]> granicus.if.org Git - strace/blobdiff - configure.ac
io.c: move sendfile parsers to a separate file
[strace] / configure.ac
index 5b0a38ff575f8e4118c6e591441b5de5d2b7a614..0819f8390cba4ae279c1dfa6bcef60cb76bf7118 100644 (file)
@@ -11,6 +11,7 @@ AM_MAINTAINER_MODE
 AC_CANONICAL_HOST
 
 AC_PROG_CC
+AX_PROG_CC_FOR_BUILD
 AC_USE_SYSTEM_EXTENSIONS
 
 AC_MSG_CHECKING([for supported architecture])
@@ -52,13 +53,12 @@ alpha*)
        AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
        ;;
 powerpc*)
-       arch=powerpc
        AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
        AC_TRY_COMPILE(
 [#ifndef __LP64__
 # error 32 bit
-#endif], [], ppc_bits=64, ppc_bits=32)
-       if test "$ppc_bits" = "64"; then
+#endif], [], arch=powerpc64, arch=powerpc)
+       if test "$arch" = "powerpc64"; then
                AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
        fi
        ;;
@@ -125,6 +125,11 @@ 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.])
@@ -144,11 +149,34 @@ AC_MSG_RESULT($arch)
 
 AC_SUBST(arch)
 
-AM_CONDITIONAL([I386], [test x$arch = xi386])
-AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
-AM_CONDITIONAL([X32], [test x$arch = xx32])
-
-AC_INCLUDEDIR
+if test "$arch" = mips; then
+       AC_CACHE_CHECK([for _MIPS_SIM], [st_cv__MIPS_SIM],
+                      [AC_COMPUTE_INT([st_cv__MIPS_SIM], [_MIPS_SIM],
+                                      [#include <sgidefs.h>],
+                                      [AC_MSG_ERROR([_MIPS_SIM cannot be determined])])])
+
+       AC_CACHE_CHECK([for MIPS ABI], [st_cv_mips_abi],
+               [AC_COMPILE_IFELSE(
+                       [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
+                                        [[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
+                       [st_cv_mips_abi=o32],
+               [AC_COMPILE_IFELSE(
+                       [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
+                                        [[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
+                       [st_cv_mips_abi=n32],
+               [AC_COMPILE_IFELSE(
+                       [AC_LANG_PROGRAM([[#include <sgidefs.h>]],
+                                        [[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
+                       [st_cv_mips_abi=n64],
+                       [st_cv_mips_abi=unknown])])])])
+
+       case "$st_cv_mips_abi" in
+               o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
+               n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
+               n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
+               *) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
+       esac
+fi
 
 AC_ARG_ENABLE([arm-oabi],
              [AS_HELP_STRING([--enable-arm-oabi],
@@ -184,22 +212,23 @@ AC_HEADER_STDBOOL
 AC_HEADER_DIRENT
 AC_HEADER_STAT
 AC_CHECK_MEMBERS(m4_normalize([
+       struct stat.st_atim.tv_nsec,
        struct stat.st_blksize,
        struct stat.st_blocks,
+       struct stat.st_ctim.tv_nsec,
        struct stat.st_flags,
        struct stat.st_fstype,
        struct stat.st_gen,
+       struct stat.st_mtim.tv_nsec,
        struct stat.st_rdev
 ]))
-AC_STAT64
-AC_STATFS64
 
 AC_TYPE_SIGNAL
 AC_TYPE_UID_T
 AC_TYPE_MODE_T
 AC_TYPE_GETGROUPS
 AC_HEADER_MAJOR
-AC_CHECK_TYPES([sig_atomic_t, siginfo_t],,, [#include <signal.h>])
+AC_CHECK_TYPES([sig_atomic_t],,, [#include <signal.h>])
 AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
 [#include <sys/types.h>
 #include <sys/socket.h>
@@ -207,11 +236,14 @@ AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
 AC_LITTLE_ENDIAN_LONG_LONG
 
 AC_CHECK_FUNCS(m4_normalize([
+       fanotify_mark
        fopen64
        fork
        fputs_unlocked
        if_indextoname
        inet_ntop
+       inet_pton
+       pipe2
        prctl
        preadv
        process_vm_readv
@@ -219,6 +251,7 @@ AC_CHECK_FUNCS(m4_normalize([
        sendmsg
        sendmmsg
        sigaction
+       signalfd
        stpcpy
        strerror
        strsignal
@@ -230,22 +263,26 @@ AC_CHECK_HEADERS(m4_normalize([
        elf.h
        inttypes.h
        ioctls.h
+       linux/bsg.h
        linux/falloc.h
+       linux/filter.h
+       linux/hiddev.h
+       linux/mmtimer.h
        linux/perf_event.h
-       linux/ptrace.h
+       linux/seccomp.h
+       linux/securebits.h
        linux/utsname.h
        mqueue.h
        netinet/sctp.h
-       poll.h
        scsi/sg.h
        stropts.h
        sys/conf.h
        sys/epoll.h
-       sys/filio.h
+       sys/eventfd.h
+       sys/fanotify.h
        sys/ioctl.h
-       sys/poll.h
-       sys/ptrace.h
        sys/reg.h
+       sys/signalfd.h
        sys/vfs.h
        sys/xattr.h
 ]))
@@ -260,7 +297,17 @@ AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
 AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
 AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
 
+AC_CHECK_MEMBERS(m4_normalize([
+       struct stat.st_atime_nsec,
+       struct stat.st_ctime_nsec,
+       struct stat.st_mtime_nsec
+]),,, [#include <sys/types.h>
+#include <asm/stat.h>])
+
+AC_CHECK_TYPES([struct stat64],,, [#include <sys/types.h>
+#include <asm/stat.h>])
 AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
+AC_CHECK_TYPES([struct statfs64],,, [#include <sys/vfs.h>])
 
 AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
               [#include <sys/ptrace.h>])
@@ -269,11 +316,9 @@ AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
 
 AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
                  struct sigevent.__pad,
-                 siginfo_t.si_syscall],,, [#include <signal.h>])
-
-AC_CHECK_MEMBERS([struct sysinfo.totalhigh,
-                 struct sysinfo.freehigh,
-                 struct sysinfo.mem_unit],,, [#include <sys/sysinfo.h>])
+                 siginfo_t.si_syscall,
+                 siginfo_t.si_timerid,
+                 siginfo_t.si_overrun],,, [#include <signal.h>])
 
 AC_CHECK_TYPES([struct flock64],,, [#include <fcntl.h>])
 
@@ -282,25 +327,28 @@ AC_CHECK_HEADERS([libaio.h], [
        AC_CHECK_DECLS([IO_CMD_PWRITE, IO_CMD_PWRITEV],,, [#include <libaio.h>])
 ])
 
+AC_CHECK_HEADERS([linux/input.h], [
+       AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
+])
+
+AC_CHECK_HEADERS([linux/bpf.h], [
+       AC_CACHE_CHECK([whether union bpf_attr.log_buf initialization works],
+                      [st_cv_have_union_bpf_attr_log_buf],
+               [AC_COMPILE_IFELSE(
+                       [AC_LANG_PROGRAM([[#include <linux/bpf.h>]],
+                                        [[union bpf_attr a = { .log_buf = 0 };]])],
+                       [st_cv_have_union_bpf_attr_log_buf=yes],
+                       [st_cv_have_union_bpf_attr_log_buf=no])])
+       if test $st_cv_have_union_bpf_attr_log_buf = yes; then
+               AC_DEFINE(HAVE_UNION_BPF_ATTR_LOG_BUF, [1],
+                         [Define to 1 if union bpf_attr.log_buf initialization works])
+       fi
+])
+
 AC_CHECK_DECLS([sys_errlist])
 AC_CHECK_DECLS(m4_normalize([
-       PTRACE_EVENT_CLONE,
-       PTRACE_EVENT_EXEC,
-       PTRACE_EVENT_EXIT,
-       PTRACE_EVENT_FORK,
-       PTRACE_EVENT_VFORK,
-       PTRACE_EVENT_VFORK_DONE,
-       PTRACE_GETEVENTMSG,
-       PTRACE_GETSIGINFO,
-       PTRACE_O_TRACECLONE,
-       PTRACE_O_TRACEEXEC,
-       PTRACE_O_TRACEEXIT,
-       PTRACE_O_TRACEFORK,
-       PTRACE_O_TRACESYSGOOD,
-       PTRACE_O_TRACEVFORK,
        PTRACE_PEEKUSER,
-       PTRACE_POKEUSER,
-       PTRACE_SETOPTIONS
+       PTRACE_POKEUSER
 ]),,, [#include <sys/ptrace.h>])
 
 AC_CHECK_DECLS(m4_normalize([
@@ -695,14 +743,24 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([long long])
 AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
+AC_CHECK_SIZEOF([struct i64_i32],,[struct i64_i32 {long long i64; int i32;};])
 
-AC_CACHE_CHECK([for SA_RESTORER], [st_cv_sa_restorer],
-              [st_cv_sa_restorer="$(echo SA_RESTORER |
+AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
+              [[st_cv_SIGRTMIN="$(echo SIGRTMIN |
+                       $CPP $CPPFLAGS -P -imacros asm/signal.h - |
+                       grep '^[0-9]')"
+                test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
+if test "x$st_cv_SIGRTMIN" != xno; then
+       AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
+                          [SIGRTMIN defined in <asm/signal.h>])
+fi
+AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
+              [st_cv_SA_RESTORER="$(echo SA_RESTORER |
                        $CPP $CPPFLAGS -P -imacros asm/signal.h - |
                        grep ^0x)"
-               test -n "$st_cv_sa_restorer" || st_cv_sa_restorer=no])
-if test "x$st_cv_sa_restorer" != xno; then
-       AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_sa_restorer],
+               test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
+if test "x$st_cv_SA_RESTORER" != xno; then
+       AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
                           [SA_RESTORER defined in <asm/signal.h>])
 fi
 
@@ -715,6 +773,12 @@ if test "x$st_cv_have___builtin_popcount" = xyes; then
                  [Define to 1 if the system provides __builtin_popcount function])
 fi
 
+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)
+
 AC_PATH_PROG([PERL], [perl])
 
 dnl stack trace with libunwind
@@ -806,5 +870,17 @@ fi
 AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
 AC_MSG_RESULT([$use_libunwind])
 
-AC_CONFIG_FILES([Makefile tests/Makefile])
+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])
+       fi
+fi
+
+st_MPERS([m32], [aarch64|powerpc64|sparc64|tile|x32|x86_64])
+st_MPERS([mx32], [x86_64])
+
+AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
 AC_OUTPUT