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