]> granicus.if.org Git - strace/commitdiff
Fix build on systems where libc relies on <linux/signal.h>
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 18 Jun 2018 22:59:38 +0000 (22:59 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 18 Jun 2018 22:59:38 +0000 (22:59 +0000)
Commit v4.23~10 has broken the build with Android's libc because it
relies on the UAPI headers (such as <linux/signal.h>) to define various
types, rather than copying them into the libc headers (such as <signal.h>)
like most other Linux C libraries.

* linux/linux/signal.h: Rename to linux/signal.h.in.
* Makefile.am (strace_SOURCES): Remove linux/linux/signal.h.
(EXTRA_DIST): Add linux/signal.h.in.
(DISTCLEANFILES): Add linux/linux/signal.h.
* configure.ac (AC_CACHE_CHECK): Check whether <linux/signal.h>
can be used along with <signal.h>, install linux/linux/signal.h
workaround if they cannot be used together.

Reported-by: Elliott Hughes <enh@google.com>
Closes: https://github.com/strace/strace/issues/72
Makefile.am
configure.ac
linux/signal.h.in [moved from linux/linux/signal.h with 100% similarity]

index 32593443aa94a59e896269857381dbe7de64fe4e..5f3f50a765fcf6225879ae38907878ffd45c4f2f 100644 (file)
@@ -182,7 +182,6 @@ strace_SOURCES =    \
        ldt.c           \
        link.c          \
        linux/asm_stat.h \
-       linux/linux/signal.h \
        linux/x32/asm_stat.h \
        linux/x86_64/asm_stat.h \
        listen.c        \
@@ -804,6 +803,7 @@ EXTRA_DIST =                                \
        linux/sh64/syscallent.h         \
        linux/sh64/userent.h            \
        linux/shuffle_scno.c            \
+       linux/signal.h.in               \
        linux/signalent.h               \
        linux/smc_diag.h                \
        linux/sock_diag.h               \
@@ -1042,7 +1042,7 @@ CLEANFILES    = $(ioctl_redefs_h) $(ioctlent_h) $(mpers_preproc_files) \
                ioctl_iocdef.h ioctl_iocdef.i \
                bpf_attr_check.c native_printer_decls.h native_printer_defs.h \
                printers.h sen.h sys_func.h
-DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h
+DISTCLEANFILES = gnu/stubs-32.h gnu/stubs-x32.h linux/linux/signal.h
 
 include scno.am
 
index 9dec1b23244dd7be2e3caa9952b34e5f8ae8c6e7..a2170454fc34da213e183cdad038ab104532c0ae 100644 (file)
@@ -581,8 +581,22 @@ AC_CHECK_TYPES(m4_normalize([
 ]),,, [#include <linux/kvm.h>])
 
 saved_CPPFLAGS="$CPPFLAGS"
-CPPFLAGS="$CPPFLAGS -I$srcdir/linux"
+
+AC_CACHE_CHECK([whether <linux/signal.h> can be used along with <signal.h>],
+              [st_cv_linux_signal],
+              [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <signal.h>
+#include <linux/signal.h>]],[])],
+                                 [st_cv_linux_signal=yes],
+                                 [st_cv_linux_signal=no])])
+if test "x$st_cv_linux_signal" = xno; then
+       mkdir -p linux/linux
+       cp $srcdir/linux/signal.h.in linux/linux/signal.h
+       CPPFLAGS="$CPPFLAGS -Ilinux"
+fi
+
 AC_CHECK_TYPES([struct __aio_sigset],,, [#include <linux/aio_abi.h>])
+
 CPPFLAGS="$saved_CPPFLAGS"
 
 AC_CHECK_HEADERS([linux/btrfs.h], [
similarity index 100%
rename from linux/linux/signal.h
rename to linux/signal.h.in