Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 1 | # -*- Autoconf -*- |
Petr Machata | e99af27 | 2012-10-26 00:29:52 +0200 | [diff] [blame] | 2 | # This file is part of ltrace. |
Petr Machata | 912a0f7 | 2014-01-24 00:50:06 +0100 | [diff] [blame] | 3 | # Copyright (C) 2010,2012,2013,2014 Petr Machata, Red Hat Inc. |
Petr Machata | e99af27 | 2012-10-26 00:29:52 +0200 | [diff] [blame] | 4 | # Copyright (C) 2010,2011 Joe Damato |
| 5 | # Copyright (C) 2010 Marc Kleine-Budde |
| 6 | # Copyright (C) 2010 Zachary T Welch |
| 7 | # |
| 8 | # This program is free software; you can redistribute it and/or |
| 9 | # modify it under the terms of the GNU General Public License as |
| 10 | # published by the Free Software Foundation; either version 2 of the |
| 11 | # License, or (at your option) any later version. |
| 12 | # |
| 13 | # This program is distributed in the hope that it will be useful, but |
| 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | # General Public License for more details. |
| 17 | # |
| 18 | # You should have received a copy of the GNU General Public License |
| 19 | # along with this program; if not, write to the Free Software |
| 20 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 21 | # 02110-1301 USA |
| 22 | |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 23 | # Process this file with autoconf to produce a configure script. |
Petr Machata | fe58c61 | 2012-12-10 13:36:26 +0100 | [diff] [blame] | 24 | AC_PREREQ([2.65]) |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 25 | |
Petr Machata | cb9d174 | 2013-11-05 02:21:10 +0100 | [diff] [blame] | 26 | AC_INIT([ltrace],[0.7.91],[ltrace-devel@lists.alioth.debian.org], |
Petr Machata | d709493 | 2012-12-04 02:03:56 +0100 | [diff] [blame] | 27 | [ltrace],[http://ltrace.alioth.debian.org/]) |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 28 | AC_CONFIG_HEADERS([config.h]) |
| 29 | AC_CONFIG_SRCDIR(libltrace.c) |
Michael K. Edwards | 090f7d3 | 2011-03-06 17:23:07 +0000 | [diff] [blame] | 30 | AC_CONFIG_MACRO_DIR([config/m4]) |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 31 | AC_CONFIG_AUX_DIR([config/autoconf]) |
| 32 | AC_CANONICAL_BUILD |
| 33 | AC_CANONICAL_HOST |
| 34 | |
| 35 | case "${host_os}" in |
Petr Machata | d15283b | 2012-12-10 16:57:18 +0100 | [diff] [blame] | 36 | linux-gnu*) HOST_OS="linux-gnu" ;; |
| 37 | linux-uclibc*) HOST_OS="linux-gnu" ;; |
Andrey Zonov | e6f86b2 | 2012-08-05 00:11:46 +0400 | [diff] [blame] | 38 | *) AC_MSG_ERROR([unkown host-os ${host_os}]) ;; |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 39 | esac |
| 40 | AC_SUBST(HOST_OS) |
| 41 | |
| 42 | case "${host_cpu}" in |
| 43 | arm*|sa110) HOST_CPU="arm" ;; |
Edgar E. Iglesias | 1e2a1f7 | 2012-09-12 16:20:47 +0200 | [diff] [blame] | 44 | cris*) HOST_CPU="cris" ;; |
Edgar E. Iglesias | 266e1f5 | 2012-09-27 12:07:33 +0200 | [diff] [blame] | 45 | mips*) HOST_CPU="mips" ;; |
Petr Machata | 1906248 | 2010-11-01 16:06:12 +0100 | [diff] [blame] | 46 | powerpc|powerpc64) HOST_CPU="ppc" ;; |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 47 | sun4u|sparc64) HOST_CPU="sparc" ;; |
| 48 | s390x) HOST_CPU="s390" ;; |
Petr Machata | ddd96a3 | 2012-05-17 23:35:26 +0200 | [diff] [blame] | 49 | i?86|x86_64) HOST_CPU="x86" ;; |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 50 | *) HOST_CPU="${host_cpu}" ;; |
| 51 | esac |
| 52 | AC_SUBST(HOST_CPU) |
| 53 | |
| 54 | # Checks for programs. |
| 55 | AC_PROG_CC |
Michael K. Edwards | 2f13201 | 2011-03-06 20:41:50 +0000 | [diff] [blame] | 56 | LT_INIT |
Marc Kleine-Budde | 7cae4e0 | 2010-02-04 18:55:22 +0100 | [diff] [blame] | 57 | # libtool-2: LT_INIT() |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 58 | AM_INIT_AUTOMAKE([foreign no-exeext dist-bzip2]) |
Zachary T Welch | d915289 | 2010-11-05 15:02:57 -0700 | [diff] [blame] | 59 | AM_MAINTAINER_MODE |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 60 | |
Petr Machata | dd53203 | 2013-03-05 17:15:43 +0100 | [diff] [blame] | 61 | # |
| 62 | # We use stat(2). Even though we don't care about the file size or |
| 63 | # inode number, stat will fail with EOVERFLOW if either of these |
| 64 | # exceeds 32 bits. We therefore ask for stat64 if available. Do this |
| 65 | # test as soon as possible, as large file support may influence |
| 66 | # whether other headers are available. |
| 67 | # |
| 68 | AC_SYS_LARGEFILE |
| 69 | |
Zachary T Welch | 6188614 | 2010-12-10 14:52:33 -0800 | [diff] [blame] | 70 | AC_ARG_WITH([libelf], |
| 71 | AS_HELP_STRING([--with-libelf], [Prefix of libelf headers/library]), |
| 72 | [case "${withval}" in |
| 73 | (no) |
| 74 | AC_MSG_ERROR([*** libelf is a required dependency]) |
| 75 | ;; |
| 76 | (yes) |
| 77 | AC_MSG_ERROR([*** --with-libelf requires you to specify a path]) |
| 78 | ;; |
| 79 | (*) |
| 80 | AM_CPPFLAGS="${AM_CPPFLAGS} -I${withval}/include" |
| 81 | AM_LDFLAGS="${AM_LDFLAGS} -L${withval}/lib" |
Zachary T Welch | 68621db | 2010-12-16 15:18:23 -0800 | [diff] [blame] | 82 | libelf_LD_LIBRARY_PATH="${withval}/lib" |
Zachary T Welch | 6188614 | 2010-12-10 14:52:33 -0800 | [diff] [blame] | 83 | ;; |
| 84 | esac],[]) |
| 85 | |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 86 | # Checks for libraries. |
| 87 | |
Zachary T Welch | 6188614 | 2010-12-10 14:52:33 -0800 | [diff] [blame] | 88 | saved_CPPFLAGS="${CPPFLAGS}" |
| 89 | saved_LDFLAGS="${LDFLAGS}" |
| 90 | CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}" |
| 91 | LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}" |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 92 | # libelf |
Petr Machata | 8c4aa1f | 2010-11-03 12:16:44 +0100 | [diff] [blame] | 93 | AC_CHECK_HEADERS([elf.h gelf.h],, |
| 94 | [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] | 95 | ) |
Petr Machata | 8c4aa1f | 2010-11-03 12:16:44 +0100 | [diff] [blame] | 96 | AC_CHECK_LIB([elf], [elf_begin],, |
| 97 | [AC_MSG_ERROR([*** libelf not found on your system])] |
| 98 | ) |
Zachary T Welch | 6188614 | 2010-12-10 14:52:33 -0800 | [diff] [blame] | 99 | CPPFLAGS="${saved_CPPFLAGS}" |
| 100 | LDFLAGS="${saved_LDFLAGS}" |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 101 | |
| 102 | |
| 103 | # HAVE_LIBIBERTY |
| 104 | AC_CHECK_LIB([iberty], [cplus_demangle], [ |
| 105 | AC_DEFINE([HAVE_LIBIBERTY], [1], [we have libiberty]) |
| 106 | liberty_LIBS="-liberty"], [ |
| 107 | liberty_LIBS=""]) |
| 108 | AC_SUBST(liberty_LIBS) |
| 109 | |
| 110 | |
| 111 | # HAVE_LIBSUPC__ |
| 112 | AC_CHECK_LIB([supc++], [__cxa_demangle], [ |
| 113 | AC_DEFINE([HAVE_LIBSUPC__], [1], [we have libsupc++]) |
| 114 | libsupcxx_LIBS="-lsupc++"], [ |
| 115 | libsupcxx_LIBS=""]) |
| 116 | AC_SUBST(libsupcxx_LIBS) |
| 117 | |
| 118 | |
Petr Machata | cdd17b8 | 2012-06-01 19:35:24 +0200 | [diff] [blame] | 119 | # HAVE_LIBSTDC__ |
| 120 | AC_CHECK_LIB([stdc++], [__cxa_demangle], [ |
| 121 | AC_DEFINE([HAVE_LIBSTDC__], [1], [we have libstdc++]) |
| 122 | libstdcxx_LIBS="-lstdc++"], [ |
| 123 | libstdcxx_LIBS=""]) |
| 124 | AC_SUBST(libstdcxx_LIBS) |
| 125 | |
| 126 | |
Petr Machata | cec06ec | 2012-04-10 13:31:55 +0200 | [diff] [blame] | 127 | dnl Check security_get_boolean_active availability. |
| 128 | AC_CHECK_HEADERS(selinux/selinux.h) |
| 129 | AC_CHECK_LIB(selinux, security_get_boolean_active) |
| 130 | |
Mark Wielaard | dfefa9f | 2014-01-07 21:00:44 +0100 | [diff] [blame] | 131 | dnl Whether (and which) elfutils libdw.so to use for unwinding. |
| 132 | AC_ARG_WITH(elfutils, |
| 133 | AS_HELP_STRING([--with-elfutils], [Use elfutils libdwfl unwinding support]), |
| 134 | [case "${withval}" in |
| 135 | (yes|no) enable_elfutils=$withval;; |
| 136 | (*) enable_elfutils=yes |
| 137 | AM_CPPFLAGS="${AM_CPPFLAGS} -I${withval}/include" |
| 138 | AM_LDFLAGS="${AM_LDFLAGS} -L${withval}/lib" |
| 139 | elfutils_LD_LIBRARY_PATH="${withval}/lib:${withval}/lib/elfutils" |
| 140 | ;; |
| 141 | esac],[enable_elfutils=maybe]) |
| 142 | |
| 143 | dnl Check whether we have the elfutils libdwfl.h header installed. |
| 144 | saved_CPPFLAGS="${CPPFLAGS}" |
| 145 | CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}" |
| 146 | AC_CHECK_HEADERS([elfutils/libdwfl.h],[have_libdwfl_h=yes]) |
| 147 | CPPFLAGS="${saved_CPPFLAGS}" |
| 148 | |
| 149 | dnl And whether libdw.so provides the unwinding functions. |
| 150 | saved_LDFLAGS="${LDFLAGS}" |
| 151 | LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}" |
| 152 | AC_CHECK_LIB([dw], [dwfl_getthread_frames], [have_libdw_dwfl_frames=yes]) |
| 153 | LDFLAGS="${saved_LDFLAGS}" |
| 154 | |
| 155 | AC_MSG_CHECKING([whether to use elfutils libdwfl unwinding support]) |
| 156 | case "${enable_elfutils}" in |
| 157 | (yes|maybe) |
| 158 | if test x$have_libdwfl_h = xyes -a x$have_libdw_dwfl_frames = xyes; then |
| 159 | enable_elfutils=yes |
| 160 | elif test $enable_elfutils = maybe; then |
| 161 | enable_elfutils=no |
| 162 | else |
| 163 | AC_MSG_RESULT([$enable_elfutils]) |
| 164 | AC_MSG_ERROR([Missing elfutils/libdwfl.h or dwfl_getthread_frames not in libdw.so]) |
| 165 | fi |
| 166 | ;; |
| 167 | (*) ;; |
| 168 | esac |
| 169 | AC_MSG_RESULT([$enable_elfutils]) |
| 170 | |
| 171 | if test x"$enable_elfutils" = xyes; then |
| 172 | libdw_LIBS=-ldw |
| 173 | AC_SUBST(libdw_LIBS) |
| 174 | AC_DEFINE([HAVE_LIBDW], [1], [we have elfutils libdw]) |
| 175 | fi |
Petr Machata | cec06ec | 2012-04-10 13:31:55 +0200 | [diff] [blame] | 176 | |
Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 177 | # HAVE_LIBUNWIND |
| 178 | AC_ARG_WITH(libunwind, |
Zachary T Welch | bc7a4a9 | 2010-11-05 15:03:04 -0700 | [diff] [blame] | 179 | AS_HELP_STRING([--with-libunwind], [Use libunwind frame unwinding support]), |
| 180 | [case "${withval}" in |
| 181 | (yes|no) enable_libunwind=$withval;; |
| 182 | (*) enable_libunwind=yes |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 183 | AM_CPPFLAGS="${AM_CPPFLAGS} -I${withval}/include" |
| 184 | AM_LDFLAGS="${AM_LDFLAGS} -L${withval}/lib" |
Zachary T Welch | 68621db | 2010-12-16 15:18:23 -0800 | [diff] [blame] | 185 | libunwind_LD_LIBRARY_PATH="${withval}/lib" |
Zachary T Welch | bc7a4a9 | 2010-11-05 15:03:04 -0700 | [diff] [blame] | 186 | ;; |
| 187 | esac],[enable_libunwind=maybe]) |
| 188 | |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 189 | saved_CPPFLAGS="${CPPFLAGS}" |
| 190 | CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}" |
Zachary T Welch | bc7a4a9 | 2010-11-05 15:03:04 -0700 | [diff] [blame] | 191 | AC_CHECK_HEADERS([libunwind.h], [have_libunwind_h=yes]) |
| 192 | AC_CHECK_HEADERS([libunwind-ptrace.h], [have_libunwind_ptrace_h=yes]) |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 193 | CPPFLAGS="${saved_CPPFLAGS}" |
Zachary T Welch | bc7a4a9 | 2010-11-05 15:03:04 -0700 | [diff] [blame] | 194 | |
| 195 | AC_MSG_CHECKING([whether to use libunwind support]) |
| 196 | case "${enable_libunwind}" in |
| 197 | (yes|maybe) |
| 198 | if test x$have_libunwind_h = xyes -o x$have_libunwind_ptrace_h = xyes; then |
| 199 | enable_libunwind=yes |
| 200 | elif test $enable_libunwind = maybe; then |
| 201 | enable_libunwind=no |
| 202 | else |
| 203 | AC_MSG_RESULT([$enable_libunwind]) |
| 204 | AC_MSG_ERROR([libunwind.h or libunwind-ptrace.h cannot be found]) |
Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 205 | fi |
Zachary T Welch | bc7a4a9 | 2010-11-05 15:03:04 -0700 | [diff] [blame] | 206 | ;; |
| 207 | (*) ;; |
| 208 | esac |
| 209 | AC_MSG_RESULT([$enable_libunwind]) |
Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 210 | |
| 211 | if test x"$enable_libunwind" = xyes; then |
Joe Damato | afb4434 | 2010-11-07 15:33:36 -0800 | [diff] [blame] | 212 | case "${host_cpu}" in |
| 213 | arm*|sa110) UNWIND_ARCH="arm" ;; |
| 214 | i?86) UNWIND_ARCH="x86" ;; |
| 215 | powerpc) UNWIND_ARCH="ppc32" ;; |
Petr Machata | 36f2968 | 2012-11-30 21:44:01 +0100 | [diff] [blame] | 216 | powerpc64) UNWIND_ARCH="ppc64" ;; |
Joe Damato | afb4434 | 2010-11-07 15:33:36 -0800 | [diff] [blame] | 217 | mips*) UNWIND_ARCH="mips" ;; |
| 218 | *) UNWIND_ARCH="${host_cpu}" ;; |
| 219 | esac |
| 220 | |
Petr Machata | 036fb18 | 2012-12-04 13:38:08 +0100 | [diff] [blame] | 221 | saved_LDFLAGS="${LDFLAGS}" |
| 222 | LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}" |
| 223 | AC_CHECK_LIB([unwind], [backtrace], [libunwind_LIBS=-lunwind], |
| 224 | [AC_MSG_ERROR([Couldn't find or use libunwind.])]) |
| 225 | |
| 226 | AC_CHECK_LIB([unwind-${UNWIND_ARCH}], [_U${UNWIND_ARCH}_init_remote], |
| 227 | [libunwind_LIBS="-lunwind-${UNWIND_ARCH} $libunwind_LIBS"], |
| 228 | [AC_MSG_ERROR([Couldn't find or use libunwind-${UNWIND_ARCH}.])], |
| 229 | [$libunwind_LIBS]) |
| 230 | |
| 231 | AC_CHECK_LIB([unwind-ptrace], [_UPT_create], |
| 232 | [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"], |
| 233 | [AC_MSG_ERROR([Couldn't find or use libunwind-ptrace.])], |
| 234 | [$libunwind_LIBS]) |
| 235 | |
| 236 | AC_SUBST(libunwind_LIBS) |
Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 237 | AC_DEFINE([HAVE_LIBUNWIND], [1], [we have libunwind]) |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 238 | LDFLAGS="${saved_LDFLAGS}" |
Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 239 | fi |
| 240 | |
Mark Wielaard | dfefa9f | 2014-01-07 21:00:44 +0100 | [diff] [blame] | 241 | if test x"$enable_elfutils" = xyes -a x"$enable_libunwind" = xyes; then |
| 242 | AC_MSG_ERROR([Cannot enable both --with-libunwind and --with-elfutils]) |
| 243 | fi |
| 244 | |
| 245 | if test x"$enable_elfutils" = xyes -o x"$enable_libunwind" = xyes; then |
| 246 | AC_DEFINE([HAVE_UNWINDER], [1], [we have an unwinder available]) |
| 247 | fi |
Joe Damato | ab3b72c | 2010-10-31 00:21:53 -0700 | [diff] [blame] | 248 | |
Zachary T Welch | 6188614 | 2010-12-10 14:52:33 -0800 | [diff] [blame] | 249 | saved_CPPFLAGS="${CPPFLAGS}" |
| 250 | saved_LDFLAGS="${LDFLAGS}" |
| 251 | CPPFLAGS="${CPPFLAGS} ${AM_CPPFLAGS}" |
| 252 | LDFLAGS="${LDFLAGS} ${AM_LDFLAGS}" |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 253 | # HAVE_ELF_C_READ_MMAP |
| 254 | AC_MSG_CHECKING([whether elf_begin accepts ELF_C_READ_MMAP]) |
| 255 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <gelf.h>]], [[ |
| 256 | int main () { |
| 257 | Elf *elf = elf_begin(4, ELF_C_READ_MMAP, 0); |
| 258 | return 0; |
| 259 | } |
| 260 | ]])],[ |
| 261 | AC_DEFINE([HAVE_ELF_C_READ_MMAP], [1], [we have read mmap support]) |
| 262 | AC_MSG_RESULT([yes])],[ |
| 263 | AC_MSG_RESULT([no])]) |
| 264 | |
Zachary T Welch | 0a43b32 | 2010-12-08 18:55:10 -0800 | [diff] [blame] | 265 | saved_CFLAGS="${CFLAGS}" |
| 266 | CFLAGS="${CFLAGS} -Wall -Werror" |
Petr Machata | 144a938 | 2012-02-07 01:52:56 +0100 | [diff] [blame] | 267 | AC_MSG_CHECKING([whether elf_hash takes a char* argument]) |
Zachary T Welch | 0a43b32 | 2010-12-08 18:55:10 -0800 | [diff] [blame] | 268 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libelf.h>]], [[ |
| 269 | (void) elf_hash("name"); |
| 270 | ]])], |
Petr Machata | 144a938 | 2012-02-07 01:52:56 +0100 | [diff] [blame] | 271 | [AC_DEFINE([ELF_HASH_TAKES_CHARP], [1], |
| 272 | [elf_hash() takes char* (as opposed to unsigned char *)]) |
Zachary T Welch | 0a43b32 | 2010-12-08 18:55:10 -0800 | [diff] [blame] | 273 | AC_MSG_RESULT([yes])], |
| 274 | [AC_MSG_RESULT([no])]) |
| 275 | CFLAGS="${saved_CFLAGS}" |
Zachary T Welch | 6188614 | 2010-12-10 14:52:33 -0800 | [diff] [blame] | 276 | CPPFLAGS="${saved_CPPFLAGS}" |
| 277 | LDFLAGS="${saved_LDFLAGS}" |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 278 | |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 279 | AM_CPPFLAGS=" \ |
Petr Machata | 7e6f2b3 | 2012-12-04 02:05:50 +0100 | [diff] [blame] | 280 | -DSYSCONFDIR="'\"$(sysconfdir)\"'" \ |
Petr Machata | aa3db6b | 2013-10-23 00:52:13 +0200 | [diff] [blame] | 281 | -DPKGDATADIR="'\"$(pkgdatadir)\"'" \ |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 282 | ${AM_CPPFLAGS} \ |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 283 | -I\$(top_srcdir)/sysdeps/${HOST_OS}/${HOST_CPU} \ |
| 284 | -I\$(top_srcdir)/sysdeps/${HOST_OS} \ |
| 285 | -I\$(top_srcdir)/sysdeps \ |
| 286 | -I\$(top_srcdir) \ |
| 287 | " |
| 288 | |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 289 | # Checks for header files. |
| 290 | AC_CHECK_HEADERS([ \ |
| 291 | fcntl.h \ |
| 292 | limits.h \ |
| 293 | stddef.h \ |
| 294 | stdint.h \ |
| 295 | stdlib.h \ |
| 296 | string.h \ |
| 297 | sys/ioctl.h \ |
| 298 | sys/param.h \ |
| 299 | sys/time.h \ |
| 300 | unistd.h \ |
| 301 | ]) |
| 302 | |
| 303 | # Checks for typedefs, structures, and compiler characteristics. |
| 304 | AC_TYPE_UID_T |
| 305 | AC_C_INLINE |
| 306 | AC_TYPE_PID_T |
| 307 | AC_TYPE_SIZE_T |
| 308 | AC_CHECK_SIZEOF([long]) |
| 309 | |
| 310 | |
| 311 | # Checks for library functions. |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 312 | AC_FUNC_FORK |
| 313 | AC_CHECK_FUNCS([ \ |
| 314 | alarm \ |
| 315 | atexit \ |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 316 | gettimeofday \ |
| 317 | memset \ |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 318 | strchr \ |
| 319 | strdup \ |
| 320 | strerror \ |
Petr Machata | 7c4d311 | 2012-12-09 11:55:03 +0100 | [diff] [blame] | 321 | strsignal \ |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 322 | strtol \ |
| 323 | strtoul \ |
| 324 | ]) |
| 325 | |
Petr Machata | 2ae374a | 2012-12-08 05:08:48 +0100 | [diff] [blame] | 326 | # |
Petr Machata | 3690fad | 2012-12-10 13:29:47 +0100 | [diff] [blame] | 327 | # Define HAVE_OPEN_MEMSTREAM if open_memstream is available. glibc |
| 328 | # before 2.10, eglibc and uClibc all need _GNU_SOURCE defined for |
| 329 | # open_memstream to become visible, so check for that as well. If |
| 330 | # unavailable, require that tmpfile be present. There's no |
| 331 | # HAVE_TMPFILE, as we plain require that to be present as a fallback. |
Petr Machata | 2ae374a | 2012-12-08 05:08:48 +0100 | [diff] [blame] | 332 | # |
| 333 | AC_CHECK_FUNCS([open_memstream], [], |
Petr Machata | 3690fad | 2012-12-10 13:29:47 +0100 | [diff] [blame] | 334 | [AC_MSG_CHECKING([for open_memstream with _GNU_SOURCE]) |
| 335 | AC_LINK_IFELSE( |
| 336 | [AC_LANG_PROGRAM([[#define _GNU_SOURCE 1 |
| 337 | #include <stdio.h>]], |
| 338 | [[char *buf; size_t sz; |
| 339 | return open_memstream(&buf, &sz) != 0;]])], |
| 340 | |
| 341 | [AC_MSG_RESULT([yes]) |
| 342 | AC_DEFINE([HAVE_OPEN_MEMSTREAM], [1], |
| 343 | [Define if open_memstream exists.])], |
| 344 | |
| 345 | [AC_MSG_RESULT([no]) |
| 346 | AC_CHECK_FUNC([tmpfile], [], |
| 347 | [AC_MSG_ERROR( |
| 348 | [Either open_memstream or tmpfile required.])])])]) |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 349 | |
| 350 | # |
Petr Machata | 35d0730 | 2012-12-09 11:38:56 +0100 | [diff] [blame] | 351 | # Define HAVE_GETOPT_LONG if that is available. |
| 352 | # |
| 353 | AC_CHECK_HEADER([getopt.h], [AC_CHECK_FUNCS([getopt_long])]) |
| 354 | |
| 355 | # |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 356 | # Debugging |
| 357 | # |
| 358 | AC_MSG_CHECKING([whether to enable debugging]) |
| 359 | AC_ARG_ENABLE(debug, |
| 360 | AS_HELP_STRING([--enable-debug], [enable debugging @<:@default=no@:>@]), |
| 361 | [case "$enableval" in |
| 362 | y | yes) CONFIG_DEBUG=yes ;; |
| 363 | *) CONFIG_DEBUG=no ;; |
| 364 | esac], |
| 365 | [CONFIG_DEBUG=no]) |
| 366 | AC_MSG_RESULT([${CONFIG_DEBUG}]) |
| 367 | if test "${CONFIG_DEBUG}" = "yes"; then |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 368 | AC_DEFINE(DEBUG, 1, [debugging]) |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 369 | fi |
| 370 | |
Zachary T Welch | fe6c805 | 2010-12-08 18:55:11 -0800 | [diff] [blame] | 371 | # Ignore the compiler's warnings at your own risk. |
| 372 | AM_CFLAGS="${AM_CFLAGS} -Wall -Wsign-compare -Wfloat-equal -Wformat-security" |
| 373 | AC_ARG_ENABLE([werror], |
| 374 | AS_HELP_STRING([--disable-werror], [disable use of -Werror]), |
| 375 | [enable_werror=$enableval], [enable_werror=yes]) |
| 376 | if test x$enable_werror = xyes; then |
| 377 | AM_CFLAGS="${AM_CFLAGS} -Werror" |
| 378 | fi |
| 379 | |
Petr Machata | 7a1d8cd | 2012-10-06 21:35:36 +0200 | [diff] [blame] | 380 | AC_ARG_ENABLE([valgrind], |
| 381 | AS_HELP_STRING([--enable-valgrind],[run all tests under valgrind]), |
| 382 | [use_valgrind=$enableval], [use_valgrind=no]) |
| 383 | if test x$use_valgrind = xyes; then |
| 384 | AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no) |
| 385 | if test x$HAVE_VALGRIND = xno; then |
| 386 | AC_MSG_ERROR([valgrind not found]) |
| 387 | fi |
| 388 | fi |
| 389 | AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes) |
| 390 | |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 391 | AC_SUBST(AM_CPPFLAGS) |
Zachary T Welch | fe6c805 | 2010-12-08 18:55:11 -0800 | [diff] [blame] | 392 | AC_SUBST(AM_CFLAGS) |
Zachary T Welch | d0fafff | 2010-12-08 18:55:13 -0800 | [diff] [blame] | 393 | AC_SUBST(AM_LDFLAGS) |
Zachary T Welch | 68621db | 2010-12-16 15:18:23 -0800 | [diff] [blame] | 394 | AC_SUBST(libelf_LD_LIBRARY_PATH) |
Mark Wielaard | dfefa9f | 2014-01-07 21:00:44 +0100 | [diff] [blame] | 395 | AC_SUBST(elfutils_LD_LIBRARY_PATH) |
Zachary T Welch | 68621db | 2010-12-16 15:18:23 -0800 | [diff] [blame] | 396 | AC_SUBST(libunwind_LD_LIBRARY_PATH) |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 397 | |
| 398 | AC_CONFIG_FILES([ |
| 399 | Makefile |
| 400 | sysdeps/Makefile |
| 401 | sysdeps/linux-gnu/Makefile |
Petr Machata | 912a0f7 | 2014-01-24 00:50:06 +0100 | [diff] [blame] | 402 | sysdeps/linux-gnu/aarch64/Makefile |
Petr Machata | 26ef4ca | 2012-05-18 00:25:29 +0200 | [diff] [blame] | 403 | sysdeps/linux-gnu/alpha/Makefile |
| 404 | sysdeps/linux-gnu/arm/Makefile |
Edgar E. Iglesias | 17e330d | 2012-09-12 16:20:49 +0200 | [diff] [blame] | 405 | sysdeps/linux-gnu/cris/Makefile |
Petr Machata | 26ef4ca | 2012-05-18 00:25:29 +0200 | [diff] [blame] | 406 | sysdeps/linux-gnu/ia64/Makefile |
| 407 | sysdeps/linux-gnu/m68k/Makefile |
Markos Chandras | a193452 | 2013-03-22 12:24:09 +0000 | [diff] [blame] | 408 | sysdeps/linux-gnu/metag/Makefile |
Oliver Spornitz | 32ea1b1 | 2013-02-16 14:39:51 +0100 | [diff] [blame] | 409 | sysdeps/linux-gnu/mips/Makefile |
Petr Machata | 26ef4ca | 2012-05-18 00:25:29 +0200 | [diff] [blame] | 410 | sysdeps/linux-gnu/ppc/Makefile |
| 411 | sysdeps/linux-gnu/s390/Makefile |
| 412 | sysdeps/linux-gnu/sparc/Makefile |
| 413 | sysdeps/linux-gnu/x86/Makefile |
Zachary T Welch | 3a9d1e7 | 2010-11-05 15:03:00 -0700 | [diff] [blame] | 414 | testsuite/Makefile |
| 415 | testsuite/ltrace.main/Makefile |
| 416 | testsuite/ltrace.minor/Makefile |
| 417 | testsuite/ltrace.torture/Makefile |
Marc Kleine-Budde | 584929c | 2010-02-03 20:24:13 +0100 | [diff] [blame] | 418 | ]) |
| 419 | AC_OUTPUT |