diff options
author | Dmitry V. Levin <ldv@strace.io> | 2021-07-18 18:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@strace.io> | 2021-07-18 18:00:00 +0000 |
commit | ab3ff0e7092fb66d23ac53bc79f7d83396787658 (patch) | |
tree | 4cad9e67f0f0acfe0b19a5b17207f7f402103239 /configure.ac | |
parent | 34bd2a397b64e6caa9bd7a94cb27fa7cbaec715c (diff) | |
download | strace-ab3ff0e7092fb66d23ac53bc79f7d83396787658.tar.gz |
build: do not use old bundled linux kernel headers
Do not use bundled linux kernel headers when they are definitely older
than those provided by the operating system.
* bundled/linux/include/uapi/linux/version.h: New file, copied from
headers_install'ed Linux kernel v5.13.
* bundled/Makefile.am (EXTRA_DIST): Add it.
* configure.ac: Compare LINUX_VERSION_CODE provided by bundled and
system <linux/version.h> files, define USE_BUNDLED_HEADERS and CPPFLAGS
appropriately.
* src/Makefile.am (bundled_CPPFLAGS): New variable.
(AM_CPPFLAGS): Use it.
* tests/Makefile.am: Likewise.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 7e3194216..1f195b1cd 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,8 @@ AC_INIT([strace], [https://strace.io]) m4_define([copyright_year], st_esyscmd_s([./build-aux/copyright-year-gen .year])) m4_define([manpage_date], st_esyscmd_s([./build-aux/file-date-gen doc/strace.1.in])) +m4_define([linux_version_code], + st_esyscmd_s([sed '/^#define LINUX_VERSION_CODE /!d;s///;q' bundled/linux/include/uapi/linux/version.h])) AC_COPYRIGHT([Copyright (c) 1999-]copyright_year[ The strace developers.]) AC_CONFIG_SRCDIR([src/strace.c]) AC_CONFIG_AUX_DIR([build-aux]) @@ -246,8 +248,19 @@ AC_SUBST(cc_flags_m32) AC_SUBST(cc_flags_mx32) AC_SUBST(arch_native) -CPPFLAGS="$CPPFLAGS -I$srcdir/bundled/linux/arch/$karch/include/uapi" -CPPFLAGS="$CPPFLAGS -I$srcdir/bundled/linux/include/uapi" +AC_CACHE_CHECK( + [whether to use bundled linux kernel headers], + [st_cv_use_bundled_headers], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <linux/version.h> +#define USE_OS_HEADERS (LINUX_VERSION_CODE > ]linux_version_code[ ? 1 : -1)], + [[int i[USE_OS_HEADERS];]])], + [st_cv_use_bundled_headers=no], + [st_cv_use_bundled_headers=yes])]) +AM_CONDITIONAL([USE_BUNDLED_HEADERS], [test $st_cv_use_bundled_headers = yes]) +if test $st_cv_use_bundled_headers = yes; then + CPPFLAGS="$CPPFLAGS -I$srcdir/bundled/linux/arch/$karch/include/uapi" + CPPFLAGS="$CPPFLAGS -I$srcdir/bundled/linux/include/uapi" +fi MIPS_ABI= if test "$arch" = mips; then |