summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorEric McConville <erichasemail@gmail.com>2013-11-27 15:15:14 -0600
committerdormando <dormando@rydia.net>2013-12-09 01:49:06 -0800
commit145bcfd09a3fd8ba20543dd497728c29fb613e38 (patch)
treecce63cf250bb3827c81270e43161d3986d1c2812 /configure.ac
parent4fabbe31840dd61a9de19fbb0283d49e5c497d2f (diff)
downloadmemcached-145bcfd09a3fd8ba20543dd497728c29fb613e38.tar.gz
Created DETECT_CLANG autoconf function, and excluded '-pthread' from CFLAGS when GCC is clang1.4.16
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac36
1 files changed, 34 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 0e1cea7..f2639d6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,27 @@ AC_DEFUN([DETECT_ICC],
DETECT_ICC([], [])
dnl **********************************************************************
+dnl DETECT_CLANG ([ACTION-IF-YES], [ACTION-IF-NO])
+dnl
+dnl check if compiler is clang, and if so run the ACTION-IF-YES sets the
+dnl $CLANG variable to "yes" or "no"
+dnl **********************************************************************
+AC_DEFUN([DETECT_CLANG],
+[
+ AC_MSG_CHECKING([for clang in use])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [[
+ #ifndef __clang__
+ not clang
+ #endif
+ ]])],
+ [CLANG=yes], [CLANG=no])
+ AC_MSG_RESULT([$CLANG])
+ AS_IF([test "$CLANG" = "yes"],[$1],[$2])
+])
+DETECT_CLANG([],[])
+
+dnl **********************************************************************
dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
dnl
dnl check if this is the Sun Studio compiler, and if so run the ACTION-IF-YES
@@ -50,7 +71,9 @@ AC_DEFUN([DETECT_SUNCC],
DETECT_SUNCC([CFLAGS="-mt $CFLAGS"], [])
AS_IF([test "$ICC" = "yes" -o "$GCC" = "yes"],
- [CFLAGS="$CFLAGS -pthread"])
+[
+ AS_IF(test "$CLANG" = "no",[CFLAGS="$CFLAGS -pthread"])
+])
if test "$ICC" = "no"; then
AC_PROG_CC_C99
@@ -69,6 +92,7 @@ AS_IF([test "x$enable_sasl_pwdb" = "xyes"],
[enable_sasl=yes ])
+
dnl **********************************************************************
dnl DETECT_SASL_CB_GETCONF
dnl
@@ -142,7 +166,7 @@ AC_ARG_ENABLE(coverage,
[AS_HELP_STRING([--disable-coverage],[Disable code coverage])])
if test "x$enable_coverage" != "xno"; then
- if test "$GCC" = "yes" -a "$ICC" != "yes"
+ if test "$GCC" = "yes" -a "$ICC" != "yes" -a "$CLANG" != "yes"
then
CFLAGS="$CFLAGS -pthread"
AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
@@ -163,6 +187,14 @@ if test "x$enable_coverage" != "xno"; then
if test "x$PROFILER" != "xno"; then
PROFILER_FLAGS=-xprofile=tcov
fi
+ elif test "x$CLANG" != "xno"
+ then
+ AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
+ if test "x$PROFILER" != "xno"
+ then
+ PROFILER_FLAGS="-fprofile-arcs -ftest-coverage"
+ PROFILER_LDFLAGS=
+ fi
fi
fi
AC_SUBST(PROFILER_FLAGS)