commit:     f63258372627d6c111d7dcf519b303bc1b4e2efc
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 16 22:04:27 2025 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Fri Jan 17 17:53:16 2025 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=f6325837

Move config macros to sandboxconfig.h

This allows a cleaner separation between libsbutil and gnulib.

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .gitignore   | 4 ++--
 config.h     | 9 +++++++++
 configure.ac | 5 +----
 headers.h    | 4 +---
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index 7f6dae9..79e2d35 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,8 +29,6 @@ core
 /compile
 /config.cache
 /config.guess
-/config.h
-/config.h.in
 /config.log
 /config.status
 /config.sub
@@ -41,6 +39,8 @@ core
 /libtool
 /ltmain.sh
 /missing
+/sandboxconfig.h
+/sandboxconfig.h.in
 /stamp-h1
 
 /m4/libtool.m4

diff --git a/config.h b/config.h
new file mode 100644
index 0000000..1831ecf
--- /dev/null
+++ b/config.h
@@ -0,0 +1,9 @@
+#pragma once
+/*
+ * config.h only exists to make the gnulib code work.
+ * The real config lives in sandboxconfig.h.
+ */
+#ifdef HAVE_CONFIG_H
+#include <sandboxconfig.h>
+#endif
+#include "libsbutil/gnulib/glue.h"

diff --git a/configure.ac b/configure.ac
index 0ada7d8..4ccb23f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@ AC_PREREQ([2.69])
 AC_INIT([sandbox], [2.42], [[email protected]])
 AM_INIT_AUTOMAKE([1.15 dist-xz foreign no-dist-gzip silent-rules 
subdir-objects -Wall])
 AM_SILENT_RULES([yes]) # AM_INIT_AUTOMAKE([silent-rules]) is broken atm
-AC_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADER([sandboxconfig.h])
 AC_CONFIG_MACRO_DIR([m4])
 
 dnl we want to strip out quote chars and normalize whitespace
@@ -454,9 +454,6 @@ if test "x${LDFLAG_VER}" = "x" ; then
 fi
 AC_SUBST([LDFLAG_VER])
 
-dnl Add some glue for gnulib modules that include config.h directly.
-AH_BOTTOM([#include "headers.h"])
-
 AC_CONFIG_TESTDIR([tests])
 
 AC_CONFIG_FILES([src/sandbox.sh], [chmod +x src/sandbox.sh])

diff --git a/headers.h b/headers.h
index 396002f..7a17415 100644
--- a/headers.h
+++ b/headers.h
@@ -8,7 +8,7 @@
 #define __SB_HEADERS_H__
 
 #ifdef HAVE_CONFIG_H
-# include "config.h"
+# include <sandboxconfig.h>
 #endif
 
 #ifdef HAVE_DIRENT_H
@@ -167,6 +167,4 @@
 # include "localdecls.h"
 #endif
 
-#include "libsbutil/gnulib/glue.h"
-
 #endif

Reply via email to