[mapserver-commits] r11199 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Thu Mar 17 12:38:51 EDT 2011


Author: warmerdam
Date: 2011-03-17 09:38:51 -0700 (Thu, 17 Mar 2011)
New Revision: 11199

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/configure.in
Log:
rework postgis/postgres link configuration (#3708)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2011-03-17 16:27:55 UTC (rev 11198)
+++ trunk/mapserver/HISTORY.TXT	2011-03-17 16:38:51 UTC (rev 11199)
@@ -14,6 +14,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- avoid linking in postgres dependencies unnecessarily (#3708)
+
 - don't initialize outputformats until they are selected
 
 - use "seamless" creation of tiles for polygon fills with vector symbols

Modified: trunk/mapserver/configure.in
===================================================================
--- trunk/mapserver/configure.in	2011-03-17 16:27:55 UTC (rev 11198)
+++ trunk/mapserver/configure.in	2011-03-17 16:38:51 UTC (rev 11199)
@@ -1502,25 +1502,42 @@
   POSTGIS_INC=
   POSTGIS_LIB=
 else
+  POSTGIS_ENABLED=
+
   if test -f "$PG_CONFIG" -a -x "$PG_CONFIG" ; then
     AC_MSG_RESULT([yes, user supplied pg_config ($PG_CONFIG)])
   else
     AC_MSG_ERROR(['$PG_CONFIG' is not an executable.  Make sure you use --with-postgis=/path/to/pg_config])
   fi
 
-  POSTGIS_ENABLED=-DUSE_POSTGIS
-  POSTGIS_EXTRALIBS=`$PG_CONFIG --libs`
+  POSTGIS_EXTRALIBS="`$PG_CONFIG --libs`"
   dnl Verify if pg_config has the "--libs" option..
-  if test $? -eq 0 ; then  
-      POSTGIS_LIB="-L`$PG_CONFIG --libdir` -lpq $POSTGIS_EXTRALIBS"
-  else
-      POSTGIS_LIB="-L`$PG_CONFIG --libdir` -lpq"
+  if test $? -ne 0 ; then  
+      POSTGIS_EXTRALIBS=
   fi
+
   POSTGIS_INC="-I`$PG_CONFIG --includedir`"
 
   old_LDFLAGS="$LDFLAGS"
-  LDFLAGS="$LDFLAGS -L`$PG_CONFIG --libdir`"
-  AC_CHECK_LIB(pq, PQserverVersion, POSTGIS_ENABLED="$POSTGIS_ENABLED -DPOSTGIS_HAS_SERVER_VERSION")
+
+  POSTGIS_LIB="-L`$PG_CONFIG --libdir` -lpq"
+  LDFLAGS="$LDFLAGS $POSTGIS_LIB"
+
+  AC_CHECK_LIB(pq, PQconnectdb, POSTGIS_ENABLED="-DUSE_POSTGIS")
+
+  dnl if that didn't work, try adding in the dependent libs. 
+  if test  "$POSTGIS_ENABLED"x = x ; then
+    POSTGIS_LIB="$POSTGIS_LIB $POSTGIS_EXTRALIBS"
+    LDFLAGS="$old_LDFLAGS $POSTGIS_LIB"
+    unset ac_cv_lib_pq_PQconnectdb
+    AC_CHECK_LIB(pq, PQconnectdb, POSTGIS_ENABLED="-DUSE_POSTGIS")
+  fi
+
+  dnl If we have postgresql client lib, check for versioninfo.
+  if test "$POSTGIS_ENABLED" = "-DUSE_POSTGIS" ; then
+    AC_CHECK_LIB(pq, PQserverVersion, POSTGIS_ENABLED="$POSTGIS_ENABLED -DPOSTGIS_HAS_SERVER_VERSION")
+  fi
+
   LDFLAGS="$old_LDFLAGS"
 
 fi



More information about the mapserver-commits mailing list