[Telepathy-commits] [telepathy-qt4/master] Rewrite the (wrongly) modified AS_COMPILER_FLAG as TP_CXX_COMPILER_FLAG, using AC_COMPILE_IFELSE
Olli Salli
olli.salli at collabora.co.uk
Mon Sep 22 10:15:26 PDT 2008
---
configure.ac | 12 ++++++------
m4/tp-cxx-compiler-flag.m4 | 32 ++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+), 6 deletions(-)
create mode 100644 m4/tp-cxx-compiler-flag.m4
diff --git a/configure.ac b/configure.ac
index d61097f..03b87b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,18 +68,18 @@ COMPILER_COVERAGE
LINKER_OPTIMISATIONS
dnl decide error flags
-AS_COMPILER_FLAG(-Wall, ERROR_CXXFLAGS="-Wall", ERROR_CXXFLAGS="")
-AS_COMPILER_FLAG(-Werror, werror=yes, werror=no)
+TP_CXX_COMPILER_FLAG(-Wall, ERROR_CXXFLAGS="-Wall", ERROR_CXXFLAGS="")
+TP_CXX_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, :)
-AS_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
-AS_COMPILER_FLAG(-Wno-missing-field-initializers,
+TP_CXX_COMPILER_FLAG(-Wextra, wextra=yes, wextra=no)
+TP_CXX_COMPILER_FLAG(-Wno-missing-field-initializers,
wno_missing_field_initializers=yes,
wno_missing_field_initializers=no)
-AS_COMPILER_FLAG(-Wno-unused-parameter,
+TP_CXX_COMPILER_FLAG(-Wno-unused-parameter,
wno_unused_parameter=yes,
wno_unused_parameter=no)
@@ -97,7 +97,7 @@ ifelse(tp_qt4_nano_version, 0,
fi
])
-AS_COMPILER_FLAG(-Wmissing-declarations, ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Wmissing-declarations")
+TP_CXX_COMPILER_FLAG(-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/tp-cxx-compiler-flag.m4 b/m4/tp-cxx-compiler-flag.m4
new file mode 100644
index 0000000..4e860fe
--- /dev/null
+++ b/m4/tp-cxx-compiler-flag.m4
@@ -0,0 +1,32 @@
+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