On Tue, 2008-05-20 at 20:26 -0400, Bob Rossi wrote:
> That's because as you can see the -lpq went at the
> end which is incorrect.

The real problem is that we're adding libraries to LDFLAGS. We should be
adding them to LIBS. I meant to fix that long time ago, but I always get
put off by the fact that many config programs mix these two together
(ARGH!).

Could you do a quick test for me? Try the attached patch...

-- 
Bojan
Index: build/dbd.m4
===================================================================
--- build/dbd.m4	(revision 658494)
+++ build/dbd.m4	(working copy)
@@ -35,10 +35,11 @@
       if test "x$PGSQL_CONFIG" != 'x'; then
         pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
         pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
-        pgsql_LDFLAGS="$pgsql_LDFLAGS `$PGSQL_CONFIG --libs`"
+        pgsql_LIBS="`$PGSQL_CONFIG --libs`"
 
         APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
         APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
+        APR_ADDTO(LIBS, [$pgsql_LIBS])
       fi
 
       AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
@@ -55,7 +56,7 @@
       if test "x$PGSQL_CONFIG" != 'x'; then
         pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
         pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
-        pgsql_LDFLAGS="$pgsql_LDFLAGS `$PGSQL_CONFIG --libs`"
+        pgsql_LIBS="`$PGSQL_CONFIG --libs`"
       else
         pgsql_CPPFLAGS="-I$withval/include"
         pgsql_LDFLAGS="-L$withval/lib "
@@ -63,6 +64,7 @@
 
       APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
       APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
+      APR_ADDTO(LIBS, [$pgsql_LIBS])
 
       AC_MSG_NOTICE(checking for pgsql in $withval)
       AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
@@ -78,10 +80,11 @@
     if test "x$PGSQL_CONFIG" != 'x'; then
       pgsql_CPPFLAGS="-I`$PGSQL_CONFIG --includedir`"
       pgsql_LDFLAGS="-L`$PGSQL_CONFIG --libdir`"
-      pgsql_LDFLAGS="$pgsql_LDFLAGS `$PGSQL_CONFIG --libs`"
+      pgsql_LIBS="`$PGSQL_CONFIG --libs`"
 
       APR_ADDTO(CPPFLAGS, [$pgsql_CPPFLAGS])
       APR_ADDTO(LDFLAGS, [$pgsql_LDFLAGS])
+      APR_ADDTO(LIBS, [$pgsql_LIBS])
     fi
 
     AC_CHECK_HEADERS(libpq-fe.h, AC_CHECK_LIB(pq, PQsendQueryPrepared, [apu_have_pgsql=1]))
@@ -96,7 +99,7 @@
   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
-    LDADD_dbd_pgsql="$pgsql_LDFLAGS -lpq"
+    LDADD_dbd_pgsql="$pgsql_LDFLAGS -lpq $pgsql_LIBS"
   fi
   AC_SUBST(LDADD_dbd_pgsql)
 

Reply via email to