From 4130e1972d001143e5e9f3c6b65f2a6f9524169e Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Fri, 3 Feb 2012 13:18:27 -0600 Subject: Refresh autoconf-archive m4 scripts --- m4/ax_cc_maxopt.m4 | 18 ++++--- m4/ax_cflags_warn_all.m4 | 134 +++++++++++------------------------------------ m4/ax_compiler_vendor.m4 | 43 +++++++++++---- m4/ax_enable_builddir.m4 | 2 +- m4/ax_gcc_archflag.m4 | 8 +-- 5 files changed, 78 insertions(+), 127 deletions(-) (limited to 'm4') diff --git a/m4/ax_cc_maxopt.m4 b/m4/ax_cc_maxopt.m4 index 2957da7..4e75327 100644 --- a/m4/ax_cc_maxopt.m4 +++ b/m4/ax_cc_maxopt.m4 @@ -21,7 +21,7 @@ # by the code (e.g. for gcc's -fstrict-aliasing), and that floating-point # computations can be re-ordered as needed. # -# Requires macros: AX_CHECK_COMPILER_FLAGS, AX_COMPILER_VENDOR, +# Requires macros: AX_CHECK_COMPILE_FLAG, AX_COMPILER_VENDOR, # AX_GCC_ARCHFLAG, AX_GCC_X86_CPUID. # # LICENSE @@ -55,7 +55,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 11 +#serial 12 AC_DEFUN([AX_CC_MAXOPT], [ @@ -90,7 +90,7 @@ if test "$ac_test_CFLAGS" != "set"; then else xlc_opt="-qtune=auto" fi - AX_CHECK_COMPILER_FLAGS($xlc_opt, + AX_CHECK_COMPILE_FLAG($xlc_opt, CFLAGS="-O3 -qansialias -w $xlc_opt", [CFLAGS="-O3 -qansialias -w" echo "******************************************************" @@ -125,7 +125,7 @@ if test "$ac_test_CFLAGS" != "set"; then esac if test "x$icc_flags" != x; then for flag in $icc_flags; do - AX_CHECK_COMPILER_FLAGS($flag, [icc_archflag=$flag; break]) + AX_CHECK_COMPILE_FLAG($flag, [icc_archflag=$flag; break]) done fi AC_MSG_CHECKING([for icc architecture flag]) @@ -140,11 +140,15 @@ if test "$ac_test_CFLAGS" != "set"; then # default optimization flags for gcc on all systems CFLAGS="-O3 -fomit-frame-pointer" + # -malign-double for x86 systems + AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double") + # -fstrict-aliasing for gcc-2.95+ - AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing, + AX_CHECK_COMPILE_FLAG(-fstrict-aliasing, CFLAGS="$CFLAGS -fstrict-aliasing") - AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math") + # note that we enable "unsafe" fp optimization with other compilers, too + AX_CHECK_COMPILE_FLAG(-ffast-math, CFLAGS="$CFLAGS -ffast-math") AX_GCC_ARCHFLAG($acx_maxopt_portable) ;; @@ -161,7 +165,7 @@ if test "$ac_test_CFLAGS" != "set"; then CFLAGS="-O3" fi - AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [ + AX_CHECK_COMPILE_FLAG($CFLAGS, [], [ echo "" echo "********************************************************" echo "* WARNING: The guessed CFLAGS don't seem to work with *" diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4 index 7625580..c22e37f 100644 --- a/m4/ax_cflags_warn_all.m4 +++ b/m4/ax_cflags_warn_all.m4 @@ -25,6 +25,8 @@ # - $3 action-if-found : add value to shellvariable # - $4 action-if-not-found : nothing # +# NOTE: These macros depend on AX_APPEND_FLAG. +# # LICENSE # # Copyright (c) 2008 Guido U. Draheim @@ -56,99 +58,14 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 10 +#serial 13 -AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl +AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], VAR,[VAR="no, unknown" - AC_LANG_PUSH([C]) - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % -Wall" dnl GCC - "-xstrconst % -v" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix - "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - "-ansi -ansiE % -fullwarn" dnl IRIX - "+ESlit % +w1" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_POP([C]) -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], -VAR,[VAR="no, unknown" - AC_LANG_PUSH([C++]) - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % -Wall" dnl GCC - "-xstrconst % -v" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix - "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - "-ansi -ansiE % -fullwarn" dnl IRIX - "+ESlit % +w1" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_POP([C++]) -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl -AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], -VAR,[VAR="no, unknown" - AC_LANG_PUSH([Fortran]) - ac_save_[]FLAGS="$[]FLAGS" +ac_save_[]FLAGS="$[]FLAGS" for ac_arg dnl in "-warn all % -warn all" dnl Intel "-pedantic % -Wall" dnl GCC @@ -164,25 +81,16 @@ do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_POP([Fortran]) +FLAGS="$ac_save_[]FLAGS" ]) +AS_VAR_POPDEF([FLAGS])dnl case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; + .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; + *) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;; esac AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - +])dnl AX_FLAGS_WARN_ALL dnl implementation tactics: dnl the for-argument contains a list of options. The first part of dnl these does only exist to detect the compiler - usually it is @@ -193,3 +101,21 @@ dnl like -Woption or -Xoption as they think of it is a pass-through dnl to later compile stages or something. The "%" is used as a dnl delimiter. A non-option comment can be given after "%%" marks dnl which will be shown but not added to the respective C/CXXFLAGS. + +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C]) +]) + +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([C++]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([C++]) +]) + +AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl +AC_LANG_PUSH([Fortran]) +AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4]) +AC_LANG_POP([Fortran]) +]) diff --git a/m4/ax_compiler_vendor.m4 b/m4/ax_compiler_vendor.m4 index 3214706..73e32ea 100644 --- a/m4/ax_compiler_vendor.m4 +++ b/m4/ax_compiler_vendor.m4 @@ -44,20 +44,41 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 9 +#serial 11 AC_DEFUN([AX_COMPILER_VENDOR], -[ -AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, - [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown - # note: don't check for gcc first since some other compilers define __GNUC__ - for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do - vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" +[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [# note: don't check for gcc first since some other compilers define __GNUC__ + vendors="intel: __ICC,__ECC,__INTEL_COMPILER + ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ + pathscale: __PATHCC__,__PATHSCALE__ + clang: __clang__ + gnu: __GNUC__ + sun: __SUNPRO_C,__SUNPRO_CC + hp: __HP_cc,__HP_aCC + dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER + borland: __BORLANDC__,__TURBOC__ + comeau: __COMO__ + cray: _CRAYC + kai: __KCC + lcc: __LCC__ + sgi: __sgi,sgi + microsoft: _MSC_VER + metrowerks: __MWERKS__ + watcom: __WATCOMC__ + portland: __PGI + unknown: UNKNOWN" + for ventest in $vendors; do + case $ventest in + *:) vendor=$ventest; continue ;; + *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; + esac AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ -#if !($vencpp) - thisisanerror; -#endif -])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) + #if !($vencpp) + thisisanerror; + #endif + ])], [break]) done + ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` ]) ]) diff --git a/m4/ax_enable_builddir.m4 b/m4/ax_enable_builddir.m4 index 98ea911..3fb8731 100644 --- a/m4/ax_enable_builddir.m4 +++ b/m4/ax_enable_builddir.m4 @@ -79,7 +79,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 22 +#serial 23 AC_DEFUN([AX_ENABLE_BUILDDIR],[ AC_REQUIRE([AC_CANONICAL_HOST])[]dnl diff --git a/m4/ax_gcc_archflag.m4 b/m4/ax_gcc_archflag.m4 index d37a913..2611bab 100644 --- a/m4/ax_gcc_archflag.m4 +++ b/m4/ax_gcc_archflag.m4 @@ -11,7 +11,7 @@ # This macro tries to guess the "native" arch corresponding to the target # architecture for use with gcc's -march=arch or -mtune=arch flags. If # found, the cache variable $ax_cv_gcc_archflag is set to this flag and -# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is is set to +# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is set to # "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is # to add $ax_cv_gcc_archflag to the end of $CFLAGS. # @@ -27,7 +27,7 @@ # When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is # called unless the user specified --with-gcc-arch manually. # -# Requires macros: AX_CHECK_COMPILER_FLAGS, AX_GCC_X86_CPUID +# Requires macros: AX_CHECK_COMPILE_FLAG, AX_GCC_X86_CPUID # # (The main emphasis here is on recent CPUs, on the principle that doing # high-performance computing on old hardware is uncommon.) @@ -63,7 +63,7 @@ # modified version of the Autoconf Macro, you may extend this special # exception to the GPL to apply to your modified version as well. -#serial 8 +#serial 10 AC_DEFUN([AX_GCC_ARCHFLAG], [AC_REQUIRE([AC_PROG_CC]) @@ -197,7 +197,7 @@ for arch in $ax_gcc_arch; do flags="-march=$arch -mcpu=$arch -m$arch" fi for flag in $flags; do - AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break]) + AX_CHECK_COMPILE_FLAG($flag, [ax_cv_gcc_archflag=$flag; break]) done test "x$ax_cv_gcc_archflag" = xunknown || break done -- cgit v1.2.1