Blob Blame History Raw
commit cddd55cee11a854f84db7257db73318a5c181f7f
Author: Fabrice Bellet <fabrice@bellet.info>
Date:   Thu Jul 7 22:31:19 2011 +0200

    Build a shared version of simgear. Use the --allow-shlib-undefined flag
    to allow linking executables with libraries containing unresolved
    symbols.

diff --git a/Makefile.am b/Makefile.am
index 24cddec..fcaebb8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,5 @@
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+
 EXTRA_DIST = \
 	acinclude.m4 \
 	autogen.sh \
diff --git a/autogen.sh b/autogen.sh
index 84bbd42..ae08d62 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -17,6 +17,9 @@ echo -n " automake: `automake --version | head -1 | awk '{print $4}'`"
 echo " ($AUTO_MAKE_VERSION)"
 echo ""
 
+echo "Running libtoolize --force"
+libtoolize --force
+
 echo "Running aclocal"
 aclocal
 
diff --git a/configure.ac b/configure.ac
index 28e846c..35c5b0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,8 @@ dnl Ensure touching the version causes autoconf to re-run
 AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/version'])
 
 AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
+AC_PROG_LIBTOOL
+AC_CONFIG_MACRO_DIR([m4])
 
 dnl Require at least automake 2.52
 AC_PREREQ(2.52)
@@ -48,7 +50,6 @@ AC_PROG_CC
 AC_PROG_CPP
 AC_PROG_CXX
 AC_PROG_CXXCPP
-AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_PROG_LN_S
 AX_BOOST_BASE([1.37.0])
diff --git a/simgear/bucket/Makefile.am b/simgear/bucket/Makefile.am
index d1f7b69..df5d29f 100644
--- a/simgear/bucket/Makefile.am
+++ b/simgear/bucket/Makefile.am
@@ -1,10 +1,11 @@
 includedir = @includedir@/bucket
 
-lib_LIBRARIES = libsgbucket.a
+lib_LTLIBRARIES = libsgbucket.la
 
 include_HEADERS = newbucket.hxx
 
-libsgbucket_a_SOURCES = newbucket.cxx
+libsgbucket_la_SOURCES = newbucket.cxx
+libsgbucket_la_LDFLAGS = -release @VERSION@ -module
 
 # noinst_PROGRAMS = testbucket
 
diff --git a/simgear/debug/Makefile.am b/simgear/debug/Makefile.am
index cdfba79..1e0d912 100644
--- a/simgear/debug/Makefile.am
+++ b/simgear/debug/Makefile.am
@@ -2,10 +2,11 @@ includedir = @includedir@/debug
 
 EXTRA_DIST = logtest.cxx
 
-lib_LIBRARIES = libsgdebug.a
+lib_LTLIBRARIES = libsgdebug.la
 
 include_HEADERS = debug_types.h logstream.hxx
 
-libsgdebug_a_SOURCES = logstream.cxx
+libsgdebug_la_SOURCES = logstream.cxx
+libsgdebug_la_LDFLAGS = -release @VERSION@ -module
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/environment/Makefile.am b/simgear/environment/Makefile.am
index 92f0fe0..7e5a1c1 100644
--- a/simgear/environment/Makefile.am
+++ b/simgear/environment/Makefile.am
@@ -1,9 +1,10 @@
 includedir = @includedir@/environment
 
-lib_LIBRARIES = libsgenvironment.a
+lib_LTLIBRARIES = libsgenvironment.la
 
 include_HEADERS = metar.hxx precipitation.hxx visual_enviro.hxx
 
-libsgenvironment_a_SOURCES = metar.cxx precipitation.cxx
+libsgenvironment_la_SOURCES = metar.cxx precipitation.cxx
+libsgenvironment_la_LDFLAGS = -release @VERSION@ -module
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/ephemeris/Makefile.am b/simgear/ephemeris/Makefile.am
index c6ea748..c567bd4 100644
--- a/simgear/ephemeris/Makefile.am
+++ b/simgear/ephemeris/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/ephemeris
 
-lib_LIBRARIES = libsgephem.a
+lib_LTLIBRARIES = libsgephem.la
 
 include_HEADERS = \
 	celestialBody.hxx \
@@ -16,7 +16,7 @@ include_HEADERS = \
 	uranus.hxx \
 	venus.hxx
 
-libsgephem_a_SOURCES = \
+libsgephem_la_SOURCES = \
 	celestialBody.cxx \
 	ephemeris.cxx \
 	jupiter.cxx \
@@ -31,4 +31,6 @@ libsgephem_a_SOURCES = \
 	uranus.cxx \
 	venus.cxx
 
+libsgephem_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/io/Makefile.am b/simgear/io/Makefile.am
index 566af47..db72183 100644
--- a/simgear/io/Makefile.am
+++ b/simgear/io/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/io
 
-lib_LIBRARIES = libsgio.a
+lib_LTLIBRARIES = libsgio.la
 
 include_HEADERS = \
 	iochannel.hxx \
@@ -15,7 +15,7 @@ include_HEADERS = \
 	sg_netChannel.hxx \
 	sg_netChat.hxx
 
-libsgio_a_SOURCES = \
+libsgio_la_SOURCES = \
 	iochannel.cxx \
 	lowlevel.cxx \
 	sg_binobj.cxx \
@@ -28,61 +28,73 @@ libsgio_a_SOURCES = \
 	sg_netChannel.cxx \
 	sg_netChat.cxx
 
+libsgio_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
 
 noinst_PROGRAMS = decode_binobj socktest lowtest tcp_server tcp_client
 
 tcp_server_SOURCES = tcp_server.cxx
 
+tcp_server_LDFLAGS = -Wl,--allow-shlib-undefined
+
 tcp_server_LDADD = \
-	libsgio.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/bucket/libsgbucket.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
+	$(top_builddir)/simgear/io/libsgio.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/bucket/libsgbucket.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
 	-lz \
 	$(network_LIBS) \
 	$(base_LIBS)
 
 tcp_client_SOURCES = tcp_client.cxx
 
+tcp_client_LDFLAGS = -Wl,--allow-shlib-undefined
+
 tcp_client_LDADD = \
-	libsgio.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/bucket/libsgbucket.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
+	$(top_builddir)/simgear/io/libsgio.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/bucket/libsgbucket.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
 	-lz \
 	$(network_LIBS) \
 	$(base_LIBS)
 
 socktest_SOURCES = socktest.cxx
 
+socktest_LDFLAGS = -Wl,--allow-shlib-undefined
+
 socktest_LDADD = \
-	libsgio.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/bucket/libsgbucket.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
+	$(top_builddir)/simgear/io/libsgio.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/bucket/libsgbucket.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
     -lz \
 	$(network_LIBS) \
 	$(base_LIBS) 
 
 lowtest_SOURCES = lowtest.cxx
 
+lowtest_LDFLAGS = -Wl,--allow-shlib-undefined
+
 lowtest_LDADD = \
-	libsgio.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/bucket/libsgbucket.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
+	$(top_builddir)/simgear/io/libsgio.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/bucket/libsgbucket.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
 	$(base_LIBS) -lz
 
 decode_binobj_SOURCES = decode_binobj.cxx
 
+decode_binobj_LDFLAGS = -Wl,--allow-shlib-undefined
+
 decode_binobj_LDADD = \
-	libsgio.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/bucket/libsgbucket.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
+	$(top_builddir)/simgear/io/libsgio.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/bucket/libsgbucket.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
 	$(base_LIBS) -lz
diff --git a/simgear/magvar/Makefile.am b/simgear/magvar/Makefile.am
index 2c78c2f..7d3121e 100644
--- a/simgear/magvar/Makefile.am
+++ b/simgear/magvar/Makefile.am
@@ -1,17 +1,21 @@
 includedir = @includedir@/magvar
 
-lib_LIBRARIES = libsgmagvar.a
+lib_LTLIBRARIES = libsgmagvar.la
 
 include_HEADERS = magvar.hxx coremag.hxx
 
-libsgmagvar_a_SOURCES = coremag.cxx magvar.cxx
+libsgmagvar_la_SOURCES = coremag.cxx magvar.cxx
+
+libsgmagvar_la_LDFLAGS = -release @VERSION@ -module
 
 noinst_PROGRAMS = testmagvar
 
 testmagvar_SOURCES = testmagvar.cxx
 
+testmagvar_LDFLAGS = -Wl,--allow-shlib-undefined
+
 testmagvar_LDADD = \
-	libsgmagvar.a \
+	$(top_builddir)/simgear/magvar/libsgmagvar.la \
 	$(base_LIBS)
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/math/Makefile.am b/simgear/math/Makefile.am
index 4418aeb..c534813 100644
--- a/simgear/math/Makefile.am
+++ b/simgear/math/Makefile.am
@@ -5,21 +5,25 @@ TESTS           = $(check_PROGRAMS)
 
 SGMathTest_SOURCES = SGMathTest.cxx
 
+SGMathTest_LDFLAGS = -Wl,--allow-shlib-undefined
+
 SGMathTest_LDADD = \
-	libsgmath.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
+	$(top_builddir)/simgear/math/libsgmath.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
 	$(base_LIBS)
 
 SGGeometryTest_SOURCES = SGGeometryTest.cxx
 
+SGGeometryTest_LDFLAGS = -Wl,--allow-shlib-undefined
+
 SGGeometryTest_LDADD = \
-	libsgmath.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
+	$(top_builddir)/simgear/math/libsgmath.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
 	$(base_LIBS)
 
-lib_LIBRARIES = libsgmath.a
+lib_LTLIBRARIES = libsgmath.la
 
 include_HEADERS = \
 	interpolater.hxx \
@@ -53,7 +57,7 @@ include_HEADERS = \
 	beziercurve.hxx \
 	project.hxx
 
-libsgmath_a_SOURCES = \
+libsgmath_la_SOURCES = \
 	interpolater.cxx \
 	leastsqs.cxx \
 	sg_random.c \
@@ -61,4 +65,6 @@ libsgmath_a_SOURCES = \
 	SGGeodesy.cxx \
 	project.cxx
 
+libsgmath_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/misc/Makefile.am b/simgear/misc/Makefile.am
index ae696e7..9e24efe 100644
--- a/simgear/misc/Makefile.am
+++ b/simgear/misc/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/misc
 
-lib_LIBRARIES = libsgmisc.a
+lib_LTLIBRARIES = libsgmisc.la
 
 include_HEADERS = \
 	sg_path.hxx \
@@ -17,7 +17,7 @@ include_HEADERS = \
 	ResourceManager.hxx \
 	sg_sleep.hxx
 
-libsgmisc_a_SOURCES = \
+libsgmisc_la_SOURCES = \
 	sg_path.cxx \
 	sgstream.cxx \
 	strutils.cxx \
@@ -30,6 +30,8 @@ libsgmisc_a_SOURCES = \
 	ResourceManager.cxx \
 	sg_sleep.cxx
 
+libsgmisc_la_LDFLAGS = -release @VERSION@ -module
+
 #noinst_PROGRAMS = tabbed_value_test swap_test
 
 #tabbed_value_test_SOURCES = tabbed_values_test.cxx
@@ -38,12 +40,6 @@ libsgmisc_a_SOURCES = \
 #	$(top_builddir)/simgear/xml/libsgxml.a \
 #	$(top_builddir)/simgear/debug/libsgdebug.a
 
-$(top_builddir)/simgear/xml/libsgxml.a:
-	cd $(top_builddir)/simgear/xml && $(MAKE) $(AM_MAKEFLAGS) libsgxml.a
-
-$(top_builddir)/simgear/debug/libsgdebug.a:
-	cd $(top_builddir)/simgear/debug && $(MAKE) $(AM_MAKEFLAGS) libsgdebug.a
-
 #swap_test_SOURCES = swap_test.cpp
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/nasal/Makefile.am b/simgear/nasal/Makefile.am
index b83d473..16e4ee5 100644
--- a/simgear/nasal/Makefile.am
+++ b/simgear/nasal/Makefile.am
@@ -1,13 +1,15 @@
 includedir = @includedir@/nasal
 
-lib_LIBRARIES = libsgnasal.a
+lib_LTLIBRARIES = libsgnasal.la
 
 include_HEADERS = nasal.h naref.h
 
-libsgnasal_a_SOURCES = bitslib.c code.c code.h codegen.c data.h gc.c	\
+libsgnasal_la_SOURCES = bitslib.c code.c code.h codegen.c data.h gc.c	\
                        hash.c iolib.c iolib.h lex.c lib.c mathlib.c	\
                        misc.c naref.h nasal.h parse.c parse.h string.c	\
                        thread-posix.c thread-win32.c threadlib.c	\
                        utf8lib.c vector.c
 
+libsgnasal_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/props/Makefile.am b/simgear/props/Makefile.am
index 7196e8a..dc0b50c 100644
--- a/simgear/props/Makefile.am
+++ b/simgear/props/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/props
 
-lib_LIBRARIES = libsgprops.a
+lib_LTLIBRARIES = libsgprops.la
 
 include_HEADERS = \
 	condition.hxx \
@@ -11,37 +11,40 @@ include_HEADERS = \
 	propertyObject.hxx \
 	tiedpropertylist.hxx
 
-libsgprops_a_SOURCES = \
+libsgprops_la_SOURCES = \
 	condition.cxx \
 	props.cxx \
 	props_io.cxx \
 	AtomicChangeListener.cxx \
 	propertyObject.cxx
 
+libsgprops_la_LDFLAGS = -release @VERSION@ -module
+
 check_PROGRAMS = props_test propertyObject_test
 TESTS           = propertyObject_test
 
 props_test_SOURCES = props_test.cxx
+props_test_LDFLAGS = -Wl,--allow-shlib-undefined
 props_test_LDADD = \
-	libsgprops.a \
-	$(top_builddir)/simgear/xml/libsgxml.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a
+	$(top_builddir)/simgear/props/libsgprops.la \
+	$(top_builddir)/simgear/xml/libsgxml.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la
 
 propertyObject_test_SOURCES = propertyObject_test.cxx
+propertyObject_test_LDFLAGS = -Wl,--allow-shlib-undefined
 propertyObject_test_LDADD = \
-	libsgprops.a \
-	$(top_builddir)/simgear/xml/libsgxml.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a
-
+	$(top_builddir)/simgear/props/libsgprops.la \
+	$(top_builddir)/simgear/xml/libsgxml.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la
 
 if HAVE_FRAMEWORK_OSG
-props_test_LDFLAGS = $(openthreads_FRAMEWORK)
+props_test_LDADD += $(openthreads_FRAMEWORK)
 else
-props_test_LDFLAGS = -lOpenThreads
+props_test_LDADD += -lOpenThreads
 endif
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/route/Makefile.am b/simgear/route/Makefile.am
index 80a9ea6..2aaa176 100644
--- a/simgear/route/Makefile.am
+++ b/simgear/route/Makefile.am
@@ -1,35 +1,41 @@
 includedir = @includedir@/route
 
-lib_LIBRARIES = libsgroute.a
+lib_LTLIBRARIES = libsgroute.la
 
 include_HEADERS = route.hxx waypoint.hxx
 
-libsgroute_a_SOURCES = \
+libsgroute_la_SOURCES = \
 	route.cxx \
 	waypoint.cxx
 
+libsgroute_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
 
 noinst_PROGRAMS = waytest routetest
 
 waytest_SOURCES = waytest.cxx
 
+waytest_LDFLAGS = -Wl,--allow-shlib-undefined
+
 waytest_LDADD = \
-	libsgroute.a \
-	$(top_builddir)/simgear/math/libsgmath.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
-	$(top_builddir)/simgear/props/libsgprops.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/xml/libsgxml.a \
+	$(top_builddir)/simgear/route/libsgroute.la \
+	$(top_builddir)/simgear/math/libsgmath.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
+	$(top_builddir)/simgear/props/libsgprops.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/xml/libsgxml.la \
 	$(base_LIBS) \
 	-lz
 
 routetest_SOURCES = routetest.cxx
 
+routetest_LDFLAGS = -Wl,--allow-shlib-undefined
+
 routetest_LDADD = \
-	libsgroute.a \
-	$(top_builddir)/simgear/math/libsgmath.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
+	$(top_builddir)/simgear/route/libsgroute.la \
+	$(top_builddir)/simgear/math/libsgmath.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
 	$(base_LIBS)
diff --git a/simgear/scene/bvh/Makefile.am b/simgear/scene/bvh/Makefile.am
index 2e5389c..6464632 100644
--- a/simgear/scene/bvh/Makefile.am
+++ b/simgear/scene/bvh/Makefile.am
@@ -4,13 +4,17 @@ check_PROGRAMS  = bvhtest
 TESTS           = $(check_PROGRAMS)
 
 bvhtest_SOURCES = bvhtest.cxx
-bvhtest_LDADD = libsgbvh.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
+
+bvhtest_LDFLAGS = -Wl,--allow-shlib-undefined
+
+bvhtest_LDADD = \
+	$(top_builddir)/simgear/scene/bvh/libsgbvh.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
 	$(base_LIBS)
 
 
-lib_LIBRARIES = libsgbvh.a
+lib_LTLIBRARIES = libsgbvh.la
 
 noinst_HEADERS =
 
@@ -34,7 +38,7 @@ include_HEADERS = \
 	BVHTransform.hxx \
 	BVHVisitor.hxx
 
-libsgbvh_a_SOURCES = \
+libsgbvh_la_SOURCES = \
 	BVHGroup.cxx \
 	BVHLineGeometry.cxx \
 	BVHLineSegmentVisitor.cxx \
@@ -48,4 +52,6 @@ libsgbvh_a_SOURCES = \
 	BVHSubTreeCollector.cxx \
 	BVHTransform.cxx
 
+libsgbvh_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/scene/material/Makefile.am b/simgear/scene/material/Makefile.am
index 2d46826..1032f9f 100644
--- a/simgear/scene/material/Makefile.am
+++ b/simgear/scene/material/Makefile.am
@@ -1,37 +1,39 @@
-includedir = @includedir@/scene/material
-
-lib_LIBRARIES = libsgmaterial.a
-
-noinst_HEADERS =
-
-include_HEADERS = \
-	Effect.hxx \
-	EffectBuilder.hxx \
-	EffectCullVisitor.hxx \
-	EffectGeode.hxx \
-	GLPredicate.hxx \
-	Pass.hxx \
-	Technique.hxx \
-	TextureBuilder.hxx \
-	mat.hxx \
-	matlib.hxx \
-	matmodel.hxx \
-	mipmap.hxx
-
-libsgmaterial_a_SOURCES = \
-	Effect.cxx \
-	EffectBuilder.cxx \
-	EffectCullVisitor.cxx \
-	EffectGeode.cxx \
-	GLPredicate.cxx \
-	Pass.cxx \
-	Technique.cxx \
-	TextureBuilder.cxx \
-	makeEffect.cxx \
-	mat.cxx \
-	matlib.cxx \
-	matmodel.cxx \
-	mipmap.cxx \
-	Noise.cxx Noise.hxx
-
-INCLUDES = -I$(top_srcdir)
+includedir = @includedir@/scene/material
+
+lib_LTLIBRARIES = libsgmaterial.la
+
+noinst_HEADERS =
+
+include_HEADERS = \
+	Effect.hxx \
+	EffectBuilder.hxx \
+	EffectCullVisitor.hxx \
+	EffectGeode.hxx \
+	GLPredicate.hxx \
+	Pass.hxx \
+	Technique.hxx \
+	TextureBuilder.hxx \
+	mat.hxx \
+	matlib.hxx \
+	matmodel.hxx \
+	mipmap.hxx
+
+libsgmaterial_la_SOURCES = \
+	Effect.cxx \
+	EffectBuilder.cxx \
+	EffectCullVisitor.cxx \
+	EffectGeode.cxx \
+	GLPredicate.cxx \
+	Pass.cxx \
+	Technique.cxx \
+	TextureBuilder.cxx \
+	makeEffect.cxx \
+	mat.cxx \
+	matlib.cxx \
+	matmodel.cxx \
+	mipmap.cxx \
+	Noise.cxx Noise.hxx
+
+libsgmaterial_la_LDFLAGS = -release @VERSION@ -module
+
+INCLUDES = -I$(top_srcdir)
diff --git a/simgear/scene/model/Makefile.am b/simgear/scene/model/Makefile.am
index b36ab83..e9a3b3b 100644
--- a/simgear/scene/model/Makefile.am
+++ b/simgear/scene/model/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/scene/model
 
-lib_LIBRARIES = libsgmodel.a
+lib_LTLIBRARIES = libsgmodel.la
 
 noinst_HEADERS =
 
@@ -26,7 +26,7 @@ include_HEADERS = \
 	SGTranslateTransform.hxx \
 	SGText.hxx
 
-libsgmodel_a_SOURCES = \
+libsgmodel_la_SOURCES = \
 	animation.cxx \
 	BoundingVolumeBuildVisitor.hxx \
 	particles.cxx \
@@ -49,4 +49,6 @@ libsgmodel_a_SOURCES = \
 	SGTranslateTransform.cxx \
 	SGText.cxx
 
+libsgmodel_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/scene/sky/Makefile.am b/simgear/scene/sky/Makefile.am
index 440cfb4..dd16a7d 100644
--- a/simgear/scene/sky/Makefile.am
+++ b/simgear/scene/sky/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/scene/sky
 
-lib_LIBRARIES = libsgsky.a
+lib_LTLIBRARIES = libsgsky.la
 
 include_HEADERS = \
 	cloud.hxx \
@@ -14,7 +14,7 @@ include_HEADERS = \
 	newcloud.hxx \
 	CloudShaderGeometry.hxx
 
-libsgsky_a_SOURCES = \
+libsgsky_la_SOURCES = \
 	cloud.cxx \
 	dome.cxx \
 	moon.cxx \
@@ -26,4 +26,6 @@ libsgsky_a_SOURCES = \
 	newcloud.cxx \
 	CloudShaderGeometry.cxx
 
+libsgsky_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/scene/tgdb/Makefile.am b/simgear/scene/tgdb/Makefile.am
index 3d05b27..85938ac 100644
--- a/simgear/scene/tgdb/Makefile.am
+++ b/simgear/scene/tgdb/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/scene/tgdb
 
-lib_LIBRARIES = libsgtgdb.a
+lib_LTLIBRARIES = libsgtgdb.la
 
 noinst_HEADERS =
 
@@ -24,7 +24,7 @@ include_HEADERS = \
 	TileCache.hxx \
 	TileEntry.hxx
 
-libsgtgdb_a_SOURCES = \
+libsgtgdb_la_SOURCES = \
 	apt_signs.cxx \
 	obj.cxx \
 	pt_lights.cxx \
@@ -40,4 +40,6 @@ libsgtgdb_a_SOURCES = \
 	TileEntry.cxx \
 	TreeBin.cxx TreeBin.hxx
 
+libsgtgdb_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/scene/tsync/Makefile.am b/simgear/scene/tsync/Makefile.am
index 4f338d0..d28dcb5 100644
--- a/simgear/scene/tsync/Makefile.am
+++ b/simgear/scene/tsync/Makefile.am
@@ -2,14 +2,15 @@ includedir = @includedir@/scene/tsync
 
 AM_CPPFLAGS = $(svn_CPPFLAGS)
 
-lib_LIBRARIES = libsgtsync.a
+lib_LTLIBRARIES = libsgtsync.la
 
 noinst_HEADERS =
 
 include_HEADERS = \
 	terrasync.hxx
 
-libsgtsync_a_SOURCES = \
+libsgtsync_la_SOURCES = \
 	terrasync.cxx
+libsgtsync_la_LDFLAGS = -release @VERSION@ -module
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/scene/util/Makefile.am b/simgear/scene/util/Makefile.am
index 376f72f..f3c8d5c 100644
--- a/simgear/scene/util/Makefile.am
+++ b/simgear/scene/util/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/scene/util
 
-lib_LIBRARIES = libsgutil.a
+lib_LTLIBRARIES = libsgutil.la
 
 noinst_HEADERS =
 
@@ -25,7 +25,7 @@ include_HEADERS = \
 	VectorArrayAdapter.hxx
 
 
-libsgutil_a_SOURCES = \
+libsgutil_la_SOURCES = \
 	SGEnlargeBoundingBox.cxx \
 	SGSceneFeatures.cxx \
 	SGSceneUserData.cxx \
@@ -39,4 +39,6 @@ libsgutil_a_SOURCES = \
 	QuadTreeBuilder.cxx \
 	UpdateOnceCallback.cxx
 
+libsgutil_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/screen/Makefile.am b/simgear/screen/Makefile.am
index 37eac01..7a46676 100644
--- a/simgear/screen/Makefile.am
+++ b/simgear/screen/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/screen
 
-lib_LIBRARIES = libsgscreen.a
+lib_LTLIBRARIES = libsgscreen.la
 
 EXTRA_DIST = jpgfactory.cxx jpgfactory.hxx
 
@@ -19,12 +19,13 @@ include_HEADERS = \
 	tr.h \
 	extensions.hxx
 
-libsgscreen_a_SOURCES = \
+libsgscreen_la_SOURCES = \
 	$(IMAGE_SERVER_SRCS) \
 	screen-dump.cxx \
 	tr.cxx \
 	extensions.cxx
 	
+libsgscreen_la_LDFLAGS = -release @VERSION@ -module
 
 INCLUDES = -I$(top_srcdir) -I$(top_builddir) 
 
diff --git a/simgear/serial/Makefile.am b/simgear/serial/Makefile.am
index 0cace19..1899ce2 100644
--- a/simgear/serial/Makefile.am
+++ b/simgear/serial/Makefile.am
@@ -1,17 +1,21 @@
 includedir = @includedir@/serial
 
-lib_LIBRARIES = libsgserial.a
+lib_LTLIBRARIES = libsgserial.la
 
 include_HEADERS = serial.hxx
 
-libsgserial_a_SOURCES = serial.cxx
+libsgserial_la_SOURCES = serial.cxx
+
+libsgserial_la_LDFLAGS = -release @VERSION@ -module
 
 noinst_PROGRAMS = testserial
 
 testserial_SOURCES = testserial.cxx
 
+testserial_LDFLAGS = -Wl,--allow-shlib-undefined
+
 testserial_LDADD = \
-	libsgserial.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a
+	$(top_builddir)/simgear/serial/libsgserial.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la
 
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/sound/Makefile.am b/simgear/sound/Makefile.am
index 7719f10..a492534 100644
--- a/simgear/sound/Makefile.am
+++ b/simgear/sound/Makefile.am
@@ -2,7 +2,7 @@ includedir = @includedir@/sound
 
 EXTRA_DIST = jet.wav
 
-lib_LIBRARIES = libsgsound.a
+lib_LTLIBRARIES = libsgsound.la
 
 noinst_HEADERS =
 
@@ -13,13 +13,15 @@ include_HEADERS = \
 	sample_queue.hxx \
 	xmlsound.hxx
 
-libsgsound_a_SOURCES = \
+libsgsound_la_SOURCES = \
 	soundmgr_openal.cxx \
 	sample_group.cxx \
 	sample_openal.cxx  \
 	sample_queue.cxx \
 	xmlsound.cxx
 
+libsgsound_la_LDFLAGS = -release @VERSION@ -module
+
 check_PROGRAMS = openal_test1 openal_test2 openal_test3 openal_test4
 
 openal_test1_SOURCES = openal_test1.cxx
@@ -27,35 +29,40 @@ openal_test2_SOURCES = openal_test2.cxx
 openal_test3_SOURCES = openal_test3.cxx
 openal_test4_SOURCES = openal_test4.cxx
 
+openal_test1_LDFLAGS = -Wl,--allow-shlib-undefined
+openal_test2_LDFLAGS = -Wl,--allow-shlib-undefined
+openal_test3_LDFLAGS = -Wl,--allow-shlib-undefined
+openal_test4_LDFLAGS = -Wl,--allow-shlib-undefined
+
 openal_test1_LDADD = \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
+	$(top_builddir)/simgear/sound/libsgdebug.la \
 	$(openal_LIBS)
 
 openal_test2_LDADD = \
-	libsgsound.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/timing/libsgtiming.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
-	$(top_builddir)/simgear/math/libsgmath.a \
+	$(top_builddir)/simgear/sound/libsgsound.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/timing/libsgtiming.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
+	$(top_builddir)/simgear/math/libsgmath.la \
 	$(openal_LIBS)
 
 openal_test3_LDADD = \
-	libsgsound.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-	$(top_builddir)/simgear/timing/libsgtiming.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
-	$(top_builddir)/simgear/math/libsgmath.a \
+	$(top_builddir)/simgear/sound/libsgsound.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/timing/libsgtiming.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
+	$(top_builddir)/simgear/math/libsgmath.la \
 	$(openal_LIBS) -lstdc++
 
 openal_test4_LDADD = \
-	libsgsound.a \
-	$(top_builddir)/simgear/structure/libsgstructure.a \
-        $(top_builddir)/simgear/timing/libsgtiming.a \
-	$(top_builddir)/simgear/debug/libsgdebug.a \
-	$(top_builddir)/simgear/misc/libsgmisc.a \
-	$(top_builddir)/simgear/math/libsgmath.a \
+	$(top_builddir)/simgear/sound/libsgsound.la \
+	$(top_builddir)/simgear/structure/libsgstructure.la \
+	$(top_builddir)/simgear/timing/libsgtiming.la \
+	$(top_builddir)/simgear/debug/libsgdebug.la \
+	$(top_builddir)/simgear/misc/libsgmisc.la \
+	$(top_builddir)/simgear/math/libsgmath.la \
 	$(openal_LIBS) -lstdc++
 
 INCLUDES = -I$(top_srcdir) -DSRC_DIR=\"$(top_srcdir)/simgear/sound\"
diff --git a/simgear/structure/Makefile.am b/simgear/structure/Makefile.am
index 7311a54..c94ab43 100644
--- a/simgear/structure/Makefile.am
+++ b/simgear/structure/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/structure
 
-lib_LIBRARIES = libsgstructure.a
+lib_LTLIBRARIES = libsgstructure.la
 
 include_HEADERS = \
 	callback.hxx \
@@ -23,7 +23,7 @@ include_HEADERS = \
 	Singleton.hxx \
 	StringTable.hxx
 
-libsgstructure_a_SOURCES = \
+libsgstructure_la_SOURCES = \
 	commands.cxx \
 	exception.cxx \
 	event_mgr.cxx\
@@ -36,5 +36,7 @@ libsgstructure_a_SOURCES = \
 	SGSmplstat.cxx \
 	StringTable.cxx
 
+libsgstructure_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
 
diff --git a/simgear/threads/Makefile.am b/simgear/threads/Makefile.am
index 86af31a..acf3f81 100644
--- a/simgear/threads/Makefile.am
+++ b/simgear/threads/Makefile.am
@@ -1,16 +1,18 @@
 includedir = @includedir@/threads
 
 if HAVE_THREADS
-lib_LIBRARIES = libsgthreads.a
+lib_LTLIBRARIES = libsgthreads.la
 
 include_HEADERS = \
 	SGGuard.hxx \
 	SGQueue.hxx \
 	SGThread.hxx
 
-libsgthreads_a_SOURCES = \
+libsgthreads_la_SOURCES = \
 	SGThread.cxx
 
+libsgthreads_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
 else
 include_HEADERS = SGQueue.hxx
diff --git a/simgear/timing/Makefile.am b/simgear/timing/Makefile.am
index 6a45c62..088db3b 100644
--- a/simgear/timing/Makefile.am
+++ b/simgear/timing/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/timing
 
-lib_LIBRARIES = libsgtiming.a
+lib_LTLIBRARIES = libsgtiming.la
 
 include_HEADERS = \
 	lowleveltime.h \
@@ -8,10 +8,12 @@ include_HEADERS = \
 	timestamp.hxx \
 	timezone.h
 
-libsgtiming_a_SOURCES = \
+libsgtiming_la_SOURCES = \
 	lowleveltime.cxx \
 	sg_time.cxx \
 	timestamp.cxx \
 	timezone.cxx
 
+libsgtiming_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)
diff --git a/simgear/xml/Makefile.am b/simgear/xml/Makefile.am
index 274f97e..9d754e9 100644
--- a/simgear/xml/Makefile.am
+++ b/simgear/xml/Makefile.am
@@ -1,6 +1,6 @@
 includedir = @includedir@/xml
 
-lib_LIBRARIES = libsgxml.a
+lib_LTLIBRARIES = libsgxml.la
 
 include_HEADERS = \
 	easyxml.hxx
@@ -8,7 +8,7 @@ include_HEADERS = \
 noinst_HEADERS = \
 	xmltok_impl.c xmltok_ns.c
 
-libsgxml_a_SOURCES = \
+libsgxml_la_SOURCES = \
 	asciitab.h \
 	easyxml.cxx \
 	hashtable.h hashtable.c \
@@ -18,4 +18,6 @@ libsgxml_a_SOURCES = \
 	xmltok.h xmltok.c \
 	xmltok_impl.h
 
+libsgxml_la_LDFLAGS = -release @VERSION@ -module
+
 INCLUDES = -I$(top_srcdir)