Fix build on systems where libc relies on <linux/signal.h>

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
This commit is contained in:
Дмитрий Левин 2018-06-18 22:59:38 +00:00
parent a219217119
commit 15003d43d0
3 changed files with 17 additions and 3 deletions

View 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

View 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], [