blob: b3b62e883234c6d99ae4111a3a7811882f0a907e [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 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000077s390)
78 arch=s390
79 AC_DEFINE([S390], 1, [Define for the S390 architecture.])
80 ;;
81s390x)
82 arch=s390x
83 AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
84 ;;
85hppa*|parisc*)
86 arch=hppa
87 AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
88 ;;
Roland McGrath67828ca2007-11-01 21:32:49 +000089sh64*)
Roland McGrathf5a47772003-06-26 22:40:42 +000090 arch=sh64
91 AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
Roland McGrathe1e584b2003-06-02 19:18:58 +000092 ;;
Roland McGrath67828ca2007-11-01 21:32:49 +000093sh*)
94 arch=sh
95 AC_DEFINE([SH], 1, [Define for the SH architecture.])
96 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000097x86?64*)
H.J. Lu35be5812012-04-16 13:00:01 +020098 AC_TRY_COMPILE(
99[#ifndef __ILP32__
100# error not x32
101#endif], [], arch=x32, arch=x86_64)
102 if test "$arch" = "x86_64"; then
103 AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
104 else
105 AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
106 fi
Roland McGrath6d2b3492002-12-30 00:51:30 +0000107 ;;
Denys Vlasenkoea0e6e82009-02-25 17:08:40 +0000108cris|crisv10)
109 arch=crisv10
110 AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
111 ;;
112crisv32)
113 arch=crisv32
114 AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
115 ;;
Chris Metcalfc8c66982009-12-28 10:00:15 -0500116tile*)
117 arch=tile
118 AC_DEFINE([TILE], 1, [Define for the Tile architecture])
119 ;;
Edgar E. Iglesias939caba2010-07-06 14:21:07 +0200120microblaze*)
121 arch=microblaze
122 AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
123 ;;
Christian Svensson492f81f2013-02-14 13:26:27 +0100124or1k*)
125 arch=or1k
126 AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
127 ;;
128
Chris Zankel8f636ed2013-03-25 10:22:07 -0700129xtensa*)
130 arch=xtensa
131 AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
132 ;;
133
Roland McGrath6d2b3492002-12-30 00:51:30 +0000134*)
135 AC_MSG_RESULT([NO!])
136 AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
137 ;;
138esac
139AC_MSG_RESULT($arch)
140
Roland McGrath6d2b3492002-12-30 00:51:30 +0000141AC_SUBST(arch)
Roland McGrath6d2b3492002-12-30 00:51:30 +0000142
Roland McGrathbc44e402004-07-12 05:45:08 +0000143AM_CONDITIONAL([I386], [test x$arch = xi386])
Roland McGrath2746edd2002-12-30 09:13:08 +0000144AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
H.J. Lu35be5812012-04-16 13:00:01 +0200145AM_CONDITIONAL([X32], [test x$arch = xx32])
Roland McGrath45aeb6e2003-01-10 10:44:59 +0000146
Roland McGrath6d2b3492002-12-30 00:51:30 +0000147AC_INCLUDEDIR
148
Dmitry V. Levin918e49b2010-09-09 17:41:15 +0000149gl_WARN_ADD([-Wall])
Dmitry V. Levin1ed5d802010-09-09 17:42:28 +0000150gl_WARN_ADD([-Wwrite-strings])
Dmitry V. Levind376c922012-05-15 00:50:26 +0000151AC_ARG_ENABLE([gcc-Werror],
152 [AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
153 [case $enableval in
154 yes) gl_WARN_ADD([-Werror]) ;;
155 no) ;;
156 *) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
157 esac]
158)
Dmitry V. Levin918e49b2010-09-09 17:41:15 +0000159AC_SUBST([WARN_CFLAGS])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000160
161AC_PROG_CPP
Roland McGrath6d2b3492002-12-30 00:51:30 +0000162AC_PROG_INSTALL
163AC_C_CONST
Mike Frysinger6d12afd2010-09-12 03:39:55 -0400164AC_C_BIGENDIAN
Roland McGrath6d2b3492002-12-30 00:51:30 +0000165AC_HEADER_STDC
Roland McGrath639658b2008-08-01 01:06:31 +0000166AC_HEADER_STDBOOL
Roland McGrath6d2b3492002-12-30 00:51:30 +0000167AC_HEADER_DIRENT
168AC_HEADER_STAT
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000169AC_CHECK_MEMBERS(m4_normalize([
170 struct stat.st_aclcnt,
171 struct stat.st_blksize,
172 struct stat.st_blocks,
173 struct stat.st_flags,
174 struct stat.st_fstype,
175 struct stat.st_gen,
176 struct stat.st_level,
177 struct stat.st_rdev
178]))
Roland McGrath6d2b3492002-12-30 00:51:30 +0000179AC_STAT64
Bernhard Reutner-Fischer9906e6d2009-10-14 16:33:58 +0200180AC_STATFS64
Roland McGrath6d2b3492002-12-30 00:51:30 +0000181
182AC_TYPE_SIGNAL
183AC_TYPE_UID_T
184AC_TYPE_MODE_T
185AC_TYPE_GETGROUPS
186AC_HEADER_MAJOR
Roland McGrathacf06ef2003-01-10 19:57:34 +0000187AC_CHECK_TYPES([sig_atomic_t, siginfo_t],,, [#include <signal.h>])
Roland McGrathe07cd602003-02-26 20:34:02 +0000188AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
189[#include <sys/types.h>
190#include <sys/socket.h>
191#include <netinet/in.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000192AC_CHECK_TYPES([long long])
193AC_LITTLE_ENDIAN_LONG_LONG
194AC_OFF_T_IS_LONG_LONG
Roland McGrath6d2b3492002-12-30 00:51:30 +0000195AC_CHECK_TYPES([struct opthdr],,, [#include <sys/socket.h>])
196AC_CHECK_TYPES([struct t_opthdr],,, [#include <sys/tiuser.h>])
197
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000198AC_CHECK_FUNCS(m4_normalize([
199 fork
200 if_indextoname
201 inet_ntop
202 prctl
203 process_vm_readv
204 sendmsg
205 sigaction
206 stpcpy
207 strerror
208 strsignal
209 _sys_siglist
210 sys_siglist
211]))
212AC_CHECK_HEADERS(m4_normalize([
213 asm/cachectl.h
214 asm/sysmips.h
Dmitry V. Levinc41808b2013-03-18 00:52:29 +0000215 elf.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000216 inttypes.h
217 ioctls.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000218 linux/capability.h
Ben Noordhuis88eafd82013-02-04 00:04:57 +0100219 linux/perf_event.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000220 linux/ptrace.h
221 linux/utsname.h
222 mqueue.h
223 netinet/sctp.h
224 poll.h
225 stropts.h
226 sys/acl.h
227 sys/asynch.h
228 sys/conf.h
229 sys/epoll.h
230 sys/filio.h
231 sys/ioctl.h
232 sys/poll.h
233 sys/ptrace.h
234 sys/reg.h
235 sys/uio.h
236 sys/vfs.h
237]))
Roland McGrath6d2b3492002-12-30 00:51:30 +0000238AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
Roland McGrathe7fa3052007-07-05 20:50:34 +0000239 [], [], [#include <stddef.h>
Andreas Schwab360986b2010-03-08 16:07:52 +0100240#include <sys/socket.h>
241#include <asm/types.h>])
Roland McGrath41074c02002-12-30 10:23:01 +0000242AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
Roland McGrath587c7b52009-02-11 03:03:28 +0000243AC_CHECK_TYPES([struct sigcontext_struct,
244 struct sigcontext],,, [#include <signal.h>])
Roland McGratha7a0d382003-01-10 19:55:30 +0000245AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000246
Roland McGrath6d2b3492002-12-30 00:51:30 +0000247AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000248
Roland McGratha7a0d382003-01-10 19:55:30 +0000249AC_CHECK_MEMBERS([struct T_conn_res.QUEUE_ptr,
250 struct T_conn_res.ACCEPTOR_id],,,
251[#include <sys/stream.h>
252#include <sys/tihdr.h>])
253
Roland McGrath79db8af2003-06-27 21:20:09 +0000254AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
255
Roland McGrathce9f0742004-03-01 21:29:22 +0000256AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg],,,
257 [#include <sys/ptrace.h>])
258
Roland McGrath7decfb22004-03-01 22:10:52 +0000259AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
260
Roland McGrathbe4d9f82005-08-03 12:18:09 +0000261AC_CHECK_MEMBERS([struct dqblk.dqb_curblocks],,, [#include <sys/quota.h>])
262
Roland McGrathfece3222007-07-05 19:08:42 +0000263AC_CHECK_MEMBERS([struct sigcontext.sc_hi2],,, [#include <signal.h>
Roland McGrathd26486e2007-07-11 07:11:20 +0000264#ifdef HAVE_ASM_SIGCONTEXT_H
265# include <asm/sigcontext.h>
266#endif])
Roland McGrathfece3222007-07-05 19:08:42 +0000267
Dmitry V. Levinea22e972012-05-01 20:56:32 +0000268AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
269
Roland McGrath6d2b3492002-12-30 00:51:30 +0000270AC_CHECK_DECLS([sys_errlist])
271AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>])
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000272AC_CHECK_DECLS(m4_normalize([
273 PTRACE_EVENT_CLONE,
274 PTRACE_EVENT_EXEC,
275 PTRACE_EVENT_EXIT,
276 PTRACE_EVENT_FORK,
277 PTRACE_EVENT_VFORK,
278 PTRACE_EVENT_VFORK_DONE,
279 PTRACE_GETEVENTMSG,
280 PTRACE_GETSIGINFO,
281 PTRACE_O_TRACECLONE,
282 PTRACE_O_TRACEEXEC,
283 PTRACE_O_TRACEEXIT,
284 PTRACE_O_TRACEFORK,
285 PTRACE_O_TRACESYSGOOD,
286 PTRACE_O_TRACEVFORK,
287 PTRACE_SETOPTIONS
288]),,, [#include <sys/ptrace.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000289
Dmitry V. Levincf050db2012-05-02 10:21:49 +0000290AC_CHECK_DECLS(m4_normalize([
291 LO_FLAGS_AUTOCLEAR,
292 LO_FLAGS_PARTSCAN
293]),,, [#include <linux/loop.h>])
294
Dmitry V. Levin25caa312011-08-16 21:36:16 +0000295AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
296 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
297#include <stdlib.h>
298#include <linux/fs.h>], [return !BLKGETSIZE64;])],
299 [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
300 if test $ac_cv_have_blkgetsize64 = yes; then
301 AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
302 fi)
303
Dmitry V. Levin63e4f862012-03-15 20:42:46 +0000304AC_CHECK_SIZEOF([long])
Dmitry V. Levin7a498be2013-05-04 19:51:57 +0000305AC_CHECK_SIZEOF([long long])
Dmitry V. Levinb468f232012-03-16 23:05:21 +0400306AC_CHECK_SIZEOF([rlim_t],,[#include <sys/resource.h>])
Dmitry V. Levin63e4f862012-03-15 20:42:46 +0000307
Dmitry V. Levin3b211d82013-03-18 23:28:29 +0000308AC_CHECK_HEADERS([libaio.h], [
309 AC_CHECK_MEMBERS([struct iocb.u.c.flags],,, [#include <libaio.h>])
310 AC_CHECK_DECLS([IO_CMD_PWRITE, IO_CMD_PWRITEV],,, [#include <libaio.h>])
311])
312
Roland McGrath6d2b3492002-12-30 00:51:30 +0000313AC_PATH_PROG([PERL], [perl])
314
Dmitry V. Levin4e4b5ad2011-02-27 00:28:50 +0000315AC_CONFIG_FILES([Makefile tests/Makefile])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000316AC_OUTPUT