diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-07-19 11:02:36 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-07-19 11:02:36 +0000 |
commit | d75b206f1cf044a2755661bfda6e1c2176194d27 (patch) | |
tree | 872f1a5b931616845d9c8c0719fbc6ee2f240708 /lib/make/configure.in | |
parent | 5e8a6d12850955880b0aba398e4c3b6386c32e41 (diff) |
Cactus' autodetection of Fortran's real*16 does currently not work; it
always detects it as "not present", even if the message printed to the
screen during configuration says "present". The enclosed patch
corrects this:
Rename the detecting autoconf macro from CCTK_PROG_FORTRAN_REAL16 to
CCTK_FORTRAN_REAL16. This follows the usual autoconf naming
conventions; see e.g. CCTK_CXX_BOOL. Also rename the return value (a
global variable) from fortran_does_real16 to
cctk_cv_have_fortran_real16.
In this macro, use the function AC_TRY_COMPILE instead of
AC_TRY_COMPILER. The difference is that this then only compiles, it
does not try to link and execute. Executing would require handling
cross-compiling in a special way.
Replace the autoconf macro AC_TRY_COMPILE by CCTK_TRY_COMPILE,
correcting an error in handling Fortran programmes. AC_TRY_COMPILE
does not work for Fortran in autoconf 2.13.
Move setting the compiler debug and warning flags further up in
configure.in, so that the Fortran 77 compiler flags, which may be
copied from the Fortran 90 compiler flags, are correct when the
Fortran types are detected. Otherwise the wrong Fortran 77 compiler
may be used for this test.
Add autodetection for all the Fortran types real*4, real*8, real*16,
complex*8, complex*16, and complex*32. Make this result available to
thorns as HAVE_CCTK_FORTRAN_xxx.
Define the CCTK_REALxxx and HAVE_CCTK_REALxxx macros only if the
corresponding real and complex types are available in both C and
Fortran.
Remove some leftover debugging statements.
Tested on Darwin-x86 with gcc and Linux-x86 with Intel.
Touche force-reconfigure.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4351 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/make/configure.in')
-rw-r--r-- | lib/make/configure.in | 265 |
1 files changed, 135 insertions, 130 deletions
diff --git a/lib/make/configure.in b/lib/make/configure.in index 7bc0985f..848cdc78 100644 --- a/lib/make/configure.in +++ b/lib/make/configure.in @@ -19,6 +19,7 @@ dnl Starts here AC_INIT() AC_CONFIG_HEADER(cctk_Config.h) + ####################################################################### # determine WARN_MODE from the WARN option # if this option isn't set WARN_MODE will default to 'no' @@ -36,6 +37,38 @@ fi ####################################################################### +# determine DEBUG_MODE from the DEBUG option +# if this option isn't set DEBUG_MODE will default to 'no' +if test -n "$DEBUG" ; then + changequote({, }) + DEBUG=`echo $DEBUG | tr '[:upper:]' '[:lower:]'` + changequote([, ]) +fi + +if test -n "$DEBUG" -a "$DEBUG" != 'no' ; then + AC_DEFINE(CCTK_DEBUG) + case "$DEBUG" in + memory) + AC_DEFINE(CCTK_TRACEMEMORY) + ;; + flags|yes) + DEBUG_FLAGS='yes' + ;; + defines) + AC_DEFINE(DEBUG) + ;; + all) + AC_DEFINE(CCTK_TRACEMEMORY) + DEBUG_FLAGS='yes' + ;; + *) + AC_ERROR(Didn't recognize setting of DEBUG=\"$DEBUG\") + ;; + esac +fi + + +####################################################################### # determine OPTIMISE_MODE from the OPTIMISE/OPTIMIZE option # if this option isn't set OPTIMISE_MODE will default to 'yes' @@ -212,14 +245,105 @@ fi # Finish the architecture stuff CCTK_WriteLine cctk_Archdefs.h '#endif /* _CCTK_ARCHDEFS_H_ */' + + +# Set the warn flags +AC_SUBST(WARN_MODE) + +# Set the warning flags if they've not been set by now +# (using GNU compiler warning flags as a reasonable default) +AC_SUBST(C_WARN_FLAGS) +if test -z "$C_WARN_FLAGS" -a "$CC" = 'gcc' ; then + C_WARN_FLAGS='-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline' +else + : ${C_WARN_FLAGS=''} +fi + +AC_SUBST(CXX_WARN_FLAGS) +if test -z "$CXX_WARN_FLAGS" -a \( "$CXX" = 'c++' -o "$CXX" = 'g++' \) ; then + CXX_WARN_FLAGS='-Wall -W -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Winline -Woverloaded-virtual' +else + : ${CXX_WARN_FLAGS=''} +fi + +AC_SUBST(F77_WARN_FLAGS) +if test -z "$F77_WARN_FLAGS" -a "$F77" = 'g77' ; then + F77_WARN_FLAGS='-Wall' +else + : ${F77_WARN_FLAGS=''} +fi + +AC_SUBST(F90_WARN_FLAGS) +: ${F90_WARN_FLAGS=''} + + +AC_SUBST(DEBUG_MODE) +DEBUG_MODE='no' +if test -n "$DEBUG_FLAGS"; then + DEBUG_MODE=$DEBUG_FLAGS +fi + +# Set the debug flags if they've not been set by now +# (using '-g' as a reasonable default) +AC_SUBST(C_DEBUG_FLAGS) +: ${C_DEBUG_FLAGS='-g'} + +AC_SUBST(CXX_DEBUG_FLAGS) +: ${CXX_DEBUG_FLAGS='-g'} + +AC_SUBST(F77_DEBUG_FLAGS) +: ${F77_DEBUG_FLAGS='-g'} + +AC_SUBST(F90_DEBUG_FLAGS) +: ${F90_DEBUG_FLAGS='-g'} + + +# Set the optimization flags if they've not been set by now +# (using '-O2' as a reasonable default) +AC_SUBST(OPTIMISE_MODE) + +AC_SUBST(C_OPTIMISE_FLAGS) +: ${C_OPTIMISE_FLAGS='-O2'} + +AC_SUBST(CXX_OPTIMISE_FLAGS) +: ${CXX_OPTIMISE_FLAGS='-O2'} + +AC_SUBST(F77_OPTIMISE_FLAGS) +if test -z "$F77_OPTIMISE_FLAGS" -a "$F77" = 'g77' ; then + F77_OPTIMISE_FLAGS='-O2' +else + : ${F77_OPTIMISE_FLAGS=''} +fi + +AC_SUBST(F90_OPTIMISE_FLAGS) +: ${F90_OPTIMISE_FLAGS=''} + + +# Set the profiling flags if they've not been set by now +# (using '-pg' as a reasonable default) +AC_SUBST(PROFILE_MODE) + +AC_SUBST(C_PROFILE_FLAGS) +: ${C_PROFILE_FLAGS='-pg'} + +AC_SUBST(CXX_PROFILE_FLAGS) +: ${CXX_PROFILE_FLAGS='-pg'} + +AC_SUBST(F77_PROFILE_FLAGS) +: ${F77_PROFILE_FLAGS='-pg'} + +AC_SUBST(F90_PROFILE_FLAGS) +: ${F90_PROFILE_FLAGS='-pg'} + ########################################################################## -######################################################################### # The known architecture stuff has probably set the LIBS variable # So remember what it is and set it to blank to prevent any problems with the # rest of the configure stuff. +######################################################################### + KNOWN_LIBS="$LIBS" unset LIBS @@ -535,11 +659,13 @@ CCTK_CHECK_CXX_RESTRICT CCTK_C_BOOL CCTK_CXX_BOOL -CCTK_PROG_FORTRAN_REAL16_WORKS -AC_PROG_CXX_GNU -if test "$fortran_does_real16" = 'yes'; then - AC_DEFINE(HAVE_FORTRAN_REAL16) -fi +CCTK_FORTRAN_REAL4 +CCTK_FORTRAN_REAL8 +CCTK_FORTRAN_REAL16 + +CCTK_FORTRAN_COMPLEX8 +CCTK_FORTRAN_COMPLEX16 +CCTK_FORTRAN_COMPLEX32 dnl Do we have crypt(3) CCTK_CHECK_FUNC(crypt, , CCTK_CHECK_LIB_FUNC(crypt, crypt)) @@ -659,10 +785,6 @@ if test -n "$CCTK_INT1" ; then fi # Float types -echo "Float types" -echo "x$ac_cv_sizeof_long_double" -echo "x$ac_cv_sizeof_double" -echo "x$ac_cv_sizeof_float" case "x$ac_cv_sizeof_long_double" in 'x16') CCTK_REAL16='long double' ;; @@ -694,17 +816,17 @@ if test "x$DISABLE_REAL16" != 'xyes' -a "x$DISABLE_REAL16" != 'xno' -a "x$DISABL AC_ERROR([Didn't recognise setting of DISABLE_REAL16=\"$DISABLE_REAL16\"; should be either \"yes\" or \"no\" or \"\" (empty)]) fi -if test -n "$CCTK_REAL16" -a "x$DISABLE_REAL16" != 'xyes' -a -n "$HAVE_FORTRAN_REAL16" ; then +if test -n "$CCTK_REAL16" -a "x$cctk_cv_have_fortran_real16" = 'xyes' -a "x$cctk_cv_have_fortran_complex32" = 'xyes' -a "x$DISABLE_REAL16" != 'xyes' ; then AC_DEFINE_UNQUOTED(CCTK_REAL16, $CCTK_REAL16) AC_DEFINE(HAVE_CCTK_REAL16) fi -if test -n "$CCTK_REAL8" ; then +if test -n "$CCTK_REAL8" -a "x$cctk_cv_have_fortran_real8" -a "x$cctk_cv_have_fortran_complex16" = 'xyes' ; then AC_DEFINE_UNQUOTED(CCTK_REAL8, $CCTK_REAL8) AC_DEFINE(HAVE_CCTK_REAL8) fi -if test -n "$CCTK_REAL4" ; then +if test -n "$CCTK_REAL4" -a "x$cctk_cv_have_fortran_real4" = 'xyes' -a "x$cctk_cv_have_fortran_complex8" = 'xyes' ; then AC_DEFINE_UNQUOTED(CCTK_REAL4, $CCTK_REAL4) AC_DEFINE(HAVE_CCTK_REAL4) fi @@ -807,123 +929,6 @@ AC_SUBST(FCOMPILEONLY) : ${FCOMPILEONLY='-c -o'} -####################################################################### -# determine DEBUG_MODE from the DEBUG option -# if this option isn't set DEBUG_MODE will default to 'no' -if test -n "$DEBUG" ; then - changequote({, }) - DEBUG=`echo $DEBUG | tr '[:upper:]' '[:lower:]'` - changequote([, ]) -fi - -if test -n "$DEBUG" -a "$DEBUG" != 'no' ; then - AC_DEFINE(CCTK_DEBUG) - case "$DEBUG" in - memory) - AC_DEFINE(CCTK_TRACEMEMORY) - ;; - flags|yes) - DEBUG_FLAGS='yes' - ;; - defines) - AC_DEFINE(DEBUG) - ;; - all) - AC_DEFINE(CCTK_TRACEMEMORY) - DEBUG_FLAGS='yes' - ;; - *) - AC_ERROR(Didn't recognize setting of DEBUG=\"$DEBUG\") - ;; - esac -fi - -AC_SUBST(DEBUG_MODE) -DEBUG_MODE='no' -if test -n "$DEBUG_FLAGS"; then - DEBUG_MODE=$DEBUG_FLAGS -fi - -# Set the debug flags if they've not been set by now -# (using '-g' as a reasonable default) -AC_SUBST(C_DEBUG_FLAGS) -: ${C_DEBUG_FLAGS='-g'} - -AC_SUBST(CXX_DEBUG_FLAGS) -: ${CXX_DEBUG_FLAGS='-g'} - -AC_SUBST(F77_DEBUG_FLAGS) -: ${F77_DEBUG_FLAGS='-g'} - -AC_SUBST(F90_DEBUG_FLAGS) -: ${F90_DEBUG_FLAGS='-g'} - -# Set the warn flags -AC_SUBST(WARN_MODE) - -# Set the warning flags if they've not been set by now -# (using GNU compiler warning flags as a reasonable default) -AC_SUBST(C_WARN_FLAGS) -if test -z "$C_WARN_FLAGS" -a "$CC" = 'gcc' ; then - C_WARN_FLAGS='-Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Winline' -else - : ${C_WARN_FLAGS=''} -fi - -AC_SUBST(CXX_WARN_FLAGS) -if test -z "$CXX_WARN_FLAGS" -a \( "$CXX" = 'c++' -o "$CXX" = 'g++' \) ; then - CXX_WARN_FLAGS='-Wall -W -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Winline -Woverloaded-virtual' -else - : ${CXX_WARN_FLAGS=''} -fi - -AC_SUBST(F77_WARN_FLAGS) -if test -z "$F77_WARN_FLAGS" -a "$F77" = 'g77' ; then - F77_WARN_FLAGS='-Wall' -else - : ${F77_WARN_FLAGS=''} -fi - -AC_SUBST(F90_WARN_FLAGS) -: ${F90_WARN_FLAGS=''} - -# Set the optimization flags if they've not been set by now -# (using '-O2' as a reasonable default) -AC_SUBST(OPTIMISE_MODE) - -AC_SUBST(C_OPTIMISE_FLAGS) -: ${C_OPTIMISE_FLAGS='-O2'} - -AC_SUBST(CXX_OPTIMISE_FLAGS) -: ${CXX_OPTIMISE_FLAGS='-O2'} - -AC_SUBST(F77_OPTIMISE_FLAGS) -if test -z "$F77_OPTIMISE_FLAGS" -a "$F77" = 'g77' ; then - F77_OPTIMISE_FLAGS='-O2' -else - : ${F77_OPTIMISE_FLAGS=''} -fi - -AC_SUBST(F90_OPTIMISE_FLAGS) -: ${F90_OPTIMISE_FLAGS=''} - -# Set the profiling flags if they've not been set by now -# (using '-pg' as a reasonable default) -AC_SUBST(PROFILE_MODE) - -AC_SUBST(C_PROFILE_FLAGS) -: ${C_PROFILE_FLAGS='-pg'} - -AC_SUBST(CXX_PROFILE_FLAGS) -: ${CXX_PROFILE_FLAGS='-pg'} - -AC_SUBST(F77_PROFILE_FLAGS) -: ${F77_PROFILE_FLAGS='-pg'} - -AC_SUBST(F90_PROFILE_FLAGS) -: ${F90_PROFILE_FLAGS='-pg'} - - # Set the createexe flag if it's not been set by now AC_SUBST(CREATEEXE) : ${CREATEEXE='-o'} |