📄 f77flags.m4
字号:
dnl ######################################################################dnldnl File: fortflags.m4dnldnl Purpose: dnl Given F77 compiler, determine flagsdnl See also f77.m4 and f77interop.m4dnldnl Variables set here includednl F77_LDdnl F77_DBL_FLAGdnl Promote r4 to r8dnl F77_OPT_FLAGdnl Normal optimizationdnl F77_MACH_FLAGdnl Machine dependent flags for "ultra" optimization. NEEDS WORK!!dnl F77_NOOPT_FLAGdnl o Sometimes better to explicitly turn off optimizationdnl F77_DEBUG_FLAGdnl Include check array conformance if availablednl F77_OTHER_FLAGdnl Things should probably be used, but are not strictly necessarydnl F77_INCLUDE_FLAGdnl Because Absoft does not use the -I flag for include directoriesdnl F77_PIC_FLAGdnl Position-Independent Code (for shared libraries)dnl FFLAGSdnl dnl Version: $Id: f77flags.m4,v 1.1 2005/04/29 14:47:06 kruger Exp $dnldnl Copyright Tech-X Corporation, 2001. Redistribution allowed provideddnl this copyright statement remains intact.dnldnl ######################################################################dnl ----------------------------------------------------------------------dnl allow flags or environment to overwrite variablesdnl ----------------------------------------------------------------------AC_ARG_WITH( FFLAGS, [ --with-FFLAGS="MyFFLAGS" to set Fortran flags with Myf90], FFLAGS="$withval")AC_ARG_WITH(OPTIMIZED, [ --with-OPTIMIZED turn on Fortran optimization flags], OPTIMIZED=yes, OPTIMIZED=no)AC_ARG_WITH(FULLOPTIMIZED, [ --with-FULLOPTIMIZED turn on full Fortran optimization flags], OPTIMIZED=full, OPTIMIZED=$OPTIMIZED)dnl AC_ARG_ENABLE(ultraoptimize,[ --enable-ultraoptimize turn on ultraoptimization flags],dnl OPTIMIZED=ultra, OPTIMIZED=$OPTIMIZED)AC_ARG_WITH( DEBUG, [ --enable-debug turn on debugging, turn off optimization.], DEBUG=yes, DEBUG=no)dnl ----------------------------------------------------------------------dnl Check on host and f90 since it is possible to have same compiler on dnl different platforms with subtle differencesdnl ----------------------------------------------------------------------case "$host" in *-linux-gnu) if test -n "$F77"; then fbindir=`dirname $F77` flibdir="`dirname $fbindir`/lib" else fbindir="" flibdir="" fi case $F77 in *lf95*) F77_DBL_FLAG="--dbl " F77_OPT_FLAG="-O --prefetch 2" F77_NOOPT_FLAG="-O0" F77_DEBUG_FLAG="-g --chk" F77_OTHER_FLAG="--ap --pca" dnl Preserve arithmetic precision F77_PIC_FLAG="-shared" ;; *pgf90) F77_DBL_FLAG="-r8 " F77_OPT_FLAG="-fast" dnl SEK: I think fast has all of these other optimizations but not sure dnl F77_OPT_FLAG="-fast -Mcache_align -Munroll -Mdalign -Minline -Mvect=prefetch" F77_NOOPT_FLAG="" F77_DEBUG_FLAG="-g -C -trapuv -Minfo" F77_OTHER_FLAG="-byteswapio" dnl Use little endian for binary compatibility ;; *ifort) F77_DBL_FLAG="-autodouble " F77_OPT_FLAG="-O2" F77_NOOPT_FLAG="-O0" F77_MACH_FLAG="-O2 -tpp7 -xW" F77_DEBUG_FLAG="-g -inline_debug_info" F77_OTHER_FLAG="-cm -w -l32 -w95" dnl Quiet F77_PIC_FLAG="-Kpic" ;; *ifc) F77_DBL_FLAG="-autodouble " F77_OPT_FLAG="-O2" F77_NOOPT_FLAG="-O0" dnl F77_OPT_FLAG="-O2 -tpp7 -xW" dnl Pentium 4 F77_DEBUG_FLAG="-g -inline_debug_info" F77_OTHER_FLAG="-cm -w -l32 -w95" dnl Quiet F77_PIC_FLAG="-Kpic" ;; *bsoft) dnl SEK: Not sure about some of these flags because the naming dnl scheme is so screwed up F77_INCLUDE_FLAG="-p" F77_DBL_FLAG="-N11" F77_OPT_FLAG="-O -B100" F77_NOOPT_FLAG="-O0" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="" F77_LD="$F77 -L$flibdir -lU77 -lfio -lf77math -lf90math" F77_PIC_FLAG="-fpic" ;; *g95) F77_DBL_FLAG="-N11" F77_OPT_FLAG="-O2" F77_NOOPT_FLAG="-O0" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="-fno-second-underscore" ;; *) F77_DBL_FLAG="" F77_OPT_FLAG="-O" F77_NOOPT_FLAG="" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="" ;; esac ;; *apple-darwin*) case $F77 in *xlf90) F77_DBL_FLAG="-autodouble " F77_OPT_FLAG="-O2" F77_NOOPT_FLAG="-O0" dnl F77_OPT_FLAG="-O2 -tpp7 -xW" dnl Pentium 4 F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="-cm -w -l32" dnl Quiet F77_PIC_FLAG="-qpic" ;; *Absoft*) dnl SEK: Not sure about some of these flags because the naming dnl scheme is so screwed up F77_INCLUDE_FLAG="-p" F77_DBL_FLAG="-N11" F77_OPT_FLAG="-O -B100 -cpu:g4" F77_NOOPT_FLAG="-O0" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="-YEXT_NAMES=LCS -YEXT_SFX=_" F77_LD="$F77 -lU77 -lfio -lf77math -lf90math" ;; *) F77_DBL_FLAG="" F77_OPT_FLAG="-O" F77_NOOPT_FLAG="" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="" ;; esac ;; hppa*-hp-hpux*) F77_LD="$F77 +z" ;; alpha*-cray-unicos*) ;; *-*-aix*) F77_DBL_FLAG="-qrealsize=8" F77_OPT_FLAG="-O3 -qstrict -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1" F77_NOOPT_FLAG="-qnoopt" dnl F77_OPT_FLAG="-O2 -tpp7 -xW" F77_DEBUG_FLAG="-g -qcheck -qsigtrap -qflttrap" dnl F77_OTHER_FLAG="-q32 -qfixed -qxlf90=autodealloc" F77_OTHER_FLAG="-qxlf90=autodealloc" dnl autodealloc default on most compilers" F77_PIC_FLAG="-qpic" ;; *-sgi-irix6*) F77_DBL_FLAG="-r8 -d16" F77_OPT_FLAG="-O" F77_NOOPT_FLAG="" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="" F77_LDFLAGS="" ;;esacdnl ----------------------------------------------------------------------dnl Set up default flags by setting variables that haven't been defineddnl ----------------------------------------------------------------------if test -z "$F77_INCLUDE_FLAG"; then F77_INCLUDE_FLAG="-I"fidnl Can't test on all platforms, so this could cause errors.if test -z "$F77_INCLUDE_FLAG"; then F77_PIC_FLAG="-fpic"fidnl ----------------------------------------------------------------------dnl Set flags based on input. Debug flag overwrites optimization flagdnl ----------------------------------------------------------------------if test -n "$F77"; then if test -z "$F77_LD"; then F77_LD=$F77 fi if test -z "$FFLAGS"; then FFLAGS="$F77_OTHER_FLAG" if test "$DOUBLE" = yes; then FFLAGS="$F77_DBL_FLAG $FFLAGS" fi case $OPTIMIZED in yes) FFLAGS="$FFLAGS $F77_OPT_FLAG" ;; ultra) AC_MSG_WARN(May generate code for this processor only.) FFLAGS="$FFLAGS $F77_OPT_FLAG $F77_MACH_FLAG" ;; noopt) FFLAGS="$FFLAGS $F77_NOOPT_FLAG" ;; esac if test "$DEBUG" = yes; then FFLAGS="$F77_DEBUG_FLAG $FFLAGS" fi fielse case $F77 in *g77) F77_DBL_FLAG="" F77_OPT_FLAG="-O2" F77_NOOPT_FLAG="-O0" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="-fno-second-underscore" ;; dnl Add your own system here *) F77_DBL_FLAG="" F77_OPT_FLAG="-O" F77_NOOPT_FLAG="" F77_DEBUG_FLAG="-g" F77_OTHER_FLAG="" ;; esac if test -z "$LD"; then LD=$F77 fi if test -z "$FFLAGS"; then FFLAGS="$F77_OTHER_FLAG" if test "$DOUBLE" = yes; then FFLAGS="$F77_DBL_FLAG $FFLAGS" fi case $OPTIMIZED in yes) FFLAGS="$FFLAGS $F77_OPT_FLAG" ;; full) FFLAGS="$FFLAGS $F77_OPT_FLAG $F77_FULLOPT_FLAG" ;; noopt) FFLAGS="$FFLAGS $F77_NOOPT_FLAG" ;; esac if test "$DEBUG" = yes; then FFLAGS="$F77_DEBUG_FLAG $FFLAGS" fi fifidnl ----------------------------------------------------------------------dnl AC_SUBST everything to allow fine-grained control of compilationdnl ----------------------------------------------------------------------AC_SUBST(FFLAGS)AC_SUBST(F77_LD)AC_SUBST(F77_INCLUDE_FLAG)AC_SUBST(F77_DBL_FLAG)AC_SUBST(F77_OPT_FLAG)AC_SUBST(F77_MACH_FLAG)AC_SUBST(F77_NOOPT_FLAG)AC_SUBST(F77_DEBUG_FLAG)AC_SUBST(F77_OTHER_FLAG)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -