Chris@10
|
1 dnl @synopsis AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
|
Chris@10
|
2 dnl @summary check whether FLAGS are accepted by the compiler
|
Chris@10
|
3 dnl @category Misc
|
Chris@10
|
4 dnl
|
Chris@10
|
5 dnl Check whether the given compiler FLAGS work with the current language's
|
Chris@10
|
6 dnl compiler, or whether they give an error. (Warnings, however, are
|
Chris@10
|
7 dnl ignored.)
|
Chris@10
|
8 dnl
|
Chris@10
|
9 dnl ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
Chris@10
|
10 dnl success/failure.
|
Chris@10
|
11 dnl
|
Chris@10
|
12 dnl @version 2005-05-30
|
Chris@10
|
13 dnl @license GPLWithACException
|
Chris@10
|
14 dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Matteo Frigo.
|
Chris@10
|
15 AC_DEFUN([AX_CHECK_COMPILER_FLAGS],
|
Chris@10
|
16 [AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX
|
Chris@10
|
17 AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1])
|
Chris@10
|
18 dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname:
|
Chris@10
|
19 AS_LITERAL_IF([$1],
|
Chris@10
|
20 [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [
|
Chris@10
|
21 ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
Chris@10
|
22 _AC_LANG_PREFIX[]FLAGS="$1"
|
Chris@10
|
23 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
Chris@10
|
24 AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
|
Chris@10
|
25 AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
|
Chris@10
|
26 _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])],
|
Chris@10
|
27 [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS
|
Chris@10
|
28 _AC_LANG_PREFIX[]FLAGS="$1"
|
Chris@10
|
29 AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
Chris@10
|
30 eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes,
|
Chris@10
|
31 eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no)
|
Chris@10
|
32 _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])
|
Chris@10
|
33 eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)
|
Chris@10
|
34 AC_MSG_RESULT($ax_check_compiler_flags)
|
Chris@10
|
35 if test "x$ax_check_compiler_flags" = xyes; then
|
Chris@10
|
36 m4_default([$2], :)
|
Chris@10
|
37 else
|
Chris@10
|
38 m4_default([$3], :)
|
Chris@10
|
39 fi
|
Chris@10
|
40 ])dnl AX_CHECK_COMPILER_FLAGS
|