libs.m4 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2011-2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. #
  5. # StarPU is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU Lesser General Public License as published by
  7. # the Free Software Foundation; either version 2.1 of the License, or (at
  8. # your option) any later version.
  9. #
  10. # StarPU is distributed in the hope that it will be useful, but
  11. # WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. #
  14. # See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. #
  16. # STARPU_SEARCH_LIBS(NAME, FUNCTION, SEARCH-LIBS,
  17. # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
  18. # [OTHER-LIBRARIES])
  19. #
  20. # Like AC_SEARCH_LIBS, but puts -l flags into $1_LDFLAGS instead of LIBS, and
  21. # AC_SUBSTs it
  22. AC_DEFUN([STARPU_SEARCH_LIBS], [dnl
  23. _LIBS_SAV="$LIBS"
  24. LIBS=""
  25. AC_SEARCH_LIBS([$2], [$3], [$4], [$5], [$6])
  26. STARPU_$1_LDFLAGS="$STARPU_$1_LDFLAGS $LIBS"
  27. LIBS=$_LIBS_SAV
  28. AC_SUBST(STARPU_$1_LDFLAGS)
  29. ])dnl
  30. # STARPU_CHECK_LIB(NAME, LIBRARY, FUNCTION,
  31. # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
  32. # [OTHER-LIBRARIES])
  33. #
  34. # Like AC_CHECK_LIB, but puts -l flags into $1_LDFLAGS instead of LIBS, and
  35. # AC_SUBSTs it
  36. AC_DEFUN([STARPU_CHECK_LIB], [dnl
  37. _LIBS_SAV="$LIBS"
  38. LIBS=""
  39. AC_CHECK_LIB([$2], [$3], [$4], [$5], [$6])
  40. STARPU_$1_LDFLAGS="$STARPU_$1_LDFLAGS $LIBS"
  41. LIBS=$_LIBS_SAV
  42. AC_SUBST(STARPU_$1_LDFLAGS)
  43. ])dnl
  44. # STARPU_HAVE_LIBRARY(NAME, LIBRARY,
  45. # [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
  46. # [OTHER-LIBRARIES])
  47. # Like AC_HAVE_LIBRARY, but puts -l flags into $1_LDFLAGS instead of LIBS, and
  48. # AC_SUBSTs it
  49. AC_DEFUN([STARPU_HAVE_LIBRARY], [dnl
  50. STARPU_CHECK_LIB([$1], [$2], main, [$3], [$4], [$5])
  51. ])dnl
  52. # STARPU_INIT_ZERO(INCLUDES, TYPE, INIT_MACRO)
  53. # Checks whether when TYPE is initialized with INIT_MACRO, the content is just
  54. # plain zeroes
  55. AC_DEFUN([STARPU_INIT_ZERO], [dnl
  56. AC_MSG_CHECKING(whether $3 just zeroes)
  57. AC_RUN_IFELSE([AC_LANG_PROGRAM(
  58. $1,
  59. [[$2 var = $3;
  60. char *p;
  61. for (p = (char*) &var; p < (char*) (&var+1); p++)
  62. if (*p != 0)
  63. return 1;
  64. return 0;
  65. ]],
  66. )],
  67. [AC_DEFINE([STARPU_$3_ZERO], [1], [Define to 1 if `$3' is just zeroes])
  68. AC_MSG_RESULT(yes)],
  69. [AC_MSG_RESULT(no)])
  70. ])dnl