From 6993a6686f43f2313b18142c1e96189a27db2aa3 Mon Sep 17 00:00:00 2001 From: Anthony Green Date: Tue, 30 Oct 2012 06:59:32 -0400 Subject: Fix autoconf macros --- m4/ax_cc_maxopt.m4 | 4 +-- m4/ax_cflags_warn_all.m4 | 3 +- m4/ax_check_compile_flag.m4 | 72 ++++++++++++++++++++++++++++++++++++++++ m4/ax_check_compiler_flags.m4 | 76 ------------------------------------------- m4/ax_gcc_archflag.m4 | 44 +++++++++++++++---------- 5 files changed, 103 insertions(+), 96 deletions(-) create mode 100644 m4/ax_check_compile_flag.m4 delete mode 100644 m4/ax_check_compiler_flags.m4 (limited to 'm4') diff --git a/m4/ax_cc_maxopt.m4 b/m4/ax_cc_maxopt.m4 index 4e75327..f5f7517 100644 --- a/m4/ax_cc_maxopt.m4 +++ b/m4/ax_cc_maxopt.m4 @@ -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 12 +#serial 13 AC_DEFUN([AX_CC_MAXOPT], [ @@ -64,7 +64,7 @@ AC_REQUIRE([AX_COMPILER_VENDOR]) AC_REQUIRE([AC_CANONICAL_HOST]) AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], - acx_maxopt_portable=$withval, acx_maxopt_portable=no) + acx_maxopt_portable=$enableval, acx_maxopt_portable=no) # Try to determine "good" native compiler flags if none specified via CFLAGS if test "$ac_test_CFLAGS" != "set"; then diff --git a/m4/ax_cflags_warn_all.m4 b/m4/ax_cflags_warn_all.m4 index c22e37f..0fa3e18 100644 --- a/m4/ax_cflags_warn_all.m4 +++ b/m4/ax_cflags_warn_all.m4 @@ -58,7 +58,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 13 +#serial 14 AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl @@ -84,6 +84,7 @@ done FLAGS="$ac_save_[]FLAGS" ]) AS_VAR_POPDEF([FLAGS])dnl +AC_REQUIRE([AX_APPEND_FLAG]) case ".$VAR" in .ok|.ok,*) m4_ifvaln($3,$3) ;; .|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;; diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 0000000..c3a8d69 --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 2 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes], + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_check_compiler_flags.m4 b/m4/ax_check_compiler_flags.m4 deleted file mode 100644 index 35bfd2a..0000000 --- a/m4/ax_check_compiler_flags.m4 +++ /dev/null @@ -1,76 +0,0 @@ -# =========================================================================== -# http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) -# -# DESCRIPTION -# -# Check whether the given compiler FLAGS work with the current language's -# compiler, or whether they give an error. (Warnings, however, are -# ignored.) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# LICENSE -# -# Copyright (c) 2009 Steven G. Johnson -# Copyright (c) 2009 Matteo Frigo -# -# This program is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation, either version 3 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# 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 - -AC_DEFUN([AX_CHECK_COMPILER_FLAGS], -[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX -AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: -AS_LITERAL_IF([$1], - [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [ - ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes, - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], - [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes, - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) -eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]) -AC_MSG_RESULT($ax_check_compiler_flags) -if test "x$ax_check_compiler_flags" = xyes; then - m4_default([$2], :) -else - m4_default([$3], :) -fi -])dnl AX_CHECK_COMPILER_FLAGS diff --git a/m4/ax_gcc_archflag.m4 b/m4/ax_gcc_archflag.m4 index 2611bab..3fd050e 100644 --- a/m4/ax_gcc_archflag.m4 +++ b/m4/ax_gcc_archflag.m4 @@ -36,6 +36,7 @@ # # Copyright (c) 2008 Steven G. Johnson # Copyright (c) 2008 Matteo Frigo +# Copyright (c) 2012 Tsukasa Oi # # This program is free software: you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the @@ -63,7 +64,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 10 +#serial 11 AC_DEFUN([AX_GCC_ARCHFLAG], [AC_REQUIRE([AC_PROG_CC]) @@ -84,7 +85,7 @@ if test "x$ax_gcc_arch" = xyes; then ax_gcc_arch="" if test "$cross_compiling" = no; then case $host_cpu in - i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones + i[[3456]]86*|x86_64*) # use cpuid codes AX_GCC_X86_CPUID(0) AX_GCC_X86_CPUID(1) case $ax_cv_gcc_x86_cpuid_0 in @@ -92,18 +93,24 @@ case $host_cpu in case $ax_cv_gcc_x86_cpuid_1 in *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; *5??:*:*:*) ax_gcc_arch=pentium ;; - *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; - *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6??:*:*:*) ax_gcc_arch=pentiumpro ;; - *f3[[347]]:*:*:*|*f4[1347]:*:*:*) + *0?6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *0?6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6[[9de]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *0?6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *0?6f?:*:*:*|*1?66?:*:*:*) ax_gcc_arch="core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[7d]]?:*:*:*) ax_gcc_arch="penryn core2 pentium-m pentium3 pentiumpro" ;; + *1?6[[aef]]?:*:*:*|*2?6[[5cef]]?:*:*:*) ax_gcc_arch="corei7 core2 pentium-m pentium3 pentiumpro" ;; + *1?6c?:*:*:*|*[[23]]?66?:*:*:*) ax_gcc_arch="atom core2 pentium-m pentium3 pentiumpro" ;; + *2?6[[ad]]?:*:*:*) ax_gcc_arch="corei7-avx corei7 core2 pentium-m pentium3 pentiumpro" ;; + *0?6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *6??:*:*:*) ax_gcc_arch="core2 pentiumpro" ;; + ?000?f3[[347]]:*:*:*|?000?f4[1347]:*:*:*|?000?f6?:*:*:*) case $host_cpu in - x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; - *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; - esac ;; - *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + ?000?f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; esac ;; *:68747541:*:*) # AMD case $ax_cv_gcc_x86_cpuid_1 in @@ -121,10 +128,13 @@ case $host_cpu in ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; *) ax_gcc_arch="athlon-4 athlon k7" ;; esac ;; - *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; - *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; - *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; - *f??:*:*:*) ax_gcc_arch="k8" ;; + ?00??f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + ?00??f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + ?00??f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + ?00??f??:*:*:*) ax_gcc_arch="k8" ;; + ?05??f??:*:*:*) ax_gcc_arch="btver1 amdfam10 k8" ;; + ?06??f??:*:*:*) ax_gcc_arch="bdver1 amdfam10 k8" ;; + *f??:*:*:*) ax_gcc_arch="amdfam10 k8" ;; esac ;; *:746e6543:*:*) # IDT case $ax_cv_gcc_x86_cpuid_1 in -- cgit v1.2.1