Preferably include from build dir (#13516)

* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
This commit is contained in:
Arnaud Le Blanc 2024-06-26 00:26:43 +02:00 committed by GitHub
parent 604e0a7bbe
commit 11accb5cdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
193 changed files with 202 additions and 202 deletions

View File

@ -15,9 +15,9 @@
#if !defined(__CYGWIN__) && defined(_WIN32)
# define TSRM_WIN32
# include "Zend/zend_config.w32.h"
# include <Zend/zend_config.w32.h>
#else
# include "main/php_config.h"
# include <main/php_config.h>
#endif
#include <stdint.h>

View File

@ -2,8 +2,7 @@ mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
INSTALL = $(top_srcdir)/build/shtool install -c
INSTALL_DATA = $(INSTALL) -m 644
DEFS = -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
COMMON_FLAGS = $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
all: $(all_targets)
@echo

View File

@ -1353,13 +1353,14 @@ LIBZEND_BASIC_CHECKS
LIBZEND_DLSYM_CHECK
LIBZEND_OTHER_CHECKS
INCLUDES="$INCLUDES -I\$(top_builddir)/TSRM"
INCLUDES="$INCLUDES -I\$(top_builddir)/Zend"
if test "$abs_srcdir" != "$abs_builddir"; then
INCLUDES="$INCLUDES -I\$(top_srcdir)/main -I\$(top_srcdir)/Zend"
INCLUDES="$INCLUDES -I\$(top_srcdir)/TSRM -I\$(top_builddir)/"
fi
PHP_ADD_INCLUDE([$abs_srcdir], [1])
PHP_ADD_INCLUDE([$abs_srcdir/main], [1])
PHP_ADD_INCLUDE([$abs_builddir], [1])
PHP_ADD_INCLUDE([$abs_builddir/main], [1])
PHP_ADD_INCLUDE([$abs_builddir/TSRM])
PHP_ADD_INCLUDE([$abs_builddir/Zend])
PHP_ADD_INCLUDE([$abs_srcdir/Zend])
PHP_ADD_INCLUDE([$abs_srcdir/TSRM])
ZEND_EXTRA_LIBS="$LIBS"
unset LIBS

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -18,7 +18,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <intsafe.h>

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -20,7 +20,7 @@
* (can wait till 5.1) */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -22,7 +22,7 @@
* */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -18,7 +18,7 @@
* using IDispatchEx */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -17,7 +17,7 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -17,7 +17,7 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -17,7 +17,7 @@
#define ZEND_INCLUDE_FULL_WINDOWS_HEADERS
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -18,7 +18,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -17,7 +17,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -17,7 +17,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -18,7 +18,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_filter.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -22,7 +22,7 @@
/* Note that there is no code from the gd package in this file */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -1,7 +1,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#else
#include "php_config.h"
#include <php_config.h>
#endif
#include "gd_compat.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -15,7 +15,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -2,7 +2,7 @@
#define incl_PHP_GMP_INT_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -16,7 +16,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <math.h>

View File

@ -17,7 +17,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -16,7 +16,7 @@
#define PHP_INTL_CONVERTER_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php.h"

View File

@ -12,7 +12,7 @@
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <unicode/udat.h>

View File

@ -12,7 +12,7 @@
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "../php_intl.h"

View File

@ -12,7 +12,7 @@
+----------------------------------------------------------------------+
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "dateformat_data.h"

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "../php_intl.h"

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <unicode/ustring.h>

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "formatter_data.h"

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <unicode/ustring.h>

View File

@ -13,7 +13,7 @@
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include "php_intl.h"

View File

@ -14,7 +14,7 @@
/* {{{ includes */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <php.h>

View File

@ -14,7 +14,7 @@
/* {{{ includes */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <php.h>

View File

@ -17,7 +17,7 @@
/* {{{ includes */
#ifdef HAVE_CONFIG_H
#include "config.h"
#include <config.h>
#endif
#include <php.h>

Some files were not shown because too many files have changed in this diff Show More