diff options
author | standel <standel@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-04-22 09:27:21 +0000 |
---|---|---|
committer | standel <standel@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-04-22 09:27:21 +0000 |
commit | 7a385b06097a35cef68757614b501eb03def5bc4 (patch) | |
tree | 517d1907bb773519676d82bb0b40a60e387d34c9 /acinclude.m4 | |
parent | 16c7fea3f584565a3a517eb682d6c67ba69b413b (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.m4 | 30 |
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 +]) |