summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2013-07-02 06:57:19 +0200
committerKim Woelders <kim@woelders.dk>2013-07-03 15:07:51 +0200
commit6e41fe2e1ace8298e2bb9116f30206594b7c064e (patch)
tree2bc8eb5af7c0dbbccee5abc5ad0bbf16d7b70ad1
parent41dc2bb98bd99fbf82add85cf6e5b7100aa65693 (diff)
downloadimlib2-6e41fe2e1ace8298e2bb9116f30206594b7c064e.tar.gz
Set warning options when using gcc.
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am2
-rwxr-xr-xautogen.sh2
-rw-r--r--configure.ac4
-rw-r--r--m4/ac_warnflags.m431
-rw-r--r--src/lib/Makefile.am1
-rw-r--r--src/modules/filters/Makefile.am1
-rw-r--r--src/modules/loaders/Makefile.am1
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], [enlightenment-devel@lists.sourceforge.net])
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 \