]> granicus.if.org Git - php/commitdiff
Expand the variables in PHP_EXPAND_BUILD_VARS.
authorSascha Schumann <sas@php.net>
Wed, 20 Mar 2002 13:24:59 +0000 (13:24 +0000)
committerSascha Schumann <sas@php.net>
Wed, 20 Mar 2002 13:24:59 +0000 (13:24 +0000)
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.

Makefile.global
acinclude.m4
ext/iconv/iconv.c
ext/iconv/php_iconv.h

index 7fb148979186997b808de2fe2f06ca9b005881de..2799f41a669968fce34dc47e5d8a24da8f5b3c50 100644 (file)
@@ -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)
 
 
index 949f1f9d8925b7338eb469574381a7fcbbfcb4da..cfc06cb989186bf0ed791389fa2c2a94e7e848aa 100644 (file)
@@ -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
index 9310870dfbc7e8749e2ed01052b324ae6226fd39..472d6ce85a110a22e8445f22f609ba30dd7ee1b0 100644 (file)
 
 #include "php.h"
 
+#ifdef PHP_ATOM_INC
+#include "php_have_iconv.h"
+#include "php_have_libiconv.h"
+#endif
+
 #if HAVE_ICONV
 
 #include <iconv.h>
index 4e38380f80824e07acf4d84f6275e4bf02a56e32..247f4cc615decba12b738ab3465b9964c73fdad8 100644 (file)
 #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