summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2009-01-08 14:49:57 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2009-01-08 14:49:57 +0000
commita1a86e4c0e311987a934b0e2f7e18561f6b8ab73 (patch)
treeff0cdef2bc49c980476033f27c4d956c3534d00f /m4
parent95a1320d62dcd4c924a1ea3e3bd954b518f68b72 (diff)
downloadtelepathy-glib-a1a86e4c0e311987a934b0e2f7e18561f6b8ab73.tar.gz
Fork a version of AS_COMPILER_FLAG that supports C++ as well as C
This is so we can share TP_COMPILER_WARNINGS between telepathy-glib and telepathy-qt4.
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am2
-rw-r--r--m4/tp-compiler-flag.m4 (renamed from m4/as-compiler-flag.m4)21
-rw-r--r--m4/tp-compiler-warnings.m410
3 files changed, 18 insertions, 15 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
index e2267e0da..e04d0cb39 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1,6 +1,6 @@
EXTRA_DIST = \
-as-compiler-flag.m4 \
compiler.m4 \
gtk-doc.m4 \
linker.m4 \
+tp-compiler-flag.m4 \
tp-compiler-warnings.m4
diff --git a/m4/as-compiler-flag.m4 b/m4/tp-compiler-flag.m4
index 605708a5a..fc05e9e17 100644
--- a/m4/as-compiler-flag.m4
+++ b/m4/tp-compiler-flag.m4
@@ -1,25 +1,29 @@
-dnl as-compiler-flag.m4 0.1.0
+dnl A version of AS_COMPILER_FLAG that supports both C and C++.
+dnl Based on:
+dnl as-compiler-flag.m4 0.1.0
dnl autostars m4 macro for detection of compiler flags
-
dnl David Schleef <ds@schleef.org>
-
dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
-dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
-dnl Tries to compile with the given CFLAGS.
-dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags,
-dnl and ACTION-IF-NOT-ACCEPTED otherwise.
+dnl TP_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED])
+dnl Tries to compile with the given CFLAGS and CXXFLAGS.
+dnl
+dnl Runs ACTION-IF-ACCEPTED if the compiler for the currently selected
+dnl AC_LANG can compile with the flags, and ACTION-IF-NOT-ACCEPTED otherwise.
-AC_DEFUN([AS_COMPILER_FLAG],
+AC_DEFUN([TP_COMPILER_FLAG],
[
AC_MSG_CHECKING([to see if compiler understands $1])
save_CFLAGS="$CFLAGS"
+ save_CXXFLAGS="$CXXFLAGS"
CFLAGS="$CFLAGS $1"
+ CXXFLAGS="$CXXFLAGS $1"
AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no])
CFLAGS="$save_CFLAGS"
+ CXXFLAGS="$save_CXXFLAGS"
if test "X$flag_ok" = Xyes ; then
$2
@@ -30,4 +34,3 @@ AC_DEFUN([AS_COMPILER_FLAG],
fi
AC_MSG_RESULT([$flag_ok])
])
-
diff --git a/m4/tp-compiler-warnings.m4 b/m4/tp-compiler-warnings.m4
index dbc4ebbe2..fab5dc898 100644
--- a/m4/tp-compiler-warnings.m4
+++ b/m4/tp-compiler-warnings.m4
@@ -9,20 +9,20 @@ AC_DEFUN([TP_COMPILER_WARNINGS],
[
AC_REQUIRE([AC_ARG_ENABLE])dnl
AC_REQUIRE([AC_HELP_STRING])dnl
- AC_REQUIRE([AS_COMPILER_FLAG])dnl
+ AC_REQUIRE([TP_COMPILER_FLAG])dnl
tp_warnings=""
for tp_flag in $3; do
- AS_COMPILER_FLAG([-W$tp_flag], [tp_warnings="$tp_warnings -W$tp_flag"])
+ TP_COMPILER_FLAG([-W$tp_flag], [tp_warnings="$tp_warnings -W$tp_flag"])
done
tp_error_flags="-Werror"
- AS_COMPILER_FLAG([-Werror], [tp_werror=yes], [tp_werror=no])
+ TP_COMPILER_FLAG([-Werror], [tp_werror=yes], [tp_werror=no])
for tp_flag in $4; do
- AS_COMPILER_FLAG([-Wno-$tp_flag],
+ TP_COMPILER_FLAG([-Wno-$tp_flag],
[tp_warnings="$tp_warnings -Wno-$tp_flag"])
- AS_COMPILER_FLAG([-Wno-error=$tp_flag],
+ TP_COMPILER_FLAG([-Wno-error=$tp_flag],
[tp_error_flags="$tp_error_flags -Wno-error=$tp_flag"], [tp_werror=no])
done