📄 flags.m4
字号:
dnl ######################################################################dnldnl File: flags.m4dnldnl Purpose: To determine the flags for C and C++ compilation. In thednl case where the C or C++ compiler is mpiCC, one must dnl first parse the name of the real compiler out of thednl mpiCC script.dnldnl Version: $Id: flags.m4,v 1.164 2005/08/01 23:58:51 cary Exp $dnldnl Copyright Tech-X Corporation, 2001. Redistribution allowed provideddnl this copyright statement remains intact.dnldnl ######################################################################dnl echo $ac_n "setting the flags per system and compiler... $ac_c" 1>&6echo "Setting the flags per system and compiler:" $CXX#default valuesSHAREDLIBFLAGS="-shared"# Extract the real compilerif test -n "$CXX"; then isabs=`echo $CXX | grep '^/'` if test -n "$isabs"; then ABSCXX=$CXX else AC_PATH_PROG(ABSCXX, $CXX) fi CXXBASE=`basename $ABSCXX` case $CXXBASE in mpiCC | mpicxx) # echo "Looking for compiler in" $ABSCXX # REALCXX=`grep CCCBASE= $ABSCXX | sed 's/^.*=//' | sed 's/\"//g'` REALCXX=`$ABSCXX -show | sed 's/ .*$//'` if test -z "$REALCXX"; then AC_MSG_ERROR(Unable to determine the real compiler inside of $ABSCXX) fi echo MPICHG2 = $MPICHG2 if test "$MPICHG2" = yes; then REALCXX=`grep TEST_GC= $REALCXX | sed 's/^.*=//' | sed 's/\"//g'` fi ;; mpic++) # echo "Looking for compiler in" $ABSCXX REALCXX=g++ ;; mpCC) REALCXX=xlC ;; mpCC_r) REALCXX=xlC_r ;; *) REALCXX=$CXXBASE ;; esac echo Real C++ compiler is \`$REALCXX\'else echo No C++ compiler specified REALCXX=nocxxfi#The following is used to make sure that e.g. pathscale is foundREALCXX=`basename $REALCXX`# Check for optimizationAC_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)AC_ARG_ENABLE(ultraoptimize,[ --enable-ultraoptimize turn on ultraoptimization flags],OPTIMIZED=ultra, OPTIMIZED=$OPTIMIZED)AC_ARG_ENABLE(profiling,[ --enable-profiling turn on profiling],PROFILING=yes, PROFILING=no)AC_ARG_ENABLE(libhpm,[ --enable-libhpm use libhpm performance counters],LIBHPM=yes, LIBHPM=no)AC_ARG_ENABLE(assert,[ --enable-assert turn on assertion checking],ASSERT=yes, ASSERT=no)CRAY=""CRAY_INSTANTIATE=""export CRAYcase "$REALCXX" in *g++ | *g++3 | path* ) CPPFLAGS="" CXXFLAGS="-Wall -Wno-unused" CXXDEPFLAGS="-M" CXXDEP="$CXX -M >depend.u" CXXPROFILE_FLAG=-pg if test "$PROFILING" = "yes"; then CXX_PROFILE_FLAG="-pg"; fi AR="ar cr" AR_FLAGS=" " ARFLAGS=" " case "$host" in rs6000-ibm-aix*) CXX_PIC_FLAG=" " ;; hppa*-hp-hpux*) CXX_PIC_FLAG="-fpic" ;; *) CXX_PIC_FLAG="-fPIC" ;; esac# Get version to set compiler directory AC_MSG_CHECKING(g++ version) # echo g++ version ver=`$CXX --version | sed -n '1p' | sed 's/^.*GCC. //' | sed 's/ .*$//'` AC_MSG_RESULT($ver) case $ver in 4.0*) COMPDIR=gcc4.0 ;; 3.4*) COMPDIR=gcc3.4 ;; 3.3*) COMPDIR=gcc3.3 OPTIFLAGS="$OPTIFLAGS --param max-unrolled-insns=10" ;; 3.2*) COMPDIR=gcc3.2 ;; 3.1*) COMPDIR=gcc3.1 ;; 3.0*) COMPDIR=gcc3.0 ;; 2.96*) COMPDIR=gcc2.96 ;; 2.95* | pgcc-2.95*) COMPDIR=gcc2.95 case $host in *-*-solaris*) AC_MSG_WARN(gcc2.95-solaris may not work. In that case try egcs1.1.2.) ;; esac ;; egcs-2.91*) COMPDIR=egcs1.1 ;; *) if test "$PACKAGE" = "ntcdata" -o "$PACKAGE" = "ntcphys" ; then AC_MSG_ERROR(Ancient gcc. Must be egcs1.1.1 or gcc2.95 or later.) else AC_MSG_WARN(Caution: version $ver is not known to work.) COMPDIR=gcc3.1 fi ;; esac# Set optimization flags echo OPTIMIZED = $OPTIMIZED processor=`uname -p` if test "$processor" = unknown; then processor=`uname -m`; fi sys=`uname -s` case $OPTIMIZED in yes) OPTIFLAGS="-g -O2 -pipe" case "$processor" in athlon) OPTIFLAGS="$OPTIFLAGS -mcpu=athlon" ;; esac ;; full | ultra) OPTIFLAGS="-O3 -pipe" AC_MSG_WARN(May generate code for this processor only.) # echo sys = $sys case "$sys" in Linux) OPTIFLAGS="$OPTIFLAGS -funroll-loops" case $processor in athlon) ismp=`cat /proc/cpuinfo | grep "model name" | grep " MP "` if test -n "$ismp"; then processor="${processor}-mp"; fi OPTIFLAGS="$OPTIFLAGS -march=$processor" ;; i686) isintel=`cat /proc/cpuinfo | grep "model name" | grep " Intel"` if test -n "$isintel"; then thisproc="pentium4" else isathlon=`cat /proc/cpuinfo | grep "model name" | grep " Athlon"` if test -n "$isathlon"; then thisproc="athlon" ismp=`cat /proc/cpuinfo | grep "model name" | grep " MP "` if test -n "$ismp"; then thisproc="${thisproc}-mp"; fi fi fi if test -n "$thisproc"; then OPTIFLAGS="$OPTIFLAGS -march=$thisproc" fi ;; esac ;; Darwin) machine=`machine` # OPTIFLAGS="$OPTIFLAGS -funroll-loops --param max-unrolled-insns=10 -fprefetch-loop-arrays -faltivec" # Adding -faltivec causes a crash on the G5 SHAREDLIBFLAGS="-dynamiclib" OPTIFLAGS="$OPTIFLAGS -funroll-loops" case "$machine" in ppc7450) OPTIFLAGS="$OPTIFLAGS -mcpu=7450" ;; ppc970) OPTIFLAGS="$OPTIFLAGS -mcpu=970" ;; esac ;; esac case $ver in 3.3*) OPTIFLAGS="$OPTIFLAGS --param max-unrolled-insns=10" case "$processor" in athlon) # Since this is not working I am commenting it out - CPN 2/21/05 # OPTIFLAGS="$OPTIFLAGS -mfpmath=sse" # sse not working? ;; esac ;; esac# Add options for ultra or fastmath if test $OPTIMIZED = ultra; then AC_MSG_WARN(May generate code that is not IEEE math compliant.) OPTIFLAGS="$OPTIFLAGS -ffast-math" fi# Full optimize generates cpu specific code ;; *) OPTIFLAGS="-g -DDEBUG" ;; esac# Check for -fsquangle AC_MSG_CHECKING(for -fsquangle) case "$host" in *-cray-unicos*) AC_MSG_RESULT(no) ;; *) # AC_PATH_PROG(gxxtmp, g++) absgxx=`echo $ABSCXX | sed "s/^.* //g"` # echo absgxx = $absgxx bincxxdir=`dirname "$absgxx" | sed "s/ //g"` topcxxdir=`dirname "$bincxxdir" | sed "s/ //g"` libcxxdir=$topcxxdir/lib # echo libcxxdir = $libcxxdir # sqngtst="$NM $libcxxdir/libstdc++.a* 2>/dev/null | grep t12basic_string3ZX01ZX11ZX21_RB2" # echo sqngtst = $sqngtst sqng=`$NM $libcxxdir/libstdc++.a* 2>/dev/null | grep t12basic_string3ZX01ZX11ZX21_RB2` # echo sqng = $sqng if test -n "$sqng"; then CXXFLAGS="$CXXFLAGS -fsquangle" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ;; esac ;; *aCC) case "$host" in hppa*-hp-hpux*) ver=`aCC -V 2>&1 | sed "s/^.*A\.//"` minver=`echo $ver | sed "s/^.*\.//"` majver=`echo $ver | sed "s/\..*$//"` if test $majver -lt 3 -o $majver -eq 3 -a $minver -lt 13; then AC_MSG_WARN(aCC not tested for versions less than A.03.13 on HPUX11.00) fi CPPFLAGS="" CXX_PIC_FLAG="+z" CXXFLAGS="-Aa +w +W152,169,361,392,495,431,641,655,5004" # Tried adding +p, but this caused incorrect compilation failures CXXDEPFLAGS="+M" CXXDEP="$CXX +M >depend.u" AR="ar cq" AR_FLAGS=" " ARFLAGS=" " if test "$OPTIMIZED" = "no"; then OPTIFLAGS="-g -DDEBUG" else OPTIFLAGS="-O"; fi COMPDIR=aCC ;; *) AC_MSG_ERROR(Compiler $CXX not supported for host $host.) ;; esac ;; KCC | mpKCC) CPPFLAGS="" CXX_PIC_FLAG=" " case "$host" in *86-pc-linux-*) CXXFLAGS="--one_instantiation_per_object --display_error_number --diag_suppress 837 -DHAS_BOOL_TYPE -D_OSF_SOURCE" CXXDEP="$CXX -M >depend.u" ;; *-cray-unicos*) CXXFLAGS="--one_instantiation_per_object --display_error_number --diag_suppress 837 -DHAS_BOOL_TYPE -D_XOPEN_SOURCE -D_OSF_SOURCE" CXXDEP="$CXX -M >depend.u" ;; *) CXXFLAGS="--one_instantiation_per_object --display_error_number --diag_suppress 837 -DHAS_BOOL_TYPE -D_XOPEN_SOURCE -D_OSF_SOURCE" CXXDEP="$CXX -M >depend.u" ;; esac CXXDEPFLAGS="-M" AR="KCC -o" AR_FLAGS=" " ARFLAGS=" " # if test "$OPTIMIZED" = "no"; then OPTIFLAGS="+K0 -g -DDEBUG" if test "$OPTIMIZED" = "no"; then OPTIFLAGS="-g -DDEBUG" else OPTIFLAGS="+K3"; fi COMPDIR=KCC ;; cxx) CPPFLAGS="" CXX_PIC_FLAG=" " CXXDEPFLAGS="-M -noimplicit_include" CXXDEP="$CXX -M -noimplicit_include >depend.u" AR="ar cr" AR_FLAGS=" " ARFLAGS=" " COMPDIR=cxx case "$host" in alpha*-dec-osf*) CXXFLAGS="-msg_disable 846 -D__USE_STD_IOSTREAM -msg_disable narrowptr" CXX_REPOSITORY="cxx_repository/*.o" if test "$OPTIMIZED" = "no"; then OPTIFLAGS="-g -DDEBUG" else OPTIFLAGS="-O3"; fi # Optimization does not work ;; alphaev6*-linux-*) CXXFLAGS=" -arch ev6 -tune ev6"# CXX_REPOSITORY="cxx_repository/*.o" if test "$OPTIMIZED" = "no"; then OPTIFLAGS="-g -DDEBUG" else OPTIFLAGS="-O3"; fi ;; *) AC_MSG_ERROR(Compiler $CXX not supported for host $host.) ;; esac ;; CC) case "$host" in *-sgi-irix6*) CPPFLAGS="" CXX_PIC_FLAG=" " # changes 9 Oct 01 to get oopic to compile # CXXFLAGS="-n32 -exceptions -no_auto_include -D_PTHREADS -LANG:ansi-for-init-scope=ON -LANG:std -OPT:Olimit_opt=on" # CXXFLAGS="-n32 -exceptions -no_auto_include -D_PTHREADS -LANG:ansi-for-init-scope=ON -OPT:Olimit_opt=on" # Change from Irek for dxhdf5. If causes problems elsewhere, # we need to test on the project CXXFLAGS="-exceptions -no_auto_include -LANG:std -LANG:ansi-for-\init-scope=ON -OPT:Olimit_opt=on -woff 1174,1552" CXXDEPFLAGS="-M" CXXDEP="$CXX -M" CXXDEP="$CXX -M >depend.u" AR="CC -ar -o" AR_FLAGS=" " ARFLAGS=" " if test "$OPTIMIZED" = "no"; then OPTIFLAGS="-g -DDEBUG" else OPTIFLAGS="-O"; fi COMPDIR=CC ;; *-*-solaris*) CPPFLAGS=" " CXX_PIC_FLAG="-KPIC" CXXFLAGS="-D__EXTENSIONS__ -D_POSIX_SOURCE" CXXDEPFLAGS="-xM1" CXXDEP="$CXX -xM1 >depend.u" AR="CC -xar -o" AR_FLAGS=" " ARFLAGS=" " if test "$OPTIMIZED" = "no"; then OPTIFLAGS="-g -DDEBUG" else OPTIFLAGS="-g -DDEBUG -O" echo "Solaris CC may not work with optimization. Also needs -g -DDEBUG" fi COMPDIR=CC ;; *-cray-unicos*)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -