1# Configure template for strace.
2#
3# Copyright (c) 1999-2001 Wichert Akkerman <wichert@deephackmode.org>
4# Copyright (c) 2002-2009 Roland McGrath <roland@redhat.com>
5# Copyright (c) 2006-2015 Dmitry V. Levin <ldv@altlinux.org>
6# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
7# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
8# All rights reserved.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions
12# are met:
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18# 3. The name of the author may not be used to endorse or promote products
19#    derived from this software without specific prior written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32AC_PREREQ(2.57)
33AC_INIT([strace],
34	m4_esyscmd([./git-version-gen .tarball-version]),
35	[strace-devel@lists.sourceforge.net])
36AC_CONFIG_SRCDIR([strace.c])
37AC_CONFIG_AUX_DIR([.])
38AC_CONFIG_HEADERS([config.h])
39AM_INIT_AUTOMAKE([foreign nostdinc dist-xz no-dist-gzip silent-rules parallel-tests])
40AM_MAINTAINER_MODE
41AC_CANONICAL_HOST
42
43AC_PROG_CC
44AX_PROG_CC_FOR_BUILD
45AC_USE_SYSTEM_EXTENSIONS
46AC_PROG_RANLIB
47
48AC_MSG_CHECKING([for supported architecture])
49arch_m32=
50arch_mx32=
51case "$host_cpu" in
52bfin)
53	arch=bfin
54	AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
55	;;
56i[[3456]]86|pentium)
57	arch=i386
58	AC_DEFINE([I386], 1, [Define for the i386 architecture.])
59	;;
60ia64)
61	arch=ia64
62	AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
63	;;
64m68k)
65	arch=m68k
66	AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
67	;;
68sparc64*)
69	arch=sparc64
70	arch_m32=sparc
71	AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
72	;;
73sparc*)
74	arch=sparc
75	AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
76	;;
77metag*)
78	arch=metag
79	AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
80	;;
81mips*)
82	arch=mips
83	AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
84	;;
85alpha*)
86	arch=alpha
87	AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
88	;;
89powerpc*)
90	AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
91	AC_TRY_COMPILE(
92[#ifndef __LP64__
93# error 32 bit
94#endif], [], arch=powerpc64, arch=powerpc)
95	if test "$arch" = "powerpc64"; then
96		arch_m32=powerpc
97		AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
98	fi
99	;;
100arm*)
101	arch=arm
102	AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
103	;;
104aarch64*)
105	arch=aarch64
106	arch_m32=arm
107	AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
108	;;
109avr32*)
110	arch=avr32
111	AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
112	;;
113arc*)
114	arch=arc
115	AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
116	;;
117s390)
118	arch=s390
119	AC_DEFINE([S390], 1, [Define for the S390 architecture.])
120	;;
121s390x)
122	arch=s390x
123	AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
124	;;
125hppa*|parisc*)
126	arch=hppa
127	AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
128	;;
129sh64*)
130	arch=sh64
131	AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
132	;;
133sh*)
134	arch=sh
135	AC_DEFINE([SH], 1, [Define for the SH architecture.])
136	;;
137x86?64*)
138	arch_m32=i386
139	AC_TRY_COMPILE(
140[#ifndef __ILP32__
141# error not x32
142#endif], [], arch=x32, arch=x86_64)
143	if test "$arch" = "x86_64"; then
144		arch_mx32=x32
145		AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
146	else
147		AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
148	fi
149	;;
150cris|crisv10)
151	arch=crisv10
152	AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
153	;;
154crisv32)
155	arch=crisv32
156	AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
157	;;
158tile*)
159	arch=tile
160	AC_DEFINE([TILE], 1, [Define for the Tile architecture])
161	;;
162microblaze*)
163	arch=microblaze
164	AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
165	;;
166nios2*)
167	arch=nios2
168	AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
169	;;
170
171or1k*)
172	arch=or1k
173	AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
174	;;
175
176xtensa*)
177	arch=xtensa
178	AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
179	;;
180
181*)
182	AC_MSG_RESULT([NO!])
183	AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
184	;;
185esac
186AC_MSG_RESULT($arch)
187
188test -n "$arch_m32" ||
189	arch_m32=$arch
190test -n "$arch_mx32" ||
191	arch_mx32=$arch
192AC_SUBST(arch)
193AC_SUBST(arch_m32)
194AC_SUBST(arch_mx32)
195
196if test "$arch" = mips; then
197	AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
198		       [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
199				       [#include <sgidefs.h>],
200				       [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
201
202	AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
203		[AC_COMPILE_IFELSE(
204			[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
205					 [[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
206			[st_cv_mips_abi=o32],
207		[AC_COMPILE_IFELSE(
208			[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
209					 [[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
210			[st_cv_mips_abi=n32],
211		[AC_COMPILE_IFELSE(
212			[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
213					 [[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
214			[st_cv_mips_abi=n64],
215			[st_cv_mips_abi=unknown])])])])
216
217	case "$st_cv_mips_abi" in
218		o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
219		n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
220		n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
221		*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
222	esac
223fi
224
225AC_ARG_ENABLE([arm-oabi],
226	      [AS_HELP_STRING([--enable-arm-oabi],
227			      [enable OABI support on ARM EABI])],
228	      [], [enable_arm_oabi=no])
229case "$enable_arm_oabi" in
230	yes) enable_arm_oabi=1 ;;
231	no) enable_arm_oabi=0 ;;
232	*) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
233esac
234AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
235		   [Define to 1 if you want OABI support on ARM EABI.])
236
237gl_WARN_ADD([-Wall])
238gl_WARN_ADD([-Wwrite-strings])
239gl_WARN_ADD([-Wsign-compare])
240AC_ARG_ENABLE([gcc-Werror],
241  [AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
242  [case $enableval in
243     yes) gl_WARN_ADD([-Werror]) ;;
244     no)  ;;
245     *)   AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
246   esac]
247)
248AC_SUBST([WARN_CFLAGS])
249
250AC_PROG_CPP
251AC_PROG_INSTALL
252AC_C_CONST
253AC_C_BIGENDIAN
254AC_HEADER_STDC
255AC_HEADER_STDBOOL
256AC_HEADER_DIRENT
257AC_HEADER_STAT
258AC_CHECK_MEMBERS(m4_normalize([
259	struct stat.st_atim.tv_nsec,
260	struct stat.st_blksize,
261	struct stat.st_blocks,
262	struct stat.st_ctim.tv_nsec,
263	struct stat.st_flags,
264	struct stat.st_fstype,
265	struct stat.st_gen,
266	struct stat.st_mtim.tv_nsec,
267	struct stat.st_rdev
268]))
269
270AC_TYPE_SIGNAL
271AC_TYPE_UID_T
272AC_TYPE_MODE_T
273AC_TYPE_GETGROUPS
274AC_HEADER_MAJOR
275AC_CHECK_TYPES([sig_atomic_t],,, [#include <signal.h>])
276AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
277[#include <sys/types.h>
278#include <sys/socket.h>
279#include <netinet/in.h>])
280
281AC_CHECK_FUNCS(m4_normalize([
282	fanotify_mark
283	fopen64
284	fork
285	fputs_unlocked
286	fstatat
287	ftruncate
288	futimens
289	if_indextoname
290	inet_ntop
291	inet_pton
292	pipe2
293	prctl
294	preadv
295	process_vm_readv
296	pwritev
297	sendmmsg
298	sigaction
299	signalfd
300	stpcpy
301	strerror
302	strsignal
303	utimensat
304]))
305AC_CHECK_HEADERS(m4_normalize([
306	asm/cachectl.h
307	asm/sysmips.h
308	bluetooth/bluetooth.h
309	elf.h
310	inttypes.h
311	ioctls.h
312	linux/bsg.h
313	linux/falloc.h
314	linux/filter.h
315	linux/hiddev.h
316	linux/ip_vs.h
317	linux/ipc.h
318	linux/mmtimer.h
319	linux/msg.h
320	linux/perf_event.h
321	linux/seccomp.h
322	linux/securebits.h
323	linux/sem.h
324	linux/shm.h
325	linux/utsname.h
326	mqueue.h
327	netinet/sctp.h
328	scsi/sg.h
329	stropts.h
330	sys/conf.h
331	sys/epoll.h
332	sys/eventfd.h
333	sys/fanotify.h
334	sys/ioctl.h
335	sys/ipc.h
336	sys/msg.h
337	sys/reg.h
338	sys/sem.h
339	sys/shm.h
340	sys/signalfd.h
341	sys/vfs.h
342	sys/xattr.h
343]))
344AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
345AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
346                 [], [], [#include <stddef.h>
347#include <sys/socket.h>
348#include <asm/types.h>])
349AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
350AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
351AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
352AC_CHECK_HEADERS(m4_normalize([
353	linux/netfilter_arp/arp_tables.h
354	linux/netfilter_bridge/ebtables.h
355	linux/netfilter_ipv4/ip_tables.h
356	linux/netfilter_ipv6/ip6_tables.h
357]), [], [], [#include <netinet/in.h>
358#include <net/if.h>])
359
360AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
361AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
362
363AC_CHECK_MEMBERS(m4_normalize([
364	struct stat.st_atime_nsec,
365	struct stat.st_ctime_nsec,
366	struct stat.st_mtime_nsec
367]),,, [#include <sys/types.h>
368#include <asm/stat.h>])
369
370AC_CHECK_TYPES([struct stat64],,, [#include <sys/types.h>
371#include <asm/stat.h>])
372AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
373AC_CHECK_TYPES([struct statfs64],,, [#include <sys/vfs.h>])
374
375AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
376	       [#include <sys/ptrace.h>])
377
378AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
379
380AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
381		  struct sigevent.__pad,
382		  siginfo_t.si_syscall,
383		  siginfo_t.si_timerid,
384		  siginfo_t.si_overrun],,, [#include <signal.h>])
385
386AC_CHECK_TYPES([struct flock,
387		struct flock64,
388		struct __kernel_flock,
389		struct __kernel_flock64],,, [#include <sys/types.h>
390#include <linux/fcntl.h>])
391
392AC_CHECK_TYPES([__kernel_long_t, __kernel_ulong_t],,, [#include <asm/posix_types.h>])
393
394AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
395
396AC_CHECK_HEADERS([linux/input.h], [
397	AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
398])
399
400AC_CHECK_HEADERS([linux/bpf.h], [
401	AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
402		       [st_cv_have_union_bpf_attr_log_buf],
403		[AC_COMPILE_IFELSE(
404			[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
405					 [[union bpf_attr a = { .log_buf = 0 };]])],
406			[st_cv_have_union_bpf_attr_log_buf=yes],
407			[st_cv_have_union_bpf_attr_log_buf=no])])
408	if test $st_cv_have_union_bpf_attr_log_buf = yes; then
409		AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
410			  [Define to 1 if union bpf_attr.log_buf initialization works])
411	fi
412])
413
414AC_CHECK_DECLS([sys_errlist])
415AC_CHECK_DECLS(m4_normalize([
416	PTRACE_PEEKUSER,
417	PTRACE_POKEUSER
418]),,, [#include <sys/ptrace.h>])
419
420AC_CHECK_DECLS(m4_normalize([
421	P_PID,
422	P_PPID,
423	P_PGID,
424	P_SID,
425	P_CID,
426	P_UID,
427	P_GID,
428	P_ALL,
429	P_LWPID
430]),,, [#include <sys/wait.h>])
431
432AC_CHECK_DECLS(m4_normalize([
433	LO_FLAGS_READ_ONLY,
434	LO_FLAGS_AUTOCLEAR,
435	LO_FLAGS_PARTSCAN
436]),,, [#include <linux/loop.h>])
437
438AC_CHECK_DECLS(m4_normalize([
439	CTL_KERN,
440	CTL_VM,
441	CTL_NET,
442	CTL_PROC,
443	CTL_FS,
444	CTL_DEBUG,
445	CTL_DEV,
446	CTL_BUS,
447	CTL_ABI,
448	CTL_CPU,
449	CTL_ARLAN,
450	CTL_S390DBF,
451	CTL_SUNRPC,
452	CTL_PM,
453	CTL_FRV,
454	KERN_OSTYPE,
455	KERN_OSRELEASE,
456	KERN_OSREV,
457	KERN_VERSION,
458	KERN_SECUREMASK,
459	KERN_PROF,
460	KERN_NODENAME,
461	KERN_DOMAINNAME,
462	KERN_PANIC,
463	KERN_REALROOTDEV,
464	KERN_SPARC_REBOOT,
465	KERN_CTLALTDEL,
466	KERN_PRINTK,
467	KERN_NAMETRANS,
468	KERN_PPC_HTABRECLAIM,
469	KERN_PPC_ZEROPAGED,
470	KERN_PPC_POWERSAVE_NAP,
471	KERN_MODPROBE,
472	KERN_SG_BIG_BUFF,
473	KERN_ACCT,
474	KERN_PPC_L2CR,
475	KERN_RTSIGNR,
476	KERN_RTSIGMAX,
477	KERN_SHMMAX,
478	KERN_MSGMAX,
479	KERN_MSGMNB,
480	KERN_MSGPOOL,
481	KERN_SYSRQ,
482	KERN_MAX_THREADS,
483	KERN_RANDOM,
484	KERN_SHMALL,
485	KERN_MSGMNI,
486	KERN_SEM,
487	KERN_SPARC_STOP_A,
488	KERN_SHMMNI,
489	KERN_OVERFLOWUID,
490	KERN_OVERFLOWGID,
491	KERN_SHMPATH,
492	KERN_HOTPLUG,
493	KERN_IEEE_EMULATION_WARNINGS,
494	KERN_S390_USER_DEBUG_LOGGING,
495	KERN_CORE_USES_PID,
496	KERN_TAINTED,
497	KERN_CADPID,
498	KERN_PIDMAX,
499	KERN_CORE_PATTERN,
500	KERN_PANIC_ON_OOPS,
501	KERN_HPPA_PWRSW,
502	KERN_HPPA_UNALIGNED,
503	KERN_PRINTK_RATELIMIT,
504	KERN_PRINTK_RATELIMIT_BURST,
505	KERN_PTY,
506	KERN_NGROUPS_MAX,
507	KERN_SPARC_SCONS_PWROFF,
508	KERN_HZ_TIMER,
509	KERN_UNKNOWN_NMI_PANIC,
510	KERN_BOOTLOADER_TYPE,
511	KERN_RANDOMIZE,
512	KERN_SETUID_DUMPABLE,
513	KERN_SPIN_RETRY,
514	KERN_ACPI_VIDEO_FLAGS,
515	KERN_IA64_UNALIGNED,
516	KERN_COMPAT_LOG,
517	KERN_MAX_LOCK_DEPTH,
518	KERN_NMI_WATCHDOG,
519	KERN_PANIC_ON_NMI,
520	NET_CORE,
521	NET_ETHER,
522	NET_802,
523	NET_UNIX,
524	NET_IPV4,
525	NET_IPX,
526	NET_ATALK,
527	NET_NETROM,
528	NET_AX25,
529	NET_BRIDGE,
530	NET_ROSE,
531	NET_IPV6,
532	NET_X25,
533	NET_TR,
534	NET_DECNET,
535	NET_ECONET,
536	NET_SCTP,
537	NET_LLC,
538	NET_NETFILTER,
539	NET_DCCP,
540	NET_IRDA,
541	NET_CORE_WMEM_MAX,
542	NET_CORE_RMEM_MAX,
543	NET_CORE_WMEM_DEFAULT,
544	NET_CORE_RMEM_DEFAULT,
545	NET_CORE_DESTROY_DELAY,
546	NET_CORE_MAX_BACKLOG,
547	NET_CORE_FASTROUTE,
548	NET_CORE_MSG_COST,
549	NET_CORE_MSG_BURST,
550	NET_CORE_OPTMEM_MAX,
551	NET_CORE_HOT_LIST_LENGTH,
552	NET_CORE_DIVERT_VERSION,
553	NET_CORE_NO_CONG_THRESH,
554	NET_CORE_NO_CONG,
555	NET_CORE_LO_CONG,
556	NET_CORE_MOD_CONG,
557	NET_CORE_DEV_WEIGHT,
558	NET_CORE_SOMAXCONN,
559	NET_CORE_BUDGET,
560	NET_CORE_AEVENT_ETIME,
561	NET_CORE_AEVENT_RSEQTH,
562	NET_CORE_WARNINGS,
563	NET_IPV4_FORWARD,
564	NET_IPV4_DYNADDR,
565	NET_IPV4_CONF,
566	NET_IPV4_NEIGH,
567	NET_IPV4_ROUTE,
568	NET_IPV4_FIB_HASH,
569	NET_IPV4_NETFILTER,
570	NET_IPV4_TCP_TIMESTAMPS,
571	NET_IPV4_TCP_WINDOW_SCALING,
572	NET_IPV4_TCP_SACK,
573	NET_IPV4_TCP_RETRANS_COLLAPSE,
574	NET_IPV4_DEFAULT_TTL,
575	NET_IPV4_AUTOCONFIG,
576	NET_IPV4_NO_PMTU_DISC,
577	NET_IPV4_TCP_SYN_RETRIES,
578	NET_IPV4_IPFRAG_HIGH_THRESH,
579	NET_IPV4_IPFRAG_LOW_THRESH,
580	NET_IPV4_IPFRAG_TIME,
581	NET_IPV4_TCP_MAX_KA_PROBES,
582	NET_IPV4_TCP_KEEPALIVE_TIME,
583	NET_IPV4_TCP_KEEPALIVE_PROBES,
584	NET_IPV4_TCP_RETRIES1,
585	NET_IPV4_TCP_RETRIES2,
586	NET_IPV4_TCP_FIN_TIMEOUT,
587	NET_IPV4_IP_MASQ_DEBUG,
588	NET_TCP_SYNCOOKIES,
589	NET_TCP_STDURG,
590	NET_TCP_RFC1337,
591	NET_TCP_SYN_TAILDROP,
592	NET_TCP_MAX_SYN_BACKLOG,
593	NET_IPV4_LOCAL_PORT_RANGE,
594	NET_IPV4_ICMP_ECHO_IGNORE_ALL,
595	NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
596	NET_IPV4_ICMP_SOURCEQUENCH_RATE,
597	NET_IPV4_ICMP_DESTUNREACH_RATE,
598	NET_IPV4_ICMP_TIMEEXCEED_RATE,
599	NET_IPV4_ICMP_PARAMPROB_RATE,
600	NET_IPV4_ICMP_ECHOREPLY_RATE,
601	NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
602	NET_IPV4_IGMP_MAX_MEMBERSHIPS,
603	NET_TCP_TW_RECYCLE,
604	NET_IPV4_ALWAYS_DEFRAG,
605	NET_IPV4_TCP_KEEPALIVE_INTVL,
606	NET_IPV4_INET_PEER_THRESHOLD,
607	NET_IPV4_INET_PEER_MINTTL,
608	NET_IPV4_INET_PEER_MAXTTL,
609	NET_IPV4_INET_PEER_GC_MINTIME,
610	NET_IPV4_INET_PEER_GC_MAXTIME,
611	NET_TCP_ORPHAN_RETRIES,
612	NET_TCP_ABORT_ON_OVERFLOW,
613	NET_TCP_SYNACK_RETRIES,
614	NET_TCP_MAX_ORPHANS,
615	NET_TCP_MAX_TW_BUCKETS,
616	NET_TCP_FACK,
617	NET_TCP_REORDERING,
618	NET_TCP_ECN,
619	NET_TCP_DSACK,
620	NET_TCP_MEM,
621	NET_TCP_WMEM,
622	NET_TCP_RMEM,
623	NET_TCP_APP_WIN,
624	NET_TCP_ADV_WIN_SCALE,
625	NET_IPV4_NONLOCAL_BIND,
626	NET_IPV4_ICMP_RATELIMIT,
627	NET_IPV4_ICMP_RATEMASK,
628	NET_TCP_TW_REUSE,
629	NET_TCP_FRTO,
630	NET_TCP_LOW_LATENCY,
631	NET_IPV4_IPFRAG_SECRET_INTERVAL,
632	NET_IPV4_IGMP_MAX_MSF,
633	NET_TCP_NO_METRICS_SAVE,
634	NET_TCP_DEFAULT_WIN_SCALE,
635	NET_TCP_MODERATE_RCVBUF,
636	NET_TCP_TSO_WIN_DIVISOR,
637	NET_TCP_BIC_BETA,
638	NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
639	NET_TCP_CONG_CONTROL,
640	NET_TCP_ABC,
641	NET_IPV4_IPFRAG_MAX_DIST,
642	NET_TCP_MTU_PROBING,
643	NET_TCP_BASE_MSS,
644	NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
645	NET_TCP_DMA_COPYBREAK,
646	NET_TCP_SLOW_START_AFTER_IDLE,
647	NET_CIPSOV4_CACHE_ENABLE,
648	NET_CIPSOV4_CACHE_BUCKET_SIZE,
649	NET_CIPSOV4_RBM_OPTFMT,
650	NET_CIPSOV4_RBM_STRICTVALID,
651	NET_TCP_AVAIL_CONG_CONTROL,
652	NET_TCP_ALLOWED_CONG_CONTROL,
653	NET_TCP_MAX_SSTHRESH,
654	NET_TCP_FRTO_RESPONSE,
655	NET_IPV4_ROUTE_FLUSH,
656	NET_IPV4_ROUTE_MIN_DELAY,
657	NET_IPV4_ROUTE_MAX_DELAY,
658	NET_IPV4_ROUTE_GC_THRESH,
659	NET_IPV4_ROUTE_MAX_SIZE,
660	NET_IPV4_ROUTE_GC_MIN_INTERVAL,
661	NET_IPV4_ROUTE_GC_TIMEOUT,
662	NET_IPV4_ROUTE_GC_INTERVAL,
663	NET_IPV4_ROUTE_REDIRECT_LOAD,
664	NET_IPV4_ROUTE_REDIRECT_NUMBER,
665	NET_IPV4_ROUTE_REDIRECT_SILENCE,
666	NET_IPV4_ROUTE_ERROR_COST,
667	NET_IPV4_ROUTE_ERROR_BURST,
668	NET_IPV4_ROUTE_GC_ELASTICITY,
669	NET_IPV4_ROUTE_MTU_EXPIRES,
670	NET_IPV4_ROUTE_MIN_PMTU,
671	NET_IPV4_ROUTE_MIN_ADVMSS,
672	NET_IPV4_ROUTE_SECRET_INTERVAL,
673	NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
674	NET_IPV4_CONF_FORWARDING,
675	NET_IPV4_CONF_MC_FORWARDING,
676	NET_IPV4_CONF_PROXY_ARP,
677	NET_IPV4_CONF_ACCEPT_REDIRECTS,
678	NET_IPV4_CONF_SECURE_REDIRECTS,
679	NET_IPV4_CONF_SEND_REDIRECTS,
680	NET_IPV4_CONF_SHARED_MEDIA,
681	NET_IPV4_CONF_RP_FILTER,
682	NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE,
683	NET_IPV4_CONF_BOOTP_RELAY,
684	NET_IPV4_CONF_LOG_MARTIANS,
685	NET_IPV4_CONF_TAG,
686	NET_IPV4_CONF_ARPFILTER,
687	NET_IPV4_CONF_MEDIUM_ID,
688	NET_IPV4_CONF_NOXFRM,
689	NET_IPV4_CONF_NOPOLICY,
690	NET_IPV4_CONF_FORCE_IGMP_VERSION,
691	NET_IPV4_CONF_ARP_ANNOUNCE,
692	NET_IPV4_CONF_ARP_IGNORE,
693	NET_IPV4_CONF_PROMOTE_SECONDARIES,
694	NET_IPV4_CONF_ARP_ACCEPT,
695	NET_IPV4_CONF_ARP_NOTIFY,
696	NET_IPV6_CONF,
697	NET_IPV6_NEIGH,
698	NET_IPV6_ROUTE,
699	NET_IPV6_ICMP,
700	NET_IPV6_BINDV6ONLY,
701	NET_IPV6_IP6FRAG_HIGH_THRESH,
702	NET_IPV6_IP6FRAG_LOW_THRESH,
703	NET_IPV6_IP6FRAG_TIME,
704	NET_IPV6_IP6FRAG_SECRET_INTERVAL,
705	NET_IPV6_MLD_MAX_MSF,
706	NET_IPV6_ROUTE_FLUSH,
707	NET_IPV6_ROUTE_GC_THRESH,
708	NET_IPV6_ROUTE_MAX_SIZE,
709	NET_IPV6_ROUTE_GC_MIN_INTERVAL,
710	NET_IPV6_ROUTE_GC_TIMEOUT,
711	NET_IPV6_ROUTE_GC_INTERVAL,
712	NET_IPV6_ROUTE_GC_ELASTICITY,
713	NET_IPV6_ROUTE_MTU_EXPIRES,
714	NET_IPV6_ROUTE_MIN_ADVMSS,
715	NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
716	NET_UNIX_DESTROY_DELAY,
717	NET_UNIX_DELETE_DELAY,
718	NET_UNIX_MAX_DGRAM_QLEN,
719	VM_OVERCOMMIT_MEMORY,
720	VM_PAGE_CLUSTER,
721	VM_DIRTY_BACKGROUND,
722	VM_DIRTY_RATIO,
723	VM_DIRTY_WB_CS,
724	VM_DIRTY_EXPIRE_CS,
725	VM_NR_PDFLUSH_THREADS,
726	VM_OVERCOMMIT_RATIO,
727	VM_PAGEBUF,
728	VM_HUGETLB_PAGES,
729	VM_SWAPPINESS,
730	VM_LOWMEM_RESERVE_RATIO,
731	VM_MIN_FREE_KBYTES,
732	VM_MAX_MAP_COUNT,
733	VM_LAPTOP_MODE,
734	VM_BLOCK_DUMP,
735	VM_HUGETLB_GROUP,
736	VM_VFS_CACHE_PRESSURE,
737	VM_LEGACY_VA_LAYOUT,
738	VM_SWAP_TOKEN_TIMEOUT
739]),,,
740[#include <sys/types.h>
741#include <linux/sysctl.h>])
742
743AC_CHECK_DECLS(m4_normalize([
744	V4L2_FIELD_ANY,
745	V4L2_FIELD_NONE,
746	V4L2_FIELD_TOP,
747	V4L2_FIELD_BOTTOM,
748	V4L2_FIELD_INTERLACED,
749	V4L2_FIELD_SEQ_TB,
750	V4L2_FIELD_SEQ_BT,
751	V4L2_FIELD_ALTERNATE,
752	V4L2_FIELD_INTERLACED_TB,
753	V4L2_FIELD_INTERLACED_BT,
754	V4L2_BUF_TYPE_VIDEO_CAPTURE,
755	V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
756	V4L2_BUF_TYPE_VIDEO_OUTPUT,
757	V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
758	V4L2_BUF_TYPE_VIDEO_OVERLAY,
759	V4L2_BUF_TYPE_VBI_CAPTURE,
760	V4L2_BUF_TYPE_VBI_OUTPUT,
761	V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
762	V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
763	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
764	V4L2_TUNER_RADIO,
765	V4L2_TUNER_ANALOG_TV,
766	V4L2_TUNER_DIGITAL_TV,
767	V4L2_MEMORY_MMAP,
768	V4L2_MEMORY_USERPTR,
769	V4L2_MEMORY_OVERLAY,
770	V4L2_MEMORY_DMABUF,
771	V4L2_COLORSPACE_SMPTE170M,
772	V4L2_COLORSPACE_SMPTE240M,
773	V4L2_COLORSPACE_REC709,
774	V4L2_COLORSPACE_BT878,
775	V4L2_COLORSPACE_470_SYSTEM_M,
776	V4L2_COLORSPACE_470_SYSTEM_BG,
777	V4L2_COLORSPACE_JPEG,
778	V4L2_COLORSPACE_SRGB,
779	V4L2_PRIORITY_UNSET,
780	V4L2_PRIORITY_BACKGROUND,
781	V4L2_PRIORITY_INTERACTIVE,
782	V4L2_PRIORITY_RECORD,
783	V4L2_FRMSIZE_TYPE_DISCRETE,
784	V4L2_FRMSIZE_TYPE_CONTINUOUS,
785	V4L2_FRMSIZE_TYPE_STEPWISE,
786	V4L2_FRMIVAL_TYPE_DISCRETE,
787	V4L2_FRMIVAL_TYPE_CONTINUOUS,
788	V4L2_FRMIVAL_TYPE_STEPWISE,
789	V4L2_CTRL_TYPE_INTEGER,
790	V4L2_CTRL_TYPE_BOOLEAN,
791	V4L2_CTRL_TYPE_MENU,
792	V4L2_CTRL_TYPE_BUTTON,
793	V4L2_CTRL_TYPE_INTEGER64,
794	V4L2_CTRL_TYPE_CTRL_CLASS,
795	V4L2_CTRL_TYPE_STRING,
796	V4L2_CTRL_TYPE_BITMASK,
797	V4L2_CTRL_TYPE_INTEGER_MENU
798]),,, [#include <linux/videodev2.h>])
799
800AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
801	[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
802#include <stdlib.h>
803#include <linux/fs.h>], [return !BLKGETSIZE64;])],
804			   [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
805	if test $ac_cv_have_blkgetsize64 = yes; then
806		AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
807	fi)
808
809AC_CHECK_SIZEOF([long])
810AC_CHECK_SIZEOF([long long])
811AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
812AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
813
814AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
815	       [[st_cv_SIGRTMIN="$(echo SIGRTMIN |
816			$CPP $CPPFLAGS -P -imacros asm/signal.h - |
817			grep '^[0-9]')"
818	         test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
819if test "x$st_cv_SIGRTMIN" != xno; then
820	AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
821			   [SIGRTMIN defined in <asm/signal.h>])
822fi
823AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
824	       [st_cv_SA_RESTORER="$(echo SA_RESTORER |
825			$CPP $CPPFLAGS -P -imacros asm/signal.h - |
826			grep ^0x)"
827	        test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
828if test "x$st_cv_SA_RESTORER" != xno; then
829	AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
830			   [SA_RESTORER defined in <asm/signal.h>])
831fi
832
833AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
834	       [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
835			       [st_cv_have___builtin_popcount=yes],
836			       [st_cv_have___builtin_popcount=no])])
837if test "x$st_cv_have___builtin_popcount" = xyes; then
838	AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
839		  [Define to 1 if the system provides __builtin_popcount function])
840fi
841
842AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
843if test "x$ac_cv_lib_dl_dladdr" = xyes; then
844	AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
845fi
846AC_SUBST(dl_LIBS)
847
848AC_PATH_PROG([PERL], [perl])
849
850dnl stack trace with libunwind
851libunwind_CPPFLAGS=
852libunwind_LDFLAGS=
853libunwind_LIBS=
854AC_ARG_WITH([libunwind],
855            [AS_HELP_STRING([--with-libunwind],
856                            [use libunwind to implement stack tracing support])],
857            [case "${withval}" in
858             yes|no|check) ;;
859             *) with_libunwind=yes
860                libunwind_CPPFLAGS="-I${withval}/include"
861                libunwind_LDFLAGS="-L${withval}/lib" ;;
862             esac],
863            [with_libunwind=check]
864)
865
866use_libunwind=no
867AS_IF([test "x$with_libunwind" != xno],
868      [saved_CPPFLAGS="$CPPFLAGS"
869       CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
870
871       AC_CHECK_HEADERS([libunwind-ptrace.h],
872         [saved_LDFLAGS="$LDFLAGS"
873          LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
874
875          AC_CHECK_LIB([unwind], [backtrace],
876            [libunwind_LIBS="-lunwind $libunwind_LIBS"
877
878             AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
879             saved_LIBS="$LIBS"
880             LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
881
882             AC_LINK_IFELSE(
883               [AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
884                                [[return !unw_create_addr_space(0, 0)]])
885               ],
886               [AC_MSG_RESULT([yes])
887                libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
888
889                AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
890                  [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
891                   use_libunwind=yes
892                  ],
893                  [if test "x$with_libunwind" != xcheck; then
894                     AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
895                   fi
896                  ],
897                  [$libunwind_LIBS]
898                )
899               ],
900               [AC_MSG_RESULT([no])
901                if test "x$with_libunwind" != xcheck; then
902                  AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
903                fi
904               ]
905             )
906
907             LIBS="$saved_LIBS"
908            ],
909            [if test "x$with_libunwind" != xcheck; then
910               AC_MSG_FAILURE([failed to find libunwind])
911             fi
912            ],
913            [$libunwind_LIBS]
914          )
915
916          LDFLAGS="$saved_LDFLAGS"
917         ],
918         [if test "x$with_libunwind" != xcheck; then
919            AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
920          fi
921         ]
922       )
923
924       CPPFLAGS="$saved_CPPFLAGS"
925      ]
926)
927
928dnl enable libunwind
929AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
930if test "x$use_libunwind" = xyes; then
931	AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
932	AC_SUBST(libunwind_LIBS)
933	AC_SUBST(libunwind_LDFLAGS)
934	AC_SUBST(libunwind_CPPFLAGS)
935fi
936AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
937AC_MSG_RESULT([$use_libunwind])
938
939if test "$arch" = mips && test "$no_create" != yes; then
940	mkdir -p linux/mips
941	if $srcdir/linux/mips/genstub.sh linux/mips; then
942		AC_MSG_RESULT([Generated MIPS syscallent stubs])
943	else
944		AC_MSG_FAILURE([Failed to generate syscallent stubs])
945	fi
946fi
947
948st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
949st_MPERS([mx32], [x86_64])
950
951AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
952AC_OUTPUT
953