acinclude.m4 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. dnl This test is taken from libgfortran
  2. dnl Check whether the target supports __sync_val_compare_and_swap.
  3. AC_DEFUN([STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP], [
  4. AC_CACHE_CHECK([whether the target supports __sync_val_compare_and_swap],
  5. ac_cv_have_sync_val_compare_and_swap, [
  6. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  7. [bar = __sync_val_compare_and_swap(&foo, 0, 1);])],
  8. [ac_cv_have_sync_val_compare_and_swap=yes],
  9. [ac_cv_have_sync_val_compare_and_swap=no])])
  10. if test $ac_cv_have_sync_val_compare_and_swap = yes; then
  11. AC_DEFINE(STARPU_HAVE_SYNC_VAL_COMPARE_AND_SWAP, 1,
  12. [Define to 1 if the target supports __sync_val_compare_and_swap])
  13. fi])
  14. dnl Check whether the target supports __sync_bool_compare_and_swap.
  15. AC_DEFUN([STARPU_CHECK_SYNC_BOOL_COMPARE_AND_SWAP], [
  16. AC_CACHE_CHECK([whether the target supports __sync_bool_compare_and_swap],
  17. ac_cv_have_sync_bool_compare_and_swap, [
  18. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  19. [bar = __sync_bool_compare_and_swap(&foo, 0, 1);])],
  20. [ac_cv_have_sync_bool_compare_and_swap=yes],
  21. [ac_cv_have_sync_bool_compare_and_swap=no])])
  22. if test $ac_cv_have_sync_bool_compare_and_swap = yes; then
  23. AC_DEFINE(STARPU_HAVE_SYNC_BOOL_COMPARE_AND_SWAP, 1,
  24. [Define to 1 if the target supports __sync_bool_compare_and_swap])
  25. fi])
  26. dnl Check whether the target supports __sync_fetch_and_add.
  27. AC_DEFUN([STARPU_CHECK_SYNC_FETCH_AND_ADD], [
  28. AC_CACHE_CHECK([whether the target supports __sync_fetch_and_add],
  29. ac_cv_have_sync_fetch_and_add, [
  30. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  31. [bar = __sync_fetch_and_add(&foo, 1);])],
  32. [ac_cv_have_sync_fetch_and_add=yes],
  33. [ac_cv_have_sync_fetch_and_add=no])])
  34. if test $ac_cv_have_sync_fetch_and_add = yes; then
  35. AC_DEFINE(STARPU_HAVE_SYNC_FETCH_AND_ADD, 1,
  36. [Define to 1 if the target supports __sync_fetch_and_add])
  37. fi])
  38. dnl Check whether the target supports __sync_fetch_and_or.
  39. AC_DEFUN([STARPU_CHECK_SYNC_FETCH_AND_OR], [
  40. AC_CACHE_CHECK([whether the target supports __sync_fetch_and_or],
  41. ac_cv_have_sync_fetch_and_or, [
  42. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  43. [bar = __sync_fetch_and_or(&foo, 1);])],
  44. [ac_cv_have_sync_fetch_and_or=yes],
  45. [ac_cv_have_sync_fetch_and_or=no])])
  46. if test $ac_cv_have_sync_fetch_and_or = yes; then
  47. AC_DEFINE(STARPU_HAVE_SYNC_FETCH_AND_OR, 1,
  48. [Define to 1 if the target supports __sync_fetch_and_or])
  49. fi])
  50. dnl Check whether the target supports __sync_lock_test_and_set.
  51. AC_DEFUN([STARPU_CHECK_SYNC_LOCK_TEST_AND_SET], [
  52. AC_CACHE_CHECK([whether the target supports __sync_lock_test_and_set],
  53. ac_cv_have_sync_lock_test_and_set, [
  54. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  55. [bar = __sync_lock_test_and_set(&foo, 1);])],
  56. [ac_cv_have_sync_lock_test_and_set=yes],
  57. [ac_cv_have_sync_lock_test_and_set=no])])
  58. if test $ac_cv_have_sync_lock_test_and_set = yes; then
  59. AC_DEFINE(STARPU_HAVE_SYNC_LOCK_TEST_AND_SET, 1,
  60. [Define to 1 if the target supports __sync_lock_test_and_set])
  61. fi])
  62. dnl Check whether the target supports __sync_synchronize.
  63. AC_DEFUN([STARPU_CHECK_SYNC_SYNCHRONIZE], [
  64. AC_CACHE_CHECK([whether the target supports __sync_synchronize],
  65. ac_cv_have_sync_synchronize, [
  66. AC_LINK_IFELSE([AC_LANG_PROGRAM(,
  67. [__sync_synchronize();])],
  68. [ac_cv_have_sync_synchronize=yes],
  69. [ac_cv_have_sync_synchronize=no])])
  70. if test $ac_cv_have_sync_synchronize = yes; then
  71. AC_DEFINE(STARPU_HAVE_SYNC_SYNCHRONIZE, 1,
  72. [Define to 1 if the target supports __sync_synchronize])
  73. fi])