diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-03-13 19:26:16 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2003-03-13 19:26:16 +0000 |
commit | 841cbf6f63668e286a580ede386af719a05ae50b (patch) | |
tree | fc97293791db99e5073ef5cf027c33ff852815c1 /lib/make/aclocal.m4 | |
parent | 5a4c7464ba9c1de348dbf3bebd8c6f74d6b29026 (diff) |
Some changes prompted by PR/1320:
Added #define of SIZEOF_LONG_LONG to cctk_Config.h.in
Added macros which detect the presence of bool in C and restrict in C++.
Currently these define CCTK_... macros but don't #define bool in C or
restrict in C++ as these would be non-standard features which might
conflict with user-written macros or code.
Moved AC_C_RESTRICT macro to aclocal.m4 and renamed it to CCTK_C_RESTRICT to
conform with autoconf naming conventions.
Created macro for detecting presence of bool in CXX and changed to use the
macro.
A little bit of tidying up of cctk_Config.h.in to make the file a bit easier to
read.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3173 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make/aclocal.m4')
-rw-r--r-- | lib/make/aclocal.m4 | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lib/make/aclocal.m4 b/lib/make/aclocal.m4 index 1f832325..2c73f094 100644 --- a/lib/make/aclocal.m4 +++ b/lib/make/aclocal.m4 @@ -273,3 +273,60 @@ changequote([, ])dnl ifelse([$4], , , [$4 ])dnl ]) + +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(CCTK_CHECK_C_RESTRICT, +[AC_CACHE_CHECK([for C restrict], cctk_cv_c_restrict, +[cctk_cv_c_restrict=no +for ac_kw in restrict __restrict__ __restrict; do + AC_TRY_COMPILE(, [double * $ac_kw foo;], [cctk_cv_c_restrict=$ac_kw; break]) +done +]) +case "$cctk_cv_c_restrict" in + restrict | yes) ;; + no) AC_DEFINE(CCTK_C_RESTRICT, ) ;; + *) AC_DEFINE_UNQUOTED(CCTK_C_RESTRICT, $cctk_cv_c_restrict) ;; +esac +]) + +AC_DEFUN(CCTK_CHECK_CXX_RESTRICT, +[AC_CACHE_CHECK([for C++ restrict], cctk_cv_cxx_restrict, +[cctk_cv_cxx_restrict=no +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +for ac_kw in restrict __restrict__ __restrict; do + AC_TRY_COMPILE(, [double * $ac_kw foo;], [cctk_cv_cxx_restrict=$ac_kw; break]) +done +AC_LANG_RESTORE +]) +case "$cctk_cv_cxx_restrict" in + restrict | yes) ;; + no) AC_DEFINE(CCTK_CXX_RESTRICT, ) ;; + *) AC_DEFINE_UNQUOTED(CCTK_CXX_RESTRICT, $cctk_cv_cxx_restrict) ;; +esac +]) + +AC_DEFUN(CCTK_C_BOOL, +[AC_CACHE_CHECK([for C bool], cctk_cv_have_c_bool, +[cctk_cv_have_c_bool=no +AC_TRY_COMPILE(, bool foo;, cctk_cv_have_c_bool=yes, cctk_cv_have_c_bool=no) +]) +if test "$cctk_cv_have_c_bool" = "yes" ; then + AC_DEFINE(CCTK_HAVE_C_BOOL) +fi +]) + +AC_DEFUN(CCTK_CXX_BOOL, +[AC_CACHE_CHECK([for CXX bool], cctk_cv_have_cxx_bool, +[cctk_cv_have_cxx_bool=no +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILE(, bool foo;, cctk_cv_have_cxx_bool=yes, cctk_cv_have_cxx_bool=no) +AC_LANG_RESTORE +]) +if test "$cctk_cv_have_cxx_bool" = "yes" ; then + AC_DEFINE(CCTK_HAVE_CXX_BOOL) +fi +]) |