diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2011-09-27 05:02:38 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2011-09-27 05:02:38 (GMT) |
commit | 4af3cd2b7a89b2eeed05d5ec0b0641ca7c2545bc (patch) | |
tree | 01f90619962c447280074bb8d10ae5c7b2b9acbc /configure.in | |
parent | a07004c825e3a4e4b61269fd3e5f2b57092f073c (diff) | |
download | hdf5-4af3cd2b7a89b2eeed05d5ec0b0641ca7c2545bc.zip hdf5-4af3cd2b7a89b2eeed05d5ec0b0641ca7c2545bc.tar.gz hdf5-4af3cd2b7a89b2eeed05d5ec0b0641ca7c2545bc.tar.bz2 |
[svn-r21421] Merged the Fortran 2003 changes from the trunk into the 1.8 branch, used:
svn merge -r 20506:21414 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/fortran
Tested: jam (gnu, intel, pgi compilers)
Also merged effected non-Fortran files:
svn merge -r21247:r21248 https://svn.hdfgroup.uiuc.edu/hdf5/trunk/src/libhdf5.settings.in
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 190 |
1 files changed, 166 insertions, 24 deletions
diff --git a/configure.in b/configure.in index dd2934f..93201d4 100644 --- a/configure.in +++ b/configure.in @@ -154,6 +154,7 @@ dnl EXTERNAL_FILTERS equals all external filters. Default none. dnl MPE: whether MPE option is enabled. Default no. dnl STATIC_EXEC: whether static-exec is enabled. Default no. dnl HDF_FORTRAN: whether Fortran is enabled. Default no. +dnl HDF_FORTRAN2003: whether Fortran 2003 is enabled. Default no. dnl FC: Fortran compiler. dnl HDF_CXX: whether C++ is enabled. Default no. dnl CXX: C++ compiler. @@ -174,7 +175,9 @@ AC_SUBST(EXTERNAL_FILTERS) AC_SUBST(MPE) MPE=no AC_SUBST(STATIC_EXEC) STATIC_EXEC=no AC_SUBST(HDF_FORTRAN) HDF_FORTRAN=no +AC_SUBST(HDF_FORTRAN2003) HDF_FORTRAN2003=no AC_SUBST(FC) HDF_FORTRAN=no +AC_SUBST(FC2003) HDF_FORTRAN2003=no AC_SUBST(HDF_CXX) HDF_CXX=no AC_SUBST(CXX) HDF_CXX=no AC_SUBST(HDF5_HL) HDF5_HL=yes @@ -369,19 +372,53 @@ AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES="" AC_MSG_CHECKING([if Fortran interface enabled]) AC_ARG_ENABLE([fortran], [AC_HELP_STRING([--enable-fortran], - [Compile the Fortran interface [default=no]])], + [Compile the Fortran 77/90/95 interface [default=no]])], [HDF_FORTRAN=$enableval]) +if test "X$HDF_FORTRAN" = "Xyes"; then + echo "yes" +else + echo "no" +fi + + +dnl ---------------------------------------------------------------------- +dnl Check if they would like the Fortran 2003 interface compiled +dnl +AC_MSG_CHECKING([if Fortran 2003 interface enabled]) +AC_ARG_ENABLE([fortran2003], + [AC_HELP_STRING([--enable-fortran2003], + [Compile the Fortran 2003 interface, must also specify --enable-fortran [default=no]])], + [HDF_FORTRAN2003=$enableval]) + +dnl ---------------------------------------------------------------------- +dnl Check to make sure --enable-fortran is present if --enable-fortran2003 +dnl was specified + +if test "X$HDF_FORTRAN2003" = "Xyes" && test "X$HDF_FORTRAN" = "Xno"; then + echo "yes" + AC_MSG_ERROR([--enable-fortran must be used with --enable-fortran2003]) +else + echo "no" +fi HAVE_SIZEOF="no" -FORTRAN_DEFAULT_REALisDBLE="no" +FORTRAN_DEFAULT_REALisDBLE="no" if test "X$HDF_FORTRAN" = "Xyes"; then - echo "yes" + AC_SUBST(FC) HDF_FORTRAN=yes + AC_SUBST([HAVE_FORTRAN_2003]) + HDF5_INTERFACES="$HDF5_INTERFACES fortran" dnl -------------------------------------------------------------------- + dnl Default for FORTRAN 2003 compliant compilers + dnl + HAVE_FORTRAN_2003="no" + HAVE_ISO_C_BINDING="no" + + dnl -------------------------------------------------------------------- dnl HDF5 integer variables for the H5fortran_types.f90 file. dnl AC_SUBST([R_LARGE]) @@ -429,19 +466,19 @@ if test "X$HDF_FORTRAN" = "Xyes"; then dnl -------------------------------------------------------------------- dnl See if the compiler will support the "-I." option dnl -dnl AM_FCFLAGS_saved=$AM_FCFLAGS -dnl AM_FCFLAGS="${AM_FCFLAGS} -I." + dnl AM_FCFLAGS_saved=$AM_FCFLAGS + dnl AM_FCFLAGS="${AM_FCFLAGS} -I." -dnl AC_MSG_CHECKING(if compiler supports -I. option) -dnl AC_TRY_FCOMPILE([ -dnl program conftest -dnl end -dnl ], AC_MSG_RESULT(yes), -dnl AC_MSG_RESULT(no) -dnl AM_FCFLAGS="$AM_FCFLAGS_saved") + dnl AC_MSG_CHECKING(if compiler supports -I. option) + dnl AC_TRY_FCOMPILE([ + dnl program conftest + dnl end + dnl ], AC_MSG_RESULT(yes), + dnl AC_MSG_RESULT(no) + dnl AM_FCFLAGS="$AM_FCFLAGS_saved") -dnl -------------------------------------------------------------------- -dnl See if the fortran compiler supports the intrinsic function "SIZEOF" + dnl -------------------------------------------------------------------- + dnl See if the fortran compiler supports the intrinsic function "SIZEOF" AC_MSG_CHECKING([if Fortran compiler supports intrinsic SIZEOF]) AC_TRY_RUN([ @@ -452,10 +489,8 @@ dnl See if the fortran compiler supports the intrinsic function "SIZEOF" HAVE_SIZEOF="yes"], AC_MSG_RESULT(no)) - -dnl Check to see if -r8 was specified to determine if we need to -dnl compile the DOUBLE PRECISION interfaces. - + dnl Check to see if -r8 was specified to determine if we need to + dnl compile the DOUBLE PRECISION interfaces. AC_MSG_CHECKING([if Fortran default REAL is DOUBLE PRECISION]) @@ -484,14 +519,121 @@ dnl compile the DOUBLE PRECISION interfaces. AC_MSG_RESULT(no), [AC_MSG_RESULT(yes) FORTRAN_DEFAULT_REALisDBLE="yes"]) - dnl Change back to the C language - AC_LANG_POP(Fortran) -else - echo "no" - FC="no" + + if test "X$HDF_FORTRAN2003" = "Xyes"; then + + dnl Checking if the compiler supports the ISO_C_BINDING module, if it does + dnl not then don't bother checking any other Fortran 2003 features and + dnl disable Fortran 2003. + + AC_MSG_CHECKING([if Fortran compiler supports ISO_C_BINDING module]) + + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[USE iso_c_binding])], + [AC_MSG_RESULT(yes) + HAVE_ISO_C_BINDING=[yes]], + [AC_MSG_RESULT(no)]) + + if test "X$HAVE_ISO_C_BINDING" = "Xno"; then + AC_MSG_ERROR([Fortran compiler does not have ISO_C_BINDING; unsupported Fortran 2003 compiler, remove --enable-fortran2003]) + fi + + AC_MSG_CHECKING([if Fortran compiler version compatible with Fortran 2003 HDF]) + HAVE_FORTRAN_2003="no" + + dnl Sun compiler + if (${FC} -V 2>&1 | grep 'Sun Fortran') > /dev/null; then + vers=[`${FC} -V 2>&1 | sed -rn '\|Fortran 95 | s|.* ([0-9.]+) .*|\1|p' | sed -e 's/[^0-9]//g'`] + if test -n "$vers" && test "$vers" -ge 86; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + echo $HAVE_FORTRAN_2003 + AC_MSG_ERROR([Only Sun Fortran Compiler, Version >= 8.6 F2003 supported; remove --enable-fortran2003]) + fi + fi + + dnl Intel compiler + if (${FC} -V 2>&1 | grep '^Intel(R) Fortran') > /dev/null; then + vers_major=[`${FC} -v 2>&1 | grep -o ' [0-9]*\.' | sed -e 's/[^0-9]//g'`] + vers_minor=[`${FC} -v 2>&1 | grep -o '\.[0-9]*[.? ?]' | sed -e 's/[^0-9]//g'`] + if test -n "$vers_major" && test "$vers_major" -gt 10; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + if test -n "$vers_major" && test "$vers_major" = 10 && test -n "$vers_minor" && test "$vers_minor" -ge 1; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + echo $HAVE_FORTRAN_2003 + AC_MSG_ERROR([Only Intel Fortran Compiler, Version >= 10.1 F2003 supported; remove --enable-fortran2003]) + fi + fi + fi + + dnl g95 compiler + if (${FC} -dumpversion 2>&1 | grep 'G95') > /dev/null; then + vers=[`${FC} -dumpversion 2>&1 | grep -o '[^ ]*!' | sed -e 's/[^0-9]//g'`] + if test -n "$vers" && test "$vers" -ge 90; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + echo $HAVE_FORTRAN_2003 + AC_MSG_ERROR([Only G95 Fortran Compiler, Version >= .9 F2003 supported; remove --enable-fortran2003]) + fi + fi + + dnl gfortran + if (${FC} --version 2>&1 | grep 'GNU Fortran') > /dev/null; then + vers_major=[`${FC} --version 2>&1 | grep 'GNU Fortran (' | grep -o ') [0-9]*\.' | sed -e 's/[^0-9]//g'`] + vers_minor=[`${FC} --version 2>&1 | grep 'GNU Fortran (' | grep -o '\.[0-9]*\.' | sed -e 's/[^0-9]//g'`] + + if test -n "$vers_major" && test "$vers_major" -gt 4; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + if test -n "$vers_major" && test "$vers_major" = 4 && test -n "$vers_minor" && test "$vers_minor" -gt 1; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + echo $HAVE_FORTRAN_2003 + AC_MSG_ERROR([Only GNU Fortran Compiler, Version > 4.1.0 F2003 supported; remove --enable-fortran2003]) + fi + fi + fi + + dnl The Portland Group + if (${FC} -V 2>&1 | grep 'Portland Group') > /dev/null; then + vers_major=[`${FC} -V 2>&1 | grep 'pgf' | grep -o ' [0-9]*\.' | sed -e 's/[^0-9]//g'`] + vers_minor=[`${FC} -V 2>&1 | grep 'pgf' | grep -o '\.[0-9]*\-' | sed -e 's/[^0-9]//g'`] + + if test -n "$vers_major" && test "$vers_major" -gt 11; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + if test -n "$vers_major" && test "$vers_major" = 11 && test -n "$vers_minor" && test "$vers_minor" -gt 6; then + HAVE_FORTRAN_2003="yes" + echo $HAVE_FORTRAN_2003 + else + echo $HAVE_FORTRAN_2003 + AC_MSG_ERROR([Only The Portland Group Compiler, Version >= 11.7-0 F2003 supported; remove --enable-fortran2003]) + fi + fi + fi + + dnl A valid F2003 compiler version was not found, return error message and exit + if test "X$HAVE_FORTRAN_2003" = "Xno"; then + echo $HAVE_FORTRAN_2003 + AC_MSG_ERROR([Failed to find a supported F2003 compiler; remove --enable-fortran2003]) + fi + + fi fi +dnl Change back to the C language +AC_LANG_POP(Fortran) + AM_CONDITIONAL([FORTRAN_HAVE_SIZEOF], [test "X$HAVE_SIZEOF" = "Xyes"]) +AM_CONDITIONAL([FORTRAN_2003_CONDITIONAL_F], [test "X$HAVE_FORTRAN_2003" = "Xyes"]) AM_CONDITIONAL([FORTRAN_DEFAULT_REALisDBLE_F], [test "X$FORTRAN_DEFAULT_REALisDBLE" = "Xyes"]) dnl ---------------------------------------------------------------------- @@ -780,7 +922,7 @@ dnl Furthermore, the name of the compiler might tell us how to run the dnl resulting executable. For `mpif90' the executable should be run with dnl `mpiexec' from the same directory as mpif90 if it exists. dnl -if test "X$HDF_FORTRAN" = "Xyes"; then +if test "X$HDF_FORTRAN" = "Xyes" ; then dnl Change to the Fortran 90 language AC_LANG_PUSH(Fortran) |