Increase the chances of finding libpq if it's installed.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 6 Feb 2008 10:33:05 +0000 (10:33 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 6 Feb 2008 10:33:05 +0000 (10:33 +0000)
configure.ac
src/ui/gui/automake.mk
src/ui/terminal/automake.mk
tests/automake.mk
tests/command/get-data-psql.sh

index 9c52b30a676ef3c77393bb174dc61b74538e6ab5..57e7ae8a16cf7d6c5237a4700eee99d83d13ece1 100644 (file)
@@ -48,13 +48,15 @@ AM_CONDITIONAL(WITHGUI, test x"$with_gui" != x"no")
 
 
 dnl Checks needed for psql reader
-AC_CHECK_PROG(psql_support, pg_config, yes, no)
-if test x"$psql_support" = x"yes" ; then 
+AC_ARG_VAR([PG_CONFIG], [Full pathname of the pg_config program shipped with Postgresql])
+AC_PATH_PROG([PG_CONFIG], [pg_config], [], [$PATH:/usr/local/pgsql/bin:/usr/pgsql/bin])
+if test -n "$PG_CONFIG" ; then 
+   AC_SUBST(PG_CONFIG)
    AC_DEFINE([PSQL_SUPPORT], 1,
    [Define to 1 if building in support for reading from postgres databases.])
-   PG_CFLAGS=-I`pg_config --includedir` 
+   PG_CFLAGS=-I`$PG_CONFIG --includedir` 
    AC_SUBST(PG_CFLAGS)
-   PG_LDFLAGS=-L`pg_config --libdir`
+   PG_LDFLAGS=-R`$PG_CONFIG --libdir`
    AC_SUBST(PG_LDFLAGS)
    PG_LIBS=-lpq
    AC_SUBST(PG_LIBS)
@@ -63,7 +65,7 @@ if test x"$psql_support" = x"yes" ; then
                    [Define to 1 if the openssl library is present.])
            ,)
 fi
-AM_CONDITIONAL(PSQL_SUPPORT, test x"$psql_support" = x"yes")
+AM_CONDITIONAL(PSQL_SUPPORT, test -n "$PG_CONFIG")
 
 dnl Checks needed for gnumeric reader
 gnm_support=yes;
index dfbc578574e1475cc9d69cf18978b21e7a20c6ef..498ffd4746d37cddd07e94a0bf8374b2c27e7ab7 100644 (file)
@@ -9,6 +9,7 @@ src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) $(GLADE_CFLAGS) -Wall \
 
 
 src_ui_gui_psppire_LDFLAGS = \
+       $(PG_LDFLAGS) \
        -export-dynamic 
 
 
index 0684e313caa0638369df94207516d0990a3ac97f..57eedb29e8e727fed027148f25dca74f913c669c 100644 (file)
@@ -41,6 +41,8 @@ src_ui_terminal_pspp_LDADD = \
 
 
 
+src_ui_terminal_pspp_LDFLAGS = $(PG_LDFLAGS)
+
 if RELOCATABLE_VIA_LD
-src_ui_terminal_pspp_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
+src_ui_terminal_pspp_LDFLAGS += `$(RELOCATABLE_LDFLAGS) $(bindir)`
 endif
index 6d0fd670e8142343e0879488648a84d240dac656..e00fa21dac1a275f7c598b11980f3953800db8f8 100644 (file)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in  -*- makefile -*-
 
 TESTS_ENVIRONMENT = top_srcdir='$(top_srcdir)' top_builddir='$(top_builddir)'
-TESTS_ENVIRONMENT += PERL='@PERL@'
+TESTS_ENVIRONMENT += PERL='@PERL@' PG_CONFIG='@PG_CONFIG@'
 
 # Allow locale_charset to find charset.alias before running "make install".
 TESTS_ENVIRONMENT += CHARSETALIASDIR='$(abs_top_builddir)/gl'
index 6b501025b8b6bd338fabd98bf55b4c1d5ea886e1..521a97f84c941c6e7a3615770b77c4f8552d66e9 100755 (executable)
@@ -21,7 +21,7 @@ export LANG
 
 port=6543
 dbase=pspptest
-PG_CONFIG=pg_config
+PG_CONFIG=${PG_CONFIG:=pg_config}
 pgpath=`$PG_CONFIG | awk '/BINDIR/{print $3}'`
 
 cleanup()