[cfe-dev] Some configure problems
Dmitri Shubin
sbn at tbricks.com
Tue Mar 13 06:55:39 PDT 2012
Hello!
While bootstrapping clang w/ libc++ on Solaris I found several problems
in "configure" scripts:
1) Typo in std::isinf() detection:
Index: autoconf/m4/func_isinf.m4
===================================================================
--- autoconf/m4/func_isinf.m4 (revision 152623)
+++ autoconf/m4/func_isinf.m4 (working copy)
@@ -19,7 +19,7 @@
AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath],
[std::isinf], [<cmath>],
- [float f; std::isinf(f)}])
+ [float f; std::isinf(f);])
if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then
AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf
function is found in <cmath>])
fi
Duplicated in projects/sample/autoconf/m4/func_isinf.m4
2) When configuring clang to build using libc++ I think '-stdlib=libc++'
should be used for all C++ configure tests
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac (revision 152548)
+++ autoconf/configure.ac (working copy)
@@ -431,7 +431,7 @@
[Use libc++ if available (default is NO)]),,
enableval=default)
case "$enableval" in
- yes) AC_SUBST(ENABLE_LIBCPP,[1]) ;;
+ yes) AC_SUBST(ENABLE_LIBCPP,[1]); CXXFLAGS+=" -stdlib=libc++" ;;
no) AC_SUBST(ENABLE_LIBCPP,[0]) ;;
default) AC_SUBST(ENABLE_LIBCPP,[0]);;
*) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or
"no"]) ;;
Index: autoconf/m4/huge_val.m4
===================================================================
--- autoconf/m4/huge_val.m4 (revision 152548)
+++ autoconf/m4/huge_val.m4 (working copy)
@@ -6,7 +6,7 @@
AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
AC_LANG_PUSH([C++])
ac_save_CXXFLAGS=$CXXFLAGS
- CXXFLAGS=-pedantic
+ CXXFLAGS+=" -pedantic"
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include <math.h>],
3) 'projects/sample' has its own configure script which lacks libc++ support
Index: projects/sample/autoconf/configure.ac
===================================================================
--- projects/sample/autoconf/configure.ac (revision 152548)
+++ projects/sample/autoconf/configure.ac (working copy)
@@ -360,6 +360,18 @@
dnl===
dnl===-----------------------------------------------------------------------===
+dnl --enable-libcpp : check whether or not to use libc++ on the command
line
+AC_ARG_ENABLE(libcpp,
+ AS_HELP_STRING([--enable-libcpp],
+ [Use libc++ if available (default is NO)]),,
+ enableval=default)
+case "$enableval" in
+ yes) AC_SUBST(ENABLE_LIBCPP,[1]); CXXFLAGS+=" -stdlib=libc++" ;;
+ no) AC_SUBST(ENABLE_LIBCPP,[0]) ;;
+ default) AC_SUBST(ENABLE_LIBCPP,[0]);;
+ *) AC_MSG_ERROR([Invalid setting for --enable-libcpp. Use "yes" or
"no"]) ;;
+esac
+
dnl --enable-optimized : check whether they want to do an optimized build:
AC_ARG_ENABLE(optimized, AS_HELP_STRING(
--enable-optimized,[Compile with optimizations enabled (default is
NO)]),,enableval=$optimize)
Index: projects/sample/autoconf/m4/huge_val.m4
===================================================================
--- projects/sample/autoconf/m4/huge_val.m4 (revision 152548)
+++ projects/sample/autoconf/m4/huge_val.m4 (working copy)
@@ -6,7 +6,7 @@
AC_CACHE_CHECK([for HUGE_VAL sanity], [ac_cv_huge_val_sanity],[
AC_LANG_PUSH([C++])
ac_save_CXXFLAGS=$CXXFLAGS
- CXXFLAGS=-pedantic
+ CXXFLAGS+=" -pedantic"
AC_RUN_IFELSE(
AC_LANG_PROGRAM(
[#include <math.h>],
Index: projects/sample/Makefile.llvm.rules
===================================================================
--- projects/sample/Makefile.llvm.rules (revision 152548)
+++ projects/sample/Makefile.llvm.rules (working copy)
@@ -245,6 +245,11 @@
endif
endif
+ifeq ($(ENABLE_LIBCPP),1)
+ CXX.Flags += -stdlib=libc++
+ LD.Flags += -stdlib=libc++
+endif
+
ifeq ($(ENABLE_PROFILING),1)
BuildMode := $(BuildMode)+Profile
CXX.Flags := $(filter-out -fomit-frame-pointer,$(CXX.Flags)) -pg -g
Index: projects/sample/Makefile.llvm.config.in
===================================================================
--- projects/sample/Makefile.llvm.config.in (revision 152548)
+++ projects/sample/Makefile.llvm.config.in (working copy)
@@ -182,6 +182,10 @@
# These are options that can either be enabled here, or can be enabled
on the
# make command line (ie, make ENABLE_PROFILING=1):
+# When ENABLE_LIBCPP is enabled, LLVM uses libc++ by default to build.
+#ENABLE_LIBCPP = 0
+ENABLE_LIBCPP = @ENABLE_LIBCPP@
+
# When ENABLE_OPTIMIZED is enabled, LLVM code is optimized and output
is put
# into the "Release" directories. Otherwise, LLVM code is not
optimized and
# output is put in the "Debug" directories.
More information about the cfe-dev
mailing list