diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-08-30 09:27:05 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-08-30 09:27:05 +0000 |
commit | 1fba87d3e55636b2151eb7f0ab985d0b807fd202 (patch) | |
tree | 386a619b8447e3c86f5b819ff834295714eba0ea /lib/make/configure.in | |
parent | 4fdc99855d3e2706fd6c84d12841eb8cbd43ef3f (diff) |
Erik's patch to also check for the '__restrict__' or '__restrict' keywords
being recognized by the C compiler as the restrict qualifier.
This closes PR Cactus 1112.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2990 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make/configure.in')
-rw-r--r-- | lib/make/configure.in | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/lib/make/configure.in b/lib/make/configure.in index 1b837a0e..1a82a215 100644 --- a/lib/make/configure.in +++ b/lib/make/configure.in @@ -204,25 +204,24 @@ fi AC_C_CONST AC_C_INLINE -dnl Check for the presence of the restrict keyword -AC_MSG_CHECKING([for restrict]) -AC_CACHE_VAL(cctk_cv_have_restrict, -[AC_TRY_COMPILE([ -int foo(double * restrict a, double * restrict b) -{ - return 0; -}], -, eval "cctk_cv_have_restrict=yes", -eval "cctk_cv_have_restrict=no") +dnl Do nothing if the compiler accepts the restrict keyword. +dnl Otherwise define restrict to __restrict__ or __restrict if one of +dnl those work, otherwise define restrict to be empty. +AC_DEFUN(AC_C_RESTRICT, +[AC_CACHE_CHECK([for restrict], ac_cv_c_restrict, +[ac_cv_c_restrict=no +for ac_kw in restrict __restrict__ __restrict; do + AC_TRY_COMPILE(, [double * $ac_kw foo;], [ac_cv_c_restrict=$ac_kw; break]) +done +]) +case "$ac_cv_c_restrict" in + restrict | yes) ;; + no) AC_DEFINE(restrict, ) ;; + *) AC_DEFINE_UNQUOTED(restrict, $ac_cv_c_restrict) ;; +esac ]) -if test "$cctk_cv_have_restrict" = "yes"; then - AC_DEFINE(restrict,restrict) - AC_MSG_RESULT(yes) -else - AC_DEFINE(restrict,) - AC_MSG_RESULT(no) -fi +AC_C_RESTRICT # Check for sizes of integer types |