blob: 066444abdc6eda285a7b4ae2dc031d876872a885 [file] [log] [blame]
Roland McGrath6d2b3492002-12-30 00:51:30 +00001dnl Process this file with autoconf to create configure. Use autoreconf.
2AC_PREREQ(2.57)
Dmitry V. Levindce75932013-04-30 23:52:12 +00003AC_INIT([strace],
4 m4_esyscmd([./git-version-gen .tarball-version]),
5 [strace-devel@lists.sourceforge.net])
Roland McGrath6d2b3492002-12-30 00:51:30 +00006AC_CONFIG_SRCDIR([strace.c])
Roland McGrathffda2d32009-10-11 16:25:29 -07007AC_CONFIG_AUX_DIR([.])
Mike Frysingerbb3a0f72013-04-30 22:41:11 -04008AC_CONFIG_HEADERS([config.h])
Dmitry V. Levin3cf90b62013-06-18 14:31:57 +00009AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip silent-rules parallel-tests])
Roland McGrath6d2b3492002-12-30 00:51:30 +000010AM_MAINTAINER_MODE
11AC_CANONICAL_HOST
12
H.J. Lu35be5812012-04-16 13:00:01 +020013AC_PROG_CC
H.J. Lu35be5812012-04-16 13:00:01 +020014AC_USE_SYSTEM_EXTENSIONS
15
Roland McGrath6d2b3492002-12-30 00:51:30 +000016AC_MSG_CHECKING([for supported architecture])
17case "$host_cpu" in
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +000018bfin)
19 arch=bfin
20 AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
21 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000022i[[3456]]86|pentium)
23 arch=i386
24 AC_DEFINE([I386], 1, [Define for the i386 architecture.])
25 ;;
26ia64)
27 arch=ia64
28 AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
29 ;;
30m68k)
31 arch=m68k
32 AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
33 ;;
Roland McGrath6d1a65c2004-07-12 07:44:08 +000034sparc64*)
35 arch=sparc64
36 AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
37 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000038sparc*)
39 arch=sparc
40 AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
41 ;;
James Hogan5f999a82013-02-22 14:44:10 +000042metag*)
43 arch=metag
44 AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
45 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000046mips*)
47 arch=mips
48 AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
49 ;;
50alpha*)
51 arch=alpha
52 AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
53 ;;
Roland McGratheb285352003-01-14 09:59:00 +000054powerpc*)
Roland McGrath6d2b3492002-12-30 00:51:30 +000055 arch=powerpc
56 AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
Anton Blanchard9afc2ee2013-07-11 12:03:57 +100057 AC_TRY_COMPILE(
58[#ifndef __LP64__
59# error 32 bit
60#endif], [], ppc_bits=64, ppc_bits=32)
61 if test "$ppc_bits" = "64"; then
Andreas Schwabd69fa492010-07-12 21:39:57 +020062 AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
63 fi
Roland McGrath6d2b3492002-12-30 00:51:30 +000064 ;;
65arm*)
66 arch=arm
67 AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
68 ;;
Steve McIntyred8d3bd32012-10-24 17:58:16 +010069aarch64*)
70 arch=aarch64
71 AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
72 ;;
Denys Vlasenko5ae2b7c2009-02-27 20:32:52 +000073avr32*)
74 arch=avr32
75 AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
76 ;;
Vineet Gupta7daacbb2013-08-16 12:47:06 +053077arc*)
78 arch=arc
79 AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
80 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000081s390)
82 arch=s390
83 AC_DEFINE([S390], 1, [Define for the S390 architecture.])
84 ;;
85s390x)
86 arch=s390x
87 AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
88 ;;
89hppa*|parisc*)
90 arch=hppa
91 AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
92 ;;
Roland McGrath67828ca2007-11-01 21:32:49 +000093sh64*)
Roland McGrathf5a47772003-06-26 22:40:42 +000094 arch=sh64
95 AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
Roland McGrathe1e584b2003-06-02 19:18:58 +000096 ;;
Roland McGrath67828ca2007-11-01 21:32:49 +000097sh*)
98 arch=sh
99 AC_DEFINE([SH], 1, [Define for the SH architecture.])
100 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +0000101x86?64*)
H.J. Lu35be5812012-04-16 13:00:01 +0200102 AC_TRY_COMPILE(
103[#ifndef __ILP32__
104# error not x32
105#endif], [], arch=x32, arch=x86_64)
106 if test "$arch" = "x86_64"; then
107 AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
108 else
109 AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
110 fi
Roland McGrath6d2b3492002-12-30 00:51:30 +0000111 ;;
Denys Vlasenkoea0e6e82009-02-25 17:08:40 +0000112cris|crisv10)
113 arch=crisv10
114 AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
115 ;;
116crisv32)
117 arch=crisv32
118 AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
119 ;;
Chris Metcalfc8c66982009-12-28 10:00:15 -0500120tile*)
121 arch=tile
122 AC_DEFINE([TILE], 1, [Define for the Tile architecture])
123 ;;
Edgar E. Iglesias939caba2010-07-06 14:21:07 +0200124microblaze*)
125 arch=microblaze
126 AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
127 ;;
Christian Svensson492f81f2013-02-14 13:26:27 +0100128or1k*)
129 arch=or1k
130 AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
131 ;;
132
Chris Zankel8f636ed2013-03-25 10:22:07 -0700133xtensa*)
134 arch=xtensa
135 AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
136 ;;
137
Roland McGrath6d2b3492002-12-30 00:51:30 +0000138*)
139 AC_MSG_RESULT([NO!])
140 AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
141 ;;
142esac
143AC_MSG_RESULT($arch)
144
Roland McGrath6d2b3492002-12-30 00:51:30 +0000145AC_SUBST(arch)
Roland McGrath6d2b3492002-12-30 00:51:30 +0000146
Roland McGrathbc44e402004-07-12 05:45:08 +0000147AM_CONDITIONAL([I386], [test x$arch = xi386])
Roland McGrath2746edd2002-12-30 09:13:08 +0000148AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
H.J. Lu35be5812012-04-16 13:00:01 +0200149AM_CONDITIONAL([X32], [test x$arch = xx32])
Roland McGrath45aeb6e2003-01-10 10:44:59 +0000150
Roland McGrath6d2b3492002-12-30 00:51:30 +0000151AC_INCLUDEDIR
152
Dmitry V. Levin0160e162014-03-18 23:37:43 +0000153AC_ARG_ENABLE([arm-oabi],
154 [AS_HELP_STRING([--enable-arm-oabi],
155 [enable OABI support on ARM EABI])],
156 [], [enable_arm_oabi=no])
157case "$enable_arm_oabi" in
158 yes) enable_arm_oabi=1 ;;
159 no) enable_arm_oabi=0 ;;
160 *) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
161esac
162AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
163 [Define to 1 if you want OABI support on ARM EABI.])
164
Dmitry V. Levin918e49b2010-09-09 17:41:15 +0000165gl_WARN_ADD([-Wall])
Dmitry V. Levin1ed5d802010-09-09 17:42:28 +0000166gl_WARN_ADD([-Wwrite-strings])
Dmitry V. Levind376c922012-05-15 00:50:26 +0000167AC_ARG_ENABLE([gcc-Werror],
168 [AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
169 [case $enableval in
170 yes) gl_WARN_ADD([-Werror]) ;;
171 no) ;;
172 *) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
173 esac]
174)
Dmitry V. Levin918e49b2010-09-09 17:41:15 +0000175AC_SUBST([WARN_CFLAGS])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000176
177AC_PROG_CPP
Roland McGrath6d2b3492002-12-30 00:51:30 +0000178AC_PROG_INSTALL
179AC_C_CONST
Mike Frysinger6d12afd2010-09-12 03:39:55 -0400180AC_C_BIGENDIAN
Roland McGrath6d2b3492002-12-30 00:51:30 +0000181AC_HEADER_STDC
Roland McGrath639658b2008-08-01 01:06:31 +0000182AC_HEADER_STDBOOL
Roland McGrath6d2b3492002-12-30 00:51:30 +0000183AC_HEADER_DIRENT
184AC_HEADER_STAT
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000185AC_CHECK_MEMBERS(m4_normalize([
186 struct stat.st_aclcnt,
187 struct stat.st_blksize,
188 struct stat.st_blocks,
189 struct stat.st_flags,
190 struct stat.st_fstype,
191 struct stat.st_gen,
192 struct stat.st_level,
193 struct stat.st_rdev
194]))
Roland McGrath6d2b3492002-12-30 00:51:30 +0000195AC_STAT64
Bernhard Reutner-Fischer9906e6d2009-10-14 16:33:58 +0200196AC_STATFS64
Roland McGrath6d2b3492002-12-30 00:51:30 +0000197
198AC_TYPE_SIGNAL
199AC_TYPE_UID_T
200AC_TYPE_MODE_T
201AC_TYPE_GETGROUPS
202AC_HEADER_MAJOR
Roland McGrathacf06ef2003-01-10 19:57:34 +0000203AC_CHECK_TYPES([sig_atomic_t, siginfo_t],,, [#include <signal.h>])
Roland McGrathe07cd602003-02-26 20:34:02 +0000204AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
205[#include <sys/types.h>
206#include <sys/socket.h>
207#include <netinet/in.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000208AC_LITTLE_ENDIAN_LONG_LONG
Roland McGrath6d2b3492002-12-30 00:51:30 +0000209
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000210AC_CHECK_FUNCS(m4_normalize([
Dmitry V. Levind3541302014-02-26 00:01:00 +0000211 fopen64
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000212 fork
Dmitry V. Levind3541302014-02-26 00:01:00 +0000213 fputs_unlocked
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000214 if_indextoname
215 inet_ntop
216 prctl
217 process_vm_readv
218 sendmsg
219 sigaction
220 stpcpy
221 strerror
222 strsignal
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000223]))
224AC_CHECK_HEADERS(m4_normalize([
225 asm/cachectl.h
226 asm/sysmips.h
Dmitry V. Levinc41808b2013-03-18 00:52:29 +0000227 elf.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000228 inttypes.h
229 ioctls.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000230 linux/capability.h
Ben Noordhuis88eafd82013-02-04 00:04:57 +0100231 linux/perf_event.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000232 linux/ptrace.h
233 linux/utsname.h
234 mqueue.h
235 netinet/sctp.h
236 poll.h
Dmitry V. Levinfdb896e2014-02-25 23:04:55 +0000237 scsi/sg.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000238 stropts.h
239 sys/acl.h
240 sys/asynch.h
241 sys/conf.h
242 sys/epoll.h
243 sys/filio.h
244 sys/ioctl.h
245 sys/poll.h
246 sys/ptrace.h
247 sys/reg.h
248 sys/uio.h
249 sys/vfs.h
250]))
Roland McGrath6d2b3492002-12-30 00:51:30 +0000251AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
Roland McGrathe7fa3052007-07-05 20:50:34 +0000252 [], [], [#include <stddef.h>
Andreas Schwab360986b2010-03-08 16:07:52 +0100253#include <sys/socket.h>
254#include <asm/types.h>])
Roland McGrath41074c02002-12-30 10:23:01 +0000255AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
Dmitry V. Levine2de3bd2013-11-12 15:27:38 +0000256AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
Roland McGratha7a0d382003-01-10 19:55:30 +0000257AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000258
Roland McGrath6d2b3492002-12-30 00:51:30 +0000259AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000260
Roland McGrath79db8af2003-06-27 21:20:09 +0000261AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
262
Ali Polatel0b4060f2013-09-24 20:04:32 +0300263AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
Roland McGrathce9f0742004-03-01 21:29:22 +0000264 [#include <sys/ptrace.h>])
265
Dmitry V. Levinea22e972012-05-01 20:56:32 +0000266AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
267
Dmitry V. Levinae5aa472013-11-11 23:54:30 +0000268AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
Dmitry V. Levinbc091e32014-03-11 22:18:40 +0000269 struct sigevent.__pad,
270 siginfo_t.si_syscall],,, [#include <signal.h>])
Dmitry V. Levinae5aa472013-11-11 23:54:30 +0000271
Dmitry V. Levin594eb8f2013-11-12 21:49:03 +0000272AC_CHECK_TYPES([struct flock64],,, [#include <fcntl.h>])
273
Roland McGrath6d2b3492002-12-30 00:51:30 +0000274AC_CHECK_DECLS([sys_errlist])
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000275AC_CHECK_DECLS(m4_normalize([
276 PTRACE_EVENT_CLONE,
277 PTRACE_EVENT_EXEC,
278 PTRACE_EVENT_EXIT,
279 PTRACE_EVENT_FORK,
280 PTRACE_EVENT_VFORK,
281 PTRACE_EVENT_VFORK_DONE,
282 PTRACE_GETEVENTMSG,
283 PTRACE_GETSIGINFO,
284 PTRACE_O_TRACECLONE,
285 PTRACE_O_TRACEEXEC,
286 PTRACE_O_TRACEEXIT,
287 PTRACE_O_TRACEFORK,
288 PTRACE_O_TRACESYSGOOD,
289 PTRACE_O_TRACEVFORK,
Dmitry V. Levin6974bd42013-11-12 21:20:50 +0000290 PTRACE_PEEKUSER,
291 PTRACE_POKEUSER,
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000292 PTRACE_SETOPTIONS
293]),,, [#include <sys/ptrace.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000294
Dmitry V. Levincf050db2012-05-02 10:21:49 +0000295AC_CHECK_DECLS(m4_normalize([
Dmitry V. Levinbaf60d92014-04-26 14:12:33 +0000296 LO_FLAGS_READ_ONLY,
Dmitry V. Levincf050db2012-05-02 10:21:49 +0000297 LO_FLAGS_AUTOCLEAR,
298 LO_FLAGS_PARTSCAN
299]),,, [#include <linux/loop.h>])
300
Dmitry V. Levin25caa312011-08-16 21:36:16 +0000301AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
302 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
303#include <stdlib.h>
304#include <linux/fs.h>], [return !BLKGETSIZE64;])],
305 [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
306 if test $ac_cv_have_blkgetsize64 = yes; then
307 AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
308 fi)
309
Dmitry V. Levin63e4f862012-03-15 20:42:46 +0000310AC_CHECK_SIZEOF([long])
Dmitry V. Levin7a498be2013-05-04 19:51:57 +0000311AC_CHECK_SIZEOF([long long])
Dmitry V. Levin54cabef2014-03-03 23:09:47 +0000312AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
Dmitry V. Levin63e4f862012-03-15 20:42:46 +0000313
Dmitry V. Levinab3953b2014-02-08 00:15:52 +0000314AC_CACHE_CHECK([for SA_RESTORER], [st_cv_sa_restorer],
315 [st_cv_sa_restorer="$(echo SA_RESTORER |
316 $CPP $CPPFLAGS -P -imacros asm/signal.h - |
317 grep ^0x)"
318 test -n "$st_cv_sa_restorer" || st_cv_sa_restorer=no])
319if test "x$st_cv_sa_restorer" != xno; then
320 AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_sa_restorer],
321 [SA_RESTORER defined in <asm/signal.h>])
322fi
323
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000324AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
325 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
326 [st_cv_have___builtin_popcount=yes],
327 [st_cv_have___builtin_popcount=no])])
328if test "x$st_cv_have___builtin_popcount" = xyes; then
329 AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
330 [Define to 1 if the system provides __builtin_popcount function])
331fi
332
Roland McGrath6d2b3492002-12-30 00:51:30 +0000333AC_PATH_PROG([PERL], [perl])
334
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +0000335AC_CONFIG_FILES([Makefile tests/Makefile])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000336AC_OUTPUT