From ea0c5c53fd2910a995b935b5ec3417bf85ec8ae6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <rem@videolan.org>
Date: Thu, 1 May 2008 19:11:07 +0300
Subject: [PATCH] Look for config.h output in public header files

---
 src/Makefile.am   |  5 +++--
 src/check_headers | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
 create mode 100755 src/check_headers

diff --git a/src/Makefile.am b/src/Makefile.am
index cea22989d48e..c5e1e16eb270 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -444,8 +444,8 @@ check_PROGRAMS = \
 	test_headers \
 	$(NULL)
 
-dist_check_SCRIPTS = check_symbols
-TESTS = $(check_PROGRAMS) $(dist_check_SCRIPTS)
+dist_check_SCRIPTS = check_symbols check_headers
+TESTS = $(check_PROGRAMS) check_symbols
 
 CFLAGS_tests = `$(VLC_CONFIG) --cflags libvlc`
 
@@ -478,6 +478,7 @@ check-local:
 			exit 1; \
 		fi ; \
 	done
+	$(srcdir)/check_headers $(dist_pkginclude_HEADERS) $(pkginclude_HEADERS)
 
 FORCE:
 	@echo "Generated source cannot be phony. Go away." >&2
diff --git a/src/check_headers b/src/check_headers
new file mode 100755
index 000000000000..71c0fe0b3358
--- /dev/null
+++ b/src/check_headers
@@ -0,0 +1,14 @@
+#! /bin/sh
+# Copyright © 2008 Rémi Denis-Courmont
+
+cd "$(dirname "$0")" || exit $?
+
+# Look for configure #defines in public headers.
+# There are incorrect, as external users don't have our <config.h>.
+regexp="$(cat ../config.h.in | \
+	sed -n -e 's/^#undef \([A-Z0-9_]*\)$/\1/p' | \
+	xargs | \
+	sed -e 's/ /\\\|/g')"
+
+! grep -- "$regexp" "$@"
+
-- 
GitLab