📄 configure.in
字号:
dnldnl This configure is used ONLY to determine the Fortran 90 featuresdnl that are needed to implement the create_type_xxx routines.AC_INIT(Makefile.in)AC_PREREQ(2.59)dnl The MPICH2 top-level configure adds a bunch of flags to thednl user-defined CFLAGS by processing different configure command-linednl arguments (--enable-g, --enable-default-optimization). These updateddnl flags are passed down as a separate flag. Here, we don't care aboutdnl the user-defined flags, but rather this updated flags, so we justdnl overwrite CFLAGS with them.PAC_SUBCONFIG_INIT()AC_CONFIG_AUX_DIR(../../../confdb)dnlPAC_ARG_CACHINGAC_ARG_ENABLE(echo,[--enable-echo - Turn on echoing from within the configure script],set -x)AC_ARG_WITH(cross,[--with-cross=file - Specify the values of variables that configure cannotdetermine in a cross-compilation environment],,with_cross=no)AC_ARG_WITH(mpichconfig,[--with-mpichconfig=file - Use file for the MPICH configuration. Normally, this file is mpichlib.conf, but other files may be used.],[if test -z "$withval" -o "X$withval" = "Xyes" ; then mpichconfig_file=../../util/mpichlib.confelse mpichconfig_file=$withvalfi],mpichconfig_file="")dnldnl First check that we have a clean build if we are doing a VPATH buildif test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status ; then AC_MSG_ERROR([You cannot do a VPATH build if the source directory has been configured. Run "make distclean" in $srcdir first.])fidnldnl Get the "master" top srcdir if we are a subdir configureif test -z "$top_srcdir" ; then use_top_srcdir=$srcdir else use_top_srcdir=$top_srcdirfiif test -z "$master_top_srcdir" ; then master_top_srcdir=$use_top_srcdirfiAC_SUBST(master_top_srcdir)export master_top_srcdir## Get the master builddir (which may be imported from above)if test -z "$master_top_builddir" ; then master_top_builddir=`pwd`fiexport master_top_builddirAC_SUBST(master_top_builddir)# Get the C compiler (needed for type_create_f90_xxx functions)PAC_PROG_CCdnl Set CFLAGS for enable strict if necessaryPAC_CC_STRICTAC_C_CONST# Find a Fortran 90 compiler. Sets F90saveF90FLAGS=$F90FLAGSPAC_PROG_F90F90FLAGS=$saveF90FLAGSif test -z "$F90" ; then AC_MSG_ERROR([Could not find a usable F90 compiler])fi## Determine the extension for f90 files (it isn't always .f90)PAC_F90_EXTF90EXT=$pac_cv_f90_extAC_SUBST(F90EXT)## Get the sizes of the standard types. These are used # to implement MPI_SIZEOF, among other things.## Set likely defaultsCROSS_F90_SIZEOF_INTEGER=${CROSS_F90_SIZEOF_INTEGER:-4}CROSS_F90_SIZEOF_REAL=${CROSS_F90_SIZEOF_REAL:-4}CROSS_F90_SIZEOF_CHARACTER=${CROSS_F90_SIZEOF_CHARACTER:-1}CROSS_F90_SIZEOF_DOUBLE_PRECISION=${CROSS_F90_SIZEOF_DOUBLE_PRECISION:-4}dnl PAC_PROG_F90_CHECK_SIZEOF_EXT(INTEGER,$CROSS_F90_SIZEOF_INTEGER)dnl PAC_PROG_F90_CHECK_SIZEOF_EXT(REAL,$CROSS_F90_SIZEOF_REAL)dnl PAC_PROG_F90_CHECK_SIZEOF_EXT(CHARACTER,$CROSS_F90_SIZEOF_CHARACTER)## We check the size of double precision even though it should be# twice the size of a real because some environments allow the user# to set real and double precision to the same size. This is no longer# Fortran, but this check helps make us more robustdnl PAC_PROG_F90_CHECK_SIZEOF(DOUBLE PRECISION,$CROSS_F90_SIZEOF_DOUBLE_PRECISION)# We also want to substitute for these values, not just define themSIZEOF_F90_INTEGER=$pac_cv_f90_sizeof_INTEGERSIZEOF_F90_REAL=$pac_cv_f90_sizeof_REALSIZEOF_F90_CHARACTER=$pac_cv_f90_sizeof_CHARACTERSIZEOF_F90_DOUBLE_PRECISION=$pac_cv_f90_sizeof_DOUBLE_PRECISIONAC_SUBST(SIZEOF_F90_INTEGER)AC_SUBST(SIZEOF_F90_REAL)AC_SUBST(SIZEOF_F90_CHARACTER)AC_SUBST(SIZEOF_F90_DOUBLE_PRECISION)PAC_LANG_FORTRAN90## Determine the precision and range of the standard Fortran types. This# isn't quite enough for a full implementation of the Type_create_f90_xxx# routines, but will handle most programs. We can extend this by trying to# find (through selected_real_kind and selected_int_kind) types with larger or# smaller precisions and/or ranges than the basic types.if test -z "$CROSS_F90_REAL_MODEL" ; then AC_MSG_CHECKING([for precision and range of reals]) rm -f conftest* cat > conftest.$ac_f90ext <<EOF program main real a print *, precision(a), ",", range(a) endEOF if test -z "$ac_f90link" -a -n "$ac_link" ; then ac_f90link=$ac_link fi if AC_TRY_EVAL(ac_f90link) && test -s conftest${ac_exeext} ; then ./conftest > conftest.out 2>&AC_FD_CC if test -s conftest.out ; then F90_REAL_MODEL=`cat conftest.out | sed -e 's/ */ /g'` AC_MSG_RESULT($F90_REAL_MODEL) else AC_MSG_WARN([No output from test program]) fi else AC_MSG_WARN([Could not build program to determine precision and range of reals]) echo $ac_f90link >&AC_FD_CC cat conftest.$ac_f90ext >&AC_FD_CC fi rm -f conftest*else F90_REAL_MODEL=$CROSS_F90_REAL_MODELfiAC_SUBST(F90_REAL_MODEL)#if test -z "$CROSS_F90_DOUBLE_MODEL" ; then AC_MSG_CHECKING([for precision and range of double precision]) rm -f conftest* cat > conftest.$ac_f90ext <<EOF program main double precision a print *, precision(a), ",", range(a) endEOF if AC_TRY_EVAL(ac_f90link) && test -s conftest${ac_exeext} ; then ./conftest > conftest.out 2>&AC_FD_CC if test -s conftest.out ; then F90_DOUBLE_MODEL=`cat conftest.out | sed -e 's/ */ /g'` AC_MSG_RESULT($F90_DOUBLE_MODEL) else AC_MSG_WARN([No output from test program]) fi else AC_MSG_WARN([Could not build program to determine precision and range of double precision data]) fi rm -f conftest*else F90_DOUBLE_MODEL=$CROSS_F90_DOUBLE_MODELfiAC_SUBST(F90_DOUBLE_MODEL)#if test -z "$CROSS_F90_INTEGER_MODEL" ; then AC_MSG_CHECKING([for range of integers]) rm -f conftest* cat > conftest.$ac_f90ext <<EOF program main integer a print *, range(a) endEOF if AC_TRY_EVAL(ac_f90link) && test -s conftest${ac_exeext} ; then ./conftest > conftest.out 2>&AC_FD_CC if test -s conftest.out ; then F90_INTEGER_MODEL=`cat conftest.out | sed -e 's/ */ /g'` AC_MSG_RESULT($F90_INTEGER_MODEL) else AC_MSG_WARN([No output from test program]) fi else AC_MSG_WARN([Could not build program to determine range of integer]) echo $ac_f90link >&AC_FD_CC cat conftest.$ac_f90ext >&AC_FD_CC fi rm -f conftest*else F90_INTEGER_MODEL=$CROSS_F90_INTEGER_MODELfiAC_SUBST(F90_INTEGER_MODEL)## Try to find the available integer kinds by using selected_int_kind# This produces a table of range,kindif test -z "$CROSS_F90_INTEGER_MODEL_MAP" ; then saveFFLAGS=$FFLAGS AC_PROG_F77 FFLAGS=$saveFFLAGS # We assume that the Fortran 77 and Fortran 90 linkers are compatible PAC_PROG_F77_LINKER_WITH_C # For name mangle, we need the library flags PAC_PROG_F77_NAME_MANGLE # Clean LIBS? LIBS="`echo A$LIBS | sed -e 's/ */ /g' -e 's/^A//'`" if test ":$LIBS:" = ": :" ; then LIBS="" ; fi AC_MSG_CHECKING([for available integer kinds and ranges]) rm -f conftest.* # Now, create the program to find the kinds and sizes # We have to do this is two steps: # First, find the valid kinds. Some (all?) Fortran compilers require # that the kind be a constant expression (gfortran, for example). # Once we have the valid kinds, we can determine the size of # an integer of each of the valid kinds cat >conftest.$ac_f90ext <<EOF program main integer r, lastkind lastkind=selected_int_kind(1) do r=2,30 k = selected_int_kind(r) if (k .ne. lastkind) then print *, r-1,",",lastkind lastkind = k endif if (k .le. 0) then exit endif enddo if (k.ne.lastkind) then print *, 31, ",", k endif end EOF if AC_TRY_EVAL(ac_f90link) && test -s conftest${ac_exeext} ; then ./conftest > conftest.out 2>&AC_FD_CC if test -s conftest.out ; then F90_INTEGER_MODEL=`cat conftest.out | sed -e 's/ */ /g'| tr '\012' ','` AC_MSG_RESULT($F90_INTEGER_MODEL) validKinds="`sed -e 's/ */ /g' conftest.out | tr '\012' ':'`" else AC_MSG_WARN([No output from test program]) fi else AC_MSG_WARN([Could not build program to determine range of integer]) echo $ac_f90link >&AC_FD_CC cat conftest.$ac_f90ext >&AC_FD_CC fi rm -f conftest* # First, create a C routine to provide the size in bytes # of a variable cat <<EOF > conftestc.c#include <stdio.h>#include "confdefs.h"#ifdef F77_NAME_UPPER#define cisize_ CISIZE#define isize_ ISIZE#elif defined(F77_NAME_LOWER) || defined(F77_NAME_MIXED)#define cisize_ cisize#define isize_ isize#endifint cisize_(char *,char*);int cisize_(char *i1p, char *i2p){ int isize_val=0; isize_val = (int)(i2p - i1p); return isize_val;}EOF pac_tmp_compile='$CC -c $CFLAGS $CPPFLAGS conftestc.c >&5' if AC_TRY_EVAL(pac_tmp_compile) && test -s conftestc.o ; then saveIFS=$IFS IFS=: for rangekind in $validKinds ; do kind="`echo $rangekind | sed -e 's/.*,//'`" range="`echo $rangekind | sed -e 's/,.*//'`" cat >conftest.$ac_f90ext <<EOF program main integer (kind=$kind) a(2) integer cisize print *, $range, ",", $kind, ",", cisize( a(1), a(2) ) endEOF IFS=$saveIFS mylink='$F90 -o conftest$ac_exeext $F90FLAGS $LDFLAGS conftest.$ac_f90ext conftestc.o $LIBS >&AC_FD_CC' if AC_TRY_EVAL(mylink) && test -s conftest${ac_exeext} ; then ./conftest > conftest.out 2>&AC_FD_CC if test -s conftest.out ; then sizes="`cat conftest.out | sed -e 's/ */ /g'`" F90_INTEGER_MODEL_MAP="$F90_INTEGER_MODEL_MAP { $sizes }," else AC_MSG_WARN([No output from test program]) fi else AC_MSG_WARN([Could not build program to determine available integer kinds and ranges]) echo $mylink >&AC_FD_CC echo "LIBS = :$LIBS:" >&AC_FD_CC cat conftest.$ac_f90ext >&AC_FD_CC if test ! -s conftestc.o ; then echo "conftestc.o disappered!" >&AC_FD_CC fi fi rm -f conftest.* IFS=: done IFS=$saveIFS AC_MSG_RESULT($F90_INTEGER_MODEL_MAP) rm -f conftest* else AC_MSG_WARN([Could not build routines to return sizes data]) fi else F90_INTEGER_MODEL_MAP="$CROSS_F90_INTEGER_MODEL_MAP" fiAC_SUBST(F90_INTEGER_MODEL_MAP) dnl Check for other Fortran 90 features, such as different include/usednl module directory and special flags. Build modules if requestedAC_SUBST(F90_SUFFIX)f90includedir='${includedir}'f90libdir='${libdir}'AC_SUBST(f90includedir)AC_SUBST(f90libdir)AC_SUBST(F90_LDFLAGS)AC_SUBST(F90INC)AC_SUBST(F90_MODINCFLAG)AC_SUBST(F90MODINCSPEC)F90INCFLAG=-IAC_SUBST(F90INCFLAG)AC_SUBST(F90FLAGS)AC_SUBST(F90LINKER)AC_SUBST(F90LIB_PATH)if test -z "$F90_LIBDIR_LEADER" ; then F90_LIBDIR_LEADER="-L"fiAC_SUBST(F90_LIBDIR_LEADER)dnl Place holder macro for finalizationPAC_SUBCONFIG_FINALIZE()AC_OUTPUT(mpif90model.h)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -