aboutsummaryrefslogtreecommitdiffstats
path: root/m4/cflags.m4
blob: cc6d5fab3ab56bbbf877853199dbb9a85a637c12 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
AC_DEFUN([CHECK_CFLAG], [
    var=`echo "$1" | tr "=-" "__"`
    AC_CACHE_CHECK([whether the C compiler accepts $1],[check_cflag_$var],[
        save_CFLAGS="$CFLAGS"
        CFLAGS="$CFLAGS $1"
        AC_COMPILE_IFELSE([int main(void) { return 0; }],
            [eval "check_cflag_$var=yes"],
            [eval "check_cflag_$var=no"])
        CFLAGS="$save_CFLAGS"
        ])
    if eval "test x`echo '$check_cflag_'$var` = xyes"; then
        AM_CFLAGS="$AM_CFLAGS $1"
    fi
    ])
])