$(config_h_in): configure
# 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.
+# otherwise (timestamps are not updated).
@echo rebuilding $@
@rm -f $@
@$(PHP_AUTOHEADER) $(PHP_AUTOCONF_FLAGS)
- @sed -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $@ > $@.tmp && mv $@.tmp $@
AC_DEFINE_UNQUOTED(AS_TR_CPP([PHP_HAVE_$1_INSTRUCTIONS]),
[$have_ext_instructions], [Whether the compiler supports $1 instructions])
])
+
+dnl
+dnl PHP_PATCH_CONFIG_HEADERS([FILE])
+dnl
+dnl PACKAGE_* symbols are automatically defined by Autoconf. When including
+dnl configuration header, warnings about redefined symbols are emitted for such
+dnl symbols if they are defined by multiple libraries. This disables all
+dnl PACKAGE_* symbols in the generated configuration header template FILE. For
+dnl example, main/php_config.h.in for PHP or config.h.in for PHP extensions.
+dnl
+AC_DEFUN([PHP_PATCH_CONFIG_HEADERS], [
+ AC_MSG_NOTICE([patching $1])
+
+ $SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < $srcdir/$1 \
+ > $srcdir/$1.tmp && mv $srcdir/$1.tmp $srcdir/$1
+])
PHP_CANONICAL_HOST_TARGET
AC_CONFIG_HEADERS([main/php_config.h])
+
AH_TOP([
#ifndef PHP_CONFIG_H
#define PHP_CONFIG_H
dnl Generate build files.
AC_CONFIG_FILES([$ALL_OUTPUT_FILES])
+
+AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([main/php_config.h.in])])
+
AC_CONFIG_COMMANDS([default],[
cat <<X
$PHP_AUTOCONF || exit 1
$PHP_AUTOHEADER || exit 1
-
- # Disable PACKAGE_* symbols in config.h.in
- $SED -e 's/^#undef PACKAGE_[^ ]*/\/\* & \*\//g' < config.h.in > config.h.in.tmp
- mv config.h.in.tmp config.h.in
}
# Main script
AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_COMMANDS_PRE([PHP_PATCH_CONFIG_HEADERS([config.h.in])])
+
AC_OUTPUT