aboutsummaryrefslogtreecommitdiffstats
path: root/acinclude.m4
diff options
context:
space:
mode:
authorstandel <standel@f5534014-38df-0310-8fa8-9805f1628bb7>2007-04-22 09:27:21 +0000
committerstandel <standel@f5534014-38df-0310-8fa8-9805f1628bb7>2007-04-22 09:27:21 +0000
commit7a385b06097a35cef68757614b501eb03def5bc4 (patch)
tree517d1907bb773519676d82bb0b40a60e387d34c9 /acinclude.m4
parent16c7fea3f584565a3a517eb682d6c67ba69b413b (diff)
adding AC_(WIRESHARK|WIRETAP)_GCC_CFLAGS_OPTION macro to test whether gcc
supports the options passed as arguments. If the options are supported, they are added to CFLAGS. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21493 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'acinclude.m4')
-rw-r--r--acinclude.m430
1 files changed, 30 insertions, 0 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index fd1d86ac04..127fc77905 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1503,3 +1503,33 @@ AC_DEFUN([AC_WIRESHARK_KRB5_CHECK],
AC_SUBST(KRB5_LIBS)
])
+#
+# AC_WIRESHARK_GCC_CFLAGS_CHECK
+#
+# $1 : cflags to test
+#
+# The macro first determines if the compiler is GCC. Then compile with the
+# defined cflags. The defined flags are added to CFLAGS only if the compilation
+# succeeds.
+#
+AC_DEFUN([AC_WIRESHARK_GCC_CFLAGS_CHECK],
+[GCC_OPTION="$1"
+AC_MSG_CHECKING(whether we can add $GCC_OPTION to CFLAGS)
+if test "x$GCC" != "x"; then
+ CFLAGS_saved="$CFLAGS"
+ CFLAGS="$CFLAGS $GCC_OPTION"
+ AC_COMPILE_IFELSE([
+ AC_LANG_SOURCE([[
+ int foo;
+ ]])],
+ [
+ AC_MSG_RESULT(yes)
+ ],
+ [
+ AC_MSG_RESULT(no)
+ CFLAGS="$CFLAGS_saved"
+ ])
+else
+ AC_MSG_RESULT(no)
+fi
+])