[libglnx: 2/3] Include libglnx-config.h instead of config.h




commit c306703c6fb4b52b8ef1ebfdeb1b234fef8665a0
Author: Simon McVittie <smcv collabora com>
Date:   Tue Apr 6 18:08:55 2021 +0100

    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 <smcv collabora com>

 .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 55b946e..65a2e4d 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 957eae9..b09e43b 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 c7bb600..c016d37 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 c2fe29d..12976b3 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 0a63bcb..041e1cf 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 <string.h>
 
diff --git a/glnx-errors.c b/glnx-errors.c
index f350f30..52a6161 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 <glnx-backport-autocleanups.h>
 #include <glnx-errors.h>
diff --git a/glnx-fdio.c b/glnx-fdio.c
index 3fa73b5..a3eeb80 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 <string.h>
 #include <stdio.h>
diff --git a/glnx-local-alloc.c b/glnx-local-alloc.c
index 692f0de..58776b9 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 f1d52de..4f7e8c7 100644
--- a/glnx-lockfile.c
+++ b/glnx-lockfile.c
@@ -22,7 +22,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#include "config.h"
+#include "libglnx-config.h"
 
 #include <stdlib.h>
 #include <stdbool.h>
diff --git a/glnx-missing-syscall.h b/glnx-missing-syscall.h
index 4876ca3..0b617bd 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 78042fe..8aa4f21 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 <string.h>
 
diff --git a/glnx-xattrs.c b/glnx-xattrs.c
index 892d534..92677ef 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 <string.h>
 #include <stdio.h>
diff --git a/meson.build b/meson.build
index 74ee36a..6c2dbf2 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 869d144..879b876 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 <errno.h>
diff --git a/tests/test-libglnx-errors.c b/tests/test-libglnx-errors.c
index 4e91e02..9e8c1e3 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 <glib.h>
 #include <stdlib.h>
diff --git a/tests/test-libglnx-fdio.c b/tests/test-libglnx-fdio.c
index 84ebb14..fcf0ef8 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 <glib.h>
 #include <stdlib.h>
diff --git a/tests/test-libglnx-macros.c b/tests/test-libglnx-macros.c
index ffde8fa..68dc5db 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 <glib.h>
 #include <stdlib.h>
diff --git a/tests/test-libglnx-shutil.c b/tests/test-libglnx-shutil.c
index 6917b89..b4ee838 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 <glib.h>
 #include <stdlib.h>
diff --git a/tests/test-libglnx-xattrs.c b/tests/test-libglnx-xattrs.c
index 82def4a..0789a2e 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 <glib.h>
 #include <stdlib.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]