[llvm-commits] CVS: llvm/tools/llvm-config/llvm-config.in.in Makefile

David Greene greened at obbligato.org
Thu Jun 28 12:36:36 PDT 2007



Changes in directory llvm/tools/llvm-config:

llvm-config.in.in updated: 1.27 -> 1.28
Makefile updated: 1.23 -> 1.24
---
Log message:

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.


---
Diffs of the changes:  (+30 -3)

 Makefile          |    4 +++-
 llvm-config.in.in |   29 +++++++++++++++++++++++++++--
 2 files changed, 30 insertions(+), 3 deletions(-)


Index: llvm/tools/llvm-config/llvm-config.in.in
diff -u llvm/tools/llvm-config/llvm-config.in.in:1.27 llvm/tools/llvm-config/llvm-config.in.in:1.28
--- llvm/tools/llvm-config/llvm-config.in.in:1.27	Sun Apr 22 13:33:20 2007
+++ llvm/tools/llvm-config/llvm-config.in.in	Thu Jun 28 14:36:07 2007
@@ -42,6 +42,7 @@
 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 @@
 $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 @@
             $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 @@
   --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 @@
     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 (@) {


Index: llvm/tools/llvm-config/Makefile
diff -u llvm/tools/llvm-config/Makefile:1.23 llvm/tools/llvm-config/Makefile:1.24
--- llvm/tools/llvm-config/Makefile:1.23	Sun Feb  4 16:08:16 2007
+++ llvm/tools/llvm-config/Makefile	Thu Jun 28 14:36:07 2007
@@ -20,6 +20,7 @@
 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 @@
 # Build our final script.
 $(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
 	$(Echo) "Building llvm-config script."
-	$(Verb) $(ECHO) 's, at LLVM_CFLAGS@,$(SUB_CFLAGS),' > temp.sed
+	$(Verb) $(ECHO) 's, at LLVM_CPPFLAGS@,$(SUB_CPPFLAGS),' > temp.sed
+	$(Verb) $(ECHO) 's, at LLVM_CFLAGS@,$(SUB_CFLAGS),' >> temp.sed
 	$(Verb) $(ECHO) 's, at LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' >> temp.sed
 	$(Verb) $(ECHO) 's, at LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed
 	$(Verb) $(ECHO) 's, at LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed






More information about the llvm-commits mailing list