]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
build: Set default compiler variables from configure
authorGuillem Jover <guillem@hadrons.org>
Sun, 3 Jun 2012 05:39:42 +0000 (07:39 +0200)
committerGuillem Jover <guillem@hadrons.org>
Sun, 3 Jun 2012 05:46:00 +0000 (07:46 +0200)
This centralizes the setting so there's no duplication anymore,
makes sure the user supplied variables are never overridden, and
are only set when using gcc.

Reported-by: Samuli Suominen <ssuominen@gentoo.org>
configure.ac
src/Makefile.am
test/Makefile.am

index 54da1017634c6a63fc924e4262144c8333319f51..063bf9270a34f839bde0b169638b5abda2117154 100644 (file)
@@ -11,6 +11,9 @@ AM_INIT_AUTOMAKE([1.8 foreign nostdinc])
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
                             [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
 
+# Check and store if we got user supplied variables
+user_CFLAGS=${CFLAGS-unset}
+
 # Checks for operating system services and capabilities.
 AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
@@ -22,6 +25,11 @@ AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
+# Set default compiler variables
+if test "$user_CFLAGS" = unset && test "$GCC" = yes; then
+  CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter"
+fi
+
 # Checks for libraries.
 
 # Checks for header files.
index 4c571369c6d26834fc69e5f3b5ecf566b88cb7df..46b946bd7bc89a3dc74a417c5767bbcab3821d2e 100644 (file)
@@ -1,8 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-# Set default values for user variables
-CFLAGS = -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter
-
 AM_CPPFLAGS = \
        -I$(top_builddir) \
        -isystem $(top_srcdir)/include/bsd/ \
index f2801363905b7b7e566d7761b8cc77f25d3806ef..1d41b86d762757974ff3341dbed3b80b8019d5f5 100644 (file)
@@ -1,8 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-# Set default values for user variables
-CFLAGS = -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter
-
 AM_CPPFLAGS = \
        -I$(top_builddir) \
        -isystem $(top_srcdir)/include/bsd/ \