# Copyright (c) 2006-2016 Dmitry V. Levin <ldv@altlinux.org>
# Copyright (c) 2008-2015 Mike Frysinger <vapier@gentoo.org>
# Copyright (c) 2015 Elvira Khabirova <lineprinter0@gmail.com>
-# Copyright (c) 2002-2017 The strace developers.
+# Copyright (c) 2002-2018 The strace developers.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
AC_PREREQ(2.57)
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
- [strace-devel@lists.sourceforge.net],
+ [strace-devel@lists.strace.io],
[strace],
[https://strace.io])
m4_define([copyright_year], m4_esyscmd([./copyright-year-gen .year]))
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
-RPM_CHANGELOGTIME="$(LC_TIME=C date '+%a %b %d %Y')"
+RPM_CHANGELOGTIME="$(LC_TIME=C date -u '+%a %b %d %Y')"
AC_SUBST(RPM_CHANGELOGTIME)
-DEB_CHANGELOGTIME="$(LC_TIME=C date -R)"
+DEB_CHANGELOGTIME="$(LC_TIME=C date -u -R)"
AC_SUBST(DEB_CHANGELOGTIME)
AC_PROG_CC
+AC_PROG_CC_STDC
AC_PROG_CPP
st_WARN_CFLAGS
AX_PROG_CC_FOR_BUILD
AC_MSG_CHECKING([for supported architecture])
arch_m32=
arch_mx32=
+cc_flags_m32=-m32
+cc_flags_mx32=-mx32
case "$host_cpu" in
+aarch64*)
+ arch=aarch64
+ arch_m32=arm
+ AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
+ ;;
+alpha*)
+ arch=alpha
+ AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
+ ;;
+arc*)
+ arch=arc
+ AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
+ ;;
+arm*)
+ arch=arm
+ AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
+ ;;
+avr32*)
+ arch=avr32
+ AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
+ ;;
bfin)
arch=bfin
AC_DEFINE([BFIN], 1, [Define for the Blackfin architecture.])
;;
+hppa*|parisc*)
+ arch=hppa
+ AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
+ ;;
i[[3456]]86|pentium)
arch=i386
AC_DEFINE([I386], 1, [Define for the i386 architecture.])
arch=m68k
AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
;;
-sparc64*)
- arch=sparc64
- arch_m32=sparc
- AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
- ;;
-sparc*)
- arch=sparc
- AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
- ;;
metag*)
arch=metag
AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
;;
+microblaze*)
+ arch=microblaze
+ AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
+ ;;
mips*)
arch=mips
AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
;;
-alpha*)
- arch=alpha
- AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
+nios2*)
+ arch=nios2
+ AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
+ ;;
+or1k*)
+ arch=or1k
+ AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
;;
powerpc*)
AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
;;
-arm*)
- arch=arm
- AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
- ;;
-aarch64*)
- arch=aarch64
- arch_m32=arm
- AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
- ;;
-avr32*)
- arch=avr32
- AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
- ;;
-arc*)
- arch=arc
- AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
+riscv*)
+ arch=riscv
+ AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
;;
s390)
arch=s390
;;
s390x)
arch=s390x
+ arch_m32=s390
+ cc_flags_m32=-m31
AC_DEFINE([S390X], 1, [Define for the S390x architecture.])
;;
-hppa*|parisc*)
- arch=hppa
- AC_DEFINE([HPPA], 1, [Define for the HPPA architecture.])
- ;;
sh64*)
arch=sh64
AC_DEFINE([SH64], 1, [Define for the SH64 architecture.])
arch=sh
AC_DEFINE([SH], 1, [Define for the SH architecture.])
;;
+sparc64*)
+ arch=sparc64
+ arch_m32=sparc
+ AC_DEFINE([SPARC64], 1, [Define for the SPARC64 architecture.])
+ ;;
+sparc*)
+ arch=sparc
+ AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
+ ;;
+tile*)
+ arch=tile
+ AC_DEFINE([TILE], 1, [Define for the Tile architecture])
+ ;;
x86?64*)
arch_m32=i386
AC_TRY_COMPILE(
AC_DEFINE([X32], 1, [Define for the 32bit AMD x86-64 architecture.])
fi
;;
-cris|crisv10)
- arch=crisv10
- AC_DEFINE([CRISV10], 1, [Define for the CRISv10 architecture.])
- ;;
-crisv32)
- arch=crisv32
- AC_DEFINE([CRISV32], 1, [Define for the CRISv32 architecture.])
- ;;
-tile*)
- arch=tile
- AC_DEFINE([TILE], 1, [Define for the Tile architecture])
- ;;
-microblaze*)
- arch=microblaze
- AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
- ;;
-nios2*)
- arch=nios2
- AC_DEFINE([NIOS2], 1, [Define for the Nios-II architecture.])
- ;;
-
-or1k*)
- arch=or1k
- AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
- ;;
-
xtensa*)
arch=xtensa
AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
;;
-
-riscv*)
- arch=riscv
- AC_DEFINE([RISCV], 1, [Define for the RISC-V architecture])
- ;;
-
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
esac
AC_MSG_RESULT($arch)
+arch_native=$arch
+
test -n "$arch_m32" ||
arch_m32=$arch
test -n "$arch_mx32" ||
AC_SUBST(arch)
AC_SUBST(arch_m32)
AC_SUBST(arch_mx32)
+AC_SUBST(cc_flags_m32)
+AC_SUBST(cc_flags_mx32)
+AC_SUBST(arch_native)
MIPS_ABI=
if test "$arch" = mips; then
AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
[AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM], ,
- [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
+ [AC_MSG_FAILURE([_MIPS_SIM cannot be determined])])])
# requires GCC >= 3.4
AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
fstatat
ftruncate
futimens
+ iconv_open
if_indextoname
open64
prctl
[#include <sys/types.h>
#include <asm/stat.h>])
-AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
+AC_CHECK_TYPES([struct user_desc],
+ [AC_CHECK_MEMBERS([struct user_desc.lm],,,
+ [#include <asm/ldt.h>])],,
+ [#include <asm/ldt.h>])
AC_CHECK_MEMBERS([struct stat.st_mtime_nsec, struct stat64.st_mtime_nsec],,,
[#include <sys/types.h>
struct flock,
struct flock64,
struct __kernel_flock,
- struct __kernel_flock64
+ struct __kernel_flock64,
+ struct f_owner_ex,
+ struct __kernel_f_owner_ex
]),,,
[#include <sys/types.h>
#include <linux/fcntl.h>])
struct perf_event_attr.use_clockid,
struct perf_event_attr.context_switch,
struct perf_event_attr.write_backward,
+ struct perf_event_attr.namespaces,
struct perf_event_attr.bp_type,
struct perf_event_attr.config1,
struct perf_event_attr.config2,
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
+ asm/guarded_storage.h
asm/sysmips.h
- bluetooth/bluetooth.h
elf.h
+ iconv.h
inttypes.h
linux/bsg.h
linux/cryptouser.h
linux/ip_vs.h
linux/ipc.h
linux/kcmp.h
+ linux/kvm.h
+ linux/memfd.h
linux/mmtimer.h
linux/msg.h
linux/neighbour.h
linux/netfilter/nfnetlink_cttimeout.h
linux/netfilter/nfnetlink_log.h
linux/netfilter/nfnetlink_queue.h
- linux/netfilter/xt_osf.h
linux/nsfs.h
linux/perf_event.h
linux/quota.h
mqueue.h
netinet/sctp.h
netipx/ipx.h
+ paths.h
scsi/sg.h
stropts.h
sys/conf.h
sys/ipc.h
sys/msg.h
sys/quota.h
- sys/reg.h
sys/sem.h
sys/shm.h
sys/signalfd.h
AC_CHECK_HEADERS([linux/mqueue.h],,, [#include <linux/types.h>])
+AC_CHECK_HEADERS([linux/netfilter/xt_osf.h],,, [#include <linux/ip.h>
+#include <linux/tcp.h>])
+
AC_CHECK_HEADERS(m4_normalize([
linux/netfilter_arp/arp_tables.h
linux/netfilter_bridge/ebtables.h
])
AC_CHECK_HEADERS([linux/bpf.h], [
- st_CHECK_UNION_BPF_ATTR([attach_flags])
- st_CHECK_UNION_BPF_ATTR([bpf_fd])
- st_CHECK_UNION_BPF_ATTR([flags])
- st_CHECK_UNION_BPF_ATTR([inner_map_fd])
- st_CHECK_UNION_BPF_ATTR([prog_flags])
+ AC_CHECK_TYPES([struct bpf_insn],,, [#include <linux/bpf.h>])
+ st_BPF_ATTR
+])
+
+AC_CHECK_HEADERS([bluetooth/bluetooth.h], [
+ AC_CHECK_MEMBERS([struct sockaddr_l2.l2_bdaddr_type],,,
+ [#include <bluetooth/bluetooth.h>
+ #include <bluetooth/l2cap.h>])
])
AC_CHECK_TYPES(m4_normalize([
AC_CHECK_TYPES([struct blk_user_trace_setup],,, [#include <linux/blktrace_api.h>])
+AC_CHECK_TYPES([struct mtd_write_req],,, [#include <mtd/mtd-abi.h>])
+
+AC_CHECK_MEMBERS([struct ubi_attach_req.max_beb_per1024],,, [#include <mtd/ubi-user.h>])
+
+AC_CHECK_TYPES(m4_normalize([
+ struct ptp_sys_offset
+]),,, [#include <linux/ptp_clock.h>])
+
+AC_CHECK_TYPES(m4_normalize([
+ struct kvm_regs,
+ struct kvm_sregs,
+ struct kvm_userspace_memory_region
+]),,, [#include <linux/kvm.h>])
+
AC_CHECK_HEADERS([linux/btrfs.h], [
AC_CHECK_MEMBERS(m4_normalize([
struct btrfs_ioctl_feature_flags.compat_flags,
struct btrfs_ioctl_fs_info_args.nodesize,
struct btrfs_ioctl_defrag_range_args.start,
- struct btrfs_ioctl_search_args_v2.buf_size
+ struct btrfs_ioctl_search_args_v2.buf_size,
+ struct btrfs_ioctl_logical_ino_args.flags
]),,, [ #include <stdio.h>
#include <linux/btrfs.h>])
AC_CHECK_DECLS(m4_normalize([BTRFS_COMPRESS_NONE, BTRFS_COMPRESS_ZLIB,
fi)
AC_CHECK_SIZEOF([long])
+SIZEOF_LONG="$ac_cv_sizeof_long"
+AC_SUBST(SIZEOF_LONG)
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
AC_CHECK_SIZEOF([kernel_long_t],,[#include "$srcdir/kernel_types.h"])
+SIZEOF_KERNEL_LONG_T="$ac_cv_sizeof_kernel_long_t"
+AC_SUBST(SIZEOF_KERNEL_LONG_T)
AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
+
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
[Define to 1 if the system provides program_invocation_name variable])
fi
+AC_CACHE_CHECK([for static_assert], [st_cv_have_static_assert],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <assert.h>]],
+ [[static_assert(1,"")]]
+ )
+ ],
+ [st_cv_have_static_assert=yes],
+ [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
+ [[_Static_assert(1,"")]]
+ )
+ ],
+ [st_cv_have_static_assert=_Static_assert],
+ [st_cv_have_static_assert=no]
+ )
+ ]
+ )
+ ]
+ )
+case "x$st_cv_have_static_assert" in
+ xyes)
+ AC_DEFINE([HAVE_STATIC_ASSERT], [1],
+ [Define to 1 if the system provides static_assert])
+ ;;
+ x_Static_assert)
+ AC_DEFINE([HAVE__STATIC_ASSERT], [1],
+ [Define to 1 if the system provides _Static_assert])
+ ;;
+esac
+
AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
if test "x$ac_cv_lib_dl_dladdr" = xyes; then
AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
fi
AC_SUBST(dl_LIBS)
+saved_LIBS="$LIBS"
+AC_SEARCH_LIBS([timer_create], [rt])
+LIBS="$saved_LIBS"
+case "$ac_cv_search_timer_create" in
+ no) AC_MSG_FAILURE([failed to find timer_create]) ;;
+ -l*) timer_LIBS="$ac_cv_search_timer_create" ;;
+ *) timer_LIBS= ;;
+esac
+AC_SUBST(timer_LIBS)
+
+saved_LIBS="$LIBS"
+AC_SEARCH_LIBS([clock_gettime], [rt])
+LIBS="$saved_LIBS"
+case "$ac_cv_search_clock_gettime" in
+ no) AC_MSG_FAILURE([failed to find clock_gettime]) ;;
+ -l*) clock_LIBS="$ac_cv_search_clock_gettime" ;;
+ *) clock_LIBS= ;;
+esac
+AC_SUBST(clock_LIBS)
+
+saved_LIBS="$LIBS"
+AC_SEARCH_LIBS([mq_open], [rt])
+LIBS="$saved_LIBS"
+case "$ac_cv_search_mq_open" in
+ -l*) mq_LIBS="$ac_cv_search_mq_open" ;;
+ *) mq_LIBS= ;;
+esac
+AC_SUBST(mq_LIBS)
+
AC_PATH_PROG([PERL], [perl])
-dnl stack trace with libunwind
-libunwind_CPPFLAGS=
-libunwind_LDFLAGS=
-libunwind_LIBS=
-AC_ARG_WITH([libunwind],
- [AS_HELP_STRING([--with-libunwind],
- [use libunwind to implement stack tracing support])],
- [case "${withval}" in
- yes|no|check) ;;
- *) with_libunwind=yes
- libunwind_CPPFLAGS="-I${withval}/include"
- libunwind_LDFLAGS="-L${withval}/lib" ;;
- esac],
- [with_libunwind=check]
-)
-
-use_libunwind=no
-AS_IF([test "x$with_libunwind" != xno],
- [saved_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
-
- AC_CHECK_HEADERS([libunwind-ptrace.h],
- [saved_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
-
- AC_CHECK_LIB([unwind], [backtrace],
- [libunwind_LIBS="-lunwind $libunwind_LIBS"
-
- AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
- saved_LIBS="$LIBS"
- LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
-
- AC_LINK_IFELSE(
- [AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
- [[return !unw_create_addr_space(0, 0)]])
- ],
- [AC_MSG_RESULT([yes])
- libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
-
- AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
- [libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
- use_libunwind=yes
- ],
- [if test "x$with_libunwind" != xcheck; then
- AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
- fi
- ],
- [$libunwind_LIBS]
- )
- ],
- [AC_MSG_RESULT([no])
- if test "x$with_libunwind" != xcheck; then
- AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
- fi
- ]
- )
-
- LIBS="$saved_LIBS"
- ],
- [if test "x$with_libunwind" != xcheck; then
- AC_MSG_FAILURE([failed to find libunwind])
- fi
- ],
- [$libunwind_LIBS]
- )
-
- LDFLAGS="$saved_LDFLAGS"
- ],
- [if test "x$with_libunwind" != xcheck; then
- AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
- fi
- ]
- )
-
- CPPFLAGS="$saved_CPPFLAGS"
- ]
-)
-
-dnl enable libunwind
-AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
-if test "x$use_libunwind" = xyes; then
- AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
- AC_SUBST(libunwind_LIBS)
- AC_SUBST(libunwind_LDFLAGS)
- AC_SUBST(libunwind_CPPFLAGS)
-fi
-AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
-AC_MSG_RESULT([$use_libunwind])
+AC_CHECK_TOOL([READELF], [readelf])
+
+st_STACKTRACE
if test "$arch" = mips && test "$no_create" != yes; then
mkdir -p linux/mips
if $srcdir/linux/mips/genstub.sh linux/mips; then
AC_MSG_RESULT([Generated MIPS syscallent stubs])
else
- AC_MSG_FAILURE([Failed to generate syscallent stubs])
+ AC_MSG_ERROR([Failed to generate syscallent stubs])
fi
fi
-st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
+AC_ARG_ENABLE([mpers],
+ [AS_HELP_STRING([--enable-mpers=yes|no|check|m32|mx32],
+ [whether to enable multiple personalities support required
+ for proper decoding of structures used by tracees with
+ personalities that differ from the personality of strace,
+ default is yes.])],
+ [case "$enableval" in
+ yes|no|check|m32|mx32) enable_mpers="$enableval" ;;
+ *) AC_MSG_ERROR([bad value $enableval for enable-mpers option.
+ Valid options are: yes, no, check, m32, mx32.])
+ ;;
+ esac],
+ [enable_mpers=yes])
+
+st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AX_VALGRIND_DFLT([sgcheck], [off])
tests-m32/Makefile
tests-mx32/Makefile
strace.1
+ strace-log-merge.1
strace.spec
debian/changelog])
AC_OUTPUT