You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by pq...@apache.org on 2005/02/19 11:12:43 UTC

svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Author: pquerna
Date: Sat Feb 19 02:12:41 2005
New Revision: 154402

URL: http://svn.apache.org/viewcvs?view=rev&rev=154402
Log:
Hook the PostgreSQL DBD driver into autoconf.
The current code will not autodetect Postgres on all systems.

Added:
    apr/apr-util/trunk/build/dbd.m4
Modified:
    apr/apr-util/trunk/build.conf
    apr/apr-util/trunk/configure.in
    apr/apr-util/trunk/include/apu.h.in

Modified: apr/apr-util/trunk/build.conf
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/build.conf?view=diff&r1=154401&r2=154402
==============================================================================
--- apr/apr-util/trunk/build.conf (original)
+++ apr/apr-util/trunk/build.conf Sat Feb 19 02:12:41 2005
@@ -18,7 +18,7 @@
   xml/*.c
   strmatch/*.c
   xlate/*.c
-  dbd/apr_dbd.c
+  dbd/*.c
 
 # we have no platform-specific subdirs
 platform_dirs =

Added: apr/apr-util/trunk/build/dbd.m4
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/build/dbd.m4?view=auto&rev=154402
==============================================================================
--- apr/apr-util/trunk/build/dbd.m4 (added)
+++ apr/apr-util/trunk/build/dbd.m4 Sat Feb 19 02:12:41 2005
@@ -0,0 +1,58 @@
+dnl
+dnl DBD module
+dnl
+
+dnl
+dnl APU_CHECK_DBD: see what kind of DBD backend to use for apr_dbd.
+dnl
+AC_DEFUN(APU_CHECK_DBD, [
+  apu_have_pgsql=0
+
+  AC_ARG_WITH([pgsql], [
+  --with-pgsql=DIR          specify PostgreSQL location
+  ], [
+    apu_have_pgsql=0
+    if test "$withval" = "yes"; then
+      AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQconnectdb, [apu_have_pgsql=1]))
+      if test "$apu_have_pgsql" == "0"; then
+        AC_CHECK_HEADER(postgresql/libpq-fe.h, AC_CHECK_LIB(pq, PQconnectdb, [apu_have_pgsql=1]))
+        if test "$apu_have_pgsql" != "0"; then
+          APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include/postgresql])
+        fi
+      fi
+    elif test "$withval" = "no"; then
+      apu_have_pgsql=0
+    else
+      CPPFLAGS="-I$withval/include"
+      LIBS="-L$withval/lib "
+
+      AC_MSG_NOTICE(checking for pgsql in $withval)
+      AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQconnectdb, [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, PQconnectdb, [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
+    fi
+  ], [
+    apu_have_pgsql=0
+    AC_CHECK_HEADER(libpq-fe.h, AC_CHECK_LIB(pq, PQconnectdb, [apu_have_pgsql=1]))
+  ])
+
+  AC_SUBST(apu_have_pgsql)
+
+  dnl Since we have already done the AC_CHECK_LIB tests, if we have it, 
+  dnl we know the library is there.
+  if test "$apu_have_pgsql" = "1"; then
+    APR_ADDTO(APRUTIL_EXPORT_LIBS,[-lpq])
+    APR_ADDTO(APRUTIL_LIBS,[-lpq])
+  fi
+])
+

Modified: apr/apr-util/trunk/configure.in
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/configure.in?view=diff&r1=154401&r2=154402
==============================================================================
--- apr/apr-util/trunk/configure.in (original)
+++ apr/apr-util/trunk/configure.in Sat Feb 19 02:12:41 2005
@@ -14,6 +14,7 @@
 sinclude(build/apr_common.m4)
 sinclude(build/find_apr.m4)
 sinclude(build/dbm.m4)
+sinclude(build/dbd.m4)
 
 dnl Generate ./config.nice for reproducing runs of configure
 dnl 
@@ -117,6 +118,7 @@
 dnl Find an iconv library
 APU_FIND_LDAP
 APU_CHECK_DBM
+APU_CHECK_DBD
 APU_FIND_EXPAT
 APU_FIND_ICONV
 

Modified: apr/apr-util/trunk/include/apu.h.in
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/include/apu.h.in?view=diff&r1=154401&r2=154402
==============================================================================
--- apr/apr-util/trunk/include/apu.h.in (original)
+++ apr/apr-util/trunk/include/apu.h.in Sat Feb 19 02:12:41 2005
@@ -77,6 +77,8 @@
 #define APU_HAVE_DB_VERSION    @apu_db_version@
 #endif /* APU_HAVE_DB */
 
+#define APU_HAVE_PGSQL         @apu_have_pgsql@
+
 #define APU_HAVE_APR_ICONV     @have_apr_iconv@
 #define APU_HAVE_ICONV         @have_iconv@
 #define APR_HAS_XLATE          (APU_HAVE_APR_ICONV || APU_HAVE_ICONV)



Re: svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Posted by Joe Orton <jo...@redhat.com>.
On Sat, Feb 19, 2005 at 10:12:43AM -0000, Paul Querna wrote:
> Author: pquerna
> Date: Sat Feb 19 02:12:41 2005
> New Revision: 154402
> 
> URL: http://svn.apache.org/viewcvs?view=rev&rev=154402
> Log:
> Hook the PostgreSQL DBD driver into autoconf.
> The current code will not autodetect Postgres on all systems.

Does this driver require some features of particular versions of
PostgresSQL?  This broke the build on my RHEL3 box:

libtool: link: warning: `-version-info' is ignored for programs
../.libs/libaprutil-1.so: undefined reference to `PQexecPrepared'
../.libs/libaprutil-1.so: undefined reference to `PQsendQueryParams'
../.libs/libaprutil-1.so: undefined reference to `PQexecParams'
../.libs/libaprutil-1.so: undefined reference to `PQsendQueryPrepared'

postgres 7.3.9

joe

Re: svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Posted by Nick Kew <ni...@webthing.com>.
Garrett Rooney wrote:

> Leaving it directly linked in to libaprutil seems fine for now, but I
> imagine we'll want to split it out sooner or later, since it would be
> inconvenient for packagers to have to make libaprutil depend on
> postgres, sqlite, mysql, and whatever else we end up implementing...

Agreed.

I've just updated the source to change

#if APR_HAS_DSO

to

#if APR_DSO_BUILD

That'll build it correctly for a static link for the time being.
Then we can
#define APR_DSO_BUILD APR_HAS_DSO
once the autofoo sufficiently supports dynamic building

-- 
Nick Kew

Re: svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
Nick Kew wrote:

>>It can be staticly linked, or dynamically loaded. Either works fine, afaik.
> 
> 
> As designed, it is loaded dynamically if APR_HAS_DSO, statically if not.

Leaving it directly linked in to libaprutil seems fine for now, but I 
imagine we'll want to split it out sooner or later, since it would be 
inconvenient for packagers to have to make libaprutil depend on 
postgres, sqlite, mysql, and whatever else we end up implementing...

-garrett

Re: svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Posted by Nick Kew <ni...@webthing.com>.
Paul Querna wrote:
> Garrett Rooney wrote:
> 
>> pquerna@apache.org wrote:
>>
>>> Author: pquerna
>>> Date: Sat Feb 19 02:12:41 2005
>>> New Revision: 154402
>>>
>>> URL: http://svn.apache.org/viewcvs?view=rev&rev=154402
>>> Log:
>>> Hook the PostgreSQL DBD driver into autoconf.
>>> The current code will not autodetect Postgres on all systems.
>>
>>
>>
>> Doesn't the DBD code expect the postgres dbd module to be built as a
>> shared library and then loaded dynamically, rather than just linking
>> it in to libaprutil?  It seems like there needs to be some Makefile.in
>> magic to make that happen...
> 
> 
> It can be staticly linked, or dynamically loaded. Either works fine, afaik.

As designed, it is loaded dynamically if APR_HAS_DSO, statically if not.

ISTR we still have unfinished business re: mysql licensing.  We haven't
heard anything from them, unless I've missed it.  I'll have to check
it against the current svn and keep it up-to-date until I have my own
SVN open (which is getting delayed now by an enforced house move:-( ).

-- 
Nick Kew

Re: svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Posted by Paul Querna <ch...@force-elite.com>.
Garrett Rooney wrote:
> pquerna@apache.org wrote:
> 
>> Author: pquerna
>> Date: Sat Feb 19 02:12:41 2005
>> New Revision: 154402
>>
>> URL: http://svn.apache.org/viewcvs?view=rev&rev=154402
>> Log:
>> Hook the PostgreSQL DBD driver into autoconf.
>> The current code will not autodetect Postgres on all systems.
> 
> 
> Doesn't the DBD code expect the postgres dbd module to be built as a 
> shared library and then loaded dynamically, rather than just linking it 
> in to libaprutil?  It seems like there needs to be some Makefile.in 
> magic to make that happen...

It can be staticly linked, or dynamically loaded. Either works fine, afaik.

-Paul

Re: svn commit: r154402 - in apr/apr-util/trunk: build.conf build/dbd.m4 configure.in include/apu.h.in

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
pquerna@apache.org wrote:
> Author: pquerna
> Date: Sat Feb 19 02:12:41 2005
> New Revision: 154402
> 
> URL: http://svn.apache.org/viewcvs?view=rev&rev=154402
> Log:
> Hook the PostgreSQL DBD driver into autoconf.
> The current code will not autodetect Postgres on all systems.

Doesn't the DBD code expect the postgres dbd module to be built as a 
shared library and then loaded dynamically, rather than just linking it 
in to libaprutil?  It seems like there needs to be some Makefile.in 
magic to make that happen...

-garrett