aboutsummaryrefslogtreecommitdiffstats
path: root/m4/cflags.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/cflags.m4')
-rw-r--r--m4/cflags.m415
1 files changed, 15 insertions, 0 deletions
diff --git a/m4/cflags.m4 b/m4/cflags.m4
new file mode 100644
index 000000000..cc6d5fab3
--- /dev/null
+++ b/m4/cflags.m4
@@ -0,0 +1,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
+ ])
+])