summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/configure.ac
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-09-04 06:02:25 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-09-04 06:02:25 +0000
commit763f84a6dace6af3d8637d12dd9cd2f6f69b46ab (patch)
tree75ac4ce391c59a62f23cbd02ffae54e3134376cc /sca-cpp/trunk/configure.ac
parentad5eccea058713a2816ca95f7f4392fe0ab03fb0 (diff)
Build with Clang/LLVM when available.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1164964 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/configure.ac')
-rw-r--r--sca-cpp/trunk/configure.ac39
1 files changed, 27 insertions, 12 deletions
diff --git a/sca-cpp/trunk/configure.ac b/sca-cpp/trunk/configure.ac
index eeba8178b1..d0f5a29a9e 100644
--- a/sca-cpp/trunk/configure.ac
+++ b/sca-cpp/trunk/configure.ac
@@ -27,17 +27,18 @@ AC_PREFIX_DEFAULT(/usr/local/tuscany/sca)
# Check for required programs.
AC_MSG_NOTICE([checking for programs])
-AC_MSG_CHECKING([for gcc-4.5])
-if test -x "/usr/bin/g++-4.5"; then
- # Use GCC 4.5 if available
- CXX=/usr/bin/g++-4.5
- CPP=/usr/bin/cpp-4.5
- CC=/usr/bin/gcc-4.5
- AC_MSG_RESULT(/usr/bin/gcc-4.5)
- AM_CONDITIONAL([WANT_GCC45], true)
- AC_DEFINE([WANT_GCC45], 1, [compile with gcc-4.5])
-else
- AM_CONDITIONAL([WANT_GCC45], false)
+if test "${CXX}" = ""; then
+ AC_MSG_CHECKING([for clang++])
+ if test -x "/usr/bin/clang++"; then
+ # Use CLang++/LLVM if available
+ CXX=/usr/bin/clang++
+ CC=/usr/bin/clang
+ AC_MSG_RESULT(/usr/bin/clang++)
+ AM_CONDITIONAL([WANT_LLVM], true)
+ AC_DEFINE([WANT_LLVM], 1, [compile with clang++/llvm])
+ else
+ AM_CONDITIONAL([WANT_LLVM], false)
+ fi
fi
AC_PROG_CXX
AC_PROG_AWK
@@ -49,6 +50,12 @@ AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
# Initialize default GCC C++ and LD options.
+cxxname=`basename ${CXX}`
+if test "${cxxname}" = "clang++"; then
+ cxxtype="clang"
+else
+ cxxtype="gcc"
+fi
cxxflags="${CXXFLAGS}"
ldflags="${LDFLAGS}"
defaultlibs="${LIBS}"
@@ -107,12 +114,20 @@ AC_ARG_ENABLE(maintainer-mode, [AS_HELP_STRING([--enable-maintainer-mode], [comp
esac ],
[ AC_MSG_RESULT(no)])
if test "${want_maintainer_mode}" = "true"; then
- cxxflags="${cxxflags} -D_DEBUG -O2 -ggdb -g3 -Werror -Wall -Wextra -Wno-ignored-qualifiers -Wno-strict-aliasing -Winit-self -Wmissing-include-dirs -Wcast-qual -Wcast-align -Wwrite-strings -Wpointer-arith -Wconversion -Waddress -Wlogical-op -Wredundant-decls -std=c++0x -fmessage-length=0"
+ cxxflags="${cxxflags} -D_DEBUG -O2 -ggdb -g3 -Werror -Wall -Wextra -Wno-ignored-qualifiers -Wno-strict-aliasing -Winit-self -Wmissing-include-dirs -Wcast-qual -Wcast-align -Wwrite-strings -Wpointer-arith -Waddress -Wredundant-decls -std=c++0x -fmessage-length=0"
+ if test "${cxxtype}" = "clang"; then
+ cxxflags="${cxxflags} -stdlib=libc++"
+ else
+ cxxflags="${cxxflags} -Wlogical-op -Wconversion"
+ fi
ldflags="${ldflags} -pg"
AM_CONDITIONAL([WANT_MAINTAINER_MODE], true)
AC_DEFINE([WANT_MAINTAINER_MODE], 1, [compile with debugging and compile-time warnings])
else
cxxflags="${cxxflags} -g -O2 -std=c++0x -fmessage-length=0"
+ if test "${cxxtype}" = "clang"; then
+ cxxflags="${cxxflags} -stdlib=libc++"
+ fi
AM_CONDITIONAL([WANT_MAINTAINER_MODE], false)
fi