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
|
|
|
AC_CHECK_LIB(util, kinfo_getvmmap)
|
|
|
|
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"
|
|
|
|
if test x$enable_debug = xyes; then
|
|
|
|
CPPFLAGS="${CPPFLAGS} -DDEBUG"
|
|
|
|
else
|
|
|
|
CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
|
|
|
fi
|
|
|
|
|
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-04-04 11:39:28 +02:00
|
|
|
AC_DEFUN([AC_CHECK_PTRACE_DECL],
|
|
|
|
[for pxxx in $1; do
|
|
|
|
AC_CHECK_DECLS($pxxx, [], [],
|
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-04-04 11:39:28 +02:00
|
|
|
done]
|
|
|
|
)
|
|
|
|
|
|
|
|
AC_CHECK_PTRACE_DECL([PTRACE_POKEUSER PTRACE_POKEDATA PTRACE_CONT \
|
|
|
|
PTRACE_TRACEME PTRACE_CONT PTRACE_SIGNLESTEP PTRACE_SYSCALL PT_IO PT_GETREGS \
|
|
|
|
PT_GETFPREGS PT_CONTINUE PT_TRACE_ME PT_STEP PT_SYSCALL])
|
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 \
|
|
|
|
ttrace)
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
use_altivec=`is_gcc_altivec`
|
|
|
|
AM_CONDITIONAL(USE_ALTIVEC, test x$use_altivec = xhas_altivec)
|
|
|
|
|
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`
|
|
|
|
|
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
|
|
|
|
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
|
|
|
|
|
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"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_ARG_ENABLE(debug,
|
|
|
|
[ --enable-debug turn on debug support (slows down execution)],
|
|
|
|
[enable_debug=yes], [])
|
|
|
|
|
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
|
|
|
if test x$enable_cxx_exceptions = xyes; then
|
|
|
|
AC_MSG_NOTICE([Enabling C++ exception support])
|
|
|
|
fi
|
|
|
|
AM_CONDITIONAL([SUPPORT_CXX_EXCEPTIONS], [test x$enable_cxx_exceptions = xyes])
|
|
|
|
|
2009-03-17 05:21:58 +01:00
|
|
|
AC_ARG_ENABLE(debug_frame,
|
|
|
|
[ --enable-debug-frame Load the ".debug_frame" section if available],
|
2009-03-18 03:08:58 +01:00
|
|
|
[enable_debug_frame=$enableval], [enable_debug_frame=no])
|
|
|
|
if test x$enable_debug_frame = xyes; then
|
|
|
|
AC_DEFINE([CONFIG_DEBUG_FRAME], [], [Enable Debug Frame])
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2002-11-09 08:59:02 +01:00
|
|
|
LIBUNWIND___THREAD
|
|
|
|
|
2004-04-20 18:53:44 +02:00
|
|
|
save_LDFLAGS="$LDFLAGS"
|
|
|
|
LDFLAGS="$LDFLAGS -static-libcxa"
|
|
|
|
AC_TRY_LINK([], [], [have_static_libcxa=yes])
|
|
|
|
LDFLAGS="$save_LDFLAGS"
|
|
|
|
if test "x$have_static_libcxa" = xyes; then
|
|
|
|
LDFLAGS_STATIC_LIBCXA="-XCClinker -static-libcxa"
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_TRY_COMPILE([], [#ifndef __INTEL_COMPILER
|
|
|
|
#error choke me
|
|
|
|
#endif], [intel_compiler=yes])
|
|
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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-03-07 11:46:05 +01:00
|
|
|
AC_SUBST(DLLIB)
|
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
|