2004-09-08 19:36:28 +02:00
|
|
|
define(pkg_major, 0)
|
2005-05-03 11:13:17 +02:00
|
|
|
define(pkg_minor, 99)
|
2009-03-18 23:33:27 +01:00
|
|
|
define(pkg_extra, -beta)
|
2007-11-15 00:47:28 +01:00
|
|
|
define(pkg_maintainer, libunwind-devel@nongnu.org)
|
2004-09-08 19:36:28 +02:00
|
|
|
define(mkvers, $1.$2$3)
|
2002-02-28 17:24:48 +01:00
|
|
|
dnl Process this file with autoconf to produce a configure script.
|
2004-09-08 19:36:28 +02:00
|
|
|
AC_INIT(libunwind, mkvers(pkg_major, pkg_minor, pkg_extra), pkg_maintainer)
|
2004-03-30 03:56:19 +02:00
|
|
|
AC_CONFIG_SRCDIR(src/mi/backtrace.c)
|
2004-07-15 19:39:59 +02:00
|
|
|
AC_CONFIG_AUX_DIR(config)
|
2002-02-28 17:24:48 +01:00
|
|
|
AC_CANONICAL_SYSTEM
|
2004-08-17 17:34:28 +02:00
|
|
|
AM_INIT_AUTOMAKE([1.6 subdir-objects])
|
2002-02-28 17:24:48 +01:00
|
|
|
AM_MAINTAINER_MODE
|
|
|
|
AM_CONFIG_HEADER(include/config.h)
|
|
|
|
|
|
|
|
dnl Checks for programs.
|
|
|
|
AC_PROG_CC
|
2003-03-28 08:43:22 +01:00
|
|
|
AC_PROG_CXX
|
2002-02-28 17:24:48 +01:00
|
|
|
AC_PROG_INSTALL
|
|
|
|
AC_PROG_MAKE_SET
|
|
|
|
AM_PROG_LIBTOOL
|
2003-02-14 04:09:27 +01:00
|
|
|
AM_PROG_AS
|
2004-08-17 17:34:28 +02:00
|
|
|
AM_PROG_CC_C_O
|
2002-02-28 17:24:48 +01:00
|
|
|
|
|
|
|
dnl Checks for libraries.
|
2003-04-03 09:59:15 +02:00
|
|
|
AC_CHECK_LIB(uca, __uc_get_grs)
|
2010-03-07 11:46:05 +01:00
|
|
|
OLD_LIBS=${LIBS}
|
2010-03-31 22:01:46 +02:00
|
|
|
AC_SEARCH_LIBS(dlopen, dl)
|
2010-03-07 11:46:05 +01:00
|
|
|
LIBS=${OLD_LIBS}
|
|
|
|
case "$ac_cv_search_dlopen" in
|
|
|
|
-l*) DLLIB=$ac_cv_search_dlopen;;
|
|
|
|
*) DLLIB="";;
|
|
|
|
esac
|
|
|
|
|
2003-11-24 22:37:22 +01:00
|
|
|
CHECK_ATOMIC_OPS
|
2002-02-28 17:24:48 +01:00
|
|
|
|
|
|
|
dnl Checks for header files.
|
|
|
|
AC_HEADER_STDC
|
2010-03-05 23:41:37 +01:00
|
|
|
AC_CHECK_HEADERS(asm/ptrace_offsets.h endian.h sys/endian.h execinfo.h \
|
2010-03-06 13:55:11 +01:00
|
|
|
ia64intrin.h sys/uc_access.h unistd.h signal.h sys/types.h \
|
2010-04-04 10:57:57 +02:00
|
|
|
sys/procfs.h)
|
2002-02-28 17:24:48 +01:00
|
|
|
|
|
|
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
|
|
|
AC_C_CONST
|
|
|
|
AC_C_INLINE
|
2003-03-19 20:25:18 +01:00
|
|
|
AC_TYPE_SIGNAL
|
2002-02-28 17:24:48 +01:00
|
|
|
AC_TYPE_SIZE_T
|
|
|
|
|
2003-09-25 07:29:14 +02:00
|
|
|
CPPFLAGS="${CPPFLAGS} -D_GNU_SOURCE"
|
|
|
|
|
2004-01-24 07:45:18 +01:00
|
|
|
AC_CHECK_MEMBERS([struct dl_phdr_info.dlpi_subs],,,[#include <link.h>])
|
2003-09-25 07:29:14 +02:00
|
|
|
AC_CHECK_TYPES([sighandler_t], [], [],
|
|
|
|
[$ac_includes_default
|
|
|
|
#if HAVE_SIGNAL_H
|
|
|
|
# include <signal.h>
|
|
|
|
#endif
|
|
|
|
])
|
2003-03-19 20:25:18 +01:00
|
|
|
|
2010-10-29 01:25:47 +02:00
|
|
|
AC_CHECK_DECLS([PTRACE_POKEUSER, PTRACE_POKEDATA,
|
2010-10-25 18:52:55 +02:00
|
|
|
PTRACE_TRACEME, PTRACE_CONT, PTRACE_SINGLESTEP,
|
2010-04-05 22:19:03 +02:00
|
|
|
PTRACE_SYSCALL, PT_IO, PT_GETREGS,
|
|
|
|
PT_GETFPREGS, PT_CONTINUE, PT_TRACE_ME,
|
|
|
|
PT_STEP, PT_SYSCALL], [], [],
|
2010-03-07 23:50:50 +01:00
|
|
|
[$ac_includes_default
|
|
|
|
#if HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#include <sys/ptrace.h>
|
|
|
|
])
|
2010-03-06 13:55:11 +01:00
|
|
|
|
2002-02-28 17:24:48 +01:00
|
|
|
dnl Checks for library functions.
|
|
|
|
AC_FUNC_MEMCMP
|
|
|
|
AC_TYPE_SIGNAL
|
2004-04-20 18:53:44 +02:00
|
|
|
AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \
|
2010-04-20 16:45:18 +02:00
|
|
|
ttrace mincore)
|
2007-08-02 17:59:43 +02:00
|
|
|
is_gcc_m64() {
|
|
|
|
if test `echo $CFLAGS | grep "\-m64" -c` -eq 1 ; then echo ppc64;
|
|
|
|
else
|
|
|
|
if test `echo $CC | grep "\-m64" -c` -eq 1 ; then echo ppc64; else echo ppc32; fi;
|
|
|
|
fi;
|
|
|
|
}
|
2002-02-28 17:24:48 +01:00
|
|
|
|
2007-08-07 04:23:42 +02:00
|
|
|
is_gcc_altivec() {
|
|
|
|
if test `echo $CFLAGS | grep "\-maltivec" -c` -eq 1 ; then echo has_altivec;
|
|
|
|
else
|
|
|
|
if test `echo $CC | grep "\-maltivec" -c` -eq 1 ; then echo has_altivec; else echo no_altivec; fi;
|
|
|
|
fi;
|
|
|
|
}
|
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([if building with AltiVec])
|
2007-08-07 04:23:42 +02:00
|
|
|
use_altivec=`is_gcc_altivec`
|
|
|
|
AM_CONDITIONAL(USE_ALTIVEC, test x$use_altivec = xhas_altivec)
|
2010-10-29 01:25:49 +02:00
|
|
|
if test x$use_altivec = xhas_altivec; then
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
2007-08-07 04:23:42 +02:00
|
|
|
|
2002-02-28 17:24:48 +01:00
|
|
|
get_arch() {
|
|
|
|
case "$1" in
|
2008-02-05 01:16:37 +01:00
|
|
|
arm*) echo arm;;
|
2002-02-28 17:24:48 +01:00
|
|
|
i?86) echo x86;;
|
2003-01-14 08:11:56 +01:00
|
|
|
hppa*) echo hppa;;
|
2008-02-05 01:16:37 +01:00
|
|
|
mips*) echo mips;;
|
2009-04-13 20:44:45 +02:00
|
|
|
powerpc*) is_gcc_m64;;
|
2010-03-05 23:41:37 +01:00
|
|
|
amd64) echo x86_64;;
|
2002-12-19 08:16:50 +01:00
|
|
|
*) echo $1;;
|
2002-02-28 17:24:48 +01:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
build_arch=`get_arch $build_cpu`
|
2008-02-05 01:16:37 +01:00
|
|
|
host_arch=`get_arch $host_cpu`
|
2002-02-28 17:24:48 +01:00
|
|
|
target_arch=`get_arch $target_cpu`
|
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([for build architecture])
|
|
|
|
AC_MSG_RESULT([$build_arch])
|
|
|
|
AC_MSG_CHECKING([for host architecture])
|
|
|
|
AC_MSG_RESULT([$host_arch])
|
|
|
|
AC_MSG_CHECKING([for target architecture])
|
|
|
|
AC_MSG_RESULT([$target_arch])
|
|
|
|
AC_MSG_CHECKING([for target operating system])
|
|
|
|
AC_MSG_RESULT([$target_os])
|
|
|
|
|
2008-02-05 01:16:37 +01:00
|
|
|
AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch)
|
|
|
|
AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm)
|
2003-01-16 04:10:11 +01:00
|
|
|
AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64)
|
|
|
|
AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa)
|
2008-02-05 01:16:37 +01:00
|
|
|
AM_CONDITIONAL(ARCH_MIPS, test x$target_arch = xmips)
|
2003-01-16 04:10:11 +01:00
|
|
|
AM_CONDITIONAL(ARCH_X86, test x$target_arch = xx86)
|
2004-08-19 15:39:10 +02:00
|
|
|
AM_CONDITIONAL(ARCH_X86_64, test x$target_arch = xx86_64)
|
2007-08-02 17:59:43 +02:00
|
|
|
AM_CONDITIONAL(ARCH_PPC32, test x$target_arch = xppc32)
|
|
|
|
AM_CONDITIONAL(ARCH_PPC64, test x$target_arch = xppc64)
|
2003-02-08 11:10:59 +01:00
|
|
|
AM_CONDITIONAL(OS_LINUX, expr x$target_os : xlinux >/dev/null)
|
2003-04-03 09:59:15 +02:00
|
|
|
AM_CONDITIONAL(OS_HPUX, expr x$target_os : xhpux >/dev/null)
|
2010-03-05 23:41:37 +01:00
|
|
|
AM_CONDITIONAL(OS_FREEBSD, expr x$target_os : xfreebsd >/dev/null)
|
2002-02-28 17:24:48 +01:00
|
|
|
|
2010-11-09 02:16:40 +01:00
|
|
|
AC_MSG_CHECKING([for ELF helper width])
|
|
|
|
case "${target_arch}" in
|
|
|
|
(arm|hppa|ppc32|x86) use_elf32=yes; AC_MSG_RESULT([32]);;
|
|
|
|
(ia64|ppc64|x86_64) use_elf64=yes; AC_MSG_RESULT([64]);;
|
|
|
|
(mips) use_elfxx=yes; AC_MSG_RESULT([xx]);;
|
|
|
|
*) AC_MSG_ERROR([Unknown ELF target: ${target_arch}])
|
|
|
|
esac
|
|
|
|
AM_CONDITIONAL(USE_ELF32, [test x$use_elf32 = xyes])
|
|
|
|
AM_CONDITIONAL(USE_ELF64, [test x$use_elf64 = xyes])
|
|
|
|
AM_CONDITIONAL(USE_ELFXX, [test x$use_elfxx = xyes])
|
|
|
|
|
2010-11-09 02:16:38 +01:00
|
|
|
AC_MSG_CHECKING([whether to include DWARF support])
|
|
|
|
if test x$target_arch != xia64; then
|
|
|
|
use_dwarf=yes
|
|
|
|
else
|
|
|
|
use_dwarf=no
|
|
|
|
fi
|
|
|
|
AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes])
|
|
|
|
AC_MSG_RESULT([$use_dwarf])
|
|
|
|
|
2007-09-20 19:11:37 +02:00
|
|
|
if test x$target_arch = xppc64; then
|
|
|
|
libdir='${exec_prefix}/lib64'
|
|
|
|
AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]);
|
|
|
|
AC_SUBST([libdir])
|
|
|
|
fi
|
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([whether to restrict build to remote support])
|
2008-02-05 01:16:37 +01:00
|
|
|
if test x$target_arch != x$host_arch; then
|
2002-02-28 17:24:48 +01:00
|
|
|
CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
|
2010-10-29 01:25:49 +02:00
|
|
|
remote_only=yes
|
|
|
|
else
|
|
|
|
remote_only=no
|
2002-02-28 17:24:48 +01:00
|
|
|
fi
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_RESULT([$remote_only])
|
2002-02-28 17:24:48 +01:00
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([whether to enable debug support])
|
2002-02-28 17:24:48 +01:00
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
[ --enable-debug turn on debug support (slows down execution)],
|
2010-10-29 01:25:49 +02:00
|
|
|
[enable_debug=yes], [enable_debug=no])
|
|
|
|
if test x$enable_debug = xyes; then
|
|
|
|
CPPFLAGS="${CPPFLAGS} -DDEBUG"
|
|
|
|
else
|
|
|
|
CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$enable_debug])
|
2002-02-28 17:24:48 +01:00
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([whether to enable C++ exception support])
|
2008-06-16 22:28:36 +02:00
|
|
|
AC_ARG_ENABLE(cxx_exceptions,
|
|
|
|
[ --enable-cxx-exceptions use libunwind to handle C++ exceptions],
|
2009-03-17 05:57:08 +01:00
|
|
|
[enable_cxx_exceptions=$enableval],
|
|
|
|
[
|
|
|
|
# C++ exception handling doesn't work too well on x86
|
|
|
|
case $target_arch in
|
|
|
|
x86*) enable_cxx_exceptions=no;;
|
2009-04-03 00:49:37 +02:00
|
|
|
arm*) enable_cxx_exceptions=no;;
|
|
|
|
mips*) enable_cxx_exceptions=no;;
|
2009-03-17 05:57:08 +01:00
|
|
|
*) enable_cxx_exceptions=yes;;
|
|
|
|
esac
|
|
|
|
])
|
|
|
|
|
2008-06-16 22:28:36 +02:00
|
|
|
AM_CONDITIONAL([SUPPORT_CXX_EXCEPTIONS], [test x$enable_cxx_exceptions = xyes])
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_RESULT([$enable_cxx_exceptions])
|
2008-06-16 22:28:36 +02:00
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([whether to load .debug_frame sections])
|
2009-03-17 05:21:58 +01:00
|
|
|
AC_ARG_ENABLE(debug_frame,
|
|
|
|
[ --enable-debug-frame Load the ".debug_frame" section if available],
|
2010-10-29 01:25:50 +02:00
|
|
|
[enable_debug_frame=$enableval], [
|
|
|
|
case "${target_arch}" in
|
|
|
|
(arm) enable_debug_frame=yes;;
|
|
|
|
(*) enable_debug_frame=no;;
|
|
|
|
esac])
|
2009-03-18 03:08:58 +01:00
|
|
|
if test x$enable_debug_frame = xyes; then
|
|
|
|
AC_DEFINE([CONFIG_DEBUG_FRAME], [], [Enable Debug Frame])
|
|
|
|
fi
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_RESULT([$enable_debug_frame])
|
2009-03-18 03:08:58 +01:00
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([whether to block signals during mutex ops])
|
2009-09-21 22:04:33 +02:00
|
|
|
AC_ARG_ENABLE(block_signals,
|
|
|
|
[ --enable-block-signals Block signals before performing mutex operations],
|
|
|
|
[enable_block_signals=$enableval], [enable_block_signals=yes])
|
|
|
|
if test x$enable_block_signals = xyes; then
|
|
|
|
AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations])
|
|
|
|
fi
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_RESULT([$enable_block_signals])
|
2009-09-21 22:04:33 +02:00
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([whether to validate memory addresses before use])
|
2010-04-25 04:24:49 +02:00
|
|
|
AC_ARG_ENABLE(conservative_checks,
|
|
|
|
[ --enable-conservative-checks Validate all memory addresses before use],
|
|
|
|
[enable_conservative_checks=$enableval], [enable_conservative_checks=yes])
|
|
|
|
if test x$enable_conservative_checks = xyes; then
|
2011-03-22 11:30:21 +01:00
|
|
|
AC_DEFINE(CONSERVATIVE_CHECKS, 1,
|
|
|
|
[Define to 1 if you want every memory access validated])
|
2010-04-25 04:24:49 +02:00
|
|
|
fi
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_RESULT([$enable_conservative_checks])
|
2009-09-21 22:04:33 +02:00
|
|
|
|
2002-11-09 08:59:02 +01:00
|
|
|
LIBUNWIND___THREAD
|
|
|
|
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_CHECKING([for Intel compiler])
|
2004-04-20 18:53:44 +02:00
|
|
|
AC_TRY_COMPILE([], [#ifndef __INTEL_COMPILER
|
|
|
|
#error choke me
|
2010-10-29 01:25:49 +02:00
|
|
|
#endif], [intel_compiler=yes], [intel_compiler=no])
|
2004-04-20 18:53:44 +02:00
|
|
|
|
|
|
|
if test x$GCC = xyes -a x$intel_compiler != xyes; then
|
2005-05-03 11:13:17 +02:00
|
|
|
CFLAGS="${CFLAGS} -fexceptions -Wall -Wsign-compare"
|
2004-11-05 01:27:40 +01:00
|
|
|
LIBCRTS="-lgcc"
|
2002-07-18 05:58:34 +02:00
|
|
|
fi
|
2010-10-29 01:25:49 +02:00
|
|
|
AC_MSG_RESULT([$intel_compiler])
|
2002-07-18 05:58:34 +02:00
|
|
|
|
2010-11-09 02:16:33 +01:00
|
|
|
if test x$intel_compiler = xyes; then
|
|
|
|
AC_MSG_CHECKING([if linker supports -static-libcxa])
|
|
|
|
save_LDFLAGS="$LDFLAGS"
|
|
|
|
LDFLAGS="$LDFLAGS -static-libcxa"
|
|
|
|
AC_TRY_LINK([], [], [have_static_libcxa=yes], [have_static_libcxa=no])
|
|
|
|
LDFLAGS="$save_LDFLAGS"
|
|
|
|
if test "x$have_static_libcxa" = xyes; then
|
|
|
|
LDFLAGS_STATIC_LIBCXA="-XCClinker -static-libcxa"
|
|
|
|
fi
|
|
|
|
AC_MSG_RESULT([$have_static_libcxa])
|
|
|
|
fi
|
|
|
|
|
2003-02-14 04:09:27 +01:00
|
|
|
CCASFLAGS="${CCASFLAGS} ${CPPFLAGS}"
|
|
|
|
|
2002-04-06 01:37:55 +02:00
|
|
|
arch="$target_arch"
|
2002-02-28 17:24:48 +01:00
|
|
|
ARCH=`echo $target_arch | tr [a-z] [A-Z]`
|
|
|
|
|
2004-09-08 19:36:28 +02:00
|
|
|
dnl create shell variables from the M4 macros:
|
|
|
|
PKG_MAJOR=pkg_major
|
|
|
|
PKG_MINOR=pkg_minor
|
|
|
|
PKG_EXTRA=pkg_extra
|
|
|
|
PKG_MAINTAINER=pkg_maintainer
|
|
|
|
|
2011-03-22 20:29:40 +01:00
|
|
|
old_LIBS="$LIBS"
|
|
|
|
LIBS=""
|
|
|
|
AC_SEARCH_LIBS(backtrace, execinfo)
|
|
|
|
BACKTRACELIB="$LIBS"
|
|
|
|
LIBS="$old_LIBS"
|
|
|
|
|
2004-05-05 03:58:44 +02:00
|
|
|
AC_SUBST(build_arch)
|
|
|
|
AC_SUBST(target_os)
|
2002-04-06 01:37:55 +02:00
|
|
|
AC_SUBST(arch)
|
2002-02-28 17:24:48 +01:00
|
|
|
AC_SUBST(ARCH)
|
2004-04-20 18:53:44 +02:00
|
|
|
AC_SUBST(LDFLAGS_STATIC_LIBCXA)
|
2004-11-03 22:50:24 +01:00
|
|
|
AC_SUBST(LIBCRTS)
|
2004-09-08 19:36:28 +02:00
|
|
|
AC_SUBST(PKG_MAJOR)
|
|
|
|
AC_SUBST(PKG_MINOR)
|
|
|
|
AC_SUBST(PKG_EXTRA)
|
|
|
|
AC_SUBST(PKG_MAINTAINER)
|
2009-03-16 04:01:23 +01:00
|
|
|
AC_SUBST(enable_cxx_exceptions)
|
2010-05-27 04:21:30 +02:00
|
|
|
AC_SUBST(enable_debug_frame)
|
2010-03-07 11:46:05 +01:00
|
|
|
AC_SUBST(DLLIB)
|
2011-03-22 20:29:40 +01:00
|
|
|
AC_SUBST(BACKTRACELIB)
|
2003-01-17 08:48:52 +01:00
|
|
|
|
2004-05-05 03:58:44 +02:00
|
|
|
AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile tests/check-namespace.sh
|
2004-09-08 19:36:28 +02:00
|
|
|
doc/Makefile doc/common.tex include/libunwind-common.h)
|
2003-01-17 08:48:52 +01:00
|
|
|
AC_OUTPUT
|