telepathy-mission-control: configure.ac: use AC_DEFINE instead of appending to CFLAGS

Simon McVittie smcv at kemper.freedesktop.org
Thu Sep 26 06:20:47 PDT 2013


Module: telepathy-mission-control
Branch: master
Commit: 55ed19e0e2a7ae96bee58ef37c79e48241959d96
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=55ed19e0e2a7ae96bee58ef37c79e48241959d96

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Jul 19 18:08:34 2013 +0100

configure.ac: use AC_DEFINE instead of appending to CFLAGS

In build systems that put CFLAGS in an environment variable rather
than a configure command-line argument (e.g. RPM, I think?), what we
put in CFLAGS will potentially take precedence, and the external
build system's chosen CFLAGS won't necessarily be used. Meanwhile,
if the build system puts CFLAGS on the make command line, it will
take precedence: in particular, debug logging could be disabled, which
is bad for debuggability. If we move to AC_DEFINE, they'll interact
properly.

There is one remaining use of CFLAGS in configure.ac, for code
coverage. RPMs and other production-quality builds shouldn't have
coverage instrumentation, so this doesn't really conflict.

Also use AS_IF instead of if/fi, while I'm touching these lines anyway:
it's better Autoconf style.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69822
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 configure.ac |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/configure.ac b/configure.ac
index fe10dd5..ef7985e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -94,24 +94,23 @@ AC_MSG_RESULT([$mc_want_twisted_tests])
 AM_CONDITIONAL([WANT_TWISTED_TESTS], test yes = "$mc_want_twisted_tests")
 
 AC_ARG_ENABLE(debug,            [  --disable-debug               compile without debug code],[enable_debug=${enableval}], enable_debug=yes )
-if test "x$enable_debug" = "xyes"; then
-	CFLAGS="$CFLAGS -DENABLE_DEBUG"
-fi
+AS_IF([test "x$enable_debug" = "xyes"],
+    [AC_DEFINE([ENABLE_DEBUG], [1], [Define to compile in debug messages])])
 
 AC_ARG_ENABLE(cast-checks,      [  --disable-cast-checks         compile with GLIB cast checks disabled],[cchecks=${enableval}],cchecks=yes)
-if test "x$cchecks" = "xno"; then
-	CFLAGS="$CFLAGS -DG_DISABLE_CAST_CHECKS"
-fi
+AS_IF([test "x$cchecks" = "xno"],
+    [AC_DEFINE([G_DISABLE_CAST_CHECKS], [1],
+        [Define to disable checked casts (not recommended)])])
 
 AC_ARG_ENABLE(asserts,      [  --disable-asserts        compile with GLIB assertions disabled],[asserts=${enableval}],asserts=yes)
-if test "x$asserts" = "xno"; then
-	CFLAGS="$CFLAGS -DG_DISABLE_ASSERTS"
-fi
+AS_IF([test "x$asserts" = "xno"],
+    [AC_DEFINE([G_DISABLE_ASSERTS], [1],
+        [Define to disable assertions (not recommended)])])
 
 AC_ARG_ENABLE(checks,       [  --disable-checks         compile with GLIB checks disabled],[checks=${enableval}],checks=yes)
-if test "x$checks" = "xno"; then
-	CFLAGS="$CFLAGS -DG_DISABLE_CHECKS"
-fi
+AS_IF([test "x$checks" = "xno"],
+    [AC_DEFINE([G_DISABLE_CHECKS], [1],
+        [Define to disable checks (not recommended)])])
 
 AC_ARG_ENABLE(coverage,       [  --enable-coverage         compile with coverage info],[enable_coverage=${enableval}],enable_coverage=no)
 if test "x$enable_coverage" = "xyes"; then



More information about the telepathy-commits mailing list