You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bo...@apache.org on 2006/05/24 06:12:04 UTC
svn commit: r409065 - in /apr/apr-util/branches/1.2.x: build/dbd.m4
dbd/apr_dbd_pgsql.c
Author: bojan
Date: Tue May 23 21:12:03 2006
New Revision: 409065
URL: http://svn.apache.org/viewvc?rev=409065&view=rev
Log:
Rework r409059 from the trunk to apply to 1.2.x branch.
Correct detection of various databases (PostgreSQL, MySQL, SQLite2/3).
Use mysql_config to help detect required CPPFLAGS/LDFLAGS for MySQL.
Modified:
apr/apr-util/branches/1.2.x/build/dbd.m4
apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c
Modified: apr/apr-util/branches/1.2.x/build/dbd.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/build/dbd.m4?rev=409065&r1=409064&r2=409065&view=diff
==============================================================================
--- apr/apr-util/branches/1.2.x/build/dbd.m4 (original)
+++ apr/apr-util/branches/1.2.x/build/dbd.m4 Tue May 23 21:12:03 2006
@@ -29,36 +29,42 @@
], [
apu_have_pgsql=0
if test "$withval" = "yes"; then
- AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
+ AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
if test "$apu_have_pgsql" == "0"; then
- AC_CHECK_HEADER(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
- if test "$apu_have_pgsql" != "0"; then
- APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/postgresql])
- fi
+ AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
fi
elif test "$withval" = "no"; then
apu_have_pgsql=0
else
- CPPFLAGS="-I$withval/include"
- LIBS="-L$withval/lib "
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ pgsql_CPPFLAGS="-I$withval/include"
+ pgsql_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
AC_MSG_NOTICE(checking for pgsql in $withval)
- AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
+ AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
if test "$apu_have_pgsql" != "0"; then
APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
fi
if test "$apu_have_pgsql" != "1"; then
- AC_CHECK_HEADER(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
+ AC_CHECK_HEADERS(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
if test "$apu_have_pgsql" != "0"; then
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/postgresql])
APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
fi
fi
+
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
fi
], [
apu_have_pgsql=0
- AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
+ AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
])
AC_SUBST(apu_have_pgsql)
dnl Since we have already done the AC_CHECK_LIB tests, if we have it,
@@ -77,37 +83,92 @@
], [
apu_have_mysql=0
if test "$withval" = "yes"; then
- AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
+ mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
+
+ APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
+ fi
+
+ AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
if test "$apu_have_mysql" == "0"; then
- AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
- if test "$apu_have_mysql" != "0"; then
- APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/myql])
+ AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+ else
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
+ APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
fi
fi
+
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
elif test "$withval" = "no"; then
apu_have_mysql=0
else
- CPPFLAGS="-I$withval/include"
- LIBS="-L$withval/lib "
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_PATH_PROG([MYSQL_CONFIG],[mysql_config],,[$withval/bin])
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
+ mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
+ else
+ mysql_CPPFLAGS="-I$withval/include"
+ mysql_LDFLAGS="-L$withval/lib "
+ fi
+
+ APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
AC_MSG_NOTICE(checking for mysql in $withval)
- AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+ AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
if test "$apu_have_mysql" != "0"; then
- APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
- APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
+ APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
+ APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
fi
if test "$apu_have_mysql" != "1"; then
- AC_CHECK_HEADER(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+ AC_CHECK_HEADERS(mysql/mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
if test "$apu_have_mysql" != "0"; then
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/mysql])
APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
fi
fi
+
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
fi
], [
apu_have_mysql=0
- AC_CHECK_HEADER(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ AC_PATH_PROG([MYSQL_CONFIG],[mysql_config])
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ mysql_CPPFLAGS="`$MYSQL_CONFIG --include`"
+ mysql_LDFLAGS="`$MYSQL_CONFIG --libs_r`"
+
+ APR_ADDTO(CPPFLAGS, [$mysql_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$mysql_LDFLAGS])
+ fi
+
+ AC_CHECK_HEADERS(mysql.h, AC_CHECK_LIB(mysqlclient_r, mysql_init, [apu_have_mysql=1]))
+
+ if test "$apu_have_mysql" != "0"; then
+ if test "x$MYSQL_CONFIG" != 'x'; then
+ APR_ADDTO(APRUTIL_INCLUDES, [$mysql_CPPFLAGS])
+ APR_ADDTO(APRUTIL_LDFLAGS, [$mysql_LDFLAGS])
+ fi
+ fi
+
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
])
AC_SUBST(apu_have_mysql)
@@ -128,23 +189,32 @@
], [
apu_have_sqlite3=0
if test "$withval" = "yes"; then
- AC_CHECK_HEADER(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+ AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
elif test "$withval" = "no"; then
apu_have_sqlite3=0
else
- CPPFLAGS="-I$withval/include"
- LIBS="-L$withval/lib "
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ sqlite3_CPPFLAGS="-I$withval/include"
+ sqlite3_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$sqlite3_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$sqlite3_LDFLAGS])
AC_MSG_NOTICE(checking for sqlite3 in $withval)
- AC_CHECK_HEADER(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+ AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
if test "$apu_have_sqlite3" != "0"; then
APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
fi
+
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
fi
], [
apu_have_sqlite3=0
- AC_CHECK_HEADER(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
+ AC_CHECK_HEADERS(sqlite3.h, AC_CHECK_LIB(sqlite3, sqlite3_open, [apu_have_sqlite3=1]))
])
AC_SUBST(apu_have_sqlite3)
@@ -165,23 +235,32 @@
], [
apu_have_sqlite2=0
if test "$withval" = "yes"; then
- AC_CHECK_HEADER(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
+ AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
elif test "$withval" = "no"; then
apu_have_sqlite2=0
else
- CPPFLAGS="-I$withval/include"
- LIBS="-L$withval/lib "
+ old_cppflags="$CPPFLAGS"
+ old_ldflags="$LDFLAGS"
+
+ sqlite2_CPPFLAGS="-I$withval/include"
+ sqlite2_LDFLAGS="-L$withval/lib "
+
+ APR_ADDTO(CPPFLAGS, [$sqlite2_CPPFLAGS])
+ APR_ADDTO(LDFLAGS, [$sqlite2_LDFLAGS])
AC_MSG_NOTICE(checking for sqlite2 in $withval)
- AC_CHECK_HEADER(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
+ AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
if test "$apu_have_sqlite2" != "0"; then
APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include])
fi
+
+ CPPFLAGS="$old_cppflags"
+ LDFLAGS="$old_ldflags"
fi
], [
apu_have_sqlite2=0
- AC_CHECK_HEADER(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
+ AC_CHECK_HEADERS(sqlite.h, AC_CHECK_LIB(sqlite, sqlite_open, [apu_have_sqlite2=1]))
])
AC_SUBST(apu_have_sqlite2)
Modified: apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c?rev=409065&r1=409064&r2=409065&view=diff
==============================================================================
--- apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/branches/1.2.x/dbd/apr_dbd_pgsql.c Tue May 23 21:12:03 2006
@@ -18,10 +18,16 @@
#if APU_HAVE_PGSQL
+#include "apu_config.h"
+
#include <ctype.h>
#include <stdlib.h>
+#ifdef HAVE_LIBPQ_FE_H
#include <libpq-fe.h>
+#elif defined(HAVE_POSTGRESQL_LIBPQ_FE_H)
+#include <postgresql/libpq-fe.h>
+#endif
#include "apr_strings.h"
#include "apr_time.h"
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x:
build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Bojan Smojver <bo...@rexursive.com>.
On Thu, 2006-06-01 at 12:37 +0100, Joe Orton wrote:
> Works fine now, thanks a lot for sorting this out.
No worries.
--
Bojan
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x: build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Joe Orton <jo...@redhat.com>.
On Thu, Jun 01, 2006 at 09:34:09PM +1000, Bojan Smojver wrote:
> On Thu, 2006-06-01 at 21:04 +1000, Bojan Smojver wrote:
>
> > Working on it...
>
> Should be in trunk and 1.2.x now. Let me know if it worked for you too.
Works fine now, thanks a lot for sorting this out.
joe
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x:
build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Bojan Smojver <bo...@rexursive.com>.
On Thu, 2006-06-01 at 21:04 +1000, Bojan Smojver wrote:
> Working on it...
Should be in trunk and 1.2.x now. Let me know if it worked for you too.
--
Bojan
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x:
build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Bojan Smojver <bo...@rexursive.com>.
On Thu, 2006-06-01 at 11:18 +0100, Joe Orton wrote:
> Did you try to link anything against that libaprutil? e.g. just try a
> "make -C test testall"
Yeah, I see this now. I just built the thing and that worked. It appears
to be referring to undefined symbol apr_dbd_mysql_driver due to:
#if APU_HAVE_MYSQL
DRIVER_LOAD("mysql", apr_dbd_mysql_driver, pool);
#endif
> Actually I guess the fact that this was working previously was just luck
> on FCx since it wasn't looking in the right place for mysql.h etc.
Yeah, the fix broke it :-)
Working on it...
--
Bojan
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x: build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Joe Orton <jo...@redhat.com>.
On Thu, Jun 01, 2006 at 07:57:58PM +1000, Bojan Smojver wrote:
> On Thu, 2006-06-01 at 10:06 +0100, Joe Orton wrote:
> > The MySQL stuff needs to be disabled by default (as it was previously?)
> > since the MySQL driver is not included in apr-util. Currently all
> > builds are failing on platforms with MySQL installed.
>
> I just checked out 1.2.x of APR/APU and built successfully on FC5. I
> have mysql-devel package installed (and it was detected) but I left the
> driver out. No problems at all.
Did you try to link anything against that libaprutil? e.g. just try a
"make -C test testall"
Actually I guess the fact that this was working previously was just luck
on FCx since it wasn't looking in the right place for mysql.h etc.
> Do you have the log of the build?
e.g. the failing bit:
/tmp/regressW16059/build-trunk-prefork-debug/srclib/apr/libtool --silent
--mode=link gcc -g -O2 -Wall -Wmissing-prototypes -Wstrict-prototypes
-Wmissing-declarations -pthread -L/usr/lib64/mysql -lmysqlclient_r
-lz -lpthread -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto -o
htdigest htdigest.lo
/tmp/regressW16059/build-trunk-prefork-debug/srclib/pcre/libpcre.la
/tmp/regressW16059/build-trunk-prefork-debug/srclib/apr-util/libaprutil-1.la
-lldap -llber -ldb-4.3 -lpq -lmysqlclient_r -lsqlite3 -lexpat
/tmp/regressW16059/build-trunk-prefork-debug/srclib/apr/libapr-1.la
-luuid -lrt -lcrypt -lpthread -ldl
/tmp/regressW16059/build-trunk-prefork-debug/srclib/apr-util/.libs/libaprutil-1.so:
undefined reference to `apr_dbd_mysql_driver'
collect2: ld returned 1 exit status
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x:
build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Bojan Smojver <bo...@rexursive.com>.
On Thu, 2006-06-01 at 10:06 +0100, Joe Orton wrote:
> The MySQL stuff needs to be disabled by default (as it was previously?)
> since the MySQL driver is not included in apr-util. Currently all
> builds are failing on platforms with MySQL installed.
I just checked out 1.2.x of APR/APU and built successfully on FC5. I
have mysql-devel package installed (and it was detected) but I left the
driver out. No problems at all.
Do you have the log of the build?
--
Bojan
Re: svn commit: r409065 - in /apr/apr-util/branches/1.2.x: build/dbd.m4 dbd/apr_dbd_pgsql.c
Posted by Joe Orton <jo...@redhat.com>.
On Wed, May 24, 2006 at 04:12:04AM -0000, bojan@apache.org wrote:
> Author: bojan
> Date: Tue May 23 21:12:03 2006
> New Revision: 409065
>
> URL: http://svn.apache.org/viewvc?rev=409065&view=rev
> Log:
> Rework r409059 from the trunk to apply to 1.2.x branch.
> Correct detection of various databases (PostgreSQL, MySQL, SQLite2/3).
> Use mysql_config to help detect required CPPFLAGS/LDFLAGS for MySQL.
The MySQL stuff needs to be disabled by default (as it was previously?)
since the MySQL driver is not included in apr-util. Currently all
builds are failing on platforms with MySQL installed.
(I don't really see the point in having the autoconf code in the tree at
all if the associated C code is not, to be honest)
Regards,
joe