]> granicus.if.org Git - postgis/commitdiff
Applied Alex Bodnaru patch for pgsql source tree dependency drop.
authorSandro Santilli <strk@keybit.net>
Sat, 4 Jun 2005 10:06:14 +0000 (10:06 +0000)
committerSandro Santilli <strk@keybit.net>
Sat, 4 Jun 2005 10:06:14 +0000 (10:06 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@1733 b70326c6-7e19-0410-871a-916f4a2858ee

Makefile
Makefile.config.in
configure.in
doc/Makefile
jdbc2/Makefile
loader/Makefile
lwgeom/Makefile

index 7033afd893f1ca8a559f305982a04a86a4e03b73..41cc76dfabbb2f4674f01e245aae807d79c08238 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,21 +10,22 @@ install: all liblwgeom-install loaderdumper-install docs-install
 
 uninstall: liblwgeom-uninstall loaderdumper-uninstall docs-uninstall
 
-clean: Makefile.config liblwgeom-clean loaderdumper-clean test-clean 
+clean: Makefile.config liblwgeom-clean loaderdumper-clean docs-clean test-clean 
        rm -f lwpostgis.sql
 
 distclean: clean
        rm -Rf autom4te.cache
        rm -f config.log config.cache config.status Makefile.config
 
-maintainer-clean:
+maintainer-clean: Makefile.config
        @echo '------------------------------------------------------'
        @echo 'This command is intended for maintainers to use; it'
        @echo 'deletes files that may need special tools to rebuild.'
        @echo '------------------------------------------------------'
-       $(MAKE) distclean
+       $(MAKE) -C doc maintainer-clean
        $(MAKE) -C lwgeom maintainer-clean
        $(MAKE) -C jdbc2 maintainer-clean
+       $(MAKE) distclean
        rm -f configure
 
 test: liblwgeom
@@ -34,7 +35,7 @@ test-clean:
        $(MAKE) -C regress clean
 
 liblwgeom: Makefile.config
-       $(MAKE) -C lwgeom
+       $(MAKE) -C lwgeom all
 
 liblwgeom-clean:
        $(MAKE) -C lwgeom clean
@@ -60,6 +61,10 @@ loaderdumper-uninstall:
 docs: Makefile.config
        $(MAKE) -C doc 
 
+docs-clean: Makefile.config
+       $(MAKE) -C doc clean
+
+
 docs-install:
        $(MAKE) -C doc install
 
index 3b47a003d63be0039bd19fb813c3e29aecf6c43d..d1875b541f5446bca385d99e4a3d128a7932d16c 100644 (file)
@@ -75,6 +75,7 @@ PGBEINCLUDES=@PGBEINCLUDES@
 PGFELIBS=@PGFELIBS@
 PGBELIBS=@PGBELIBS@
 PGBIN=@PGBIN@
+PORTNAME=@PORTNAME@
 
 #
 # Docbook
@@ -92,6 +93,7 @@ CXX=@CXX@
 #
 FLEX=@FLEX@
 YACC=@YACC@
+LN_S=@LN_S@
 INSTALL=@INSTALL@ -c
 INSTALL_DATA=$(INSTALL) -m 644
 INSTALL_BIN=$(INSTALL) -m 755
@@ -110,7 +112,6 @@ libdir=@libdir@
 libexecdir=@libexecdir@
 MODULE_INSTALLDIR=@MODULE_INSTALLDIR@
 LPATH=@LPATH@
-
 #
 # DLL 
 #
index 99b8483cafa5b054eeafb37f187a5bda2a1e6118..edf4a259c4f9ea2261ca62cf03afed7f33c1c57f 100644 (file)
@@ -14,12 +14,12 @@ dnl Compilers
 dnl
 AC_PROG_CC
 AC_PROG_CXX
+AC_PROG_LN_S
 
 dnl
 dnl host operating system
 dnl
 AC_CANONICAL_HOST
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
 dnl
 dnl Search for pg_config and setup pgsql stuff
@@ -47,6 +47,7 @@ AC_SUBST(PGBEINCLUDES)
 AC_SUBST(PGFELIBS)
 AC_SUBST(PGBELIBS)
 AC_SUBST(PGBIN)
+AC_SUBST(PGTEMPLATE)
 AC_SUBST(MODULE_INSTALLDIR)
 AC_SUBST(LPATH)
 PGFEINCLUDES="-I`${PGCONFIG} --includedir`"
@@ -54,6 +55,69 @@ PGFELIBS="-L`${PGCONFIG} --libdir` -lpq"
 PGBELIBS="-L$( echo $(${PGCONFIG} --libdir)) -lpostgres"
 PGBEINCLUDES="-I`${PGCONFIG} --includedir-server`"
 PGBIN="$(${PGCONFIG} --bindir)"
+AC_MSG_CHECKING([which template to use])
+
+PGTEMPLATE="$(${PGCONFIG} --configure | \
+             awk 'BEGIN {RS = " "; FS = "=";} \
+                         { \
+                               if (match($1,"--with-template")) \
+                                       { \
+                                               gsub("'\''$", "", $2); \
+                                               print $2; \
+                                       } \
+                               }' \
+                       )"
+template=$PGTEMPLATE
+
+case $host_os in
+     aix*) template=aix ;;
+    beos*) template=beos ;;
+    bsdi*) template=bsdi ;;
+  cygwin*) template=cygwin ;;
+  darwin*) template=darwin ;;
+    dgux*) template=dgux ;;
+ freebsd*) template=freebsd ;;
+    hpux*) template=hpux ;;
+    irix*) template=irix ;;
+ linux*|gnu*|k*bsd*-gnu)
+           template=linux ;;
+   mingw*) template=win32 ;;
+  netbsd*) template=netbsd ;;
+nextstep*) template=nextstep ;;
+ openbsd*) template=openbsd ;;
+     osf*) template=osf ;;
+     qnx*) template=qnx4 ;;
+     sco*) template=sco ;;
+ solaris*) template=solaris ;;
+   sunos*) template=sunos4 ;;
+ sysv4.2*)
+        case $host_vendor in
+          univel) template=univel ;;
+        esac ;;
+   sysv4*) template=svr4 ;;
+   sysv5*) template=unixware ;;
+  ultrix*) template=ultrix4 ;;
+esac
+
+  if test x"$template" = x"" ; then
+    AC_MSG_ERROR([[
+*******************************************************************
+PostgreSQL has apparently not been ported to your platform yet.
+To try a manual configuration, look into the src/template directory
+for a similar platform and use the '--with-template=' option.
+
+Please also contact <pgsql-ports@postgresql.org> to see about
+rectifying this.  Include the above 'checking host system type...'
+line.
+*******************************************************************
+]])
+  fi
+
+AC_MSG_RESULT([$template])
+
+PORTNAME=$template
+AC_SUBST(PORTNAME)
+
 
 dnl
 dnl Test for GEOS
@@ -169,7 +233,7 @@ if test -z "$INSTALL"; then
 fi
 
 AC_SUBST(docdir)
-docdir='${prefix}/doc'
+docdir='${prefix}/share/doc'
 AC_ARG_WITH(docdir,
 [  --with-docdir=DIR       install the documentation in DIR [[PREFIX/doc]]],
        if test "$with_docdir" = "yes"; then
@@ -216,10 +280,32 @@ if test "${prefix}" = "NONE"; then
                fi
        done
        exec_prefix='${prefix}'
-       docdir='${prefix}/doc/postgresql/contrib'
+       if test "${docdir}" = ""; then
+               docdir="$(${PGCONFIG} --configure | \
+             awk 'BEGIN {RS = " "; FS = "=";} \
+                         { \
+                               if (match($1,"--docdir")) \
+                                       { \
+                                               gsub("'\''$", "", $2); \
+                                               print $2"/postgresql/contrib"; \
+                                       } \
+                               }' \
+                       )"
+       fi
        datadir='${prefix}/share/postgresql/contrib'
-       mandir='${prefix}/man'
-       bindir='${exec_prefix}/bin'
+       if test "${mandir}" = ""; then
+               mandir="$(${PGCONFIG} --configure | \
+             awk 'BEGIN {RS = " "; FS = "=";} \
+                         { \
+                               if (match($1,"--mandir")) \
+                                       { \
+                                               gsub("'\''$", "", $2); \
+                                               print $2; \
+                                       } \
+                               }' \
+                       )"
+       fi
+       bindir="$(${PGCONFIG} --bindir)"
        MODULE_INSTALLDIR="`${PGCONFIG} --pkglibdir`"
        LPATH='\$$libdir'
 else
@@ -237,6 +323,8 @@ AC_SUBST(DLFLAGS)
 AC_SUBST(EXE)
 AC_SUBST(HOST_OS)
 
+#host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
 HOST_OS=$host_os
 DLSUFFIX=.so
 DLFLAGS=-shared
@@ -256,7 +344,6 @@ esac
 
 
 
-
 AC_OUTPUT(Makefile.config)
 
 AC_MSG_RESULT([ ])
@@ -280,6 +367,7 @@ dnl AC_MSG_RESULT([  FLEX:  path=$FLEX])
 dnl AC_MSG_RESULT([  YACC:  path=$YACC])
 
 AC_MSG_RESULT([  ])
+AC_MSG_RESULT([ PORTNAME: $PORTNAME])
 AC_MSG_RESULT([   PREFIX: $prefix])
 AC_MSG_RESULT([  EPREFIX: $exec_prefix])
 AC_MSG_RESULT([      DOC: $docdir])
index b42aff6605a8038606cda337fafcb070d6fffb0e..f59aeca20e3e36ea45db57a34639928dde049968 100644 (file)
@@ -69,17 +69,17 @@ maintainer-clean: clean
        @rm -f html/*.html
 
 install: html/postgis.html man/shp2pgsql.1 man/pgsql2shp.1
-       @mkdir -p $(docdir)
-       @mkdir -p $(mandir)/man1
-       $(INSTALL_DATA) html/postgis.html $(docdir)/postgis.html
-       $(INSTALL_DATA) man/pgsql2shp.1 $(mandir)/man1/pgsql2shp.1
-       $(INSTALL_DATA) man/shp2pgsql.1 $(mandir)/man1/shp2pgsql.1
-       $(INSTALL_DATA) ../README.postgis $(docdir)/README.postgis
+       @mkdir -p $(DESTDIR)$(docdir)
+       @mkdir -p $(DESTDIR)$(mandir)/man1
+       $(INSTALL_DATA) html/postgis.html $(DESTDIR)$(docdir)/postgis.html
+       $(INSTALL_DATA) man/pgsql2shp.1 $(DESTDIR)$(mandir)/man1/pgsql2shp.1
+       $(INSTALL_DATA) man/shp2pgsql.1 $(DESTDIR)$(mandir)/man1/shp2pgsql.1
+       $(INSTALL_DATA) ../README.postgis $(DESTDIR)$(docdir)/README.postgis
 
 uninstall:
-       rm -f $(docdir)/postgis/postgis.html
-       rm -f $(docdir)/postgis/README.postgis
-       rm -f $(mandir)/man1/shp2pgsql.1
-       rm -f $(mandir)/man1/pgsql2shp.1
+       rm -f $(DESTDIR)$(docdir)/postgis/postgis.html
+       rm -f $(DESTDIR)$(docdir)/postgis/README.postgis
+       rm -f $(DESTDIR)$(mandir)/man1/shp2pgsql.1
+       rm -f $(DESTDIR)$(mandir)/man1/pgsql2shp.1
 
 .PHONY: html 
index ebb1fc04e0afffd72cb997f3da3830ec2e1d32d4..0124eba3cbf8882382968418745827ee1c4cdd09 100644 (file)
@@ -40,18 +40,6 @@ CP?=cp
 # variable to postgis_debug.fastjar and JAR (above) to fastjar.
 DEBUGJAR?=postgis_debug.jar
 
-# Find our postgresql build directory - needed for "make installdirs" and 
-# "make install" that are used by the debian packaging process. As everything
-# else works without Makefile.global, we don't abort on inclusion failure
-# and use late checking iside those rules instead.
-ifeq (${PGSQL_SRC},)
-       PGSQL_SRC=../../..
-endif
-
-top_builddir:=$(PGSQL_SRC)
-top_makefile:=$(PGSQL_SRC)/src/Makefile.global
--include $(top_makefile)
-
 # Make sure our classpath includes your postgresql.jar. This is somehow
 # difficult because some JREs (e. G. those on debian woody or sablevm) seem
 # to forget their own system classes (aka bootclasspath) as soon as _any_
@@ -128,6 +116,7 @@ DEBUGJARCONTENTS=-C $(SRCDIR) org \
 
 # include version numbers from central repository
 include ../Version.config
+include ../Makefile.config
 VERSION=$(JDBC_MAJOR_VERSION)_$(JDBC_MINOR_VERSION)_$(JDBC_MICRO_VERSION)
 VERSIONPATH=$(BUILD)/org/postgis
 VERSIONTARGET=$(VERSIONPATH)/version.properties
@@ -252,18 +241,12 @@ maintainer-clean: clean
        $(DELETE) $(SRCCONF)
 
 
-# Install - this needs the successfull inclusion of PostgreSQL top
-# level Makefile (which is mandatory for the C part of PostGIS as well).
 install: jar installdirs
-       @echo Testing for successful inclusion of $(top_makefile)
-       test $(top_makefile)
        $(INSTALL_DATA) postgis.jar $(DESTDIR)
        $(INSTALL_DATA) postgis_debug.jar $(DESTDIR)
 
 installdirs:
-       @echo Testing for successful inclusion of $(top_makefile)
-       test $(top_makefile)
-       $(mkinstalldirs) $(DESTDIR)
+       @mkdir -p $(DESTDIR)
 
 # Preliminary JTS support
 
index abbd78f75a0eab2f0d4b6d3a74d07fc2f1fb0aa9..2aede61fa7bab862cbb3a7e527ca8f3742c3e599 100644 (file)
@@ -26,14 +26,14 @@ shp2pgsql$(EXE): $(OBJS) shp2pgsql.o
        $(CC) $(CFLAGS) $(OBJS) shp2pgsql.o $(LDFLAGS) -o $@ 
 
 install: all
-       @mkdir -p $(bindir)
-       $(INSTALL_BIN) pgsql2shp$(EXE) $(bindir)/pgsql2shp$(EXE)
-       $(INSTALL_BIN) shp2pgsql$(EXE) $(bindir)/shp2pgsql$(EXE)
+       @mkdir -p $(DESTDIR)$(bindir)
+       $(INSTALL_BIN) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
+       $(INSTALL_BIN) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
 
 uninstall:
-       rm -f $(bindir)/pgsql2shp$(EXE)
-       rm -f $(bindir)/shp2pgsql$(EXE)
+       rm -f $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
+       rm -f $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
 
 clean:
-       rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(EXE) pgsql2shp$(EXE)
+       rm -f $(OBJS) shp2pgsql.o pgsql2shp.o PQunescapeBytea.o shp2pgsql$(EXE) pgsql2shp$(EXE)
 
index 7cb79659920172731168bd2b2080dd73017ded43..25644b9f8c1186cd0a95e9a5d6a00e44fc862ffd 100644 (file)
@@ -87,25 +87,13 @@ OBJS=$(SA_OBJS) liblwgeom.o lwgeom_pg.o lwgeom_debug.o lwgeom_spheroid.o lwgeom_
 #OTHERS=y.output lex.yy.c wktparse.tab.c wktparse.tab.h lwpostgis.sql
 OTHERS=y.output lwpostgis.sql ../lwpostgis.sql postgis_geos_version.h
 
+enable_shared=yes
+include Makefile.shlib
 
 #---------------------------------------------------------------
 # Makefile targets
 
-all: $(GEOS_RULES) $(SHLIB) ../lwpostgis.sql
-
-$(SHLIB): $(OBJS)
-ifeq ($(findstring mingw,$(HOST_OS)),mingw)
-       dlltool --export-all  --output-def lwgeom.def $(OBJS)
-       dllwrap  -o $@ --dllname $@ --def lwgeom.def $(OBJS) $(SHLIB_LINK) $(PGBELIBS)
-       dlltool --dllname $@  --def lwgeom.def --output-lib liblwgeom.a
-else
-ifeq ($(findstring darwin,$(HOST_OS)),darwin)
-       $(CC) $(SHLIB_LINK) -o $(SHLIB) -bundle $(OBJS) -bundle_loader $(PGBIN)/postgres
-else
-       $(CC) $(SHLIB_LINK) -o $(SHLIB) $(OBJS) 
-endif
-endif
-
+all: $(GEOS_RULES) ../lwpostgis.sql all-shared-lib
 
 wktparse.tab.c: wktparse.y
        $(YACC) -vd -p lwg_parse_yy wktparse.y
@@ -139,32 +127,36 @@ lwpostgis.sql: lwpostgis.sql.in
 install: all install-lwgeom-lib install-lwgeom-scripts
 
 install-lwgeom-scripts:
-       @mkdir -p $(datadir)
-       $(INSTALL_DATA) lwpostgis.sql $(datadir)/lwpostgis.sql
-       $(INSTALL_DATA) ../spatial_ref_sys.sql $(datadir)/spatial_ref_sys.sql
+       @mkdir -p $(DESTDIR)$(datadir)
+       $(INSTALL_DATA) lwpostgis.sql $(DESTDIR)$(datadir)/lwpostgis.sql
+       $(INSTALL_DATA) ../spatial_ref_sys.sql $(DESTDIR)$(datadir)/spatial_ref_sys.sql
 
 #- This has been copied from postgresql and adapted
 install-lwgeom-lib: $(SHLIB)
-       @mkdir -p $(MODULE_INSTALLDIR)
-       $(INSTALL_LIB) $$(MODULE_INSTALLDIR)/$(SHLIB)
+       @mkdir -p $(DESTDIR)$(MODULE_INSTALLDIR)
+       $(INSTALL_LIB) $(SHLIB) $(DESTDIR)$(MODULE_INSTALLDIR)/$(SHLIB)
 
+ifneq ($(PORTNAME), cygwin)
+ifneq ($(PORTNAME), win32)
 ifneq ($(PORTNAME), win)
 ifneq ($(SHLIB), $(SHLIB_MAJOR))
-       cd $(MODULE_INSTALLDIR) && \
-       rm -f $(SHLIB_MAHOR) && \
+       cd $(DESTDIR)$(MODULE_INSTALLDIR) && \
+       rm -f $(SHLIB_MAJOR) && \
        ln -sf $(SHLIB) $(SHLIB_MAJOR)
 endif
 ifneq ($(SHLIB), lib$(NAME)$(DLSUFFIX))
-       cd $(MODULE_INSTALLDIR) && \
+       cd $(DESTDIR)$(MODULE_INSTALLDIR) && \
        rm -f $(SHLIB_BARE) && \
        ln -sf $(SHLIB) $(SHLIB_BARE)
 endif
 endif # not win
+endif # not win32
+endif # not cygwin
 
-uninstall-lib: 
-       rm -f $(MODULE_INSTALLDIR)/$(SHLIB)
-       rm -f $(MODULE_INSTALLDIR)/$(SHLIB_MAJOR)
-       rm -f $(MODULE_INSTALLDIR)/$(SHLIB_BARE)
+uninstall-lwgeom-lib: 
+       rm -f $(DESTDIR)$(MODULE_INSTALLDIR)/$(SHLIB)
+       rm -f $(DESTDIR)$(MODULE_INSTALLDIR)/$(SHLIB_MAJOR)
+       rm -f $(DESTDIR)$(MODULE_INSTALLDIR)/$(SHLIB_BARE)
 
 #----------------------------------------------------------
 
@@ -172,15 +164,15 @@ detect_geos_version:
        sh ../geos_version.sh $(GEOS_DIR) > postgis_geos_version.h
 
 uninstall-lwgeom-scripts:
-       rm -f $(datadir)/postgis/lwpostgis.sql
-       rm -f $(datadir)/postgis/spatial_ref_sys.sql
+       rm -f $(DESTDIR)$(datadir)/postgis/lwpostgis.sql
+       rm -f $(DESTDIR)$(datadir)/postgis/spatial_ref_sys.sql
 
-uninstall: uninstall-lib uninstall-lwgeom-scripts
+uninstall: uninstall-lwgeom-lib uninstall-lwgeom-scripts
 
-clean-lib:
+clean-lwgeom-lib:
        rm -f $(SHLIB) $(SHLIB_MAJOR) $(SHLIB_BARE)
 
-clean distclean: clean-lib
+clean distclean: clean-lwgeom-lib
        rm -f *.o *.so *.a test $(OTHERS)
 
 maintainer-clean: clean