llvm.org GIT mirror llvm / c69bdad
Add an --enable-backtraces option to configure to determine whether or not we want to print out backtrace information. Useful for libraries that don't need backtrace information on a crash. rdar://11844710 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164426 91177308-0d34-0410-b5e6-96231b3b80d8 Eric Christopher 8 years ago
4 changed file(s) with 47 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
677677 AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS,
678678 [Define if timestamp information (e.g., __DATE__) is allowed])
679679
680 dnl Enable embedding timestamp information into build.
681
682 AC_ARG_ENABLE(backtraces,
683 AS_HELP_STRING([--enable-backtraces],
684 [Enable embedding backtraces on crash (default is YES)]),,
685 enableval=default)
686 case "$enableval" in
687 yes) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
688 no) AC_SUBST(ENABLE_TIMESTAMPS,[0]) ;;
689 default) AC_SUBST(ENABLE_TIMESTAMPS,[1]) ;;
690 *) AC_MSG_ERROR([Invalid setting for --enable-backtraces. Use "yes" or "no"]) ;;
691 esac
692 AC_DEFINE_UNQUOTED([ENABLE_BACKTRACES],$ENABLE_BACKTRACES,
693 [Define if you want backtraces on crash])
694
680695 dnl Allow specific targets to be specified for building (or not)
681696 TARGETS_TO_BUILD=""
682697 AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
14221422 Win32 DLL (default is NO)
14231423 --enable-timestamps Enable embedding timestamp information in build
14241424 (default is YES)
1425 --enable-backtraces Enable embedding backtraces on crash (default is
1426 YES)
14251427 --enable-targets Build specific host targets: all or
14261428 target1,target2,... Valid targets are: host, x86,
14271429 x86_64, sparc, powerpc, arm, mips, spu, hexagon,
53815383 _ACEOF
53825384
53835385
5386
5387 # Check whether --enable-backtraces was given.
5388 if test "${enable_backtraces+set}" = set; then
5389 enableval=$enable_backtraces;
5390 else
5391 enableval=default
5392 fi
5393
5394 case "$enableval" in
5395 yes) ENABLE_TIMESTAMPS=1
5396 ;;
5397 no) ENABLE_TIMESTAMPS=0
5398 ;;
5399 default) ENABLE_TIMESTAMPS=1
5400 ;;
5401 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&5
5402 echo "$as_me: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&2;}
5403 { (exit 1); exit 1; }; } ;;
5404 esac
5405
5406 cat >>confdefs.h <<_ACEOF
5407 #define ENABLE_BACKTRACES $ENABLE_BACKTRACES
5408 _ACEOF
5409
5410
53845411 TARGETS_TO_BUILD=""
53855412 # Check whether --enable-targets was given.
53865413 if test "${enable_targets+set}" = set; then
1028810315 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1028910316 lt_status=$lt_dlunknown
1029010317 cat > conftest.$ac_ext <
10291 #line 10292 "configure"
10318 #line 10319 "configure"
1029210319 #include "confdefs.h"
1029310320
1029410321 #if HAVE_DLFCN_H
1616
1717 /* Default to all compiler invocations for --sysroot=. */
1818 #undef DEFAULT_SYSROOT
19
20 /* Define if you want backtraces on crash */
21 #undef ENABLE_BACKTRACES
1922
2023 /* Define if position independent code is enabled */
2124 #undef ENABLE_PIC
242242 // On glibc systems we have the 'backtrace' function, which works nicely, but
243243 // doesn't demangle symbols.
244244 static void PrintStackTrace(void *) {
245 #ifdef HAVE_BACKTRACE
245 #if defined(HAVE_BACKTRACE) && defined(ENABLE_BACKTRACE)
246246 static void* StackTrace[256];
247247 // Use backtrace() to output a backtrace on Linux systems with glibc.
248248 int depth = backtrace(StackTrace,