📄 configure.in
字号:
then dnl If --with-mpi-compiler is used, then change the MPICC setting if test -n "$with_mpi_compiler" then MPICC="$with_mpi_compiler" fi dnl Copied and hacked from fftw's configure.in dnl Check for mpi library... sinclude(acx_mpi.m4) ACX_MPI([], [AC_MSG_ERROR([couldn't find mpi library])]) dnl This is a hack to make the compilers point to $MPICC only for the rest of the mpi tests. dnl This must be reversed at the end of this section. joempi_save_CC="$CC" joempi_save_CPP="$CPP" CC="$MPICC" CPP="$MPICC -E" dnl checking to see if lam is installed as mpi implementation save_LIBS="$LIBS" AC_CHECK_LIB([lam], [lamlog], [MPILIBS="-lmpi -llam $MPILIBS"], [], [-lmpi "$MPI_LIB_PATH"]) lamTest=`echo "$MPILIBS" | grep 'llam' | cut -f1 -d' '` if test x"$lamTest" = x then dnl if didn't find lam, then look for mpich AC_CHECK_LIB([mpich], [MPI_Init], [MPILIBS="-lmpich $MPILIBS"], [], ["$MPI_LIB_PATH"]) fi LIBS="$save_LIBS" # we don't want to add -lmpi -llam or -lmpich to the LIBS variable dnl check for fftw_mpi.h if test "x$FFTW_PATH" = "x" then AC_CHECK_HEADERS(["$FFTW_INCLUDE_PATH"fftw_mpi.h],[], [echo "Eeek! I can't find fftw_mpi.h!"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Continuing anyway"]) else AC_CHECK_FILE(["$FFTW_INCLUDE_PATH"fftw_mpi.h],[], [echo "Eeek! I can't find fftw_mpi.h!"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Continuing anyway"]) fi dnl check for the fftw_mpi library AC_CHECK_LIB([fftw_mpi], [fftw2d_mpi_create_plan], [FFTW_MPI="-lfftw_mpi"], [echo "Eeek! fftw_mpi doesn't seem to work"; echo "It doesn't look like you'll be able to use fftw_mpi"; echo "Perhaps you need to use --enable-mpi in fftw??"; echo "Continuing anyway"], ["$THREADLIBS" "$FFTW_LIB_PATH" "$FFTW_LIBS" "$MPILIBS" "$MPI_LIBS" "$MPI_LIB_PATH" "$MPI_INCLUDE_PATH"]) dnl Must replace the compilers with the original CC="$joempi_save_CC" CPP="$joempi_save_CPP"fidnl If the FFTW_PATH is set, put -L$FFTW_PATH into the FFTW_* variablesif test -z "$FFTW_PATH"then FFTW_MPI_LIBS="$FFTW_THREADS $FFTW_MPI $FFTW_LIBS" FFTW_LIBS="$FFTW_THREADS $FFTW_LIBS"else FFTW_MPI_LIBS="$FFTW_THREADS $FFTW_MPI $FFTW_LIBS $FFTW_LIB_PATH" FFTW_LIBS="$FFTW_THREADS $FFTW_LIBS $FFTW_LIB_PATH"fidnl We need to know where libxmds.a isXMDS_LIBS="$LIBS -lxmds -L$USER_LIB"AC_SUBST([CC])AC_SUBST([CFLAGS])AC_SUBST([CXX])AC_SUBST([CXXFLAGS])dnl Ww now need to add -lxmds to the libraries needed to build xmdsLIBS="$LIBS -lxmds -L."AC_SUBST([LIBS])AC_DEFINE_UNQUOTED([CC],["$CC"],[C compiler])AC_DEFINE_UNQUOTED([CXX],["$CXX"],[C++ compiler])AC_DEFINE_UNQUOTED([CFLAGS],["$CFLAGS"],[C compiler flags])AC_DEFINE_UNQUOTED([CXXFLAGS],["$CXXFLAGS"],[C++ compiler flags])AC_DEFINE_UNQUOTED([LIBS],["$LIBS"],[Library flags])AC_DEFINE_UNQUOTED([THREADLIBS],["$THREADLIBS"],[Thread libraries])AC_DEFINE_UNQUOTED([FFTW_MPI_LIBS],["$FFTW_MPI_LIBS"],[MPI libraries for FFTW])AC_DEFINE_UNQUOTED([FFTW_LIBS],["$FFTW_LIBS"],[Libraries for FFTW])AC_DEFINE_UNQUOTED([INCLUDES],["$INCLUDES"],[Include flags])dnl some special stuff for iccif test "x$ICC" != "x" -a -z "$XMDS_CC"then XMDS_CC="$ICC" XMDS_LIBS="-limf $XMDS_LIBS" if test -z "$XMDS_CFLAGS" then XMDS_CFLAGS="$tempXMDS_CFLAGS $AGGRESSIVE_ICC_CFLAGS" fielse XMDS_CC="$CXX"fidnl if we're using gcc, then use the gcc aggressive flags by defaultdnl ac_compiler_gnu is the flag internal to configure that is set if using the gnu c/c++ compilerif test x"$ac_compiler_gnu" = xyes -a -n "$tempXMDS_CFLAGS" -a x"$ICC" = xthen XMDS_CFLAGS="$tempXMDS_CFLAGS $AGGRESSIVE_GCC_CFLAGS"fidnl if the XMDS_CFLAGS etc aren't set, then use the CFLAGSif test -z "$XMDS_CFLAGS"then XMDS_CFLAGS="$CFLAGS"fidnl if the user has set XMDS_CFLAGS at the command line, but not dnl mentioned -pthread and PTHREAD_CFLAGS is non-null then appenddnl PTHREAD_CFLAGS to XMDS_CFLAGSif test -n "$XMDS_CFLAGS"then xmdsflagsTest=`echo "$XMDS_CFLAGS" | grep 'pthread'` if test -z "$xmdsflagsTest" -a -n "$PTHREAD_CFLAGS" then AC_MSG_WARN([$PTHREAD_CFLAGS required for xmds but not in XMDS_CFLAGS; appending]) XMDS_CFLAGS="$XMDS_CFLAGS $PTHREAD_CFLAGS" fifidnl if the C or C++ compilers are the Tru64 ones then need dnl to add -D__USE_STD_IOSTREAM=1 to XMDS_CFLAGStru64Test=`cxx -V 2>/dev/null| grep 'Tru64'`if test -n "$tru64Test"then AC_MSG_WARN([It looks like you are using the Tru64 compiler...]) AC_MSG_WARN([I will set __USE_STD_IOSTREAM appropriately]) XMDS_CFLAGS="$XMDS_CFLAGS -D__USE_STD_IOSTREAM=1"fidnl now set the variables in stoneAC_DEFINE_UNQUOTED([XMDS_CC],["$XMDS_CC"],[C compiler for xmds simulations])AC_DEFINE_UNQUOTED([XMDS_CFLAGS],["$XMDS_CFLAGS"],[C compiler flags for xmds])AC_DEFINE_UNQUOTED([XMDS_LIBS],["$XMDS_LIBS"],[C libraries for xmds])AC_DEFINE_UNQUOTED([XMDS_INCLUDES],["$XMDS_INCLUDES"],[Include flags for xmds])dnl we need to work out how mpicc is run, if it is used.if test x"$MPICC" = xmpiccthen AC_MSG_CHECKING([how mpicc is run]) lamTest=`echo "$MPILIBS" | grep 'llam' | cut -f1 -d' '` mpichTest=`echo "$MPILIBS" | grep 'lmpich' | cut -f1 -d' '` if test x"$lamTest" != x then mpiccTest=`mpicc -showme | cut -f1 -d' '` elif test x"$mpichTest" != x then mpiccTest=`mpicc -show | cut -f1 -d' '` fi dnl if mpiccTest isn't set, then assume gcc if test -z "$mpiccTest" then AC_MSG_WARN([cannot work out how mpicc is run; assuming gcc]) mpiccTest=gcc fi stdcTest=`echo "$LIBS" | grep 'stdc++'` case "$mpiccTest" in *gcc* ) if test -z "$stdcTest" then MPILIBS="$MPILIBS -lstdc++" fi AC_MSG_RESULT([gcc]) ;; *icc* ) AC_MSG_RESULT([icc]) ;; * ) AC_MSG_RESULT(["$mpiccTest"]) ;; esacdnl This part seems to be a bad idea, we've already tested that it works above (acx_mpi.m4)dnl All this section does is beef up the default compiler optionsdnl elsednl if test -n "$enable_mpi"dnl thendnl AC_MSG_WARN([mpicc not set explicitly; using system C++ compiler])dnl MPICC=$CXXdnl fifiAC_DEFINE_UNQUOTED([MPICC],["$MPICC"],[MPI C compiler])dnl this is a better way to test than with an if blah = moo then...case "$mpiccTest" in *gcc* ) # use the gcc aggressive flags by default MPICCFLAGS="$tempMPICCFLAGS $AGGRESSIVE_GCC_CFLAGS $XMDS_LIBS $MPILIBS $MPI_LIB_PATH -I$USER_INCLUDE -L$USER_LIB" ;; *icc* ) MPICCFLAGS="$tempMPICCFLAGS $AGGRESSIVE_ICC_CFLAGS $XMDS_LIBS $MPILIBS $MPI_LIB_PATH -I$USER_INCLUDE -L$USER_LIB" ;; * ) MPICCFLAGS="$XMDS_CFLAGS $XMDS_LIBS $MPILIBS $MPI_LIB_PATH" # MPICCFLAGS="$CFLAGS $INCLUDES $LIBS $THREADLIBS $MPI_LIBS $FFTW_MPI_LIBS" ;;esacAC_DEFINE_UNQUOTED([MPICCFLAGS],["$MPICCFLAGS"],[MPI C compiler flags])dnl Checks for typedefs, structures, and compiler characteristics.AC_C_CONSTAC_C_INLINEdnl These are the makefiles to produceAC_OUTPUT(Makefile source/Makefile)dnl We really want xmdsconfig.h to be the same as config.h, so, just so that itdnl works, put a cp in herecp source/config.h source/xmdsconfig.hdnl echo some stuff for debuggingecho ""echo "**************************************************"echo ""echo "XMDS will be built with these options:"echo " CFLAGS = $CFLAGS"echo " CXXFLAGS = $CXXFLAGS"echo " INCLUDES = $INCLUDES"echo " LIBS = $LIBS"echo " THREADLIBS = $THREADLIBS"echo ""echo "Simulations will be built with these options:"echo " compiler options:"echo " XMDS_CC = $XMDS_CC"echo " XMDS_CFLAGS = $XMDS_CFLAGS"echo " XMDS_LIBS = $XMDS_LIBS"echo " XMDS_INCLUDES = $XMDS_INCLUDES"echo ""echo " mpi options:"if test -z "$enable_mpi"then echo " MPI NOT ENABLED"else echo " MPICC = $MPICC" echo " MPICCFLAGS = $MPICCFLAGS" echo " MPILIBS = $MPILIBS"fiecho ""echo " fftw options:"echo " FFTW_LIBS = $FFTW_LIBS"echo " FFTW_MPI_LIBS = $FFTW_MPI_LIBS"echo ""echo "The user defined options were:"echo " USER_LIB = -L$USER_LIB"echo " USER_INCLUDE = -I$USER_INCLUDE"echo ""echo "**************************************************"echo ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -