| Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 1 | # -*- Autoconf -*- |
| 2 | # Process this file with autoconf to produce a configure script. |
| Marc Kleine-Budde | 3a7d76d | 2010-02-04 18:54:58 +0100 | [diff] [blame] | 3 | AC_PREREQ(2.59) |
| Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 4 | |
| 5 | AC_INIT([ltrace],[0.5.3],[ltrace-devel <ltrace-devel@lists.alioth.debian.org>]) |
| 6 | AC_CONFIG_HEADERS([config.h]) |
| 7 | AC_CONFIG_SRCDIR(libltrace.c) |
| 8 | #AC_CONFIG_MACRO_DIR([config/m4]) |
| 9 | AC_CONFIG_AUX_DIR([config/autoconf]) |
| 10 | AC_CANONICAL_BUILD |
| 11 | AC_CANONICAL_HOST |
| 12 | |
| 13 | case "${host_os}" in |
| 14 | linux-gnu*) HOST_OS="linux-gnu" ;; |
| 15 | *) AC_MSG_ERROR([unkown host-os ${host_osx}]) ;; |
| 16 | esac |
| 17 | AC_SUBST(HOST_OS) |
| 18 | |
| 19 | case "${host_cpu}" in |
| 20 | arm*|sa110) HOST_CPU="arm" ;; |
| 21 | i?86) HOST_CPU="i386" ;; |
| 22 | powerpc|ppc64) HOST_CPU="ppc" ;; |
| 23 | sun4u|sparc64) HOST_CPU="sparc" ;; |
| 24 | s390x) HOST_CPU="s390" ;; |
| 25 | *) HOST_CPU="${host_cpu}" ;; |
| 26 | esac |
| 27 | AC_SUBST(HOST_CPU) |
| 28 | |
| 29 | # Checks for programs. |
| 30 | AC_PROG_CC |
| Marc Kleine-Budde | 7cae4e0 | 2010-02-04 18:55:22 +0100 | [diff] [blame] | 31 | AC_PROG_LIBTOOL |
| 32 | # libtool-2: LT_INIT() |
| Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 33 | AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2]) |
| 34 | |
| 35 | # Checks for libraries. |
| 36 | |
| 37 | # libelf |
| Petr Machata | 8c4aa1f | 2010-11-03 12:16:44 +0100 | [diff] [blame^] | 38 | AC_CHECK_HEADERS([elf.h gelf.h],, |
| 39 | [AC_MSG_ERROR([*** libelf.h or gelf.h not found on your system])] |
| Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 40 | ) |
| Petr Machata | 8c4aa1f | 2010-11-03 12:16:44 +0100 | [diff] [blame^] | 41 | AC_CHECK_LIB([elf], [elf_begin],, |
| 42 | [AC_MSG_ERROR([*** libelf not found on your system])] |
| 43 | ) |
| Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 44 | |
| 45 | |
| 46 | # HAVE_LIBIBERTY |
| 47 | AC_CHECK_LIB([iberty], [cplus_demangle], [ |
| 48 | AC_DEFINE([HAVE_LIBIBERTY], [1], [we have libiberty]) |
| 49 | liberty_LIBS="-liberty"], [ |
| 50 | liberty_LIBS=""]) |
| 51 | AC_SUBST(liberty_LIBS) |
| 52 | |
| 53 | |
| 54 | # HAVE_LIBSUPC__ |
| 55 | AC_CHECK_LIB([supc++], [__cxa_demangle], [ |
| 56 | AC_DEFINE([HAVE_LIBSUPC__], [1], [we have libsupc++]) |
| 57 | libsupcxx_LIBS="-lsupc++"], [ |
| 58 | libsupcxx_LIBS=""]) |
| 59 | AC_SUBST(libsupcxx_LIBS) |
| 60 | |
| 61 | |
| Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 62 | # HAVE_LIBUNWIND |
| 63 | AC_ARG_WITH(libunwind, |
| 64 | [ --with-libunwind Use libunwind frame unwinding support], |
| 65 | [case "${withval}" in |
| 66 | yes) enable_libunwind=yes ;; |
| 67 | no) enable_libunwind=no ;; |
| 68 | *) AC_MSG_ERROR(bad value ${withval} for GDB with-libunwind option) ;; |
| 69 | esac],[ |
| 70 | AC_CHECK_HEADERS(libunwind.h) |
| 71 | AC_CHECK_HEADERS(libunwind-ptrace.h) |
| 72 | if test x"$ac_cv_header_libunwind_h" = xyes; then |
| 73 | enable_libunwind=yes; |
| 74 | fi |
| 75 | ]) |
| 76 | |
| 77 | if test x"$enable_libunwind" = xyes; then |
| 78 | AC_CHECK_LIB(unwind, backtrace, libunwind_LIBS=-lunwind, libunwind_LIBS=) |
| 79 | AC_SUBST(libunwind_LIBS) |
| 80 | AC_CHECK_LIB(unwind-ptrace, _UPT_create, libunwind_ptrace_LIBS=-lunwind-ptrace, libunwind_ptrace_LIBS=) |
| 81 | AC_SUBST(libunwind_ptrace_LIBS) |
| 82 | AC_CHECK_LIB(unwind-${HOST_CPU}, _U${HOST_CPU}_init_remote, libunwind_arch_LIBS=-lunwind-${HOST_CPU}, libunwind_arch_LIBS=) |
| 83 | AC_SUBST(libunwind_arch_LIBS) |
| 84 | AC_DEFINE([HAVE_LIBUNWIND], [1], [we have libunwind]) |
| 85 | fi |
| 86 | |
| 87 | |
| Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 88 | # HAVE_ELF_C_READ_MMAP |
| 89 | AC_MSG_CHECKING([whether elf_begin accepts ELF_C_READ_MMAP]) |
| 90 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gelf.h>]], [[ |
| 91 | int main () { |
| 92 | Elf *elf = elf_begin(4, ELF_C_READ_MMAP, 0); |
| 93 | return 0; |
| 94 | } |
| 95 | ]])],[ |
| 96 | AC_DEFINE([HAVE_ELF_C_READ_MMAP], [1], [we have read mmap support]) |
| 97 | AC_MSG_RESULT([yes])],[ |
| 98 | AC_MSG_RESULT([no])]) |
| 99 | |
| 100 | |
| 101 | CPPFLAGS=" \ |
| 102 | ${CPPFLAGS} \ |
| 103 | -I\$(top_srcdir)/sysdeps/${HOST_OS}/${HOST_CPU} \ |
| 104 | -I\$(top_srcdir)/sysdeps/${HOST_OS} \ |
| 105 | -I\$(top_srcdir)/sysdeps \ |
| 106 | -I\$(top_srcdir) \ |
| 107 | " |
| 108 | |
| 109 | CFLAGS="${CFLAGS} -Wall" |
| 110 | |
| 111 | # Checks for header files. |
| 112 | AC_CHECK_HEADERS([ \ |
| 113 | fcntl.h \ |
| 114 | limits.h \ |
| 115 | stddef.h \ |
| 116 | stdint.h \ |
| 117 | stdlib.h \ |
| 118 | string.h \ |
| 119 | sys/ioctl.h \ |
| 120 | sys/param.h \ |
| 121 | sys/time.h \ |
| 122 | unistd.h \ |
| 123 | ]) |
| 124 | |
| 125 | # Checks for typedefs, structures, and compiler characteristics. |
| 126 | AC_TYPE_UID_T |
| 127 | AC_C_INLINE |
| 128 | AC_TYPE_PID_T |
| 129 | AC_TYPE_SIZE_T |
| 130 | AC_CHECK_SIZEOF([long]) |
| 131 | |
| 132 | |
| 133 | # Checks for library functions. |
| 134 | AC_FUNC_ERROR_AT_LINE |
| 135 | AC_FUNC_FORK |
| 136 | AC_CHECK_FUNCS([ \ |
| 137 | alarm \ |
| 138 | atexit \ |
| 139 | getcwd \ |
| 140 | gettimeofday \ |
| 141 | memset \ |
| 142 | mkdir \ |
| 143 | rmdir \ |
| 144 | strchr \ |
| 145 | strdup \ |
| 146 | strerror \ |
| 147 | strtol \ |
| 148 | strtoul \ |
| 149 | ]) |
| 150 | |
| 151 | |
| 152 | # |
| 153 | # Debugging |
| 154 | # |
| 155 | AC_MSG_CHECKING([whether to enable debugging]) |
| 156 | AC_ARG_ENABLE(debug, |
| 157 | AS_HELP_STRING([--enable-debug], [enable debugging @<:@default=no@:>@]), |
| 158 | [case "$enableval" in |
| 159 | y | yes) CONFIG_DEBUG=yes ;; |
| 160 | *) CONFIG_DEBUG=no ;; |
| 161 | esac], |
| 162 | [CONFIG_DEBUG=no]) |
| 163 | AC_MSG_RESULT([${CONFIG_DEBUG}]) |
| 164 | if test "${CONFIG_DEBUG}" = "yes"; then |
| 165 | CFLAGS="${CFLAGS} -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1" |
| 166 | AC_DEFINE(DEBUG, 1, [debugging]) |
| 167 | else |
| 168 | CFLAGS="${CFLAGS} -O2" |
| 169 | fi |
| 170 | |
| 171 | dnl testsuite/Makefile |
| 172 | dnl testsuite/ltrace.main/Makefile |
| 173 | dnl testsuite/ltrace.minor/Makefile |
| 174 | dnl testsuite/ltrace.torture/Makefile |
| 175 | |
| 176 | AC_CONFIG_FILES([ |
| 177 | Makefile |
| 178 | sysdeps/Makefile |
| 179 | sysdeps/linux-gnu/Makefile |
| 180 | sysdeps/linux-gnu/alpha/Makefile |
| 181 | sysdeps/linux-gnu/arm/Makefile |
| 182 | sysdeps/linux-gnu/i386/Makefile |
| 183 | sysdeps/linux-gnu/ia64/Makefile |
| 184 | sysdeps/linux-gnu/m68k/Makefile |
| 185 | sysdeps/linux-gnu/mipsel/Makefile |
| 186 | sysdeps/linux-gnu/ppc/Makefile |
| 187 | sysdeps/linux-gnu/s390/Makefile |
| 188 | sysdeps/linux-gnu/sparc/Makefile |
| 189 | sysdeps/linux-gnu/x86_64/Makefile |
| 190 | ]) |
| 191 | AC_OUTPUT |