sniper          Sun Feb 22 22:24:59 2004 EDT

  Modified files:              
    /php-src    acinclude.m4 
    /php-src/ext/imap   config.m4 
  Log:
  - Added PHP_TEST_BUILD macro which can be used to test whether build 
    works / would work with current LIBS (+ additional extra-libs)
  
  
  
http://cvs.php.net/diff.php/php-src/acinclude.m4?r1=1.269&r2=1.270&ty=u
Index: php-src/acinclude.m4
diff -u php-src/acinclude.m4:1.269 php-src/acinclude.m4:1.270
--- php-src/acinclude.m4:1.269  Mon Jan 19 20:11:04 2004
+++ php-src/acinclude.m4        Sun Feb 22 22:24:58 2004
@@ -1,4 +1,4 @@
-dnl $Id: acinclude.m4,v 1.269 2004/01/20 01:11:04 sniper Exp $
+dnl $Id: acinclude.m4,v 1.270 2004/02/23 03:24:58 sniper Exp $
 dnl
 dnl This file contains local autoconf functions.
 
@@ -1788,7 +1788,20 @@
       LIBXML_INCS=`$XML2_CONFIG --cflags`
       PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
       PHP_EVAL_INCLINE($LIBXML_INCS)
-      AC_DEFINE(HAVE_LIBXML, 1, [ ])
+
+      dnl Check that build works with given libs
+      AC_CACHE_CHECK(whether libxml build works, php_cv_libxml_build_works, [
+        PHP_TEST_BUILD(xmlInitParser,
+        [
+          php_cv_libxml_build_works=yes
+          AC_DEFINE(HAVE_LIBXML, 1, [ ])
+        ], [
+          AC_MSG_RESULT(no)
+          AC_MSG_ERROR([build test failed.  Please check the config.log for details.])
+        ], [
+          [$]$1
+        ])
+      ])
       $2
     else
       AC_MSG_ERROR([libxml2 version 2.5.10 or greater required.])
@@ -1880,3 +1893,28 @@
 
   APACHE_VERSION=`expr [$]4 \* 1000000 + [$]5 \* 1000 + [$]6`
 ])
+
+dnl
+dnl PHP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs [, 
extra-source]])
+dnl This macro checks whether build works and given function exists.
+dnl
+AC_DEFUN(PHP_TEST_BUILD, [
+  old_LIBS=$LIBS
+  LIBS="$4 $LIBS"
+  AC_TRY_RUN([
+    $5
+    char $1();
+    int main() {
+      $1();
+      return 0;
+    }
+  ], [
+    LIBS=$old_LIBS
+    $2
+  ],[
+    LIBS=$old_LIBS
+    $3
+  ],[
+    LIBS=$old_LIBS
+  ])
+])
http://cvs.php.net/diff.php/php-src/ext/imap/config.m4?r1=1.62&r2=1.63&ty=u
Index: php-src/ext/imap/config.m4
diff -u php-src/ext/imap/config.m4:1.62 php-src/ext/imap/config.m4:1.63
--- php-src/ext/imap/config.m4:1.62     Fri Jan 16 19:00:11 2004
+++ php-src/ext/imap/config.m4  Sun Feb 22 22:24:58 2004
@@ -1,5 +1,5 @@
 dnl
-dnl $Id: config.m4,v 1.62 2004/01/17 00:00:11 sniper Exp $
+dnl $Id: config.m4,v 1.63 2004/02/23 03:24:58 sniper Exp $
 dnl
 
 AC_DEFUN(IMAP_INC_CHK,[if test -r "$i$1/c-client.h"; then
@@ -20,11 +20,10 @@
   done
 ])
 
-dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok [, extra-libs])
+dnl PHP_IMAP_TEST_BUILD(function, action-if-ok, action-if-not-ok, extra-libs)
 AC_DEFUN(PHP_IMAP_TEST_BUILD, [
-  old_LIBS=$LIBS
-  LIBS="$4 $LIBS"
-  AC_TRY_RUN([
+  PHP_TEST_BUILD([$1], [$2], [$3], [$4],
+  [
     void mm_log(void){}
     void mm_dlog(void){}
     void mm_flags(void){}
@@ -40,17 +39,6 @@
     void mm_exists(void){}
     void mm_searched(void){}
     void mm_expunged(void){}
-    char $1();
-    int main() {
-      $1();
-      return 0;
-    }
-  ], [
-    LIBS=$old_LIBS
-    $2
-  ],[
-    LIBS=$old_LIBS
-    $3
   ])
 ])
 
@@ -206,7 +194,7 @@
       AC_DEFINE(HAVE_IMAP_AUTH_GSS, 1, [ ])
     ], [], $TST_LIBS)
 
-    AC_MSG_CHECKING(whether IMAP works)
+    AC_MSG_CHECKING(whether build with IMAP works)
     PHP_IMAP_TEST_BUILD(mail_newbody, [
       AC_MSG_RESULT(yes)
     ], [

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to