Home | History | Annotate | Download | only in strace
      1 # Configure template for strace.
      2 #
      3 # Copyright (c) 1999-2001 Wichert Akkerman <wichert (a] deephackmode.org>
      4 # Copyright (c) 2002-2009 Roland McGrath <roland (a] redhat.com>
      5 # Copyright (c) 2006-2016 Dmitry V. Levin <ldv (a] altlinux.org>
      6 # Copyright (c) 2008-2015 Mike Frysinger <vapier (a] gentoo.org>
      7 # Copyright (c) 2015 Elvira Khabirova <lineprinter0 (a] 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 
     32 AC_PREREQ(2.57)
     33 AC_INIT([strace],
     34 	m4_esyscmd([./git-version-gen .tarball-version]),
     35 	[strace-devel (a] lists.sourceforge.net],
     36 	[strace],
     37 	[https://strace.io])
     38 AC_COPYRIGHT([Copyright (C) 1999-2017 The strace developers.])
     39 AC_CONFIG_SRCDIR([strace.c])
     40 AC_CONFIG_AUX_DIR([.])
     41 AC_CONFIG_HEADERS([config.h])
     42 AM_INIT_AUTOMAKE([foreign nostdinc dist-xz silent-rules parallel-tests])
     43 AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
     44 AM_MAINTAINER_MODE
     45 AC_CANONICAL_HOST
     46 
     47 RPM_CHANGELOGTIME="$(LC_TIME=C date '+%a %b %d %Y')"
     48 AC_SUBST(RPM_CHANGELOGTIME)
     49 DEB_CHANGELOGTIME="$(LC_TIME=C date -R)"
     50 AC_SUBST(DEB_CHANGELOGTIME)
     51 
     52 AC_PROG_CC
     53 AC_PROG_CPP
     54 st_WARN_CFLAGS
     55 AX_PROG_CC_FOR_BUILD
     56 AC_PROG_INSTALL
     57 AC_PROG_RANLIB
     58 
     59 AC_USE_SYSTEM_EXTENSIONS
     60 AX_CODE_COVERAGE
     61 
     62 AC_MSG_CHECKING([for supported architecture])
     63 arch_m32=
     64 arch_mx32=
     65 case "$host_cpu" in
     66 bfin)
     67 	arch=bfin
     68 	AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
     69 	;;
     70 i[[3456]]86|pentium)
     71 	arch=i386
     72 	AC_DEFINE([I386], 1, [Define for the i386 architecture.])
     73 	;;
     74 ia64)
     75 	arch=ia64
     76 	AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
     77 	;;
     78 m68k)
     79 	arch=m68k
     80 	AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
     81 	;;
     82 sparc64*)
     83 	arch=sparc64
     84 	arch_m32=sparc
     85 	AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
     86 	;;
     87 sparc*)
     88 	arch=sparc
     89 	AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
     90 	;;
     91 metag*)
     92 	arch=metag
     93 	AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
     94 	;;
     95 mips*)
     96 	arch=mips
     97 	AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
     98 	;;
     99 alpha*)
    100 	arch=alpha
    101 	AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
    102 	;;
    103 powerpc*)
    104 	AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
    105 	AC_TRY_COMPILE(
    106 [#ifndef __LP64__
    107 # error 32 bit
    108 #endif], [], arch=powerpc64, arch=powerpc)
    109 	if test "$arch" = "powerpc64"; then
    110 		arch_m32=powerpc
    111 		AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
    112 	fi
    113 	;;
    114 arm*)
    115 	arch=arm
    116 	AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
    117 	;;
    118 aarch64*)
    119 	arch=aarch64
    120 	arch_m32=arm
    121 	AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
    122 	;;
    123 avr32*)
    124 	arch=avr32
    125 	AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
    126 	;;
    127 arc*)
    128 	arch=arc
    129 	AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
    130 	;;
    131 s390)
    132 	arch=s390
    133 	AC_DEFINE([S390], 1, [Define for the S390 architecture.])
    134 	;;
    135 s390x)
    136 	arch=s390x
    137 	AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
    138 	;;
    139 hppa*|parisc*)
    140 	arch=hppa
    141 	AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
    142 	;;
    143 sh64*)
    144 	arch=sh64
    145 	AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
    146 	;;
    147 sh*)
    148 	arch=sh
    149 	AC_DEFINE([SH], 1, [Define for the SH architecture.])
    150 	;;
    151 x86?64*)
    152 	arch_m32=i386
    153 	AC_TRY_COMPILE(
    154 [#ifndef __ILP32__
    155 # error not x32
    156 #endif], [], arch=x32, arch=x86_64)
    157 	if test "$arch" = "x86_64"; then
    158 		arch_mx32=x32
    159 		AC_DEFINE([X86_64], 1, [Define for the 64bit AMD x86-64 architecture.])
    160 	else
    161 		AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
    162 	fi
    163 	;;
    164 cris|crisv10)
    165 	arch=crisv10
    166 	AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
    167 	;;
    168 crisv32)
    169 	arch=crisv32
    170 	AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
    171 	;;
    172 tile*)
    173 	arch=tile
    174 	AC_DEFINE([TILE], 1, [Define for the Tile architecture])
    175 	;;
    176 microblaze*)
    177 	arch=microblaze
    178 	AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
    179 	;;
    180 nios2*)
    181 	arch=nios2
    182 	AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
    183 	;;
    184 
    185 or1k*)
    186 	arch=or1k
    187 	AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
    188 	;;
    189 
    190 xtensa*)
    191 	arch=xtensa
    192 	AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
    193 	;;
    194 
    195 riscv*)
    196 	arch=riscv
    197 	AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
    198 	;;
    199 
    200 *)
    201 	AC_MSG_RESULT([NO!])
    202 	AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
    203 	;;
    204 esac
    205 AC_MSG_RESULT($arch)
    206 
    207 test -n "$arch_m32" ||
    208 	arch_m32=$arch
    209 test -n "$arch_mx32" ||
    210 	arch_mx32=$arch
    211 AC_SUBST(arch)
    212 AC_SUBST(arch_m32)
    213 AC_SUBST(arch_mx32)
    214 
    215 MIPS_ABI=
    216 if test "$arch" = mips; then
    217 	AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
    218 		       [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], ,
    219 				       [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
    220 
    221 	# requires GCC >= 3.4
    222 	AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
    223 		[AC_COMPILE_IFELSE(
    224 			[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIO32 ? 1 : - 1];]])],
    225 			[st_cv_mips_abi=o32],
    226 		[AC_COMPILE_IFELSE(
    227 			[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABIN32 ? 1 : - 1];]])],
    228 			[st_cv_mips_abi=n32],
    229 		[AC_COMPILE_IFELSE(
    230 			[AC_LANG_PROGRAM(, [[int i[_MIPS_SIM == _ABI64 ? 1 : - 1];]])],
    231 			[st_cv_mips_abi=n64],
    232 			[st_cv_mips_abi=unknown])])])])
    233 
    234 	case "$st_cv_mips_abi" in
    235 		o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _ABIO32.]);;
    236 		n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _ABIN32.]);;
    237 		n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _ABI64.]);;
    238 		*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
    239 	esac
    240 	MIPS_ABI="$st_cv_mips_abi"
    241 fi
    242 AC_SUBST(MIPS_ABI)
    243 
    244 AC_ARG_ENABLE([arm-oabi],
    245 	      [AS_HELP_STRING([--enable-arm-oabi],
    246 			      [enable OABI support on ARM EABI])],
    247 	      [], [enable_arm_oabi=no])
    248 case "$enable_arm_oabi" in
    249 	yes) enable_arm_oabi=1 ;;
    250 	no) enable_arm_oabi=0 ;;
    251 	*) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
    252 esac
    253 AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
    254 		   [Define to 1 if you want OABI support on ARM EABI.])
    255 
    256 AC_C_BIGENDIAN
    257 AC_C_TYPEOF
    258 
    259 AC_TYPE_UID_T
    260 
    261 AC_CHECK_FUNCS(m4_normalize([
    262 	accept4
    263 	fallocate
    264 	fanotify_mark
    265 	fopen64
    266 	fork
    267 	fputs_unlocked
    268 	fstatat
    269 	ftruncate
    270 	futimens
    271 	if_indextoname
    272 	open64
    273 	prctl
    274 	preadv
    275 	process_vm_readv
    276 	pwritev
    277 	readahead
    278 	signalfd
    279 	stpcpy
    280 	strerror
    281 	strsignal
    282 	sync_file_range
    283 	utimensat
    284 ]))
    285 
    286 AC_CHECK_TYPES([sig_atomic_t, struct sigcontext],,, [#include <signal.h>])
    287 
    288 AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
    289 
    290 AC_CHECK_TYPES([__kernel_long_t, __kernel_ulong_t],,,
    291 [#include <asm/posix_types.h>])
    292 
    293 AC_CHECK_TYPES([struct stat64, struct __old_kernel_stat],,,
    294 [#include <sys/types.h>
    295 #include <asm/stat.h>])
    296 
    297 AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
    298 
    299 AC_CHECK_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,,
    300 [#include <sys/types.h>
    301 #include <asm/stat.h>])
    302 
    303 AC_CHECK_TYPES(m4_normalize([
    304 	struct pt_all_user_regs,
    305 	struct ia64_fpreg,
    306 	struct ptrace_peeksiginfo_args
    307 ]),,, [#include <sys/ptrace.h>])
    308 
    309 AC_CHECK_TYPES(m4_normalize([
    310 	struct flock,
    311 	struct flock64,
    312 	struct __kernel_flock,
    313 	struct __kernel_flock64
    314 ]),,,
    315 [#include <sys/types.h>
    316 #include <linux/fcntl.h>])
    317 
    318 AC_CHECK_MEMBERS([struct timex.tai],,, [#include <sys/timex.h>])
    319 
    320 AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
    321 
    322 AC_CHECK_MEMBERS(m4_normalize([
    323 	siginfo_t.si_syscall,
    324 	siginfo_t.si_timerid,
    325 	siginfo_t.si_overrun
    326 ]),,, [#include <signal.h>])
    327 
    328 AC_CHECK_MEMBERS(m4_normalize([
    329 	struct perf_event_attr.precise_ip,
    330 	struct perf_event_attr.mmap_data,
    331 	struct perf_event_attr.sample_id_all,
    332 	struct perf_event_attr.exclude_host,
    333 	struct perf_event_attr.exclude_guest,
    334 	struct perf_event_attr.exclude_callchain_kernel,
    335 	struct perf_event_attr.exclude_callchain_user,
    336 	struct perf_event_attr.mmap2,
    337 	struct perf_event_attr.comm_exec,
    338 	struct perf_event_attr.use_clockid,
    339 	struct perf_event_attr.context_switch,
    340 	struct perf_event_attr.write_backward,
    341 	struct perf_event_attr.bp_type,
    342 	struct perf_event_attr.config1,
    343 	struct perf_event_attr.config2,
    344 	struct perf_event_attr.branch_sample_type,
    345 	struct perf_event_attr.sample_regs_user,
    346 	struct perf_event_attr.sample_stack_user,
    347 	struct perf_event_attr.sample_regs_intr,
    348 	struct perf_event_attr.aux_watermark,
    349 	struct perf_event_attr.sample_max_stack
    350 ]),,, [#include <linux/perf_event.h>])
    351 
    352 AC_CHECK_HEADERS(m4_normalize([
    353 	asm/cachectl.h
    354 	asm/sysmips.h
    355 	bluetooth/bluetooth.h
    356 	elf.h
    357 	inttypes.h
    358 	linux/bsg.h
    359 	linux/dm-ioctl.h
    360 	linux/dqblk_xfs.h
    361 	linux/falloc.h
    362 	linux/fiemap.h
    363 	linux/filter.h
    364 	linux/hiddev.h
    365 	linux/ip_vs.h
    366 	linux/ipc.h
    367 	linux/mmtimer.h
    368 	linux/msg.h
    369 	linux/perf_event.h
    370 	linux/quota.h
    371 	linux/seccomp.h
    372 	linux/securebits.h
    373 	linux/sem.h
    374 	linux/shm.h
    375 	linux/userfaultfd.h
    376 	linux/utsname.h
    377 	mqueue.h
    378 	netinet/sctp.h
    379 	netipx/ipx.h
    380 	scsi/sg.h
    381 	stropts.h
    382 	sys/conf.h
    383 	sys/eventfd.h
    384 	sys/fanotify.h
    385 	sys/ipc.h
    386 	sys/msg.h
    387 	sys/quota.h
    388 	sys/reg.h
    389 	sys/sem.h
    390 	sys/shm.h
    391 	sys/signalfd.h
    392 	sys/xattr.h
    393 	ustat.h
    394 ]))
    395 
    396 AC_CHECK_HEADERS([asm/sigcontext.h],,, [#include <signal.h>])
    397 
    398 AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
    399 
    400 AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
    401 
    402 AC_CHECK_HEADERS(m4_normalize([
    403 	linux/netfilter_arp/arp_tables.h
    404 	linux/netfilter_bridge/ebtables.h
    405 	linux/netfilter_ipv4/ip_tables.h
    406 	linux/netfilter_ipv6/ip6_tables.h
    407 ]),,, [#include <netinet/in.h>
    408 #include <net/if.h>])
    409 
    410 AC_CHECK_HEADERS([linux/input.h], [
    411 	AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
    412 ])
    413 
    414 AC_CHECK_HEADERS([linux/bpf.h], [
    415 	AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
    416 		       [st_cv_have_union_bpf_attr_log_buf],
    417 		[AC_COMPILE_IFELSE(
    418 			[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
    419 					 [[union bpf_attr a = { .log_buf = 0 };]])],
    420 			[st_cv_have_union_bpf_attr_log_buf=yes],
    421 			[st_cv_have_union_bpf_attr_log_buf=no])])
    422 	if test $st_cv_have_union_bpf_attr_log_buf = yes; then
    423 		AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
    424 			  [Define to 1 if union bpf_attr.log_buf initialization works])
    425 	fi
    426 	AC_CACHE_CHECK([whether union bpf_attr.bpf_fd initialization works],
    427 		       [st_cv_have_union_bpf_attr_bpf_fd],
    428 		[AC_COMPILE_IFELSE(
    429 			[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
    430 					 [[union bpf_attr a = { .bpf_fd = 0 };]])],
    431 			[st_cv_have_union_bpf_attr_bpf_fd=yes],
    432 			[st_cv_have_union_bpf_attr_bpf_fd=no])])
    433 	if test $st_cv_have_union_bpf_attr_bpf_fd = yes; then
    434 		AC_DEFINE(HAVE_UNION_BPF_ATTR_BPF_FD, [1],
    435 			  [Define to 1 if union bpf_attr.bpf_fd initialization works])
    436 	fi
    437 	AC_CACHE_CHECK([whether union bpf_attr.attach_type initialization works],
    438 		       [st_cv_have_union_bpf_attr_attach_type],
    439 		[AC_COMPILE_IFELSE(
    440 			[AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
    441 					 [[union bpf_attr a = { .attach_type = 0 };]])],
    442 			[st_cv_have_union_bpf_attr_attach_type=yes],
    443 			[st_cv_have_union_bpf_attr_attach_type=no])])
    444 	if test $st_cv_have_union_bpf_attr_attach_type = yes; then
    445 		AC_DEFINE(HAVE_UNION_BPF_ATTR_ATTACH_TYPE, [1],
    446 			  [Define to 1 if union bpf_attr.attach_type initialization works])
    447 	fi
    448 ])
    449 
    450 AC_CHECK_TYPES([struct statfs], [
    451 	AC_CHECK_MEMBERS([struct statfs.f_frsize],,, [#include <linux/types.h>
    452 #include <asm/statfs.h>])
    453 	AC_CHECK_MEMBERS([struct statfs.f_flags],,, [#include <linux/types.h>
    454 #include <asm/statfs.h>])
    455 	AC_CHECK_MEMBERS([struct statfs.f_fsid.val],,, [#include <linux/types.h>
    456 #include <asm/statfs.h>])
    457 	AC_CHECK_MEMBERS([struct statfs.f_fsid.__val],,, [#include <linux/types.h>
    458 #include <asm/statfs.h>])
    459 ],, [#include <linux/types.h>
    460 #include <asm/statfs.h>])
    461 
    462 AC_CHECK_TYPES([struct statfs64], [
    463 	AC_CHECK_MEMBERS([struct statfs64.f_frsize],,, [#include <linux/types.h>
    464 #include <asm/statfs.h>])
    465 	AC_CHECK_MEMBERS([struct statfs64.f_flags],,, [#include <linux/types.h>
    466 #include <asm/statfs.h>])
    467 	AC_CHECK_MEMBERS([struct statfs64.f_fsid.val],,, [#include <linux/types.h>
    468 #include <asm/statfs.h>])
    469 	AC_CHECK_MEMBERS([struct statfs64.f_fsid.__val],,, [#include <linux/types.h>
    470 #include <asm/statfs.h>])
    471 ],, [#include <linux/types.h>
    472 #include <asm/statfs.h>])
    473 
    474 AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>])
    475 
    476 AC_CHECK_HEADERS([linux/btrfs.h], [
    477 	AC_CHECK_MEMBERS(m4_normalize([
    478 		struct btrfs_ioctl_feature_flags.compat_flags,
    479 		struct btrfs_ioctl_fs_info_args.nodesize,
    480 		struct btrfs_ioctl_defrag_range_args.start,
    481 		struct btrfs_ioctl_search_args_v2.buf_size
    482 		]),,, [ #include <stdio.h>
    483 #include <linux/btrfs.h>])
    484         AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
    485 	                        BTRFS_COMPRESS_LZO]),,,[ #include <stdio.h>
    486 #include <linux/btrfs.h>])])
    487 
    488 AC_CHECK_DECLS([sys_errlist])
    489 AC_CHECK_DECLS(m4_normalize([
    490 	PTRACE_PEEKUSER,
    491 	PTRACE_POKEUSER
    492 ]),,, [#include <sys/ptrace.h>])
    493 
    494 AC_CHECK_DECLS(m4_normalize([
    495 	P_PID,
    496 	P_PPID,
    497 	P_PGID,
    498 	P_SID,
    499 	P_CID,
    500 	P_UID,
    501 	P_GID,
    502 	P_ALL,
    503 	P_LWPID
    504 ]),,, [#include <sys/wait.h>])
    505 
    506 AC_CHECK_DECLS(m4_normalize([
    507 	LO_FLAGS_READ_ONLY,
    508 	LO_FLAGS_USE_AOPS,
    509 	LO_FLAGS_AUTOCLEAR,
    510 	LO_FLAGS_PARTSCAN,
    511 	LO_FLAGS_DIRECT_IO
    512 ]),,, [#include <linux/loop.h>])
    513 
    514 AC_CHECK_DECLS(m4_normalize([
    515 	CTL_PROC,
    516 	CTL_ARLAN,
    517 	CTL_S390DBF,
    518 	CTL_SUNRPC,
    519 	CTL_PM,
    520 	CTL_FRV,
    521 	KERN_PRINTK_RATELIMIT,
    522 	KERN_PRINTK_RATELIMIT_BURST,
    523 	KERN_PTY,
    524 	KERN_NGROUPS_MAX,
    525 	KERN_SPARC_SCONS_PWROFF,
    526 	KERN_HZ_TIMER,
    527 	KERN_UNKNOWN_NMI_PANIC,
    528 	KERN_BOOTLOADER_TYPE,
    529 	KERN_RANDOMIZE,
    530 	KERN_SETUID_DUMPABLE,
    531 	KERN_SPIN_RETRY,
    532 	KERN_ACPI_VIDEO_FLAGS,
    533 	KERN_IA64_UNALIGNED,
    534 	KERN_COMPAT_LOG,
    535 	KERN_MAX_LOCK_DEPTH,
    536 	KERN_NMI_WATCHDOG,
    537 	KERN_PANIC_ON_NMI,
    538 	NET_LLC,
    539 	NET_NETFILTER,
    540 	NET_DCCP,
    541 	NET_IRDA,
    542 	NET_CORE_DESTROY_DELAY,
    543 	NET_CORE_BUDGET,
    544 	NET_CORE_AEVENT_ETIME,
    545 	NET_CORE_AEVENT_RSEQTH,
    546 	NET_CORE_WARNINGS,
    547 	NET_IPV4_IGMP_MAX_MSF,
    548 	NET_TCP_NO_METRICS_SAVE,
    549 	NET_TCP_DEFAULT_WIN_SCALE,
    550 	NET_TCP_MODERATE_RCVBUF,
    551 	NET_TCP_TSO_WIN_DIVISOR,
    552 	NET_TCP_BIC_BETA,
    553 	NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
    554 	NET_TCP_CONG_CONTROL,
    555 	NET_TCP_ABC,
    556 	NET_IPV4_IPFRAG_MAX_DIST,
    557 	NET_TCP_MTU_PROBING,
    558 	NET_TCP_BASE_MSS,
    559 	NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
    560 	NET_TCP_DMA_COPYBREAK,
    561 	NET_TCP_SLOW_START_AFTER_IDLE,
    562 	NET_CIPSOV4_CACHE_ENABLE,
    563 	NET_CIPSOV4_CACHE_BUCKET_SIZE,
    564 	NET_CIPSOV4_RBM_OPTFMT,
    565 	NET_CIPSOV4_RBM_STRICTVALID,
    566 	NET_TCP_AVAIL_CONG_CONTROL,
    567 	NET_TCP_ALLOWED_CONG_CONTROL,
    568 	NET_TCP_MAX_SSTHRESH,
    569 	NET_TCP_FRTO_RESPONSE,
    570 	NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
    571 	NET_IPV4_CONF_FORCE_IGMP_VERSION,
    572 	NET_IPV4_CONF_ARP_ANNOUNCE,
    573 	NET_IPV4_CONF_ARP_IGNORE,
    574 	NET_IPV4_CONF_PROMOTE_SECONDARIES,
    575 	NET_IPV4_CONF_ARP_ACCEPT,
    576 	NET_IPV4_CONF_ARP_NOTIFY,
    577 	NET_IPV6_MLD_MAX_MSF,
    578 	NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
    579 	VM_MAX_MAP_COUNT,
    580 	VM_LAPTOP_MODE,
    581 	VM_BLOCK_DUMP,
    582 	VM_HUGETLB_GROUP,
    583 	VM_VFS_CACHE_PRESSURE,
    584 	VM_LEGACY_VA_LAYOUT,
    585 	VM_SWAP_TOKEN_TIMEOUT
    586 ]),,,
    587 [#include <sys/types.h>
    588 #include <linux/sysctl.h>])
    589 
    590 AC_CHECK_DECLS(m4_normalize([
    591 	V4L2_FIELD_ANY,
    592 	V4L2_FIELD_NONE,
    593 	V4L2_FIELD_TOP,
    594 	V4L2_FIELD_BOTTOM,
    595 	V4L2_FIELD_INTERLACED,
    596 	V4L2_FIELD_SEQ_TB,
    597 	V4L2_FIELD_SEQ_BT,
    598 	V4L2_FIELD_ALTERNATE,
    599 	V4L2_FIELD_INTERLACED_TB,
    600 	V4L2_FIELD_INTERLACED_BT,
    601 	V4L2_BUF_TYPE_VIDEO_CAPTURE,
    602 	V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
    603 	V4L2_BUF_TYPE_VIDEO_OUTPUT,
    604 	V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
    605 	V4L2_BUF_TYPE_VIDEO_OVERLAY,
    606 	V4L2_BUF_TYPE_VBI_CAPTURE,
    607 	V4L2_BUF_TYPE_VBI_OUTPUT,
    608 	V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
    609 	V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
    610 	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
    611 	V4L2_TUNER_RADIO,
    612 	V4L2_TUNER_ANALOG_TV,
    613 	V4L2_TUNER_DIGITAL_TV,
    614 	V4L2_MEMORY_MMAP,
    615 	V4L2_MEMORY_USERPTR,
    616 	V4L2_MEMORY_OVERLAY,
    617 	V4L2_MEMORY_DMABUF,
    618 	V4L2_COLORSPACE_SMPTE170M,
    619 	V4L2_COLORSPACE_SMPTE240M,
    620 	V4L2_COLORSPACE_REC709,
    621 	V4L2_COLORSPACE_BT878,
    622 	V4L2_COLORSPACE_470_SYSTEM_M,
    623 	V4L2_COLORSPACE_470_SYSTEM_BG,
    624 	V4L2_COLORSPACE_JPEG,
    625 	V4L2_COLORSPACE_SRGB,
    626 	V4L2_PRIORITY_UNSET,
    627 	V4L2_PRIORITY_BACKGROUND,
    628 	V4L2_PRIORITY_INTERACTIVE,
    629 	V4L2_PRIORITY_RECORD,
    630 	V4L2_FRMSIZE_TYPE_DISCRETE,
    631 	V4L2_FRMSIZE_TYPE_CONTINUOUS,
    632 	V4L2_FRMSIZE_TYPE_STEPWISE,
    633 	V4L2_FRMIVAL_TYPE_DISCRETE,
    634 	V4L2_FRMIVAL_TYPE_CONTINUOUS,
    635 	V4L2_FRMIVAL_TYPE_STEPWISE,
    636 	V4L2_CTRL_TYPE_INTEGER,
    637 	V4L2_CTRL_TYPE_BOOLEAN,
    638 	V4L2_CTRL_TYPE_MENU,
    639 	V4L2_CTRL_TYPE_BUTTON,
    640 	V4L2_CTRL_TYPE_INTEGER64,
    641 	V4L2_CTRL_TYPE_CTRL_CLASS,
    642 	V4L2_CTRL_TYPE_STRING,
    643 	V4L2_CTRL_TYPE_BITMASK,
    644 	V4L2_CTRL_TYPE_INTEGER_MENU
    645 ]),,, [#include <sys/time.h>
    646 #include <linux/ioctl.h>
    647 #include <linux/types.h>
    648 #include <linux/videodev2.h>])
    649 
    650 AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
    651 	[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
    652 #include <stdlib.h>
    653 #include <linux/fs.h>], [return !BLKGETSIZE64;])],
    654 			   [ac_cv_have_blkgetsize64=yes], [ac_cv_have_blkgetsize64=no])]
    655 	if test $ac_cv_have_blkgetsize64 = yes; then
    656 		AC_DEFINE([HAVE_BLKGETSIZE64], [1], [Define to 1 if you have BLKGETSIZE64.])
    657 	fi)
    658 
    659 AC_CHECK_SIZEOF([long])
    660 AC_CHECK_SIZEOF([long long])
    661 AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
    662 AC_CHECK_SIZEOF([kernel_long_t],,[#include "$srcdir/kernel_types.h"])
    663 AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
    664 
    665 AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
    666 	       [[st_cv_SIGRTMIN="$(echo SIGRTMIN |
    667 			$CPP $CPPFLAGS -P -imacros asm/signal.h - |
    668 			grep '^[0-9]')"
    669 	         test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
    670 if test "x$st_cv_SIGRTMIN" != xno; then
    671 	AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
    672 			   [SIGRTMIN defined in <asm/signal.h>])
    673 fi
    674 AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
    675 	       [st_cv_SA_RESTORER="$(echo SA_RESTORER |
    676 			$CPP $CPPFLAGS -P -imacros asm/signal.h - |
    677 			grep ^0x)"
    678 	        test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
    679 if test "x$st_cv_SA_RESTORER" != xno; then
    680 	AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
    681 			   [SA_RESTORER defined in <asm/signal.h>])
    682 fi
    683 
    684 AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
    685 	       [AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
    686 			       [st_cv_have___builtin_popcount=yes],
    687 			       [st_cv_have___builtin_popcount=no])])
    688 if test "x$st_cv_have___builtin_popcount" = xyes; then
    689 	AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
    690 		  [Define to 1 if the system provides __builtin_popcount function])
    691 fi
    692 
    693 AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
    694 if test "x$ac_cv_lib_dl_dladdr" = xyes; then
    695 	AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
    696 fi
    697 AC_SUBST(dl_LIBS)
    698 
    699 AC_PATH_PROG([PERL], [perl])
    700 
    701 dnl stack trace with libunwind
    702 libunwind_CPPFLAGS=
    703 libunwind_LDFLAGS=
    704 libunwind_LIBS=
    705 AC_ARG_WITH([libunwind],
    706             [AS_HELP_STRING([--with-libunwind],
    707                             [use libunwind to implement stack tracing support])],
    708             [case "${withval}" in
    709              yes|no|check) ;;
    710              *) with_libunwind=yes
    711                 libunwind_CPPFLAGS="-I${withval}/include"
    712                 libunwind_LDFLAGS="-L${withval}/lib" ;;
    713              esac],
    714             [with_libunwind=check]
    715 )
    716 
    717 use_libunwind=no
    718 AS_IF([test "x$with_libunwind" != xno],
    719       [saved_CPPFLAGS="$CPPFLAGS"
    720        CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
    721 
    722        AC_CHECK_HEADERS([libunwind-ptrace.h],
    723          [saved_LDFLAGS="$LDFLAGS"
    724           LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
    725 
    726           AC_CHECK_LIB([unwind], [backtrace],
    727             [libunwind_LIBS="-lunwind $libunwind_LIBS"
    728 
    729              AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
    730              saved_LIBS="$LIBS"
    731              LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
    732 
    733              AC_LINK_IFELSE(
    734                [AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
    735                                 [[return !unw_create_addr_space(0, 0)]])
    736                ],
    737                [AC_MSG_RESULT([yes])
    738                 libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
    739 
    740                 AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
    741                   [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
    742                    use_libunwind=yes
    743                   ],
    744                   [if test "x$with_libunwind" != xcheck; then
    745                      AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
    746                    fi
    747                   ],
    748                   [$libunwind_LIBS]
    749                 )
    750                ],
    751                [AC_MSG_RESULT([no])
    752                 if test "x$with_libunwind" != xcheck; then
    753                   AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
    754                 fi
    755                ]
    756              )
    757 
    758              LIBS="$saved_LIBS"
    759             ],
    760             [if test "x$with_libunwind" != xcheck; then
    761                AC_MSG_FAILURE([failed to find libunwind])
    762              fi
    763             ],
    764             [$libunwind_LIBS]
    765           )
    766 
    767           LDFLAGS="$saved_LDFLAGS"
    768          ],
    769          [if test "x$with_libunwind" != xcheck; then
    770             AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
    771           fi
    772          ]
    773        )
    774 
    775        CPPFLAGS="$saved_CPPFLAGS"
    776       ]
    777 )
    778 
    779 dnl enable libunwind
    780 AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
    781 if test "x$use_libunwind" = xyes; then
    782 	AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
    783 	AC_SUBST(libunwind_LIBS)
    784 	AC_SUBST(libunwind_LDFLAGS)
    785 	AC_SUBST(libunwind_CPPFLAGS)
    786 fi
    787 AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
    788 AC_MSG_RESULT([$use_libunwind])
    789 
    790 if test "$arch" = mips && test "$no_create" != yes; then
    791 	mkdir -p linux/mips
    792 	if $srcdir/linux/mips/genstub.sh linux/mips; then
    793 		AC_MSG_RESULT([Generated MIPS syscallent stubs])
    794 	else
    795 		AC_MSG_FAILURE([Failed to generate syscallent stubs])
    796 	fi
    797 fi
    798 
    799 st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
    800 st_MPERS([mx32], [x86_64])
    801 
    802 AX_VALGRIND_DFLT([sgcheck], [off])
    803 AX_VALGRIND_CHECK
    804 
    805 AC_CONFIG_FILES([Makefile
    806 		 tests/Makefile
    807 		 tests-m32/Makefile
    808 		 tests-mx32/Makefile
    809 		 strace.spec
    810 		 debian/changelog])
    811 AC_OUTPUT
    812