annotate acinclude/ax_gcc_archflag.m4 @ 5209:7d64745f1363

Fixed crash when binary shaders are not available.
author Sam Lantinga <slouken@libsdl.org>
date Sun, 06 Feb 2011 08:46:48 -0800
parents 5d7d48157be7
children
rev   line source
5029
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 # ===========================================================================
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 # http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 # ===========================================================================
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 # SYNOPSIS
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 # AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 # DESCRIPTION
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 # This macro tries to guess the "native" arch corresponding to the target
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 # architecture for use with gcc's -march=arch or -mtune=arch flags. If
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 # found, the cache variable $ax_cv_gcc_archflag is set to this flag and
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 # ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is is set to
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 # "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 # to add $ax_cv_gcc_archflag to the end of $CFLAGS.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 # PORTABLE? should be either [yes] (default) or [no]. In the former case,
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 # the flag is set to -mtune (or equivalent) so that the architecture is
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 # only used for tuning, but the instruction set used is still portable. In
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 # the latter case, the flag is set to -march (or equivalent) so that
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 # architecture-specific instructions are enabled.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 # The user can specify --with-gcc-arch=<arch> in order to override the
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 # macro's choice of architecture, or --without-gcc-arch to disable this.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 # When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 # called unless the user specified --with-gcc-arch manually.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 # Requires macros: AX_CHECK_COMPILER_FLAGS, AX_GCC_X86_CPUID
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 # (The main emphasis here is on recent CPUs, on the principle that doing
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 # high-performance computing on old hardware is uncommon.)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 # LICENSE
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 # Copyright (c) 2008 Steven G. Johnson <stevenj@alum.mit.edu>
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 # Copyright (c) 2008 Matteo Frigo
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 # This program is free software: you can redistribute it and/or modify it
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 # under the terms of the GNU General Public License as published by the
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 # Free Software Foundation, either version 3 of the License, or (at your
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 # option) any later version.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 # This program is distributed in the hope that it will be useful, but
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 # WITHOUT ANY WARRANTY; without even the implied warranty of
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 # Public License for more details.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 # You should have received a copy of the GNU General Public License along
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 # with this program. If not, see <http://www.gnu.org/licenses/>.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 # As a special exception, the respective Autoconf Macro's copyright owner
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 # gives unlimited permission to copy, distribute and modify the configure
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 # scripts that are the output of Autoconf when processing the Macro. You
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 # need not follow the terms of the GNU General Public License when using
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 # or distributing such scripts, even though portions of the text of the
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 # Macro appear in them. The GNU General Public License (GPL) does govern
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 # all other use of the material that constitutes the Autoconf Macro.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 # This special exception to the GPL applies to versions of the Autoconf
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 # Macro released by the Autoconf Archive. When you make and distribute a
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 # modified version of the Autoconf Macro, you may extend this special
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 # exception to the GPL to apply to your modified version as well.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 #serial 8
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 AC_DEFUN([AX_GCC_ARCHFLAG],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 [AC_REQUIRE([AC_PROG_CC])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 AC_REQUIRE([AC_CANONICAL_HOST])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=<arch>], [use architecture <arch> for gcc -march/-mtune, instead of guessing])],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 ax_gcc_arch=$withval, ax_gcc_arch=yes)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 AC_MSG_CHECKING([for gcc architecture flag])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 AC_MSG_RESULT([])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 AC_CACHE_VAL(ax_cv_gcc_archflag,
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 [
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 ax_cv_gcc_archflag="unknown"
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 if test "$GCC" = yes; then
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 if test "x$ax_gcc_arch" = xyes; then
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 ax_gcc_arch=""
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 if test "$cross_compiling" = no; then
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 case $host_cpu in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 AX_GCC_X86_CPUID(0)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 AX_GCC_X86_CPUID(1)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 case $ax_cv_gcc_x86_cpuid_0 in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 *:756e6547:*:*) # Intel
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 case $ax_cv_gcc_x86_cpuid_1 in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 *5??:*:*:*) ax_gcc_arch=pentium ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 *6??:*:*:*) ax_gcc_arch=pentiumpro ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 *f3[[347]]:*:*:*|*f4[1347]:*:*:*)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 case $host_cpu in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 *) ax_gcc_arch="prescott pentium4 pentiumpro" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 esac ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 esac ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 *:68747541:*:*) # AMD
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 case $ax_cv_gcc_x86_cpuid_1 in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 *60?:*:*:*) ax_gcc_arch=k7 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 *6[[68a]]?:*:*:*)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 AX_GCC_X86_CPUID(0x80000006) # L2 cache size
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 case $ax_cv_gcc_x86_cpuid_0x80000006 in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 *) ax_gcc_arch="athlon-4 athlon k7" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 esac ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 *f5?:*:*:*) ax_gcc_arch="opteron k8" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 *f??:*:*:*) ax_gcc_arch="k8" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 esac ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 *:746e6543:*:*) # IDT
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 case $ax_cv_gcc_x86_cpuid_1 in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 *54?:*:*:*) ax_gcc_arch=winchip-c6 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 *58?:*:*:*) ax_gcc_arch=winchip2 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 esac ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 esac
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 if test x"$ax_gcc_arch" = x; then # fallback
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 case $host_cpu in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 i586*) ax_gcc_arch=pentium ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 i686*) ax_gcc_arch=pentiumpro ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 esac
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 fi
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 sparc*)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 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`
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters`
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 case $cputype in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 *cypress*) ax_gcc_arch=cypress ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 esac ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 alphaev5) ax_gcc_arch=ev5 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 alphaev56) ax_gcc_arch=ev56 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 alphapca56) ax_gcc_arch="pca56 ev56" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 alphaev6) ax_gcc_arch=ev6 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 alphaev67) ax_gcc_arch=ev67 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 alphaev68) ax_gcc_arch="ev68 ev67" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 powerpc*)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 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`
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'`
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 case $cputype in
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 *750*) ax_gcc_arch="750 G3" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 *970*) ax_gcc_arch="970 G5 power4";;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 603ev|8240) ax_gcc_arch="$cputype 603e 603";;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 *) ax_gcc_arch=$cputype ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182 esac
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 ax_gcc_arch="$ax_gcc_arch powerpc"
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 ;;
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 esac
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 fi # not cross-compiling
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 fi # guess arch
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 for arch in $ax_gcc_arch; do
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 flags="-mtune=$arch"
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 # -mcpu=$arch and m$arch generate nonportable code on every arch except
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196 else
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 flags="-march=$arch -mcpu=$arch -m$arch"
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 fi
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 for flag in $flags; do
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 done
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 test "x$ax_cv_gcc_archflag" = xunknown || break
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 done
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 fi
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 fi # $GCC=yes
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 ])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 AC_MSG_CHECKING([for gcc architecture flag])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 AC_MSG_RESULT($ax_cv_gcc_archflag)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 if test "x$ax_cv_gcc_archflag" = xunknown; then
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 m4_default([$3],:)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 else
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 fi
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 ])