File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / mysql / config.m4
Revision 1.1.1.4 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 08:02:25 2013 UTC (10 years, 9 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, HEAD
v 5.4.20

    1: dnl
    2: dnl $Id: config.m4,v 1.1.1.4 2013/10/14 08:02:25 misho Exp $
    3: dnl
    4: 
    5: AC_DEFUN([MYSQL_LIB_CHK], [
    6:   str="$MYSQL_DIR/$1/lib$MYSQL_LIBNAME.*"
    7:   for j in `echo $str`; do
    8:     if test -r $j; then
    9:       MYSQL_LIB_DIR=$MYSQL_DIR/$1
   10:       break 2
   11:     fi
   12:   done
   13: ])
   14: 
   15: AC_DEFUN([PHP_MYSQL_SOCKET_SEARCH], [
   16:   for i in  \
   17:     /var/run/mysqld/mysqld.sock \
   18:     /var/tmp/mysql.sock \
   19:     /var/run/mysql/mysql.sock \
   20:     /var/lib/mysql/mysql.sock \
   21:     /var/mysql/mysql.sock \
   22:     /usr/local/mysql/var/mysql.sock \
   23:     /Private/tmp/mysql.sock \
   24:     /private/tmp/mysql.sock \
   25:     /tmp/mysql.sock \
   26:   ; do
   27:     if test -r $i; then
   28:       MYSQL_SOCK=$i
   29:       break 2
   30:     fi
   31:   done
   32: 
   33:   if test -n "$MYSQL_SOCK"; then
   34:     AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
   35:     AC_MSG_RESULT([$MYSQL_SOCK])
   36:   else
   37:     AC_MSG_RESULT([no])
   38:   fi
   39: ])
   40: 
   41: 
   42: PHP_ARG_WITH(mysql, for MySQL support,
   43: [  --with-mysql[=DIR]      Include MySQL support.  DIR is the MySQL base
   44:                           directory, if no DIR is passed or the value is
   45:                           mysqlnd the MySQL native driver will be used])
   46: 
   47: PHP_ARG_WITH(mysql-sock, for specified location of the MySQL UNIX socket,
   48: [  --with-mysql-sock[=SOCKPATH]   MySQL/MySQLi/PDO_MYSQL: Location of the MySQL unix socket pointer.
   49:                             If unspecified, the default locations are searched], no, no)
   50: 
   51: if test -z "$PHP_ZLIB_DIR"; then
   52:   PHP_ARG_WITH(zlib-dir, for the location of libz, 
   53:   [  --with-zlib-dir[=DIR]     MySQL: Set the path to libz install prefix], no, no)
   54: fi
   55: 
   56: if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then
   57:   dnl enables build of mysqnd library
   58:   PHP_MYSQLND_ENABLED=yes
   59: 
   60: elif test "$PHP_MYSQL" != "no"; then
   61:   MYSQL_DIR=
   62:   MYSQL_INC_DIR=
   63: 
   64:   if test -r $PHP_MYSQL/include/mysql/mysql.h; then
   65:     MYSQL_DIR=$PHP_MYSQL
   66:     MYSQL_INC_DIR=$PHP_MYSQL/include/mysql
   67:     break
   68:   elif test -r $PHP_MYSQL/include/mysql.h; then
   69:     MYSQL_DIR=$PHP_MYSQL
   70:     MYSQL_INC_DIR=$PHP_MYSQL/include
   71:     break
   72:   fi
   73: 
   74:   if test -z "$MYSQL_DIR"; then
   75:     AC_MSG_ERROR([Cannot find MySQL header files under $PHP_MYSQL.
   76: Note that the MySQL client library is not bundled anymore!])
   77:   fi
   78: 
   79:   if test "$enable_maintainer_zts" = "yes"; then
   80:     MYSQL_LIBNAME=mysqlclient_r
   81:   else
   82:     MYSQL_LIBNAME=mysqlclient
   83:   fi
   84:   case $host_alias in
   85:     *netware*[)]
   86:       MYSQL_LIBNAME=mysql
   87:       ;;
   88:   esac
   89: 
   90:   dnl for compat with PHP 4 build system
   91:   if test -z "$PHP_LIBDIR"; then
   92:     PHP_LIBDIR=lib
   93:   fi
   94: 
   95:   for i in $PHP_LIBDIR $PHP_LIBDIR/mysql; do
   96:     MYSQL_LIB_CHK($i)
   97:   done
   98: 
   99:   if test -z "$MYSQL_LIB_DIR"; then
  100:     MYSQL_LIB_CHK(lib/x86_64-linux-gnu)
  101:   fi
  102:   if test -z "$MYSQL_LIB_DIR"; then
  103:     MYSQL_LIB_CHK(lib/i386-linux-gnu)
  104:   fi
  105: 
  106:   if test -z "$MYSQL_LIB_DIR"; then
  107:     AC_MSG_ERROR([Cannot find lib$MYSQL_LIBNAME under $MYSQL_DIR.
  108: Note that the MySQL client library is not bundled anymore!])
  109:   fi
  110: 
  111:   PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_close, [ ],
  112:   [
  113:     if test "$PHP_ZLIB_DIR" != "no"; then
  114:       PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, MYSQL_SHARED_LIBADD)
  115:       PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_error, [], [
  116:         AC_MSG_ERROR([mysql configure failed. Please check config.log for more information.])
  117:       ], [
  118:         -L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$MYSQL_LIB_DIR 
  119:       ])  
  120:       MYSQL_LIBS="-L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz"
  121:     else
  122:       PHP_ADD_LIBRARY(z,, MYSQL_SHARED_LIBADD)
  123:       PHP_CHECK_LIBRARY($MYSQL_LIBNAME, mysql_errno, [], [
  124:         AC_MSG_ERROR([Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.])
  125:       ], [
  126:         -L$MYSQL_LIB_DIR
  127:       ])   
  128:       MYSQL_LIBS="-lz"
  129:     fi
  130:   ], [
  131:     -L$MYSQL_LIB_DIR 
  132:   ])
  133: 
  134:   PHP_ADD_LIBRARY_WITH_PATH($MYSQL_LIBNAME, $MYSQL_LIB_DIR, MYSQL_SHARED_LIBADD)
  135:   PHP_ADD_INCLUDE($MYSQL_INC_DIR)
  136: 
  137:   MYSQL_MODULE_TYPE=external
  138:   MYSQL_LIBS="-L$MYSQL_LIB_DIR -l$MYSQL_LIBNAME $MYSQL_LIBS"
  139:   MYSQL_INCLUDE=-I$MYSQL_INC_DIR
  140:  
  141:   PHP_SUBST_OLD(MYSQL_MODULE_TYPE)
  142:   PHP_SUBST_OLD(MYSQL_LIBS)
  143:   PHP_SUBST_OLD(MYSQL_INCLUDE)
  144: fi
  145: 
  146: dnl Enable extension
  147: if test "$PHP_MYSQL" != "no"; then
  148:   AC_MSG_CHECKING([for MySQL UNIX socket location])
  149:   if test "$PHP_MYSQL_SOCK" != "no" && test "$PHP_MYSQL_SOCK" != "yes"; then
  150:     MYSQL_SOCK=$PHP_MYSQL_SOCK
  151:     AC_DEFINE_UNQUOTED(PHP_MYSQL_UNIX_SOCK_ADDR, "$MYSQL_SOCK", [ ])
  152:     AC_MSG_RESULT([$MYSQL_SOCK])
  153:   elif test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL_SOCK" = "yes"; then
  154:     PHP_MYSQL_SOCKET_SEARCH
  155:   else
  156:     AC_MSG_RESULT([no])
  157:   fi
  158: 
  159:   AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
  160:   PHP_NEW_EXTENSION(mysql, php_mysql.c, $ext_shared)
  161:   PHP_SUBST(MYSQL_SHARED_LIBADD)
  162: 
  163:   if test "$PHP_MYSQL" = "yes" || test "$PHP_MYSQL" = "mysqlnd"; then
  164:     PHP_ADD_EXTENSION_DEP(mysql, mysqlnd)
  165:     AC_DEFINE([MYSQL_USE_MYSQLND], 1, [Whether mysqlnd is enabled])
  166:   fi
  167: fi

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>