Annotation of embedaddon/php/ext/pdo_mysql/config.m4, revision 1.1.1.1
1.1 misho 1: dnl $Id: config.m4 311041 2011-05-15 05:49:34Z rasmus $
2: dnl config.m4 for extension pdo_mysql
3: dnl vim: se ts=2 sw=2 et:
4:
5: PHP_ARG_WITH(pdo-mysql, for MySQL support for PDO,
6: [ --with-pdo-mysql[=DIR] PDO: MySQL support. DIR is the MySQL base directory
7: If mysqlnd is passed as DIR, the MySQL native
8: native driver will be used [/usr/local]])
9:
10: if test -z "$PHP_ZLIB_DIR"; then
11: PHP_ARG_WITH(zlib-dir, for the location of libz,
12: [ --with-zlib-dir[=DIR] PDO_MySQL: Set the path to libz install prefix], no, no)
13: fi
14:
15: if test "$PHP_PDO_MYSQL" != "no"; then
16:
17: if test "$PHP_PDO" = "no" && test "$ext_shared" = "no"; then
18: AC_MSG_ERROR([PDO is not enabled! Add --enable-pdo to your configure line.])
19: fi
20:
21: AC_DEFUN([PDO_MYSQL_LIB_CHK], [
22: str="$PDO_MYSQL_DIR/$1/libmysqlclient*"
23: for j in `echo $str`; do
24: if test -r $j; then
25: PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$1
26: break 2
27: fi
28: done
29: ])
30:
31: if test -f $PHP_PDO_MYSQL && test -x $PHP_PDO_MYSQL ; then
32: PDO_MYSQL_CONFIG=$PHP_PDO_MYSQL
33: elif test "$PHP_PDO_MYSQL" != "yes"; then
34: if test -d "$PHP_PDO_MYSQL" ; then
35: if test -x "$PHP_PDO_MYSQL/bin/mysql_config" ; then
36: PDO_MYSQL_CONFIG="$PHP_PDO_MYSQL/bin/mysql_config"
37: else
38: PDO_MYSQL_DIR="$PHP_PDO_MYSQL"
39: fi
40: fi
41: else
42: for i in /usr/local /usr ; do
43: if test -x "$i/bin/mysql_config" ; then
44: PDO_MYSQL_CONFIG="$i/bin/mysql_config"
45: break;
46: fi
47: if test -r $i/include/mysql/mysql.h || test -r $i/include/mysql.h ; then
48: PDO_MYSQL_DIR="$i"
49: break;
50: fi
51: done
52: fi
53:
54: if test "$PHP_PDO_MYSQL" = "mysqlnd"; then
55: dnl enables build of mysqnd library
56: PHP_MYSQLND_ENABLED=yes
57: AC_DEFINE([PDO_USE_MYSQLND], 1, [Whether pdo_mysql uses mysqlnd])
58: else
59: AC_DEFINE(HAVE_MYSQL, 1, [Whether you have MySQL])
60:
61: AC_MSG_CHECKING([for mysql_config])
62: if test -n "$PDO_MYSQL_CONFIG"; then
63: AC_MSG_RESULT($PDO_MYSQL_CONFIG)
64: if test "x$SED" = "x"; then
65: AC_PATH_PROG(SED, sed)
66: fi
67: if test "$enable_maintainer_zts" = "yes"; then
68: PDO_MYSQL_LIBNAME=mysqlclient_r
69: PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs_r | $SED -e "s/'//g"`
70: else
71: PDO_MYSQL_LIBNAME=mysqlclient
72: PDO_MYSQL_LIBS=`$PDO_MYSQL_CONFIG --libs | $SED -e "s/'//g"`
73: fi
74: PDO_MYSQL_INCLUDE=`$PDO_MYSQL_CONFIG --cflags | $SED -e "s/'//g"`
75: elif test -n "$PDO_MYSQL_DIR"; then
76: AC_MSG_RESULT([not found])
77: AC_MSG_CHECKING([for mysql install under $PDO_MYSQL_DIR])
78: if test -r $PDO_MYSQL_DIR/include/mysql; then
79: PDO_MYSQL_INC_DIR=$PDO_MYSQL_DIR/include/mysql
80: else
81: PDO_MYSQL_INC_DIR=$PDO_MYSQL_DIR/include
82: fi
83: if test -r $PDO_MYSQL_DIR/$PHP_LIBDIR/mysql; then
84: PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$PHP_LIBDIR/mysql
85: else
86: PDO_MYSQL_LIB_DIR=$PDO_MYSQL_DIR/$PHP_LIBDIR
87: fi
88:
89: if test -r "$PDO_MYSQL_LIB_DIR"; then
90: AC_MSG_RESULT([libs under $PDO_MYSQL_LIB_DIR; seems promising])
91: else
92: AC_MSG_RESULT([can not find it])
93: AC_MSG_ERROR([Unable to find your mysql installation])
94: fi
95:
96: PHP_ADD_INCLUDE($PDO_MYSQL_INC_DIR)
97: PDO_MYSQL_INCLUDE=-I$PDO_MYSQL_INC_DIR
98: else
99: AC_MSG_RESULT([not found])
100: AC_MSG_ERROR([Unable to find your mysql installation])
101: fi
102:
103: PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_query,
104: [
105: PHP_EVAL_INCLINE($PDO_MYSQL_INCLUDE)
106: PHP_EVAL_LIBLINE($PDO_MYSQL_LIBS, PDO_MYSQL_SHARED_LIBADD)
107: ],[
108: if test "$PHP_ZLIB_DIR" != "no"; then
109: PHP_ADD_LIBRARY_WITH_PATH(z, $PHP_ZLIB_DIR, PDO_MYSQL_SHARED_LIBADD)
110: PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_query, [], [
111: AC_MSG_ERROR([PDO_MYSQL configure failed. Please check config.log for more information.])
112: ], [
113: -L$PHP_ZLIB_DIR/$PHP_LIBDIR -L$PDO_MYSQL_LIB_DIR
114: ])
115: PDO_MYSQL_LIBS="$PDO_MYSQL_LIBS -L$PHP_ZLIB_DIR/$PHP_LIBDIR -lz"
116: else
117: PHP_ADD_LIBRARY(z,, PDO_MYSQL_SHARED_LIBADD)
118: PHP_CHECK_LIBRARY($PDO_MYSQL_LIBNAME, mysql_query, [], [
119: AC_MSG_ERROR([Try adding --with-zlib-dir=<DIR>. Please check config.log for more information.])
120: ], [
121: -L$PDO_MYSQL_LIB_DIR
122: ])
123: PDO_MYSQL_LIBS="$PDO_MYSQL_LIBS -lz"
124: fi
125:
126: PHP_EVAL_INCLINE($PDO_MYSQL_INCLUDE)
127: PHP_EVAL_LIBLINE($PDO_MYSQL_LIBS, PDO_MYSQL_SHARED_LIBADD)
128: ],[
129: $PDO_MYSQL_LIBS
130: ])
131:
132: _SAVE_LIBS=$LIBS
133: LIBS="$LIBS $PDO_MYSQL_LIBS"
134: AC_CHECK_FUNCS([mysql_commit mysql_stmt_prepare mysql_next_result mysql_sqlstate])
135: LIBS=$_SAVE_LIBS
136: fi
137:
138: ifdef([PHP_CHECK_PDO_INCLUDES],
139: [
140: PHP_CHECK_PDO_INCLUDES
141: ],[
142: AC_MSG_CHECKING([for PDO includes])
143: if test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
144: pdo_inc_path=$abs_srcdir/ext
145: elif test -f $abs_srcdir/ext/pdo/php_pdo_driver.h; then
146: pdo_inc_path=$abs_srcdir/ext
147: elif test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
148: pdo_inc_path=$prefix/include/php/ext
149: else
150: AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
151: fi
152: AC_MSG_RESULT($pdo_inc_path)
153: ])
154:
155: if test -n "$PDO_MYSQL_CONFIG"; then
156: PDO_MYSQL_SOCKET=`$PDO_MYSQL_CONFIG --socket`
157: AC_DEFINE_UNQUOTED(PDO_MYSQL_UNIX_ADDR, "$PDO_MYSQL_SOCKET", [ ])
158: fi
159:
160: dnl fix after renaming to pdo_mysql
161: PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_inc_path -I)
162: ifdef([PHP_ADD_EXTENSION_DEP],
163: [
164: PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo)
165: if test "$PHP_MYSQL" = "mysqlnd"; then
166: PHP_ADD_EXTENSION_DEP(pdo_mysql, mysqlnd)
167: fi
168: ])
169: PDO_MYSQL_MODULE_TYPE=external
170:
171: PHP_SUBST(PDO_MYSQL_SHARED_LIBADD)
172: PHP_SUBST_OLD(PDO_MYSQL_MODULE_TYPE)
173: fi
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>