summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric McConville <erichasemail@gmail.com>2013-11-27 15:15:14 -0600
committerDustin Sallings <dustin@spy.net>2013-12-15 23:01:53 -0800
commitf1285b7f4b24968b2dd6fa80612bac0847ac26ee (patch)
treedf229e35c4090d955d7442e49e0813c499f93784
parent1e472debb3a352e7e204204a66b23e344d2dc11b (diff)
downloadmemcached-engine-pu.tar.gz
Created DETECT_CLANG autoconf function, and excluded '-pthread' from CFLAGS when GCC is clangengine-pu
-rw-r--r--configure.ac40
1 files changed, 34 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 4bedb4d..1f8e485 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,6 +43,27 @@ AC_DEFUN([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
@@ -56,7 +77,8 @@ AC_DEFUN([DETECT_SUNCC],
])
AS_IF(test "x$GCC" = "xyes",
- DETECT_ICC([CFLAGS="-pthread $CFLAGS"], [CFLAGS="-fvisibility=hidden -pthread $CFLAGS"]),
+ DETECT_ICC([CFLAGS="-pthread $CFLAGS"],
+ DETECT_CLANG([], [CFLAGS="-fvisibility=hidden -pthread $CFLAGS"])),
ICC=no
DETECT_SUNCC([CFLAGS="-xldscope=hidden -mt -xc99=all $CFLAGS"], []))
@@ -85,6 +107,7 @@ AS_IF([test "x$enable_sasl_pwdb" = "xyes"],
[enable_sasl=yes ])
+
dnl **********************************************************************
dnl DETECT_SASL_CB_GETCONF
dnl
@@ -206,11 +229,8 @@ AC_SUBST(PROFILER_LDFLAGS)
AC_ARG_ENABLE(coverage,
[AS_HELP_STRING([--enable-coverage],[Disable code coverage])])
-if test "x$enable_coverage" = "xyes"; then
- if test "$ICC" = "yes"
- then
- AC_MSG_WARN([icc doesn't support code coverage checking])
- elif test "$GCC" = "yes"
+if test "x$enable_coverage" != "xno"; then
+ if test "$GCC" = "yes" -a "$ICC" != "yes" -a "$CLANG" != "yes"
then
AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
if test "x$PROFILER" != "xno"; then
@@ -230,6 +250,14 @@ if test "x$enable_coverage" = "xyes"; 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)