diff options
author | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2013-01-04 02:12:51 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss.ws@gmail.com> | 2013-01-04 02:12:51 +0000 |
commit | 3be49bedd126c4a4446d6f05fafe653fa2578b03 (patch) | |
tree | 22502b2c5c29ef9b000979ad6a6759d0bbf35204 | |
parent | 6ea36c51c3b912d139833f033bd5d23649e9aea3 (diff) |
In AC_WIRESHARK_GCC_CFLAGS_CHECK() don't check if $3 (the program to be run)
exists by doing:
if test "x$3" != "x" ; then
because if the program contains quotes it breaks the shell's parsing.
Instead test for the existence of $4 (which is mandatory if $3 is given).
Fix up the test program for -Wlogical-op so that it actually compiles
warning-free (at least on my system) when the compiler doesn't have the bug
we're checking for.
svn path=/trunk/; revision=46926
-rw-r--r-- | acinclude.m4 | 14 | ||||
-rw-r--r-- | configure.ac | 11 |
2 files changed, 16 insertions, 9 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index a17c7a1328..c1d1704f34 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -785,10 +785,10 @@ AC_DEFUN([AC_WIRESHARK_LIBLUA_CHECK],[ LIBS="$LIBS -L$lua_dir/lib -llua -lm" wireshark_save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -L$lua_dir/lib" - + # # Determine Lua version by reading the LUA_VERSION_NUM definition - # from lua.h under the given Lua directory. The value is 501 for + # from lua.h under the given Lua directory. The value is 501 for # Lua 5.1, 502 for Lua 5.2, etc. # AC_MSG_CHECKING(Lua version) @@ -1641,7 +1641,10 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then # whether it fails with this option and -Werror, # and, if so, don't include it. # - if test "x$3" != "x" ; then + # We test arg 4 here because arg 3 is a program which + # could contain quotes (breaking the comparison). + # + if test "x$4" != "x" ; then CFLAGS="$CFLAGS -Werror" AC_MSG_CHECKING(whether $GCC_OPTION $4) AC_COMPILE_IFELSE([ @@ -1705,7 +1708,10 @@ if test "x$ac_supports_gcc_flags" = "xyes" ; then # whether it fails with this option and -Werror, # and, if so, don't include it. # - if test "x$3" != "x" ; then + # We test arg 4 here because arg 3 is a program which + # could contain quotes (breaking the comparison). + # + if test "x$4" != "x" ; then CXXFLAGS="$CXXFLAGS -Werror" AC_MSG_CHECKING(whether $GCC_OPTION $4) AC_COMPILE_IFELSE([ diff --git a/configure.ac b/configure.ac index c0d7b2ccae..7fc7a32a56 100644 --- a/configure.ac +++ b/configure.ac @@ -471,16 +471,17 @@ foo(int a) [warns about variables in function declarations shadowing other variables]) # Unfortunately some versions of gcc generate logical-op warnings when strchr() -# is given a constant seperators list. +# is given a constant string. # gcc versions 4.3.2 and 4.4.5 are known to have the problem. AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wlogical-op, C, [ #include <string.h> -extern int foo(char *, int); +int foo(const char *, int); +int bar(void); int -foo(char *sep, int c) +foo(const char *sep, int c) { if (strchr (sep, c) != NULL) return 1; @@ -489,9 +490,9 @@ foo(char *sep, int c) } int -main(int argc, char **argv) +bar(void) { - return foo(\"<\", 'a'); + return foo("<", 'a'); } ], [generates warnings from strchr()]) |