From ccd51c65b1bf9194ce434652b322af2dd7579ba4 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Sat, 4 Jun 2005 10:06:14 +0000 Subject: [PATCH] Applied Alex Bodnaru patch for pgsql source tree dependency drop. git-svn-id: http://svn.osgeo.org/postgis/trunk@1733 b70326c6-7e19-0410-871a-916f4a2858ee --- Makefile | 13 ++++-- Makefile.config.in | 3 +- configure.in | 100 ++++++++++++++++++++++++++++++++++++++++++--- doc/Makefile | 20 ++++----- jdbc2/Makefile | 21 +--------- loader/Makefile | 12 +++--- lwgeom/Makefile | 56 +++++++++++-------------- 7 files changed, 147 insertions(+), 78 deletions(-) diff --git a/Makefile b/Makefile index 7033afd89..41cc76dfa 100644 --- 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 diff --git a/Makefile.config.in b/Makefile.config.in index 3b47a003d..d1875b541 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -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 # diff --git a/configure.in b/configure.in index 99b8483ca..edf4a259c 100644 --- a/configure.in +++ b/configure.in @@ -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 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]) diff --git a/doc/Makefile b/doc/Makefile index b42aff660..f59aeca20 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -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 diff --git a/jdbc2/Makefile b/jdbc2/Makefile index ebb1fc04e..0124eba3c 100644 --- a/jdbc2/Makefile +++ b/jdbc2/Makefile @@ -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 diff --git a/loader/Makefile b/loader/Makefile index abbd78f75..2aede61fa 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -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) diff --git a/lwgeom/Makefile b/lwgeom/Makefile index 7cb796599..25644b9f8 100644 --- a/lwgeom/Makefile +++ b/lwgeom/Makefile @@ -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 -- 2.50.1