libs.m4 2.5 KB

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