From: Sascha Schumann Date: Wed, 20 Mar 2002 13:24:59 +0000 (+0000) Subject: Expand the variables in PHP_EXPAND_BUILD_VARS. X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1186 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=350de12bc24472ccf20ff9a8b39a6da0185c070d;p=php 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. --- diff --git a/Makefile.global b/Makefile.global index 7fb1489791..2799f41a66 100644 --- a/Makefile.global +++ b/Makefile.global @@ -3,7 +3,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) +DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir) COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) diff --git a/acinclude.m4 b/acinclude.m4 index 949f1f9d89..cfc06cb989 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -17,12 +17,12 @@ AC_DEFUN(PHP_ADD_MAKEFILE_FRAGMENT,[ ]) -dnl PHP_DEFINE(what[, value]) +dnl PHP_DEFINE(WHAT[, value]) dnl -dnl Creates builddir/include/what.h and in there #define what value +dnl Creates builddir/include/what.h and in there #define WHAT value dnl AC_DEFUN(PHP_DEFINE,[ - echo "#define $1 $2" > include/$1.h + [echo "#define ]$1[]ifelse([$2],,[ 1],[ $2])[" > include/php_]translit($1,A-Z,a-z)[.h] ]) dnl PHP_INIT_BUILD_SYSTEM @@ -31,6 +31,9 @@ AC_DEFUN(PHP_INIT_BUILD_SYSTEM,[ mkdir include >/dev/null 2>&1 > Makefile.objects > Makefile.fragments +dnl We need to play tricks here to avoid matching the egrep line itself +pattern=define +egrep $pattern'.*include/php' $srcdir/configure|sed 's/.*>//'|xargs touch ]) dnl PHP_GEN_GLOBAL_MAKEFILE @@ -68,9 +71,23 @@ AC_DEFUN(PHP_ADD_SOURCES,[ ]) dnl PHP_ASSIGN_BUILD_VARS(type) -dnl Internal macro, should/can be exploded manually +dnl Internal macro AC_DEFUN(PHP_ASSIGN_BUILD_VARS,[ - for acx in pre meta post; do for acy in c cxx; do eval b_${acy}_$acx=[\$]$1_${acy}_$acx; done; done +ifelse($1,shared,[ + b_c_pre=$shared_c_pre + b_cxx_pre=$shared_cxx_pre + b_c_meta=$shared_c_meta + b_cxx_meta=$shared_cxx_meta + b_c_post=$shared_c_post + b_cxx_post=$shared_cxx_post +],[ + b_c_pre=$php_c_pre + b_cxx_pre=$php_cxx_pre + b_c_meta=$php_c_meta + b_cxx_meta=$php_cxx_meta + b_c_post=$php_c_post + b_cxx_post=$php_cxx_post +])dnl b_lo=[$]$1_lo ]) @@ -1357,10 +1374,14 @@ AC_DEFUN(PHP_SETUP_ICONV, [ found_iconv=no unset ICONV_DIR - AC_CHECK_FUNCS(iconv libiconv, [ - AC_DEFINE(HAVE_ICONV, 1, [ ]) + AC_CHECK_FUNC(iconv, [ + PHP_DEFINE(HAVE_ICONV) found_iconv=yes - ], [ + ],[ + AC_CHECK_FUNC(libiconv,[ + PHP_DEFINE(HAVE_LIBICONV) + found_iconv=yes + ],[ for i in $PHP_ICONV /usr/local /usr; do if test -r $i/include/giconv.h; then @@ -1383,17 +1404,18 @@ AC_DEFUN(PHP_SETUP_ICONV, [ then PHP_CHECK_LIBRARY($iconv_lib_name, libiconv, [ found_iconv=yes - AC_DEFINE(HAVE_LIBICONV, 1, [ ]) + PHP_DEFINE(HAVE_LIBICONV) ], [ PHP_CHECK_LIBRARY($iconv_lib_name, iconv, [ found_iconv=yes - AC_DEFINE(HAVE_ICONV, 1, [ ]) + PHP_DEFINE(HAVE_ICONV) ]) ], [ -L$ICONV_DIR/lib ]) fi ]) + ]) if test "$found_iconv" = "yes"; then if test -n "$ICONV_DIR"; then diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 9310870dfb..472d6ce85a 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -25,6 +25,11 @@ #include "php.h" +#ifdef PHP_ATOM_INC +#include "php_have_iconv.h" +#include "php_have_libiconv.h" +#endif + #if HAVE_ICONV #include diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h index 4e38380f80..247f4cc615 100644 --- a/ext/iconv/php_iconv.h +++ b/ext/iconv/php_iconv.h @@ -26,6 +26,11 @@ #define PHP_ICONV_API #endif +#ifdef PHP_ATOM_INC +#include "php_have_iconv.h" +#endif + + #if HAVE_ICONV extern zend_module_entry iconv_module_entry; #define iconv_module_ptr &iconv_module_entry