chiark / gitweb /
configure.ac, wireshark/Makefile.am: Leave CFLAGS and CPPFLAGS to user.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 20 Jan 2012 01:19:03 +0000 (01:19 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 24 Jan 2012 01:49:15 +0000 (01:49 +0000)
Only fiddle with AM_CFLAGS, so that users can use CFLAGS to do stuff
like set debugging and fiddle with optimization settings.  This turns
out to be a bit fiddly because Autoconf doesn't really understand this
stuff.

configure.ac
wireshark/Makefile.am

index 54caf9d..3ca6cf6 100644 (file)
@@ -41,6 +41,11 @@ AM_PROG_LIBTOOL
 
 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
 
+mdw_ORIG_CFLAGS=$CFLAGS
+mdw_ORIG_CPPFLAGS=$CPPFLAGS
+AC_SUBST(AM_CFLAGS)
+AC_SUBST(AM_CPPFLAGS)
+
 dnl--------------------------------------------------------------------------
 dnl C programming environment.
 
@@ -51,17 +56,17 @@ AC_SEARCH_LIBS([socket], [socket])
 case "$host_os" in
   linux)
     AC_ARG_WITH([linux-includes],
-               AS_HELP_STRING(
+               AS_HELP_STRING(
                  [--with-linux-includes=DIR],
                  [Linux kernel includes]),
-               [CFLAGS="$CFLAGS -I$withval"], [:])
+               [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:])
     ;;
 esac
 
 PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
 
-CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
+AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
 
 dnl--------------------------------------------------------------------------
 dnl Directories to install things into.
@@ -296,7 +301,7 @@ case "$haveshark,$needshark" in
     AC_MSG_ERROR([failed to configure Wireshark plugin])
     ;;
   yes,*)
-    WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
+    WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
     AC_SUBST(WIRESHARK_CFLAGS)
     AC_SUBST(wireshark_plugindir)
     ;;
@@ -307,6 +312,9 @@ AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
 dnl--------------------------------------------------------------------------
 dnl Produce output.
 
+CFLAGS=$mdw_ORIG_CFLAGS
+CPPFLAGS=$mdw_ORIG_CPPFLAGS
+
 AC_CONFIG_HEADER([config/config.h])
 AC_CONFIG_TESTDIR([t])
 
index ae3ccf4..6342178 100644 (file)
@@ -28,7 +28,7 @@ include $(top_srcdir)/vars.am
 ###--------------------------------------------------------------------------
 ### Wireshark plugin.
 
-CFLAGS                         += $(WIRESHARK_CFLAGS)
+AM_CFLAGS                      += $(WIRESHARK_CFLAGS)
 LIBS                            =
 
 wireshark_plugin_LTLIBRARIES    = tripe.la