aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@medozas.de>2011-11-21 19:47:26 +0100
committerKay Sievers <kay.sievers@vrfy.org>2011-12-21 01:37:03 +0100
commitbb75eeb44a30b8831e983ab3f485ea6f37dc88e3 (patch)
tree28242666171c7fc7e8afda0ae41abb30ad8b1382
parent0d40c94a5604334a67ed37fbbe006aaa98c912b0 (diff)
downloadlibabc-bb75eeb44a30b8831e983ab3f485ea6f37dc88e3.tar.gz
build: define project CFLAGS inside main autotools configs
Good projects should always use these flag combinations -- not just when autogen.sh is called, but also when ./configure is run.
-rw-r--r--Makefile.am2
-rwxr-xr-xautogen.sh9
-rw-r--r--configure.ac8
3 files changed, 10 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index cabd857..79be23f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,7 +9,7 @@ AM_CPPFLAGS = \
-DSYSCONFDIR=\""$(sysconfdir)"\" \
-DLIBEXECDIR=\""$(libexecdir)"\"
-AM_CFLAGS = \
+AM_CFLAGS = ${my_CFLAGS} \
-fvisibility=hidden \
-ffunction-sections \
-fdata-sections
diff --git a/autogen.sh b/autogen.sh
index 6541826..d8ec7ed 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -2,13 +2,6 @@
autoreconf --install --symlink
-MYCFLAGS="-g -Wall \
--Wmissing-declarations -Wmissing-prototypes \
--Wnested-externs -Wpointer-arith \
--Wpointer-arith -Wsign-compare -Wchar-subscripts \
--Wstrict-prototypes -Wshadow \
--Wformat-security -Wtype-limits"
-
libdir() {
echo $(cd $1/$(gcc -print-multi-os-directory); pwd)
}
@@ -17,4 +10,4 @@ args="--prefix=/usr \
--sysconfdir=/etc \
--libdir=$(libdir /usr/lib)"
-exec ./configure $args CFLAGS="${MYCFLAGS} ${CFLAGS}" "$@"
+exec ./configure $args "$@"
diff --git a/configure.ac b/configure.ac
index b860301..24a6805 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,14 @@ AS_IF([test "x$enable_debug" = "xyes"], [
AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.])
])
+my_CFLAGS="-Wall \
+-Wmissing-declarations -Wmissing-prototypes \
+-Wnested-externs -Wpointer-arith \
+-Wpointer-arith -Wsign-compare -Wchar-subscripts \
+-Wstrict-prototypes -Wshadow \
+-Wformat-security -Wtype-limits"
+AC_SUBST([my_CFLAGS])
+
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_FILES([
Makefile