File: cc-flags.m4

package info (click to toggle)
inn2 2.5.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,720 kB
  • ctags: 8,983
  • sloc: ansic: 92,499; sh: 13,509; perl: 12,921; makefile: 2,985; yacc: 842; python: 342; lex: 255
file content (28 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
dnl cc-flags.m4 -- Checks whether the compiler supports a given flag.
dnl $Id: cc-flags.m4 8312 2009-01-31 20:35:04Z iulius $
dnl
dnl Used to check whether a compiler supports a given flag.  If it does, the
dnl commands in the second argument are run.  If not, the commands in the
dnl third argument are run.

dnl Used to build the result cache name.
AC_DEFUN([_INN_PROG_CC_FLAG_CACHE],
[translit([inn_cv_compiler_c_$1], [-], [_])])

AC_DEFUN([INN_PROG_CC_FLAG],
[AC_REQUIRE([AC_PROG_CC])
AC_MSG_CHECKING([if $CC supports $1])
AC_CACHE_VAL([_INN_PROG_CC_FLAG_CACHE([$1])],
[save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $1"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]], [[int foo = 0;]])],
    [_INN_PROG_CC_FLAG_CACHE([$1])=yes],
    [_INN_PROG_CC_FLAG_CACHE([$1])=no])
CFLAGS=$save_CFLAGS])
AC_MSG_RESULT($_INN_PROG_CC_FLAG_CACHE([$1]))
 if test x"$_INN_PROG_CC_FLAG_CACHE([$1])" = xyes ; then
    ifelse([$2], , :, [$2])
 else
    ifelse([$3], , :, [$3])
 fi])