• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-2016 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# Copyright (c) 2002-2018 The strace developers.
9# All rights reserved.
10#
11# Redistribution and use in source and binary forms, with or without
12# modification, are permitted provided that the following conditions
13# are met:
14# 1. Redistributions of source code must retain the above copyright
15#    notice, this list of conditions and the following disclaimer.
16# 2. Redistributions in binary form must reproduce the above copyright
17#    notice, this list of conditions and the following disclaimer in the
18#    documentation and/or other materials provided with the distribution.
19# 3. The name of the author may not be used to endorse or promote products
20#    derived from this software without specific prior written permission.
21#
22# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33AC_PREREQ(2.57)
34AC_INIT([strace],
35	m4_esyscmd([./git-version-gen .tarball-version]),
36	[strace-devel@lists.strace.io],
37	[strace],
38	[https://strace.io])
39m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year]))
40m4_define([manpage_date], m4_esyscmd([./file-date-gen strace.1.in]))
41AC_COPYRIGHT([Copyright (c) 1999-]copyright_year[ The strace developers.])
42AC_CONFIG_SRCDIR([strace.c])
43AC_CONFIG_AUX_DIR([.])
44AC_CONFIG_HEADERS([config.h])
45AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests 1.13])
46AM_MAINTAINER_MODE
47AC_CANONICAL_HOST
48
49RPM_CHANGELOGTIME="$(LC_TIME=C date -u '+%a %b %d %Y')"
50AC_SUBST(RPM_CHANGELOGTIME)
51DEB_CHANGELOGTIME="$(LC_TIME=C date -u -R)"
52AC_SUBST(DEB_CHANGELOGTIME)
53
54AC_PROG_CC
55AC_PROG_CC_STDC
56AC_PROG_CPP
57st_WARN_CFLAGS
58AX_PROG_CC_FOR_BUILD
59AC_PROG_INSTALL
60AC_PROG_RANLIB
61
62AC_USE_SYSTEM_EXTENSIONS
63AX_CODE_COVERAGE
64
65AC_DEFINE([COPYRIGHT_YEAR], "[copyright_year]", [Current copyright year.])
66AC_SUBST([COPYRIGHT_YEAR], [copyright_year])
67
68AC_DEFINE([MANPAGE_DATE], "[manpage_date]", [Date])
69AC_SUBST([MANPAGE_DATE], [manpage_date])
70
71AC_MSG_CHECKING([for supported architecture])
72arch_m32=
73arch_mx32=
74cc_flags_m32=-m32
75cc_flags_mx32=-mx32
76case "$host_cpu" in
77aarch64*)
78	arch=aarch64
79	arch_m32=arm
80	AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
81	;;
82alpha*)
83	arch=alpha
84	AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
85	;;
86arc*)
87	arch=arc
88	AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
89	;;
90arm*)
91	arch=arm
92	AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
93	;;
94avr32*)
95	arch=avr32
96	AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
97	;;
98bfin)
99	arch=bfin
100	AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
101	;;
102hppa*|parisc*)
103	arch=hppa
104	AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
105	;;
106i[[3456]]86|pentium)
107	arch=i386
108	AC_DEFINE([I386], 1, [Define for the i386 architecture.])
109	;;
110ia64)
111	arch=ia64
112	AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
113	;;
114m68k)
115	arch=m68k
116	AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
117	;;
118metag*)
119	arch=metag
120	AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
121	;;
122microblaze*)
123	arch=microblaze
124	AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
125	;;
126mips*)
127	arch=mips
128	AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
129	;;
130nios2*)
131	arch=nios2
132	AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
133	;;
134or1k*)
135	arch=or1k
136	AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
137	;;
138powerpc*)
139	AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
140	AC_TRY_COMPILE(
141[#ifndef __LP64__
142# error 32 bit
143#endif], [], arch=powerpc64, arch=powerpc)
144	if test "$arch" = "powerpc64"; then
145		arch_m32=powerpc
146		AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
147	fi
148	;;
149riscv*)
150	arch=riscv
151	AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
152	;;
153s390)
154	arch=s390
155	AC_DEFINE([S390], 1, [Define for the S390 architecture.])
156	;;
157s390x)
158	arch=s390x
159	arch_m32=s390
160	cc_flags_m32=-m31
161	AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
162	;;
163sh64*)
164	arch=sh64
165	AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
166	;;
167sh*)
168	arch=sh
169	AC_DEFINE([SH], 1, [Define for the SH architecture.])
170	;;
171sparc64*)
172	arch=sparc64
173	arch_m32=sparc
174	AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
175	;;
176sparc*)
177	arch=sparc
178	AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
179	;;
180tile*)
181	arch=tile
182	AC_DEFINE([TILE], 1, [Define for the Tile architecture])
183	;;
184x86?64*)
185	arch_m32=i386
186	AC_TRY_COMPILE(
187[#ifndef __ILP32__
188# error not x32
189#endif], [], arch=x32, arch=x86_64)
190	if test "$arch" = "x86_64"; then
191		arch_mx32=x32
192		AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
193	else
194		AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
195	fi
196	;;
197xtensa*)
198	arch=xtensa
199	AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
200	;;
201*)
202	AC_MSG_RESULT([NO!])
203	AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
204	;;
205esac
206AC_MSG_RESULT($arch)
207
208arch_native=$arch
209
210test -n "$arch_m32" ||
211	arch_m32=$arch
212test -n "$arch_mx32" ||
213	arch_mx32=$arch
214AC_SUBST(arch)
215AC_SUBST(arch_m32)
216AC_SUBST(arch_mx32)
217AC_SUBST(cc_flags_m32)
218AC_SUBST(cc_flags_mx32)
219AC_SUBST(arch_native)
220
221MIPS_ABI=
222if test "$arch" = mips; then
223	AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
224		       [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], ,
225				       [AC_MSG_FAILURE([_MIPS_SIM cannot be determined])])])
226
227	# requires GCC >= 3.4
228	AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
229		[AC_COMPILE_IFELSE(
230			[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIO32 ? 1 : - 1];]])],
231			[st_cv_mips_abi=o32],
232		[AC_COMPILE_IFELSE(
233			[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIN32 ? 1 : - 1];]])],
234			[st_cv_mips_abi=n32],
235		[AC_COMPILE_IFELSE(
236			[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABI64 ? 1 : - 1];]])],
237			[st_cv_mips_abi=n64],
238			[st_cv_mips_abi=unknown])])])])
239
240	case "$st_cv_mips_abi" in
241		o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _ABIO32.]);;
242		n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _ABIN32.]);;
243		n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _ABI64.]);;
244		*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
245	esac
246	MIPS_ABI="$st_cv_mips_abi"
247fi
248AC_SUBST(MIPS_ABI)
249
250AC_ARG_ENABLE([arm-oabi],
251	      [AS_HELP_STRING([--enable-arm-oabi],
252			      [enable OABI support on ARM EABI])],
253	      [], [enable_arm_oabi=no])
254case "$enable_arm_oabi" in
255	yes) enable_arm_oabi=1 ;;
256	no) enable_arm_oabi=0 ;;
257	*) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
258esac
259AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
260		   [Define to 1 if you want OABI support on ARM EABI.])
261
262AC_C_BIGENDIAN
263AC_C_TYPEOF
264
265AC_TYPE_UID_T
266
267AC_CHECK_FUNCS(m4_normalize([
268	accept4
269	be64toh
270	fallocate
271	fanotify_mark
272	fopen64
273	fork
274	fputs_unlocked
275	fstatat
276	ftruncate
277	futimens
278	iconv_open
279	if_indextoname
280	open64
281	prctl
282	preadv
283	process_vm_readv
284	pwritev
285	readahead
286	signalfd
287	stpcpy
288	strerror
289	strndup
290	strsignal
291	sync_file_range
292	utimensat
293]))
294
295AC_CHECK_TYPES([sig_atomic_t, struct sigcontext],,, [#include <signal.h>])
296
297AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
298
299AC_CHECK_TYPES([__kernel_long_t, __kernel_ulong_t],,,
300[#include <asm/posix_types.h>])
301
302AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
303[#include <sys/types.h>
304#include <asm/stat.h>])
305
306AC_CHECK_TYPES([struct user_desc],
307	       [AC_CHECK_MEMBERS([struct user_desc.lm],,,
308				 [#include <asm/ldt.h>])],,
309	       [#include <asm/ldt.h>])
310
311AC_CHECK_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,,
312[#include <sys/types.h>
313#include <asm/stat.h>])
314
315AC_CHECK_TYPES(m4_normalize([
316	struct pt_all_user_regs,
317	struct ia64_fpreg,
318	struct ptrace_peeksiginfo_args
319]),,, [#include <sys/ptrace.h>])
320
321# For kernels that do not have v3.10-rc1~201^2~11
322AC_CHECK_TYPES([s390_compat_regs],,, [#include <asm/ptrace.h>])
323
324AC_CHECK_TYPES(m4_normalize([
325	struct flock,
326	struct flock64,
327	struct __kernel_flock,
328	struct __kernel_flock64,
329	struct f_owner_ex,
330	struct __kernel_f_owner_ex
331]),,,
332[#include <sys/types.h>
333#include <linux/fcntl.h>])
334
335AC_CHECK_TYPES(m4_normalize([
336	struct crypto_report_aead,
337	struct crypto_report_blkcipher,
338	struct crypto_report_cipher,
339	struct crypto_report_hash,
340	struct crypto_report_rng
341]),,, [#include <linux/cryptouser.h>])
342
343AC_CHECK_TYPES(m4_normalize([
344	struct kcmp_epoll_slot
345]),,, [#include <linux/kcmp.h>])
346
347AC_CHECK_TYPES(m4_normalize([
348	struct keyctl_kdf_params
349]),,, [#include <linux/keyctl.h>])
350
351AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
352
353AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
354
355AC_CHECK_MEMBERS(m4_normalize([
356	siginfo_t.si_syscall,
357	siginfo_t.si_timerid,
358	siginfo_t.si_overrun
359]),,, [#include <signal.h>])
360
361AC_CHECK_MEMBERS(m4_normalize([
362	struct perf_event_attr.precise_ip,
363	struct perf_event_attr.mmap_data,
364	struct perf_event_attr.sample_id_all,
365	struct perf_event_attr.exclude_host,
366	struct perf_event_attr.exclude_guest,
367	struct perf_event_attr.exclude_callchain_kernel,
368	struct perf_event_attr.exclude_callchain_user,
369	struct perf_event_attr.mmap2,
370	struct perf_event_attr.comm_exec,
371	struct perf_event_attr.use_clockid,
372	struct perf_event_attr.context_switch,
373	struct perf_event_attr.write_backward,
374	struct perf_event_attr.namespaces,
375	struct perf_event_attr.bp_type,
376	struct perf_event_attr.config1,
377	struct perf_event_attr.config2,
378	struct perf_event_attr.branch_sample_type,
379	struct perf_event_attr.sample_regs_user,
380	struct perf_event_attr.sample_stack_user,
381	struct perf_event_attr.sample_regs_intr,
382	struct perf_event_attr.aux_watermark,
383	struct perf_event_attr.sample_max_stack
384]),,, [#include <linux/perf_event.h>])
385
386AC_CHECK_HEADERS(m4_normalize([
387	asm/cachectl.h
388	asm/guarded_storage.h
389	asm/sysmips.h
390	elf.h
391	iconv.h
392	inttypes.h
393	linux/bsg.h
394	linux/cryptouser.h
395	linux/dm-ioctl.h
396	linux/dqblk_xfs.h
397	linux/falloc.h
398	linux/fib_rules.h
399	linux/fiemap.h
400	linux/genetlink.h
401	linux/hiddev.h
402	linux/if_addr.h
403	linux/if_link.h
404	linux/ip_vs.h
405	linux/ipc.h
406	linux/kcmp.h
407	linux/kvm.h
408	linux/memfd.h
409	linux/mmtimer.h
410	linux/msg.h
411	linux/neighbour.h
412	linux/netfilter/ipset/ip_set.h
413	linux/netfilter/nf_tables.h
414	linux/netfilter/nf_tables_compat.h
415	linux/netfilter/nfnetlink.h
416	linux/netfilter/nfnetlink_acct.h
417	linux/netfilter/nfnetlink_conntrack.h
418	linux/netfilter/nfnetlink_cthelper.h
419	linux/netfilter/nfnetlink_cttimeout.h
420	linux/netfilter/nfnetlink_log.h
421	linux/netfilter/nfnetlink_queue.h
422	linux/nsfs.h
423	linux/perf_event.h
424	linux/quota.h
425	linux/seccomp.h
426	linux/securebits.h
427	linux/sem.h
428	linux/shm.h
429	linux/userfaultfd.h
430	linux/utsname.h
431	mqueue.h
432	netinet/sctp.h
433	netipx/ipx.h
434	paths.h
435	scsi/sg.h
436	stropts.h
437	sys/conf.h
438	sys/eventfd.h
439	sys/fanotify.h
440	sys/ipc.h
441	sys/msg.h
442	sys/quota.h
443	sys/sem.h
444	sys/shm.h
445	sys/signalfd.h
446	sys/xattr.h
447	ustat.h
448]))
449
450AC_CHECK_HEADERS([asm/sigcontext.h],,, [#include <signal.h>])
451
452AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
453
454AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
455
456AC_CHECK_HEADERS([linux/netfilter/xt_osf.h],,, [#include <linux/ip.h>
457#include <linux/tcp.h>])
458
459AC_CHECK_HEADERS(m4_normalize([
460	linux/netfilter_arp/arp_tables.h
461	linux/netfilter_bridge/ebtables.h
462	linux/netfilter_ipv4/ip_tables.h
463	linux/netfilter_ipv6/ip6_tables.h
464]),,, [#include <netinet/in.h>
465#include <net/if.h>])
466
467AC_CHECK_HEADERS([linux/input.h], [
468	AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
469])
470
471AC_CHECK_HEADERS([linux/bpf.h], [
472	AC_CHECK_TYPES(m4_normalize([
473		struct bpf_insn,
474		struct bpf_map_info,
475		struct bpf_prog_info
476	]),,, [#include <linux/bpf.h>])
477	st_BPF_ATTR
478])
479
480AC_CHECK_HEADERS([bluetooth/bluetooth.h], [
481	AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,,
482			 [#include <bluetooth/bluetooth.h>
483			 #include <bluetooth/l2cap.h>])
484])
485
486AC_CHECK_TYPES(m4_normalize([
487	struct br_mdb_entry,
488	struct br_port_msg
489]),,, [#include <linux/if_bridge.h>])
490AC_CHECK_MEMBERS(m4_normalize([
491	struct br_mdb_entry.flags,
492	struct br_mdb_entry.vid
493]),,, [#include <linux/if_bridge.h>])
494
495AC_CHECK_TYPES([struct dcbmsg],,, [#include <linux/dcbnl.h>])
496AC_CHECK_TYPES([struct ifaddrlblmsg],,, [#include <linux/if_addrlabel.h>])
497AC_CHECK_TYPES([struct netconfmsg],,, [#include <linux/netconf.h>])
498
499AC_CHECK_TYPES(m4_normalize([
500	struct rta_mfc_stats,
501	struct rtvia
502]),,, [#include <sys/socket.h>
503#include <linux/rtnetlink.h>])
504
505AC_CHECK_MEMBERS([struct ndt_stats.ndts_table_fulls],,, [#include <linux/neighbour.h>])
506AC_CHECK_TYPES(m4_normalize([
507	struct ndt_config,
508	struct ndt_stats
509]),,, [#include <linux/neighbour.h>])
510
511AC_CHECK_TYPES(m4_normalize([
512	struct ifla_bridge_id,
513	struct ifla_cacheinfo,
514	struct ifla_port_vsi,
515	struct rtnl_link_stats64
516]),,, [#include <sys/socket.h>
517#include <linux/rtnetlink.h>])
518AC_CHECK_MEMBERS(m4_normalize([
519	struct rtnl_link_stats.rx_nohandler,
520	struct rtnl_link_stats64.rx_nohandler
521]),,, [#include <sys/socket.h>
522#include <linux/rtnetlink.h>])
523AC_CHECK_DECLS(m4_normalize([
524	IFLA_PORT_SELF,
525	IFLA_PROTINFO,
526	IFLA_AF_SPEC,
527	IFLA_XDP
528]),,, [#include <sys/socket.h>
529#include <linux/rtnetlink.h>])
530
531AC_CHECK_TYPES(m4_normalize([
532	struct gnet_stats_basic,
533	struct gnet_stats_queue,
534	struct gnet_stats_rate_est,
535	struct gnet_stats_rate_est64
536]),,, [#include <linux/gen_stats.h>])
537
538AC_CHECK_TYPES([struct tc_sizespec],,, [#include <linux/types.h>
539#include <linux/pkt_sched.h>])
540AC_CHECK_DECLS([TCA_STAB_DATA],,, [#include <linux/types.h>
541#include <linux/pkt_sched.h>])
542
543AC_CHECK_TYPES(m4_normalize([
544	struct fib_rule_uid_range,
545	struct fib_rule_port_range
546]),,, [#include <linux/fib_rules.h>])
547
548AC_CHECK_TYPES([struct statfs], [
549	AC_CHECK_MEMBERS(m4_normalize([
550		struct statfs.f_frsize,
551		struct statfs.f_flags,
552		struct statfs.f_fsid.val,
553		struct statfs.f_fsid.__val
554	]),,, [#include <linux/types.h>
555#include <asm/statfs.h>])
556],, [#include <linux/types.h>
557#include <asm/statfs.h>])
558
559AC_CHECK_TYPES([struct statfs64], [
560	AC_CHECK_MEMBERS(m4_normalize([
561		struct statfs64.f_frsize,
562		struct statfs64.f_flags,
563		struct statfs64.f_fsid.val,
564		struct statfs64.f_fsid.__val
565	]),,, [#include <linux/types.h>
566#include <asm/statfs.h>])
567],, [#include <linux/types.h>
568#include <asm/statfs.h>])
569
570AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>])
571
572AC_CHECK_TYPES([struct mtd_write_req],,, [#include <mtd/mtd-abi.h>])
573
574AC_CHECK_MEMBERS([struct ubi_attach_req.max_beb_per1024],,, [#include <mtd/ubi-user.h>])
575
576AC_CHECK_TYPES(m4_normalize([
577	struct ptp_sys_offset
578]),,, [#include <linux/ptp_clock.h>])
579
580AC_CHECK_TYPES(m4_normalize([
581	struct kvm_cpuid2,
582	struct kvm_regs,
583	struct kvm_sregs,
584	struct kvm_userspace_memory_region
585]),,, [#include <linux/kvm.h>])
586
587saved_CPPFLAGS="$CPPFLAGS"
588
589AC_CACHE_CHECK([whether <linux/signal.h> can be used along with <signal.h>],
590	       [st_cv_linux_signal],
591	       [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
592#include <signal.h>
593#include <linux/signal.h>]],[])],
594				  [st_cv_linux_signal=yes],
595				  [st_cv_linux_signal=no])])
596if test "x$st_cv_linux_signal" = xno; then
597	mkdir -p linux/linux
598	cp $srcdir/linux/signal.h.in linux/linux/signal.h
599	CPPFLAGS="$CPPFLAGS -Ilinux"
600fi
601
602AC_CHECK_TYPES([struct __aio_sigset],,, [#include <linux/aio_abi.h>])
603
604CPPFLAGS="$saved_CPPFLAGS"
605
606AC_CHECK_HEADERS([linux/btrfs.h], [
607	AC_CHECK_MEMBERS(m4_normalize([
608		struct btrfs_ioctl_feature_flags.compat_flags,
609		struct btrfs_ioctl_fs_info_args.nodesize,
610		struct btrfs_ioctl_defrag_range_args.start,
611		struct btrfs_ioctl_search_args_v2.buf_size,
612		struct btrfs_ioctl_logical_ino_args.flags
613		]),,, [ #include <stdio.h>
614#include <linux/btrfs.h>])
615	AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
616				BTRFS_COMPRESS_LZO]),,,[ #include <stdio.h>
617#include <linux/btrfs.h>])])
618
619AC_CHECK_DECLS([sys_errlist])
620AC_CHECK_DECLS(m4_normalize([
621	PTRACE_PEEKUSER,
622	PTRACE_POKEUSER
623]),,, [#include <sys/ptrace.h>])
624
625AC_CHECK_DECLS(m4_normalize([
626	P_PID,
627	P_PPID,
628	P_PGID,
629	P_SID,
630	P_CID,
631	P_UID,
632	P_GID,
633	P_ALL,
634	P_LWPID
635]),,, [#include <sys/wait.h>])
636
637AC_CHECK_DECLS(m4_normalize([
638	LO_FLAGS_READ_ONLY,
639	LO_FLAGS_USE_AOPS,
640	LO_FLAGS_AUTOCLEAR,
641	LO_FLAGS_PARTSCAN,
642	LO_FLAGS_DIRECT_IO
643]),,, [#include <linux/loop.h>])
644
645AC_CHECK_DECLS(m4_normalize([
646	CTL_PROC,
647	CTL_ARLAN,
648	CTL_S390DBF,
649	CTL_SUNRPC,
650	CTL_PM,
651	CTL_FRV,
652	KERN_PRINTK_RATELIMIT,
653	KERN_PRINTK_RATELIMIT_BURST,
654	KERN_PTY,
655	KERN_NGROUPS_MAX,
656	KERN_SPARC_SCONS_PWROFF,
657	KERN_HZ_TIMER,
658	KERN_UNKNOWN_NMI_PANIC,
659	KERN_BOOTLOADER_TYPE,
660	KERN_RANDOMIZE,
661	KERN_SETUID_DUMPABLE,
662	KERN_SPIN_RETRY,
663	KERN_ACPI_VIDEO_FLAGS,
664	KERN_IA64_UNALIGNED,
665	KERN_COMPAT_LOG,
666	KERN_MAX_LOCK_DEPTH,
667	KERN_NMI_WATCHDOG,
668	KERN_PANIC_ON_NMI,
669	NET_LLC,
670	NET_NETFILTER,
671	NET_DCCP,
672	NET_IRDA,
673	NET_CORE_DESTROY_DELAY,
674	NET_CORE_BUDGET,
675	NET_CORE_AEVENT_ETIME,
676	NET_CORE_AEVENT_RSEQTH,
677	NET_CORE_WARNINGS,
678	NET_IPV4_IGMP_MAX_MSF,
679	NET_TCP_NO_METRICS_SAVE,
680	NET_TCP_DEFAULT_WIN_SCALE,
681	NET_TCP_MODERATE_RCVBUF,
682	NET_TCP_TSO_WIN_DIVISOR,
683	NET_TCP_BIC_BETA,
684	NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
685	NET_TCP_CONG_CONTROL,
686	NET_TCP_ABC,
687	NET_IPV4_IPFRAG_MAX_DIST,
688	NET_TCP_MTU_PROBING,
689	NET_TCP_BASE_MSS,
690	NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
691	NET_TCP_DMA_COPYBREAK,
692	NET_TCP_SLOW_START_AFTER_IDLE,
693	NET_CIPSOV4_CACHE_ENABLE,
694	NET_CIPSOV4_CACHE_BUCKET_SIZE,
695	NET_CIPSOV4_RBM_OPTFMT,
696	NET_CIPSOV4_RBM_STRICTVALID,
697	NET_TCP_AVAIL_CONG_CONTROL,
698	NET_TCP_ALLOWED_CONG_CONTROL,
699	NET_TCP_MAX_SSTHRESH,
700	NET_TCP_FRTO_RESPONSE,
701	NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
702	NET_IPV4_CONF_FORCE_IGMP_VERSION,
703	NET_IPV4_CONF_ARP_ANNOUNCE,
704	NET_IPV4_CONF_ARP_IGNORE,
705	NET_IPV4_CONF_PROMOTE_SECONDARIES,
706	NET_IPV4_CONF_ARP_ACCEPT,
707	NET_IPV4_CONF_ARP_NOTIFY,
708	NET_IPV6_MLD_MAX_MSF,
709	NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
710	VM_MAX_MAP_COUNT,
711	VM_LAPTOP_MODE,
712	VM_BLOCK_DUMP,
713	VM_HUGETLB_GROUP,
714	VM_VFS_CACHE_PRESSURE,
715	VM_LEGACY_VA_LAYOUT,
716	VM_SWAP_TOKEN_TIMEOUT
717]),,,
718[#include <sys/types.h>
719#include <linux/sysctl.h>])
720
721AC_CHECK_DECLS(m4_normalize([
722	V4L2_FIELD_ANY,
723	V4L2_FIELD_NONE,
724	V4L2_FIELD_TOP,
725	V4L2_FIELD_BOTTOM,
726	V4L2_FIELD_INTERLACED,
727	V4L2_FIELD_SEQ_TB,
728	V4L2_FIELD_SEQ_BT,
729	V4L2_FIELD_ALTERNATE,
730	V4L2_FIELD_INTERLACED_TB,
731	V4L2_FIELD_INTERLACED_BT,
732	V4L2_BUF_TYPE_VIDEO_CAPTURE,
733	V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
734	V4L2_BUF_TYPE_VIDEO_OUTPUT,
735	V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
736	V4L2_BUF_TYPE_VIDEO_OVERLAY,
737	V4L2_BUF_TYPE_VBI_CAPTURE,
738	V4L2_BUF_TYPE_VBI_OUTPUT,
739	V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
740	V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
741	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
742	V4L2_BUF_TYPE_SDR_CAPTURE,
743	V4L2_BUF_TYPE_SDR_OUTPUT,
744	V4L2_TUNER_RADIO,
745	V4L2_TUNER_ANALOG_TV,
746	V4L2_TUNER_DIGITAL_TV,
747	V4L2_MEMORY_MMAP,
748	V4L2_MEMORY_USERPTR,
749	V4L2_MEMORY_OVERLAY,
750	V4L2_MEMORY_DMABUF,
751	V4L2_COLORSPACE_SMPTE170M,
752	V4L2_COLORSPACE_SMPTE240M,
753	V4L2_COLORSPACE_REC709,
754	V4L2_COLORSPACE_BT878,
755	V4L2_COLORSPACE_470_SYSTEM_M,
756	V4L2_COLORSPACE_470_SYSTEM_BG,
757	V4L2_COLORSPACE_JPEG,
758	V4L2_COLORSPACE_SRGB,
759	V4L2_PRIORITY_UNSET,
760	V4L2_PRIORITY_BACKGROUND,
761	V4L2_PRIORITY_INTERACTIVE,
762	V4L2_PRIORITY_RECORD,
763	V4L2_FRMSIZE_TYPE_DISCRETE,
764	V4L2_FRMSIZE_TYPE_CONTINUOUS,
765	V4L2_FRMSIZE_TYPE_STEPWISE,
766	V4L2_FRMIVAL_TYPE_DISCRETE,
767	V4L2_FRMIVAL_TYPE_CONTINUOUS,
768	V4L2_FRMIVAL_TYPE_STEPWISE,
769	V4L2_CTRL_TYPE_INTEGER,
770	V4L2_CTRL_TYPE_BOOLEAN,
771	V4L2_CTRL_TYPE_MENU,
772	V4L2_CTRL_TYPE_BUTTON,
773	V4L2_CTRL_TYPE_INTEGER64,
774	V4L2_CTRL_TYPE_CTRL_CLASS,
775	V4L2_CTRL_TYPE_STRING,
776	V4L2_CTRL_TYPE_BITMASK,
777	V4L2_CTRL_TYPE_INTEGER_MENU
778]),,, [#include <sys/time.h>
779#include <linux/ioctl.h>
780#include <linux/types.h>
781#include <linux/videodev2.h>])
782
783AC_CHECK_MEMBERS(m4_normalize([
784	struct v4l2_window.global_alpha,
785	struct v4l2_sdr_format.buffersize
786]),,, [#include <sys/time.h>
787#include <linux/ioctl.h>
788#include <linux/types.h>
789#include <linux/videodev2.h>])
790
791AC_CHECK_SIZEOF([long])
792SIZEOF_LONG="$ac_cv_sizeof_long"
793AC_SUBST(SIZEOF_LONG)
794AC_CHECK_SIZEOF([long long])
795AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
796AC_CHECK_SIZEOF([kernel_long_t],,[#include "$srcdir/kernel_types.h"])
797SIZEOF_KERNEL_LONG_T="$ac_cv_sizeof_kernel_long_t"
798AC_SUBST(SIZEOF_KERNEL_LONG_T)
799AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
800
801
802AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
803	       [[st_cv_SIGRTMIN="$(echo SIGRTMIN |
804			$CPP $CPPFLAGS -P -imacros asm/signal.h - |
805			grep '^[0-9]')"
806		 test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
807if test "x$st_cv_SIGRTMIN" != xno; then
808	AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
809			   [SIGRTMIN defined in <asm/signal.h>])
810fi
811AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
812	       [st_cv_SA_RESTORER="$(echo SA_RESTORER |
813			$CPP $CPPFLAGS -P -imacros asm/signal.h - |
814			grep ^0x)"
815		test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
816if test "x$st_cv_SA_RESTORER" != xno; then
817	AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
818			   [SA_RESTORER defined in <asm/signal.h>])
819fi
820
821AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
822	       [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
823			       [st_cv_have___builtin_popcount=yes],
824			       [st_cv_have___builtin_popcount=no])])
825if test "x$st_cv_have___builtin_popcount" = xyes; then
826	AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
827		  [Define to 1 if the system provides __builtin_popcount function])
828fi
829
830AC_CACHE_CHECK([for program_invocation_name], [st_cv_have_program_invocation_name],
831	       [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
832						[[return !*program_invocation_name]])],
833			       [st_cv_have_program_invocation_name=yes],
834			       [st_cv_have_program_invocation_name=no])])
835if test "x$st_cv_have_program_invocation_name" = xyes; then
836	AC_DEFINE([HAVE_PROGRAM_INVOCATION_NAME], [1],
837		  [Define to 1 if the system provides program_invocation_name variable])
838fi
839
840AC_CACHE_CHECK([for static_assert], [st_cv_have_static_assert],
841	       [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <assert.h>]],
842						[[static_assert(1,"")]]
843					       )
844			       ],
845			       [st_cv_have_static_assert=yes],
846			       [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
847								[[_Static_assert(1,"")]]
848							       )
849					       ],
850					       [st_cv_have_static_assert=_Static_assert],
851					       [st_cv_have_static_assert=no]
852					      )
853			       ]
854			      )
855	       ]
856	      )
857case "x$st_cv_have_static_assert" in
858	xyes)
859		AC_DEFINE([HAVE_STATIC_ASSERT], [1],
860			  [Define to 1 if the system provides static_assert])
861		;;
862	x_Static_assert)
863		AC_DEFINE([HAVE__STATIC_ASSERT], [1],
864			  [Define to 1 if the system provides _Static_assert])
865		;;
866esac
867
868AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
869if test "x$ac_cv_lib_dl_dladdr" = xyes; then
870	AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
871fi
872AC_SUBST(dl_LIBS)
873
874saved_LIBS="$LIBS"
875AC_SEARCH_LIBS([timer_create], [rt])
876LIBS="$saved_LIBS"
877case "$ac_cv_search_timer_create" in
878	no) AC_MSG_FAILURE([failed to find timer_create]) ;;
879	-l*) timer_LIBS="$ac_cv_search_timer_create" ;;
880	*) timer_LIBS= ;;
881esac
882AC_SUBST(timer_LIBS)
883
884saved_LIBS="$LIBS"
885AC_SEARCH_LIBS([clock_gettime], [rt])
886LIBS="$saved_LIBS"
887case "$ac_cv_search_clock_gettime" in
888	no) AC_MSG_FAILURE([failed to find clock_gettime]) ;;
889	-l*) clock_LIBS="$ac_cv_search_clock_gettime" ;;
890	*) clock_LIBS= ;;
891esac
892AC_SUBST(clock_LIBS)
893
894saved_LIBS="$LIBS"
895AC_SEARCH_LIBS([mq_open], [rt])
896LIBS="$saved_LIBS"
897case "$ac_cv_search_mq_open" in
898	-l*) mq_LIBS="$ac_cv_search_mq_open" ;;
899	*) mq_LIBS= ;;
900esac
901AC_SUBST(mq_LIBS)
902
903AC_PATH_PROG([PERL], [perl])
904
905AC_CHECK_TOOL([READELF], [readelf])
906
907st_STACKTRACE
908
909if test "$arch" = mips && test "$no_create" != yes; then
910	mkdir -p linux/mips
911	if $srcdir/linux/mips/genstub.sh linux/mips; then
912		AC_MSG_RESULT([Generated MIPS syscallent stubs])
913	else
914		AC_MSG_ERROR([Failed to generate syscallent stubs])
915	fi
916fi
917
918AC_ARG_ENABLE([mpers],
919	[AS_HELP_STRING([--enable-mpers=yes|no|check|m32|mx32],
920		[whether to enable multiple personalities support required
921		 for proper decoding of structures used by tracees with
922		 personalities that differ from the personality of strace,
923		 default is yes.])],
924	[case "$enableval" in
925		yes|no|check|m32|mx32) enable_mpers="$enableval" ;;
926		*) AC_MSG_ERROR([bad value $enableval for enable-mpers option.
927				 Valid options are: yes, no, check, m32, mx32.])
928		;;
929	 esac],
930	[enable_mpers=yes])
931
932st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64])
933st_MPERS([mx32], [x86_64])
934
935AX_VALGRIND_DFLT([sgcheck], [off])
936AX_VALGRIND_CHECK
937
938AC_CONFIG_FILES([Makefile
939		 tests/Makefile
940		 tests-m32/Makefile
941		 tests-mx32/Makefile
942		 strace.1
943		 strace-log-merge.1
944		 strace.spec
945		 debian/changelog])
946AC_OUTPUT
947