acinclude.m4 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2012 Inria
  4. # Copyright (C) 2012,2017 CNRS
  5. # Copyright (C) 2014 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_val_compare_and_swap.
  43. AC_DEFUN([STARPU_CHECK_SYNC_VAL_COMPARE_AND_SWAP], [
  44. AC_CACHE_CHECK([whether the target supports __sync_val_compare_and_swap],
  45. ac_cv_have_sync_val_compare_and_swap, [
  46. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  47. [bar = __sync_val_compare_and_swap(&foo, 0, 1);])],
  48. [ac_cv_have_sync_val_compare_and_swap=yes],
  49. [ac_cv_have_sync_val_compare_and_swap=no])])
  50. if test $ac_cv_have_sync_val_compare_and_swap = yes; then
  51. AC_DEFINE(STARPU_HAVE_SYNC_VAL_COMPARE_AND_SWAP, 1,
  52. [Define to 1 if the target supports __sync_val_compare_and_swap])
  53. fi])
  54. # Check whether the target supports __sync_fetch_and_add.
  55. AC_DEFUN([STARPU_CHECK_SYNC_FETCH_AND_ADD], [
  56. AC_CACHE_CHECK([whether the target supports __sync_fetch_and_add],
  57. ac_cv_have_sync_fetch_and_add, [
  58. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  59. [bar = __sync_fetch_and_add(&foo, 1);])],
  60. [ac_cv_have_sync_fetch_and_add=yes],
  61. [ac_cv_have_sync_fetch_and_add=no])])
  62. if test $ac_cv_have_sync_fetch_and_add = yes; then
  63. AC_DEFINE(STARPU_HAVE_SYNC_FETCH_AND_ADD, 1,
  64. [Define to 1 if the target supports __sync_fetch_and_add])
  65. fi])
  66. # Check whether the target supports __sync_fetch_and_or.
  67. AC_DEFUN([STARPU_CHECK_SYNC_FETCH_AND_OR], [
  68. AC_CACHE_CHECK([whether the target supports __sync_fetch_and_or],
  69. ac_cv_have_sync_fetch_and_or, [
  70. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  71. [bar = __sync_fetch_and_or(&foo, 1);])],
  72. [ac_cv_have_sync_fetch_and_or=yes],
  73. [ac_cv_have_sync_fetch_and_or=no])])
  74. if test $ac_cv_have_sync_fetch_and_or = yes; then
  75. AC_DEFINE(STARPU_HAVE_SYNC_FETCH_AND_OR, 1,
  76. [Define to 1 if the target supports __sync_fetch_and_or])
  77. fi])
  78. # Check whether the target supports __sync_lock_test_and_set.
  79. AC_DEFUN([STARPU_CHECK_SYNC_LOCK_TEST_AND_SET], [
  80. AC_CACHE_CHECK([whether the target supports __sync_lock_test_and_set],
  81. ac_cv_have_sync_lock_test_and_set, [
  82. AC_LINK_IFELSE([AC_LANG_PROGRAM([int foo, bar;],
  83. [bar = __sync_lock_test_and_set(&foo, 1);])],
  84. [ac_cv_have_sync_lock_test_and_set=yes],
  85. [ac_cv_have_sync_lock_test_and_set=no])])
  86. if test $ac_cv_have_sync_lock_test_and_set = yes; then
  87. AC_DEFINE(STARPU_HAVE_SYNC_LOCK_TEST_AND_SET, 1,
  88. [Define to 1 if the target supports __sync_lock_test_and_set])
  89. fi])
  90. # Check whether the target supports __sync_synchronize.
  91. AC_DEFUN([STARPU_CHECK_SYNC_SYNCHRONIZE], [
  92. AC_CACHE_CHECK([whether the target supports __sync_synchronize],
  93. ac_cv_have_sync_synchronize, [
  94. AC_LINK_IFELSE([AC_LANG_PROGRAM(,
  95. [__sync_synchronize();])],
  96. [ac_cv_have_sync_synchronize=yes],
  97. [ac_cv_have_sync_synchronize=no])])
  98. if test $ac_cv_have_sync_synchronize = yes; then
  99. AC_DEFINE(STARPU_HAVE_SYNC_SYNCHRONIZE, 1,
  100. [Define to 1 if the target supports __sync_synchronize])
  101. fi])