Skip to content

Commit cfff450

Browse files
committed
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 afd52f9 where package version, URL, bug report location are defined, these preprocessor macros are then non empty strings. 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.
1 parent cb145e1 commit cfff450

File tree

3 files changed

+15
-24
lines changed

3 files changed

+15
-24
lines changed

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1726,4 +1726,12 @@ Check '[$]0 --help' for available options
17261726
17271727
fi
17281728
])
1729+
1730+
AC_CONFIG_COMMANDS_POST([
1731+
# Disable PACKAGE_* symbols in main/php_config.h.in
1732+
$SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $srcdir/main/php_config.h.in \
1733+
> $srcdir/main/php_config.h.in.tmp && \
1734+
mv $srcdir/main/php_config.h.in.tmp $srcdir/main/php_config.h.in
1735+
])
1736+
17291737
AC_OUTPUT

ext/mbstring/libmbfl/config.h.in

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,6 @@
4242
*/
4343
#undef LT_OBJDIR
4444

45-
/* Name of package */
46-
#undef PACKAGE
47-
48-
/* Define to the address where bug reports for this package should be sent. */
49-
#undef PACKAGE_BUGREPORT
50-
51-
/* Define to the full name of this package. */
52-
#undef PACKAGE_NAME
53-
54-
/* Define to the full name and version of this package. */
55-
#undef PACKAGE_STRING
56-
57-
/* Define to the one symbol short name of this package. */
58-
#undef PACKAGE_TARNAME
59-
60-
/* Define to the home page for this package. */
61-
#undef PACKAGE_URL
62-
63-
/* Define to the version of this package. */
64-
#undef PACKAGE_VERSION
65-
66-
/* Version number of package */
67-
#undef VERSION
68-
6945
/* Define to rpl_malloc if the replacement function should be used. */
7046
#undef malloc
7147

scripts/phpize.m4

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,11 @@ test -d modules || $php_shtool mkdir modules
205205

206206
AC_CONFIG_HEADERS([config.h])
207207

208+
AC_CONFIG_COMMANDS_POST([
209+
# Disable PACKAGE_* symbols in config.h.in
210+
$SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $srcdir/config.h.in \
211+
> $srcdir/config.h.in.tmp && \
212+
mv $srcdir/config.h.in.tmp $srcdir/config.h.in
213+
])
214+
208215
AC_OUTPUT

0 commit comments

Comments
 (0)