annotate acinclude/ax_check_compiler_flags.m4 @ 5165:e2b3f003e085

Updated for API changes
author Sam Lantinga <slouken@libsdl.org>
date Thu, 03 Feb 2011 02:42:50 -0800
parents 5d7d48157be7
children
rev   line source
5029
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 # ===========================================================================
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 # http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 # ===========================================================================
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 # SYNOPSIS
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 # AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 # DESCRIPTION
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 # Check whether the given compiler FLAGS work with the current language's
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 # compiler, or whether they give an error. (Warnings, however, are
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 # ignored.)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 # ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 # success/failure.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 # LICENSE
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 # Copyright (c) 2009 Steven G. Johnson <stevenj@alum.mit.edu>
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 # Copyright (c) 2009 Matteo Frigo
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 # This program is free software: you can redistribute it and/or modify it
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 # under the terms of the GNU General Public License as published by the
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 # Free Software Foundation, either version 3 of the License, or (at your
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 # option) any later version.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 # This program is distributed in the hope that it will be useful, but
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 # WITHOUT ANY WARRANTY; without even the implied warranty of
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 # Public License for more details.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 # You should have received a copy of the GNU General Public License along
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 # with this program. If not, see <http://www.gnu.org/licenses/>.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 # As a special exception, the respective Autoconf Macro's copyright owner
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 # gives unlimited permission to copy, distribute and modify the configure
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 # scripts that are the output of Autoconf when processing the Macro. You
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 # need not follow the terms of the GNU General Public License when using
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 # or distributing such scripts, even though portions of the text of the
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 # Macro appear in them. The GNU General Public License (GPL) does govern
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 # all other use of the material that constitutes the Autoconf Macro.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 #
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44 # This special exception to the GPL applies to versions of the Autoconf
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 # Macro released by the Autoconf Archive. When you make and distribute a
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 # modified version of the Autoconf Macro, you may extend this special
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 # exception to the GPL to apply to your modified version as well.
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 #serial 9
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 AS_LITERAL_IF([$1],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 _AC_LANG_PREFIX[]FLAGS="$1"
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 _AC_LANG_PREFIX[]FLAGS="$1"
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes,
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 AC_MSG_RESULT($ax_check_compiler_flags)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 if test "x$ax_check_compiler_flags" = xyes; then
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 m4_default([$2], :)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 else
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 m4_default([$3], :)
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 fi
5d7d48157be7 Greg Jandl to SDL
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 ])dnl AX_CHECK_COMPILER_FLAGS