summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2007-06-28 19:36:08 +0000
committerDavid Greene <greened@obbligato.org>2007-06-28 19:36:08 +0000
commita696d24ad275608540aba1e5c668bbd52e04317e (patch)
tree6fad9d35105e5dfcbaa83e58a78ef2a7b92f904b
parent31ed0fb804dd86fb15093e114701932119914400 (diff)
Add support for building with _GLIBCXX_DEBUG. New configure option
--enable-expensive-checks allows the developer to enable runtime checking that can greatly increase compile time. Currently it only turns on _GLIBCXX_DEBUG. Other expensive debugging checks added later should be controlled by this configure option. This patch also updates llvm-config with a --cppflags option to inform llvm-gcc how to build itself so that it is compatible with an llvm that was built with _GLIBCXX_DEBUG. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37777 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--Makefile.config.in5
-rw-r--r--Makefile.rules10
-rw-r--r--autoconf/configure.ac11
-rwxr-xr-xconfigure79
-rw-r--r--tools/llvm-config/Makefile4
-rw-r--r--tools/llvm-config/llvm-config.in.in29
6 files changed, 107 insertions, 31 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index 03e625be22b..add81531f24 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -209,6 +209,11 @@ OBJ_ROOT := .
#DISABLE_ASSERTIONS = 1
@DISABLE_ASSERTIONS@
+# When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
+# code will include expensive checks, otherwise they are excluded.
+#ENABLE_EXPENSIVE_CHECKS = 0
+@ENABLE_EXPENSIVE_CHECKS@
+
# When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
# symbols.
#DEBUG_RUNTIME = 1
diff --git a/Makefile.rules b/Makefile.rules
index d83f2fa548b..3da11351c01 100644
--- a/Makefile.rules
+++ b/Makefile.rules
@@ -260,6 +260,13 @@ else
C.Flags += -D_DEBUG
endif
+# If DISABLE_EXPENSIVE_CHECKS=1 is specified (make command line or configured),
+# then disable expensive checks by defining the appropriate preprocessor symbols.
+ifdef ENABLE_EXPENSIVE_CHECKS
+ BuildMode := $(BuildMode)+Checks
+ CXX.Flags += -D_GLIBCXX_DEBUG
+endif
+
ifeq ($(ENABLE_PIC),1)
CXX.Flags += -fPIC
C.Flags += -fPIC
@@ -267,7 +274,8 @@ endif
CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
C.Flags += $(CFLAGS)
-CPP.BaseFlags += $(CPPFLAGS)
+CPP.Defines += $(CPPFLAGS)
+CPP.BaseFlags += $(CPP.Defines)
LD.Flags += $(LDFLAGS)
AR.Flags := cru
LibTool.Flags := --tag=CXX
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index c8fd77f4328..4e4200be5bd 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -274,6 +274,17 @@ else
AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
fi
+dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
+AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
+ [--enable-expensive-checks,Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
+if test ${enableval} = "yes" ; then
+ AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
+ AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
+else
+ AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]])
+ AC_SUBST(EXPENSIVE_CHECKS,[[no]])
+fi
+
dnl --enable-debug-runtime : should runtime libraries have debug symbols?
AC_ARG_ENABLE(debug-runtime,
AS_HELP_STRING([--enable-debug-runtime,Build runtime libs with debug symbols (default is NO)]),,enableval=no)
diff --git a/configure b/configure
index b9eafdff211..77e4cab20ea 100755
--- a/configure
+++ b/configure
@@ -830,6 +830,8 @@ BUILD_EXEEXT
CVSBUILD
ENABLE_OPTIMIZED
DISABLE_ASSERTIONS
+ENABLE_EXPENSIVE_CHECKS
+EXPENSIVE_CHECKS
DEBUG_RUNTIME
JIT
TARGET_HAS_JIT
@@ -1525,6 +1527,8 @@ Optional Features:
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-optimized
--enable-assertions
+ --enable-expensive-checks
+
--enable-debug-runtime
--enable-jit Enable Just In Time Compiling (default is YES)
--enable-doxygen Build doxygen documentation (default is NO)
@@ -4577,6 +4581,25 @@ else
fi
+# Check whether --enable-expensive-checks was given.
+if test "${enable_expensive_checks+set}" = set; then
+ enableval=$enable_expensive_checks;
+else
+ enableval="no"
+fi
+
+if test ${enableval} = "yes" ; then
+ ENABLE_EXPENSIVE_CHECKS=ENABLE_EXPENSIVE_CHECKS=1
+
+ EXPENSIVE_CHECKS=yes
+
+else
+ ENABLE_EXPENSIVE_CHECKS=
+
+ EXPENSIVE_CHECKS=no
+
+fi
+
# Check whether --enable-debug-runtime was given.
if test "${enable_debug_runtime+set}" = set; then
enableval=$enable_debug_runtime;
@@ -10343,7 +10366,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10346 "configure"
+#line 10369 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12487,7 +12510,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 12490 "configure"' > conftest.$ac_ext
+ echo '#line 12513 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -14205,11 +14228,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14208: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14231: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14212: \$? = $ac_status" >&5
+ echo "$as_me:14235: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14473,11 +14496,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14476: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14499: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:14480: \$? = $ac_status" >&5
+ echo "$as_me:14503: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -14577,11 +14600,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14580: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:14603: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:14584: \$? = $ac_status" >&5
+ echo "$as_me:14607: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -17029,7 +17052,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17032 "configure"
+#line 17055 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -17129,7 +17152,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 17132 "configure"
+#line 17155 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -19497,11 +19520,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:19500: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:19523: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:19504: \$? = $ac_status" >&5
+ echo "$as_me:19527: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -19601,11 +19624,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:19604: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:19627: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:19608: \$? = $ac_status" >&5
+ echo "$as_me:19631: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -21171,11 +21194,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21174: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21197: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:21178: \$? = $ac_status" >&5
+ echo "$as_me:21201: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -21275,11 +21298,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:21278: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:21301: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:21282: \$? = $ac_status" >&5
+ echo "$as_me:21305: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -23510,11 +23533,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23513: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23536: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23517: \$? = $ac_status" >&5
+ echo "$as_me:23540: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -23778,11 +23801,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23781: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23804: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:23785: \$? = $ac_status" >&5
+ echo "$as_me:23808: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -23882,11 +23905,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:23885: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:23908: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:23889: \$? = $ac_status" >&5
+ echo "$as_me:23912: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -34342,6 +34365,8 @@ BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim
CVSBUILD!$CVSBUILD$ac_delim
ENABLE_OPTIMIZED!$ENABLE_OPTIMIZED$ac_delim
DISABLE_ASSERTIONS!$DISABLE_ASSERTIONS$ac_delim
+ENABLE_EXPENSIVE_CHECKS!$ENABLE_EXPENSIVE_CHECKS$ac_delim
+EXPENSIVE_CHECKS!$EXPENSIVE_CHECKS$ac_delim
DEBUG_RUNTIME!$DEBUG_RUNTIME$ac_delim
JIT!$JIT$ac_delim
TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
@@ -34363,8 +34388,6 @@ YFLAGS!$YFLAGS$ac_delim
BISON!$BISON$ac_delim
NM!$NM$ac_delim
ifGNUmake!$ifGNUmake$ac_delim
-LN_S!$LN_S$ac_delim
-CMP!$CMP$ac_delim
_ACEOF
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
@@ -34406,6 +34429,8 @@ _ACEOF
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
cat >conf$$subs.sed <<_ACEOF
+LN_S!$LN_S$ac_delim
+CMP!$CMP$ac_delim
CP!$CP$ac_delim
DATE!$DATE$ac_delim
FIND!$FIND$ac_delim
@@ -34477,7 +34502,7 @@ LIBOBJS!$LIBOBJS$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile
index 471b5bcbd5a..5ceef2e85d4 100644
--- a/tools/llvm-config/Makefile
+++ b/tools/llvm-config/Makefile
@@ -20,6 +20,7 @@ include $(LEVEL)/Makefile.common
ifeq ($(HAVE_PERL),1)
# Combine preprocessor flags (except for -I) and CXX flags.
+SUB_CPPFLAGS = ${CPP.Defines}
SUB_CFLAGS = ${CPP.BaseFlags} ${C.Flags}
SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
@@ -56,7 +57,8 @@ llvm-config.in: $(ConfigInIn) $(ConfigStatusScript)
# Build our final script.
$(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
$(Echo) "Building llvm-config script."
- $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' > temp.sed
+ $(Verb) $(ECHO) 's,@LLVM_CPPFLAGS@,$(SUB_CPPFLAGS),' > temp.sed
+ $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' >> temp.sed
$(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' >> temp.sed
$(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed
$(Verb) $(ECHO) 's,@LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed
diff --git a/tools/llvm-config/llvm-config.in.in b/tools/llvm-config/llvm-config.in.in
index 5db4eb92b58..a8eb12abd8a 100644
--- a/tools/llvm-config/llvm-config.in.in
+++ b/tools/llvm-config/llvm-config.in.in
@@ -42,6 +42,7 @@ my $TARGET_TRIPLE = q{@target@};
my $TARGETS_TO_BUILD = q{@TARGETS_TO_BUILD@};
my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@};
my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@};
+my $EXPENSIVE_CHECKS = q{@EXPENSIVE_CHECKS@};
#---- end autoconf values ----
# Must pretend x86_64 architecture is really x86, otherwise the native backend
@@ -49,6 +50,7 @@ my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@};
$ARCH = "x86" if $ARCH eq "x86_64";
#---- begin Makefile values ----
+my $CPPFLAGS = q{@LLVM_CPPFLAGS@};
my $CFLAGS = q{@LLVM_CFLAGS@};
my $CXXFLAGS = q{@LLVM_CXXFLAGS@};
my $LDFLAGS = q{@LLVM_LDFLAGS@};
@@ -112,10 +114,18 @@ foreach my $arg (@ARGV) {
$has_opt = 1; print "$INCLUDEDIR\n";
} elsif ($arg eq "--libdir") {
$has_opt = 1; print "$LIBDIR\n";
+ } elsif ($arg eq "--cppflags") {
+ $has_opt = 1;
+ my $cppopts = get_cpp_opts();
+ print "$cppopts\n";
} elsif ($arg eq "--cflags") {
- $has_opt = 1; print "-I$INCLUDEDIR $CFLAGS\n";
+ $has_opt = 1;
+ my $cppopts = get_cpp_opts();
+ print "$cppopts $CFLAGS\n";
} elsif ($arg eq "--cxxflags") {
- $has_opt = 1; print "-I$INCLUDEDIR $CXXFLAGS\n";
+ $has_opt = 1;
+ my $cppopts = get_cpp_opts();
+ print "$cppopts $CXXFLAGS\n";
} elsif ($arg eq "--ldflags") {
$has_opt = 1; print "-L$LIBDIR $LDFLAGS $SYSTEM_LIBS\n";
} elsif ($arg eq "--libs") {
@@ -187,6 +197,7 @@ Options:
--bindir Directory containing LLVM executables.
--includedir Directory containing LLVM headers.
--libdir Directory containing LLVM libraries.
+ --cppflags C preprocessor flags for files that include LLVM headers.
--cflags C compiler flags for files that include LLVM headers.
--cxxflags C++ compiler flags for files that include LLVM headers.
--ldflags Print Linker flags.
@@ -205,6 +216,20 @@ __EOD__
exit(1);
}
+# Return cpp flags used to build llvm.
+sub get_cpp_opts {
+ my $opts = "";
+
+ if ($EXPENSIVE_CHECKS eq "yes") {
+ $opts = "-D_GLIBCXX_DEBUG -I$INCLUDEDIR $CPPFLAGS";
+ }
+ else {
+ $opts = "-I$INCLUDEDIR $CPPFLAGS";
+ }
+
+ return $opts;
+}
+
# Use -lfoo instead of libfoo.a whenever possible, and add directories to
# files which can't be found using -L.
sub fix_library_names (@) {