diff options
author | Guy Harris <guy@alum.mit.edu> | 2007-04-22 07:22:37 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2007-04-22 07:22:37 +0000 |
commit | 23faf81799bbbf4c68f4d16fe5ef5ad3962f7321 (patch) | |
tree | 24137d72085340d35a89defc4766462299ebe889 /wiretap | |
parent | 464e5030ca8a8d04f3ce8c34345713aa1260f98d (diff) |
Use AC_HELP_STRING for the help strings for --with and --enable flags.
Add -Wpointer-arith to the GCC -W flags by default.
Make "extra-gcc-checks" and "warnings-as-errors" --enable flags rather
than --with flags - autoconf's model is that --enable is for turning
features on or off, --with is for enabling or disabling the use of
external packages (libpcap, Net-SNMP, GNU ADNS, etc.).
When testing whether the compiler is GCC, use the same style all the
time - check whether "x$GCC" equals "xyes". (The "x" might be overkill
- if you don't quote the arguments, it avoids a missing argument to
"test"/"[", but if you do, it might not be needed.)
svn path=/trunk/; revision=21492
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/configure.in | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/wiretap/configure.in b/wiretap/configure.in index d9d7f9383b..5f140c8721 100644 --- a/wiretap/configure.in +++ b/wiretap/configure.in @@ -32,16 +32,17 @@ AC_SUBST(FLEX_PATH) # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function # argument will compile with non-GCC compilers. # -AC_ARG_WITH(extra-gcc-checks, -[ --with-extra-gcc-checks Do additional -W checks in GCC. [default=no]], +AC_ARG_ENABLE(extra-gcc-checks, + AC_HELP_STRING( [--enable-extra-gcc-checks], + [Do additional -W checks in GCC. @<:@default=no@:>@]), [ - if test $withval != no + if test $enableval != no then wireshark_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wstrict-prototypes -Wmissing-declarations -Wwrite-strings" fi ],) -AC_MSG_CHECKING(to see if we can add '-Wall -Wpointer-arith -W$wireshark_extra_gcc_flags' to CFLAGS) -if test x$GCC != x ; then +AC_MSG_CHECKING(whether we can add '-Wall -Wpointer-arith -W$wireshark_extra_gcc_flags' to CFLAGS) +if test "x$GCC" = "xyes" ; then CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -Wpointer-arith -W$wireshark_extra_gcc_flags $CFLAGS" AC_MSG_RESULT(yes) else @@ -49,8 +50,8 @@ else AC_MSG_RESULT(no) fi -AC_MSG_CHECKING(to see if we can add '-Wdeclaration-after-statement' to CFLAGS) -if test x$GCC == xyes ; then +AC_MSG_CHECKING(whether we can add '-Wdeclaration-after-statement' to CFLAGS) +if test "x$GCC" = "xyes" ; then # some versions of GCC support this directive rm -rf conftest* echo "int foo;" >>conftest.c @@ -67,7 +68,7 @@ fi rm -rf conftest* AC_MSG_CHECKING(to see if we can add '-Wno-pointer-sign' to CFLAGS) -if test x$GCC == xyes ; then +if test "x$GCC" = "xyes" ; then # some versions of GCC support this directive rm -rf conftest* echo "int foo;" >>conftest.c @@ -84,11 +85,11 @@ fi rm -rf conftest* AC_MSG_CHECKING(whether we should treat compiler warnings as errors) -AC_ARG_WITH(warnings-as-errors, - AC_HELP_STRING( [--with-warnings-as-errors], - [Treat warnings as errors (only for gcc). [default=yes]]), +AC_ARG_ENABLE(warnings-as-errors, + AC_HELP_STRING( [--enable-warnings-as-errors], + [Treat warnings as errors (only for gcc). @<:@default=yes@:>@]), [ - if test "x$GCC" != "x" && test "x$withval" == "xyes"; then + if test "x$GCC" = "xyes" && test "x$enableval" == "xyes"; then with_warnings_as_errors="yes" AC_MSG_RESULT(yes) else @@ -96,7 +97,7 @@ AC_ARG_WITH(warnings-as-errors, AC_MSG_RESULT(no) fi ], - if test "x$GCC" != "x" && test "x$wireshark_extra_gcc_flags" = "x"; then + if test "x$GCC" = "xyes" && test "x$wireshark_extra_gcc_flags" = "x"; then with_warnings_as_errors="yes" AC_MSG_RESULT(yes) else @@ -110,8 +111,23 @@ AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes # Add any platform-specific compiler flags needed. # AC_MSG_CHECKING(for platform-specific compiler flags) -if test "x$GCC" = x -then +if test "x$GCC" = "xyes" ; then + # + # GCC - do any platform-specific tweaking necessary. + # + case "$host_os" in + darwin*) + # + # See comments above about Apple's lovely C compiler. + # + CFLAGS="-no-cpp-precomp $CFLAGS" + AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp) + ;; + *) + AC_MSG_RESULT(none needed) + ;; + esac +else # # Not GCC - assume it's the vendor's compiler. # @@ -140,22 +156,8 @@ then AC_MSG_RESULT(none needed) ;; esac -else - case "$host_os" in - darwin*) - # - # See comments above about Apple's lovely C compiler. - # - CFLAGS="-no-cpp-precomp $CFLAGS" - AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp) - ;; - *) - AC_MSG_RESULT(none needed) - ;; - esac fi - # # Add any platform-specific linker flags needed. # @@ -196,11 +198,14 @@ esac AC_SUBST(LDFLAGS_SHAREDLIB) AC_ARG_ENABLE(profile-build, -[ --enable-profile-build build profile-ready binaries. [default=no]],enable_profile_build=$enableval,enable_profile_build=no) + AC_HELP_STRING( [--enable-profile-build], + [build profile-ready binaries. @<:@default=no@:>@]), + enable_profile_build=$enableval,enable_profile_build=no) + AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes) AC_MSG_CHECKING(if profile builds must be generated) if test "x$enable_profile_build" = "xyes" ; then - if test -n "$GCC" ; then + if test "x$GCC" = "xyes" ; then AC_MSG_RESULT(yes) CFLAGS=" -pg $CFLAGS" else @@ -212,7 +217,9 @@ else fi AC_ARG_ENABLE(gtk2, -[ --disable-gtk2 build Glib1/Gtk1+-based wireshark/tshark. [default=no]],enable_gtk2=$enableval,enable_gtk2=yes) + AC_HELP_STRING( [--disable-gtk2], + [build Glib1/Gtk1+-based wireshark/tshark. @<:@default=no@:>@]), + enable_gtk2=$enableval,enable_gtk2=yes) if test "x$enable_gtk2" = "xyes" ; then AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS" LIBS="$LIBS $GLIB_LIBS", , gmodule) @@ -222,7 +229,9 @@ fi dnl Look in /usr/local for header files and libraries ? AC_ARG_ENABLE(usr-local, -[ --enable-usr-local look for headers and libs in /usr/local tree. [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes) + AC_HELP_STRING( [--enable-usr-local], + [look for headers and libs in /usr/local tree. @<:@default=yes@:>@]), + enable_usr_local=$enableval,enable_usr_local=yes) AC_MSG_CHECKING(whether to use /usr/local for headers and libraries) if test "x$enable_usr_local" = "xyes" ; then @@ -320,7 +329,8 @@ AC_COMPILE_IFELSE( # there's no benefit to not looking for the header. # AC_ARG_WITH(pcap, -[ --with-pcap=DIR libpcap is located in directory DIR.], + AC_HELP_STRING( [--with-pcap=DIR], + [libpcap is located in directory DIR.]), [ if test $withval != yes -a $withval != no then @@ -335,7 +345,8 @@ dnl zlib check AC_MSG_CHECKING(whether to use zlib for reading compressed capture files) AC_ARG_WITH(zlib, -[ --with-zlib[=DIR] use zlib (located in directory DIR, if supplied) to read compressed data. [default=yes, if present]], + AC_HELP_STRING( [--with-zlib@<:@=DIR@:>@], + [use zlib (located in directory DIR, if supplied) to read compressed data. @<:@default=yes, if present@:>@]), [ if test $withval = no then |