Skip to content

Commit 350de12

Browse files
author
Sascha Schumann
committed
Expand the variables in PHP_EXPAND_BUILD_VARS.
Make HAVE_ICONV/HAVE_LIBICONV available through the more fine-grained approach using a single include file per directive. This will significantly reduce the price of full dependencies for developers, because basically each file today includes php.h which includes php_config.h. If PHP_ATOM_INC is defined, these include files can be used. For all PHP_DEFINEs, empty files are created upon configure start.
1 parent 6f77640 commit 350de12

File tree

4 files changed

+43
-11
lines changed

4 files changed

+43
-11
lines changed

Makefile.global

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mkinstalldirs = $(top_srcdir)/build/shtool mkdir -p
33
INSTALL = $(top_srcdir)/build/shtool install -c
44
INSTALL_DATA = $(INSTALL) -m 644
55

6-
DEFS = -I$(top_builddir)/main -I$(top_srcdir)
6+
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
77
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS)
88

99

acinclude.m4

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ AC_DEFUN(PHP_ADD_MAKEFILE_FRAGMENT,[
1717
])
1818

1919

20-
dnl PHP_DEFINE(what[, value])
20+
dnl PHP_DEFINE(WHAT[, value])
2121
dnl
22-
dnl Creates builddir/include/what.h and in there #define what value
22+
dnl Creates builddir/include/what.h and in there #define WHAT value
2323
dnl
2424
AC_DEFUN(PHP_DEFINE,[
25-
echo "#define $1 $2" > include/$1.h
25+
[echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h]
2626
])
2727

2828
dnl PHP_INIT_BUILD_SYSTEM
@@ -31,6 +31,9 @@ AC_DEFUN(PHP_INIT_BUILD_SYSTEM,[
3131
mkdir include >/dev/null 2>&1
3232
> Makefile.objects
3333
> Makefile.fragments
34+
dnl We need to play tricks here to avoid matching the egrep line itself
35+
pattern=define
36+
egrep $pattern'.*include/php' $srcdir/configure|sed 's/.*>//'|xargs touch
3437
])
3538

3639
dnl PHP_GEN_GLOBAL_MAKEFILE
@@ -68,9 +71,23 @@ AC_DEFUN(PHP_ADD_SOURCES,[
6871
])
6972

7073
dnl PHP_ASSIGN_BUILD_VARS(type)
71-
dnl Internal macro, should/can be exploded manually
74+
dnl Internal macro
7275
AC_DEFUN(PHP_ASSIGN_BUILD_VARS,[
73-
for acx in pre meta post; do for acy in c cxx; do eval b_${acy}_$acx=[\$]$1_${acy}_$acx; done; done
76+
ifelse($1,shared,[
77+
b_c_pre=$shared_c_pre
78+
b_cxx_pre=$shared_cxx_pre
79+
b_c_meta=$shared_c_meta
80+
b_cxx_meta=$shared_cxx_meta
81+
b_c_post=$shared_c_post
82+
b_cxx_post=$shared_cxx_post
83+
],[
84+
b_c_pre=$php_c_pre
85+
b_cxx_pre=$php_cxx_pre
86+
b_c_meta=$php_c_meta
87+
b_cxx_meta=$php_cxx_meta
88+
b_c_post=$php_c_post
89+
b_cxx_post=$php_cxx_post
90+
])dnl
7491
b_lo=[$]$1_lo
7592
])
7693

@@ -1357,10 +1374,14 @@ AC_DEFUN(PHP_SETUP_ICONV, [
13571374
found_iconv=no
13581375
unset ICONV_DIR
13591376
1360-
AC_CHECK_FUNCS(iconv libiconv, [
1361-
AC_DEFINE(HAVE_ICONV, 1, [ ])
1377+
AC_CHECK_FUNC(iconv, [
1378+
PHP_DEFINE(HAVE_ICONV)
13621379
found_iconv=yes
1363-
], [
1380+
],[
1381+
AC_CHECK_FUNC(libiconv,[
1382+
PHP_DEFINE(HAVE_LIBICONV)
1383+
found_iconv=yes
1384+
],[
13641385
13651386
for i in $PHP_ICONV /usr/local /usr; do
13661387
if test -r $i/include/giconv.h; then
@@ -1383,17 +1404,18 @@ AC_DEFUN(PHP_SETUP_ICONV, [
13831404
then
13841405
PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [
13851406
found_iconv=yes
1386-
AC_DEFINE(HAVE_LIBICONV, 1, [ ])
1407+
PHP_DEFINE(HAVE_LIBICONV)
13871408
], [
13881409
PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [
13891410
found_iconv=yes
1390-
AC_DEFINE(HAVE_ICONV, 1, [ ])
1411+
PHP_DEFINE(HAVE_ICONV)
13911412
])
13921413
], [
13931414
-L$ICONV_DIR/lib
13941415
])
13951416
fi
13961417
])
1418+
])
13971419
13981420
if test "$found_iconv" = "yes"; then
13991421
if test -n "$ICONV_DIR"; then

ext/iconv/iconv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
#include "php.h"
2727

28+
#ifdef PHP_ATOM_INC
29+
#include "php_have_iconv.h"
30+
#include "php_have_libiconv.h"
31+
#endif
32+
2833
#if HAVE_ICONV
2934

3035
#include <iconv.h>

ext/iconv/php_iconv.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
#define PHP_ICONV_API
2727
#endif
2828

29+
#ifdef PHP_ATOM_INC
30+
#include "php_have_iconv.h"
31+
#endif
32+
33+
2934
#if HAVE_ICONV
3035
extern zend_module_entry iconv_module_entry;
3136
#define iconv_module_ptr &iconv_module_entry

0 commit comments

Comments
 (0)