sniper          Wed Mar 19 18:52:45 2003 EDT

  Modified files:              
    /php4/ext/mysqli    config.m4 
  Log:
  Better config.m4..
  
Index: php4/ext/mysqli/config.m4
diff -u php4/ext/mysqli/config.m4:1.4 php4/ext/mysqli/config.m4:1.5
--- php4/ext/mysqli/config.m4:1.4       Mon Mar 10 20:22:20 2003
+++ php4/ext/mysqli/config.m4   Wed Mar 19 18:52:45 2003
@@ -1,58 +1,45 @@
-dnl $Id: config.m4,v 1.4 2003/03/11 01:22:20 georg Exp $
+dnl
+dnl $Id: config.m4,v 1.5 2003/03/19 23:52:45 sniper Exp $
 dnl config.m4 for extension mysqli
 
-dnl Comments in this file start with the string 'dnl'.
-dnl Remove where necessary. This file will not work
-dnl without editing.
-
-dnl If your extension references something external, use with:
-
-PHP_ARG_WITH(mysqli, for mysqli support,
-[  --with-mysqli[=DIR]          Include mysqli support])
+PHP_ARG_WITH(mysqli, for MySQLi support,
+[  --with-mysqli[=FILE]         Include MySQLi support. FILE is the optional 
+                               pathname to mysql-config.])
 
 if test "$PHP_MYSQLI" != "no"; then
 
-  SEARCH_PATH="/usr/local /usr"     # you might want to change this
-  if test -r $PHP_MYSQLI/; then # path given as parameter
-    SEARCH_PATH=$PHP_MYSQLI
-  else
-    AC_MSG_CHECKING([for mysqli files in default path])
+  if test "$PHP_MYSQL" = "yes"; then
+    AC_MSG_ERROR([--with-mysql (using bundled libs) can not be used together with 
--with-mysqli.])
   fi
 
-  for i in $SEARCH_PATH ; do
-    if test -r $i/include/mysql/mysql.h; then
-      MYSQLI_DIR=$i/lib/mysql
-      MYSQLI_INC_DIR=$i/include/mysql
-      AC_MSG_RESULT(found in $i)
-    elif test -r $i/include/mysql.h; then
-      MYSQLI_DIR=$i/lib
-      MYSQLI_INC_DIR=$i/include
-      AC_MSG_RESULT(found in $i)
-    fi
-  done
+  if test "$PHP_MYSQLI" = "yes"; then
+    MYSQL_CONFIG=`$php_shtool path mysql_config`
+  else
+    MYSQL_CONFIG=$PHP_MYSQLI
+  fi
   
-  if test -z "$MYSQLI_DIR"; then
-    AC_MSG_RESULT([not found])
-    AC_MSG_ERROR([Please reinstall the mysqli distribution])
+  if test -x "$MYSQL_CONFIG" && $MYSQL_CONFIG --libs > /dev/null 2>&1; then
+    MYSQLI_INCLINE=`$MYSQL_CONFIG --cflags | sed -e "s/'//g"`
+    MYSQLI_LIBLINE=`$MYSQL_CONFIG --libs   | sed -e "s/'//g"`
+  else
+    AC_MSG_RESULT([mysql-config not found])
+    AC_MSG_ERROR([Please reinstall the mysql distribution])
   fi
 
-  # --with-mysqli -> add include path
-  PHP_ADD_INCLUDE($MYSQLI_INC_DIR)
-
-  # --with-mysqli -> check for lib and symbol presence
-  LIBNAME=mysqlclient 
-  LIBSYMBOL=mysql_bind_param
-
-  PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
+  dnl
+  dnl Check the library
+  dnl
+  PHP_CHECK_LIBRARY(mysqlclient, mysql_bind_param,
   [
-    PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $MYSQLI_DIR, MYSQLI_SHARED_LIBADD)
+    PHP_EVAL_INCLINE($MYSQLI_INCLINE)
+    PHP_EVAL_LIBLINE($MYSQLI_LIBLINE, MYSQLI_SHARED_LIBADD)
     AC_DEFINE(HAVE_MYSQLILIB,1,[ ])
   ],[
-    AC_MSG_ERROR([wrong mysql library version or lib not found])
+    AC_MSG_ERROR([wrong mysql library version or lib not found. Check config.log for 
more information.])
   ],[
-    `$PHP_MYSQLI/bin/mysql_config --libs | sed -e "s/'//g"`
+    $MYSQLI_LIBLINE
   ])
-  PHP_SUBST(MYSQLI_SHARED_LIBADD)
 
+  PHP_SUBST(MYSQLI_SHARED_LIBADD)
   PHP_NEW_EXTENSION(mysqli, mysqli.c mysqli_api.c mysqli_nonapi.c mysqli_fe.c 
mysqli_profiler.c mysqli_profiler_com.c, $ext_shared)
 fi



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

Reply via email to