acinclude.m4 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. dnl Copyright (C) Free Software Foundation, Inc.
  2. dnl
  3. dnl This program is free software; you can redistribute it and/or modify
  4. dnl it under the terms of the GNU General Public License as published by
  5. dnl the Free Software Foundation; either version 2 of the License, or
  6. dnl (at your option) any later version.
  7. dnl
  8. dnl This program is distributed in the hope that it will be useful,
  9. dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. dnl GNU General Public License for more details.
  12. dnl
  13. dnl You should have received a copy of the GNU General Public License
  14. dnl along with this program; if not, write to the Free Software
  15. dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  16. dnl
  17. dnl This test is taken from libgfortran
  18. dnl Check whether the target supports __sync_val_compare_and_swap.
  19. AC_DEFUN([STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP], [
  20. AC_CACHE_CHECK([whether the target supports __sync_val_compare_and_swap],
  21. ac_cv_have_sync_val_compare_and_swap, [
  22. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  23. [bar = __sync_val_compare_and_swap(&foo, 0, 1);])],
  24. [ac_cv_have_sync_val_compare_and_swap=yes],
  25. [ac_cv_have_sync_val_compare_and_swap=no])])
  26. if test $ac_cv_have_sync_val_compare_and_swap = yes; then
  27. AC_DEFINE(STARPU_HAVE_SYNC_VAL_COMPARE_AND_SWAP, 1,
  28. [Define to 1 if the target supports __sync_val_compare_and_swap])
  29. fi])
  30. dnl Check whether the target supports __sync_bool_compare_and_swap.
  31. AC_DEFUN([STARPU_CHECK_SYNC_BOOL_COMPARE_AND_SWAP], [
  32. AC_CACHE_CHECK([whether the target supports __sync_bool_compare_and_swap],
  33. ac_cv_have_sync_bool_compare_and_swap, [
  34. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  35. [bar = __sync_bool_compare_and_swap(&foo, 0, 1);])],
  36. [ac_cv_have_sync_bool_compare_and_swap=yes],
  37. [ac_cv_have_sync_bool_compare_and_swap=no])])
  38. if test $ac_cv_have_sync_bool_compare_and_swap = yes; then
  39. AC_DEFINE(STARPU_HAVE_SYNC_BOOL_COMPARE_AND_SWAP, 1,
  40. [Define to 1 if the target supports __sync_bool_compare_and_swap])
  41. fi])
  42. dnl Check whether the target supports __sync_fetch_and_add.
  43. AC_DEFUN([STARPU_CHECK_SYNC_FETCH_AND_ADD], [
  44. AC_CACHE_CHECK([whether the target supports __sync_fetch_and_add],
  45. ac_cv_have_sync_fetch_and_add, [
  46. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  47. [bar = __sync_fetch_and_add(&foo, 1);])],
  48. [ac_cv_have_sync_fetch_and_add=yes],
  49. [ac_cv_have_sync_fetch_and_add=no])])
  50. if test $ac_cv_have_sync_fetch_and_add = yes; then
  51. AC_DEFINE(STARPU_HAVE_SYNC_FETCH_AND_ADD, 1,
  52. [Define to 1 if the target supports __sync_fetch_and_add])
  53. fi])
  54. dnl Check whether the target supports __sync_fetch_and_or.
  55. AC_DEFUN([STARPU_CHECK_SYNC_FETCH_AND_OR], [
  56. AC_CACHE_CHECK([whether the target supports __sync_fetch_and_or],
  57. ac_cv_have_sync_fetch_and_or, [
  58. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  59. [bar = __sync_fetch_and_or(&foo, 1);])],
  60. [ac_cv_have_sync_fetch_and_or=yes],
  61. [ac_cv_have_sync_fetch_and_or=no])])
  62. if test $ac_cv_have_sync_fetch_and_or = yes; then
  63. AC_DEFINE(STARPU_HAVE_SYNC_FETCH_AND_OR, 1,
  64. [Define to 1 if the target supports __sync_fetch_and_or])
  65. fi])
  66. dnl Check whether the target supports __sync_lock_test_and_set.
  67. AC_DEFUN([STARPU_CHECK_SYNC_LOCK_TEST_AND_SET], [
  68. AC_CACHE_CHECK([whether the target supports __sync_lock_test_and_set],
  69. ac_cv_have_sync_lock_test_and_set, [
  70. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  71. [bar = __sync_lock_test_and_set(&foo, 1);])],
  72. [ac_cv_have_sync_lock_test_and_set=yes],
  73. [ac_cv_have_sync_lock_test_and_set=no])])
  74. if test $ac_cv_have_sync_lock_test_and_set = yes; then
  75. AC_DEFINE(STARPU_HAVE_SYNC_LOCK_TEST_AND_SET, 1,
  76. [Define to 1 if the target supports __sync_lock_test_and_set])
  77. fi])
  78. dnl Check whether the target supports __sync_synchronize.
  79. AC_DEFUN([STARPU_CHECK_SYNC_SYNCHRONIZE], [
  80. AC_CACHE_CHECK([whether the target supports __sync_synchronize],
  81. ac_cv_have_sync_synchronize, [
  82. AC_LINK_IFELSE([AC_LANG_PROGRAM(,
  83. [__sync_synchronize();])],
  84. [ac_cv_have_sync_synchronize=yes],
  85. [ac_cv_have_sync_synchronize=no])])
  86. if test $ac_cv_have_sync_synchronize = yes; then
  87. AC_DEFINE(STARPU_HAVE_SYNC_SYNCHRONIZE, 1,
  88. [Define to 1 if the target supports __sync_synchronize])
  89. fi])