blob: 29ea904f9fe4c089ff1cd7610e897137ab545127 [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. Levincf3ecbd2015-08-26 22:50:58 +00009AM_INIT_AUTOMAKE([foreign nostdinc 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
Mike Frysinger58c7fe92015-02-26 22:22:36 -050014AX_PROG_CC_FOR_BUILD
H.J. Lu35be5812012-04-16 13:00:01 +020015AC_USE_SYSTEM_EXTENSIONS
Elvira Khabirova09294222015-08-04 01:47:02 +030016AC_PROG_RANLIB
H.J. Lu35be5812012-04-16 13:00:01 +020017
Roland McGrath6d2b3492002-12-30 00:51:30 +000018AC_MSG_CHECKING([for supported architecture])
19case "$host_cpu" in
Dmitry V. Levin87ea1f42008-11-10 22:21:41 +000020bfin)
21 arch=bfin
22 AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
23 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000024i[[3456]]86|pentium)
25 arch=i386
26 AC_DEFINE([I386], 1, [Define for the i386 architecture.])
27 ;;
28ia64)
29 arch=ia64
30 AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
31 ;;
32m68k)
33 arch=m68k
34 AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
35 ;;
Roland McGrath6d1a65c2004-07-12 07:44:08 +000036sparc64*)
37 arch=sparc64
38 AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
39 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000040sparc*)
41 arch=sparc
42 AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
43 ;;
James Hogan5f999a82013-02-22 14:44:10 +000044metag*)
45 arch=metag
46 AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
47 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000048mips*)
49 arch=mips
50 AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
51 ;;
52alpha*)
53 arch=alpha
54 AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
55 ;;
Roland McGratheb285352003-01-14 09:59:00 +000056powerpc*)
Roland McGrath6d2b3492002-12-30 00:51:30 +000057 AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
Anton Blanchard9afc2ee2013-07-11 12:03:57 +100058 AC_TRY_COMPILE(
59[#ifndef __LP64__
60# error 32 bit
Dmitry V. Levinaf3ab5b2015-01-21 17:04:31 +000061#endif], [], arch=powerpc64, arch=powerpc)
62 if test "$arch" = "powerpc64"; then
Andreas Schwabd69fa492010-07-12 21:39:57 +020063 AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
64 fi
Roland McGrath6d2b3492002-12-30 00:51:30 +000065 ;;
66arm*)
67 arch=arm
68 AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
69 ;;
Steve McIntyred8d3bd32012-10-24 17:58:16 +010070aarch64*)
71 arch=aarch64
72 AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
73 ;;
Denys Vlasenko5ae2b7c2009-02-27 20:32:52 +000074avr32*)
75 arch=avr32
76 AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
77 ;;
Vineet Gupta7daacbb2013-08-16 12:47:06 +053078arc*)
79 arch=arc
80 AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
81 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +000082s390)
83 arch=s390
84 AC_DEFINE([S390], 1, [Define for the S390 architecture.])
85 ;;
86s390x)
87 arch=s390x
88 AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
89 ;;
90hppa*|parisc*)
91 arch=hppa
92 AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
93 ;;
Roland McGrath67828ca2007-11-01 21:32:49 +000094sh64*)
Roland McGrathf5a47772003-06-26 22:40:42 +000095 arch=sh64
96 AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
Roland McGrathe1e584b2003-06-02 19:18:58 +000097 ;;
Roland McGrath67828ca2007-11-01 21:32:49 +000098sh*)
99 arch=sh
100 AC_DEFINE([SH], 1, [Define for the SH architecture.])
101 ;;
Roland McGrath6d2b3492002-12-30 00:51:30 +0000102x86?64*)
H.J. Lu35be5812012-04-16 13:00:01 +0200103 AC_TRY_COMPILE(
104[#ifndef __ILP32__
105# error not x32
106#endif], [], arch=x32, arch=x86_64)
107 if test "$arch" = "x86_64"; then
108 AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
109 else
110 AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
111 fi
Roland McGrath6d2b3492002-12-30 00:51:30 +0000112 ;;
Denys Vlasenkoea0e6e82009-02-25 17:08:40 +0000113cris|crisv10)
114 arch=crisv10
115 AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
116 ;;
117crisv32)
118 arch=crisv32
119 AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
120 ;;
Chris Metcalfc8c66982009-12-28 10:00:15 -0500121tile*)
122 arch=tile
123 AC_DEFINE([TILE], 1, [Define for the Tile architecture])
124 ;;
Edgar E. Iglesias939caba2010-07-06 14:21:07 +0200125microblaze*)
126 arch=microblaze
127 AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
128 ;;
Ezequiel Garciabd8dd772015-04-18 17:33:27 -0300129nios2*)
130 arch=nios2
131 AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
132 ;;
133
Christian Svensson492f81f2013-02-14 13:26:27 +0100134or1k*)
135 arch=or1k
136 AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
137 ;;
138
Chris Zankel8f636ed2013-03-25 10:22:07 -0700139xtensa*)
140 arch=xtensa
141 AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
142 ;;
143
Roland McGrath6d2b3492002-12-30 00:51:30 +0000144*)
145 AC_MSG_RESULT([NO!])
146 AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
147 ;;
148esac
149AC_MSG_RESULT($arch)
150
Roland McGrath6d2b3492002-12-30 00:51:30 +0000151AC_SUBST(arch)
Roland McGrath6d2b3492002-12-30 00:51:30 +0000152
Dmitry V. Levin047365e2015-02-15 01:08:48 +0000153if test "$arch" = mips; then
Dmitry V. Levin6684b682015-08-18 22:53:22 +0000154 AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
155 [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
156 [#include <sgidefs.h>],
157 [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
158
159 AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
Dmitry V. Levin047365e2015-02-15 01:08:48 +0000160 [AC_COMPILE_IFELSE(
161 [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
162 [[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
Dmitry V. Levin6684b682015-08-18 22:53:22 +0000163 [st_cv_mips_abi=o32],
Dmitry V. Levin047365e2015-02-15 01:08:48 +0000164 [AC_COMPILE_IFELSE(
165 [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
166 [[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
Dmitry V. Levin6684b682015-08-18 22:53:22 +0000167 [st_cv_mips_abi=n32],
Dmitry V. Levin047365e2015-02-15 01:08:48 +0000168 [AC_COMPILE_IFELSE(
169 [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
170 [[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
Dmitry V. Levin6684b682015-08-18 22:53:22 +0000171 [st_cv_mips_abi=n64],
172 [st_cv_mips_abi=unknown])])])])
173
174 case "$st_cv_mips_abi" in
Dmitry V. Levin047365e2015-02-15 01:08:48 +0000175 o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
176 n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
177 n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
178 *) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
179 esac
180fi
181
Dmitry V. Levin0160e162014-03-18 23:37:43 +0000182AC_ARG_ENABLE([arm-oabi],
183 [AS_HELP_STRING([--enable-arm-oabi],
184 [enable OABI support on ARM EABI])],
185 [], [enable_arm_oabi=no])
186case "$enable_arm_oabi" in
187 yes) enable_arm_oabi=1 ;;
188 no) enable_arm_oabi=0 ;;
189 *) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
190esac
191AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
192 [Define to 1 if you want OABI support on ARM EABI.])
193
Dmitry V. Levin918e49b2010-09-09 17:41:15 +0000194gl_WARN_ADD([-Wall])
Dmitry V. Levin1ed5d802010-09-09 17:42:28 +0000195gl_WARN_ADD([-Wwrite-strings])
Dmitry V. Levin3ed5d022014-09-10 13:46:04 +0000196gl_WARN_ADD([-Wsign-compare])
Dmitry V. Levind376c922012-05-15 00:50:26 +0000197AC_ARG_ENABLE([gcc-Werror],
198 [AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
199 [case $enableval in
200 yes) gl_WARN_ADD([-Werror]) ;;
201 no) ;;
202 *) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
203 esac]
204)
Dmitry V. Levin918e49b2010-09-09 17:41:15 +0000205AC_SUBST([WARN_CFLAGS])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000206
207AC_PROG_CPP
Roland McGrath6d2b3492002-12-30 00:51:30 +0000208AC_PROG_INSTALL
209AC_C_CONST
Mike Frysinger6d12afd2010-09-12 03:39:55 -0400210AC_C_BIGENDIAN
Roland McGrath6d2b3492002-12-30 00:51:30 +0000211AC_HEADER_STDC
Roland McGrath639658b2008-08-01 01:06:31 +0000212AC_HEADER_STDBOOL
Roland McGrath6d2b3492002-12-30 00:51:30 +0000213AC_HEADER_DIRENT
214AC_HEADER_STAT
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000215AC_CHECK_MEMBERS(m4_normalize([
Dmitry V. Levin525eed32015-08-08 12:12:13 +0000216 struct stat.st_atim.tv_nsec,
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000217 struct stat.st_blksize,
218 struct stat.st_blocks,
Dmitry V. Levin525eed32015-08-08 12:12:13 +0000219 struct stat.st_ctim.tv_nsec,
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000220 struct stat.st_flags,
221 struct stat.st_fstype,
222 struct stat.st_gen,
Dmitry V. Levin525eed32015-08-08 12:12:13 +0000223 struct stat.st_mtim.tv_nsec,
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000224 struct stat.st_rdev
225]))
Roland McGrath6d2b3492002-12-30 00:51:30 +0000226
227AC_TYPE_SIGNAL
228AC_TYPE_UID_T
229AC_TYPE_MODE_T
230AC_TYPE_GETGROUPS
231AC_HEADER_MAJOR
Dmitry V. Levind8890b52015-02-07 15:47:24 +0000232AC_CHECK_TYPES([sig_atomic_t],,, [#include <signal.h>])
Roland McGrathe07cd602003-02-26 20:34:02 +0000233AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
234[#include <sys/types.h>
235#include <sys/socket.h>
236#include <netinet/in.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000237AC_LITTLE_ENDIAN_LONG_LONG
Roland McGrath6d2b3492002-12-30 00:51:30 +0000238
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000239AC_CHECK_FUNCS(m4_normalize([
Dmitry V. Levin1ea64732015-01-10 00:08:58 +0000240 fanotify_mark
Dmitry V. Levind3541302014-02-26 00:01:00 +0000241 fopen64
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000242 fork
Dmitry V. Levind3541302014-02-26 00:01:00 +0000243 fputs_unlocked
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000244 if_indextoname
245 inet_ntop
Dmitry V. Levin7bee4622015-06-08 14:19:46 +0000246 inet_pton
Dmitry V. Levin78ed3f32015-03-23 00:04:27 +0000247 pipe2
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000248 prctl
Mike Frysinger97ca0272014-08-11 02:52:08 -0400249 preadv
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000250 process_vm_readv
Mike Frysinger97ca0272014-08-11 02:52:08 -0400251 pwritev
Masatake YAMATO993198d2014-11-07 01:23:27 +0900252 sendmmsg
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000253 sigaction
Dmitry V. Levin30ac0622015-08-03 09:47:25 +0000254 signalfd
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000255 stpcpy
256 strerror
257 strsignal
Dmitry V. Levin78e48eb2015-07-15 15:34:59 +0000258 utimensat
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000259]))
260AC_CHECK_HEADERS(m4_normalize([
261 asm/cachectl.h
262 asm/sysmips.h
Lubomir Rintelc400a1c2014-10-03 11:40:28 +0200263 bluetooth/bluetooth.h
Dmitry V. Levinc41808b2013-03-18 00:52:29 +0000264 elf.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000265 inttypes.h
266 ioctls.h
Bart Van Assche67d0a8e2015-02-06 13:37:03 +0100267 linux/bsg.h
Dmitry V. Levin52572b62014-12-11 19:21:54 +0000268 linux/falloc.h
Dmitry V. Levin2af69032015-02-04 23:50:50 +0000269 linux/filter.h
Dmitry V. Levindf7aa2b2015-01-19 17:02:16 +0000270 linux/hiddev.h
Mike Frysinger54646b82015-08-19 13:29:27 -0400271 linux/ip_vs.h
Mike Frysingerba10a422015-10-31 00:47:53 -0400272 linux/ipc.h
Dmitry V. Levindf7aa2b2015-01-19 17:02:16 +0000273 linux/mmtimer.h
Mike Frysingerba10a422015-10-31 00:47:53 -0400274 linux/msg.h
Ben Noordhuis88eafd82013-02-04 00:04:57 +0100275 linux/perf_event.h
Dmitry V. Levin2af69032015-02-04 23:50:50 +0000276 linux/seccomp.h
Dmitry V. Levin1e880732015-02-14 01:51:03 +0000277 linux/securebits.h
Mike Frysingerba10a422015-10-31 00:47:53 -0400278 linux/sem.h
279 linux/shm.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000280 linux/utsname.h
281 mqueue.h
282 netinet/sctp.h
Dmitry V. Levinfdb896e2014-02-25 23:04:55 +0000283 scsi/sg.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000284 stropts.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000285 sys/conf.h
286 sys/epoll.h
Dmitry V. Levinc8cba992015-08-01 21:08:13 +0000287 sys/eventfd.h
Dmitry V. Levin1ea64732015-01-10 00:08:58 +0000288 sys/fanotify.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000289 sys/ioctl.h
Mike Frysingerba10a422015-10-31 00:47:53 -0400290 sys/ipc.h
291 sys/msg.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000292 sys/reg.h
Mike Frysingerba10a422015-10-31 00:47:53 -0400293 sys/sem.h
294 sys/shm.h
Dmitry V. Levin30ac0622015-08-03 09:47:25 +0000295 sys/signalfd.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000296 sys/vfs.h
Masatake YAMATOf5480672014-11-22 19:03:33 +0900297 sys/xattr.h
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000298]))
Mike Frysingerba10a422015-10-31 00:47:53 -0400299AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000300AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
Roland McGrathe7fa3052007-07-05 20:50:34 +0000301 [], [], [#include <stddef.h>
Andreas Schwab360986b2010-03-08 16:07:52 +0100302#include <sys/socket.h>
303#include <asm/types.h>])
Roland McGrath41074c02002-12-30 10:23:01 +0000304AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
Dmitry V. Levine2de3bd2013-11-12 15:27:38 +0000305AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
Roland McGratha7a0d382003-01-10 19:55:30 +0000306AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
Mike Frysinger54646b82015-08-19 13:29:27 -0400307AC_CHECK_HEADERS(m4_normalize([
308 linux/netfilter_arp/arp_tables.h
309 linux/netfilter_bridge/ebtables.h
310 linux/netfilter_ipv4/ip_tables.h
311 linux/netfilter_ipv6/ip6_tables.h
312]), [], [], [#include <netinet/in.h>
313#include <net/if.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000314
Masatake YAMATOcaf6a432014-11-07 01:23:25 +0900315AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000316AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000317
Dmitry V. Levin525eed32015-08-08 12:12:13 +0000318AC_CHECK_MEMBERS(m4_normalize([
319 struct stat.st_atime_nsec,
320 struct stat.st_ctime_nsec,
321 struct stat.st_mtime_nsec
322]),,, [#include <sys/types.h>
323#include <asm/stat.h>])
324
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000325AC_CHECK_TYPES([struct stat64],,, [#include <sys/types.h>
326#include <asm/stat.h>])
Roland McGrath79db8af2003-06-27 21:20:09 +0000327AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
Dmitry V. Levin9e6a7bf2015-01-08 04:12:29 +0000328AC_CHECK_TYPES([struct statfs64],,, [#include <sys/vfs.h>])
Roland McGrath79db8af2003-06-27 21:20:09 +0000329
Ali Polatel0b4060f2013-09-24 20:04:32 +0300330AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
Roland McGrathce9f0742004-03-01 21:29:22 +0000331 [#include <sys/ptrace.h>])
332
Dmitry V. Levinea22e972012-05-01 20:56:32 +0000333AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
334
Dmitry V. Levinae5aa472013-11-11 23:54:30 +0000335AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
Dmitry V. Levinbc091e32014-03-11 22:18:40 +0000336 struct sigevent.__pad,
Dmitry V. Levin36ab3d52015-01-13 09:24:04 +0300337 siginfo_t.si_syscall,
338 siginfo_t.si_timerid,
339 siginfo_t.si_overrun],,, [#include <signal.h>])
Dmitry V. Levinae5aa472013-11-11 23:54:30 +0000340
Dmitry V. Levin6250e6c2015-10-09 01:38:07 +0000341AC_CHECK_TYPES([struct flock,
342 struct flock64,
343 struct __kernel_flock,
344 struct __kernel_flock64],,, [#include <linux/fcntl.h>])
Dmitry V. Levin594eb8f2013-11-12 21:49:03 +0000345
Dmitry V. Levin0dbb7ac2015-09-16 23:15:55 +0000346AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
347
Dmitry V. Levin19dadf92015-02-22 02:50:33 +0300348AC_CHECK_HEADERS([linux/input.h], [
349 AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
350])
351
Dmitry V. Levin4e3ded32015-07-29 16:27:16 +0000352AC_CHECK_HEADERS([linux/bpf.h], [
353 AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
354 [st_cv_have_union_bpf_attr_log_buf],
355 [AC_COMPILE_IFELSE(
356 [AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
357 [[union bpf_attr a = { .log_buf = 0 };]])],
358 [st_cv_have_union_bpf_attr_log_buf=yes],
359 [st_cv_have_union_bpf_attr_log_buf=no])])
360 if test $st_cv_have_union_bpf_attr_log_buf = yes; then
361 AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
362 [Define to 1 if union bpf_attr.log_buf initialization works])
363 fi
364])
365
Roland McGrath6d2b3492002-12-30 00:51:30 +0000366AC_CHECK_DECLS([sys_errlist])
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000367AC_CHECK_DECLS(m4_normalize([
Dmitry V. Levin6974bd42013-11-12 21:20:50 +0000368 PTRACE_PEEKUSER,
Dmitry V. Levinfadf3792015-02-13 00:26:38 +0000369 PTRACE_POKEUSER
Dmitry V. Levind8879f42012-03-25 15:12:16 +0000370]),,, [#include <sys/ptrace.h>])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000371
Dmitry V. Levincf050db2012-05-02 10:21:49 +0000372AC_CHECK_DECLS(m4_normalize([
Dmitry V. Levind8ad1dd2014-04-26 15:22:08 +0000373 P_PID,
374 P_PPID,
375 P_PGID,
376 P_SID,
377 P_CID,
378 P_UID,
379 P_GID,
380 P_ALL,
381 P_LWPID
382]),,, [#include <sys/wait.h>])
383
384AC_CHECK_DECLS(m4_normalize([
Dmitry V. Levinbaf60d92014-04-26 14:12:33 +0000385 LO_FLAGS_READ_ONLY,
Dmitry V. Levincf050db2012-05-02 10:21:49 +0000386 LO_FLAGS_AUTOCLEAR,
387 LO_FLAGS_PARTSCAN
388]),,, [#include <linux/loop.h>])
389
Dmitry V. Levin6dbbe072014-04-26 13:54:12 +0000390AC_CHECK_DECLS(m4_normalize([
391 CTL_KERN,
392 CTL_VM,
393 CTL_NET,
394 CTL_PROC,
395 CTL_FS,
396 CTL_DEBUG,
397 CTL_DEV,
398 CTL_BUS,
399 CTL_ABI,
400 CTL_CPU,
401 CTL_ARLAN,
402 CTL_S390DBF,
403 CTL_SUNRPC,
404 CTL_PM,
405 CTL_FRV,
406 KERN_OSTYPE,
407 KERN_OSRELEASE,
408 KERN_OSREV,
409 KERN_VERSION,
410 KERN_SECUREMASK,
411 KERN_PROF,
412 KERN_NODENAME,
413 KERN_DOMAINNAME,
414 KERN_PANIC,
415 KERN_REALROOTDEV,
416 KERN_SPARC_REBOOT,
417 KERN_CTLALTDEL,
418 KERN_PRINTK,
419 KERN_NAMETRANS,
420 KERN_PPC_HTABRECLAIM,
421 KERN_PPC_ZEROPAGED,
422 KERN_PPC_POWERSAVE_NAP,
423 KERN_MODPROBE,
424 KERN_SG_BIG_BUFF,
425 KERN_ACCT,
426 KERN_PPC_L2CR,
427 KERN_RTSIGNR,
428 KERN_RTSIGMAX,
429 KERN_SHMMAX,
430 KERN_MSGMAX,
431 KERN_MSGMNB,
432 KERN_MSGPOOL,
433 KERN_SYSRQ,
434 KERN_MAX_THREADS,
435 KERN_RANDOM,
436 KERN_SHMALL,
437 KERN_MSGMNI,
438 KERN_SEM,
439 KERN_SPARC_STOP_A,
440 KERN_SHMMNI,
441 KERN_OVERFLOWUID,
442 KERN_OVERFLOWGID,
443 KERN_SHMPATH,
444 KERN_HOTPLUG,
445 KERN_IEEE_EMULATION_WARNINGS,
446 KERN_S390_USER_DEBUG_LOGGING,
447 KERN_CORE_USES_PID,
448 KERN_TAINTED,
449 KERN_CADPID,
450 KERN_PIDMAX,
451 KERN_CORE_PATTERN,
452 KERN_PANIC_ON_OOPS,
453 KERN_HPPA_PWRSW,
454 KERN_HPPA_UNALIGNED,
455 KERN_PRINTK_RATELIMIT,
456 KERN_PRINTK_RATELIMIT_BURST,
457 KERN_PTY,
458 KERN_NGROUPS_MAX,
459 KERN_SPARC_SCONS_PWROFF,
460 KERN_HZ_TIMER,
461 KERN_UNKNOWN_NMI_PANIC,
462 KERN_BOOTLOADER_TYPE,
463 KERN_RANDOMIZE,
464 KERN_SETUID_DUMPABLE,
465 KERN_SPIN_RETRY,
466 KERN_ACPI_VIDEO_FLAGS,
467 KERN_IA64_UNALIGNED,
468 KERN_COMPAT_LOG,
469 KERN_MAX_LOCK_DEPTH,
470 KERN_NMI_WATCHDOG,
471 KERN_PANIC_ON_NMI,
472 NET_CORE,
473 NET_ETHER,
474 NET_802,
475 NET_UNIX,
476 NET_IPV4,
477 NET_IPX,
478 NET_ATALK,
479 NET_NETROM,
480 NET_AX25,
481 NET_BRIDGE,
482 NET_ROSE,
483 NET_IPV6,
484 NET_X25,
485 NET_TR,
486 NET_DECNET,
487 NET_ECONET,
488 NET_SCTP,
489 NET_LLC,
490 NET_NETFILTER,
491 NET_DCCP,
492 NET_IRDA,
493 NET_CORE_WMEM_MAX,
494 NET_CORE_RMEM_MAX,
495 NET_CORE_WMEM_DEFAULT,
496 NET_CORE_RMEM_DEFAULT,
497 NET_CORE_DESTROY_DELAY,
498 NET_CORE_MAX_BACKLOG,
499 NET_CORE_FASTROUTE,
500 NET_CORE_MSG_COST,
501 NET_CORE_MSG_BURST,
502 NET_CORE_OPTMEM_MAX,
503 NET_CORE_HOT_LIST_LENGTH,
504 NET_CORE_DIVERT_VERSION,
505 NET_CORE_NO_CONG_THRESH,
506 NET_CORE_NO_CONG,
507 NET_CORE_LO_CONG,
508 NET_CORE_MOD_CONG,
509 NET_CORE_DEV_WEIGHT,
510 NET_CORE_SOMAXCONN,
511 NET_CORE_BUDGET,
512 NET_CORE_AEVENT_ETIME,
513 NET_CORE_AEVENT_RSEQTH,
514 NET_CORE_WARNINGS,
515 NET_IPV4_FORWARD,
516 NET_IPV4_DYNADDR,
517 NET_IPV4_CONF,
518 NET_IPV4_NEIGH,
519 NET_IPV4_ROUTE,
520 NET_IPV4_FIB_HASH,
521 NET_IPV4_NETFILTER,
522 NET_IPV4_TCP_TIMESTAMPS,
523 NET_IPV4_TCP_WINDOW_SCALING,
524 NET_IPV4_TCP_SACK,
525 NET_IPV4_TCP_RETRANS_COLLAPSE,
526 NET_IPV4_DEFAULT_TTL,
527 NET_IPV4_AUTOCONFIG,
528 NET_IPV4_NO_PMTU_DISC,
529 NET_IPV4_TCP_SYN_RETRIES,
530 NET_IPV4_IPFRAG_HIGH_THRESH,
531 NET_IPV4_IPFRAG_LOW_THRESH,
532 NET_IPV4_IPFRAG_TIME,
533 NET_IPV4_TCP_MAX_KA_PROBES,
534 NET_IPV4_TCP_KEEPALIVE_TIME,
535 NET_IPV4_TCP_KEEPALIVE_PROBES,
536 NET_IPV4_TCP_RETRIES1,
537 NET_IPV4_TCP_RETRIES2,
538 NET_IPV4_TCP_FIN_TIMEOUT,
539 NET_IPV4_IP_MASQ_DEBUG,
540 NET_TCP_SYNCOOKIES,
541 NET_TCP_STDURG,
542 NET_TCP_RFC1337,
543 NET_TCP_SYN_TAILDROP,
544 NET_TCP_MAX_SYN_BACKLOG,
545 NET_IPV4_LOCAL_PORT_RANGE,
546 NET_IPV4_ICMP_ECHO_IGNORE_ALL,
547 NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
548 NET_IPV4_ICMP_SOURCEQUENCH_RATE,
549 NET_IPV4_ICMP_DESTUNREACH_RATE,
550 NET_IPV4_ICMP_TIMEEXCEED_RATE,
551 NET_IPV4_ICMP_PARAMPROB_RATE,
552 NET_IPV4_ICMP_ECHOREPLY_RATE,
553 NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
554 NET_IPV4_IGMP_MAX_MEMBERSHIPS,
555 NET_TCP_TW_RECYCLE,
556 NET_IPV4_ALWAYS_DEFRAG,
557 NET_IPV4_TCP_KEEPALIVE_INTVL,
558 NET_IPV4_INET_PEER_THRESHOLD,
559 NET_IPV4_INET_PEER_MINTTL,
560 NET_IPV4_INET_PEER_MAXTTL,
561 NET_IPV4_INET_PEER_GC_MINTIME,
562 NET_IPV4_INET_PEER_GC_MAXTIME,
563 NET_TCP_ORPHAN_RETRIES,
564 NET_TCP_ABORT_ON_OVERFLOW,
565 NET_TCP_SYNACK_RETRIES,
566 NET_TCP_MAX_ORPHANS,
567 NET_TCP_MAX_TW_BUCKETS,
568 NET_TCP_FACK,
569 NET_TCP_REORDERING,
570 NET_TCP_ECN,
571 NET_TCP_DSACK,
572 NET_TCP_MEM,
573 NET_TCP_WMEM,
574 NET_TCP_RMEM,
575 NET_TCP_APP_WIN,
576 NET_TCP_ADV_WIN_SCALE,
577 NET_IPV4_NONLOCAL_BIND,
578 NET_IPV4_ICMP_RATELIMIT,
579 NET_IPV4_ICMP_RATEMASK,
580 NET_TCP_TW_REUSE,
581 NET_TCP_FRTO,
582 NET_TCP_LOW_LATENCY,
583 NET_IPV4_IPFRAG_SECRET_INTERVAL,
584 NET_IPV4_IGMP_MAX_MSF,
585 NET_TCP_NO_METRICS_SAVE,
586 NET_TCP_DEFAULT_WIN_SCALE,
587 NET_TCP_MODERATE_RCVBUF,
588 NET_TCP_TSO_WIN_DIVISOR,
589 NET_TCP_BIC_BETA,
590 NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
591 NET_TCP_CONG_CONTROL,
592 NET_TCP_ABC,
593 NET_IPV4_IPFRAG_MAX_DIST,
594 NET_TCP_MTU_PROBING,
595 NET_TCP_BASE_MSS,
596 NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
597 NET_TCP_DMA_COPYBREAK,
598 NET_TCP_SLOW_START_AFTER_IDLE,
599 NET_CIPSOV4_CACHE_ENABLE,
600 NET_CIPSOV4_CACHE_BUCKET_SIZE,
601 NET_CIPSOV4_RBM_OPTFMT,
602 NET_CIPSOV4_RBM_STRICTVALID,
603 NET_TCP_AVAIL_CONG_CONTROL,
604 NET_TCP_ALLOWED_CONG_CONTROL,
605 NET_TCP_MAX_SSTHRESH,
606 NET_TCP_FRTO_RESPONSE,
607 NET_IPV4_ROUTE_FLUSH,
608 NET_IPV4_ROUTE_MIN_DELAY,
609 NET_IPV4_ROUTE_MAX_DELAY,
610 NET_IPV4_ROUTE_GC_THRESH,
611 NET_IPV4_ROUTE_MAX_SIZE,
612 NET_IPV4_ROUTE_GC_MIN_INTERVAL,
613 NET_IPV4_ROUTE_GC_TIMEOUT,
614 NET_IPV4_ROUTE_GC_INTERVAL,
615 NET_IPV4_ROUTE_REDIRECT_LOAD,
616 NET_IPV4_ROUTE_REDIRECT_NUMBER,
617 NET_IPV4_ROUTE_REDIRECT_SILENCE,
618 NET_IPV4_ROUTE_ERROR_COST,
619 NET_IPV4_ROUTE_ERROR_BURST,
620 NET_IPV4_ROUTE_GC_ELASTICITY,
621 NET_IPV4_ROUTE_MTU_EXPIRES,
622 NET_IPV4_ROUTE_MIN_PMTU,
623 NET_IPV4_ROUTE_MIN_ADVMSS,
624 NET_IPV4_ROUTE_SECRET_INTERVAL,
625 NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
626 NET_IPV4_CONF_FORWARDING,
627 NET_IPV4_CONF_MC_FORWARDING,
628 NET_IPV4_CONF_PROXY_ARP,
629 NET_IPV4_CONF_ACCEPT_REDIRECTS,
630 NET_IPV4_CONF_SECURE_REDIRECTS,
631 NET_IPV4_CONF_SEND_REDIRECTS,
632 NET_IPV4_CONF_SHARED_MEDIA,
633 NET_IPV4_CONF_RP_FILTER,
634 NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE,
635 NET_IPV4_CONF_BOOTP_RELAY,
636 NET_IPV4_CONF_LOG_MARTIANS,
637 NET_IPV4_CONF_TAG,
638 NET_IPV4_CONF_ARPFILTER,
639 NET_IPV4_CONF_MEDIUM_ID,
640 NET_IPV4_CONF_NOXFRM,
641 NET_IPV4_CONF_NOPOLICY,
642 NET_IPV4_CONF_FORCE_IGMP_VERSION,
643 NET_IPV4_CONF_ARP_ANNOUNCE,
644 NET_IPV4_CONF_ARP_IGNORE,
645 NET_IPV4_CONF_PROMOTE_SECONDARIES,
646 NET_IPV4_CONF_ARP_ACCEPT,
647 NET_IPV4_CONF_ARP_NOTIFY,
648 NET_IPV6_CONF,
649 NET_IPV6_NEIGH,
650 NET_IPV6_ROUTE,
651 NET_IPV6_ICMP,
652 NET_IPV6_BINDV6ONLY,
653 NET_IPV6_IP6FRAG_HIGH_THRESH,
654 NET_IPV6_IP6FRAG_LOW_THRESH,
655 NET_IPV6_IP6FRAG_TIME,
656 NET_IPV6_IP6FRAG_SECRET_INTERVAL,
657 NET_IPV6_MLD_MAX_MSF,
658 NET_IPV6_ROUTE_FLUSH,
659 NET_IPV6_ROUTE_GC_THRESH,
660 NET_IPV6_ROUTE_MAX_SIZE,
661 NET_IPV6_ROUTE_GC_MIN_INTERVAL,
662 NET_IPV6_ROUTE_GC_TIMEOUT,
663 NET_IPV6_ROUTE_GC_INTERVAL,
664 NET_IPV6_ROUTE_GC_ELASTICITY,
665 NET_IPV6_ROUTE_MTU_EXPIRES,
666 NET_IPV6_ROUTE_MIN_ADVMSS,
667 NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
668 NET_UNIX_DESTROY_DELAY,
669 NET_UNIX_DELETE_DELAY,
670 NET_UNIX_MAX_DGRAM_QLEN,
671 VM_OVERCOMMIT_MEMORY,
672 VM_PAGE_CLUSTER,
673 VM_DIRTY_BACKGROUND,
674 VM_DIRTY_RATIO,
675 VM_DIRTY_WB_CS,
676 VM_DIRTY_EXPIRE_CS,
677 VM_NR_PDFLUSH_THREADS,
678 VM_OVERCOMMIT_RATIO,
679 VM_PAGEBUF,
680 VM_HUGETLB_PAGES,
681 VM_SWAPPINESS,
682 VM_LOWMEM_RESERVE_RATIO,
683 VM_MIN_FREE_KBYTES,
684 VM_MAX_MAP_COUNT,
685 VM_LAPTOP_MODE,
686 VM_BLOCK_DUMP,
687 VM_HUGETLB_GROUP,
688 VM_VFS_CACHE_PRESSURE,
689 VM_LEGACY_VA_LAYOUT,
690 VM_SWAP_TOKEN_TIMEOUT
691]),,,
692[#include <sys/types.h>
693#include <linux/sysctl.h>])
694
Philippe De Muyter0cc96142014-11-03 21:27:40 +0100695AC_CHECK_DECLS(m4_normalize([
696 V4L2_FIELD_ANY,
697 V4L2_FIELD_NONE,
698 V4L2_FIELD_TOP,
699 V4L2_FIELD_BOTTOM,
700 V4L2_FIELD_INTERLACED,
701 V4L2_FIELD_SEQ_TB,
702 V4L2_FIELD_SEQ_BT,
703 V4L2_FIELD_ALTERNATE,
704 V4L2_FIELD_INTERLACED_TB,
705 V4L2_FIELD_INTERLACED_BT,
706 V4L2_BUF_TYPE_VIDEO_CAPTURE,
707 V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
708 V4L2_BUF_TYPE_VIDEO_OUTPUT,
709 V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
710 V4L2_BUF_TYPE_VIDEO_OVERLAY,
711 V4L2_BUF_TYPE_VBI_CAPTURE,
712 V4L2_BUF_TYPE_VBI_OUTPUT,
713 V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
714 V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
715 V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
716 V4L2_TUNER_RADIO,
717 V4L2_TUNER_ANALOG_TV,
718 V4L2_TUNER_DIGITAL_TV,
719 V4L2_MEMORY_MMAP,
720 V4L2_MEMORY_USERPTR,
721 V4L2_MEMORY_OVERLAY,
722 V4L2_MEMORY_DMABUF,
723 V4L2_COLORSPACE_SMPTE170M,
724 V4L2_COLORSPACE_SMPTE240M,
725 V4L2_COLORSPACE_REC709,
726 V4L2_COLORSPACE_BT878,
727 V4L2_COLORSPACE_470_SYSTEM_M,
728 V4L2_COLORSPACE_470_SYSTEM_BG,
729 V4L2_COLORSPACE_JPEG,
730 V4L2_COLORSPACE_SRGB,
731 V4L2_PRIORITY_UNSET,
732 V4L2_PRIORITY_BACKGROUND,
733 V4L2_PRIORITY_INTERACTIVE,
734 V4L2_PRIORITY_RECORD,
735 V4L2_FRMSIZE_TYPE_DISCRETE,
736 V4L2_FRMSIZE_TYPE_CONTINUOUS,
737 V4L2_FRMSIZE_TYPE_STEPWISE,
738 V4L2_FRMIVAL_TYPE_DISCRETE,
739 V4L2_FRMIVAL_TYPE_CONTINUOUS,
740 V4L2_FRMIVAL_TYPE_STEPWISE,
741 V4L2_CTRL_TYPE_INTEGER,
742 V4L2_CTRL_TYPE_BOOLEAN,
743 V4L2_CTRL_TYPE_MENU,
744 V4L2_CTRL_TYPE_BUTTON,
745 V4L2_CTRL_TYPE_INTEGER64,
746 V4L2_CTRL_TYPE_CTRL_CLASS,
747 V4L2_CTRL_TYPE_STRING,
748 V4L2_CTRL_TYPE_BITMASK,
749 V4L2_CTRL_TYPE_INTEGER_MENU
750]),,, [#include <linux/videodev2.h>])
751
Dmitry V. Levin25caa312011-08-16 21:36:16 +0000752AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
753 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
754#include <stdlib.h>
755#include <linux/fs.h>], [return !BLKGETSIZE64;])],
756 [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
757 if test $ac_cv_have_blkgetsize64 = yes; then
758 AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
759 fi)
760
Dmitry V. Levin63e4f862012-03-15 20:42:46 +0000761AC_CHECK_SIZEOF([long])
Dmitry V. Levin7a498be2013-05-04 19:51:57 +0000762AC_CHECK_SIZEOF([long long])
Dmitry V. Levin54cabef2014-03-03 23:09:47 +0000763AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
Dmitry V. Levin8c20d892015-05-21 16:19:40 +0000764AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
Dmitry V. Levin63e4f862012-03-15 20:42:46 +0000765
Dmitry V. Levin59f63d32015-03-05 05:03:41 +0000766AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
767 [[st_cv_SIGRTMIN="$(echo SIGRTMIN |
768 $CPP $CPPFLAGS -P -imacros asm/signal.h - |
769 grep '^[0-9]')"
770 test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
771if test "x$st_cv_SIGRTMIN" != xno; then
772 AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
773 [SIGRTMIN defined in <asm/signal.h>])
774fi
775AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
776 [st_cv_SA_RESTORER="$(echo SA_RESTORER |
Dmitry V. Levinab3953b2014-02-08 00:15:52 +0000777 $CPP $CPPFLAGS -P -imacros asm/signal.h - |
778 grep ^0x)"
Dmitry V. Levin59f63d32015-03-05 05:03:41 +0000779 test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
780if test "x$st_cv_SA_RESTORER" != xno; then
781 AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
Dmitry V. Levinab3953b2014-02-08 00:15:52 +0000782 [SA_RESTORER defined in <asm/signal.h>])
783fi
784
Dmitry V. Levin38593e92014-02-26 16:51:28 +0000785AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
786 [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
787 [st_cv_have___builtin_popcount=yes],
788 [st_cv_have___builtin_popcount=no])])
789if test "x$st_cv_have___builtin_popcount" = xyes; then
790 AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
791 [Define to 1 if the system provides __builtin_popcount function])
792fi
793
Dmitry V. Levin856b7592015-02-27 05:01:25 +0000794AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
Dmitry V. Levin977550d2015-02-27 04:09:56 +0000795if test "x$ac_cv_lib_dl_dladdr" = xyes; then
796 AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
Dmitry V. Levin977550d2015-02-27 04:09:56 +0000797fi
798AC_SUBST(dl_LIBS)
799
Roland McGrath6d2b3492002-12-30 00:51:30 +0000800AC_PATH_PROG([PERL], [perl])
801
Luca Clementi327064b2013-07-23 00:11:35 -0700802dnl stack trace with libunwind
803libunwind_CPPFLAGS=
804libunwind_LDFLAGS=
805libunwind_LIBS=
806AC_ARG_WITH([libunwind],
807 [AS_HELP_STRING([--with-libunwind],
808 [use libunwind to implement stack tracing support])],
809 [case "${withval}" in
810 yes|no|check) ;;
811 *) with_libunwind=yes
812 libunwind_CPPFLAGS="-I${withval}/include"
813 libunwind_LDFLAGS="-L${withval}/lib" ;;
814 esac],
815 [with_libunwind=check]
816)
817
818use_libunwind=no
819AS_IF([test "x$with_libunwind" != xno],
820 [saved_CPPFLAGS="$CPPFLAGS"
821 CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
822
823 AC_CHECK_HEADERS([libunwind-ptrace.h],
824 [saved_LDFLAGS="$LDFLAGS"
825 LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
826
827 AC_CHECK_LIB([unwind], [backtrace],
828 [libunwind_LIBS="-lunwind $libunwind_LIBS"
829
830 AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
831 saved_LIBS="$LIBS"
832 LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
833
834 AC_LINK_IFELSE(
835 [AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
836 [[return !unw_create_addr_space(0, 0)]])
837 ],
838 [AC_MSG_RESULT([yes])
839 libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
840
841 AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
842 [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
843 use_libunwind=yes
844 ],
845 [if test "x$with_libunwind" != xcheck; then
846 AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
847 fi
848 ],
849 [$libunwind_LIBS]
850 )
851 ],
852 [AC_MSG_RESULT([no])
853 if test "x$with_libunwind" != xcheck; then
854 AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
855 fi
856 ]
857 )
858
859 LIBS="$saved_LIBS"
860 ],
861 [if test "x$with_libunwind" != xcheck; then
862 AC_MSG_FAILURE([failed to find libunwind])
863 fi
864 ],
865 [$libunwind_LIBS]
866 )
867
868 LDFLAGS="$saved_LDFLAGS"
869 ],
870 [if test "x$with_libunwind" != xcheck; then
871 AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
872 fi
873 ]
874 )
875
876 CPPFLAGS="$saved_CPPFLAGS"
877 ]
878)
879
880dnl enable libunwind
881AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
882if test "x$use_libunwind" = xyes; then
883 AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
884 AC_SUBST(libunwind_LIBS)
885 AC_SUBST(libunwind_LDFLAGS)
886 AC_SUBST(libunwind_CPPFLAGS)
887fi
888AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
889AC_MSG_RESULT([$use_libunwind])
890
Dmitry V. Levind59287d2015-01-13 04:57:27 +0000891if test "$arch" = mips && test "$no_create" != yes; then
892 mkdir -p linux/mips
893 if $srcdir/linux/mips/genstub.sh linux/mips; then
894 AC_MSG_RESULT([Generated MIPS syscallent stubs])
895 else
896 AC_MSG_FAILURE([Failed to generate syscallent stubs])
897 fi
898fi
899
Dmitry V. Levinf8b49132015-07-23 11:19:47 +0000900st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
901st_MPERS([mx32], [x86_64])
Dmitry V. Levin679c47c2015-01-23 22:45:02 +0000902
903AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
Roland McGrath6d2b3492002-12-30 00:51:30 +0000904AC_OUTPUT