From e5152c02d6c2be4ca2867fabe00eb70763f3de33 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Sat, 6 Aug 2011 15:12:32 +0000 Subject: [PATCH] Use libtool to build liblwgeom. Still only static. [RT-SIGTA] git-svn-id: http://svn.osgeo.org/postgis/trunk@7699 b70326c6-7e19-0410-871a-916f4a2858ee --- .gitignore | 3 +++ configure.ac | 2 +- liblwgeom/Makefile.in | 19 +++++++++++++++++-- liblwgeom/cunit/Makefile.in | 4 ++-- loader/Makefile.in | 2 +- loader/cunit/Makefile.in | 2 +- postgis/Makefile.in | 4 ++-- 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 2e282bc56..a4c85cfcf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ *.a +*.la +.libs +*.lo aclocal.m4 autom4te.cache/ config.guess diff --git a/configure.ac b/configure.ac index 9a679c6b3..8ec37efad 100644 --- a/configure.ac +++ b/configure.ac @@ -777,7 +777,7 @@ if test "x$RASTER" = "xraster"; then dnl # { dnl ================================================ POSTGIS_SRCDIR=`$PWDREGRESS` LIBLWGEOM_CFLAGS="-I${POSTGIS_SRCDIR}/liblwgeom" - LIBLWGEOM_LDFLAGS="${POSTGIS_SRCDIR}/liblwgeom/liblwgeom.a" + LIBLWGEOM_LDFLAGS="${POSTGIS_SRCDIR}/liblwgeom/.libs/liblwgeom.a" AC_SUBST([POSTGIS_SRCDIR]) AC_SUBST([LIBLWGEOM_CFLAGS]) diff --git a/liblwgeom/Makefile.in b/liblwgeom/Makefile.in index bd3eef91a..f003938ec 100644 --- a/liblwgeom/Makefile.in +++ b/liblwgeom/Makefile.in @@ -14,6 +14,9 @@ CC = @CC@ CFLAGS = @CFLAGS@ @PICFLAGS@ @WARNFLAGS@ @GEOS_CPPFLAGS@ LDFLAGS = @GEOS_LDFLAGS@ -lgeos_c NUMERICFLAGS = @NUMERICFLAGS@ +top_builddir = @top_builddir@ +LIBTOOL = @LIBTOOL@ + YACC=@YACC@ LEX=@LEX@ @@ -80,11 +83,16 @@ SA_HEADERS = \ libtgeom.h \ lwgeom_geos.h -all: liblwgeom.a +LT_OBJS = $(SA_OBJS:.o=.lo) $(NM_OBJS:.o=.lo) + +all: liblwgeom.la # nothing to install or uninstall install uninstall: +liblwgeom.la: $(LT_OBJS) $(SA_HEADERS) + $(LIBTOOL) --mode=link $(CC) -o liblwgeom.la $(LT_OBJS) + liblwgeom.a: $(SA_OBJS) $(NM_OBJS) $(SA_HEADERS) ar rs liblwgeom.a $(SA_OBJS) $(NM_OBJS) @@ -98,13 +106,20 @@ clean: rm -f $(SA_OBJS) rm -f $(NM_OBJS) rm -f liblwgeom.a + rm -f $(LT_OBJS) + rm -f liblwgeom.la + rm -rf .libs # Nothing specific in distclean (will be done by clean) distclean: -check: liblwgeom.a +check: liblwgeom.la make -C cunit check +# Command to build each of the .lo files +$(LT_OBJS): %.lo: %.c + $(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o $@ $< + # Command to build each of the .o files $(SA_OBJS): %.o: %.c $(CC) $(CFLAGS) -c -o $@ $< diff --git a/liblwgeom/cunit/Makefile.in b/liblwgeom/cunit/Makefile.in index 990601952..9f9e132cd 100644 --- a/liblwgeom/cunit/Makefile.in +++ b/liblwgeom/cunit/Makefile.in @@ -56,8 +56,8 @@ check: cu_tester endif # Build the main unit test executable -cu_tester: ../liblwgeom.a $(OBJS) - $(CC) -o $@ $(OBJS) ../liblwgeom.a -lm $(CUNIT_LDFLAGS) $(LDFLAGS) +cu_tester: ../.libs/liblwgeom.a $(OBJS) + $(CC) -o $@ $(OBJS) ../.libs/liblwgeom.a -lm $(CUNIT_LDFLAGS) $(LDFLAGS) # Command to build each of the .o files $(OBJS): %.o: %.c diff --git a/loader/Makefile.in b/loader/Makefile.in index 643710d17..a31b59534 100644 --- a/loader/Makefile.in +++ b/loader/Makefile.in @@ -39,7 +39,7 @@ ICONV_LDFLAGS=@ICONV_LDFLAGS@ ICONV_CFLAGS=@ICONV_CFLAGS@ # liblwgeom -LIBLWGEOM=../liblwgeom/liblwgeom.a +LIBLWGEOM=../liblwgeom/.libs/liblwgeom.a # GTK includes and libraries GTK_CFLAGS = @GTK_CFLAGS@ @IGE_MAC_CFLAGS@ diff --git a/loader/cunit/Makefile.in b/loader/cunit/Makefile.in index 6ca57be42..f116fdaff 100644 --- a/loader/cunit/Makefile.in +++ b/loader/cunit/Makefile.in @@ -26,7 +26,7 @@ PGSQL_FE_CPPFLAGS=@PGSQL_FE_CPPFLAGS@ PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@ # liblwgeom -LIBLWGEOM=../../liblwgeom/liblwgeom.a +LIBLWGEOM=../../liblwgeom/.libs/liblwgeom.a # iconv flags ICONV_LDFLAGS=@ICONV_LDFLAGS@ diff --git a/postgis/Makefile.in b/postgis/Makefile.in index 542cddff0..d1ac6b32e 100644 --- a/postgis/Makefile.in +++ b/postgis/Makefile.in @@ -74,7 +74,7 @@ OBJS=$(PG_OBJS) # older version of PostGIS, rather than with the static liblwgeom.a # supplied with newer versions of PostGIS PG_CPPFLAGS+=@CPPFLAGS@ -I../liblwgeom -SHLIB_LINK+=@SHLIB_LINK@ ../liblwgeom/liblwgeom.a +SHLIB_LINK+=@SHLIB_LINK@ ../liblwgeom/.libs/liblwgeom.a # Extra files to remove during 'make clean' EXTRA_CLEAN=$(SQL_OBJS) @@ -107,7 +107,7 @@ endif # Make all PostGIS objects depend upon liblwgeom, so that if an underlying # change is made, a PostGIS rebuild is triggered. -$(PG_OBJS): ../liblwgeom/liblwgeom.a +$(PG_OBJS): ../liblwgeom/.libs/liblwgeom.a # Borrow the $libdir substitution from PGXS but customise by adding the version number %.sql: %.sql.in -- 2.50.0