annotate acinclude/c.m4 @ 3377:c8d350c981ff

gcc can't generate dependencies for a file that doesn't exist, so first create SDL_revision.h
author Sam Lantinga <slouken@libsdl.org>
date Sun, 11 Oct 2009 06:42:20 +0000
parents 106a409ceeef
children a211710ebc37
rev   line source
3376
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 # This file is part of Autoconf. -*- Autoconf -*-
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 # Programming languages support.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 # Software Foundation, Inc.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 # This program is free software: you can redistribute it and/or modify
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 # it under the terms of the GNU General Public License as published by
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 # the Free Software Foundation; either version 2, or (at your option)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 # any later version.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 # This program is distributed in the hope that it will be useful,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 # GNU General Public License for more details.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 # along with this program; if not, write to the Free Software
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 # 02110-1301, USA.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 # As a special exception, the Free Software Foundation gives unlimited
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 # permission to copy, distribute and modify the configure scripts that
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 # are the output of Autoconf. You need not follow the terms of the GNU
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 # General Public License when using or distributing such scripts, even
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 # though portions of the text of Autoconf appear in them. The GNU
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 # General Public License (GPL) does govern all other use of the material
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 # that constitutes the Autoconf program.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 # Certain portions of the Autoconf source text are designed to be copied
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 # (in certain cases, depending on the input) into the output of
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 # Autoconf. We call these the "data" portions. The rest of the Autoconf
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 # source text consists of comments plus executable code that decides which
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 # of the data portions to output in any given case. We call these
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 # comments and executable code the "non-data" portions. Autoconf never
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 # copies any of the non-data portions into its output.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 # This special exception to the GPL applies to versions of Autoconf
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 # released by the Free Software Foundation. When you make and
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 # distribute a modified version of Autoconf, you may extend this special
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 # exception to the GPL to apply to your modified version as well, *unless*
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 # your modified version has the potential to copy into its output some
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 # of the text that was the non-data portion of the version that you started
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 # with. (In other words, unless your change moves or copies text from
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 # the non-data portions to the data portions.) If your modification has
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 # such potential, you must delete any notice of this special exception
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 # to the GPL from your modified version.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 # Written by David MacKenzie, with help from
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 # Akim Demaille, Paul Eggert,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 # Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 # Roland McGrath, Noah Friedman, david d zuhn, and many others.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 # Table of Contents:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 # 1. Language selection
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 # and routines to produce programs in a given language.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 # 1a. C 1b. C++ 1c. Objective C
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 # 2. Producing programs in a given language.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 # 2a. C 2b. C++ 2c. Objective C
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 # 3. Looking for a compiler
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 # And possibly the associated preprocessor.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 # 3a. C 3b. C++ 3c. Objective C
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 # 4. Compilers' characteristics.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 # 4a. C
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 ## ----------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 ## 1. Language selection. ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 ## ----------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 # -------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 # 1a. The C language. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 # -------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 # AC_LANG(C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 # ----------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 m4_define([AC_LANG(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 [ac_ext=c
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 ac_cpp='$CPP $CPPFLAGS'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 ac_compiler_gnu=$ac_cv_c_compiler_gnu
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 # AC_LANG_C
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 # ---------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 AU_DEFUN([AC_LANG_C], [AC_LANG(C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 # _AC_LANG_ABBREV(C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 # ------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 m4_define([_AC_LANG_ABBREV(C)], [c])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 # _AC_LANG_PREFIX(C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 # ------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 m4_define([_AC_LANG_PREFIX(C)], [C])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 # ---------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 # 1b. The C++ language. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 # ---------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 # AC_LANG(C++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 # ------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 m4_define([AC_LANG(C++)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 [ac_ext=cpp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 ac_cpp='$CXXCPP $CPPFLAGS'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 # AC_LANG_CPLUSPLUS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 # -----------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 # _AC_LANG_ABBREV(C++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 # --------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133 m4_define([_AC_LANG_ABBREV(C++)], [cxx])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136 # _AC_LANG_PREFIX(C++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 # --------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 m4_define([_AC_LANG_PREFIX(C++)], [CXX])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142 # ------------------------------ #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 # 1c. The Objective C language. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 # ------------------------------ #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 # AC_LANG(Objective C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 # --------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 m4_define([AC_LANG(Objective C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 [ac_ext=m
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 ac_cpp='$OBJCPP $CPPFLAGS'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 ac_compile='$OBJC -c $OBJCFLAGS $CPPFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 ac_link='$OBJC -o conftest$ac_exeext $OBJCFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 ac_compiler_gnu=$ac_cv_objc_compiler_gnu
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 # AC_LANG_OBJC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 # ------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 AU_DEFUN([AC_LANG_OBJC], [AC_LANG(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 # _AC_LANG_ABBREV(Objective C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 # ----------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 m4_define([_AC_LANG_ABBREV(Objective C)], [objc])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 # _AC_LANG_PREFIX(Objective C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 # ----------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 m4_define([_AC_LANG_PREFIX(Objective C)], [OBJC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 ## ----------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 ## 2. Producing programs. ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 ## ----------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 # --------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 # 2a. C sources. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 # --------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 # AC_LANG_SOURCE(C)(BODY)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 # -----------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 # We can't use '#line $LINENO "configure"' here, since
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186 # Sun c89 (Sun WorkShop 6 update 2 C 5.3 Patch 111679-08 2002/05/09)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 # rejects $LINENO greater than 32767, and some configure scripts
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 # are longer than 32767 lines.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 m4_define([AC_LANG_SOURCE(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190 [/* confdefs.h. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 _ACEOF
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 cat confdefs.h >>conftest.$ac_ext
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 cat >>conftest.$ac_ext <<_ACEOF
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 /* end confdefs.h. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 $1])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198 # AC_LANG_PROGRAM(C)([PROLOGUE], [BODY])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 # --------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
200 m4_define([AC_LANG_PROGRAM(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
201 [$1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
202 m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
203 m4_ifdef([_AC_LANG_PROGRAM_C_FC_HOOKS], [_AC_LANG_PROGRAM_C_FC_HOOKS])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
204 int
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
205 main ()
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 dnl Do *not* indent the following line: there may be CPP directives.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208 dnl Don't move the `;' right after for the same reason.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 $2
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 ;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211 return 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 }])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215 # AC_LANG_CALL(C)(PROLOGUE, FUNCTION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 # -----------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 # Avoid conflicting decl of main.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 m4_define([AC_LANG_CALL(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219 [AC_LANG_PROGRAM([$1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 m4_if([$2], [main], ,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 [/* Override any GCC internal prototype to avoid an error.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 Use char because int might match the return type of a GCC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223 builtin and then its argument prototype would still apply. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 #ifdef __cplusplus
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 extern "C"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 char $2 ();])], [return $2 ();])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 # AC_LANG_FUNC_LINK_TRY(C)(FUNCTION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 # ----------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232 # Don't include <ctype.h> because on OSF/1 3.0 it includes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 # <sys/types.h> which includes <sys/select.h> which contains a
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 # prototype for select. Similarly for bzero.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 # This test used to merely assign f=$1 in main(), but that was
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 # optimized away by HP unbundled cc A.05.36 for ia64 under +O3,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238 # presumably on the basis that there's no need to do that store if the
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 # program is about to exit. Conversely, the AIX linker optimizes an
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 # unused external declaration that initializes f=$1. So this test
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241 # program has both an external initialization of f, and a use of f in
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 # main that affects the exit status.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244 m4_define([AC_LANG_FUNC_LINK_TRY(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 [/* Define $1 to an innocuous variant, in case <limits.h> declares $1.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247 For example, HP-UX 11i <limits.h> declares gettimeofday. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248 #define $1 innocuous_$1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 /* System header to define __stub macros and hopefully few prototypes,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 which can conflict with char $1 (); below.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 <limits.h> exists even on freestanding compilers. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255 #ifdef __STDC__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 # include <limits.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 #else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 # include <assert.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 #undef $1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263 /* Override any GCC internal prototype to avoid an error.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 Use char because int might match the return type of a GCC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 builtin and then its argument prototype would still apply. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 #ifdef __cplusplus
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267 extern "C"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 char $1 ();
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270 /* The GNU C library defines this for functions which it implements
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 to always fail with ENOSYS. Some functions are actually named
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 something starting with __ and the normal name is an alias. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273 #if defined __stub_$1 || defined __stub___$1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 choke me
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276 ], [return $1 ();])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279 # AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 # -------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 # Return a program that is valid if EXPRESSION is nonzero.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 # EXPRESSION must be an integer constant expression.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283 # Be sure to use this array to avoid `unused' warnings, which are even
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 # errors with `-W error'.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285 m4_define([AC_LANG_BOOL_COMPILE_TRY(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
286 [AC_LANG_PROGRAM([$1], [static int test_array @<:@1 - 2 * !($2)@:>@;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 test_array @<:@0@:>@ = 0
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
288 ])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
289
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
290
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
291 # AC_LANG_INT_SAVE(C)(PROLOGUE, EXPRESSION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
292 # -----------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
293 # We need `stdio.h' to open a `FILE' and `stdlib.h' for `exit'.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
294 # But we include them only after the EXPRESSION has been evaluated.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 m4_define([AC_LANG_INT_SAVE(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
296 [AC_LANG_PROGRAM([$1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
297 static long int longval () { return $2; }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
298 static unsigned long int ulongval () { return $2; }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
299 @%:@include <stdio.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
300 @%:@include <stdlib.h>],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
301 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
302 FILE *f = fopen ("conftest.val", "w");
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
303 if (! f)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
304 return 1;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 if (($2) < 0)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
306 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
307 long int i = longval ();
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
308 if (i != ($2))
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
309 return 1;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
310 fprintf (f, "%ld", i);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
311 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
312 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
313 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 unsigned long int i = ulongval ();
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
315 if (i != ($2))
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
316 return 1;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
317 fprintf (f, "%lu", i);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
318 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
319 /* Do not output a trailing newline, as this causes \r\n confusion
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
320 on some platforms. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
321 return ferror (f) || fclose (f) != 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
322 ])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
324
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
325
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
326 # ----------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
327 # 2b. C++ sources. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
328 # ----------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
329
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
330
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
331 # AC_LANG_SOURCE(C++)(BODY)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
332 # -------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
333 m4_copy([AC_LANG_SOURCE(C)], [AC_LANG_SOURCE(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
334
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
335
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
336 # AC_LANG_PROGRAM(C++)([PROLOGUE], [BODY])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
337 # ----------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
338 m4_copy([AC_LANG_PROGRAM(C)], [AC_LANG_PROGRAM(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
339
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
340
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 # AC_LANG_CALL(C++)(PROLOGUE, FUNCTION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 # -------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 m4_copy([AC_LANG_CALL(C)], [AC_LANG_CALL(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
344
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 # AC_LANG_FUNC_LINK_TRY(C++)(FUNCTION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
347 # ------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
348 m4_copy([AC_LANG_FUNC_LINK_TRY(C)], [AC_LANG_FUNC_LINK_TRY(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
349
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
350
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
351 # AC_LANG_BOOL_COMPILE_TRY(C++)(PROLOGUE, EXPRESSION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
352 # ---------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
353 m4_copy([AC_LANG_BOOL_COMPILE_TRY(C)], [AC_LANG_BOOL_COMPILE_TRY(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
354
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
355
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
356 # AC_LANG_INT_SAVE(C++)(PROLOGUE, EXPRESSION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
357 # -------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
358 m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
359
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
360
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
361
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
362 # ------------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
363 # 2c. Objective C sources. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
364 # ------------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
365
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
366
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
367 # AC_LANG_SOURCE(Objective C)(BODY)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
368 # ---------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
369 m4_copy([AC_LANG_SOURCE(C)], [AC_LANG_SOURCE(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
370
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
371
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
372 # AC_LANG_PROGRAM(Objective C)([PROLOGUE], [BODY])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
373 # ------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
374 m4_copy([AC_LANG_PROGRAM(C)], [AC_LANG_PROGRAM(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
375
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
376
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
377 # AC_LANG_CALL(Objective C)(PROLOGUE, FUNCTION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
378 # ---------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
379 m4_copy([AC_LANG_CALL(C)], [AC_LANG_CALL(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
380
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
381
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
382 # AC_LANG_FUNC_LINK_TRY(Objective C)(FUNCTION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
383 # --------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
384 m4_copy([AC_LANG_FUNC_LINK_TRY(C)], [AC_LANG_FUNC_LINK_TRY(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
385
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387 # AC_LANG_BOOL_COMPILE_TRY(Objective C)(PROLOGUE, EXPRESSION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
388 # -----------------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 m4_copy([AC_LANG_BOOL_COMPILE_TRY(C)], [AC_LANG_BOOL_COMPILE_TRY(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
390
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
391
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 # AC_LANG_INT_SAVE(Objective C)(PROLOGUE, EXPRESSION)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 # ---------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
394 m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(Objective C)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 ## -------------------------------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 ## 3. Looking for Compilers and Preprocessors. ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 ## -------------------------------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 # -------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 # 3a. The C compiler. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 # -------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407 # _AC_ARG_VAR_CPPFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
408 # --------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
409 # Document and register CPPFLAGS, which is used by
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
410 # AC_PROG_{CC, CPP, CXX, CXXCPP, OBJC, OBJCPP}.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
411 AC_DEFUN([_AC_ARG_VAR_CPPFLAGS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
412 [AC_ARG_VAR([CPPFLAGS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
413 [C/C++/Objective C preprocessor flags, e.g. -I<include dir>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
414 if you have headers in a nonstandard directory <include dir>])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
415
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
416
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
417 # _AC_ARG_VAR_LDFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
418 # -------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
419 # Document and register LDFLAGS, which is used by
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
420 # AC_PROG_{CC, CXX, F77, FC, OBJC}.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
421 AC_DEFUN([_AC_ARG_VAR_LDFLAGS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
422 [AC_ARG_VAR([LDFLAGS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
423 [linker flags, e.g. -L<lib dir> if you have libraries in a
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
424 nonstandard directory <lib dir>])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
425
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
426
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
427 # _AC_ARG_VAR_LIBS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
428 # ----------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
429 # Document and register LIBS, which is used by
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
430 # AC_PROG_{CC, CXX, F77, FC, OBJS}.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
431 AC_DEFUN([_AC_ARG_VAR_LIBS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
432 [AC_ARG_VAR([LIBS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
433 [libraries to pass to the linker, e.g. -l<library>])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
434
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
435
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
436 # AC_LANG_PREPROC(C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
437 # -------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
438 # Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
439 AC_DEFUN([AC_LANG_PREPROC(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
440 [AC_REQUIRE([AC_PROG_CPP])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
441
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
442
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
443 # _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
444 # -----------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
445 # Check if $ac_cpp is a working preprocessor that can flag absent
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
446 # includes either by the exit status or by warnings.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
447 # This macro is for all languages, not only C.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
448 AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
449 [ac_preproc_ok=false
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
450 for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
451 do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
452 # Use a header file that comes with gcc, so configuring glibc
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
453 # with a fresh cross-compiler works.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
454 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
455 # <limits.h> exists even on freestanding compilers.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
456 # On the NeXT, cc -E runs the code through the compiler's parser,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
457 # not just through cpp. "Syntax error" is here to catch this case.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
458 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@ifdef __STDC__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
459 @%:@ include <limits.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
460 @%:@else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
461 @%:@ include <assert.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
462 @%:@endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
463 Syntax error]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
464 [],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
465 [# Broken: fails on valid input.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
466 continue])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
467
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
468 # OK, works on sane cases. Now check whether nonexistent headers
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
469 # can be detected and how.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
470 _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
471 [# Broken: success on invalid input.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
472 continue],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
473 [# Passes both tests.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
474 ac_preproc_ok=:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
475 break])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
476
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
477 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
478 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
479 rm -f conftest.err conftest.$ac_ext
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
480 AS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
481
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
482
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
483 # AC_PROG_CPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
484 # -----------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
485 # Find a working C preprocessor.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
486 # We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
487 # between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CC.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
488 AN_MAKEVAR([CPP], [AC_PROG_CPP])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
489 AN_PROGRAM([cpp], [AC_PROG_CPP])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
490 AC_DEFUN([AC_PROG_CPP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
491 [AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
492 AC_ARG_VAR([CPP], [C preprocessor])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
493 _AC_ARG_VAR_CPPFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
494 AC_LANG_PUSH(C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
495 AC_MSG_CHECKING([how to run the C preprocessor])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
496 # On Suns, sometimes $CPP names a directory.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
497 if test -n "$CPP" && test -d "$CPP"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
498 CPP=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
499 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
500 if test -z "$CPP"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
501 AC_CACHE_VAL([ac_cv_prog_CPP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
502 [dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
503 # Double quotes because CPP needs to be expanded
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
504 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
505 do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
506 _AC_PROG_PREPROC_WORKS_IFELSE([break])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
507 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
508 ac_cv_prog_CPP=$CPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
509 ])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
510 CPP=$ac_cv_prog_CPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
511 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
512 ac_cv_prog_CPP=$CPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
513 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
514 AC_MSG_RESULT([$CPP])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
515 _AC_PROG_PREPROC_WORKS_IFELSE([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
516 [AC_MSG_FAILURE([C preprocessor "$CPP" fails sanity check])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
517 AC_SUBST(CPP)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
518 AC_LANG_POP(C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
519 ])# AC_PROG_CPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
520
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
521 # AC_PROG_CPP_WERROR
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
522 # ------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
523 # Treat warnings from the preprocessor as errors.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
524 AC_DEFUN([AC_PROG_CPP_WERROR],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
525 [AC_REQUIRE([AC_PROG_CPP])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
526 ac_c_preproc_warn_flag=yes])# AC_PROG_CPP_WERROR
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
527
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
528 # AC_LANG_COMPILER(C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
529 # -------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
530 # Find the C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
531 AC_DEFUN([AC_LANG_COMPILER(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
532 [AC_REQUIRE([AC_PROG_CC])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
533
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
534
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
535 # ac_cv_prog_gcc
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
536 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
537 # We used to name the cache variable this way.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
538 AU_DEFUN([ac_cv_prog_gcc],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
539 [ac_cv_c_compiler_gnu])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
540
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
541
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
542 # AC_PROG_CC([COMPILER ...])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
543 # --------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
544 # COMPILER ... is a space separated list of C compilers to search for.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
545 # This just gives the user an opportunity to specify an alternative
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
546 # search list for the C compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
547 AN_MAKEVAR([CC], [AC_PROG_CC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
548 AN_PROGRAM([cc], [AC_PROG_CC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
549 AN_PROGRAM([gcc], [AC_PROG_CC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
550 AC_DEFUN([AC_PROG_CC],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
551 [AC_LANG_PUSH(C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
552 AC_ARG_VAR([CC], [C compiler command])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
553 AC_ARG_VAR([CFLAGS], [C compiler flags])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
554 _AC_ARG_VAR_LDFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
555 _AC_ARG_VAR_LIBS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
556 _AC_ARG_VAR_CPPFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
557 m4_ifval([$1],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
558 [AC_CHECK_TOOLS(CC, [$1])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
559 [AC_CHECK_TOOL(CC, gcc)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
560 if test -z "$CC"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
561 dnl Here we want:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
562 dnl AC_CHECK_TOOL(CC, cc)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
563 dnl but without the check for a tool without the prefix.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
564 dnl Until the check is removed from there, copy the code:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
565 if test -n "$ac_tool_prefix"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
566 AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
567 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
568 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
569 if test -z "$CC"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
570 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
571 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
572 if test -z "$CC"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
573 AC_CHECK_TOOLS(CC, cl.exe)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
574 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
575 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
576
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
577 test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
578
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
579 # Provide some information about the compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
580 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
581 set X $ac_compile
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
582 ac_compiler=$[2]
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
583 _AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
584 _AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
585 _AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
586
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
587 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
588 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
589 _AC_LANG_COMPILER_GNU
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
590 if test $ac_compiler_gnu = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
591 GCC=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
592 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
593 GCC=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
594 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
595 _AC_PROG_CC_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
596 _AC_PROG_CC_C89
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
597 AC_LANG_POP(C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
598 ])# AC_PROG_CC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
599
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
600
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
601 # _AC_PROG_CC_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
602 # -------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
603 # Check whether -g works, even if CFLAGS is set, in case the package
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
604 # plays around with CFLAGS (such as to build both debugging and normal
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
605 # versions of a library), tasteless as that idea is.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
606 # Don't consider -g to work if it generates warnings when plain compiles don't.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
607 m4_define([_AC_PROG_CC_G],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
608 [ac_test_CFLAGS=${CFLAGS+set}
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
609 ac_save_CFLAGS=$CFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
610 AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
611 [ac_save_c_werror_flag=$ac_c_werror_flag
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
612 ac_c_werror_flag=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
613 ac_cv_prog_cc_g=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
614 CFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
615 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
616 [ac_cv_prog_cc_g=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
617 [CFLAGS=""
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
618 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
619 [],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
620 [ac_c_werror_flag=$ac_save_c_werror_flag
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
621 CFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
622 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
623 [ac_cv_prog_cc_g=yes])])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
624 ac_c_werror_flag=$ac_save_c_werror_flag])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
625 if test "$ac_test_CFLAGS" = set; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
626 CFLAGS=$ac_save_CFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
627 elif test $ac_cv_prog_cc_g = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
628 if test "$GCC" = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
629 CFLAGS="-g -O2"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
630 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
631 CFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
632 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
633 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
634 if test "$GCC" = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
635 CFLAGS="-O2"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
636 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
637 CFLAGS=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
638 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
639 fi[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
640 ])# _AC_PROG_CC_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
641
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
642
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
643 # AC_PROG_GCC_TRADITIONAL
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
644 # -----------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
645 AC_DEFUN([AC_PROG_GCC_TRADITIONAL],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
646 [AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
647 if test $ac_cv_c_compiler_gnu = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
648 AC_CACHE_CHECK(whether $CC needs -traditional,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
649 ac_cv_prog_gcc_traditional,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
650 [ ac_pattern="Autoconf.*'x'"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
651 AC_EGREP_CPP($ac_pattern, [#include <sgtty.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
652 Autoconf TIOCGETP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
653 ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
654
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
655 if test $ac_cv_prog_gcc_traditional = no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
656 AC_EGREP_CPP($ac_pattern, [#include <termio.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
657 Autoconf TCGETA],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
658 ac_cv_prog_gcc_traditional=yes)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
659 fi])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
660 if test $ac_cv_prog_gcc_traditional = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
661 CC="$CC -traditional"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
662 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
663 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
664 ])# AC_PROG_GCC_TRADITIONAL
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
665
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
666
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
667 # AC_PROG_CC_C_O
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
668 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
669 AC_DEFUN([AC_PROG_CC_C_O],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
670 [AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
671 if test "x$CC" != xcc; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
672 AC_MSG_CHECKING([whether $CC and cc understand -c and -o together])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
673 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
674 AC_MSG_CHECKING([whether cc understands -c and -o together])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
675 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
676 set dummy $CC; ac_cc=`AS_ECHO(["$[2]"]) |
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
677 sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'`
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
678 AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
679 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
680 # Make sure it works both with $CC and with simple cc.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
681 # We do the test twice because some compilers refuse to overwrite an
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
682 # existing .o file with -o, though they will create one.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
683 ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
684 rm -f conftest2.*
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
685 if _AC_DO_VAR(ac_try) &&
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
686 test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
687 then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
688 eval ac_cv_prog_cc_${ac_cc}_c_o=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
689 if test "x$CC" != xcc; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
690 # Test first that cc exists at all.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
691 if _AC_DO_TOKENS(cc -c conftest.$ac_ext >&AS_MESSAGE_LOG_FD); then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
692 ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
693 rm -f conftest2.*
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
694 if _AC_DO_VAR(ac_try) &&
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
695 test -f conftest2.$ac_objext && _AC_DO_VAR(ac_try);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
696 then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
697 # cc works too.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
698 :
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
699 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
700 # cc exists but doesn't like -o.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
701 eval ac_cv_prog_cc_${ac_cc}_c_o=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
702 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
703 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
704 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
705 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
706 eval ac_cv_prog_cc_${ac_cc}_c_o=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
707 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
708 rm -f core conftest*
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
709 ])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
710 if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
711 AC_MSG_RESULT([yes])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
712 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
713 AC_MSG_RESULT([no])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
714 AC_DEFINE(NO_MINUS_C_MINUS_O, 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
715 [Define to 1 if your C compiler doesn't accept -c and -o together.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
716 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
717 ])# AC_PROG_CC_C_O
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
718
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
719
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
720
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
721 # ---------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
722 # 3b. The C++ compiler. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
723 # ---------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
724
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
725
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
726 # AC_LANG_PREPROC(C++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
727 # ---------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
728 # Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
729 AC_DEFUN([AC_LANG_PREPROC(C++)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
730 [AC_REQUIRE([AC_PROG_CXXCPP])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
731
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
732
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
733 # AC_PROG_CXXCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
734 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
735 # Find a working C++ preprocessor.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
736 # We shouldn't have to require AC_PROG_CC, but this is due to the concurrency
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
737 # between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CXX.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
738 AC_DEFUN([AC_PROG_CXXCPP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
739 [AC_REQUIRE([AC_PROG_CXX])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
740 AC_ARG_VAR([CXXCPP], [C++ preprocessor])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
741 _AC_ARG_VAR_CPPFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
742 AC_LANG_PUSH(C++)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
743 AC_MSG_CHECKING([how to run the C++ preprocessor])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
744 if test -z "$CXXCPP"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
745 AC_CACHE_VAL(ac_cv_prog_CXXCPP,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
746 [dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
747 # Double quotes because CXXCPP needs to be expanded
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
748 for CXXCPP in "$CXX -E" "/lib/cpp"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
749 do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
750 _AC_PROG_PREPROC_WORKS_IFELSE([break])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
751 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
752 ac_cv_prog_CXXCPP=$CXXCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
753 ])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
754 CXXCPP=$ac_cv_prog_CXXCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
755 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
756 ac_cv_prog_CXXCPP=$CXXCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
757 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
758 AC_MSG_RESULT([$CXXCPP])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
759 _AC_PROG_PREPROC_WORKS_IFELSE([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
760 [AC_MSG_FAILURE([C++ preprocessor "$CXXCPP" fails sanity check])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
761 AC_SUBST(CXXCPP)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
762 AC_LANG_POP(C++)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
763 ])# AC_PROG_CXXCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
764
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
765
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
766 # AC_LANG_COMPILER(C++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
767 # ---------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
768 # Find the C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
769 AC_DEFUN([AC_LANG_COMPILER(C++)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
770 [AC_REQUIRE([AC_PROG_CXX])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
771
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
772
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
773 # ac_cv_prog_gxx
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
774 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
775 # We used to name the cache variable this way.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
776 AU_DEFUN([ac_cv_prog_gxx],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
777 [ac_cv_cxx_compiler_gnu])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
778
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
779
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
780 # AC_PROG_CXX([LIST-OF-COMPILERS])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
781 # --------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
782 # LIST-OF-COMPILERS is a space separated list of C++ compilers to search
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
783 # for (if not specified, a default list is used). This just gives the
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
784 # user an opportunity to specify an alternative search list for the C++
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
785 # compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
786 # aCC HP-UX C++ compiler much better than `CC', so test before.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
787 # FCC Fujitsu C++ compiler
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
788 # KCC KAI C++ compiler
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
789 # RCC Rational C++
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
790 # xlC_r AIX C Set++ (with support for reentrant code)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
791 # xlC AIX C Set++
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
792 AN_MAKEVAR([CXX], [AC_PROG_CXX])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
793 AN_PROGRAM([CC], [AC_PROG_CXX])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
794 AN_PROGRAM([c++], [AC_PROG_CXX])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
795 AN_PROGRAM([g++], [AC_PROG_CXX])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
796 AC_DEFUN([AC_PROG_CXX],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
797 [AC_LANG_PUSH(C++)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
798 AC_ARG_VAR([CXX], [C++ compiler command])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
799 AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
800 _AC_ARG_VAR_LDFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
801 _AC_ARG_VAR_LIBS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
802 _AC_ARG_VAR_CPPFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
803 _AC_ARG_VAR_PRECIOUS([CCC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
804 if test -z "$CXX"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
805 if test -n "$CCC"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
806 CXX=$CCC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
807 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
808 AC_CHECK_TOOLS(CXX,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
809 [m4_default([$1],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
810 [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
811 g++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
812 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
813 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
814 # Provide some information about the compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
815 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
816 set X $ac_compile
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
817 ac_compiler=$[2]
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
818 _AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
819 _AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
820 _AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
821
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
822 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
823 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
824 _AC_LANG_COMPILER_GNU
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
825 if test $ac_compiler_gnu = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
826 GXX=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
827 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
828 GXX=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
829 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
830 _AC_PROG_CXX_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
831 AC_LANG_POP(C++)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
832 ])# AC_PROG_CXX
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
833
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
834
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
835 # _AC_PROG_CXX_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
836 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
837 # Check whether -g works, even if CXXFLAGS is set, in case the package
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
838 # plays around with CXXFLAGS (such as to build both debugging and
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
839 # normal versions of a library), tasteless as that idea is.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
840 # Don't consider -g to work if it generates warnings when plain compiles don't.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
841 m4_define([_AC_PROG_CXX_G],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
842 [ac_test_CXXFLAGS=${CXXFLAGS+set}
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
843 ac_save_CXXFLAGS=$CXXFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
844 AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
845 [ac_save_cxx_werror_flag=$ac_cxx_werror_flag
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
846 ac_cxx_werror_flag=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
847 ac_cv_prog_cxx_g=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
848 CXXFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
849 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
850 [ac_cv_prog_cxx_g=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
851 [CXXFLAGS=""
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
852 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
853 [],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
854 [ac_cxx_werror_flag=$ac_save_cxx_werror_flag
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
855 CXXFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
856 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
857 [ac_cv_prog_cxx_g=yes])])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
858 ac_cxx_werror_flag=$ac_save_cxx_werror_flag])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
859 if test "$ac_test_CXXFLAGS" = set; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
860 CXXFLAGS=$ac_save_CXXFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
861 elif test $ac_cv_prog_cxx_g = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
862 if test "$GXX" = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
863 CXXFLAGS="-g -O2"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
864 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
865 CXXFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
866 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
867 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
868 if test "$GXX" = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
869 CXXFLAGS="-O2"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
870 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
871 CXXFLAGS=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
872 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
873 fi[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
874 ])# _AC_PROG_CXX_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
875
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
876
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
877 # AC_PROG_CXX_C_O
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
878 # ---------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
879 # Test if the C++ compiler accepts the options `-c' and `-o'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
880 # simultaneously, and define `CXX_NO_MINUS_C_MINUS_O' if it does not.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
881 AC_DEFUN([AC_PROG_CXX_C_O],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
882 [AC_REQUIRE([AC_PROG_CXX])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
883 AC_LANG_PUSH([C++])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
884 AC_CACHE_CHECK([whether $CXX understands -c and -o together],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
885 [ac_cv_prog_cxx_c_o],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
886 [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
887 # We test twice because some compilers refuse to overwrite an existing
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
888 # `.o' file with `-o', although they will create one.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
889 ac_try='$CXX $CXXFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&AS_MESSAGE_LOG_FD'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
890 rm -f conftest2.*
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
891 if _AC_DO_VAR(ac_try) &&
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
892 test -f conftest2.$ac_objext &&
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
893 _AC_DO_VAR(ac_try); then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
894 ac_cv_prog_cxx_c_o=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
895 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
896 ac_cv_prog_cxx_c_o=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
897 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
898 rm -f conftest*])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
899 if test $ac_cv_prog_cxx_c_o = no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
900 AC_DEFINE(CXX_NO_MINUS_C_MINUS_O, 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
901 [Define to 1 if your C++ compiler doesn't accept
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
902 -c and -o together.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
903 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
904 AC_LANG_POP([C++])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
905 ])# AC_PROG_CXX_C_O
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
906
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
907
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
908
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
909 # ------------------------------ #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
910 # 3c. The Objective C compiler. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
911 # ------------------------------ #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
912
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
913
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
914 # AC_LANG_PREPROC(Objective C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
915 # ----------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
916 # Find the Objective C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
917 AC_DEFUN([AC_LANG_PREPROC(Objective C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
918 [AC_REQUIRE([AC_PROG_OBJCPP])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
919
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
920
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
921 # AC_PROG_OBJCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
922 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
923 # Find a working Objective C preprocessor.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
924 AC_DEFUN([AC_PROG_OBJCPP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
925 [AC_REQUIRE([AC_PROG_OBJC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
926 AC_ARG_VAR([OBJCPP], [Objective C preprocessor])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
927 _AC_ARG_VAR_CPPFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
928 AC_LANG_PUSH(Objective C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
929 AC_MSG_CHECKING([how to run the Objective C preprocessor])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
930 if test -z "$OBJCPP"; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
931 AC_CACHE_VAL(ac_cv_prog_OBJCPP,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
932 [dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
933 # Double quotes because OBJCPP needs to be expanded
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
934 for OBJCPP in "$OBJC -E" "/lib/cpp"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
935 do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
936 _AC_PROG_PREPROC_WORKS_IFELSE([break])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
937 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
938 ac_cv_prog_OBJCPP=$OBJCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
939 ])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
940 OBJCPP=$ac_cv_prog_OBJCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
941 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
942 ac_cv_prog_OBJCPP=$OBJCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
943 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
944 AC_MSG_RESULT([$OBJCPP])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
945 _AC_PROG_PREPROC_WORKS_IFELSE([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
946 [AC_MSG_FAILURE([Objective C preprocessor "$OBJCPP" fails sanity check])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
947 AC_SUBST(OBJCPP)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
948 AC_LANG_POP(Objective C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
949 ])# AC_PROG_OBJCPP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
950
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
951
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
952 # AC_LANG_COMPILER(Objective C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
953 # -----------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
954 # Find the Objective C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
955 AC_DEFUN([AC_LANG_COMPILER(Objective C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
956 [AC_REQUIRE([AC_PROG_OBJC])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
957
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
958
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
959
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
960 # AC_PROG_OBJC([LIST-OF-COMPILERS])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
961 # ---------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
962 # LIST-OF-COMPILERS is a space separated list of Objective C compilers to
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
963 # search for (if not specified, a default list is used). This just gives
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
964 # the user an opportunity to specify an alternative search list for the
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
965 # Objective C compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
966 # objcc StepStone Objective-C compiler (also "standard" name for OBJC)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
967 # objc David Stes' POC. If you installed this, you likely want it.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
968 # cc Native C compiler (for instance, Apple).
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
969 # CC You never know.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
970 AN_MAKEVAR([OBJC], [AC_PROG_OBJC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
971 AN_PROGRAM([objcc], [AC_PROG_OBJC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
972 AN_PROGRAM([objc], [AC_PROG_OBJC])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
973 AC_DEFUN([AC_PROG_OBJC],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
974 [AC_LANG_PUSH(Objective C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
975 AC_ARG_VAR([OBJC], [Objective C compiler command])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
976 AC_ARG_VAR([OBJCFLAGS], [Objective C compiler flags])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
977 _AC_ARG_VAR_LDFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
978 _AC_ARG_VAR_LIBS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
979 _AC_ARG_VAR_CPPFLAGS()dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
980 _AC_ARG_VAR_PRECIOUS([OBJC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
981 AC_CHECK_TOOLS(OBJC,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
982 [m4_default([$1], [gcc objcc objc cc CC])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
983 gcc)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
984 # Provide some information about the compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
985 _AS_ECHO_LOG([checking for _AC_LANG compiler version])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
986 set X $ac_compile
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
987 ac_compiler=$[2]
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
988 _AC_DO([$ac_compiler --version >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
989 _AC_DO([$ac_compiler -v >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
990 _AC_DO([$ac_compiler -V >&AS_MESSAGE_LOG_FD])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
991
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
992 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
993 m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
994 _AC_LANG_COMPILER_GNU
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
995 if test $ac_compiler_gnu = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
996 GOBJC=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
997 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
998 GOBJC=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
999 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1000 _AC_PROG_OBJC_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1001 AC_LANG_POP(Objective C)dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1002 ])# AC_PROG_OBJC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1003
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1004
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1005 # _AC_PROG_OBJC_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1006 # ---------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1007 # Check whether -g works, even if OBJCFLAGS is set, in case the package
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1008 # plays around with OBJCFLAGS (such as to build both debugging and
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1009 # normal versions of a library), tasteless as that idea is.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1010 # Don't consider -g to work if it generates warnings when plain compiles don't.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1011 m4_define([_AC_PROG_OBJC_G],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1012 [ac_test_OBJCFLAGS=${OBJCFLAGS+set}
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1013 ac_save_OBJCFLAGS=$OBJCFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1014 AC_CACHE_CHECK(whether $OBJC accepts -g, ac_cv_prog_objc_g,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1015 [ac_save_objc_werror_flag=$ac_objc_werror_flag
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1016 ac_objc_werror_flag=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1017 ac_cv_prog_objc_g=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1018 OBJCFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1019 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1020 [ac_cv_prog_objc_g=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1021 [OBJCFLAGS=""
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1022 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1023 [],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1024 [ac_objc_werror_flag=$ac_save_objc_werror_flag
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1025 OBJCFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1026 _AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1027 [ac_cv_prog_objc_g=yes])])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1028 ac_objc_werror_flag=$ac_save_objc_werror_flag])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1029 if test "$ac_test_OBJCFLAGS" = set; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1030 OBJCFLAGS=$ac_save_OBJCFLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1031 elif test $ac_cv_prog_objc_g = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1032 if test "$GOBJC" = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1033 OBJCFLAGS="-g -O2"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1034 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1035 OBJCFLAGS="-g"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1036 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1037 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1038 if test "$GOBJC" = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1039 OBJCFLAGS="-O2"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1040 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1041 OBJCFLAGS=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1042 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1043 fi[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1044 ])# _AC_PROG_OBJC_G
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1045
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1046
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1047
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1048 ## ------------------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1049 ## 4. Compilers' characteristics. ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1050 ## ------------------------------- ##
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1051
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1052 # -------------------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1053 # 4a. C compiler characteristics. #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1054 # -------------------------------- #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1055
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1056
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1057 # _AC_PROG_CC_C89 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1058 # ----------------------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1059 # If the C compiler is not in ANSI C89 (ISO C90) mode by default, try
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1060 # to add an option to output variable CC to make it so. This macro
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1061 # tries various options that select ANSI C89 on some system or
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1062 # another. It considers the compiler to be in ANSI C89 mode if it
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1063 # handles function prototypes correctly.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1064 AC_DEFUN([_AC_PROG_CC_C89],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1065 [_AC_C_STD_TRY([c89],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1066 [[#include <stdarg.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1067 #include <stdio.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1068 #include <sys/types.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1069 #include <sys/stat.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1070 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1071 struct buf { int x; };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1072 FILE * (*rcsopen) (struct buf *, struct stat *, int);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1073 static char *e (p, i)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1074 char **p;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1075 int i;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1076 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1077 return p[i];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1078 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1079 static char *f (char * (*g) (char **, int), char **p, ...)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1080 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1081 char *s;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1082 va_list v;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1083 va_start (v,p);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1084 s = g (p, va_arg (v,int));
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1085 va_end (v);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1086 return s;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1087 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1088
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1089 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1090 function prototypes and stuff, but not '\xHH' hex character constants.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1091 These don't provoke an error unfortunately, instead are silently treated
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1092 as 'x'. The following induces an error, until -std is added to get
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1093 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1094 array size at least. It's necessary to write '\x00'==0 to get something
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1095 that's true only with -std. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1096 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1097
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1098 /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1099 inside strings and character constants. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1100 #define FOO(x) 'x'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1101 int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1102
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1103 int test (int i, double x);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1104 struct s1 {int (*f) (int a);};
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1105 struct s2 {int (*f) (double a);};
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1106 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1107 int argc;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1108 char **argv;]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1109 [[return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1110 dnl Don't try gcc -ansi; that turns off useful extensions and
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1111 dnl breaks some systems' header files.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1112 dnl AIX circa 2003 -qlanglvl=extc89
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1113 dnl old AIX -qlanglvl=ansi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1114 dnl Ultrix, OSF/1, Tru64 -std
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1115 dnl HP-UX 10.20 and later -Ae
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1116 dnl HP-UX older versions -Aa -D_HPUX_SOURCE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1117 dnl SVR4 -Xc -D__EXTENSIONS__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1118 [-qlanglvl=extc89 -qlanglvl=ansi -std \
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1119 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"], [$1], [$2])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1120 ])# _AC_PROG_CC_C89
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1121
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1122
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1123 # _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1124 # ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1125 # --------------------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1126 # Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99')
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1127 # by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1128 # try again with each compiler option in the space-separated OPTION-LIST; if one
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1129 # helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1130 # else ACTION-IF-UNAVAILABLE.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1131 AC_DEFUN([_AC_C_STD_TRY],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1132 [AC_MSG_CHECKING([for $CC option to accept ISO ]m4_translit($1, [c], [C]))
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1133 AC_CACHE_VAL(ac_cv_prog_cc_$1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1134 [ac_cv_prog_cc_$1=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1135 ac_save_CC=$CC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1136 AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1137 for ac_arg in '' $4
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1138 do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1139 CC="$ac_save_CC $ac_arg"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1140 _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1141 test "x$ac_cv_prog_cc_$1" != "xno" && break
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1142 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1143 rm -f conftest.$ac_ext
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1144 CC=$ac_save_CC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1145 ])# AC_CACHE_VAL
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1146 case "x$ac_cv_prog_cc_$1" in
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1147 x)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1148 AC_MSG_RESULT([none needed]) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1149 xno)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1150 AC_MSG_RESULT([unsupported]) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1151 *)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1152 CC="$CC $ac_cv_prog_cc_$1"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1153 AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1154 esac
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1155 AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1156 ])# _AC_C_STD_TRY
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1157
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1158
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1159 # _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1160 # ----------------------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1161 # If the C compiler is not in ISO C99 mode by default, try to add an
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1162 # option to output variable CC to make it so. This macro tries
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1163 # various options that select ISO C99 on some system or another. It
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1164 # considers the compiler to be in ISO C99 mode if it handles _Bool,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1165 # // comments, flexible array members, inline, long long int, mixed
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1166 # code and declarations, named initialization of structs, restrict,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1167 # va_copy, varargs macros, variable declarations in for loops and
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1168 # variable length arrays.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1169 AC_DEFUN([_AC_PROG_CC_C99],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1170 [_AC_C_STD_TRY([c99],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1171 [[#include <stdarg.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1172 #include <stdbool.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1173 #include <stdlib.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1174 #include <wchar.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1175 #include <stdio.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1176
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1177 // Check varargs macros. These examples are taken from C99 6.10.3.5.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1178 #define debug(...) fprintf (stderr, __VA_ARGS__)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1179 #define showlist(...) puts (#__VA_ARGS__)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1180 #define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1181 static void
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1182 test_varargs_macros (void)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1183 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1184 int x = 1234;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1185 int y = 5678;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1186 debug ("Flag");
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1187 debug ("X = %d\n", x);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1188 showlist (The first, second, and third items.);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1189 report (x>y, "x is %d but y is %d", x, y);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1190 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1191
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1192 // Check long long types.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1193 #define BIG64 18446744073709551615ull
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1194 #define BIG32 4294967295ul
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1195 #define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1196 #if !BIG_OK
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1197 your preprocessor is broken;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1198 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1199 #if BIG_OK
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1200 #else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1201 your preprocessor is broken;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1202 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1203 static long long int bignum = -9223372036854775807LL;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1204 static unsigned long long int ubignum = BIG64;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1205
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1206 struct incomplete_array
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1207 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1208 int datasize;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1209 double data[];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1210 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1211
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1212 struct named_init {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1213 int number;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1214 const wchar_t *name;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1215 double average;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1216 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1217
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1218 typedef const char *ccp;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1219
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1220 static inline int
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1221 test_restrict (ccp restrict text)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1222 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1223 // See if C++-style comments work.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1224 // Iterate through items via the restricted pointer.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1225 // Also check for declarations in for loops.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1226 for (unsigned int i = 0; *(text+i) != '\0'; ++i)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1227 continue;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1228 return 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1229 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1230
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1231 // Check varargs and va_copy.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1232 static void
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1233 test_varargs (const char *format, ...)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1234 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1235 va_list args;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1236 va_start (args, format);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1237 va_list args_copy;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1238 va_copy (args_copy, args);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1239
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1240 const char *str;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1241 int number;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1242 float fnumber;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1243
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1244 while (*format)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1245 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1246 switch (*format++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1247 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1248 case 's': // string
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1249 str = va_arg (args_copy, const char *);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1250 break;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1251 case 'd': // int
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1252 number = va_arg (args_copy, int);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1253 break;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1254 case 'f': // float
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1255 fnumber = va_arg (args_copy, double);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1256 break;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1257 default:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1258 break;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1259 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1260 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1261 va_end (args_copy);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1262 va_end (args);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1263 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1264 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1265 [[
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1266 // Check bool.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1267 _Bool success = false;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1268
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1269 // Check restrict.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1270 if (test_restrict ("String literal") == 0)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1271 success = true;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1272 char *restrict newvar = "Another string";
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1273
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1274 // Check varargs.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1275 test_varargs ("s, d' f .", "string", 65, 34.234);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1276 test_varargs_macros ();
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1277
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1278 // Check flexible array members.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1279 struct incomplete_array *ia =
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1280 malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1281 ia->datasize = 10;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1282 for (int i = 0; i < ia->datasize; ++i)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1283 ia->data[i] = i * 1.234;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1284
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1285 // Check named initializers.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1286 struct named_init ni = {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1287 .number = 34,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1288 .name = L"Test wide string",
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1289 .average = 543.34343,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1290 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1291
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1292 ni.number = 58;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1293
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1294 int dynamic_array[ni.number];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1295 dynamic_array[ni.number - 1] = 543;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1296
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1297 // work around unused variable warnings
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1298 return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1299 || dynamic_array[ni.number - 1] != 543);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1300 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1301 dnl Try
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1302 dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1303 dnl AIX -qlanglvl=extc99 (unused restrictive mode: -qlanglvl=stdc99)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1304 dnl HP cc -AC99
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1305 dnl Intel ICC -std=c99, -c99 (deprecated)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1306 dnl IRIX -c99
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1307 dnl Solaris -xc99=all (Forte Developer 7 C mishandles -xc99 on Solaris 9,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1308 dnl as it incorrectly assumes C99 semantics for library functions)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1309 dnl Tru64 -c99
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1310 dnl with extended modes being tried first.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1311 [[-std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99]], [$1], [$2])[]dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1312 ])# _AC_PROG_CC_C99
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1313
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1314
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1315 # AC_PROG_CC_C89
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1316 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1317 AC_DEFUN([AC_PROG_CC_C89],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1318 [ AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1319 _AC_PROG_CC_C89
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1320 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1321
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1322
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1323 # AC_PROG_CC_C99
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1324 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1325 AC_DEFUN([AC_PROG_CC_C99],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1326 [ AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1327 _AC_PROG_CC_C99
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1328 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1329
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1330
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1331 # AC_PROG_CC_STDC
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1332 # ---------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1333 AC_DEFUN([AC_PROG_CC_STDC],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1334 [ AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1335 AS_CASE([$ac_cv_prog_cc_stdc],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1336 [no], [ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1337 [_AC_PROG_CC_C99([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1338 [_AC_PROG_CC_C89([ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1339 [ac_cv_prog_cc_stdc=no])])])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1340 AC_MSG_CHECKING([for $CC option to accept ISO Standard C])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1341 AC_CACHE_VAL([ac_cv_prog_cc_stdc], [])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1342 AS_CASE([$ac_cv_prog_cc_stdc],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1343 [no], [AC_MSG_RESULT([unsupported])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1344 [''], [AC_MSG_RESULT([none needed])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1345 [AC_MSG_RESULT([$ac_cv_prog_cc_stdc])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1346 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1347
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1348
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1349 # AC_C_BACKSLASH_A
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1350 # ----------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1351 AC_DEFUN([AC_C_BACKSLASH_A],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1352 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1353 AC_CACHE_CHECK([whether backslash-a works in strings], ac_cv_c_backslash_a,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1354 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1355 [[
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1356 #if '\a' == 'a'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1357 syntax error;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1358 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1359 char buf['\a' == 'a' ? -1 : 1];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1360 buf[0] = '\a';
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1361 return buf[0] != "\a"[0];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1362 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1363 [ac_cv_c_backslash_a=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1364 [ac_cv_c_backslash_a=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1365 if test $ac_cv_c_backslash_a = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1366 AC_DEFINE(HAVE_C_BACKSLASH_A, 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1367 [Define if backslash-a works in C strings.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1368 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1369 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1370
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1371
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1372 # AC_C_CROSS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1373 # ----------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1374 # Has been merged into AC_PROG_CC.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1375 AU_DEFUN([AC_C_CROSS], [])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1376
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1377
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1378 # AC_C_CHAR_UNSIGNED
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1379 # ------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1380 AC_DEFUN([AC_C_CHAR_UNSIGNED],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1381 [AH_VERBATIM([__CHAR_UNSIGNED__],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1382 [/* Define to 1 if type `char' is unsigned and you are not using gcc. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1383 #ifndef __CHAR_UNSIGNED__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1384 # undef __CHAR_UNSIGNED__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1385 #endif])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1386 AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1387 [AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1388 [((char) -1) < 0])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1389 ac_cv_c_char_unsigned=no, ac_cv_c_char_unsigned=yes)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1390 if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1391 AC_DEFINE(__CHAR_UNSIGNED__)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1392 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1393 ])# AC_C_CHAR_UNSIGNED
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1394
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1395
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1396 # AC_C_BIGENDIAN ([ACTION-IF-TRUE], [ACTION-IF-FALSE], [ACTION-IF-UNKNOWN],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1397 # [ACTION-IF-UNIVERSAL])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1398 # -------------------------------------------------------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1399 AC_DEFUN([AC_C_BIGENDIAN],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1400 [AH_VERBATIM([WORDS_BIGENDIAN],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1401 [/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1402 significant byte first (like Motorola and SPARC, unlike Intel). */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1403 #if defined AC_APPLE_UNIVERSAL_BUILD
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1404 # if defined __BIG_ENDIAN__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1405 # define WORDS_BIGENDIAN 1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1406 # endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1407 #else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1408 # ifndef WORDS_BIGENDIAN
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1409 # undef WORDS_BIGENDIAN
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1410 # endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1411 #endif])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1412 AC_CACHE_CHECK([whether byte ordering is bigendian], [ac_cv_c_bigendian],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1413 [ac_cv_c_bigendian=unknown
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1414 # See if we're dealing with a universal compiler.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1415 AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1416 [AC_LANG_SOURCE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1417 [[#ifndef __APPLE_CC__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1418 not a universal capable compiler
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1419 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1420 typedef int dummy;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1421 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1422 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1423 # Check for potential -arch flags. It is not universal unless
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1424 # there are some -arch flags. Note that *ppc* also matches
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1425 # ppc64. This check is also rather less than ideal.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1426 case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1427 *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1428 esac])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1429 if test $ac_cv_c_bigendian = unknown; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1430 # See if sys/param.h defines the BYTE_ORDER macro.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1431 AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1432 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1433 [[#include <sys/types.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1434 #include <sys/param.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1435 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1436 [[#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1437 && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1438 && LITTLE_ENDIAN)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1439 bogus endian macros
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1440 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1441 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1442 [# It does; now see whether it defined to BIG_ENDIAN or not.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1443 AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1444 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1445 [[#include <sys/types.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1446 #include <sys/param.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1447 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1448 [[#if BYTE_ORDER != BIG_ENDIAN
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1449 not big endian
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1450 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1451 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1452 [ac_cv_c_bigendian=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1453 [ac_cv_c_bigendian=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1454 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1455 if test $ac_cv_c_bigendian = unknown; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1456 # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1457 AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1458 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1459 [[#include <limits.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1460 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1461 [[#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1462 bogus endian macros
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1463 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1464 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1465 [# It does; now see whether it defined to _BIG_ENDIAN or not.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1466 AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1467 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1468 [[#include <limits.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1469 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1470 [[#ifndef _BIG_ENDIAN
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1471 not big endian
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1472 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1473 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1474 [ac_cv_c_bigendian=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1475 [ac_cv_c_bigendian=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1476 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1477 if test $ac_cv_c_bigendian = unknown; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1478 # Compile a test program.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1479 AC_RUN_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1480 [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1481 [[
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1482 /* Are we little or big endian? From Harbison&Steele. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1483 union
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1484 {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1485 long int l;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1486 char c[sizeof (long int)];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1487 } u;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1488 u.l = 1;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1489 return u.c[sizeof (long int) - 1] == 1;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1490 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1491 [ac_cv_c_bigendian=no],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1492 [ac_cv_c_bigendian=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1493 [# Try to guess by grepping values from an object file.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1494 AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1495 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1496 [[short int ascii_mm[] =
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1497 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1498 short int ascii_ii[] =
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1499 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1500 int use_ascii (int i) {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1501 return ascii_mm[i] + ascii_ii[i];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1502 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1503 short int ebcdic_ii[] =
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1504 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1505 short int ebcdic_mm[] =
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1506 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1507 int use_ebcdic (int i) {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1508 return ebcdic_mm[i] + ebcdic_ii[i];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1509 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1510 extern int foo;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1511 ]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1512 [[return use_ascii (foo) == use_ebcdic (foo);]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1513 [if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1514 ac_cv_c_bigendian=yes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1515 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1516 if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1517 if test "$ac_cv_c_bigendian" = unknown; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1518 ac_cv_c_bigendian=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1519 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1520 # finding both strings is unlikely to happen, but who knows?
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1521 ac_cv_c_bigendian=unknown
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1522 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1523 fi])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1524 fi])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1525 case $ac_cv_c_bigendian in #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1526 yes)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1527 m4_default([$1],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1528 [AC_DEFINE([WORDS_BIGENDIAN], 1)]);; #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1529 no)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1530 $2 ;; #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1531 universal)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1532 dnl Note that AC_APPLE_UNIVERSAL_BUILD sorts less than WORDS_BIGENDIAN;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1533 dnl this is a necessity for proper config header operation. Warn if
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1534 dnl the user did not specify a config header but is relying on the
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1535 dnl default behavior for universal builds.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1536 m4_default([$4],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1537 [AC_CONFIG_COMMANDS_PRE([m4_ifset([AH_HEADER], [],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1538 [AC_DIAGNOSE([obsolete],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1539 [AC_C_BIGENDIAN should be used with AC_CONFIG_HEADERS])])])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1540 AC_DEFINE([AC_APPLE_UNIVERSAL_BUILD],1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1541 [Define if building universal (internal helper macro)])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1542 ;; #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1543 *)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1544 m4_default([$3],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1545 [AC_MSG_ERROR([unknown endianness
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1546 presetting ac_cv_c_bigendian=no (or yes) will help])]) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1547 esac
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1548 ])# AC_C_BIGENDIAN
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1549
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1550
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1551 # AC_C_INLINE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1552 # -----------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1553 # Do nothing if the compiler accepts the inline keyword.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1554 # Otherwise define inline to __inline__ or __inline if one of those work,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1555 # otherwise define inline to be empty.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1556 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1557 # HP C version B.11.11.04 doesn't allow a typedef as the return value for an
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1558 # inline function, only builtin types.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1559 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1560 AN_IDENTIFIER([inline], [AC_C_INLINE])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1561 AC_DEFUN([AC_C_INLINE],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1562 [AC_CACHE_CHECK([for inline], ac_cv_c_inline,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1563 [ac_cv_c_inline=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1564 for ac_kw in inline __inline__ __inline; do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1565 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1566 [#ifndef __cplusplus
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1567 typedef int foo_t;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1568 static $ac_kw foo_t static_foo () {return 0; }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1569 $ac_kw foo_t foo () {return 0; }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1570 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1571 ])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1572 [ac_cv_c_inline=$ac_kw])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1573 test "$ac_cv_c_inline" != no && break
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1574 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1575 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1576 AH_VERBATIM([inline],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1577 [/* Define to `__inline__' or `__inline' if that's what the C compiler
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1578 calls it, or to nothing if 'inline' is not supported under any name. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1579 #ifndef __cplusplus
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1580 #undef inline
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1581 #endif])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1582 case $ac_cv_c_inline in
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1583 inline | yes) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1584 *)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1585 case $ac_cv_c_inline in
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1586 no) ac_val=;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1587 *) ac_val=$ac_cv_c_inline;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1588 esac
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1589 cat >>confdefs.h <<_ACEOF
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1590 #ifndef __cplusplus
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1591 #define inline $ac_val
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1592 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1593 _ACEOF
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1594 ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1595 esac
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1596 ])# AC_C_INLINE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1597
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1598
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1599 # AC_C_CONST
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1600 # ----------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1601 AC_DEFUN([AC_C_CONST],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1602 [AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1603 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1604 [[/* FIXME: Include the comments suggested by Paul. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1605 #ifndef __cplusplus
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1606 /* Ultrix mips cc rejects this. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1607 typedef int charset[2];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1608 const charset cs;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1609 /* SunOS 4.1.1 cc rejects this. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1610 char const *const *pcpcc;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1611 char **ppc;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1612 /* NEC SVR4.0.2 mips cc rejects this. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1613 struct point {int x, y;};
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1614 static struct point const zero = {0,0};
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1615 /* AIX XL C 1.02.0.0 rejects this.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1616 It does not let you subtract one const X* pointer from another in
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1617 an arm of an if-expression whose if-part is not a constant
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1618 expression */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1619 const char *g = "string";
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1620 pcpcc = &g + (g ? g-g : 0);
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1621 /* HPUX 7.0 cc rejects these. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1622 ++pcpcc;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1623 ppc = (char**) pcpcc;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1624 pcpcc = (char const *const *) ppc;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1625 { /* SCO 3.2v4 cc rejects this. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1626 char *t;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1627 char const *s = 0 ? (char *) 0 : (char const *) 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1628
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1629 *t++ = 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1630 if (s) return 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1631 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1632 { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1633 int x[] = {25, 17};
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1634 const int *foo = &x[0];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1635 ++foo;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1636 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1637 { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1638 typedef const int *iptr;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1639 iptr p = 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1640 ++p;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1641 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1642 { /* AIX XL C 1.02.0.0 rejects this saying
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1643 "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1644 struct s { int j; const int *ap[3]; };
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1645 struct s *b; b->j = 5;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1646 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1647 { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1648 const int foo = 10;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1649 if (!foo) return 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1650 }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1651 return !cs[0] && !zero.x;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1652 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1653 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1654 [ac_cv_c_const=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1655 [ac_cv_c_const=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1656 if test $ac_cv_c_const = no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1657 AC_DEFINE(const,,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1658 [Define to empty if `const' does not conform to ANSI C.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1659 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1660 ])# AC_C_CONST
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1661
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1662
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1663 # AC_C_RESTRICT
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1664 # -------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1665 # based on acx_restrict.m4, from the GNU Autoconf Macro Archive at:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1666 # http://autoconf-archive.cryp.to/acx_restrict.html
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1667 #
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1668 # Determine whether the C/C++ compiler supports the "restrict" keyword
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1669 # introduced in ANSI C99, or an equivalent. Define "restrict" to the alternate
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1670 # spelling, if any; these are more likely to work in both C and C++ compilers of
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1671 # the same family, and in the presence of varying compiler options. If only
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1672 # plain "restrict" works, do nothing. Here are some variants:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1673 # - GCC supports both __restrict and __restrict__
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1674 # - older DEC Alpha C compilers support only __restrict
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1675 # - _Restrict is the only spelling accepted by Sun WorkShop 6 update 2 C
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1676 # Otherwise, define "restrict" to be empty.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1677 AN_IDENTIFIER([restrict], [AC_C_RESTRICT])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1678 AC_DEFUN([AC_C_RESTRICT],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1679 [AC_CACHE_CHECK([for C/C++ restrict keyword], ac_cv_c_restrict,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1680 [ac_cv_c_restrict=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1681 # The order here caters to the fact that C++ does not require restrict.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1682 for ac_kw in __restrict __restrict__ _Restrict restrict; do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1683 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1684 [[typedef int * int_ptr;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1685 int foo (int_ptr $ac_kw ip) {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1686 return ip[0];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1687 }]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1688 [[int s[1];
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1689 int * $ac_kw t = s;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1690 t[0] = 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1691 return foo(t)]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1692 [ac_cv_c_restrict=$ac_kw])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1693 test "$ac_cv_c_restrict" != no && break
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1694 done
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1695 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1696 AH_VERBATIM([restrict],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1697 [/* Define to the equivalent of the C99 'restrict' keyword, or to
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1698 nothing if this is not supported. Do not define if restrict is
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1699 supported directly. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1700 #undef restrict
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1701 /* Work around a bug in Sun C++: it does not support _Restrict, even
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1702 though the corresponding Sun C compiler does, which causes
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1703 "#define restrict _Restrict" in the previous line. Perhaps some future
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1704 version of Sun C++ will work with _Restrict; if so, it'll probably
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1705 define __RESTRICT, just as Sun C does. */
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1706 #if defined __SUNPRO_CC && !defined __RESTRICT
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1707 # define _Restrict
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1708 #endif])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1709 case $ac_cv_c_restrict in
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1710 restrict) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1711 no) AC_DEFINE([restrict], []) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1712 *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1713 esac
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1714 ])# AC_C_RESTRICT
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1715
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1716
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1717 # AC_C_VOLATILE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1718 # -------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1719 # Note that, unlike const, #defining volatile to be the empty string can
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1720 # actually turn a correct program into an incorrect one, since removing
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1721 # uses of volatile actually grants the compiler permission to perform
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1722 # optimizations that could break the user's code. So, do not #define
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1723 # volatile away unless it is really necessary to allow the user's code
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1724 # to compile cleanly. Benign compiler failures should be tolerated.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1725 AC_DEFUN([AC_C_VOLATILE],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1726 [AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1727 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1728 volatile int x;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1729 int * volatile y = (int *) 0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1730 return !x && !y;])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1731 [ac_cv_c_volatile=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1732 [ac_cv_c_volatile=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1733 if test $ac_cv_c_volatile = no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1734 AC_DEFINE(volatile,,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1735 [Define to empty if the keyword `volatile' does not work.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1736 Warning: valid code using `volatile' can become incorrect
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1737 without. Disable with care.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1738 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1739 ])# AC_C_VOLATILE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1740
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1741
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1742 # AC_C_STRINGIZE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1743 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1744 # Checks if `#' can be used to glue strings together at the CPP level.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1745 # Defines HAVE_STRINGIZE if positive.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1746 AC_DEFUN([AC_C_STRINGIZE],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1747 [AC_CACHE_CHECK([for preprocessor stringizing operator],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1748 [ac_cv_c_stringize],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1749 [AC_EGREP_CPP([@%:@teststring],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1750 [@%:@define x(y) #y
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1751
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1752 char *s = x(teststring);],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1753 [ac_cv_c_stringize=no],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1754 [ac_cv_c_stringize=yes])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1755 if test $ac_cv_c_stringize = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1756 AC_DEFINE(HAVE_STRINGIZE, 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1757 [Define to 1 if cpp supports the ANSI @%:@ stringizing operator.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1758 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1759 ])# AC_C_STRINGIZE
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1760
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1761
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1762 # AC_C_PROTOTYPES
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1763 # ---------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1764 # Check if the C compiler supports prototypes, included if it needs
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1765 # options.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1766 AC_DEFUN([AC_C_PROTOTYPES],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1767 [AC_REQUIRE([AC_PROG_CC])dnl
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1768 AC_MSG_CHECKING([for function prototypes])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1769 if test "$ac_cv_prog_cc_c89" != no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1770 AC_MSG_RESULT([yes])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1771 AC_DEFINE(PROTOTYPES, 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1772 [Define to 1 if the C compiler supports function prototypes.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1773 AC_DEFINE(__PROTOTYPES, 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1774 [Define like PROTOTYPES; this can be used by system headers.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1775 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1776 AC_MSG_RESULT([no])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1777 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1778 ])# AC_C_PROTOTYPES
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1779
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1780
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1781 # AC_C_FLEXIBLE_ARRAY_MEMBER
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1782 # --------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1783 # Check whether the C compiler supports flexible array members.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1784 AC_DEFUN([AC_C_FLEXIBLE_ARRAY_MEMBER],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1785 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1786 AC_CACHE_CHECK([for flexible array members],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1787 ac_cv_c_flexmember,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1788 [AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1789 [AC_LANG_PROGRAM(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1790 [[#include <stdlib.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1791 #include <stdio.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1792 #include <stddef.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1793 struct s { int n; double d[]; };]],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1794 [[int m = getchar ();
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1795 struct s *p = malloc (offsetof (struct s, d)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1796 + m * sizeof (double));
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1797 p->d[0] = 0.0;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1798 return p->d != (double *) NULL;]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1799 [ac_cv_c_flexmember=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1800 [ac_cv_c_flexmember=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1801 if test $ac_cv_c_flexmember = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1802 AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], [],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1803 [Define to nothing if C supports flexible array members, and to
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1804 1 if it does not. That way, with a declaration like `struct s
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1805 { int n; double d@<:@FLEXIBLE_ARRAY_MEMBER@:>@; };', the struct hack
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1806 can be used with pre-C99 compilers.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1807 When computing the size of such an object, don't use 'sizeof (struct s)'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1808 as it overestimates the size. Use 'offsetof (struct s, d)' instead.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1809 Don't use 'offsetof (struct s, d@<:@0@:>@)', as this doesn't work with
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1810 MSVC and with C++ compilers.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1811 else
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1812 AC_DEFINE([FLEXIBLE_ARRAY_MEMBER], 1)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1813 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1814 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1815
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1816
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1817 # AC_C_VARARRAYS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1818 # --------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1819 # Check whether the C compiler supports variable-length arrays.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1820 AC_DEFUN([AC_C_VARARRAYS],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1821 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1822 AC_CACHE_CHECK([for variable-length arrays],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1823 ac_cv_c_vararrays,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1824 [AC_COMPILE_IFELSE(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1825 [AC_LANG_PROGRAM([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1826 [[static int x; char a[++x]; a[sizeof a - 1] = 0; return a[0];]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1827 [ac_cv_c_vararrays=yes],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1828 [ac_cv_c_vararrays=no])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1829 if test $ac_cv_c_vararrays = yes; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1830 AC_DEFINE([HAVE_C_VARARRAYS], 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1831 [Define to 1 if C supports variable-length arrays.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1832 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1833 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1834
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1835
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1836 # AC_C_TYPEOF
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1837 # -----------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1838 # Check if the C compiler supports GCC's typeof syntax.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1839 # The test case provokes incompatibilities in the Sun C compilers
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1840 # (both Solaris 8 and Solaris 10).
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1841 AC_DEFUN([AC_C_TYPEOF],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1842 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1843 AC_CACHE_CHECK([for typeof syntax and keyword spelling], ac_cv_c_typeof,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1844 [ac_cv_c_typeof=no
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1845 for ac_kw in typeof __typeof__ no; do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1846 test $ac_kw = no && break
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1847 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1848 [[
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1849 int value;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1850 typedef struct {
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1851 char a [1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1852 + ! (($ac_kw (value))
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1853 (($ac_kw (value)) 0 < ($ac_kw (value)) -1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1854 ? ($ac_kw (value)) - 1
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1855 : ~ (~ ($ac_kw (value)) 0
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1856 << sizeof ($ac_kw (value)))))]; }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1857 ac__typeof_type_;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1858 return
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1859 (! ((void) ((ac__typeof_type_ *) 0), 0));
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1860 ]])],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1861 [ac_cv_c_typeof=$ac_kw])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1862 test $ac_cv_c_typeof != no && break
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1863 done])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1864 if test $ac_cv_c_typeof != no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1865 AC_DEFINE([HAVE_TYPEOF], 1,
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1866 [Define to 1 if typeof works with your compiler.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1867 if test $ac_cv_c_typeof != typeof; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1868 AC_DEFINE_UNQUOTED([typeof], [$ac_cv_c_typeof],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1869 [Define to __typeof__ if your compiler spells it that way.])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1870 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1871 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1872 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1873
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1874
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1875 # _AC_LANG_OPENMP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1876 # ---------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1877 # Expands to some language dependent source code for testing the presence of
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1878 # OpenMP.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1879 AC_DEFUN([_AC_LANG_OPENMP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1880 [_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1881
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1882 # _AC_LANG_OPENMP(C)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1883 # ------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1884 m4_define([_AC_LANG_OPENMP(C)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1885 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1886 #ifndef _OPENMP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1887 choke me
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1888 #endif
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1889 #include <omp.h>
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1890 int main () { return omp_get_num_threads (); }
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1891 ])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1892
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1893 # _AC_LANG_OPENMP(C++)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1894 # --------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1895 m4_copy([_AC_LANG_OPENMP(C)], [_AC_LANG_OPENMP(C++)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1896
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1897 # _AC_LANG_OPENMP(Fortran 77)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1898 # ---------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1899 m4_define([_AC_LANG_OPENMP(Fortran 77)],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1900 [AC_LANG_FUNC_LINK_TRY([omp_get_num_threads])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1901
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1902 # _AC_LANG_OPENMP(Fortran)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1903 # ---------------------------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1904 m4_copy([_AC_LANG_OPENMP(Fortran 77)], [_AC_LANG_OPENMP(Fortran)])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1905
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1906 # AC_OPENMP
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1907 # ---------
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1908 # Check which options need to be passed to the C compiler to support OpenMP.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1909 # Set the OPENMP_CFLAGS / OPENMP_CXXFLAGS / OPENMP_FFLAGS variable to these
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1910 # options.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1911 # The options are necessary at compile time (so the #pragmas are understood)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1912 # and at link time (so the appropriate library is linked with).
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1913 # This macro takes care to not produce redundant options if $CC $CFLAGS already
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1914 # supports OpenMP. It also is careful to not pass options to compilers that
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1915 # misinterpret them; for example, most compilers accept "-openmp" and create
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1916 # an output file called 'penmp' rather than activating OpenMP support.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1917 AC_DEFUN([AC_OPENMP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1918 [
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1919 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1920 AC_ARG_ENABLE([openmp],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1921 [AS_HELP_STRING([--disable-openmp], [do not use OpenMP])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1922 if test "$enable_openmp" != no; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1923 AC_CACHE_CHECK([for $CC option to support OpenMP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1924 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1925 [AC_LINK_IFELSE([_AC_LANG_OPENMP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1926 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='none needed'],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1927 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp='unsupported'
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1928 dnl Try these flags:
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1929 dnl GCC >= 4.2 -fopenmp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1930 dnl SunPRO C -xopenmp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1931 dnl Intel C -openmp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1932 dnl SGI C, PGI C -mp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1933 dnl Tru64 Compaq C -omp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1934 dnl IBM C (AIX, Linux) -qsmp=omp
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1935 dnl If in this loop a compiler is passed an option that it doesn't
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1936 dnl understand or that it misinterprets, the AC_LINK_IFELSE test
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1937 dnl will fail (since we know that it failed without the option),
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1938 dnl therefore the loop will continue searching for an option, and
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1939 dnl no output file called 'penmp' or 'mp' is created.
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1940 for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp; do
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1941 ac_save_[]_AC_LANG_PREFIX[]FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1942 _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $ac_option"
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1943 AC_LINK_IFELSE([_AC_LANG_OPENMP],
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1944 [ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp=$ac_option])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1945 _AC_LANG_PREFIX[]FLAGS=$ac_save_[]_AC_LANG_PREFIX[]FLAGS
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1946 if test "$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp" != unsupported; then
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1947 break
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1948 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1949 done])])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1950 case $ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp in #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1951 "none needed" | unsupported)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1952 ;; #(
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1953 *)
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1954 OPENMP_[]_AC_LANG_PREFIX[]FLAGS=$ac_cv_prog_[]_AC_LANG_ABBREV[]_openmp ;;
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1955 esac
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1956 fi
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1957 AC_SUBST([OPENMP_]_AC_LANG_PREFIX[FLAGS])
106a409ceeef This is crazy. In order to override the default optimization for GCC,
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1958 ])