llvm.org GIT mirror llvm / e179b31
[conf] Add config variable to disable crash related overrides. - We do some nasty things w.r.t. installing or overriding signal handlers in order to improve our crash recovery support or interaction with crash reporting software, and those things are not necessarily appropriate when LLVM is being linked into a client application that has its own ideas about how to do things. This gives those clients a way to disable that handling at build time. - Currently, the code this guards is all Apple specific, but other platforms might have the same concerns so I went for a more generic configure name. Someone who is more familiar with library embedding on Windows can handle choosing which of the Windows/Signals.inc behaviors might make sense to go under this flag. - This also fixes the proper autoconf'ing of ENABLE_BACKTRACES. The code expects it to be undefined when disabled, but the autoconf check was just defining it to 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189694 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Dunbar 7 years ago
6 changed file(s) with 86 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
138138 set(ENABLE_BACKTRACES 1)
139139 endif()
140140
141 option(LLVM_ENABLE_CRASH_OVERRIDES "Enable crash overrides." ON)
142 if(LLVM_ENABLE_CRASH_OVERRIDES)
143 set(ENABLE_CRASH_OVERRIDES 1)
144 endif()
145
141146 option(LLVM_ENABLE_FFI "Use libffi to call external functions from the interpreter" OFF)
142147 set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so")
143148 set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h")
799799 AC_DEFINE_UNQUOTED([ENABLE_TIMESTAMPS],$ENABLE_TIMESTAMPS,
800800 [Define if timestamp information (e.g., __DATE__) is allowed])
801801
802 dnl Enable embedding timestamp information into build.
803
804 AC_ARG_ENABLE(backtraces,
805 AS_HELP_STRING([--enable-backtraces],
806 [Enable embedding backtraces on crash (default is YES)]),,
807 enableval=default)
808 case "$enableval" in
809 yes) AC_SUBST(ENABLE_BACKTRACES,[1]) ;;
810 no) AC_SUBST(ENABLE_BACKTRACES,[0]) ;;
811 default) AC_SUBST(ENABLE_BACKTRACES,[1]) ;;
812 *) AC_MSG_ERROR([Invalid setting for --enable-backtraces. Use "yes" or "no"]) ;;
813 esac
814 AC_DEFINE_UNQUOTED([ENABLE_BACKTRACES],$ENABLE_BACKTRACES,
815 [Define if you want backtraces on crash])
802 dnl Enable support for showing backtraces.
803 AC_ARG_ENABLE(backtraces, AS_HELP_STRING(
804 [--enable-backtraces],
805 [Enable embedding backtraces on crash (default is YES)]),
806 [case "$enableval" in
807 yes) llvm_cv_enable_backtraces="yes" ;;
808 no) llvm_cv_enable_backtraces="no" ;;
809 *) AC_MSG_ERROR([Invalid setting for --enable-backtraces. Use "yes" or "no"]) ;;
810 esac],
811 llvm_cv_enable_backtraces="yes")
812 if test "$llvm_cv_enable_backtraces" = "yes" ; then
813 AC_DEFINE([ENABLE_BACKTRACES],[1],
814 [Define if you want backtraces on crash])
815 fi
816
817 dnl Enable installing platform specific signal handling overrides, for improved
818 dnl CrashRecovery support or interaction with crash reporting software. This
819 dnl support may be inappropriate for some clients embedding LLVM as a library.
820 AC_ARG_ENABLE(crash-overrides, AS_HELP_STRING(
821 [--enable-crash-overrides],
822 [Enable crash handling overrides (default is YES)]),
823 [case "$enableval" in
824 yes) llvm_cv_enable_crash_overrides="yes" ;;
825 no) llvm_cv_enable_crash_overrides="no" ;;
826 *) AC_MSG_ERROR([Invalid setting for --enable-crash-overrides. Use "yes" or "no"]) ;;
827 esac],
828 llvm_cv_enable_crash_overrides="yes")
829 if test "$llvm_cv_enable_crash_overrides" = "yes" ; then
830 AC_DEFINE([ENABLE_CRASH_OVERRIDES],[1],
831 [Define to enable crash handling overrides])
832 fi
816833
817834 dnl Allow specific targets to be specified for building (or not)
818835 TARGETS_TO_BUILD=""
708708 ENABLE_SHARED
709709 ENABLE_EMBED_STDCXX
710710 ENABLE_TIMESTAMPS
711 ENABLE_BACKTRACES
712711 TARGETS_TO_BUILD
713712 LLVM_ENUM_TARGETS
714713 LLVM_ENUM_ASM_PRINTERS
14421441 (default is YES)
14431442 --enable-backtraces Enable embedding backtraces on crash (default is
14441443 YES)
1444 --enable-crash-overrides
1445 Enable crash handling overrides (default is YES)
14451446 --enable-targets Build specific host targets: all or
14461447 target1,target2,... Valid targets are: host, x86,
14471448 x86_64, sparc, powerpc, arm, aarch64, mips, hexagon,
56315632 _ACEOF
56325633
56335634
5634
56355635 # Check whether --enable-backtraces was given.
56365636 if test "${enable_backtraces+set}" = set; then
5637 enableval=$enable_backtraces;
5638 else
5639 enableval=default
5640 fi
5641
5642 case "$enableval" in
5643 yes) ENABLE_BACKTRACES=1
5644 ;;
5645 no) ENABLE_BACKTRACES=0
5646 ;;
5647 default) ENABLE_BACKTRACES=1
5648 ;;
5649 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&5
5637 enableval=$enable_backtraces; case "$enableval" in
5638 yes) llvm_cv_enable_backtraces="yes" ;;
5639 no) llvm_cv_enable_backtraces="no" ;;
5640 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&5
56505641 echo "$as_me: error: Invalid setting for --enable-backtraces. Use \"yes\" or \"no\"" >&2;}
56515642 { (exit 1); exit 1; }; } ;;
5652 esac
5653
5654 cat >>confdefs.h <<_ACEOF
5655 #define ENABLE_BACKTRACES $ENABLE_BACKTRACES
5656 _ACEOF
5657
5643 esac
5644 else
5645 llvm_cv_enable_backtraces="yes"
5646 fi
5647
5648 if test "$llvm_cv_enable_backtraces" = "yes" ; then
5649
5650 cat >>confdefs.h <<\_ACEOF
5651 #define ENABLE_BACKTRACES 1
5652 _ACEOF
5653
5654 fi
5655
5656 # Check whether --enable-crash-overrides was given.
5657 if test "${enable_crash_overrides+set}" = set; then
5658 enableval=$enable_crash_overrides; case "$enableval" in
5659 yes) llvm_cv_enable_crash_overrides="yes" ;;
5660 no) llvm_cv_enable_crash_overrides="no" ;;
5661 *) { { echo "$as_me:$LINENO: error: Invalid setting for --enable-crash-overrides. Use \"yes\" or \"no\"" >&5
5662 echo "$as_me: error: Invalid setting for --enable-crash-overrides. Use \"yes\" or \"no\"" >&2;}
5663 { (exit 1); exit 1; }; } ;;
5664 esac
5665 else
5666 llvm_cv_enable_crash_overrides="yes"
5667 fi
5668
5669 if test "$llvm_cv_enable_crash_overrides" = "yes" ; then
5670
5671 cat >>confdefs.h <<\_ACEOF
5672 #define ENABLE_CRASH_OVERRIDES 1
5673 _ACEOF
5674
5675 fi
56585676
56595677 TARGETS_TO_BUILD=""
56605678 # Check whether --enable-targets was given.
1056710585 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1056810586 lt_status=$lt_dlunknown
1056910587 cat > conftest.$ac_ext <
10570 #line 10571 "configure"
10588 #line 10589 "configure"
1057110589 #include "confdefs.h"
1057210590
1057310591 #if HAVE_DLFCN_H
2305423072 ENABLE_SHARED!$ENABLE_SHARED$ac_delim
2305523073 ENABLE_EMBED_STDCXX!$ENABLE_EMBED_STDCXX$ac_delim
2305623074 ENABLE_TIMESTAMPS!$ENABLE_TIMESTAMPS$ac_delim
23057 ENABLE_BACKTRACES!$ENABLE_BACKTRACES$ac_delim
2305823075 TARGETS_TO_BUILD!$TARGETS_TO_BUILD$ac_delim
2305923076 LLVM_ENUM_TARGETS!$LLVM_ENUM_TARGETS$ac_delim
2306023077 LLVM_ENUM_ASM_PRINTERS!$LLVM_ENUM_ASM_PRINTERS$ac_delim
2314123158 LLVM_CONFIGTIME!$LLVM_CONFIGTIME$ac_delim
2314223159 BINDINGS_TO_BUILD!$BINDINGS_TO_BUILD$ac_delim
2314323160 ALL_BINDINGS!$ALL_BINDINGS$ac_delim
23161 OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
2314423162 _ACEOF
2314523163
2314623164 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
2318223200 ac_delim='%!_!# '
2318323201 for ac_last_try in false false false false false :; do
2318423202 cat >conf$$subs.sed <<_ACEOF
23185 OCAML_LIBDIR!$OCAML_LIBDIR$ac_delim
2318623203 ENABLE_VISIBILITY_INLINES_HIDDEN!$ENABLE_VISIBILITY_INLINES_HIDDEN$ac_delim
2318723204 RPATH!$RPATH$ac_delim
2318823205 RDYNAMIC!$RDYNAMIC$ac_delim
2319123208 LTLIBOBJS!$LTLIBOBJS$ac_delim
2319223209 _ACEOF
2319323210
23194 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 7; then
23211 if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 6; then
2319523212 break
2319623213 elif $ac_last_try; then
2319723214 { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
1919
2020 /* Define if you want backtraces on crash */
2121 #cmakedefine ENABLE_BACKTRACES
22
23 /* Define to enable crash overrides */
24 #cmakedefine ENABLE_CRASH_OVERRIDES
2225
2326 /* Define if position independent code is enabled */
2427 #cmakedefine ENABLE_PIC
1919
2020 /* Define if you want backtraces on crash */
2121 #undef ENABLE_BACKTRACES
22
23 /* Define to enable crash handling overrides */
24 #undef ENABLE_CRASH_OVERRIDES
2225
2326 /* Define if position independent code is enabled */
2427 #undef ENABLE_PIC
332332 void llvm::sys::PrintStackTraceOnErrorSignal() {
333333 AddSignalHandler(PrintStackTraceSignalHandler, 0);
334334
335 #if defined(__APPLE__)
335 #if defined(__APPLE__) && defined(ENABLE_CRASH_OVERRIDES)
336336 // Environment variable to disable any kind of crash dialog.
337337 if (getenv("LLVM_DISABLE_CRASH_REPORT")) {
338338 mach_port_t self = mach_task_self();
358358 // the same linkage unit by just defining our own versions of the assert handler
359359 // and abort.
360360
361 #ifdef __APPLE__
361 #if defined(__APPLE__) && defined(ENABLE_CRASH_OVERRIDES)
362362
363363 #include
364364 #include