Re: MySQL client library upgrade: 3.3.31

From: Date: Thu, 18 Jan 2001 01:11:23 +0000
Subject: Re: MySQL client library upgrade: 3.3.31
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-44434@lists.php.net to get a copy of this message
On Wed, 17 Jan 2001, Thimble Smith wrote: > On Wed, Jan 17, 2001 at 01:57:08AM -0800, chrisv@b0rked.dhs.org wrote: > > +AC_DEFUN(PHP_MYSQL_VERSION,[ > > + if test "$PHP_MYSQL" != "yes"; then > > + AC_MSG_CHECKING(for MySQL version) > > + MYSQL_VERSION=$( strings $MYSQL_LIB_DIR/libmysqlclient.so | grep '3\.' ) > > + if test "x$( echo $MYSQL_VERSION | cut -f2 -d. )" = "x23" ; then > > + AC_MSG_RESULT($MYSQL_VERSION) > > + PHP_EVAL_LIBLINE($PHP_MYSQL/bin/mysql_config --libs) > > + else > > + AC_MSG_RESULT($MYSQL_VERSION) > > + fi > > + fi > > +]) > > I think it would be better to simply check if mysql_config > exists. If so, use it; if not, assume that the version is older > and doesn't need -lz. One trouble with the above is that it > won't work when 4.0 comes out (alpha should be pretty soon). > Of course an extra test could be added, but I don't think it's > needed. > > Did you mean to 'test "$PHP_MYSQL" = "yes"' up there, instead > of '!='? You could remove the else clause, and just put the > AC_MSG_RESULT() outside the if. Plus, there are some bashisms > there that aren't portable. I wouldn't doubt that there are some ways to make it better.. that was a quick throw-together that took me about 5 minutes to make. The reason it's "$PHP_MYSQL" != "yes" is because it's called from after it's been determined that the user wants MySQL support, and a value of "yes" is the value that is passed if the user wants to use the built-in library (or so I could tell by reading the code..). I suppose most of that could be rewritten to, perhaps something like the following: AC_DEFUN(PHP_MYSQL_VERSION,[ if test "$PHP_MYSQL" != "yes"; then AC_MSG_CHECKING(for MySQL version) if test -x "$PHP_MYSQL/bin/mysql_config"; then AC_MSG_RESULT(3.23 or better) PHP_EVAL_LIBLINE($PHP_MYSQL/bin/mysql_config --libs) else AC_MSG_RESULT(3.22 or earlier) fi fi ]) (yet another 5 minute job.. I don't see any bash-isms in there, but there could be some..) Of course, this should only be called once it's been determined that the user wants MySQL support and they don't want the built-in library.. Chris PS: This is just an example.. as I mentioned, I'm sure there are better ways to write it.

« previous php.dev (#44434) next »