diff options
author | David Greene <greened@obbligato.org> | 2007-06-28 19:36:08 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2007-06-28 19:36:08 +0000 |
commit | a696d24ad275608540aba1e5c668bbd52e04317e (patch) | |
tree | 6fad9d35105e5dfcbaa83e58a78ef2a7b92f904b /tools | |
parent | 31ed0fb804dd86fb15093e114701932119914400 (diff) | |
download | external_llvm-a696d24ad275608540aba1e5c668bbd52e04317e.zip external_llvm-a696d24ad275608540aba1e5c668bbd52e04317e.tar.gz external_llvm-a696d24ad275608540aba1e5c668bbd52e04317e.tar.bz2 |
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
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-config/Makefile | 4 | ||||
-rw-r--r-- | tools/llvm-config/llvm-config.in.in | 29 |
2 files changed, 30 insertions, 3 deletions
diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile index 471b5bc..5ceef2e 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 5db4eb9..a8eb12a 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 (@) { |