[Telepathy-commits] [telepathy-qt4/master] Replace TP_CXX_COMPILER_FLAG with a TP_COMPILER_FLAG that handles both C and C++
Simon McVittie
simon.mcvittie at collabora.co.uk
Thu Jan 8 07:04:54 PST 2009
---
configure.ac | 8 ++++----
m4/Makefile.am | 2 +-
m4/tp-compiler-flag.m4 | 36 ++++++++++++++++++++++++++++++++++++
m4/tp-cxx-compiler-flag.m4 | 32 --------------------------------
4 files changed, 41 insertions(+), 37 deletions(-)
create mode 100644 m4/tp-compiler-flag.m4
delete mode 100644 m4/tp-cxx-compiler-flag.m4
diff --git a/configure.ac b/configure.ac
index a377edf..654fdd5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,14 +69,14 @@ LINKER_OPTIMISATIONS
LINKER_VERSION_SCRIPT
dnl decide error flags
-TP_CXX_COMPILER_FLAG(-Wall, ERROR_CXXFLAGS="-Wall", ERROR_CXXFLAGS="")
-TP_CXX_COMPILER_FLAG(-Werror, werror=yes, werror=no)
+TP_COMPILER_FLAG(-Wall, ERROR_CXXFLAGS="-Wall", ERROR_CXXFLAGS="")
+TP_COMPILER_FLAG(-Werror, werror=yes, werror=no)
AC_ARG_ENABLE(Werror,
AC_HELP_STRING([--disable-Werror],[compile without -Werror (normally enabled in development builds)]),
werror=$enableval, :)
-TP_CXX_COMPILER_FLAG([$ERROR_CXXFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter], wextra=yes, wextra=no)
+TP_COMPILER_FLAG([$ERROR_CXXFLAGS -Wextra -Wno-missing-field-initializers -Wno-unused-parameter], wextra=yes, wextra=no)
ifelse(tp_qt4_nano_version, 0,
[ official_release=yes ],
@@ -87,7 +87,7 @@ ifelse(tp_qt4_nano_version, 0,
fi
])
-TP_CXX_COMPILER_FLAG([$ERROR_CXXFLAGS -Wmissing-declarations], ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wmissing-declarations")
+TP_COMPILER_FLAG([$ERROR_CXXFLAGS -Wmissing-declarations], ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wmissing-declarations")
AC_SUBST(ERROR_CXXFLAGS)
AM_CONDITIONAL([OFFICIAL_RELEASE], [test "x$official_release" = xyes])
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 8e3dbfc..ba3c330 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -1,4 +1,4 @@
EXTRA_DIST = \
-tp-cxx-compiler-flag.m4 \
+tp-compiler-flag.m4 \
compiler.m4 \
linker.m4
diff --git a/m4/tp-compiler-flag.m4 b/m4/tp-compiler-flag.m4
new file mode 100644
index 0000000..fc05e9e
--- /dev/null
+++ b/m4/tp-compiler-flag.m4
@@ -0,0 +1,36 @@
+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 at schleef.org>
+dnl $Id: as-compiler-flag.m4,v 1.1 2005/06/18 18:02:46 burgerman Exp $
+
+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([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
+ true
+ else
+ $3
+ true
+ fi
+ AC_MSG_RESULT([$flag_ok])
+])
diff --git a/m4/tp-cxx-compiler-flag.m4 b/m4/tp-cxx-compiler-flag.m4
deleted file mode 100644
index 4e860fe..0000000
--- a/m4/tp-cxx-compiler-flag.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-dnl tp-cxx-compiler-flag.m4
-dnl
-dnl Autoconf macro for determining if the C++ compiler supports a given set of
-dnl command-line flags. It requires AC_LANG([C++]). Adapted from an autostars
-dnl (http://autostars.sourceforge.net) macro called AS_COMPILER_FLAG.
-dnl
-dnl TP_CXX_COMPILER_FLAG(CXXFLAGS, SUPPORTS, [DOESNT-SUPPORT])
-dnl Tries to compile with the given CXXFLAGS.
-dnl Runs SUPPORTS if the compiler can compile with the flags,
-dnl and DOESNT-SUPPORT otherwise.
-
-AC_DEFUN([TP_CXX_COMPILER_FLAG],
-[
- AC_LANG_ASSERT([C++])
- AC_MSG_CHECKING([to see if the C++ compiler understands $1])
-
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS $1"
-
- AC_COMPILE_IFELSE([ ], [flag_ok=yes], [flag_ok=no])
- CXXFLAGS="$save_CXXFLAGS"
-
- if test "X$flag_ok" = Xyes ; then
- $2
- true
- else
- $3
- true
- fi
- AC_MSG_RESULT([$flag_ok])
-])
-
--
1.5.6.5
More information about the Telepathy-commits
mailing list