# 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_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])
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=
fstatat
ftruncate
futimens
+ iconv_open
if_indextoname
open64
prctl
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>])
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
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/bpf.h], [
- AC_CHECK_MEMBERS(m4_normalize([
- union bpf_attr.attach_flags,
- union bpf_attr.bpf_fd,
- union bpf_attr.flags,
- union bpf_attr.info.info,
- union bpf_attr.next_id,
- union bpf_attr.numa_node,
- union bpf_attr.prog_flags,
- union bpf_attr.test.duration
- ]),,, [#include <linux/bpf.h>])
+ 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([
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])
AC_CHECK_TOOL([READELF], [readelf])
-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])
-
-dnl demangling symbols in the stack trace
-libiberty_CPPFLAGS=
-libiberty_LDFLAGS=
-libiberty_LIBS=
-AC_ARG_WITH([libiberty],
- [AS_HELP_STRING([--with-libiberty],
- [use libiberty to demangle symbols in stack trace])],
- [case "${withval}" in
- yes|no|check) ;;
- *) with_libiberty=yes
- libiberty_CPPFLAGS="-I${withval}/include"
- libiberty_LDFLAGS="-L${withval}/lib" ;;
- esac],
- [with_libiberty=check]
-)
-
-use_libiberty=no
-AS_IF([test "x$use_libunwind" = xyes && test "x$with_libiberty" != xno],
- [saved_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS $libiberty_CPPFLAGS"
- AC_CHECK_HEADERS([demangle.h libiberty/demangle.h],
- [saved_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $libiberty_LDFLAGS"
- AC_CHECK_LIB([iberty],[cplus_demangle],
- [libiberty_LIBS="-liberty"
- use_libiberty=yes
- ],
- [if test "x$with_libiberty" != xcheck; then
- AC_MSG_FAILURE([failed to find cplus_demangle in libiberty])
- fi
- ]
- )
- LDFLAGS="$saved_LDFLAGS"
- ],
- [if test "x$with_libiberty" != xcheck; then
- AC_MSG_FAILURE([failed to find demangle.h])
- fi
- ]
- )
- CPPFLAGS="$saved_CPPFLAGS"
- ]
-)
-
-dnl enable libiberty
-AC_MSG_CHECKING([whether to enable demangling symbols in stack trace])
-if test "x$use_libiberty" = xyes; then
- AC_DEFINE([USE_DEMANGLE], 1, [Do demangling symbols in stack trace])
- AC_SUBST(libiberty_LIBS)
- AC_SUBST(libiberty_LDFLAGS)
- AC_SUBST(libiberty_CPPFLAGS)
-fi
-AM_CONDITIONAL([USE_DEMANGLE], [test "x$use_libiberty" = xyes])
-AC_MSG_RESULT([$use_libiberty])
+st_STACKTRACE
if test "$arch" = mips && test "$no_create" != yes; then
mkdir -p linux/mips
fi
AC_ARG_ENABLE([mpers],
- [AS_HELP_STRING([--enable-mpers=yes|no|check],
+ [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) enable_mpers="$enableval" ;;
+ yes|no|check|m32|mx32) enable_mpers="$enableval" ;;
*) AC_MSG_ERROR([bad value $enableval for enable-mpers option.
- Valid options are: yes, no, check.]) ;;
+ Valid options are: yes, no, check, m32, mx32.])
+ ;;
esac],
[enable_mpers=yes])
-st_MPERS([m32], [aarch64|powerpc64|riscv|sparc64|tile|x32|x86_64])
+st_MPERS([m32], [aarch64|powerpc64|riscv|s390x|sparc64|tile|x32|x86_64])
st_MPERS([mx32], [x86_64])
AX_VALGRIND_DFLT([sgcheck], [off])