summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSascha Schumann <sas@php.net>2000-05-01 21:32:26 +0000
committerSascha Schumann <sas@php.net>2000-05-01 21:32:26 +0000
commit1e3d94b70b276fdb9b6079d0d86a346f19c67c8f (patch)
tree607a6d379167ade82a371c267eb8b115b10c1240 /ext
parent15c8fa99fbd3c46d2eb566ada95ba295acf95b6a (diff)
downloadphp-git-1e3d94b70b276fdb9b6079d0d86a346f19c67c8f.tar.gz
Revamp config stuff
Diffstat (limited to 'ext')
-rw-r--r--ext/pgsql/Makefile.in3
-rw-r--r--ext/pgsql/config.m490
2 files changed, 40 insertions, 53 deletions
diff --git a/ext/pgsql/Makefile.in b/ext/pgsql/Makefile.in
index 26b3f94f4a..475870238e 100644
--- a/ext/pgsql/Makefile.in
+++ b/ext/pgsql/Makefile.in
@@ -2,8 +2,9 @@
LTLIBRARY_NAME = libpgsql.la
LTLIBRARY_SOURCES = pgsql.c
LTLIBRARY_SHARED_NAME = pgsql.la
-LTLIBRARY_SHARED_LIBADD = $(PGSQL_LFLAGS) $(PGSQL_LIBS)
+LTLIBRARY_SHARED_LIBADD = $(PGSQL_SHARED_LIBADD)
EXTRA_INCLUDES = $(PGSQL_INCLUDE)
include $(top_srcdir)/build/dynlib.mk
+
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
index 2228e47c93..d3c638d733 100644
--- a/ext/pgsql/config.m4
+++ b/ext/pgsql/config.m4
@@ -1,61 +1,47 @@
dnl $Id$
-AC_MSG_CHECKING(for PostgresSQL support)
-AC_ARG_WITH(pgsql,
+AC_DEFUN(PGSQL_INC_CHK,[if test -r $i$1/libpq-fe.h; then PGSQL_DIR=$i; PGSQL_INCDIR=$i$1])
+
+PHP_ARG_WITH(pgsql,for PostgresSQL support,
[ --with-pgsql[=DIR] Include PostgresSQL support. DIR is the PostgresSQL
base install directory, defaults to /usr/local/pgsql.
Set DIR to "shared" to build as a dl, or "shared,DIR"
- to build as a dl and still specify DIR.],
-[
- case $withval in
- shared)
- shared=yes
- withval=yes
- ;;
- shared,*)
- shared=yes
- withval=`echo $withval | sed -e 's/^shared,//'`
- ;;
- *)
- shared=no
- ;;
- esac
- if test "$withval" != "no"; then
- if test "$withval" = "yes"; then
- PGSQL_INCDIR=/usr/local/pgsql/include
- PGSQL_LIBDIR=/usr/local/pgsql/lib
- else
- PGSQL_INCDIR=$withval/include
- test -d $withval/include/pgsql && PGSQL_INCDIR=$withval/include/pgsql
- test -d $withval/include/postgresql && PGSQL_INCDIR=$withval/include/postgresql
- PGSQL_LIBDIR=$withval/lib
- test -d $withval/lib/pgsql && PGSQL_LIBDIR=$withval/lib/pgsql
- fi
- PGSQL_INCLUDE=-I$PGSQL_INCDIR
- PGSQL_LFLAGS=-L$PGSQL_LIBDIR
- PGSQL_LIBS=-lpq
-
- old_CFLAGS=$CFLAGS
- CFLAGS="$CFLAGS $PGSQL_INCLUDE"
- AC_DEFINE(HAVE_PGSQL,1,[ ])
- if test "$shared" = "yes"; then
- AC_MSG_RESULT(yes (shared))
- PGSQL_SHARED="pgsql.la"
- else
- AC_MSG_RESULT(yes (static))
- AC_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR)
- AC_ADD_INCLUDE($PGSQL_INCDIR)
- PGSQL_STATIC="libphpext_pgsql.la"
+ to build as a dl and still specify DIR.])
+
+if test "$PHP_PGSQL" != "no"; then
+ for i in /usr /usr/local /usr/local/pgsql $PHP_PGSQL; do
+ PGSQL_INC_CHK(/include)
+ el[]PGSQL_INC_CHK(/include/pgsql)
+ el[]PGSQL_INC_CHK(/include/postgresql)
fi
- AC_CHECK_FUNC(PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ]))
- CFLAGS=$old_CFLAGS
- PHP_EXTENSION(pgsql,$shared)
+ done
+
+ if test -z "$PGSQL_DIR"; then
+ AC_MSG_RESULT(Cannot find libpq-fe.h. Please specify the installation path of PostgreSQL)
+ fi
+
+ PGSQL_INCLUDE="-I$PGSQL_INCDIR"
+
+ PGSQL_LIBDIR=$PGSQL_DIR/lib
+ test -d $PGSQL_DIR/lib/pgsql && PGSQL_LIBDIR=$PGSQL_DIR/lib/pgsql
+
+ old_LIBS="$LIBS"
+ old_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -L$PGSQL_LIBDIR"
+ AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[ ]))
+ LIBS="$old_LIBS"
+ LDFLAGS="$old_LDFLAGS"
+
+ AC_DEFINE(HAVE_PGSQL,1,[ ])
+
+ if test "$ext_shared" = "yes"; then
+ PGSQL_SHARED_LIBADD="-R$PGSQL_LIBDIR -L$PGSQL_LIBDIR -lpq"
else
- AC_MSG_RESULT(no)
+ AC_ADD_LIBRARY_WITH_PATH(pq, $PGSQL_LIBDIR)
fi
-],[
- AC_MSG_RESULT(no)
-])
-PHP_SUBST(PGSQL_LIBS)
-PHP_SUBST(PGSQL_LFLAGS)
+
+ PHP_EXTENSION(pgsql,$ext_shared)
+fi
+
PHP_SUBST(PGSQL_INCLUDE)
+PHP_SUBST(PGSQL_SHARED_LIBADD)