📄 configure.in
字号:
value=`expr $value \* 16 + $char` done #echo "$fullvar = $value" eval $fullvar=$valuedoneAC_SUBST(F77_INTEGER1)AC_SUBST(F77_INTEGER2)AC_SUBST(F77_INTEGER4)AC_SUBST(F77_INTEGER8)AC_SUBST(F77_INTEGER16)AC_SUBST(F77_REAL4)AC_SUBST(F77_REAL8)AC_SUBST(F77_REAL16)AC_SUBST(F77_COMPLEX8)AC_SUBST(F77_COMPLEX16)AC_SUBST(F77_COMPLEX32)noval="yes"AC_MSG_CHECKING([for C type matching Fortran integer])for c_type in char short int long "long_long" ; do eval ctypelen=\$"ac_cv_sizeof_$c_type" if test "$pac_cv_f77_sizeof_integer" = "$ctypelen" -a \ "$ctypelen" -gt 0 ; then c_type=`echo $c_type | sed -e 's/_/ /g'` AC_MSG_RESULT($c_type) MPI_FINT=$c_type noval="no" break fidoneif test "$noval" = "yes" ; then # Set a default MPI_FINT="int" AC_MSG_RESULT([unavailable])fiAC_SUBST(MPI_FINT)dnldnl We also need to check the size of MPI_Aint vs MPI_Fint, anddnl define AINT_LARGER_THAN_FINT if aint is larger (this dnl affects code in MPI_Address)if test "$ac_cv_sizeof_voidp" != "0" -a \ "$ac_cv_sizeof_voidp" -gt "$pac_cv_f77_sizeof_integer" ; then AC_DEFINE(HAVE_AINT_LARGER_THAN_FINT,,[Define if addresses are larger than Fortran integers])fidnldnldnl Include a defined value for Fint is intif test "$MPI_FINT" = "int" ; then AC_DEFINE(HAVE_FINT_IS_INT,,[Define if Fortran integer are the same size as C ints])fi## Set size of MPI_Status. We may need sizeof_int here as well#if test -z "$MPI_STATUS_SIZE" ; then if test -n "$SIZEOF_MPI_STATUS" ; then # compute from the C sizeof MPI_STATUS_SIZE=`expr $SIZEOF_MPI_STATUS / $ac_cv_sizeof_int` if test "$MPI_STATUS_SIZE" = "0" ; then AC_MSG_WARN([Could not compute the size of MPI_Status]) MPI_STATUS_SIZE=5 fi else AC_MSG_WARN([MPI_STATUS_SIZE was not defined!]) # The default size is 5. See mpi.h.in MPI_STATUS_SIZE=5 fifiAC_SUBST(MPI_STATUS_SIZE)PAC_PROG_C_UNALIGNED_DOUBLES(,[AC_MSG_WARN(Your C compiler $CC does not support unaligned accessesto doubles. This is required for interoperation with Fortran (the Fortran standard requires it).)])## Bsend overhead is sent down from the top level configure.# Set a conservative default if it isn't provided.BSEND_OVERHEAD=${BSEND_OVERHEAD:-128}AC_SUBST(BSEND_OVERHEAD)MPI_MAX_PROCESSOR_NAME="${MPI_MAX_PROCESSOR_NAME:-128}"AC_SUBST(MPI_MAX_PROCESSOR_NAME)## Try for weak symbols for the profiling interface.if test "$enable_weak" = "yes" ; then PAC_PROG_C_WEAK_SYMBOLS(AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols supported]))fi# These values are exported from the upper-layer configure.AC_SUBST(PROFILE_DEF_MPI)AC_SUBST(NO_WEAK_SYM)AC_SUBST(NO_WEAK_SYM_TARGET)## If weak symbols are *not* supported, we may want to be careful# about including # external pmpi_wtime, pmpi_wtick# in the mpif.h file . For now, we'll just declare them as # double precision without including an external declaration for them.## Try to get values for Fortran logical variables.if test "$cross_compiling" = "no" ; then AC_MSG_CHECKING([for values of Fortran logicals]) AC_CACHE_VAL(pac_cv_prog_f77_true_false_value,[ PAC_PROG_F77_RUN_PROC_FROM_C([#include <stdio.h>int main(){ $MPI_FINT itrue, ifalse; FILE *f = fopen("conftestval", "w" ); if (!f) exit(1); ftest_( &itrue, &ifalse ); fprintf( f, "%d %d\n", itrue, ifalse ); exit(0);}],[ subroutine ftest( itrue, ifalse ) logical itrue, ifalse itrue = .TRUE. ifalse = .FALSE. return end],[ pac_cv_prog_f77_true_false_value=`cat conftestval`],,:)]) true_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/ .*//g'`" false_val="`echo $pac_cv_prog_f77_true_false_value | sed -e 's/.* *//g'`" if test -n "$true_val" -a -n "$false_val" ; then AC_DEFINE(F77_TRUE_VALUE_SET,,[Define if we know the value of Fortran true and false]) AC_DEFINE_UNQUOTED(F77_TRUE_VALUE,$true_val,[The value of true in Fortran]) AC_DEFINE_UNQUOTED(F77_FALSE_VALUE,$false_val,[The value of false in Fortran]) AC_MSG_RESULT([True is $true_val and False is $false_val]) else AC_MSG_RESULT([could not determine]) fifiPAC_LANG_POP_COMPILERS# If the system is Cray or Cray-like, then we need to handle character# data in a special way. This code does that.if test "$target_os" = "CRAY" ; then # If tested code does NOT compile, then define _TWO_WORD_FCD AC_MSG_CHECKING([whether TWO_WORD_FCDs are used]) AC_TRY_COMPILE([#include <fortran.h>],[void *buf;_fcd temp;temp = _fcdtocp(buf);],compile_check=yes,compile_check=no) AC_MSG_RESULT($compile_check) if test "$compile_check" = "no" ; then TEMP_CFLAGS=$CFLAGS CFLAGS="-D_TWO_WORD_FCD $CFLAGS" AC_MSG_CHECKING([whether program compiles if _TWO_WORD_FCD is defined ]) AC_TRY_COMPILE([#include <fortran.h>],[void *buf;_fcd temp;temp = _fcdtocp(buf);],compile_check=yes,compile_check=no) AC_MSG_RESULT($compile_check) if test "$compile_check" = "no" ; then AC_MSG_WARN([You may have problems compiling the Fortran interfacespecifically calls to _fcdtocp]) elif test "$compile_check" = "yes" ; then AC_DEFINE(_TWO_WORD_FCD,,[Define if characters use two-word descriptors]) fi CFLAGS=$TEMP_CFLAGS fifiif test -n "$arch_UXPM" -o -n "$arch_uxpv" ; then # This asserts that Fortran passes functions by passing the address of the # pointer to the function. # We really need a TEST for this AC_DEFINE(FORTRAN_SPECIAL_FUNCTION_PTR,,[Define if Fortran functions are passed by passing the address of the pointer to the function]) # Suggested values for these are dnl CFLAGS=-O dnl #FFLAGS=-Oe,-U -Aabe ( Parameter e is not supported on uxp/m ) dnl FLINKER=frt dnl FLIBS="$FLIB_PATH $LIB_LIST"fi## For Fortran 90, we'll also need MPI_ADDRESS_KIND and MPI_OFFSET_KIND# Since our compiler might BE a Fortran 90 compiler, try and determine the# values. F90="${F90-$F77}"PAC_LANG_PUSH_COMPILERSPAC_LANG_FORTRAN90# Offset kind should be for 8 bytes if possible (Romio prefers that)# address should be sizeof void *testsize=$ac_cv_sizeof_voidpif test "$testsize" = 0 ; then # Set a default testsize=4fidnl Using the {} around testsize helps the comments work correctlyPAC_PROG_F90_INT_KIND(ADDRESS_KIND,${testsize},$CROSS_F90_ADDRESS_KIND)if test "$ac_cv_sizeof_void_p" = 8 ; then OFFSET_KIND=$ADDRESS_KINDelse PAC_PROG_F90_INT_KIND(OFFSET_KIND,8,$CROSS_F90_OFFSET_KIND)fi## Some compilers won't allow a -1 kind (e.g., absoft). In this case, # use a fallback (sizeof(int) kind)if test "$ADDRESS_KIND" = "-1" -o "$OFFSET_KIND" = "-1" ; then PAC_PROG_F90_INT_KIND(simpleintkind,${pac_cv_f77_sizeof_integer}) if test "$simpleintkind" = "-1" ; then # Wild guess; probably means that Fortran 90 is not available simpleintkind=4 fi if test "$ADDRESS_KIND" = "-1" ; then ADDRESS_KIND=$simpleintkind fi if test "$OFFSET_KIND" = "-1" ; then OFFSET_KIND=$simpleintkind fifiPAC_LANG_POP_COMPILERSAC_SUBST(ADDRESS_KIND)AC_SUBST(OFFSET_KIND)dnl Check for other Fortran 90 features, such as different include/usednl module directory and special flags. Build modules if requestedif test -n "$F90" -a "$enable_f90" != "no" ; then F90_SUFFIX="$ac_f90ext" # For now, top_srcdir_val is MPIR_HOME; # The build dir is relative at ../.. top_srcdir_val="$MPIR_HOME" if test "$do_f90_modules" = "yes" -a -n "$top_srcdir_val" ; then echo "Setting up F90 Module support" if test ! -d ../../f90modules ; then mkdir ../../f90modules ; fi # if we're the developers, we may need to create the # initial configure files. if test ! -x $top_srcdir_val/f90modules/configure -a \ -s $top_srcdir_val/f90modules/configure.in -a \ -x $top_srcdir_val/f90modules/makeconfigure ; then (cd $top_srcdir_val/f90modules ; ./makeconfigure) fi # Should F90LINKER be F90TESTLINKER? (cd ../../f90modules ; \ export F90 ; export MPIR_HOME ; export VPATH ; \ export libbuild_dir ; export includebuild_dir ; \ export MAKE ; F90LINKER="$F90LINKER" ; \ export F90LINKER ; export F77 ; \ $top_srcdir_val/f90modules/configure --with-mpich) if test ! -s ../../f90modules/Makefile ; then # turn off f90 F90="" else F90_MODINCFLAG="`$MAKE -f ../../f90modules/Makefile f90modflag`" F90MODINCSPEC="`$MAKE -f ../../f90modules/Makefile f90modspec`" if test -z "$USER_SET_F90INC" -a -z "$F90INC" ; then # This should use a test or try to get it from the f90module. F90INC=`$MAKE -f ../../f90modules/Makefile f90incflag` fi fi fielse # Remove the f90modules/Makefile since this is the only way # to tell the top-level makefile not to build the f90 modules. # (We need a better way) rm -f ../../f90modules/MakefilefiAC_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)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)dnldnl If both C and Fortran are gnu, define the following to simplify dnl shared library support. AC_MSG_CHECKING([whether using gcc and g77 together])if test "$ac_cv_prog_gcc" = "yes" -a "$ac_cv_prog_g77" = "yes" ; then AC_DEFINE(USE_GCC_G77_DECLS,1,[Define if using gcc and g77 together]) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fidnl In the MPICH case, make a copy of the definitions file available to thednl mpi.h file.dnl Despite the fact that this appears *before* AC_OUTPUT, these actions dnl happen *after* AC_OUTPUTdnl AC_OUTPUT_COMMANDS([if test -n "$includebuild_dir" ; then \dnl cp include/mpi_fortdefs.h $includebuild_dir/mpi_fortdefs.h ; fi],dnl [includebuild_dir=$includebuild_dir] )dnl AC_OUTPUT_COMMANDS([chmod a+x mpif77 ; \dnl if test -n "$binbuild_dir" ; then cp mpif77 $binbuild_dir/mpif77 ; fi], dnl [binbuild_dir=$binbuild_dir] )dnldnl First, ensure that echo works within the config.status AC_OUTPUT_COMMANDS([if test "$enable_echo" ; then set -x ; fi ])dnl add ROMIO part of mpif.h if it existsAC_OUTPUT_COMMANDS([if test -f ../../romio/include/mpiof.h -a "$ROMIO" = 1 ; then \ sed -e '/MPI_OFFSET_KIND/d' ../../romio/include/mpiof.h | \ cat mpif.h - > mpif-tmp.h ; \ rm -f $includebuild_dir/mpif.h ; \ mv mpif-tmp.h mpif.h ; fi])dnl This must be run before converting C to !AC_OUTPUT_COMMANDS([rm -f .tmp ; cat mpif.h mpif_bottom.h > .tmp ;rm -f mpif.h ; mv .tmp mpif.h])dnl By modifying mpif.h to use ! for comments, it can work with many f90 dnl compilers without creating a separate version. dnl Note that this is run AFTER the AC_OUTPUT actionsAC_OUTPUT_COMMANDS([if test "$has_exclaim" = "yes" ; then rm -f .tmp cp mpif.h .tmp sed -e 's/^C/\!/g' .tmp > mpif.h rm -f .tmpfi],[has_exclaim=$has_exclaim])dnlFC="$F77"AC_SUBST(FC)AC_SUBST(CFLAGS) # some autoconf versions need this explicitlydnl AC_OUTPUT_COMMANDS([chmod a+x mpif77])dnl AC_OUTPUT_COMMANDS([chmod a+x mpif90])dnl AC_OUTPUT(Makefile mpif.h mpi_fortdefs.h mpif77 mpif77.conf mpif90 mpif90.conf initfcmn.f)AC_OUTPUT(Makefile mpif.h mpif77.conf setbotf.f)exit 0dnldnl Add the following to the output step after the AC_OUTPUTif test -n "$F90" ; then # Remove all comments from mpif.h /bin/rm -f $includebuild_dir/mpif.h.copy cp $includebuild_dir/mpif.h $includebuild_dir/mpif.h.copy if test "$fixupmpif" = "no" ; then # Regular Fortran doesn't have ! for comments, so we just delete them sed -e '/^C/d' -e 's/\!.*$//g' $includebuild_dir/mpif.h.copy > $includebuild_dir/mpif.h else sed -e 's/^C/\!/g' $includebuild_dir/mpif.h.copy > $includebuild_dir/mpif.h fi /bin/rm -f $includebuild_dir/mpif.h.copyelse # ROMIO might have added ! comments to mpif.h if test -z "$fixupmpif" -o "$fixupmpif" = "no" ; then /bin/rm -f $includebuild_dir/mpif.h.copy cp $includebuild_dir/mpif.h $includebuild_dir/mpif.h.copy # Regular Fortran doesn't have ! for comments, so we just delete them sed -e '/^C/d' -e 's/\!.*$//g' $includebuild_dir/mpif.h.copy > $includebuild_dir/mpif.h /bin/rm -f $includebuild_dir/mpif.h.copy fifi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -