From abb0957198be8cb34c4dfa0dfd7e7eee13055f09 Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Mon, 15 Apr 2013 09:44:48 -0500 Subject: [PATCH] Added --enable-ptrace This change adds a manual override to control building of the ptrace library, similar to the existing --enable-coredump option. The default is set based on the existence of sys/ptrace.h, allowing it to be automatically disabled for platforms that do not have ptrace. --- configure.ac | 9 +++++++++ src/Makefile.am | 12 +++++++++--- tests/Makefile.am | 14 +++++++++----- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 7d549aac..b68c1c22 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,14 @@ AC_ARG_ENABLE(coredump, AC_MSG_CHECKING([if we should build libunwind-coredump]) AC_MSG_RESULT([$enable_coredump]) +AC_ARG_ENABLE(ptrace, + AS_HELP_STRING([--enable-ptrace],[building libunwind-ptrace library]),, + [AC_CHECK_HEADER([sys/ptrace.h], [enable_ptrace=yes], [enable_ptrace=no])] +) + +AC_MSG_CHECKING([if we should build libunwind-ptrace]) +AC_MSG_RESULT([$enable_ptrace]) + AC_MSG_CHECKING([for build architecture]) AC_MSG_RESULT([$build_arch]) AC_MSG_CHECKING([for host architecture]) @@ -120,6 +128,7 @@ AC_MSG_CHECKING([for target operating system]) AC_MSG_RESULT([$target_os]) AM_CONDITIONAL(BUILD_COREDUMP, test x$enable_coredump = xyes) +AM_CONDITIONAL(BUILD_PTRACE, test x$enable_ptrace = xyes) AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch) AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm) AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64) diff --git a/src/Makefile.am b/src/Makefile.am index adfbef36..5bc4b3e0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,7 +9,10 @@ COMMON_SO_LDFLAGS = -XCClinker -nostartfiles lib_LIBRARIES = lib_LTLIBRARIES = if !REMOTE_ONLY -lib_LTLIBRARIES += libunwind.la libunwind-ptrace.la +lib_LTLIBRARIES += libunwind.la +if BUILD_PTRACE +lib_LTLIBRARIES += libunwind-ptrace.la +endif if BUILD_COREDUMP lib_LTLIBRARIES += libunwind-coredump.la endif @@ -22,8 +25,11 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libunwind-generic.pc if !REMOTE_ONLY -pkgconfig_DATA += unwind/libunwind.pc ptrace/libunwind-ptrace.pc \ - setjmp/libunwind-setjmp.pc +pkgconfig_DATA += unwind/libunwind.pc setjmp/libunwind-setjmp.pc +endif + +if BUILD_PTRACE +pkgconfig_DATA += ptrace/libunwind-ptrace.pc endif if BUILD_COREDUMP diff --git a/tests/Makefile.am b/tests/Makefile.am index a7700622..fc5529d9 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -36,7 +36,7 @@ if USE_ALTIVEC endif #USE_ALTIVEC endif #ARCH_PPC64 endif #!ARCH_IA64 - check_SCRIPTS_cdep = run-ptrace-mapper run-ptrace-misc + check_SCRIPTS_cdep = check_PROGRAMS_cdep = Gtest-bt Ltest-bt Gtest-exc Ltest-exc \ Gtest-init Ltest-init \ Gtest-concurrent Ltest-concurrent \ @@ -45,12 +45,16 @@ endif #!ARCH_IA64 Gtest-dyn1 Ltest-dyn1 \ Gtest-trace Ltest-trace \ test-async-sig test-flush-cache test-init-remote \ - test-mem test-setjmp test-ptrace Ltest-varargs \ + test-mem test-setjmp Ltest-varargs \ Ltest-nomalloc Ltest-nocalloc Lrs-race - noinst_PROGRAMS_cdep = forker crasher mapper test-ptrace-misc \ - Gperf-simple Lperf-simple + noinst_PROGRAMS_cdep = forker crasher Gperf-simple Lperf-simple \ + Gperf-trace Lperf-trace - noinst_PROGRAMS_cdep += Gperf-trace Lperf-trace +if BUILD_PTRACE + check_SCRIPTS_cdep += run-ptrace-mapper run-ptrace-misc + check_PROGRAMS_cdep += test-ptrace + noinst_PROGRAMS_cdep += mapper test-ptrace-misc +endif if SUPPORT_CXX_EXCEPTIONS check_PROGRAMS_cdep += Ltest-cxx-exceptions