llvm.org GIT mirror llvm / a696d24
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 David Greene 12 years ago
6 changed file(s) with 107 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
208208 #DISABLE_ASSERTIONS = 1
209209 @DISABLE_ASSERTIONS@
210210
211 # When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
212 # code will include expensive checks, otherwise they are excluded.
213 #ENABLE_EXPENSIVE_CHECKS = 0
214 @ENABLE_EXPENSIVE_CHECKS@
215
211216 # When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
212217 # symbols.
213218 #DEBUG_RUNTIME = 1
259259 C.Flags += -D_DEBUG
260260 endif
261261
262 # If DISABLE_EXPENSIVE_CHECKS=1 is specified (make command line or configured),
263 # then disable expensive checks by defining the appropriate preprocessor symbols.
264 ifdef ENABLE_EXPENSIVE_CHECKS
265 BuildMode := $(BuildMode)+Checks
266 CXX.Flags += -D_GLIBCXX_DEBUG
267 endif
268
262269 ifeq ($(ENABLE_PIC),1)
263270 CXX.Flags += -fPIC
264271 C.Flags += -fPIC
266273
267274 CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
268275 C.Flags += $(CFLAGS)
269 CPP.BaseFlags += $(CPPFLAGS)
276 CPP.Defines += $(CPPFLAGS)
277 CPP.BaseFlags += $(CPP.Defines)
270278 LD.Flags += $(LDFLAGS)
271279 AR.Flags := cru
272280 LibTool.Flags := --tag=CXX
271271 AC_SUBST(DISABLE_ASSERTIONS,[[]])
272272 else
273273 AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
274 fi
275
276 dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
277 AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
278 [--enable-expensive-checks,Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
279 if test ${enableval} = "yes" ; then
280 AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
281 AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
282 else
283 AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]])
284 AC_SUBST(EXPENSIVE_CHECKS,[[no]])
274285 fi
275286
276287 dnl --enable-debug-runtime : should runtime libraries have debug symbols?
829829 CVSBUILD
830830 ENABLE_OPTIMIZED
831831 DISABLE_ASSERTIONS
832 ENABLE_EXPENSIVE_CHECKS
833 EXPENSIVE_CHECKS
832834 DEBUG_RUNTIME
833835 JIT
834836 TARGET_HAS_JIT
15241526 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
15251527 --enable-optimized
15261528 --enable-assertions
1529 --enable-expensive-checks
1530
15271531 --enable-debug-runtime
15281532 --enable-jit Enable Just In Time Compiling (default is YES)
15291533 --enable-doxygen Build doxygen documentation (default is NO)
45764580
45774581 fi
45784582
4583 # Check whether --enable-expensive-checks was given.
4584 if test "${enable_expensive_checks+set}" = set; then
4585 enableval=$enable_expensive_checks;
4586 else
4587 enableval="no"
4588 fi
4589
4590 if test ${enableval} = "yes" ; then
4591 ENABLE_EXPENSIVE_CHECKS=ENABLE_EXPENSIVE_CHECKS=1
4592
4593 EXPENSIVE_CHECKS=yes
4594
4595 else
4596 ENABLE_EXPENSIVE_CHECKS=
4597
4598 EXPENSIVE_CHECKS=no
4599
4600 fi
4601
45794602 # Check whether --enable-debug-runtime was given.
45804603 if test "${enable_debug_runtime+set}" = set; then
45814604 enableval=$enable_debug_runtime;
1034210365 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1034310366 lt_status=$lt_dlunknown
1034410367 cat > conftest.$ac_ext <
10345 #line 10346 "configure"
10368 #line 10369 "configure"
1034610369 #include "confdefs.h"
1034710370
1034810371 #if HAVE_DLFCN_H
1248612509 ;;
1248712510 *-*-irix6*)
1248812511 # Find out which ABI we are using.
12489 echo '#line 12490 "configure"' > conftest.$ac_ext
12512 echo '#line 12513 "configure"' > conftest.$ac_ext
1249012513 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1249112514 (eval $ac_compile) 2>&5
1249212515 ac_status=$?
1420414227 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1420514228 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1420614229 -e 's:$: $lt_compiler_flag:'`
14207 (eval echo "\"\$as_me:14208: $lt_compile\"" >&5)
14230 (eval echo "\"\$as_me:14231: $lt_compile\"" >&5)
1420814231 (eval "$lt_compile" 2>conftest.err)
1420914232 ac_status=$?
1421014233 cat conftest.err >&5
14211 echo "$as_me:14212: \$? = $ac_status" >&5
14234 echo "$as_me:14235: \$? = $ac_status" >&5
1421214235 if (exit $ac_status) && test -s "$ac_outfile"; then
1421314236 # The compiler can only warn and ignore the option if not recognized
1421414237 # So say no if there are warnings other than the usual output.
1447214495 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1447314496 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1447414497 -e 's:$: $lt_compiler_flag:'`
14475 (eval echo "\"\$as_me:14476: $lt_compile\"" >&5)
14498 (eval echo "\"\$as_me:14499: $lt_compile\"" >&5)
1447614499 (eval "$lt_compile" 2>conftest.err)
1447714500 ac_status=$?
1447814501 cat conftest.err >&5
14479 echo "$as_me:14480: \$? = $ac_status" >&5
14502 echo "$as_me:14503: \$? = $ac_status" >&5
1448014503 if (exit $ac_status) && test -s "$ac_outfile"; then
1448114504 # The compiler can only warn and ignore the option if not recognized
1448214505 # So say no if there are warnings other than the usual output.
1457614599 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1457714600 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1457814601 -e 's:$: $lt_compiler_flag:'`
14579 (eval echo "\"\$as_me:14580: $lt_compile\"" >&5)
14602 (eval echo "\"\$as_me:14603: $lt_compile\"" >&5)
1458014603 (eval "$lt_compile" 2>out/conftest.err)
1458114604 ac_status=$?
1458214605 cat out/conftest.err >&5
14583 echo "$as_me:14584: \$? = $ac_status" >&5
14606 echo "$as_me:14607: \$? = $ac_status" >&5
1458414607 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1458514608 then
1458614609 # The compiler can only warn and ignore the option if not recognized
1702817051 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1702917052 lt_status=$lt_dlunknown
1703017053 cat > conftest.$ac_ext <
17031 #line 17032 "configure"
17054 #line 17055 "configure"
1703217055 #include "confdefs.h"
1703317056
1703417057 #if HAVE_DLFCN_H
1712817151 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1712917152 lt_status=$lt_dlunknown
1713017153 cat > conftest.$ac_ext <
17131 #line 17132 "configure"
17154 #line 17155 "configure"
1713217155 #include "confdefs.h"
1713317156
1713417157 #if HAVE_DLFCN_H
1949619519 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1949719520 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1949819521 -e 's:$: $lt_compiler_flag:'`
19499 (eval echo "\"\$as_me:19500: $lt_compile\"" >&5)
19522 (eval echo "\"\$as_me:19523: $lt_compile\"" >&5)
1950019523 (eval "$lt_compile" 2>conftest.err)
1950119524 ac_status=$?
1950219525 cat conftest.err >&5
19503 echo "$as_me:19504: \$? = $ac_status" >&5
19526 echo "$as_me:19527: \$? = $ac_status" >&5
1950419527 if (exit $ac_status) && test -s "$ac_outfile"; then
1950519528 # The compiler can only warn and ignore the option if not recognized
1950619529 # So say no if there are warnings other than the usual output.
1960019623 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1960119624 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1960219625 -e 's:$: $lt_compiler_flag:'`
19603 (eval echo "\"\$as_me:19604: $lt_compile\"" >&5)
19626 (eval echo "\"\$as_me:19627: $lt_compile\"" >&5)
1960419627 (eval "$lt_compile" 2>out/conftest.err)
1960519628 ac_status=$?
1960619629 cat out/conftest.err >&5
19607 echo "$as_me:19608: \$? = $ac_status" >&5
19630 echo "$as_me:19631: \$? = $ac_status" >&5
1960819631 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1960919632 then
1961019633 # The compiler can only warn and ignore the option if not recognized
2117021193 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2117121194 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2117221195 -e 's:$: $lt_compiler_flag:'`
21173 (eval echo "\"\$as_me:21174: $lt_compile\"" >&5)
21196 (eval echo "\"\$as_me:21197: $lt_compile\"" >&5)
2117421197 (eval "$lt_compile" 2>conftest.err)
2117521198 ac_status=$?
2117621199 cat conftest.err >&5
21177 echo "$as_me:21178: \$? = $ac_status" >&5
21200 echo "$as_me:21201: \$? = $ac_status" >&5
2117821201 if (exit $ac_status) && test -s "$ac_outfile"; then
2117921202 # The compiler can only warn and ignore the option if not recognized
2118021203 # So say no if there are warnings other than the usual output.
2127421297 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2127521298 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2127621299 -e 's:$: $lt_compiler_flag:'`
21277 (eval echo "\"\$as_me:21278: $lt_compile\"" >&5)
21300 (eval echo "\"\$as_me:21301: $lt_compile\"" >&5)
2127821301 (eval "$lt_compile" 2>out/conftest.err)
2127921302 ac_status=$?
2128021303 cat out/conftest.err >&5
21281 echo "$as_me:21282: \$? = $ac_status" >&5
21304 echo "$as_me:21305: \$? = $ac_status" >&5
2128221305 if (exit $ac_status) && test -s out/conftest2.$ac_objext
2128321306 then
2128421307 # The compiler can only warn and ignore the option if not recognized
2350923532 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2351023533 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2351123534 -e 's:$: $lt_compiler_flag:'`
23512 (eval echo "\"\$as_me:23513: $lt_compile\"" >&5)
23535 (eval echo "\"\$as_me:23536: $lt_compile\"" >&5)
2351323536 (eval "$lt_compile" 2>conftest.err)
2351423537 ac_status=$?
2351523538 cat conftest.err >&5
23516 echo "$as_me:23517: \$? = $ac_status" >&5
23539 echo "$as_me:23540: \$? = $ac_status" >&5
2351723540 if (exit $ac_status) && test -s "$ac_outfile"; then
2351823541 # The compiler can only warn and ignore the option if not recognized
2351923542 # So say no if there are warnings other than the usual output.
2377723800 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2377823801 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2377923802 -e 's:$: $lt_compiler_flag:'`
23780 (eval echo "\"\$as_me:23781: $lt_compile\"" >&5)
23803 (eval echo "\"\$as_me:23804: $lt_compile\"" >&5)
2378123804 (eval "$lt_compile" 2>conftest.err)
2378223805 ac_status=$?
2378323806 cat conftest.err >&5
23784 echo "$as_me:23785: \$? = $ac_status" >&5
23807 echo "$as_me:23808: \$? = $ac_status" >&5
2378523808 if (exit $ac_status) && test -s "$ac_outfile"; then
2378623809 # The compiler can only warn and ignore the option if not recognized
2378723810 # So say no if there are warnings other than the usual output.
2388123904 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
2388223905 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
2388323906 -e 's:$: $lt_compiler_flag:'`
23884 (eval echo "\"\$as_me:23885: $lt_compile\"" >&5)
23907 (eval echo "\"\$as_me:23908: $lt_compile\"" >&5)
2388523908 (eval "$lt_compile" 2>out/conftest.err)
2388623909 ac_status=$?
2388723910 cat out/conftest.err >&5
23888 echo "$as_me:23889: \$? = $ac_status" >&5
23911 echo "$as_me:23912: \$? = $ac_status" >&5
2388923912 if (exit $ac_status) && test -s out/conftest2.$ac_objext
2389023913 then
2389123914 # The compiler can only warn and ignore the option if not recognized
3434134364 CVSBUILD!$CVSBUILD$ac_delim
3434234365 ENABLE_OPTIMIZED!$ENABLE_OPTIMIZED$ac_delim
3434334366 DISABLE_ASSERTIONS!$DISABLE_ASSERTIONS$ac_delim
34367 ENABLE_EXPENSIVE_CHECKS!$ENABLE_EXPENSIVE_CHECKS$ac_delim
34368 EXPENSIVE_CHECKS!$EXPENSIVE_CHECKS$ac_delim
3434434369 DEBUG_RUNTIME!$DEBUG_RUNTIME$ac_delim
3434534370 JIT!$JIT$ac_delim
3434634371 TARGET_HAS_JIT!$TARGET_HAS_JIT$ac_delim
3436234387 BISON!$BISON$ac_delim
3436334388 NM!$NM$ac_delim
3436434389 ifGNUmake!$ifGNUmake$ac_delim
34365 LN_S!$LN_S$ac_delim
34366 CMP!$CMP$ac_delim
3436734390 _ACEOF
3436834391
3436934392 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
3440534428 ac_delim='%!_!# '
3440634429 for ac_last_try in false false false false false :; do
3440734430 cat >conf$$subs.sed <<_ACEOF
34431 LN_S!$LN_S$ac_delim
34432 CMP!$CMP$ac_delim
3440834433 CP!$CP$ac_delim
3440934434 DATE!$DATE$ac_delim
3441034435 FIND!$FIND$ac_delim
3447634501 LTLIBOBJS!$LTLIBOBJS$ac_delim
3447734502 _ACEOF
3447834503
34479 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 69; then
34504 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 71; then
3448034505 break
3448134506 elif $ac_last_try; then
3448234507 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
1919 ifeq ($(HAVE_PERL),1)
2020
2121 # Combine preprocessor flags (except for -I) and CXX flags.
22 SUB_CPPFLAGS = ${CPP.Defines}
2223 SUB_CFLAGS = ${CPP.BaseFlags} ${C.Flags}
2324 SUB_CXXFLAGS = ${CPP.BaseFlags} ${CXX.Flags}
2425
5556 # Build our final script.
5657 $(ToolDir)/llvm-config: llvm-config.in $(FinalLibDeps)
5758 $(Echo) "Building llvm-config script."
58 $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' > temp.sed
59 $(Verb) $(ECHO) 's,@LLVM_CPPFLAGS@,$(SUB_CPPFLAGS),' > temp.sed
60 $(Verb) $(ECHO) 's,@LLVM_CFLAGS@,$(SUB_CFLAGS),' >> temp.sed
5961 $(Verb) $(ECHO) 's,@LLVM_CXXFLAGS@,$(SUB_CXXFLAGS),' >> temp.sed
6062 $(Verb) $(ECHO) 's,@LLVM_LDFLAGS@,$(SUB_LDFLAGS),' >> temp.sed
6163 $(Verb) $(ECHO) 's,@LLVM_BUILDMODE@,$(BuildMode),' >> temp.sed
4141 my $TARGETS_TO_BUILD = q{@TARGETS_TO_BUILD@};
4242 my $TARGET_HAS_JIT = q{@TARGET_HAS_JIT@};
4343 my @TARGETS_BUILT = map { lc($_) } qw{@TARGETS_TO_BUILD@};
44 my $EXPENSIVE_CHECKS = q{@EXPENSIVE_CHECKS@};
4445 #---- end autoconf values ----
4546
4647 # Must pretend x86_64 architecture is really x86, otherwise the native backend
4849 $ARCH = "x86" if $ARCH eq "x86_64";
4950
5051 #---- begin Makefile values ----
52 my $CPPFLAGS = q{@LLVM_CPPFLAGS@};
5153 my $CFLAGS = q{@LLVM_CFLAGS@};
5254 my $CXXFLAGS = q{@LLVM_CXXFLAGS@};
5355 my $LDFLAGS = q{@LLVM_LDFLAGS@};
111113 $has_opt = 1; print "$INCLUDEDIR\n";
112114 } elsif ($arg eq "--libdir") {
113115 $has_opt = 1; print "$LIBDIR\n";
116 } elsif ($arg eq "--cppflags") {
117 $has_opt = 1;
118 my $cppopts = get_cpp_opts();
119 print "$cppopts\n";
114120 } elsif ($arg eq "--cflags") {
115 $has_opt = 1; print "-I$INCLUDEDIR $CFLAGS\n";
121 $has_opt = 1;
122 my $cppopts = get_cpp_opts();
123 print "$cppopts $CFLAGS\n";
116124 } elsif ($arg eq "--cxxflags") {
117 $has_opt = 1; print "-I$INCLUDEDIR $CXXFLAGS\n";
125 $has_opt = 1;
126 my $cppopts = get_cpp_opts();
127 print "$cppopts $CXXFLAGS\n";
118128 } elsif ($arg eq "--ldflags") {
119129 $has_opt = 1; print "-L$LIBDIR $LDFLAGS $SYSTEM_LIBS\n";
120130 } elsif ($arg eq "--libs") {
186196 --bindir Directory containing LLVM executables.
187197 --includedir Directory containing LLVM headers.
188198 --libdir Directory containing LLVM libraries.
199 --cppflags C preprocessor flags for files that include LLVM headers.
189200 --cflags C compiler flags for files that include LLVM headers.
190201 --cxxflags C++ compiler flags for files that include LLVM headers.
191202 --ldflags Print Linker flags.
204215 exit(1);
205216 }
206217
218 # Return cpp flags used to build llvm.
219 sub get_cpp_opts {
220 my $opts = "";
221
222 if ($EXPENSIVE_CHECKS eq "yes") {
223 $opts = "-D_GLIBCXX_DEBUG -I$INCLUDEDIR $CPPFLAGS";
224 }
225 else {
226 $opts = "-I$INCLUDEDIR $CPPFLAGS";
227 }
228
229 return $opts;
230 }
231
207232 # Use -lfoo instead of libfoo.a whenever possible, and add directories to
208233 # files which can't be found using -L.
209234 sub fix_library_names (@) {