summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2013-05-02 15:21:43 -0700
committerEmmanuele Bassi <ebassi@gnome.org>2013-05-02 15:21:43 -0700
commit570c15667b7b788493cdbb0c37f3523589c28d68 (patch)
treeb0b0a1a8341a590f7cbb5130002770f3cd446cd2
parent0bb802d5204bbb3a1fafff98de02d377bd3ddf19 (diff)
build: Enable -std=c99
So we can compile with C99 enabled; this requires checking that the version of the compiler supports the -std=c99 command line switch, which holds true for both GCC and CLang. The warnings/errors we enable through the --enable-strict-flags configure switch need to be amended so that we don't catch C99 valid constructs like declaration after statement and VLAs. [endlessm/eos-sdk#49]
-rw-r--r--configure.ac50
1 files changed, 27 insertions, 23 deletions
diff --git a/configure.ac b/configure.ac
index 8dbae59..301b78f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,8 +84,6 @@ EOS_REQUIRED_MODULES_PRIVATE="$GLIB_REQUIREMENT $GOBJECT_REQUIREMENT $GIO_REQUIR
AC_SUBST(EOS_REQUIRED_MODULES)
AC_SUBST(EOS_REQUIRED_MODULES_PRIVATE)
-AC_CACHE_SAVE
-
# Gettext package name
GETTEXT_PACKAGE=$PACKAGE
AC_SUBST(GETTEXT_PACKAGE)
@@ -94,6 +92,29 @@ AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, ["$GETTEXT_PACKAGE"],
# Detect which languages are available
AS_ALL_LINGUAS
+# Required build tools
+# --------------------
+# C compiler
+AC_PROG_CC
+# Make sure the C compiler supports per-target CFLAGS
+AM_PROG_CC_C_O
+# Library configuration tool
+PKG_PROG_PKG_CONFIG
+# Gettext
+AM_GNU_GETTEXT([external])
+AM_GNU_GETTEXT_VERSION([0.18.1])
+# Gtk-doc; 0.18 required for Markdown parsing
+GTK_DOC_CHECK([1.18], [--flavour no-tmpl])
+# GObject Introspection
+GOBJECT_INTROSPECTION_REQUIRE([1.30])
+
+AC_CACHE_SAVE
+
+# Check that the compiler supports C99, and enable it in our CFLAGS
+AS_COMPILER_FLAGS(C99_CFLAGS, "-std=c99")
+C99_CFLAGS=${C99_CFLAGS#* }
+CFLAGS="$CFLAGS $C99_CFLAGS"
+
# Configure options
# -----------------
# --enable-strict-flags: Compile with strict compiler flags. Done automatically
@@ -116,39 +137,22 @@ STRICT_COMPILER_FLAGS="$STRICT_COMPILER_FLAGS
-Werror=format
-Werror=format-security
-Werror=format-nonliteral
- -Werror=init-self
- -Werror=declaration-after-statement
- -Werror=vla"
+ -Werror=init-self"
AS_CASE([$enable_strict_flags],
[yes],
[AS_COMPILER_FLAGS([STRICT_CFLAGS], [$STRICT_COMPILER_FLAGS])],
[no],
[],
- [error],
+ [error],
[
STRICT_COMPILER_FLAGS="$STRICT_COMPILER_FLAGS -Werror"
AS_COMPILER_FLAGS([STRICT_CFLAGS], [$STRICT_COMPILER_FLAGS])
],
[AC_MSG_ERROR([Invalid option for --enable-strict-flags])])
-STRICT_CFLAGS=${STRICT_CFLAGS#* } dnl Strip spaces
+dnl Strip leading spaces
+STRICT_CFLAGS=${STRICT_CFLAGS#* }
AC_SUBST(STRICT_CFLAGS)
-# Required build tools
-# --------------------
-# C compiler
-AC_PROG_CC
-# Make sure the C compiler supports per-target CFLAGS
-AM_PROG_CC_C_O
-# Library configuration tool
-PKG_PROG_PKG_CONFIG
-# Gettext
-AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.18.1])
-# Gtk-doc; 0.18 required for Markdown parsing
-GTK_DOC_CHECK([1.18], [--flavour no-tmpl])
-# GObject Introspection
-GOBJECT_INTROSPECTION_REQUIRE([1.30])
-
# Required libraries
# ------------------
PKG_CHECK_MODULES([EOS_SDK], [