Greg Jandl to SDL
authorSam Lantinga <slouken@libsdl.org>
Tue, 18 Jan 2011 22:40:45 -0800
changeset 50295d7d48157be7
parent 5028 fffb33ae85e8
child 5030 6a0803e47c7b
Greg Jandl to SDL

I did some digging, and I think I've found a better solution. By
including some additional .m4 macros in the acinclude directory
(http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html,
http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html and
http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html)
then using the patch below (same as previous patch + one line change
to configure.in), SDL will build correctly out of the box.

The arch can then be overridden by --with-gcc-arch=<arch> (most will
probably want to build with i686 there for general distribution) or
--without-gcc-arch, to disable setting the arch all together.

On my Atom netbook, I get -march=PentiumPro by default, which works
great, as does --with-gcc-arch=i686.
acinclude/ax_check_compiler_flags.m4
acinclude/ax_gcc_archflag.m4
acinclude/ax_gcc_x86_cpuid.m4.htm
configure.in
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/acinclude/ax_check_compiler_flags.m4	Tue Jan 18 22:40:45 2011 -0800
     1.3 @@ -0,0 +1,76 @@
     1.4 +# ===========================================================================
     1.5 +#  http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html
     1.6 +# ===========================================================================
     1.7 +#
     1.8 +# SYNOPSIS
     1.9 +#
    1.10 +#   AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
    1.11 +#
    1.12 +# DESCRIPTION
    1.13 +#
    1.14 +#   Check whether the given compiler FLAGS work with the current language's
    1.15 +#   compiler, or whether they give an error. (Warnings, however, are
    1.16 +#   ignored.)
    1.17 +#
    1.18 +#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
    1.19 +#   success/failure.
    1.20 +#
    1.21 +# LICENSE
    1.22 +#
    1.23 +#   Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
    1.24 +#   Copyright (c) 2009 Matteo Frigo
    1.25 +#
    1.26 +#   This program is free software: you can redistribute it and/or modify it
    1.27 +#   under the terms of the GNU General Public License as published by the
    1.28 +#   Free Software Foundation, either version 3 of the License, or (at your
    1.29 +#   option) any later version.
    1.30 +#
    1.31 +#   This program is distributed in the hope that it will be useful, but
    1.32 +#   WITHOUT ANY WARRANTY; without even the implied warranty of
    1.33 +#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    1.34 +#   Public License for more details.
    1.35 +#
    1.36 +#   You should have received a copy of the GNU General Public License along
    1.37 +#   with this program. If not, see <http://www.gnu.org/licenses/>.
    1.38 +#
    1.39 +#   As a special exception, the respective Autoconf Macro's copyright owner
    1.40 +#   gives unlimited permission to copy, distribute and modify the configure
    1.41 +#   scripts that are the output of Autoconf when processing the Macro. You
    1.42 +#   need not follow the terms of the GNU General Public License when using
    1.43 +#   or distributing such scripts, even though portions of the text of the
    1.44 +#   Macro appear in them. The GNU General Public License (GPL) does govern
    1.45 +#   all other use of the material that constitutes the Autoconf Macro.
    1.46 +#
    1.47 +#   This special exception to the GPL applies to versions of the Autoconf
    1.48 +#   Macro released by the Autoconf Archive. When you make and distribute a
    1.49 +#   modified version of the Autoconf Macro, you may extend this special
    1.50 +#   exception to the GPL to apply to your modified version as well.
    1.51 +
    1.52 +#serial 9
    1.53 +
    1.54 +AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
    1.55 +[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
    1.56 +AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
    1.57 +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
    1.58 +AS_LITERAL_IF([$1],
    1.59 +  [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [
    1.60 +      ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
    1.61 +      _AC_LANG_PREFIX[]FLAGS="$1"
    1.62 +      AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
    1.63 +        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
    1.64 +        AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
    1.65 +      _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
    1.66 +  [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
    1.67 +   _AC_LANG_PREFIX[]FLAGS="$1"
    1.68 +   AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
    1.69 +     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
    1.70 +     eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
    1.71 +   _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
    1.72 +eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])
    1.73 +AC_MSG_RESULT($ax_check_compiler_flags)
    1.74 +if test "x$ax_check_compiler_flags" = xyes; then
    1.75 +	m4_default([$2], :)
    1.76 +else
    1.77 +	m4_default([$3], :)
    1.78 +fi
    1.79 +])dnl AX_CHECK_COMPILER_FLAGS
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/acinclude/ax_gcc_archflag.m4	Tue Jan 18 22:40:45 2011 -0800
     2.3 @@ -0,0 +1,215 @@
     2.4 +# ===========================================================================
     2.5 +#      http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html
     2.6 +# ===========================================================================
     2.7 +#
     2.8 +# SYNOPSIS
     2.9 +#
    2.10 +#   AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE])
    2.11 +#
    2.12 +# DESCRIPTION
    2.13 +#
    2.14 +#   This macro tries to guess the "native" arch corresponding to the target
    2.15 +#   architecture for use with gcc's -march=arch or -mtune=arch flags. If
    2.16 +#   found, the cache variable $ax_cv_gcc_archflag is set to this flag and
    2.17 +#   ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is is set to
    2.18 +#   "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is
    2.19 +#   to add $ax_cv_gcc_archflag to the end of $CFLAGS.
    2.20 +#
    2.21 +#   PORTABLE? should be either [yes] (default) or [no]. In the former case,
    2.22 +#   the flag is set to -mtune (or equivalent) so that the architecture is
    2.23 +#   only used for tuning, but the instruction set used is still portable. In
    2.24 +#   the latter case, the flag is set to -march (or equivalent) so that
    2.25 +#   architecture-specific instructions are enabled.
    2.26 +#
    2.27 +#   The user can specify --with-gcc-arch=<arch> in order to override the
    2.28 +#   macro's choice of architecture, or --without-gcc-arch to disable this.
    2.29 +#
    2.30 +#   When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is
    2.31 +#   called unless the user specified --with-gcc-arch manually.
    2.32 +#
    2.33 +#   Requires macros: AX_CHECK_COMPILER_FLAGS, AX_GCC_X86_CPUID
    2.34 +#
    2.35 +#   (The main emphasis here is on recent CPUs, on the principle that doing
    2.36 +#   high-performance computing on old hardware is uncommon.)
    2.37 +#
    2.38 +# LICENSE
    2.39 +#
    2.40 +#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
    2.41 +#   Copyright (c) 2008 Matteo Frigo
    2.42 +#
    2.43 +#   This program is free software: you can redistribute it and/or modify it
    2.44 +#   under the terms of the GNU General Public License as published by the
    2.45 +#   Free Software Foundation, either version 3 of the License, or (at your
    2.46 +#   option) any later version.
    2.47 +#
    2.48 +#   This program is distributed in the hope that it will be useful, but
    2.49 +#   WITHOUT ANY WARRANTY; without even the implied warranty of
    2.50 +#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    2.51 +#   Public License for more details.
    2.52 +#
    2.53 +#   You should have received a copy of the GNU General Public License along
    2.54 +#   with this program. If not, see <http://www.gnu.org/licenses/>.
    2.55 +#
    2.56 +#   As a special exception, the respective Autoconf Macro's copyright owner
    2.57 +#   gives unlimited permission to copy, distribute and modify the configure
    2.58 +#   scripts that are the output of Autoconf when processing the Macro. You
    2.59 +#   need not follow the terms of the GNU General Public License when using
    2.60 +#   or distributing such scripts, even though portions of the text of the
    2.61 +#   Macro appear in them. The GNU General Public License (GPL) does govern
    2.62 +#   all other use of the material that constitutes the Autoconf Macro.
    2.63 +#
    2.64 +#   This special exception to the GPL applies to versions of the Autoconf
    2.65 +#   Macro released by the Autoconf Archive. When you make and distribute a
    2.66 +#   modified version of the Autoconf Macro, you may extend this special
    2.67 +#   exception to the GPL to apply to your modified version as well.
    2.68 +
    2.69 +#serial 8
    2.70 +
    2.71 +AC_DEFUN([AX_GCC_ARCHFLAG],
    2.72 +[AC_REQUIRE([AC_PROG_CC])
    2.73 +AC_REQUIRE([AC_CANONICAL_HOST])
    2.74 +
    2.75 +AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=<arch>], [use architecture <arch> for gcc -march/-mtune, instead of guessing])],
    2.76 +	ax_gcc_arch=$withval, ax_gcc_arch=yes)
    2.77 +
    2.78 +AC_MSG_CHECKING([for gcc architecture flag])
    2.79 +AC_MSG_RESULT([])
    2.80 +AC_CACHE_VAL(ax_cv_gcc_archflag,
    2.81 +[
    2.82 +ax_cv_gcc_archflag="unknown"
    2.83 +
    2.84 +if test "$GCC" = yes; then
    2.85 +
    2.86 +if test "x$ax_gcc_arch" = xyes; then
    2.87 +ax_gcc_arch=""
    2.88 +if test "$cross_compiling" = no; then
    2.89 +case $host_cpu in
    2.90 +  i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones
    2.91 +     AX_GCC_X86_CPUID(0)
    2.92 +     AX_GCC_X86_CPUID(1)
    2.93 +     case $ax_cv_gcc_x86_cpuid_0 in
    2.94 +       *:756e6547:*:*) # Intel
    2.95 +          case $ax_cv_gcc_x86_cpuid_1 in
    2.96 +	    *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
    2.97 +	    *5??:*:*:*) ax_gcc_arch=pentium ;;
    2.98 +	    *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
    2.99 +	    *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
   2.100 +	    *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
   2.101 +	    *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
   2.102 +	    *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
   2.103 +	    *6??:*:*:*) ax_gcc_arch=pentiumpro ;;
   2.104 +            *f3[[347]]:*:*:*|*f4[1347]:*:*:*)
   2.105 +		case $host_cpu in
   2.106 +                  x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
   2.107 +                  *) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
   2.108 +                esac ;;
   2.109 +            *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
   2.110 +          esac ;;
   2.111 +       *:68747541:*:*) # AMD
   2.112 +          case $ax_cv_gcc_x86_cpuid_1 in
   2.113 +	    *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;;
   2.114 +	    *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
   2.115 +	    *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
   2.116 +	    *60?:*:*:*) ax_gcc_arch=k7 ;;
   2.117 +	    *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;;
   2.118 +	    *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;;
   2.119 +	    *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;;
   2.120 +	    *6[[68a]]?:*:*:*)
   2.121 +	       AX_GCC_X86_CPUID(0x80000006) # L2 cache size
   2.122 +	       case $ax_cv_gcc_x86_cpuid_0x80000006 in
   2.123 +                 *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256
   2.124 +			ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
   2.125 +                 *) ax_gcc_arch="athlon-4 athlon k7" ;;
   2.126 +	       esac ;;
   2.127 +	    *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
   2.128 +	    *f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
   2.129 +	    *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
   2.130 +	    *f??:*:*:*) ax_gcc_arch="k8" ;;
   2.131 +          esac ;;
   2.132 +	*:746e6543:*:*) # IDT
   2.133 +	   case $ax_cv_gcc_x86_cpuid_1 in
   2.134 +	     *54?:*:*:*) ax_gcc_arch=winchip-c6 ;;
   2.135 +	     *58?:*:*:*) ax_gcc_arch=winchip2 ;;
   2.136 +	     *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;;
   2.137 +	     *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
   2.138 +	   esac ;;
   2.139 +     esac
   2.140 +     if test x"$ax_gcc_arch" = x; then # fallback
   2.141 +	case $host_cpu in
   2.142 +	  i586*) ax_gcc_arch=pentium ;;
   2.143 +	  i686*) ax_gcc_arch=pentiumpro ;;
   2.144 +        esac
   2.145 +     fi
   2.146 +     ;;
   2.147 +
   2.148 +  sparc*)
   2.149 +     AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/])
   2.150 +     cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null`
   2.151 +     cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters`
   2.152 +     case $cputype in
   2.153 +         *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;;
   2.154 +         *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;;
   2.155 +         *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;;
   2.156 +         *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;;
   2.157 +         *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;;
   2.158 +         *cypress*) ax_gcc_arch=cypress ;;
   2.159 +     esac ;;
   2.160 +
   2.161 +  alphaev5) ax_gcc_arch=ev5 ;;
   2.162 +  alphaev56) ax_gcc_arch=ev56 ;;
   2.163 +  alphapca56) ax_gcc_arch="pca56 ev56" ;;
   2.164 +  alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;;
   2.165 +  alphaev6) ax_gcc_arch=ev6 ;;
   2.166 +  alphaev67) ax_gcc_arch=ev67 ;;
   2.167 +  alphaev68) ax_gcc_arch="ev68 ev67" ;;
   2.168 +  alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;;
   2.169 +  alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;;
   2.170 +  alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;;
   2.171 +
   2.172 +  powerpc*)
   2.173 +     cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null`
   2.174 +     cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'`
   2.175 +     case $cputype in
   2.176 +       *750*) ax_gcc_arch="750 G3" ;;
   2.177 +       *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;;
   2.178 +       *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;;
   2.179 +       *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;;
   2.180 +       *970*) ax_gcc_arch="970 G5 power4";;
   2.181 +       *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
   2.182 +       *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
   2.183 +       603ev|8240) ax_gcc_arch="$cputype 603e 603";;
   2.184 +       *) ax_gcc_arch=$cputype ;;
   2.185 +     esac
   2.186 +     ax_gcc_arch="$ax_gcc_arch powerpc"
   2.187 +     ;;
   2.188 +esac
   2.189 +fi # not cross-compiling
   2.190 +fi # guess arch
   2.191 +
   2.192 +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
   2.193 +for arch in $ax_gcc_arch; do
   2.194 +  if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
   2.195 +    flags="-mtune=$arch"
   2.196 +    # -mcpu=$arch and m$arch generate nonportable code on every arch except
   2.197 +    # x86.  And some other arches (e.g. Alpha) don't accept -mtune.  Grrr.
   2.198 +    case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
   2.199 +  else
   2.200 +    flags="-march=$arch -mcpu=$arch -m$arch"
   2.201 +  fi
   2.202 +  for flag in $flags; do
   2.203 +    AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break])
   2.204 +  done
   2.205 +  test "x$ax_cv_gcc_archflag" = xunknown || break
   2.206 +done
   2.207 +fi
   2.208 +
   2.209 +fi # $GCC=yes
   2.210 +])
   2.211 +AC_MSG_CHECKING([for gcc architecture flag])
   2.212 +AC_MSG_RESULT($ax_cv_gcc_archflag)
   2.213 +if test "x$ax_cv_gcc_archflag" = xunknown; then
   2.214 +  m4_default([$3],:)
   2.215 +else
   2.216 +  m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"])
   2.217 +fi
   2.218 +])
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/acinclude/ax_gcc_x86_cpuid.m4.htm	Tue Jan 18 22:40:45 2011 -0800
     3.3 @@ -0,0 +1,79 @@
     3.4 +# ===========================================================================
     3.5 +#     http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html
     3.6 +# ===========================================================================
     3.7 +#
     3.8 +# SYNOPSIS
     3.9 +#
    3.10 +#   AX_GCC_X86_CPUID(OP)
    3.11 +#
    3.12 +# DESCRIPTION
    3.13 +#
    3.14 +#   On Pentium and later x86 processors, with gcc or a compiler that has a
    3.15 +#   compatible syntax for inline assembly instructions, run a small program
    3.16 +#   that executes the cpuid instruction with input OP. This can be used to
    3.17 +#   detect the CPU type.
    3.18 +#
    3.19 +#   On output, the values of the eax, ebx, ecx, and edx registers are stored
    3.20 +#   as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable
    3.21 +#   ax_cv_gcc_x86_cpuid_OP.
    3.22 +#
    3.23 +#   If the cpuid instruction fails (because you are running a
    3.24 +#   cross-compiler, or because you are not using gcc, or because you are on
    3.25 +#   a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP
    3.26 +#   is set to the string "unknown".
    3.27 +#
    3.28 +#   This macro mainly exists to be used in AX_GCC_ARCHFLAG.
    3.29 +#
    3.30 +# LICENSE
    3.31 +#
    3.32 +#   Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
    3.33 +#   Copyright (c) 2008 Matteo Frigo
    3.34 +#
    3.35 +#   This program is free software: you can redistribute it and/or modify it
    3.36 +#   under the terms of the GNU General Public License as published by the
    3.37 +#   Free Software Foundation, either version 3 of the License, or (at your
    3.38 +#   option) any later version.
    3.39 +#
    3.40 +#   This program is distributed in the hope that it will be useful, but
    3.41 +#   WITHOUT ANY WARRANTY; without even the implied warranty of
    3.42 +#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
    3.43 +#   Public License for more details.
    3.44 +#
    3.45 +#   You should have received a copy of the GNU General Public License along
    3.46 +#   with this program. If not, see <http://www.gnu.org/licenses/>.
    3.47 +#
    3.48 +#   As a special exception, the respective Autoconf Macro's copyright owner
    3.49 +#   gives unlimited permission to copy, distribute and modify the configure
    3.50 +#   scripts that are the output of Autoconf when processing the Macro. You
    3.51 +#   need not follow the terms of the GNU General Public License when using
    3.52 +#   or distributing such scripts, even though portions of the text of the
    3.53 +#   Macro appear in them. The GNU General Public License (GPL) does govern
    3.54 +#   all other use of the material that constitutes the Autoconf Macro.
    3.55 +#
    3.56 +#   This special exception to the GPL applies to versions of the Autoconf
    3.57 +#   Macro released by the Autoconf Archive. When you make and distribute a
    3.58 +#   modified version of the Autoconf Macro, you may extend this special
    3.59 +#   exception to the GPL to apply to your modified version as well.
    3.60 +
    3.61 +#serial 7
    3.62 +
    3.63 +AC_DEFUN([AX_GCC_X86_CPUID],
    3.64 +[AC_REQUIRE([AC_PROG_CC])
    3.65 +AC_LANG_PUSH([C])
    3.66 +AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1,
    3.67 + [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include <stdio.h>], [
    3.68 +     int op = $1, eax, ebx, ecx, edx;
    3.69 +     FILE *f;
    3.70 +      __asm__("cpuid"
    3.71 +        : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx)
    3.72 +        : "a" (op));
    3.73 +     f = fopen("conftest_cpuid", "w"); if (!f) return 1;
    3.74 +     fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx);
    3.75 +     fclose(f);
    3.76 +     return 0;
    3.77 +])],
    3.78 +     [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid],
    3.79 +     [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid],
    3.80 +     [ax_cv_gcc_x86_cpuid_$1=unknown])])
    3.81 +AC_LANG_POP([C])
    3.82 +])
     4.1 --- a/configure.in	Tue Jan 18 22:10:37 2011 -0800
     4.2 +++ b/configure.in	Tue Jan 18 22:40:45 2011 -0800
     4.3 @@ -48,6 +48,7 @@
     4.4  
     4.5  dnl Detect the canonical build and host environments
     4.6  dnl AC_CANONICAL_HOST
     4.7 +AX_GCC_ARCHFLAG([no])
     4.8  
     4.9  dnl Check for tools
    4.10  AC_PROG_LIBTOOL