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