📄 fcflags.m4
字号:
dnl ######################################################################dnldnl File: fcflags.m4dnldnl Purpose: dnl Given FC (f90) compiler, determine flagsdnl See also fc.m4 and fcinterop.m4dnldnl Variables set here includednl FC_LDdnl FC_DBL_FLAGdnl Promote r4 to r8dnl FC_WARN_FLAGdnl Turn on additional warnings. NEED WORK: defined only for lf95! dnl FC_OPT_FLAGdnl Normal optimizationdnl FC_MACH_FLAGdnl Machine dependent flags for "ultra" optimization. NEEDS WORK!!dnl FC_NOOPT_FLAGdnl o Sometimes better to explicitly turn off optimizationdnl FC_DEBUG_FLAGdnl Include check array conformance if availablednl FC_OTHER_FLAGdnl Things should probably be used, but are not strictly necessarydnl FC_INCLUDE_FLAGdnl Because Absoft does not use the -I flag for include directoriesdnl FC_PIC_FLAGdnl Position-Independent Code (for shared libraries)dnl FCFLAGSdnldnl Description of differences between levels of optimization: dnl Standard: basic optimizations that are low-risk and do not lead todnl very long compilation times or code bloat. Full compliance with thednl IEEE-754 standard for floating point accuracy. No fancy tricks likednl loop unrolling, inlining of non-inline functions, instruction reordering,dnl rewriting floating point expressions, or inter-procedural analysis. Nodnl cpu-specific code. This generally corresponds to '-O2' or so.dnl dnl Full: aggressive optimizations that might lead to longer compilednl times and/or code size increase. Compliance with the IEEE standarddnl is relaxed. Function inlining permitted. Other fancy tricks also alloweddnl to some extend. No cpu-specific code. This generally corresponds to '-O3'.dnl dnl Ultra: all caution to the wind. Compliance with IEEE goes out of thednl window. Any trick the compiler provides may be used. Code can bednl tailored to a specific cpu. Compiler options are highly platform-dependentdnl dnl NOTES: dnl o FC is the autotools awful variable name for any fortrandnl version beyond F77. We use it interchangably with f90dnldnl Version: $Id: fcflags.m4,v 1.3 2005/07/13 00:02:25 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(FCFLAGS, [ --with-FCFLAGS="MyFCFLAGS" to set Fortran flags with Myf90], FCFLAGS="$withval")AC_ARG_ENABLE(debug,[ --enable-debug turn on debug and turn off optimizaton], DEBUG=yes, DEBUG=no)AC_ARG_ENABLE(optimize,[ --enable-optimize turn on optimization flags], OPTIMIZED=yes, OPTIMIZED=no)AC_ARG_ENABLE(fulloptimize,[ --enable-fulloptimize turn on full optimization flags], OPTIMIZED=full, OPTIMIZED=$OPTIMIZED)dnl NOT ENABLED YETdnl AC_ARG_ENABLE(ultraoptimize,[ --enable-ultraoptimize turn on ultraoptimization flags],dnl OPTIMIZED=ultra, OPTIMIZED=$OPTIMIZED)dnl AC_ARG_ENABLE(profiling,[ --enable-profiling turn on profiling],dnl PROFILING=yes, PROFILING=no)dnl ----------------------------------------------------------------------dnl Check on host and f90 since it is possible to have same compiler on dnl different platforms with subtle differencesdnl ----------------------------------------------------------------------if test -n "$FC"; then fbindir=`dirname $FC` flibdir="`dirname $fbindir`/lib"else fbindir="" flibdir=""ficase "$host" in *-linux-gnu) case $FC in *lf95*) FC_DBL_FLAG="--dbl " FC_OPT_FLAG="-O --prefetch 2" FC_NOOPT_FLAG="-O0" FC_DEBUG_FLAG="-g --chk" FC_OTHER_FLAG="--ap --pca" dnl Preserve arithmetic precision FC_WARN_FLAG="--f95" dnl turn on Fortran 95 confirmation warning FC_PIC_FLAG="-shared" ;; *pgf90) FC_DBL_FLAG="-r8 " FC_OPT_FLAG="-fast" dnl SEK: I think fast has all of these other optimizations but not sure dnl FC_OPT_FLAG="-fast -Mcache_align -Munroll -Mdalign -Minline -Mvect=prefetch" FC_NOOPT_FLAG="" FC_DEBUG_FLAG="-g -C -trapuv -Minfo" FC_OTHER_FLAG="-byteswapio" dnl Use little endian for binary compatibility ;; *ifort) FC_DBL_FLAG="-autodouble " FC_OPT_FLAG="-O2" FC_NOOPT_FLAG="-O0" FC_MACH_FLAG="-O2 -tpp7 -xW" FC_DEBUG_FLAG="-g -inline_debug_info" FC_OTHER_FLAG="-cm -w -w95" dnl Quiet FC_PIC_FLAG="-Kpic" ;; *ifc) FC_DBL_FLAG="-autodouble " FC_OPT_FLAG="-O2" FC_NOOPT_FLAG="-O0" dnl FC_OPT_FLAG="-O2 -tpp7 -xW" dnl Pentium 4 FC_DEBUG_FLAG="-g -inline_debug_info" FC_OTHER_FLAG="-cm -w -l32 -w95" dnl Quiet FC_PIC_FLAG="-Kpic" ;; *bsoft) dnl SEK: Not sure about some of these flags because the naming dnl scheme is so screwed up FC_INCLUDE_FLAG="-p" FC_DBL_FLAG="-N11" FC_OPT_FLAG="-O -B100" FC_NOOPT_FLAG="-O0" FC_DEBUG_FLAG="-g" FC_OTHER_FLAG="" FC_LD="$FC -L$flibdir -lU77 -lfio -lf77math -lf90math" FC_PIC_FLAG="-fpic" ;; *g95) FC_DBL_FLAG="-N11" FC_OPT_FLAG="-O2" FC_NOOPT_FLAG="-O0" FC_DEBUG_FLAG="-g" FC_OTHER_FLAG="-fno-second-underscore" ;; *) FC_DBL_FLAG="" FC_OPT_FLAG="-O" FC_NOOPT_FLAG="" FC_DEBUG_FLAG="-g" FC_OTHER_FLAG="" ;; esac ;; *apple-darwin*) case $FC in *xlf90) FC_DBL_FLAG="-autodouble " FC_OPT_FLAG="-O2" FC_NOOPT_FLAG="-O0" dnl FC_OPT_FLAG="-O2 -tpp7 -xW" dnl Pentium 4 FC_DEBUG_FLAG="-g" dnl qextname adds underscores to lookup table. FC_OTHER_FLAG="-w -l32 -qextname -qsuffix=f=f90 -qalign=natural" dnl Quiet FC_PIC_FLAG="-qpic" ;; *Absoft*) dnl SEK: Not sure about some of these flags because the naming dnl scheme is so screwed up FC_INCLUDE_FLAG="-p" FC_DBL_FLAG="-N11" FC_OPT_FLAG="-O -B100 -cpu:g4" FC_NOOPT_FLAG="-O0" FC_DEBUG_FLAG="-g" FC_OTHER_FLAG="-YEXT_NAMES=LCS -YEXT_SFX=_" FC_LD="$FC -lU77 -lfio -lf77math -lf90math" ;; *) FC_DBL_FLAG="" FC_OPT_FLAG="-O" FC_NOOPT_FLAG="" FC_DEBUG_FLAG="-g" FC_OTHER_FLAG="" ;; esac ;; hppa*-hp-hpux*) FC_LD="$FC +z" ;; alpha*-cray-unicos*) ;; *-*-aix*) FC_DBL_FLAG="-qrealsize=8" FC_OPT_FLAG="-O3 -qstrict -qarch=pwr3 -qtune=pwr3 -qcache=auto -qmaxmem=-1" FC_NOOPT_FLAG="-qnoopt" dnl FC_OPT_FLAG="-O2 -tpp7 -xW" dnl FC_DEBUG_FLAG="-g -qcheck -qsigtrap -qflttrap" dnl Skip underflow since that can trip things up. FC_DEBUG_FLAG="-g -qcheck -qsigtrap -qflttrap=overflow:zerodivide:invalid:enable" dnl FC_OTHER_FLAG="-q32 -qfixed -qxlf90=autodealloc" dnl DEFAULT_FFLAGS="-g -O2 -qextname -qsuffix=f=f90 -qalign=natural" FC_OTHER_FLAG="-qxlf90=autodealloc" dnl autodealloc default on most compilers" FC_PIC_FLAG="-qpic" ;; *-sgi-irix6*) FC_DBL_FLAG="-r8 -d16" FC_OPT_FLAG="-O" FC_NOOPT_FLAG="" FC_DEBUG_FLAG="-g" FC_OTHER_FLAG="" FC_LDFLAGS="" ;;esacdnl ----------------------------------------------------------------------dnl Set up default flags by setting variables that haven't been defineddnl ----------------------------------------------------------------------if test -z "$FC_INCLUDE_FLAG"; then FC_INCLUDE_FLAG="-I"fidnl Can't test on all platforms, so this could cause errors.if test -z "$FC_PIC_FLAG"; then FC_PIC_FLAG="-fpic"fidnl ----------------------------------------------------------------------dnl Set flags based on input. Debug flag overwrites optimization flagdnl ----------------------------------------------------------------------if test -n "$FC"; then if test -z "$FC_LD"; then FC_LD=$FC fi if test -z "$FCFLAGS"; then FCFLAGS="$FC_OTHER_FLAG" if test "$DOUBLE" = yes; then FCFLAGS="$FC_DBL_FLAG $FCFLAGS" fi case $OPTIMIZED in yes) FCFLAGS="$FCFLAGS $FC_OPT_FLAG" ;; ultra) AC_MSG_WARN(May generate code for this processor only.) FCFLAGS="$FCFLAGS $FC_OPT_FLAG $FC_MACH_FLAG" ;; noopt) FCFLAGS="$FCFLAGS $FC_NOOPT_FLAG" ;; esac if test "$DEBUG" = yes; then FCFLAGS="$FC_DEBUG_FLAG $FCFLAGS" fi fifidnl ----------------------------------------------------------------------dnl AC_SUBST everything to allow fine-grained control of compilationdnl ----------------------------------------------------------------------AC_SUBST(FCFLAGS)AC_SUBST(FC_LD)AC_SUBST(FC_INCLUDE_FLAG)AC_SUBST(FC_DBL_FLAG)AC_SUBST(FC_OPT_FLAG)AC_SUBST(FC_MACH_FLAG)AC_SUBST(FC_NOOPT_FLAG)AC_SUBST(FC_DEBUG_FLAG)AC_SUBST(FC_OTHER_FLAG)AC_SUBST(FC_PIC_FLAG)AC_SUBST(FC_WARN_FLAG)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -