From c306703c6fb4b52b8ef1ebfdeb1b234fef8665a0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 6 Apr 2021 18:08:55 +0100 Subject: [PATCH] Include libglnx-config.h instead of config.h This avoids colliding with a config.h generated by a parent Meson project. In the Meson build system, we generate libglnx-config.h by doing our own checks, so we want to avoid it colliding. In the Autotools build system, we assume that the parent project will generate its own config.h that contains the results of LIBGLNX_CONFIGURE, and create a forwarding header libglnx-config.h in the $(top_builddir) (so that it is next to config.h). Note that after updating libglnx in an Autotools non-recursive-Make project (libostree, flatpak, flatpak-builder) it will be necessary to re-run autogen.sh. Signed-off-by: Simon McVittie --- .gitignore | 2 ++ Makefile-libglnx.am | 6 +++++- glnx-backports.c | 2 +- glnx-console.c | 2 +- glnx-dirfd.c | 2 +- glnx-errors.c | 2 +- glnx-fdio.c | 2 +- glnx-local-alloc.c | 2 +- glnx-lockfile.c | 2 +- glnx-missing-syscall.h | 2 +- glnx-shutil.c | 2 +- glnx-xattrs.c | 2 +- meson.build | 2 +- tests/libglnx-testlib.c | 2 +- tests/test-libglnx-errors.c | 2 +- tests/test-libglnx-fdio.c | 2 +- tests/test-libglnx-macros.c | 2 +- tests/test-libglnx-shutil.c | 2 +- tests/test-libglnx-xattrs.c | 2 +- 19 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 55b946e7..65a2e4da 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ # subdir-objects Makefile-libglnx.am.inc +libglnx-config.h + # Some standard bits .deps .libs diff --git a/Makefile-libglnx.am b/Makefile-libglnx.am index 957eae97..b09e43bf 100644 --- a/Makefile-libglnx.am +++ b/Makefile-libglnx.am @@ -21,6 +21,10 @@ EXTRA_DIST += \ $(libglnx_srcpath)/libglnx.m4 \ $(NULL) +BUILT_SOURCES += $(top_builddir)/libglnx-config.h +$(top_builddir)/libglnx-config.h: Makefile.am + echo '#include "config.h"' > $@ + libglnx_la_SOURCES = \ $(libglnx_srcpath)/glnx-macros.h \ $(libglnx_srcpath)/glnx-backport-autocleanups.h \ @@ -49,7 +53,7 @@ libglnx_la_SOURCES = \ $(libglnx_srcpath)/tests/libglnx-testlib.h \ $(NULL) -libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) +libglnx_la_CFLAGS = $(AM_CFLAGS) $(libglnx_cflags) -I$(builddir) libglnx_la_LDFLAGS = -avoid-version -Bsymbolic-functions -export-symbols-regex "^glnx_" -no-undefined -export-dynamic libglnx_la_LIBADD = $(libglnx_libs) diff --git a/glnx-backports.c b/glnx-backports.c index c7bb600f..c016d37e 100644 --- a/glnx-backports.c +++ b/glnx-backports.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "glnx-backports.h" diff --git a/glnx-console.c b/glnx-console.c index c2fe29db..12976b35 100644 --- a/glnx-console.c +++ b/glnx-console.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "glnx-console.h" diff --git a/glnx-dirfd.c b/glnx-dirfd.c index 0a63bcbc..041e1cfe 100644 --- a/glnx-dirfd.c +++ b/glnx-dirfd.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include diff --git a/glnx-errors.c b/glnx-errors.c index f350f305..52a61619 100644 --- a/glnx-errors.c +++ b/glnx-errors.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include #include diff --git a/glnx-fdio.c b/glnx-fdio.c index 3fa73b5d..a3eeb80e 100644 --- a/glnx-fdio.c +++ b/glnx-fdio.c @@ -21,7 +21,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include #include diff --git a/glnx-local-alloc.c b/glnx-local-alloc.c index 692f0de2..58776b94 100644 --- a/glnx-local-alloc.c +++ b/glnx-local-alloc.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "glnx-local-alloc.h" diff --git a/glnx-lockfile.c b/glnx-lockfile.c index f1d52dee..4f7e8c78 100644 --- a/glnx-lockfile.c +++ b/glnx-lockfile.c @@ -22,7 +22,7 @@ along with systemd; If not, see . ***/ -#include "config.h" +#include "libglnx-config.h" #include #include diff --git a/glnx-missing-syscall.h b/glnx-missing-syscall.h index 4876ca39..0b617bda 100644 --- a/glnx-missing-syscall.h +++ b/glnx-missing-syscall.h @@ -30,7 +30,7 @@ Add abstraction model for BPF programs */ -#include "config.h" +#include "libglnx-config.h" #if !HAVE_DECL_RENAMEAT2 # ifndef __NR_renameat2 diff --git a/glnx-shutil.c b/glnx-shutil.c index 78042fe0..8aa4f21c 100644 --- a/glnx-shutil.c +++ b/glnx-shutil.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include diff --git a/glnx-xattrs.c b/glnx-xattrs.c index 892d5343..92677ef1 100644 --- a/glnx-xattrs.c +++ b/glnx-xattrs.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include #include diff --git a/meson.build b/meson.build index 74ee36a3..6c2dbf26 100644 --- a/meson.build +++ b/meson.build @@ -35,7 +35,7 @@ foreach check_function : check_functions conf.set10('HAVE_DECL_' + check_function.underscorify().to_upper(), have_it) endforeach config_h = configure_file( - output : 'config.h', + output : 'libglnx-config.h', configuration : conf, ) diff --git a/tests/libglnx-testlib.c b/tests/libglnx-testlib.c index 869d144d..879b8766 100644 --- a/tests/libglnx-testlib.c +++ b/tests/libglnx-testlib.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "libglnx-testlib.h" #include diff --git a/tests/test-libglnx-errors.c b/tests/test-libglnx-errors.c index 4e91e02c..9e8c1e3b 100644 --- a/tests/test-libglnx-errors.c +++ b/tests/test-libglnx-errors.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "libglnx.h" #include #include diff --git a/tests/test-libglnx-fdio.c b/tests/test-libglnx-fdio.c index 84ebb14d..fcf0ef81 100644 --- a/tests/test-libglnx-fdio.c +++ b/tests/test-libglnx-fdio.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "libglnx.h" #include #include diff --git a/tests/test-libglnx-macros.c b/tests/test-libglnx-macros.c index ffde8fae..68dc5db2 100644 --- a/tests/test-libglnx-macros.c +++ b/tests/test-libglnx-macros.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "libglnx.h" #include #include diff --git a/tests/test-libglnx-shutil.c b/tests/test-libglnx-shutil.c index 6917b890..b4ee838c 100644 --- a/tests/test-libglnx-shutil.c +++ b/tests/test-libglnx-shutil.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "libglnx.h" #include #include diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c index 82def4aa..0789a2ec 100644 --- a/tests/test-libglnx-xattrs.c +++ b/tests/test-libglnx-xattrs.c @@ -18,7 +18,7 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include "libglnx-config.h" #include "libglnx.h" #include #include