diff options
author | Sebastien Tandel <sebastien@tandel.be> | 2007-04-22 09:27:21 +0000 |
---|---|---|
committer | Sebastien Tandel <sebastien@tandel.be> | 2007-04-22 09:27:21 +0000 |
commit | 706627f882078eda3937374183766e0a8e3017df (patch) | |
tree | 517d1907bb773519676d82bb0b40a60e387d34c9 /acinclude.m4 | |
parent | 23faf81799bbbf4c68f4d16fe5ef5ad3962f7321 (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.
svn path=/trunk/; revision=21493
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 +]) |