Ticket #120: 0001-improved-postgresql-detection.patch

File 0001-improved-postgresql-detection.patch, 4.1 KB (added by hacker, 18 months ago)

patch against current svn with a wordy comment.

  • configure.ac

    From 8109bc5f97eb32c4ee773f50383e0cf6365d25db Mon Sep 17 00:00:00 2001
    From: Michael Krelin <hacker@klever.net>
    Date: Sat, 28 Jul 2007 17:38:03 +0200
    Subject: [PATCH] improved postgresql detection
    
     Improve postgresql detection by obtaining relevant directories from pg_config
     script, which can be specified as a parameter to --enable-pgsql configure
     option. The legacy detection code is left intact to ensure unnecessary level
     of compatibility and invoked if --enable-pgsql is supplied with no parameter.
     In the long run it would be better to detect pg_config in this case.
    
    Signed-off-by: Michael Krelin <hacker@klever.net>
    ---
     configure.ac |   71 +++++++++++++++++++++++++++++++++------------------------
     1 files changed, 41 insertions(+), 30 deletions(-)
    
    diff --git a/configure.ac b/configure.ac
    index 099aec9..29dca26 100644
    a b  
    494494 
    495495# PostgreSQL 
    496496AC_ARG_ENABLE([pgsql], 
    497         AC_HELP_STRING([--enable-pgsql], [enable PostgreSQL auth/reg/storage support (no)]), 
    498         [enable_pgsql=$enableval have_pgsql=no], 
     497        AC_HELP_STRING([--enable-pgsql], 
     498        [enable PostgreSQL auth/reg/storage support, you can provide path to 
     499        pg_config executable (no)]), 
     500        [enable_pgsql="$enableval" have_pgsql=no], 
    499501        [enable_pgsql=no         have_pgsql=no]) 
    500 if test "x-$enable_pgsql" = "x-yes" ; then 
    501         for i in /usr /usr/local /usr/local/pgsql ; do 
    502                 for j in include include/pgsql include/postgres include/postgresql "" ; do 
    503                         if test -r "$i/$j/libpq-fe.h" ; then 
    504                                 PGSQL_INCLUDE=$i/$j 
    505                         fi 
    506                 done 
    507                 for lib in lib lib64 ; do 
    508                         for j in $lib $lib/pgsql $lib/postgres $lib/postgresql "" ; do 
    509                                 if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a" ; then 
    510                                         PGSQL_LIBDIR=$i/$j 
    511                                 fi 
    512                         done 
    513                 done 
    514         done 
    515         AC_CHECK_LIB([pq], [PQsetdbLogin], [ 
    516                 have_pgsql=yes 
    517                 if test "x-$PGSQL_INCLUDE" != "x-"; then 
    518                         PGSQL_CFLAGS="-I $PGSQL_INCLUDE" 
    519                 fi 
    520                 if test "x-$PGSQL_LIBDIR" != "x-"; then 
    521                         PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" 
    522                 fi 
    523                 AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.]) 
    524         ]) 
    525         if test "x-$have_pgsql" != "x-yes" ; then 
    526                 AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.]) 
    527         fi 
     502if test "x-$enable_pgsql" != "x-no" ; then 
     503        if test -x "$enable_pgsql" ; then 
     504                PGSQL_INCLUDE="$($enable_pgsql --includedir)" 
     505                PGSQL_LIBDIR="$($enable_pgsql --libdir)" 
     506                PGSQL_CFLAGS="-I$PGSQL_INCLUDE" 
     507                PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" 
     508                have_pgsql=yes 
     509                AC_DEFINE([STORAGE_POSTGRES],[1],[Define to 1 if you want to use PostgreSQL for storage.]) 
     510        else    # leave legacy detection intact for now 
     511                for i in /usr /usr/local /usr/local/pgsql ; do 
     512                        for j in include include/pgsql include/postgres include/postgresql "" ; do 
     513                                if test -r "$i/$j/libpq-fe.h" ; then 
     514                                        PGSQL_INCLUDE=$i/$j 
     515                                fi 
     516                        done 
     517                        for lib in lib lib64 ; do 
     518                                for j in $lib $lib/pgsql $lib/postgres $lib/postgresql "" ; do 
     519                                        if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a" ; then 
     520                                                PGSQL_LIBDIR=$i/$j 
     521                                        fi 
     522                                done 
     523                        done 
     524                done 
     525                AC_CHECK_LIB([pq], [PQsetdbLogin], [ 
     526                        have_pgsql=yes 
     527                        if test "x-$PGSQL_INCLUDE" != "x-"; then 
     528                                PGSQL_CFLAGS="-I $PGSQL_INCLUDE" 
     529                        fi 
     530                        if test "x-$PGSQL_LIBDIR" != "x-"; then 
     531                                PGSQL_LIBS="-L$PGSQL_LIBDIR -lpq" 
     532                        fi 
     533                        AC_DEFINE(STORAGE_POSTGRES, 1, [Define to 1 if you want to use PostgreSQL for storage.]) 
     534                ]) 
     535                if test "x-$have_pgsql" != "x-yes" ; then 
     536                        AC_MSG_ERROR([PostgreSQL support requested, but headers/libraries not found.]) 
     537                fi 
     538        fi 
    528539fi 
    529540AC_SUBST(PGSQL_CFLAGS) 
    530541AC_SUBST(PGSQL_LIBS)