kwo pushed a commit to branch master.

commit 6e41fe2e1ace8298e2bb9116f30206594b7c064e
Author: Kim Woelders <[email protected]>
Date:   Tue Jul 2 06:57:19 2013 +0200

    Set warning options when using gcc.
---
 .gitignore                      |  1 +
 Makefile.am                     |  2 ++
 autogen.sh                      |  2 +-
 configure.ac                    |  4 +++-
 m4/ac_warnflags.m4              | 31 +++++++++++++++++++++++++++++++
 src/lib/Makefile.am             |  1 +
 src/modules/filters/Makefile.am |  1 +
 src/modules/loaders/Makefile.am |  1 +
 8 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index c17f8fb..79675ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@
 /ltmain.sh
 /missing
 /stamp-h1
+/m4/*.m4
 
 /imlib2-config
 /imlib2.pc
diff --git a/Makefile.am b/Makefile.am
index f86fcf6..d7abbe6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,7 @@
 AUTOMAKE_OPTIONS = foreign
 
+ACLOCAL_AMFLAGS = -I m4
+
 SUBDIRS = src data doc
 
 MAINTAINERCLEANFILES = aclocal.m4 config.guess config.h.in \
diff --git a/autogen.sh b/autogen.sh
index fc4f667..753a7d3 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -3,7 +3,7 @@
 rm -rf autom4te.cache
 rm -f aclocal.m4 ltmain.sh
 
-echo "Running aclocal..." ; aclocal $ACLOCAL_FLAGS || exit 1
+echo "Running aclocal..." ; aclocal -I m4 $ACLOCAL_FLAGS || exit 1
 echo "Running autoheader..." ; autoheader || exit 1
 echo "Running autoconf..." ; autoconf || exit 1
 echo "Running libtoolize..." ; (libtoolize --copy --automake $LIBTOOL_FLAGS || 
glibtoolize --automake) || exit 1
diff --git a/configure.ac b/configure.ac
index a4e2ca7..77927a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ rm -f config.cache
 
 AC_INIT([imlib2], [1.4.5], [[email protected]])
 AC_CONFIG_SRCDIR(configure.ac)
-dnl#AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_MACRO_DIR([m4])
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
@@ -501,6 +501,8 @@ fi
 AM_CONDITIONAL(BUILD_ID3_LOADER, test "$id3_ok" = yes)
 AC_SUBST(ID3LIBS)
 
+AC_C_WARNFLAGS()
+
 if test "x$enable_visibility_hiding" = xyes ; then
   CPPFLAGS="$CPPFLAGS -fvisibility=hidden"
 fi
diff --git a/m4/ac_warnflags.m4 b/m4/ac_warnflags.m4
new file mode 100644
index 0000000..84128c0
--- /dev/null
+++ b/m4/ac_warnflags.m4
@@ -0,0 +1,31 @@
+dnl Copyright (C) 2008 Kim Woelders
+dnl This code is public domain and can be freely used or copied.
+
+dnl Macro to set compiler warning flags
+
+dnl Provides configure argument --enable-werror to stop compilation on warnings
+
+dnl Usage: AC_C_WARNFLAGS([LANG])
+dnl Set LANG to 'cpp' when compiling for C++
+
+AC_DEFUN([AC_C_WARNFLAGS], [
+  define(ac_c_compile_cpp, ifelse([$1], [cpp], [yes], [no]))
+
+  AC_ARG_ENABLE(werror,
+    [  --enable-werror         treat compiler warnings as errors 
@<:@default=no@:>@],,
+    enable_werror=no)
+
+  if test "x$GCC" = "xyes"; then
+    CWARNFLAGS="-W -Wall -Waggregate-return -Wcast-align -Wpointer-arith 
-Wshadow -Wwrite-strings"
+dnl # ignore some warnings for now...
+    CWARNFLAGS="$CWARNFLAGS -Wno-unused-parameter"
+    ifelse(ac_c_compile_cpp, no, [
+      CWARNFLAGS="$CWARNFLAGS -Wmissing-prototypes -Wmissing-declarations 
-Wstrict-prototypes"
+    ],)
+
+    if test "x$enable_werror" = "xyes"; then
+      CWARNFLAGS="$CWARNFLAGS -Werror"
+    fi
+  fi
+  AC_SUBST(CWARNFLAGS)
+])
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 51a7212..d44dc88 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -1,5 +1,6 @@
 AUTOMAKE_OPTIONS     = 1.4 foreign
 MAINTAINERCLEANFILES = Makefile.in
+AM_CFLAGS            = $(CWARNFLAGS)
 AM_CPPFLAGS         = @my_includes@ -I. -I$(top_srcdir)  -I$(top_builddir)  
-DPACKAGE_LIB_DIR=\"$(libdir)\"
 # Older automakes (<1.10) do not use INCLUDES when compiling .S files
 AM_CCASFLAGS = -I$(top_builddir)
diff --git a/src/modules/filters/Makefile.am b/src/modules/filters/Makefile.am
index c85217a..7965296 100644
--- a/src/modules/filters/Makefile.am
+++ b/src/modules/filters/Makefile.am
@@ -1,6 +1,7 @@
 MAINTAINERCLEANFILES = Makefile.in
 AUTOMAKE_OPTIONS     = 1.4 foreign
 
+AM_CFLAGS            = $(CWARNFLAGS)
 AM_CPPFLAGS          = -I. \
                        -I$(top_srcdir) \
                        -I$(top_srcdir)/src/lib \
diff --git a/src/modules/loaders/Makefile.am b/src/modules/loaders/Makefile.am
index e2b892a..a6caa15 100644
--- a/src/modules/loaders/Makefile.am
+++ b/src/modules/loaders/Makefile.am
@@ -1,6 +1,7 @@
 MAINTAINERCLEANFILES = Makefile.in
 AUTOMAKE_OPTIONS     = 1.4 foreign
 
+AM_CFLAGS            = $(CWARNFLAGS)
 AM_CPPFLAGS          = -I. \
                        -I$(top_srcdir) \
                        -I$(top_srcdir)/src/lib \

-- 

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

Reply via email to