configure.ac revision 00fd6fed57aa24a73583f338dd7fb6e27895f17d
1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3AC_PREREQ(2.59) 4 5AC_INIT([ltrace],[0.5.3],[ltrace-devel <ltrace-devel@lists.alioth.debian.org>]) 6AC_CONFIG_HEADERS([config.h]) 7AC_CONFIG_SRCDIR(libltrace.c) 8#AC_CONFIG_MACRO_DIR([config/m4]) 9AC_CONFIG_AUX_DIR([config/autoconf]) 10AC_CANONICAL_BUILD 11AC_CANONICAL_HOST 12 13case "${host_os}" in 14 linux-gnu*) HOST_OS="linux-gnu" ;; 15 *) AC_MSG_ERROR([unkown host-os ${host_osx}]) ;; 16esac 17AC_SUBST(HOST_OS) 18 19case "${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}" ;; 26esac 27AC_SUBST(HOST_CPU) 28 29# Checks for programs. 30AC_PROG_CC 31AC_PROG_LIBTOOL 32# libtool-2: LT_INIT() 33AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2]) 34 35# Checks for libraries. 36 37# libelf 38AC_CHECK_HEADERS([elf.h gelf.h],, 39 [AC_MSG_ERROR([*** libelf.h or gelf.h not found on your system])] 40) 41AC_CHECK_LIB([elf], [elf_begin],, 42 [AC_MSG_ERROR([*** libelf not found on your system])] 43) 44 45 46# HAVE_LIBIBERTY 47AC_CHECK_LIB([iberty], [cplus_demangle], [ 48 AC_DEFINE([HAVE_LIBIBERTY], [1], [we have libiberty]) 49 liberty_LIBS="-liberty"], [ 50 liberty_LIBS=""]) 51AC_SUBST(liberty_LIBS) 52 53 54# HAVE_LIBSUPC__ 55AC_CHECK_LIB([supc++], [__cxa_demangle], [ 56 AC_DEFINE([HAVE_LIBSUPC__], [1], [we have libsupc++]) 57 libsupcxx_LIBS="-lsupc++"], [ 58 libsupcxx_LIBS=""]) 59AC_SUBST(libsupcxx_LIBS) 60 61 62# HAVE_LIBUNWIND 63AC_ARG_WITH(libunwind, 64 AS_HELP_STRING([--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) ;; 69esac],[ 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 77if 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]) 85fi 86 87 88# HAVE_ELF_C_READ_MMAP 89AC_MSG_CHECKING([whether elf_begin accepts ELF_C_READ_MMAP]) 90AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gelf.h>]], [[ 91int 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 101CPPFLAGS=" \ 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 109CFLAGS="${CFLAGS} -Wall" 110 111# Checks for header files. 112AC_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. 126AC_TYPE_UID_T 127AC_C_INLINE 128AC_TYPE_PID_T 129AC_TYPE_SIZE_T 130AC_CHECK_SIZEOF([long]) 131 132 133# Checks for library functions. 134AC_FUNC_ERROR_AT_LINE 135AC_FUNC_FORK 136AC_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# 155AC_MSG_CHECKING([whether to enable debugging]) 156AC_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]) 163AC_MSG_RESULT([${CONFIG_DEBUG}]) 164if test "${CONFIG_DEBUG}" = "yes"; then 165 CFLAGS="${CFLAGS} -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1" 166 AC_DEFINE(DEBUG, 1, [debugging]) 167else 168 CFLAGS="${CFLAGS} -O2" 169fi 170 171dnl testsuite/Makefile 172dnl testsuite/ltrace.main/Makefile 173dnl testsuite/ltrace.minor/Makefile 174dnl testsuite/ltrace.torture/Makefile 175 176AC_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]) 191AC_OUTPUT 192