aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-11-19 11:06:43 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-01-30 11:59:14 +0100
commit1c078531a017358241a35475fb24f2bd65d501db (patch)
treea2dd47febbed8353ca3917f396f905a342fa19dc /configure.ac
parent4bfd955e64af56b47d398a857be4e8e1b16ce260 (diff)
build: use AX_IS_RELEASE() and AX_COMPILER_FLAGS()
The autoconf macros AX_COMPILER_FLAGS_{CFLAGS|GIR|LDFLAGS} test for compiler and linker support of various flags, and add the flags to the generated output. If the command-line option '--enable-compile-warnings' is specified to 'configure', a number of additional warning options is also added to the output. This is the default. This update requires the presence of the GNU autoconf-archive in the system.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac32
1 files changed, 30 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 5e56dfd2..57495032 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,33 @@ LT_PREREQ([2.2])
LT_INIT([disable-static])
dnl-----------------------------------------------------------------------------
+dnl Compiler warnings
+dnl
+
+dnl Make sure autoconf-archive is available
+m4_pattern_forbid([^AX_(COMPILER_FLAGS|COMPILER_FLAGS_(CFLAGS|GIR|LDFLAGS))\b],
+ [Unexpanded AX_ macro found. Please install GNU autoconf-archive])
+
+dnl Detect git or release builds
+AX_IS_RELEASE([git-directory])
+
+dnl Function type cast disabled: used throughout the code especially to
+dnl cast GAsyncReadyCallbacks with the real object type instead of GObject
+DISABLED_WARNINGS="${DISABLED_WARNINGS} -Wno-cast-function-type"
+
+dnl All message protocol structs are packed, never complain about it
+DISABLED_WARNINGS="${DISABLED_WARNINGS} -Wno-packed"
+
+dnl Setup compiler checks
+AX_COMPILER_FLAGS()
+AX_COMPILER_FLAGS_CFLAGS(,,,[${DISABLED_WARNINGS}])
+
+dnl Specify gnu89 mode
+if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -std=gnu89"
+fi
+
+dnl-----------------------------------------------------------------------------
dnl Version definitions
dnl
@@ -384,8 +411,6 @@ case $with_qmi in
;;
esac
-NM_COMPILER_WARNINGS
-
dnl-----------------------------------------------------------------------------
dnl Distribution version string
dnl
@@ -534,7 +559,10 @@ echo "
compiler: ${CC}
cflags: ${CFLAGS}
ldflags: ${LDFLAGS}
+ warn cflags: ${WARN_CFLAGS}
+ warn ldflags: ${WARN_LDFLAGS}
maintainer mode: ${USE_MAINTAINER_MODE}
+ release: ${ax_is_release}
System paths:
prefix: ${prefix}