summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-11-12 15:00:25 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-11-12 17:37:11 +0000
commitba8a957bfaffdddd10782ccb06d80d54e5805fcd (patch)
treeee9e4e2670c9f421281824c5192f9fb581312635 /configure.ac
parent51af0ef35b5a7ed0d1468f11cca73ba0158e8be4 (diff)
Generalize COM_GCC_IS_CLANG -> COM_IS_CLANG
...in anticipation of building with clang-cl.exe on Windows Change-Id: I1d723c9d3b5ca8a2bc6b27ef0189a7b053581398 Reviewed-on: https://gerrit.libreoffice.org/19928 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac116
1 files changed, 55 insertions, 61 deletions
diff --git a/configure.ac b/configure.ac
index 408abd52f6ff..5737d68d3dac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3267,63 +3267,6 @@ else
fi
AC_SUBST(CROSS_COMPILING)
-dnl ===================================================================
-dnl Is GCC actually Clang?
-dnl ===================================================================
-
-COM_GCC_IS_CLANG=
-if test "$GCC" = "yes"; then
- AC_MSG_CHECKING([whether GCC is actually Clang])
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
- #ifndef __clang__
- you lose
- #endif
- int foo=42;
- ]])],
- [AC_MSG_RESULT([yes])
- COM_GCC_IS_CLANG=TRUE],
- [AC_MSG_RESULT([no])])
-
- if test "$COM_GCC_IS_CLANG" = TRUE; then
- AC_MSG_CHECKING([the Clang version])
- clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P /dev/stdin`
- CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P /dev/stdin`
- CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
- AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
- AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
- fi
-fi
-AC_SUBST(COM_GCC_IS_CLANG)
-
-if test "$CCACHE" != "" -a "$COM_GCC_IS_CLANG" = TRUE; then
- if test -z "$CCACHE_CPP2"; then
- AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
- add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
- fi
-fi
-
-dnl ===================================================================
-dnl Test the gcc version
-dnl ===================================================================
-if test "$GCC" = "yes" -a -z "$COM_GCC_IS_CLANG"; then
- AC_MSG_CHECKING([the GCC version])
- _gcc_version=`$CC -dumpversion`
- GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
-
- AC_MSG_RESULT([gcc $_gcc_version])
-
- if test "$GCC_VERSION" -lt 0407; then
- AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
- fi
-else
- # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
- # GCC version should generally be checked only when handling GCC-specific bugs, for testing
- # things like features configure checks should be used, otherwise they may e.g. fail with Clang
- # (which reports itself as GCC 4.2.1).
- GCC_VERSION=
-fi
-AC_SUBST(GCC_VERSION)
-
# ===================================================================
# check various GCC options that Clang does not support now but maybe
# will somewhen in the future, check them even for GCC, so that the
@@ -3856,6 +3799,35 @@ fi
UNOWINREG_DLL="185d60944ea767075d27247c3162b3bc-unowinreg.dll"
AC_SUBST(UNOWINREG_DLL)
+COM_IS_CLANG=
+AC_MSG_CHECKING([whether the compiler is actually Clang])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ #ifndef __clang__
+ you lose
+ #endif
+ int foo=42;
+ ]])],
+ [AC_MSG_RESULT([yes])
+ COM_IS_CLANG=TRUE],
+ [AC_MSG_RESULT([no])])
+
+if test "$COM_IS_CLANG" = TRUE; then
+ AC_MSG_CHECKING([the Clang version])
+ clang_version=`echo __clang_major__.__clang_minor__.__clang_patchlevel__ | $CC -E -P /dev/stdin`
+ CLANG_FULL_VERSION=`echo __clang_version__ | $CC -E -P /dev/stdin`
+ CLANGVER=`echo $clang_version | $AWK -F. '{ print \$1*10000+\$2*100+\$3 }'`
+ AC_MSG_RESULT([Clang $CLANG_FULL_VERSION, $CLANGVER])
+ AC_DEFINE_UNQUOTED(CLANG_FULL_VERSION,$CLANG_FULL_VERSION)
+fi
+AC_SUBST(COM_IS_CLANG)
+
+if test "$CCACHE" != "" -a "$COM_IS_CLANG" = TRUE; then
+ if test -z "$CCACHE_CPP2"; then
+ AC_MSG_WARN([Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings.])
+ add_warning "Using ccache with Clang without CCACHE_CPP2 set causes spurious warnings."
+ fi
+fi
+
#
# prefix C with ccache if needed
#
@@ -3878,6 +3850,28 @@ if test "$CCACHE" != ""; then
AC_LANG_POP([C])
fi
+dnl ===================================================================
+dnl Test the gcc version
+dnl ===================================================================
+if test "$GCC" = "yes" -a -z "$COM_IS_CLANG"; then
+ AC_MSG_CHECKING([the GCC version])
+ _gcc_version=`$CC -dumpversion`
+ GCC_VERSION=`echo $_gcc_version | $AWK -F. '{ print \$1*100+\$2 }'`
+
+ AC_MSG_RESULT([gcc $_gcc_version])
+
+ if test "$GCC_VERSION" -lt 0407; then
+ AC_MSG_ERROR([GCC $_gcc_version is too old, must be at least GCC 4.7.0])
+ fi
+else
+ # Explicitly force GCC_VERSION to be empty, even for Clang, to check incorrect uses.
+ # GCC version should generally be checked only when handling GCC-specific bugs, for testing
+ # things like features configure checks should be used, otherwise they may e.g. fail with Clang
+ # (which reports itself as GCC 4.2.1).
+ GCC_VERSION=
+fi
+AC_SUBST(GCC_VERSION)
+
dnl Set the ENABLE_DBGUTIL variable
dnl ===================================================================
AC_MSG_CHECKING([whether to build with additional debug utilities])
@@ -5931,7 +5925,7 @@ if test "$GCC" = "yes"; then
HAVE_THREADSAFE_STATICS=TRUE
fi
elif test "$_os" != Android; then
- if test "$COM_GCC_IS_CLANG" = TRUE; then
+ if test "$COM_IS_CLANG" = TRUE; then
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <list>
@@ -6469,7 +6463,7 @@ _ACEOF
dnl known to not work with -z defs (unsetting which makes the test
dnl moot, though):
my_linkflagsnoundefs=$LINKFLAGSNOUNDEFS
- if test "$COM_GCC_IS_CLANG" = TRUE; then
+ if test "$COM_IS_CLANG" = TRUE; then
for i in $CXX; do
case $i in
-fsanitize=*)
@@ -6595,7 +6589,7 @@ dnl ===================================================================
COMPILER_PLUGINS=
# currently only Clang
-if test "$COM_GCC_IS_CLANG" = "TRUE"; then
+if test "$COM_IS_CLANG" = "TRUE"; then
if test -n "$enable_compiler_plugins"; then
compiler_plugins="$enable_compiler_plugins"
elif test -n "$ENABLE_DBGUTIL"; then
@@ -8231,7 +8225,7 @@ if test "$ENABLE_MARIADBC" = "TRUE"; then
fi
AC_MSG_CHECKING([for MariaDB Client library])
MARIADB_CFLAGS=`$MARIADBCONFIG --cflags`
- if test "$COM_GCC_IS_CLANG" = TRUE; then
+ if test "$COM_IS_CLANG" = TRUE; then
MARIADB_CFLAGS=$(printf '%s' "$MARIADB_CFLAGS" | sed -e s/-fstack-protector-strong//)
fi
MARIADB_LIBS=`$MARIADBCONFIG --libs_r`