[Telepathy-commits] [telepathy-gabble/master] Use compiler.m4 (from Aranha via telepathy-glib) to control coverage/optimizations
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Jan 20 10:04:58 PST 2009
---
configure.ac | 12 ++------
m4/Makefile.am | 3 +-
m4/compiler.m4 | 67 +++++++++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 2 +-
tests/Makefile.am | 2 +-
tests/twisted/Makefile.am | 2 +-
6 files changed, 75 insertions(+), 13 deletions(-)
create mode 100644 m4/compiler.m4
diff --git a/configure.ac b/configure.ac
index 418dedd..bdffcee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -33,6 +33,9 @@ AC_PROG_CC_STDC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
+COMPILER_OPTIMISATIONS
+COMPILER_COVERAGE
+
dnl decide error flags
AS_COMPILER_FLAG(-Wall, ERROR_CFLAGS="-Wall", ERROR_CFLAGS="")
AS_COMPILER_FLAG(-Werror, werror=yes, werror=no)
@@ -77,10 +80,6 @@ AC_ARG_ENABLE(handle-leak-debug,
AC_HELP_STRING([--enable-handle-leak-debug],[compile with -rdynamic so telepathy-glib handle leak debugging code will work]),
enable_handle_leak_debug=$enableval, enable_handle_leak_debug=no )
-AC_ARG_ENABLE(coverage,
- AC_HELP_STRING([--enable-coverage],[compile with coverage info]),
- enable_coverage=$enableval, enable_coverage=no )
-
ifelse(gabble_nano_version, 0,
[ # Gabble is version x.y.z - disable coding style checks by default
AC_ARG_ENABLE(coding-style-checks,
@@ -104,12 +103,7 @@ if test x$enable_handle_leak_debug = xyes; then
HANDLE_LEAK_DEBUG_CFLAGS="-rdynamic"
fi
-if test x$enable_coverage = xyes; then
- COVERAGE_CFLAGS="-g -fprofile-arcs -ftest-coverage"
-fi
-
AC_SUBST(HANDLE_LEAK_DEBUG_CFLAGS)
-AC_SUBST(COVERAGE_CFLAGS)
AC_SUBST([ENABLE_CODING_STYLE_CHECKS])
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 4557e85..80f350b 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1,2 +1,3 @@
EXTRA_DIST = \
- as-compiler-flag.m4
+ as-compiler-flag.m4 \
+ compiler.m4
diff --git a/m4/compiler.m4 b/m4/compiler.m4
new file mode 100644
index 0000000..5aff5d8
--- /dev/null
+++ b/m4/compiler.m4
@@ -0,0 +1,67 @@
+# compiler.m4 - autoconf macros for compiler settings
+#
+# Copyright © 2005 Scott James Remnant <scott at netsplit.com>.
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+# ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+
+# COMPILER_WARNINGS
+# ----------------------
+# Add configure option to enable additional compiler warnings and treat
+# them as errors.
+AC_DEFUN([COMPILER_WARNINGS],
+[AC_ARG_ENABLE(compiler-warnings,
+ AS_HELP_STRING([--enable-compiler-warnings],
+ [Enable additional compiler warnings]),
+[if test "x$enable_compiler_warnings" = "xyes"; then
+ if test "x$GCC" = "xyes"; then
+ CFLAGS="-Wall -Werror $CFLAGS"
+ fi
+ if test "x$GXX" = "xyes"; then
+ CXXFLAGS="-Wall -Werror $CXXFLAGS"
+ fi
+fi])dnl
+])# COMPILER_WARNINGS
+
+# COMPILER_OPTIMISATIONS
+# ---------------------------
+# Add configure option to disable optimisations.
+AC_DEFUN([COMPILER_OPTIMISATIONS],
+[AC_ARG_ENABLE(compiler-optimisations,
+ AS_HELP_STRING([--disable-compiler-optimisations],
+ [Disable compiler optimisations]),
+[if test "x$enable_compiler_optimisations" = "xno"; then
+ [CFLAGS=`echo "$CFLAGS" | sed -e "s/ -O[1-9]*\b/ -O0/g"`]
+fi])dnl
+])# COMPILER_OPTIMISATIONS
+
+# COMPILER_COVERAGE
+# ----------------------
+# Add configure option to enable coverage data.
+AC_DEFUN([COMPILER_COVERAGE],
+[AC_ARG_ENABLE(compiler-coverage,
+ AS_HELP_STRING([--enable-compiler-coverage],
+ [Enable generation of coverage data]),
+[if test "x$enable_compiler_coverage" = "xyes"; then
+ if test "x$GCC" = "xyes"; then
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ fi
+fi])dnl
+])# COMPILER_COVERAGE
diff --git a/src/Makefile.am b/src/Makefile.am
index d024e98..619d9ee 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -154,7 +154,7 @@ noinst_LTLIBRARIES = libgabble-convenience.la
AM_CFLAGS = $(ERROR_CFLAGS) -I$(top_srcdir) -I$(top_builddir) \
@DBUS_CFLAGS@ @GLIB_CFLAGS@ @LOUDMOUTH_CFLAGS@ \
- @HANDLE_LEAK_DEBUG_CFLAGS@ @COVERAGE_CFLAGS@ @TP_GLIB_CFLAGS@ \
+ @HANDLE_LEAK_DEBUG_CFLAGS@ @TP_GLIB_CFLAGS@ \
-I $(top_srcdir)/lib -I $(top_builddir)/lib
ALL_LIBS = @DBUS_LIBS@ @GLIB_LIBS@ @LOUDMOUTH_LIBS@ @TP_GLIB_LIBS@
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9b634b9..0a3cc51 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -42,7 +42,7 @@ test_dtube_unique_names_LDADD = \
$(ALL_LIBS)
AM_CFLAGS = $(ERROR_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@ @LOUDMOUTH_CFLAGS@ \
- @COVERAGE_CFLAGS@ @TP_GLIB_CFLAGS@ \
+ @TP_GLIB_CFLAGS@ \
-I $(top_srcdir) -I $(top_builddir)
ALL_LIBS = @DBUS_LIBS@ @GLIB_LIBS@ @LOUDMOUTH_LIBS@ @TP_GLIB_LIBS@
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 2f6375e..9538647 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -136,7 +136,7 @@ telepathy_gabble_debug_LDADD = \
$(ALL_LIBS)
AM_CFLAGS = $(ERROR_CFLAGS) @DBUS_CFLAGS@ @GLIB_CFLAGS@ @LOUDMOUTH_CFLAGS@ \
- @COVERAGE_CFLAGS@ @TP_GLIB_CFLAGS@ \
+ @TP_GLIB_CFLAGS@ \
-I $(top_srcdir)/src -I $(top_builddir)/src
ALL_LIBS = @DBUS_LIBS@ @GLIB_LIBS@ @LOUDMOUTH_LIBS@ @TP_GLIB_LIBS@
--
1.5.6.5
More information about the Telepathy-commits
mailing list