summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2019-04-10 01:04:02 +0200
committerPeter Kokot <peterkokot@gmail.com>2019-04-13 07:00:17 +0200
commit69b20f51e15d535da77f830709a4f1b5a682c265 (patch)
treec9819130681eca73f1c9d03dbb3a2dad277c3d15 /build
parent769db42341845544eebd4c939ecdaf87ce711d85 (diff)
downloadphp-git-69b20f51e15d535da77f830709a4f1b5a682c265.tar.gz
Disable PACKAGE_* preprocessor symbols
Autoconf defines PACKAGE_* symbols: - PACKAGE_NAME - PACKAGE_VERSION - PACKAGE_TARNAME - PACKAGE_STRING - PACKAGE_BUGREPORT - PACKAGE_URL and appends them to the generated config.h.in files. With AC_INIT change via afd52f9d9986d92dd0c63832a07ab1a16bf11d53 where package version, URL, bug report location and similar meta data are defined, these preprocessor macros are then non empty strings in the generated configuration header file. When using phpize, PHP shares the config files in extensions, warnings of redefined macros appear, such as: - `warning: 'PACKAGE_NAME' macro redefined` This patch now disables these non utilized symbols in the generated config header files. Better practice would be to include only API specific headers where needed but this would require even more refactorings. Some extensions such as pcre, pgsql, and pdo_pgsql solve this issue by undefining some of these symbols before including the library configuration headers in the code also. Because these symbols can be defined by any library which uses Autotools. Additionally, the unused PACKAGE_* symbols were cleaned for the bundled libmbfl library and with this patch not needed undef code removed.
Diffstat (limited to 'build')
-rw-r--r--build/build2.mk6
1 files changed, 4 insertions, 2 deletions
diff --git a/build/build2.mk b/build/build2.mk
index 79824cab8f..690166e887 100644
--- a/build/build2.mk
+++ b/build/build2.mk
@@ -28,11 +28,13 @@ SUPPRESS_WARNINGS ?= 2>&1 | (egrep -v '(AC_PROG_CXXCPP was called before AC_PROG
all: $(targets)
$(config_h_in): configure
-# explicitly remove target since autoheader does not seem to work
-# correctly otherwise (timestamps are not updated)
+# Explicitly remove target since autoheader does not seem to work correctly
+# otherwise (timestamps are not updated). Also disable PACKAGE_* symbols in the
+# generated php_config.h.in template.
@echo rebuilding $@
@rm -f $@
$(PHP_AUTOHEADER) $(SUPPRESS_WARNINGS)
+ sed -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $@ > $@.tmp && mv $@.tmp $@
aclocal.m4: configure.ac acinclude.m4
@echo rebuilding $@