Skip to content
Browse files

Created DETECT_CLANG autoconf function, and excluded '-pthread' from …

…CFLAGS when GCC is clang
  • Loading branch information...
1 parent 1e472de commit f1285b7f4b24968b2dd6fa80612bac0847ac26ee @emcconville emcconville committed with dustin Nov 27, 2013
Showing with 34 additions and 6 deletions.
  1. +34 −6 configure.ac
View
40 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)

0 comments on commit f1285b7

Please sign in to comment.
Something went wrong with that request. Please try again.