From 40c79d0602c1b736093d5b245e6aeac8db1ef01b Mon Sep 17 00:00:00 2001 From: James Laird Date: Tue, 28 Mar 2006 17:13:46 -0500 Subject: [svn-r12172] Purpose: configure refactoring Description: Migrated a couple of Fortran macros to standard autoconf macros Solution: HDF5 had a couple of macros, AC_TRY_FLINK and AC_CHECK_FLIB, which were adaptions of standard autoconf macros before those macros supported F90. Now Autoconf seems to have better support for f90, so its standard macros AC_TRY_LINK and AC_CHECK_LIB can do this job (and move the burden of supporting those macros to autoconf). Platforms tested: heping, modi4, copper --- configure | 290 +++++++++++++++++++++++++++++++++-------------------------- configure.in | 10 ++- 2 files changed, 169 insertions(+), 131 deletions(-) diff --git a/configure b/configure index 9436ba9..0ce39ef 100755 --- a/configure +++ b/configure @@ -48490,184 +48490,220 @@ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$a ac_compiler_gnu=$ac_cv_fc_compiler_gnu - ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * + cat >conftest.$ac_ext <<_ACEOF + program main -cat >conftest.$ac_ext <&5 - (eval $ac_compile) 2>&5 + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_fc_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : - else - : - ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking for + include 'mpif.h' + integer:: ierr + call mpi_file_open( ierr ) in -lmpi... $ECHO_C" >&6 +if test "${ac_cv_lib_mpi______________include__mpif_h______________integer___ierr_____________call_mpi_file_open__ierr__+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpi $LIBS" +cat >conftest.$ac_ext <<_ACEOF + program main + call include 'mpif.h' integer:: ierr call mpi_file_open( ierr ) - end -EOF - -if test -n "mpi"; then - saved_LIBS="$LIBS" - LIBS="$LIBS -lmpi" -fi - -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_fc_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - : - + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mpi______________include__mpif_h______________integer___ierr_____________call_mpi_file_open__ierr__=yes else - LIBS="$saved_LIBS" - PARALLEL=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_mpi______________include__mpif_h______________integer___ierr_____________call_mpi_file_open__ierr__=no fi -cd .. -rm -rf conftest* -ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_mpi______________include__mpif_h______________integer___ierr_____________call_mpi_file_open__ierr__" >&5 +echo "${ECHO_T}$ac_cv_lib_mpi______________include__mpif_h______________integer___ierr_____________call_mpi_file_open__ierr__" >&6 +if test $ac_cv_lib_mpi______________include__mpif_h______________integer___ierr_____________call_mpi_file_open__ierr__ = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMPI 1 +_ACEOF + LIBS="-lmpi $LIBS" +else + PARALLEL=no fi -cd .. -rm -rf conftest* -ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext if test "X$PARALLEL" = "Xyes"; then - ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * - -cat >conftest.$ac_ext <conftest.$ac_ext <<_ACEOF + program main + include 'mpif.h' integer:: ierr call mpi_file_open( ierr ) - end -EOF - -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_fc_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then : - else - : - ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - - -test -d conftestdir || mkdir conftestdir -cd conftestdir -rm -rf * + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 -cat >conftest.$ac_ext <&5 +echo $ECHO_N "checking for + include 'mpif.h' + integer:: ierr + call mpi_file_open( ierr ) in -lmpio... $ECHO_C" >&6 +if test "${ac_cv_lib_mpio________________include__mpif_h________________integer___ierr_______________call_mpi_file_open__ierr__+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmpio $LIBS" +cat >conftest.$ac_ext <<_ACEOF + program main + call include 'mpif.h' integer:: ierr call mpi_file_open( ierr ) - end -EOF - -if test -n "mpio"; then - saved_LIBS="$LIBS" - LIBS="$LIBS -lmpio" -fi - -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + end +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_fc_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - : - + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mpio________________include__mpif_h________________integer___ierr_______________call_mpi_file_open__ierr__=yes else - LIBS="$saved_LIBS" - PARALLEL=no + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_mpio________________include__mpif_h________________integer___ierr_______________call_mpi_file_open__ierr__=no fi -cd .. -rm -rf conftest* -ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_mpio________________include__mpif_h________________integer___ierr_______________call_mpi_file_open__ierr__" >&5 +echo "${ECHO_T}$ac_cv_lib_mpio________________include__mpif_h________________integer___ierr_______________call_mpi_file_open__ierr__" >&6 +if test $ac_cv_lib_mpio________________include__mpif_h________________integer___ierr_______________call_mpi_file_open__ierr__ = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBMPIO 1 +_ACEOF + LIBS="-lmpio $LIBS" +else + PARALLEL=no fi -cd .. -rm -rf conftest* -ac_ext=${FC_SRCEXT-f} -ac_compile='$FC -c $FCFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext >&5' -ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $FCFLAGS_SRCEXT conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_fc_compiler_gnu - +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi ac_ext=c diff --git a/configure.in b/configure.in index decdeb2..3f31a2e 100644 --- a/configure.in +++ b/configure.in @@ -2160,10 +2160,11 @@ case "X-$enable_parallel" in AC_LANG_PUSH(Fortran) dnl Try link a simple MPI program. If fail, try again with -lmpi. - AC_TRY_FLINK(mpif.h, [ + AC_TRY_LINK(, [ + include 'mpif.h' integer:: ierr call mpi_file_open( ierr )],, - AC_CHECK_FLIB(mpi, [ + AC_CHECK_LIB(mpi, [ include 'mpif.h' integer:: ierr call mpi_file_open( ierr )],, PARALLEL=no)) @@ -2171,10 +2172,11 @@ case "X-$enable_parallel" in dnl Then try link a simple MPI-IO program. If fail, try again with dnl -lmpio. if test "X$PARALLEL" = "Xyes"; then - AC_TRY_FLINK(mpif.h, [ + AC_TRY_LINK(, [ + include 'mpif.h' integer:: ierr call mpi_file_open( ierr )],, - AC_CHECK_FLIB(mpio, [ + AC_CHECK_LIB(mpio, [ include 'mpif.h' integer:: ierr call mpi_file_open( ierr )],, PARALLEL=no)) -- cgit v0.12