]> granicus.if.org Git - php/commitdiff
- Cleanup, simplifying, etc.
authorfoobar <sniper@php.net>
Mon, 30 Jun 2003 17:23:52 +0000 (17:23 +0000)
committerfoobar <sniper@php.net>
Mon, 30 Jun 2003 17:23:52 +0000 (17:23 +0000)
ext/dom/config.m4
ext/simplexml/config.m4
ext/xml/config.m4
ext/xsl/config.m4

index 4d72141795eb1866a2e313d777d74f2f501e8448..a3a5b159c21438b29cf7d15c87212404101b315f 100644 (file)
@@ -2,89 +2,30 @@ dnl
 dnl $Id$
 dnl
 
-AC_DEFUN(PHP_DOM_CHECK_VERSION,[
-  old_CPPFLAGS=$CPPFLAGS
-  CPPFLAGS=-I$DOM_DIR/include$DOM_DIR_ADD
-  AC_MSG_CHECKING(for libxml version)
-  AC_EGREP_CPP(yes,[
-#include <libxml/xmlversion.h>
-#if LIBXML_VERSION >= 20414
-  yes
-#endif
-  ],[
-    AC_MSG_RESULT(>= 2.4.14)
-  ],[
-    AC_MSG_ERROR(libxml version 2.4.14 or greater required.)
-  ])
-  CPPFLAGS=$old_CPPFLAGS
-])
-
-PHP_ARG_WITH(dom, for new DOM support,
-[  --with-dom[=DIR]       Include new DOM support (requires libxml >= 2.4.14).
-                          DIR is the libxml install directory.], yes)
+PHP_ARG_ENABLE(dom, whether to enable DOM support,
+[  --disable-dom           Disable new DOM support.], yes)
 
-if test -z "$PHP_ZLIB_DIR"; then
-  PHP_ARG_WITH(zlib-dir, for the location of libz,
-  [  --with-zlib-dir[=DIR]     DOM: Set the path to libz install prefix.], no, no)
+if test -z "$PHP_LIBXML_DIR"; then
+  PHP_ARG_WITH(libxml-dir, libxml2 install dir,
+  [  --with-libxml-dir[=DIR]   DOM: libxml2 install prefix.], no, no)
 fi
 
 if test "$PHP_DOM" != "no"; then
-  DOM_DIR_ADD=""
-  if test -r $PHP_DOM/include/libxml2/libxml/tree.h; then
-    DOM_DIR=$PHP_DOM
-    DOM_DIR_ADD="/libxml2"
-  elif test -r $PHP_DOM/include/libxml/tree.h; then
-    DOM_DIR=$PHP_DOM
-  else
-    for i in /usr/local /usr; do
-      test -r $i/include/libxml/tree.h && DOM_DIR=$i
-      test -r $i/include/libxml2/libxml/tree.h && DOM_DIR=$i && DOM_DIR_ADD="/libxml2"
-    done
-  fi
-
-  if test -z "$DOM_DIR"; then
-    AC_MSG_RESULT(not found)
-    AC_MSG_ERROR(Please reinstall the libxml >= 2.4.14 distribution)
-  fi
-
-  PHP_DOM_CHECK_VERSION
-
-  if test -f $DOM_DIR/lib/libxml2.a -o -f $DOM_DIR/lib/libxml2.$SHLIB_SUFFIX_NAME ; then
-    DOM_LIBNAME=xml2
-  else
-    DOM_LIBNAME=xml
-  fi
-
-  XML2_CONFIG=$DOM_DIR/bin/xml2-config
-  if test -x $XML2_CONFIG; then
-    DOM_LIBS=`$XML2_CONFIG --libs`
-    PHP_EVAL_LIBLINE($DOM_LIBS, DOM_SHARED_LIBADD)
-  else 
-    PHP_ADD_LIBRARY_WITH_PATH($DOM_LIBNAME, $DOM_DIR/lib, DOM_SHARED_LIBADD)
-  fi
 
-  PHP_ADD_INCLUDE($DOM_DIR/include$DOM_DIR_ADD)
-
-  dnl Search for the zlib directory
-
-  if test "$PHP_ZLIB_DIR" = "no"; then
-       for i in /usr /usr/local; do
-         if test -r $i/lib/libz.so; then
-           PHP_ZLIB_DIR=$i
-         fi
-       done
-  fi
-
-  if test "$PHP_ZLIB_DIR" = "no"; then
-    AC_MSG_ERROR(DOM requires ZLIB. Use --with-zlib-dir=<DIR>)
-  else
-    PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR/lib, DOM_SHARED_LIBADD)
-  fi
-  
-  AC_DEFINE(HAVE_DOM,1,[ ])
-  PHP_NEW_EXTENSION(dom, php_dom.c attr.c document.c domerrorhandler.c domstringlist.c domexception.c namelist.c processinginstruction.c cdatasection.c documentfragment.c domimplementation.c element.c node.c string_extend.c characterdata.c documenttype.c domimplementationlist.c entity.c nodelist.c text.c comment.c domconfiguration.c domimplementationsource.c entityreference.c notation.c typeinfo.c domerror.c domlocator.c namednodemap.c userdatahandler.c , $ext_shared)
-  PHP_SUBST(DOM_SHARED_LIBADD)
+  PHP_SETUP_LIBXML(DOM_SHARED_LIBADD, [
+    AC_DEFINE(HAVE_DOM,1,[ ])
+    PHP_NEW_EXTENSION(dom, [php_dom.c attr.c document.c domerrorhandler.c \
+                            domstringlist.c domexception.c namelist.c \
+                            processinginstruction.c cdatasection.c \
+                            documentfragment.c domimplementation.c \
+                            element.c node.c string_extend.c characterdata.c \
+                            documenttype.c domimplementationlist.c entity.c \
+                            nodelist.c text.c comment.c domconfiguration.c \
+                            domimplementationsource.c entityreference.c notation.c \
+                            typeinfo.c domerror.c domlocator.c namednodemap.c userdatahandler.c], 
+                            $ext_shared)
+    PHP_SUBST(DOM_SHARED_LIBADD)
+  ], [
+    AC_MSG_ERROR([xml2-config not found. Please check your libxml2 installation.])
+  ])
 fi
-
-
index ea861491fdad7039e663e79419a04d13286618aa..c12ab763500c3acb9d6cb2cb76f51bc63e1c4ad8 100644 (file)
@@ -1,12 +1,15 @@
 dnl $Id$
 dnl config.m4 for extension simplexml
 
-PHP_ARG_WITH(simplexml, for simplexml support,
-[  --with-simplexml       Include simplexml support], yes)
+PHP_ARG_ENABLE(simplexml, whether to enable simplexml support,
+[  --disable-simplexml     Disable simplexml support], yes)
 
-if test "$PHP_SIMPLEXML" != "no"; then
+if test -z "$PHP_LIBXML_DIR"; then
+  PHP_ARG_WITH(libxml-dir, libxml2 install dir,
+  [  --with-libxml-dir=DIR     SimpleXML: libxml2 install prefix], no, no)
+fi
 
-  PHP_LIBXML_DIR=$PHP_SIMPLEXML
+if test "$PHP_SIMPLEXML" != "no"; then
 
   PHP_SETUP_LIBXML(SIMPLEXML_SHARED_LIBADD, [
     AC_DEFINE(HAVE_SIMPLEXML,1,[ ])
index 5902fadaf78a644a3f42b9449b238a17cb694f83..4836373c3313c1c6bac973b9d9a6fdfadcedcd2f 100644 (file)
@@ -5,8 +5,10 @@ dnl
 PHP_ARG_ENABLE(xml,whether to enable XML support,
 [  --disable-xml           Disable XML support.], yes)
 
-PHP_ARG_WITH(libxml-dir, libxml install dir,
-[  --with-libxml-dir=DIR     XML: libxml install prefix], no, no)
+if test -z "$PHP_LIBXML_DIR"; then
+  PHP_ARG_WITH(libxml-dir, libxml2 install dir,
+  [  --with-libxml-dir=DIR     XML: libxml2 install prefix], no, no)
+fi
 
 PHP_ARG_WITH(libexpat-dir, libexpat install dir,
 [  --with-libexpat-dir=DIR   XML: libexpat install prefix (deprecated)], no, no)
@@ -18,8 +20,8 @@ if test "$PHP_XML" != "no"; then
   PHP_SETUP_LIBXML(XML_SHARED_LIBADD, [
     xml_extra_sources="compat.c"
   ], [
-    if test "$PHP_EXPAT_DIR" = "no"; then
-      AC_MSG_ERROR(xml2-config not found. Use --with-libxml-dir=<DIR>)
+    if test "$PHP_LIBEXPAT_DIR" = "no"; then
+      AC_MSG_ERROR([xml2-config not found. Use --with-libxml-dir=<DIR>])
     fi
   ])
 
@@ -30,6 +32,7 @@ if test "$PHP_XML" != "no"; then
     for i in $PHP_XML $PHP_LIBEXPAT_DIR; do
       if test -f "$i/lib/libexpat.a" -o -f "$i/lib/libexpat.$SHLIB_SUFFIX_NAME"; then
         EXPAT_DIR=$i
+        break
       fi
     done
 
index 11917ab9ad9ecc33f6172f7701eba61b86b58ccd..81f375c49fd705e1b66e6897f0c8b850fca15254 100644 (file)
@@ -2,59 +2,40 @@ dnl
 dnl $Id$
 dnl
 
-AC_DEFUN(PHP_XSL_CHECK_VERSION,[
-  old_CPPFLAGS=$CPPFLAGS
-  CPPFLAGS=-I$XSL_DIR/include
-  AC_MSG_CHECKING(for libxslt version)
-  AC_EGREP_CPP(yes,[
-#include <libxslt/xsltconfig.h>
-#if LIBXSLT_VERSION >= 10018
-  yes
-#endif
-  ],[
-    AC_MSG_RESULT(>= 1.0.18)
-  ],[
-    AC_MSG_ERROR(libxslt version 1.0.18 or greater required.)
-  ])
-  CPPFLAGS=$old_CPPFLAGS
-])
-
 PHP_ARG_WITH(xsl, for XSL support,
 [  --with-xsl[=DIR]        Include new XSL support (requires libxslt >= 1.0.18).
                           DIR is the libxslt install directory.])
 
 if test "$PHP_XSL" != "no" -a "$PHP_DOM" = "no"; then
-    AC_MSG_ERROR([XSL extension requires DOM extension, add --with-dom.])
+  AC_MSG_ERROR([XSL extension requires DOM extension, add --enable-dom.])
 fi
 
 if test "$PHP_XSL" != "no"; then
 
-  if test -r $PHP_XSL/include/libxslt/transform.h; then
-    XSL_DIR=$PHP_XSL
-  else
-    for i in /usr/local /usr; do
-      test -r $i/include/libxslt/transform.h && XSL_DIR=$i
-    done
-  fi
+  for i in $PHP_XSL /usr/local /usr; do
+    if test -x "$i/bin/xslt-config"; then
+      XSLT_CONFIG=$i/bin/xslt-config
+      break
+    fi
+  done
 
-  if test -z "$XSL_DIR"; then
-    AC_MSG_RESULT(not found)
-    AC_MSG_ERROR(Please reinstall the libxslt >= 1.0.18 distribution)
-  fi
-
-  PHP_XSL_CHECK_VERSION
-
-  XSLT_CONFIG=$XSL_DIR/bin/xslt-config
-  if test -x $XSLT_CONFIG; then
-    DOM_LIBS=`$XSLT_CONFIG --libs`
-    DOM_INCLUDES=`$XSLT_CONFIG --cflags`
-    AC_MSG_RESULT(found xslt-config in $XSLT_CONFIG)
-    PHP_EVAL_LIBLINE($DOM_LIBS, XSL_SHARED_LIBADD)
-    CFLAGS="$CFLAGS $DOM_INCLUDES"
-  else 
-    PHP_ADD_LIBRARY_WITH_PATH($DOM_LIBNAME, $XSL_DIR/lib, XSL_SHARED_LIBADD)
-    PHP_ADD_INCLUDE($XSL_DIR/include)
+  if test -z "$XSLT_CONFIG"; then
+    AC_MSG_ERROR([xslt-config not found. Please reinstall the libxslt >= 1.0.18 distribution])
+  else
+    libxslt_full_version=`$XSLT_CONFIG --version`
+    ac_IFS=$IFS
+    IFS="."
+    set $libxslt_full_version
+    IFS=$ac_IFS
+    LIBXSLT_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
+    if test "$LIBXSLT_VERSION" -ge "1000018"; then
+      XSL_LIBS=`$XSLT_CONFIG --libs`
+      XSL_INCS=`$XSLT_CONFIG --cflags`
+      PHP_EVAL_LIBLINE($XSL_LIBS, XSL_SHARED_LIBADD)
+      PHP_EVAL_INCLINE($XSL_INCS)
+    else
+      AC_MSG_ERROR([libxslt version 1.0.18 or greater required.])
+    fi
   fi
   
   AC_DEFINE(HAVE_XSL,1,[ ])