acinclude.m4 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2012 Inria
  4. # Copyright (C) 2012,2017 CNRS
  5. # Copyright (C) 2014,2019 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. # 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. # 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. # 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. # 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. # 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. # Check whether the target supports __atomic_compare_exchange_n.
  79. AC_DEFUN([STARPU_CHECK_ATOMIC_COMPARE_EXCHANGE_N], [
  80. AC_CACHE_CHECK([whether the target supports __atomic_compare_exchange_n],
  81. ac_cv_have_atomic_compare_exchange_n, [
  82. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar, baz;],
  83. [baz = __atomic_compare_exchange_n(&foo, &bar, 1, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);])],
  84. [ac_cv_have_atomic_compare_exchange_n=yes],
  85. [ac_cv_have_atomic_compare_exchange_n=no])])
  86. if test $ac_cv_have_atomic_compare_exchange_n = yes; then
  87. AC_DEFINE(STARPU_HAVE_ATOMIC_COMPARE_EXCHANGE_N, 1,
  88. [Define to 1 if the target supports __atomic_compare_exchange_n])
  89. fi])
  90. # Check whether the target supports __atomic_exchange_n.
  91. AC_DEFUN([STARPU_CHECK_ATOMIC_EXCHANGE_N], [
  92. AC_CACHE_CHECK([whether the target supports __atomic_exchange_n],
  93. ac_cv_have_atomic_exchange_n, [
  94. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  95. [bar = __atomic_exchange_n(&foo, 1, __ATOMIC_SEQ_CST);])],
  96. [ac_cv_have_atomic_exchange_n=yes],
  97. [ac_cv_have_atomic_exchange_n=no])])
  98. if test $ac_cv_have_atomic_exchange_n = yes; then
  99. AC_DEFINE(STARPU_HAVE_ATOMIC_EXCHANGE_N, 1,
  100. [Define to 1 if the target supports __atomic_exchange_n])
  101. fi])
  102. # Check whether the target supports __atomic_fetch_add.
  103. AC_DEFUN([STARPU_CHECK_ATOMIC_FETCH_ADD], [
  104. AC_CACHE_CHECK([whether the target supports __atomic_fetch_add],
  105. ac_cv_have_atomic_fetch_add, [
  106. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  107. [bar = __atomic_fetch_add(&foo, 1, __ATOMIC_SEQ_CST);])],
  108. [ac_cv_have_atomic_fetch_add=yes],
  109. [ac_cv_have_atomic_fetch_add=no])])
  110. if test $ac_cv_have_atomic_fetch_add = yes; then
  111. AC_DEFINE(STARPU_HAVE_ATOMIC_FETCH_ADD, 1,
  112. [Define to 1 if the target supports __atomic_fetch_add])
  113. fi])
  114. # Check whether the target supports __atomic_fetch_or.
  115. AC_DEFUN([STARPU_CHECK_ATOMIC_FETCH_OR], [
  116. AC_CACHE_CHECK([whether the target supports __atomic_fetch_or],
  117. ac_cv_have_atomic_fetch_or, [
  118. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  119. [bar = __atomic_fetch_or(&foo, 1, __ATOMIC_SEQ_CST);])],
  120. [ac_cv_have_atomic_fetch_or=yes],
  121. [ac_cv_have_atomic_fetch_or=no])])
  122. if test $ac_cv_have_atomic_fetch_or = yes; then
  123. AC_DEFINE(STARPU_HAVE_ATOMIC_FETCH_OR, 1,
  124. [Define to 1 if the target supports __atomic_fetch_or])
  125. fi])
  126. # Check whether the target supports __atomic_test_and_set.
  127. AC_DEFUN([STARPU_CHECK_ATOMIC_TEST_AND_SET], [
  128. AC_CACHE_CHECK([whether the target supports __atomic_test_and_set],
  129. ac_cv_have_atomic_test_and_set, [
  130. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  131. [bar = __atomic_test_and_set(&foo, __ATOMIC_SEQ_CST);])],
  132. [ac_cv_have_atomic_test_and_set=yes],
  133. [ac_cv_have_atomic_test_and_set=no])])
  134. if test $ac_cv_have_atomic_test_and_set = yes; then
  135. AC_DEFINE(STARPU_HAVE_ATOMIC_TEST_AND_SET, 1,
  136. [Define to 1 if the target supports __atomic_test_and_set])
  137. fi])
  138. # Check whether the target supports __sync_synchronize.
  139. AC_DEFUN([STARPU_CHECK_SYNC_SYNCHRONIZE], [
  140. AC_CACHE_CHECK([whether the target supports __sync_synchronize],
  141. ac_cv_have_sync_synchronize, [
  142. AC_LINK_IFELSE([AC_LANG_PROGRAM(,
  143. [__sync_synchronize();])],
  144. [ac_cv_have_sync_synchronize=yes],
  145. [ac_cv_have_sync_synchronize=no])])
  146. if test $ac_cv_have_sync_synchronize = yes; then
  147. AC_DEFINE(STARPU_HAVE_SYNC_SYNCHRONIZE, 1,
  148. [Define to 1 if the target supports __sync_synchronize])
  149. fi])