[SCM] libbluray/upstream: Imported Upstream version 0.9.3

sramacher at users.alioth.debian.org sramacher at users.alioth.debian.org
Tue May 17 17:58:58 UTC 2016


The following commit has been merged in the upstream branch:
commit 105f60c81ae90569f9a56244ff2ddb06131a7634
Author: Sebastian Ramacher <sramacher at debian.org>
Date:   Tue May 17 19:26:33 2016 +0200

    Imported Upstream version 0.9.3

diff --git a/ChangeLog b/ChangeLog
index 545fb3f..28d8a0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2016-05-15: Version 0.9.3
+- Add bd_open_files(). This function deprecates old global file system hooks.
+- Add flag for on-disc menu support to DISC_INFO.
+- Add configure argument to disable building of JAR file.
+- Add missing player settings enums.
+- Update linux Java search path list and preferred JVM.
+- Enable UDF support by default.
+- Split developer tools from examples.
+- Improve BDJ_EVENT_CHAPTER triggering.
+- Improve main title detection.
+- Improve error resilience.
+- Improve BD-J compability.
+- Improve detecting of working aacs implementation.
+- Improve libmmbd support.
+- Fix BD-J media player stop().
+- Fix restoring playback rate with some BD-J discs.
+- Fix restoring suspended playback time position.
+- Fix current chapter lookup.
+- Fix lost key focus with multi-HScene discs.
+- Fix playback of discs without Top Menu title.
+- Fix caching of some BD-J files from UDF filesystem.
+- Fix stopping playback from HDMV menus.
+- Fix possible errors in win32 .iso image reading.
+- Fix undefined values in DISC_INFO.
+- Fix memory leaks.
+
 2015-12-01: Version 0.9.2
 - Add primary audio stream to bd_select_stream().
 - Improve error resilience.
diff --git a/Makefile.am b/Makefile.am
index 300deec..3a54bfc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -112,6 +112,8 @@ libbluray_la_SOURCES = \
 	src/util/attributes.h \
 	src/util/bits.h \
 	src/util/bits.c \
+	src/util/event_queue.h \
+	src/util/event_queue.c \
 	src/util/logging.h \
 	src/util/logging.c \
 	src/util/log_control.h \
@@ -186,10 +188,12 @@ endif
 
 
 if USING_BDJAVA
+if USING_BDJAVA_BUILD_JAR
 jardir=$(datadir)/java/
 jar_DATA=$(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar
 
 $(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar: all-local
+endif
 
 libbluray_la_SOURCES += \
 	src/libbluray/bdj/bdj.h \
@@ -214,6 +218,7 @@ libbluray_la_SOURCES += \
 
 AM_CFLAGS += $(BDJAVA_CFLAGS)
 
+if USING_BDJAVA_BUILD_JAR
 all-local:
 	ant -f $(top_srcdir)/src/libbluray/bdj/build.xml \
 	    -Dbuild='$(abs_builddir)/src/libbluray/bdj/build' \
@@ -229,6 +234,7 @@ clean-local:
 	    -Dversion='$(BDJ_TYPE)-$(VERSION)' \
 	    clean
 endif
+endif
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = src/libbluray.pc
@@ -266,20 +272,20 @@ bd_info_LDADD = libbluray.la
 bdsplice_SOURCES = src/examples/bdsplice.c
 bdsplice_LDADD = libbluray.la
 
-bdj_test_SOURCES = src/examples/bdj_test.c
+bdj_test_SOURCES = src/devtools/bdj_test.c
 bdj_test_LDADD = libbluray.la
 
-bdjo_dump_SOURCES = src/examples/bdjo_dump.c
+bdjo_dump_SOURCES = src/devtools/bdjo_dump.c
 bdjo_dump_LDADD = libbluray.la
 
 clpi_dump_CFLAGS = $(AM_CFLAGS)
 clpi_dump_SOURCES = \
-	src/examples/clpi_dump.c \
-	src/examples/util.c \
-	src/examples/util.h
+	src/devtools/clpi_dump.c \
+	src/devtools/util.c \
+	src/devtools/util.h
 clpi_dump_LDADD = libbluray.la
 
-hdmv_test_SOURCES = src/examples/hdmv_test.c
+hdmv_test_SOURCES = src/devtools/hdmv_test.c
 hdmv_test_LDADD = libbluray.la
 
 index_dump_SOURCES = src/examples/index_dump.c
@@ -292,15 +298,15 @@ list_titles_SOURCES = src/examples/list_titles.c
 list_titles_LDADD = libbluray.la
 
 mobj_dump_CFLAGS = $(AM_CFLAGS)
-mobj_dump_SOURCES = src/examples/mobj_dump.c \
+mobj_dump_SOURCES = src/devtools/mobj_dump.c \
 	src/libbluray/hdmv/mobj_print.c
 mobj_dump_LDADD = libbluray.la
 
 mpls_dump_CFLAGS = $(AM_CFLAGS)
 mpls_dump_SOURCES = \
-	src/examples/mpls_dump.c \
-	src/examples/util.c \
-	src/examples/util.h
+	src/devtools/mpls_dump.c \
+	src/devtools/util.c \
+	src/devtools/util.h
 mpls_dump_LDADD = libbluray.la
 
 sound_dump_SOURCES = src/examples/sound_dump.c
diff --git a/Makefile.in b/Makefile.in
index e8ec6c2..687f6cb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -309,11 +309,12 @@ am__libbluray_la_SOURCES_DIST = src/file/dirs.h src/file/dl.h \
 	src/libbluray/hdmv/mobj_print.h \
 	src/libbluray/hdmv/mobj_print.c src/util/array.h \
 	src/util/array.c src/util/attributes.h src/util/bits.h \
-	src/util/bits.c src/util/logging.h src/util/logging.c \
-	src/util/log_control.h src/util/macro.h src/util/mutex.h \
-	src/util/mutex.c src/util/refcnt.h src/util/refcnt.c \
-	src/util/strutl.h src/util/strutl.c src/util/time.h \
-	src/util/time.c src/file/dir_posix.c src/file/dirs_darwin.c \
+	src/util/bits.c src/util/event_queue.h src/util/event_queue.c \
+	src/util/logging.h src/util/logging.c src/util/log_control.h \
+	src/util/macro.h src/util/mutex.h src/util/mutex.c \
+	src/util/refcnt.h src/util/refcnt.c src/util/strutl.h \
+	src/util/strutl.c src/util/time.h src/util/time.c \
+	src/file/dir_posix.c src/file/dirs_darwin.c \
 	src/file/dl_posix.c src/file/file_posix.c \
 	src/file/mount_darwin.c src/file/dir_win32.c \
 	src/file/dirs_win32.c src/file/dl_win32.c \
@@ -396,10 +397,10 @@ am_libbluray_la_OBJECTS = src/file/file.lo src/file/filesystem.lo \
 	src/libbluray/disc/dec.lo src/libbluray/disc/disc.lo \
 	src/libbluray/hdmv/hdmv_vm.lo src/libbluray/hdmv/mobj_parse.lo \
 	src/libbluray/hdmv/mobj_print.lo src/util/array.lo \
-	src/util/bits.lo src/util/logging.lo src/util/mutex.lo \
-	src/util/refcnt.lo src/util/strutl.lo src/util/time.lo \
-	$(am__objects_1) $(am__objects_2) $(am__objects_3) \
-	$(am__objects_4) $(am__objects_5)
+	src/util/bits.lo src/util/event_queue.lo src/util/logging.lo \
+	src/util/mutex.lo src/util/refcnt.lo src/util/strutl.lo \
+	src/util/time.lo $(am__objects_1) $(am__objects_2) \
+	$(am__objects_3) $(am__objects_4) $(am__objects_5)
 libbluray_la_OBJECTS = $(am_libbluray_la_OBJECTS)
 AM_V_lt = $(am__v_lt_ at AM_V@)
 am__v_lt_ = $(am__v_lt_ at AM_DEFAULT_V@)
@@ -416,14 +417,14 @@ am__bd_info_SOURCES_DIST = src/examples/bd_info.c
 @USING_EXAMPLES_TRUE@	src/examples/bd_info.$(OBJEXT)
 bd_info_OBJECTS = $(am_bd_info_OBJECTS)
 @USING_EXAMPLES_TRUE at bd_info_DEPENDENCIES = libbluray.la
-am__bdj_test_SOURCES_DIST = src/examples/bdj_test.c
+am__bdj_test_SOURCES_DIST = src/devtools/bdj_test.c
 @USING_EXAMPLES_TRUE at am_bdj_test_OBJECTS =  \
- at USING_EXAMPLES_TRUE@	src/examples/bdj_test.$(OBJEXT)
+ at USING_EXAMPLES_TRUE@	src/devtools/bdj_test.$(OBJEXT)
 bdj_test_OBJECTS = $(am_bdj_test_OBJECTS)
 @USING_EXAMPLES_TRUE at bdj_test_DEPENDENCIES = libbluray.la
-am__bdjo_dump_SOURCES_DIST = src/examples/bdjo_dump.c
+am__bdjo_dump_SOURCES_DIST = src/devtools/bdjo_dump.c
 @USING_EXAMPLES_TRUE at am_bdjo_dump_OBJECTS =  \
- at USING_EXAMPLES_TRUE@	src/examples/bdjo_dump.$(OBJEXT)
+ at USING_EXAMPLES_TRUE@	src/devtools/bdjo_dump.$(OBJEXT)
 bdjo_dump_OBJECTS = $(am_bdjo_dump_OBJECTS)
 @USING_EXAMPLES_TRUE at bdjo_dump_DEPENDENCIES = libbluray.la
 am__bdsplice_SOURCES_DIST = src/examples/bdsplice.c
@@ -431,18 +432,18 @@ am__bdsplice_SOURCES_DIST = src/examples/bdsplice.c
 @USING_EXAMPLES_TRUE@	src/examples/bdsplice.$(OBJEXT)
 bdsplice_OBJECTS = $(am_bdsplice_OBJECTS)
 @USING_EXAMPLES_TRUE at bdsplice_DEPENDENCIES = libbluray.la
-am__clpi_dump_SOURCES_DIST = src/examples/clpi_dump.c \
-	src/examples/util.c src/examples/util.h
- at USING_EXAMPLES_TRUE@am_clpi_dump_OBJECTS = src/examples/clpi_dump-clpi_dump.$(OBJEXT) \
- at USING_EXAMPLES_TRUE@	src/examples/clpi_dump-util.$(OBJEXT)
+am__clpi_dump_SOURCES_DIST = src/devtools/clpi_dump.c \
+	src/devtools/util.c src/devtools/util.h
+ at USING_EXAMPLES_TRUE@am_clpi_dump_OBJECTS = src/devtools/clpi_dump-clpi_dump.$(OBJEXT) \
+ at USING_EXAMPLES_TRUE@	src/devtools/clpi_dump-util.$(OBJEXT)
 clpi_dump_OBJECTS = $(am_clpi_dump_OBJECTS)
 @USING_EXAMPLES_TRUE at clpi_dump_DEPENDENCIES = libbluray.la
 clpi_dump_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(clpi_dump_CFLAGS) \
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am__hdmv_test_SOURCES_DIST = src/examples/hdmv_test.c
+am__hdmv_test_SOURCES_DIST = src/devtools/hdmv_test.c
 @USING_EXAMPLES_TRUE at am_hdmv_test_OBJECTS =  \
- at USING_EXAMPLES_TRUE@	src/examples/hdmv_test.$(OBJEXT)
+ at USING_EXAMPLES_TRUE@	src/devtools/hdmv_test.$(OBJEXT)
 hdmv_test_OBJECTS = $(am_hdmv_test_OBJECTS)
 @USING_EXAMPLES_TRUE at hdmv_test_DEPENDENCIES = libbluray.la
 am__index_dump_SOURCES_DIST = src/examples/index_dump.c
@@ -460,19 +461,19 @@ am__list_titles_SOURCES_DIST = src/examples/list_titles.c
 @USING_EXAMPLES_TRUE@	src/examples/list_titles.$(OBJEXT)
 list_titles_OBJECTS = $(am_list_titles_OBJECTS)
 @USING_EXAMPLES_TRUE at list_titles_DEPENDENCIES = libbluray.la
-am__mobj_dump_SOURCES_DIST = src/examples/mobj_dump.c \
+am__mobj_dump_SOURCES_DIST = src/devtools/mobj_dump.c \
 	src/libbluray/hdmv/mobj_print.c
- at USING_EXAMPLES_TRUE@am_mobj_dump_OBJECTS = src/examples/mobj_dump-mobj_dump.$(OBJEXT) \
+ at USING_EXAMPLES_TRUE@am_mobj_dump_OBJECTS = src/devtools/mobj_dump-mobj_dump.$(OBJEXT) \
 @USING_EXAMPLES_TRUE@	src/libbluray/hdmv/mobj_dump-mobj_print.$(OBJEXT)
 mobj_dump_OBJECTS = $(am_mobj_dump_OBJECTS)
 @USING_EXAMPLES_TRUE at mobj_dump_DEPENDENCIES = libbluray.la
 mobj_dump_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mobj_dump_CFLAGS) \
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-am__mpls_dump_SOURCES_DIST = src/examples/mpls_dump.c \
-	src/examples/util.c src/examples/util.h
- at USING_EXAMPLES_TRUE@am_mpls_dump_OBJECTS = src/examples/mpls_dump-mpls_dump.$(OBJEXT) \
- at USING_EXAMPLES_TRUE@	src/examples/mpls_dump-util.$(OBJEXT)
+am__mpls_dump_SOURCES_DIST = src/devtools/mpls_dump.c \
+	src/devtools/util.c src/devtools/util.h
+ at USING_EXAMPLES_TRUE@am_mpls_dump_OBJECTS = src/devtools/mpls_dump-mpls_dump.$(OBJEXT) \
+ at USING_EXAMPLES_TRUE@	src/devtools/mpls_dump-util.$(OBJEXT)
 mpls_dump_OBJECTS = $(am_mpls_dump_OBJECTS)
 @USING_EXAMPLES_TRUE at mpls_dump_DEPENDENCIES = libbluray.la
 mpls_dump_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -669,6 +670,7 @@ LIBXML2_LIBS = @LIBXML2_LIBS@
 LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
 LT_VERSION_INFO = @LT_VERSION_INFO@
 MAKEINFO = @MAKEINFO@
 MANIFEST_TOOL = @MANIFEST_TOOL@
@@ -741,6 +743,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -845,12 +848,13 @@ libbluray_la_SOURCES = src/file/dirs.h src/file/dl.h src/file/file.h \
 	src/libbluray/hdmv/mobj_print.h \
 	src/libbluray/hdmv/mobj_print.c src/util/array.h \
 	src/util/array.c src/util/attributes.h src/util/bits.h \
-	src/util/bits.c src/util/logging.h src/util/logging.c \
-	src/util/log_control.h src/util/macro.h src/util/mutex.h \
-	src/util/mutex.c src/util/refcnt.h src/util/refcnt.c \
-	src/util/strutl.h src/util/strutl.c src/util/time.h \
-	src/util/time.c $(am__append_1) $(am__append_2) \
-	$(am__append_3) $(am__append_4) $(am__append_5)
+	src/util/bits.c src/util/event_queue.h src/util/event_queue.c \
+	src/util/logging.h src/util/logging.c src/util/log_control.h \
+	src/util/macro.h src/util/mutex.h src/util/mutex.c \
+	src/util/refcnt.h src/util/refcnt.c src/util/strutl.h \
+	src/util/strutl.c src/util/time.h src/util/time.c \
+	$(am__append_1) $(am__append_2) $(am__append_3) \
+	$(am__append_4) $(am__append_5)
 libbluray_la_LDFLAGS = -no-undefined -version-info $(LT_VERSION_INFO) -export-symbols-regex "^bd_"
 libbluray_la_LIBADD = $(LIBXML2_LIBS) $(FT2_LIBS) $(FONTCONFIG_LIBS)
 noinst_HEADERS = \
@@ -870,26 +874,26 @@ pkginclude_HEADERS = \
 	src/libbluray/decoders/overlay.h \
 	src/util/log_control.h
 
- at USING_BDJAVA_TRUE@jardir = $(datadir)/java/
- at USING_BDJAVA_TRUE@jar_DATA = $(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE at jardir = $(datadir)/java/
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE at jar_DATA = $(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = src/libbluray.pc
 @USING_EXAMPLES_TRUE at bd_info_SOURCES = src/examples/bd_info.c
 @USING_EXAMPLES_TRUE at bd_info_LDADD = libbluray.la
 @USING_EXAMPLES_TRUE at bdsplice_SOURCES = src/examples/bdsplice.c
 @USING_EXAMPLES_TRUE at bdsplice_LDADD = libbluray.la
- at USING_EXAMPLES_TRUE@bdj_test_SOURCES = src/examples/bdj_test.c
+ at USING_EXAMPLES_TRUE@bdj_test_SOURCES = src/devtools/bdj_test.c
 @USING_EXAMPLES_TRUE at bdj_test_LDADD = libbluray.la
- at USING_EXAMPLES_TRUE@bdjo_dump_SOURCES = src/examples/bdjo_dump.c
+ at USING_EXAMPLES_TRUE@bdjo_dump_SOURCES = src/devtools/bdjo_dump.c
 @USING_EXAMPLES_TRUE at bdjo_dump_LDADD = libbluray.la
 @USING_EXAMPLES_TRUE at clpi_dump_CFLAGS = $(AM_CFLAGS)
 @USING_EXAMPLES_TRUE at clpi_dump_SOURCES = \
- at USING_EXAMPLES_TRUE@	src/examples/clpi_dump.c \
- at USING_EXAMPLES_TRUE@	src/examples/util.c \
- at USING_EXAMPLES_TRUE@	src/examples/util.h
+ at USING_EXAMPLES_TRUE@	src/devtools/clpi_dump.c \
+ at USING_EXAMPLES_TRUE@	src/devtools/util.c \
+ at USING_EXAMPLES_TRUE@	src/devtools/util.h
 
 @USING_EXAMPLES_TRUE at clpi_dump_LDADD = libbluray.la
- at USING_EXAMPLES_TRUE@hdmv_test_SOURCES = src/examples/hdmv_test.c
+ at USING_EXAMPLES_TRUE@hdmv_test_SOURCES = src/devtools/hdmv_test.c
 @USING_EXAMPLES_TRUE at hdmv_test_LDADD = libbluray.la
 @USING_EXAMPLES_TRUE at index_dump_SOURCES = src/examples/index_dump.c
 @USING_EXAMPLES_TRUE at index_dump_LDADD = libbluray.la
@@ -898,15 +902,15 @@ pkgconfig_DATA = src/libbluray.pc
 @USING_EXAMPLES_TRUE at list_titles_SOURCES = src/examples/list_titles.c
 @USING_EXAMPLES_TRUE at list_titles_LDADD = libbluray.la
 @USING_EXAMPLES_TRUE at mobj_dump_CFLAGS = $(AM_CFLAGS)
- at USING_EXAMPLES_TRUE@mobj_dump_SOURCES = src/examples/mobj_dump.c \
+ at USING_EXAMPLES_TRUE@mobj_dump_SOURCES = src/devtools/mobj_dump.c \
 @USING_EXAMPLES_TRUE@	src/libbluray/hdmv/mobj_print.c
 
 @USING_EXAMPLES_TRUE at mobj_dump_LDADD = libbluray.la
 @USING_EXAMPLES_TRUE at mpls_dump_CFLAGS = $(AM_CFLAGS)
 @USING_EXAMPLES_TRUE at mpls_dump_SOURCES = \
- at USING_EXAMPLES_TRUE@	src/examples/mpls_dump.c \
- at USING_EXAMPLES_TRUE@	src/examples/util.c \
- at USING_EXAMPLES_TRUE@	src/examples/util.h
+ at USING_EXAMPLES_TRUE@	src/devtools/mpls_dump.c \
+ at USING_EXAMPLES_TRUE@	src/devtools/util.c \
+ at USING_EXAMPLES_TRUE@	src/devtools/util.h
 
 @USING_EXAMPLES_TRUE at mpls_dump_LDADD = libbluray.la
 @USING_EXAMPLES_TRUE at sound_dump_SOURCES = src/examples/sound_dump.c
@@ -1125,6 +1129,8 @@ src/util/array.lo: src/util/$(am__dirstamp) \
 	src/util/$(DEPDIR)/$(am__dirstamp)
 src/util/bits.lo: src/util/$(am__dirstamp) \
 	src/util/$(DEPDIR)/$(am__dirstamp)
+src/util/event_queue.lo: src/util/$(am__dirstamp) \
+	src/util/$(DEPDIR)/$(am__dirstamp)
 src/util/logging.lo: src/util/$(am__dirstamp) \
 	src/util/$(DEPDIR)/$(am__dirstamp)
 src/util/mutex.lo: src/util/$(am__dirstamp) \
@@ -1284,14 +1290,20 @@ src/examples/bd_info.$(OBJEXT): src/examples/$(am__dirstamp) \
 bd_info$(EXEEXT): $(bd_info_OBJECTS) $(bd_info_DEPENDENCIES) $(EXTRA_bd_info_DEPENDENCIES) 
 	@rm -f bd_info$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bd_info_OBJECTS) $(bd_info_LDADD) $(LIBS)
-src/examples/bdj_test.$(OBJEXT): src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
+src/devtools/$(am__dirstamp):
+	@$(MKDIR_P) src/devtools
+	@: > src/devtools/$(am__dirstamp)
+src/devtools/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) src/devtools/$(DEPDIR)
+	@: > src/devtools/$(DEPDIR)/$(am__dirstamp)
+src/devtools/bdj_test.$(OBJEXT): src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
 
 bdj_test$(EXEEXT): $(bdj_test_OBJECTS) $(bdj_test_DEPENDENCIES) $(EXTRA_bdj_test_DEPENDENCIES) 
 	@rm -f bdj_test$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bdj_test_OBJECTS) $(bdj_test_LDADD) $(LIBS)
-src/examples/bdjo_dump.$(OBJEXT): src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
+src/devtools/bdjo_dump.$(OBJEXT): src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
 
 bdjo_dump$(EXEEXT): $(bdjo_dump_OBJECTS) $(bdjo_dump_DEPENDENCIES) $(EXTRA_bdjo_dump_DEPENDENCIES) 
 	@rm -f bdjo_dump$(EXEEXT)
@@ -1302,17 +1314,17 @@ src/examples/bdsplice.$(OBJEXT): src/examples/$(am__dirstamp) \
 bdsplice$(EXEEXT): $(bdsplice_OBJECTS) $(bdsplice_DEPENDENCIES) $(EXTRA_bdsplice_DEPENDENCIES) 
 	@rm -f bdsplice$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(bdsplice_OBJECTS) $(bdsplice_LDADD) $(LIBS)
-src/examples/clpi_dump-clpi_dump.$(OBJEXT):  \
-	src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
-src/examples/clpi_dump-util.$(OBJEXT): src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
+src/devtools/clpi_dump-clpi_dump.$(OBJEXT):  \
+	src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
+src/devtools/clpi_dump-util.$(OBJEXT): src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
 
 clpi_dump$(EXEEXT): $(clpi_dump_OBJECTS) $(clpi_dump_DEPENDENCIES) $(EXTRA_clpi_dump_DEPENDENCIES) 
 	@rm -f clpi_dump$(EXEEXT)
 	$(AM_V_CCLD)$(clpi_dump_LINK) $(clpi_dump_OBJECTS) $(clpi_dump_LDADD) $(LIBS)
-src/examples/hdmv_test.$(OBJEXT): src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
+src/devtools/hdmv_test.$(OBJEXT): src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
 
 hdmv_test$(EXEEXT): $(hdmv_test_OBJECTS) $(hdmv_test_DEPENDENCIES) $(EXTRA_hdmv_test_DEPENDENCIES) 
 	@rm -f hdmv_test$(EXEEXT)
@@ -1335,9 +1347,9 @@ src/examples/list_titles.$(OBJEXT): src/examples/$(am__dirstamp) \
 list_titles$(EXEEXT): $(list_titles_OBJECTS) $(list_titles_DEPENDENCIES) $(EXTRA_list_titles_DEPENDENCIES) 
 	@rm -f list_titles$(EXEEXT)
 	$(AM_V_CCLD)$(LINK) $(list_titles_OBJECTS) $(list_titles_LDADD) $(LIBS)
-src/examples/mobj_dump-mobj_dump.$(OBJEXT):  \
-	src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
+src/devtools/mobj_dump-mobj_dump.$(OBJEXT):  \
+	src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
 src/libbluray/hdmv/mobj_dump-mobj_print.$(OBJEXT):  \
 	src/libbluray/hdmv/$(am__dirstamp) \
 	src/libbluray/hdmv/$(DEPDIR)/$(am__dirstamp)
@@ -1345,11 +1357,11 @@ src/libbluray/hdmv/mobj_dump-mobj_print.$(OBJEXT):  \
 mobj_dump$(EXEEXT): $(mobj_dump_OBJECTS) $(mobj_dump_DEPENDENCIES) $(EXTRA_mobj_dump_DEPENDENCIES) 
 	@rm -f mobj_dump$(EXEEXT)
 	$(AM_V_CCLD)$(mobj_dump_LINK) $(mobj_dump_OBJECTS) $(mobj_dump_LDADD) $(LIBS)
-src/examples/mpls_dump-mpls_dump.$(OBJEXT):  \
-	src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
-src/examples/mpls_dump-util.$(OBJEXT): src/examples/$(am__dirstamp) \
-	src/examples/$(DEPDIR)/$(am__dirstamp)
+src/devtools/mpls_dump-mpls_dump.$(OBJEXT):  \
+	src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
+src/devtools/mpls_dump-util.$(OBJEXT): src/devtools/$(am__dirstamp) \
+	src/devtools/$(DEPDIR)/$(am__dirstamp)
 
 mpls_dump$(EXEEXT): $(mpls_dump_OBJECTS) $(mpls_dump_DEPENDENCIES) $(EXTRA_mpls_dump_DEPENDENCIES) 
 	@rm -f mpls_dump$(EXEEXT)
@@ -1365,6 +1377,7 @@ mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
 	-rm -f contrib/libudfread/src/*.$(OBJEXT)
 	-rm -f contrib/libudfread/src/*.lo
+	-rm -f src/devtools/*.$(OBJEXT)
 	-rm -f src/examples/*.$(OBJEXT)
 	-rm -f src/file/*.$(OBJEXT)
 	-rm -f src/file/*.lo
@@ -1391,19 +1404,19 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at contrib/libudfread/src/$(DEPDIR)/default_blockinput.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at contrib/libudfread/src/$(DEPDIR)/ecma167.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at contrib/libudfread/src/$(DEPDIR)/udfread.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/bdj_test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/bdjo_dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/clpi_dump-util.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/hdmv_test.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/devtools/$(DEPDIR)/mpls_dump-util.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/bd_info.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/bdj_test.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/bdjo_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/bdsplice.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/clpi_dump-util.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/hdmv_test.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/index_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/libbluray_test.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/list_titles.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Po at am__quote@
- at AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/mpls_dump-util.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/examples/$(DEPDIR)/sound_dump.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/file/$(DEPDIR)/dir_posix.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/file/$(DEPDIR)/dir_win32.Plo at am__quote@
@@ -1458,6 +1471,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote at src/libbluray/hdmv/$(DEPDIR)/mobj_print.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/util/$(DEPDIR)/array.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/util/$(DEPDIR)/bits.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at src/util/$(DEPDIR)/event_queue.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/util/$(DEPDIR)/logging.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/util/$(DEPDIR)/mutex.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at src/util/$(DEPDIR)/refcnt.Plo at am__quote@
@@ -1488,47 +1502,47 @@ distclean-compile:
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(LTCOMPILE) -c -o $@ $<
 
-src/examples/clpi_dump-clpi_dump.o: src/examples/clpi_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/examples/clpi_dump-clpi_dump.o -MD -MP -MF src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Tpo -c -o src/examples/clpi_dump-clpi_dump.o `test -f 'src/examples/clpi_dump.c' || echo '$(srcdir)/'`src/examples/clpi_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Tpo src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/clpi_dump.c' object='src/examples/clpi_dump-clpi_dump.o' libtool=no @AMDEPBACKSLASH@
+src/devtools/clpi_dump-clpi_dump.o: src/devtools/clpi_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/devtools/clpi_dump-clpi_dump.o -MD -MP -MF src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Tpo -c -o src/devtools/clpi_dump-clpi_dump.o `test -f 'src/devtools/clpi_dump.c' || echo '$(srcdir)/'`src/devtools/clpi_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Tpo src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/clpi_dump.c' object='src/devtools/clpi_dump-clpi_dump.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/examples/clpi_dump-clpi_dump.o `test -f 'src/examples/clpi_dump.c' || echo '$(srcdir)/'`src/examples/clpi_dump.c
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/clpi_dump-clpi_dump.o `test -f 'src/devtools/clpi_dump.c' || echo '$(srcdir)/'`src/devtools/clpi_dump.c
 
-src/examples/clpi_dump-clpi_dump.obj: src/examples/clpi_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/examples/clpi_dump-clpi_dump.obj -MD -MP -MF src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Tpo -c -o src/examples/clpi_dump-clpi_dump.obj `if test -f 'src/examples/clpi_dump.c'; then $(CYGPATH_W) 'src/examples/clpi_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/clpi_dump.c'; fi`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Tpo src/examples/$(DEPDIR)/clpi_dump-clpi_dump.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/clpi_dump.c' object='src/examples/clpi_dump-clpi_dump.obj' libtool=no @AMDEPBACKSLASH@
+src/devtools/clpi_dump-clpi_dump.obj: src/devtools/clpi_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/devtools/clpi_dump-clpi_dump.obj -MD -MP -MF src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Tpo -c -o src/devtools/clpi_dump-clpi_dump.obj `if test -f 'src/devtools/clpi_dump.c'; then $(CYGPATH_W) 'src/devtools/clpi_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/clpi_dump.c'; fi`
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Tpo src/devtools/$(DEPDIR)/clpi_dump-clpi_dump.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/clpi_dump.c' object='src/devtools/clpi_dump-clpi_dump.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/examples/clpi_dump-clpi_dump.obj `if test -f 'src/examples/clpi_dump.c'; then $(CYGPATH_W) 'src/examples/clpi_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/clpi_dump.c'; fi`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/clpi_dump-clpi_dump.obj `if test -f 'src/devtools/clpi_dump.c'; then $(CYGPATH_W) 'src/devtools/clpi_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/clpi_dump.c'; fi`
 
-src/examples/clpi_dump-util.o: src/examples/util.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/examples/clpi_dump-util.o -MD -MP -MF src/examples/$(DEPDIR)/clpi_dump-util.Tpo -c -o src/examples/clpi_dump-util.o `test -f 'src/examples/util.c' || echo '$(srcdir)/'`src/examples/util.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/clpi_dump-util.Tpo src/examples/$(DEPDIR)/clpi_dump-util.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/util.c' object='src/examples/clpi_dump-util.o' libtool=no @AMDEPBACKSLASH@
+src/devtools/clpi_dump-util.o: src/devtools/util.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/devtools/clpi_dump-util.o -MD -MP -MF src/devtools/$(DEPDIR)/clpi_dump-util.Tpo -c -o src/devtools/clpi_dump-util.o `test -f 'src/devtools/util.c' || echo '$(srcdir)/'`src/devtools/util.c
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/clpi_dump-util.Tpo src/devtools/$(DEPDIR)/clpi_dump-util.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/util.c' object='src/devtools/clpi_dump-util.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/examples/clpi_dump-util.o `test -f 'src/examples/util.c' || echo '$(srcdir)/'`src/examples/util.c
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/clpi_dump-util.o `test -f 'src/devtools/util.c' || echo '$(srcdir)/'`src/devtools/util.c
 
-src/examples/clpi_dump-util.obj: src/examples/util.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/examples/clpi_dump-util.obj -MD -MP -MF src/examples/$(DEPDIR)/clpi_dump-util.Tpo -c -o src/examples/clpi_dump-util.obj `if test -f 'src/examples/util.c'; then $(CYGPATH_W) 'src/examples/util.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/util.c'; fi`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/clpi_dump-util.Tpo src/examples/$(DEPDIR)/clpi_dump-util.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/util.c' object='src/examples/clpi_dump-util.obj' libtool=no @AMDEPBACKSLASH@
+src/devtools/clpi_dump-util.obj: src/devtools/util.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -MT src/devtools/clpi_dump-util.obj -MD -MP -MF src/devtools/$(DEPDIR)/clpi_dump-util.Tpo -c -o src/devtools/clpi_dump-util.obj `if test -f 'src/devtools/util.c'; then $(CYGPATH_W) 'src/devtools/util.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/util.c'; fi`
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/clpi_dump-util.Tpo src/devtools/$(DEPDIR)/clpi_dump-util.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/util.c' object='src/devtools/clpi_dump-util.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/examples/clpi_dump-util.obj `if test -f 'src/examples/util.c'; then $(CYGPATH_W) 'src/examples/util.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/util.c'; fi`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(clpi_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/clpi_dump-util.obj `if test -f 'src/devtools/util.c'; then $(CYGPATH_W) 'src/devtools/util.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/util.c'; fi`
 
-src/examples/mobj_dump-mobj_dump.o: src/examples/mobj_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -MT src/examples/mobj_dump-mobj_dump.o -MD -MP -MF src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Tpo -c -o src/examples/mobj_dump-mobj_dump.o `test -f 'src/examples/mobj_dump.c' || echo '$(srcdir)/'`src/examples/mobj_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Tpo src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/mobj_dump.c' object='src/examples/mobj_dump-mobj_dump.o' libtool=no @AMDEPBACKSLASH@
+src/devtools/mobj_dump-mobj_dump.o: src/devtools/mobj_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -MT src/devtools/mobj_dump-mobj_dump.o -MD -MP -MF src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Tpo -c -o src/devtools/mobj_dump-mobj_dump.o `test -f 'src/devtools/mobj_dump.c' || echo '$(srcdir)/'`src/devtools/mobj_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Tpo src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/mobj_dump.c' object='src/devtools/mobj_dump-mobj_dump.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -c -o src/examples/mobj_dump-mobj_dump.o `test -f 'src/examples/mobj_dump.c' || echo '$(srcdir)/'`src/examples/mobj_dump.c
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/mobj_dump-mobj_dump.o `test -f 'src/devtools/mobj_dump.c' || echo '$(srcdir)/'`src/devtools/mobj_dump.c
 
-src/examples/mobj_dump-mobj_dump.obj: src/examples/mobj_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -MT src/examples/mobj_dump-mobj_dump.obj -MD -MP -MF src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Tpo -c -o src/examples/mobj_dump-mobj_dump.obj `if test -f 'src/examples/mobj_dump.c'; then $(CYGPATH_W) 'src/examples/mobj_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/mobj_dump.c'; fi`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Tpo src/examples/$(DEPDIR)/mobj_dump-mobj_dump.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/mobj_dump.c' object='src/examples/mobj_dump-mobj_dump.obj' libtool=no @AMDEPBACKSLASH@
+src/devtools/mobj_dump-mobj_dump.obj: src/devtools/mobj_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -MT src/devtools/mobj_dump-mobj_dump.obj -MD -MP -MF src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Tpo -c -o src/devtools/mobj_dump-mobj_dump.obj `if test -f 'src/devtools/mobj_dump.c'; then $(CYGPATH_W) 'src/devtools/mobj_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/mobj_dump.c'; fi`
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Tpo src/devtools/$(DEPDIR)/mobj_dump-mobj_dump.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/mobj_dump.c' object='src/devtools/mobj_dump-mobj_dump.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -c -o src/examples/mobj_dump-mobj_dump.obj `if test -f 'src/examples/mobj_dump.c'; then $(CYGPATH_W) 'src/examples/mobj_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/mobj_dump.c'; fi`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/mobj_dump-mobj_dump.obj `if test -f 'src/devtools/mobj_dump.c'; then $(CYGPATH_W) 'src/devtools/mobj_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/mobj_dump.c'; fi`
 
 src/libbluray/hdmv/mobj_dump-mobj_print.o: src/libbluray/hdmv/mobj_print.c
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -MT src/libbluray/hdmv/mobj_dump-mobj_print.o -MD -MP -MF src/libbluray/hdmv/$(DEPDIR)/mobj_dump-mobj_print.Tpo -c -o src/libbluray/hdmv/mobj_dump-mobj_print.o `test -f 'src/libbluray/hdmv/mobj_print.c' || echo '$(srcdir)/'`src/libbluray/hdmv/mobj_print.c
@@ -1544,33 +1558,33 @@ src/libbluray/hdmv/mobj_dump-mobj_print.obj: src/libbluray/hdmv/mobj_print.c
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mobj_dump_CFLAGS) $(CFLAGS) -c -o src/libbluray/hdmv/mobj_dump-mobj_print.obj `if test -f 'src/libbluray/hdmv/mobj_print.c'; then $(CYGPATH_W) 'src/libbluray/hdmv/mobj_print.c'; else $(CYGPATH_W) '$(srcdir)/src/libbluray/hdmv/mobj_print.c'; fi`
 
-src/examples/mpls_dump-mpls_dump.o: src/examples/mpls_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/examples/mpls_dump-mpls_dump.o -MD -MP -MF src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Tpo -c -o src/examples/mpls_dump-mpls_dump.o `test -f 'src/examples/mpls_dump.c' || echo '$(srcdir)/'`src/examples/mpls_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Tpo src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/mpls_dump.c' object='src/examples/mpls_dump-mpls_dump.o' libtool=no @AMDEPBACKSLASH@
+src/devtools/mpls_dump-mpls_dump.o: src/devtools/mpls_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/devtools/mpls_dump-mpls_dump.o -MD -MP -MF src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Tpo -c -o src/devtools/mpls_dump-mpls_dump.o `test -f 'src/devtools/mpls_dump.c' || echo '$(srcdir)/'`src/devtools/mpls_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Tpo src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/mpls_dump.c' object='src/devtools/mpls_dump-mpls_dump.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/examples/mpls_dump-mpls_dump.o `test -f 'src/examples/mpls_dump.c' || echo '$(srcdir)/'`src/examples/mpls_dump.c
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/mpls_dump-mpls_dump.o `test -f 'src/devtools/mpls_dump.c' || echo '$(srcdir)/'`src/devtools/mpls_dump.c
 
-src/examples/mpls_dump-mpls_dump.obj: src/examples/mpls_dump.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/examples/mpls_dump-mpls_dump.obj -MD -MP -MF src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Tpo -c -o src/examples/mpls_dump-mpls_dump.obj `if test -f 'src/examples/mpls_dump.c'; then $(CYGPATH_W) 'src/examples/mpls_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/mpls_dump.c'; fi`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Tpo src/examples/$(DEPDIR)/mpls_dump-mpls_dump.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/mpls_dump.c' object='src/examples/mpls_dump-mpls_dump.obj' libtool=no @AMDEPBACKSLASH@
+src/devtools/mpls_dump-mpls_dump.obj: src/devtools/mpls_dump.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/devtools/mpls_dump-mpls_dump.obj -MD -MP -MF src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Tpo -c -o src/devtools/mpls_dump-mpls_dump.obj `if test -f 'src/devtools/mpls_dump.c'; then $(CYGPATH_W) 'src/devtools/mpls_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/mpls_dump.c'; fi`
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Tpo src/devtools/$(DEPDIR)/mpls_dump-mpls_dump.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/mpls_dump.c' object='src/devtools/mpls_dump-mpls_dump.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/examples/mpls_dump-mpls_dump.obj `if test -f 'src/examples/mpls_dump.c'; then $(CYGPATH_W) 'src/examples/mpls_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/mpls_dump.c'; fi`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/mpls_dump-mpls_dump.obj `if test -f 'src/devtools/mpls_dump.c'; then $(CYGPATH_W) 'src/devtools/mpls_dump.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/mpls_dump.c'; fi`
 
-src/examples/mpls_dump-util.o: src/examples/util.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/examples/mpls_dump-util.o -MD -MP -MF src/examples/$(DEPDIR)/mpls_dump-util.Tpo -c -o src/examples/mpls_dump-util.o `test -f 'src/examples/util.c' || echo '$(srcdir)/'`src/examples/util.c
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/mpls_dump-util.Tpo src/examples/$(DEPDIR)/mpls_dump-util.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/util.c' object='src/examples/mpls_dump-util.o' libtool=no @AMDEPBACKSLASH@
+src/devtools/mpls_dump-util.o: src/devtools/util.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/devtools/mpls_dump-util.o -MD -MP -MF src/devtools/$(DEPDIR)/mpls_dump-util.Tpo -c -o src/devtools/mpls_dump-util.o `test -f 'src/devtools/util.c' || echo '$(srcdir)/'`src/devtools/util.c
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/mpls_dump-util.Tpo src/devtools/$(DEPDIR)/mpls_dump-util.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/util.c' object='src/devtools/mpls_dump-util.o' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/examples/mpls_dump-util.o `test -f 'src/examples/util.c' || echo '$(srcdir)/'`src/examples/util.c
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/mpls_dump-util.o `test -f 'src/devtools/util.c' || echo '$(srcdir)/'`src/devtools/util.c
 
-src/examples/mpls_dump-util.obj: src/examples/util.c
- at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/examples/mpls_dump-util.obj -MD -MP -MF src/examples/$(DEPDIR)/mpls_dump-util.Tpo -c -o src/examples/mpls_dump-util.obj `if test -f 'src/examples/util.c'; then $(CYGPATH_W) 'src/examples/util.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/util.c'; fi`
- at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/examples/$(DEPDIR)/mpls_dump-util.Tpo src/examples/$(DEPDIR)/mpls_dump-util.Po
- at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/examples/util.c' object='src/examples/mpls_dump-util.obj' libtool=no @AMDEPBACKSLASH@
+src/devtools/mpls_dump-util.obj: src/devtools/util.c
+ at am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -MT src/devtools/mpls_dump-util.obj -MD -MP -MF src/devtools/$(DEPDIR)/mpls_dump-util.Tpo -c -o src/devtools/mpls_dump-util.obj `if test -f 'src/devtools/util.c'; then $(CYGPATH_W) 'src/devtools/util.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/util.c'; fi`
+ at am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) src/devtools/$(DEPDIR)/mpls_dump-util.Tpo src/devtools/$(DEPDIR)/mpls_dump-util.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='src/devtools/util.c' object='src/devtools/mpls_dump-util.obj' libtool=no @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
- at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/examples/mpls_dump-util.obj `if test -f 'src/examples/util.c'; then $(CYGPATH_W) 'src/examples/util.c'; else $(CYGPATH_W) '$(srcdir)/src/examples/util.c'; fi`
+ at am__fastdepCC_FALSE@	$(AM_V_CC at am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mpls_dump_CFLAGS) $(CFLAGS) -c -o src/devtools/mpls_dump-util.obj `if test -f 'src/devtools/util.c'; then $(CYGPATH_W) 'src/devtools/util.c'; else $(CYGPATH_W) '$(srcdir)/src/devtools/util.c'; fi`
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -1877,6 +1891,7 @@ distcleancheck: distclean
 	       exit 1; } >&2
 check-am: all-am
 check: check-am
+ at USING_BDJAVA_BUILD_JAR_FALSE@all-local:
 @USING_BDJAVA_FALSE at all-local:
 all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) $(HEADERS) \
 		config.h all-local
@@ -1915,6 +1930,8 @@ distclean-generic:
 	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
 	-rm -f contrib/libudfread/src/$(DEPDIR)/$(am__dirstamp)
 	-rm -f contrib/libudfread/src/$(am__dirstamp)
+	-rm -f src/devtools/$(DEPDIR)/$(am__dirstamp)
+	-rm -f src/devtools/$(am__dirstamp)
 	-rm -f src/examples/$(DEPDIR)/$(am__dirstamp)
 	-rm -f src/examples/$(am__dirstamp)
 	-rm -f src/file/$(DEPDIR)/$(am__dirstamp)
@@ -1939,6 +1956,7 @@ distclean-generic:
 maintainer-clean-generic:
 	@echo "This command is intended for maintainers to use"
 	@echo "it deletes files that may require special tools to rebuild."
+ at USING_BDJAVA_BUILD_JAR_FALSE@clean-local:
 @USING_BDJAVA_FALSE at clean-local:
 clean: clean-am
 
@@ -1947,7 +1965,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
 
 distclean: distclean-am
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-	-rm -rf contrib/libudfread/src/$(DEPDIR) src/examples/$(DEPDIR) src/file/$(DEPDIR) src/libbluray/$(DEPDIR) src/libbluray/bdj/$(DEPDIR) src/libbluray/bdj/native/$(DEPDIR) src/libbluray/bdnav/$(DEPDIR) src/libbluray/decoders/$(DEPDIR) src/libbluray/disc/$(DEPDIR) src/libbluray/hdmv/$(DEPDIR) src/util/$(DEPDIR)
+	-rm -rf contrib/libudfread/src/$(DEPDIR) src/devtools/$(DEPDIR) src/examples/$(DEPDIR) src/file/$(DEPDIR) src/libbluray/$(DEPDIR) src/libbluray/bdj/$(DEPDIR) src/libbluray/bdj/native/$(DEPDIR) src/libbluray/bdnav/$(DEPDIR) src/libbluray/decoders/$(DEPDIR) src/libbluray/disc/$(DEPDIR) src/libbluray/hdmv/$(DEPDIR) src/util/$(DEPDIR)
 	-rm -f Makefile
 distclean-am: clean-am distclean-compile distclean-generic \
 	distclean-hdr distclean-libtool distclean-tags
@@ -1996,7 +2014,7 @@ installcheck-am:
 maintainer-clean: maintainer-clean-am
 	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
 	-rm -rf $(top_srcdir)/autom4te.cache
-	-rm -rf contrib/libudfread/src/$(DEPDIR) src/examples/$(DEPDIR) src/file/$(DEPDIR) src/libbluray/$(DEPDIR) src/libbluray/bdj/$(DEPDIR) src/libbluray/bdj/native/$(DEPDIR) src/libbluray/bdnav/$(DEPDIR) src/libbluray/decoders/$(DEPDIR) src/libbluray/disc/$(DEPDIR) src/libbluray/hdmv/$(DEPDIR) src/util/$(DEPDIR)
+	-rm -rf contrib/libudfread/src/$(DEPDIR) src/devtools/$(DEPDIR) src/examples/$(DEPDIR) src/file/$(DEPDIR) src/libbluray/$(DEPDIR) src/libbluray/bdj/$(DEPDIR) src/libbluray/bdj/native/$(DEPDIR) src/libbluray/bdnav/$(DEPDIR) src/libbluray/decoders/$(DEPDIR) src/libbluray/disc/$(DEPDIR) src/libbluray/hdmv/$(DEPDIR) src/util/$(DEPDIR)
 	-rm -f Makefile
 maintainer-clean-am: distclean-am maintainer-clean-generic
 
@@ -2090,22 +2108,22 @@ uninstall-am: uninstall-binPROGRAMS uninstall-jarDATA \
 @DX_COND_doc_TRUE@	rm -rf @DX_DOCDIR@
 @DX_COND_doc_TRUE@	$(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
 
- at USING_BDJAVA_TRUE@$(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar: all-local
-
- at USING_BDJAVA_TRUE@all-local:
- at USING_BDJAVA_TRUE@	ant -f $(top_srcdir)/src/libbluray/bdj/build.xml \
- at USING_BDJAVA_TRUE@	    -Dbuild='$(abs_builddir)/src/libbluray/bdj/build' \
- at USING_BDJAVA_TRUE@	    -Ddist='$(abs_builddir)/.libs' \
- at USING_BDJAVA_TRUE@	    -Dsrc_awt=:java-$(BDJ_TYPE) \
- at USING_BDJAVA_TRUE@	    -Dbootclasspath="$(BDJ_BOOTCLASSPATH)" \
- at USING_BDJAVA_TRUE@	    -Dversion='$(BDJ_TYPE)-$(VERSION)'
-
- at USING_BDJAVA_TRUE@clean-local:
- at USING_BDJAVA_TRUE@	ant -f $(top_srcdir)/src/libbluray/bdj/build.xml \
- at USING_BDJAVA_TRUE@	    -Dbuild='$(abs_builddir)/src/libbluray/bdj/build' \
- at USING_BDJAVA_TRUE@	    -Ddist='$(abs_builddir)/.libs' \
- at USING_BDJAVA_TRUE@	    -Dversion='$(BDJ_TYPE)-$(VERSION)' \
- at USING_BDJAVA_TRUE@	    clean
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@$(top_builddir)/.libs/libbluray-$(BDJ_TYPE)-$(VERSION).jar: all-local
+
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE at all-local:
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	ant -f $(top_srcdir)/src/libbluray/bdj/build.xml \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Dbuild='$(abs_builddir)/src/libbluray/bdj/build' \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Ddist='$(abs_builddir)/.libs' \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Dsrc_awt=:java-$(BDJ_TYPE) \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Dbootclasspath="$(BDJ_BOOTCLASSPATH)" \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Dversion='$(BDJ_TYPE)-$(VERSION)'
+
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE at clean-local:
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	ant -f $(top_srcdir)/src/libbluray/bdj/build.xml \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Dbuild='$(abs_builddir)/src/libbluray/bdj/build' \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Ddist='$(abs_builddir)/.libs' \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    -Dversion='$(BDJ_TYPE)-$(VERSION)' \
+ at USING_BDJAVA_BUILD_JAR_TRUE@@USING_BDJAVA_TRUE@	    clean
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 1f5c50c..1659250 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2014-03-23'
+timestamp='2015-08-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -24,12 +24,12 @@ timestamp='2014-03-23'
 # program.  This Exception is an additional permission under section 7
 # of the GNU General Public License, version 3 ("GPLv3").
 #
-# Originally written by Per Bothner.
+# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
 #
 # You can get the latest version of this script from:
 # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
 #
-# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+# Please send patches to <config-patches at gnu.org>.
 
 
 me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -168,20 +168,27 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 	# Note: NetBSD doesn't particularly care about the vendor
 	# portion of the name.  We always set it to "unknown".
 	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
+	    /sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || \
+	    echo unknown)`
 	case "${UNAME_MACHINE_ARCH}" in
 	    armeb) machine=armeb-unknown ;;
 	    arm*) machine=arm-unknown ;;
 	    sh3el) machine=shl-unknown ;;
 	    sh3eb) machine=sh-unknown ;;
 	    sh5el) machine=sh5le-unknown ;;
+	    earmv*)
+		arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
+		endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
+		machine=${arch}${endian}-unknown
+		;;
 	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
 	esac
 	# The Operating System including object format, if it has switched
 	# to ELF recently, or will in the future.
 	case "${UNAME_MACHINE_ARCH}" in
-	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+	    arm*|earm*|i386|m68k|ns32k|sh3*|sparc|vax)
 		eval $set_cc_for_build
 		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
 			| grep -q __ELF__
@@ -197,6 +204,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		os=netbsd
 		;;
 	esac
+	# Determine ABI tags.
+	case "${UNAME_MACHINE_ARCH}" in
+	    earm*)
+		expr='s/^earmv[0-9]/-eabi/;s/eb$//'
+		abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
+		;;
+	esac
 	# The OS release
 	# Debian GNU/NetBSD machines have a different userland, and
 	# thus, need a distinct triplet. However, they do not need
@@ -207,13 +221,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
 		release='-gnu'
 		;;
 	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
 		;;
 	esac
 	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
 	# contains redundant information, the shorter form:
 	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
+	echo "${machine}-${os}${release}${abi}"
 	exit ;;
     *:Bitrig:*:*)
 	UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@@ -235,6 +249,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
     *:MirBSD:*:*)
 	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
 	exit ;;
+    *:Sortix:*:*)
+	echo ${UNAME_MACHINE}-unknown-sortix
+	exit ;;
     alpha:OSF1:*:*)
 	case $UNAME_RELEASE in
 	*4.0)
@@ -579,8 +596,9 @@ EOF
 	else
 		IBM_ARCH=powerpc
 	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
+	if [ -x /usr/bin/lslpp ] ; then
+		IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
+			   awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
 	else
 		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
 	fi
@@ -932,6 +950,9 @@ EOF
     crisv32:Linux:*:*)
 	echo ${UNAME_MACHINE}-axis-linux-${LIBC}
 	exit ;;
+    e2k:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	exit ;;
     frv:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
 	exit ;;
@@ -1020,7 +1041,7 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-${LIBC}
 	exit ;;
     x86_64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+	echo ${UNAME_MACHINE}-pc-linux-${LIBC}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
diff --git a/build-aux/config.sub b/build-aux/config.sub
index bba4efb..1acc966 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2014 Free Software Foundation, Inc.
+#   Copyright 1992-2015 Free Software Foundation, Inc.
 
-timestamp='2014-09-11'
+timestamp='2015-08-20'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ timestamp='2014-09-11'
 # of the GNU General Public License, version 3 ("GPLv3").
 
 
-# Please send patches with a ChangeLog entry to config-patches at gnu.org.
+# Please send patches to <config-patches at gnu.org>.
 #
 # Configuration subroutine to validate and canonicalize a configuration type.
 # Supply the specified configuration type as an argument.
@@ -68,7 +68,7 @@ Report bugs and patches to <config-patches at gnu.org>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2014 Free Software Foundation, Inc.
+Copyright 1992-2015 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -117,7 +117,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
   nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
   linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
-  knetbsd*-gnu* | netbsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \
   kopensolaris*-gnu* | \
   storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
@@ -255,12 +255,13 @@ case $basic_machine in
 	| arc | arceb \
 	| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
 	| avr | avr32 \
+	| ba \
 	| be32 | be64 \
 	| bfin \
 	| c4x | c8051 | clipper \
 	| d10v | d30v | dlx | dsp16xx \
-	| epiphany \
-	| fido | fr30 | frv \
+	| e2k | epiphany \
+	| fido | fr30 | frv | ft32 \
 	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
 	| hexagon \
 	| i370 | i860 | i960 | ia64 \
@@ -305,7 +306,7 @@ case $basic_machine in
 	| riscv32 | riscv64 \
 	| rl78 | rx \
 	| score \
-	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@@ -313,6 +314,7 @@ case $basic_machine in
 	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
 	| ubicom32 \
 	| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+	| visium \
 	| we32k \
 	| x86 | xc16x | xstormy16 | xtensa \
 	| z8k | z80)
@@ -327,6 +329,9 @@ case $basic_machine in
 	c6x)
 		basic_machine=tic6x-unknown
 		;;
+	leon|leon[3-9])
+		basic_machine=sparc-$basic_machine
+		;;
 	m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
 		basic_machine=$basic_machine-unknown
 		os=-none
@@ -372,12 +377,13 @@ case $basic_machine in
 	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
 	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
 	| avr-* | avr32-* \
+	| ba-* \
 	| be32-* | be64-* \
 	| bfin-* | bs2000-* \
 	| c[123]* | c30-* | [cjt]90-* | c4x-* \
 	| c8051-* | clipper-* | craynv-* | cydra-* \
 	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
+	| e2k-* | elxsi-* \
 	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
 	| h8300-* | h8500-* \
 	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
@@ -424,12 +430,13 @@ case $basic_machine in
 	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
 	| pyramid-* \
+	| riscv32-* | riscv64-* \
 	| rl78-* | romp-* | rs6000-* | rx-* \
 	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
 	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
 	| tahoe-* \
 	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
 	| tile*-* \
@@ -437,6 +444,7 @@ case $basic_machine in
 	| ubicom32-* \
 	| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
 	| vax-* \
+	| visium-* \
 	| we32k-* \
 	| x86-* | x86_64-* | xc16x-* | xps100-* \
 	| xstormy16-* | xtensa*-* \
@@ -513,6 +521,9 @@ case $basic_machine in
 		basic_machine=i386-pc
 		os=-aros
 		;;
+        asmjs)
+		basic_machine=asmjs-unknown
+		;;
 	aux)
 		basic_machine=m68k-apple
 		os=-aux
@@ -774,6 +785,9 @@ case $basic_machine in
 		basic_machine=m68k-isi
 		os=-sysv
 		;;
+	leon-*|leon[3-9]-*)
+		basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
+		;;
 	m68knommu)
 		basic_machine=m68k-unknown
 		os=-linux
@@ -1365,7 +1379,7 @@ case $os in
 	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
 	      | -sym* | -kopensolaris* | -plan9* \
 	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* | -aros* \
+	      | -aos* | -aros* | -cloudabi* | -sortix* \
 	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
 	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
 	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
diff --git a/build-aux/install-sh b/build-aux/install-sh
index 0b0fdcb..59990a1 100755
--- a/build-aux/install-sh
+++ b/build-aux/install-sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2013-12-25.23; # UTC
+scriptversion=2014-09-12.12; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -324,34 +324,41 @@ do
             # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
             ;;
           *)
+            # $RANDOM is not portable (e.g. dash);  use it when possible to
+            # lower collision chance
             tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-            trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+            trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
 
+            # As "mkdir -p" follows symlinks and we work in /tmp possibly;  so
+            # create the $tmpdir first (and fail if unsuccessful) to make sure
+            # that nobody tries to guess the $tmpdir name.
             if (umask $mkdir_umask &&
-                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+                $mkdirprog $mkdir_mode "$tmpdir" &&
+                exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
             then
               if test -z "$dir_arg" || {
                    # Check for POSIX incompatibilities with -m.
                    # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
                    # other-writable bit of parent directory when it shouldn't.
                    # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+                   test_tmpdir="$tmpdir/a"
+                   ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
                    case $ls_ld_tmpdir in
                      d????-?r-*) different_mode=700;;
                      d????-?--*) different_mode=755;;
                      *) false;;
                    esac &&
-                   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-                     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+                   $mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
+                     ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
                      test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
                    }
                  }
               then posix_mkdir=:
               fi
-              rmdir "$tmpdir/d" "$tmpdir"
+              rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
             else
               # Remove any dirs left behind by ancient mkdir implementations.
-              rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+              rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
             fi
             trap '' 0;;
         esac;;
diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh
index bffda54..147d758 100644
--- a/build-aux/ltmain.sh
+++ b/build-aux/ltmain.sh
@@ -1,9 +1,12 @@
+#! /bin/sh
+## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
+##               by inline-source v2014-01-03.01
 
-# libtool (GNU libtool) 2.4.2
+# libtool (GNU libtool) 2.4.6
+# Provide generalized library-building support services.
 # Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
 
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-2015 Free Software Foundation, Inc.
 # This is free software; see the source for copying conditions.  There is NO
 # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
@@ -23,881 +26,2112 @@
 # General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
-#
-#       --config             show all configuration variables
-#       --debug              enable verbose shell tracing
-#   -n, --dry-run            display commands without modifying any files
-#       --features           display basic configuration information and exit
-#       --mode=MODE          use operation mode MODE
-#       --preserve-dup-deps  don't remove duplicate dependency libraries
-#       --quiet, --silent    don't print informational messages
-#       --no-quiet, --no-silent
-#                            print informational messages (default)
-#       --no-warn            don't display warning messages
-#       --tag=TAG            use configuration variables from tag TAG
-#   -v, --verbose            print more informational messages than default
-#       --no-verbose         don't print the extra informational messages
-#       --version            print version information
-#   -h, --help, --help-all   print short, long, or detailed help message
-#
-# MODE must be one of the following:
-#
-#         clean              remove files from the build directory
-#         compile            compile a source file into a libtool object
-#         execute            automatically set library path, then run a program
-#         finish             complete the installation of libtool libraries
-#         install            install libraries or executables
-#         link               create a library or an executable
-#         uninstall          remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE.  When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-#         host-triplet:	$host
-#         shell:		$SHELL
-#         compiler:		$LTCC
-#         compiler flags:		$LTCFLAGS
-#         linker:		$LD (gnu? $with_gnu_ld)
-#         $progname:	(GNU libtool) 2.4.2 Debian-2.4.2-1.11
-#         automake:	$automake_version
-#         autoconf:	$autoconf_version
-#
-# Report bugs to <bug-libtool at gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
 
 PROGRAM=libtool
 PACKAGE=libtool
-VERSION="2.4.2 Debian-2.4.2-1.11"
-TIMESTAMP=""
-package_revision=1.3337
+VERSION="2.4.6 Debian-2.4.6-0.1"
+package_revision=2.4.6
 
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Run './libtool --help' for help with using this script from the
+# command line.
+
+
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# After configure completes, it has a better idea of some of the
+# shell tools we need than the defaults used by the functions shared
+# with bootstrap, so set those here where they can still be over-
+# ridden by the user, but otherwise take precedence.
+
+: ${AUTOCONF="autoconf"}
+: ${AUTOMAKE="automake"}
+
+
+## -------------------------- ##
+## Source external libraries. ##
+## -------------------------- ##
+
+# Much of our low-level functionality needs to be sourced from external
+# libraries, which are installed to $pkgauxdir.
+
+# Set a version string for this script.
+scriptversion=2015-01-20.17; # UTC
+
+# General shell script boiler plate, and helper functions.
+# Written by Gary V. Vaughan, 2004
+
+# Copyright (C) 2004-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# As a special exception to the GNU General Public License, if you distribute
+# this file as part of a program or library that is built using GNU Libtool,
+# you may include this file under the same distribution terms that you use
+# for the rest of that program.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to gary at gnu.org.
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# Evaluate this file near the top of your script to gain access to
+# the functions and variables defined here:
+#
+#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
+#
+# If you need to override any of the default environment variable
+# settings, do that before evaluating this file.
+
+
+## -------------------- ##
+## Shell normalisation. ##
+## -------------------- ##
+
+# Some shells need a little help to be as Bourne compatible as possible.
+# Before doing anything else, make sure all that help has been provided!
+
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
 fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
-  eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
 
-# NLS nuisances: We save the old values to restore during execute mode.
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+# NLS nuisances: We save the old values in case they are required later.
+_G_user_locale=
+_G_safe_locale=
+for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
 do
-  eval "if test \"\${$lt_var+set}\" = set; then
-          save_$lt_var=\$$lt_var
-          $lt_var=C
-	  export $lt_var
-	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
-	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+  eval "if test set = \"\${$_G_var+set}\"; then
+          save_$_G_var=\$$_G_var
+          $_G_var=C
+	  export $_G_var
+	  _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
+	  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
 	fi"
 done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
 
-$lt_unset CDPATH
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Make sure IFS has a sensible default
+sp=' '
+nl='
+'
+IFS="$sp	$nl"
+
+# There are apparently some retarded systems that use ';' as a PATH separator!
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
 
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
 
 
+## ------------------------- ##
+## Locate command utilities. ##
+## ------------------------- ##
+
+
+# func_executable_p FILE
+# ----------------------
+# Check that FILE is an executable regular file.
+func_executable_p ()
+{
+    test -f "$1" && test -x "$1"
+}
+
+
+# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
+# --------------------------------------------
+# Search for either a program that responds to --version with output
+# containing "GNU", or else returned by CHECK_FUNC otherwise, by
+# trying all the directories in PATH with each of the elements of
+# PROGS_LIST.
+#
+# CHECK_FUNC should accept the path to a candidate program, and
+# set $func_check_prog_result if it truncates its output less than
+# $_G_path_prog_max characters.
+func_path_progs ()
+{
+    _G_progs_list=$1
+    _G_check_func=$2
+    _G_PATH=${3-"$PATH"}
+
+    _G_path_prog_max=0
+    _G_path_prog_found=false
+    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
+    for _G_dir in $_G_PATH; do
+      IFS=$_G_save_IFS
+      test -z "$_G_dir" && _G_dir=.
+      for _G_prog_name in $_G_progs_list; do
+        for _exeext in '' .EXE; do
+          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
+          func_executable_p "$_G_path_prog" || continue
+          case `"$_G_path_prog" --version 2>&1` in
+            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
+            *)     $_G_check_func $_G_path_prog
+		   func_path_progs_result=$func_check_prog_result
+		   ;;
+          esac
+          $_G_path_prog_found && break 3
+        done
+      done
+    done
+    IFS=$_G_save_IFS
+    test -z "$func_path_progs_result" && {
+      echo "no acceptable sed could be found in \$PATH" >&2
+      exit 1
+    }
+}
+
+
+# We want to be able to use the functions in this file before configure
+# has figured out where the best binaries are kept, which means we have
+# to search for them ourselves - except when the results are already set
+# where we skip the searches.
+
+# Unless the user overrides by setting SED, search the path for either GNU
+# sed, or the sed that truncates its output the least.
+test -z "$SED" && {
+  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+  for _G_i in 1 2 3 4 5 6 7; do
+    _G_sed_script=$_G_sed_script$nl$_G_sed_script
+  done
+  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
+  _G_sed_script=
+
+  func_check_prog_sed ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo '' >> conftest.nl
+      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
+  rm -f conftest.sed
+  SED=$func_path_progs_result
+}
+
+
+# Unless the user overrides by setting GREP, search the path for either GNU
+# grep, or the grep that truncates its output the least.
+test -z "$GREP" && {
+  func_check_prog_grep ()
+  {
+    _G_path_prog=$1
+
+    _G_count=0
+    _G_path_prog_max=0
+    printf 0123456789 >conftest.in
+    while :
+    do
+      cat conftest.in conftest.in >conftest.tmp
+      mv conftest.tmp conftest.in
+      cp conftest.in conftest.nl
+      echo 'GREP' >> conftest.nl
+      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
+      diff conftest.out conftest.nl >/dev/null 2>&1 || break
+      _G_count=`expr $_G_count + 1`
+      if test "$_G_count" -gt "$_G_path_prog_max"; then
+        # Best one so far, save it but keep looking for a better one
+        func_check_prog_result=$_G_path_prog
+        _G_path_prog_max=$_G_count
+      fi
+      # 10*(2^10) chars as input seems more than enough
+      test 10 -lt "$_G_count" && break
+    done
+    rm -f conftest.in conftest.tmp conftest.nl conftest.out
+  }
+
+  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
+  GREP=$func_path_progs_result
+}
+
+
+## ------------------------------- ##
+## User overridable command paths. ##
+## ------------------------------- ##
+
+# All uppercase variable names are used for environment variables.  These
+# variables can be overridden by the user before calling a script that
+# uses them if a suitable command of that name is not already available
+# in the command search PATH.
 
 : ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
+: ${ECHO="printf %s\n"}
+: ${EGREP="$GREP -E"}
+: ${FGREP="$GREP -F"}
+: ${LN_S="ln -s"}
 : ${MAKE="make"}
 : ${MKDIR="mkdir"}
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 : ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" 	$lt_nl"
 
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
 
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
-    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-} # func_dirname may be replaced by extended shell implementation
+## -------------------- ##
+## Useful sed snippets. ##
+## -------------------- ##
 
+sed_dirname='s|/[^/]*$||'
+sed_basename='s|^.*/||'
 
-# func_basename file
-func_basename ()
-{
-    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
 
+# Same as above, but do not quote variable references.
+sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-#   dirname:  Compute the dirname of FILE.  If nonempty,
-#             add APPEND to the result, otherwise set result
-#             to NONDIR_REPLACEMENT.
-#             value returned in "$func_dirname_result"
-#   basename: Compute filename of FILE.
-#             value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
-    # Extract subdirectory from the argument.
-    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
-    if test "X$func_dirname_result" = "X${1}"; then
-      func_dirname_result="${3}"
-    else
-      func_dirname_result="$func_dirname_result${2}"
-    fi
-    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
 
+# Sed substitution that converts a w32 file name or path
+# that contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-'\' parameter expansions in output of sed_double_quote_subst that
+# were '\'-ed in input to the same.  If an odd number of '\' preceded a
+# '$' in input to sed_double_quote_subst, that '$' was protected from
+# expansion.  Since each input '\' is now two '\'s, look for any number
+# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
+_G_bs='\\'
+_G_bs2='\\\\'
+_G_bs4='\\\\\\\\'
+_G_dollar='\$'
+sed_double_backslash="\
+  s/$_G_bs4/&\\
+/g
+  s/^$_G_bs2$_G_dollar/$_G_bs&/
+  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
+  s/\n//g"
 
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
-    case ${2} in
-      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
-    esac
-} # func_stripname may be replaced by extended shell implementation
 
+## ----------------- ##
+## Global variables. ##
+## ----------------- ##
 
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
-		s@/\./@/@g
-		t dotsl
-		s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
+# Except for the global variables explicitly listed below, the following
+# functions in the '^func_' namespace, and the '^require_' namespace
+# variables initialised in the 'Resource management' section, sourcing
+# this file will not pollute your global namespace with anything
+# else. There's no portable way to scope variables in Bourne shell
+# though, so actually running these functions will sometimes place
+# results into a variable named after the function, and often use
+# temporary variables in the '^_G_' namespace. If you are careful to
+# avoid using those namespaces casually in your sourcing script, things
+# should continue to work as you expect. And, of course, you can freely
+# overwrite any of the functions or variables defined here before
+# calling anything to customize them.
 
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-#             value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
-  # Start from root dir and reassemble the path.
-  func_normal_abspath_result=
-  func_normal_abspath_tpath=$1
-  func_normal_abspath_altnamespace=
-  case $func_normal_abspath_tpath in
-    "")
-      # Empty path, that just means $cwd.
-      func_stripname '' '/' "`pwd`"
-      func_normal_abspath_result=$func_stripname_result
-      return
-    ;;
-    # The next three entries are used to spot a run of precisely
-    # two leading slashes without using negated character classes;
-    # we take advantage of case's first-match behaviour.
-    ///*)
-      # Unusual form of absolute path, do nothing.
-    ;;
-    //*)
-      # Not necessarily an ordinary path; POSIX reserves leading '//'
-      # and for example Cygwin uses it to access remote file shares
-      # over CIFS/SMB, so we conserve a leading double slash if found.
-      func_normal_abspath_altnamespace=/
-    ;;
-    /*)
-      # Absolute path, do nothing.
-    ;;
-    *)
-      # Relative path, prepend $cwd.
-      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
-    ;;
-  esac
-  # Cancel out all the simple stuff to save iterations.  We also want
-  # the path to end with a slash for ease of parsing, so make sure
-  # there is one (and only one) here.
-  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
-  while :; do
-    # Processed it all yet?
-    if test "$func_normal_abspath_tpath" = / ; then
-      # If we ascended to the root using ".." the result may be empty now.
-      if test -z "$func_normal_abspath_result" ; then
-        func_normal_abspath_result=/
-      fi
-      break
-    fi
-    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcar"`
-    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
-        -e "$pathcdr"`
-    # Figure out what to do with it
-    case $func_normal_abspath_tcomponent in
-      "")
-        # Trailing empty path component, ignore it.
-      ;;
-      ..)
-        # Parent dir; strip last assembled component from result.
-        func_dirname "$func_normal_abspath_result"
-        func_normal_abspath_result=$func_dirname_result
-      ;;
-      *)
-        # Actual path component, append it.
-        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
-      ;;
-    esac
-  done
-  # Restore leading double-slash if one was found on entry.
-  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
-}
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
 
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-#             value returned in "$func_relative_path_result"
-func_relative_path ()
-{
-  func_relative_path_result=
-  func_normal_abspath "$1"
-  func_relative_path_tlibdir=$func_normal_abspath_result
-  func_normal_abspath "$2"
-  func_relative_path_tbindir=$func_normal_abspath_result
-
-  # Ascend the tree starting from libdir
-  while :; do
-    # check if we have found a prefix of bindir
-    case $func_relative_path_tbindir in
-      $func_relative_path_tlibdir)
-        # found an exact match
-        func_relative_path_tcancelled=
-        break
-        ;;
-      $func_relative_path_tlibdir*)
-        # found a matching prefix
-        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
-        func_relative_path_tcancelled=$func_stripname_result
-        if test -z "$func_relative_path_result"; then
-          func_relative_path_result=.
-        fi
-        break
-        ;;
-      *)
-        func_dirname $func_relative_path_tlibdir
-        func_relative_path_tlibdir=${func_dirname_result}
-        if test "x$func_relative_path_tlibdir" = x ; then
-          # Have to descend all the way to the root!
-          func_relative_path_result=../$func_relative_path_result
-          func_relative_path_tcancelled=$func_relative_path_tbindir
-          break
-        fi
-        func_relative_path_result=../$func_relative_path_result
-        ;;
-    esac
-  done
+# Allow overriding, eg assuming that you follow the convention of
+# putting '$debug_cmd' at the start of all your functions, you can get
+# bash to show function call trace with:
+#
+#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
+debug_cmd=${debug_cmd-":"}
+exit_cmd=:
 
-  # Now calculate path; take care to avoid doubling-up slashes.
-  func_stripname '' '/' "$func_relative_path_result"
-  func_relative_path_result=$func_stripname_result
-  func_stripname '/' '/' "$func_relative_path_tcancelled"
-  if test "x$func_stripname_result" != x ; then
-    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
-  fi
+# By convention, finish your script with:
+#
+#    exit $exit_status
+#
+# so that you can set exit_status to non-zero if you want to indicate
+# something went wrong during execution without actually bailing out at
+# the point of failure.
+exit_status=$EXIT_SUCCESS
 
-  # Normalisation. If bindir is libdir, return empty string,
-  # else relative path ending with a slash; either way, target
-  # file name can be directly appended.
-  if test ! -z "$func_relative_path_result"; then
-    func_stripname './' '' "$func_relative_path_result/"
-    func_relative_path_result=$func_stripname_result
-  fi
-}
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath=$0
 
-# The name of this program:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
+# The name of this program.
+progname=`$ECHO "$progpath" |$SED "$sed_basename"`
 
-# Make sure we have an absolute path for reexecution:
+# Make sure we have an absolute progpath for reexecution:
 case $progpath in
   [\\/]*|[A-Za-z]:\\*) ;;
   *[\\/]*)
-     progdir=$func_dirname_result
+     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
      progdir=`cd "$progdir" && pwd`
-     progpath="$progdir/$progname"
+     progpath=$progdir/$progname
      ;;
   *)
-     save_IFS="$IFS"
+     _G_IFS=$IFS
      IFS=${PATH_SEPARATOR-:}
      for progdir in $PATH; do
-       IFS="$save_IFS"
+       IFS=$_G_IFS
        test -x "$progdir/$progname" && break
      done
-     IFS="$save_IFS"
+     IFS=$_G_IFS
      test -n "$progdir" || progdir=`pwd`
-     progpath="$progdir/$progname"
+     progpath=$progdir/$progname
      ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-# Sed substitution that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+## ----------------- ##
+## Standard options. ##
+## ----------------- ##
 
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes.  A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
-  s/$bs4/&\\
-/g
-  s/^$bs2$dollar/$bs&/
-  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
-  s/\n//g"
+# The following options affect the operation of the functions defined
+# below, and should be set appropriately depending on run-time para-
+# meters passed on the command line.
 
-# Standard options:
 opt_dry_run=false
-opt_help=false
 opt_quiet=false
 opt_verbose=false
-opt_warning=:
 
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
-    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
-}
+# Categories 'all' and 'none' are always available.  Append any others
+# you will pass as the first argument to func_warning from your own
+# code.
+warning_categories=
 
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
-    $opt_verbose && func_echo ${1+"$@"}
+# By default, display warnings according to 'opt_warning_types'.  Set
+# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
+# treat the next displayed warning as a fatal error.
+warning_func=func_warn_and_continue
 
-    # A bug in bash halts the script if the last line of a function
-    # fails when set -e is in force, so we need another command to
-    # work around that:
-    :
-}
+# Set to 'all' to display all warnings, 'none' to suppress all
+# warnings, or a space delimited list of some subset of
+# 'warning_categories' to display only the listed warnings.
+opt_warning_types=all
 
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
-    $ECHO "$*"
-}
 
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
-    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
-}
+## -------------------- ##
+## Resource management. ##
+## -------------------- ##
 
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
-    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+# This section contains definitions for functions that each ensure a
+# particular resource (a file, or a non-empty configuration variable for
+# example) is available, and if appropriate to extract default values
+# from pertinent package files. Call them using their associated
+# 'require_*' variable to ensure that they are executed, at most, once.
+#
+# It's entirely deliberate that calling these functions can set
+# variables that don't obey the namespace limitations obeyed by the rest
+# of this file, in order that that they be as useful as possible to
+# callers.
 
-    # bash bug again:
-    :
-}
 
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
+# require_term_colors
+# -------------------
+# Allow display of bold text on terminals that support it.
+require_term_colors=func_require_term_colors
+func_require_term_colors ()
 {
-    func_error ${1+"$@"}
-    exit $EXIT_FAILURE
-}
+    $debug_cmd
+
+    test -t 1 && {
+      # COLORTERM and USE_ANSI_COLORS environment variables take
+      # precedence, because most terminfo databases neglect to describe
+      # whether color sequences are supported.
+      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
+
+      if test 1 = "$USE_ANSI_COLORS"; then
+        # Standard ANSI escape sequences
+        tc_reset=''
+        tc_bold='';   tc_standout=''
+        tc_red='';   tc_green=''
+        tc_blue='';  tc_cyan=''
+      else
+        # Otherwise trust the terminfo database after all.
+        test -n "`tput sgr0 2>/dev/null`" && {
+          tc_reset=`tput sgr0`
+          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
+          tc_standout=$tc_bold
+          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
+          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
+          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
+          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
+          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
+        }
+      fi
+    }
 
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
-    func_error ${1+"$@"}
-    func_fatal_error "$help"
+    require_term_colors=:
 }
-help="Try \`$progname --help' for more information."  ## default
 
 
-# func_grep expression filename
+## ----------------- ##
+## Function library. ##
+## ----------------- ##
+
+# This section contains a variety of useful functions to call in your
+# scripts. Take note of the portable wrappers for features provided by
+# some modern shells, which will fall back to slower equivalents on
+# less featureful shells.
+
+
+# func_append VAR VALUE
+# ---------------------
+# Append VALUE onto the existing contents of VAR.
+
+  # We should try to minimise forks, especially on Windows where they are
+  # unreasonably slow, so skip the feature probes when bash or zsh are
+  # being used:
+  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
+    : ${_G_HAVE_ARITH_OP="yes"}
+    : ${_G_HAVE_XSI_OPS="yes"}
+    # The += operator was introduced in bash 3.1
+    case $BASH_VERSION in
+      [12].* | 3.0 | 3.0*) ;;
+      *)
+        : ${_G_HAVE_PLUSEQ_OP="yes"}
+        ;;
+    esac
+  fi
+
+  # _G_HAVE_PLUSEQ_OP
+  # Can be empty, in which case the shell is probed, "yes" if += is
+  # useable or anything else if it does not work.
+  test -z "$_G_HAVE_PLUSEQ_OP" \
+    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
+    && _G_HAVE_PLUSEQ_OP=yes
+
+if test yes = "$_G_HAVE_PLUSEQ_OP"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_append ()
+  {
+    $debug_cmd
+
+    eval "$1+=\$2"
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_append ()
+  {
+    $debug_cmd
+
+    eval "$1=\$$1\$2"
+  }
+fi
+
+
+# func_append_quoted VAR VALUE
+# ----------------------------
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+if test yes = "$_G_HAVE_PLUSEQ_OP"; then
+  eval 'func_append_quoted ()
+  {
+    $debug_cmd
+
+    func_quote_for_eval "$2"
+    eval "$1+=\\ \$func_quote_for_eval_result"
+  }'
+else
+  func_append_quoted ()
+  {
+    $debug_cmd
+
+    func_quote_for_eval "$2"
+    eval "$1=\$$1\\ \$func_quote_for_eval_result"
+  }
+fi
+
+
+# func_append_uniq VAR VALUE
+# --------------------------
+# Append unique VALUE onto the existing contents of VAR, assuming
+# entries are delimited by the first character of VALUE.  For example:
+#
+#   func_append_uniq options " --another-option option-argument"
+#
+# will only append to $options if " --another-option option-argument "
+# is not already present somewhere in $options already (note spaces at
+# each end implied by leading space in second argument).
+func_append_uniq ()
+{
+    $debug_cmd
+
+    eval _G_current_value='`$ECHO $'$1'`'
+    _G_delim=`expr "$2" : '\(.\)'`
+
+    case $_G_delim$_G_current_value$_G_delim in
+      *"$2$_G_delim"*) ;;
+      *) func_append "$@" ;;
+    esac
+}
+
+
+# func_arith TERM...
+# ------------------
+# Set func_arith_result to the result of evaluating TERMs.
+  test -z "$_G_HAVE_ARITH_OP" \
+    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
+    && _G_HAVE_ARITH_OP=yes
+
+if test yes = "$_G_HAVE_ARITH_OP"; then
+  eval 'func_arith ()
+  {
+    $debug_cmd
+
+    func_arith_result=$(( $* ))
+  }'
+else
+  func_arith ()
+  {
+    $debug_cmd
+
+    func_arith_result=`expr "$@"`
+  }
+fi
+
+
+# func_basename FILE
+# ------------------
+# Set func_basename_result to FILE with everything up to and including
+# the last / stripped.
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  # If this shell supports suffix pattern removal, then use it to avoid
+  # forking. Hide the definitions single quotes in case the shell chokes
+  # on unsupported syntax...
+  _b='func_basename_result=${1##*/}'
+  _d='case $1 in
+        */*) func_dirname_result=${1%/*}$2 ;;
+        *  ) func_dirname_result=$3        ;;
+      esac'
+
+else
+  # ...otherwise fall back to using sed.
+  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
+  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
+      if test "X$func_dirname_result" = "X$1"; then
+        func_dirname_result=$3
+      else
+        func_append func_dirname_result "$2"
+      fi'
+fi
+
+eval 'func_basename ()
+{
+    $debug_cmd
+
+    '"$_b"'
+}'
+
+
+# func_dirname FILE APPEND NONDIR_REPLACEMENT
+# -------------------------------------------
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+eval 'func_dirname ()
+{
+    $debug_cmd
+
+    '"$_d"'
+}'
+
+
+# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
+# --------------------------------------------------------
+# Perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# For efficiency, we do not delegate to the functions above but instead
+# duplicate the functionality here.
+eval 'func_dirname_and_basename ()
+{
+    $debug_cmd
+
+    '"$_b"'
+    '"$_d"'
+}'
+
+
+# func_echo ARG...
+# ----------------
+# Echo program name prefixed message.
+func_echo ()
+{
+    $debug_cmd
+
+    _G_message=$*
+
+    func_echo_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_IFS
+      $ECHO "$progname: $_G_line"
+    done
+    IFS=$func_echo_IFS
+}
+
+
+# func_echo_all ARG...
+# --------------------
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+
+# func_echo_infix_1 INFIX ARG...
+# ------------------------------
+# Echo program name, followed by INFIX on the first line, with any
+# additional lines not showing INFIX.
+func_echo_infix_1 ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    _G_infix=$1; shift
+    _G_indent=$_G_infix
+    _G_prefix="$progname: $_G_infix: "
+    _G_message=$*
+
+    # Strip color escape sequences before counting printable length
+    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
+    do
+      test -n "$_G_tc" && {
+        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
+        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
+      }
+    done
+    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
+
+    func_echo_infix_1_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_infix_1_IFS
+      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
+      _G_prefix=$_G_indent
+    done
+    IFS=$func_echo_infix_1_IFS
+}
+
+
+# func_error ARG...
+# -----------------
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
+}
+
+
+# func_fatal_error ARG...
+# -----------------------
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    $debug_cmd
+
+    func_error "$*"
+    exit $EXIT_FAILURE
+}
+
+
+# func_grep EXPRESSION FILENAME
+# -----------------------------
 # Check whether EXPRESSION matches any line of FILENAME, without output.
 func_grep ()
 {
+    $debug_cmd
+
     $GREP "$1" "$2" >/dev/null 2>&1
 }
 
 
-# func_mkdir_p directory-path
+# func_len STRING
+# ---------------
+# Set func_len_result to the length of STRING. STRING may not
+# start with a hyphen.
+  test -z "$_G_HAVE_XSI_OPS" \
+    && (eval 'x=a/b/c;
+      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
+    && _G_HAVE_XSI_OPS=yes
+
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_len ()
+  {
+    $debug_cmd
+
+    func_len_result=${#1}
+  }'
+else
+  func_len ()
+  {
+    $debug_cmd
+
+    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+  }
+fi
+
+
+# func_mkdir_p DIRECTORY-PATH
+# ---------------------------
 # Make sure the entire path to DIRECTORY-PATH is available.
 func_mkdir_p ()
 {
-    my_directory_path="$1"
-    my_dir_list=
+    $debug_cmd
 
-    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+    _G_directory_path=$1
+    _G_dir_list=
 
-      # Protect directory names starting with `-'
-      case $my_directory_path in
-        -*) my_directory_path="./$my_directory_path" ;;
+    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
+
+      # Protect directory names starting with '-'
+      case $_G_directory_path in
+        -*) _G_directory_path=./$_G_directory_path ;;
       esac
 
       # While some portion of DIR does not yet exist...
-      while test ! -d "$my_directory_path"; do
+      while test ! -d "$_G_directory_path"; do
         # ...make a list in topmost first order.  Use a colon delimited
 	# list incase some portion of path contains whitespace.
-        my_dir_list="$my_directory_path:$my_dir_list"
+        _G_dir_list=$_G_directory_path:$_G_dir_list
 
         # If the last portion added has no slash in it, the list is done
-        case $my_directory_path in */*) ;; *) break ;; esac
+        case $_G_directory_path in */*) ;; *) break ;; esac
 
         # ...otherwise throw away the child directory and loop
-        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
       done
-      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
 
-      save_mkdir_p_IFS="$IFS"; IFS=':'
-      for my_dir in $my_dir_list; do
-	IFS="$save_mkdir_p_IFS"
-        # mkdir can fail with a `File exist' error if two processes
+      func_mkdir_p_IFS=$IFS; IFS=:
+      for _G_dir in $_G_dir_list; do
+	IFS=$func_mkdir_p_IFS
+        # mkdir can fail with a 'File exist' error if two processes
         # try to create one of the directories concurrently.  Don't
         # stop in that case!
-        $MKDIR "$my_dir" 2>/dev/null || :
+        $MKDIR "$_G_dir" 2>/dev/null || :
       done
-      IFS="$save_mkdir_p_IFS"
+      IFS=$func_mkdir_p_IFS
 
       # Bail out if we (or some other process) failed to create a directory.
-      test -d "$my_directory_path" || \
-        func_fatal_error "Failed to create \`$1'"
+      test -d "$_G_directory_path" || \
+        func_fatal_error "Failed to create '$1'"
     fi
 }
 
 
-# func_mktempdir [string]
+# func_mktempdir [BASENAME]
+# -------------------------
 # Make a temporary directory that won't clash with other running
 # libtool processes, and avoids race conditions if possible.  If
-# given, STRING is the basename for that directory.
+# given, BASENAME is the basename for that directory.
 func_mktempdir ()
 {
-    my_template="${TMPDIR-/tmp}/${1-$progname}"
+    $debug_cmd
+
+    _G_template=${TMPDIR-/tmp}/${1-$progname}
 
-    if test "$opt_dry_run" = ":"; then
+    if test : = "$opt_dry_run"; then
       # Return a directory name, but don't create it in dry-run mode
-      my_tmpdir="${my_template}-$$"
+      _G_tmpdir=$_G_template-$$
     else
 
       # If mktemp works, use that first and foremost
-      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
 
-      if test ! -d "$my_tmpdir"; then
+      if test ! -d "$_G_tmpdir"; then
         # Failing that, at least try and use $RANDOM to avoid a race
-        my_tmpdir="${my_template}-${RANDOM-0}$$"
+        _G_tmpdir=$_G_template-${RANDOM-0}$$
 
-        save_mktempdir_umask=`umask`
+        func_mktempdir_umask=`umask`
         umask 0077
-        $MKDIR "$my_tmpdir"
-        umask $save_mktempdir_umask
+        $MKDIR "$_G_tmpdir"
+        umask $func_mktempdir_umask
       fi
 
       # If we're not in dry-run mode, bomb out on failure
-      test -d "$my_tmpdir" || \
-        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+      test -d "$_G_tmpdir" || \
+        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
+    fi
+
+    $ECHO "$_G_tmpdir"
+}
+
+
+# func_normal_abspath PATH
+# ------------------------
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+func_normal_abspath ()
+{
+    $debug_cmd
+
+    # These SED scripts presuppose an absolute path with a trailing slash.
+    _G_pathcar='s|^/\([^/]*\).*$|\1|'
+    _G_pathcdr='s|^/[^/]*||'
+    _G_removedotparts=':dotsl
+		s|/\./|/|g
+		t dotsl
+		s|/\.$|/|'
+    _G_collapseslashes='s|/\{1,\}|/|g'
+    _G_finalslash='s|/*$|/|'
+
+    # Start from root dir and reassemble the path.
+    func_normal_abspath_result=
+    func_normal_abspath_tpath=$1
+    func_normal_abspath_altnamespace=
+    case $func_normal_abspath_tpath in
+      "")
+        # Empty path, that just means $cwd.
+        func_stripname '' '/' "`pwd`"
+        func_normal_abspath_result=$func_stripname_result
+        return
+        ;;
+      # The next three entries are used to spot a run of precisely
+      # two leading slashes without using negated character classes;
+      # we take advantage of case's first-match behaviour.
+      ///*)
+        # Unusual form of absolute path, do nothing.
+        ;;
+      //*)
+        # Not necessarily an ordinary path; POSIX reserves leading '//'
+        # and for example Cygwin uses it to access remote file shares
+        # over CIFS/SMB, so we conserve a leading double slash if found.
+        func_normal_abspath_altnamespace=/
+        ;;
+      /*)
+        # Absolute path, do nothing.
+        ;;
+      *)
+        # Relative path, prepend $cwd.
+        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+        ;;
+    esac
+
+    # Cancel out all the simple stuff to save iterations.  We also want
+    # the path to end with a slash for ease of parsing, so make sure
+    # there is one (and only one) here.
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
+    while :; do
+      # Processed it all yet?
+      if test / = "$func_normal_abspath_tpath"; then
+        # If we ascended to the root using ".." the result may be empty now.
+        if test -z "$func_normal_abspath_result"; then
+          func_normal_abspath_result=/
+        fi
+        break
+      fi
+      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_pathcar"`
+      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+          -e "$_G_pathcdr"`
+      # Figure out what to do with it
+      case $func_normal_abspath_tcomponent in
+        "")
+          # Trailing empty path component, ignore it.
+          ;;
+        ..)
+          # Parent dir; strip last assembled component from result.
+          func_dirname "$func_normal_abspath_result"
+          func_normal_abspath_result=$func_dirname_result
+          ;;
+        *)
+          # Actual path component, append it.
+          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
+          ;;
+      esac
+    done
+    # Restore leading double-slash if one was found on entry.
+    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+
+# func_notquiet ARG...
+# --------------------
+# Echo program name prefixed message only when not in quiet mode.
+func_notquiet ()
+{
+    $debug_cmd
+
+    $opt_quiet || func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+
+# func_relative_path SRCDIR DSTDIR
+# --------------------------------
+# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
+func_relative_path ()
+{
+    $debug_cmd
+
+    func_relative_path_result=
+    func_normal_abspath "$1"
+    func_relative_path_tlibdir=$func_normal_abspath_result
+    func_normal_abspath "$2"
+    func_relative_path_tbindir=$func_normal_abspath_result
+
+    # Ascend the tree starting from libdir
+    while :; do
+      # check if we have found a prefix of bindir
+      case $func_relative_path_tbindir in
+        $func_relative_path_tlibdir)
+          # found an exact match
+          func_relative_path_tcancelled=
+          break
+          ;;
+        $func_relative_path_tlibdir*)
+          # found a matching prefix
+          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+          func_relative_path_tcancelled=$func_stripname_result
+          if test -z "$func_relative_path_result"; then
+            func_relative_path_result=.
+          fi
+          break
+          ;;
+        *)
+          func_dirname $func_relative_path_tlibdir
+          func_relative_path_tlibdir=$func_dirname_result
+          if test -z "$func_relative_path_tlibdir"; then
+            # Have to descend all the way to the root!
+            func_relative_path_result=../$func_relative_path_result
+            func_relative_path_tcancelled=$func_relative_path_tbindir
+            break
+          fi
+          func_relative_path_result=../$func_relative_path_result
+          ;;
+      esac
+    done
+
+    # Now calculate path; take care to avoid doubling-up slashes.
+    func_stripname '' '/' "$func_relative_path_result"
+    func_relative_path_result=$func_stripname_result
+    func_stripname '/' '/' "$func_relative_path_tcancelled"
+    if test -n "$func_stripname_result"; then
+      func_append func_relative_path_result "/$func_stripname_result"
+    fi
+
+    # Normalisation. If bindir is libdir, return '.' else relative path.
+    if test -n "$func_relative_path_result"; then
+      func_stripname './' '' "$func_relative_path_result"
+      func_relative_path_result=$func_stripname_result
     fi
 
-    $ECHO "$my_tmpdir"
+    test -n "$func_relative_path_result" || func_relative_path_result=.
+
+    :
+}
+
+
+# func_quote_for_eval ARG...
+# --------------------------
+# Aesthetically quote ARGs to be evaled later.
+# This function returns two values:
+#   i) func_quote_for_eval_result
+#      double-quoted, suitable for a subsequent eval
+#  ii) func_quote_for_eval_unquoted_result
+#      has all characters that are still active within double
+#      quotes backslashified.
+func_quote_for_eval ()
+{
+    $debug_cmd
+
+    func_quote_for_eval_unquoted_result=
+    func_quote_for_eval_result=
+    while test 0 -lt $#; do
+      case $1 in
+        *[\\\`\"\$]*)
+	  _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
+        *)
+          _G_unquoted_arg=$1 ;;
+      esac
+      if test -n "$func_quote_for_eval_unquoted_result"; then
+	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
+      else
+        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
+      fi
+
+      case $_G_unquoted_arg in
+        # Double-quote args containing shell metacharacters to delay
+        # word splitting, command substitution and variable expansion
+        # for a subsequent eval.
+        # Many Bourne shells cannot handle close brackets correctly
+        # in scan sets, so we specify it separately.
+        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+          _G_quoted_arg=\"$_G_unquoted_arg\"
+          ;;
+        *)
+          _G_quoted_arg=$_G_unquoted_arg
+	  ;;
+      esac
+
+      if test -n "$func_quote_for_eval_result"; then
+	func_append func_quote_for_eval_result " $_G_quoted_arg"
+      else
+        func_append func_quote_for_eval_result "$_G_quoted_arg"
+      fi
+      shift
+    done
+}
+
+
+# func_quote_for_expand ARG
+# -------------------------
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    $debug_cmd
+
+    case $1 in
+      *[\\\`\"]*)
+	_G_arg=`$ECHO "$1" | $SED \
+	    -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        _G_arg=$1 ;;
+    esac
+
+    case $_G_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        _G_arg=\"$_G_arg\"
+        ;;
+    esac
+
+    func_quote_for_expand_result=$_G_arg
+}
+
+
+# func_stripname PREFIX SUFFIX NAME
+# ---------------------------------
+# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_stripname ()
+  {
+    $debug_cmd
+
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary variable first.
+    func_stripname_result=$3
+    func_stripname_result=${func_stripname_result#"$1"}
+    func_stripname_result=${func_stripname_result%"$2"}
+  }'
+else
+  func_stripname ()
+  {
+    $debug_cmd
+
+    case $2 in
+      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
+      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
+    esac
+  }
+fi
+
+
+# func_show_eval CMD [FAIL_EXP]
+# -----------------------------
+# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    $debug_cmd
+
+    _G_cmd=$1
+    _G_fail_exp=${2-':'}
+
+    func_quote_for_expand "$_G_cmd"
+    eval "func_notquiet $func_quote_for_expand_result"
+
+    $opt_dry_run || {
+      eval "$_G_cmd"
+      _G_status=$?
+      if test 0 -ne "$_G_status"; then
+	eval "(exit $_G_status); $_G_fail_exp"
+      fi
+    }
+}
+
+
+# func_show_eval_locale CMD [FAIL_EXP]
+# ------------------------------------
+# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    $debug_cmd
+
+    _G_cmd=$1
+    _G_fail_exp=${2-':'}
+
+    $opt_quiet || {
+      func_quote_for_expand "$_G_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    $opt_dry_run || {
+      eval "$_G_user_locale
+	    $_G_cmd"
+      _G_status=$?
+      eval "$_G_safe_locale"
+      if test 0 -ne "$_G_status"; then
+	eval "(exit $_G_status); $_G_fail_exp"
+      fi
+    }
+}
+
+
+# func_tr_sh
+# ----------
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+    $debug_cmd
+
+    case $1 in
+    [0-9]* | *[!a-zA-Z0-9_]*)
+      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
+      ;;
+    * )
+      func_tr_sh_result=$1
+      ;;
+    esac
+}
+
+
+# func_verbose ARG...
+# -------------------
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $debug_cmd
+
+    $opt_verbose && func_echo "$*"
+
+    :
+}
+
+
+# func_warn_and_continue ARG...
+# -----------------------------
+# Echo program name prefixed warning message to standard error.
+func_warn_and_continue ()
+{
+    $debug_cmd
+
+    $require_term_colors
+
+    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
+}
+
+
+# func_warning CATEGORY ARG...
+# ----------------------------
+# Echo program name prefixed warning message to standard error. Warning
+# messages can be filtered according to CATEGORY, where this function
+# elides messages where CATEGORY is not listed in the global variable
+# 'opt_warning_types'.
+func_warning ()
+{
+    $debug_cmd
+
+    # CATEGORY must be in the warning_categories list!
+    case " $warning_categories " in
+      *" $1 "*) ;;
+      *) func_internal_error "invalid warning category '$1'" ;;
+    esac
+
+    _G_category=$1
+    shift
+
+    case " $opt_warning_types " in
+      *" $_G_category "*) $warning_func ${1+"$@"} ;;
+    esac
+}
+
+
+# func_sort_ver VER1 VER2
+# -----------------------
+# 'sort -V' is not generally available.
+# Note this deviates from the version comparison in automake
+# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
+# but this should suffice as we won't be specifying old
+# version formats or redundant trailing .0 in bootstrap.conf.
+# If we did want full compatibility then we should probably
+# use m4_version_compare from autoconf.
+func_sort_ver ()
+{
+    $debug_cmd
+
+    printf '%s\n%s\n' "$1" "$2" \
+      | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n
+}
+
+# func_lt_ver PREV CURR
+# ---------------------
+# Return true if PREV and CURR are in the correct order according to
+# func_sort_ver, otherwise false.  Use it like this:
+#
+#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
+func_lt_ver ()
+{
+    $debug_cmd
+
+    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
+}
+
+
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
+#! /bin/sh
+
+# Set a version string for this script.
+scriptversion=2014-01-07.03; # UTC
+
+# A portable, pluggable option parser for Bourne shell.
+# Written by Gary V. Vaughan, 2010
+
+# Copyright (C) 2010-2015 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Please report bugs or propose patches to gary at gnu.org.
+
+
+## ------ ##
+## Usage. ##
+## ------ ##
+
+# This file is a library for parsing options in your shell scripts along
+# with assorted other useful supporting features that you can make use
+# of too.
+#
+# For the simplest scripts you might need only:
+#
+#   #!/bin/sh
+#   . relative/path/to/funclib.sh
+#   . relative/path/to/options-parser
+#   scriptversion=1.0
+#   func_options ${1+"$@"}
+#   eval set dummy "$func_options_result"; shift
+#   ...rest of your script...
+#
+# In order for the '--version' option to work, you will need to have a
+# suitably formatted comment like the one at the top of this file
+# starting with '# Written by ' and ending with '# warranty; '.
+#
+# For '-h' and '--help' to work, you will also need a one line
+# description of your script's purpose in a comment directly above the
+# '# Written by ' line, like the one at the top of this file.
+#
+# The default options also support '--debug', which will turn on shell
+# execution tracing (see the comment above debug_cmd below for another
+# use), and '--verbose' and the func_verbose function to allow your script
+# to display verbose messages only when your user has specified
+# '--verbose'.
+#
+# After sourcing this file, you can plug processing for additional
+# options by amending the variables from the 'Configuration' section
+# below, and following the instructions in the 'Option parsing'
+# section further down.
+
+## -------------- ##
+## Configuration. ##
+## -------------- ##
+
+# You should override these variables in your script after sourcing this
+# file so that they reflect the customisations you have added to the
+# option parser.
+
+# The usage line for option parsing errors and the start of '-h' and
+# '--help' output messages. You can embed shell variables for delayed
+# expansion at the time the message is displayed, but you will need to
+# quote other shell meta-characters carefully to prevent them being
+# expanded when the contents are evaled.
+usage='$progpath [OPTION]...'
+
+# Short help message in response to '-h' and '--help'.  Add to this or
+# override it after sourcing this library to reflect the full set of
+# options your script accepts.
+usage_message="\
+       --debug        enable verbose shell tracing
+   -W, --warnings=CATEGORY
+                      report the warnings falling in CATEGORY [all]
+   -v, --verbose      verbosely report processing
+       --version      print version information and exit
+   -h, --help         print short or long help message and exit
+"
+
+# Additional text appended to 'usage_message' in response to '--help'.
+long_help_message="
+Warning categories include:
+       'all'          show all warnings
+       'none'         turn off all the warnings
+       'error'        warnings are treated as fatal errors"
+
+# Help message printed before fatal option parsing errors.
+fatal_help="Try '\$progname --help' for more information."
+
+
+
+## ------------------------- ##
+## Hook function management. ##
+## ------------------------- ##
+
+# This section contains functions for adding, removing, and running hooks
+# to the main code.  A hook is just a named list of of function, that can
+# be run in order later on.
+
+# func_hookable FUNC_NAME
+# -----------------------
+# Declare that FUNC_NAME will run hooks added with
+# 'func_add_hook FUNC_NAME ...'.
+func_hookable ()
+{
+    $debug_cmd
+
+    func_append hookable_fns " $1"
+}
+
+
+# func_add_hook FUNC_NAME HOOK_FUNC
+# ---------------------------------
+# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
+# first have been declared "hookable" by a call to 'func_hookable'.
+func_add_hook ()
+{
+    $debug_cmd
+
+    case " $hookable_fns " in
+      *" $1 "*) ;;
+      *) func_fatal_error "'$1' does not accept hook functions." ;;
+    esac
+
+    eval func_append ${1}_hooks '" $2"'
+}
+
+
+# func_remove_hook FUNC_NAME HOOK_FUNC
+# ------------------------------------
+# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
+func_remove_hook ()
+{
+    $debug_cmd
+
+    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
+}
+
+
+# func_run_hooks FUNC_NAME [ARG]...
+# ---------------------------------
+# Run all hook functions registered to FUNC_NAME.
+# It is assumed that the list of hook functions contains nothing more
+# than a whitespace-delimited list of legal shell function names, and
+# no effort is wasted trying to catch shell meta-characters or preserve
+# whitespace.
+func_run_hooks ()
+{
+    $debug_cmd
+
+    case " $hookable_fns " in
+      *" $1 "*) ;;
+      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
+    esac
+
+    eval _G_hook_fns=\$$1_hooks; shift
+
+    for _G_hook in $_G_hook_fns; do
+      eval $_G_hook '"$@"'
+
+      # store returned options list back into positional
+      # parameters for next 'cmd' execution.
+      eval _G_hook_result=\$${_G_hook}_result
+      eval set dummy "$_G_hook_result"; shift
+    done
+
+    func_quote_for_eval ${1+"$@"}
+    func_run_hooks_result=$func_quote_for_eval_result
+}
+
+
+
+## --------------- ##
+## Option parsing. ##
+## --------------- ##
+
+# In order to add your own option parsing hooks, you must accept the
+# full positional parameter list in your hook function, remove any
+# options that you action, and then pass back the remaining unprocessed
+# options in '<hooked_function_name>_result', escaped suitably for
+# 'eval'.  Like this:
+#
+#    my_options_prep ()
+#    {
+#        $debug_cmd
+#
+#        # Extend the existing usage message.
+#        usage_message=$usage_message'
+#      -s, --silent       don'\''t print informational messages
+#    '
+#
+#        func_quote_for_eval ${1+"$@"}
+#        my_options_prep_result=$func_quote_for_eval_result
+#    }
+#    func_add_hook func_options_prep my_options_prep
+#
+#
+#    my_silent_option ()
+#    {
+#        $debug_cmd
+#
+#        # Note that for efficiency, we parse as many options as we can
+#        # recognise in a loop before passing the remainder back to the
+#        # caller on the first unrecognised argument we encounter.
+#        while test $# -gt 0; do
+#          opt=$1; shift
+#          case $opt in
+#            --silent|-s) opt_silent=: ;;
+#            # Separate non-argument short options:
+#            -s*)         func_split_short_opt "$_G_opt"
+#                         set dummy "$func_split_short_opt_name" \
+#                             "-$func_split_short_opt_arg" ${1+"$@"}
+#                         shift
+#                         ;;
+#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
+#          esac
+#        done
+#
+#        func_quote_for_eval ${1+"$@"}
+#        my_silent_option_result=$func_quote_for_eval_result
+#    }
+#    func_add_hook func_parse_options my_silent_option
+#
+#
+#    my_option_validation ()
+#    {
+#        $debug_cmd
+#
+#        $opt_silent && $opt_verbose && func_fatal_help "\
+#    '--silent' and '--verbose' options are mutually exclusive."
+#
+#        func_quote_for_eval ${1+"$@"}
+#        my_option_validation_result=$func_quote_for_eval_result
+#    }
+#    func_add_hook func_validate_options my_option_validation
+#
+# You'll alse need to manually amend $usage_message to reflect the extra
+# options you parse.  It's preferable to append if you can, so that
+# multiple option parsing hooks can be added safely.
+
+
+# func_options [ARG]...
+# ---------------------
+# All the functions called inside func_options are hookable. See the
+# individual implementations for details.
+func_hookable func_options
+func_options ()
+{
+    $debug_cmd
+
+    func_options_prep ${1+"$@"}
+    eval func_parse_options \
+        ${func_options_prep_result+"$func_options_prep_result"}
+    eval func_validate_options \
+        ${func_parse_options_result+"$func_parse_options_result"}
+
+    eval func_run_hooks func_options \
+        ${func_validate_options_result+"$func_validate_options_result"}
+
+    # save modified positional parameters for caller
+    func_options_result=$func_run_hooks_result
 }
 
 
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
+# func_options_prep [ARG]...
+# --------------------------
+# All initialisations required before starting the option parse loop.
+# Note that when calling hook functions, we pass through the list of
+# positional parameters.  If a hook function modifies that list, and
+# needs to propogate that back to rest of this script, then the complete
+# modified list must be put in 'func_run_hooks_result' before
+# returning.
+func_hookable func_options_prep
+func_options_prep ()
 {
-    case $1 in
-      *[\\\`\"\$]*)
-	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
-      *)
-        func_quote_for_eval_unquoted_result="$1" ;;
-    esac
+    $debug_cmd
 
-    case $func_quote_for_eval_unquoted_result in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting, command substitution and and variable
-      # expansion for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
-        ;;
-      *)
-        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
-    esac
+    # Option defaults:
+    opt_verbose=false
+    opt_warning_types=
+
+    func_run_hooks func_options_prep ${1+"$@"}
+
+    # save modified positional parameters for caller
+    func_options_prep_result=$func_run_hooks_result
 }
 
 
-# func_quote_for_expand arg
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
+# func_parse_options [ARG]...
+# ---------------------------
+# The main option parsing loop.
+func_hookable func_parse_options
+func_parse_options ()
 {
-    case $1 in
-      *[\\\`\"]*)
-	my_arg=`$ECHO "$1" | $SED \
-	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
-      *)
-        my_arg="$1" ;;
-    esac
+    $debug_cmd
 
-    case $my_arg in
-      # Double-quote args containing shell metacharacters to delay
-      # word splitting and command substitution for a subsequent eval.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, so we specify it separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-        my_arg="\"$my_arg\""
-        ;;
-    esac
+    func_parse_options_result=
 
-    func_quote_for_expand_result="$my_arg"
-}
+    # this just eases exit handling
+    while test $# -gt 0; do
+      # Defer to hook functions for initial option parsing, so they
+      # get priority in the event of reusing an option name.
+      func_run_hooks func_parse_options ${1+"$@"}
 
+      # Adjust func_parse_options positional parameters to match
+      eval set dummy "$func_run_hooks_result"; shift
 
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
-{
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
+      # Break out of the loop if we already parsed every option.
+      test $# -gt 0 || break
 
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
+      _G_opt=$1
+      shift
+      case $_G_opt in
+        --debug|-x)   debug_cmd='set -x'
+                      func_echo "enabling shell trace mode"
+                      $debug_cmd
+                      ;;
+
+        --no-warnings|--no-warning|--no-warn)
+                      set dummy --warnings none ${1+"$@"}
+                      shift
+		      ;;
 
-    if ${opt_dry_run-false}; then :; else
-      eval "$my_cmd"
-      my_status=$?
-      if test "$my_status" -eq 0; then :; else
-	eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
+        --warnings|--warning|-W)
+                      test $# = 0 && func_missing_arg $_G_opt && break
+                      case " $warning_categories $1" in
+                        *" $1 "*)
+                          # trailing space prevents matching last $1 above
+                          func_append_uniq opt_warning_types " $1"
+                          ;;
+                        *all)
+                          opt_warning_types=$warning_categories
+                          ;;
+                        *none)
+                          opt_warning_types=none
+                          warning_func=:
+                          ;;
+                        *error)
+                          opt_warning_types=$warning_categories
+                          warning_func=func_fatal_error
+                          ;;
+                        *)
+                          func_fatal_error \
+                             "unsupported warning category: '$1'"
+                          ;;
+                      esac
+                      shift
+                      ;;
+
+        --verbose|-v) opt_verbose=: ;;
+        --version)    func_version ;;
+        -\?|-h)       func_usage ;;
+        --help)       func_help ;;
+
+	# Separate optargs to long options (plugins may need this):
+	--*=*)        func_split_equals "$_G_opt"
+	              set dummy "$func_split_equals_lhs" \
+                          "$func_split_equals_rhs" ${1+"$@"}
+                      shift
+                      ;;
+
+       # Separate optargs to short options:
+        -W*)
+                      func_split_short_opt "$_G_opt"
+                      set dummy "$func_split_short_opt_name" \
+                          "$func_split_short_opt_arg" ${1+"$@"}
+                      shift
+                      ;;
+
+        # Separate non-argument short options:
+        -\?*|-h*|-v*|-x*)
+                      func_split_short_opt "$_G_opt"
+                      set dummy "$func_split_short_opt_name" \
+                          "-$func_split_short_opt_arg" ${1+"$@"}
+                      shift
+                      ;;
+
+        --)           break ;;
+        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
+        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
+      esac
+    done
+
+    # save modified positional parameters for caller
+    func_quote_for_eval ${1+"$@"}
+    func_parse_options_result=$func_quote_for_eval_result
 }
 
 
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
-# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.  Use the saved locale for evaluation.
-func_show_eval_locale ()
+# func_validate_options [ARG]...
+# ------------------------------
+# Perform any sanity checks on option settings and/or unconsumed
+# arguments.
+func_hookable func_validate_options
+func_validate_options ()
 {
-    my_cmd="$1"
-    my_fail_exp="${2-:}"
+    $debug_cmd
 
-    ${opt_silent-false} || {
-      func_quote_for_expand "$my_cmd"
-      eval "func_echo $func_quote_for_expand_result"
-    }
+    # Display all warnings if -W was not given.
+    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
 
-    if ${opt_dry_run-false}; then :; else
-      eval "$lt_user_locale
-	    $my_cmd"
-      my_status=$?
-      eval "$lt_safe_locale"
-      if test "$my_status" -eq 0; then :; else
-	eval "(exit $my_status); $my_fail_exp"
-      fi
-    fi
-}
+    func_run_hooks func_validate_options ${1+"$@"}
 
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result.  All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
-{
-  case $1 in
-  [0-9]* | *[!a-zA-Z0-9_]*)
-    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
-    ;;
-  * )
-    func_tr_sh_result=$1
-    ;;
-  esac
+    # Bail if the options were screwed!
+    $exit_cmd $EXIT_FAILURE
+
+    # save modified positional parameters for caller
+    func_validate_options_result=$func_run_hooks_result
 }
 
 
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
-{
-    $opt_debug
 
-    $SED -n '/(C)/!b go
-	:more
-	/\./!{
-	  N
-	  s/\n# / /
-	  b more
-	}
-	:go
-	/^# '$PROGRAM' (GNU /,/# warranty; / {
-        s/^# //
-	s/^# *$//
-        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
-        p
-     }' < "$progpath"
-     exit $?
-}
+## ----------------- ##
+## Helper functions. ##
+## ----------------- ##
 
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
+# This section contains the helper functions used by the rest of the
+# hookable option parser framework in ascii-betical order.
+
+
+# func_fatal_help ARG...
+# ----------------------
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
 {
-    $opt_debug
+    $debug_cmd
 
-    $SED -n '/^# Usage:/,/^#  *.*--help/ {
-        s/^# //
-	s/^# *$//
-	s/\$progname/'$progname'/
-	p
-    }' < "$progpath"
-    echo
-    $ECHO "run \`$progname --help | more' for full usage"
-    exit $?
+    eval \$ECHO \""Usage: $usage"\"
+    eval \$ECHO \""$fatal_help"\"
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
 }
 
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
+
+# func_help
+# ---------
+# Echo long help message to standard output and exit.
 func_help ()
 {
-    $opt_debug
-
-    $SED -n '/^# Usage:/,/# Report bugs to/ {
-	:print
-        s/^# //
-	s/^# *$//
-	s*\$progname*'$progname'*
-	s*\$host*'"$host"'*
-	s*\$SHELL*'"$SHELL"'*
-	s*\$LTCC*'"$LTCC"'*
-	s*\$LTCFLAGS*'"$LTCFLAGS"'*
-	s*\$LD*'"$LD"'*
-	s/\$with_gnu_ld/'"$with_gnu_ld"'/
-	s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
-	s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
-	p
-	d
-     }
-     /^# .* home page:/b print
-     /^# General help using/b print
-     ' < "$progpath"
-    ret=$?
-    if test -z "$1"; then
-      exit $ret
-    fi
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message"
+    exit 0
 }
 
-# func_missing_arg argname
+
+# func_missing_arg ARGNAME
+# ------------------------
 # Echo program name prefixed message to standard error and set global
 # exit_cmd.
 func_missing_arg ()
 {
-    $opt_debug
+    $debug_cmd
 
-    func_error "missing argument for $1."
+    func_error "Missing argument for '$1'."
     exit_cmd=exit
 }
 
 
-# func_split_short_opt shortopt
+# func_split_equals STRING
+# ------------------------
+# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
+# splitting STRING at the '=' sign.
+test -z "$_G_HAVE_XSI_OPS" \
+    && (eval 'x=a/b/c;
+      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
+    && _G_HAVE_XSI_OPS=yes
+
+if test yes = "$_G_HAVE_XSI_OPS"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_split_equals ()
+  {
+      $debug_cmd
+
+      func_split_equals_lhs=${1%%=*}
+      func_split_equals_rhs=${1#*=}
+      test "x$func_split_equals_lhs" = "x$1" \
+        && func_split_equals_rhs=
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_split_equals ()
+  {
+      $debug_cmd
+
+      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
+      func_split_equals_rhs=
+      test "x$func_split_equals_lhs" = "x$1" \
+        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
+  }
+fi #func_split_equals
+
+
+# func_split_short_opt SHORTOPT
+# -----------------------------
 # Set func_split_short_opt_name and func_split_short_opt_arg shell
 # variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
+if test yes = "$_G_HAVE_XSI_OPS"
+then
+  # This is an XSI compatible shell, allowing a faster implementation...
+  eval 'func_split_short_opt ()
+  {
+      $debug_cmd
+
+      func_split_short_opt_arg=${1#??}
+      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
+  }'
+else
+  # ...otherwise fall back to using expr, which is often a shell builtin.
+  func_split_short_opt ()
+  {
+      $debug_cmd
+
+      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
+      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
+  }
+fi #func_split_short_opt
+
+
+# func_usage
+# ----------
+# Echo short help message to standard output and exit.
+func_usage ()
 {
-    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
-    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+    $debug_cmd
 
-    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
-    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
+    func_usage_message
+    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
+    exit 0
+}
 
 
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
+# func_usage_message
+# ------------------
+# Echo short help message to standard output.
+func_usage_message ()
 {
-    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
-    my_sed_long_arg='1s/^--[^=]*=//'
+    $debug_cmd
 
-    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
-    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
+    eval \$ECHO \""Usage: $usage"\"
+    echo
+    $SED -n 's|^# ||
+        /^Written by/{
+          x;p;x
+        }
+	h
+	/^Written by/q' < "$progpath"
+    echo
+    eval \$ECHO \""$usage_message"\"
+}
 
-exit_cmd=:
 
+# func_version
+# ------------
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $debug_cmd
 
+    printf '%s\n' "$progname $scriptversion"
+    $SED -n '
+        /(C)/!b go
+        :more
+        /\./!{
+          N
+          s|\n# | |
+          b more
+        }
+        :go
+        /^# Written by /,/# warranty; / {
+          s|^# ||
+          s|^# *$||
+          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
+          p
+        }
+        /^# Written by / {
+          s|^# ||
+          p
+        }
+        /^warranty; /q' < "$progpath"
 
+    exit $?
+}
 
 
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
+# Local variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'before-save-hook 'time-stamp)
+# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
+# time-stamp-time-zone: "UTC"
+# End:
 
-# Global variables.
-nonopt=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
+# Set a version string.
+scriptversion='(GNU libtool) 2.4.6'
 
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
 
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
+# func_echo ARG...
+# ----------------
+# Libtool also displays the current mode in messages, so override
+# funclib.sh func_echo with this custom definition.
+func_echo ()
 {
-    eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
+    $debug_cmd
 
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
-    func_quote_for_eval "${2}"
-    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
+    _G_message=$*
 
+    func_echo_IFS=$IFS
+    IFS=$nl
+    for _G_line in $_G_message; do
+      IFS=$func_echo_IFS
+      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
+    done
+    IFS=$func_echo_IFS
+}
 
-# func_arith arithmetic-term...
-func_arith ()
+
+# func_warning ARG...
+# -------------------
+# Libtool warnings are not categorized, so override funclib.sh
+# func_warning with this simpler definition.
+func_warning ()
 {
-    func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
+    $debug_cmd
 
+    $warning_func ${1+"$@"}
+}
 
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
-    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
 
+## ---------------- ##
+## Options parsing. ##
+## ---------------- ##
+
+# Hook in the functions to make sure our own options are parsed during
+# the option parsing loop.
+
+usage='$progpath [OPTION]... [MODE-ARG]...'
+
+# Short help message in response to '-h'.
+usage_message="Options:
+       --config             show all configuration variables
+       --debug              enable verbose shell tracing
+   -n, --dry-run            display commands without modifying any files
+       --features           display basic configuration information and exit
+       --mode=MODE          use operation mode MODE
+       --no-warnings        equivalent to '-Wnone'
+       --preserve-dup-deps  don't remove duplicate dependency libraries
+       --quiet, --silent    don't print informational messages
+       --tag=TAG            use configuration variables from tag TAG
+   -v, --verbose            print more informational messages than default
+       --version            print version information
+   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
+   -h, --help, --help-all   print short, long, or detailed help message
+"
 
-# func_lo2o object
-func_lo2o ()
+# Additional text appended to 'usage_message' in response to '--help'.
+func_help ()
 {
-    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
+    $debug_cmd
+
+    func_usage_message
+    $ECHO "$long_help_message
+
+MODE must be one of the following:
+
+       clean           remove files from the build directory
+       compile         compile a source file into a libtool object
+       execute         automatically set library path, then run a program
+       finish          complete the installation of libtool libraries
+       install         install libraries or executables
+       link            create a library or an executable
+       uninstall       remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE.  When passed as first option,
+'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
+Try '$progname --help --mode=MODE' for a more detailed description of MODE.
+
+When reporting a bug, please describe a test case to reproduce it and
+include the following information:
+
+       host-triplet:   $host
+       shell:          $SHELL
+       compiler:       $LTCC
+       compiler flags: $LTCFLAGS
+       linker:         $LD (gnu? $with_gnu_ld)
+       version:        $progname (GNU libtool) 2.4.6
+       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
+       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
+
+Report bugs to <bug-libtool at gnu.org>.
+GNU libtool home page: <http://www.gnu.org/s/libtool/>.
+General help using GNU software: <http://www.gnu.org/gethelp/>."
+    exit 0
+}
 
 
-# func_xform libobj-or-source
-func_xform ()
-{
-    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
+# func_lo2o OBJECT-NAME
+# ---------------------
+# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
+# object suffix.
+
+lo2o=s/\\.lo\$/.$objext/
+o2lo=s/\\.$objext\$/.lo/
+
+if test yes = "$_G_HAVE_XSI_OPS"; then
+  eval 'func_lo2o ()
+  {
+    case $1 in
+      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
+      *   ) func_lo2o_result=$1               ;;
+    esac
+  }'
+
+  # func_xform LIBOBJ-OR-SOURCE
+  # ---------------------------
+  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
+  # suffix to a '.lo' libtool-object suffix.
+  eval 'func_xform ()
+  {
+    func_xform_result=${1%.*}.lo
+  }'
+else
+  # ...otherwise fall back to using sed.
+  func_lo2o ()
+  {
+    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
+  }
+
+  func_xform ()
+  {
+    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
+  }
+fi
 
 
-# func_fatal_configuration arg...
+# func_fatal_configuration ARG...
+# -------------------------------
 # Echo program name prefixed message to standard error, followed by
 # a configuration failure hint, and exit.
 func_fatal_configuration ()
 {
-    func_error ${1+"$@"}
-    func_error "See the $PACKAGE documentation for more information."
-    func_fatal_error "Fatal configuration error."
+    func__fatal_error ${1+"$@"} \
+      "See the $PACKAGE documentation for more information." \
+      "Fatal configuration error."
 }
 
 
 # func_config
+# -----------
 # Display the configuration for all the tags in this script.
 func_config ()
 {
@@ -915,17 +2149,19 @@ func_config ()
     exit $?
 }
 
+
 # func_features
+# -------------
 # Display the features supported by this script.
 func_features ()
 {
     echo "host: $host"
-    if test "$build_libtool_libs" = yes; then
+    if test yes = "$build_libtool_libs"; then
       echo "enable shared libraries"
     else
       echo "disable shared libraries"
     fi
-    if test "$build_old_libs" = yes; then
+    if test yes = "$build_old_libs"; then
       echo "enable static libraries"
     else
       echo "disable static libraries"
@@ -934,314 +2170,350 @@ func_features ()
     exit $?
 }
 
-# func_enable_tag tagname
+
+# func_enable_tag TAGNAME
+# -----------------------
 # Verify that TAGNAME is valid, and either flag an error and exit, or
 # enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
 # variable here.
 func_enable_tag ()
 {
-  # Global variable:
-  tagname="$1"
+    # Global variable:
+    tagname=$1
 
-  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
-  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
-  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+    sed_extractcf=/$re_begincf/,/$re_endcf/p
 
-  # Validate tagname.
-  case $tagname in
-    *[!-_A-Za-z0-9,/]*)
-      func_fatal_error "invalid tag name: $tagname"
-      ;;
-  esac
+    # Validate tagname.
+    case $tagname in
+      *[!-_A-Za-z0-9,/]*)
+        func_fatal_error "invalid tag name: $tagname"
+        ;;
+    esac
 
-  # Don't test for the "default" C tag, as we know it's
-  # there but not specially marked.
-  case $tagname in
-    CC) ;;
+    # Don't test for the "default" C tag, as we know it's
+    # there but not specially marked.
+    case $tagname in
+        CC) ;;
     *)
-      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
-	taglist="$taglist $tagname"
-
-	# Evaluate the configuration.  Be careful to quote the path
-	# and the sed script, to avoid splitting on whitespace, but
-	# also don't use non-portable quotes within backquotes within
-	# quotes we have to do it in 2 steps:
-	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
-	eval "$extractedcf"
-      else
-	func_error "ignoring unknown tag $tagname"
-      fi
-      ;;
-  esac
+        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	  taglist="$taglist $tagname"
+
+	  # Evaluate the configuration.  Be careful to quote the path
+	  # and the sed script, to avoid splitting on whitespace, but
+	  # also don't use non-portable quotes within backquotes within
+	  # quotes we have to do it in 2 steps:
+	  extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	  eval "$extractedcf"
+        else
+	  func_error "ignoring unknown tag $tagname"
+        fi
+        ;;
+    esac
 }
 
+
 # func_check_version_match
+# ------------------------
 # Ensure that we are using m4 macros, and libtool script from the same
 # release of libtool.
 func_check_version_match ()
 {
-  if test "$package_revision" != "$macro_revision"; then
-    if test "$VERSION" != "$macro_version"; then
-      if test -z "$macro_version"; then
-        cat >&2 <<_LT_EOF
+    if test "$package_revision" != "$macro_revision"; then
+      if test "$VERSION" != "$macro_version"; then
+        if test -z "$macro_version"; then
+          cat >&2 <<_LT_EOF
 $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 $progname: definition of this LT_INIT comes from an older release.
 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 $progname: and run autoconf again.
 _LT_EOF
-      else
-        cat >&2 <<_LT_EOF
+        else
+          cat >&2 <<_LT_EOF
 $progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
 $progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
 $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
 $progname: and run autoconf again.
 _LT_EOF
-      fi
-    else
-      cat >&2 <<_LT_EOF
+        fi
+      else
+        cat >&2 <<_LT_EOF
 $progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
 $progname: but the definition of this LT_INIT comes from revision $macro_revision.
 $progname: You should recreate aclocal.m4 with macros from revision $package_revision
 $progname: of $PACKAGE $VERSION and run autoconf again.
 _LT_EOF
-    fi
+      fi
 
-    exit $EXIT_MISMATCH
-  fi
+      exit $EXIT_MISMATCH
+    fi
 }
 
 
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
-  shift; set dummy --mode clean ${1+"$@"}; shift
-  ;;
-compile|compil|compi|comp|com|co|c)
-  shift; set dummy --mode compile ${1+"$@"}; shift
-  ;;
-execute|execut|execu|exec|exe|ex|e)
-  shift; set dummy --mode execute ${1+"$@"}; shift
-  ;;
-finish|finis|fini|fin|fi|f)
-  shift; set dummy --mode finish ${1+"$@"}; shift
-  ;;
-install|instal|insta|inst|ins|in|i)
-  shift; set dummy --mode install ${1+"$@"}; shift
-  ;;
-link|lin|li|l)
-  shift; set dummy --mode link ${1+"$@"}; shift
-  ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
-  shift; set dummy --mode uninstall ${1+"$@"}; shift
-  ;;
-esac
+# libtool_options_prep [ARG]...
+# -----------------------------
+# Preparation for options parsed by libtool.
+libtool_options_prep ()
+{
+    $debug_mode
 
+    # Option defaults:
+    opt_config=false
+    opt_dlopen=
+    opt_dry_run=false
+    opt_help=false
+    opt_mode=
+    opt_preserve_dup_deps=false
+    opt_quiet=false
 
+    nonopt=
+    preserve_args=
 
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_warning=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
+    # Shorthand for --mode=foo, only valid as the first argument
+    case $1 in
+    clean|clea|cle|cl)
+      shift; set dummy --mode clean ${1+"$@"}; shift
+      ;;
+    compile|compil|compi|comp|com|co|c)
+      shift; set dummy --mode compile ${1+"$@"}; shift
+      ;;
+    execute|execut|execu|exec|exe|ex|e)
+      shift; set dummy --mode execute ${1+"$@"}; shift
+      ;;
+    finish|finis|fini|fin|fi|f)
+      shift; set dummy --mode finish ${1+"$@"}; shift
+      ;;
+    install|instal|insta|inst|ins|in|i)
+      shift; set dummy --mode install ${1+"$@"}; shift
+      ;;
+    link|lin|li|l)
+      shift; set dummy --mode link ${1+"$@"}; shift
+      ;;
+    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+      shift; set dummy --mode uninstall ${1+"$@"}; shift
+      ;;
+    esac
+
+    # Pass back the list of options.
+    func_quote_for_eval ${1+"$@"}
+    libtool_options_prep_result=$func_quote_for_eval_result
+}
+func_add_hook func_options_prep libtool_options_prep
 
 
-# Parse options once, thoroughly.  This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
+# libtool_parse_options [ARG]...
+# ---------------------------------
+# Provide handling for libtool specific options.
+libtool_parse_options ()
 {
-  # this just eases exit handling
-  while test $# -gt 0; do
-    opt="$1"
-    shift
-    case $opt in
-      --debug|-x)	opt_debug='set -x'
-			func_echo "enabling shell trace mode"
-			$opt_debug
-			;;
-      --dry-run|--dryrun|-n)
-			opt_dry_run=:
-			;;
-      --config)
-			opt_config=:
-func_config
-			;;
-      --dlopen|-dlopen)
-			optarg="$1"
-			opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
-			shift
-			;;
-      --preserve-dup-deps)
-			opt_preserve_dup_deps=:
-			;;
-      --features)
-			opt_features=:
-func_features
-			;;
-      --finish)
-			opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
-			;;
-      --help)
-			opt_help=:
-			;;
-      --help-all)
-			opt_help_all=:
-opt_help=': help-all'
-			;;
-      --mode)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_mode="$optarg"
-case $optarg in
-  # Valid mode arguments:
-  clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
-  # Catch anything else as an error
-  *) func_error "invalid argument for $opt"
-     exit_cmd=exit
-     break
-     ;;
-esac
-			shift
-			;;
-      --no-silent|--no-quiet)
-			opt_silent=false
-func_append preserve_args " $opt"
-			;;
-      --no-warning|--no-warn)
-			opt_warning=false
-func_append preserve_args " $opt"
-			;;
-      --no-verbose)
-			opt_verbose=false
-func_append preserve_args " $opt"
-			;;
-      --silent|--quiet)
-			opt_silent=:
-func_append preserve_args " $opt"
-        opt_verbose=false
-			;;
-      --verbose|-v)
-			opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
-			;;
-      --tag)
-			test $# = 0 && func_missing_arg $opt && break
-			optarg="$1"
-			opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
-			shift
-			;;
-
-      -\?|-h)		func_usage				;;
-      --help)		func_help				;;
-      --version)	func_version				;;
-
-      # Separate optargs to long options:
-      --*=*)
-			func_split_long_opt "$opt"
-			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
-			shift
-			;;
-
-      # Separate non-argument short options:
-      -\?*|-h*|-n*|-v*)
-			func_split_short_opt "$opt"
-			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
-			shift
-			;;
-
-      --)		break					;;
-      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
-      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
-    esac
-  done
+    $debug_cmd
 
-  # Validate options:
+    # Perform our own loop to consume as many options as possible in
+    # each iteration.
+    while test $# -gt 0; do
+      _G_opt=$1
+      shift
+      case $_G_opt in
+        --dry-run|--dryrun|-n)
+                        opt_dry_run=:
+                        ;;
+
+        --config)       func_config ;;
+
+        --dlopen|-dlopen)
+                        opt_dlopen="${opt_dlopen+$opt_dlopen
+}$1"
+                        shift
+                        ;;
+
+        --preserve-dup-deps)
+                        opt_preserve_dup_deps=: ;;
+
+        --features)     func_features ;;
+
+        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
+
+        --help)         opt_help=: ;;
+
+        --help-all)     opt_help=': help-all' ;;
+
+        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
+                        opt_mode=$1
+                        case $1 in
+                          # Valid mode arguments:
+                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+                          # Catch anything else as an error
+                          *) func_error "invalid argument for $_G_opt"
+                             exit_cmd=exit
+                             break
+                             ;;
+                        esac
+                        shift
+                        ;;
+
+        --no-silent|--no-quiet)
+                        opt_quiet=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --no-warnings|--no-warning|--no-warn)
+                        opt_warning=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --no-verbose)
+                        opt_verbose=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --silent|--quiet)
+                        opt_quiet=:
+                        opt_verbose=false
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
+                        opt_tag=$1
+                        func_append preserve_args " $_G_opt $1"
+                        func_enable_tag "$1"
+                        shift
+                        ;;
+
+        --verbose|-v)   opt_quiet=false
+                        opt_verbose=:
+                        func_append preserve_args " $_G_opt"
+                        ;;
+
+	# An option not handled by this hook function:
+        *)		set dummy "$_G_opt" ${1+"$@"};	shift; break  ;;
+      esac
+    done
 
-  # save first non-option argument
-  if test "$#" -gt 0; then
-    nonopt="$opt"
-    shift
-  fi
 
-  # preserve --debug
-  test "$opt_debug" = : || func_append preserve_args " --debug"
+    # save modified positional parameters for caller
+    func_quote_for_eval ${1+"$@"}
+    libtool_parse_options_result=$func_quote_for_eval_result
+}
+func_add_hook func_parse_options libtool_parse_options
 
-  case $host in
-    *cygwin* | *mingw* | *pw32* | *cegcc*)
-      # don't eliminate duplications in $postdeps and $predeps
-      opt_duplicate_compiler_generated_deps=:
-      ;;
-    *)
-      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
-      ;;
-  esac
 
-  $opt_help || {
-    # Sanity checks first:
-    func_check_version_match
 
-    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-      func_fatal_configuration "not configured to build any kind of library"
+# libtool_validate_options [ARG]...
+# ---------------------------------
+# Perform any sanity checks on option settings and/or unconsumed
+# arguments.
+libtool_validate_options ()
+{
+    # save first non-option argument
+    if test 0 -lt $#; then
+      nonopt=$1
+      shift
     fi
 
-    # Darwin sucks
-    eval std_shrext=\"$shrext_cmds\"
+    # preserve --debug
+    test : = "$debug_cmd" || func_append preserve_args " --debug"
 
-    # Only execute mode is allowed to have -dlopen flags.
-    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
-      func_error "unrecognized option \`-dlopen'"
-      $ECHO "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
+    case $host in
+      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
+      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
+      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
+        # don't eliminate duplications in $postdeps and $predeps
+        opt_duplicate_compiler_generated_deps=:
+        ;;
+      *)
+        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+        ;;
+    esac
 
-    # Change the help message to a mode-specific one.
-    generic_help="$help"
-    help="Try \`$progname --help --mode=$opt_mode' for more information."
-  }
+    $opt_help || {
+      # Sanity checks first:
+      func_check_version_match
+
+      test yes != "$build_libtool_libs" \
+        && test yes != "$build_old_libs" \
+        && func_fatal_configuration "not configured to build any kind of library"
+
+      # Darwin sucks
+      eval std_shrext=\"$shrext_cmds\"
+
+      # Only execute mode is allowed to have -dlopen flags.
+      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
+        func_error "unrecognized option '-dlopen'"
+        $ECHO "$help" 1>&2
+        exit $EXIT_FAILURE
+      fi
 
+      # Change the help message to a mode-specific one.
+      generic_help=$help
+      help="Try '$progname --help --mode=$opt_mode' for more information."
+    }
 
-  # Bail if the options were screwed
-  $exit_cmd $EXIT_FAILURE
+    # Pass back the unparsed argument list
+    func_quote_for_eval ${1+"$@"}
+    libtool_validate_options_result=$func_quote_for_eval_result
 }
+func_add_hook func_validate_options libtool_validate_options
 
 
+# Process options as early as possible so that --help and --version
+# can return quickly.
+func_options ${1+"$@"}
+eval set dummy "$func_options_result"; shift
+
 
 
 ## ----------- ##
 ##    Main.    ##
 ## ----------- ##
 
+magic='%%%MAGIC variable%%%'
+magic_exe='%%%MAGIC EXE variable%%%'
+
+# Global variables.
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# func_generated_by_libtool
+# True iff stdin has been generated by Libtool. This function is only
+# a basic sanity check; it will hardly flush out determined imposters.
+func_generated_by_libtool_p ()
+{
+  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
 # func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
+# True iff FILE is a libtool '.la' library or '.lo' object file.
 # This function is only a basic sanity check; it will hardly flush out
 # determined imposters.
 func_lalib_p ()
 {
     test -f "$1" &&
-      $SED -e 4q "$1" 2>/dev/null \
-        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
 }
 
 # func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
+# True iff FILE is a libtool '.la' library or '.lo' object file.
 # This function implements the same check as func_lalib_p without
 # resorting to external programs.  To this end, it redirects stdin and
 # closes it afterwards, without saving the original file descriptor.
 # As a safety measure, use it only where a negative result would be
-# fatal anyway.  Works if `file' does not exist.
+# fatal anyway.  Works if 'file' does not exist.
 func_lalib_unsafe_p ()
 {
     lalib_p=no
@@ -1249,13 +2521,13 @@ func_lalib_unsafe_p ()
 	for lalib_p_l in 1 2 3 4
 	do
 	    read lalib_p_line
-	    case "$lalib_p_line" in
+	    case $lalib_p_line in
 		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
 	    esac
 	done
 	exec 0<&5 5<&-
     fi
-    test "$lalib_p" = yes
+    test yes = "$lalib_p"
 }
 
 # func_ltwrapper_script_p file
@@ -1264,7 +2536,8 @@ func_lalib_unsafe_p ()
 # determined imposters.
 func_ltwrapper_script_p ()
 {
-    func_lalib_p "$1"
+    test -f "$1" &&
+      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
 }
 
 # func_ltwrapper_executable_p file
@@ -1289,7 +2562,7 @@ func_ltwrapper_scriptname ()
 {
     func_dirname_and_basename "$1" "" "."
     func_stripname '' '.exe' "$func_basename_result"
-    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
 }
 
 # func_ltwrapper_p file
@@ -1308,11 +2581,13 @@ func_ltwrapper_p ()
 # FAIL_CMD may read-access the current command in variable CMD!
 func_execute_cmds ()
 {
-    $opt_debug
+    $debug_cmd
+
     save_ifs=$IFS; IFS='~'
     for cmd in $1; do
-      IFS=$save_ifs
+      IFS=$sp$nl
       eval cmd=\"$cmd\"
+      IFS=$save_ifs
       func_show_eval "$cmd" "${2-:}"
     done
     IFS=$save_ifs
@@ -1324,10 +2599,11 @@ func_execute_cmds ()
 # Note that it is not necessary on cygwin/mingw to append a dot to
 # FILE even if both FILE and FILE.exe exist: automatic-append-.exe
 # behavior happens only for exec(3), not for open(2)!  Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
+# 'FILE.' does not work on cygwin managed mounts.
 func_source ()
 {
-    $opt_debug
+    $debug_cmd
+
     case $1 in
     */* | *\\*)	. "$1" ;;
     *)		. "./$1" ;;
@@ -1354,10 +2630,10 @@ func_resolve_sysroot ()
 # store the result into func_replace_sysroot_result.
 func_replace_sysroot ()
 {
-  case "$lt_sysroot:$1" in
+  case $lt_sysroot:$1 in
   ?*:"$lt_sysroot"*)
     func_stripname "$lt_sysroot" '' "$1"
-    func_replace_sysroot_result="=$func_stripname_result"
+    func_replace_sysroot_result='='$func_stripname_result
     ;;
   *)
     # Including no sysroot.
@@ -1374,7 +2650,8 @@ func_replace_sysroot ()
 # arg is usually of the form 'gcc ...'
 func_infer_tag ()
 {
-    $opt_debug
+    $debug_cmd
+
     if test -n "$available_tags" && test -z "$tagname"; then
       CC_quoted=
       for arg in $CC; do
@@ -1393,7 +2670,7 @@ func_infer_tag ()
 	for z in $available_tags; do
 	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
 	    # Evaluate the configuration.
-	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
 	    CC_quoted=
 	    for arg in $CC; do
 	      # Double-quote args containing other shell metacharacters.
@@ -1418,7 +2695,7 @@ func_infer_tag ()
 	# line option must be used.
 	if test -z "$tagname"; then
 	  func_echo "unable to infer tagged configuration"
-	  func_fatal_error "specify a tag with \`--tag'"
+	  func_fatal_error "specify a tag with '--tag'"
 #	else
 #	  func_verbose "using $tagname tagged configuration"
 	fi
@@ -1434,15 +2711,15 @@ func_infer_tag ()
 # but don't create it if we're doing a dry run.
 func_write_libtool_object ()
 {
-    write_libobj=${1}
-    if test "$build_libtool_libs" = yes; then
-      write_lobj=\'${2}\'
+    write_libobj=$1
+    if test yes = "$build_libtool_libs"; then
+      write_lobj=\'$2\'
     else
       write_lobj=none
     fi
 
-    if test "$build_old_libs" = yes; then
-      write_oldobj=\'${3}\'
+    if test yes = "$build_old_libs"; then
+      write_oldobj=\'$3\'
     else
       write_oldobj=none
     fi
@@ -1450,7 +2727,7 @@ func_write_libtool_object ()
     $opt_dry_run || {
       cat >${write_libobj}T <<EOF
 # $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 #
 # Please DO NOT delete this file!
 # It is necessary for linking the library.
@@ -1462,7 +2739,7 @@ pic_object=$write_lobj
 non_pic_object=$write_oldobj
 
 EOF
-      $MV "${write_libobj}T" "${write_libobj}"
+      $MV "${write_libobj}T" "$write_libobj"
     }
 }
 
@@ -1482,8 +2759,9 @@ EOF
 # be empty on error (or when ARG is empty)
 func_convert_core_file_wine_to_w32 ()
 {
-  $opt_debug
-  func_convert_core_file_wine_to_w32_result="$1"
+  $debug_cmd
+
+  func_convert_core_file_wine_to_w32_result=$1
   if test -n "$1"; then
     # Unfortunately, winepath does not exit with a non-zero error code, so we
     # are forced to check the contents of stdout. On the other hand, if the
@@ -1491,9 +2769,9 @@ func_convert_core_file_wine_to_w32 ()
     # *an error message* to stdout. So we must check for both error code of
     # zero AND non-empty stdout, which explains the odd construction:
     func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
-    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
       func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
-        $SED -e "$lt_sed_naive_backslashify"`
+        $SED -e "$sed_naive_backslashify"`
     else
       func_convert_core_file_wine_to_w32_result=
     fi
@@ -1514,18 +2792,19 @@ func_convert_core_file_wine_to_w32 ()
 # are convertible, then the result may be empty.
 func_convert_core_path_wine_to_w32 ()
 {
-  $opt_debug
+  $debug_cmd
+
   # unfortunately, winepath doesn't convert paths, only file names
-  func_convert_core_path_wine_to_w32_result=""
+  func_convert_core_path_wine_to_w32_result=
   if test -n "$1"; then
     oldIFS=$IFS
     IFS=:
     for func_convert_core_path_wine_to_w32_f in $1; do
       IFS=$oldIFS
       func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
-      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+      if test -n "$func_convert_core_file_wine_to_w32_result"; then
         if test -z "$func_convert_core_path_wine_to_w32_result"; then
-          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
         else
           func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
         fi
@@ -1554,7 +2833,8 @@ func_convert_core_path_wine_to_w32 ()
 # environment variable; do not put it in $PATH.
 func_cygpath ()
 {
-  $opt_debug
+  $debug_cmd
+
   if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
     func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
     if test "$?" -ne 0; then
@@ -1563,7 +2843,7 @@ func_cygpath ()
     fi
   else
     func_cygpath_result=
-    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
   fi
 }
 #end: func_cygpath
@@ -1574,10 +2854,11 @@ func_cygpath ()
 # result in func_convert_core_msys_to_w32_result.
 func_convert_core_msys_to_w32 ()
 {
-  $opt_debug
+  $debug_cmd
+
   # awkward: cmd appends spaces to result
   func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
-    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
 }
 #end: func_convert_core_msys_to_w32
 
@@ -1588,13 +2869,14 @@ func_convert_core_msys_to_w32 ()
 # func_to_host_file_result to ARG1).
 func_convert_file_check ()
 {
-  $opt_debug
-  if test -z "$2" && test -n "$1" ; then
+  $debug_cmd
+
+  if test -z "$2" && test -n "$1"; then
     func_error "Could not determine host file name corresponding to"
-    func_error "  \`$1'"
+    func_error "  '$1'"
     func_error "Continuing, but uninstalled executables may not work."
     # Fallback:
-    func_to_host_file_result="$1"
+    func_to_host_file_result=$1
   fi
 }
 # end func_convert_file_check
@@ -1606,10 +2888,11 @@ func_convert_file_check ()
 # func_to_host_file_result to a simplistic fallback value (see below).
 func_convert_path_check ()
 {
-  $opt_debug
+  $debug_cmd
+
   if test -z "$4" && test -n "$3"; then
     func_error "Could not determine the host path corresponding to"
-    func_error "  \`$3'"
+    func_error "  '$3'"
     func_error "Continuing, but uninstalled executables may not work."
     # Fallback.  This is a deliberately simplistic "conversion" and
     # should not be "improved".  See libtool.info.
@@ -1618,7 +2901,7 @@ func_convert_path_check ()
       func_to_host_path_result=`echo "$3" |
         $SED -e "$lt_replace_pathsep_chars"`
     else
-      func_to_host_path_result="$3"
+      func_to_host_path_result=$3
     fi
   fi
 }
@@ -1630,9 +2913,10 @@ func_convert_path_check ()
 # and appending REPL if ORIG matches BACKPAT.
 func_convert_path_front_back_pathsep ()
 {
-  $opt_debug
+  $debug_cmd
+
   case $4 in
-  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+  $1 ) func_to_host_path_result=$3$func_to_host_path_result
     ;;
   esac
   case $4 in
@@ -1646,7 +2930,7 @@ func_convert_path_front_back_pathsep ()
 ##################################################
 # $build to $host FILE NAME CONVERSION FUNCTIONS #
 ##################################################
-# invoked via `$to_host_file_cmd ARG'
+# invoked via '$to_host_file_cmd ARG'
 #
 # In each case, ARG is the path to be converted from $build to $host format.
 # Result will be available in $func_to_host_file_result.
@@ -1657,7 +2941,8 @@ func_convert_path_front_back_pathsep ()
 # in func_to_host_file_result.
 func_to_host_file ()
 {
-  $opt_debug
+  $debug_cmd
+
   $to_host_file_cmd "$1"
 }
 # end func_to_host_file
@@ -1669,7 +2954,8 @@ func_to_host_file ()
 # in (the comma separated) LAZY, no conversion takes place.
 func_to_tool_file ()
 {
-  $opt_debug
+  $debug_cmd
+
   case ,$2, in
     *,"$to_tool_file_cmd",*)
       func_to_tool_file_result=$1
@@ -1687,7 +2973,7 @@ func_to_tool_file ()
 # Copy ARG to func_to_host_file_result.
 func_convert_file_noop ()
 {
-  func_to_host_file_result="$1"
+  func_to_host_file_result=$1
 }
 # end func_convert_file_noop
 
@@ -1698,11 +2984,12 @@ func_convert_file_noop ()
 # func_to_host_file_result.
 func_convert_file_msys_to_w32 ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     func_convert_core_msys_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result=$func_convert_core_msys_to_w32_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1714,8 +3001,9 @@ func_convert_file_msys_to_w32 ()
 # func_to_host_file_result.
 func_convert_file_cygwin_to_w32 ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
     # LT_CYGPATH in this case.
@@ -1731,11 +3019,12 @@ func_convert_file_cygwin_to_w32 ()
 # and a working winepath. Returns result in func_to_host_file_result.
 func_convert_file_nix_to_w32 ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     func_convert_core_file_wine_to_w32 "$1"
-    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1747,12 +3036,13 @@ func_convert_file_nix_to_w32 ()
 # Returns result in func_to_host_file_result.
 func_convert_file_msys_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     func_convert_core_msys_to_w32 "$1"
     func_cygpath -u "$func_convert_core_msys_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
+    func_to_host_file_result=$func_cygpath_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1765,13 +3055,14 @@ func_convert_file_msys_to_cygwin ()
 # in func_to_host_file_result.
 func_convert_file_nix_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_file_result="$1"
+  $debug_cmd
+
+  func_to_host_file_result=$1
   if test -n "$1"; then
     # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
     func_convert_core_file_wine_to_w32 "$1"
     func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
-    func_to_host_file_result="$func_cygpath_result"
+    func_to_host_file_result=$func_cygpath_result
   fi
   func_convert_file_check "$1" "$func_to_host_file_result"
 }
@@ -1781,7 +3072,7 @@ func_convert_file_nix_to_cygwin ()
 #############################################
 # $build to $host PATH CONVERSION FUNCTIONS #
 #############################################
-# invoked via `$to_host_path_cmd ARG'
+# invoked via '$to_host_path_cmd ARG'
 #
 # In each case, ARG is the path to be converted from $build to $host format.
 # The result will be available in $func_to_host_path_result.
@@ -1805,10 +3096,11 @@ func_convert_file_nix_to_cygwin ()
 to_host_path_cmd=
 func_init_to_host_path_cmd ()
 {
-  $opt_debug
+  $debug_cmd
+
   if test -z "$to_host_path_cmd"; then
     func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
-    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+    to_host_path_cmd=func_convert_path_$func_stripname_result
   fi
 }
 
@@ -1818,7 +3110,8 @@ func_init_to_host_path_cmd ()
 # in func_to_host_path_result.
 func_to_host_path ()
 {
-  $opt_debug
+  $debug_cmd
+
   func_init_to_host_path_cmd
   $to_host_path_cmd "$1"
 }
@@ -1829,7 +3122,7 @@ func_to_host_path ()
 # Copy ARG to func_to_host_path_result.
 func_convert_path_noop ()
 {
-  func_to_host_path_result="$1"
+  func_to_host_path_result=$1
 }
 # end func_convert_path_noop
 
@@ -1840,8 +3133,9 @@ func_convert_path_noop ()
 # func_to_host_path_result.
 func_convert_path_msys_to_w32 ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # Remove leading and trailing path separator characters from ARG.  MSYS
     # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
@@ -1849,7 +3143,7 @@ func_convert_path_msys_to_w32 ()
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result=$func_convert_core_msys_to_w32_result
     func_convert_path_check : ";" \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
@@ -1863,8 +3157,9 @@ func_convert_path_msys_to_w32 ()
 # func_to_host_file_result.
 func_convert_path_cygwin_to_w32 ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
@@ -1883,14 +3178,15 @@ func_convert_path_cygwin_to_w32 ()
 # a working winepath.  Returns result in func_to_host_file_result.
 func_convert_path_nix_to_w32 ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
-    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
     func_convert_path_check : ";" \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
@@ -1904,15 +3200,16 @@ func_convert_path_nix_to_w32 ()
 # Returns result in func_to_host_file_result.
 func_convert_path_msys_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # See func_convert_path_msys_to_w32:
     func_stripname : : "$1"
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
     func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
+    func_to_host_path_result=$func_cygpath_result
     func_convert_path_check : : \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
@@ -1927,8 +3224,9 @@ func_convert_path_msys_to_cygwin ()
 # func_to_host_file_result.
 func_convert_path_nix_to_cygwin ()
 {
-  $opt_debug
-  func_to_host_path_result="$1"
+  $debug_cmd
+
+  func_to_host_path_result=$1
   if test -n "$1"; then
     # Remove leading and trailing path separator characters from
     # ARG. msys behavior is inconsistent here, cygpath turns them
@@ -1937,7 +3235,7 @@ func_convert_path_nix_to_cygwin ()
     func_to_host_path_tmp1=$func_stripname_result
     func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
     func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
-    func_to_host_path_result="$func_cygpath_result"
+    func_to_host_path_result=$func_cygpath_result
     func_convert_path_check : : \
       "$func_to_host_path_tmp1" "$func_to_host_path_result"
     func_convert_path_front_back_pathsep ":*" "*:" : "$1"
@@ -1946,13 +3244,31 @@ func_convert_path_nix_to_cygwin ()
 # end func_convert_path_nix_to_cygwin
 
 
+# func_dll_def_p FILE
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with _LT_DLL_DEF_P in libtool.m4
+func_dll_def_p ()
+{
+  $debug_cmd
+
+  func_dll_def_p_tmp=`$SED -n \
+    -e 's/^[	 ]*//' \
+    -e '/^\(;.*\)*$/d' \
+    -e 's/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p' \
+    -e q \
+    "$1"`
+  test DEF = "$func_dll_def_p_tmp"
+}
+
+
 # func_mode_compile arg...
 func_mode_compile ()
 {
-    $opt_debug
+    $debug_cmd
+
     # Get the compilation command and the source file.
     base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
     suppress_opt=yes
     suppress_output=
     arg_mode=normal
@@ -1965,12 +3281,12 @@ func_mode_compile ()
       case $arg_mode in
       arg  )
 	# do not "continue".  Instead, add this to base_compile
-	lastarg="$arg"
+	lastarg=$arg
 	arg_mode=normal
 	;;
 
       target )
-	libobj="$arg"
+	libobj=$arg
 	arg_mode=normal
 	continue
 	;;
@@ -1980,7 +3296,7 @@ func_mode_compile ()
 	case $arg in
 	-o)
 	  test -n "$libobj" && \
-	    func_fatal_error "you cannot specify \`-o' more than once"
+	    func_fatal_error "you cannot specify '-o' more than once"
 	  arg_mode=target
 	  continue
 	  ;;
@@ -2009,12 +3325,12 @@ func_mode_compile ()
 	  func_stripname '-Wc,' '' "$arg"
 	  args=$func_stripname_result
 	  lastarg=
-	  save_ifs="$IFS"; IFS=','
+	  save_ifs=$IFS; IFS=,
 	  for arg in $args; do
-	    IFS="$save_ifs"
+	    IFS=$save_ifs
 	    func_append_quoted lastarg "$arg"
 	  done
-	  IFS="$save_ifs"
+	  IFS=$save_ifs
 	  func_stripname ' ' '' "$lastarg"
 	  lastarg=$func_stripname_result
 
@@ -2027,8 +3343,8 @@ func_mode_compile ()
 	  # Accept the current argument as the source file.
 	  # The previous "srcfile" becomes the current argument.
 	  #
-	  lastarg="$srcfile"
-	  srcfile="$arg"
+	  lastarg=$srcfile
+	  srcfile=$arg
 	  ;;
 	esac  #  case $arg
 	;;
@@ -2043,13 +3359,13 @@ func_mode_compile ()
       func_fatal_error "you must specify an argument for -Xcompile"
       ;;
     target)
-      func_fatal_error "you must specify a target with \`-o'"
+      func_fatal_error "you must specify a target with '-o'"
       ;;
     *)
       # Get the name of the library object.
       test -z "$libobj" && {
 	func_basename "$srcfile"
-	libobj="$func_basename_result"
+	libobj=$func_basename_result
       }
       ;;
     esac
@@ -2069,7 +3385,7 @@ func_mode_compile ()
     case $libobj in
     *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
     *)
-      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      func_fatal_error "cannot determine name of library object from '$libobj'"
       ;;
     esac
 
@@ -2078,8 +3394,8 @@ func_mode_compile ()
     for arg in $later; do
       case $arg in
       -shared)
-	test "$build_libtool_libs" != yes && \
-	  func_fatal_configuration "can not build a shared library"
+	test yes = "$build_libtool_libs" \
+	  || func_fatal_configuration "cannot build a shared library"
 	build_old_libs=no
 	continue
 	;;
@@ -2105,17 +3421,17 @@ func_mode_compile ()
     func_quote_for_eval "$libobj"
     test "X$libobj" != "X$func_quote_for_eval_result" \
       && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
-      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+      && func_warning "libobj name '$libobj' may not contain shell special characters."
     func_dirname_and_basename "$obj" "/" ""
-    objname="$func_basename_result"
-    xdir="$func_dirname_result"
-    lobj=${xdir}$objdir/$objname
+    objname=$func_basename_result
+    xdir=$func_dirname_result
+    lobj=$xdir$objdir/$objname
 
     test -z "$base_compile" && \
       func_fatal_help "you must specify a compilation command"
 
     # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
+    if test yes = "$build_old_libs"; then
       removelist="$obj $lobj $libobj ${libobj}T"
     else
       removelist="$lobj $libobj ${libobj}T"
@@ -2127,16 +3443,16 @@ func_mode_compile ()
       pic_mode=default
       ;;
     esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
       # non-PIC code in shared libraries is not supported
       pic_mode=default
     fi
 
     # Calculate the filename of the output object if compiler does
     # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
+    if test no = "$compiler_c_o"; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
+      lockfile=$output_obj.lock
     else
       output_obj=
       need_locks=no
@@ -2145,12 +3461,12 @@ func_mode_compile ()
 
     # Lock this critical section if it is needed
     # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
+    if test yes = "$need_locks"; then
       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 	func_echo "Waiting for $lockfile to be removed"
 	sleep 2
       done
-    elif test "$need_locks" = warn; then
+    elif test warn = "$need_locks"; then
       if test -f "$lockfile"; then
 	$ECHO "\
 *** ERROR, $lockfile exists and contains:
@@ -2158,7 +3474,7 @@ func_mode_compile ()
 
 This indicates that another process is trying to use the same
 temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
+your compiler does not support '-c' and '-o' together.  If you
 repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
@@ -2180,11 +3496,11 @@ compiler."
     qsrcfile=$func_quote_for_eval_result
 
     # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
+    if test yes = "$build_libtool_libs"; then
       # Without this assignment, base_compile gets emptied.
       fbsd_hideous_sh_bug=$base_compile
 
-      if test "$pic_mode" != no; then
+      if test no != "$pic_mode"; then
 	command="$base_compile $qsrcfile $pic_flag"
       else
 	# Don't build PIC code
@@ -2201,7 +3517,7 @@ compiler."
       func_show_eval_locale "$command"	\
           'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
 
-      if test "$need_locks" = warn &&
+      if test warn = "$need_locks" &&
 	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 	$ECHO "\
 *** ERROR, $lockfile contains:
@@ -2212,7 +3528,7 @@ $srcfile
 
 This indicates that another process is trying to use the same
 temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
+your compiler does not support '-c' and '-o' together.  If you
 repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
@@ -2228,20 +3544,20 @@ compiler."
       fi
 
       # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
+      if test yes = "$suppress_opt"; then
 	suppress_output=' >/dev/null 2>&1'
       fi
     fi
 
     # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
+    if test yes = "$build_old_libs"; then
+      if test yes != "$pic_mode"; then
 	# Don't build PIC code
 	command="$base_compile $qsrcfile$pie_flag"
       else
 	command="$base_compile $qsrcfile $pic_flag"
       fi
-      if test "$compiler_c_o" = yes; then
+      if test yes = "$compiler_c_o"; then
 	func_append command " -o $obj"
       fi
 
@@ -2250,7 +3566,7 @@ compiler."
       func_show_eval_locale "$command" \
         '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
 
-      if test "$need_locks" = warn &&
+      if test warn = "$need_locks" &&
 	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
 	$ECHO "\
 *** ERROR, $lockfile contains:
@@ -2261,7 +3577,7 @@ $srcfile
 
 This indicates that another process is trying to use the same
 temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
+your compiler does not support '-c' and '-o' together.  If you
 repeat this compilation, it may succeed, by chance, but you had better
 avoid parallel builds (make -j) in this platform, or get a better
 compiler."
@@ -2281,7 +3597,7 @@ compiler."
       func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
 
       # Unlock the critical section if it was locked
-      if test "$need_locks" != no; then
+      if test no != "$need_locks"; then
 	removelist=$lockfile
         $RM "$lockfile"
       fi
@@ -2291,7 +3607,7 @@ compiler."
 }
 
 $opt_help || {
-  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+  test compile = "$opt_mode" && func_mode_compile ${1+"$@"}
 }
 
 func_mode_help ()
@@ -2311,7 +3627,7 @@ func_mode_help ()
 Remove files from the build directory.
 
 RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 to RM.
 
 If FILE is a libtool library, object or program, all the files associated
@@ -2330,16 +3646,16 @@ This mode accepts the following additional options:
   -no-suppress      do not suppress compiler output for multiple passes
   -prefer-pic       try to build PIC objects only
   -prefer-non-pic   try to build non-PIC objects only
-  -shared           do not build a \`.o' file suitable for static linking
-  -static           only build a \`.o' file suitable for static linking
+  -shared           do not build a '.o' file suitable for static linking
+  -static           only build a '.o' file suitable for static linking
   -Wc,FLAG          pass FLAG directly to the compiler
 
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+COMPILE-COMMAND is a command to be used in creating a 'standard' object file
 from the given SOURCEFILE.
 
 The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
+SOURCEFILE, then substituting the C source code suffix '.c' with the
+library object suffix, '.lo'."
         ;;
 
       execute)
@@ -2352,7 +3668,7 @@ This mode accepts the following additional options:
 
   -dlopen FILE      add the directory containing FILE to the library path
 
-This mode sets the library path environment variable according to \`-dlopen'
+This mode sets the library path environment variable according to '-dlopen'
 flags.
 
 If any of the ARGS are libtool executable wrappers, then they are translated
@@ -2371,7 +3687,7 @@ Complete the installation of libtool libraries.
 Each LIBDIR is a directory that contains libtool libraries.
 
 The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
+the '--dry-run' option if you just want to see what would be executed."
         ;;
 
       install)
@@ -2381,7 +3697,7 @@ the \`--dry-run' option if you just want to see what would be executed."
 Install executables or libraries.
 
 INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
+either the 'install' or 'cp' program.
 
 The following components of INSTALL-COMMAND are treated specially:
 
@@ -2407,7 +3723,7 @@ The following components of LINK-COMMAND are treated specially:
   -avoid-version    do not add a version suffix if possible
   -bindir BINDIR    specify path to binaries directory (for systems where
                     libraries must be found in the PATH setting at runtime)
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlopen FILE      '-dlpreopen' FILE if it cannot be dlopened at runtime
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
@@ -2421,7 +3737,8 @@ The following components of LINK-COMMAND are treated specially:
   -no-install       link a not-installable executable
   -no-undefined     declare that a library does not refer to external symbols
   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -objectlist FILE  use a list of object files found in FILE to specify objects
+  -os2dllname NAME  force a short DLL name on OS/2 (no effect on other OSes)
   -precious-files-regex REGEX
                     don't remove output files matching REGEX
   -release RELEASE  specify package release information
@@ -2441,20 +3758,20 @@ The following components of LINK-COMMAND are treated specially:
   -Xlinker FLAG     pass linker-specific FLAG directly to the linker
   -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
 
-All other options (arguments beginning with \`-') are ignored.
+All other options (arguments beginning with '-') are ignored.
 
-Every other argument is treated as a filename.  Files ending in \`.la' are
+Every other argument is treated as a filename.  Files ending in '.la' are
 treated as uninstalled libtool libraries, other files are standard or library
 object files.
 
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
+If the OUTPUT-FILE ends in '.la', then a libtool library is created,
+only library objects ('.lo' files) may be specified, and '-rpath' is
 required, except when creating a convenience library.
 
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
+If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created
+using 'ar' and 'ranlib', or on Windows using 'lib'.
 
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file
 is created, otherwise an executable program is created."
         ;;
 
@@ -2465,7 +3782,7 @@ is created, otherwise an executable program is created."
 Remove libraries from an installation directory.
 
 RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+(typically '/bin/rm').  RM-OPTIONS are options (such as '-f') to be passed
 to RM.
 
 If FILE is a libtool library, all the files associated with it are deleted.
@@ -2473,17 +3790,17 @@ Otherwise, only FILE itself is deleted using RM."
         ;;
 
       *)
-        func_fatal_help "invalid operation mode \`$opt_mode'"
+        func_fatal_help "invalid operation mode '$opt_mode'"
         ;;
     esac
 
     echo
-    $ECHO "Try \`$progname --help' for more information about other modes."
+    $ECHO "Try '$progname --help' for more information about other modes."
 }
 
 # Now that we've collected a possible --mode arg, show help if necessary
 if $opt_help; then
-  if test "$opt_help" = :; then
+  if test : = "$opt_help"; then
     func_mode_help
   else
     {
@@ -2491,7 +3808,7 @@ if $opt_help; then
       for opt_mode in compile link execute install finish uninstall clean; do
 	func_mode_help
       done
-    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    } | $SED -n '1p; 2,$s/^Usage:/  or: /p'
     {
       func_help noexit
       for opt_mode in compile link execute install finish uninstall clean; do
@@ -2499,7 +3816,7 @@ if $opt_help; then
 	func_mode_help
       done
     } |
-    sed '1d
+    $SED '1d
       /^When reporting/,/^Report/{
 	H
 	d
@@ -2516,16 +3833,17 @@ fi
 # func_mode_execute arg...
 func_mode_execute ()
 {
-    $opt_debug
+    $debug_cmd
+
     # The first argument is the command name.
-    cmd="$nonopt"
+    cmd=$nonopt
     test -z "$cmd" && \
       func_fatal_help "you must specify a COMMAND"
 
     # Handle -dlopen flags immediately.
     for file in $opt_dlopen; do
       test -f "$file" \
-	|| func_fatal_help "\`$file' is not a file"
+	|| func_fatal_help "'$file' is not a file"
 
       dir=
       case $file in
@@ -2535,7 +3853,7 @@ func_mode_execute ()
 
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
-	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+	  || func_fatal_help "'$lib' is not a valid libtool archive"
 
 	# Read the libtool library.
 	dlname=
@@ -2546,18 +3864,18 @@ func_mode_execute ()
 	if test -z "$dlname"; then
 	  # Warn if it was a shared library.
 	  test -n "$library_names" && \
-	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	    func_warning "'$file' was not linked with '-export-dynamic'"
 	  continue
 	fi
 
 	func_dirname "$file" "" "."
-	dir="$func_dirname_result"
+	dir=$func_dirname_result
 
 	if test -f "$dir/$objdir/$dlname"; then
 	  func_append dir "/$objdir"
 	else
 	  if test ! -f "$dir/$dlname"; then
-	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	    func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'"
 	  fi
 	fi
 	;;
@@ -2565,18 +3883,18 @@ func_mode_execute ()
       *.lo)
 	# Just add the directory containing the .lo file.
 	func_dirname "$file" "" "."
-	dir="$func_dirname_result"
+	dir=$func_dirname_result
 	;;
 
       *)
-	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	func_warning "'-dlopen' is ignored for non-libtool libraries and objects"
 	continue
 	;;
       esac
 
       # Get the absolute pathname.
       absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
+      test -n "$absdir" && dir=$absdir
 
       # Now add the directory to shlibpath_var.
       if eval "test -z \"\$$shlibpath_var\""; then
@@ -2588,7 +3906,7 @@ func_mode_execute ()
 
     # This variable tells wrapper scripts just to set shlibpath_var
     # rather than running their programs.
-    libtool_execute_magic="$magic"
+    libtool_execute_magic=$magic
 
     # Check if any of the arguments is a wrapper script.
     args=
@@ -2601,12 +3919,12 @@ func_mode_execute ()
 	if func_ltwrapper_script_p "$file"; then
 	  func_source "$file"
 	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
+	  file=$progdir/$program
 	elif func_ltwrapper_executable_p "$file"; then
 	  func_ltwrapper_scriptname "$file"
 	  func_source "$func_ltwrapper_scriptname_result"
 	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
+	  file=$progdir/$program
 	fi
 	;;
       esac
@@ -2614,7 +3932,15 @@ func_mode_execute ()
       func_append_quoted args "$file"
     done
 
-    if test "X$opt_dry_run" = Xfalse; then
+    if $opt_dry_run; then
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    else
       if test -n "$shlibpath_var"; then
 	# Export the shlibpath_var.
 	eval "export $shlibpath_var"
@@ -2631,25 +3957,18 @@ func_mode_execute ()
       done
 
       # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
-	echo "export $shlibpath_var"
-      fi
-      $ECHO "$cmd$args"
-      exit $EXIT_SUCCESS
+      exec_cmd=\$cmd$args
     fi
 }
 
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+test execute = "$opt_mode" && func_mode_execute ${1+"$@"}
 
 
 # func_mode_finish arg...
 func_mode_finish ()
 {
-    $opt_debug
+    $debug_cmd
+
     libs=
     libdirs=
     admincmds=
@@ -2663,11 +3982,11 @@ func_mode_finish ()
 	if func_lalib_unsafe_p "$opt"; then
 	  func_append libs " $opt"
 	else
-	  func_warning "\`$opt' is not a valid libtool archive"
+	  func_warning "'$opt' is not a valid libtool archive"
 	fi
 
       else
-	func_fatal_error "invalid argument \`$opt'"
+	func_fatal_error "invalid argument '$opt'"
       fi
     done
 
@@ -2682,12 +4001,12 @@ func_mode_finish ()
       # Remove sysroot references
       if $opt_dry_run; then
         for lib in $libs; do
-          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+          echo "removing references to $lt_sysroot and '=' prefixes from $lib"
         done
       else
         tmpdir=`func_mktempdir`
         for lib in $libs; do
-	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	  $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
 	    > $tmpdir/tmp-la
 	  mv -f $tmpdir/tmp-la $lib
 	done
@@ -2712,7 +4031,7 @@ func_mode_finish ()
     fi
 
     # Exit here if they wanted silent mode.
-    $opt_silent && exit $EXIT_SUCCESS
+    $opt_quiet && exit $EXIT_SUCCESS
 
     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
       echo "----------------------------------------------------------------------"
@@ -2723,27 +4042,27 @@ func_mode_finish ()
       echo
       echo "If you ever happen to want to link against installed libraries"
       echo "in a given directory, LIBDIR, you must either use libtool, and"
-      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "specify the full pathname of the library, or use the '-LLIBDIR'"
       echo "flag during linking and do at least one of the following:"
       if test -n "$shlibpath_var"; then
-	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "   - add LIBDIR to the '$shlibpath_var' environment variable"
 	echo "     during execution"
       fi
       if test -n "$runpath_var"; then
-	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "   - add LIBDIR to the '$runpath_var' environment variable"
 	echo "     during linking"
       fi
       if test -n "$hardcode_libdir_flag_spec"; then
 	libdir=LIBDIR
 	eval flag=\"$hardcode_libdir_flag_spec\"
 
-	$ECHO "   - use the \`$flag' linker flag"
+	$ECHO "   - use the '$flag' linker flag"
       fi
       if test -n "$admincmds"; then
 	$ECHO "   - have your system administrator run these commands:$admincmds"
       fi
       if test -f /etc/ld.so.conf; then
-	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+	echo "   - have your system administrator add LIBDIR to '/etc/ld.so.conf'"
       fi
       echo
 
@@ -2762,18 +4081,20 @@ func_mode_finish ()
     exit $EXIT_SUCCESS
 }
 
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+test finish = "$opt_mode" && func_mode_finish ${1+"$@"}
 
 
 # func_mode_install arg...
 func_mode_install ()
 {
-    $opt_debug
+    $debug_cmd
+
     # There may be an optional sh(1) argument at the beginning of
     # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+    if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" ||
        # Allow the use of GNU shtool's install command.
-       case $nonopt in *shtool*) :;; *) false;; esac; then
+       case $nonopt in *shtool*) :;; *) false;; esac
+    then
       # Aesthetically quote it.
       func_quote_for_eval "$nonopt"
       install_prog="$func_quote_for_eval_result "
@@ -2800,7 +4121,7 @@ func_mode_install ()
     opts=
     prev=
     install_type=
-    isdir=no
+    isdir=false
     stripme=
     no_mode=:
     for arg
@@ -2813,7 +4134,7 @@ func_mode_install ()
       fi
 
       case $arg in
-      -d) isdir=yes ;;
+      -d) isdir=: ;;
       -f)
 	if $install_cp; then :; else
 	  prev=$arg
@@ -2831,7 +4152,7 @@ func_mode_install ()
       *)
 	# If the previous option needed an argument, then skip it.
 	if test -n "$prev"; then
-	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	  if test X-m = "X$prev" && test -n "$install_override_mode"; then
 	    arg2=$install_override_mode
 	    no_mode=false
 	  fi
@@ -2856,7 +4177,7 @@ func_mode_install ()
       func_fatal_help "you must specify an install program"
 
     test -n "$prev" && \
-      func_fatal_help "the \`$prev' option requires an argument"
+      func_fatal_help "the '$prev' option requires an argument"
 
     if test -n "$install_override_mode" && $no_mode; then
       if $install_cp; then :; else
@@ -2878,19 +4199,19 @@ func_mode_install ()
     dest=$func_stripname_result
 
     # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
+    test -d "$dest" && isdir=:
+    if $isdir; then
+      destdir=$dest
       destname=
     else
       func_dirname_and_basename "$dest" "" "."
-      destdir="$func_dirname_result"
-      destname="$func_basename_result"
+      destdir=$func_dirname_result
+      destname=$func_basename_result
 
       # Not a directory, so check to see that there is only one file specified.
       set dummy $files; shift
       test "$#" -gt 1 && \
-	func_fatal_help "\`$dest' is not a directory"
+	func_fatal_help "'$dest' is not a directory"
     fi
     case $destdir in
     [\\/]* | [A-Za-z]:[\\/]*) ;;
@@ -2899,7 +4220,7 @@ func_mode_install ()
 	case $file in
 	*.lo) ;;
 	*)
-	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  func_fatal_help "'$destdir' must be an absolute directory name"
 	  ;;
 	esac
       done
@@ -2908,7 +4229,7 @@ func_mode_install ()
 
     # This variable tells wrapper scripts just to set variables rather
     # than running their programs.
-    libtool_install_magic="$magic"
+    libtool_install_magic=$magic
 
     staticlibs=
     future_libdirs=
@@ -2928,7 +4249,7 @@ func_mode_install ()
 
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$file" \
-	  || func_fatal_help "\`$file' is not a valid libtool archive"
+	  || func_fatal_help "'$file' is not a valid libtool archive"
 
 	library_names=
 	old_library=
@@ -2950,7 +4271,7 @@ func_mode_install ()
 	fi
 
 	func_dirname "$file" "/" ""
-	dir="$func_dirname_result"
+	dir=$func_dirname_result
 	func_append dir "$objdir"
 
 	if test -n "$relink_command"; then
@@ -2964,7 +4285,7 @@ func_mode_install ()
 	  # are installed into $libdir/../bin (currently, that works fine)
 	  # but it's something to keep an eye on.
 	  test "$inst_prefix_dir" = "$destdir" && \
-	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+	    func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir"
 
 	  if test -n "$inst_prefix_dir"; then
 	    # Stick the inst_prefix_dir data into the link command.
@@ -2973,29 +4294,36 @@ func_mode_install ()
 	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
 	  fi
 
-	  func_warning "relinking \`$file'"
+	  func_warning "relinking '$file'"
 	  func_show_eval "$relink_command" \
-	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	    'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"'
 	fi
 
 	# See the names of the shared library.
 	set dummy $library_names; shift
 	if test -n "$1"; then
-	  realname="$1"
+	  realname=$1
 	  shift
 
-	  srcname="$realname"
-	  test -n "$relink_command" && srcname="$realname"T
+	  srcname=$realname
+	  test -n "$relink_command" && srcname=${realname}T
 
 	  # Install the shared library and build the symlinks.
 	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
 	      'exit $?'
-	  tstripme="$stripme"
+	  tstripme=$stripme
 	  case $host_os in
 	  cygwin* | mingw* | pw32* | cegcc*)
 	    case $realname in
 	    *.dll.a)
-	      tstripme=""
+	      tstripme=
+	      ;;
+	    esac
+	    ;;
+	  os2*)
+	    case $realname in
+	    *_dll.a)
+	      tstripme=
 	      ;;
 	    esac
 	    ;;
@@ -3006,7 +4334,7 @@ func_mode_install ()
 
 	  if test "$#" -gt 0; then
 	    # Delete the old symlinks, and create new ones.
-	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # Try 'ln -sf' first, because the 'ln' binary might depend on
 	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
 	    # so we also need to try rm && ln -s.
 	    for linkname
@@ -3017,14 +4345,14 @@ func_mode_install ()
 	  fi
 
 	  # Do each command in the postinstall commands.
-	  lib="$destdir/$realname"
+	  lib=$destdir/$realname
 	  func_execute_cmds "$postinstall_cmds" 'exit $?'
 	fi
 
 	# Install the pseudo-library for information purposes.
 	func_basename "$file"
-	name="$func_basename_result"
-	instname="$dir/$name"i
+	name=$func_basename_result
+	instname=$dir/${name}i
 	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
 
 	# Maybe install the static library, too.
@@ -3036,11 +4364,11 @@ func_mode_install ()
 
 	# Figure out destination file name, if it wasn't already specified.
 	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
+	  destfile=$destdir/$destname
 	else
 	  func_basename "$file"
-	  destfile="$func_basename_result"
-	  destfile="$destdir/$destfile"
+	  destfile=$func_basename_result
+	  destfile=$destdir/$destfile
 	fi
 
 	# Deduce the name of the destination old-style object file.
@@ -3050,11 +4378,11 @@ func_mode_install ()
 	  staticdest=$func_lo2o_result
 	  ;;
 	*.$objext)
-	  staticdest="$destfile"
+	  staticdest=$destfile
 	  destfile=
 	  ;;
 	*)
-	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  func_fatal_help "cannot copy a libtool object to '$destfile'"
 	  ;;
 	esac
 
@@ -3063,7 +4391,7 @@ func_mode_install ()
 	  func_show_eval "$install_prog $file $destfile" 'exit $?'
 
 	# Install the old object if enabled.
-	if test "$build_old_libs" = yes; then
+	if test yes = "$build_old_libs"; then
 	  # Deduce the name of the old-style object file.
 	  func_lo2o "$file"
 	  staticobj=$func_lo2o_result
@@ -3075,23 +4403,23 @@ func_mode_install ()
       *)
 	# Figure out destination file name, if it wasn't already specified.
 	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
+	  destfile=$destdir/$destname
 	else
 	  func_basename "$file"
-	  destfile="$func_basename_result"
-	  destfile="$destdir/$destfile"
+	  destfile=$func_basename_result
+	  destfile=$destdir/$destfile
 	fi
 
 	# If the file is missing, and there is a .exe on the end, strip it
 	# because it is most likely a libtool script we actually want to
 	# install
-	stripped_ext=""
+	stripped_ext=
 	case $file in
 	  *.exe)
 	    if test ! -f "$file"; then
 	      func_stripname '' '.exe' "$file"
 	      file=$func_stripname_result
-	      stripped_ext=".exe"
+	      stripped_ext=.exe
 	    fi
 	    ;;
 	esac
@@ -3119,19 +4447,19 @@ func_mode_install ()
 
 	  # Check the variables that should have been set.
 	  test -z "$generated_by_libtool_version" && \
-	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+	    func_fatal_error "invalid libtool wrapper script '$wrapper'"
 
-	  finalize=yes
+	  finalize=:
 	  for lib in $notinst_deplibs; do
 	    # Check to see that each library is installed.
 	    libdir=
 	    if test -f "$lib"; then
 	      func_source "$lib"
 	    fi
-	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'`
 	    if test -n "$libdir" && test ! -f "$libfile"; then
-	      func_warning "\`$lib' has not been installed in \`$libdir'"
-	      finalize=no
+	      func_warning "'$lib' has not been installed in '$libdir'"
+	      finalize=false
 	    fi
 	  done
 
@@ -3139,29 +4467,29 @@ func_mode_install ()
 	  func_source "$wrapper"
 
 	  outputname=
-	  if test "$fast_install" = no && test -n "$relink_command"; then
+	  if test no = "$fast_install" && test -n "$relink_command"; then
 	    $opt_dry_run || {
-	      if test "$finalize" = yes; then
+	      if $finalize; then
 	        tmpdir=`func_mktempdir`
 		func_basename "$file$stripped_ext"
-		file="$func_basename_result"
-	        outputname="$tmpdir/$file"
+		file=$func_basename_result
+	        outputname=$tmpdir/$file
 	        # Replace the output file specification.
 	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
 
-	        $opt_silent || {
+	        $opt_quiet || {
 	          func_quote_for_expand "$relink_command"
 		  eval "func_echo $func_quote_for_expand_result"
 	        }
 	        if eval "$relink_command"; then :
 	          else
-		  func_error "error: relink \`$file' with the above command before installing it"
+		  func_error "error: relink '$file' with the above command before installing it"
 		  $opt_dry_run || ${RM}r "$tmpdir"
 		  continue
 	        fi
-	        file="$outputname"
+	        file=$outputname
 	      else
-	        func_warning "cannot relink \`$file'"
+	        func_warning "cannot relink '$file'"
 	      fi
 	    }
 	  else
@@ -3198,10 +4526,10 @@ func_mode_install ()
 
     for file in $staticlibs; do
       func_basename "$file"
-      name="$func_basename_result"
+      name=$func_basename_result
 
       # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
+      oldlib=$destdir/$name
       func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
       tool_oldlib=$func_to_tool_file_result
 
@@ -3216,18 +4544,18 @@ func_mode_install ()
     done
 
     test -n "$future_libdirs" && \
-      func_warning "remember to run \`$progname --finish$future_libdirs'"
+      func_warning "remember to run '$progname --finish$future_libdirs'"
 
     if test -n "$current_libdirs"; then
       # Maybe just do a dry run.
       $opt_dry_run && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+      exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs'
     else
       exit $EXIT_SUCCESS
     fi
 }
 
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
+test install = "$opt_mode" && func_mode_install ${1+"$@"}
 
 
 # func_generate_dlsyms outputname originator pic_p
@@ -3235,16 +4563,17 @@ test "$opt_mode" = install && func_mode_install ${1+"$@"}
 # a dlpreopen symbol table.
 func_generate_dlsyms ()
 {
-    $opt_debug
-    my_outputname="$1"
-    my_originator="$2"
-    my_pic_p="${3-no}"
-    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    $debug_cmd
+
+    my_outputname=$1
+    my_originator=$2
+    my_pic_p=${3-false}
+    my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'`
     my_dlsyms=
 
-    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+    if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
       if test -n "$NM" && test -n "$global_symbol_pipe"; then
-	my_dlsyms="${my_outputname}S.c"
+	my_dlsyms=${my_outputname}S.c
       else
 	func_error "not configured to extract global symbols from dlpreopened files"
       fi
@@ -3255,7 +4584,7 @@ func_generate_dlsyms ()
       "") ;;
       *.c)
 	# Discover the nlist of each of the dlfiles.
-	nlist="$output_objdir/${my_outputname}.nm"
+	nlist=$output_objdir/$my_outputname.nm
 
 	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
 
@@ -3263,34 +4592,36 @@ func_generate_dlsyms ()
 	func_verbose "creating $output_objdir/$my_dlsyms"
 
 	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */
 
 #ifdef __cplusplus
 extern \"C\" {
 #endif
 
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
 #pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
 #endif
 
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
-#elif defined(__osf__)
+#elif defined __osf__
 /* This system does not cope well with relocations in const data.  */
 # define LT_DLSYM_CONST
 #else
 # define LT_DLSYM_CONST const
 #endif
 
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
 /* External symbol declarations for the compiler. */\
 "
 
-	if test "$dlself" = yes; then
-	  func_verbose "generating symbol list for \`$output'"
+	if test yes = "$dlself"; then
+	  func_verbose "generating symbol list for '$output'"
 
 	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
 
@@ -3298,7 +4629,7 @@ extern \"C\" {
 	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	  for progfile in $progfiles; do
 	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
-	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    func_verbose "extracting global C symbols from '$func_to_tool_file_result'"
 	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
 	  done
 
@@ -3318,10 +4649,10 @@ extern \"C\" {
 
 	  # Prepare the list of exported symbols
 	  if test -z "$export_symbols"; then
-	    export_symbols="$output_objdir/$outputname.exp"
+	    export_symbols=$output_objdir/$outputname.exp
 	    $opt_dry_run || {
 	      $RM $export_symbols
-	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	      eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
 	      case $host in
 	      *cygwin* | *mingw* | *cegcc* )
                 eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
@@ -3331,7 +4662,7 @@ extern \"C\" {
 	    }
 	  else
 	    $opt_dry_run || {
-	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
 	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
 	      eval '$MV "$nlist"T "$nlist"'
 	      case $host in
@@ -3345,22 +4676,22 @@ extern \"C\" {
 	fi
 
 	for dlprefile in $dlprefiles; do
-	  func_verbose "extracting global C symbols from \`$dlprefile'"
+	  func_verbose "extracting global C symbols from '$dlprefile'"
 	  func_basename "$dlprefile"
-	  name="$func_basename_result"
+	  name=$func_basename_result
           case $host in
 	    *cygwin* | *mingw* | *cegcc* )
 	      # if an import library, we need to obtain dlname
 	      if func_win32_import_lib_p "$dlprefile"; then
 	        func_tr_sh "$dlprefile"
 	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
-	        dlprefile_dlbasename=""
+	        dlprefile_dlbasename=
 	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
 	          # Use subshell, to avoid clobbering current variable values
 	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
-	          if test -n "$dlprefile_dlname" ; then
+	          if test -n "$dlprefile_dlname"; then
 	            func_basename "$dlprefile_dlname"
-	            dlprefile_dlbasename="$func_basename_result"
+	            dlprefile_dlbasename=$func_basename_result
 	          else
 	            # no lafile. user explicitly requested -dlpreopen <import library>.
 	            $sharedlib_from_linklib_cmd "$dlprefile"
@@ -3368,7 +4699,7 @@ extern \"C\" {
 	          fi
 	        fi
 	        $opt_dry_run || {
-	          if test -n "$dlprefile_dlbasename" ; then
+	          if test -n "$dlprefile_dlbasename"; then
 	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
 	          else
 	            func_warning "Could not compute DLL name from $name"
@@ -3424,6 +4755,11 @@ extern \"C\" {
 	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
 	  fi
 
+	  func_show_eval '$RM "${nlist}I"'
+	  if test -n "$global_symbol_to_import"; then
+	    eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I'
+	  fi
+
 	  echo >> "$output_objdir/$my_dlsyms" "\
 
 /* The mapping between symbol names and symbols.  */
@@ -3432,11 +4768,30 @@ typedef struct {
   void *address;
 } lt_dlsymlist;
 extern LT_DLSYM_CONST lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
+lt_${my_prefix}_LTX_preloaded_symbols[];\
+"
+
+	  if test -s "$nlist"I; then
+	    echo >> "$output_objdir/$my_dlsyms" "\
+static void lt_syminit(void)
+{
+  LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols;
+  for (; symbol->name; ++symbol)
+    {"
+	    $SED 's/.*/      if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms"
+	    echo >> "$output_objdir/$my_dlsyms" "\
+    }
+}"
+	  fi
+	  echo >> "$output_objdir/$my_dlsyms" "\
 LT_DLSYM_CONST lt_dlsymlist
 lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
-  { \"$my_originator\", (void *) 0 },"
+{ {\"$my_originator\", (void *) 0},"
+
+	  if test -s "$nlist"I; then
+	    echo >> "$output_objdir/$my_dlsyms" "\
+  {\"@INIT@\", (void *) &lt_syminit},"
+	  fi
 
 	  case $need_lib_prefix in
 	  no)
@@ -3478,9 +4833,7 @@ static const void *lt_preloaded_setup() {
 	  *-*-hpux*)
 	    pic_flag_for_symtable=" $pic_flag"  ;;
 	  *)
-	    if test "X$my_pic_p" != Xno; then
-	      pic_flag_for_symtable=" $pic_flag"
-	    fi
+	    $my_pic_p && pic_flag_for_symtable=" $pic_flag"
 	    ;;
 	  esac
 	  ;;
@@ -3497,10 +4850,10 @@ static const void *lt_preloaded_setup() {
 	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
 
 	# Clean up the generated files.
-	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"'
 
 	# Transform the symbol file into the correct name.
-	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	symfileobj=$output_objdir/${my_outputname}S.$objext
 	case $host in
 	*cygwin* | *mingw* | *cegcc* )
 	  if test -f "$output_objdir/$my_outputname.def"; then
@@ -3518,7 +4871,7 @@ static const void *lt_preloaded_setup() {
 	esac
 	;;
       *)
-	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	func_fatal_error "unknown suffix for '$my_dlsyms'"
 	;;
       esac
     else
@@ -3532,6 +4885,32 @@ static const void *lt_preloaded_setup() {
     fi
 }
 
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $debug_cmd
+
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $debug_cmd
+
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
 # func_win32_libid arg
 # return the library type of file 'arg'
 #
@@ -3541,8 +4920,9 @@ static const void *lt_preloaded_setup() {
 # Despite the name, also deal with 64 bit binaries.
 func_win32_libid ()
 {
-  $opt_debug
-  win32_libid_type="unknown"
+  $debug_cmd
+
+  win32_libid_type=unknown
   win32_fileres=`file -L $1 2>/dev/null`
   case $win32_fileres in
   *ar\ archive\ import\ library*) # definitely import
@@ -3552,16 +4932,29 @@ func_win32_libid ()
     # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
        $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
-      func_to_tool_file "$1" func_convert_file_msys_to_w32
-      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
-	$SED -n -e '
+      case $nm_interface in
+      "MS dumpbin")
+	if func_cygming_ms_implib_p "$1" ||
+	   func_cygming_gnu_implib_p "$1"
+	then
+	  win32_nmres=import
+	else
+	  win32_nmres=
+	fi
+	;;
+      *)
+	func_to_tool_file "$1" func_convert_file_msys_to_w32
+	win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+	  $SED -n -e '
 	    1,100{
 		/ I /{
-		    s,.*,import,
+		    s|.*|import|
 		    p
 		    q
 		}
 	    }'`
+	;;
+      esac
       case $win32_nmres in
       import*)  win32_libid_type="x86 archive import";;
       *)        win32_libid_type="x86 archive static";;
@@ -3593,7 +4986,8 @@ func_win32_libid ()
 #    $sharedlib_from_linklib_result
 func_cygming_dll_for_implib ()
 {
-  $opt_debug
+  $debug_cmd
+
   sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
 }
 
@@ -3610,7 +5004,8 @@ func_cygming_dll_for_implib ()
 # specified import library.
 func_cygming_dll_for_implib_fallback_core ()
 {
-  $opt_debug
+  $debug_cmd
+
   match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
   $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
     $SED '/^Contents of section '"$match_literal"':/{
@@ -3646,8 +5041,8 @@ func_cygming_dll_for_implib_fallback_core ()
       /./p' |
     # we now have a list, one entry per line, of the stringified
     # contents of the appropriate section of all members of the
-    # archive which possess that section. Heuristic: eliminate
-    # all those which have a first or second character that is
+    # archive that possess that section. Heuristic: eliminate
+    # all those that have a first or second character that is
     # a '.' (that is, objdump's representation of an unprintable
     # character.) This should work for all archives with less than
     # 0x302f exports -- but will fail for DLLs whose name actually
@@ -3658,30 +5053,6 @@ func_cygming_dll_for_implib_fallback_core ()
     $SED -e '/^\./d;/^.\./d;q'
 }
 
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
-  test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
-  $opt_debug
-  func_to_tool_file "$1" func_convert_file_msys_to_w32
-  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
-  test -n "$func_cygming_ms_implib_tmp"
-}
-
 # func_cygming_dll_for_implib_fallback ARG
 # Platform-specific function to extract the
 # name of the DLL associated with the specified
@@ -3695,16 +5066,17 @@ func_cygming_ms_implib_p ()
 #    $sharedlib_from_linklib_result
 func_cygming_dll_for_implib_fallback ()
 {
-  $opt_debug
-  if func_cygming_gnu_implib_p "$1" ; then
+  $debug_cmd
+
+  if func_cygming_gnu_implib_p "$1"; then
     # binutils import library
     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
-  elif func_cygming_ms_implib_p "$1" ; then
+  elif func_cygming_ms_implib_p "$1"; then
     # ms-generated import library
     sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
   else
     # unknown
-    sharedlib_from_linklib_result=""
+    sharedlib_from_linklib_result=
   fi
 }
 
@@ -3712,10 +5084,11 @@ func_cygming_dll_for_implib_fallback ()
 # func_extract_an_archive dir oldlib
 func_extract_an_archive ()
 {
-    $opt_debug
-    f_ex_an_ar_dir="$1"; shift
-    f_ex_an_ar_oldlib="$1"
-    if test "$lock_old_archive_extraction" = yes; then
+    $debug_cmd
+
+    f_ex_an_ar_dir=$1; shift
+    f_ex_an_ar_oldlib=$1
+    if test yes = "$lock_old_archive_extraction"; then
       lockfile=$f_ex_an_ar_oldlib.lock
       until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
 	func_echo "Waiting for $lockfile to be removed"
@@ -3724,7 +5097,7 @@ func_extract_an_archive ()
     fi
     func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
 		   'stat=$?; rm -f "$lockfile"; exit $stat'
-    if test "$lock_old_archive_extraction" = yes; then
+    if test yes = "$lock_old_archive_extraction"; then
       $opt_dry_run || rm -f "$lockfile"
     fi
     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
@@ -3738,22 +5111,23 @@ func_extract_an_archive ()
 # func_extract_archives gentop oldlib ...
 func_extract_archives ()
 {
-    $opt_debug
-    my_gentop="$1"; shift
+    $debug_cmd
+
+    my_gentop=$1; shift
     my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
+    my_oldobjs=
+    my_xlib=
+    my_xabs=
+    my_xdir=
 
     for my_xlib in $my_oldlibs; do
       # Extract the objects.
       case $my_xlib in
-	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;;
 	*) my_xabs=`pwd`"/$my_xlib" ;;
       esac
       func_basename "$my_xlib"
-      my_xlib="$func_basename_result"
+      my_xlib=$func_basename_result
       my_xlib_u=$my_xlib
       while :; do
         case " $extracted_archives " in
@@ -3765,7 +5139,7 @@ func_extract_archives ()
 	esac
       done
       extracted_archives="$extracted_archives $my_xlib_u"
-      my_xdir="$my_gentop/$my_xlib_u"
+      my_xdir=$my_gentop/$my_xlib_u
 
       func_mkdir_p "$my_xdir"
 
@@ -3778,22 +5152,23 @@ func_extract_archives ()
 	  cd $my_xdir || exit $?
 	  darwin_archive=$my_xabs
 	  darwin_curdir=`pwd`
-	  darwin_base_archive=`basename "$darwin_archive"`
+	  func_basename "$darwin_archive"
+	  darwin_base_archive=$func_basename_result
 	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
 	  if test -n "$darwin_arches"; then
 	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
 	    darwin_arch=
 	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
-	    for darwin_arch in  $darwin_arches ; do
-	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	    for darwin_arch in  $darwin_arches; do
+	      func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch"
+	      $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive"
+	      cd "unfat-$$/$darwin_base_archive-$darwin_arch"
+	      func_extract_an_archive "`pwd`" "$darwin_base_archive"
 	      cd "$darwin_curdir"
-	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	      $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive"
 	    done # $darwin_arches
             ## Okay now we've a bunch of thin objects, gotta fatten them up :)
-	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u`
 	    darwin_file=
 	    darwin_files=
 	    for darwin_file in $darwin_filelist; do
@@ -3815,7 +5190,7 @@ func_extract_archives ()
       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
     done
 
-    func_extract_archives_result="$my_oldobjs"
+    func_extract_archives_result=$my_oldobjs
 }
 
 
@@ -3830,7 +5205,7 @@ func_extract_archives ()
 #
 # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
 # variable will take.  If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
+# will assume that the directory where it is stored is
 # the $objdir directory.  This is a cygwin/mingw-specific
 # behavior.
 func_emit_wrapper ()
@@ -3841,7 +5216,7 @@ func_emit_wrapper ()
 #! $SHELL
 
 # $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 #
 # The $output program cannot be directly executed until all the libtool
 # libraries that it depends on are installed.
@@ -3898,9 +5273,9 @@ _LTECHO_EOF'
 
 # Very basic option parsing. These options are (a) specific to
 # the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
+# /script/ and the wrapper /executable/ that is used only on
 # windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
+# (application programs are unlikely to have options that match
 # this pattern).
 #
 # There are only two supported options: --lt-debug and
@@ -3933,7 +5308,7 @@ func_parse_lt_options ()
 
   # Print the debug banner immediately:
   if test -n \"\$lt_option_debug\"; then
-    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+    echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2
   fi
 }
 
@@ -3944,7 +5319,7 @@ func_lt_dump_args ()
   lt_dump_args_N=1;
   for lt_arg
   do
-    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\"
     lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
   done
 }
@@ -3958,7 +5333,7 @@ func_exec_program_core ()
   *-*-mingw | *-*-os2* | *-cegcc*)
     $ECHO "\
       if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2
         func_lt_dump_args \${1+\"\$@\"} 1>&2
       fi
       exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
@@ -3968,7 +5343,7 @@ func_exec_program_core ()
   *)
     $ECHO "\
       if test -n \"\$lt_option_debug\"; then
-        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2
         func_lt_dump_args \${1+\"\$@\"} 1>&2
       fi
       exec \"\$progdir/\$program\" \${1+\"\$@\"}
@@ -4043,13 +5418,13 @@ func_exec_program ()
   test -n \"\$absdir\" && thisdir=\"\$absdir\"
 "
 
-	if test "$fast_install" = yes; then
+	if test yes = "$fast_install"; then
 	  $ECHO "\
   program=lt-'$outputname'$exeext
   progdir=\"\$thisdir/$objdir\"
 
   if test ! -f \"\$progdir/\$program\" ||
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\
        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
 
     file=\"\$\$-\$program\"
@@ -4066,7 +5441,7 @@ func_exec_program ()
     if test -n \"\$relink_command\"; then
       if relink_command_output=\`eval \$relink_command 2>&1\`; then :
       else
-	$ECHO \"\$relink_command_output\" >&2
+	\$ECHO \"\$relink_command_output\" >&2
 	$RM \"\$progdir/\$file\"
 	exit 1
       fi
@@ -4101,7 +5476,7 @@ func_exec_program ()
 	fi
 
 	# Export our shlibpath_var if we have one.
-	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
 	  $ECHO "\
     # Add our own library path to $shlibpath_var
     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
@@ -4121,7 +5496,7 @@ func_exec_program ()
     fi
   else
     # The program doesn't exist.
-    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2
     \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
     \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
     exit 1
@@ -4140,7 +5515,7 @@ func_emit_cwrapperexe_src ()
 	cat <<EOF
 
 /* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+   Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 
    The $output program cannot be directly executed until all the libtool
    libraries that it depends on are installed.
@@ -4175,47 +5550,45 @@ EOF
 #include <fcntl.h>
 #include <sys/stat.h>
 
+#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0)
+
 /* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
+#if defined __MINGW32__
 # ifdef __STRICT_ANSI__
 int _putenv (const char *);
 # endif
-#elif defined(__CYGWIN__)
+#elif defined __CYGWIN__
 # ifdef __STRICT_ANSI__
 char *realpath (const char *, char *);
 int putenv (char *);
 int setenv (const char *, const char *, int);
 # endif
-/* #elif defined (other platforms) ... */
+/* #elif defined other_platform || defined ... */
 #endif
 
 /* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
+#if defined _MSC_VER
 # define setmode _setmode
 # define stat    _stat
 # define chmod   _chmod
 # define getcwd  _getcwd
 # define putenv  _putenv
 # define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-#  define _INTPTR_T_DEFINED
-#  define intptr_t int
-# endif
-#elif defined(__MINGW32__)
+#elif defined __MINGW32__
 # define setmode _setmode
 # define stat    _stat
 # define chmod   _chmod
 # define getcwd  _getcwd
 # define putenv  _putenv
-#elif defined(__CYGWIN__)
+#elif defined __CYGWIN__
 # define HAVE_SETENV
 # define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
+/* #elif defined other platforms ... */
 #endif
 
-#if defined(PATH_MAX)
+#if defined PATH_MAX
 # define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
+#elif defined MAXPATHLEN
 # define LT_PATHMAX MAXPATHLEN
 #else
 # define LT_PATHMAX 1024
@@ -4234,8 +5607,8 @@ int setenv (const char *, const char *, int);
 # define PATH_SEPARATOR ':'
 #endif
 
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
+#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \
+  defined __OS2__
 # define HAVE_DOS_BASED_FILE_SYSTEM
 # define FOPEN_WB "wb"
 # ifndef DIR_SEPARATOR_2
@@ -4268,10 +5641,10 @@ int setenv (const char *, const char *, int);
 
 #define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
 #define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
+  if (stale) { free (stale); stale = 0; } \
 } while (0)
 
-#if defined(LT_DEBUGWRAPPER)
+#if defined LT_DEBUGWRAPPER
 static int lt_debug = 1;
 #else
 static int lt_debug = 0;
@@ -4300,11 +5673,16 @@ void lt_dump_script (FILE *f);
 EOF
 
 	    cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
+#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)
+# define externally_visible volatile
+#else
+# define externally_visible __attribute__((externally_visible)) volatile
+#endif
+externally_visible const char * MAGIC_EXE = "$magic_exe";
 const char * LIB_PATH_VARNAME = "$shlibpath_var";
 EOF
 
-	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	    if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
               func_to_host_path "$temp_rpath"
 	      cat <<EOF
 const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
@@ -4328,7 +5706,7 @@ const char * EXE_PATH_VALUE   = "";
 EOF
 	    fi
 
-	    if test "$fast_install" = yes; then
+	    if test yes = "$fast_install"; then
 	      cat <<EOF
 const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
 EOF
@@ -4357,12 +5735,12 @@ main (int argc, char *argv[])
   char *actual_cwrapper_name;
   char *target_name;
   char *lt_argv_zero;
-  intptr_t rval = 127;
+  int rval = 127;
 
   int i;
 
   program_name = (char *) xstrdup (base_name (argv[0]));
-  newargz = XMALLOC (char *, argc + 1);
+  newargz = XMALLOC (char *, (size_t) argc + 1);
 
   /* very simple arg parsing; don't want to rely on getopt
    * also, copy all non cwrapper options to newargz, except
@@ -4371,10 +5749,10 @@ main (int argc, char *argv[])
   newargc=0;
   for (i = 1; i < argc; i++)
     {
-      if (strcmp (argv[i], dumpscript_opt) == 0)
+      if (STREQ (argv[i], dumpscript_opt))
 	{
 EOF
-	    case "$host" in
+	    case $host in
 	      *mingw* | *cygwin* )
 		# make stdout use "unix" line endings
 		echo "          setmode(1,_O_BINARY);"
@@ -4385,12 +5763,12 @@ EOF
 	  lt_dump_script (stdout);
 	  return 0;
 	}
-      if (strcmp (argv[i], debug_opt) == 0)
+      if (STREQ (argv[i], debug_opt))
 	{
           lt_debug = 1;
           continue;
 	}
-      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+      if (STREQ (argv[i], ltwrapper_option_prefix))
         {
           /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
              namespace, but it is not one of the ones we know about and
@@ -4413,7 +5791,7 @@ EOF
 EOF
 	    cat <<EOF
   /* The GNU banner must be the first non-error debug message */
-  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE) $VERSION\n");
 EOF
 	    cat <<"EOF"
   lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
@@ -4524,7 +5902,7 @@ EOF
 		cat <<"EOF"
   /* execv doesn't actually work on mingw as expected on unix */
   newargz = prepare_spawn (newargz);
-  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  rval = (int) _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
   if (rval == -1)
     {
       /* failed to start process */
@@ -4569,7 +5947,7 @@ base_name (const char *name)
 {
   const char *base;
 
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
   /* Skip over the disk name in MSDOS pathnames. */
   if (isalpha ((unsigned char) name[0]) && name[1] == ':')
     name += 2;
@@ -4628,7 +6006,7 @@ find_executable (const char *wrapper)
   const char *p_next;
   /* static buffer for getcwd */
   char tmp[LT_PATHMAX + 1];
-  int tmp_len;
+  size_t tmp_len;
   char *concat_name;
 
   lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
@@ -4638,7 +6016,7 @@ find_executable (const char *wrapper)
     return NULL;
 
   /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
   if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
     {
       concat_name = xstrdup (wrapper);
@@ -4656,7 +6034,7 @@ find_executable (const char *wrapper)
 	    return concat_name;
 	  XFREE (concat_name);
 	}
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+#if defined HAVE_DOS_BASED_FILE_SYSTEM
     }
 #endif
 
@@ -4679,7 +6057,7 @@ find_executable (const char *wrapper)
 	      for (q = p; *q; q++)
 		if (IS_PATH_SEPARATOR (*q))
 		  break;
-	      p_len = q - p;
+	      p_len = (size_t) (q - p);
 	      p_next = (*q == '\0' ? q : q + 1);
 	      if (p_len == 0)
 		{
@@ -4798,7 +6176,7 @@ strendzap (char *str, const char *pat)
   if (patlen <= len)
     {
       str += len - patlen;
-      if (strcmp (str, pat) == 0)
+      if (STREQ (str, pat))
 	*str = '\0';
     }
   return str;
@@ -4863,7 +6241,7 @@ lt_setenv (const char *name, const char *value)
     char *str = xstrdup (value);
     setenv (name, str, 1);
 #else
-    int len = strlen (name) + 1 + strlen (value) + 1;
+    size_t len = strlen (name) + 1 + strlen (value) + 1;
     char *str = XMALLOC (char, len);
     sprintf (str, "%s=%s", name, value);
     if (putenv (str) != EXIT_SUCCESS)
@@ -4880,8 +6258,8 @@ lt_extend_str (const char *orig_value, const char *add, int to_end)
   char *new_value;
   if (orig_value && *orig_value)
     {
-      int orig_value_len = strlen (orig_value);
-      int add_len = strlen (add);
+      size_t orig_value_len = strlen (orig_value);
+      size_t add_len = strlen (add);
       new_value = XMALLOC (char, add_len + orig_value_len + 1);
       if (to_end)
         {
@@ -4912,10 +6290,10 @@ lt_update_exe_path (const char *name, const char *value)
     {
       char *new_value = lt_extend_str (getenv (name), value, 0);
       /* some systems can't cope with a ':'-terminated path #' */
-      int len = strlen (new_value);
-      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+      size_t len = strlen (new_value);
+      while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
         {
-          new_value[len-1] = '\0';
+          new_value[--len] = '\0';
         }
       lt_setenv (name, new_value);
       XFREE (new_value);
@@ -5082,27 +6460,47 @@ EOF
 # True if ARG is an import lib, as indicated by $file_magic_cmd
 func_win32_import_lib_p ()
 {
-    $opt_debug
+    $debug_cmd
+
     case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
     *import*) : ;;
     *) false ;;
     esac
 }
 
+# func_suncc_cstd_abi
+# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!!
+# Several compiler flags select an ABI that is incompatible with the
+# Cstd library. Avoid specifying it if any are in CXXFLAGS.
+func_suncc_cstd_abi ()
+{
+    $debug_cmd
+
+    case " $compile_command " in
+    *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*)
+      suncc_use_cstd_abi=no
+      ;;
+    *)
+      suncc_use_cstd_abi=yes
+      ;;
+    esac
+}
+
 # func_mode_link arg...
 func_mode_link ()
 {
-    $opt_debug
+    $debug_cmd
+
     case $host in
     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
       # It is impossible to link a dll without this setting, and
       # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
+      # what system we are compiling for in order to pass an extra
       # flag for every libtool invocation.
       # allow_undefined=no
 
       # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
+      # to make a dll that has undefined symbols, in which case not
       # even a static library is built.  For now, we need to specify
       # -no-undefined on the libtool link line when we can be certain
       # that all symbols are satisfied, otherwise we get a static library.
@@ -5146,10 +6544,11 @@ func_mode_link ()
     module=no
     no_install=no
     objs=
+    os2dllname=
     non_pic_objects=
     precious_files_regex=
     prefer_static_libs=no
-    preload=no
+    preload=false
     prev=
     prevarg=
     release=
@@ -5161,7 +6560,7 @@ func_mode_link ()
     vinfo=
     vinfo_number=no
     weak_libs=
-    single_module="${wl}-single_module"
+    single_module=$wl-single_module
     func_infer_tag $base_compile
 
     # We need to know -static, to get the right output filenames.
@@ -5169,15 +6568,15 @@ func_mode_link ()
     do
       case $arg in
       -shared)
-	test "$build_libtool_libs" != yes && \
-	  func_fatal_configuration "can not build a shared library"
+	test yes != "$build_libtool_libs" \
+	  && func_fatal_configuration "cannot build a shared library"
 	build_old_libs=no
 	break
 	;;
       -all-static | -static | -static-libtool-libs)
 	case $arg in
 	-all-static)
-	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	  if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then
 	    func_warning "complete static linking is impossible in this configuration"
 	  fi
 	  if test -n "$link_static_flag"; then
@@ -5210,7 +6609,7 @@ func_mode_link ()
 
     # Go through the arguments, transforming them on the way.
     while test "$#" -gt 0; do
-      arg="$1"
+      arg=$1
       shift
       func_quote_for_eval "$arg"
       qarg=$func_quote_for_eval_unquoted_result
@@ -5227,21 +6626,21 @@ func_mode_link ()
 
 	case $prev in
 	bindir)
-	  bindir="$arg"
+	  bindir=$arg
 	  prev=
 	  continue
 	  ;;
 	dlfiles|dlprefiles)
-	  if test "$preload" = no; then
+	  $preload || {
 	    # Add the symbol object into the linking commands.
 	    func_append compile_command " @SYMFILE@"
 	    func_append finalize_command " @SYMFILE@"
-	    preload=yes
-	  fi
+	    preload=:
+	  }
 	  case $arg in
 	  *.la | *.lo) ;;  # We handle these cases below.
 	  force)
-	    if test "$dlself" = no; then
+	    if test no = "$dlself"; then
 	      dlself=needless
 	      export_dynamic=yes
 	    fi
@@ -5249,9 +6648,9 @@ func_mode_link ()
 	    continue
 	    ;;
 	  self)
-	    if test "$prev" = dlprefiles; then
+	    if test dlprefiles = "$prev"; then
 	      dlself=yes
-	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	    elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then
 	      dlself=yes
 	    else
 	      dlself=needless
@@ -5261,7 +6660,7 @@ func_mode_link ()
 	    continue
 	    ;;
 	  *)
-	    if test "$prev" = dlfiles; then
+	    if test dlfiles = "$prev"; then
 	      func_append dlfiles " $arg"
 	    else
 	      func_append dlprefiles " $arg"
@@ -5272,14 +6671,14 @@ func_mode_link ()
 	  esac
 	  ;;
 	expsyms)
-	  export_symbols="$arg"
+	  export_symbols=$arg
 	  test -f "$arg" \
-	    || func_fatal_error "symbol file \`$arg' does not exist"
+	    || func_fatal_error "symbol file '$arg' does not exist"
 	  prev=
 	  continue
 	  ;;
 	expsyms_regex)
-	  export_symbols_regex="$arg"
+	  export_symbols_regex=$arg
 	  prev=
 	  continue
 	  ;;
@@ -5297,7 +6696,13 @@ func_mode_link ()
 	  continue
 	  ;;
 	inst_prefix)
-	  inst_prefix_dir="$arg"
+	  inst_prefix_dir=$arg
+	  prev=
+	  continue
+	  ;;
+	mllvm)
+	  # Clang does not use LLVM to link, so we can simply discard any
+	  # '-mllvm $arg' options when doing the link step.
 	  prev=
 	  continue
 	  ;;
@@ -5321,21 +6726,21 @@ func_mode_link ()
 
 		if test -z "$pic_object" ||
 		   test -z "$non_pic_object" ||
-		   test "$pic_object" = none &&
-		   test "$non_pic_object" = none; then
-		  func_fatal_error "cannot find name of object for \`$arg'"
+		   test none = "$pic_object" &&
+		   test none = "$non_pic_object"; then
+		  func_fatal_error "cannot find name of object for '$arg'"
 		fi
 
 		# Extract subdirectory from the argument.
 		func_dirname "$arg" "/" ""
-		xdir="$func_dirname_result"
+		xdir=$func_dirname_result
 
-		if test "$pic_object" != none; then
+		if test none != "$pic_object"; then
 		  # Prepend the subdirectory the object is found in.
-		  pic_object="$xdir$pic_object"
+		  pic_object=$xdir$pic_object
 
-		  if test "$prev" = dlfiles; then
-		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		  if test dlfiles = "$prev"; then
+		    if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
 		      func_append dlfiles " $pic_object"
 		      prev=
 		      continue
@@ -5346,7 +6751,7 @@ func_mode_link ()
 		  fi
 
 		  # CHECK ME:  I think I busted this.  -Ossama
-		  if test "$prev" = dlprefiles; then
+		  if test dlprefiles = "$prev"; then
 		    # Preload the old-style object.
 		    func_append dlprefiles " $pic_object"
 		    prev=
@@ -5354,23 +6759,23 @@ func_mode_link ()
 
 		  # A PIC object.
 		  func_append libobjs " $pic_object"
-		  arg="$pic_object"
+		  arg=$pic_object
 		fi
 
 		# Non-PIC object.
-		if test "$non_pic_object" != none; then
+		if test none != "$non_pic_object"; then
 		  # Prepend the subdirectory the object is found in.
-		  non_pic_object="$xdir$non_pic_object"
+		  non_pic_object=$xdir$non_pic_object
 
 		  # A standard non-PIC object
 		  func_append non_pic_objects " $non_pic_object"
-		  if test -z "$pic_object" || test "$pic_object" = none ; then
-		    arg="$non_pic_object"
+		  if test -z "$pic_object" || test none = "$pic_object"; then
+		    arg=$non_pic_object
 		  fi
 		else
 		  # If the PIC object exists, use it instead.
 		  # $xdir was prepended to $pic_object above.
-		  non_pic_object="$pic_object"
+		  non_pic_object=$pic_object
 		  func_append non_pic_objects " $non_pic_object"
 		fi
 	      else
@@ -5378,7 +6783,7 @@ func_mode_link ()
 		if $opt_dry_run; then
 		  # Extract subdirectory from the argument.
 		  func_dirname "$arg" "/" ""
-		  xdir="$func_dirname_result"
+		  xdir=$func_dirname_result
 
 		  func_lo2o "$arg"
 		  pic_object=$xdir$objdir/$func_lo2o_result
@@ -5386,24 +6791,29 @@ func_mode_link ()
 		  func_append libobjs " $pic_object"
 		  func_append non_pic_objects " $non_pic_object"
 	        else
-		  func_fatal_error "\`$arg' is not a valid libtool object"
+		  func_fatal_error "'$arg' is not a valid libtool object"
 		fi
 	      fi
 	    done
 	  else
-	    func_fatal_error "link input file \`$arg' does not exist"
+	    func_fatal_error "link input file '$arg' does not exist"
 	  fi
 	  arg=$save_arg
 	  prev=
 	  continue
 	  ;;
+	os2dllname)
+	  os2dllname=$arg
+	  prev=
+	  continue
+	  ;;
 	precious_regex)
-	  precious_files_regex="$arg"
+	  precious_files_regex=$arg
 	  prev=
 	  continue
 	  ;;
 	release)
-	  release="-$arg"
+	  release=-$arg
 	  prev=
 	  continue
 	  ;;
@@ -5415,7 +6825,7 @@ func_mode_link ()
 	    func_fatal_error "only absolute run-paths are allowed"
 	    ;;
 	  esac
-	  if test "$prev" = rpath; then
+	  if test rpath = "$prev"; then
 	    case "$rpath " in
 	    *" $arg "*) ;;
 	    *) func_append rpath " $arg" ;;
@@ -5430,7 +6840,7 @@ func_mode_link ()
 	  continue
 	  ;;
 	shrext)
-	  shrext_cmds="$arg"
+	  shrext_cmds=$arg
 	  prev=
 	  continue
 	  ;;
@@ -5470,7 +6880,7 @@ func_mode_link ()
 	esac
       fi # test -n "$prev"
 
-      prevarg="$arg"
+      prevarg=$arg
 
       case $arg in
       -all-static)
@@ -5484,7 +6894,7 @@ func_mode_link ()
 
       -allow-undefined)
 	# FIXME: remove this flag sometime in the future.
-	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	func_fatal_error "'-allow-undefined' must not be used because it is the default"
 	;;
 
       -avoid-version)
@@ -5516,7 +6926,7 @@ func_mode_link ()
 	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
 	  func_fatal_error "more than one -exported-symbols argument is not allowed"
 	fi
-	if test "X$arg" = "X-export-symbols"; then
+	if test X-export-symbols = "X$arg"; then
 	  prev=expsyms
 	else
 	  prev=expsyms_regex
@@ -5550,9 +6960,9 @@ func_mode_link ()
 	func_stripname "-L" '' "$arg"
 	if test -z "$func_stripname_result"; then
 	  if test "$#" -gt 0; then
-	    func_fatal_error "require no space between \`-L' and \`$1'"
+	    func_fatal_error "require no space between '-L' and '$1'"
 	  else
-	    func_fatal_error "need path for \`-L' option"
+	    func_fatal_error "need path for '-L' option"
 	  fi
 	fi
 	func_resolve_sysroot "$func_stripname_result"
@@ -5563,8 +6973,8 @@ func_mode_link ()
 	*)
 	  absdir=`cd "$dir" && pwd`
 	  test -z "$absdir" && \
-	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
-	  dir="$absdir"
+	    func_fatal_error "cannot determine absolute directory name of '$dir'"
+	  dir=$absdir
 	  ;;
 	esac
 	case "$deplibs " in
@@ -5599,7 +7009,7 @@ func_mode_link ()
 	;;
 
       -l*)
-	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	if test X-lc = "X$arg" || test X-lm = "X$arg"; then
 	  case $host in
 	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
 	    # These systems don't actually have a C or math library (as such)
@@ -5607,11 +7017,11 @@ func_mode_link ()
 	    ;;
 	  *-*-os2*)
 	    # These systems don't actually have a C library (as such)
-	    test "X$arg" = "X-lc" && continue
+	    test X-lc = "X$arg" && continue
 	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
 	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
+	    test X-lc = "X$arg" && continue
 	    ;;
 	  *-*-rhapsody* | *-*-darwin1.[012])
 	    # Rhapsody C and math libraries are in the System framework
@@ -5620,16 +7030,16 @@ func_mode_link ()
 	    ;;
 	  *-*-sco3.2v5* | *-*-sco5v6*)
 	    # Causes problems with __ctype
-	    test "X$arg" = "X-lc" && continue
+	    test X-lc = "X$arg" && continue
 	    ;;
 	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
 	    # Compiler inserts libc in the correct place for threads to work
-	    test "X$arg" = "X-lc" && continue
+	    test X-lc = "X$arg" && continue
 	    ;;
 	  esac
-	elif test "X$arg" = "X-lc_r"; then
+	elif test X-lc_r = "X$arg"; then
 	 case $host in
-	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
 	   # Do not include libc_r directly, use -pthread flag.
 	   continue
 	   ;;
@@ -5639,6 +7049,11 @@ func_mode_link ()
 	continue
 	;;
 
+      -mllvm)
+	prev=mllvm
+	continue
+	;;
+
       -module)
 	module=yes
 	continue
@@ -5668,7 +7083,7 @@ func_mode_link ()
 	;;
 
       -multi_module)
-	single_module="${wl}-multi_module"
+	single_module=$wl-multi_module
 	continue
 	;;
 
@@ -5682,8 +7097,8 @@ func_mode_link ()
 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
 	  # The PATH hackery in wrapper scripts is required on Windows
 	  # and Darwin in order for the loader to find any dlls it needs.
-	  func_warning "\`-no-install' is ignored for $host"
-	  func_warning "assuming \`-no-fast-install' instead"
+	  func_warning "'-no-install' is ignored for $host"
+	  func_warning "assuming '-no-fast-install' instead"
 	  fast_install=no
 	  ;;
 	*) no_install=yes ;;
@@ -5701,6 +7116,11 @@ func_mode_link ()
 	continue
 	;;
 
+      -os2dllname)
+	prev=os2dllname
+	continue
+	;;
+
       -o) prev=output ;;
 
       -precious-files-regex)
@@ -5788,14 +7208,14 @@ func_mode_link ()
 	func_stripname '-Wc,' '' "$arg"
 	args=$func_stripname_result
 	arg=
-	save_ifs="$IFS"; IFS=','
+	save_ifs=$IFS; IFS=,
 	for flag in $args; do
-	  IFS="$save_ifs"
+	  IFS=$save_ifs
           func_quote_for_eval "$flag"
 	  func_append arg " $func_quote_for_eval_result"
 	  func_append compiler_flags " $func_quote_for_eval_result"
 	done
-	IFS="$save_ifs"
+	IFS=$save_ifs
 	func_stripname ' ' '' "$arg"
 	arg=$func_stripname_result
 	;;
@@ -5804,15 +7224,15 @@ func_mode_link ()
 	func_stripname '-Wl,' '' "$arg"
 	args=$func_stripname_result
 	arg=
-	save_ifs="$IFS"; IFS=','
+	save_ifs=$IFS; IFS=,
 	for flag in $args; do
-	  IFS="$save_ifs"
+	  IFS=$save_ifs
           func_quote_for_eval "$flag"
 	  func_append arg " $wl$func_quote_for_eval_result"
 	  func_append compiler_flags " $wl$func_quote_for_eval_result"
 	  func_append linker_flags " $func_quote_for_eval_result"
 	done
-	IFS="$save_ifs"
+	IFS=$save_ifs
 	func_stripname ' ' '' "$arg"
 	arg=$func_stripname_result
 	;;
@@ -5835,7 +7255,7 @@ func_mode_link ()
       # -msg_* for osf cc
       -msg_*)
 	func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
+	arg=$func_quote_for_eval_result
 	;;
 
       # Flags to be passed through unchanged, with rationale:
@@ -5847,25 +7267,49 @@ func_mode_link ()
       # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
       # -F/path              path to uninstalled frameworks, gcc on darwin
       # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # -fstack-protector*   stack protector flags for GCC
       # @file                GCC response files
       # -tp=*                Portland pgcc target processor selection
       # --sysroot=*          for sysroot support
-      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      # -specs=*             GCC specs files
+      # -stdlib=*            select c++ std lib with clang
+      # -fsanitize=*         Clang/GCC memory and address sanitizer
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
       -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+      -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
+      -specs=*|-fsanitize=*)
         func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
+	arg=$func_quote_for_eval_result
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
         func_append compiler_flags " $arg"
         continue
         ;;
 
+      -Z*)
+        if test os2 = "`expr $host : '.*\(os2\)'`"; then
+          # OS/2 uses -Zxxx to specify OS/2-specific options
+	  compiler_flags="$compiler_flags $arg"
+	  func_append compile_command " $arg"
+	  func_append finalize_command " $arg"
+	  case $arg in
+	  -Zlinker | -Zstack)
+	    prev=xcompiler
+	    ;;
+	  esac
+	  continue
+        else
+	  # Otherwise treat like 'Some other compiler flag' below
+	  func_quote_for_eval "$arg"
+	  arg=$func_quote_for_eval_result
+        fi
+	;;
+
       # Some other compiler flag.
       -* | +*)
         func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
+	arg=$func_quote_for_eval_result
 	;;
 
       *.$objext)
@@ -5886,21 +7330,21 @@ func_mode_link ()
 
 	  if test -z "$pic_object" ||
 	     test -z "$non_pic_object" ||
-	     test "$pic_object" = none &&
-	     test "$non_pic_object" = none; then
-	    func_fatal_error "cannot find name of object for \`$arg'"
+	     test none = "$pic_object" &&
+	     test none = "$non_pic_object"; then
+	    func_fatal_error "cannot find name of object for '$arg'"
 	  fi
 
 	  # Extract subdirectory from the argument.
 	  func_dirname "$arg" "/" ""
-	  xdir="$func_dirname_result"
+	  xdir=$func_dirname_result
 
-	  if test "$pic_object" != none; then
+	  test none = "$pic_object" || {
 	    # Prepend the subdirectory the object is found in.
-	    pic_object="$xdir$pic_object"
+	    pic_object=$xdir$pic_object
 
-	    if test "$prev" = dlfiles; then
-	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+	    if test dlfiles = "$prev"; then
+	      if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then
 		func_append dlfiles " $pic_object"
 		prev=
 		continue
@@ -5911,7 +7355,7 @@ func_mode_link ()
 	    fi
 
 	    # CHECK ME:  I think I busted this.  -Ossama
-	    if test "$prev" = dlprefiles; then
+	    if test dlprefiles = "$prev"; then
 	      # Preload the old-style object.
 	      func_append dlprefiles " $pic_object"
 	      prev=
@@ -5919,23 +7363,23 @@ func_mode_link ()
 
 	    # A PIC object.
 	    func_append libobjs " $pic_object"
-	    arg="$pic_object"
-	  fi
+	    arg=$pic_object
+	  }
 
 	  # Non-PIC object.
-	  if test "$non_pic_object" != none; then
+	  if test none != "$non_pic_object"; then
 	    # Prepend the subdirectory the object is found in.
-	    non_pic_object="$xdir$non_pic_object"
+	    non_pic_object=$xdir$non_pic_object
 
 	    # A standard non-PIC object
 	    func_append non_pic_objects " $non_pic_object"
-	    if test -z "$pic_object" || test "$pic_object" = none ; then
-	      arg="$non_pic_object"
+	    if test -z "$pic_object" || test none = "$pic_object"; then
+	      arg=$non_pic_object
 	    fi
 	  else
 	    # If the PIC object exists, use it instead.
 	    # $xdir was prepended to $pic_object above.
-	    non_pic_object="$pic_object"
+	    non_pic_object=$pic_object
 	    func_append non_pic_objects " $non_pic_object"
 	  fi
 	else
@@ -5943,7 +7387,7 @@ func_mode_link ()
 	  if $opt_dry_run; then
 	    # Extract subdirectory from the argument.
 	    func_dirname "$arg" "/" ""
-	    xdir="$func_dirname_result"
+	    xdir=$func_dirname_result
 
 	    func_lo2o "$arg"
 	    pic_object=$xdir$objdir/$func_lo2o_result
@@ -5951,7 +7395,7 @@ func_mode_link ()
 	    func_append libobjs " $pic_object"
 	    func_append non_pic_objects " $non_pic_object"
 	  else
-	    func_fatal_error "\`$arg' is not a valid libtool object"
+	    func_fatal_error "'$arg' is not a valid libtool object"
 	  fi
 	fi
 	;;
@@ -5967,11 +7411,11 @@ func_mode_link ()
 	# A libtool-controlled library.
 
 	func_resolve_sysroot "$arg"
-	if test "$prev" = dlfiles; then
+	if test dlfiles = "$prev"; then
 	  # This library was specified with -dlopen.
 	  func_append dlfiles " $func_resolve_sysroot_result"
 	  prev=
-	elif test "$prev" = dlprefiles; then
+	elif test dlprefiles = "$prev"; then
 	  # The library was specified with -dlpreopen.
 	  func_append dlprefiles " $func_resolve_sysroot_result"
 	  prev=
@@ -5986,7 +7430,7 @@ func_mode_link ()
 	# Unknown arguments in both finalize_command and compile_command need
 	# to be aesthetically quoted because they are evaled later.
 	func_quote_for_eval "$arg"
-	arg="$func_quote_for_eval_result"
+	arg=$func_quote_for_eval_result
 	;;
       esac # arg
 
@@ -5998,9 +7442,9 @@ func_mode_link ()
     done # argument parsing loop
 
     test -n "$prev" && \
-      func_fatal_help "the \`$prevarg' option requires an argument"
+      func_fatal_help "the '$prevarg' option requires an argument"
 
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+    if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then
       eval arg=\"$export_dynamic_flag_spec\"
       func_append compile_command " $arg"
       func_append finalize_command " $arg"
@@ -6009,20 +7453,23 @@ func_mode_link ()
     oldlibs=
     # calculate the name of the file, without its directory
     func_basename "$output"
-    outputname="$func_basename_result"
-    libobjs_save="$libobjs"
+    outputname=$func_basename_result
+    libobjs_save=$libobjs
 
     if test -n "$shlibpath_var"; then
       # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+      eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\`
     else
       shlib_search_path=
     fi
     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
 
+    # Definition is injected by LT_CONFIG during libtool generation.
+    func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH"
+
     func_dirname "$output" "/" ""
-    output_objdir="$func_dirname_result$objdir"
+    output_objdir=$func_dirname_result$objdir
     func_to_tool_file "$output_objdir/"
     tool_output_objdir=$func_to_tool_file_result
     # Create the object directory.
@@ -6045,7 +7492,7 @@ func_mode_link ()
     # Find all interdependent deplibs by searching for libraries
     # that are linked more than once (e.g. -la -lb -la)
     for deplib in $deplibs; do
-      if $opt_preserve_dup_deps ; then
+      if $opt_preserve_dup_deps; then
 	case "$libs " in
 	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	esac
@@ -6053,7 +7500,7 @@ func_mode_link ()
       func_append libs " $deplib"
     done
 
-    if test "$linkmode" = lib; then
+    if test lib = "$linkmode"; then
       libs="$predeps $libs $compiler_lib_search_path $postdeps"
 
       # Compute libraries that are listed more than once in $predeps
@@ -6085,7 +7532,7 @@ func_mode_link ()
 	  case $file in
 	  *.la) ;;
 	  *)
-	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    func_fatal_help "libraries can '-dlopen' only libtool libraries: $file"
 	    ;;
 	  esac
 	done
@@ -6093,7 +7540,7 @@ func_mode_link ()
     prog)
 	compile_deplibs=
 	finalize_deplibs=
-	alldeplibs=no
+	alldeplibs=false
 	newdlfiles=
 	newdlprefiles=
 	passes="conv scan dlopen dlpreopen link"
@@ -6105,32 +7552,32 @@ func_mode_link ()
     for pass in $passes; do
       # The preopen pass in lib mode reverses $deplibs; put it back here
       # so that -L comes before libs that need it for instance...
-      if test "$linkmode,$pass" = "lib,link"; then
+      if test lib,link = "$linkmode,$pass"; then
 	## FIXME: Find the place where the list is rebuilt in the wrong
 	##        order, and fix it there properly
         tmp_deplibs=
 	for deplib in $deplibs; do
 	  tmp_deplibs="$deplib $tmp_deplibs"
 	done
-	deplibs="$tmp_deplibs"
+	deplibs=$tmp_deplibs
       fi
 
-      if test "$linkmode,$pass" = "lib,link" ||
-	 test "$linkmode,$pass" = "prog,scan"; then
-	libs="$deplibs"
+      if test lib,link = "$linkmode,$pass" ||
+	 test prog,scan = "$linkmode,$pass"; then
+	libs=$deplibs
 	deplibs=
       fi
-      if test "$linkmode" = prog; then
+      if test prog = "$linkmode"; then
 	case $pass in
-	dlopen) libs="$dlfiles" ;;
-	dlpreopen) libs="$dlprefiles" ;;
+	dlopen) libs=$dlfiles ;;
+	dlpreopen) libs=$dlprefiles ;;
 	link)
 	  libs="$deplibs %DEPLIBS%"
 	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
 	  ;;
 	esac
       fi
-      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+      if test lib,dlpreopen = "$linkmode,$pass"; then
 	# Collect and forward deplibs of preopened libtool libs
 	for lib in $dlprefiles; do
 	  # Ignore non-libtool-libs
@@ -6151,26 +7598,26 @@ func_mode_link ()
 	    esac
 	  done
 	done
-	libs="$dlprefiles"
+	libs=$dlprefiles
       fi
-      if test "$pass" = dlopen; then
+      if test dlopen = "$pass"; then
 	# Collect dlpreopened libraries
-	save_deplibs="$deplibs"
+	save_deplibs=$deplibs
 	deplibs=
       fi
 
       for deplib in $libs; do
 	lib=
-	found=no
+	found=false
 	case $deplib in
 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-	  if test "$linkmode,$pass" = "prog,link"; then
+	  if test prog,link = "$linkmode,$pass"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
 	    func_append compiler_flags " $deplib"
-	    if test "$linkmode" = lib ; then
+	    if test lib = "$linkmode"; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
 		    * ) func_append new_inherited_linker_flags " $deplib" ;;
@@ -6180,13 +7627,13 @@ func_mode_link ()
 	  continue
 	  ;;
 	-l*)
-	  if test "$linkmode" != lib && test "$linkmode" != prog; then
-	    func_warning "\`-l' is ignored for archives/objects"
+	  if test lib != "$linkmode" && test prog != "$linkmode"; then
+	    func_warning "'-l' is ignored for archives/objects"
 	    continue
 	  fi
 	  func_stripname '-l' '' "$deplib"
 	  name=$func_stripname_result
-	  if test "$linkmode" = lib; then
+	  if test lib = "$linkmode"; then
 	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
 	  else
 	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
@@ -6194,31 +7641,22 @@ func_mode_link ()
 	  for searchdir in $searchdirs; do
 	    for search_ext in .la $std_shrext .so .a; do
 	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
+	      lib=$searchdir/lib$name$search_ext
 	      if test -f "$lib"; then
-		if test "$search_ext" = ".la"; then
-		  found=yes
+		if test .la = "$search_ext"; then
+		  found=:
 		else
-		  found=no
+		  found=false
 		fi
 		break 2
 	      fi
 	    done
 	  done
-	  if test "$found" != yes; then
-	    # deplib doesn't seem to be a libtool library
-	    if test "$linkmode,$pass" = "prog,link"; then
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      deplibs="$deplib $deplibs"
-	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    continue
-	  else # deplib is a libtool library
+	  if $found; then
+	    # deplib is a libtool library
 	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
 	    # We need to do some special things here, and not later.
-	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 	      case " $predeps $postdeps " in
 	      *" $deplib "*)
 		if func_lalib_p "$lib"; then
@@ -6226,19 +7664,19 @@ func_mode_link ()
 		  old_library=
 		  func_source "$lib"
 		  for l in $old_library $library_names; do
-		    ll="$l"
+		    ll=$l
 		  done
-		  if test "X$ll" = "X$old_library" ; then # only static version available
-		    found=no
+		  if test "X$ll" = "X$old_library"; then # only static version available
+		    found=false
 		    func_dirname "$lib" "" "."
-		    ladir="$func_dirname_result"
+		    ladir=$func_dirname_result
 		    lib=$ladir/$old_library
-		    if test "$linkmode,$pass" = "prog,link"; then
+		    if test prog,link = "$linkmode,$pass"; then
 		      compile_deplibs="$deplib $compile_deplibs"
 		      finalize_deplibs="$deplib $finalize_deplibs"
 		    else
 		      deplibs="$deplib $deplibs"
-		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
 		    fi
 		    continue
 		  fi
@@ -6247,15 +7685,25 @@ func_mode_link ()
 	      *) ;;
 	      esac
 	    fi
+	  else
+	    # deplib doesn't seem to be a libtool library
+	    if test prog,link = "$linkmode,$pass"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
 	  fi
 	  ;; # -l
 	*.ltframework)
-	  if test "$linkmode,$pass" = "prog,link"; then
+	  if test prog,link = "$linkmode,$pass"; then
 	    compile_deplibs="$deplib $compile_deplibs"
 	    finalize_deplibs="$deplib $finalize_deplibs"
 	  else
 	    deplibs="$deplib $deplibs"
-	    if test "$linkmode" = lib ; then
+	    if test lib = "$linkmode"; then
 		case "$new_inherited_linker_flags " in
 		    *" $deplib "*) ;;
 		    * ) func_append new_inherited_linker_flags " $deplib" ;;
@@ -6268,18 +7716,18 @@ func_mode_link ()
 	  case $linkmode in
 	  lib)
 	    deplibs="$deplib $deplibs"
-	    test "$pass" = conv && continue
+	    test conv = "$pass" && continue
 	    newdependency_libs="$deplib $newdependency_libs"
 	    func_stripname '-L' '' "$deplib"
 	    func_resolve_sysroot "$func_stripname_result"
 	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  prog)
-	    if test "$pass" = conv; then
+	    if test conv = "$pass"; then
 	      deplibs="$deplib $deplibs"
 	      continue
 	    fi
-	    if test "$pass" = scan; then
+	    if test scan = "$pass"; then
 	      deplibs="$deplib $deplibs"
 	    else
 	      compile_deplibs="$deplib $compile_deplibs"
@@ -6290,13 +7738,13 @@ func_mode_link ()
 	    func_append newlib_search_path " $func_resolve_sysroot_result"
 	    ;;
 	  *)
-	    func_warning "\`-L' is ignored for archives/objects"
+	    func_warning "'-L' is ignored for archives/objects"
 	    ;;
 	  esac # linkmode
 	  continue
 	  ;; # -L
 	-R*)
-	  if test "$pass" = link; then
+	  if test link = "$pass"; then
 	    func_stripname '-R' '' "$deplib"
 	    func_resolve_sysroot "$func_stripname_result"
 	    dir=$func_resolve_sysroot_result
@@ -6314,7 +7762,7 @@ func_mode_link ()
 	  lib=$func_resolve_sysroot_result
 	  ;;
 	*.$libext)
-	  if test "$pass" = conv; then
+	  if test conv = "$pass"; then
 	    deplibs="$deplib $deplibs"
 	    continue
 	  fi
@@ -6325,21 +7773,26 @@ func_mode_link ()
 	    case " $dlpreconveniencelibs " in
 	    *" $deplib "*) ;;
 	    *)
-	      valid_a_lib=no
+	      valid_a_lib=false
 	      case $deplibs_check_method in
 		match_pattern*)
 		  set dummy $deplibs_check_method; shift
 		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
 		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
 		    | $EGREP "$match_pattern_regex" > /dev/null; then
-		    valid_a_lib=yes
+		    valid_a_lib=:
 		  fi
 		;;
 		pass_all)
-		  valid_a_lib=yes
+		  valid_a_lib=:
 		;;
 	      esac
-	      if test "$valid_a_lib" != yes; then
+	      if $valid_a_lib; then
+		echo
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      else
 		echo
 		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
 		echo "*** I have the capability to make that library automatically link in when"
@@ -6347,18 +7800,13 @@ func_mode_link ()
 		echo "*** shared version of the library, which you do not appear to have"
 		echo "*** because the file extensions .$libext of this argument makes me believe"
 		echo "*** that it is just a static archive that I should not use here."
-	      else
-		echo
-		$ECHO "*** Warning: Linking the shared library $output against the"
-		$ECHO "*** static library $deplib is not portable!"
-		deplibs="$deplib $deplibs"
 	      fi
 	      ;;
 	    esac
 	    continue
 	    ;;
 	  prog)
-	    if test "$pass" != link; then
+	    if test link != "$pass"; then
 	      deplibs="$deplib $deplibs"
 	    else
 	      compile_deplibs="$deplib $compile_deplibs"
@@ -6369,10 +7817,10 @@ func_mode_link ()
 	  esac # linkmode
 	  ;; # *.$libext
 	*.lo | *.$objext)
-	  if test "$pass" = conv; then
+	  if test conv = "$pass"; then
 	    deplibs="$deplib $deplibs"
-	  elif test "$linkmode" = prog; then
-	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	  elif test prog = "$linkmode"; then
+	    if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then
 	      # If there is no dlopen support or we're linking statically,
 	      # we need to preload.
 	      func_append newdlprefiles " $deplib"
@@ -6385,22 +7833,20 @@ func_mode_link ()
 	  continue
 	  ;;
 	%DEPLIBS%)
-	  alldeplibs=yes
+	  alldeplibs=:
 	  continue
 	  ;;
 	esac # case $deplib
 
-	if test "$found" = yes || test -f "$lib"; then :
-	else
-	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
-	fi
+	$found || test -f "$lib" \
+	  || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'"
 
 	# Check to see that this really is a libtool archive.
 	func_lalib_unsafe_p "$lib" \
-	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+	  || func_fatal_error "'$lib' is not a valid libtool archive"
 
 	func_dirname "$lib" "" "."
-	ladir="$func_dirname_result"
+	ladir=$func_dirname_result
 
 	dlname=
 	dlopen=
@@ -6430,19 +7876,19 @@ func_mode_link ()
 	  done
 	fi
 	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
-	if test "$linkmode,$pass" = "lib,link" ||
-	   test "$linkmode,$pass" = "prog,scan" ||
-	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	if test lib,link = "$linkmode,$pass" ||
+	   test prog,scan = "$linkmode,$pass" ||
+	   { test prog != "$linkmode" && test lib != "$linkmode"; }; then
 	  test -n "$dlopen" && func_append dlfiles " $dlopen"
 	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
 	fi
 
-	if test "$pass" = conv; then
+	if test conv = "$pass"; then
 	  # Only check for convenience libraries
 	  deplibs="$lib $deplibs"
 	  if test -z "$libdir"; then
 	    if test -z "$old_library"; then
-	      func_fatal_error "cannot find name of link library for \`$lib'"
+	      func_fatal_error "cannot find name of link library for '$lib'"
 	    fi
 	    # It is a libtool convenience library, so add in its objects.
 	    func_append convenience " $ladir/$objdir/$old_library"
@@ -6450,15 +7896,15 @@ func_mode_link ()
 	    tmp_libs=
 	    for deplib in $dependency_libs; do
 	      deplibs="$deplib $deplibs"
-	      if $opt_preserve_dup_deps ; then
+	      if $opt_preserve_dup_deps; then
 		case "$tmp_libs " in
 		*" $deplib "*) func_append specialdeplibs " $deplib" ;;
 		esac
 	      fi
 	      func_append tmp_libs " $deplib"
 	    done
-	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
-	    func_fatal_error "\`$lib' is not a convenience library"
+	  elif test prog != "$linkmode" && test lib != "$linkmode"; then
+	    func_fatal_error "'$lib' is not a convenience library"
 	  fi
 	  continue
 	fi # $pass = conv
@@ -6467,26 +7913,26 @@ func_mode_link ()
 	# Get the name of the library we link against.
 	linklib=
 	if test -n "$old_library" &&
-	   { test "$prefer_static_libs" = yes ||
-	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	   { test yes = "$prefer_static_libs" ||
+	     test built,no = "$prefer_static_libs,$installed"; }; then
 	  linklib=$old_library
 	else
 	  for l in $old_library $library_names; do
-	    linklib="$l"
+	    linklib=$l
 	  done
 	fi
 	if test -z "$linklib"; then
-	  func_fatal_error "cannot find name of link library for \`$lib'"
+	  func_fatal_error "cannot find name of link library for '$lib'"
 	fi
 
 	# This library was specified with -dlopen.
-	if test "$pass" = dlopen; then
-	  if test -z "$libdir"; then
-	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
-	  fi
+	if test dlopen = "$pass"; then
+	  test -z "$libdir" \
+	    && func_fatal_error "cannot -dlopen a convenience library: '$lib'"
 	  if test -z "$dlname" ||
-	     test "$dlopen_support" != yes ||
-	     test "$build_libtool_libs" = no; then
+	     test yes != "$dlopen_support" ||
+	     test no = "$build_libtool_libs"
+	  then
 	    # If there is no dlname, no dlopen support or we're linking
 	    # statically, we need to preload.  We also need to preload any
 	    # dependent libraries so libltdl's deplib preloader doesn't
@@ -6500,40 +7946,40 @@ func_mode_link ()
 
 	# We need an absolute path.
 	case $ladir in
-	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;;
 	*)
 	  abs_ladir=`cd "$ladir" && pwd`
 	  if test -z "$abs_ladir"; then
-	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "cannot determine absolute directory name of '$ladir'"
 	    func_warning "passing it literally to the linker, although it might fail"
-	    abs_ladir="$ladir"
+	    abs_ladir=$ladir
 	  fi
 	  ;;
 	esac
 	func_basename "$lib"
-	laname="$func_basename_result"
+	laname=$func_basename_result
 
 	# Find the relevant object directory and library name.
-	if test "X$installed" = Xyes; then
+	if test yes = "$installed"; then
 	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    func_warning "library \`$lib' was moved."
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    libdir="$abs_ladir"
+	    func_warning "library '$lib' was moved."
+	    dir=$ladir
+	    absdir=$abs_ladir
+	    libdir=$abs_ladir
 	  else
-	    dir="$lt_sysroot$libdir"
-	    absdir="$lt_sysroot$libdir"
+	    dir=$lt_sysroot$libdir
+	    absdir=$lt_sysroot$libdir
 	  fi
-	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	  test yes = "$hardcode_automatic" && avoidtemprpath=yes
 	else
 	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    dir="$ladir"
-	    absdir="$abs_ladir"
+	    dir=$ladir
+	    absdir=$abs_ladir
 	    # Remove this search path later
 	    func_append notinst_path " $abs_ladir"
 	  else
-	    dir="$ladir/$objdir"
-	    absdir="$abs_ladir/$objdir"
+	    dir=$ladir/$objdir
+	    absdir=$abs_ladir/$objdir
 	    # Remove this search path later
 	    func_append notinst_path " $abs_ladir"
 	  fi
@@ -6542,11 +7988,11 @@ func_mode_link ()
 	name=$func_stripname_result
 
 	# This library was specified with -dlpreopen.
-	if test "$pass" = dlpreopen; then
-	  if test -z "$libdir" && test "$linkmode" = prog; then
-	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	if test dlpreopen = "$pass"; then
+	  if test -z "$libdir" && test prog = "$linkmode"; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'"
 	  fi
-	  case "$host" in
+	  case $host in
 	    # special handling for platforms with PE-DLLs.
 	    *cygwin* | *mingw* | *cegcc* )
 	      # Linker will automatically link against shared library if both
@@ -6590,9 +8036,9 @@ func_mode_link ()
 
 	if test -z "$libdir"; then
 	  # Link the convenience library
-	  if test "$linkmode" = lib; then
+	  if test lib = "$linkmode"; then
 	    deplibs="$dir/$old_library $deplibs"
-	  elif test "$linkmode,$pass" = "prog,link"; then
+	  elif test prog,link = "$linkmode,$pass"; then
 	    compile_deplibs="$dir/$old_library $compile_deplibs"
 	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
 	  else
@@ -6602,14 +8048,14 @@ func_mode_link ()
 	fi
 
 
-	if test "$linkmode" = prog && test "$pass" != link; then
+	if test prog = "$linkmode" && test link != "$pass"; then
 	  func_append newlib_search_path " $ladir"
 	  deplibs="$lib $deplibs"
 
-	  linkalldeplibs=no
-	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
-	     test "$build_libtool_libs" = no; then
-	    linkalldeplibs=yes
+	  linkalldeplibs=false
+	  if test no != "$link_all_deplibs" || test -z "$library_names" ||
+	     test no = "$build_libtool_libs"; then
+	    linkalldeplibs=:
 	  fi
 
 	  tmp_libs=
@@ -6621,14 +8067,14 @@ func_mode_link ()
 		 ;;
 	    esac
 	    # Need to link against all dependency_libs?
-	    if test "$linkalldeplibs" = yes; then
+	    if $linkalldeplibs; then
 	      deplibs="$deplib $deplibs"
 	    else
 	      # Need to hardcode shared library paths
 	      # or/and link against static libraries
 	      newdependency_libs="$deplib $newdependency_libs"
 	    fi
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_preserve_dup_deps; then
 	      case "$tmp_libs " in
 	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
 	      esac
@@ -6638,15 +8084,15 @@ func_mode_link ()
 	  continue
 	fi # $linkmode = prog...
 
-	if test "$linkmode,$pass" = "prog,link"; then
+	if test prog,link = "$linkmode,$pass"; then
 	  if test -n "$library_names" &&
-	     { { test "$prefer_static_libs" = no ||
-	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	     { { test no = "$prefer_static_libs" ||
+	         test built,yes = "$prefer_static_libs,$installed"; } ||
 	       test -z "$old_library"; }; then
 	    # We need to hardcode the library path
-	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then
 	      # Make sure the rpath contains only unique directories.
-	      case "$temp_rpath:" in
+	      case $temp_rpath: in
 	      *"$absdir:"*) ;;
 	      *) func_append temp_rpath "$absdir:" ;;
 	      esac
@@ -6675,9 +8121,9 @@ func_mode_link ()
 	    esac
 	  fi # $linkmode,$pass = prog,link...
 
-	  if test "$alldeplibs" = yes &&
-	     { test "$deplibs_check_method" = pass_all ||
-	       { test "$build_libtool_libs" = yes &&
+	  if $alldeplibs &&
+	     { test pass_all = "$deplibs_check_method" ||
+	       { test yes = "$build_libtool_libs" &&
 		 test -n "$library_names"; }; }; then
 	    # We only need to search for static libraries
 	    continue
@@ -6686,19 +8132,19 @@ func_mode_link ()
 
 	link_static=no # Whether the deplib will be linked statically
 	use_static_libs=$prefer_static_libs
-	if test "$use_static_libs" = built && test "$installed" = yes; then
+	if test built = "$use_static_libs" && test yes = "$installed"; then
 	  use_static_libs=no
 	fi
 	if test -n "$library_names" &&
-	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	   { test no = "$use_static_libs" || test -z "$old_library"; }; then
 	  case $host in
-	  *cygwin* | *mingw* | *cegcc*)
+	  *cygwin* | *mingw* | *cegcc* | *os2*)
 	      # No point in relinking DLLs because paths are not encoded
 	      func_append notinst_deplibs " $lib"
 	      need_relink=no
 	    ;;
 	  *)
-	    if test "$installed" = no; then
+	    if test no = "$installed"; then
 	      func_append notinst_deplibs " $lib"
 	      need_relink=yes
 	    fi
@@ -6708,24 +8154,24 @@ func_mode_link ()
 
 	  # Warn about portability, can't link against -module's on some
 	  # systems (darwin).  Don't bleat about dlopened modules though!
-	  dlopenmodule=""
+	  dlopenmodule=
 	  for dlpremoduletest in $dlprefiles; do
 	    if test "X$dlpremoduletest" = "X$lib"; then
-	      dlopenmodule="$dlpremoduletest"
+	      dlopenmodule=$dlpremoduletest
 	      break
 	    fi
 	  done
-	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	  if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then
 	    echo
-	    if test "$linkmode" = prog; then
+	    if test prog = "$linkmode"; then
 	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
 	    else
 	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
 	    fi
 	    $ECHO "*** $linklib is not portable!"
 	  fi
-	  if test "$linkmode" = lib &&
-	     test "$hardcode_into_libs" = yes; then
+	  if test lib = "$linkmode" &&
+	     test yes = "$hardcode_into_libs"; then
 	    # Hardcode the library path.
 	    # Skip directories that are in the system default run-time
 	    # search path.
@@ -6753,43 +8199,43 @@ func_mode_link ()
 	    # figure out the soname
 	    set dummy $library_names
 	    shift
-	    realname="$1"
+	    realname=$1
 	    shift
 	    libname=`eval "\\$ECHO \"$libname_spec\""`
 	    # use dlname if we got it. it's perfectly good, no?
 	    if test -n "$dlname"; then
-	      soname="$dlname"
+	      soname=$dlname
 	    elif test -n "$soname_spec"; then
 	      # bleh windows
 	      case $host in
-	      *cygwin* | mingw* | *cegcc*)
+	      *cygwin* | mingw* | *cegcc* | *os2*)
 	        func_arith $current - $age
 		major=$func_arith_result
-		versuffix="-$major"
+		versuffix=-$major
 		;;
 	      esac
 	      eval soname=\"$soname_spec\"
 	    else
-	      soname="$realname"
+	      soname=$realname
 	    fi
 
 	    # Make a new name for the extract_expsyms_cmds to use
-	    soroot="$soname"
+	    soroot=$soname
 	    func_basename "$soroot"
-	    soname="$func_basename_result"
+	    soname=$func_basename_result
 	    func_stripname 'lib' '.dll' "$soname"
 	    newlib=libimp-$func_stripname_result.a
 
 	    # If the library has no export list, then create one now
 	    if test -f "$output_objdir/$soname-def"; then :
 	    else
-	      func_verbose "extracting exported symbol list from \`$soname'"
+	      func_verbose "extracting exported symbol list from '$soname'"
 	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
 	    fi
 
 	    # Create $newlib
 	    if test -f "$output_objdir/$newlib"; then :; else
-	      func_verbose "generating import library for \`$soname'"
+	      func_verbose "generating import library for '$soname'"
 	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
 	    fi
 	    # make sure the library variables are pointing to the new library
@@ -6797,58 +8243,58 @@ func_mode_link ()
 	    linklib=$newlib
 	  fi # test -n "$old_archive_from_expsyms_cmds"
 
-	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
+	  if test prog = "$linkmode" || test relink != "$opt_mode"; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
 	    lib_linked=yes
 	    case $hardcode_action in
 	    immediate | unsupported)
-	      if test "$hardcode_direct" = no; then
-		add="$dir/$linklib"
+	      if test no = "$hardcode_direct"; then
+		add=$dir/$linklib
 		case $host in
-		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
-		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;;
+		  *-*-sysv4*uw2*) add_dir=-L$dir ;;
 		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
-		    *-*-unixware7*) add_dir="-L$dir" ;;
+		    *-*-unixware7*) add_dir=-L$dir ;;
 		  *-*-darwin* )
-		    # if the lib is a (non-dlopened) module then we can not
+		    # if the lib is a (non-dlopened) module then we cannot
 		    # link against it, someone is ignoring the earlier warnings
 		    if /usr/bin/file -L $add 2> /dev/null |
-			 $GREP ": [^:]* bundle" >/dev/null ; then
+			 $GREP ": [^:]* bundle" >/dev/null; then
 		      if test "X$dlopenmodule" != "X$lib"; then
 			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
-			if test -z "$old_library" ; then
+			if test -z "$old_library"; then
 			  echo
 			  echo "*** And there doesn't seem to be a static archive available"
 			  echo "*** The link will probably fail, sorry"
 			else
-			  add="$dir/$old_library"
+			  add=$dir/$old_library
 			fi
 		      elif test -n "$old_library"; then
-			add="$dir/$old_library"
+			add=$dir/$old_library
 		      fi
 		    fi
 		esac
-	      elif test "$hardcode_minus_L" = no; then
+	      elif test no = "$hardcode_minus_L"; then
 		case $host in
-		*-*-sunos*) add_shlibpath="$dir" ;;
+		*-*-sunos*) add_shlibpath=$dir ;;
 		esac
-		add_dir="-L$dir"
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = no; then
-		add_shlibpath="$dir"
-		add="-l$name"
+		add_dir=-L$dir
+		add=-l$name
+	      elif test no = "$hardcode_shlibpath_var"; then
+		add_shlibpath=$dir
+		add=-l$name
 	      else
 		lib_linked=no
 	      fi
 	      ;;
 	    relink)
-	      if test "$hardcode_direct" = yes &&
-	         test "$hardcode_direct_absolute" = no; then
-		add="$dir/$linklib"
-	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$absdir"
+	      if test yes = "$hardcode_direct" &&
+	         test no = "$hardcode_direct_absolute"; then
+		add=$dir/$linklib
+	      elif test yes = "$hardcode_minus_L"; then
+		add_dir=-L$absdir
 		# Try looking first in the location we're being installed to.
 		if test -n "$inst_prefix_dir"; then
 		  case $libdir in
@@ -6857,10 +8303,10 @@ func_mode_link ()
 		      ;;
 		  esac
 		fi
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = yes; then
-		add_shlibpath="$dir"
-		add="-l$name"
+		add=-l$name
+	      elif test yes = "$hardcode_shlibpath_var"; then
+		add_shlibpath=$dir
+		add=-l$name
 	      else
 		lib_linked=no
 	      fi
@@ -6868,7 +8314,7 @@ func_mode_link ()
 	    *) lib_linked=no ;;
 	    esac
 
-	    if test "$lib_linked" != yes; then
+	    if test yes != "$lib_linked"; then
 	      func_fatal_configuration "unsupported hardcode properties"
 	    fi
 
@@ -6878,15 +8324,15 @@ func_mode_link ()
 	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
 	      esac
 	    fi
-	    if test "$linkmode" = prog; then
+	    if test prog = "$linkmode"; then
 	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
 	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
 	    else
 	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
 	      test -n "$add" && deplibs="$add $deplibs"
-	      if test "$hardcode_direct" != yes &&
-		 test "$hardcode_minus_L" != yes &&
-		 test "$hardcode_shlibpath_var" = yes; then
+	      if test yes != "$hardcode_direct" &&
+		 test yes != "$hardcode_minus_L" &&
+		 test yes = "$hardcode_shlibpath_var"; then
 		case :$finalize_shlibpath: in
 		*":$libdir:"*) ;;
 		*) func_append finalize_shlibpath "$libdir:" ;;
@@ -6895,33 +8341,33 @@ func_mode_link ()
 	    fi
 	  fi
 
-	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
+	  if test prog = "$linkmode" || test relink = "$opt_mode"; then
 	    add_shlibpath=
 	    add_dir=
 	    add=
 	    # Finalize command for both is simple: just hardcode it.
-	    if test "$hardcode_direct" = yes &&
-	       test "$hardcode_direct_absolute" = no; then
-	      add="$libdir/$linklib"
-	    elif test "$hardcode_minus_L" = yes; then
-	      add_dir="-L$libdir"
-	      add="-l$name"
-	    elif test "$hardcode_shlibpath_var" = yes; then
+	    if test yes = "$hardcode_direct" &&
+	       test no = "$hardcode_direct_absolute"; then
+	      add=$libdir/$linklib
+	    elif test yes = "$hardcode_minus_L"; then
+	      add_dir=-L$libdir
+	      add=-l$name
+	    elif test yes = "$hardcode_shlibpath_var"; then
 	      case :$finalize_shlibpath: in
 	      *":$libdir:"*) ;;
 	      *) func_append finalize_shlibpath "$libdir:" ;;
 	      esac
-	      add="-l$name"
-	    elif test "$hardcode_automatic" = yes; then
+	      add=-l$name
+	    elif test yes = "$hardcode_automatic"; then
 	      if test -n "$inst_prefix_dir" &&
-		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
-		add="$inst_prefix_dir$libdir/$linklib"
+		 test -f "$inst_prefix_dir$libdir/$linklib"; then
+		add=$inst_prefix_dir$libdir/$linklib
 	      else
-		add="$libdir/$linklib"
+		add=$libdir/$linklib
 	      fi
 	    else
 	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
+	      add_dir=-L$libdir
 	      # Try looking first in the location we're being installed to.
 	      if test -n "$inst_prefix_dir"; then
 		case $libdir in
@@ -6930,10 +8376,10 @@ func_mode_link ()
 		    ;;
 		esac
 	      fi
-	      add="-l$name"
+	      add=-l$name
 	    fi
 
-	    if test "$linkmode" = prog; then
+	    if test prog = "$linkmode"; then
 	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
 	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
 	    else
@@ -6941,43 +8387,43 @@ func_mode_link ()
 	      test -n "$add" && deplibs="$add $deplibs"
 	    fi
 	  fi
-	elif test "$linkmode" = prog; then
+	elif test prog = "$linkmode"; then
 	  # Here we assume that one of hardcode_direct or hardcode_minus_L
 	  # is not unsupported.  This is valid on all known static and
 	  # shared platforms.
-	  if test "$hardcode_direct" != unsupported; then
-	    test -n "$old_library" && linklib="$old_library"
+	  if test unsupported != "$hardcode_direct"; then
+	    test -n "$old_library" && linklib=$old_library
 	    compile_deplibs="$dir/$linklib $compile_deplibs"
 	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
 	  else
 	    compile_deplibs="-l$name -L$dir $compile_deplibs"
 	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
 	  fi
-	elif test "$build_libtool_libs" = yes; then
+	elif test yes = "$build_libtool_libs"; then
 	  # Not a shared library
-	  if test "$deplibs_check_method" != pass_all; then
+	  if test pass_all != "$deplibs_check_method"; then
 	    # We're trying link a shared library against a static one
 	    # but the system doesn't support it.
 
 	    # Just print a warning and add the library to dependency_libs so
 	    # that the program can be linked against the static library.
 	    echo
-	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    $ECHO "*** Warning: This system cannot link to static lib archive $lib."
 	    echo "*** I have the capability to make that library automatically link in when"
 	    echo "*** you link to this library.  But I can only do this if you have a"
 	    echo "*** shared version of the library, which you do not appear to have."
-	    if test "$module" = yes; then
+	    if test yes = "$module"; then
 	      echo "*** But as you try to build a module library, libtool will still create "
 	      echo "*** a static module, that should work as long as the dlopening application"
 	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
 	      if test -z "$global_symbol_pipe"; then
 		echo
 		echo "*** However, this would only work if libtool was able to extract symbol"
-		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
 		echo "*** not find such a program.  So, this module is probably useless."
-		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+		echo "*** 'nm' from GNU binutils and a full rebuild may help."
 	      fi
-	      if test "$build_old_libs" = no; then
+	      if test no = "$build_old_libs"; then
 		build_libtool_libs=module
 		build_old_libs=yes
 	      else
@@ -6990,11 +8436,11 @@ func_mode_link ()
 	  fi
 	fi # link shared/static library?
 
-	if test "$linkmode" = lib; then
+	if test lib = "$linkmode"; then
 	  if test -n "$dependency_libs" &&
-	     { test "$hardcode_into_libs" != yes ||
-	       test "$build_old_libs" = yes ||
-	       test "$link_static" = yes; }; then
+	     { test yes != "$hardcode_into_libs" ||
+	       test yes = "$build_old_libs" ||
+	       test yes = "$link_static"; }; then
 	    # Extract -R from dependency_libs
 	    temp_deplibs=
 	    for libdir in $dependency_libs; do
@@ -7008,12 +8454,12 @@ func_mode_link ()
 	      *) func_append temp_deplibs " $libdir";;
 	      esac
 	    done
-	    dependency_libs="$temp_deplibs"
+	    dependency_libs=$temp_deplibs
 	  fi
 
 	  func_append newlib_search_path " $absdir"
 	  # Link against this library
-	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
 	  # ... and its dependency_libs
 	  tmp_libs=
 	  for deplib in $dependency_libs; do
@@ -7023,7 +8469,7 @@ func_mode_link ()
                    func_resolve_sysroot "$func_stripname_result";;
               *) func_resolve_sysroot "$deplib" ;;
             esac
-	    if $opt_preserve_dup_deps ; then
+	    if $opt_preserve_dup_deps; then
 	      case "$tmp_libs " in
 	      *" $func_resolve_sysroot_result "*)
                 func_append specialdeplibs " $func_resolve_sysroot_result" ;;
@@ -7032,12 +8478,12 @@ func_mode_link ()
 	    func_append tmp_libs " $func_resolve_sysroot_result"
 	  done
 
-	  if test "$link_all_deplibs" != no; then
+	  if test no != "$link_all_deplibs"; then
 	    # Add the search paths of all dependency libraries
 	    for deplib in $dependency_libs; do
 	      path=
 	      case $deplib in
-	      -L*) path="$deplib" ;;
+	      -L*) path=$deplib ;;
 	      *.la)
 	        func_resolve_sysroot "$deplib"
 	        deplib=$func_resolve_sysroot_result
@@ -7045,12 +8491,12 @@ func_mode_link ()
 		dir=$func_dirname_result
 		# We need an absolute path.
 		case $dir in
-		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		[\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;;
 		*)
 		  absdir=`cd "$dir" && pwd`
 		  if test -z "$absdir"; then
-		    func_warning "cannot determine absolute directory name of \`$dir'"
-		    absdir="$dir"
+		    func_warning "cannot determine absolute directory name of '$dir'"
+		    absdir=$dir
 		  fi
 		  ;;
 		esac
@@ -7058,35 +8504,35 @@ func_mode_link ()
 		case $host in
 		*-*-darwin*)
 		  depdepl=
-		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-		  if test -n "$deplibrary_names" ; then
-		    for tmp in $deplibrary_names ; do
+		  eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names"; then
+		    for tmp in $deplibrary_names; do
 		      depdepl=$tmp
 		    done
-		    if test -f "$absdir/$objdir/$depdepl" ; then
-		      depdepl="$absdir/$objdir/$depdepl"
-		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+		    if test -f "$absdir/$objdir/$depdepl"; then
+		      depdepl=$absdir/$objdir/$depdepl
+		      darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
                       if test -z "$darwin_install_name"; then
-                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                          darwin_install_name=`$OTOOL64 -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
                       fi
-		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
-		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+		      func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl"
+		      func_append linker_flags " -dylib_file $darwin_install_name:$depdepl"
 		      path=
 		    fi
 		  fi
 		  ;;
 		*)
-		  path="-L$absdir/$objdir"
+		  path=-L$absdir/$objdir
 		  ;;
 		esac
 		else
-		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
 		  test -z "$libdir" && \
-		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		    func_fatal_error "'$deplib' is not a valid libtool archive"
 		  test "$absdir" != "$libdir" && \
-		    func_warning "\`$deplib' seems to be moved"
+		    func_warning "'$deplib' seems to be moved"
 
-		  path="-L$absdir"
+		  path=-L$absdir
 		fi
 		;;
 	      esac
@@ -7098,23 +8544,23 @@ func_mode_link ()
 	  fi # link_all_deplibs != no
 	fi # linkmode = lib
       done # for deplib in $libs
-      if test "$pass" = link; then
-	if test "$linkmode" = "prog"; then
+      if test link = "$pass"; then
+	if test prog = "$linkmode"; then
 	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
 	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
 	else
 	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
 	fi
       fi
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
+      dependency_libs=$newdependency_libs
+      if test dlpreopen = "$pass"; then
 	# Link the dlpreopened libraries before other libraries
 	for deplib in $save_deplibs; do
 	  deplibs="$deplib $deplibs"
 	done
       fi
-      if test "$pass" != dlopen; then
-	if test "$pass" != conv; then
+      if test dlopen != "$pass"; then
+	test conv = "$pass" || {
 	  # Make sure lib_search_path contains only unique directories.
 	  lib_search_path=
 	  for dir in $newlib_search_path; do
@@ -7124,12 +8570,12 @@ func_mode_link ()
 	    esac
 	  done
 	  newlib_search_path=
-	fi
+	}
 
-	if test "$linkmode,$pass" != "prog,link"; then
-	  vars="deplibs"
-	else
+	if test prog,link = "$linkmode,$pass"; then
 	  vars="compile_deplibs finalize_deplibs"
+	else
+	  vars=deplibs
 	fi
 	for var in $vars dependency_libs; do
 	  # Add libraries to $var in reverse order
@@ -7187,62 +8633,93 @@ func_mode_link ()
 	  eval $var=\"$tmp_libs\"
 	done # for var
       fi
+
+      # Add Sun CC postdeps if required:
+      test CXX = "$tagname" && {
+        case $host_os in
+        linux*)
+          case `$CC -V 2>&1 | sed 5q` in
+          *Sun\ C*) # Sun C++ 5.9
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+
+        solaris*)
+          func_cc_basename "$CC"
+          case $func_cc_basename_result in
+          CC* | sunCC*)
+            func_suncc_cstd_abi
+
+            if test no != "$suncc_use_cstd_abi"; then
+              func_append postdeps ' -library=Cstd -library=Crun'
+            fi
+            ;;
+          esac
+          ;;
+        esac
+      }
+
       # Last step: remove runtime libs from dependency_libs
       # (they stay in deplibs)
       tmp_libs=
-      for i in $dependency_libs ; do
+      for i in $dependency_libs; do
 	case " $predeps $postdeps $compiler_lib_search_path " in
 	*" $i "*)
-	  i=""
+	  i=
 	  ;;
 	esac
-	if test -n "$i" ; then
+	if test -n "$i"; then
 	  func_append tmp_libs " $i"
 	fi
       done
       dependency_libs=$tmp_libs
     done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
+    if test prog = "$linkmode"; then
+      dlfiles=$newdlfiles
     fi
-    if test "$linkmode" = prog || test "$linkmode" = lib; then
-      dlprefiles="$newdlprefiles"
+    if test prog = "$linkmode" || test lib = "$linkmode"; then
+      dlprefiles=$newdlprefiles
     fi
 
     case $linkmode in
     oldlib)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	func_warning "\`-dlopen' is ignored for archives"
+      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+	func_warning "'-dlopen' is ignored for archives"
       fi
 
       case " $deplibs" in
       *\ -l* | *\ -L*)
-	func_warning "\`-l' and \`-L' are ignored for archives" ;;
+	func_warning "'-l' and '-L' are ignored for archives" ;;
       esac
 
       test -n "$rpath" && \
-	func_warning "\`-rpath' is ignored for archives"
+	func_warning "'-rpath' is ignored for archives"
 
       test -n "$xrpath" && \
-	func_warning "\`-R' is ignored for archives"
+	func_warning "'-R' is ignored for archives"
 
       test -n "$vinfo" && \
-	func_warning "\`-version-info/-version-number' is ignored for archives"
+	func_warning "'-version-info/-version-number' is ignored for archives"
 
       test -n "$release" && \
-	func_warning "\`-release' is ignored for archives"
+	func_warning "'-release' is ignored for archives"
 
       test -n "$export_symbols$export_symbols_regex" && \
-	func_warning "\`-export-symbols' is ignored for archives"
+	func_warning "'-export-symbols' is ignored for archives"
 
       # Now set the variables for building old libraries.
       build_libtool_libs=no
-      oldlibs="$output"
+      oldlibs=$output
       func_append objs "$old_deplibs"
       ;;
 
     lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
+      # Make sure we only generate libraries of the form 'libNAME.la'.
       case $outputname in
       lib*)
 	func_stripname 'lib' '.la' "$outputname"
@@ -7251,10 +8728,10 @@ func_mode_link ()
 	eval libname=\"$libname_spec\"
 	;;
       *)
-	test "$module" = no && \
-	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+	test no = "$module" \
+	  && func_fatal_help "libtool library '$output' must begin with 'lib'"
 
-	if test "$need_lib_prefix" != no; then
+	if test no != "$need_lib_prefix"; then
 	  # Add the "lib" prefix for modules if required
 	  func_stripname '' '.la' "$outputname"
 	  name=$func_stripname_result
@@ -7268,8 +8745,8 @@ func_mode_link ()
       esac
 
       if test -n "$objs"; then
-	if test "$deplibs_check_method" != pass_all; then
-	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	if test pass_all != "$deplibs_check_method"; then
+	  func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs"
 	else
 	  echo
 	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
@@ -7278,21 +8755,21 @@ func_mode_link ()
 	fi
       fi
 
-      test "$dlself" != no && \
-	func_warning "\`-dlopen self' is ignored for libtool libraries"
+      test no = "$dlself" \
+	|| func_warning "'-dlopen self' is ignored for libtool libraries"
 
       set dummy $rpath
       shift
-      test "$#" -gt 1 && \
-	func_warning "ignoring multiple \`-rpath's for a libtool library"
+      test 1 -lt "$#" \
+	&& func_warning "ignoring multiple '-rpath's for a libtool library"
 
-      install_libdir="$1"
+      install_libdir=$1
 
       oldlibs=
       if test -z "$rpath"; then
-	if test "$build_libtool_libs" = yes; then
+	if test yes = "$build_libtool_libs"; then
 	  # Building a libtool convenience library.
-	  # Some compilers have problems with a `.al' extension so
+	  # Some compilers have problems with a '.al' extension so
 	  # convenience libraries should have the same extension an
 	  # archive normally would.
 	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
@@ -7301,20 +8778,20 @@ func_mode_link ()
 	fi
 
 	test -n "$vinfo" && \
-	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+	  func_warning "'-version-info/-version-number' is ignored for convenience libraries"
 
 	test -n "$release" && \
-	  func_warning "\`-release' is ignored for convenience libraries"
+	  func_warning "'-release' is ignored for convenience libraries"
       else
 
 	# Parse the version information argument.
-	save_ifs="$IFS"; IFS=':'
+	save_ifs=$IFS; IFS=:
 	set dummy $vinfo 0 0 0
 	shift
-	IFS="$save_ifs"
+	IFS=$save_ifs
 
 	test -n "$7" && \
-	  func_fatal_help "too many parameters to \`-version-info'"
+	  func_fatal_help "too many parameters to '-version-info'"
 
 	# convert absolute version numbers to libtool ages
 	# this retains compatibility with .la files and attempts
@@ -7322,45 +8799,45 @@ func_mode_link ()
 
 	case $vinfo_number in
 	yes)
-	  number_major="$1"
-	  number_minor="$2"
-	  number_revision="$3"
+	  number_major=$1
+	  number_minor=$2
+	  number_revision=$3
 	  #
 	  # There are really only two kinds -- those that
 	  # use the current revision as the major version
 	  # and those that subtract age and use age as
 	  # a minor version.  But, then there is irix
-	  # which has an extra 1 added just for fun
+	  # that has an extra 1 added just for fun
 	  #
 	  case $version_type in
 	  # correct linux to gnu/linux during the next big refactor
-	  darwin|linux|osf|windows|none)
+	  darwin|freebsd-elf|linux|osf|windows|none)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
-	    age="$number_minor"
-	    revision="$number_revision"
+	    age=$number_minor
+	    revision=$number_revision
 	    ;;
-	  freebsd-aout|freebsd-elf|qnx|sunos)
-	    current="$number_major"
-	    revision="$number_minor"
-	    age="0"
+	  freebsd-aout|qnx|sunos)
+	    current=$number_major
+	    revision=$number_minor
+	    age=0
 	    ;;
 	  irix|nonstopux)
 	    func_arith $number_major + $number_minor
 	    current=$func_arith_result
-	    age="$number_minor"
-	    revision="$number_minor"
+	    age=$number_minor
+	    revision=$number_minor
 	    lt_irix_increment=no
 	    ;;
 	  *)
-	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+	    func_fatal_configuration "$modename: unknown library version type '$version_type'"
 	    ;;
 	  esac
 	  ;;
 	no)
-	  current="$1"
-	  revision="$2"
-	  age="$3"
+	  current=$1
+	  revision=$2
+	  age=$3
 	  ;;
 	esac
 
@@ -7368,30 +8845,30 @@ func_mode_link ()
 	case $current in
 	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 	*)
-	  func_error "CURRENT \`$current' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
+	  func_error "CURRENT '$current' must be a nonnegative integer"
+	  func_fatal_error "'$vinfo' is not valid version information"
 	  ;;
 	esac
 
 	case $revision in
 	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 	*)
-	  func_error "REVISION \`$revision' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
+	  func_error "REVISION '$revision' must be a nonnegative integer"
+	  func_fatal_error "'$vinfo' is not valid version information"
 	  ;;
 	esac
 
 	case $age in
 	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
 	*)
-	  func_error "AGE \`$age' must be a nonnegative integer"
-	  func_fatal_error "\`$vinfo' is not valid version information"
+	  func_error "AGE '$age' must be a nonnegative integer"
+	  func_fatal_error "'$vinfo' is not valid version information"
 	  ;;
 	esac
 
 	if test "$age" -gt "$current"; then
-	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
-	  func_fatal_error "\`$vinfo' is not valid version information"
+	  func_error "AGE '$age' is greater than the current interface number '$current'"
+	  func_fatal_error "'$vinfo' is not valid version information"
 	fi
 
 	# Calculate the version variables.
@@ -7406,26 +8883,36 @@ func_mode_link ()
 	  # verstring for coding it into the library header
 	  func_arith $current - $age
 	  major=.$func_arith_result
-	  versuffix="$major.$age.$revision"
+	  versuffix=$major.$age.$revision
 	  # Darwin ld doesn't like 0 for these options...
 	  func_arith $current + 1
 	  minor_current=$func_arith_result
-	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
 	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+          # On Darwin other compilers
+          case $CC in
+              nagfor*)
+                  verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
+                  ;;
+              *)
+                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+                  ;;
+          esac
 	  ;;
 
 	freebsd-aout)
-	  major=".$current"
-	  versuffix=".$current.$revision";
+	  major=.$current
+	  versuffix=.$current.$revision
 	  ;;
 
 	freebsd-elf)
-	  major=".$current"
-	  versuffix=".$current"
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix=$major.$age.$revision
 	  ;;
 
 	irix | nonstopux)
-	  if test "X$lt_irix_increment" = "Xno"; then
+	  if test no = "$lt_irix_increment"; then
 	    func_arith $current - $age
 	  else
 	    func_arith $current - $age + 1
@@ -7436,69 +8923,74 @@ func_mode_link ()
 	    nonstopux) verstring_prefix=nonstopux ;;
 	    *)         verstring_prefix=sgi ;;
 	  esac
-	  verstring="$verstring_prefix$major.$revision"
+	  verstring=$verstring_prefix$major.$revision
 
 	  # Add in all the interfaces that we are compatible with.
 	  loop=$revision
-	  while test "$loop" -ne 0; do
+	  while test 0 -ne "$loop"; do
 	    func_arith $revision - $loop
 	    iface=$func_arith_result
 	    func_arith $loop - 1
 	    loop=$func_arith_result
-	    verstring="$verstring_prefix$major.$iface:$verstring"
+	    verstring=$verstring_prefix$major.$iface:$verstring
 	  done
 
-	  # Before this point, $major must not contain `.'.
+	  # Before this point, $major must not contain '.'.
 	  major=.$major
-	  versuffix="$major.$revision"
+	  versuffix=$major.$revision
 	  ;;
 
 	linux) # correct to gnu/linux during the next big refactor
 	  func_arith $current - $age
 	  major=.$func_arith_result
-	  versuffix="$major.$age.$revision"
+	  versuffix=$major.$age.$revision
 	  ;;
 
 	osf)
 	  func_arith $current - $age
 	  major=.$func_arith_result
-	  versuffix=".$current.$age.$revision"
-	  verstring="$current.$age.$revision"
+	  versuffix=.$current.$age.$revision
+	  verstring=$current.$age.$revision
 
 	  # Add in all the interfaces that we are compatible with.
 	  loop=$age
-	  while test "$loop" -ne 0; do
+	  while test 0 -ne "$loop"; do
 	    func_arith $current - $loop
 	    iface=$func_arith_result
 	    func_arith $loop - 1
 	    loop=$func_arith_result
-	    verstring="$verstring:${iface}.0"
+	    verstring=$verstring:$iface.0
 	  done
 
 	  # Make executables depend on our current version.
-	  func_append verstring ":${current}.0"
+	  func_append verstring ":$current.0"
 	  ;;
 
 	qnx)
-	  major=".$current"
-	  versuffix=".$current"
+	  major=.$current
+	  versuffix=.$current
+	  ;;
+
+	sco)
+	  major=.$current
+	  versuffix=.$current
 	  ;;
 
 	sunos)
-	  major=".$current"
-	  versuffix=".$current.$revision"
+	  major=.$current
+	  versuffix=.$current.$revision
 	  ;;
 
 	windows)
 	  # Use '-' rather than '.', since we only want one
-	  # extension on DOS 8.3 filesystems.
+	  # extension on DOS 8.3 file systems.
 	  func_arith $current - $age
 	  major=$func_arith_result
-	  versuffix="-$major"
+	  versuffix=-$major
 	  ;;
 
 	*)
-	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  func_fatal_configuration "unknown library version type '$version_type'"
 	  ;;
 	esac
 
@@ -7512,42 +9004,45 @@ func_mode_link ()
 	    verstring=
 	    ;;
 	  *)
-	    verstring="0.0"
+	    verstring=0.0
 	    ;;
 	  esac
-	  if test "$need_version" = no; then
+	  if test no = "$need_version"; then
 	    versuffix=
 	  else
-	    versuffix=".0.0"
+	    versuffix=.0.0
 	  fi
 	fi
 
 	# Remove version info from name if versioning should be avoided
-	if test "$avoid_version" = yes && test "$need_version" = no; then
+	if test yes,no = "$avoid_version,$need_version"; then
 	  major=
 	  versuffix=
-	  verstring=""
+	  verstring=
 	fi
 
 	# Check to see if the archive will have undefined symbols.
-	if test "$allow_undefined" = yes; then
-	  if test "$allow_undefined_flag" = unsupported; then
-	    func_warning "undefined symbols not allowed in $host shared libraries"
-	    build_libtool_libs=no
-	    build_old_libs=yes
+	if test yes = "$allow_undefined"; then
+	  if test unsupported = "$allow_undefined_flag"; then
+	    if test yes = "$build_old_libs"; then
+	      func_warning "undefined symbols not allowed in $host shared libraries; building static only"
+	      build_libtool_libs=no
+	    else
+	      func_fatal_error "can't build $host shared library unless -no-undefined is specified"
+	    fi
 	  fi
 	else
 	  # Don't allow undefined symbols.
-	  allow_undefined_flag="$no_undefined_flag"
+	  allow_undefined_flag=$no_undefined_flag
 	fi
 
       fi
 
-      func_generate_dlsyms "$libname" "$libname" "yes"
+      func_generate_dlsyms "$libname" "$libname" :
       func_append libobjs " $symfileobj"
-      test "X$libobjs" = "X " && libobjs=
+      test " " = "$libobjs" && libobjs=
 
-      if test "$opt_mode" != relink; then
+      if test relink != "$opt_mode"; then
 	# Remove our outputs, but don't remove object files since they
 	# may have been created when compiling PIC objects.
 	removelist=
@@ -7556,8 +9051,8 @@ func_mode_link ()
 	  case $p in
 	    *.$objext | *.gcno)
 	       ;;
-	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-	       if test "X$precious_files_regex" != "X"; then
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*)
+	       if test -n "$precious_files_regex"; then
 		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
 		 then
 		   continue
@@ -7573,11 +9068,11 @@ func_mode_link ()
       fi
 
       # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+      if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then
 	func_append oldlibs " $output_objdir/$libname.$libext"
 
 	# Transform .lo files to .o files.
-	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP`
       fi
 
       # Eliminate all temporary directories.
@@ -7598,13 +9093,13 @@ func_mode_link ()
 	  *) func_append finalize_rpath " $libdir" ;;
 	  esac
 	done
-	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then
 	  dependency_libs="$temp_xrpath $dependency_libs"
 	fi
       fi
 
       # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
+      old_dlfiles=$dlfiles
       dlfiles=
       for lib in $old_dlfiles; do
 	case " $dlprefiles $dlfiles " in
@@ -7614,7 +9109,7 @@ func_mode_link ()
       done
 
       # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
+      old_dlprefiles=$dlprefiles
       dlprefiles=
       for lib in $old_dlprefiles; do
 	case "$dlprefiles " in
@@ -7623,7 +9118,7 @@ func_mode_link ()
 	esac
       done
 
-      if test "$build_libtool_libs" = yes; then
+      if test yes = "$build_libtool_libs"; then
 	if test -n "$rpath"; then
 	  case $host in
 	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
@@ -7647,7 +9142,7 @@ func_mode_link ()
 	    ;;
 	  *)
 	    # Add libc to deplibs on all other systems if necessary.
-	    if test "$build_libtool_need_lc" = "yes"; then
+	    if test yes = "$build_libtool_need_lc"; then
 	      func_append deplibs " -lc"
 	    fi
 	    ;;
@@ -7663,9 +9158,9 @@ func_mode_link ()
 	# I'm not sure if I'm treating the release correctly.  I think
 	# release should show up in the -l (ie -lgmp5) so we don't want to
 	# add it in twice.  Is that correct?
-	release=""
-	versuffix=""
-	major=""
+	release=
+	versuffix=
+	major=
 	newdeplibs=
 	droppeddeps=no
 	case $deplibs_check_method in
@@ -7694,20 +9189,20 @@ EOF
 	      -l*)
 		func_stripname -l '' "$i"
 		name=$func_stripname_result
-		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 		  case " $predeps $postdeps " in
 		  *" $i "*)
 		    func_append newdeplibs " $i"
-		    i=""
+		    i=
 		    ;;
 		  esac
 		fi
-		if test -n "$i" ; then
+		if test -n "$i"; then
 		  libname=`eval "\\$ECHO \"$libname_spec\""`
 		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
 		  set dummy $deplib_matches; shift
 		  deplib_match=$1
-		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
 		    func_append newdeplibs " $i"
 		  else
 		    droppeddeps=yes
@@ -7737,20 +9232,20 @@ EOF
 		$opt_dry_run || $RM conftest
 		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
 		  ldd_output=`ldd conftest`
-		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 		    case " $predeps $postdeps " in
 		    *" $i "*)
 		      func_append newdeplibs " $i"
-		      i=""
+		      i=
 		      ;;
 		    esac
 		  fi
-		  if test -n "$i" ; then
+		  if test -n "$i"; then
 		    libname=`eval "\\$ECHO \"$libname_spec\""`
 		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
 		    set dummy $deplib_matches; shift
 		    deplib_match=$1
-		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then
 		      func_append newdeplibs " $i"
 		    else
 		      droppeddeps=yes
@@ -7787,24 +9282,24 @@ EOF
 	    -l*)
 	      func_stripname -l '' "$a_deplib"
 	      name=$func_stripname_result
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
 		  func_append newdeplibs " $a_deplib"
-		  a_deplib=""
+		  a_deplib=
 		  ;;
 		esac
 	      fi
-	      if test -n "$a_deplib" ; then
+	      if test -n "$a_deplib"; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
 		if test -n "$file_magic_glob"; then
 		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
 		else
 		  libnameglob=$libname
 		fi
-		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+		test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  if test "$want_nocaseglob" = yes; then
+		  if test yes = "$want_nocaseglob"; then
 		    shopt -s nocaseglob
 		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
 		    $nocaseglob
@@ -7822,25 +9317,25 @@ EOF
 		      # We might still enter an endless loop, since a link
 		      # loop can be closed while we follow links,
 		      # but so what?
-		      potlib="$potent_lib"
+		      potlib=$potent_lib
 		      while test -h "$potlib" 2>/dev/null; do
-			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			potliblink=`ls -ld $potlib | $SED 's/.* -> //'`
 			case $potliblink in
-			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			[\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;;
+			*) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";;
 			esac
 		      done
 		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
 			 $SED -e 10q |
 			 $EGREP "$file_magic_regex" > /dev/null; then
 			func_append newdeplibs " $a_deplib"
-			a_deplib=""
+			a_deplib=
 			break 2
 		      fi
 		  done
 		done
 	      fi
-	      if test -n "$a_deplib" ; then
+	      if test -n "$a_deplib"; then
 		droppeddeps=yes
 		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
@@ -7848,7 +9343,7 @@ EOF
 		echo "*** you link to this library.  But I can only do this if you have a"
 		echo "*** shared version of the library, which you do not appear to have"
 		echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
+		if test -z "$potlib"; then
 		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
 		else
 		  $ECHO "*** with $libname and none of the candidates passed a file format test"
@@ -7871,30 +9366,30 @@ EOF
 	    -l*)
 	      func_stripname -l '' "$a_deplib"
 	      name=$func_stripname_result
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      if test yes = "$allow_libtool_libs_with_static_runtimes"; then
 		case " $predeps $postdeps " in
 		*" $a_deplib "*)
 		  func_append newdeplibs " $a_deplib"
-		  a_deplib=""
+		  a_deplib=
 		  ;;
 		esac
 	      fi
-	      if test -n "$a_deplib" ; then
+	      if test -n "$a_deplib"; then
 		libname=`eval "\\$ECHO \"$libname_spec\""`
 		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
 		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
 		  for potent_lib in $potential_libs; do
-		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    potlib=$potent_lib # see symlink-check above in file_magic test
 		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
 		       $EGREP "$match_pattern_regex" > /dev/null; then
 		      func_append newdeplibs " $a_deplib"
-		      a_deplib=""
+		      a_deplib=
 		      break 2
 		    fi
 		  done
 		done
 	      fi
-	      if test -n "$a_deplib" ; then
+	      if test -n "$a_deplib"; then
 		droppeddeps=yes
 		echo
 		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
@@ -7902,7 +9397,7 @@ EOF
 		echo "*** you link to this library.  But I can only do this if you have a"
 		echo "*** shared version of the library, which you do not appear to have"
 		echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
+		if test -z "$potlib"; then
 		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
 		else
 		  $ECHO "*** with $libname and none of the candidates passed a file format test"
@@ -7918,18 +9413,18 @@ EOF
 	  done # Gone through all deplibs.
 	  ;;
 	none | unknown | *)
-	  newdeplibs=""
+	  newdeplibs=
 	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
-	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	    for i in $predeps $postdeps ; do
+	  if test yes = "$allow_libtool_libs_with_static_runtimes"; then
+	    for i in $predeps $postdeps; do
 	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"`
 	    done
 	  fi
 	  case $tmp_deplibs in
 	  *[!\	\ ]*)
 	    echo
-	    if test "X$deplibs_check_method" = "Xnone"; then
+	    if test none = "$deplibs_check_method"; then
 	      echo "*** Warning: inter-library dependencies are not supported in this platform."
 	    else
 	      echo "*** Warning: inter-library dependencies are not known to be supported."
@@ -7953,8 +9448,8 @@ EOF
 	  ;;
 	esac
 
-	if test "$droppeddeps" = yes; then
-	  if test "$module" = yes; then
+	if test yes = "$droppeddeps"; then
+	  if test yes = "$module"; then
 	    echo
 	    echo "*** Warning: libtool could not satisfy all declared inter-library"
 	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
@@ -7963,12 +9458,12 @@ EOF
 	    if test -z "$global_symbol_pipe"; then
 	      echo
 	      echo "*** However, this would only work if libtool was able to extract symbol"
-	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** lists from a program, using 'nm' or equivalent, but libtool could"
 	      echo "*** not find such a program.  So, this module is probably useless."
-	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      echo "*** 'nm' from GNU binutils and a full rebuild may help."
 	    fi
-	    if test "$build_old_libs" = no; then
-	      oldlibs="$output_objdir/$libname.$libext"
+	    if test no = "$build_old_libs"; then
+	      oldlibs=$output_objdir/$libname.$libext
 	      build_libtool_libs=module
 	      build_old_libs=yes
 	    else
@@ -7979,14 +9474,14 @@ EOF
 	    echo "*** automatically added whenever a program is linked with this library"
 	    echo "*** or is declared to -dlopen it."
 
-	    if test "$allow_undefined" = no; then
+	    if test no = "$allow_undefined"; then
 	      echo
 	      echo "*** Since this library must not contain undefined symbols,"
 	      echo "*** because either the platform does not support them or"
 	      echo "*** it was explicitly requested with -no-undefined,"
 	      echo "*** libtool will only create a static version of it."
-	      if test "$build_old_libs" = no; then
-		oldlibs="$output_objdir/$libname.$libext"
+	      if test no = "$build_old_libs"; then
+		oldlibs=$output_objdir/$libname.$libext
 		build_libtool_libs=module
 		build_old_libs=yes
 	      else
@@ -8032,7 +9527,7 @@ EOF
 	*) func_append new_libs " $deplib" ;;
 	esac
       done
-      deplibs="$new_libs"
+      deplibs=$new_libs
 
       # All the library-specific variables (install_libdir is set above).
       library_names=
@@ -8040,25 +9535,25 @@ EOF
       dlname=
 
       # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-	# Remove ${wl} instances when linking with ld.
+      if test yes = "$build_libtool_libs"; then
+	# Remove $wl instances when linking with ld.
 	# FIXME: should test the right _cmds variable.
 	case $archive_cmds in
 	  *\$LD\ *) wl= ;;
         esac
-	if test "$hardcode_into_libs" = yes; then
+	if test yes = "$hardcode_into_libs"; then
 	  # Hardcode the library paths
 	  hardcode_libdirs=
 	  dep_rpath=
-	  rpath="$finalize_rpath"
-	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+	  rpath=$finalize_rpath
+	  test relink = "$opt_mode" || rpath=$compile_rpath$rpath
 	  for libdir in $rpath; do
 	    if test -n "$hardcode_libdir_flag_spec"; then
 	      if test -n "$hardcode_libdir_separator"; then
 		func_replace_sysroot "$libdir"
 		libdir=$func_replace_sysroot_result
 		if test -z "$hardcode_libdirs"; then
-		  hardcode_libdirs="$libdir"
+		  hardcode_libdirs=$libdir
 		else
 		  # Just accumulate the unique libdirs.
 		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
@@ -8083,7 +9578,7 @@ EOF
 	  # Substitute the hardcoded libdirs into the rpath.
 	  if test -n "$hardcode_libdir_separator" &&
 	     test -n "$hardcode_libdirs"; then
-	    libdir="$hardcode_libdirs"
+	    libdir=$hardcode_libdirs
 	    eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
 	  fi
 	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
@@ -8097,8 +9592,8 @@ EOF
 	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
 	fi
 
-	shlibpath="$finalize_shlibpath"
-	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	shlibpath=$finalize_shlibpath
+	test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath
 	if test -n "$shlibpath"; then
 	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
 	fi
@@ -8108,19 +9603,19 @@ EOF
 	eval library_names=\"$library_names_spec\"
 	set dummy $library_names
 	shift
-	realname="$1"
+	realname=$1
 	shift
 
 	if test -n "$soname_spec"; then
 	  eval soname=\"$soname_spec\"
 	else
-	  soname="$realname"
+	  soname=$realname
 	fi
 	if test -z "$dlname"; then
 	  dlname=$soname
 	fi
 
-	lib="$output_objdir/$realname"
+	lib=$output_objdir/$realname
 	linknames=
 	for link
 	do
@@ -8134,7 +9629,7 @@ EOF
 	delfiles=
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
 	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
-	  export_symbols="$output_objdir/$libname.uexp"
+	  export_symbols=$output_objdir/$libname.uexp
 	  func_append delfiles " $export_symbols"
 	fi
 
@@ -8143,31 +9638,31 @@ EOF
 	cygwin* | mingw* | cegcc*)
 	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
 	    # exporting using user supplied symfile
-	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	    func_dll_def_p "$export_symbols" || {
 	      # and it's NOT already a .def file. Must figure out
 	      # which of the given symbols are data symbols and tag
 	      # them as such. So, trigger use of export_symbols_cmds.
 	      # export_symbols gets reassigned inside the "prepare
 	      # the list of exported symbols" if statement, so the
 	      # include_expsyms logic still works.
-	      orig_export_symbols="$export_symbols"
+	      orig_export_symbols=$export_symbols
 	      export_symbols=
 	      always_export_symbols=yes
-	    fi
+	    }
 	  fi
 	  ;;
 	esac
 
 	# Prepare the list of exported symbols
 	if test -z "$export_symbols"; then
-	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-	    func_verbose "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
+	  if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then
+	    func_verbose "generating symbol list for '$libname.la'"
+	    export_symbols=$output_objdir/$libname.exp
 	    $opt_dry_run || $RM $export_symbols
 	    cmds=$export_symbols_cmds
-	    save_ifs="$IFS"; IFS='~'
+	    save_ifs=$IFS; IFS='~'
 	    for cmd1 in $cmds; do
-	      IFS="$save_ifs"
+	      IFS=$save_ifs
 	      # Take the normal branch if the nm_file_list_spec branch
 	      # doesn't work or if tool conversion is not needed.
 	      case $nm_file_list_spec~$to_tool_file_cmd in
@@ -8181,7 +9676,7 @@ EOF
 		  try_normal_branch=no
 		  ;;
 	      esac
-	      if test "$try_normal_branch" = yes \
+	      if test yes = "$try_normal_branch" \
 		 && { test "$len" -lt "$max_cmd_len" \
 		      || test "$max_cmd_len" -le -1; }
 	      then
@@ -8192,7 +9687,7 @@ EOF
 		output_la=$func_basename_result
 		save_libobjs=$libobjs
 		save_output=$output
-		output=${output_objdir}/${output_la}.nm
+		output=$output_objdir/$output_la.nm
 		func_to_tool_file "$output"
 		libobjs=$nm_file_list_spec$func_to_tool_file_result
 		func_append delfiles " $output"
@@ -8215,8 +9710,8 @@ EOF
 		break
 	      fi
 	    done
-	    IFS="$save_ifs"
-	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+	    IFS=$save_ifs
+	    if test -n "$export_symbols_regex" && test : != "$skipped_export"; then
 	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
 	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
 	    fi
@@ -8224,16 +9719,16 @@ EOF
 	fi
 
 	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  tmp_export_symbols="$export_symbols"
-	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  tmp_export_symbols=$export_symbols
+	  test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
 	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	fi
 
-	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	if test : != "$skipped_export" && test -n "$orig_export_symbols"; then
 	  # The given exports_symbols file has to be filtered, so filter it.
-	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	  func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
 	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
-	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # 's' commands, which not all seds can handle. GNU sed should be fine
 	  # though. Also, the filter scales superlinearly with the number of
 	  # global variables. join(1) would be nice here, but unfortunately
 	  # isn't a blessed tool.
@@ -8252,11 +9747,11 @@ EOF
 	    ;;
 	  esac
 	done
-	deplibs="$tmp_deplibs"
+	deplibs=$tmp_deplibs
 
 	if test -n "$convenience"; then
 	  if test -n "$whole_archive_flag_spec" &&
-	    test "$compiler_needs_object" = yes &&
+	    test yes = "$compiler_needs_object" &&
 	    test -z "$libobjs"; then
 	    # extract the archives, so we have objects to list.
 	    # TODO: could optimize this to just extract one archive.
@@ -8267,7 +9762,7 @@ EOF
 	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
 	    test "X$libobjs" = "X " && libobjs=
 	  else
-	    gentop="$output_objdir/${outputname}x"
+	    gentop=$output_objdir/${outputname}x
 	    func_append generated " $gentop"
 
 	    func_extract_archives $gentop $convenience
@@ -8276,18 +9771,18 @@ EOF
 	  fi
 	fi
 
-	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then
 	  eval flag=\"$thread_safe_flag_spec\"
 	  func_append linker_flags " $flag"
 	fi
 
 	# Make a backup of the uninstalled library when relinking
-	if test "$opt_mode" = relink; then
+	if test relink = "$opt_mode"; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
 	fi
 
 	# Do each of the archive commands.
-	if test "$module" = yes && test -n "$module_cmds" ; then
+	if test yes = "$module" && test -n "$module_cmds"; then
 	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 	    eval test_cmds=\"$module_expsym_cmds\"
 	    cmds=$module_expsym_cmds
@@ -8305,7 +9800,7 @@ EOF
 	  fi
 	fi
 
-	if test "X$skipped_export" != "X:" &&
+	if test : != "$skipped_export" &&
 	   func_len " $test_cmds" &&
 	   len=$func_len_result &&
 	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
@@ -8338,8 +9833,8 @@ EOF
 	  last_robj=
 	  k=1
 
-	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
-	    output=${output_objdir}/${output_la}.lnkscript
+	  if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then
+	    output=$output_objdir/$output_la.lnkscript
 	    func_verbose "creating GNU ld script: $output"
 	    echo 'INPUT (' > $output
 	    for obj in $save_libobjs
@@ -8351,14 +9846,14 @@ EOF
 	    func_append delfiles " $output"
 	    func_to_tool_file "$output"
 	    output=$func_to_tool_file_result
-	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
-	    output=${output_objdir}/${output_la}.lnk
+	  elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then
+	    output=$output_objdir/$output_la.lnk
 	    func_verbose "creating linker input file list: $output"
 	    : > $output
 	    set x $save_libobjs
 	    shift
 	    firstobj=
-	    if test "$compiler_needs_object" = yes; then
+	    if test yes = "$compiler_needs_object"; then
 	      firstobj="$1 "
 	      shift
 	    fi
@@ -8373,7 +9868,7 @@ EOF
 	  else
 	    if test -n "$save_libobjs"; then
 	      func_verbose "creating reloadable object files..."
-	      output=$output_objdir/$output_la-${k}.$objext
+	      output=$output_objdir/$output_la-$k.$objext
 	      eval test_cmds=\"$reload_cmds\"
 	      func_len " $test_cmds"
 	      len0=$func_len_result
@@ -8385,13 +9880,13 @@ EOF
 		func_len " $obj"
 		func_arith $len + $func_len_result
 		len=$func_arith_result
-		if test "X$objlist" = X ||
+		if test -z "$objlist" ||
 		   test "$len" -lt "$max_cmd_len"; then
 		  func_append objlist " $obj"
 		else
 		  # The command $test_cmds is almost too long, add a
 		  # command to the queue.
-		  if test "$k" -eq 1 ; then
+		  if test 1 -eq "$k"; then
 		    # The first file doesn't have a previous command to add.
 		    reload_objs=$objlist
 		    eval concat_cmds=\"$reload_cmds\"
@@ -8401,10 +9896,10 @@ EOF
 		    reload_objs="$objlist $last_robj"
 		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
 		  fi
-		  last_robj=$output_objdir/$output_la-${k}.$objext
+		  last_robj=$output_objdir/$output_la-$k.$objext
 		  func_arith $k + 1
 		  k=$func_arith_result
-		  output=$output_objdir/$output_la-${k}.$objext
+		  output=$output_objdir/$output_la-$k.$objext
 		  objlist=" $obj"
 		  func_len " $last_robj"
 		  func_arith $len0 + $func_len_result
@@ -8416,9 +9911,9 @@ EOF
 	      # files will link in the last one created.
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
 	      reload_objs="$objlist $last_robj"
-	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+	      eval concat_cmds=\"\$concat_cmds$reload_cmds\"
 	      if test -n "$last_robj"; then
-	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+	        eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
 	      fi
 	      func_append delfiles " $output"
 
@@ -8426,9 +9921,9 @@ EOF
 	      output=
 	    fi
 
-	    if ${skipped_export-false}; then
-	      func_verbose "generating symbol list for \`$libname.la'"
-	      export_symbols="$output_objdir/$libname.exp"
+	    ${skipped_export-false} && {
+	      func_verbose "generating symbol list for '$libname.la'"
+	      export_symbols=$output_objdir/$libname.exp
 	      $opt_dry_run || $RM $export_symbols
 	      libobjs=$output
 	      # Append the command to create the export file.
@@ -8437,16 +9932,16 @@ EOF
 	      if test -n "$last_robj"; then
 		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
 	      fi
-	    fi
+	    }
 
 	    test -n "$save_libobjs" &&
 	      func_verbose "creating a temporary reloadable object file: $output"
 
 	    # Loop through the commands generated above and execute them.
-	    save_ifs="$IFS"; IFS='~'
+	    save_ifs=$IFS; IFS='~'
 	    for cmd in $concat_cmds; do
-	      IFS="$save_ifs"
-	      $opt_silent || {
+	      IFS=$save_ifs
+	      $opt_quiet || {
 		  func_quote_for_expand "$cmd"
 		  eval "func_echo $func_quote_for_expand_result"
 	      }
@@ -8454,7 +9949,7 @@ EOF
 		lt_exit=$?
 
 		# Restore the uninstalled library and exit
-		if test "$opt_mode" = relink; then
+		if test relink = "$opt_mode"; then
 		  ( cd "$output_objdir" && \
 		    $RM "${realname}T" && \
 		    $MV "${realname}U" "$realname" )
@@ -8463,7 +9958,7 @@ EOF
 		exit $lt_exit
 	      }
 	    done
-	    IFS="$save_ifs"
+	    IFS=$save_ifs
 
 	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
 	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
@@ -8471,18 +9966,18 @@ EOF
 	    fi
 	  fi
 
-          if ${skipped_export-false}; then
+          ${skipped_export-false} && {
 	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	      tmp_export_symbols="$export_symbols"
-	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	      tmp_export_symbols=$export_symbols
+	      test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols
 	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
 	    fi
 
 	    if test -n "$orig_export_symbols"; then
 	      # The given exports_symbols file has to be filtered, so filter it.
-	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	      func_verbose "filter symbol list for '$libname.la' to tag DATA exports"
 	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
-	      # 's' commands which not all seds can handle. GNU sed should be fine
+	      # 's' commands, which not all seds can handle. GNU sed should be fine
 	      # though. Also, the filter scales superlinearly with the number of
 	      # global variables. join(1) would be nice here, but unfortunately
 	      # isn't a blessed tool.
@@ -8491,7 +9986,7 @@ EOF
 	      export_symbols=$output_objdir/$libname.def
 	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
 	    fi
-	  fi
+	  }
 
 	  libobjs=$output
 	  # Restore the value of output.
@@ -8505,7 +10000,7 @@ EOF
 	  # value of $libobjs for piecewise linking.
 
 	  # Do each of the archive commands.
-	  if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test yes = "$module" && test -n "$module_cmds"; then
 	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
 	      cmds=$module_expsym_cmds
 	    else
@@ -8527,7 +10022,7 @@ EOF
 
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
-	  gentop="$output_objdir/${outputname}x"
+	  gentop=$output_objdir/${outputname}x
 	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
@@ -8535,11 +10030,12 @@ EOF
 	  test "X$libobjs" = "X " && libobjs=
 	fi
 
-	save_ifs="$IFS"; IFS='~'
+	save_ifs=$IFS; IFS='~'
 	for cmd in $cmds; do
-	  IFS="$save_ifs"
+	  IFS=$sp$nl
 	  eval cmd=\"$cmd\"
-	  $opt_silent || {
+	  IFS=$save_ifs
+	  $opt_quiet || {
 	    func_quote_for_expand "$cmd"
 	    eval "func_echo $func_quote_for_expand_result"
 	  }
@@ -8547,7 +10043,7 @@ EOF
 	    lt_exit=$?
 
 	    # Restore the uninstalled library and exit
-	    if test "$opt_mode" = relink; then
+	    if test relink = "$opt_mode"; then
 	      ( cd "$output_objdir" && \
 	        $RM "${realname}T" && \
 		$MV "${realname}U" "$realname" )
@@ -8556,10 +10052,10 @@ EOF
 	    exit $lt_exit
 	  }
 	done
-	IFS="$save_ifs"
+	IFS=$save_ifs
 
 	# Restore the uninstalled library and exit
-	if test "$opt_mode" = relink; then
+	if test relink = "$opt_mode"; then
 	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
 
 	  if test -n "$convenience"; then
@@ -8579,39 +10075,39 @@ EOF
 	done
 
 	# If -module or -export-dynamic was specified, set the dlname.
-	if test "$module" = yes || test "$export_dynamic" = yes; then
+	if test yes = "$module" || test yes = "$export_dynamic"; then
 	  # On all known operating systems, these are identical.
-	  dlname="$soname"
+	  dlname=$soname
 	fi
       fi
       ;;
 
     obj)
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	func_warning "\`-dlopen' is ignored for objects"
+      if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then
+	func_warning "'-dlopen' is ignored for objects"
       fi
 
       case " $deplibs" in
       *\ -l* | *\ -L*)
-	func_warning "\`-l' and \`-L' are ignored for objects" ;;
+	func_warning "'-l' and '-L' are ignored for objects" ;;
       esac
 
       test -n "$rpath" && \
-	func_warning "\`-rpath' is ignored for objects"
+	func_warning "'-rpath' is ignored for objects"
 
       test -n "$xrpath" && \
-	func_warning "\`-R' is ignored for objects"
+	func_warning "'-R' is ignored for objects"
 
       test -n "$vinfo" && \
-	func_warning "\`-version-info' is ignored for objects"
+	func_warning "'-version-info' is ignored for objects"
 
       test -n "$release" && \
-	func_warning "\`-release' is ignored for objects"
+	func_warning "'-release' is ignored for objects"
 
       case $output in
       *.lo)
 	test -n "$objs$old_deplibs" && \
-	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+	  func_fatal_error "cannot build library object '$output' from non-libtool objects"
 
 	libobj=$output
 	func_lo2o "$libobj"
@@ -8619,7 +10115,7 @@ EOF
 	;;
       *)
 	libobj=
-	obj="$output"
+	obj=$output
 	;;
       esac
 
@@ -8632,17 +10128,19 @@ EOF
       # the extraction.
       reload_conv_objs=
       gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec and hope we can get by with
-      # turning comma into space..
-      wl=
-
+      # if reload_cmds runs $LD directly, get rid of -Wl from
+      # whole_archive_flag_spec and hope we can get by with turning comma
+      # into space.
+      case $reload_cmds in
+        *\$LD[\ \$]*) wl= ;;
+      esac
       if test -n "$convenience"; then
 	if test -n "$whole_archive_flag_spec"; then
 	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	  test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	  reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags
 	else
-	  gentop="$output_objdir/${obj}x"
+	  gentop=$output_objdir/${obj}x
 	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $convenience
@@ -8651,12 +10149,12 @@ EOF
       fi
 
       # If we're not building shared, we need to use non_pic_objs
-      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+      test yes = "$build_libtool_libs" || libobjs=$non_pic_objects
 
       # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+      reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs
 
-      output="$obj"
+      output=$obj
       func_execute_cmds "$reload_cmds" 'exit $?'
 
       # Exit if we aren't doing a library object file.
@@ -8668,7 +10166,7 @@ EOF
 	exit $EXIT_SUCCESS
       fi
 
-      if test "$build_libtool_libs" != yes; then
+      test yes = "$build_libtool_libs" || {
 	if test -n "$gentop"; then
 	  func_show_eval '${RM}r "$gentop"'
 	fi
@@ -8678,12 +10176,12 @@ EOF
 	# $show "echo timestamp > $libobj"
 	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
 	exit $EXIT_SUCCESS
-      fi
+      }
 
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
+      if test -n "$pic_flag" || test default != "$pic_mode"; then
 	# Only do commands if we really have different PIC objects.
 	reload_objs="$libobjs $reload_conv_objs"
-	output="$libobj"
+	output=$libobj
 	func_execute_cmds "$reload_cmds" 'exit $?'
       fi
 
@@ -8700,16 +10198,14 @@ EOF
 	          output=$func_stripname_result.exe;;
       esac
       test -n "$vinfo" && \
-	func_warning "\`-version-info' is ignored for programs"
+	func_warning "'-version-info' is ignored for programs"
 
       test -n "$release" && \
-	func_warning "\`-release' is ignored for programs"
+	func_warning "'-release' is ignored for programs"
 
-      test "$preload" = yes \
-        && test "$dlopen_support" = unknown \
-	&& test "$dlopen_self" = unknown \
-	&& test "$dlopen_self_static" = unknown && \
-	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+      $preload \
+	&& test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \
+	&& func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support."
 
       case $host in
       *-*-rhapsody* | *-*-darwin1.[012])
@@ -8723,11 +10219,11 @@ EOF
       *-*-darwin*)
 	# Don't allow lazy linking, it breaks C++ global constructors
 	# But is supposedly fixed on 10.4 or later (yay!).
-	if test "$tagname" = CXX ; then
+	if test CXX = "$tagname"; then
 	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
 	    10.[0123])
-	      func_append compile_command " ${wl}-bind_at_load"
-	      func_append finalize_command " ${wl}-bind_at_load"
+	      func_append compile_command " $wl-bind_at_load"
+	      func_append finalize_command " $wl-bind_at_load"
 	    ;;
 	  esac
 	fi
@@ -8763,7 +10259,7 @@ EOF
 	*) func_append new_libs " $deplib" ;;
 	esac
       done
-      compile_deplibs="$new_libs"
+      compile_deplibs=$new_libs
 
 
       func_append compile_command " $compile_deplibs"
@@ -8787,7 +10283,7 @@ EOF
 	if test -n "$hardcode_libdir_flag_spec"; then
 	  if test -n "$hardcode_libdir_separator"; then
 	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
+	      hardcode_libdirs=$libdir
 	    else
 	      # Just accumulate the unique libdirs.
 	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
@@ -8810,7 +10306,7 @@ EOF
 	fi
 	case $host in
 	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
-	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'`
 	  case :$dllsearchpath: in
 	  *":$libdir:"*) ;;
 	  ::) dllsearchpath=$libdir;;
@@ -8827,10 +10323,10 @@ EOF
       # Substitute the hardcoded libdirs into the rpath.
       if test -n "$hardcode_libdir_separator" &&
 	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
+	libdir=$hardcode_libdirs
 	eval rpath=\" $hardcode_libdir_flag_spec\"
       fi
-      compile_rpath="$rpath"
+      compile_rpath=$rpath
 
       rpath=
       hardcode_libdirs=
@@ -8838,7 +10334,7 @@ EOF
 	if test -n "$hardcode_libdir_flag_spec"; then
 	  if test -n "$hardcode_libdir_separator"; then
 	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
+	      hardcode_libdirs=$libdir
 	    else
 	      # Just accumulate the unique libdirs.
 	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
@@ -8863,45 +10359,43 @@ EOF
       # Substitute the hardcoded libdirs into the rpath.
       if test -n "$hardcode_libdir_separator" &&
 	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
+	libdir=$hardcode_libdirs
 	eval rpath=\" $hardcode_libdir_flag_spec\"
       fi
-      finalize_rpath="$rpath"
+      finalize_rpath=$rpath
 
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+      if test -n "$libobjs" && test yes = "$build_old_libs"; then
 	# Transform all the library objects into standard objects.
 	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
 	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
       fi
 
-      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+      func_generate_dlsyms "$outputname" "@PROGRAM@" false
 
       # template prelinking step
       if test -n "$prelink_cmds"; then
 	func_execute_cmds "$prelink_cmds" 'exit $?'
       fi
 
-      wrappers_required=yes
+      wrappers_required=:
       case $host in
       *cegcc* | *mingw32ce*)
         # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
-        wrappers_required=no
+        wrappers_required=false
         ;;
       *cygwin* | *mingw* )
-        if test "$build_libtool_libs" != yes; then
-          wrappers_required=no
-        fi
+        test yes = "$build_libtool_libs" || wrappers_required=false
         ;;
       *)
-        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-          wrappers_required=no
+        if test no = "$need_relink" || test yes != "$build_libtool_libs"; then
+          wrappers_required=false
         fi
         ;;
       esac
-      if test "$wrappers_required" = no; then
+      $wrappers_required || {
 	# Replace the output file specification.
 	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
-	link_command="$compile_command$compile_rpath"
+	link_command=$compile_command$compile_rpath
 
 	# We have no uninstalled library dependencies, so finalize right now.
 	exit_status=0
@@ -8914,12 +10408,12 @@ EOF
 	fi
 
 	# Delete the generated files.
-	if test -f "$output_objdir/${outputname}S.${objext}"; then
-	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	if test -f "$output_objdir/${outputname}S.$objext"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.$objext"'
 	fi
 
 	exit $exit_status
-      fi
+      }
 
       if test -n "$compile_shlibpath$finalize_shlibpath"; then
 	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
@@ -8949,9 +10443,9 @@ EOF
 	fi
       fi
 
-      if test "$no_install" = yes; then
+      if test yes = "$no_install"; then
 	# We don't need to create a wrapper script.
-	link_command="$compile_var$compile_command$compile_rpath"
+	link_command=$compile_var$compile_command$compile_rpath
 	# Replace the output file specification.
 	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
 	# Delete the old output file.
@@ -8968,27 +10462,28 @@ EOF
 	exit $EXIT_SUCCESS
       fi
 
-      if test "$hardcode_action" = relink; then
-	# Fast installation is not supported
-	link_command="$compile_var$compile_command$compile_rpath"
-	relink_command="$finalize_var$finalize_command$finalize_rpath"
+      case $hardcode_action,$fast_install in
+        relink,*)
+	  # Fast installation is not supported
+	  link_command=$compile_var$compile_command$compile_rpath
+	  relink_command=$finalize_var$finalize_command$finalize_rpath
 
-	func_warning "this platform does not like uninstalled shared libraries"
-	func_warning "\`$output' will be relinked during installation"
-      else
-	if test "$fast_install" != no; then
-	  link_command="$finalize_var$compile_command$finalize_rpath"
-	  if test "$fast_install" = yes; then
-	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
-	  else
-	    # fast_install is set to needless
-	    relink_command=
-	  fi
-	else
-	  link_command="$compile_var$compile_command$compile_rpath"
-	  relink_command="$finalize_var$finalize_command$finalize_rpath"
-	fi
-      fi
+	  func_warning "this platform does not like uninstalled shared libraries"
+	  func_warning "'$output' will be relinked during installation"
+	  ;;
+        *,yes)
+	  link_command=$finalize_var$compile_command$finalize_rpath
+	  relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+          ;;
+	*,no)
+	  link_command=$compile_var$compile_command$compile_rpath
+	  relink_command=$finalize_var$finalize_command$finalize_rpath
+          ;;
+	*,needless)
+	  link_command=$finalize_var$compile_command$finalize_rpath
+	  relink_command=
+          ;;
+      esac
 
       # Replace the output file specification.
       link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
@@ -9045,8 +10540,8 @@ EOF
 	    func_dirname_and_basename "$output" "" "."
 	    output_name=$func_basename_result
 	    output_path=$func_dirname_result
-	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
-	    cwrapper="$output_path/$output_name.exe"
+	    cwrappersource=$output_path/$objdir/lt-$output_name.c
+	    cwrapper=$output_path/$output_name.exe
 	    $RM $cwrappersource $cwrapper
 	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
 
@@ -9067,7 +10562,7 @@ EOF
 	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
 	    $opt_dry_run || {
 	      # note: this script will not be executed, so do not chmod.
-	      if test "x$build" = "x$host" ; then
+	      if test "x$build" = "x$host"; then
 		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
 	      else
 		func_emit_wrapper no > $func_ltwrapper_scriptname_result
@@ -9090,25 +10585,27 @@ EOF
     # See if we need to build an old-fashioned archive.
     for oldlib in $oldlibs; do
 
-      if test "$build_libtool_libs" = convenience; then
-	oldobjs="$libobjs_save $symfileobj"
-	addlibs="$convenience"
-	build_libtool_libs=no
-      else
-	if test "$build_libtool_libs" = module; then
-	  oldobjs="$libobjs_save"
+      case $build_libtool_libs in
+        convenience)
+	  oldobjs="$libobjs_save $symfileobj"
+	  addlibs=$convenience
 	  build_libtool_libs=no
-	else
+	  ;;
+	module)
+	  oldobjs=$libobjs_save
+	  addlibs=$old_convenience
+	  build_libtool_libs=no
+          ;;
+	*)
 	  oldobjs="$old_deplibs $non_pic_objects"
-	  if test "$preload" = yes && test -f "$symfileobj"; then
-	    func_append oldobjs " $symfileobj"
-	  fi
-	fi
-	addlibs="$old_convenience"
-      fi
+	  $preload && test -f "$symfileobj" \
+	    && func_append oldobjs " $symfileobj"
+	  addlibs=$old_convenience
+	  ;;
+      esac
 
       if test -n "$addlibs"; then
-	gentop="$output_objdir/${outputname}x"
+	gentop=$output_objdir/${outputname}x
 	func_append generated " $gentop"
 
 	func_extract_archives $gentop $addlibs
@@ -9116,13 +10613,13 @@ EOF
       fi
 
       # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+      if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then
 	cmds=$old_archive_from_new_cmds
       else
 
 	# Add any objects from preloaded convenience libraries
 	if test -n "$dlprefiles"; then
-	  gentop="$output_objdir/${outputname}x"
+	  gentop=$output_objdir/${outputname}x
 	  func_append generated " $gentop"
 
 	  func_extract_archives $gentop $dlprefiles
@@ -9143,7 +10640,7 @@ EOF
 	  :
 	else
 	  echo "copying selected object files to avoid basename conflicts..."
-	  gentop="$output_objdir/${outputname}x"
+	  gentop=$output_objdir/${outputname}x
 	  func_append generated " $gentop"
 	  func_mkdir_p "$gentop"
 	  save_oldobjs=$oldobjs
@@ -9152,7 +10649,7 @@ EOF
 	  for obj in $save_oldobjs
 	  do
 	    func_basename "$obj"
-	    objbase="$func_basename_result"
+	    objbase=$func_basename_result
 	    case " $oldobjs " in
 	    " ") oldobjs=$obj ;;
 	    *[\ /]"$objbase "*)
@@ -9221,18 +10718,18 @@ EOF
 	    else
 	      # the above command should be used before it gets too long
 	      oldobjs=$objlist
-	      if test "$obj" = "$last_oldobj" ; then
+	      if test "$obj" = "$last_oldobj"; then
 		RANLIB=$save_RANLIB
 	      fi
 	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      eval concat_cmds=\"\$concat_cmds$old_archive_cmds\"
 	      objlist=
 	      len=$len0
 	    fi
 	  done
 	  RANLIB=$save_RANLIB
 	  oldobjs=$objlist
-	  if test "X$oldobjs" = "X" ; then
+	  if test -z "$oldobjs"; then
 	    eval cmds=\"\$concat_cmds\"
 	  else
 	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
@@ -9249,7 +10746,7 @@ EOF
     case $output in
     *.la)
       old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      test yes = "$build_old_libs" && old_library=$libname.$libext
       func_verbose "creating $output"
 
       # Preserve any variables that may affect compiler behavior
@@ -9264,31 +10761,31 @@ EOF
 	fi
       done
       # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
       relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
-      if test "$hardcode_automatic" = yes ; then
+      if test yes = "$hardcode_automatic"; then
 	relink_command=
       fi
 
       # Only create the output if not a dry run.
       $opt_dry_run || {
 	for installed in no yes; do
-	  if test "$installed" = yes; then
+	  if test yes = "$installed"; then
 	    if test -z "$install_libdir"; then
 	      break
 	    fi
-	    output="$output_objdir/$outputname"i
+	    output=$output_objdir/${outputname}i
 	    # Replace all uninstalled libtool libraries with the installed ones
 	    newdependency_libs=
 	    for deplib in $dependency_libs; do
 	      case $deplib in
 	      *.la)
 		func_basename "$deplib"
-		name="$func_basename_result"
+		name=$func_basename_result
 		func_resolve_sysroot "$deplib"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
+		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
 		test -z "$libdir" && \
-		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  func_fatal_error "'$deplib' is not a valid libtool archive"
 		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
 		;;
 	      -L*)
@@ -9304,23 +10801,23 @@ EOF
 	      *) func_append newdependency_libs " $deplib" ;;
 	      esac
 	    done
-	    dependency_libs="$newdependency_libs"
+	    dependency_libs=$newdependency_libs
 	    newdlfiles=
 
 	    for lib in $dlfiles; do
 	      case $lib in
 	      *.la)
 	        func_basename "$lib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		name=$func_basename_result
+		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
-		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		  func_fatal_error "'$lib' is not a valid libtool archive"
 		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
 	      *) func_append newdlfiles " $lib" ;;
 	      esac
 	    done
-	    dlfiles="$newdlfiles"
+	    dlfiles=$newdlfiles
 	    newdlprefiles=
 	    for lib in $dlprefiles; do
 	      case $lib in
@@ -9330,34 +10827,34 @@ EOF
 		# didn't already link the preopened objects directly into
 		# the library:
 		func_basename "$lib"
-		name="$func_basename_result"
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		name=$func_basename_result
+		eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
 		test -z "$libdir" && \
-		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		  func_fatal_error "'$lib' is not a valid libtool archive"
 		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
 		;;
 	      esac
 	    done
-	    dlprefiles="$newdlprefiles"
+	    dlprefiles=$newdlprefiles
 	  else
 	    newdlfiles=
 	    for lib in $dlfiles; do
 	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
 	      func_append newdlfiles " $abs"
 	    done
-	    dlfiles="$newdlfiles"
+	    dlfiles=$newdlfiles
 	    newdlprefiles=
 	    for lib in $dlprefiles; do
 	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		[\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;;
 		*) abs=`pwd`"/$lib" ;;
 	      esac
 	      func_append newdlprefiles " $abs"
 	    done
-	    dlprefiles="$newdlprefiles"
+	    dlprefiles=$newdlprefiles
 	  fi
 	  $RM $output
 	  # place dlname in correct position for cygwin
@@ -9373,10 +10870,9 @@ EOF
 	  case $host,$output,$installed,$module,$dlname in
 	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
 	      # If a -bindir argument was supplied, place the dll there.
-	      if test "x$bindir" != x ;
-	      then
+	      if test -n "$bindir"; then
 		func_relative_path "$install_libdir" "$bindir"
-		tdlname=$func_relative_path_result$dlname
+		tdlname=$func_relative_path_result/$dlname
 	      else
 		# Otherwise fall back on heuristic.
 		tdlname=../bin/$dlname
@@ -9385,7 +10881,7 @@ EOF
 	  esac
 	  $ECHO > $output "\
 # $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
 #
 # Please DO NOT delete this file!
 # It is necessary for linking the library.
@@ -9399,7 +10895,7 @@ library_names='$library_names'
 # The name of the static archive.
 old_library='$old_library'
 
-# Linker flags that can not go in dependency_libs.
+# Linker flags that cannot go in dependency_libs.
 inherited_linker_flags='$new_inherited_linker_flags'
 
 # Libraries that this one depends upon.
@@ -9425,7 +10921,7 @@ dlpreopen='$dlprefiles'
 
 # Directory that this library needs to be installed in:
 libdir='$install_libdir'"
-	  if test "$installed" = no && test "$need_relink" = yes; then
+	  if test no,yes = "$installed,$need_relink"; then
 	    $ECHO >> $output "\
 relink_command=\"$relink_command\""
 	  fi
@@ -9440,27 +10936,29 @@ relink_command=\"$relink_command\""
     exit $EXIT_SUCCESS
 }
 
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
-    func_mode_link ${1+"$@"}
+if test link = "$opt_mode" || test relink = "$opt_mode"; then
+  func_mode_link ${1+"$@"}
+fi
 
 
 # func_mode_uninstall arg...
 func_mode_uninstall ()
 {
-    $opt_debug
-    RM="$nonopt"
+    $debug_cmd
+
+    RM=$nonopt
     files=
-    rmforce=
+    rmforce=false
     exit_status=0
 
     # This variable tells wrapper scripts just to set variables rather
     # than running their programs.
-    libtool_install_magic="$magic"
+    libtool_install_magic=$magic
 
     for arg
     do
       case $arg in
-      -f) func_append RM " $arg"; rmforce=yes ;;
+      -f) func_append RM " $arg"; rmforce=: ;;
       -*) func_append RM " $arg" ;;
       *) func_append files " $arg" ;;
       esac
@@ -9473,18 +10971,18 @@ func_mode_uninstall ()
 
     for file in $files; do
       func_dirname "$file" "" "."
-      dir="$func_dirname_result"
-      if test "X$dir" = X.; then
-	odir="$objdir"
+      dir=$func_dirname_result
+      if test . = "$dir"; then
+	odir=$objdir
       else
-	odir="$dir/$objdir"
+	odir=$dir/$objdir
       fi
       func_basename "$file"
-      name="$func_basename_result"
-      test "$opt_mode" = uninstall && odir="$dir"
+      name=$func_basename_result
+      test uninstall = "$opt_mode" && odir=$dir
 
       # Remember odir for removal later, being careful to avoid duplicates
-      if test "$opt_mode" = clean; then
+      if test clean = "$opt_mode"; then
 	case " $rmdirs " in
 	  *" $odir "*) ;;
 	  *) func_append rmdirs " $odir" ;;
@@ -9499,11 +10997,11 @@ func_mode_uninstall ()
       elif test -d "$file"; then
 	exit_status=1
 	continue
-      elif test "$rmforce" = yes; then
+      elif $rmforce; then
 	continue
       fi
 
-      rmfiles="$file"
+      rmfiles=$file
 
       case $name in
       *.la)
@@ -9517,7 +11015,7 @@ func_mode_uninstall ()
 	  done
 	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
 
-	  case "$opt_mode" in
+	  case $opt_mode in
 	  clean)
 	    case " $library_names " in
 	    *" $dlname "*) ;;
@@ -9528,12 +11026,12 @@ func_mode_uninstall ()
 	  uninstall)
 	    if test -n "$library_names"; then
 	      # Do each command in the postuninstall commands.
-	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	      func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1'
 	    fi
 
 	    if test -n "$old_library"; then
 	      # Do each command in the old_postuninstall commands.
-	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	      func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1'
 	    fi
 	    # FIXME: should reinstall the best remaining shared library.
 	    ;;
@@ -9549,21 +11047,19 @@ func_mode_uninstall ()
 	  func_source $dir/$name
 
 	  # Add PIC object to the list of files to remove.
-	  if test -n "$pic_object" &&
-	     test "$pic_object" != none; then
+	  if test -n "$pic_object" && test none != "$pic_object"; then
 	    func_append rmfiles " $dir/$pic_object"
 	  fi
 
 	  # Add non-PIC object to the list of files to remove.
-	  if test -n "$non_pic_object" &&
-	     test "$non_pic_object" != none; then
+	  if test -n "$non_pic_object" && test none != "$non_pic_object"; then
 	    func_append rmfiles " $dir/$non_pic_object"
 	  fi
 	fi
 	;;
 
       *)
-	if test "$opt_mode" = clean ; then
+	if test clean = "$opt_mode"; then
 	  noexename=$name
 	  case $file in
 	  *.exe)
@@ -9590,12 +11086,12 @@ func_mode_uninstall ()
 
 	    # note $name still contains .exe if it was in $file originally
 	    # as does the version of $file that was added into $rmfiles
-	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
-	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	    func_append rmfiles " $odir/$name $odir/${name}S.$objext"
+	    if test yes = "$fast_install" && test -n "$relink_command"; then
 	      func_append rmfiles " $odir/lt-$name"
 	    fi
-	    if test "X$noexename" != "X$name" ; then
-	      func_append rmfiles " $odir/lt-${noexename}.c"
+	    if test "X$noexename" != "X$name"; then
+	      func_append rmfiles " $odir/lt-$noexename.c"
 	    fi
 	  fi
 	fi
@@ -9604,7 +11100,7 @@ func_mode_uninstall ()
       func_show_eval "$RM $rmfiles" 'exit_status=1'
     done
 
-    # Try to remove the ${objdir}s in the directories where we deleted files
+    # Try to remove the $objdir's in the directories where we deleted files
     for dir in $rmdirs; do
       if test -d "$dir"; then
 	func_show_eval "rmdir $dir >/dev/null 2>&1"
@@ -9614,16 +11110,17 @@ func_mode_uninstall ()
     exit $exit_status
 }
 
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
-    func_mode_uninstall ${1+"$@"}
+if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then
+  func_mode_uninstall ${1+"$@"}
+fi
 
 test -z "$opt_mode" && {
-  help="$generic_help"
+  help=$generic_help
   func_fatal_help "you must specify a MODE"
 }
 
 test -z "$exec_cmd" && \
-  func_fatal_help "invalid operation mode \`$opt_mode'"
+  func_fatal_help "invalid operation mode '$opt_mode'"
 
 if test -n "$exec_cmd"; then
   eval exec "$exec_cmd"
@@ -9634,7 +11131,7 @@ exit $exit_status
 
 
 # The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
+# where we disable both kinds of libraries.  Given conflicting
 # choices, we go for a static library, that is the most portable,
 # since we can't tell whether shared libraries were disabled because
 # the user asked for that or because the platform doesn't support
@@ -9657,5 +11154,3 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
 # mode:shell-script
 # sh-indentation:2
 # End:
-# vi:sw=2
-
diff --git a/config.h.in b/config.h.in
index e5bdb83..18db351 100644
--- a/config.h.in
+++ b/config.h.in
@@ -102,8 +102,7 @@
 /* "" */
 #undef JDK_HOME
 
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
-   */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
 #undef LT_OBJDIR
 
 /* Name of package */
diff --git a/configure b/configure
index bd97ffd..bdfe138 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libbluray 0.9.2.
+# Generated by GNU Autoconf 2.69 for libbluray 0.9.3.
 #
 # Report bugs to <http://www.videolan.org/developers/libbluray.html>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libbluray'
 PACKAGE_TARNAME='libbluray'
-PACKAGE_VERSION='0.9.2'
-PACKAGE_STRING='libbluray 0.9.2'
+PACKAGE_VERSION='0.9.3'
+PACKAGE_STRING='libbluray 0.9.3'
 PACKAGE_BUGREPORT='http://www.videolan.org/developers/libbluray.html'
 PACKAGE_URL=''
 
@@ -691,6 +691,8 @@ ENABLE_UDF_TRUE
 UDF_CFLAGS
 BDJ_BOOTCLASSPATH
 BDJ_TYPE
+USING_BDJAVA_BUILD_JAR_FALSE
+USING_BDJAVA_BUILD_JAR_TRUE
 USING_BDJAVA_FALSE
 USING_BDJAVA_TRUE
 HAVE_ANT
@@ -707,6 +709,7 @@ PKG_CONFIG_PATH
 PKG_CONFIG
 DLOPEN_LIBS
 CPP
+LT_SYS_LIBRARY_PATH
 OTOOL64
 OTOOL
 LIPO
@@ -804,6 +807,7 @@ infodir
 docdir
 oldincludedir
 includedir
+runstatedir
 localstatedir
 sharedstatedir
 sysconfdir
@@ -833,6 +837,7 @@ enable_optimizations
 enable_examples
 enable_bdjava
 enable_udf
+enable_bdjava_jar
 with_libxml2
 with_freetype
 with_fontconfig
@@ -843,6 +848,7 @@ enable_shared
 enable_static
 with_pic
 enable_fast_install
+with_aix_soname
 with_gnu_ld
 with_sysroot
 enable_libtool_lock
@@ -867,6 +873,7 @@ CFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
+LT_SYS_LIBRARY_PATH
 CPP
 PKG_CONFIG
 PKG_CONFIG_PATH
@@ -916,6 +923,7 @@ datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1168,6 +1176,15 @@ do
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -runstatedir | --runstatedir | --runstatedi | --runstated \
+  | --runstate | --runstat | --runsta | --runst | --runs \
+  | --run | --ru | --r)
+    ac_prev=runstatedir ;;
+  -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+  | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+  | --run=* | --ru=* | --r=*)
+    runstatedir=$ac_optarg ;;
+
   -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1305,7 +1322,7 @@ fi
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-		libdir localedir mandir
+		libdir localedir mandir runstatedir
 do
   eval ac_val=\$$ac_var
   # Remove trailing slashes.
@@ -1418,7 +1435,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libbluray 0.9.2 to adapt to many kinds of systems.
+\`configure' configures libbluray 0.9.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1458,6 +1475,7 @@ Fine tuning of the installation directories:
   --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --runstatedir=DIR       modifiable per-process data [LOCALSTATEDIR/run]
   --libdir=DIR            object code libraries [EPREFIX/lib]
   --includedir=DIR        C header files [PREFIX/include]
   --oldincludedir=DIR     C header files for non-gcc [/usr/include]
@@ -1488,7 +1506,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libbluray 0.9.2:";;
+     short | recursive ) echo "Configuration of libbluray 0.9.3:";;
    esac
   cat <<\_ACEOF
 
@@ -1505,7 +1523,9 @@ Optional Features:
   --disable-optimizations disable optimizations [default=enabled]
   --enable-examples       build examples (default is yes)
   --disable-bdjava        disable BD-Java support [default=enabled]
-  --enable-udf            enable UDF support [default=disabled]
+  --disable-udf           disable UDF support [default=enabled]
+  --disable-bdjava-jar    disable building of BD-Java JAR file
+                          [default=enabled]
   --enable-dependency-tracking
                           do not reject slow dependency extractors
   --disable-dependency-tracking
@@ -1542,9 +1562,12 @@ Optional Packages:
                           Default is empty.
   --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
+  --with-aix-soname=aix|svr4|both
+                          shared library versioning (aka "SONAME") variant to
+                          provide on AIX, [default=aix].
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
-  --with-sysroot=DIR Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).
+  --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
+                          compiler's sysroot if not specified).
 
 Some influential environment variables:
   JDK_HOME    Path to the JDK
@@ -1555,6 +1578,8 @@ Some influential environment variables:
   LIBS        libraries to pass to the linker, e.g. -l<library>
   CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
+  LT_SYS_LIBRARY_PATH
+              User-defined run-time library search path.
   CPP         C preprocessor
   PKG_CONFIG  path to pkg-config utility
   PKG_CONFIG_PATH
@@ -1640,7 +1665,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libbluray configure 0.9.2
+libbluray configure 0.9.3
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2066,7 +2091,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libbluray $as_me 0.9.2, which was
+It was created by libbluray $as_me 0.9.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3001,7 +3026,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libbluray'
- VERSION='0.9.2'
+ VERSION='0.9.3'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3344,7 +3369,17 @@ fi
 
 # Check whether --enable-udf was given.
 if test "${enable_udf+set}" = set; then :
-  enableval=$enable_udf;
+  enableval=$enable_udf; enable_udf=$enableval
+else
+  enable_udf=yes
+fi
+
+
+# Check whether --enable-bdjava-jar was given.
+if test "${enable_bdjava_jar+set}" = set; then :
+  enableval=$enable_bdjava_jar; use_bdjava_jar=$enableval
+else
+  use_bdjava_jar=yes
 fi
 
 
@@ -4435,8 +4470,8 @@ esac
 
 
 
-macro_version='2.4.2'
-macro_revision='1.3337'
+macro_version='2.4.6'
+macro_revision='2.4.6'
 
 
 
@@ -4450,7 +4485,7 @@ macro_revision='1.3337'
 
 
 
-ltmain="$ac_aux_dir/ltmain.sh"
+ltmain=$ac_aux_dir/ltmain.sh
 
 # Backslashify metacharacters that are still active within
 # double-quoted strings.
@@ -4499,7 +4534,7 @@ func_echo_all ()
     $ECHO ""
 }
 
-case "$ECHO" in
+case $ECHO in
   printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
 $as_echo "printf" >&6; } ;;
   print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
@@ -4822,19 +4857,19 @@ test -z "$GREP" && GREP=grep
 
 # Check whether --with-gnu-ld was given.
 if test "${with_gnu_ld+set}" = set; then :
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+  withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes
 else
   with_gnu_ld=no
 fi
 
 ac_prog=ld
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   # Check if gcc -print-prog-name=ld gives a path.
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
 $as_echo_n "checking for ld used by $CC... " >&6; }
   case $host in
   *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
+    # gcc leaves a trailing carriage return, which upsets mingw
     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
   *)
     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
@@ -4848,7 +4883,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
       while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
 	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
       done
-      test -z "$LD" && LD="$ac_prog"
+      test -z "$LD" && LD=$ac_prog
       ;;
   "")
     # If it fails, then pretend we aren't using GCC.
@@ -4859,7 +4894,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
     with_gnu_ld=unknown
     ;;
   esac
-elif test "$with_gnu_ld" = yes; then
+elif test yes = "$with_gnu_ld"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
 $as_echo_n "checking for GNU ld... " >&6; }
 else
@@ -4870,32 +4905,32 @@ if ${lt_cv_path_LD+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
+      lt_cv_path_LD=$ac_dir/$ac_prog
       # Check to see if the program is GNU ld.  I'd rather use --version,
       # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
+	test no != "$with_gnu_ld" && break
 	;;
       *)
-	test "$with_gnu_ld" != yes && break
+	test yes != "$with_gnu_ld" && break
 	;;
       esac
     fi
   done
-  IFS="$lt_save_ifs"
+  IFS=$lt_save_ifs
 else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
 fi
 fi
 
-LD="$lt_cv_path_LD"
+LD=$lt_cv_path_LD
 if test -n "$LD"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
 $as_echo "$LD" >&6; }
@@ -4938,33 +4973,38 @@ if ${lt_cv_path_NM+:} false; then :
 else
   if test -n "$NM"; then
   # Let the user override the test.
-  lt_cv_path_NM="$NM"
+  lt_cv_path_NM=$NM
 else
-  lt_nm_to_check="${ac_tool_prefix}nm"
+  lt_nm_to_check=${ac_tool_prefix}nm
   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
     for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      tmp_nm=$ac_dir/$lt_tmp_nm
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
 	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	# Adding the 'sed 1q' prevents false positives on HP-UX, which says:
 	#   nm: unknown option "B" ignored
 	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
+	# MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
+	case $build_os in
+	mingw*) lt_bad_file=conftest.nm/nofile ;;
+	*) lt_bad_file=/dev/null ;;
+	esac
+	case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
+	*$lt_bad_file* | *'Invalid file or object type'*)
 	  lt_cv_path_NM="$tmp_nm -B"
-	  break
+	  break 2
 	  ;;
 	*)
 	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
 	  */dev/null*)
 	    lt_cv_path_NM="$tmp_nm -p"
-	    break
+	    break 2
 	    ;;
 	  *)
 	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
@@ -4975,15 +5015,15 @@ else
 	esac
       fi
     done
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
   done
   : ${lt_cv_path_NM=no}
 fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
 $as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
+if test no != "$lt_cv_path_NM"; then
+  NM=$lt_cv_path_NM
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
   if test -n "$DUMPBIN"; then :
@@ -5089,9 +5129,9 @@ esac
   fi
 fi
 
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
     *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
+      DUMPBIN="$DUMPBIN -symbols -headers"
       ;;
     *)
       DUMPBIN=:
@@ -5099,8 +5139,8 @@ fi
     esac
   fi
 
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
+  if test : != "$DUMPBIN"; then
+    NM=$DUMPBIN
   fi
 fi
 test -z "$NM" && NM=nm
@@ -5151,7 +5191,7 @@ if ${lt_cv_sys_max_cmd_len+:} false; then :
   $as_echo_n "(cached) " >&6
 else
     i=0
-  teststring="ABCD"
+  teststring=ABCD
 
   case $build_os in
   msdosdjgpp*)
@@ -5191,7 +5231,7 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+  bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
     # This has been around since 386BSD, at least.  Likely further.
     if test -x /sbin/sysctl; then
       lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -5242,22 +5282,22 @@ else
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
     if test -n "$lt_cv_sys_max_cmd_len" && \
-	test undefined != "$lt_cv_sys_max_cmd_len"; then
+       test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
       # Make teststring a little bigger before we do anything with it.
       # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
+      for i in 1 2 3 4 5 6 7 8; do
         teststring=$teststring$teststring
       done
       SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+      while { test X`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
+	      test 17 != "$i" # 1/2 MB should be enough
       do
         i=`expr $i + 1`
         teststring=$teststring$teststring
@@ -5275,7 +5315,7 @@ else
 
 fi
 
-if test -n $lt_cv_sys_max_cmd_len ; then
+if test -n "$lt_cv_sys_max_cmd_len"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
 $as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
@@ -5293,30 +5333,6 @@ max_cmd_len=$lt_cv_sys_max_cmd_len
 : ${MV="mv -f"}
 : ${RM="rm -f"}
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
-$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
-$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
-$as_echo "$lt_shell_append" >&6; }
-
-
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   lt_unset=unset
 else
@@ -5439,13 +5455,13 @@ esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
   cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       reload_cmds=false
     fi
     ;;
   darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    if test yes = "$GCC"; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
     else
       reload_cmds='$LD$reload_flag -o $output$reload_objs'
     fi
@@ -5573,13 +5589,13 @@ lt_cv_deplibs_check_method='unknown'
 # Need to set the preceding variable on all platforms that support
 # interlibrary dependencies.
 # 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
+# 'unknown' -- same as none, but documents that we really don't know.
 # 'pass_all' -- all dependencies passed with no checks.
 # 'test_compile' -- check by making test program.
 # 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+# that responds to the $file_magic_cmd with a given extended regex.
+# If you have 'file' or equivalent on your system and you're not sure
+# whether 'pass_all' will *always* work, you probably want this one.
 
 case $host_os in
 aix[4-9]*)
@@ -5606,8 +5622,7 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
@@ -5703,8 +5718,8 @@ newos6*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+openbsd* | bitrig*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
   else
     lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
@@ -5757,6 +5772,9 @@ sysv4 | sysv4.3*)
 tpf*)
   lt_cv_deplibs_check_method=pass_all
   ;;
+os2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 esac
 
 fi
@@ -5914,8 +5932,8 @@ else
 
 case $host_os in
 cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
+  # two different shell functions defined in ltmain.sh;
+  # decide which one to use based on capabilities of $DLLTOOL
   case `$DLLTOOL --help 2>&1` in
   *--identify-strict*)
     lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
@@ -5927,7 +5945,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   ;;
 *)
   # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  lt_cv_sharedlib_from_linklib_cmd=$ECHO
   ;;
 esac
 
@@ -6082,7 +6100,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-      if test "$ac_status" -eq 0; then
+      if test 0 -eq "$ac_status"; then
 	# Ensure the archiver fails upon bogus file names.
 	rm -f conftest.$ac_objext libconftest.a
 	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
@@ -6090,7 +6108,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }
-	if test "$ac_status" -ne 0; then
+	if test 0 -ne "$ac_status"; then
           lt_cv_ar_at_file=@
         fi
       fi
@@ -6103,7 +6121,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
 $as_echo "$lt_cv_ar_at_file" >&6; }
 
-if test "x$lt_cv_ar_at_file" = xno; then
+if test no = "$lt_cv_ar_at_file"; then
   archiver_list_spec=
 else
   archiver_list_spec=$lt_cv_ar_at_file
@@ -6320,7 +6338,7 @@ old_postuninstall_cmds=
 
 if test -n "$RANLIB"; then
   case $host_os in
-  openbsd*)
+  bitrig* | openbsd*)
     old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
@@ -6410,7 +6428,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   symcode='[ABCDGISTW]'
   ;;
 hpux*)
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     symcode='[ABCDEGRST]'
   fi
   ;;
@@ -6443,14 +6461,44 @@ case `$NM -V 2>&1` in
   symcode='[ABCDGIRSTW]' ;;
 esac
 
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  # Gets list of data symbols to import.
+  lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+  # Adjust the below global symbol transforms to fixup imported variables.
+  lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
+  lt_c_name_hook=" -e 's/^I .* \(.*\)$/  {\"\1\", (void *) 0},/p'"
+  lt_c_name_lib_hook="\
+  -e 's/^I .* \(lib.*\)$/  {\"\1\", (void *) 0},/p'\
+  -e 's/^I .* \(.*\)$/  {\"lib\1\", (void *) 0},/p'"
+else
+  # Disable hooks by default.
+  lt_cv_sys_global_symbol_to_import=
+  lt_cdecl_hook=
+  lt_c_name_hook=
+  lt_c_name_lib_hook=
+fi
+
 # Transform an extracted symbol line into a proper C declaration.
 # Some systems (esp. on ia64) link data and code symbols differently,
 # so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+lt_cv_sys_global_symbol_to_cdecl="sed -n"\
+$lt_cdecl_hook\
+" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
+$lt_c_name_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/p'"
+
+# Transform an extracted symbol line into symbol name with lib prefix and
+# symbol address.
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
+$lt_c_name_lib_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(lib.*\)$/  {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"lib\1\", (void *) \&\1},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -6468,21 +6516,24 @@ for ac_symprfx in "" "_"; do
 
   # Write the raw and C identifiers.
   if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
+    # Fake it for dumpbin and say T for any non-static function,
+    # D for any global variable and I for any imported variable.
     # Also find C++ and __fastcall symbols from MSVC++,
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK '"\
 "     {last_section=section; section=\$ 3};"\
 "     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
+"     /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
+"     /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
 "     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+"     {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
+"     s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
 "     ' prfx=^$ac_symprfx"
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
@@ -6530,11 +6581,11 @@ _LT_EOF
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
-#elif defined(__osf__)
+#elif defined __osf__
 /* This system does not cope well with relocations in const data.  */
 # define LT_DLSYM_CONST
 #else
@@ -6560,7 +6611,7 @@ lt__PROGRAM__LTX_preloaded_symbols[] =
 {
   { "@PROGRAM@", (void *) 0 },
 _LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  $SED "s/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
 	  cat <<\_LT_EOF >> conftest.$ac_ext
   {0, (void *) 0}
 };
@@ -6580,13 +6631,13 @@ _LT_EOF
 	  mv conftest.$ac_objext conftstm.$ac_objext
 	  lt_globsym_save_LIBS=$LIBS
 	  lt_globsym_save_CFLAGS=$CFLAGS
-	  LIBS="conftstm.$ac_objext"
+	  LIBS=conftstm.$ac_objext
 	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
 	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
   (eval $ac_link) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+  test $ac_status = 0; } && test -s conftest$ac_exeext; then
 	    pipe_works=yes
 	  fi
 	  LIBS=$lt_globsym_save_LIBS
@@ -6607,7 +6658,7 @@ _LT_EOF
   rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
+  if test yes = "$pipe_works"; then
     break
   else
     lt_cv_sys_global_symbol_pipe=
@@ -6660,6 +6711,16 @@ fi
 
 
 
+
+
+
+
+
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
 $as_echo_n "checking for sysroot... " >&6; }
 
@@ -6672,9 +6733,9 @@ fi
 
 
 lt_sysroot=
-case ${with_sysroot} in #(
+case $with_sysroot in #(
  yes)
-   if test "$GCC" = yes; then
+   if test yes = "$GCC"; then
      lt_sysroot=`$CC --print-sysroot 2>/dev/null`
    fi
    ;; #(
@@ -6684,8 +6745,8 @@ case ${with_sysroot} in #(
  no|'')
    ;; #(
  *)
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
-$as_echo "${with_sysroot}" >&6; }
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5
+$as_echo "$with_sysroot" >&6; }
    as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
    ;;
 esac
@@ -6697,18 +6758,99 @@ $as_echo "${lt_sysroot:-no}" >&6; }
 
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5
+$as_echo_n "checking for a working dd... " >&6; }
+if ${ac_cv_path_lt_DD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+: ${lt_DD:=$DD}
+if test -z "$lt_DD"; then
+  ac_path_lt_DD_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in dd; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext"
+      as_fn_executable_p "$ac_path_lt_DD" || continue
+if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
+fi
+      $ac_path_lt_DD_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_lt_DD"; then
+    :
+  fi
+else
+  ac_cv_path_lt_DD=$lt_DD
+fi
+
+rm -f conftest.i conftest2.i conftest.out
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5
+$as_echo "$ac_cv_path_lt_DD" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5
+$as_echo_n "checking how to truncate binary pipes... " >&6; }
+if ${lt_cv_truncate_bin+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+lt_cv_truncate_bin=
+if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
+fi
+rm -f conftest.i conftest2.i conftest.out
+test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5
+$as_echo "$lt_cv_truncate_bin" >&6; }
+
+
+
+
+
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
 # Check whether --enable-libtool-lock was given.
 if test "${enable_libtool_lock+set}" = set; then :
   enableval=$enable_libtool_lock;
 fi
 
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+test no = "$enable_libtool_lock" || enable_libtool_lock=yes
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
 case $host in
 ia64-*-hpux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set mode
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -6717,24 +6859,25 @@ ia64-*-hpux*)
   test $ac_status = 0; }; then
     case `/usr/bin/file conftest.$ac_objext` in
       *ELF-32*)
-	HPUX_IA64_MODE="32"
+	HPUX_IA64_MODE=32
 	;;
       *ELF-64*)
-	HPUX_IA64_MODE="64"
+	HPUX_IA64_MODE=64
 	;;
     esac
   fi
   rm -rf conftest*
   ;;
 *-*-irix6*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo '#line '$LINENO' "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
+    if test yes = "$lt_cv_prog_gnu_ld"; then
       case `/usr/bin/file conftest.$ac_objext` in
 	*32-bit*)
 	  LD="${LD-ld} -melf32bsmip"
@@ -6763,9 +6906,50 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
+mips64*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    emul=elf
+    case `/usr/bin/file conftest.$ac_objext` in
+      *32-bit*)
+	emul="${emul}32"
+	;;
+      *64-bit*)
+	emul="${emul}64"
+	;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *MSB*)
+	emul="${emul}btsmip"
+	;;
+      *LSB*)
+	emul="${emul}ltsmip"
+	;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *N32*)
+	emul="${emul}n32"
+	;;
+    esac
+    LD="${LD-ld} -m $emul"
+  fi
+  rm -rf conftest*
+  ;;
+
 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.  Note that the listed cases only cover the
+  # situations where additional linker options are needed (such as when
+  # doing 32-bit compilation for a host where ld defaults to 64-bit, or
+  # vice versa); the common cases where no linker options are needed do
+  # not appear in the list.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -6788,10 +6972,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 		;;
 	    esac
 	    ;;
-	  powerpc64le-*)
+	  powerpc64le-*linux*)
 	    LD="${LD-ld} -m elf32lppclinux"
 	    ;;
-	  powerpc64-*)
+	  powerpc64-*linux*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -6810,10 +6994,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  powerpcle-*)
+	  powerpcle-*linux*)
 	    LD="${LD-ld} -m elf64lppc"
 	    ;;
-	  powerpc-*)
+	  powerpc-*linux*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -6831,7 +7015,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
+  SAVE_CFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -belf"
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
 $as_echo_n "checking whether the C compiler needs -belf... " >&6; }
@@ -6871,13 +7055,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
 $as_echo "$lt_cv_cc_needs_belf" >&6; }
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+  if test yes != "$lt_cv_cc_needs_belf"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
+    CFLAGS=$SAVE_CFLAGS
   fi
   ;;
 *-*solaris*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -6889,7 +7074,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
       case $lt_cv_prog_gnu_ld in
       yes*)
         case $host in
-        i?86-*-solaris*)
+        i?86-*-solaris*|x86_64-*-solaris*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
         sparc*-*-solaris*)
@@ -6898,7 +7083,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
         esac
         # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
         if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
+          LD=${LD-ld}_sol2
         fi
         ;;
       *)
@@ -6914,7 +7099,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; }
   ;;
 esac
 
-need_locks="$enable_libtool_lock"
+need_locks=$enable_libtool_lock
 
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
@@ -7025,7 +7210,7 @@ else
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
 $as_echo "$lt_cv_path_mainfest_tool" >&6; }
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
+if test yes != "$lt_cv_path_mainfest_tool"; then
   MANIFEST_TOOL=:
 fi
 
@@ -7528,7 +7713,7 @@ if ${lt_cv_apple_cc_single_mod+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
+      if test -z "$LT_MULTI_MODULE"; then
 	# By default we will add the -single_module flag. You can override
 	# by either setting the environment variable LT_MULTI_MODULE
 	# non-empty at configure time, or by adding -multi_module to the
@@ -7546,7 +7731,7 @@ else
 	  cat conftest.err >&5
 	# Otherwise, if the output was created with a 0 exit code from
 	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&5
@@ -7585,7 +7770,7 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-	LDFLAGS="$save_LDFLAGS"
+	LDFLAGS=$save_LDFLAGS
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
@@ -7614,7 +7799,7 @@ _LT_EOF
       _lt_result=$?
       if test -s conftest.err && $GREP force_load conftest.err; then
 	cat conftest.err >&5
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&5
@@ -7627,32 +7812,32 @@ fi
 $as_echo "$lt_cv_ld_force_load" >&6; }
     case $host_os in
     rhapsody* | darwin1.[012])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
     darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
     darwin*) # darwin 5.x on
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
       # target defaults to 10.4. Don't you love it?
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
 	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[012]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	  _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+	10.[012][,.]*)
+	  _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
 	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	  _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
       esac
     ;;
   esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
       _lt_dar_single_mod='$single_module'
     fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
     else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -7660,6 +7845,41 @@ $as_echo "$lt_cv_ld_force_load" >&6; }
     ;;
   esac
 
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -7963,14 +8183,14 @@ if test "${enable_shared+set}" = set; then :
     *)
       enable_shared=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_shared=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -7994,14 +8214,14 @@ if test "${enable_static+set}" = set; then :
     *)
      enable_static=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_static=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -8025,14 +8245,14 @@ if test "${with_pic+set}" = set; then :
     *)
       pic_mode=default
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$lt_pkg" = "X$lt_p"; then
 	  pic_mode=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -8040,8 +8260,6 @@ else
 fi
 
 
-test -z "$pic_mode" && pic_mode=default
-
 
 
 
@@ -8057,14 +8275,14 @@ if test "${enable_fast_install+set}" = set; then :
     *)
       enable_fast_install=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_fast_install=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac
 else
@@ -8078,11 +8296,63 @@ fi
 
 
 
+  shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[5-9]*,yes)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5
+$as_echo_n "checking which variant of shared library versioning to provide... " >&6; }
+
+# Check whether --with-aix-soname was given.
+if test "${with_aix_soname+set}" = set; then :
+  withval=$with_aix_soname; case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname
+else
+  if ${lt_cv_with_aix_soname+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_with_aix_soname=aix
+fi
+
+    with_aix_soname=$lt_cv_with_aix_soname
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5
+$as_echo "$with_aix_soname" >&6; }
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+
+
+
+
+
+
 
 
 
 # This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+LIBTOOL_DEPS=$ltmain
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -8131,7 +8401,7 @@ test -z "$LN_S" && LN_S="ln -s"
 
 
 
-if test -n "${ZSH_VERSION+set}" ; then
+if test -n "${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 
@@ -8170,7 +8440,7 @@ aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
   # reason, if we set the COLLECT_NAMES environment variable, the problems
   # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
+  if test set != "${COLLECT_NAMES+set}"; then
     COLLECT_NAMES=
     export COLLECT_NAMES
   fi
@@ -8181,14 +8451,14 @@ esac
 ofile=libtool
 can_build_shared=yes
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+with_gnu_ld=$lt_cv_prog_gnu_ld
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
+old_CC=$CC
+old_CFLAGS=$CFLAGS
 
 # Set sane defaults for various variables
 test -z "$CC" && CC=cc
@@ -8197,15 +8467,8 @@ test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
 test -z "$LD" && LD=ld
 test -z "$ac_objext" && ac_objext=o
 
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+func_cc_basename $compiler
+cc_basename=$func_cc_basename_result
 
 
 # Only perform the check for file, if the check method requires it
@@ -8220,22 +8483,22 @@ if ${lt_cv_path_MAGIC_CMD+:} false; then :
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
   ;;
 *)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
   for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/${ac_tool_prefix}file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+    if test -f "$ac_dir/${ac_tool_prefix}file"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file"
       if test -n "$file_magic_test_file"; then
 	case $deplibs_check_method in
 	"file_magic "*)
 	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
 	    $EGREP "$file_magic_regex" > /dev/null; then
 	    :
@@ -8258,13 +8521,13 @@ _LT_EOF
       break
     fi
   done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
   ;;
 esac
 fi
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 if test -n "$MAGIC_CMD"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
 $as_echo "$MAGIC_CMD" >&6; }
@@ -8286,22 +8549,22 @@ if ${lt_cv_path_MAGIC_CMD+:} false; then :
 else
   case $MAGIC_CMD in
 [\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
   ;;
 *)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
   for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+    if test -f "$ac_dir/file"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"file"
       if test -n "$file_magic_test_file"; then
 	case $deplibs_check_method in
 	"file_magic "*)
 	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
 	    $EGREP "$file_magic_regex" > /dev/null; then
 	    :
@@ -8324,13 +8587,13 @@ _LT_EOF
       break
     fi
   done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
   ;;
 esac
 fi
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 if test -n "$MAGIC_CMD"; then
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
 $as_echo "$MAGIC_CMD" >&6; }
@@ -8351,7 +8614,7 @@ esac
 
 # Use C for the default configuration in the libtool script
 
-lt_save_CC="$CC"
+lt_save_CC=$CC
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -8413,7 +8676,7 @@ if test -n "$compiler"; then
 
 lt_prog_compiler_no_builtin_flag=
 
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $cc_basename in
   nvcc*)
     lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
@@ -8429,7 +8692,7 @@ else
   lt_cv_prog_compiler_rtti_exceptions=no
    ac_outfile=conftest.$ac_objext
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   lt_compiler_flag="-fno-rtti -fno-exceptions"  ## exclude from sc_useless_quotes_in_assignment
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -8459,7 +8722,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
-if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then
     lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
 else
     :
@@ -8477,17 +8740,18 @@ lt_prog_compiler_pic=
 lt_prog_compiler_static=
 
 
-  if test "$GCC" = yes; then
+  if test yes = "$GCC"; then
     lt_prog_compiler_wl='-Wl,'
     lt_prog_compiler_static='-static'
 
     case $host_os in
       aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# AIX 5 now supports IA64 processor
 	lt_prog_compiler_static='-Bstatic'
       fi
+      lt_prog_compiler_pic='-fPIC'
       ;;
 
     amigaos*)
@@ -8498,8 +8762,8 @@ lt_prog_compiler_static=
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
             lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
@@ -8515,6 +8779,11 @@ lt_prog_compiler_static=
       # Although the cygwin gcc ignores -fPIC, still need this for old-style
       # (--disable-auto-import) libraries
       lt_prog_compiler_pic='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+	lt_prog_compiler_static='$wl-static'
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -8585,7 +8854,7 @@ lt_prog_compiler_static=
     case $host_os in
     aix*)
       lt_prog_compiler_wl='-Wl,'
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# AIX 5 now supports IA64 processor
 	lt_prog_compiler_static='-Bstatic'
       else
@@ -8593,10 +8862,29 @@ lt_prog_compiler_static=
       fi
       ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        lt_prog_compiler_wl='-Wl,-Wl,,'
+        lt_prog_compiler_pic='-PIC'
+        lt_prog_compiler_static='-Bstatic'
+        ;;
+      esac
+      ;;
+
     mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       lt_prog_compiler_pic='-DDLL_EXPORT'
+      case $host_os in
+      os2*)
+	lt_prog_compiler_static='$wl-static'
+	;;
+      esac
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -8612,7 +8900,7 @@ lt_prog_compiler_static=
 	;;
       esac
       # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      lt_prog_compiler_static='$wl-a ${wl}archive'
       ;;
 
     irix5* | irix6* | nonstopux*)
@@ -8623,7 +8911,7 @@ lt_prog_compiler_static=
 
     linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
+      # old Intel for x86_64, which still supported -KPIC.
       ecc*)
 	lt_prog_compiler_wl='-Wl,'
 	lt_prog_compiler_pic='-KPIC'
@@ -8648,6 +8936,12 @@ lt_prog_compiler_static=
 	lt_prog_compiler_pic='-PIC'
 	lt_prog_compiler_static='-Bstatic'
 	;;
+      tcc*)
+	# Fabrice Bellard et al's Tiny C Compiler
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
+	;;
       pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
@@ -8745,7 +9039,7 @@ lt_prog_compiler_static=
       ;;
 
     sysv4*MP*)
-      if test -d /usr/nec ;then
+      if test -d /usr/nec; then
 	lt_prog_compiler_pic='-Kconform_pic'
 	lt_prog_compiler_static='-Bstatic'
       fi
@@ -8774,7 +9068,7 @@ lt_prog_compiler_static=
   fi
 
 case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
+  # For platforms that do not support PIC, -DPIC is meaningless:
   *djgpp*)
     lt_prog_compiler_pic=
     ;;
@@ -8806,7 +9100,7 @@ else
   lt_cv_prog_compiler_pic_works=no
    ac_outfile=conftest.$ac_objext
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"  ## exclude from sc_useless_quotes_in_assignment
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -8836,7 +9130,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+if test yes = "$lt_cv_prog_compiler_pic_works"; then
     case $lt_prog_compiler_pic in
      "" | " "*) ;;
      *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
@@ -8868,7 +9162,7 @@ if ${lt_cv_prog_compiler_static_works+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler_static_works=no
-   save_LDFLAGS="$LDFLAGS"
+   save_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
@@ -8887,13 +9181,13 @@ else
      fi
    fi
    $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+   LDFLAGS=$save_LDFLAGS
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
 $as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+if test yes = "$lt_cv_prog_compiler_static_works"; then
     :
 else
     lt_prog_compiler_static=
@@ -9013,8 +9307,8 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
 
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+hard_links=nottested
+if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then
   # do not overwrite the value of need_locks provided by the user
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
 $as_echo_n "checking if we can lock with hard links... " >&6; }
@@ -9026,9 +9320,9 @@ $as_echo_n "checking if we can lock with hard links... " >&6; }
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
 $as_echo "$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+  if test no = "$hard_links"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;}
     need_locks=warn
   fi
 else
@@ -9071,9 +9365,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   # included in the symbol list
   include_expsyms=
   # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
+  # it will be wrapped by ' (' and ')$', so one must not match beginning or
+  # end of line.  Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
+  # as well as any symbol that contains 'd'.
   exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
@@ -9088,7 +9382,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       with_gnu_ld=no
     fi
     ;;
@@ -9096,7 +9390,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     # we just hope/assume this is gcc and not c89 (= MSVC++)
     with_gnu_ld=yes
     ;;
-  openbsd*)
+  openbsd* | bitrig*)
     with_gnu_ld=no
     ;;
   linux* | k*bsd*-gnu | gnu*)
@@ -9109,7 +9403,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
   # On some targets, GNU ld is compatible enough with the native linker
   # that we're better off using the native interface for both.
   lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     case $host_os in
       aix*)
 	# The AIX port of GNU ld has always aspired to compatibility
@@ -9131,24 +9425,24 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     esac
   fi
 
-  if test "$lt_use_gnu_ld_interface" = yes; then
+  if test yes = "$lt_use_gnu_ld_interface"; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
+    wlarc='$wl'
 
     # Set some defaults for GNU ld with shared library support. These
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
     runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
+    hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+    export_dynamic_flag_spec='$wl--export-dynamic'
     # ancient GNU ld didn't support --whole-archive et. al.
     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
     else
       whole_archive_flag_spec=
     fi
     supports_anon_versioning=no
-    case `$LD -v 2>&1` in
+    case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in
       *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
@@ -9161,7 +9455,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
     case $host_os in
     aix[3-9]*)
       # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
+      if test ia64 != "$host_cpu"; then
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
@@ -9180,7 +9474,7 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             archive_expsym_cmds=''
         ;;
       m68k)
@@ -9196,7 +9490,7 @@ _LT_EOF
 	allow_undefined_flag=unsupported
 	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
 	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -9206,7 +9500,7 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
       # as there is no search path for DLLs.
       hardcode_libdir_flag_spec='-L$libdir'
-      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      export_dynamic_flag_spec='$wl--export-all-symbols'
       allow_undefined_flag=unsupported
       always_export_symbols=no
       enable_shared_with_static_runtimes=yes
@@ -9214,61 +9508,89 @@ _LT_EOF
       exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file, use it as
+	# is; otherwise, prepend EXPORTS...
+	archive_expsym_cmds='if   test DEF = "`$SED -n     -e '\''s/^[	 ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
 	ld_shlibs=no
       fi
       ;;
 
     haiku*)
-      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       link_all_deplibs=yes
       ;;
 
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      shrext_cmds=.dll
+      archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	prefix_cmds="$SED"~
+	if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	  prefix_cmds="$prefix_cmds -e 1d";
+	fi~
+	prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+	cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
     interix[3-9]*)
       hardcode_direct=no
       hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec='${wl}-E'
+      hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+      export_dynamic_flag_spec='$wl-E'
       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
       # Instead, shared libraries are loaded at an image base (0x10000000 by
       # default) and relocated if they conflict, which is a slow very memory
       # consuming and fragmenting process.  To avoid this, we pick a random,
       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
     gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
+      if test linux-dietlibc = "$host_os"; then
 	case $cc_basename in
 	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
 	esac
       fi
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
+	 && test no = "$tmp_diet"
       then
 	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
 	pgf77* | pgf90* | pgf95* | pgfortran*)
 					# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -9279,42 +9601,47 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
+        nagfor*)                        # NAGFOR 5.3
+          tmp_sharedflag='-Wl,-shared' ;;
 	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
 	nvcc*)	# Cuda Compiler Driver 2.2
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  compiler_needs_object=yes
 	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  compiler_needs_object=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
 	  tmp_sharedflag='-G' ;;
 	esac
-	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
 
-        if test "x$supports_anon_versioning" = xyes; then
+        if test yes = "$supports_anon_versioning"; then
           archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
         fi
 
 	case $cc_basename in
+	tcc*)
+	  export_dynamic_flag_spec='-rdynamic'
+	  ;;
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
-	  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	  hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
 	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
+	  if test yes = "$supports_anon_versioning"; then
 	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -9328,8 +9655,8 @@ _LT_EOF
 	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -9347,8 +9674,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
@@ -9360,7 +9687,7 @@ _LT_EOF
 	ld_shlibs=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
 *** reliably create shared libraries on SCO systems.  Therefore, libtool
 *** is disabling shared libraries support.  We urge you to upgrade GNU
 *** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
@@ -9375,9 +9702,9 @@ _LT_EOF
 	  # DT_RUNPATH tag from executables and libraries.  But doing so
 	  # requires that you compile everything twice, which is a pain.
 	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	    hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 	  else
 	    ld_shlibs=no
 	  fi
@@ -9394,15 +9721,15 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	ld_shlibs=no
       fi
       ;;
     esac
 
-    if test "$ld_shlibs" = no; then
+    if test no = "$ld_shlibs"; then
       runpath_var=
       hardcode_libdir_flag_spec=
       export_dynamic_flag_spec=
@@ -9418,7 +9745,7 @@ _LT_EOF
       # Note: this linker hardcodes the directories in LIBPATH if there
       # are no directories specified by -L.
       hardcode_minus_L=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+      if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
 	# Neither direct hardcoding nor static linking is supported with a
 	# broken collect2.
 	hardcode_direct=unsupported
@@ -9426,34 +9753,57 @@ _LT_EOF
       ;;
 
     aix[4-9]*)
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
 	aix_use_runtimelinking=no
 	exp_sym_flag='-Bexport'
-	no_entry_flag=""
+	no_entry_flag=
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
+	# -C means demangle to GNU nm, but means don't demangle to AIX nm.
+	# Without the "-l" option, or with the "-B" option, AIX nm treats
+	# weak defined symbols like other global defined symbols, whereas
+	# GNU nm marks them as "W".
+	# While the 'weak' keyword is ignored in the Export File, we need
+	# it in the Import File for the 'aix-soname' feature, so we have
+	# to replace the "-B" option with "-P" for AIX nm.
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
 	else
-	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
 	fi
 	aix_use_runtimelinking=no
 
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
+	# have runtime linking enabled, and use it for executables.
+	# For shared libraries, we enable/disable runtime linking
+	# depending on the kind of the shared library created -
+	# when "with_aix_soname,aix_use_runtimelinking" is:
+	# "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+	# "aix,yes"  lib.so          shared, rtl:yes, for executables
+	#            lib.a           static archive
+	# "both,no"  lib.so.V(shr.o) shared, rtl:yes
+	#            lib.a(lib.so.V) shared, rtl:no,  for executables
+	# "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+	#            lib.a(lib.so.V) shared, rtl:no
+	# "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+	#            lib.a           static archive
 	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
 	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	  if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
 	    aix_use_runtimelinking=yes
 	    break
 	  fi
 	  done
+	  if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+	    # With aix-soname=svr4, we create the lib.so.V shared archives only,
+	    # so we don't have lib.a shared libs to link our executables.
+	    # We have to force runtime linking in this case.
+	    aix_use_runtimelinking=yes
+	    LDFLAGS="$LDFLAGS -Wl,-brtl"
+	  fi
 	  ;;
 	esac
 
@@ -9472,13 +9822,21 @@ _LT_EOF
       hardcode_direct_absolute=yes
       hardcode_libdir_separator=':'
       link_all_deplibs=yes
-      file_list_spec='${wl}-f,'
+      file_list_spec='$wl-f,'
+      case $with_aix_soname,$aix_use_runtimelinking in
+      aix,*) ;; # traditional, no import file
+      svr4,* | *,yes) # use import file
+	# The Import File defines what to hardcode.
+	hardcode_direct=no
+	hardcode_direct_absolute=no
+	;;
+      esac
 
-      if test "$GCC" = yes; then
+      if test yes = "$GCC"; then
 	case $host_os in aix4.[012]|aix4.[012].*)
 	# We only want to do this on AIX 4.2 and lower, the check
 	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
+	  collect2name=`$CC -print-prog-name=collect2`
 	  if test -f "$collect2name" &&
 	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
 	  then
@@ -9497,36 +9855,42 @@ _LT_EOF
 	  ;;
 	esac
 	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
+	if test yes = "$aix_use_runtimelinking"; then
+	  shared_flag="$shared_flag "'$wl-G'
 	fi
-	link_all_deplibs=no
+	# Need to ensure runtime linking is disabled for the traditional
+	# shared library, or the linker may eventually find shared libraries
+	# /with/ Import File - we do not want to mix them.
+	shared_flag_aix='-shared'
+	shared_flag_svr4='-shared $wl-G'
       else
 	# not using gcc
-	if test "$host_cpu" = ia64; then
+	if test ia64 = "$host_cpu"; then
 	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
 	# chokes on -Wl,-G. The following line is correct:
 	  shared_flag='-G'
 	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
+	  if test yes = "$aix_use_runtimelinking"; then
+	    shared_flag='$wl-G'
 	  else
-	    shared_flag='${wl}-bM:SRE'
+	    shared_flag='$wl-bM:SRE'
 	  fi
+	  shared_flag_aix='$wl-bM:SRE'
+	  shared_flag_svr4='$wl-G'
 	fi
       fi
 
-      export_dynamic_flag_spec='${wl}-bexpall'
+      export_dynamic_flag_spec='$wl-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       always_export_symbols=yes
-      if test "$aix_use_runtimelinking" = yes; then
+      if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
 	# Warning - without using the other runtime loading flags (-brtl),
 	# -berok will link without error, but may produce a broken library.
 	allow_undefined_flag='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
-        if test "${lt_cv_aix_libpath+set}" = set; then
+        if test set = "${lt_cv_aix_libpath+set}"; then
   aix_libpath=$lt_cv_aix_libpath
 else
   if ${lt_cv_aix_libpath_+:} false; then :
@@ -9561,7 +9925,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
   if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
+    lt_cv_aix_libpath_=/usr/lib:/lib
   fi
 
 fi
@@ -9569,17 +9933,17 @@ fi
   aix_libpath=$lt_cv_aix_libpath_
 fi
 
-        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
       else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	if test ia64 = "$host_cpu"; then
+	  hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib'
 	  allow_undefined_flag="-z nodefs"
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
-	 if test "${lt_cv_aix_libpath+set}" = set; then
+	 if test set = "${lt_cv_aix_libpath+set}"; then
   aix_libpath=$lt_cv_aix_libpath
 else
   if ${lt_cv_aix_libpath_+:} false; then :
@@ -9614,7 +9978,7 @@ fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
   if test -z "$lt_cv_aix_libpath_"; then
-    lt_cv_aix_libpath_="/usr/lib:/lib"
+    lt_cv_aix_libpath_=/usr/lib:/lib
   fi
 
 fi
@@ -9622,21 +9986,33 @@ fi
   aix_libpath=$lt_cv_aix_libpath_
 fi
 
-	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	 hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag=' ${wl}-bernotok'
-	  allow_undefined_flag=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
+	  no_undefined_flag=' $wl-bernotok'
+	  allow_undefined_flag=' $wl-berok'
+	  if test yes = "$with_gnu_ld"; then
 	    # We only use this code for GNU lds that support --whole-archive.
-	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive'
 	  else
 	    # Exported symbols can be pulled into shared objects from archives
 	    whole_archive_flag_spec='$convenience'
 	  fi
 	  archive_cmds_need_lc=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	  archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+	  # -brtl affects multiple linker settings, -berok does not and is overridden later
+	  compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`'
+	  if test svr4 != "$with_aix_soname"; then
+	    # This is similar to how AIX traditionally builds its shared libraries.
+	    archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+	  fi
+	  if test aix != "$with_aix_soname"; then
+	    archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+	  else
+	    # used by -dlpreopen to get the symbols
+	    archive_expsym_cmds="$archive_expsym_cmds"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+	  fi
+	  archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d'
 	fi
       fi
       ;;
@@ -9645,7 +10021,7 @@ fi
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             archive_expsym_cmds=''
         ;;
       m68k)
@@ -9675,16 +10051,17 @@ fi
 	# Tell ltmain to make .lib files, not .a files.
 	libext=lib
 	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
+	shrext_cmds=.dll
 	# FIXME: Setting linknames here is a bad hack.
-	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+	archive_expsym_cmds='if   test DEF = "`$SED -n     -e '\''s/^[	 ]*//'\''     -e '\''/^\(;.*\)*$/d'\''     -e '\''s/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p'\''     -e q     $export_symbols`" ; then
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
 	enable_shared_with_static_runtimes=yes
@@ -9693,18 +10070,18 @@ fi
 	# Don't use ranlib
 	old_postinstall_cmds='chmod 644 $oldlib'
 	postlink_cmds='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
 	;;
       *)
 	# Assume MSVC wrapper
@@ -9713,7 +10090,7 @@ fi
 	# Tell ltmain to make .lib files, not .a files.
 	libext=lib
 	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
+	shrext_cmds=.dll
 	# FIXME: Setting linknames here is a bad hack.
 	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
 	# The linker will automatically build a .lib file if we build a DLL.
@@ -9732,24 +10109,24 @@ fi
   hardcode_direct=no
   hardcode_automatic=yes
   hardcode_shlibpath_var=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  if test yes = "$lt_cv_ld_force_load"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
 
   else
     whole_archive_flag_spec=''
   fi
   link_all_deplibs=yes
-  allow_undefined_flag="$_lt_dar_allow_undefined"
+  allow_undefined_flag=$_lt_dar_allow_undefined
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
-  if test "$_lt_dar_can_shared" = "yes"; then
+  if test yes = "$_lt_dar_can_shared"; then
     output_verbose_link_cmd=func_echo_all
-    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
 
   else
   ld_shlibs=no
@@ -9791,33 +10168,33 @@ fi
       ;;
 
     hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      if test yes = "$GCC"; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       else
-	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       fi
-      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl+b $wl$libdir'
       hardcode_libdir_separator=:
       hardcode_direct=yes
 
       # hardcode_minus_L: Not really in the search PATH,
       # but as the default location of the library.
       hardcode_minus_L=yes
-      export_dynamic_flag_spec='${wl}-E'
+      export_dynamic_flag_spec='$wl-E'
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+	archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+	hardcode_libdir_flag_spec='$wl+b $wl$libdir'
 	hardcode_libdir_separator=:
 	hardcode_direct=yes
 	hardcode_direct_absolute=yes
-	export_dynamic_flag_spec='${wl}-E'
+	export_dynamic_flag_spec='$wl-E'
 	# hardcode_minus_L: Not really in the search PATH,
 	# but as the default location of the library.
 	hardcode_minus_L=yes
@@ -9825,25 +10202,25 @@ fi
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test yes,no = "$GCC,$with_gnu_ld"; then
 	case $host_cpu in
 	hppa*64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
 	case $host_cpu in
 	hppa*64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
 
@@ -9855,7 +10232,7 @@ if ${lt_cv_prog_compiler__b+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   lt_cv_prog_compiler__b=no
-   save_LDFLAGS="$LDFLAGS"
+   save_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS -b"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
@@ -9874,14 +10251,14 @@ else
      fi
    fi
    $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+   LDFLAGS=$save_LDFLAGS
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
 $as_echo "$lt_cv_prog_compiler__b" >&6; }
 
-if test x"$lt_cv_prog_compiler__b" = xyes; then
-    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+if test yes = "$lt_cv_prog_compiler__b"; then
+    archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 else
     archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
 fi
@@ -9889,8 +10266,8 @@ fi
 	  ;;
 	esac
       fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+	hardcode_libdir_flag_spec='$wl+b $wl$libdir'
 	hardcode_libdir_separator=:
 
 	case $host_cpu in
@@ -9901,7 +10278,7 @@ fi
 	*)
 	  hardcode_direct=yes
 	  hardcode_direct_absolute=yes
-	  export_dynamic_flag_spec='${wl}-E'
+	  export_dynamic_flag_spec='$wl-E'
 
 	  # hardcode_minus_L: Not really in the search PATH,
 	  # but as the default location of the library.
@@ -9912,8 +10289,8 @@ fi
       ;;
 
     irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
@@ -9923,8 +10300,8 @@ $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >
 if ${lt_cv_irix_exported_symbol+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+  save_LDFLAGS=$LDFLAGS
+	   LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
 	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 int foo (void) { return 0; }
@@ -9936,24 +10313,35 @@ else
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-           LDFLAGS="$save_LDFLAGS"
+           LDFLAGS=$save_LDFLAGS
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
 $as_echo "$lt_cv_irix_exported_symbol" >&6; }
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	if test yes = "$lt_cv_irix_exported_symbol"; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
 	fi
+	link_all_deplibs=no
       else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
       fi
       archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       hardcode_libdir_separator=:
       inherit_rpath=yes
       link_all_deplibs=yes
       ;;
 
+    linux*)
+      case $cc_basename in
+      tcc*)
+	# Fabrice Bellard et al's Tiny C Compiler
+	ld_shlibs=yes
+	archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      esac
+      ;;
+
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
@@ -9968,7 +10356,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
     newsos6)
       archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
       hardcode_direct=yes
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       hardcode_libdir_separator=:
       hardcode_shlibpath_var=no
       ;;
@@ -9976,27 +10364,19 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
     *nto* | *qnx*)
       ;;
 
-    openbsd*)
+    openbsd* | bitrig*)
       if test -f /usr/libexec/ld.so; then
 	hardcode_direct=yes
 	hardcode_shlibpath_var=no
 	hardcode_direct_absolute=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
 	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec='${wl}-E'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='$wl-rpath,$libdir'
+	  export_dynamic_flag_spec='$wl-E'
 	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	     ;;
-	  esac
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  hardcode_libdir_flag_spec='$wl-rpath,$libdir'
 	fi
       else
 	ld_shlibs=no
@@ -10007,33 +10387,53 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       hardcode_libdir_flag_spec='-L$libdir'
       hardcode_minus_L=yes
       allow_undefined_flag=unsupported
-      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      shrext_cmds=.dll
+      archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	prefix_cmds="$SED"~
+	if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	  prefix_cmds="$prefix_cmds -e 1d";
+	fi~
+	prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+	cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      enable_shared_with_static_runtimes=yes
       ;;
 
     osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+	allow_undefined_flag=' $wl-expect_unresolved $wl\*'
+	archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
       fi
       archive_cmds_need_lc='no'
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       hardcode_libdir_separator=:
       ;;
 
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      if test yes = "$GCC"; then
+	allow_undefined_flag=' $wl-expect_unresolved $wl\*'
+	archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+	hardcode_libdir_flag_spec='$wl-rpath $wl$libdir'
       else
 	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	hardcode_libdir_flag_spec='-rpath $libdir'
@@ -10044,24 +10444,24 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
 
     solaris*)
       no_undefined_flag=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+	wlarc='$wl'
+	archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
 	  wlarc=''
-	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
 	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
 	  ;;
 	*)
-	  wlarc='${wl}'
-	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  wlarc='$wl'
+	  archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
 	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
 	  ;;
 	esac
       fi
@@ -10071,11 +10471,11 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       solaris2.[0-5] | solaris2.[0-5].*) ;;
       *)
 	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but understands '-z linker_flag'.  GCC discards it without '$wl',
 	# but is careful enough not to reorder.
 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	if test yes = "$GCC"; then
+	  whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
 	else
 	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
 	fi
@@ -10085,10 +10485,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       ;;
 
     sunos4*)
-      if test "x$host_vendor" = xsequent; then
+      if test sequent = "$host_vendor"; then
 	# Use $CC to link under sequent, because it throws in some extra .o
 	# files that make .init and .fini sections work.
-	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
       else
 	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -10137,43 +10537,43 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag='${wl}-z,text'
+      no_undefined_flag='$wl-z,text'
       archive_cmds_need_lc=no
       hardcode_shlibpath_var=no
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+	archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
     sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
+      # Note: We CANNOT use -z defs as we might desire, because we do not
       # link with -lc, and that would cause any symbols used from libc to
       # always be unresolved, which means just about no library would
       # ever link correctly.  If we're not using GNU ld we use -z text
       # though, which does catch some bad symbols but isn't as heavy-handed
       # as -z defs.
-      no_undefined_flag='${wl}-z,text'
-      allow_undefined_flag='${wl}-z,nodefs'
+      no_undefined_flag='$wl-z,text'
+      allow_undefined_flag='$wl-z,nodefs'
       archive_cmds_need_lc=no
       hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_flag_spec='$wl-R,$libdir'
       hardcode_libdir_separator=':'
       link_all_deplibs=yes
-      export_dynamic_flag_spec='${wl}-Bexport'
+      export_dynamic_flag_spec='$wl-Bexport'
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+	archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
@@ -10188,10 +10588,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
       ;;
     esac
 
-    if test x$host_vendor = xsni; then
+    if test sni = "$host_vendor"; then
       case $host in
       sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	export_dynamic_flag_spec='$wl-Blargedynsym'
 	;;
       esac
     fi
@@ -10199,7 +10599,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
 $as_echo "$ld_shlibs" >&6; }
-test "$ld_shlibs" = no && can_build_shared=no
+test no = "$ld_shlibs" && can_build_shared=no
 
 with_gnu_ld=$with_gnu_ld
 
@@ -10225,7 +10625,7 @@ x|xyes)
   # Assume -lc should be added
   archive_cmds_need_lc=yes
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
+  if test yes,yes = "$GCC,$enable_shared"; then
     case $archive_cmds in
     *'~'*)
       # FIXME: we may have to deal with multi-command sequences.
@@ -10440,14 +10840,14 @@ esac
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
 $as_echo_n "checking dynamic linker characteristics... " >&6; }
 
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
+    darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
+    *) lt_awk_arg='/^libraries:/' ;;
   esac
   case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
+    mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;;
+    *) lt_sed_strip_eq='s|=/|/|g' ;;
   esac
   lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
   case $lt_search_path_spec in
@@ -10463,28 +10863,35 @@ if test "$GCC" = yes; then
     ;;
   esac
   # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
+  # and add multilib dir if necessary...
   lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  # ...but if some path component already ends with the multilib dir we assume
+  # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
+  case "$lt_multi_os_dir; $lt_search_path_spec " in
+  "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
+    lt_multi_os_dir=
+    ;;
+  esac
   for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
+    if test -d "$lt_sys_path$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
+    elif test -n "$lt_multi_os_dir"; then
       test -d "$lt_sys_path" && \
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
   lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
+BEGIN {RS = " "; FS = "/|\n";} {
+  lt_foo = "";
+  lt_count = 0;
   for (lt_i = NF; lt_i > 0; lt_i--) {
     if ($lt_i != "" && $lt_i != ".") {
       if ($lt_i == "..") {
         lt_count++;
       } else {
         if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
+          lt_foo = "/" $lt_i lt_foo;
         } else {
           lt_count--;
         }
@@ -10498,7 +10905,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   # for these hosts.
   case $host_os in
     mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+      $SED 's|/\([A-Za-z]:\)|\1|g'` ;;
   esac
   sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
@@ -10507,7 +10914,7 @@ fi
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
-shrext_cmds=".so"
+shrext_cmds=.so
 postinstall_cmds=
 postuninstall_cmds=
 finish_cmds=
@@ -10524,14 +10931,16 @@ hardcode_into_libs=no
 # flags to be left without arguments
 need_version=unknown
 
+
+
 case $host_os in
 aix3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
   # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
+  soname_spec='$libname$release$shared_ext$major'
   ;;
 
 aix[4-9]*)
@@ -10539,41 +10948,91 @@ aix[4-9]*)
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
     shlibpath_var=LD_LIBRARY_PATH
   else
     # With GCC up to 2.95.x, collect2 would create an import file
     # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
     # development snapshots of GCC prior to 3.0.
     case $host_os in
       aix4 | aix4.[01] | aix4.[01].*)
       if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
 	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	   echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
 	:
       else
 	can_build_shared=no
       fi
       ;;
     esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
     # soname into executable. Probably we can add versioning support to
     # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
       # If using run time linking (on AIX 4.2 or later) use lib<name>.so
       # instead of lib<name>.a to let people know that these are not
       # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a(lib.so.V)'
       # We preserve .a as extension for shared libraries through AIX4.2
       # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
     shlibpath_var=LIBPATH
   fi
   ;;
@@ -10583,18 +11042,18 @@ amigaos*)
   powerpc)
     # Since July 2007 AmigaOS4 officially supports .so libraries.
     # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
     ;;
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
 
 beos*)
-  library_names_spec='${libname}${shared_ext}'
+  library_names_spec='$libname$shared_ext'
   dynamic_linker="$host_os ld.so"
   shlibpath_var=LIBRARY_PATH
   ;;
@@ -10602,8 +11061,8 @@ beos*)
 bsdi[45]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
@@ -10615,7 +11074,7 @@ bsdi[45]*)
 
 cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
-  shrext_cmds=".dll"
+  shrext_cmds=.dll
   need_version=no
   need_lib_prefix=no
 
@@ -10624,8 +11083,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname~
@@ -10641,17 +11100,17 @@ cygwin* | mingw* | pw32* | cegcc*)
     case $host_os in
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
 
       sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
       ;;
     esac
     dynamic_linker='Win32 ld.exe'
@@ -10660,8 +11119,8 @@ cygwin* | mingw* | pw32* | cegcc*)
   *,cl*)
     # Native MSVC
     libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
+    soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
 
     case $build_os in
     mingw*)
@@ -10688,7 +11147,7 @@ cygwin* | mingw* | pw32* | cegcc*)
       sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
       ;;
     *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=$LIB
       if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
         # It is most probably a Windows format PATH.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
@@ -10701,8 +11160,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     esac
 
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname'
@@ -10715,7 +11174,7 @@ cygwin* | mingw* | pw32* | cegcc*)
 
   *)
     # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib'
     dynamic_linker='Win32 ld.exe'
     ;;
   esac
@@ -10728,8 +11187,8 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
@@ -10742,8 +11201,8 @@ dgux*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -10761,12 +11220,13 @@ freebsd* | dragonfly*)
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
     freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
   esac
@@ -10796,10 +11256,10 @@ haiku*)
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=no
   sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
@@ -10817,14 +11277,15 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.so"
     shlibpath_var=LD_LIBRARY_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -10832,8 +11293,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
@@ -10842,8 +11303,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=SHLIB_PATH
     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     ;;
   esac
   # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
@@ -10856,8 +11317,8 @@ interix[3-9]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -10868,7 +11329,7 @@ irix5* | irix6* | nonstopux*)
   case $host_os in
     nonstopux*) version_type=nonstopux ;;
     *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
+	if test yes = "$lt_cv_prog_gnu_ld"; then
 		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
@@ -10876,8 +11337,8 @@ irix5* | irix6* | nonstopux*)
   esac
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
   case $host_os in
   irix5* | nonstopux*)
     libsuff= shlibsuff=
@@ -10896,8 +11357,8 @@ irix5* | irix6* | nonstopux*)
   esac
   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
   shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
   hardcode_into_libs=yes
   ;;
 
@@ -10906,13 +11367,33 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  hardcode_libdir_flag_spec='-L$libdir'
+  ;;
+
 # This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -10956,7 +11437,12 @@ fi
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
@@ -10988,12 +11474,12 @@ netbsd*)
   need_lib_prefix=no
   need_version=no
   if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     dynamic_linker='NetBSD ld.elf_so'
   fi
   shlibpath_var=LD_LIBRARY_PATH
@@ -11003,7 +11489,7 @@ netbsd*)
 
 newsos6)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   ;;
@@ -11012,58 +11498,68 @@ newsos6)
   version_type=qnx
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   dynamic_linker='ldqnx.so'
   ;;
 
-openbsd*)
+openbsd* | bitrig*)
   version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
+  sys_lib_dlsearch_path_spec=/usr/lib
   need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
   else
-    shlibpath_overrides_runpath=yes
+    need_version=yes
   fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
   ;;
 
 os2*)
   libname_spec='$name'
-  shrext_cmds=".dll"
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
   need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
   dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
   ;;
 
 osf3* | osf4* | osf5*)
   version_type=osf
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
   ;;
 
 rdos*)
@@ -11074,8 +11570,8 @@ solaris*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
@@ -11085,11 +11581,11 @@ solaris*)
 
 sunos4*)
   version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
   finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     need_lib_prefix=no
   fi
   need_version=yes
@@ -11097,8 +11593,8 @@ sunos4*)
 
 sysv4 | sysv4.3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   case $host_vendor in
     sni)
@@ -11119,24 +11615,24 @@ sysv4 | sysv4.3*)
   ;;
 
 sysv4*MP*)
-  if test -d /usr/nec ;then
+  if test -d /usr/nec; then
     version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
     shlibpath_var=LD_LIBRARY_PATH
   fi
   ;;
 
 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
+  version_type=sco
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
   else
     sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
@@ -11154,7 +11650,7 @@ tpf*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -11162,8 +11658,8 @@ tpf*)
 
 uts4*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -11173,20 +11669,35 @@ uts4*)
 esac
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
 $as_echo "$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
+test no = "$dynamic_linker" && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
+
+
+
+
+
 
 
 
@@ -11283,15 +11794,15 @@ $as_echo_n "checking how to hardcode library paths into programs... " >&6; }
 hardcode_action=
 if test -n "$hardcode_libdir_flag_spec" ||
    test -n "$runpath_var" ||
-   test "X$hardcode_automatic" = "Xyes" ; then
+   test yes = "$hardcode_automatic"; then
 
   # We can hardcode non-existent directories.
-  if test "$hardcode_direct" != no &&
+  if test no != "$hardcode_direct" &&
      # If the only mechanism to avoid hardcoding is shlibpath_var, we
      # have to relink, otherwise we might link with an installed library
      # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
-     test "$hardcode_minus_L" != no; then
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" &&
+     test no != "$hardcode_minus_L"; then
     # Linking always hardcodes the temporary library directory.
     hardcode_action=relink
   else
@@ -11306,12 +11817,12 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
 $as_echo "$hardcode_action" >&6; }
 
-if test "$hardcode_action" = relink ||
-   test "$inherit_rpath" = yes; then
+if test relink = "$hardcode_action" ||
+   test yes = "$inherit_rpath"; then
   # Fast installation is not supported
   enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
   # Fast installation is not necessary
   enable_fast_install=needless
 fi
@@ -11321,7 +11832,7 @@ fi
 
 
 
-  if test "x$enable_dlopen" != xyes; then
+  if test yes != "$enable_dlopen"; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
   enable_dlopen_self_static=unknown
@@ -11331,23 +11842,23 @@ else
 
   case $host_os in
   beos*)
-    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen=load_add_on
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ;;
 
   mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen=LoadLibrary
     lt_cv_dlopen_libs=
     ;;
 
   cygwin*)
-    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen=dlopen
     lt_cv_dlopen_libs=
     ;;
 
   darwin*)
-  # if libdl is installed we need to link against it
+    # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
 if ${ac_cv_lib_dl_dlopen+:} false; then :
@@ -11385,10 +11896,10 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
 else
 
-    lt_cv_dlopen="dyld"
+    lt_cv_dlopen=dyld
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
 
@@ -11396,10 +11907,18 @@ fi
 
     ;;
 
+  tpf*)
+    # Don't try to run any link tests for TPF.  We know it's impossible
+    # because TPF is a cross-compiler, and we know how we open DSOs.
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=no
+    ;;
+
   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
 if test "x$ac_cv_func_shl_load" = xyes; then :
-  lt_cv_dlopen="shl_load"
+  lt_cv_dlopen=shl_load
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
 $as_echo_n "checking for shl_load in -ldld... " >&6; }
@@ -11438,11 +11957,11 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
 $as_echo "$ac_cv_lib_dld_shl_load" >&6; }
 if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+  lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld
 else
   ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
 if test "x$ac_cv_func_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen"
+  lt_cv_dlopen=dlopen
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
 $as_echo_n "checking for dlopen in -ldl... " >&6; }
@@ -11481,7 +12000,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
 $as_echo "$ac_cv_lib_dl_dlopen" >&6; }
 if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
 $as_echo_n "checking for dlopen in -lsvld... " >&6; }
@@ -11520,7 +12039,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
 $as_echo "$ac_cv_lib_svld_dlopen" >&6; }
 if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+  lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
 $as_echo_n "checking for dld_link in -ldld... " >&6; }
@@ -11559,7 +12078,7 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
 $as_echo "$ac_cv_lib_dld_dld_link" >&6; }
 if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+  lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld
 fi
 
 
@@ -11580,21 +12099,21 @@ fi
     ;;
   esac
 
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
+  if test no = "$lt_cv_dlopen"; then
     enable_dlopen=no
+  else
+    enable_dlopen=yes
   fi
 
   case $lt_cv_dlopen in
   dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+    save_CPPFLAGS=$CPPFLAGS
+    test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    save_LDFLAGS="$LDFLAGS"
+    save_LDFLAGS=$LDFLAGS
     wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    save_LIBS="$LIBS"
+    save_LIBS=$LIBS
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
@@ -11602,7 +12121,7 @@ $as_echo_n "checking whether a program can dlopen itself... " >&6; }
 if ${lt_cv_dlopen_self+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  	  if test "$cross_compiling" = yes; then :
+  	  if test yes = "$cross_compiling"; then :
   lt_cv_dlopen_self=cross
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -11649,9 +12168,9 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
+/* When -fvisibility=hidden is used, assume the code has been annotated
    correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
 int fnord () __attribute__((visibility("default")));
 #endif
 
@@ -11681,7 +12200,7 @@ _LT_EOF
   (eval $ac_link) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -11701,14 +12220,14 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
 $as_echo "$lt_cv_dlopen_self" >&6; }
 
-    if test "x$lt_cv_dlopen_self" = xyes; then
+    if test yes = "$lt_cv_dlopen_self"; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
 if ${lt_cv_dlopen_self_static+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  	  if test "$cross_compiling" = yes; then :
+  	  if test yes = "$cross_compiling"; then :
   lt_cv_dlopen_self_static=cross
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -11755,9 +12274,9 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
+/* When -fvisibility=hidden is used, assume the code has been annotated
    correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
 int fnord () __attribute__((visibility("default")));
 #endif
 
@@ -11787,7 +12306,7 @@ _LT_EOF
   (eval $ac_link) 2>&5
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+  test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then
     (./conftest; exit; ) >&5 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -11808,9 +12327,9 @@ fi
 $as_echo "$lt_cv_dlopen_self_static" >&6; }
     fi
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
     ;;
   esac
 
@@ -11854,7 +12373,7 @@ else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
   darwin*)
-    if test -n "$STRIP" ; then
+    if test -n "$STRIP"; then
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
@@ -11882,7 +12401,7 @@ fi
 
 
 
-  # Report which library types will actually be built
+  # Report what library types will actually be built
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
 $as_echo_n "checking if libtool supports shared libraries... " >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
@@ -11890,13 +12409,13 @@ $as_echo "$can_build_shared" >&6; }
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
 $as_echo_n "checking whether to build shared libraries... " >&6; }
-  test "$can_build_shared" = "no" && enable_shared=no
+  test no = "$can_build_shared" && enable_shared=no
 
   # On AIX, shared libraries and static libraries use the same namespace, and
   # are all built from PIC.
   case $host_os in
   aix3*)
-    test "$enable_shared" = yes && enable_static=no
+    test yes = "$enable_shared" && enable_static=no
     if test -n "$RANLIB"; then
       archive_cmds="$archive_cmds~\$RANLIB \$lib"
       postinstall_cmds='$RANLIB $lib'
@@ -11904,8 +12423,12 @@ $as_echo_n "checking whether to build shared libraries... " >&6; }
     ;;
 
   aix[4-9]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;			# shared object as lib.so file only
+      yes,svr4,*) ;;			# shared object as lib.so archive member only
+      yes,*) enable_static=no ;;	# shared object in lib.a archive as well
+      esac
     fi
     ;;
   esac
@@ -11915,7 +12438,7 @@ $as_echo "$enable_shared" >&6; }
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
 $as_echo_n "checking whether to build static libraries... " >&6; }
   # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
+  test yes = "$enable_shared" || enable_static=yes
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
 $as_echo "$enable_static" >&6; }
 
@@ -11929,7 +12452,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC="$lt_save_CC"
+CC=$lt_save_CC
 
 
 
@@ -13343,7 +13866,7 @@ $as_echo "no" >&6; }
 fi
 
 
-  if test "x$HAVE_ANT" = "xno"; then
+  if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then
       as_fn_error $? "BD-J requires ANT, but ant was not found. Please install it." "$LINENO" 5
   fi
 
@@ -13369,6 +13892,14 @@ else
   USING_BDJAVA_FALSE=
 fi
 
+ if  test $use_bdjava_jar = "yes" ; then
+  USING_BDJAVA_BUILD_JAR_TRUE=
+  USING_BDJAVA_BUILD_JAR_FALSE='#'
+else
+  USING_BDJAVA_BUILD_JAR_TRUE='#'
+  USING_BDJAVA_BUILD_JAR_FALSE=
+fi
+
 
 if test "$BDJ_TYPE" = "j2me"; then
 
@@ -15351,10 +15882,10 @@ BLURAY_VERSION_MAJOR=0
 
 BLURAY_VERSION_MINOR=9
 
-BLURAY_VERSION_MICRO=2
+BLURAY_VERSION_MICRO=3
 
 
-LT_VERSION_INFO="10:2:9"
+LT_VERSION_INFO="11:0:10"
 
 
 
@@ -15509,6 +16040,10 @@ if test -z "${USING_BDJAVA_TRUE}" && test -z "${USING_BDJAVA_FALSE}"; then
   as_fn_error $? "conditional \"USING_BDJAVA\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${USING_BDJAVA_BUILD_JAR_TRUE}" && test -z "${USING_BDJAVA_BUILD_JAR_FALSE}"; then
+  as_fn_error $? "conditional \"USING_BDJAVA_BUILD_JAR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${ENABLE_UDF_TRUE}" && test -z "${ENABLE_UDF_FALSE}"; then
   as_fn_error $? "conditional \"ENABLE_UDF\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -15998,7 +16533,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libbluray $as_me 0.9.2, which was
+This file was extended by libbluray $as_me 0.9.3, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -16064,7 +16599,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libbluray config.status 0.9.2
+libbluray config.status 0.9.3
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
@@ -16199,6 +16734,7 @@ enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
 enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
 pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
 enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`'
 SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
 ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
 PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
@@ -16248,10 +16784,13 @@ compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
 GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`'
 nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
 lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`'
 objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
 MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
 lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
@@ -16316,7 +16855,8 @@ finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
 finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
 hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
 sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`'
+configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`'
 hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
 enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
 enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
@@ -16367,9 +16907,12 @@ CFLAGS \
 compiler \
 lt_cv_sys_global_symbol_pipe \
 lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_import \
 lt_cv_sys_global_symbol_to_c_name_address \
 lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+lt_cv_nm_interface \
 nm_file_list_spec \
+lt_cv_truncate_bin \
 lt_prog_compiler_no_builtin_flag \
 lt_prog_compiler_pic \
 lt_prog_compiler_wl \
@@ -16404,7 +16947,7 @@ old_striplib \
 striplib; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -16431,10 +16974,11 @@ postinstall_cmds \
 postuninstall_cmds \
 finish_cmds \
 sys_lib_search_path_spec \
-sys_lib_dlsearch_path_spec; do
+configure_time_dlsearch_path \
+configure_time_lt_sys_library_path; do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[\\\\\\\`\\"\\\$]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -16443,19 +16987,16 @@ sys_lib_dlsearch_path_spec; do
 done
 
 ac_aux_dir='$ac_aux_dir'
-xsi_shell='$xsi_shell'
-lt_shell_append='$lt_shell_append'
 
-# See if we are running on zsh, and set the options which allow our
+# See if we are running on zsh, and set the options that allow our
 # commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
+if test -n "\${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 
 
     PACKAGE='$PACKAGE'
     VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
     RM='$RM'
     ofile='$ofile'
 
@@ -17166,55 +17707,53 @@ $as_echo X"$file" |
  ;;
     "libtool":C)
 
-    # See if we are running on zsh, and set the options which allow our
+    # See if we are running on zsh, and set the options that allow our
     # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
+    if test -n "${ZSH_VERSION+set}"; then
       setopt NO_GLOB_SUBST
     fi
 
-    cfgfile="${ofile}T"
+    cfgfile=${ofile}T
     trap "$RM \"$cfgfile\"; exit 1" 1 2 15
     $RM "$cfgfile"
 
     cat <<_LT_EOF >> "$cfgfile"
 #! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Generated automatically by $as_me ($PACKAGE) $VERSION
 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
+
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit, 1996
+
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of of the License, or
+# (at your option) any later version.
 #
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program or library that is built
+# using GNU Libtool, you may include this file under the  same
+# distribution terms that you use for the rest of that program.
 #
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
 # The names of the tagged configurations supported by this script.
-available_tags=""
+available_tags=''
+
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
 
 # ### BEGIN LIBTOOL CONFIG
 
@@ -17234,6 +17773,9 @@ pic_mode=$pic_mode
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
+# Shared archive member basename,for filename based shared library versioning on AIX.
+shared_archive_member_spec=$shared_archive_member_spec
+
 # Shell to use when invoking shell scripts.
 SHELL=$lt_SHELL
 
@@ -17351,18 +17893,27 @@ global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 # Transform the output of nm in a proper C declaration.
 global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
 
+# Transform the output of nm into a list of symbols to manually relocate.
+global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import
+
 # Transform the output of nm in a C name address pair.
 global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 
 # Transform the output of nm in a C name address pair when lib prefix is needed.
 global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
+# The name lister interface.
+nm_interface=$lt_lt_cv_nm_interface
+
 # Specify filename containing input files for \$NM.
 nm_file_list_spec=$lt_nm_file_list_spec
 
-# The root where to search for dependent libraries,and in which our libraries should be installed.
+# The root where to search for dependent libraries,and where our libraries should be installed.
 lt_sysroot=$lt_sysroot
 
+# Command to truncate a binary pipe.
+lt_truncate_bin=$lt_lt_cv_truncate_bin
+
 # The name of the directory that contains temporary libtool files.
 objdir=$objdir
 
@@ -17453,8 +18004,11 @@ hardcode_into_libs=$hardcode_into_libs
 # Compile-time system search path for libraries.
 sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
 
-# Run-time system search path for libraries.
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+# Detected run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path
+
+# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
+configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path
 
 # Whether dlopen is supported.
 dlopen_support=$enable_dlopen
@@ -17547,13 +18101,13 @@ hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 # Whether we need a single "-rpath" flag with a separated argument.
 hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
 # DIR into the resulting binary.
 hardcode_direct=$hardcode_direct
 
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes
 # DIR into the resulting binary and the resulting library dependency is
-# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# "absolute",i.e impossible to change by setting \$shlibpath_var if the
 # library is relocated.
 hardcode_direct_absolute=$hardcode_direct_absolute
 
@@ -17605,13 +18159,72 @@ hardcode_action=$hardcode_action
 
 _LT_EOF
 
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x$2 in
+    x)
+        ;;
+    *:)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
+        ;;
+    x:*)
+        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
+        ;;
+    *)
+        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+
+
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in $*""; do
+      case $cc_temp in
+        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
   case $host_os in
   aix3*)
     cat <<\_LT_EOF >> "$cfgfile"
 # AIX sometimes has problems with the GCC collect2 program.  For some
 # reason, if we set the COLLECT_NAMES environment variable, the problems
 # vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
+if test set != "${COLLECT_NAMES+set}"; then
   COLLECT_NAMES=
   export COLLECT_NAMES
 fi
@@ -17620,7 +18233,7 @@ _LT_EOF
   esac
 
 
-ltmain="$ac_aux_dir/ltmain.sh"
+ltmain=$ac_aux_dir/ltmain.sh
 
 
   # We use sed instead of cat because bash on DJGPP gets confused if
@@ -17630,165 +18243,6 @@ ltmain="$ac_aux_dir/ltmain.sh"
   sed '$q' "$ltmain" >> "$cfgfile" \
      || (rm -f "$cfgfile"; exit 1)
 
-  if test x"$xsi_shell" = xyes; then
-  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
-func_dirname ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_basename ()$/,/^} # func_basename /c\
-func_basename ()\
-{\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
-func_dirname_and_basename ()\
-{\
-\    case ${1} in\
-\      */*) func_dirname_result="${1%/*}${2}" ;;\
-\      *  ) func_dirname_result="${3}" ;;\
-\    esac\
-\    func_basename_result="${1##*/}"\
-} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
-func_stripname ()\
-{\
-\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
-\    # positional parameters, so assign one to ordinary parameter first.\
-\    func_stripname_result=${3}\
-\    func_stripname_result=${func_stripname_result#"${1}"}\
-\    func_stripname_result=${func_stripname_result%"${2}"}\
-} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
-func_split_long_opt ()\
-{\
-\    func_split_long_opt_name=${1%%=*}\
-\    func_split_long_opt_arg=${1#*=}\
-} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
-func_split_short_opt ()\
-{\
-\    func_split_short_opt_arg=${1#??}\
-\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
-} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
-func_lo2o ()\
-{\
-\    case ${1} in\
-\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
-\      *)    func_lo2o_result=${1} ;;\
-\    esac\
-} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_xform ()$/,/^} # func_xform /c\
-func_xform ()\
-{\
-    func_xform_result=${1%.*}.lo\
-} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_arith ()$/,/^} # func_arith /c\
-func_arith ()\
-{\
-    func_arith_result=$(( $* ))\
-} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_len ()$/,/^} # func_len /c\
-func_len ()\
-{\
-    func_len_result=${#1}\
-} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  sed -e '/^func_append ()$/,/^} # func_append /c\
-func_append ()\
-{\
-    eval "${1}+=\\${2}"\
-} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
-func_append_quoted ()\
-{\
-\    func_quote_for_eval "${2}"\
-\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
-} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
-$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
-fi
-
-
    mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
@@ -17840,6 +18294,7 @@ echo "  --------"
 echo "  BD-J support:                  $use_bdjava"
 if [ $use_bdjava = "yes" ]; then
 echo "  BD-J type:                     $BDJ_TYPE"
+echo "  build JAR:                     $use_bdjava_jar"
 if test x"$BDJ_BOOTCLASSPATH" != x""; then
 echo "  BD-J bootclasspath:            $BDJ_BOOTCLASSPATH"
 fi
diff --git a/configure.ac b/configure.ac
index e0da375..2c540b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,7 +1,7 @@
 dnl library version number
 m4_define([bluray_major], 0)
 m4_define([bluray_minor], 9)
-m4_define([bluray_micro], 2)
+m4_define([bluray_micro], 3)
 m4_define([bluray_version],[bluray_major.bluray_minor.bluray_micro])
 
 dnl shared library version (.so version)
@@ -12,9 +12,9 @@ dnl - If interfaces have been changed or removed, increase current and set age a
 dnl
 dnl Library file name will be libbluray.so.(current-age).age.revision
 dnl
-m4_define([lt_current],  10)
-m4_define([lt_revision], 2)
-m4_define([lt_age],      9)
+m4_define([lt_current],  11)
+m4_define([lt_revision], 0)
+m4_define([lt_age],      10)
 
 dnl initilization
 AC_INIT([libbluray], bluray_version, [http://www.videolan.org/developers/libbluray.html])
@@ -87,7 +87,15 @@ AC_ARG_ENABLE([bdjava],
   [use_bdjava=yes])
 
 AC_ARG_ENABLE([udf],
-  [AS_HELP_STRING([--enable-udf], [enable UDF support @<:@default=disabled@:>@])])
+  [AS_HELP_STRING([--disable-udf], [disable UDF support @<:@default=enabled@:>@])],
+  [enable_udf=$enableval],
+  [enable_udf=yes])
+
+AC_ARG_ENABLE([bdjava-jar],
+  [AS_HELP_STRING([--disable-bdjava-jar],
+  [disable building of BD-Java JAR file @<:@default=enabled@:>@])],
+  [use_bdjava_jar=$enableval],
+  [use_bdjava_jar=yes])
 
 AC_ARG_WITH([libxml2],
   [AS_HELP_STRING([--without-libxml2], [build without libxml2 support @<:@default=with@:>@])])
@@ -224,7 +232,7 @@ if [[ $use_bdjava = "yes" ]]; then
   ])
 
   AC_CHECK_PROG(HAVE_ANT, [ant], yes, no)
-  if test "x$HAVE_ANT" = "xno"; then
+  if test "x$use_bdjava_jar" = "xyes" && test "x$HAVE_ANT" = "xno"; then
       AC_MSG_ERROR([BD-J requires ANT, but ant was not found. Please install it.])
   fi
 
@@ -233,6 +241,7 @@ if [[ $use_bdjava = "yes" ]]; then
   AC_DEFINE_UNQUOTED([JDK_HOME], ["$JDK_HOME"], [""])
 fi
 AM_CONDITIONAL([USING_BDJAVA], [ test $use_bdjava = "yes" ])
+AM_CONDITIONAL([USING_BDJAVA_BUILD_JAR], [ test $use_bdjava_jar = "yes" ])
 
 dnl BD-J type
 if test "$BDJ_TYPE" = "j2me"; then
@@ -292,6 +301,7 @@ echo "  --------"
 echo "  BD-J support:                  $use_bdjava"
 if [[ $use_bdjava = "yes" ]]; then
 echo "  BD-J type:                     $BDJ_TYPE"
+echo "  build JAR:                     $use_bdjava_jar"
 if test x"$BDJ_BOOTCLASSPATH" != x""; then
 echo "  BD-J bootclasspath:            $BDJ_BOOTCLASSPATH"
 fi
diff --git a/contrib/libudfread/src/default_blockinput.c b/contrib/libudfread/src/default_blockinput.c
index 7a3f6ba..34ebdd1 100644
--- a/contrib/libudfread/src/default_blockinput.c
+++ b/contrib/libudfread/src/default_blockinput.c
@@ -28,7 +28,6 @@
 
 #include <errno.h>
 #include <stdlib.h>
-#include <stdlib.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
@@ -38,6 +37,9 @@
 
 #ifdef _WIN32
 #include <windows.h>
+#ifndef HAVE_UNISTD_H
+#include <stdio.h>
+#endif
 #include <io.h>
 #endif
 
@@ -60,7 +62,8 @@ static ssize_t pread(int fd, void *buf, size_t count, off_t offset)
         return -1;
     }
 
-    ov.Offset     = offset;
+    memset(&ov, 0, sizeof(ov));
+    ov.Offset     = (DWORD)offset;
     ov.OffsetHigh = (offset >> 32);
     if (!ReadFile(handle, buf, count, &got, &ov)) {
         return -1;
diff --git a/contrib/libudfread/src/udfread.c b/contrib/libudfread/src/udfread.c
index ba910aa..7b27410 100644
--- a/contrib/libudfread/src/udfread.c
+++ b/contrib/libudfread/src/udfread.c
@@ -1405,20 +1405,20 @@ uint32_t udfread_read_blocks(UDFFILE *p, void *buf, uint32_t file_block, uint32_
 static ssize_t _read(UDFFILE *p, void *buf, size_t bytes)
 {
     /* start from middle of block ? */
-    int64_t pos_off = p->pos % UDF_BLOCK_SIZE;
+    size_t pos_off = p->pos % UDF_BLOCK_SIZE;
     if (pos_off) {
-        int64_t chunk_size = UDF_BLOCK_SIZE - pos_off;
+        size_t chunk_size = UDF_BLOCK_SIZE - pos_off;
         if (!p->block_valid) {
             if (udfread_read_blocks(p, p->block, p->pos / UDF_BLOCK_SIZE, 1, 0) != 1) {
                 return -1;
             }
             p->block_valid = 1;
         }
-        if (chunk_size > (int64_t)bytes) {
+        if (chunk_size > bytes) {
             chunk_size = bytes;
         }
         memcpy(buf, p->block + pos_off, chunk_size);
-        p->pos += chunk_size;
+        p->pos += (int64_t)chunk_size;
         return chunk_size;
     }
 
@@ -1478,7 +1478,7 @@ ssize_t udfread_file_read(UDFFILE *p, void *buf, size_t bytes)
 
     /* read chunks */
     while (bytes > 0) {
-        int64_t r = _read(p, bufpt, bytes);
+        ssize_t r = _read(p, bufpt, bytes);
         if (r < 0) {
             if (bufpt != buf) {
                 /* got some bytes */
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index d7c043f..10ab284 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1,8 +1,6 @@
 # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
 #
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
+#   Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc.
 #   Written by Gordon Matzigkeit, 1996
 #
 # This file is free software; the Free Software Foundation gives
@@ -10,36 +8,30 @@
 # modifications, as long as this notice is preserved.
 
 m4_define([_LT_COPYING], [dnl
-#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-#                 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-#                 Foundation, Inc.
-#   Written by Gordon Matzigkeit, 1996
-#
-#   This file is part of GNU Libtool.
-#
-# GNU Libtool is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation; either version 2 of
-# the License, or (at your option) any later version.
+# Copyright (C) 2014 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of of the License, or
+# (at your option) any later version.
 #
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program or library that is built
+# using GNU Libtool, you may include this file under the  same
+# distribution terms that you use for the rest of that program.
 #
-# GNU Libtool is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with GNU Libtool; see the file COPYING.  If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ])
 
-# serial 57 LT_INIT
+# serial 58 LT_INIT
 
 
 # LT_PREREQ(VERSION)
@@ -67,7 +59,7 @@ esac
 # LT_INIT([OPTIONS])
 # ------------------
 AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK
 AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
 AC_BEFORE([$0], [LT_LANG])dnl
 AC_BEFORE([$0], [LT_OUTPUT])dnl
@@ -91,7 +83,7 @@ dnl Parse OPTIONS
 _LT_SET_OPTIONS([$0], [$1])
 
 # This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+LIBTOOL_DEPS=$ltmain
 
 # Always use our own libtool.
 LIBTOOL='$(SHELL) $(top_builddir)/libtool'
@@ -111,26 +103,43 @@ dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
 dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
 
 
+# _LT_PREPARE_CC_BASENAME
+# -----------------------
+m4_defun([_LT_PREPARE_CC_BASENAME], [
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+func_cc_basename ()
+{
+    for cc_temp in @S|@*""; do
+      case $cc_temp in
+        compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+        distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+        \-*) ;;
+        *) break;;
+      esac
+    done
+    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+}
+])# _LT_PREPARE_CC_BASENAME
+
+
 # _LT_CC_BASENAME(CC)
 # -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME,
+# but that macro is also expanded into generated libtool script, which
+# arranges for $SED and $ECHO to be set by different means.
 m4_defun([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+[m4_require([_LT_PREPARE_CC_BASENAME])dnl
+AC_REQUIRE([_LT_DECL_SED])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+func_cc_basename $1
+cc_basename=$func_cc_basename_result
 ])
 
 
 # _LT_FILEUTILS_DEFAULTS
 # ----------------------
 # It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'.
 m4_defun([_LT_FILEUTILS_DEFAULTS],
 [: ${CP="cp -f"}
 : ${MV="mv -f"}
@@ -177,15 +186,16 @@ m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
 m4_require([_LT_CMD_OLD_ARCHIVE])dnl
 m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
 m4_require([_LT_WITH_SYSROOT])dnl
+m4_require([_LT_CMD_TRUNCATE])dnl
 
 _LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
+# See if we are running on zsh, and set the options that allow our
 # commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
+if test -n "\${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 ])
-if test -n "${ZSH_VERSION+set}" ; then
+if test -n "${ZSH_VERSION+set}"; then
    setopt NO_GLOB_SUBST
 fi
 
@@ -198,7 +208,7 @@ aix3*)
   # AIX sometimes has problems with the GCC collect2 program.  For some
   # reason, if we set the COLLECT_NAMES environment variable, the problems
   # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
+  if test set != "${COLLECT_NAMES+set}"; then
     COLLECT_NAMES=
     export COLLECT_NAMES
   fi
@@ -209,14 +219,14 @@ esac
 ofile=libtool
 can_build_shared=yes
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
+# All known linkers require a '.a' archive for static linking (except MSVC,
 # which needs '.lib').
 libext=a
 
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+with_gnu_ld=$lt_cv_prog_gnu_ld
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
+old_CC=$CC
+old_CFLAGS=$CFLAGS
 
 # Set sane defaults for various variables
 test -z "$CC" && CC=cc
@@ -269,14 +279,14 @@ no_glob_subst='s/\*/\\\*/g'
 
 # _LT_PROG_LTMAIN
 # ---------------
-# Note that this code is called both from `configure', and `config.status'
+# Note that this code is called both from 'configure', and 'config.status'
 # now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# 'config.status' has no value for ac_aux_dir unless we are using Automake,
 # so we pass a copy along to make sure it has a sensible value anyway.
 m4_defun([_LT_PROG_LTMAIN],
 [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
 _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
+ltmain=$ac_aux_dir/ltmain.sh
 ])# _LT_PROG_LTMAIN
 
 
@@ -286,7 +296,7 @@ ltmain="$ac_aux_dir/ltmain.sh"
 
 # So that we can recreate a full libtool script including additional
 # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
+# in macros and then make a single call at the end using the 'libtool'
 # label.
 
 
@@ -421,8 +431,8 @@ m4_define([_lt_decl_all_varnames],
 
 # _LT_CONFIG_STATUS_DECLARE([VARNAME])
 # ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'.  VARNAME
+# Quote a variable value, and forward it to 'config.status' so that its
+# declaration there will have the same value as in 'configure'.  VARNAME
 # must have a single quote delimited value for this to work.
 m4_define([_LT_CONFIG_STATUS_DECLARE],
 [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
@@ -446,7 +456,7 @@ m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
 # Output comment and list of tags supported by the script
 m4_defun([_LT_LIBTOOL_TAGS],
 [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
+available_tags='_LT_TAGS'dnl
 ])
 
 
@@ -474,7 +484,7 @@ m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
 # _LT_LIBTOOL_CONFIG_VARS
 # -----------------------
 # Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool'
 # script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
 # section) are produced by _LT_LIBTOOL_TAG_VARS.
 m4_defun([_LT_LIBTOOL_CONFIG_VARS],
@@ -500,8 +510,8 @@ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
 # Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
 # variables for single and double quote escaping we saved from calls
 # to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'.  Finally, any additional code accumulated
+# into 'config.status', and then the shell code to quote escape them in
+# for loops in 'config.status'.  Finally, any additional code accumulated
 # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
 m4_defun([_LT_CONFIG_COMMANDS],
 [AC_PROVIDE_IFELSE([LT_OUTPUT],
@@ -547,7 +557,7 @@ for var in lt_decl_all_varnames([[ \
 ]], lt_decl_quote_varnames); do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -560,7 +570,7 @@ for var in lt_decl_all_varnames([[ \
 ]], lt_decl_dquote_varnames); do
     case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
     *[[\\\\\\\`\\"\\\$]]*)
-      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes
       ;;
     *)
       eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
@@ -576,7 +586,7 @@ _LT_OUTPUT_LIBTOOL_INIT
 # Generate a child script FILE with all initialization necessary to
 # reuse the environment learned by the parent script, and make the
 # file executable.  If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins.  After this
+# '#!' sequence but before initialization text begins.  After this
 # macro, additional text can be appended to FILE to form the body of
 # the child script.  The macro ends with non-zero status if the
 # file could not be fully written (such as if the disk is full).
@@ -598,7 +608,7 @@ AS_SHELL_SANITIZE
 _AS_PREPARE
 exec AS_MESSAGE_FD>&1
 _ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
+test 0 = "$lt_write_fail" && chmod +x $1[]dnl
 m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
 
 # LT_OUTPUT
@@ -621,7 +631,7 @@ exec AS_MESSAGE_LOG_FD>>config.log
 } >&AS_MESSAGE_LOG_FD
 
 lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
+'$as_me' creates a local libtool stub from the current configuration,
 for use in further configure time tests before the real libtool is
 generated.
 
@@ -643,7 +653,7 @@ Copyright (C) 2011 Free Software Foundation, Inc.
 This config.lt script is free software; the Free Software Foundation
 gives unlimited permision to copy, distribute and modify it."
 
-while test $[#] != 0
+while test 0 != $[#]
 do
   case $[1] in
     --version | --v* | -V )
@@ -656,10 +666,10 @@ do
       lt_cl_silent=: ;;
 
     -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
+Try '$[0] --help' for more information.]) ;;
 
     *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
+Try '$[0] --help' for more information.]) ;;
   esac
   shift
 done
@@ -685,7 +695,7 @@ chmod +x "$CONFIG_LT"
 # open by configure.  Here we exec the FD to /dev/null, effectively closing
 # config.log, so it can be properly (re)opened and appended to by config.lt.
 lt_cl_success=:
-test "$silent" = yes &&
+test yes = "$silent" &&
   lt_config_lt_args="$lt_config_lt_args --quiet"
 exec AS_MESSAGE_LOG_FD>/dev/null
 $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
@@ -705,27 +715,31 @@ m4_defun([_LT_CONFIG],
 _LT_CONFIG_SAVE_COMMANDS([
   m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
   m4_if(_LT_TAG, [C], [
-    # See if we are running on zsh, and set the options which allow our
+    # See if we are running on zsh, and set the options that allow our
     # commands through without removal of \ escapes.
-    if test -n "${ZSH_VERSION+set}" ; then
+    if test -n "${ZSH_VERSION+set}"; then
       setopt NO_GLOB_SUBST
     fi
 
-    cfgfile="${ofile}T"
+    cfgfile=${ofile}T
     trap "$RM \"$cfgfile\"; exit 1" 1 2 15
     $RM "$cfgfile"
 
     cat <<_LT_EOF >> "$cfgfile"
 #! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Generated automatically by $as_me ($PACKAGE) $VERSION
 # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 # NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
+
+# Provide generalized library-building support services.
+# Written by Gordon Matzigkeit, 1996
+
 _LT_COPYING
 _LT_LIBTOOL_TAGS
 
+# Configured defaults for sys_lib_dlsearch_path munging.
+: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"}
+
 # ### BEGIN LIBTOOL CONFIG
 _LT_LIBTOOL_CONFIG_VARS
 _LT_LIBTOOL_TAG_VARS
@@ -733,13 +747,24 @@ _LT_LIBTOOL_TAG_VARS
 
 _LT_EOF
 
+    cat <<'_LT_EOF' >> "$cfgfile"
+
+# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_PREPARE_MUNGE_PATH_LIST
+_LT_PREPARE_CC_BASENAME
+
+# ### END FUNCTIONS SHARED WITH CONFIGURE
+
+_LT_EOF
+
   case $host_os in
   aix3*)
     cat <<\_LT_EOF >> "$cfgfile"
 # AIX sometimes has problems with the GCC collect2 program.  For some
 # reason, if we set the COLLECT_NAMES environment variable, the problems
 # vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
+if test set != "${COLLECT_NAMES+set}"; then
   COLLECT_NAMES=
   export COLLECT_NAMES
 fi
@@ -756,8 +781,6 @@ _LT_EOF
   sed '$q' "$ltmain" >> "$cfgfile" \
      || (rm -f "$cfgfile"; exit 1)
 
-  _LT_PROG_REPLACE_SHELLFNS
-
    mv -f "$cfgfile" "$ofile" ||
     (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
   chmod +x "$ofile"
@@ -775,7 +798,6 @@ _LT_EOF
 [m4_if([$1], [], [
     PACKAGE='$PACKAGE'
     VERSION='$VERSION'
-    TIMESTAMP='$TIMESTAMP'
     RM='$RM'
     ofile='$ofile'], [])
 ])dnl /_LT_CONFIG_SAVE_COMMANDS
@@ -974,7 +996,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 
     AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
       [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
+      if test -z "$LT_MULTI_MODULE"; then
 	# By default we will add the -single_module flag. You can override
 	# by either setting the environment variable LT_MULTI_MODULE
 	# non-empty at configure time, or by adding -multi_module to the
@@ -992,7 +1014,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
 	# Otherwise, if the output was created with a 0 exit code from
 	# the compiler, it worked.
-	elif test -f libconftest.dylib && test $_lt_result -eq 0; then
+	elif test -f libconftest.dylib && test 0 = "$_lt_result"; then
 	  lt_cv_apple_cc_single_mod=yes
 	else
 	  cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1010,7 +1032,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
       AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
 	[lt_cv_ld_exported_symbols_list=yes],
 	[lt_cv_ld_exported_symbols_list=no])
-	LDFLAGS="$save_LDFLAGS"
+	LDFLAGS=$save_LDFLAGS
     ])
 
     AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
@@ -1032,7 +1054,7 @@ _LT_EOF
       _lt_result=$?
       if test -s conftest.err && $GREP force_load conftest.err; then
 	cat conftest.err >&AS_MESSAGE_LOG_FD
-      elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
+      elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then
 	lt_cv_ld_force_load=yes
       else
 	cat conftest.err >&AS_MESSAGE_LOG_FD
@@ -1042,32 +1064,32 @@ _LT_EOF
     ])
     case $host_os in
     rhapsody* | darwin1.[[012]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;;
     darwin1.*)
-      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+      _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
     darwin*) # darwin 5.x on
       # if running on 10.5 or later, the deployment target defaults
       # to the OS version, if on x86, and 10.4, the deployment
       # target defaults to 10.4. Don't you love it?
       case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
 	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-	10.[[012]]*)
-	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	  _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]][[,.]]*)
+	  _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;;
 	10.*)
-	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	  _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;;
       esac
     ;;
   esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+    if test yes = "$lt_cv_apple_cc_single_mod"; then
       _lt_dar_single_mod='$single_module'
     fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    if test yes = "$lt_cv_ld_exported_symbols_list"; then
+      _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym'
     else
-      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib'
     fi
-    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+    if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then
       _lt_dsymutil='~$DSYMUTIL $lib || :'
     else
       _lt_dsymutil=
@@ -1087,29 +1109,29 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(hardcode_direct, $1)=no
   _LT_TAGVAR(hardcode_automatic, $1)=yes
   _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  if test "$lt_cv_ld_force_load" = "yes"; then
-    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  if test yes = "$lt_cv_ld_force_load"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
     m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
                   [FC],  [_LT_TAGVAR(compiler_needs_object, $1)=yes])
   else
     _LT_TAGVAR(whole_archive_flag_spec, $1)=''
   fi
   _LT_TAGVAR(link_all_deplibs, $1)=yes
-  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
-  if test "$_lt_dar_can_shared" = "yes"; then
+  if test yes = "$_lt_dar_can_shared"; then
     output_verbose_link_cmd=func_echo_all
-    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
     m4_if([$1], [CXX],
-[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+[   if test yes != "$lt_cv_apple_cc_single_mod"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil"
     fi
 ],[])
   else
@@ -1129,7 +1151,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
 # Allow to override them for all tags through lt_cv_aix_libpath.
 m4_defun([_LT_SYS_MODULE_PATH_AIX],
 [m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
+if test set = "${lt_cv_aix_libpath+set}"; then
   aix_libpath=$lt_cv_aix_libpath
 else
   AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
@@ -1147,7 +1169,7 @@ else
     _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
   fi],[])
   if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
-    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib
   fi
   ])
   aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
@@ -1167,8 +1189,8 @@ m4_define([_LT_SHELL_INIT],
 # -----------------------
 # Find how we can fake an echo command that does not interpret backslash.
 # In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
+# of the generated configure script that will find a shell with a builtin
+# printf (that we can use as an echo command).
 m4_defun([_LT_PROG_ECHO_BACKSLASH],
 [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
@@ -1196,10 +1218,10 @@ fi
 # Invoke $ECHO with all args, space-separated.
 func_echo_all ()
 {
-    $ECHO "$*" 
+    $ECHO "$*"
 }
 
-case "$ECHO" in
+case $ECHO in
   printf*) AC_MSG_RESULT([printf]) ;;
   print*) AC_MSG_RESULT([print -r]) ;;
   *) AC_MSG_RESULT([cat]) ;;
@@ -1225,16 +1247,17 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
 AC_DEFUN([_LT_WITH_SYSROOT],
 [AC_MSG_CHECKING([for sysroot])
 AC_ARG_WITH([sysroot],
-[  --with-sysroot[=DIR] Search for dependent libraries within DIR
-                        (or the compiler's sysroot if not specified).],
+[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
+  [Search for dependent libraries within DIR (or the compiler's sysroot
+   if not specified).])],
 [], [with_sysroot=no])
 
 dnl lt_sysroot will always be passed unquoted.  We quote it here
 dnl in case the user passed a directory name.
 lt_sysroot=
-case ${with_sysroot} in #(
+case $with_sysroot in #(
  yes)
-   if test "$GCC" = yes; then
+   if test yes = "$GCC"; then
      lt_sysroot=`$CC --print-sysroot 2>/dev/null`
    fi
    ;; #(
@@ -1244,14 +1267,14 @@ case ${with_sysroot} in #(
  no|'')
    ;; #(
  *)
-   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_RESULT([$with_sysroot])
    AC_MSG_ERROR([The sysroot must be an absolute path.])
    ;;
 esac
 
  AC_MSG_RESULT([${lt_sysroot:-no}])
 _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
+[dependent libraries, and where our libraries should be installed.])])
 
 # _LT_ENABLE_LOCK
 # ---------------
@@ -1259,31 +1282,33 @@ m4_defun([_LT_ENABLE_LOCK],
 [AC_ARG_ENABLE([libtool-lock],
   [AS_HELP_STRING([--disable-libtool-lock],
     [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+test no = "$enable_libtool_lock" || enable_libtool_lock=yes
 
 # Some flags need to be propagated to the compiler or linker for good
 # libtool support.
 case $host in
 ia64-*-hpux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set mode
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.$ac_objext` in
       *ELF-32*)
-	HPUX_IA64_MODE="32"
+	HPUX_IA64_MODE=32
 	;;
       *ELF-64*)
-	HPUX_IA64_MODE="64"
+	HPUX_IA64_MODE=64
 	;;
     esac
   fi
   rm -rf conftest*
   ;;
 *-*-irix6*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
-    if test "$lt_cv_prog_gnu_ld" = yes; then
+    if test yes = "$lt_cv_prog_gnu_ld"; then
       case `/usr/bin/file conftest.$ac_objext` in
 	*32-bit*)
 	  LD="${LD-ld} -melf32bsmip"
@@ -1312,9 +1337,46 @@ ia64-*-hpux*)
   rm -rf conftest*
   ;;
 
+mips64*-*linux*)
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    emul=elf
+    case `/usr/bin/file conftest.$ac_objext` in
+      *32-bit*)
+	emul="${emul}32"
+	;;
+      *64-bit*)
+	emul="${emul}64"
+	;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *MSB*)
+	emul="${emul}btsmip"
+	;;
+      *LSB*)
+	emul="${emul}ltsmip"
+	;;
+    esac
+    case `/usr/bin/file conftest.$ac_objext` in
+      *N32*)
+	emul="${emul}n32"
+	;;
+    esac
+    LD="${LD-ld} -m $emul"
+  fi
+  rm -rf conftest*
+  ;;
+
 x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
 s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.  Note that the listed cases only cover the
+  # situations where additional linker options are needed (such as when
+  # doing 32-bit compilation for a host where ld defaults to 64-bit, or
+  # vice versa); the common cases where no linker options are needed do
+  # not appear in the list.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
@@ -1333,10 +1395,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 		;;
 	    esac
 	    ;;
-	  powerpc64le-*)
+	  powerpc64le-*linux*)
 	    LD="${LD-ld} -m elf32lppclinux"
 	    ;;
-	  powerpc64-*)
+	  powerpc64-*linux*)
 	    LD="${LD-ld} -m elf32ppclinux"
 	    ;;
 	  s390x-*linux*)
@@ -1355,10 +1417,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 	  x86_64-*linux*)
 	    LD="${LD-ld} -m elf_x86_64"
 	    ;;
-	  powerpcle-*)
+	  powerpcle-*linux*)
 	    LD="${LD-ld} -m elf64lppc"
 	    ;;
-	  powerpc-*)
+	  powerpc-*linux*)
 	    LD="${LD-ld} -m elf64ppc"
 	    ;;
 	  s390*-*linux*|s390*-*tpf*)
@@ -1376,19 +1438,20 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
 
 *-*-sco3.2v5*)
   # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
+  SAVE_CFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -belf"
   AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
     [AC_LANG_PUSH(C)
      AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
      AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+  if test yes != "$lt_cv_cc_needs_belf"; then
     # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
+    CFLAGS=$SAVE_CFLAGS
   fi
   ;;
 *-*solaris*)
-  # Find out which ABI we are using.
+  # Find out what ABI is being produced by ac_compile, and set linker
+  # options accordingly.
   echo 'int i;' > conftest.$ac_ext
   if AC_TRY_EVAL(ac_compile); then
     case `/usr/bin/file conftest.o` in
@@ -1396,7 +1459,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
       case $lt_cv_prog_gnu_ld in
       yes*)
         case $host in
-        i?86-*-solaris*)
+        i?86-*-solaris*|x86_64-*-solaris*)
           LD="${LD-ld} -m elf_x86_64"
           ;;
         sparc*-*-solaris*)
@@ -1405,7 +1468,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
         esac
         # GNU ld 2.21 introduced _sol2 emulations.  Use them if available.
         if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
-          LD="${LD-ld}_sol2"
+          LD=${LD-ld}_sol2
         fi
         ;;
       *)
@@ -1421,7 +1484,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
   ;;
 esac
 
-need_locks="$enable_libtool_lock"
+need_locks=$enable_libtool_lock
 ])# _LT_ENABLE_LOCK
 
 
@@ -1440,11 +1503,11 @@ AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
      [echo conftest.$ac_objext > conftest.lst
       lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
       AC_TRY_EVAL([lt_ar_try])
-      if test "$ac_status" -eq 0; then
+      if test 0 -eq "$ac_status"; then
 	# Ensure the archiver fails upon bogus file names.
 	rm -f conftest.$ac_objext libconftest.a
 	AC_TRY_EVAL([lt_ar_try])
-	if test "$ac_status" -ne 0; then
+	if test 0 -ne "$ac_status"; then
           lt_cv_ar_at_file=@
         fi
       fi
@@ -1452,7 +1515,7 @@ AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
      ])
   ])
 
-if test "x$lt_cv_ar_at_file" = xno; then
+if test no = "$lt_cv_ar_at_file"; then
   archiver_list_spec=
 else
   archiver_list_spec=$lt_cv_ar_at_file
@@ -1483,7 +1546,7 @@ old_postuninstall_cmds=
 
 if test -n "$RANLIB"; then
   case $host_os in
-  openbsd*)
+  bitrig* | openbsd*)
     old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
     ;;
   *)
@@ -1519,7 +1582,7 @@ AC_CACHE_CHECK([$1], [$2],
   [$2=no
    m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
    echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
+   lt_compiler_flag="$3"  ## exclude from sc_useless_quotes_in_assignment
    # Insert the option either (1) after the last *FLAGS variable, or
    # (2) before a word containing "conftest.", or (3) at the end.
    # Note that $ac_compile itself does not contain backslashes and begins
@@ -1546,7 +1609,7 @@ AC_CACHE_CHECK([$1], [$2],
    $RM conftest*
 ])
 
-if test x"[$]$2" = xyes; then
+if test yes = "[$]$2"; then
     m4_if([$5], , :, [$5])
 else
     m4_if([$6], , :, [$6])
@@ -1568,7 +1631,7 @@ AC_DEFUN([_LT_LINKER_OPTION],
 m4_require([_LT_DECL_SED])dnl
 AC_CACHE_CHECK([$1], [$2],
   [$2=no
-   save_LDFLAGS="$LDFLAGS"
+   save_LDFLAGS=$LDFLAGS
    LDFLAGS="$LDFLAGS $3"
    echo "$lt_simple_link_test_code" > conftest.$ac_ext
    if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
@@ -1587,10 +1650,10 @@ AC_CACHE_CHECK([$1], [$2],
      fi
    fi
    $RM -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+   LDFLAGS=$save_LDFLAGS
 ])
 
-if test x"[$]$2" = xyes; then
+if test yes = "[$]$2"; then
     m4_if([$4], , :, [$4])
 else
     m4_if([$5], , :, [$5])
@@ -1611,7 +1674,7 @@ AC_DEFUN([LT_CMD_MAX_LEN],
 AC_MSG_CHECKING([the maximum length of command line arguments])
 AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
   i=0
-  teststring="ABCD"
+  teststring=ABCD
 
   case $build_os in
   msdosdjgpp*)
@@ -1651,7 +1714,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+  bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*)
     # This has been around since 386BSD, at least.  Likely further.
     if test -x /sbin/sysctl; then
       lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
@@ -1702,22 +1765,22 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
   *)
     lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
     if test -n "$lt_cv_sys_max_cmd_len" && \
-	test undefined != "$lt_cv_sys_max_cmd_len"; then
+       test undefined != "$lt_cv_sys_max_cmd_len"; then
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
       # Make teststring a little bigger before we do anything with it.
       # a 1K string should be a reasonable start.
-      for i in 1 2 3 4 5 6 7 8 ; do
+      for i in 1 2 3 4 5 6 7 8; do
         teststring=$teststring$teststring
       done
       SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
       # If test is not a shell built-in, we'll probably end up computing a
       # maximum length that is only half of the actual maximum length, but
       # we can't tell.
-      while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
+      while { test X`env echo "$teststring$teststring" 2>/dev/null` \
 	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
-	      test $i != 17 # 1/2 MB should be enough
+	      test 17 != "$i" # 1/2 MB should be enough
       do
         i=`expr $i + 1`
         teststring=$teststring$teststring
@@ -1733,7 +1796,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
     ;;
   esac
 ])
-if test -n $lt_cv_sys_max_cmd_len ; then
+if test -n "$lt_cv_sys_max_cmd_len"; then
   AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
 else
   AC_MSG_RESULT(none)
@@ -1761,7 +1824,7 @@ m4_defun([_LT_HEADER_DLFCN],
 # ----------------------------------------------------------------
 m4_defun([_LT_TRY_DLOPEN_SELF],
 [m4_require([_LT_HEADER_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
+if test yes = "$cross_compiling"; then :
   [$4]
 else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
@@ -1808,9 +1871,9 @@ else
 #  endif
 #endif
 
-/* When -fvisbility=hidden is used, assume the code has been annotated
+/* When -fvisibility=hidden is used, assume the code has been annotated
    correspondingly for the symbols needed.  */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
 int fnord () __attribute__((visibility("default")));
 #endif
 
@@ -1836,7 +1899,7 @@ int main ()
   return status;
 }]
 _LT_EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+  if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then
     (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
     lt_status=$?
     case x$lt_status in
@@ -1857,7 +1920,7 @@ rm -fr conftest*
 # ------------------
 AC_DEFUN([LT_SYS_DLOPEN_SELF],
 [m4_require([_LT_HEADER_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
+if test yes != "$enable_dlopen"; then
   enable_dlopen=unknown
   enable_dlopen_self=unknown
   enable_dlopen_self_static=unknown
@@ -1867,44 +1930,52 @@ else
 
   case $host_os in
   beos*)
-    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen=load_add_on
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ;;
 
   mingw* | pw32* | cegcc*)
-    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen=LoadLibrary
     lt_cv_dlopen_libs=
     ;;
 
   cygwin*)
-    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen=dlopen
     lt_cv_dlopen_libs=
     ;;
 
   darwin*)
-  # if libdl is installed we need to link against it
+    # if libdl is installed we need to link against it
     AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
+		[lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[
+    lt_cv_dlopen=dyld
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ])
     ;;
 
+  tpf*)
+    # Don't try to run any link tests for TPF.  We know it's impossible
+    # because TPF is a cross-compiler, and we know how we open DSOs.
+    lt_cv_dlopen=dlopen
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=no
+    ;;
+
   *)
     AC_CHECK_FUNC([shl_load],
-	  [lt_cv_dlopen="shl_load"],
+	  [lt_cv_dlopen=shl_load],
       [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	    [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld],
 	[AC_CHECK_FUNC([dlopen],
-	      [lt_cv_dlopen="dlopen"],
+	      [lt_cv_dlopen=dlopen],
 	  [AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+		[lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],
 	    [AC_CHECK_LIB([svld], [dlopen],
-		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+		  [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld],
 	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+		    [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld])
 	      ])
 	    ])
 	  ])
@@ -1913,21 +1984,21 @@ else
     ;;
   esac
 
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
+  if test no = "$lt_cv_dlopen"; then
     enable_dlopen=no
+  else
+    enable_dlopen=yes
   fi
 
   case $lt_cv_dlopen in
   dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+    save_CPPFLAGS=$CPPFLAGS
+    test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    save_LDFLAGS="$LDFLAGS"
+    save_LDFLAGS=$LDFLAGS
     wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    save_LIBS="$LIBS"
+    save_LIBS=$LIBS
     LIBS="$lt_cv_dlopen_libs $LIBS"
 
     AC_CACHE_CHECK([whether a program can dlopen itself],
@@ -1937,7 +2008,7 @@ else
 	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
     ])
 
-    if test "x$lt_cv_dlopen_self" = xyes; then
+    if test yes = "$lt_cv_dlopen_self"; then
       wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
       AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
 	  lt_cv_dlopen_self_static, [dnl
@@ -1947,9 +2018,9 @@ else
       ])
     fi
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
+    CPPFLAGS=$save_CPPFLAGS
+    LDFLAGS=$save_LDFLAGS
+    LIBS=$save_LIBS
     ;;
   esac
 
@@ -2041,8 +2112,8 @@ m4_defun([_LT_COMPILER_FILE_LOCKS],
 m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 _LT_COMPILER_C_O([$1])
 
-hard_links="nottested"
-if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+hard_links=nottested
+if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then
   # do not overwrite the value of need_locks provided by the user
   AC_MSG_CHECKING([if we can lock with hard links])
   hard_links=yes
@@ -2052,8 +2123,8 @@ if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" !=
   ln conftest.a conftest.b 2>&5 || hard_links=no
   ln conftest.a conftest.b 2>/dev/null && hard_links=no
   AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+  if test no = "$hard_links"; then
+    AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe])
     need_locks=warn
   fi
 else
@@ -2080,8 +2151,8 @@ objdir=$lt_cv_objdir
 _LT_DECL([], [objdir], [0],
          [The name of the directory that contains temporary libtool files])dnl
 m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
-  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/",
+  [Define to the sub-directory where libtool stores uninstalled libraries.])
 ])# _LT_CHECK_OBJDIR
 
 
@@ -2093,15 +2164,15 @@ m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
 _LT_TAGVAR(hardcode_action, $1)=
 if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
    test -n "$_LT_TAGVAR(runpath_var, $1)" ||
-   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+   test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then
 
   # We can hardcode non-existent directories.
-  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+  if test no != "$_LT_TAGVAR(hardcode_direct, $1)" &&
      # If the only mechanism to avoid hardcoding is shlibpath_var, we
      # have to relink, otherwise we might link with an installed library
      # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+     ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" &&
+     test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then
     # Linking always hardcodes the temporary library directory.
     _LT_TAGVAR(hardcode_action, $1)=relink
   else
@@ -2115,12 +2186,12 @@ else
 fi
 AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
 
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
-   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+if test relink = "$_LT_TAGVAR(hardcode_action, $1)" ||
+   test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then
   # Fast installation is not supported
   enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
+elif test yes = "$shlibpath_overrides_runpath" ||
+     test no = "$enable_shared"; then
   # Fast installation is not necessary
   enable_fast_install=needless
 fi
@@ -2144,7 +2215,7 @@ else
 # FIXME - insert some real tests, host_os isn't really good enough
   case $host_os in
   darwin*)
-    if test -n "$STRIP" ; then
+    if test -n "$STRIP"; then
       striplib="$STRIP -x"
       old_striplib="$STRIP -S"
       AC_MSG_RESULT([yes])
@@ -2162,6 +2233,47 @@ _LT_DECL([], [striplib], [1])
 ])# _LT_CMD_STRIPLIB
 
 
+# _LT_PREPARE_MUNGE_PATH_LIST
+# ---------------------------
+# Make sure func_munge_path_list() is defined correctly.
+m4_defun([_LT_PREPARE_MUNGE_PATH_LIST],
+[[# func_munge_path_list VARIABLE PATH
+# -----------------------------------
+# VARIABLE is name of variable containing _space_ separated list of
+# directories to be munged by the contents of PATH, which is string
+# having a format:
+# "DIR[:DIR]:"
+#       string "DIR[ DIR]" will be prepended to VARIABLE
+# ":DIR[:DIR]"
+#       string "DIR[ DIR]" will be appended to VARIABLE
+# "DIRP[:DIRP]::[DIRA:]DIRA"
+#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
+#       "DIRA[ DIRA]" will be appended to VARIABLE
+# "DIR[:DIR]"
+#       VARIABLE will be replaced by "DIR[ DIR]"
+func_munge_path_list ()
+{
+    case x at S|@2 in
+    x)
+        ;;
+    *:)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\"
+        ;;
+    x:*)
+        eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    *::*)
+        eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
+        eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\"
+        ;;
+    *)
+        eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\"
+        ;;
+    esac
+}
+]])# _LT_PREPARE_PATH_LIST
+
+
 # _LT_SYS_DYNAMIC_LINKER([TAG])
 # -----------------------------
 # PORTME Fill in your ld.so characteristics
@@ -2172,17 +2284,18 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_OBJDUMP])dnl
 m4_require([_LT_DECL_SED])dnl
 m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl
 AC_MSG_CHECKING([dynamic linker characteristics])
 m4_if([$1],
 	[], [
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
+    darwin*) lt_awk_arg='/^libraries:/,/LR/' ;;
+    *) lt_awk_arg='/^libraries:/' ;;
   esac
   case $host_os in
-    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
-    *) lt_sed_strip_eq="s,=/,/,g" ;;
+    mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;;
+    *) lt_sed_strip_eq='s|=/|/|g' ;;
   esac
   lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
   case $lt_search_path_spec in
@@ -2198,28 +2311,35 @@ if test "$GCC" = yes; then
     ;;
   esac
   # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
+  # and add multilib dir if necessary...
   lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  # ...but if some path component already ends with the multilib dir we assume
+  # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer).
+  case "$lt_multi_os_dir; $lt_search_path_spec " in
+  "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*)
+    lt_multi_os_dir=
+    ;;
+  esac
   for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
+    if test -d "$lt_sys_path$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir"
+    elif test -n "$lt_multi_os_dir"; then
       test -d "$lt_sys_path" && \
 	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
     fi
   done
   lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
+BEGIN {RS = " "; FS = "/|\n";} {
+  lt_foo = "";
+  lt_count = 0;
   for (lt_i = NF; lt_i > 0; lt_i--) {
     if ($lt_i != "" && $lt_i != ".") {
       if ($lt_i == "..") {
         lt_count++;
       } else {
         if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
+          lt_foo = "/" $lt_i lt_foo;
         } else {
           lt_count--;
         }
@@ -2233,7 +2353,7 @@ BEGIN {RS=" "; FS="/|\n";} {
   # for these hosts.
   case $host_os in
     mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
-      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+      $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;;
   esac
   sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
 else
@@ -2242,7 +2362,7 @@ fi])
 library_names_spec=
 libname_spec='lib$name'
 soname_spec=
-shrext_cmds=".so"
+shrext_cmds=.so
 postinstall_cmds=
 postuninstall_cmds=
 finish_cmds=
@@ -2259,14 +2379,17 @@ hardcode_into_libs=no
 # flags to be left without arguments
 need_version=unknown
 
+AC_ARG_VAR([LT_SYS_LIBRARY_PATH],
+[User-defined run-time library search path.])
+
 case $host_os in
 aix3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname.a'
   shlibpath_var=LIBPATH
 
   # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
+  soname_spec='$libname$release$shared_ext$major'
   ;;
 
 aix[[4-9]]*)
@@ -2274,41 +2397,91 @@ aix[[4-9]]*)
   need_lib_prefix=no
   need_version=no
   hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext'
     shlibpath_var=LD_LIBRARY_PATH
   else
     # With GCC up to 2.95.x, collect2 would create an import file
     # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
+    # the line '#! .'.  This would cause the generated library to
+    # depend on '.', always an invalid library.  This was fixed in
     # development snapshots of GCC prior to 3.0.
     case $host_os in
       aix4 | aix4.[[01]] | aix4.[[01]].*)
       if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
 	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	   echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then
 	:
       else
 	can_build_shared=no
       fi
       ;;
     esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # Using Import Files as archive members, it is possible to support
+    # filename-based versioning of shared library archives on AIX. While
+    # this would work for both with and without runtime linking, it will
+    # prevent static linking of such archives. So we do filename-based
+    # shared library versioning with .so extension only, which is used
+    # when both runtime linking and shared linking is enabled.
+    # Unfortunately, runtime linking may impact performance, so we do
+    # not want this to be the default eventually. Also, we use the
+    # versioned .so libs for executables only if there is the -brtl
+    # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only.
+    # To allow for filename-based versioning support, we need to create
+    # libNAME.so.V as an archive file, containing:
+    # *) an Import File, referring to the versioned filename of the
+    #    archive as well as the shared archive member, telling the
+    #    bitwidth (32 or 64) of that shared object, and providing the
+    #    list of exported symbols of that shared object, eventually
+    #    decorated with the 'weak' keyword
+    # *) the shared object with the F_LOADONLY flag set, to really avoid
+    #    it being seen by the linker.
+    # At run time we better use the real file rather than another symlink,
+    # but for link time we create the symlink libNAME.so -> libNAME.so.V
+
+    case $with_aix_soname,$aix_use_runtimelinking in
+    # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct
     # soname into executable. Probably we can add versioning support to
     # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
+    aix,yes) # traditional libtool
+      dynamic_linker='AIX unversionable lib.so'
       # If using run time linking (on AIX 4.2 or later) use lib<name>.so
       # instead of lib<name>.a to let people know that these are not
       # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      ;;
+    aix,no) # traditional AIX only
+      dynamic_linker='AIX lib.a[(]lib.so.V[)]'
       # We preserve .a as extension for shared libraries through AIX4.2
       # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      ;;
+    svr4,*) # full svr4 only
+      dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,yes) # both, prefer svr4
+      dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]"
+      library_names_spec='$libname$release$shared_ext$major $libname$shared_ext'
+      # unpreferred sharedlib libNAME.a needs extra handling
+      postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"'
+      postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"'
+      # We do not specify a path in Import Files, so LIBPATH fires.
+      shlibpath_overrides_runpath=yes
+      ;;
+    *,no) # both, prefer aix
+      dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]"
+      library_names_spec='$libname$release.a $libname.a'
+      soname_spec='$libname$release$shared_ext$major'
+      # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling
+      postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)'
+      postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"'
+      ;;
+    esac
     shlibpath_var=LIBPATH
   fi
   ;;
@@ -2318,18 +2491,18 @@ amigaos*)
   powerpc)
     # Since July 2007 AmigaOS4 officially supports .so libraries.
     # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
     ;;
   m68k)
     library_names_spec='$libname.ixlibrary $libname.a'
     # Create ${libname}_ixlibrary.a entries in /sys/libs.
-    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
     ;;
   esac
   ;;
 
 beos*)
-  library_names_spec='${libname}${shared_ext}'
+  library_names_spec='$libname$shared_ext'
   dynamic_linker="$host_os ld.so"
   shlibpath_var=LIBRARY_PATH
   ;;
@@ -2337,8 +2510,8 @@ beos*)
 bsdi[[45]]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
@@ -2350,7 +2523,7 @@ bsdi[[45]]*)
 
 cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
-  shrext_cmds=".dll"
+  shrext_cmds=.dll
   need_version=no
   need_lib_prefix=no
 
@@ -2359,8 +2532,8 @@ cygwin* | mingw* | pw32* | cegcc*)
     # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname~
@@ -2376,17 +2549,17 @@ cygwin* | mingw* | pw32* | cegcc*)
     case $host_os in
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
 m4_if([$1], [],[
       sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
       ;;
     mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
       ;;
     esac
     dynamic_linker='Win32 ld.exe'
@@ -2395,8 +2568,8 @@ m4_if([$1], [],[
   *,cl*)
     # Native MSVC
     libname_spec='$name'
-    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-    library_names_spec='${libname}.dll.lib'
+    soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext'
+    library_names_spec='$libname.dll.lib'
 
     case $build_os in
     mingw*)
@@ -2423,7 +2596,7 @@ m4_if([$1], [],[
       sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
       ;;
     *)
-      sys_lib_search_path_spec="$LIB"
+      sys_lib_search_path_spec=$LIB
       if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
         # It is most probably a Windows format PATH.
         sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
@@ -2436,8 +2609,8 @@ m4_if([$1], [],[
     esac
 
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+    postinstall_cmds='base_file=`basename \$file`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname'
@@ -2450,7 +2623,7 @@ m4_if([$1], [],[
 
   *)
     # Assume MSVC wrapper
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib'
     dynamic_linker='Win32 ld.exe'
     ;;
   esac
@@ -2463,8 +2636,8 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
+  library_names_spec='$libname$release$major$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$major$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
@@ -2477,8 +2650,8 @@ dgux*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -2496,12 +2669,13 @@ freebsd* | dragonfly*)
   version_type=freebsd-$objformat
   case $version_type in
     freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+      soname_spec='$libname$release$shared_ext$major'
       need_version=no
       need_lib_prefix=no
       ;;
     freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
       need_version=yes
       ;;
   esac
@@ -2531,10 +2705,10 @@ haiku*)
   need_lib_prefix=no
   need_version=no
   dynamic_linker="$host_os runtime_loader"
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
+  shlibpath_overrides_runpath=no
   sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
   hardcode_into_libs=yes
   ;;
@@ -2552,14 +2726,15 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.so"
     shlibpath_var=LD_LIBRARY_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
+    if test 32 = "$HPUX_IA64_MODE"; then
       sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux32
     else
       sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+      sys_lib_dlsearch_path_spec=/usr/lib/hpux64
     fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
   hppa*64*)
     shrext_cmds='.sl'
@@ -2567,8 +2742,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
@@ -2577,8 +2752,8 @@ hpux9* | hpux10* | hpux11*)
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=SHLIB_PATH
     shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     ;;
   esac
   # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
@@ -2591,8 +2766,8 @@ interix[[3-9]]*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -2603,7 +2778,7 @@ irix5* | irix6* | nonstopux*)
   case $host_os in
     nonstopux*) version_type=nonstopux ;;
     *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
+	if test yes = "$lt_cv_prog_gnu_ld"; then
 		version_type=linux # correct to gnu/linux during the next big refactor
 	else
 		version_type=irix
@@ -2611,8 +2786,8 @@ irix5* | irix6* | nonstopux*)
   esac
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext'
   case $host_os in
   irix5* | nonstopux*)
     libsuff= shlibsuff=
@@ -2631,8 +2806,8 @@ irix5* | irix6* | nonstopux*)
   esac
   shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
   shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff"
+  sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff"
   hardcode_into_libs=yes
   ;;
 
@@ -2641,13 +2816,33 @@ linux*oldld* | linux*aout* | linux*coff*)
   dynamic_linker=no
   ;;
 
+linux*android*)
+  version_type=none # Android doesn't support versioned libraries.
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='$libname$release$shared_ext'
+  soname_spec='$libname$release$shared_ext'
+  finish_cmds=
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  dynamic_linker='Android linker'
+  # Don't embed -rpath directories since the linker doesn't support them.
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+  ;;
+
 # This must be glibc/ELF.
 linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
@@ -2672,7 +2867,12 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
   # before this can be enabled.
   hardcode_into_libs=yes
 
-  # Append ld.so.conf contents to the search path
+  # Ideally, we could use ldconfig to report *all* directores which are
+  # searched for libraries, however this is still not possible.  Aside from not
+  # being certain /sbin/ldconfig is available, command
+  # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64,
+  # even though it is searched at run-time.  Try to do the best guess by
+  # appending ld.so.conf contents (and includes) to the search path.
   if test -f /etc/ld.so.conf; then
     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
@@ -2704,12 +2904,12 @@ netbsd*)
   need_lib_prefix=no
   need_version=no
   if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
   else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
+    library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+    soname_spec='$libname$release$shared_ext$major'
     dynamic_linker='NetBSD ld.elf_so'
   fi
   shlibpath_var=LD_LIBRARY_PATH
@@ -2719,7 +2919,7 @@ netbsd*)
 
 newsos6)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   ;;
@@ -2728,58 +2928,68 @@ newsos6)
   version_type=qnx
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
   dynamic_linker='ldqnx.so'
   ;;
 
-openbsd*)
+openbsd* | bitrig*)
   version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
+  sys_lib_dlsearch_path_spec=/usr/lib
   need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
-    *)				need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
+    need_version=no
   else
-    shlibpath_overrides_runpath=yes
+    need_version=yes
   fi
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
   ;;
 
 os2*)
   libname_spec='$name'
-  shrext_cmds=".dll"
+  version_type=windows
+  shrext_cmds=.dll
+  need_version=no
   need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
+  # OS/2 can only load a DLL with a base name of 8 characters or less.
+  soname_spec='`test -n "$os2dllname" && libname="$os2dllname";
+    v=$($ECHO $release$versuffix | tr -d .-);
+    n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _);
+    $ECHO $n$v`$shared_ext'
+  library_names_spec='${libname}_dll.$libext'
   dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
+  shlibpath_var=BEGINLIBPATH
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+  postinstall_cmds='base_file=`basename \$file`~
+    dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~
+    dldir=$destdir/`dirname \$dlpath`~
+    test -d \$dldir || mkdir -p \$dldir~
+    $install_prog $dir/$dlname \$dldir/$dlname~
+    chmod a+x \$dldir/$dlname~
+    if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+      eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+    fi'
+  postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~
+    dlpath=$dir/\$dldll~
+    $RM \$dlpath'
   ;;
 
 osf3* | osf4* | osf5*)
   version_type=osf
   need_lib_prefix=no
   need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='$libname$release$shared_ext$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
   ;;
 
 rdos*)
@@ -2790,8 +3000,8 @@ solaris*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
@@ -2801,11 +3011,11 @@ solaris*)
 
 sunos4*)
   version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix'
   finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     need_lib_prefix=no
   fi
   need_version=yes
@@ -2813,8 +3023,8 @@ sunos4*)
 
 sysv4 | sysv4.3*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   case $host_vendor in
     sni)
@@ -2835,24 +3045,24 @@ sysv4 | sysv4.3*)
   ;;
 
 sysv4*MP*)
-  if test -d /usr/nec ;then
+  if test -d /usr/nec; then
     version_type=linux # correct to gnu/linux during the next big refactor
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
+    library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext'
+    soname_spec='$libname$shared_ext.$major'
     shlibpath_var=LD_LIBRARY_PATH
   fi
   ;;
 
 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
+  version_type=sco
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
   else
     sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
@@ -2870,7 +3080,7 @@ tpf*)
   version_type=linux # correct to gnu/linux during the next big refactor
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
   hardcode_into_libs=yes
@@ -2878,8 +3088,8 @@ tpf*)
 
 uts4*)
   version_type=linux # correct to gnu/linux during the next big refactor
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext'
+  soname_spec='$libname$release$shared_ext$major'
   shlibpath_var=LD_LIBRARY_PATH
   ;;
 
@@ -2888,20 +3098,30 @@ uts4*)
   ;;
 esac
 AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
+test no = "$dynamic_linker" && can_build_shared=no
 
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then
+  sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec
 fi
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+
+if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then
+  sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec
 fi
 
+# remember unaugmented sys_lib_dlsearch_path content for libtool script decls...
+configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec
+
+# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code
+func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH"
+
+# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool
+configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH
+
 _LT_DECL([], [variables_saved_for_relink], [1],
     [Variables whose values should be saved in libtool wrapper scripts and
     restored at link time])
@@ -2934,39 +3154,41 @@ _LT_DECL([], [hardcode_into_libs], [0],
     [Whether we should hardcode library paths into libraries])
 _LT_DECL([], [sys_lib_search_path_spec], [2],
     [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
-    [Run-time system search path for libraries])
+_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2],
+    [Detected run-time system search path for libraries])
+_LT_DECL([], [configure_time_lt_sys_library_path], [2],
+    [Explicit LT_SYS_LIBRARY_PATH set during ./configure time])
 ])# _LT_SYS_DYNAMIC_LINKER
 
 
 # _LT_PATH_TOOL_PREFIX(TOOL)
 # --------------------------
-# find a file program which can recognize shared library
+# find a file program that can recognize shared library
 AC_DEFUN([_LT_PATH_TOOL_PREFIX],
 [m4_require([_LT_DECL_EGREP])dnl
 AC_MSG_CHECKING([for $1])
 AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
 [case $MAGIC_CMD in
 [[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path.
   ;;
 *)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_MAGIC_CMD=$MAGIC_CMD
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
 dnl $ac_dummy forces splitting on constant user-supplied paths.
 dnl POSIX.2 word splitting is done only on the output of word expansions,
 dnl not every word.  This closes a longstanding sh security hole.
   ac_dummy="m4_if([$2], , $PATH, [$2])"
   for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+    if test -f "$ac_dir/$1"; then
+      lt_cv_path_MAGIC_CMD=$ac_dir/"$1"
       if test -n "$file_magic_test_file"; then
 	case $deplibs_check_method in
 	"file_magic "*)
 	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
 	    $EGREP "$file_magic_regex" > /dev/null; then
 	    :
@@ -2989,11 +3211,11 @@ _LT_EOF
       break
     fi
   done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  IFS=$lt_save_ifs
+  MAGIC_CMD=$lt_save_MAGIC_CMD
   ;;
 esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+MAGIC_CMD=$lt_cv_path_MAGIC_CMD
 if test -n "$MAGIC_CMD"; then
   AC_MSG_RESULT($MAGIC_CMD)
 else
@@ -3011,7 +3233,7 @@ dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
 
 # _LT_PATH_MAGIC
 # --------------
-# find a file program which can recognize a shared library
+# find a file program that can recognize a shared library
 m4_defun([_LT_PATH_MAGIC],
 [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
 if test -z "$lt_cv_path_MAGIC_CMD"; then
@@ -3038,16 +3260,16 @@ m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
 AC_ARG_WITH([gnu-ld],
     [AS_HELP_STRING([--with-gnu-ld],
 	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
+    [test no = "$withval" || with_gnu_ld=yes],
     [with_gnu_ld=no])dnl
 
 ac_prog=ld
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   # Check if gcc -print-prog-name=ld gives a path.
   AC_MSG_CHECKING([for ld used by $CC])
   case $host in
   *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
+    # gcc leaves a trailing carriage return, which upsets mingw
     ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
   *)
     ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
@@ -3061,7 +3283,7 @@ if test "$GCC" = yes; then
       while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
 	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
       done
-      test -z "$LD" && LD="$ac_prog"
+      test -z "$LD" && LD=$ac_prog
       ;;
   "")
     # If it fails, then pretend we aren't using GCC.
@@ -3072,37 +3294,37 @@ if test "$GCC" = yes; then
     with_gnu_ld=unknown
     ;;
   esac
-elif test "$with_gnu_ld" = yes; then
+elif test yes = "$with_gnu_ld"; then
   AC_MSG_CHECKING([for GNU ld])
 else
   AC_MSG_CHECKING([for non-GNU ld])
 fi
 AC_CACHE_VAL(lt_cv_path_LD,
 [if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
   for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
     test -z "$ac_dir" && ac_dir=.
     if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
+      lt_cv_path_LD=$ac_dir/$ac_prog
       # Check to see if the program is GNU ld.  I'd rather use --version,
       # but apparently some variants of GNU ld only accept -v.
       # Break only if it was the GNU/non-GNU ld that we prefer.
       case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
       *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
+	test no != "$with_gnu_ld" && break
 	;;
       *)
-	test "$with_gnu_ld" != yes && break
+	test yes != "$with_gnu_ld" && break
 	;;
       esac
     fi
   done
-  IFS="$lt_save_ifs"
+  IFS=$lt_save_ifs
 else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+  lt_cv_path_LD=$LD # Let the user override the test with a path.
 fi])
-LD="$lt_cv_path_LD"
+LD=$lt_cv_path_LD
 if test -n "$LD"; then
   AC_MSG_RESULT($LD)
 else
@@ -3156,13 +3378,13 @@ esac
 reload_cmds='$LD$reload_flag -o $output$reload_objs'
 case $host_os in
   cygwin* | mingw* | pw32* | cegcc*)
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       reload_cmds=false
     fi
     ;;
   darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    if test yes = "$GCC"; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs'
     else
       reload_cmds='$LD$reload_flag -o $output$reload_objs'
     fi
@@ -3173,6 +3395,43 @@ _LT_TAGDECL([], [reload_cmds], [2])dnl
 ])# _LT_CMD_RELOAD
 
 
+# _LT_PATH_DD
+# -----------
+# find a working dd
+m4_defun([_LT_PATH_DD],
+[AC_CACHE_CHECK([for a working dd], [ac_cv_path_lt_DD],
+[printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+: ${lt_DD:=$DD}
+AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd],
+[if "$ac_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=:
+fi])
+rm -f conftest.i conftest2.i conftest.out])
+])# _LT_PATH_DD
+
+
+# _LT_CMD_TRUNCATE
+# ----------------
+# find command to truncate a binary pipe
+m4_defun([_LT_CMD_TRUNCATE],
+[m4_require([_LT_PATH_DD])
+AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin],
+[printf 0123456789abcdef0123456789abcdef >conftest.i
+cat conftest.i conftest.i >conftest2.i
+lt_cv_truncate_bin=
+if "$ac_cv_path_lt_DD" bs=32 count=1 <conftest2.i >conftest.out 2>/dev/null; then
+  cmp -s conftest.i conftest.out \
+  && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1"
+fi
+rm -f conftest.i conftest2.i conftest.out
+test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"])
+_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1],
+  [Command to truncate a binary pipe])
+])# _LT_CMD_TRUNCATE
+
+
 # _LT_CHECK_MAGIC_METHOD
 # ----------------------
 # how to check for library dependencies
@@ -3188,13 +3447,13 @@ lt_cv_deplibs_check_method='unknown'
 # Need to set the preceding variable on all platforms that support
 # interlibrary dependencies.
 # 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
+# 'unknown' -- same as none, but documents that we really don't know.
 # 'pass_all' -- all dependencies passed with no checks.
 # 'test_compile' -- check by making test program.
 # 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+# that responds to the $file_magic_cmd with a given extended regex.
+# If you have 'file' or equivalent on your system and you're not sure
+# whether 'pass_all' will *always* work, you probably want this one.
 
 case $host_os in
 aix[[4-9]]*)
@@ -3221,8 +3480,7 @@ mingw* | pw32*)
   # Base MSYS/MinGW do not provide the 'file' command needed by
   # func_win32_libid shell function, so use a weaker test based on 'objdump',
   # unless we find 'file', for example because we are cross-compiling.
-  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
-  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+  if ( file / ) >/dev/null 2>&1; then
     lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
     lt_cv_file_magic_cmd='func_win32_libid'
   else
@@ -3318,8 +3576,8 @@ newos6*)
   lt_cv_deplibs_check_method=pass_all
   ;;
 
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+openbsd* | bitrig*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
   else
     lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
@@ -3372,6 +3630,9 @@ sysv4 | sysv4.3*)
 tpf*)
   lt_cv_deplibs_check_method=pass_all
   ;;
+os2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 esac
 ])
 
@@ -3412,33 +3673,38 @@ AC_DEFUN([LT_PATH_NM],
 AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
 [if test -n "$NM"; then
   # Let the user override the test.
-  lt_cv_path_NM="$NM"
+  lt_cv_path_NM=$NM
 else
-  lt_nm_to_check="${ac_tool_prefix}nm"
+  lt_nm_to_check=${ac_tool_prefix}nm
   if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
     lt_nm_to_check="$lt_nm_to_check nm"
   fi
   for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR
     for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+      tmp_nm=$ac_dir/$lt_tmp_nm
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then
 	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	# Adding the 'sed 1q' prevents false positives on HP-UX, which says:
 	#   nm: unknown option "B" ignored
 	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
+	# MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty
+	case $build_os in
+	mingw*) lt_bad_file=conftest.nm/nofile ;;
+	*) lt_bad_file=/dev/null ;;
+	esac
+	case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in
+	*$lt_bad_file* | *'Invalid file or object type'*)
 	  lt_cv_path_NM="$tmp_nm -B"
-	  break
+	  break 2
 	  ;;
 	*)
 	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
 	  */dev/null*)
 	    lt_cv_path_NM="$tmp_nm -p"
-	    break
+	    break 2
 	    ;;
 	  *)
 	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
@@ -3449,21 +3715,21 @@ else
 	esac
       fi
     done
-    IFS="$lt_save_ifs"
+    IFS=$lt_save_ifs
   done
   : ${lt_cv_path_NM=no}
 fi])
-if test "$lt_cv_path_NM" != "no"; then
-  NM="$lt_cv_path_NM"
+if test no != "$lt_cv_path_NM"; then
+  NM=$lt_cv_path_NM
 else
   # Didn't find any BSD compatible name lister, look for dumpbin.
   if test -n "$DUMPBIN"; then :
     # Let the user override the test.
   else
     AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
-    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in
     *COFF*)
-      DUMPBIN="$DUMPBIN -symbols"
+      DUMPBIN="$DUMPBIN -symbols -headers"
       ;;
     *)
       DUMPBIN=:
@@ -3471,8 +3737,8 @@ else
     esac
   fi
   AC_SUBST([DUMPBIN])
-  if test "$DUMPBIN" != ":"; then
-    NM="$DUMPBIN"
+  if test : != "$DUMPBIN"; then
+    NM=$DUMPBIN
   fi
 fi
 test -z "$NM" && NM=nm
@@ -3518,8 +3784,8 @@ lt_cv_sharedlib_from_linklib_cmd,
 
 case $host_os in
 cygwin* | mingw* | pw32* | cegcc*)
-  # two different shell functions defined in ltmain.sh
-  # decide which to use based on capabilities of $DLLTOOL
+  # two different shell functions defined in ltmain.sh;
+  # decide which one to use based on capabilities of $DLLTOOL
   case `$DLLTOOL --help 2>&1` in
   *--identify-strict*)
     lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
@@ -3531,7 +3797,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   ;;
 *)
   # fallback: assume linklib IS sharedlib
-  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  lt_cv_sharedlib_from_linklib_cmd=$ECHO
   ;;
 esac
 ])
@@ -3558,13 +3824,28 @@ AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool
     lt_cv_path_mainfest_tool=yes
   fi
   rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
+if test yes != "$lt_cv_path_mainfest_tool"; then
   MANIFEST_TOOL=:
 fi
 _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
 ])# _LT_PATH_MANIFEST_TOOL
 
 
+# _LT_DLL_DEF_P([FILE])
+# ---------------------
+# True iff FILE is a Windows DLL '.def' file.
+# Keep in sync with func_dll_def_p in the libtool script
+AC_DEFUN([_LT_DLL_DEF_P],
+[dnl
+  test DEF = "`$SED -n dnl
+    -e '\''s/^[[	 ]]*//'\'' dnl Strip leading whitespace
+    -e '\''/^\(;.*\)*$/d'\'' dnl      Delete empty lines and comments
+    -e '\''s/^\(EXPORTS\|LIBRARY\)\([[	 ]].*\)*$/DEF/p'\'' dnl
+    -e q dnl                          Only consider the first "real" line
+    $1`" dnl
+])# _LT_DLL_DEF_P
+
+
 # LT_LIB_M
 # --------
 # check for math library
@@ -3576,11 +3857,11 @@ case $host in
   # These system don't have libm, or don't need it
   ;;
 *-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw)
   AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
   ;;
 *)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  AC_CHECK_LIB(m, cos, LIBM=-lm)
   ;;
 esac
 AC_SUBST([LIBM])
@@ -3599,7 +3880,7 @@ m4_defun([_LT_COMPILER_NO_RTTI],
 
 _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
 
-if test "$GCC" = yes; then
+if test yes = "$GCC"; then
   case $cc_basename in
   nvcc*)
     _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
@@ -3651,7 +3932,7 @@ cygwin* | mingw* | pw32* | cegcc*)
   symcode='[[ABCDGISTW]]'
   ;;
 hpux*)
-  if test "$host_cpu" = ia64; then
+  if test ia64 = "$host_cpu"; then
     symcode='[[ABCDEGRST]]'
   fi
   ;;
@@ -3684,14 +3965,44 @@ case `$NM -V 2>&1` in
   symcode='[[ABCDGIRSTW]]' ;;
 esac
 
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  # Gets list of data symbols to import.
+  lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'"
+  # Adjust the below global symbol transforms to fixup imported variables.
+  lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'"
+  lt_c_name_hook=" -e 's/^I .* \(.*\)$/  {\"\1\", (void *) 0},/p'"
+  lt_c_name_lib_hook="\
+  -e 's/^I .* \(lib.*\)$/  {\"\1\", (void *) 0},/p'\
+  -e 's/^I .* \(.*\)$/  {\"lib\1\", (void *) 0},/p'"
+else
+  # Disable hooks by default.
+  lt_cv_sys_global_symbol_to_import=
+  lt_cdecl_hook=
+  lt_c_name_hook=
+  lt_c_name_lib_hook=
+fi
+
 # Transform an extracted symbol line into a proper C declaration.
 # Some systems (esp. on ia64) link data and code symbols differently,
 # so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+lt_cv_sys_global_symbol_to_cdecl="sed -n"\
+$lt_cdecl_hook\
+" -e 's/^T .* \(.*\)$/extern int \1();/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'"
 
 # Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address="sed -n"\
+$lt_c_name_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/p'"
+
+# Transform an extracted symbol line into symbol name with lib prefix and
+# symbol address.
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\
+$lt_c_name_lib_hook\
+" -e 's/^: \(.*\) .*$/  {\"\1\", (void *) 0},/p'"\
+" -e 's/^$symcode$symcode* .* \(lib.*\)$/  {\"\1\", (void *) \&\1},/p'"\
+" -e 's/^$symcode$symcode* .* \(.*\)$/  {\"lib\1\", (void *) \&\1},/p'"
 
 # Handle CRLF in mingw tool chain
 opt_cr=
@@ -3709,21 +4020,24 @@ for ac_symprfx in "" "_"; do
 
   # Write the raw and C identifiers.
   if test "$lt_cv_nm_interface" = "MS dumpbin"; then
-    # Fake it for dumpbin and say T for any non-static function
-    # and D for any global variable.
+    # Fake it for dumpbin and say T for any non-static function,
+    # D for any global variable and I for any imported variable.
     # Also find C++ and __fastcall symbols from MSVC++,
     # which start with @ or ?.
     lt_cv_sys_global_symbol_pipe="$AWK ['"\
 "     {last_section=section; section=\$ 3};"\
 "     /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
 "     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\
+"     /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\
+"     /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\
 "     \$ 0!~/External *\|/{next};"\
 "     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
 "     {if(hide[section]) next};"\
-"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
-"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\
+"     {split(\$ 0,a,/\||\r/); split(a[2],s)};"\
+"     s[1]~/^[@?]/{print f,s[1],s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\
 "     ' prfx=^$ac_symprfx]"
   else
     lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
@@ -3763,11 +4077,11 @@ _LT_EOF
 	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
 	  cat <<_LT_EOF > conftest.$ac_ext
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
    relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT@&t at _DLSYM_CONST
-#elif defined(__osf__)
+#elif defined __osf__
 /* This system does not cope well with relocations in const data.  */
 # define LT@&t at _DLSYM_CONST
 #else
@@ -3793,7 +4107,7 @@ lt__PROGRAM__LTX_preloaded_symbols[[]] =
 {
   { "@PROGRAM@", (void *) 0 },
 _LT_EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  $SED "s/^$symcode$symcode* .* \(.*\)$/  {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
 	  cat <<\_LT_EOF >> conftest.$ac_ext
   {0, (void *) 0}
 };
@@ -3813,9 +4127,9 @@ _LT_EOF
 	  mv conftest.$ac_objext conftstm.$ac_objext
 	  lt_globsym_save_LIBS=$LIBS
 	  lt_globsym_save_CFLAGS=$CFLAGS
-	  LIBS="conftstm.$ac_objext"
+	  LIBS=conftstm.$ac_objext
 	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	  if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then
 	    pipe_works=yes
 	  fi
 	  LIBS=$lt_globsym_save_LIBS
@@ -3836,7 +4150,7 @@ _LT_EOF
   rm -rf conftest* conftst*
 
   # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
+  if test yes = "$pipe_works"; then
     break
   else
     lt_cv_sys_global_symbol_pipe=
@@ -3863,12 +4177,16 @@ _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
     [Take the output of nm and produce a listing of raw symbols and C names])
 _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
     [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1],
+    [Transform the output of nm into a list of symbols to manually relocate])
 _LT_DECL([global_symbol_to_c_name_address],
     [lt_cv_sys_global_symbol_to_c_name_address], [1],
     [Transform the output of nm in a C name address pair])
 _LT_DECL([global_symbol_to_c_name_address_lib_prefix],
     [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
     [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([nm_interface], [lt_cv_nm_interface], [1],
+    [The name lister interface])
 _LT_DECL([], [nm_file_list_spec], [1],
     [Specify filename containing input files for $NM])
 ]) # _LT_CMD_GLOBAL_SYMBOLS
@@ -3884,17 +4202,18 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)=
 
 m4_if([$1], [CXX], [
   # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
+  if test yes = "$GXX"; then
     _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
     _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
 
     case $host_os in
     aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# AIX 5 now supports IA64 processor
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       fi
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
 
     amigaos*)
@@ -3905,8 +4224,8 @@ m4_if([$1], [CXX], [
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
@@ -3922,6 +4241,11 @@ m4_if([$1], [CXX], [
       # (--disable-auto-import) libraries
       m4_if([$1], [GCJ], [],
 	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+	;;
+      esac
       ;;
     darwin* | rhapsody*)
       # PIC is the default on this platform
@@ -3971,7 +4295,7 @@ m4_if([$1], [CXX], [
     case $host_os in
       aix[[4-9]]*)
 	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
+	if test ia64 = "$host_cpu"; then
 	  # AIX 5 now supports IA64 processor
 	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	else
@@ -4012,14 +4336,14 @@ m4_if([$1], [CXX], [
 	case $cc_basename in
 	  CC*)
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
+	    if test ia64 != "$host_cpu"; then
 	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
 	    fi
 	    ;;
 	  aCC*)
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
 	    case $host_cpu in
 	    hppa*64*|ia64*)
 	      # +Z the default
@@ -4056,7 +4380,7 @@ m4_if([$1], [CXX], [
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
 	    ;;
 	  ecpc* )
-	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    # old Intel C++ for x86_64, which still supported -KPIC.
 	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
 	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
@@ -4201,17 +4525,18 @@ m4_if([$1], [CXX], [
   fi
 ],
 [
-  if test "$GCC" = yes; then
+  if test yes = "$GCC"; then
     _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
     _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
 
     case $host_os in
       aix*)
       # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# AIX 5 now supports IA64 processor
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       fi
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
       ;;
 
     amigaos*)
@@ -4222,8 +4547,8 @@ m4_if([$1], [CXX], [
         ;;
       m68k)
             # FIXME: we need at least 68020 code to build shared libraries, but
-            # adding the `-m68020' flag to GCC prevents building anything better,
-            # like `-m68040'.
+            # adding the '-m68020' flag to GCC prevents building anything better,
+            # like '-m68040'.
             _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
         ;;
       esac
@@ -4240,6 +4565,11 @@ m4_if([$1], [CXX], [
       # (--disable-auto-import) libraries
       m4_if([$1], [GCJ], [],
 	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+	;;
+      esac
       ;;
 
     darwin* | rhapsody*)
@@ -4310,7 +4640,7 @@ m4_if([$1], [CXX], [
     case $host_os in
     aix*)
       _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# AIX 5 now supports IA64 processor
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       else
@@ -4318,11 +4648,30 @@ m4_if([$1], [CXX], [
       fi
       ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      esac
+      ;;
+
     mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
       m4_if([$1], [GCJ], [],
 	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      case $host_os in
+      os2*)
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static'
+	;;
+      esac
       ;;
 
     hpux9* | hpux10* | hpux11*)
@@ -4338,7 +4687,7 @@ m4_if([$1], [CXX], [
 	;;
       esac
       # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive'
       ;;
 
     irix5* | irix6* | nonstopux*)
@@ -4349,7 +4698,7 @@ m4_if([$1], [CXX], [
 
     linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*)
       case $cc_basename in
-      # old Intel for x86_64 which still supported -KPIC.
+      # old Intel for x86_64, which still supported -KPIC.
       ecc*)
 	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
@@ -4374,6 +4723,12 @@ m4_if([$1], [CXX], [
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
 	;;
+      tcc*)
+	# Fabrice Bellard et al's Tiny C Compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	;;
       pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
         # Portland Group compilers (*not* the Pentium gcc compiler,
 	# which looks to be a dead project)
@@ -4471,7 +4826,7 @@ m4_if([$1], [CXX], [
       ;;
 
     sysv4*MP*)
-      if test -d /usr/nec ;then
+      if test -d /usr/nec; then
 	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
 	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
       fi
@@ -4500,7 +4855,7 @@ m4_if([$1], [CXX], [
   fi
 ])
 case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
+  # For platforms that do not support PIC, -DPIC is meaningless:
   *djgpp*)
     _LT_TAGVAR(lt_prog_compiler_pic, $1)=
     ;;
@@ -4566,17 +4921,21 @@ m4_if([$1], [CXX], [
   case $host_os in
   aix[[4-9]]*)
     # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    # Also, AIX nm treats weak defined symbols like other global defined
-    # symbols, whereas GNU nm marks them as "W".
+    # -C means demangle to GNU nm, but means don't demangle to AIX nm.
+    # Without the "-l" option, or with the "-B" option, AIX nm treats
+    # weak defined symbols like other global defined symbols, whereas
+    # GNU nm marks them as "W".
+    # While the 'weak' keyword is ignored in the Export File, we need
+    # it in the Import File for the 'aix-soname' feature, so we have
+    # to replace the "-B" option with "-P" for AIX nm.
     if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
     else
-      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+      _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
     fi
     ;;
   pw32*)
-    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds
     ;;
   cygwin* | mingw* | cegcc*)
     case $cc_basename in
@@ -4625,9 +4984,9 @@ m4_if([$1], [CXX], [
   # included in the symbol list
   _LT_TAGVAR(include_expsyms, $1)=
   # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
+  # it will be wrapped by ' (' and ')$', so one must not match beginning or
+  # end of line.  Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc',
+  # as well as any symbol that contains 'd'.
   _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
   # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
   # platforms (ab)use it in PIC code, but their linkers get confused if
@@ -4643,7 +5002,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     # FIXME: the MSVC++ port hasn't been tested in a loooong time
     # When not using gcc, we currently assume that we are using
     # Microsoft Visual C++.
-    if test "$GCC" != yes; then
+    if test yes != "$GCC"; then
       with_gnu_ld=no
     fi
     ;;
@@ -4651,7 +5010,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     # we just hope/assume this is gcc and not c89 (= MSVC++)
     with_gnu_ld=yes
     ;;
-  openbsd*)
+  openbsd* | bitrig*)
     with_gnu_ld=no
     ;;
   linux* | k*bsd*-gnu | gnu*)
@@ -4664,7 +5023,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
   # On some targets, GNU ld is compatible enough with the native linker
   # that we're better off using the native interface for both.
   lt_use_gnu_ld_interface=no
-  if test "$with_gnu_ld" = yes; then
+  if test yes = "$with_gnu_ld"; then
     case $host_os in
       aix*)
 	# The AIX port of GNU ld has always aspired to compatibility
@@ -4686,24 +5045,24 @@ dnl Note also adjust exclude_expsyms for C++ above.
     esac
   fi
 
-  if test "$lt_use_gnu_ld_interface" = yes; then
+  if test yes = "$lt_use_gnu_ld_interface"; then
     # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
+    wlarc='$wl'
 
     # Set some defaults for GNU ld with shared library support. These
     # are reset later if shared libraries are not supported. Putting them
     # here allows them to be overridden if necessary.
     runpath_var=LD_RUN_PATH
-    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
     # ancient GNU ld didn't support --whole-archive et. al.
     if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
-      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
     else
       _LT_TAGVAR(whole_archive_flag_spec, $1)=
     fi
     supports_anon_versioning=no
-    case `$LD -v 2>&1` in
+    case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in
       *GNU\ gold*) supports_anon_versioning=yes ;;
       *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
       *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
@@ -4716,7 +5075,7 @@ dnl Note also adjust exclude_expsyms for C++ above.
     case $host_os in
     aix[[3-9]]*)
       # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
+      if test ia64 != "$host_cpu"; then
 	_LT_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
@@ -4735,7 +5094,7 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             _LT_TAGVAR(archive_expsym_cmds, $1)=''
         ;;
       m68k)
@@ -4751,7 +5110,7 @@ _LT_EOF
 	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
 	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
 	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4761,7 +5120,7 @@ _LT_EOF
       # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
       # as there is no search path for DLLs.
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
       _LT_TAGVAR(always_export_symbols, $1)=no
       _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -4769,61 +5128,89 @@ _LT_EOF
       _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
 
       if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file, use it as
+	# is; otherwise, prepend EXPORTS...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+          cp $export_symbols $output_objdir/$soname.def;
+        else
+          echo EXPORTS > $output_objdir/$soname.def;
+          cat $export_symbols >> $output_objdir/$soname.def;
+        fi~
+        $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
 
     haiku*)
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      shrext_cmds=.dll
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	prefix_cmds="$SED"~
+	if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	  prefix_cmds="$prefix_cmds -e 1d";
+	fi~
+	prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+	cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
     interix[[3-9]]*)
       _LT_TAGVAR(hardcode_direct, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
       # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
       # Instead, shared libraries are loaded at an image base (0x10000000 by
       # default) and relocated if they conflict, which is a slow very memory
       # consuming and fragmenting process.  To avoid this, we pick a random,
       # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
       # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
 
     gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
       tmp_diet=no
-      if test "$host_os" = linux-dietlibc; then
+      if test linux-dietlibc = "$host_os"; then
 	case $cc_basename in
 	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
 	esac
       fi
       if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
-	 && test "$tmp_diet" = no
+	 && test no = "$tmp_diet"
       then
 	tmp_addflag=' $pic_flag'
 	tmp_sharedflag='-shared'
 	case $cc_basename,$host_cpu in
         pgcc*)				# Portland Group C compiler
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  tmp_addflag=' $pic_flag'
 	  ;;
 	pgf77* | pgf90* | pgf95* | pgfortran*)
 					# Portland Group f77 and f90 compilers
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  tmp_addflag=' $pic_flag -Mnomain' ;;
 	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
 	  tmp_addflag=' -i_dynamic' ;;
@@ -4834,42 +5221,47 @@ _LT_EOF
 	lf95*)				# Lahey Fortran 8.1
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
 	  tmp_sharedflag='--shared' ;;
+        nagfor*)                        # NAGFOR 5.3
+          tmp_sharedflag='-Wl,-shared' ;;
 	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
 	  tmp_addflag= ;;
 	nvcc*)	# Cuda Compiler Driver 2.2
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  _LT_TAGVAR(compiler_needs_object, $1)=yes
 	  ;;
 	esac
 	case `$CC -V 2>&1 | sed 5q` in
 	*Sun\ C*)			# Sun C 5.9
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	  _LT_TAGVAR(compiler_needs_object, $1)=yes
 	  tmp_sharedflag='-G' ;;
 	*Sun\ F*)			# Sun Fortran 8.3
 	  tmp_sharedflag='-G' ;;
 	esac
-	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
 
-        if test "x$supports_anon_versioning" = xyes; then
+        if test yes = "$supports_anon_versioning"; then
           _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	    echo "local: *; };" >> $output_objdir/$libname.ver~
-	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+            cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+            echo "local: *; };" >> $output_objdir/$libname.ver~
+            $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
         fi
 
 	case $cc_basename in
+	tcc*)
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic'
+	  ;;
 	xlf* | bgf* | bgxlf* | mpixlf*)
 	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
 	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
-	  if test "x$supports_anon_versioning" = xyes; then
+	  if test yes = "$supports_anon_versioning"; then
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-	      echo "local: *; };" >> $output_objdir/$libname.ver~
-	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+              cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+              echo "local: *; };" >> $output_objdir/$libname.ver~
+              $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
 	  fi
 	  ;;
 	esac
@@ -4883,8 +5275,8 @@ _LT_EOF
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
 	wlarc=
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       fi
       ;;
 
@@ -4902,8 +5294,8 @@ _LT_EOF
 
 _LT_EOF
       elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
@@ -4915,7 +5307,7 @@ _LT_EOF
 	_LT_TAGVAR(ld_shlibs, $1)=no
 	cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot
 *** reliably create shared libraries on SCO systems.  Therefore, libtool
 *** is disabling shared libraries support.  We urge you to upgrade GNU
 *** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
@@ -4930,9 +5322,9 @@ _LT_EOF
 	  # DT_RUNPATH tag from executables and libraries.  But doing so
 	  # requires that you compile everything twice, which is a pain.
 	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 	  else
 	    _LT_TAGVAR(ld_shlibs, $1)=no
 	  fi
@@ -4949,15 +5341,15 @@ _LT_EOF
 
     *)
       if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
       fi
       ;;
     esac
 
-    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+    if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then
       runpath_var=
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
       _LT_TAGVAR(export_dynamic_flag_spec, $1)=
@@ -4973,7 +5365,7 @@ _LT_EOF
       # Note: this linker hardcodes the directories in LIBPATH if there
       # are no directories specified by -L.
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+      if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then
 	# Neither direct hardcoding nor static linking is supported with a
 	# broken collect2.
 	_LT_TAGVAR(hardcode_direct, $1)=unsupported
@@ -4981,34 +5373,57 @@ _LT_EOF
       ;;
 
     aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
+      if test ia64 = "$host_cpu"; then
 	# On IA64, the linker does run time linking by default, so we don't
 	# have to do anything special.
 	aix_use_runtimelinking=no
 	exp_sym_flag='-Bexport'
-	no_entry_flag=""
+	no_entry_flag=
       else
 	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	# Also, AIX nm treats weak defined symbols like other global
-	# defined symbols, whereas GNU nm marks them as "W".
+	# -C means demangle to GNU nm, but means don't demangle to AIX nm.
+	# Without the "-l" option, or with the "-B" option, AIX nm treats
+	# weak defined symbols like other global defined symbols, whereas
+	# GNU nm marks them as "W".
+	# While the 'weak' keyword is ignored in the Export File, we need
+	# it in the Import File for the 'aix-soname' feature, so we have
+	# to replace the "-B" option with "-P" for AIX nm.
 	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols'
 	else
-	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	  _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols'
 	fi
 	aix_use_runtimelinking=no
 
 	# Test if we are trying to use run time linking or normal
 	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
+	# have runtime linking enabled, and use it for executables.
+	# For shared libraries, we enable/disable runtime linking
+	# depending on the kind of the shared library created -
+	# when "with_aix_soname,aix_use_runtimelinking" is:
+	# "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+	# "aix,yes"  lib.so          shared, rtl:yes, for executables
+	#            lib.a           static archive
+	# "both,no"  lib.so.V(shr.o) shared, rtl:yes
+	#            lib.a(lib.so.V) shared, rtl:no,  for executables
+	# "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+	#            lib.a(lib.so.V) shared, rtl:no
+	# "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+	#            lib.a           static archive
 	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
 	  for ld_flag in $LDFLAGS; do
-	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	  if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then
 	    aix_use_runtimelinking=yes
 	    break
 	  fi
 	  done
+	  if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+	    # With aix-soname=svr4, we create the lib.so.V shared archives only,
+	    # so we don't have lib.a shared libs to link our executables.
+	    # We have to force runtime linking in this case.
+	    aix_use_runtimelinking=yes
+	    LDFLAGS="$LDFLAGS -Wl,-brtl"
+	  fi
 	  ;;
 	esac
 
@@ -5027,13 +5442,21 @@ _LT_EOF
       _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
       _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+      _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
+      case $with_aix_soname,$aix_use_runtimelinking in
+      aix,*) ;; # traditional, no import file
+      svr4,* | *,yes) # use import file
+	# The Import File defines what to hardcode.
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+	;;
+      esac
 
-      if test "$GCC" = yes; then
+      if test yes = "$GCC"; then
 	case $host_os in aix4.[[012]]|aix4.[[012]].*)
 	# We only want to do this on AIX 4.2 and lower, the check
 	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
+	  collect2name=`$CC -print-prog-name=collect2`
 	  if test -f "$collect2name" &&
 	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
 	  then
@@ -5052,62 +5475,80 @@ _LT_EOF
 	  ;;
 	esac
 	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
+	if test yes = "$aix_use_runtimelinking"; then
+	  shared_flag="$shared_flag "'$wl-G'
 	fi
-	_LT_TAGVAR(link_all_deplibs, $1)=no
+	# Need to ensure runtime linking is disabled for the traditional
+	# shared library, or the linker may eventually find shared libraries
+	# /with/ Import File - we do not want to mix them.
+	shared_flag_aix='-shared'
+	shared_flag_svr4='-shared $wl-G'
       else
 	# not using gcc
-	if test "$host_cpu" = ia64; then
+	if test ia64 = "$host_cpu"; then
 	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
 	# chokes on -Wl,-G. The following line is correct:
 	  shared_flag='-G'
 	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
+	  if test yes = "$aix_use_runtimelinking"; then
+	    shared_flag='$wl-G'
 	  else
-	    shared_flag='${wl}-bM:SRE'
+	    shared_flag='$wl-bM:SRE'
 	  fi
+	  shared_flag_aix='$wl-bM:SRE'
+	  shared_flag_svr4='$wl-G'
 	fi
       fi
 
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
       # It seems that -bexpall does not export symbols beginning with
       # underscore (_), so it is better to generate a list of symbols to export.
       _LT_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
+      if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
 	# Warning - without using the other runtime loading flags (-brtl),
 	# -berok will link without error, but may produce a broken library.
 	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
         # Determine the default libpath from the value encoded in an
         # empty executable.
         _LT_SYS_MODULE_PATH_AIX([$1])
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
       else
-	if test "$host_cpu" = ia64; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	if test ia64 = "$host_cpu"; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
 	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
 	else
 	 # Determine the default libpath from the value encoded in an
 	 # empty executable.
 	 _LT_SYS_MODULE_PATH_AIX([$1])
-	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
 	  # Warning - without using the other run time loading flags,
 	  # -berok will link without error, but may produce a broken library.
-	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  if test "$with_gnu_ld" = yes; then
+	  _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
+	  if test yes = "$with_gnu_ld"; then
 	    # We only use this code for GNU lds that support --whole-archive.
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
 	  else
 	    # Exported symbols can be pulled into shared objects from archives
 	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	  fi
 	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+	  # -brtl affects multiple linker settings, -berok does not and is overridden later
+	  compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
+	  if test svr4 != "$with_aix_soname"; then
+	    # This is similar to how AIX traditionally builds its shared libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+	  fi
+	  if test aix != "$with_aix_soname"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+	  else
+	    # used by -dlpreopen to get the symbols
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+	  fi
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
 	fi
       fi
       ;;
@@ -5116,7 +5557,7 @@ _LT_EOF
       case $host_cpu in
       powerpc)
             # see comment about AmigaOS4 .so support
-            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
             _LT_TAGVAR(archive_expsym_cmds, $1)=''
         ;;
       m68k)
@@ -5146,16 +5587,17 @@ _LT_EOF
 	# Tell ltmain to make .lib files, not .a files.
 	libext=lib
 	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
+	shrext_cmds=.dll
 	# FIXME: Setting linknames here is a bad hack.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	  else
-	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	  fi~
-	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	  linknames='
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+            cp "$export_symbols" "$output_objdir/$soname.def";
+            echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+          else
+            $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+          fi~
+          $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+          linknames='
 	# The linker will not automatically build a static lib if we build a DLL.
 	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
@@ -5164,18 +5606,18 @@ _LT_EOF
 	# Don't use ranlib
 	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
 	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	  lt_tool_outputfile="@TOOL_OUTPUT@"~
-	  case $lt_outputfile in
-	    *.exe|*.EXE) ;;
-	    *)
-	      lt_outputfile="$lt_outputfile.exe"
-	      lt_tool_outputfile="$lt_tool_outputfile.exe"
-	      ;;
-	  esac~
-	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	    $RM "$lt_outputfile.manifest";
-	  fi'
+          lt_tool_outputfile="@TOOL_OUTPUT@"~
+          case $lt_outputfile in
+            *.exe|*.EXE) ;;
+            *)
+              lt_outputfile=$lt_outputfile.exe
+              lt_tool_outputfile=$lt_tool_outputfile.exe
+              ;;
+          esac~
+          if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+            $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+            $RM "$lt_outputfile.manifest";
+          fi'
 	;;
       *)
 	# Assume MSVC wrapper
@@ -5184,7 +5626,7 @@ _LT_EOF
 	# Tell ltmain to make .lib files, not .a files.
 	libext=lib
 	# Tell ltmain to make .dll files, not .so files.
-	shrext_cmds=".dll"
+	shrext_cmds=.dll
 	# FIXME: Setting linknames here is a bad hack.
 	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
 	# The linker will automatically build a .lib file if we build a DLL.
@@ -5234,33 +5676,33 @@ _LT_EOF
       ;;
 
     hpux9*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      if test yes = "$GCC"; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       else
-	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
       fi
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_TAGVAR(hardcode_direct, $1)=yes
 
       # hardcode_minus_L: Not really in the search PATH,
       # but as the default location of the library.
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
       ;;
 
     hpux10*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes,no = "$GCC,$with_gnu_ld"; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
       fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
 	# hardcode_minus_L: Not really in the search PATH,
 	# but as the default location of the library.
 	_LT_TAGVAR(hardcode_minus_L, $1)=yes
@@ -5268,25 +5710,25 @@ _LT_EOF
       ;;
 
     hpux11*)
-      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+      if test yes,no = "$GCC,$with_gnu_ld"; then
 	case $host_cpu in
 	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
       else
 	case $host_cpu in
 	hppa*64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	ia64*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
 	m4_if($1, [], [
@@ -5294,14 +5736,14 @@ _LT_EOF
 	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
 	  _LT_LINKER_OPTION([if $CC understands -b],
 	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
-	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
 	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
-	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
 	  ;;
 	esac
       fi
-      if test "$with_gnu_ld" = no; then
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      if test no = "$with_gnu_ld"; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
 	case $host_cpu in
@@ -5312,7 +5754,7 @@ _LT_EOF
 	*)
 	  _LT_TAGVAR(hardcode_direct, $1)=yes
 	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
 
 	  # hardcode_minus_L: Not really in the search PATH,
 	  # but as the default location of the library.
@@ -5323,16 +5765,16 @@ _LT_EOF
       ;;
 
     irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
 	# Try to use the -exported_symbol ld option, if it does not
 	# work, assume that -exports_file does not work either and
 	# implicitly export all symbols.
 	# This should be the same for all languages, so no per-tag cache variable.
 	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
 	  [lt_cv_irix_exported_symbol],
-	  [save_LDFLAGS="$LDFLAGS"
-	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	  [save_LDFLAGS=$LDFLAGS
+	   LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null"
 	   AC_LINK_IFELSE(
 	     [AC_LANG_SOURCE(
 	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
@@ -5345,21 +5787,32 @@ _LT_EOF
       end]])])],
 	      [lt_cv_irix_exported_symbol=yes],
 	      [lt_cv_irix_exported_symbol=no])
-           LDFLAGS="$save_LDFLAGS"])
-	if test "$lt_cv_irix_exported_symbol" = yes; then
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+           LDFLAGS=$save_LDFLAGS])
+	if test yes = "$lt_cv_irix_exported_symbol"; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib'
 	fi
+	_LT_TAGVAR(link_all_deplibs, $1)=no
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_TAGVAR(inherit_rpath, $1)=yes
       _LT_TAGVAR(link_all_deplibs, $1)=yes
       ;;
 
+    linux*)
+      case $cc_basename in
+      tcc*)
+	# Fabrice Bellard et al's Tiny C Compiler
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	;;
+      esac
+      ;;
+
     netbsd* | netbsdelf*-gnu)
       if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
 	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
@@ -5374,7 +5827,7 @@ _LT_EOF
     newsos6)
       _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
       _LT_TAGVAR(hardcode_direct, $1)=yes
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       ;;
@@ -5382,27 +5835,19 @@ _LT_EOF
     *nto* | *qnx*)
       ;;
 
-    openbsd*)
+    openbsd* | bitrig*)
       if test -f /usr/libexec/ld.so; then
 	_LT_TAGVAR(hardcode_direct, $1)=yes
 	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
 	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
-	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
 	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
 	fi
       else
 	_LT_TAGVAR(ld_shlibs, $1)=no
@@ -5413,33 +5858,53 @@ _LT_EOF
       _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_TAGVAR(hardcode_minus_L, $1)=yes
       _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      shrext_cmds=.dll
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	$ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	$ECHO EXPORTS >> $output_objdir/$libname.def~
+	prefix_cmds="$SED"~
+	if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	  prefix_cmds="$prefix_cmds -e 1d";
+	fi~
+	prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+	cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+	$CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	emximp -o $lib $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
 
     osf3*)
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      if test yes = "$GCC"; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
       fi
       _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=:
       ;;
 
     osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      if test yes = "$GCC"; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
       else
 	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
-	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+          $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp'
 
 	# Both c and cxx compiler support -rpath directly
 	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -5450,24 +5915,24 @@ _LT_EOF
 
     solaris*)
       _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+	wlarc='$wl'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags'
 	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+          $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
       else
 	case `$CC -V 2>&1` in
 	*"Compilers 5.0"*)
 	  wlarc=''
-	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags'
 	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+            $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
 	  ;;
 	*)
-	  wlarc='${wl}'
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  wlarc='$wl'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags'
 	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+            $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
 	  ;;
 	esac
       fi
@@ -5477,11 +5942,11 @@ _LT_EOF
       solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
       *)
 	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but understands '-z linker_flag'.  GCC discards it without '$wl',
 	# but is careful enough not to reorder.
 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	if test yes = "$GCC"; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
 	else
 	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
 	fi
@@ -5491,10 +5956,10 @@ _LT_EOF
       ;;
 
     sunos4*)
-      if test "x$host_vendor" = xsequent; then
+      if test sequent = "$host_vendor"; then
 	# Use $CC to link under sequent, because it throws in some extra .o
 	# files that make .init and .fini sections work.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags'
       else
 	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
       fi
@@ -5543,43 +6008,43 @@ _LT_EOF
       ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
     sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
+      # Note: We CANNOT use -z defs as we might desire, because we do not
       # link with -lc, and that would cause any symbols used from libc to
       # always be unresolved, which means just about no library would
       # ever link correctly.  If we're not using GNU ld we use -z text
       # though, which does catch some bad symbols but isn't as heavy-handed
       # as -z defs.
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
       _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
       _LT_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
       runpath_var='LD_RUN_PATH'
 
-      if test "$GCC" = yes; then
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      if test yes = "$GCC"; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       else
-	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
       fi
       ;;
 
@@ -5594,17 +6059,17 @@ _LT_EOF
       ;;
     esac
 
-    if test x$host_vendor = xsni; then
+    if test sni = "$host_vendor"; then
       case $host in
       sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym'
 	;;
       esac
     fi
   fi
 ])
 AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
 
 _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
 
@@ -5621,7 +6086,7 @@ x|xyes)
   # Assume -lc should be added
   _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
+  if test yes,yes = "$GCC,$enable_shared"; then
     case $_LT_TAGVAR(archive_cmds, $1) in
     *'~'*)
       # FIXME: we may have to deal with multi-command sequences.
@@ -5701,12 +6166,12 @@ _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
 _LT_TAGDECL([], [hardcode_libdir_separator], [1],
     [Whether we need a single "-rpath" flag with a separated argument])
 _LT_TAGDECL([], [hardcode_direct], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
     DIR into the resulting binary])
 _LT_TAGDECL([], [hardcode_direct_absolute], [0],
-    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
     DIR into the resulting binary and the resulting library dependency is
-    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    "absolute", i.e impossible to change by setting $shlibpath_var if the
     library is relocated])
 _LT_TAGDECL([], [hardcode_minus_L], [0],
     [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
@@ -5747,10 +6212,10 @@ dnl    [Compiler flag to generate thread safe objects])
 # ------------------------
 # Ensure that the configuration variables for a C compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
+# the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_C_CONFIG],
 [m4_require([_LT_DECL_EGREP])dnl
-lt_save_CC="$CC"
+lt_save_CC=$CC
 AC_LANG_PUSH(C)
 
 # Source file extension for C test sources.
@@ -5790,18 +6255,18 @@ if test -n "$compiler"; then
   LT_SYS_DLOPEN_SELF
   _LT_CMD_STRIPLIB
 
-  # Report which library types will actually be built
+  # Report what library types will actually be built
   AC_MSG_CHECKING([if libtool supports shared libraries])
   AC_MSG_RESULT([$can_build_shared])
 
   AC_MSG_CHECKING([whether to build shared libraries])
-  test "$can_build_shared" = "no" && enable_shared=no
+  test no = "$can_build_shared" && enable_shared=no
 
   # On AIX, shared libraries and static libraries use the same namespace, and
   # are all built from PIC.
   case $host_os in
   aix3*)
-    test "$enable_shared" = yes && enable_static=no
+    test yes = "$enable_shared" && enable_static=no
     if test -n "$RANLIB"; then
       archive_cmds="$archive_cmds~\$RANLIB \$lib"
       postinstall_cmds='$RANLIB $lib'
@@ -5809,8 +6274,12 @@ if test -n "$compiler"; then
     ;;
 
   aix[[4-9]]*)
-    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-      test "$enable_shared" = yes && enable_static=no
+    if test ia64 != "$host_cpu"; then
+      case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+      yes,aix,yes) ;;			# shared object as lib.so file only
+      yes,svr4,*) ;;			# shared object as lib.so archive member only
+      yes,*) enable_static=no ;;	# shared object in lib.a archive as well
+      esac
     fi
     ;;
   esac
@@ -5818,13 +6287,13 @@ if test -n "$compiler"; then
 
   AC_MSG_CHECKING([whether to build static libraries])
   # Make sure either enable_shared or enable_static is yes.
-  test "$enable_shared" = yes || enable_static=yes
+  test yes = "$enable_shared" || enable_static=yes
   AC_MSG_RESULT([$enable_static])
 
   _LT_CONFIG($1)
 fi
 AC_LANG_POP
-CC="$lt_save_CC"
+CC=$lt_save_CC
 ])# _LT_LANG_C_CONFIG
 
 
@@ -5832,14 +6301,14 @@ CC="$lt_save_CC"
 # --------------------------
 # Ensure that the configuration variables for a C++ compiler are suitably
 # defined.  These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
+# the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_CXX_CONFIG],
 [m4_require([_LT_FILEUTILS_DEFAULTS])dnl
 m4_require([_LT_DECL_EGREP])dnl
 m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
+if test -n "$CXX" && ( test no != "$CXX" &&
+    ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) ||
+    (test g++ != "$CXX"))); then
   AC_PROG_CXXCPP
 else
   _lt_caught_CXX_error=yes
@@ -5881,7 +6350,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the CXX compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_caught_CXX_error" != yes; then
+if test yes != "$_lt_caught_CXX_error"; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="int some_variable = 0;"
 
@@ -5923,35 +6392,35 @@ if test "$_lt_caught_CXX_error" != yes; then
   if test -n "$compiler"; then
     # We don't want -fno-exception when compiling C++ code, so set the
     # no_builtin_flag separately
-    if test "$GXX" = yes; then
+    if test yes = "$GXX"; then
       _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
     else
       _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
     fi
 
-    if test "$GXX" = yes; then
+    if test yes = "$GXX"; then
       # Set up default GNU C++ configuration
 
       LT_PATH_LD
 
       # Check if GNU C++ uses GNU ld as the underlying linker, since the
       # archiving commands below assume that GNU ld is being used.
-      if test "$with_gnu_ld" = yes; then
-        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      if test yes = "$with_gnu_ld"; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
 
         # If archive_cmds runs LD, not CC, wlarc should be empty
         # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
         #     investigate it a little bit more. (MM)
-        wlarc='${wl}'
+        wlarc='$wl'
 
         # ancient GNU ld didn't support --whole-archive et. al.
         if eval "`$CC -print-prog-name=ld` --help 2>&1" |
 	  $GREP 'no-whole-archive' > /dev/null; then
-          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
         else
           _LT_TAGVAR(whole_archive_flag_spec, $1)=
         fi
@@ -5987,18 +6456,30 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=no
         ;;
       aix[[4-9]]*)
-        if test "$host_cpu" = ia64; then
+        if test ia64 = "$host_cpu"; then
           # On IA64, the linker does run time linking by default, so we don't
           # have to do anything special.
           aix_use_runtimelinking=no
           exp_sym_flag='-Bexport'
-          no_entry_flag=""
+          no_entry_flag=
         else
           aix_use_runtimelinking=no
 
           # Test if we are trying to use run time linking or normal
           # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-          # need to do runtime linking.
+          # have runtime linking enabled, and use it for executables.
+          # For shared libraries, we enable/disable runtime linking
+          # depending on the kind of the shared library created -
+          # when "with_aix_soname,aix_use_runtimelinking" is:
+          # "aix,no"   lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "aix,yes"  lib.so          shared, rtl:yes, for executables
+          #            lib.a           static archive
+          # "both,no"  lib.so.V(shr.o) shared, rtl:yes
+          #            lib.a(lib.so.V) shared, rtl:no,  for executables
+          # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a(lib.so.V) shared, rtl:no
+          # "svr4,*"   lib.so.V(shr.o) shared, rtl:yes, for executables
+          #            lib.a           static archive
           case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
 	    for ld_flag in $LDFLAGS; do
 	      case $ld_flag in
@@ -6008,6 +6489,13 @@ if test "$_lt_caught_CXX_error" != yes; then
 	        ;;
 	      esac
 	    done
+	    if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then
+	      # With aix-soname=svr4, we create the lib.so.V shared archives only,
+	      # so we don't have lib.a shared libs to link our executables.
+	      # We have to force runtime linking in this case.
+	      aix_use_runtimelinking=yes
+	      LDFLAGS="$LDFLAGS -Wl,-brtl"
+	    fi
 	    ;;
           esac
 
@@ -6026,13 +6514,21 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
         _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
-        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+        _LT_TAGVAR(file_list_spec, $1)='$wl-f,'
+        case $with_aix_soname,$aix_use_runtimelinking in
+        aix,*) ;;	# no import file
+        svr4,* | *,yes) # use import file
+          # The Import File defines what to hardcode.
+          _LT_TAGVAR(hardcode_direct, $1)=no
+          _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+          ;;
+        esac
 
-        if test "$GXX" = yes; then
+        if test yes = "$GXX"; then
           case $host_os in aix4.[[012]]|aix4.[[012]].*)
           # We only want to do this on AIX 4.2 and lower, the check
           # below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
+	  collect2name=`$CC -print-prog-name=collect2`
 	  if test -f "$collect2name" &&
 	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
 	  then
@@ -6050,64 +6546,84 @@ if test "$_lt_caught_CXX_error" != yes; then
 	  fi
           esac
           shared_flag='-shared'
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag="$shared_flag "'${wl}-G'
+	  if test yes = "$aix_use_runtimelinking"; then
+	    shared_flag=$shared_flag' $wl-G'
 	  fi
+	  # Need to ensure runtime linking is disabled for the traditional
+	  # shared library, or the linker may eventually find shared libraries
+	  # /with/ Import File - we do not want to mix them.
+	  shared_flag_aix='-shared'
+	  shared_flag_svr4='-shared $wl-G'
         else
           # not using gcc
-          if test "$host_cpu" = ia64; then
+          if test ia64 = "$host_cpu"; then
 	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
 	  # chokes on -Wl,-G. The following line is correct:
 	  shared_flag='-G'
           else
-	    if test "$aix_use_runtimelinking" = yes; then
-	      shared_flag='${wl}-G'
+	    if test yes = "$aix_use_runtimelinking"; then
+	      shared_flag='$wl-G'
 	    else
-	      shared_flag='${wl}-bM:SRE'
+	      shared_flag='$wl-bM:SRE'
 	    fi
+	    shared_flag_aix='$wl-bM:SRE'
+	    shared_flag_svr4='$wl-G'
           fi
         fi
 
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall'
         # It seems that -bexpall does not export symbols beginning with
         # underscore (_), so it is better to generate a list of symbols to
 	# export.
         _LT_TAGVAR(always_export_symbols, $1)=yes
-        if test "$aix_use_runtimelinking" = yes; then
+	if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then
           # Warning - without using the other runtime loading flags (-brtl),
           # -berok will link without error, but may produce a broken library.
-          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # The "-G" linker flag allows undefined symbols.
+          _LT_TAGVAR(no_undefined_flag, $1)='-bernotok'
           # Determine the default libpath from the value encoded in an empty
           # executable.
           _LT_SYS_MODULE_PATH_AIX([$1])
-          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
 
-          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag
         else
-          if test "$host_cpu" = ia64; then
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+          if test ia64 = "$host_cpu"; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib'
 	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols"
           else
 	    # Determine the default libpath from the value encoded in an
 	    # empty executable.
 	    _LT_SYS_MODULE_PATH_AIX([$1])
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath"
 	    # Warning - without using the other run time loading flags,
 	    # -berok will link without error, but may produce a broken library.
-	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	    if test "$with_gnu_ld" = yes; then
+	    _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok'
+	    if test yes = "$with_gnu_ld"; then
 	      # We only use this code for GNU lds that support --whole-archive.
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
 	    else
 	      # Exported symbols can be pulled into shared objects from archives
 	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
 	    fi
 	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
-	    # This is similar to how AIX traditionally builds its shared
-	    # libraries.
-	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d'
+	    # -brtl affects multiple linker settings, -berok does not and is overridden later
+	    compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`'
+	    if test svr4 != "$with_aix_soname"; then
+	      # This is similar to how AIX traditionally builds its shared
+	      # libraries. Need -bnortl late, we may have -brtl in LDFLAGS.
+	      _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname'
+	    fi
+	    if test aix != "$with_aix_soname"; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp'
+	    else
+	      # used by -dlpreopen to get the symbols
+	      _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV  $output_objdir/$realname.d/$soname $output_objdir'
+	    fi
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d'
           fi
         fi
         ;;
@@ -6117,7 +6633,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
 	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
 	  # support --undefined.  This deserves some investigation.  FIXME
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
 	else
 	  _LT_TAGVAR(ld_shlibs, $1)=no
 	fi
@@ -6145,57 +6661,58 @@ if test "$_lt_caught_CXX_error" != yes; then
 	  # Tell ltmain to make .lib files, not .a files.
 	  libext=lib
 	  # Tell ltmain to make .dll files, not .so files.
-	  shrext_cmds=".dll"
+	  shrext_cmds=.dll
 	  # FIXME: Setting linknames here is a bad hack.
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
-	    else
-	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
-	    fi~
-	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
-	    linknames='
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+              cp "$export_symbols" "$output_objdir/$soname.def";
+              echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp";
+            else
+              $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp;
+            fi~
+            $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+            linknames='
 	  # The linker will not automatically build a static lib if we build a DLL.
 	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
 	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 	  # Don't use ranlib
 	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
 	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
-	    lt_tool_outputfile="@TOOL_OUTPUT@"~
-	    case $lt_outputfile in
-	      *.exe|*.EXE) ;;
-	      *)
-		lt_outputfile="$lt_outputfile.exe"
-		lt_tool_outputfile="$lt_tool_outputfile.exe"
-		;;
-	    esac~
-	    func_to_tool_file "$lt_outputfile"~
-	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
-	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
-	      $RM "$lt_outputfile.manifest";
-	    fi'
+            lt_tool_outputfile="@TOOL_OUTPUT@"~
+            case $lt_outputfile in
+              *.exe|*.EXE) ;;
+              *)
+                lt_outputfile=$lt_outputfile.exe
+                lt_tool_outputfile=$lt_tool_outputfile.exe
+                ;;
+            esac~
+            func_to_tool_file "$lt_outputfile"~
+            if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then
+              $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+              $RM "$lt_outputfile.manifest";
+            fi'
 	  ;;
 	*)
 	  # g++
 	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
 	  # as there is no search path for DLLs.
 	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols'
 	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
 	  _LT_TAGVAR(always_export_symbols, $1)=no
 	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 
 	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	    # If the export-symbols file already is a .def file (1st line
-	    # is EXPORTS), use it as is; otherwise, prepend...
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	      cp $export_symbols $output_objdir/$soname.def;
-	    else
-	      echo EXPORTS > $output_objdir/$soname.def;
-	      cat $export_symbols >> $output_objdir/$soname.def;
-	    fi~
-	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file, use it as
+	    # is; otherwise, prepend EXPORTS...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then
+              cp $export_symbols $output_objdir/$soname.def;
+            else
+              echo EXPORTS > $output_objdir/$soname.def;
+              cat $export_symbols >> $output_objdir/$soname.def;
+            fi~
+            $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
 	  else
 	    _LT_TAGVAR(ld_shlibs, $1)=no
 	  fi
@@ -6206,6 +6723,34 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_DARWIN_LINKER_FEATURES($1)
 	;;
 
+      os2*)
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	shrext_cmds=.dll
+	_LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	  $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	  $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	  $ECHO EXPORTS >> $output_objdir/$libname.def~
+	  emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~
+	  $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	  emximp -o $lib $output_objdir/$libname.def'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~
+	  $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~
+	  $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~
+	  $ECHO EXPORTS >> $output_objdir/$libname.def~
+	  prefix_cmds="$SED"~
+	  if test EXPORTS = "`$SED 1q $export_symbols`"; then
+	    prefix_cmds="$prefix_cmds -e 1d";
+	  fi~
+	  prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~
+	  cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~
+	  $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~
+	  emximp -o $lib $output_objdir/$libname.def'
+	_LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+
       dgux*)
         case $cc_basename in
           ec++*)
@@ -6241,14 +6786,14 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       haiku*)
-        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
         _LT_TAGVAR(link_all_deplibs, $1)=yes
         ;;
 
       hpux9*)
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
         _LT_TAGVAR(hardcode_direct, $1)=yes
         _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
 				             # but as the default
@@ -6260,7 +6805,7 @@ if test "$_lt_caught_CXX_error" != yes; then
             _LT_TAGVAR(ld_shlibs, $1)=no
             ;;
           aCC*)
-            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
             # Commands to make compiler produce verbose output that lists
             # what "hidden" libraries, object files and flags are used when
             # linking a shared library.
@@ -6269,11 +6814,11 @@ if test "$_lt_caught_CXX_error" != yes; then
             # explicitly linking system object files so we need to strip them
             # from the output so that they don't get included in the library
             # dependencies.
-            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
             ;;
           *)
-            if test "$GXX" = yes; then
-              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            if test yes = "$GXX"; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib'
             else
               # FIXME: insert proper C++ library support
               _LT_TAGVAR(ld_shlibs, $1)=no
@@ -6283,15 +6828,15 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
       hpux10*|hpux11*)
-        if test $with_gnu_ld = no; then
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        if test no = "$with_gnu_ld"; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir'
 	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
           case $host_cpu in
             hppa*64*|ia64*)
               ;;
             *)
-	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
               ;;
           esac
         fi
@@ -6317,13 +6862,13 @@ if test "$_lt_caught_CXX_error" != yes; then
           aCC*)
 	    case $host_cpu in
 	      hppa*64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	        ;;
 	      ia64*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	        ;;
 	      *)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	        ;;
 	    esac
 	    # Commands to make compiler produce verbose output that lists
@@ -6334,20 +6879,20 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 	    ;;
           *)
-	    if test "$GXX" = yes; then
-	      if test $with_gnu_ld = no; then
+	    if test yes = "$GXX"; then
+	      if test no = "$with_gnu_ld"; then
 	        case $host_cpu in
 	          hppa*64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          ia64*)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	          *)
-	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	            ;;
 	        esac
 	      fi
@@ -6362,22 +6907,22 @@ if test "$_lt_caught_CXX_error" != yes; then
       interix[[3-9]]*)
 	_LT_TAGVAR(hardcode_direct, $1)=no
 	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
 	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
 	# Instead, shared libraries are loaded at an image base (0x10000000 by
 	# default) and relocated if they conflict, which is a slow very memory
 	# consuming and fragmenting process.  To avoid this, we pick a random,
 	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
 	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
 	;;
       irix5* | irix6*)
         case $cc_basename in
           CC*)
 	    # SGI C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
@@ -6386,17 +6931,17 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
 	    ;;
           *)
-	    if test "$GXX" = yes; then
-	      if test "$with_gnu_ld" = no; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	    if test yes = "$GXX"; then
+	      if test no = "$with_gnu_ld"; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
 	      else
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib'
 	      fi
 	    fi
 	    _LT_TAGVAR(link_all_deplibs, $1)=yes
 	    ;;
         esac
-        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
         _LT_TAGVAR(hardcode_libdir_separator, $1)=:
         _LT_TAGVAR(inherit_rpath, $1)=yes
         ;;
@@ -6409,8 +6954,8 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # KCC will only create a shared library if the output file
 	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
 	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib'
 	    # Commands to make compiler produce verbose output that lists
 	    # what "hidden" libraries, object files and flags are used when
 	    # linking a shared library.
@@ -6419,10 +6964,10 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
 
 	    # Archives containing C++ object files must be created using
 	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
@@ -6436,59 +6981,59 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # earlier do not add the objects themselves.
 	    case `$CC -V 2>&1` in
 	      *"Version 7."*)
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 		;;
 	      *)  # Version 8.0 or newer
 	        tmp_idyn=
 	        case $host_cpu in
 		  ia64*) tmp_idyn=' -i_dynamic';;
 		esac
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 		;;
 	    esac
 	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive'
 	    ;;
           pgCC* | pgcpp*)
             # Portland Group C++ compiler
 	    case `$CC -V` in
 	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
 	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
-		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+               rm -rf $tpldir~
+               $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+               compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
 	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
-		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
-		$RANLIB $oldlib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+                $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+                $RANLIB $oldlib'
 	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
-		rm -rf $tpldir~
-		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
-		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+                rm -rf $tpldir~
+                $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+                $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 	      ;;
 	    *) # Version 6 and above use weak symbols
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib'
 	      ;;
 	    esac
 
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
             ;;
 	  cxx*)
 	    # Compaq C++
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname  -o $lib $wl-retain-symbols-file $wl$export_symbols'
 
 	    runpath_var=LD_RUN_PATH
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
@@ -6502,18 +7047,18 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
 	    ;;
 	  xl* | mpixl* | bgxl*)
 	    # IBM XL 8.0 on PPC, with GNU ld
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	    if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib'
+	    if test yes = "$supports_anon_versioning"; then
 	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
-		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-		echo "local: *; };" >> $output_objdir/$libname.ver~
-		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+                cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+                echo "local: *; };" >> $output_objdir/$libname.ver~
+                $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib'
 	    fi
 	    ;;
 	  *)
@@ -6521,10 +7066,10 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    *Sun\ C*)
 	      # Sun C++ 5.9
 	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols'
 	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive'
 	      _LT_TAGVAR(compiler_needs_object, $1)=yes
 
 	      # Not sure whether something based on
@@ -6582,22 +7127,17 @@ if test "$_lt_caught_CXX_error" != yes; then
         _LT_TAGVAR(ld_shlibs, $1)=yes
 	;;
 
-      openbsd2*)
-        # C++ shared libraries are fairly broken
-	_LT_TAGVAR(ld_shlibs, $1)=no
-	;;
-
-      openbsd*)
+      openbsd* | bitrig*)
 	if test -f /usr/libexec/ld.so; then
 	  _LT_TAGVAR(hardcode_direct, $1)=yes
 	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
 	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
 	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
 	  fi
 	  output_verbose_link_cmd=func_echo_all
 	else
@@ -6613,9 +7153,9 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # KCC will only create a shared library if the output file
 	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
 	    # to its proper name (with version) after linking.
-	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
 
-	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir'
 	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
 	    # Archives containing C++ object files must be created using
@@ -6633,17 +7173,17 @@ if test "$_lt_caught_CXX_error" != yes; then
           cxx*)
 	    case $host in
 	      osf3*)
-	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
 		;;
 	      *)
 	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	          echo "-hidden">> $lib.exp~
-	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
-	          $RM $lib.exp'
+                  echo "-hidden">> $lib.exp~
+                  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~
+                  $RM $lib.exp'
 	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
 		;;
 	    esac
@@ -6658,21 +7198,21 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # explicitly linking system object files so we need to strip them
 	    # from the output so that they don't get included in the library
 	    # dependencies.
-	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
 	    ;;
 	  *)
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	    if test yes,no = "$GXX,$with_gnu_ld"; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*'
 	      case $host in
 	        osf3*)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
 		  ;;
 	        *)
-	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib'
 		  ;;
 	      esac
 
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir'
 	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
 
 	      # Commands to make compiler produce verbose output that lists
@@ -6718,9 +7258,9 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    # Sun C++ 4.2, 5.x and Centerline C++
             _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
 	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
 	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+              $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
 	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
@@ -6728,7 +7268,7 @@ if test "$_lt_caught_CXX_error" != yes; then
 	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
 	      *)
 		# The compiler driver will combine and reorder linker options,
-		# but understands `-z linker_flag'.
+		# but understands '-z linker_flag'.
 	        # Supported since Solaris 2.6 (maybe 2.5.1?)
 		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
 	        ;;
@@ -6745,30 +7285,30 @@ if test "$_lt_caught_CXX_error" != yes; then
 	    ;;
           gcx*)
 	    # Green Hills C++ Compiler
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
 
 	    # The C++ compiler must be used to create the archive.
 	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
 	    ;;
           *)
 	    # GNU C++ compiler with Solaris linker
-	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	    if test yes,no = "$GXX,$with_gnu_ld"; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs'
 	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+                  $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
 	        # linking a shared library.
 	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 	      else
-	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # g++ 2.7 appears to require '-G' NOT '-shared' on this
 	        # platform.
-	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib'
 	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
-		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+                  $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
 
 	        # Commands to make compiler produce verbose output that lists
 	        # what "hidden" libraries, object files and flags are used when
@@ -6776,11 +7316,11 @@ if test "$_lt_caught_CXX_error" != yes; then
 	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
 	      fi
 
-	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir'
 	      case $host_os in
 		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
 		*)
-		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract'
 		  ;;
 	      esac
 	    fi
@@ -6789,52 +7329,52 @@ if test "$_lt_caught_CXX_error" != yes; then
         ;;
 
     sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
       _LT_TAGVAR(archive_cmds_need_lc, $1)=no
       _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
       runpath_var='LD_RUN_PATH'
 
       case $cc_basename in
         CC*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	*)
-	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
       esac
       ;;
 
       sysv5* | sco3.2v5* | sco5v6*)
-	# Note: We can NOT use -z defs as we might desire, because we do not
+	# Note: We CANNOT use -z defs as we might desire, because we do not
 	# link with -lc, and that would cause any symbols used from libc to
 	# always be unresolved, which means just about no library would
 	# ever link correctly.  If we're not using GNU ld we use -z text
 	# though, which does catch some bad symbols but isn't as heavy-handed
 	# as -z defs.
-	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs'
 	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
 	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
-	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir'
 	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
 	_LT_TAGVAR(link_all_deplibs, $1)=yes
-	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport'
 	runpath_var='LD_RUN_PATH'
 
 	case $cc_basename in
           CC*)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
-	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+              '"$_LT_TAGVAR(old_archive_cmds, $1)"
 	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
-	      '"$_LT_TAGVAR(reload_cmds, $1)"
+              '"$_LT_TAGVAR(reload_cmds, $1)"
 	    ;;
 	  *)
-	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
 	    ;;
 	esac
       ;;
@@ -6865,10 +7405,10 @@ if test "$_lt_caught_CXX_error" != yes; then
     esac
 
     AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+    test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no
 
-    _LT_TAGVAR(GCC, $1)="$GXX"
-    _LT_TAGVAR(LD, $1)="$LD"
+    _LT_TAGVAR(GCC, $1)=$GXX
+    _LT_TAGVAR(LD, $1)=$LD
 
     ## CAVEAT EMPTOR:
     ## There is no encapsulation within the following macros, do not change
@@ -6895,7 +7435,7 @@ if test "$_lt_caught_CXX_error" != yes; then
   lt_cv_path_LD=$lt_save_path_LD
   lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
   lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
+fi # test yes != "$_lt_caught_CXX_error"
 
 AC_LANG_POP
 ])# _LT_LANG_CXX_CONFIG
@@ -6917,13 +7457,14 @@ AC_REQUIRE([_LT_DECL_SED])
 AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
 func_stripname_cnf ()
 {
-  case ${2} in
-  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
-  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  case @S|@2 in
+  .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;;
+  *)  func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;;
   esac
 } # func_stripname_cnf
 ])# _LT_FUNC_STRIPNAME_CNF
 
+
 # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
 # ---------------------------------
 # Figure out "hidden" library dependencies from verbose
@@ -7007,13 +7548,13 @@ if AC_TRY_EVAL(ac_compile); then
   pre_test_object_deps_done=no
 
   for p in `eval "$output_verbose_link_cmd"`; do
-    case ${prev}${p} in
+    case $prev$p in
 
     -L* | -R* | -l*)
        # Some compilers place space between "-{L,R}" and the path.
        # Remove the space.
-       if test $p = "-L" ||
-          test $p = "-R"; then
+       if test x-L = "$p" ||
+          test x-R = "$p"; then
 	 prev=$p
 	 continue
        fi
@@ -7029,16 +7570,16 @@ if AC_TRY_EVAL(ac_compile); then
        case $p in
        =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
        esac
-       if test "$pre_test_object_deps_done" = no; then
-	 case ${prev} in
+       if test no = "$pre_test_object_deps_done"; then
+	 case $prev in
 	 -L | -R)
 	   # Internal compiler library paths should come after those
 	   # provided the user.  The postdeps already come after the
 	   # user supplied libs so there is no need to process them.
 	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	     _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p
 	   else
-	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p"
 	   fi
 	   ;;
 	 # The "-l" case would never come before the object being
@@ -7046,9 +7587,9 @@ if AC_TRY_EVAL(ac_compile); then
 	 esac
        else
 	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
-	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	   _LT_TAGVAR(postdeps, $1)=$prev$p
 	 else
-	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p"
 	 fi
        fi
        prev=
@@ -7063,15 +7604,15 @@ if AC_TRY_EVAL(ac_compile); then
 	 continue
        fi
 
-       if test "$pre_test_object_deps_done" = no; then
+       if test no = "$pre_test_object_deps_done"; then
 	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
-	   _LT_TAGVAR(predep_objects, $1)="$p"
+	   _LT_TAGVAR(predep_objects, $1)=$p
 	 else
 	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
 	 fi
        else
 	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
-	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	   _LT_TAGVAR(postdep_objects, $1)=$p
 	 else
 	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
 	 fi
@@ -7102,51 +7643,6 @@ interix[[3-9]]*)
   _LT_TAGVAR(postdep_objects,$1)=
   _LT_TAGVAR(postdeps,$1)=
   ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC* | sunCC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
 esac
 ])
 
@@ -7155,7 +7651,7 @@ case " $_LT_TAGVAR(postdeps, $1) " in
 esac
  _LT_TAGVAR(compiler_lib_search_dirs, $1)=
 if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'`
 fi
 _LT_TAGDECL([], [compiler_lib_search_dirs], [1],
     [The directories searched by this compiler when creating a shared library])
@@ -7175,10 +7671,10 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1],
 # --------------------------
 # Ensure that the configuration variables for a Fortran 77 compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_F77_CONFIG],
 [AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
+if test -z "$F77" || test no = "$F77"; then
   _lt_disable_F77=yes
 fi
 
@@ -7215,7 +7711,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the F77 compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_F77" != yes; then
+if test yes != "$_lt_disable_F77"; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="\
       subroutine t
@@ -7237,7 +7733,7 @@ if test "$_lt_disable_F77" != yes; then
   _LT_LINKER_BOILERPLATE
 
   # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
+  lt_save_CC=$CC
   lt_save_GCC=$GCC
   lt_save_CFLAGS=$CFLAGS
   CC=${F77-"f77"}
@@ -7251,21 +7747,25 @@ if test "$_lt_disable_F77" != yes; then
     AC_MSG_RESULT([$can_build_shared])
 
     AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
+    test no = "$can_build_shared" && enable_shared=no
 
     # On AIX, shared libraries and static libraries use the same namespace, and
     # are all built from PIC.
     case $host_os in
       aix3*)
-        test "$enable_shared" = yes && enable_static=no
+        test yes = "$enable_shared" && enable_static=no
         if test -n "$RANLIB"; then
           archive_cmds="$archive_cmds~\$RANLIB \$lib"
           postinstall_cmds='$RANLIB $lib'
         fi
         ;;
       aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
+	if test ia64 != "$host_cpu"; then
+	  case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+	  yes,aix,yes) ;;		# shared object as lib.so file only
+	  yes,svr4,*) ;;		# shared object as lib.so archive member only
+	  yes,*) enable_static=no ;;	# shared object in lib.a archive as well
+	  esac
 	fi
         ;;
     esac
@@ -7273,11 +7773,11 @@ if test "$_lt_disable_F77" != yes; then
 
     AC_MSG_CHECKING([whether to build static libraries])
     # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
+    test yes = "$enable_shared" || enable_static=yes
     AC_MSG_RESULT([$enable_static])
 
-    _LT_TAGVAR(GCC, $1)="$G77"
-    _LT_TAGVAR(LD, $1)="$LD"
+    _LT_TAGVAR(GCC, $1)=$G77
+    _LT_TAGVAR(LD, $1)=$LD
 
     ## CAVEAT EMPTOR:
     ## There is no encapsulation within the following macros, do not change
@@ -7294,9 +7794,9 @@ if test "$_lt_disable_F77" != yes; then
   fi # test -n "$compiler"
 
   GCC=$lt_save_GCC
-  CC="$lt_save_CC"
-  CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test yes != "$_lt_disable_F77"
 
 AC_LANG_POP
 ])# _LT_LANG_F77_CONFIG
@@ -7306,11 +7806,11 @@ AC_LANG_POP
 # -------------------------
 # Ensure that the configuration variables for a Fortran compiler are
 # suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_FC_CONFIG],
 [AC_LANG_PUSH(Fortran)
 
-if test -z "$FC" || test "X$FC" = "Xno"; then
+if test -z "$FC" || test no = "$FC"; then
   _lt_disable_FC=yes
 fi
 
@@ -7347,7 +7847,7 @@ _LT_TAGVAR(objext, $1)=$objext
 # the FC compiler isn't working.  Some variables (like enable_shared)
 # are currently assumed to apply to all compilers on this platform,
 # and will be corrupted by setting them based on a non-working compiler.
-if test "$_lt_disable_FC" != yes; then
+if test yes != "$_lt_disable_FC"; then
   # Code to be used in simple compile tests
   lt_simple_compile_test_code="\
       subroutine t
@@ -7369,7 +7869,7 @@ if test "$_lt_disable_FC" != yes; then
   _LT_LINKER_BOILERPLATE
 
   # Allow CC to be a program name with arguments.
-  lt_save_CC="$CC"
+  lt_save_CC=$CC
   lt_save_GCC=$GCC
   lt_save_CFLAGS=$CFLAGS
   CC=${FC-"f95"}
@@ -7385,21 +7885,25 @@ if test "$_lt_disable_FC" != yes; then
     AC_MSG_RESULT([$can_build_shared])
 
     AC_MSG_CHECKING([whether to build shared libraries])
-    test "$can_build_shared" = "no" && enable_shared=no
+    test no = "$can_build_shared" && enable_shared=no
 
     # On AIX, shared libraries and static libraries use the same namespace, and
     # are all built from PIC.
     case $host_os in
       aix3*)
-        test "$enable_shared" = yes && enable_static=no
+        test yes = "$enable_shared" && enable_static=no
         if test -n "$RANLIB"; then
           archive_cmds="$archive_cmds~\$RANLIB \$lib"
           postinstall_cmds='$RANLIB $lib'
         fi
         ;;
       aix[[4-9]]*)
-	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-	  test "$enable_shared" = yes && enable_static=no
+	if test ia64 != "$host_cpu"; then
+	  case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in
+	  yes,aix,yes) ;;		# shared object as lib.so file only
+	  yes,svr4,*) ;;		# shared object as lib.so archive member only
+	  yes,*) enable_static=no ;;	# shared object in lib.a archive as well
+	  esac
 	fi
         ;;
     esac
@@ -7407,11 +7911,11 @@ if test "$_lt_disable_FC" != yes; then
 
     AC_MSG_CHECKING([whether to build static libraries])
     # Make sure either enable_shared or enable_static is yes.
-    test "$enable_shared" = yes || enable_static=yes
+    test yes = "$enable_shared" || enable_static=yes
     AC_MSG_RESULT([$enable_static])
 
-    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
-    _LT_TAGVAR(LD, $1)="$LD"
+    _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu
+    _LT_TAGVAR(LD, $1)=$LD
 
     ## CAVEAT EMPTOR:
     ## There is no encapsulation within the following macros, do not change
@@ -7431,7 +7935,7 @@ if test "$_lt_disable_FC" != yes; then
   GCC=$lt_save_GCC
   CC=$lt_save_CC
   CFLAGS=$lt_save_CFLAGS
-fi # test "$_lt_disable_FC" != yes
+fi # test yes != "$_lt_disable_FC"
 
 AC_LANG_POP
 ])# _LT_LANG_FC_CONFIG
@@ -7441,7 +7945,7 @@ AC_LANG_POP
 # --------------------------
 # Ensure that the configuration variables for the GNU Java Compiler compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_GCJ_CONFIG],
 [AC_REQUIRE([LT_PROG_GCJ])dnl
 AC_LANG_SAVE
@@ -7475,7 +7979,7 @@ CC=${GCJ-"gcj"}
 CFLAGS=$GCJFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
+_LT_TAGVAR(LD, $1)=$LD
 _LT_CC_BASENAME([$compiler])
 
 # GCJ did not exist at the time GCC didn't implicitly link libc in.
@@ -7512,7 +8016,7 @@ CFLAGS=$lt_save_CFLAGS
 # --------------------------
 # Ensure that the configuration variables for the GNU Go compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_GO_CONFIG],
 [AC_REQUIRE([LT_PROG_GO])dnl
 AC_LANG_SAVE
@@ -7546,7 +8050,7 @@ CC=${GOC-"gccgo"}
 CFLAGS=$GOFLAGS
 compiler=$CC
 _LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
+_LT_TAGVAR(LD, $1)=$LD
 _LT_CC_BASENAME([$compiler])
 
 # Go did not exist at the time GCC didn't implicitly link libc in.
@@ -7583,7 +8087,7 @@ CFLAGS=$lt_save_CFLAGS
 # -------------------------
 # Ensure that the configuration variables for the Windows resource compiler
 # are suitably defined.  These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
+# to write the compiler configuration to 'libtool'.
 m4_defun([_LT_LANG_RC_CONFIG],
 [AC_REQUIRE([LT_PROG_RC])dnl
 AC_LANG_SAVE
@@ -7599,7 +8103,7 @@ _LT_TAGVAR(objext, $1)=$objext
 lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
 
 # Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
+lt_simple_link_test_code=$lt_simple_compile_test_code
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_TAG_COMPILER
@@ -7609,7 +8113,7 @@ _LT_COMPILER_BOILERPLATE
 _LT_LINKER_BOILERPLATE
 
 # Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
+lt_save_CC=$CC
 lt_save_CFLAGS=$CFLAGS
 lt_save_GCC=$GCC
 GCC=
@@ -7638,7 +8142,7 @@ AC_DEFUN([LT_PROG_GCJ],
 [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
   [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
     [AC_CHECK_TOOL(GCJ, gcj,)
-      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2"
       AC_SUBST(GCJFLAGS)])])[]dnl
 ])
 
@@ -7749,7 +8253,7 @@ lt_ac_count=0
 # Add /usr/xpg4/bin/sed as it is typically found on Solaris
 # along with /bin/sed that truncates output.
 for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
+  test ! -f "$lt_ac_sed" && continue
   cat /dev/null > conftest.in
   lt_ac_count=0
   echo $ECHO_N "0123456789$ECHO_C" >conftest.in
@@ -7766,9 +8270,9 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
     $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
     cmp -s conftest.out conftest.nl || break
     # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
+    test 10 -lt "$lt_ac_count" && break
     lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
+    if test "$lt_ac_count" -gt "$lt_ac_max"; then
       lt_ac_max=$lt_ac_count
       lt_cv_path_SED=$lt_ac_sed
     fi
@@ -7792,27 +8296,7 @@ dnl AC_DEFUN([LT_AC_PROG_SED], [])
 # Find out whether the shell is Bourne or XSI compatible,
 # or has some other useful features.
 m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
-  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
-      = c,a/b,b/c, \
-    && eval 'test $(( 1 + 1 )) -eq 2 \
-    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
-  && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
-    >/dev/null 2>&1 \
-  && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   lt_unset=unset
 else
   lt_unset=false
@@ -7836,102 +8320,9 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
 ])# _LT_CHECK_SHELL_FEATURES
 
 
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
-  && mv -f "$cfgfile.tmp" "$cfgfile" \
-    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
-    case ${1} in
-      */*) func_dirname_result="${1%/*}${2}" ;;
-      *  ) func_dirname_result="${3}" ;;
-    esac
-    func_basename_result="${1##*/}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
-    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
-    # positional parameters, so assign one to ordinary parameter first.
-    func_stripname_result=${3}
-    func_stripname_result=${func_stripname_result#"${1}"}
-    func_stripname_result=${func_stripname_result%"${2}"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
-    func_split_long_opt_name=${1%%=*}
-    func_split_long_opt_arg=${1#*=}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
-    func_split_short_opt_arg=${1#??}
-    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
-  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
-    case ${1} in
-      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
-      *)    func_lo2o_result=${1} ;;
-    esac])
-
-  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
-
-  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
-
-  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
-  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
-
-  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
-    func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
-    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
-  # Save a `func_append' function call where possible by direct use of '+='
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-else
-  # Save a `func_append' function call even when '+=' is not available
-  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
-    && mv -f "$cfgfile.tmp" "$cfgfile" \
-      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-  test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
-  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
 # _LT_PATH_CONVERSION_FUNCTIONS
 # -----------------------------
-# Determine which file name conversion functions should be used by
+# Determine what file name conversion functions should be used by
 # func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
 # for certain cross-compile configurations and native mingw.
 m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
index 5d9acd8..94b0829 100644
--- a/m4/ltoptions.m4
+++ b/m4/ltoptions.m4
@@ -1,14 +1,14 @@
 # Helper functions for option handling.                    -*- Autoconf -*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-#   Inc.
+#   Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
 # unlimited permission to copy and/or distribute it, with or without
 # modifications, as long as this notice is preserved.
 
-# serial 7 ltoptions.m4
+# serial 8 ltoptions.m4
 
 # This is to help aclocal find these macros, as it can't see m4_define.
 AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
@@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION],
 [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
 m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
         _LT_MANGLE_DEFUN([$1], [$2]),
-    [m4_warning([Unknown $1 option `$2'])])[]dnl
+    [m4_warning([Unknown $1 option '$2'])])[]dnl
 ])
 
 
@@ -75,13 +75,15 @@ m4_if([$1],[LT_INIT],[
   dnl
   dnl If no reference was made to various pairs of opposing options, then
   dnl we run the default mode handler for the pair.  For example, if neither
-  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl 'shared' nor 'disable-shared' was passed, we enable building of shared
   dnl archives by default:
   _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
   _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
   _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
-  		   [_LT_ENABLE_FAST_INSTALL])
+		   [_LT_ENABLE_FAST_INSTALL])
+  _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4],
+		   [_LT_WITH_AIX_SONAME([aix])])
   ])
 ])# _LT_SET_OPTIONS
 
@@ -112,7 +114,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN],
 [_LT_SET_OPTION([LT_INIT], [dlopen])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
+put the 'dlopen' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -148,7 +150,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
 _LT_SET_OPTION([LT_INIT], [win32-dll])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
+put the 'win32-dll' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -157,9 +159,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
 
 # _LT_ENABLE_SHARED([DEFAULT])
 # ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-shared flag, and supports the 'shared' and
+# 'disable-shared' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_SHARED],
 [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([shared],
@@ -172,14 +174,14 @@ AC_ARG_ENABLE([shared],
     *)
       enable_shared=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_shared=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
@@ -211,9 +213,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], [])
 
 # _LT_ENABLE_STATIC([DEFAULT])
 # ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-static flag, and support the 'static' and
+# 'disable-static' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_STATIC],
 [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([static],
@@ -226,14 +228,14 @@ AC_ARG_ENABLE([static],
     *)
      enable_static=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_static=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
@@ -265,9 +267,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], [])
 
 # _LT_ENABLE_FAST_INSTALL([DEFAULT])
 # ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+# implement the --enable-fast-install flag, and support the 'fast-install'
+# and 'disable-fast-install' LT_INIT options.
+# DEFAULT is either 'yes' or 'no'.  If omitted, it defaults to 'yes'.
 m4_define([_LT_ENABLE_FAST_INSTALL],
 [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
 AC_ARG_ENABLE([fast-install],
@@ -280,14 +282,14 @@ AC_ARG_ENABLE([fast-install],
     *)
       enable_fast_install=no
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for pkg in $enableval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$pkg" = "X$p"; then
 	  enable_fast_install=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
     [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
@@ -304,14 +306,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
+the 'fast-install' option into LT_INIT's first parameter.])
 ])
 
 AU_DEFUN([AC_DISABLE_FAST_INSTALL],
 [_LT_SET_OPTION([LT_INIT], [disable-fast-install])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
+the 'disable-fast-install' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
@@ -319,11 +321,64 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
 dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
 
 
+# _LT_WITH_AIX_SONAME([DEFAULT])
+# ----------------------------------
+# implement the --with-aix-soname flag, and support the `aix-soname=aix'
+# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT
+# is either `aix', `both' or `svr4'.  If omitted, it defaults to `aix'.
+m4_define([_LT_WITH_AIX_SONAME],
+[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl
+shared_archive_member_spec=
+case $host,$enable_shared in
+power*-*-aix[[5-9]]*,yes)
+  AC_MSG_CHECKING([which variant of shared library versioning to provide])
+  AC_ARG_WITH([aix-soname],
+    [AS_HELP_STRING([--with-aix-soname=aix|svr4|both],
+      [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])],
+    [case $withval in
+    aix|svr4|both)
+      ;;
+    *)
+      AC_MSG_ERROR([Unknown argument to --with-aix-soname])
+      ;;
+    esac
+    lt_cv_with_aix_soname=$with_aix_soname],
+    [AC_CACHE_VAL([lt_cv_with_aix_soname],
+      [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT)
+    with_aix_soname=$lt_cv_with_aix_soname])
+  AC_MSG_RESULT([$with_aix_soname])
+  if test aix != "$with_aix_soname"; then
+    # For the AIX way of multilib, we name the shared archive member
+    # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o',
+    # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File.
+    # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag,
+    # the AIX toolchain works better with OBJECT_MODE set (default 32).
+    if test 64 = "${OBJECT_MODE-32}"; then
+      shared_archive_member_spec=shr_64
+    else
+      shared_archive_member_spec=shr
+    fi
+  fi
+  ;;
+*)
+  with_aix_soname=aix
+  ;;
+esac
+
+_LT_DECL([], [shared_archive_member_spec], [0],
+    [Shared archive member basename, for filename based shared library versioning on AIX])dnl
+])# _LT_WITH_AIX_SONAME
+
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])])
+LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])])
+
+
 # _LT_WITH_PIC([MODE])
 # --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# implement the --with-pic flag, and support the 'pic-only' and 'no-pic'
 # LT_INIT options.
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+# MODE is either 'yes' or 'no'.  If omitted, it defaults to 'both'.
 m4_define([_LT_WITH_PIC],
 [AC_ARG_WITH([pic],
     [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
@@ -334,19 +389,17 @@ m4_define([_LT_WITH_PIC],
     *)
       pic_mode=default
       # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR,
       for lt_pkg in $withval; do
-	IFS="$lt_save_ifs"
+	IFS=$lt_save_ifs
 	if test "X$lt_pkg" = "X$lt_p"; then
 	  pic_mode=yes
 	fi
       done
-      IFS="$lt_save_ifs"
+      IFS=$lt_save_ifs
       ;;
     esac],
-    [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+    [pic_mode=m4_default([$1], [default])])
 
 _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
 ])# _LT_WITH_PIC
@@ -359,7 +412,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE],
 [_LT_SET_OPTION([LT_INIT], [pic-only])
 AC_DIAGNOSE([obsolete],
 [$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
+put the 'pic-only' option into LT_INIT's first parameter.])
 ])
 
 dnl aclocal-1.4 backwards compatibility:
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
index 9000a05..48bc934 100644
--- a/m4/ltsugar.m4
+++ b/m4/ltsugar.m4
@@ -1,6 +1,7 @@
 # ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
 #
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software
+# Foundation, Inc.
 # Written by Gary V. Vaughan, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -33,7 +34,7 @@ m4_define([_lt_join],
 # ------------
 # Manipulate m4 lists.
 # These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
+# Autoconf-2.59, which quotes differently.
 m4_define([lt_car], [[$1]])
 m4_define([lt_cdr],
 [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
@@ -44,7 +45,7 @@ m4_define([lt_unquote], $1)
 
 # lt_append(MACRO-NAME, STRING, [SEPARATOR])
 # ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'.
 # Note that neither SEPARATOR nor STRING are expanded; they are appended
 # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
 # No SEPARATOR is output if MACRO-NAME was previously undefined (different
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
index 07a8602..fa04b52 100644
--- a/m4/ltversion.m4
+++ b/m4/ltversion.m4
@@ -1,6 +1,6 @@
 # ltversion.m4 -- version numbers			-*- Autoconf -*-
 #
-#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc.
 #   Written by Scott James Remnant, 2004
 #
 # This file is free software; the Free Software Foundation gives
@@ -9,15 +9,15 @@
 
 # @configure_input@
 
-# serial 3337 ltversion.m4
+# serial 4179 ltversion.m4
 # This file is part of GNU Libtool
 
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
+m4_define([LT_PACKAGE_VERSION], [2.4.6])
+m4_define([LT_PACKAGE_REVISION], [2.4.6])
 
 AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
+[macro_version='2.4.6'
+macro_revision='2.4.6'
 _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
 _LT_DECL(, macro_revision, 0)
 ])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
index c573da9..c6b26f8 100644
--- a/m4/lt~obsolete.m4
+++ b/m4/lt~obsolete.m4
@@ -1,6 +1,7 @@
 # lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
 #
-#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software
+#   Foundation, Inc.
 #   Written by Scott James Remnant, 2004.
 #
 # This file is free software; the Free Software Foundation gives
@@ -11,7 +12,7 @@
 
 # These exist entirely to fool aclocal when bootstrapping libtool.
 #
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN),
 # which have later been changed to m4_define as they aren't part of the
 # exported API, or moved to Autoconf or Automake where they belong.
 #
@@ -25,7 +26,7 @@
 # included after everything else.  This provides aclocal with the
 # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
 # because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
 #
 # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
 # Yes, that means every name once taken will need to remain here until
diff --git a/src/examples/bdj_test.c b/src/devtools/bdj_test.c
similarity index 100%
rename from src/examples/bdj_test.c
rename to src/devtools/bdj_test.c
diff --git a/src/examples/bdjo_dump.c b/src/devtools/bdjo_dump.c
similarity index 99%
rename from src/examples/bdjo_dump.c
rename to src/devtools/bdjo_dump.c
index bcbd2af..c9c8141 100644
--- a/src/examples/bdjo_dump.c
+++ b/src/devtools/bdjo_dump.c
@@ -141,7 +141,7 @@ static void _app_management_table_print(const BDJO_APP_MANAGEMENT_TABLE *p)
     unsigned ii;
 
     for (ii = 0; ii < p->num_app; ii++) {
-        printf("Application %d:\n", ii);
+        printf("Application %u:\n", ii);
         _app_print(&p->app[ii]);
     }
 }
diff --git a/src/examples/clpi_dump.c b/src/devtools/clpi_dump.c
similarity index 100%
rename from src/examples/clpi_dump.c
rename to src/devtools/clpi_dump.c
diff --git a/src/examples/hdmv_test.c b/src/devtools/hdmv_test.c
similarity index 100%
rename from src/examples/hdmv_test.c
rename to src/devtools/hdmv_test.c
diff --git a/src/examples/mobj_dump.c b/src/devtools/mobj_dump.c
similarity index 100%
rename from src/examples/mobj_dump.c
rename to src/devtools/mobj_dump.c
diff --git a/src/examples/mpls_dump.c b/src/devtools/mpls_dump.c
similarity index 97%
rename from src/examples/mpls_dump.c
rename to src/devtools/mpls_dump.c
index 619b6b2..de7da0e 100644
--- a/src/examples/mpls_dump.c
+++ b/src/devtools/mpls_dump.c
@@ -741,6 +741,13 @@ main(int argc, char *argv[])
         if (S_ISDIR(st.st_mode)) {
 
             printf("Directory: %s:\n", argv[ii]);
+
+            /* drop old ones (do not check for duplicates across directories) */
+            for (int jj = 0; jj < pl_ii; jj++) {
+                bd_free_mpls(pl_list[jj]);
+            }
+            pl_ii = 0;
+
             path = _mk_path(argv[ii], PLAYLIST_DIR);
             if (path == NULL) {
                 fprintf(stderr, "Failed to find playlist path: %s\n", argv[ii]);
@@ -761,7 +768,7 @@ main(int argc, char *argv[])
                 dirlist[jj++] = strcpy((char*)malloc(strlen(ent->d_name)), ent->d_name);
             }
             qsort(dirlist, jj, sizeof(char*), _qsort_str_cmp);
-            for (jj = 0; dirlist[jj] != NULL; jj++) {
+            for (jj = 0; dirlist[jj] != NULL && pl_ii < 1000; jj++) {
                 char *name = NULL;
                 name = _mk_path(path, dirlist[jj]);
                 free(dirlist[jj]);
@@ -781,13 +788,19 @@ main(int argc, char *argv[])
             }
             free(dirlist);
             free(path);
+            closedir(dir);
+            dir = NULL;
         } else {
             pl = _process_file(argv[ii], pl_list, pl_ii);
             if (pl != NULL) {
                 pl_list[pl_ii++] = pl;
             }
         }
+        if (pl_ii >= 999) {
+            fprintf(stderr, "Error: too many play lists given. Output is truncated.\n");
+        }
     }
+
     // Cleanup
     for (ii = 0; ii < pl_ii; ii++) {
         bd_free_mpls(pl_list[ii]);
diff --git a/src/examples/util.c b/src/devtools/util.c
similarity index 100%
rename from src/examples/util.c
rename to src/devtools/util.c
diff --git a/src/examples/util.h b/src/devtools/util.h
similarity index 100%
rename from src/examples/util.h
rename to src/devtools/util.h
diff --git a/src/examples/list_titles.c b/src/examples/list_titles.c
index 2e0cae8..9319e9e 100644
--- a/src/examples/list_titles.c
+++ b/src/examples/list_titles.c
@@ -24,7 +24,7 @@
 #include <inttypes.h>
 #include <unistd.h>
 
-#define OPTS "ahs:"
+#define OPTS "ahs:l"
 
 static void _usage(char *cmd)
 {
@@ -33,17 +33,38 @@ static void _usage(char *cmd)
 "   List the titles and title info of a BD\n"
 "   -s #    - Filter out titles shorter than # seconds\n"
 "   -a      - List all titles\n"
+"   -l      - Show language codes\n"
 "   -h      - This message\n",
         cmd
     );
     exit(EXIT_FAILURE);
 }
 
+static void _print_langs(const char *tag, const BLURAY_STREAM_INFO *si, int count)
+{
+    int ii;
+    printf("\t%s: ", tag);
+    for (ii = 0; ii < count; ii++) {
+        printf("%3.3s ", si[ii].lang);
+    }
+    printf("\n");
+}
+
+static void _dump_langs(const BLURAY_CLIP_INFO *ci)
+{
+    if (ci->audio_streams) {
+        _print_langs("AUD",  ci->audio_streams, ci->audio_stream_count);
+    }
+    if (ci->pg_streams) {
+        _print_langs("PG ",  ci->pg_streams,    ci->pg_stream_count);
+    }
+}
+
 int main(int argc, char *argv[])
 {
     BLURAY *bd;
     int count, ii, opt, main_title;
-    unsigned int seconds = 0;
+    unsigned int seconds = 0, langs = 0;
     unsigned int flags = TITLES_RELEVANT;
     char *bd_dir = NULL;
 
@@ -66,6 +87,9 @@ int main(int argc, char *argv[])
             case 's':
                 seconds = strtol(optarg, NULL, 0);
                 break;
+            case 'l':
+                langs = 1;
+                break;
             case 'h':
             default:
                 _usage(argv[0]);
@@ -78,7 +102,10 @@ int main(int argc, char *argv[])
         _usage(argv[0]);
     }
     bd = bd_open(bd_dir, NULL);
-
+    if (!bd) {
+        fprintf(stderr, "bd_open(%s) failed\n", bd_dir);
+        exit(EXIT_FAILURE);
+    }
     count = bd_get_titles(bd, flags, seconds);
     main_title = bd_get_main_title(bd);
     if (main_title >= 0) {
@@ -89,7 +116,7 @@ int main(int argc, char *argv[])
         BLURAY_TITLE_INFO* ti;
         ti = bd_get_title_info(bd, ii, 0);
         printf(
-       "index: %d duration: %02"PRIu64":%02"PRIu64":%02"PRIu64" chapters: %3d angles: %2u clips: %3u (playlist: %05d.mpls) "
+       "index: %3d duration: %02"PRIu64":%02"PRIu64":%02"PRIu64" chapters: %3d angles: %2u clips: %3u (playlist: %05d.mpls) "
        "V:%d A:%-2d PG:%-2d IG:%-2d SV:%d SA:%d\n",
               ii + 1,
               (ti->duration / 90000) / (3600),
@@ -103,6 +130,9 @@ int main(int argc, char *argv[])
               ti->clips[0].sec_video_stream_count,
               ti->clips[0].sec_audio_stream_count
         );
+        if (langs) {
+            _dump_langs(&ti->clips[0]);
+        }
         bd_free_title_info(ti);
     }
     bd_close(bd);
diff --git a/src/file/file_posix.c b/src/file/file_posix.c
index 2a79f6f..69cfcaa 100644
--- a/src/file/file_posix.c
+++ b/src/file/file_posix.c
@@ -48,7 +48,9 @@
 static void _file_close(BD_FILE_H *file)
 {
     if (file) {
-        close((int)(intptr_t)file->internal);
+        if (close((int)(intptr_t)file->internal)) {
+            BD_DEBUG(DBG_CRIT | DBG_FILE, "Error closing POSIX file (%p)\n", (void*)file);
+        }
 
         BD_DEBUG(DBG_FILE, "Closed POSIX file (%p)\n", (void*)file);
 
@@ -108,6 +110,13 @@ static int64_t _file_write(BD_FILE_H *file, const uint8_t *buf, int64_t size)
     ssize_t written, result;
 
     if (size <= 0 || size >= BD_MAX_SSIZE) {
+        if (size == 0) {
+            if (fsync((int)(intptr_t)file->internal)) {
+                BD_DEBUG(DBG_FILE, "fsync() failed (%p)\n", (void*)file);
+                return -1;
+            }
+            return 0;
+        }
         BD_DEBUG(DBG_FILE | DBG_CRIT, "Ignoring invalid write of size %"PRId64" (%p)\n", size, (void*)file);
         return 0;
     }
diff --git a/src/file/file_win32.c b/src/file/file_win32.c
index 5eb52d7..d9845fb 100644
--- a/src/file/file_win32.c
+++ b/src/file/file_win32.c
@@ -40,7 +40,9 @@
 static void _file_close(BD_FILE_H *file)
 {
     if (file) {
-        fclose((FILE *)file->internal);
+        if (fclose((FILE *)file->internal)) {
+            BD_DEBUG(DBG_FILE | DBG_CRIT, "Error closing WIN32 file (%p)\n", (void*)file);
+        }
 
         BD_DEBUG(DBG_FILE, "Closed WIN32 file (%p)\n", (void*)file);
 
@@ -89,6 +91,14 @@ static int64_t _file_write(BD_FILE_H *file, const uint8_t *buf, int64_t size)
         return (int64_t)fwrite(buf, 1, (size_t)size, (FILE *)file->internal);
     }
 
+    if (size == 0) {
+        if (fflush((FILE *)file->internal)) {
+            BD_DEBUG(DBG_FILE, "fflush() failed (%p)\n", (void*)file);
+            return -1;
+        }
+        return 0;
+    }
+
     BD_DEBUG(DBG_FILE | DBG_CRIT, "Ignoring invalid write of size %"PRId64" (%p)\n", size, (void*)file);
     return 0;
 }
diff --git a/src/file/filesystem.h b/src/file/filesystem.h
index 8ec6f85..3fe54c8 100644
--- a/src/file/filesystem.h
+++ b/src/file/filesystem.h
@@ -71,6 +71,7 @@ typedef BD_DIR_H* (*BD_DIR_OPEN) (const char* dirname);
  * @param p function pointer
  * @return previous function pointer registered
  */
+/* deprecated - use bd_open_files() instead */
 BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p);
 
 /**
@@ -80,6 +81,7 @@ BD_FILE_OPEN bd_register_file(BD_FILE_OPEN p);
  * @param p function pointer
  * @return previous function pointer registered
  */
+/* deprecated - use bd_open_files() instead */
 BD_DIR_OPEN bd_register_dir(BD_DIR_OPEN p);
 
 #ifdef __cplusplus
diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 23d944a..ef82ee4 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -167,7 +167,7 @@ static inline char *_utf8_to_cp(const char *utf8)
 static void *_jvm_dlopen(const char *java_home, const char *jvm_dir, const char *jvm_lib)
 {
     if (java_home) {
-        char *path = str_printf("%s/%s/%s", java_home, jvm_dir, jvm_lib);
+        char *path = str_printf("%s" DIR_SEP "%s" DIR_SEP "%s", java_home, jvm_dir, jvm_lib);
         if (!path) {
             BD_DEBUG(DBG_CRIT, "out of memory\n");
             return NULL;
@@ -197,14 +197,17 @@ static void *_load_jvm(const char **p_java_home)
 #else
 # ifdef _WIN32
     static const char *jvm_path[] = {NULL, JDK_HOME};
-    static const char  jvm_dir[]  = "jre/bin/server";
+    static const char  jvm_dir[]  = "jre\\bin\\server";
     static const char  jvm_lib[]  = "jvm";
 # else
     static const char *jvm_path[] = {NULL, JDK_HOME,
-                                    "/usr/lib/jvm/default-java",
-                                    "/usr/lib/jvm/java-6-openjdk",
-                                    "/usr/lib/jvm/java-7-openjdk",
-                                    "/etc/java-config-2/current-system-vm"};
+                                     "/usr/lib/jvm/default-java",
+                                     "/usr/lib/jvm/default",
+                                     "/etc/java-config-2/current-system-vm",
+                                     "/usr/lib/jvm/java-7-openjdk",
+                                     "/usr/lib/jvm/java-8-openjdk",
+                                     "/usr/lib/jvm/java-6-openjdk",
+    };
     static const char  jvm_dir[]  = "jre/lib/" JAVA_ARCH "/server";
     static const char  jvm_lib[]  = "libjvm";
 # endif
@@ -511,6 +514,7 @@ static int _create_jvm(void *jvm_lib, const char *java_home, const char *jar_fil
     JavaVMInitArgs args;
     option[n++].optionString = str_dup   ("-Dawt.toolkit=java.awt.BDToolkit");
     option[n++].optionString = str_dup   ("-Djava.awt.graphicsenv=java.awt.BDGraphicsEnvironment");
+    option[n++].optionString = str_dup   ("-Djavax.accessibility.assistive_technologies= ");
     option[n++].optionString = str_printf("-Xbootclasspath/p:%s", jar_file);
     option[n++].optionString = str_dup   ("-Xms256M");
     option[n++].optionString = str_dup   ("-Xmx256M");
@@ -695,6 +699,7 @@ int bdj_process_event(BDJAVA *bdjava, unsigned ev, unsigned param)
         "AUDIO_STREAM",
         "SECONDARY_STREAM",
         "UO_MASKED",
+        "SEEK",
     };
 
     JNIEnv* env;
diff --git a/src/libbluray/bdj/bdj.h b/src/libbluray/bdj/bdj.h
index f6cd97b..8c9feaf 100644
--- a/src/libbluray/bdj/bdj.h
+++ b/src/libbluray/bdj/bdj.h
@@ -42,6 +42,7 @@ typedef enum {
     BDJ_EVENT_AUDIO_STREAM,
     BDJ_EVENT_SECONDARY_STREAM,
     BDJ_EVENT_UO_MASKED,
+    BDJ_EVENT_SEEK,
 } BDJ_EVENT;
 
 typedef struct {
diff --git a/src/libbluray/bdj/java-j2me/org/dvb/ui/DVBGraphicsImpl.java b/src/libbluray/bdj/java-j2me/org/dvb/ui/DVBGraphicsImpl.java
index 93cd308..474c059 100644
--- a/src/libbluray/bdj/java-j2me/org/dvb/ui/DVBGraphicsImpl.java
+++ b/src/libbluray/bdj/java-j2me/org/dvb/ui/DVBGraphicsImpl.java
@@ -36,9 +36,12 @@ import java.awt.image.ImageObserver;
 import java.text.AttributedCharacterIterator;
 
 public class DVBGraphicsImpl extends DVBGraphics {
+
+    private Graphics2D gfx;
+
     protected DVBGraphicsImpl(Graphics2D gfx)
     {
-        super(gfx);
+        this.gfx = gfx;
     }
 
     /*
diff --git a/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java b/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java
index 54c24e5..77ce66e 100644
--- a/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java
+++ b/src/libbluray/bdj/java-j2se/java/awt/BDGraphics.java
@@ -53,6 +53,7 @@ class BDGraphics extends BDGraphicsBase {
 
     public java.awt.font.FontRenderContext getFontRenderContext()
     {
+        logger.unimplemented("getFontRenderContext");
         return null;
     }
     public void setPaint(Paint p) {
diff --git a/src/libbluray/bdj/java-j2se/org/dvb/ui/DVBGraphicsImpl.java b/src/libbluray/bdj/java-j2se/org/dvb/ui/DVBGraphicsImpl.java
index 6600634..d429f1d 100644
--- a/src/libbluray/bdj/java-j2se/org/dvb/ui/DVBGraphicsImpl.java
+++ b/src/libbluray/bdj/java-j2se/org/dvb/ui/DVBGraphicsImpl.java
@@ -46,9 +46,12 @@ import java.text.AttributedCharacterIterator;
 import java.util.Map;
 
 public class DVBGraphicsImpl extends DVBGraphics {
+
+    private Graphics2D gfx;
+
     protected DVBGraphicsImpl(Graphics2D gfx)
     {
-        super(gfx);
+        this.gfx = gfx;
     }
 
     /*
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java b/src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java
index 8218a7d..05a88ef 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java
+++ b/src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java
@@ -30,6 +30,7 @@ public class DeviceAttribute {
         byte bid[] = Libbluray.getAacsData(Libbluray.AACS_DEVICE_BINDING_ID);
         if (bid == null) {
             Logger.getLogger(DeviceAttribute.class.getName()).warning("getDeviceBindingID() failed");
+            return new byte[16];
         }
         return bid;
     }
diff --git a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
index f7e60f7..0e2fd5f 100644
--- a/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDGraphicsBase.java
@@ -31,13 +31,16 @@ import java.awt.image.ImageConsumer;
 import java.awt.image.ImageObserver;
 
 import org.dvb.ui.DVBBufferedImage;
+import org.dvb.ui.DVBAlphaComposite;
+import org.dvb.ui.DVBGraphics;
+import org.dvb.ui.UnsupportedDrawingOperationException;
 
 import sun.awt.ConstrainableGraphics;
 
 import org.videolan.GUIManager;
 import org.videolan.Logger;
 
-abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphics {
+abstract class BDGraphicsBase extends DVBGraphics implements ConstrainableGraphics {
     private static final Color DEFAULT_COLOR = Color.BLACK;
     private static final Font DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12);
 
@@ -146,6 +149,52 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
         return new BDGraphics((BDGraphics)this);
     }
 
+    /*
+     * DVBGraphics methods
+     */
+
+    public int[] getAvailableCompositeRules()
+    {
+        /*
+        int[] rules = { DVBAlphaComposite.CLEAR, DVBAlphaComposite.SRC,
+                        DVBAlphaComposite.SRC_OVER, DVBAlphaComposite.DST_OVER,
+                        DVBAlphaComposite.SRC_IN, DVBAlphaComposite.DST_IN,
+                        DVBAlphaComposite.SRC_OUT, DVBAlphaComposite.DST_OUT };
+        */
+        int[] rules = {
+            DVBAlphaComposite.CLEAR,
+            DVBAlphaComposite.SRC,
+            DVBAlphaComposite.SRC_OVER };
+
+        return rules;
+    }
+
+    public DVBAlphaComposite getDVBComposite()
+    {
+        Composite comp = getComposite();
+        if (!(comp instanceof AlphaComposite))
+            return null;
+        return DVBAlphaComposite.getInstance(
+                                             ((AlphaComposite)comp).getRule(),
+                                             ((AlphaComposite)comp).getAlpha());
+    }
+
+    public void setDVBComposite(DVBAlphaComposite comp)
+                    throws UnsupportedDrawingOperationException
+    {
+        if ((comp.getRule() < DVBAlphaComposite.CLEAR) ||
+            (comp.getRule() > DVBAlphaComposite.SRC_OVER)) {
+            logger.error("setDVBComposite() FAILED: unsupported rule " + comp.getRule());
+            throw new UnsupportedDrawingOperationException("Unsupported composition rule: " + comp.getRule());
+        }
+
+        setComposite(AlphaComposite.getInstance(comp.getRule(), comp.getAlpha()));
+    }
+
+    /*
+     *
+     */
+
     public void translate(int x, int y) {
         originX += x;
         originY += y;
@@ -170,7 +219,11 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
     }
 
     public FontMetrics getFontMetrics(Font font) {
-        return BDFontMetrics.getFontMetrics(font);
+        if (font != null) {
+            return BDFontMetrics.getFontMetrics(font);
+        }
+        logger.error("getFontMetrics(null) from " + Logger.dumpStack());
+        return null;
     }
 
     public void setColor(Color c) {
@@ -192,8 +245,10 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
 
     public void setComposite(Composite comp) {
         if ((comp != null) && (comp != composite)) {
-            if (!(comp instanceof AlphaComposite))
+            if (!(comp instanceof AlphaComposite)) {
+                logger.error("Composite is not AlphaComposite");
                 throw new IllegalArgumentException("Only AlphaComposite is supported");
+            }
             composite = (AlphaComposite) comp;
         }
     }
@@ -255,8 +310,10 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
         } else if (clip instanceof Rectangle) {
             Rectangle rect = (Rectangle) clip;
             setClip(rect.x, rect.y, rect.width, rect.height);
-        } else
+        } else {
+            logger.error("Shape is not Rectangle: " + clip.getClass().getName());
             throw new IllegalArgumentException("setClip(Shape) only supports Rectangle objects");
+        }
     }
 
     private void setupClip() {
@@ -1463,9 +1520,11 @@ abstract class BDGraphicsBase extends Graphics2D implements ConstrainableGraphic
         try {
             return (Image)bufferedImagePeer.get(image);
         } catch (IllegalArgumentException e) {
-            e.printStackTrace();
+            logger.error("Failed getting buffered image peer: " + e + "\n" +
+                         Logger.dumpStack(e));
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            logger.error("Failed getting buffered image peer: " + e + "\n" +
+                         Logger.dumpStack(e));
         }
         return null;
     }
diff --git a/src/libbluray/bdj/java/java/awt/BDGraphicsConfigurationBase.java b/src/libbluray/bdj/java/java/awt/BDGraphicsConfigurationBase.java
index c215fab..cc3495c 100644
--- a/src/libbluray/bdj/java/java/awt/BDGraphicsConfigurationBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDGraphicsConfigurationBase.java
@@ -45,7 +45,7 @@ abstract class BDGraphicsConfigurationBase extends GraphicsConfiguration {
         return BufferedImage.TYPE_INT_ARGB;
     }
 
-    public synchronized ColorModel getColorModel() {
+    public ColorModel getColorModel() {
         return new DirectColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB),
                                     32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000, true,
                                     DataBuffer.TYPE_INT);
diff --git a/src/libbluray/bdj/java/java/awt/BDGraphicsEnvironment.java b/src/libbluray/bdj/java/java/awt/BDGraphicsEnvironment.java
index 0a28cb9..c29c844 100644
--- a/src/libbluray/bdj/java/java/awt/BDGraphicsEnvironment.java
+++ b/src/libbluray/bdj/java/java/awt/BDGraphicsEnvironment.java
@@ -31,7 +31,7 @@ class BDGraphicsEnvironment extends GraphicsEnvironment {
         graphicsDevice = new BDGraphicsDevice(this);
     }
 
-    public synchronized GraphicsDevice[] getScreenDevices() {
+    public GraphicsDevice[] getScreenDevices() {
         return new GraphicsDevice[] { graphicsDevice };
     }
 
diff --git a/src/libbluray/bdj/java/java/awt/BDImageConsumer.java b/src/libbluray/bdj/java/java/awt/BDImageConsumer.java
index a076873..3f54a29 100644
--- a/src/libbluray/bdj/java/java/awt/BDImageConsumer.java
+++ b/src/libbluray/bdj/java/java/awt/BDImageConsumer.java
@@ -158,6 +158,7 @@ class BDImageConsumer extends BDImage implements ImageConsumer {
         for (Y = y; Y < (y + h); Y++)
             for (X = x; X < (x + w); X++)
                 backBuffer[Y * width + X] = cm.getRGB(pixels[offset + (Y - y) * scansize + (X - x)] & 0xFF);
+        dirty.add(new Rectangle(x, y, w, h));
         status |= ImageObserver.SOMEBITS;
         notifyObservers(this, ImageObserver.SOMEBITS, x, y, w, h);
     }
@@ -167,6 +168,7 @@ class BDImageConsumer extends BDImage implements ImageConsumer {
         for (Y = y; Y < (y + h); Y++)
             for (X = x; X < (x + w); X++)
                 backBuffer[Y * width + X] = cm.getRGB(pixels[offset + (Y - y) * scansize + (X - x)]);
+        dirty.add(new Rectangle(x, y, w, h));
         status |= ImageObserver.SOMEBITS;
         notifyObservers(this, ImageObserver.SOMEBITS, x, y, w, h);
     }
diff --git a/src/libbluray/bdj/java/java/awt/BDOffScreenImageSource.java b/src/libbluray/bdj/java/java/awt/BDOffScreenImageSource.java
index d42eff7..63b14d8 100644
--- a/src/libbluray/bdj/java/java/awt/BDOffScreenImageSource.java
+++ b/src/libbluray/bdj/java/java/awt/BDOffScreenImageSource.java
@@ -39,16 +39,16 @@ class BDOffScreenImageSource implements ImageProducer {
         this.buffer = buffer;
     }
 
-    public synchronized void addConsumer(ImageConsumer ic) {
+    public void addConsumer(ImageConsumer ic) {
         consumer = ic;
         produce();
     }
 
-    public synchronized boolean isConsumer(ImageConsumer ic) {
+    public boolean isConsumer(ImageConsumer ic) {
         return (ic == consumer);
     }
 
-    public synchronized void removeConsumer(ImageConsumer ic) {
+    public void removeConsumer(ImageConsumer ic) {
         if (consumer == ic) {
             consumer = null;
         }
diff --git a/src/libbluray/bdj/java/java/awt/BDToolkitBase.java b/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
index dc61bef..0f5e3e0 100644
--- a/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
@@ -124,6 +124,10 @@ abstract class BDToolkitBase extends Toolkit {
     }
 
     public Image getImage(String filename) {
+        if (BDJXletContext.getCurrentContext() == null) {
+            logger.error("getImage(): no context " + Logger.dumpStack());
+        }
+
         if (cachedImages.containsKey(filename))
             return (Image)cachedImages.get(filename);
         Image newImage = createImage(filename);
@@ -133,6 +137,10 @@ abstract class BDToolkitBase extends Toolkit {
     }
 
     public Image getImage(URL url) {
+        if (BDJXletContext.getCurrentContext() == null) {
+            logger.error("getImage(): no context " + Logger.dumpStack());
+        }
+
         if (cachedImages.containsKey(url))
             return (Image)cachedImages.get(url);
         Image newImage = createImage(url);
@@ -142,6 +150,10 @@ abstract class BDToolkitBase extends Toolkit {
     }
 
     public Image createImage(String filename) {
+        if (BDJXletContext.getCurrentContext() == null) {
+            logger.error("createImage(): no context " + Logger.dumpStack());
+        }
+
         if (!new File(filename).isAbsolute()) {
             String home = BDJXletContext.getCurrentXletHome();
             if (home != null) {
@@ -161,6 +173,9 @@ abstract class BDToolkitBase extends Toolkit {
     }
 
     public Image createImage(URL url) {
+        if (BDJXletContext.getCurrentContext() == null) {
+            logger.error("createImage(): no context " + Logger.dumpStack());
+        }
         ImageProducer ip = new URLImageSource(url);
         Image newImage = createImage(ip);
         return newImage;
@@ -169,12 +184,20 @@ abstract class BDToolkitBase extends Toolkit {
     public Image createImage(byte[] imagedata,
         int imageoffset,
         int imagelength) {
+
+        if (BDJXletContext.getCurrentContext() == null) {
+            logger.error("createImage(): no context " + Logger.dumpStack());
+        }
+
         ImageProducer ip = new ByteArrayImageSource(imagedata, imageoffset, imagelength);
         Image newImage = createImage(ip);
         return newImage;
     }
 
     public Image createImage(ImageProducer producer) {
+        if (BDJXletContext.getCurrentContext() == null) {
+            logger.error("createImage(): no context " + Logger.dumpStack());
+        }
         return new BDImageConsumer(producer);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/CachingControlEvent.java b/src/libbluray/bdj/java/javax/media/CachingControlEvent.java
index a77585b..40fcc6a 100644
--- a/src/libbluray/bdj/java/javax/media/CachingControlEvent.java
+++ b/src/libbluray/bdj/java/javax/media/CachingControlEvent.java
@@ -21,25 +21,27 @@ package javax.media;
 
 public class CachingControlEvent extends ControllerEvent {
     public CachingControlEvent(Controller from, CachingControl cacheControl,
-            long progress)
-    {
+            long progress) {
         super(from);
 
         this.cacheControl = cacheControl;
         this.progress = progress;
     }
 
-    public CachingControl getCachingControl()
-    {
+    public CachingControl getCachingControl() {
         return cacheControl;
     }
 
-    public long getContentProgress()
-    {
+    public long getContentProgress() {
         return progress;
     }
 
-    private CachingControl cacheControl;
-    private long progress;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",cacheControl=" + cacheControl + ",progress=" + progress + "]";
+    }
+
+    private final CachingControl cacheControl;
+    private final long progress;
+
     private static final long serialVersionUID = 8877038236738665179L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/ClockStartedError.java b/src/libbluray/bdj/java/javax/media/ClockStartedError.java
index 05fc411..950328e 100644
--- a/src/libbluray/bdj/java/javax/media/ClockStartedError.java
+++ b/src/libbluray/bdj/java/javax/media/ClockStartedError.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class ClockStartedError extends MediaError {
-    public ClockStartedError()
-    {
+    public ClockStartedError() {
         super();
     }
 
-    public ClockStartedError(String reason)
-    {
+    public ClockStartedError(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/ClockStoppedException.java b/src/libbluray/bdj/java/javax/media/ClockStoppedException.java
index c093d9c..4741842 100644
--- a/src/libbluray/bdj/java/javax/media/ClockStoppedException.java
+++ b/src/libbluray/bdj/java/javax/media/ClockStoppedException.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class ClockStoppedException extends MediaException {
-    public ClockStoppedException()
-    {
+    public ClockStoppedException() {
         super();
     }
 
-    public ClockStoppedException(String reason)
-    {
+    public ClockStoppedException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/ConnectionErrorEvent.java b/src/libbluray/bdj/java/javax/media/ConnectionErrorEvent.java
index dc37005..b20b27a 100644
--- a/src/libbluray/bdj/java/javax/media/ConnectionErrorEvent.java
+++ b/src/libbluray/bdj/java/javax/media/ConnectionErrorEvent.java
@@ -22,13 +22,11 @@ package javax.media;
 import javax.media.Controller;
 
 public class ConnectionErrorEvent extends ControllerErrorEvent {
-    public ConnectionErrorEvent(Controller source)
-    {
+    public ConnectionErrorEvent(Controller source) {
         super(source);
     }
 
-    public ConnectionErrorEvent(Controller source, String reason)
-    {
+    public ConnectionErrorEvent(Controller source, String reason) {
         super(source, reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/ControllerClosedEvent.java b/src/libbluray/bdj/java/javax/media/ControllerClosedEvent.java
index db01bb9..600715d 100644
--- a/src/libbluray/bdj/java/javax/media/ControllerClosedEvent.java
+++ b/src/libbluray/bdj/java/javax/media/ControllerClosedEvent.java
@@ -20,23 +20,24 @@
 package javax.media;
 
 public class ControllerClosedEvent extends ControllerEvent {
-    public ControllerClosedEvent(Controller source)
-    {
+    public ControllerClosedEvent(Controller source) {
         super(source);
     }
 
-    public ControllerClosedEvent(Controller source, String reason)
-    {
+    public ControllerClosedEvent(Controller source, String reason) {
         super(source);
 
         this.reason = reason;
     }
 
-    public String getMessage()
-    {
+    public String getMessage() {
         return reason;
     }
 
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",reason=" + reason + "]";
+    }
+
     private String reason = "";
     private static final long serialVersionUID = 5868546288299613691L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/ControllerErrorEvent.java b/src/libbluray/bdj/java/javax/media/ControllerErrorEvent.java
index b2602c0..3949a5e 100644
--- a/src/libbluray/bdj/java/javax/media/ControllerErrorEvent.java
+++ b/src/libbluray/bdj/java/javax/media/ControllerErrorEvent.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class ControllerErrorEvent extends ControllerClosedEvent {
-    public ControllerErrorEvent(Controller source)
-    {
+    public ControllerErrorEvent(Controller source) {
         super(source);
     }
 
-    public ControllerErrorEvent(Controller source, String reason)
-    {
+    public ControllerErrorEvent(Controller source, String reason) {
         super(source, reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/ControllerEvent.java b/src/libbluray/bdj/java/javax/media/ControllerEvent.java
index 90992bd..74cb01e 100644
--- a/src/libbluray/bdj/java/javax/media/ControllerEvent.java
+++ b/src/libbluray/bdj/java/javax/media/ControllerEvent.java
@@ -22,23 +22,24 @@ package javax.media;
 import java.util.EventObject;
 
 public class ControllerEvent extends EventObject implements MediaEvent {
-    public ControllerEvent(Controller source)
-    {
+    public ControllerEvent(Controller source) {
         super(source);
 
         this.source = source;
     }
 
-    public Controller getSourceController()
-    {
+    public Controller getSourceController() {
         return source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    private Controller source;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + "]";
+    }
+
+    protected final Controller source;
     private static final long serialVersionUID = 2637536605185993242L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/DataStarvedEvent.java b/src/libbluray/bdj/java/javax/media/DataStarvedEvent.java
index ca573d2..eff3527 100644
--- a/src/libbluray/bdj/java/javax/media/DataStarvedEvent.java
+++ b/src/libbluray/bdj/java/javax/media/DataStarvedEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class DataStarvedEvent extends StopEvent {
     public DataStarvedEvent(Controller source, int previous, int current,
-            int target, Time mediaTime)
-    {
+            int target, Time mediaTime) {
         super(source, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/DeallocateEvent.java b/src/libbluray/bdj/java/javax/media/DeallocateEvent.java
index a7d46d1..7245bc5 100644
--- a/src/libbluray/bdj/java/javax/media/DeallocateEvent.java
+++ b/src/libbluray/bdj/java/javax/media/DeallocateEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class DeallocateEvent extends StopEvent {
     public DeallocateEvent(Controller source, int previous, int current,
-            int target, Time mediaTime)
-    {
+            int target, Time mediaTime) {
         super(source, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/DurationUpdateEvent.java b/src/libbluray/bdj/java/javax/media/DurationUpdateEvent.java
index 051f8c9..d0d2f01 100644
--- a/src/libbluray/bdj/java/javax/media/DurationUpdateEvent.java
+++ b/src/libbluray/bdj/java/javax/media/DurationUpdateEvent.java
@@ -20,18 +20,20 @@
 package javax.media;
 
 public class DurationUpdateEvent extends ControllerEvent {
-    public DurationUpdateEvent(Controller source, Time duration)
-    {
+    public DurationUpdateEvent(Controller source, Time duration) {
         super(source);
 
         this.duration = duration;
     }
 
-    public Time getDuration()
-    {
+    public Time getDuration() {
         return duration;
     }
 
-    private Time duration;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",duration=" + duration + "]";
+    }
+
+    private final Time duration;
     private static final long serialVersionUID = 400898256354068250L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/EndOfMediaEvent.java b/src/libbluray/bdj/java/javax/media/EndOfMediaEvent.java
index 1e0a328..f347e1f 100644
--- a/src/libbluray/bdj/java/javax/media/EndOfMediaEvent.java
+++ b/src/libbluray/bdj/java/javax/media/EndOfMediaEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class EndOfMediaEvent extends StopEvent {
     public EndOfMediaEvent(Controller source, int previous, int current,
-            int target, Time mediaTime)
-    {
+            int target, Time mediaTime) {
         super(source, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/GainChangeEvent.java b/src/libbluray/bdj/java/javax/media/GainChangeEvent.java
index cfa9eaf..5b6a846 100644
--- a/src/libbluray/bdj/java/javax/media/GainChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/media/GainChangeEvent.java
@@ -23,8 +23,7 @@ import java.util.EventObject;
 
 public class GainChangeEvent extends EventObject implements MediaEvent {
     public GainChangeEvent(GainControl source, boolean mute, float dB,
-            float level)
-    {
+            float level) {
         super(source);
         this.source = source;
         this.mute = mute;
@@ -32,34 +31,34 @@ public class GainChangeEvent extends EventObject implements MediaEvent {
         this.level = level;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    public GainControl getSourceGainControl()
-    {
+    public GainControl getSourceGainControl() {
         return source;
     }
 
-    public boolean getMute()
-    {
+    public boolean getMute() {
         return mute;
     }
 
-    public float getDB()
-    {
+    public float getDB() {
         return dB;
     }
 
-    public float getLevel()
-    {
+    public float getLevel() {
         return level;
     }
 
-    private GainControl source;
-    private boolean mute;
-    private float dB;
-    private float level;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",mute=" + mute + ",db=" + dB + ",level=" + level + "]";
+    }
+
+    private final GainControl source;
+    private final boolean mute;
+    private final float dB;
+    private final float level;
+
     private static final long serialVersionUID = -3685931181525562650L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/IncompatibleSourceException.java b/src/libbluray/bdj/java/javax/media/IncompatibleSourceException.java
index 1bfd469..d7f3812 100644
--- a/src/libbluray/bdj/java/javax/media/IncompatibleSourceException.java
+++ b/src/libbluray/bdj/java/javax/media/IncompatibleSourceException.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class IncompatibleSourceException extends MediaException {
-    public IncompatibleSourceException()
-    {
+    public IncompatibleSourceException() {
         super();
     }
 
-    public IncompatibleSourceException(String reason)
-    {
+    public IncompatibleSourceException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/IncompatibleTimeBaseException.java b/src/libbluray/bdj/java/javax/media/IncompatibleTimeBaseException.java
index 87cd08c..021b438 100644
--- a/src/libbluray/bdj/java/javax/media/IncompatibleTimeBaseException.java
+++ b/src/libbluray/bdj/java/javax/media/IncompatibleTimeBaseException.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class IncompatibleTimeBaseException extends MediaException {
-    public IncompatibleTimeBaseException()
-    {
+    public IncompatibleTimeBaseException() {
         super();
     }
 
-    public IncompatibleTimeBaseException(String reason)
-    {
+    public IncompatibleTimeBaseException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/InternalErrorEvent.java b/src/libbluray/bdj/java/javax/media/InternalErrorEvent.java
index e856066..f1f23f1 100644
--- a/src/libbluray/bdj/java/javax/media/InternalErrorEvent.java
+++ b/src/libbluray/bdj/java/javax/media/InternalErrorEvent.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class InternalErrorEvent extends ControllerErrorEvent {
-    public InternalErrorEvent(Controller source)
-    {
+    public InternalErrorEvent(Controller source) {
         super(source);
     }
 
-    public InternalErrorEvent(Controller source, String reason)
-    {
+    public InternalErrorEvent(Controller source, String reason) {
         super(source, reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/Manager.java b/src/libbluray/bdj/java/javax/media/Manager.java
index 37a50d2..48a41d5 100644
--- a/src/libbluray/bdj/java/javax/media/Manager.java
+++ b/src/libbluray/bdj/java/javax/media/Manager.java
@@ -1,3 +1,21 @@
+/*
+ * This file is part of libbluray
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
 package javax.media;
 
 import java.io.IOException;
@@ -16,14 +34,12 @@ import org.videolan.Logger;
  */
 public final class Manager {
     public static Player createPlayer(URL sourceURL) throws IOException,
-            NoPlayerException
-    {
+            NoPlayerException {
         return createPlayer(new MediaLocator(sourceURL));
     }
 
     public static Player createPlayer(MediaLocator sourceLocator)
-            throws IOException, NoPlayerException
-    {
+            throws IOException, NoPlayerException {
         final String protocol = sourceLocator.getProtocol();
         final Vector dataSourceList = getDataSourceList(protocol);
         for (int i = 0; i < dataSourceList.size(); ++i) {
@@ -83,20 +99,17 @@ public final class Manager {
     }
 
     public static Player createPlayer(DataSource source) throws IOException,
-            NoPlayerException
-    {
+            NoPlayerException {
         return createPlayer(source, source.getContentType());
     }
 
     public static DataSource createDataSource(URL sourceURL)
-            throws IOException, NoDataSourceException
-    {
+            throws IOException, NoDataSourceException {
         return createDataSource(new MediaLocator(sourceURL));
     }
 
     public static DataSource createDataSource(MediaLocator sourceLocator)
-            throws IOException, NoDataSourceException
-    {
+            throws IOException, NoDataSourceException {
         final String protocol = sourceLocator.getProtocol();
         final Vector dataSourceList = getDataSourceList(protocol);
         for (int i = 0; i < dataSourceList.size(); ++i) {
@@ -140,24 +153,20 @@ public final class Manager {
         return dataSource;
     }
 
-    public static TimeBase getSystemTimeBase()
-    {
+    public static TimeBase getSystemTimeBase() {
         return systemTimeBase;
     }
 
-    public static Vector getDataSourceList(String protocolName)
-    {
+    public static Vector getDataSourceList(String protocolName) {
         return getClassList(protocolName, PackageManager.getProtocolPrefixList(), "protocol", "DataSource");
     }
 
-    public static Vector getHandlerClassList(String contentName)
-    {
+    public static Vector getHandlerClassList(String contentName) {
         return getClassList(toPackageFriendly(contentName), PackageManager.getContentPrefixList(), "content", "Handler");
     }
 
     private static Player createPlayer(DataSource source, String contentType)
-        throws IOException, NoPlayerException
-    {
+        throws IOException, NoPlayerException {
         final Vector handlerClassList = getHandlerClassList(contentType);
         for (int i = 0; i < handlerClassList.size(); ++i) {
             final String handlerClassName = (String) handlerClassList.get(i);
@@ -210,8 +219,7 @@ public final class Manager {
         throw new NoPlayerException("No player found for " + source.getLocator());
     }
 
-    private static char toPackageFriendly(char c)
-    {
+    private static char toPackageFriendly(char c) {
         if (c >= 'a' && c <= 'z')
             return c;
         else if (c >= 'A' && c <= 'Z')
@@ -226,8 +234,7 @@ public final class Manager {
             return '_';
     }
 
-    private static String toPackageFriendly(String contentName)
-    {
+    private static String toPackageFriendly(String contentName) {
         final StringBuffer b = new StringBuffer();
         for (int i = 0; i < contentName.length(); ++i) {
             final char c = contentName.charAt(i);
@@ -236,8 +243,7 @@ public final class Manager {
         return b.toString();
     }
 
-    public static Vector getClassList(String contentName, Vector packages, String component2, String className)
-    {
+    public static Vector getClassList(String contentName, Vector packages, String component2, String className) {
         final Vector result = new Vector();
         //result.add("media." + component2 + "." + contentName + "." + className);
 
diff --git a/src/libbluray/bdj/java/javax/media/MediaError.java b/src/libbluray/bdj/java/javax/media/MediaError.java
index 2850391..7cb250a 100644
--- a/src/libbluray/bdj/java/javax/media/MediaError.java
+++ b/src/libbluray/bdj/java/javax/media/MediaError.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class MediaError extends Error {
-    public MediaError()
-    {
+    public MediaError() {
         super();
     }
 
-    public MediaError(String reason)
-    {
+    public MediaError(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/MediaException.java b/src/libbluray/bdj/java/javax/media/MediaException.java
index 41242a7..490d4bd 100644
--- a/src/libbluray/bdj/java/javax/media/MediaException.java
+++ b/src/libbluray/bdj/java/javax/media/MediaException.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class MediaException extends Exception {
-    public MediaException()
-    {
+    public MediaException() {
         super();
     }
 
-    public MediaException(String reason)
-    {
+    public MediaException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/MediaLocator.java b/src/libbluray/bdj/java/javax/media/MediaLocator.java
index a182e8d..1698764 100644
--- a/src/libbluray/bdj/java/javax/media/MediaLocator.java
+++ b/src/libbluray/bdj/java/javax/media/MediaLocator.java
@@ -25,27 +25,40 @@ import java.net.URL;
 
 public class MediaLocator implements Serializable
 {
-    public MediaLocator(URL url) { 
-        this(url.toExternalForm());
+    public MediaLocator(URL url) {
+        this.url = url;
+        if (url != null) {
+            this.locatorString = url.toString().trim();
+        }
     }
 
-    public MediaLocator(String locatorString) { 
-        int index = locatorString.indexOf(":");
-        if (index <= 0)
-            throw new IllegalArgumentException("Bad locator string.");
-        protocol = locatorString.substring(0, index);
-        remainder = locatorString.substring(index + 1);
+    public MediaLocator(String locatorString) {
+        if (locatorString != null)
+            this.locatorString = locatorString.trim();
     }
 
     public URL getURL() throws MalformedURLException {
-        return new URL(toExternalForm());
+        if (url == null) {
+            url = new URL(locatorString);
+        }
+        return url;
     }
 
     public String getProtocol() {
+        String protocol = "";
+        int col = locatorString.indexOf(":");
+        if (col >= 0) {
+            protocol = locatorString.substring(0, col);
+        }
         return protocol;
     }
 
     public String getRemainder() {
+        String remainder = "";
+        int col = locatorString.indexOf(":");
+        if (col >= 0) {
+            remainder = locatorString.substring(col + 1);
+        }
         return remainder;
     }
 
@@ -54,11 +67,11 @@ public class MediaLocator implements Serializable
     }
 
     public String toExternalForm() {
-        return protocol + ":" + remainder;
+        return locatorString;
     }
-    
-    private String protocol = "";
-    private String remainder = "";
+
+    private String locatorString = "";
+    private URL url = null;
 
     private static final long serialVersionUID = 1L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/MediaTimeSetEvent.java b/src/libbluray/bdj/java/javax/media/MediaTimeSetEvent.java
index c8966d4..3a81560 100644
--- a/src/libbluray/bdj/java/javax/media/MediaTimeSetEvent.java
+++ b/src/libbluray/bdj/java/javax/media/MediaTimeSetEvent.java
@@ -20,18 +20,21 @@
 package javax.media;
 
 public class MediaTimeSetEvent extends ControllerEvent {
-    public MediaTimeSetEvent(Controller from, Time mediaTime)
-    {
+    public MediaTimeSetEvent(Controller from, Time mediaTime) {
         super(from);
-        
+
         this.mediaTime = mediaTime;
     }
 
-    public Time getMediaTime()
-    {
+    public Time getMediaTime() {
         return mediaTime;
     }
 
-    private Time mediaTime;
+    public String toString() {
+        return getClass().toString() + "[source=" + source + ",mediaTime=" + mediaTime + "]";
+    }
+
+    private final Time mediaTime;
+
     private static final long serialVersionUID = -628446955261317468L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/NoDataSourceException.java b/src/libbluray/bdj/java/javax/media/NoDataSourceException.java
index daf498b..8fb1961 100644
--- a/src/libbluray/bdj/java/javax/media/NoDataSourceException.java
+++ b/src/libbluray/bdj/java/javax/media/NoDataSourceException.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class NoDataSourceException extends MediaException {
-    public NoDataSourceException()
-    {
+    public NoDataSourceException() {
         super();
     }
 
-    public NoDataSourceException(String reason)
-    {
+    public NoDataSourceException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/NoPlayerException.java b/src/libbluray/bdj/java/javax/media/NoPlayerException.java
index a32d571..486a7ed 100644
--- a/src/libbluray/bdj/java/javax/media/NoPlayerException.java
+++ b/src/libbluray/bdj/java/javax/media/NoPlayerException.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class NoPlayerException extends MediaException {
-    public NoPlayerException()
-    {
+    public NoPlayerException() {
         super();
     }
 
-    public NoPlayerException(String reason)
-    {
+    public NoPlayerException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/NotPrefetchedError.java b/src/libbluray/bdj/java/javax/media/NotPrefetchedError.java
index 574bb02..ac37722 100644
--- a/src/libbluray/bdj/java/javax/media/NotPrefetchedError.java
+++ b/src/libbluray/bdj/java/javax/media/NotPrefetchedError.java
@@ -20,8 +20,7 @@
 package javax.media;
 
 public class NotPrefetchedError extends MediaError {
-    public NotPrefetchedError(String reason)
-    {
+    public NotPrefetchedError(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/NotRealizedError.java b/src/libbluray/bdj/java/javax/media/NotRealizedError.java
index a9122fc..9f63da7 100644
--- a/src/libbluray/bdj/java/javax/media/NotRealizedError.java
+++ b/src/libbluray/bdj/java/javax/media/NotRealizedError.java
@@ -20,8 +20,7 @@
 package javax.media;
 
 public class NotRealizedError extends MediaError {
-    public NotRealizedError(String reason)
-    {
+    public NotRealizedError(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/PackageManager.java b/src/libbluray/bdj/java/javax/media/PackageManager.java
index b5229af..ff46ba1 100644
--- a/src/libbluray/bdj/java/javax/media/PackageManager.java
+++ b/src/libbluray/bdj/java/javax/media/PackageManager.java
@@ -22,46 +22,39 @@ package javax.media;
 import java.util.Vector;
 
 public class PackageManager {
-    public PackageManager()
-    {
+    public PackageManager() {
     }
 
-    public static Vector getProtocolPrefixList()
-    {
+    public static Vector getProtocolPrefixList() {
         return protocolPrefix;
     }
 
-    public static void setProtocolPrefixList(Vector list)
-    {
+    public static void setProtocolPrefixList(Vector list) {
         protocolPrefixTemp = list;
     }
 
-	public static void commitProtocolPrefixList()
-    {
+    public static void commitProtocolPrefixList() {
         SecurityManager sec = System.getSecurityManager();
         if (sec != null)
             sec.checkPropertiesAccess();
         protocolPrefix = (Vector) protocolPrefixTemp.clone();
     }
 
-	public static Vector getContentPrefixList()
-    {
+    public static Vector getContentPrefixList() {
         return contentPrefix;
     }
 
-    public static void setContentPrefixList(Vector list)
-    {
+    public static void setContentPrefixList(Vector list) {
         contentPrefixTemp = list;
     }
 
-    public static void commitContentPrefixList()
-    {
+    public static void commitContentPrefixList() {
         SecurityManager sec = System.getSecurityManager();
         if (sec != null)
             sec.checkPropertiesAccess();
         contentPrefix = (Vector) contentPrefixTemp.clone();
     }
-    
+
     private static Vector protocolPrefixTemp = null;
     private static Vector contentPrefixTemp = null;
     private static Vector protocolPrefix = null;
diff --git a/src/libbluray/bdj/java/javax/media/PrefetchCompleteEvent.java b/src/libbluray/bdj/java/javax/media/PrefetchCompleteEvent.java
index bcb04f7..a8821bb 100644
--- a/src/libbluray/bdj/java/javax/media/PrefetchCompleteEvent.java
+++ b/src/libbluray/bdj/java/javax/media/PrefetchCompleteEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class PrefetchCompleteEvent extends TransitionEvent {
     public PrefetchCompleteEvent(Controller source, int previous, int current,
-            int target)
-    {
+            int target) {
         super(source, previous, current, target);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/RateChangeEvent.java b/src/libbluray/bdj/java/javax/media/RateChangeEvent.java
index 5090123..cfe5bbb 100644
--- a/src/libbluray/bdj/java/javax/media/RateChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/media/RateChangeEvent.java
@@ -20,18 +20,21 @@
 package javax.media;
 
 public class RateChangeEvent extends ControllerEvent {
-    public RateChangeEvent(Controller source, float rate)
-    {
+    public RateChangeEvent(Controller source, float rate) {
         super(source);
 
         this.rate = rate;
     }
 
-    public float getRate()
-    {
+    public float getRate() {
         return rate;
     }
 
-    private float rate;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",rate=" + rate + "]";
+    }
+
+    private final float rate;
+
     private static final long serialVersionUID = -4420398478601444547L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/RealizeCompleteEvent.java b/src/libbluray/bdj/java/javax/media/RealizeCompleteEvent.java
index a448906..30ca64a 100644
--- a/src/libbluray/bdj/java/javax/media/RealizeCompleteEvent.java
+++ b/src/libbluray/bdj/java/javax/media/RealizeCompleteEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class RealizeCompleteEvent extends TransitionEvent {
     public RealizeCompleteEvent(Controller source, int previous, int current,
-            int target)
-    {
+            int target) {
         super(source, previous, current, target);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/ResourceUnavailableEvent.java b/src/libbluray/bdj/java/javax/media/ResourceUnavailableEvent.java
index fb16b48..2b89962 100644
--- a/src/libbluray/bdj/java/javax/media/ResourceUnavailableEvent.java
+++ b/src/libbluray/bdj/java/javax/media/ResourceUnavailableEvent.java
@@ -20,13 +20,11 @@
 package javax.media;
 
 public class ResourceUnavailableEvent extends ControllerErrorEvent {
-    public ResourceUnavailableEvent(Controller source)
-    {
+    public ResourceUnavailableEvent(Controller source) {
         super(source);
     }
 
-    public ResourceUnavailableEvent(Controller source, String message)
-    {
+    public ResourceUnavailableEvent(Controller source, String message) {
         super(source);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/RestartingEvent.java b/src/libbluray/bdj/java/javax/media/RestartingEvent.java
index 5d28aca..e38427a 100644
--- a/src/libbluray/bdj/java/javax/media/RestartingEvent.java
+++ b/src/libbluray/bdj/java/javax/media/RestartingEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class RestartingEvent extends StopEvent {
     public RestartingEvent(Controller source, int previous, int current,
-            int target, Time mediaTime)
-    {
+            int target, Time mediaTime) {
         super(source, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/StartEvent.java b/src/libbluray/bdj/java/javax/media/StartEvent.java
index 951b9e3..8300f0a 100644
--- a/src/libbluray/bdj/java/javax/media/StartEvent.java
+++ b/src/libbluray/bdj/java/javax/media/StartEvent.java
@@ -21,24 +21,26 @@ package javax.media;
 
 public class StartEvent extends TransitionEvent {
     public StartEvent(Controller source, int previous, int current, int target,
-            Time mediaTime, Time tbTime)
-    {
+            Time mediaTime, Time tbTime) {
         super(source, previous, current, target);
         this.mediaTime = mediaTime;
         this.tbTime = tbTime;
     }
 
-    public Time getMediaTime()
-    {
+    public Time getMediaTime() {
         return mediaTime;
     }
 
-    public Time getTimeBaseTime()
-    {
+    public Time getTimeBaseTime() {
         return tbTime;
     }
 
-    private Time mediaTime;
-    private Time tbTime;
+    public String toString() {
+        return getClass().toString() + "[source=" + source + ",mediaTime=" + mediaTime + ",tbTime=" + tbTime + "]";
+    }
+
+    private final Time mediaTime;
+    private final Time tbTime;
+
     private static final long serialVersionUID = -6779753774143606328L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/StopAtTimeEvent.java b/src/libbluray/bdj/java/javax/media/StopAtTimeEvent.java
index 8ed90df..272c55e 100644
--- a/src/libbluray/bdj/java/javax/media/StopAtTimeEvent.java
+++ b/src/libbluray/bdj/java/javax/media/StopAtTimeEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class StopAtTimeEvent extends StopEvent {
     public StopAtTimeEvent(Controller source, int previous, int current,
-            int target, Time mediaTime)
-    {
+            int target, Time mediaTime) {
         super(source, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/StopByRequestEvent.java b/src/libbluray/bdj/java/javax/media/StopByRequestEvent.java
index dd17c29..e9696c0 100644
--- a/src/libbluray/bdj/java/javax/media/StopByRequestEvent.java
+++ b/src/libbluray/bdj/java/javax/media/StopByRequestEvent.java
@@ -21,8 +21,7 @@ package javax.media;
 
 public class StopByRequestEvent extends StopEvent {
     public StopByRequestEvent(Controller source, int previous, int current,
-            int target, Time mediaTime)
-    {
+            int target, Time mediaTime) {
         super(source, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/StopEvent.java b/src/libbluray/bdj/java/javax/media/StopEvent.java
index accde2e..91da003 100644
--- a/src/libbluray/bdj/java/javax/media/StopEvent.java
+++ b/src/libbluray/bdj/java/javax/media/StopEvent.java
@@ -23,18 +23,21 @@ import javax.media.Controller;
 
 public class StopEvent extends TransitionEvent {
     public StopEvent(Controller source, int previous, int current, int target,
-            Time mediaTime)
-    {
+            Time mediaTime) {
         super(source, previous, current, target);
 
         this.mediaTime = mediaTime;
     }
 
-    public Time getMediaTime()
-    {
+    public Time getMediaTime() {
         return mediaTime;
     }
 
-    private Time mediaTime;
+    public String toString() {
+        return getClass().toString() + "[source=" + source + ",mediaTime=" + mediaTime + "]";
+    }
+
+    private final Time mediaTime;
+
     private static final long serialVersionUID = -4224879148377028872L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/StopTimeChangeEvent.java b/src/libbluray/bdj/java/javax/media/StopTimeChangeEvent.java
index 792dff0..488669c 100644
--- a/src/libbluray/bdj/java/javax/media/StopTimeChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/media/StopTimeChangeEvent.java
@@ -20,18 +20,21 @@
 package javax.media;
 
 public class StopTimeChangeEvent extends ControllerEvent {
-    public StopTimeChangeEvent(Controller from, Time stopTime)
-    {
+    public StopTimeChangeEvent(Controller from, Time stopTime) {
         super(from);
 
         this.stopTime = stopTime;
     }
 
-    public Time getStopTime()
-    {
+    public Time getStopTime() {
         return stopTime;
     }
 
-    private Time stopTime;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",stopTime=" + stopTime + "]";
+    }
+
+    private final Time stopTime;
+
     private static final long serialVersionUID = -3236645692389122978L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/StopTimeSetError.java b/src/libbluray/bdj/java/javax/media/StopTimeSetError.java
index d718b06..78ef2b8 100644
--- a/src/libbluray/bdj/java/javax/media/StopTimeSetError.java
+++ b/src/libbluray/bdj/java/javax/media/StopTimeSetError.java
@@ -20,8 +20,7 @@
 package javax.media;
 
 public class StopTimeSetError extends MediaError {
-    public StopTimeSetError(String reason)
-    {
+    public StopTimeSetError(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/SystemTimeBase.java b/src/libbluray/bdj/java/javax/media/SystemTimeBase.java
index 3536179..a6e2d66 100644
--- a/src/libbluray/bdj/java/javax/media/SystemTimeBase.java
+++ b/src/libbluray/bdj/java/javax/media/SystemTimeBase.java
@@ -1,31 +1,46 @@
+/*
+ * This file is part of libbluray
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
 package javax.media;
 
 /**
  * This file is from FMJ (fmj-sf.net)
- * 
+ *
  * Complete.
  * @author Ken Larson
  *
  */
-public final class SystemTimeBase implements TimeBase
-{
+public final class SystemTimeBase implements TimeBase {
 
-    private static long start = -1L; 
-    public long getNanoseconds()
-    {
+    private static long start = -1L;
+
+    public long getNanoseconds() {
         // This version only has millisecond accuracy.
-        
-        if (start < 0)
-        {   start = System.currentTimeMillis();
+
+        if (start < 0) {
+            start = System.currentTimeMillis();
             return 0;
         }
         return (System.currentTimeMillis() - start) * 1000000L;
-        //return System.nanoTime(); // TODO: does this need to be relative to a specific point in time?
     }
 
-    public Time getTime()
-    {
+    public Time getTime() {
         return new Time(getNanoseconds());
     }
 
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/javax/media/Time.java b/src/libbluray/bdj/java/javax/media/Time.java
index dcadb06..c7d21fc 100644
--- a/src/libbluray/bdj/java/javax/media/Time.java
+++ b/src/libbluray/bdj/java/javax/media/Time.java
@@ -25,28 +25,23 @@ public class Time implements Serializable {
     public static final long ONE_SECOND = 1000000000L;
     protected long nanoseconds;
 
-    public Time(long nano)
-    {
+    public Time(long nano) {
         this.nanoseconds = nano;
     }
 
-    public Time(double seconds)
-    {
+    public Time(double seconds) {
         this.nanoseconds = secondsToNanoseconds(seconds);
     }
 
-    protected long secondsToNanoseconds(double seconds)
-    {
+    protected long secondsToNanoseconds(double seconds) {
         return (long) (seconds * ONE_SECOND);
     }
 
-    public long getNanoseconds()
-    {
+    public long getNanoseconds() {
         return nanoseconds;
     }
 
-    public double getSeconds()
-    {
+    public double getSeconds() {
         return nanoseconds / (double) ONE_SECOND;
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/TransitionEvent.java b/src/libbluray/bdj/java/javax/media/TransitionEvent.java
index 28415cd..de87572 100644
--- a/src/libbluray/bdj/java/javax/media/TransitionEvent.java
+++ b/src/libbluray/bdj/java/javax/media/TransitionEvent.java
@@ -21,31 +21,32 @@ package javax.media;
 
 public class TransitionEvent extends ControllerEvent {
     public TransitionEvent(Controller from, int previous, int current,
-            int target)
-    {
+            int target) {
         super(from);
         this.previous = previous;
         this.current = current;
         this.target = target;
     }
 
-    public int getPreviousState()
-    {
+    public int getPreviousState() {
         return previous;
     }
 
-    public int getCurrentState()
-    {
+    public int getCurrentState() {
         return current;
     }
 
-    public int getTargetState()
-    {
+    public int getTargetState() {
         return target;
     }
 
-    private int previous;
-    private int current;
-    private int target;
+    public String toString() {
+        return getClass().toString() + "[source=" + source + ",previous=" + previous + ",current=" + current + ",target=" + target + "]";
+    }
+
+    private final int previous;
+    private final int current;
+    private final int target;
+
     private static final long serialVersionUID = 6818216020447063912L;
 }
diff --git a/src/libbluray/bdj/java/javax/media/protocol/ContentDescriptor.java b/src/libbluray/bdj/java/javax/media/protocol/ContentDescriptor.java
index 31a7af7..9813364 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/ContentDescriptor.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/ContentDescriptor.java
@@ -22,18 +22,15 @@ package javax.media.protocol;
 import java.lang.Character;
 
 public class ContentDescriptor {
-    public ContentDescriptor(String cdName)
-    {
+    public ContentDescriptor(String cdName) {
         this.cdName = cdName;
     }
 
-    public String getContentType()
-    {
+    public String getContentType() {
         return cdName;
     }
 
-    public static final String mimeTypeToPackageName(String mimeType)
-    {
+    public static final String mimeTypeToPackageName(String mimeType) {
         char[] name = mimeType.toLowerCase().toCharArray();
         for (int i = 0; i < name.length; i++) {
             char c = name[i];
diff --git a/src/libbluray/bdj/java/javax/media/protocol/DataSource.java b/src/libbluray/bdj/java/javax/media/protocol/DataSource.java
index e856825..13d1b49 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/DataSource.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/DataSource.java
@@ -25,22 +25,18 @@ import javax.media.Duration;
 import javax.media.MediaLocator;
 
 public abstract class DataSource implements Controls, Duration {
-    public DataSource()
-    {
+    public DataSource() {
     }
 
-    public DataSource(MediaLocator source)
-    {
+    public DataSource(MediaLocator source) {
         locator = source;
     }
 
-    public void setLocator(MediaLocator source)
-    {
+    public void setLocator(MediaLocator source) {
         locator = source;
     }
 
-    public MediaLocator getLocator()
-    {
+    public MediaLocator getLocator() {
         return locator;
     }
 
@@ -54,8 +50,7 @@ public abstract class DataSource implements Controls, Duration {
 
     public abstract void stop() throws IOException;
 
-    protected void initCheck()
-    {
+    protected void initCheck() {
         if (locator == null)
             throw new Error("Locator can't be null");
     }
diff --git a/src/libbluray/bdj/java/javax/media/protocol/PullDataSource.java b/src/libbluray/bdj/java/javax/media/protocol/PullDataSource.java
index 0f2c610..c482dea 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/PullDataSource.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/PullDataSource.java
@@ -20,8 +20,7 @@
 package javax.media.protocol;
 
 public abstract class PullDataSource extends DataSource {
-    public PullDataSource()
-    {
+    public PullDataSource() {
     }
 
     public abstract PullSourceStream[] getStreams();
diff --git a/src/libbluray/bdj/java/javax/media/protocol/PushDataSource.java b/src/libbluray/bdj/java/javax/media/protocol/PushDataSource.java
index 8afa30e..613cf7f 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/PushDataSource.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/PushDataSource.java
@@ -20,8 +20,7 @@
 package javax.media.protocol;
 
 public abstract class PushDataSource extends DataSource {
-    public PushDataSource()
-    {
+    public PushDataSource() {
     }
 
     public abstract PushSourceStream[] getStreams();
diff --git a/src/libbluray/bdj/java/javax/media/protocol/RateRange.java b/src/libbluray/bdj/java/javax/media/protocol/RateRange.java
index 739d33b..5814c9a 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/RateRange.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/RateRange.java
@@ -20,45 +20,38 @@
 package javax.media.protocol;
 
 public class RateRange {
-    public RateRange(RateRange r)
-    {
+    public RateRange(RateRange r) {
         this.current = r.current;
         this.min = r.min;
         this.max = r.max;
         this.isExact = r.isExact;
     }
 
-    public RateRange(float init, float min, float max, boolean isExact)
-    {
+    public RateRange(float init, float min, float max, boolean isExact) {
         this.current = init;
         this.min = min;
         this.max = max;
         this.isExact = isExact;
     }
 
-    public float setCurrentRate(float rate)
-    {
+    public float setCurrentRate(float rate) {
         this.current = rate;
         return current;
     }
 
-    public float getCurrentRate()
-    {
+    public float getCurrentRate() {
         return current;
     }
 
-    public float getMinimumRate()
-    {
+    public float getMinimumRate() {
         return min;
     }
 
-    public float getMaximumRate()
-    {
+    public float getMaximumRate() {
         return max;
     }
 
-    public boolean isExact()
-    {
+    public boolean isExact() {
         return isExact;
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/protocol/URLDataSource.java b/src/libbluray/bdj/java/javax/media/protocol/URLDataSource.java
index e76faf5..7bb15f1 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/URLDataSource.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/URLDataSource.java
@@ -27,78 +27,63 @@ import javax.media.Duration;
 import javax.media.MediaLocator;
 
 public class URLDataSource extends PullDataSource {
-    protected URLDataSource()
-    {
+    protected URLDataSource() {
     }
 
-    public URLDataSource(URL url) throws IOException
-    {
+    public URLDataSource(URL url) throws IOException {
         setLocator(new MediaLocator(url));
-        this.connected = false;
+        connected = false;
     }
 
-    public PullSourceStream[] getStreams()
-    {
-        if (!this.connected)
+    public PullSourceStream[] getStreams() {
+        if (!connected)
             throw new Error("Unconnected source.");
-        return this.sources;
+        return sources;
     }
 
-    public void connect() throws IOException
-    {
-        this.conn = getLocator().getURL().openConnection();
-        this.conn.connect();
-        this.connected = true;
-        String str = this.conn.getContentType();
+    public void connect() throws IOException {
+        conn = getLocator().getURL().openConnection();
+        conn.connect();
+        connected = true;
+        String str = conn.getContentType();
         if (str == null)
             str = "UnknownContent";
-        this.contentType = new ContentDescriptor(ContentDescriptor.mimeTypeToPackageName(str));
-        this.sources = new URLSourceStream[1];
-        this.sources[0] = new URLSourceStream(this.conn, this.contentType);
+        contentType = new ContentDescriptor(ContentDescriptor.mimeTypeToPackageName(str));
+        sources = new URLSourceStream[1];
+        sources[0] = new URLSourceStream(conn, contentType);
     }
 
-    public String getContentType()
-    {
-        if (!this.connected)
+    public String getContentType() {
+        if (!connected)
             throw new Error("Source is unconnected.");
-        return this.contentType.getContentType();
+        return contentType.getContentType();
     }
 
-    public void disconnect()
-    {
-        if (this.connected)
-        {
-            try
-            {
-                this.sources[0].close();
+    public void disconnect() {
+        if (connected) {
+            try {
+                sources[0].close();
+            } catch (IOException ioe) {
             }
-            catch (IOException localIOException)
-            {
-            }
-            this.connected = false;
+            connected = false;
         }
     }
 
-    public void start() throws IOException
-    {
+    public void start() throws IOException {
     }
 
-    public void stop() throws IOException
-    {
+    public void stop() throws IOException {
     }
 
-    public Time getDuration()
-    {
+    public Time getDuration() {
         return Duration.DURATION_UNKNOWN;
     }
 
-    public Object[] getControls()
-    {
+    public Object[] getControls() {
         return new Object[0];
     }
 
-    public Object getControl(String controlName)
-    {
+    public Object getControl(String controlName) {
         return null;
     }
 
diff --git a/src/libbluray/bdj/java/javax/media/protocol/URLSourceStream.java b/src/libbluray/bdj/java/javax/media/protocol/URLSourceStream.java
index a2337c0..5d07f46 100644
--- a/src/libbluray/bdj/java/javax/media/protocol/URLSourceStream.java
+++ b/src/libbluray/bdj/java/javax/media/protocol/URLSourceStream.java
@@ -1,98 +1,84 @@
-/*
- * This file is part of libbluray
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-package javax.media.protocol;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URLConnection;
-
-class URLSourceStream
-    implements PullSourceStream
-{
-    protected URLConnection conn;
-    protected InputStream stream;
-    protected boolean eosReached;
-    ContentDescriptor contentType;
-
-    public URLSourceStream(URLConnection conn, ContentDescriptor type)
-        throws IOException
-    {
-        this.conn = conn;
-        this.stream = conn.getInputStream();
-        this.eosReached = false;
-        this.contentType = type;
-    }
-
-    public ContentDescriptor getContentDescriptor()
-    {
-        return this.contentType;
-    }
-
-    public boolean willReadBlock()
-    {
-        if (this.eosReached == true)
-            return true;
-        try
-        {
-            return this.stream.available() == 0;
-        }
-        catch (IOException e)
-        {
-        }
-        return true;
-    }
-
-    public int read(byte[] buffer, int offset, int length)
-        throws IOException
-    {
-        int bytesRead = this.stream.read(buffer, offset, length);
-        if (bytesRead == -1)
-            this.eosReached = true;
-        return bytesRead;
-    }
-
-    public void close()
-        throws IOException
-    {
-        this.stream.close();
-    }
-
-    public boolean endOfStream()
-    {
-        return this.eosReached;
-    }
-
-    public Object[] getControls()
-    {
-        return new Object[0];
-    }
-
-    public Object getControl(String controlName)
-    {
-        return null;
-    }
-
-    public long getContentLength()
-    {
-        long len = this.conn.getContentLength();
-        len = len == -1L ? -1L : len;
-
-        return len;
-    }
-}
+/*
+ * This file is part of libbluray
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+package javax.media.protocol;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLConnection;
+
+class URLSourceStream implements PullSourceStream {
+
+    protected URLConnection conn;
+    protected InputStream stream;
+    protected boolean eosReached;
+    ContentDescriptor contentType;
+
+    public URLSourceStream(URLConnection conn, ContentDescriptor type)
+        throws IOException {
+
+        this.conn = conn;
+        this.stream = conn.getInputStream();
+        this.eosReached = false;
+        this.contentType = type;
+    }
+
+    public ContentDescriptor getContentDescriptor() {
+        return contentType;
+    }
+
+    public boolean willReadBlock() {
+        if (eosReached == true)
+            return true;
+        try {
+            return stream.available() == 0;
+        }
+        catch (IOException e) {
+        }
+        return true;
+    }
+
+    public int read(byte[] buffer, int offset, int length)
+        throws IOException {
+
+        int bytesRead = stream.read(buffer, offset, length);
+        if (bytesRead == -1)
+            this.eosReached = true;
+        return bytesRead;
+    }
+
+    public void close() throws IOException {
+        stream.close();
+    }
+
+    public boolean endOfStream() {
+        return eosReached;
+    }
+
+    public Object[] getControls() {
+        return new Object[0];
+    }
+
+    public Object getControl(String controlName) {
+        return null;
+    }
+
+    public long getContentLength() {
+        return conn.getContentLength();
+    }
+}
diff --git a/src/libbluray/bdj/java/javax/tv/graphics/AlphaColor.java b/src/libbluray/bdj/java/javax/tv/graphics/AlphaColor.java
index 4723c6e..86ec0e0 100644
--- a/src/libbluray/bdj/java/javax/tv/graphics/AlphaColor.java
+++ b/src/libbluray/bdj/java/javax/tv/graphics/AlphaColor.java
@@ -39,7 +39,25 @@ public class AlphaColor extends Color {
 
     public AlphaColor(Color c)
     {
-        super(c.getRGB());
+        super(c.getRGB(), true);
+    }
+
+    public Color brighter()
+    {
+        Color c = super.brighter();
+        int a = getAlpha();
+
+        // JSR927: "Returns: A new AlphaColor object"
+        return new AlphaColor(c.getRed(), c.getGreen(), c.getBlue(), a);
+    }
+
+    public Color darker()
+    {
+        Color c = super.darker();
+        int a = getAlpha();
+
+        // JSR927: "Returns: A new AlphaColor object"
+        return new AlphaColor(c.getRed(), c.getGreen(), c.getBlue(), a);
     }
 
     private static final long serialVersionUID = -3466072971590811211L;
diff --git a/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java b/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java
index 09971b6..a6c0b28 100644
--- a/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java
+++ b/src/libbluray/bdj/java/javax/tv/graphics/TVContainer.java
@@ -23,16 +23,18 @@ import javax.tv.xlet.XletContext;
 import org.havi.ui.HSceneFactory;
 
 import org.videolan.BDJXletContext;
+import org.videolan.Logger;
 
 public class TVContainer {
     public static Container getRootContainer(XletContext context)
     {
         if (context == null) {
+            Logger.getLogger(TVContainer.class.getName()).error("null context");
             throw new NullPointerException();
         }
 
         if (!(context instanceof BDJXletContext) || (BDJXletContext)context != BDJXletContext.getCurrentContext()) {
-            org.videolan.Logger.getLogger(TVContainer.class.getName()).error("wrong context");
+            Logger.getLogger(TVContainer.class.getName()).error("wrong context");
         }
 
         /* GEM: return instance of org.havi.ui.HScene or NULL */
diff --git a/src/libbluray/bdj/java/javax/tv/locator/LocatorFactory.java b/src/libbluray/bdj/java/javax/tv/locator/LocatorFactory.java
index 375c148..a17bdc8 100644
--- a/src/libbluray/bdj/java/javax/tv/locator/LocatorFactory.java
+++ b/src/libbluray/bdj/java/javax/tv/locator/LocatorFactory.java
@@ -21,7 +21,6 @@ package javax.tv.locator;
 
 public abstract class LocatorFactory extends Object {
     protected LocatorFactory() {
-
     }
 
     public static LocatorFactory getInstance() {
diff --git a/src/libbluray/bdj/java/javax/tv/locator/LocatorFactoryImpl.java b/src/libbluray/bdj/java/javax/tv/locator/LocatorFactoryImpl.java
index 6ee4b75..6c4e1a1 100644
--- a/src/libbluray/bdj/java/javax/tv/locator/LocatorFactoryImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/locator/LocatorFactoryImpl.java
@@ -21,27 +21,40 @@
 package javax.tv.locator;
 
 import org.bluray.net.BDLocator;
+import org.videolan.Logger;
 
 public class LocatorFactoryImpl extends LocatorFactory {
     public Locator createLocator(String url) throws MalformedLocatorException {
+        if (url == null) {
+            logger.error("null locator");
+            throw new NullPointerException("Source Locator is null");
+        }
         // check if it is a bluray locator
         if (url.startsWith("bd:/")) {
             try {
                 return new BDLocator(url);
             } catch (org.davic.net.InvalidLocatorException ex) {
+                logger.error("invalid locator: " + url);
                 throw new MalformedLocatorException(ex.getMessage());
             }
         } else {
             // just return a generic locator
+            logger.error("unknown locator type: " + url);
             return new LocatorImpl(url);
         }
     }
 
-    public Locator[] transformLocator(Locator source)
-            throws InvalidLocatorException
-    {
-        org.videolan.Logger.unimplemented(LocatorFactoryImpl.class.getName(), "transformLocator");
-        throw new Error("Not implemented.");
+    public Locator[] transformLocator(Locator source) throws InvalidLocatorException {
+        if (source == null) {
+            logger.error("null locator");
+            throw new NullPointerException("Source Locator is null");
+        }
+        if (source instanceof BDLocator){
+            return new Locator[] { source };
+        }
+        logger.error("unsupported locator: " + source);
+        throw new InvalidLocatorException(source, "Source locator is invalid.");
     }
 
+    private static final Logger logger = Logger.getLogger(LocatorFactoryImpl.class.getName());
 }
diff --git a/src/libbluray/bdj/java/javax/tv/locator/LocatorImpl.java b/src/libbluray/bdj/java/javax/tv/locator/LocatorImpl.java
index e14825c..4cdbdc3 100644
--- a/src/libbluray/bdj/java/javax/tv/locator/LocatorImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/locator/LocatorImpl.java
@@ -24,7 +24,7 @@ public class LocatorImpl implements Locator {
         this.url = url;
     }
 
-    public boolean hasMultipleTransformations()    {
+    public boolean hasMultipleTransformations() {
         return false;
     }
 
@@ -44,19 +44,15 @@ public class LocatorImpl implements Locator {
     }
 
     public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
+        if (!(obj instanceof Locator))
             return false;
-        if (getClass() != obj.getClass())
-            return false;
-        LocatorImpl other = (LocatorImpl) obj;
-        if (url == null) {
-            if (other.url != null)
-                return false;
-        } else if (!url.equals(other.url))
-            return false;
-        return true;
+
+        Locator other = (Locator) obj;
+        String extForm = toExternalForm();
+        if (extForm == null) {
+            return other.toExternalForm() == null;
+        }
+        return extForm.equals(other.toExternalForm());
     }
 
     private String url;
diff --git a/src/libbluray/bdj/java/javax/tv/media/AWTVideoSize.java b/src/libbluray/bdj/java/javax/tv/media/AWTVideoSize.java
index a62a973..b75f98e 100644
--- a/src/libbluray/bdj/java/javax/tv/media/AWTVideoSize.java
+++ b/src/libbluray/bdj/java/javax/tv/media/AWTVideoSize.java
@@ -23,9 +23,13 @@ import java.awt.Rectangle;
 
 public class AWTVideoSize
 {
-    public AWTVideoSize(Rectangle source, Rectangle dest) { 
-        this.source = source;
-        this.dest = dest;
+    public AWTVideoSize(Rectangle source, Rectangle dest) {
+        if (source == null || dest == null) {
+            System.err.println("null rect");
+            throw new NullPointerException("null rect");
+        }
+        this.source = (Rectangle)source.clone();
+        this.dest = (Rectangle)dest.clone();
     }
 
     public Rectangle getSource() {
@@ -37,15 +41,14 @@ public class AWTVideoSize
     }
 
     public float getXScale() {
-        return getDestination().width / getSource().width;
+        return dest.width / source.width;
     }
 
     public float getYScale() {
-        return getDestination().height / getSource().height;
+        return dest.height / source.height;
     }
 
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + ((dest == null) ? 0 : dest.hashCode());
@@ -53,33 +56,18 @@ public class AWTVideoSize
         return result;
     }
 
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
+    public boolean equals(Object obj) {
+        if (!(obj instanceof AWTVideoSize)) {
             return false;
+        }
         AWTVideoSize other = (AWTVideoSize) obj;
-        if (dest == null) {
-            if (other.dest != null)
-                return false;
-        } else if (!dest.equals(other.dest))
-            return false;
-        if (source == null) {
-            if (other.source != null)
-                return false;
-        } else if (!source.equals(other.source))
-            return false;
-        return true;
+        return dest.equals(other.dest) && source.equals(other.source);
     }
 
-    public String toString()
-    {
-        return "AWTVideoSize [dest=" + dest + ", source=" + source + "]";
+    public String toString() {
+        return getClass().getName() + "[dest=" + dest + ",source=" + source + "]";
     }
-    
+
     private Rectangle source;
     private Rectangle dest;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/media/MediaSelectCARefusedEvent.java b/src/libbluray/bdj/java/javax/tv/media/MediaSelectCARefusedEvent.java
index ea27fec..116239c 100644
--- a/src/libbluray/bdj/java/javax/tv/media/MediaSelectCARefusedEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/media/MediaSelectCARefusedEvent.java
@@ -23,10 +23,9 @@ import javax.tv.locator.Locator;
 import javax.media.Controller;
 
 public class MediaSelectCARefusedEvent extends MediaSelectFailedEvent {
-    public MediaSelectCARefusedEvent(Controller source, Locator[] selection)
-    {
+    public MediaSelectCARefusedEvent(Controller source, Locator[] selection) {
         super(source, selection);
     }
-    
+
     private static final long serialVersionUID = -8706477571753234088L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/media/MediaSelectEvent.java b/src/libbluray/bdj/java/javax/tv/media/MediaSelectEvent.java
index c3a88de..a31d2d0 100644
--- a/src/libbluray/bdj/java/javax/tv/media/MediaSelectEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/media/MediaSelectEvent.java
@@ -23,21 +23,18 @@ import javax.tv.locator.*;
 import javax.media.Controller;
 
 public abstract class MediaSelectEvent extends java.util.EventObject {
-    public MediaSelectEvent(Controller controller, Locator[] selection)
-    {
+    public MediaSelectEvent(Controller controller, Locator[] selection) {
         super(controller);
 
         this.controller = controller;
         this.selection = selection;
     }
 
-    public Controller getController()
-    {
+    public Controller getController() {
         return controller;
     }
 
-    public Locator[] getSelection()
-    {
+    public Locator[] getSelection() {
         return selection;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/media/MediaSelectFailedEvent.java b/src/libbluray/bdj/java/javax/tv/media/MediaSelectFailedEvent.java
index 6f1c710..5f26672 100644
--- a/src/libbluray/bdj/java/javax/tv/media/MediaSelectFailedEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/media/MediaSelectFailedEvent.java
@@ -23,8 +23,7 @@ import javax.tv.locator.Locator;
 import javax.media.Controller;
 
 public class MediaSelectFailedEvent extends MediaSelectEvent {
-    public MediaSelectFailedEvent(Controller source, Locator[] selection)
-    {
+    public MediaSelectFailedEvent(Controller source, Locator[] selection) {
         super(source, selection);
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/media/MediaSelectPermission.java b/src/libbluray/bdj/java/javax/tv/media/MediaSelectPermission.java
index 3f00acf..1d8bd80 100644
--- a/src/libbluray/bdj/java/javax/tv/media/MediaSelectPermission.java
+++ b/src/libbluray/bdj/java/javax/tv/media/MediaSelectPermission.java
@@ -32,31 +32,36 @@ public final class MediaSelectPermission extends Permission
         if (locator == null)
             this.locator = "*";
         else
-        this.locator = locator.toExternalForm();
+            this.locator = locator.toExternalForm();
     }
 
     public MediaSelectPermission(String locator, String actions) {
         super("javax.tv.media.MediaSelectPermission");
 
+        if (locator == null)
+            throw new NullPointerException("null locator");
+
         this.locator = locator;
     }
 
     public boolean implies(Permission perm) {
-        return (perm instanceof MediaSelectPermission) && (this.equals(perm) || this.locator.equals("*"));
+        if (perm == null)
+            throw new NullPointerException("permission is null");
+
+        if (!(perm instanceof MediaSelectPermission))
+            return false;
+
+        return equals(perm) || locator.equals("*");
     }
 
     public boolean equals(Object obj) {
-        if (obj == null)
-            return false;
         if (this == obj)
             return true;
-        if (getClass() != obj.getClass())
+        if (!(obj instanceof MediaSelectPermission))
             return false;
+
         MediaSelectPermission other = (MediaSelectPermission) obj;
-        if (locator == null) {
-            if (other.locator != null)
-                return false;
-        } else if (!locator.equals(other.locator))
+        if (!locator.equals(other.locator))
             return false;
         return true;
     }
diff --git a/src/libbluray/bdj/java/javax/tv/media/MediaSelectSucceededEvent.java b/src/libbluray/bdj/java/javax/tv/media/MediaSelectSucceededEvent.java
index 5e6becf..d0004d3 100644
--- a/src/libbluray/bdj/java/javax/tv/media/MediaSelectSucceededEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/media/MediaSelectSucceededEvent.java
@@ -23,8 +23,7 @@ import javax.tv.locator.Locator;
 import javax.media.Controller;
 
 public class MediaSelectSucceededEvent extends MediaSelectEvent {
-    public MediaSelectSucceededEvent(Controller source, Locator[] selection)
-    {
+    public MediaSelectSucceededEvent(Controller source, Locator[] selection) {
         super(source, selection);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java b/src/libbluray/bdj/java/javax/tv/net/InterfaceMap.java
similarity index 64%
copy from src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java
copy to src/libbluray/bdj/java/javax/tv/net/InterfaceMap.java
index 78f22f2..f15a516 100644
--- a/src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java
+++ b/src/libbluray/bdj/java/javax/tv/net/InterfaceMap.java
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016  VideoLAN
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,18 +17,19 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.bluray.media;
+package javax.tv.net;
 
-public class StreamNotAvailableException extends Exception {
-    public StreamNotAvailableException()
-    {
-        super();
-    }
+import java.io.IOException;
+import java.net.InetAddress;
+import javax.tv.locator.InvalidLocatorException;
+import javax.tv.locator.Locator;
 
-    public StreamNotAvailableException(String reason)
-    {
-        super(reason);
-    }
+public class InterfaceMap
+{
+    public static InetAddress getLocalAddress(Locator locator)
+        throws InvalidLocatorException, IOException {
 
-    private static final long serialVersionUID = -7640510718455645728L;
+        org.videolan.Logger.unimplemented(InterfaceMap.class.getName(), "getLocalAddress");
+        throw new InvalidLocatorException(locator, "Unsupported");
+    }
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/ReadPermission.java b/src/libbluray/bdj/java/javax/tv/service/ReadPermission.java
index 2f7bd1b..3066da4 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ReadPermission.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ReadPermission.java
@@ -24,54 +24,54 @@ import javax.tv.locator.Locator;
 import java.io.Serializable;
 
 public final class ReadPermission extends Permission implements Serializable {
-    public ReadPermission(Locator locator)
-    {
-        super(locator.toExternalForm());
-        
-        this.locator = locator.toExternalForm();
+    public ReadPermission(Locator locator) {
+        super(locator == null ? "*" : locator.toExternalForm());
+
+        if (locator == null)
+            this.locator = "*";
+        else
+            this.locator = locator.toExternalForm();
     }
 
-    public ReadPermission(String locator, String actions)
-    {
-        super(null);
-        
+    public ReadPermission(String locator, String actions) {
+        super(locator == null ? "*" : locator);
+
+        if (locator == null)
+            throw new NullPointerException();
+
         this.locator = locator;
     }
 
-    public boolean implies(Permission perm)
-    {
-        return (perm instanceof ReadPermission) && (this.equals(perm) || this.equals("*"));
+    public boolean implies(Permission perm) {
+        if (perm == null)
+            throw new NullPointerException();
+        if (!(perm instanceof ReadPermission))
+            return false;
+
+        ReadPermission other = (ReadPermission)perm;
+        return locator.equals(other.locator) || locator.equals("*");
     }
 
-    public boolean equals(Object obj)
-    {
-        if (obj == null)
-            return false;
+    public boolean equals(Object obj) {
         if (this == obj)
             return true;
-        if (getClass() != obj.getClass())
+        if (!(obj instanceof ReadPermission))
             return false;
+
         ReadPermission other = (ReadPermission) obj;
-        if (locator == null) {
-            if (other.locator != null)
-                return false;
-        } else if (!locator.equals(other.locator))
-            return false;
-        return true;
+        return locator.equals(other.locator);
     }
 
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 31;
         int result = prime + ((locator == null) ? 0 : locator.hashCode());
         return result;
     }
 
-    public String getActions()
-    {
+    public String getActions() {
         return "";
     }
-    
+
     private String locator;
     private static final long serialVersionUID = 3887436671296398427L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java
index de6ec12..3ab9ea7 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java
@@ -22,25 +22,33 @@ package javax.tv.service;
 import java.util.EventObject;
 
 public abstract class SIChangeEvent extends EventObject {
-    public SIChangeEvent(Object source, SIChangeType type, SIElement element)
-    {
+    public SIChangeEvent(Object source, SIChangeType type, SIElement element) {
         super(source);
-        
+
+        this.source = source;
         this.type = type;
         this.element = element;
     }
 
-    public SIChangeType getChangeType()
-    {
+    public SIChangeType getChangeType() {
         return type;
     }
-    
-    public SIElement getSIElement()
-    {
+
+    public SIElement getSIElement() {
         return element;
-    } 
-    
-    private SIChangeType type;
-    private SIElement element;
+    }
+
+    public Object getSource() {
+        return source;
+    }
+
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",type=" + type + ",element=" + element + "]";
+    }
+
+    private final Object source;
+    private final SIChangeType type;
+    private final SIElement element;
+
     private static final long serialVersionUID = -2585934355425778816L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java b/src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java
index 89dfec7..bcb33d7 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java
@@ -21,7 +21,5 @@ package javax.tv.service;
 
 import java.util.EventListener;
 
-public interface SIChangeListener extends EventListener
-{
-    
+public interface SIChangeListener extends EventListener {
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java b/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java
index 70764ec..edc842a 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java
@@ -19,23 +19,21 @@
 
 package javax.tv.service;
 
-import java.io.Serializable;
+public class SIChangeType {
 
-public class SIChangeType implements Serializable
-{
     public static final SIChangeType ADD = new SIChangeType("ADD");
     public static final SIChangeType REMOVE = new SIChangeType("REMOVE");
     public static final SIChangeType MODIFY = new SIChangeType("MODIFY");
 
-    protected SIChangeType(String name) { 
+    protected SIChangeType(String name) {
         this.name = name;
+        if (name == null)
+            throw new NullPointerException();
     }
 
     public String toString() {
         return name;
     }
-    
-    protected String name;
 
-    private static final long serialVersionUID = 1L;
+    protected String name;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIElement.java b/src/libbluray/bdj/java/javax/tv/service/SIElement.java
index 16140de..ed6adc2 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIElement.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIElement.java
@@ -21,8 +21,8 @@ package javax.tv.service;
 
 import javax.tv.locator.Locator;
 
-public interface SIElement extends SIRetrievable
-{
+public interface SIElement extends SIRetrievable {
+
     public Locator getLocator();
 
     public boolean equals(Object obj);
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIException.java b/src/libbluray/bdj/java/javax/tv/service/SIException.java
index ab5a5e9..c10fdc3 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIException.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIException.java
@@ -20,15 +20,13 @@
 package javax.tv.service;
 
 public class SIException extends Exception {
-    public SIException()
-    {
+    public SIException() {
         super();
     }
 
-    public SIException(String reason)
-    {
+    public SIException(String reason) {
         super(reason);
     }
-    
+
     private static final long serialVersionUID = 37140385594509973L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java b/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
index f9d4a32..3ab923d 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
@@ -34,8 +34,11 @@ import org.bluray.ti.TitleImpl;
 import org.videolan.Libbluray;
 
 public class SIManagerImpl extends SIManager {
+
+    private static final Object instanceLock = new Object();
+
     public static SIManager createInstance() {
-        synchronized (SIManagerImpl.class) {
+        synchronized (instanceLock) {
             if (instance == null)
                 instance = new SIManagerImpl();
             return instance;
@@ -43,7 +46,7 @@ public class SIManagerImpl extends SIManager {
     }
 
     public static void shutdown() {
-        synchronized (SIManagerImpl.class) {
+        synchronized (instanceLock) {
             instance = null;
         }
     }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java b/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java
index c6e4b45..8b27031 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java
@@ -20,13 +20,13 @@
 package javax.tv.service;
 
 public class SIRequestFailureType {
-    protected SIRequestFailureType(String name)
-    {
+    protected SIRequestFailureType(String name) {
+        if (name == null)
+            throw new NullPointerException();
         this.name = name;
     }
 
-    public String toString()
-    {
+    public String toString() {
         return name;
     }
 
@@ -38,5 +38,6 @@ public class SIRequestFailureType {
             "DATA_UNAVAILABLE");
     public static final SIRequestFailureType UNKNOWN = new SIRequestFailureType(
             "UNKNOWN");
+
     private String name;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIRequestor.java b/src/libbluray/bdj/java/javax/tv/service/SIRequestor.java
index 1e4316c..009d432 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIRequestor.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIRequestor.java
@@ -19,8 +19,8 @@
 
 package javax.tv.service;
 
-public interface SIRequestor
-{
+public interface SIRequestor {
+
     public void notifySuccess(SIRetrievable[] result);
 
     public void notifyFailure(SIRequestFailureType reason);
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIRequestorImpl.java b/src/libbluray/bdj/java/javax/tv/service/SIRequestorImpl.java
index f666027..64f6021 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIRequestorImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIRequestorImpl.java
@@ -20,30 +20,25 @@
 package javax.tv.service;
 
 public class SIRequestorImpl implements SIRequestor {
-    public void notifyFailure(SIRequestFailureType reason)
-    {
+    public void notifyFailure(SIRequestFailureType reason) {
         this.response = true;
         this.reason = reason;
     }
 
-    public void notifySuccess(SIRetrievable[] result)
-    {
+    public void notifySuccess(SIRetrievable[] result) {
         this.response = true;
         this.result = result;
     }
 
-    public boolean getResponse()
-    {
+    public boolean getResponse() {
         return response;
     }
 
-    public SIRetrievable[] getResult()
-    {
+    public SIRetrievable[] getResult() {
         return result;
     }
 
-    public SIRequestFailureType getReason()
-    {
+    public SIRequestFailureType getReason() {
         return reason;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/Service.java b/src/libbluray/bdj/java/javax/tv/service/Service.java
index 5a0bb47..5bd8b4b 100644
--- a/src/libbluray/bdj/java/javax/tv/service/Service.java
+++ b/src/libbluray/bdj/java/javax/tv/service/Service.java
@@ -21,9 +21,8 @@ package javax.tv.service;
 
 import javax.tv.locator.Locator;
 
+public interface Service {
 
-public interface Service
-{
     public SIRequest retrieveDetails(SIRequestor requestor);
 
     public String getName();
diff --git a/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java b/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java
index fbbb35e..6895f55 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java
@@ -21,13 +21,13 @@ package javax.tv.service;
 
 public class ServiceInformationType {
 
-    protected ServiceInformationType(String name)
-    {
+    protected ServiceInformationType(String name) {
+        if (name == null)
+            throw new NullPointerException();
         this.name = name;
     }
 
-    public String toString()
-    {
+    public String toString() {
         return name;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/ServiceMinorNumber.java b/src/libbluray/bdj/java/javax/tv/service/ServiceMinorNumber.java
index aa6e1cb..56325b5 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ServiceMinorNumber.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ServiceMinorNumber.java
@@ -19,7 +19,6 @@
 
 package javax.tv.service;
 
-public interface ServiceMinorNumber extends ServiceNumber
-{
+public interface ServiceMinorNumber extends ServiceNumber {
     public int getMinorNumber();
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/ServiceNumber.java b/src/libbluray/bdj/java/javax/tv/service/ServiceNumber.java
index 3229b1e..c56d40f 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ServiceNumber.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ServiceNumber.java
@@ -19,7 +19,6 @@
 
 package javax.tv.service;
 
-public interface ServiceNumber
-{
+public interface ServiceNumber {
     public int getServiceNumber();
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/ServiceType.java b/src/libbluray/bdj/java/javax/tv/service/ServiceType.java
index 4f013b9..8526896 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ServiceType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ServiceType.java
@@ -19,16 +19,17 @@
 
 package javax.tv.service;
 
-public class ServiceType
-{
-    protected ServiceType(String name) { 
+public class ServiceType {
+    protected ServiceType(String name) {
+        if (name == null)
+            throw new NullPointerException();
         this.name = name;
     }
 
     public String toString() {
         return name;
     }
-    
+
     public static final ServiceType DIGITAL_TV = new ServiceType("DIGITAL_TV");
     public static final ServiceType DIGITAL_RADIO = new ServiceType("DIGITAL_RADIO");
     public static final ServiceType NVOD_REFERENCE = new ServiceType("NVOD_REFERENCE");
@@ -38,6 +39,6 @@ public class ServiceType
     public static final ServiceType DATA_BROADCAST = new ServiceType("DATA_BROADCAST");
     public static final ServiceType DATA_APPLICATION = new ServiceType("DATA_APPLICATION");
     public static final ServiceType UNKNOWN = new ServiceType("UNKNOWN");
-    
+
     private String name;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleChangeType.java b/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleChangeType.java
index 2ec1770..8abce84 100644
--- a/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleChangeType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleChangeType.java
@@ -23,15 +23,13 @@ import javax.tv.service.SIChangeType;
 
 public class ProgramScheduleChangeType extends SIChangeType
 {
-    
-
-    protected ProgramScheduleChangeType(String name) { 
+    protected ProgramScheduleChangeType(String name) {
         super(name);
     }
 
     public String toString() {
-        return name;
+        return super.toString();
     }
-    
+
     public static final ProgramScheduleChangeType CURRENT_PROGRAM_EVENT = new ProgramScheduleChangeType("CURRENT_PROGRAM_EVENT");
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleEvent.java b/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleEvent.java
index 31baf9c..72b5d44 100644
--- a/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/guide/ProgramScheduleEvent.java
@@ -24,18 +24,15 @@ import javax.tv.service.SIChangeType;
 
 public class ProgramScheduleEvent extends SIChangeEvent {
     public ProgramScheduleEvent(ProgramSchedule schedule, SIChangeType type,
-            ProgramEvent event)
-    {
+            ProgramEvent event) {
         super(schedule, type, event);
     }
 
-    public ProgramSchedule getProgramSchedule()
-    {
+    public ProgramSchedule getProgramSchedule() {
         return (ProgramSchedule)getSource();
     }
 
-    public ProgramEvent getProgramEvent()
-    {
+    public ProgramEvent getProgramEvent() {
         return (ProgramEvent)getSIElement();
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/DeliverySystemType.java b/src/libbluray/bdj/java/javax/tv/service/navigation/DeliverySystemType.java
index cc1bba8..7825218 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/DeliverySystemType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/DeliverySystemType.java
@@ -20,13 +20,13 @@
 package javax.tv.service.navigation;
 
 public class DeliverySystemType {
-    protected DeliverySystemType(String name)
-    {
+    protected DeliverySystemType(String name) {
+        if (name == null)
+            throw new NullPointerException("no name");
         this.name = name;
     }
 
-    public String toString()
-    {
+    public String toString() {
         return name;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/FilterNotSupportedException.java b/src/libbluray/bdj/java/javax/tv/service/navigation/FilterNotSupportedException.java
index dd64baa..f6e577c 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/FilterNotSupportedException.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/FilterNotSupportedException.java
@@ -22,13 +22,11 @@ package javax.tv.service.navigation;
 import javax.tv.service.SIException;
 
 public class FilterNotSupportedException extends SIException {
-    public FilterNotSupportedException()
-    {
+    public FilterNotSupportedException() {
         super();
     }
 
-    public FilterNotSupportedException(String reason)
-    {
+    public FilterNotSupportedException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/LocatorFilter.java b/src/libbluray/bdj/java/javax/tv/service/navigation/LocatorFilter.java
index 8fb7aa3..5dfbee0 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/LocatorFilter.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/LocatorFilter.java
@@ -23,8 +23,24 @@ import javax.tv.locator.Locator;
 import javax.tv.locator.InvalidLocatorException;
 import javax.tv.service.Service;
 
+import org.bluray.net.BDLocator;
+import org.bluray.ti.TitleImpl;
+
 public final class LocatorFilter extends ServiceFilter {
     public LocatorFilter(Locator[] locators) throws InvalidLocatorException {
+        if (locators == null)
+            throw new NullPointerException();
+
+        for (int i = 0; i < locators.length; i++) {
+            try {
+                if (locators[i] == null)
+                    throw new InvalidLocatorException(locators[i]);
+                new BDLocator(locators[i].toExternalForm());
+            } catch (org.davic.net.InvalidLocatorException e) {
+                throw new InvalidLocatorException(locators[i]);
+            }
+        }
+
         this.locators = locators;
     }
 
@@ -36,9 +52,17 @@ public final class LocatorFilter extends ServiceFilter {
         if (service == null)
             throw new NullPointerException();
 
+        if (!(service instanceof TitleImpl))
+            return false;
+
+        int num = ((TitleImpl)service).getTitleNum();
         for (int i = 0; i < locators.length; i++) {
-            if (locators[i].equals(service.getLocator()))
-                return true;
+
+            try {
+                BDLocator bdl = new BDLocator(locators[i].toExternalForm());
+                if (bdl.getTitleNumber() == num)
+                    return true;
+            } catch (org.davic.net.InvalidLocatorException e) { }
         }
 
         return false;
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/PreferenceFilter.java b/src/libbluray/bdj/java/javax/tv/service/navigation/PreferenceFilter.java
index 2a8a3a6..b44a3b8 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/PreferenceFilter.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/PreferenceFilter.java
@@ -23,24 +23,22 @@ import javax.tv.service.Service;
 
 public final class PreferenceFilter extends ServiceFilter {
 
-    public PreferenceFilter(FavoriteServicesName name)
-    {
+    public PreferenceFilter(FavoriteServicesName name) {
+        System.err.println("No preference");
+        if (name == null)
+            throw new NullPointerException();
         throw new IllegalArgumentException();
     }
 
-    public static FavoriteServicesName[] listPreferences()
-    {
+    public static FavoriteServicesName[] listPreferences() {
         return new FavoriteServicesName[0];
     }
 
-    public FavoriteServicesName getFilterValue()
-    {
+    public FavoriteServicesName getFilterValue() {
         return null;
     }
 
-    public boolean accept(Service service)
-    {
+    public boolean accept(Service service) {
         return false;
     }
-
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/SIElementFilter.java b/src/libbluray/bdj/java/javax/tv/service/navigation/SIElementFilter.java
index f0dc97c..dc66cc3 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/SIElementFilter.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/SIElementFilter.java
@@ -1,7 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
- * Copyright (C) 2015  Petri Hintukainen
+ * Copyright (C) 2015-2016  Petri Hintukainen
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,19 +20,24 @@
 
 package javax.tv.service.navigation;
 
-import javax.tv.service.SIRetrievable;
 import javax.tv.service.Service;
 import javax.tv.service.SIElement;
-import javax.tv.service.SIRequest;
-import javax.tv.service.SIRequestorImpl;
 
 import org.bluray.net.BDLocator;
 
+import org.bluray.ti.PlayItem;
+import org.bluray.ti.PlayItemImpl;
+import org.bluray.ti.PlayList;
+import org.bluray.ti.PlayListImpl;
+import org.bluray.ti.TitleImpl;
+
 public final class SIElementFilter extends ServiceFilter
 {
     public SIElementFilter(SIElement element) throws FilterNotSupportedException {
-        if (element == null)
+        if (element == null) {
+            System.err.println("null element");
             throw new NullPointerException();
+        }
 
         try {
             new BDLocator(element.getLocator().toExternalForm());
@@ -49,6 +54,52 @@ public final class SIElementFilter extends ServiceFilter
     }
 
     public boolean accept(Service service) {
+
+        if (service == null) {
+            System.err.println("null service");
+            throw new NullPointerException();
+        }
+
+        if (!(service instanceof TitleImpl))
+            return false;
+        TitleImpl title = (TitleImpl)service;
+
+        if (element instanceof PlayListImpl) {
+            int id = ((PlayListImpl)element).getId();
+            PlayList[] pls = title.getPlayLists();
+            for (int i = 0; i < pls.length; i++) {
+                if (id == pls[i].getId()) {
+                    return true;
+                }
+            }
+            return false;
+
+        } else if (element instanceof PlayItemImpl) {
+
+            int piId = ((PlayItemImpl)element).getPlayItemId();
+            int plId = ((PlayItemImpl)element).getPlayListId();
+
+            PlayList[] pls = title.getPlayLists();
+            for (int i = 0; i < pls.length; i++) {
+                if (plId == pls[i].getId()) {
+
+                    PlayItem pis[] = pls[i].getPlayItems();
+                    for (int j = 0; j < pis.length; j++) {
+                        if (piId == ((PlayItemImpl)pis[j]).getPlayItemId()) {
+                            return true;
+                        }
+                    }
+                }
+            }
+            return false;
+
+        } else if (element instanceof ServiceDetails) {
+            return element.getLocator() == service.getLocator();
+        }
+
+        System.err.println("Unsupported SI element");
+        return false;
+        /*
         SIRequestorImpl requestor = new SIRequestorImpl();
 
         SIRequest req = service.retrieveDetails(requestor);
@@ -81,6 +132,7 @@ public final class SIElementFilter extends ServiceFilter
         }
 
         return false;
+        */
     }
 
     SIElement element;
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceComponentChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceComponentChangeEvent.java
index 4817b04..3f7516f 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceComponentChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceComponentChangeEvent.java
@@ -23,15 +23,13 @@ import javax.tv.service.*;
 
 public class ServiceComponentChangeEvent extends ServiceDetailsSIChangeEvent {
     public ServiceComponentChangeEvent(ServiceDetails details,
-            SIChangeType type, ServiceComponent component)
-    {
+            SIChangeType type, ServiceComponent component) {
         super(details, type, component);
 
         this.component = component;
     }
 
-    public ServiceComponent getServiceComponent()
-    {
+    public ServiceComponent getServiceComponent() {
         return component;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceDetailsSIChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceDetailsSIChangeEvent.java
index 3716242..a85729c 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceDetailsSIChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceDetailsSIChangeEvent.java
@@ -23,14 +23,12 @@ import javax.tv.service.*;
 
 public abstract class ServiceDetailsSIChangeEvent extends SIChangeEvent {
     public ServiceDetailsSIChangeEvent(ServiceDetails details,
-            SIChangeType type, SIElement element)
-    {
+            SIChangeType type, SIElement element) {
         super(details, type, element);
         this.details = details;
     }
 
-    public ServiceDetails getServiceDetails()
-    {
+    public ServiceDetails getServiceDetails() {
         return details;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceFilter.java b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceFilter.java
index a3aed08..a027e0d 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceFilter.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceFilter.java
@@ -22,8 +22,7 @@ package javax.tv.service.navigation;
 import javax.tv.service.Service;
 
 public abstract class ServiceFilter {
-    protected ServiceFilter()
-    {
+    protected ServiceFilter() {
     }
 
     public abstract boolean accept(Service service);
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceIteratorImpl.java b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceIteratorImpl.java
index 441cb5b..e66eb2f 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceIteratorImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceIteratorImpl.java
@@ -19,6 +19,7 @@
 package javax.tv.service.navigation;
 
 import java.util.LinkedList;
+import java.util.NoSuchElementException;
 
 import javax.tv.service.Service;
 
@@ -36,15 +37,15 @@ public class ServiceIteratorImpl implements ServiceIterator {
     }
 
     public Service nextService() {
-        if (index < services.size())
-            return (Service)services.get(index++);
-        return null;
+        if (!hasNext())
+            throw new NoSuchElementException("End of list reached");
+        return (Service)services.get(index++);
     }
 
     public Service previousService() {
-        if (index > 0)
-            return (Service)services.get(--index);
-        return null;
+        if (!hasPrevious())
+            throw new NoSuchElementException("Start of list reached");
+        return (Service)services.get(--index);
     }
 
     public boolean hasNext() {
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceListImpl.java b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceListImpl.java
index 9846ca3..0ecb6d5 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceListImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceListImpl.java
@@ -53,27 +53,34 @@ public class ServiceListImpl implements ServiceList {
             try {
                 bdLocator = new BDLocator(locator.toExternalForm());
             } catch (org.davic.net.InvalidLocatorException e) {
+                System.err.println("invalid locator");
                 throw new InvalidLocatorException(locator);
             }
         } else {
             bdLocator = (BDLocator)locator;
         }
         int title = bdLocator.getTitleNumber();
-        if (title < 0)
+        if (title < 0) {
+            System.err.println("invalid title in locator");
             throw new InvalidLocatorException(locator);
+        }
         for (int i = 0; i < size(); i++) {
             TitleImpl ti = (TitleImpl)services.get(i);
             if (((TitleImpl)services.get(i)).getTitleNum() == title)
                 return ti;
         }
+        System.err.println("findService: " + locator + " not found");
         return null;
     }
 
     public ServiceList filterServices(ServiceFilter filter) {
+        if (filter == null) {
+            System.err.println("null service filter");
+        }
         LinkedList list = new LinkedList();
         for (int i = 0; i < size(); i++) {
             Service service = getService(i);
-            if (filter.accept(service))
+            if (filter == null || filter.accept(service))
                 list.add(service);
         }
         return new ServiceListImpl(list);
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceTypeFilter.java b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceTypeFilter.java
index 250821e..1a7ad1b 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceTypeFilter.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/ServiceTypeFilter.java
@@ -22,21 +22,20 @@ import javax.tv.service.Service;
 import javax.tv.service.ServiceType;
 
 public final class ServiceTypeFilter extends ServiceFilter {
-    public ServiceTypeFilter(ServiceType type)
-    {
+    public ServiceTypeFilter(ServiceType type) {
         if (type == null)
             throw new NullPointerException();
         this.type = type;
     }
 
-    public ServiceType getFilterValue()
-    {
+    public ServiceType getFilterValue() {
         return type;
     }
 
-    public boolean accept(Service service)
-    {
-        return service.getServiceType().equals(type);
+    public boolean accept(Service service) {
+        if (service == null)
+            throw new NullPointerException();
+        return service.getServiceType() == type;
     }
 
     private ServiceType type;
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/SortNotAvailableException.java b/src/libbluray/bdj/java/javax/tv/service/navigation/SortNotAvailableException.java
index f3b8a27..8b2a051 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/SortNotAvailableException.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/SortNotAvailableException.java
@@ -23,9 +23,12 @@ import javax.tv.service.SIException;
 
 public class SortNotAvailableException extends SIException
 {
-    public SortNotAvailableException() { }
+    public SortNotAvailableException() {
+    }
+
+    public SortNotAvailableException(String reason) {
+        super(reason);
+    }
 
-    public SortNotAvailableException(String reason) { }
-    
     private static final long serialVersionUID = 5524379730037808067L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/navigation/StreamType.java b/src/libbluray/bdj/java/javax/tv/service/navigation/StreamType.java
index 26dc166..acd9d39 100644
--- a/src/libbluray/bdj/java/javax/tv/service/navigation/StreamType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/navigation/StreamType.java
@@ -20,15 +20,13 @@
 package javax.tv.service.navigation;
 
 public class StreamType {
-    protected StreamType(String name)
-    {
+    protected StreamType(String name) {
         if (name == null)
             throw new NullPointerException();
         this.name = name;
     }
 
-    public String toString()
-    {
+    public String toString() {
         return name;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/AlternativeContentEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/AlternativeContentEvent.java
index a95ef7a..7ceb90c 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/AlternativeContentEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/AlternativeContentEvent.java
@@ -20,10 +20,9 @@
 package javax.tv.service.selection;
 
 public class AlternativeContentEvent extends PresentationChangedEvent {
-    public AlternativeContentEvent(ServiceContext context)
-    {
+    public AlternativeContentEvent(ServiceContext context) {
         super(context);
     }
-    
+
     private static final long serialVersionUID = -4788942169012231066L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/InsufficientResourcesException.java b/src/libbluray/bdj/java/javax/tv/service/selection/InsufficientResourcesException.java
index d4f348c..bf703be 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/InsufficientResourcesException.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/InsufficientResourcesException.java
@@ -20,15 +20,13 @@
 package javax.tv.service.selection;
 
 public class InsufficientResourcesException extends ServiceContextException {
-    public InsufficientResourcesException()
-    {
+    public InsufficientResourcesException() {
         super();
     }
 
-    public InsufficientResourcesException(String reason)
-    {
+    public InsufficientResourcesException(String reason) {
         super(reason);
     }
-    
+
     private static final long serialVersionUID = 4013749854109414180L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/InvalidServiceComponentException.java b/src/libbluray/bdj/java/javax/tv/service/selection/InvalidServiceComponentException.java
index 881a45c..3dd63eb 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/InvalidServiceComponentException.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/InvalidServiceComponentException.java
@@ -22,22 +22,19 @@ package javax.tv.service.selection;
 import javax.tv.locator.Locator;
 
 public class InvalidServiceComponentException extends ServiceContextException {
-    public InvalidServiceComponentException(Locator locator)
-    {
+    public InvalidServiceComponentException(Locator locator) {
         super();
 
         this.locator = locator;
     }
 
-    public InvalidServiceComponentException(Locator locator, String reason)
-    {
+    public InvalidServiceComponentException(Locator locator, String reason) {
         super(reason);
 
         this.locator = locator;
     }
 
-    public Locator getInvalidServiceComponent()
-    {
+    public Locator getInvalidServiceComponent() {
         return locator;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/NormalContentEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/NormalContentEvent.java
index a34c9e8..913a698 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/NormalContentEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/NormalContentEvent.java
@@ -21,9 +21,9 @@ package javax.tv.service.selection;
 
 public class NormalContentEvent extends PresentationChangedEvent
 {
-    public NormalContentEvent(ServiceContext context) { 
+    public NormalContentEvent(ServiceContext context) {
         super(context);
     }
-    
+
     private static final long serialVersionUID = 1246777807760132155L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/PresentationChangedEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/PresentationChangedEvent.java
index bbe56fa..23514de 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/PresentationChangedEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/PresentationChangedEvent.java
@@ -21,9 +21,9 @@ package javax.tv.service.selection;
 
 public class PresentationChangedEvent extends ServiceContextEvent
 {
-    public PresentationChangedEvent(ServiceContext context) { 
+    public PresentationChangedEvent(ServiceContext context) {
         super(context);
     }
-    
+
     private static final long serialVersionUID = 4514300927949211901L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/PresentationTerminatedEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/PresentationTerminatedEvent.java
index 8c68559..87ff8dc 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/PresentationTerminatedEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/PresentationTerminatedEvent.java
@@ -20,17 +20,20 @@
 package javax.tv.service.selection;
 
 public class PresentationTerminatedEvent extends ServiceContextEvent {
-    public PresentationTerminatedEvent(ServiceContext context, int reason)
-    {
+    public PresentationTerminatedEvent(ServiceContext context, int reason) {
         super(context);
 
         this.reason = reason;
     }
 
-    public int getReason()
-    {
+    public int getReason() {
         return reason;
     }
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",reason=" + reason + "]";
+    }
+
+    private final int reason;
 
     public static final int SERVICE_VANISHED = 1;
     public static final int TUNED_AWAY = 2;
@@ -39,6 +42,5 @@ public class PresentationTerminatedEvent extends ServiceContextEvent {
     public static final int USER_STOP = 5;
     public static final int OTHER = 255;
 
-    private int reason;
     private static final long serialVersionUID = 4787886890628229164L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/SelectPermission.java b/src/libbluray/bdj/java/javax/tv/service/selection/SelectPermission.java
index bee26cb..9127a0b 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/SelectPermission.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/SelectPermission.java
@@ -24,67 +24,54 @@ import javax.tv.locator.Locator;
 import java.io.Serializable;
 
 public final class SelectPermission extends Permission implements Serializable {
-    public SelectPermission(Locator locator, String actions)
-    {
-        super(locator.toExternalForm());
+    public SelectPermission(Locator locator, String actions) {
+        super(locator == null ? "*" : locator.toExternalForm());
 
-        if (!actions.equals("own") && !actions.equals("*"))
-            throw new IllegalArgumentException();
+        if (actions == null)
+            throw new NullPointerException();
 
-        this.locator = locator.toExternalForm();
+        this.locator = locator == null ? "*" : locator.toExternalForm();
         this.actions = actions;
     }
 
-    public SelectPermission(String locator, String actions)
-    {
-        super(locator);
+    public SelectPermission(String locator, String actions) {
+        super(locator == null ? "*" : locator);
 
-        if (!actions.equals("own") && !actions.equals("*"))
-            throw new IllegalArgumentException();
+        if (actions == null)
+            throw new NullPointerException();
 
-        this.locator = locator;
+        this.locator = locator == null ? "*" : locator;
         this.actions = actions;
     }
 
-    public boolean implies(Permission perm)
-    {
+    public boolean implies(Permission perm) {
         if (!(perm instanceof SelectPermission))
             return false;
-        if (!perm.getActions().equals(actions) && !actions.equals("*"))
-            return false;
 
         SelectPermission sperm = (SelectPermission) perm;
 
+        if (!sperm.actions.equals(actions) && !actions.equals("*"))
+            return false;
+
         if (!sperm.locator.equals(locator) && !locator.equals("*"))
             return false;
 
         return true;
     }
 
-    public boolean equals(Object obj)
-    {
-        if (obj == null)
-            return false;
-        if (this == obj)
-            return true;
-        if (getClass() != obj.getClass())
+    public boolean equals(Object obj) {
+        if (!(obj instanceof SelectPermission))
             return false;
+
         SelectPermission other = (SelectPermission) obj;
-        if (actions == null) {
-            if (other.actions != null)
-                return false;
-        } else if (!actions.equals(other.actions))
+        if (!actions.equals(other.actions))
             return false;
-        if (locator == null) {
-            if (other.locator != null)
-                return false;
-        } else if (!locator.equals(other.locator))
+        if (!locator.equals(other.locator))
             return false;
         return true;
     }
 
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + ((actions == null) ? 0 : actions.hashCode());
@@ -92,8 +79,7 @@ public final class SelectPermission extends Permission implements Serializable {
         return result;
     }
 
-    public String getActions()
-    {
+    public String getActions() {
         return actions;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/SelectionFailedEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/SelectionFailedEvent.java
index 8d5c276..998e36f 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/SelectionFailedEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/SelectionFailedEvent.java
@@ -20,18 +20,22 @@
 package javax.tv.service.selection;
 
 public class SelectionFailedEvent extends ServiceContextEvent {
-    public SelectionFailedEvent(ServiceContext context, int reason)
-    {
+    public SelectionFailedEvent(ServiceContext context, int reason) {
         super(context);
 
         this.reason = reason;
     }
 
-    public int getReason()
-    {
+    public int getReason() {
         return reason;
     }
 
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",reason=" + reason + "]";
+    }
+
+    private final int reason;
+
     public static final int INTERRUPTED = 1;
     public static final int CA_REFUSAL = 2;
     public static final int CONTENT_NOT_FOUND = 3;
@@ -40,6 +44,5 @@ public class SelectionFailedEvent extends ServiceContextEvent {
     public static final int INSUFFICIENT_RESOURCES = 6;
     public static final int OTHER = 255;
 
-    private int reason;
     private static final long serialVersionUID = 3991728273494160910L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextDestroyedEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextDestroyedEvent.java
index 45847be..9abb63f 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextDestroyedEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextDestroyedEvent.java
@@ -20,10 +20,9 @@
 package javax.tv.service.selection;
 
 public class ServiceContextDestroyedEvent extends ServiceContextEvent {
-    public ServiceContextDestroyedEvent(ServiceContext context)
-    {
+    public ServiceContextDestroyedEvent(ServiceContext context) {
         super(context);
     }
-    
+
     private static final long serialVersionUID = -5793301376652925098L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java
index 4b54985..0fd78de 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java
@@ -23,13 +23,16 @@ import java.util.EventObject;
 
 public class ServiceContextEvent extends EventObject
 {
-    public ServiceContextEvent(ServiceContext context) { 
+    public ServiceContextEvent(ServiceContext context) {
         super(context);
+        this.context = context;
     }
 
     public ServiceContext getServiceContext() {
-        return (ServiceContext)source;
+        return context;
     }
-    
+
+    protected ServiceContext context;
+
     private static final long serialVersionUID = -1865592897966055645L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextException.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextException.java
index cd56e49..f8ae2c1 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextException.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextException.java
@@ -20,13 +20,11 @@
 package javax.tv.service.selection;
 
 public class ServiceContextException extends Exception {
-    public ServiceContextException()
-    {
+    public ServiceContextException() {
         super();
     }
 
-    public ServiceContextException(String reason)
-    {
+    public ServiceContextException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
index 2940db4..9fb6b95 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextFactoryImpl.java
@@ -24,13 +24,11 @@ import javax.tv.xlet.XletContext;
 import org.bluray.ti.selection.TitleContextImpl;
 
 public class ServiceContextFactoryImpl extends ServiceContextFactory {
-    protected ServiceContextFactoryImpl() {
-        serviceContexts = new ServiceContext[1];
-        serviceContexts[0] = new TitleContextImpl();
-    }
+
+    private static final Object instanceLock = new Object();
 
     public static ServiceContextFactory getInstance() {
-        synchronized (ServiceContextFactoryImpl.class) {
+        synchronized (instanceLock) {
             if (instance == null)
                 instance = new ServiceContextFactoryImpl();
             return instance;
@@ -38,11 +36,16 @@ public class ServiceContextFactoryImpl extends ServiceContextFactory {
     }
 
     public static void shutdown() {
-        synchronized (ServiceContextFactoryImpl.class) {
+        synchronized (instanceLock) {
             instance = null;
         }
     }
 
+    protected ServiceContextFactoryImpl() {
+        serviceContexts = new ServiceContext[1];
+        serviceContexts[0] = new TitleContextImpl();
+    }
+
     public ServiceContext createServiceContext()
             throws InsufficientResourcesException, SecurityException
     {
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextPermission.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextPermission.java
index 310ca59..2c37eac 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextPermission.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextPermission.java
@@ -23,53 +23,44 @@ import java.security.Permission;
 import java.security.BasicPermission;
 
 public final class ServiceContextPermission extends BasicPermission {
-    public ServiceContextPermission(String name, String actions)
-    {
+    public ServiceContextPermission(String name, String actions) {
         super(name);
 
+        if (name == null || actions == null)
+            throw new NullPointerException();
+
         this.name = name;
         this.actions = actions;
     }
 
-    public boolean implies(Permission perm)
-    {
+    public boolean implies(Permission perm) {
+        if (perm == null)
+            throw new NullPointerException();
         if (!(perm instanceof ServiceContextPermission))
             return false;
-        if (!perm.getActions().equals(actions) && !actions.equals("*"))
-            return false;
 
         ServiceContextPermission scperm = (ServiceContextPermission) perm;
 
+        if (!scperm.actions.equals(actions) && !actions.equals("*"))
+            return false;
         if (!scperm.name.equals(name) && !name.equals("*"))
             return false;
 
         return true;
     }
 
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-            return true;
-        if (!super.equals(obj))
-            return false;
-        if (getClass() != obj.getClass())
+    public boolean equals(Object obj) {
+        if (!(obj instanceof ServiceContextPermission))
             return false;
         ServiceContextPermission other = (ServiceContextPermission) obj;
-        if (actions == null) {
-            if (other.actions != null)
-                return false;
-        } else if (!actions.equals(other.actions))
+        if (!actions.equals(other.actions))
             return false;
-        if (name == null) {
-            if (other.name != null)
-                return false;
-        } else if (!name.equals(other.name))
+        if (!name.equals(other.name))
             return false;
         return true;
     }
 
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 31;
         int result = super.hashCode();
         result = prime * result + ((actions == null) ? 0 : actions.hashCode());
@@ -77,8 +68,7 @@ public final class ServiceContextPermission extends BasicPermission {
         return result;
     }
 
-    public String getActions()
-    {
+    public String getActions() {
         return actions;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/transport/BouquetChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/transport/BouquetChangeEvent.java
index a12229d..0cad426 100644
--- a/src/libbluray/bdj/java/javax/tv/service/transport/BouquetChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/transport/BouquetChangeEvent.java
@@ -23,20 +23,17 @@ import javax.tv.service.SIChangeType;
 
 public class BouquetChangeEvent extends TransportSIChangeEvent {
     public BouquetChangeEvent(BouquetCollection collection, SIChangeType type,
-            Bouquet bouquet)
-    {
+            Bouquet bouquet) {
         super(collection, type, bouquet);
         this.collection = collection;
         this.bouquet = bouquet;
     }
 
-    public BouquetCollection getBouquetCollection()
-    {
+    public BouquetCollection getBouquetCollection() {
         return collection;
     }
 
-    public Bouquet getBouquet()
-    {
+    public Bouquet getBouquet() {
         return bouquet;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/transport/NetworkChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/transport/NetworkChangeEvent.java
index 666f186..8392962 100644
--- a/src/libbluray/bdj/java/javax/tv/service/transport/NetworkChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/transport/NetworkChangeEvent.java
@@ -23,20 +23,17 @@ import javax.tv.service.SIChangeType;
 
 public class NetworkChangeEvent extends TransportSIChangeEvent {
     public NetworkChangeEvent(NetworkCollection collection, SIChangeType type,
-            Network network)
-    {
+            Network network) {
         super(collection, type, network);
         this.collection = collection;
         this.network = network;
     }
 
-    public NetworkCollection getNetworkCollection()
-    {
+    public NetworkCollection getNetworkCollection() {
         return collection;
     }
 
-    public Network getNetwork()
-    {
+    public Network getNetwork() {
         return network;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/transport/ServiceDetailsChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/transport/ServiceDetailsChangeEvent.java
index 3c5bff3..7f116fc 100644
--- a/src/libbluray/bdj/java/javax/tv/service/transport/ServiceDetailsChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/transport/ServiceDetailsChangeEvent.java
@@ -24,14 +24,12 @@ import javax.tv.service.navigation.ServiceDetails;
 
 public class ServiceDetailsChangeEvent extends TransportSIChangeEvent {
     public ServiceDetailsChangeEvent(Transport transport, SIChangeType type,
-            ServiceDetails details)
-    {
+            ServiceDetails details) {
         super(transport, type, details);
         this.details = details;
     }
 
-    public ServiceDetails getServiceDetails()
-    {
+    public ServiceDetails getServiceDetails() {
         return details;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/transport/TransportSIChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/transport/TransportSIChangeEvent.java
index 883ea3d..1634d46 100644
--- a/src/libbluray/bdj/java/javax/tv/service/transport/TransportSIChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/transport/TransportSIChangeEvent.java
@@ -23,14 +23,12 @@ import javax.tv.service.*;
 
 public abstract class TransportSIChangeEvent extends SIChangeEvent {
     public TransportSIChangeEvent(Transport transport, SIChangeType type,
-            SIElement element)
-    {
+            SIElement element) {
         super(transport, type, element);
         this.transport = transport;
     }
 
-    public Transport getTransport()
-    {
+    public Transport getTransport() {
         return transport;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/transport/TransportStreamChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/transport/TransportStreamChangeEvent.java
index a9c2e93..479363e 100644
--- a/src/libbluray/bdj/java/javax/tv/service/transport/TransportStreamChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/transport/TransportStreamChangeEvent.java
@@ -23,20 +23,17 @@ import javax.tv.service.SIChangeType;
 
 public class TransportStreamChangeEvent extends TransportSIChangeEvent {
     public TransportStreamChangeEvent(TransportStreamCollection collection,
-            SIChangeType type, TransportStream stream)
-    {
+            SIChangeType type, TransportStream stream) {
         super(collection, type, stream);
         this.collection = collection;
         this.stream = stream;
     }
 
-    public TransportStreamCollection getTransportStreamCollection()
-    {
+    public TransportStreamCollection getTransportStreamCollection() {
         return collection;
     }
 
-    public TransportStream getTransportStream()
-    {
+    public TransportStream getTransportStream() {
         return stream;
     }
 
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java b/src/libbluray/bdj/java/javax/tv/util/TVTimer.java
similarity index 60%
copy from src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java
copy to src/libbluray/bdj/java/javax/tv/util/TVTimer.java
index 8218a7d..a1232f3 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/DeviceAttribute.java
+++ b/src/libbluray/bdj/java/javax/tv/util/TVTimer.java
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2012  libbluray
+ * Copyright (C) 2016  VideoLAN
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,20 +17,23 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package com.aacsla.bluray.online;
+package javax.tv.util;
 
-import org.videolan.Libbluray;
 import org.videolan.Logger;
 
-public class DeviceAttribute {
-    public DeviceAttribute() {
+public abstract class TVTimer
+{
+    public static TVTimer getTimer() {
+        Logger.unimplemented(TVTimer.class.getName(), "getTimer");
+        return null;
     }
 
-    public byte[] getDeviceBindingID() {
-        byte bid[] = Libbluray.getAacsData(Libbluray.AACS_DEVICE_BINDING_ID);
-        if (bid == null) {
-            Logger.getLogger(DeviceAttribute.class.getName()).warning("getDeviceBindingID() failed");
-        }
-        return bid;
-    }
+    public abstract TVTimerSpec scheduleTimerSpec(TVTimerSpec paramTVTimerSpec)
+        throws TVTimerScheduleFailedException;
+
+    public abstract long getGranularity();
+
+    public abstract long getMinRepeatInterval();
+
+    public abstract void deschedule(TVTimerSpec paramTVTimerSpec);
 }
diff --git a/src/libbluray/bdj/java/javax/microedition/xlet/UnavailableContainerException.java b/src/libbluray/bdj/java/javax/tv/util/TVTimerScheduleFailedException.java
similarity index 74%
copy from src/libbluray/bdj/java/javax/microedition/xlet/UnavailableContainerException.java
copy to src/libbluray/bdj/java/javax/tv/util/TVTimerScheduleFailedException.java
index 4f1f059..4f88d69 100644
--- a/src/libbluray/bdj/java/javax/microedition/xlet/UnavailableContainerException.java
+++ b/src/libbluray/bdj/java/javax/tv/util/TVTimerScheduleFailedException.java
@@ -1,5 +1,6 @@
 /*
  * This file is part of libbluray
+ * Copyright (C) 2016  VideoLAN
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -16,14 +17,14 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package javax.microedition.xlet;
+package javax.tv.util;
 
-public class UnavailableContainerException extends Exception {
-    public UnavailableContainerException() {
-        super();
+public class TVTimerScheduleFailedException extends Exception
+{
+    public TVTimerScheduleFailedException() {
     }
 
-    public UnavailableContainerException(String s) {
-        super(s);
+    public TVTimerScheduleFailedException(String param) {
+        super(param);
     }
 }
diff --git a/src/libbluray/bdj/java/javax/tv/util/TVTimerSpec.java b/src/libbluray/bdj/java/javax/tv/util/TVTimerSpec.java
new file mode 100644
index 0000000..ed12a7d
--- /dev/null
+++ b/src/libbluray/bdj/java/javax/tv/util/TVTimerSpec.java
@@ -0,0 +1,104 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2016  VideoLAN
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+package javax.tv.util;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.videolan.Logger;
+
+public class TVTimerSpec
+{
+    private boolean absolute;
+    private boolean regular;
+    private boolean repeat;
+    private long    time;
+
+    public TVTimerSpec() {
+        absolute = true;
+        repeat = false;
+        regular = true;
+        time = 0L;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public boolean isAbsolute() {
+        return absolute;
+    }
+
+    public boolean isRegular() {
+        return regular;
+    }
+
+    public boolean isRepeat() {
+        return repeat;
+    }
+
+    public void addTVTimerWentOffListener(TVTimerWentOffListener l) {
+        Logger.unimplemented(TVTimer.class.getName(), "addTVTimerWentOffListener");
+    }
+
+    public void removeTVTimerWentOffListener(TVTimerWentOffListener l) {
+        Logger.unimplemented(TVTimer.class.getName(), "removeTVTimerWentOffListener");
+    }
+
+    public void notifyListeners(TVTimer source) {
+        Logger.unimplemented(TVTimer.class.getName(), "notifyListeners");
+    }
+
+    public void setAbsolute(boolean absolute) {
+        this.absolute = absolute;
+    }
+
+    public void setAbsoluteTime(long when) {
+        if (when < 0L) {
+            throw new IllegalArgumentException();
+        }
+        setAbsolute(true);
+        setTime(when);
+        setRepeat(false);
+    }
+
+    public void setDelayTime(long delay) {
+        if (delay < 0L) {
+            throw new IllegalArgumentException();
+        }
+        setAbsolute(false);
+        setTime(delay);
+        setRepeat(false);
+    }
+
+    public void setRegular(boolean regular) {
+        this.regular = regular;
+    }
+
+    public void setRepeat(boolean repeat) {
+        this.repeat = repeat;
+    }
+
+    public void setTime(long time) {
+        if (time < 0L)
+            throw new IllegalArgumentException();
+        this.time = time;
+    }
+}
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/mc/MCEvent.java b/src/libbluray/bdj/java/javax/tv/util/TVTimerWentOffEvent.java
similarity index 71%
copy from src/libbluray/bdj/java/com/aacsla/bluray/mc/MCEvent.java
copy to src/libbluray/bdj/java/javax/tv/util/TVTimerWentOffEvent.java
index a40a0e4..2decd03 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/mc/MCEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/util/TVTimerWentOffEvent.java
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2012  libbluray
+ * Copyright (C) 2016  VideoLAN
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,14 +17,20 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package com.aacsla.bluray.mc;
+package javax.tv.util;
 
 import java.util.EventObject;
 
-public class MCEvent extends EventObject {
-    public MCEvent(Object source) {
+public class TVTimerWentOffEvent extends EventObject
+{
+    public TVTimerWentOffEvent(TVTimer source, TVTimerSpec spec) {
         super(source);
+        this.spec = spec;
     }
 
-    private static final long serialVersionUID = 5519846404607420914L;
+    public TVTimerSpec getTimerSpec() {
+        return spec;
+    }
+
+    private TVTimerSpec spec = null;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java b/src/libbluray/bdj/java/javax/tv/util/TVTimerWentOffListener.java
similarity index 79%
copy from src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java
copy to src/libbluray/bdj/java/javax/tv/util/TVTimerWentOffListener.java
index 89dfec7..6713b98 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIChangeListener.java
+++ b/src/libbluray/bdj/java/javax/tv/util/TVTimerWentOffListener.java
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016  VideoLAN
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,11 +17,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package javax.tv.service;
+package javax.tv.util;
 
-import java.util.EventListener;
-
-public interface SIChangeListener extends EventListener
+public abstract interface TVTimerWentOffListener
 {
-    
+    public abstract void timerWentOff(TVTimerWentOffEvent paramTVTimerWentOffEvent);
 }
diff --git a/src/libbluray/bdj/java/javax/tv/xlet/Xlet.java b/src/libbluray/bdj/java/javax/tv/xlet/Xlet.java
index 77cf449..9ced0d5 100644
--- a/src/libbluray/bdj/java/javax/tv/xlet/Xlet.java
+++ b/src/libbluray/bdj/java/javax/tv/xlet/Xlet.java
@@ -22,7 +22,7 @@ package javax.tv.xlet;
 public interface Xlet
 {
     public void initXlet(XletContext context) throws XletStateChangeException;
-    
+
     public void destroyXlet(boolean force) throws XletStateChangeException;
 
     public void startXlet() throws XletStateChangeException;
diff --git a/src/libbluray/bdj/java/javax/tv/xlet/XletContext.java b/src/libbluray/bdj/java/javax/tv/xlet/XletContext.java
index 8a02c44..79d038e 100644
--- a/src/libbluray/bdj/java/javax/tv/xlet/XletContext.java
+++ b/src/libbluray/bdj/java/javax/tv/xlet/XletContext.java
@@ -28,6 +28,6 @@ public interface XletContext
     public Object getXletProperty(String key);
 
     public void resumeRequest();
-    
+
     public static final String ARGS = "javax.tv.xlet.args";
 }
diff --git a/src/libbluray/bdj/java/javax/tv/xlet/XletStateChangeException.java b/src/libbluray/bdj/java/javax/tv/xlet/XletStateChangeException.java
index 01021bf..f6532f2 100644
--- a/src/libbluray/bdj/java/javax/tv/xlet/XletStateChangeException.java
+++ b/src/libbluray/bdj/java/javax/tv/xlet/XletStateChangeException.java
@@ -21,13 +21,12 @@ package javax.tv.xlet;
 
 public class XletStateChangeException extends Exception
 {
-    private static final long serialVersionUID = 6559278303854606991L;
-
-    public XletStateChangeException() 
-    { 
+    public XletStateChangeException() {
     }
 
-    public XletStateChangeException(String s) 
-    { 
+    public XletStateChangeException(String s) {
+        super(s);
     }
+
+    private static final long serialVersionUID = 6559278303854606991L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/bdplus/Status.java b/src/libbluray/bdj/java/org/bluray/bdplus/Status.java
index b897b3e..0d473b0 100644
--- a/src/libbluray/bdj/java/org/bluray/bdplus/Status.java
+++ b/src/libbluray/bdj/java/org/bluray/bdplus/Status.java
@@ -24,8 +24,11 @@ import org.videolan.Libbluray;
 import org.videolan.Logger;
 
 public class Status {
+
+    private static final Object instanceLock = new Object();
+
     public static Status getInstance() {
-        synchronized (Status.class) {
+        synchronized (instanceLock) {
             if (instance == null)
                 instance = new Status();
             return instance;
@@ -34,7 +37,7 @@ public class Status {
 
     public static void shutdown() {
         Status s;
-        synchronized (Status.class) {
+        synchronized (instanceLock) {
             s = instance;
             instance = null;
         }
diff --git a/src/libbluray/bdj/java/org/bluray/media/AngleChangeEvent.java b/src/libbluray/bdj/java/org/bluray/media/AngleChangeEvent.java
index 008b0bc..f177e3a 100644
--- a/src/libbluray/bdj/java/org/bluray/media/AngleChangeEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/AngleChangeEvent.java
@@ -22,17 +22,19 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class AngleChangeEvent extends EventObject {
-    public AngleChangeEvent(AngleControl source, int angle)
-    {
+    public AngleChangeEvent(AngleControl source, int angle) {
         super(source);
         this.angle = angle;
     }
 
-    public int getAngle()
-    {
+    public int getAngle() {
         return this.angle;
     }
 
-    private int angle;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",angle=" + angle + "]";
+    }
+
+    private final int angle;
     private static final long serialVersionUID = -2582705865081165327L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/media/InvalidAngleException.java b/src/libbluray/bdj/java/org/bluray/media/InvalidAngleException.java
index 73bee95..c13691f 100644
--- a/src/libbluray/bdj/java/org/bluray/media/InvalidAngleException.java
+++ b/src/libbluray/bdj/java/org/bluray/media/InvalidAngleException.java
@@ -20,13 +20,11 @@
 package org.bluray.media;
 
 public class InvalidAngleException extends Exception {
-    public InvalidAngleException()
-    {
+    public InvalidAngleException() {
         super();
     }
 
-    public InvalidAngleException(String reason)
-    {
+    public InvalidAngleException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/InvalidPlayListException.java b/src/libbluray/bdj/java/org/bluray/media/InvalidPlayListException.java
index 351b122..0da467c 100644
--- a/src/libbluray/bdj/java/org/bluray/media/InvalidPlayListException.java
+++ b/src/libbluray/bdj/java/org/bluray/media/InvalidPlayListException.java
@@ -20,13 +20,11 @@
 package org.bluray.media;
 
 public class InvalidPlayListException extends Exception {
-    public InvalidPlayListException()
-    {
+    public InvalidPlayListException() {
         super();
     }
 
-    public InvalidPlayListException(String reason)
-    {
+    public InvalidPlayListException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/PanningChangeEvent.java b/src/libbluray/bdj/java/org/bluray/media/PanningChangeEvent.java
index 584266c..c0c0adb 100644
--- a/src/libbluray/bdj/java/org/bluray/media/PanningChangeEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/PanningChangeEvent.java
@@ -22,25 +22,22 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class PanningChangeEvent extends EventObject {
-    public PanningChangeEvent(PanningControl source, float balance, float fade)
-    {
+    public PanningChangeEvent(PanningControl source, float balance, float fade) {
         super(source);
 
         this.balance = balance;
         this.fade = fade;
     }
 
-    public float getFrontRear()
-    {
+    public float getFrontRear() {
         return fade;
     }
 
-    public float getLeftRight()
-    {
+    public float getLeftRight() {
         return balance;
     }
 
-    private float balance;
-    private float fade;
+    private final float balance;
+    private final float fade;
     private static final long serialVersionUID = 75180748900043421L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/media/PiPStatusEvent.java b/src/libbluray/bdj/java/org/bluray/media/PiPStatusEvent.java
index 1437241..4b9362f 100644
--- a/src/libbluray/bdj/java/org/bluray/media/PiPStatusEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/PiPStatusEvent.java
@@ -23,18 +23,20 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class PiPStatusEvent extends EventObject {
-    public PiPStatusEvent(boolean available, PiPControl source)
-    {
+    public PiPStatusEvent(boolean available, PiPControl source) {
         super(source);
 
         this.available = available;
     }
 
-    public boolean isPiPAvailable()
-    {
+    public boolean isPiPAvailable() {
         return this.available;
     }
 
-    private boolean available;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",available=" + available + "]";
+    }
+
+    private final boolean available;
     private static final long serialVersionUID = -1233930796504204430L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/media/PlaybackMarkEvent.java b/src/libbluray/bdj/java/org/bluray/media/PlaybackMarkEvent.java
index cff609a..53c068e 100644
--- a/src/libbluray/bdj/java/org/bluray/media/PlaybackMarkEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/PlaybackMarkEvent.java
@@ -22,18 +22,20 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class PlaybackMarkEvent extends EventObject {
-    public PlaybackMarkEvent(PlaybackControl source, int mark)
-    {
+    public PlaybackMarkEvent(PlaybackControl source, int mark) {
         super(source);
 
         this.mark = mark;
     }
 
-    public int getMark()
-    {
+    public int getMark() {
         return this.mark;
     }
 
-    private int mark;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",mark=" + mark + "]";
+    }
+
+    private final int mark;
     private static final long serialVersionUID = -6679776995045036356L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/media/PlaybackPlayItemEvent.java b/src/libbluray/bdj/java/org/bluray/media/PlaybackPlayItemEvent.java
index 4d5ee03..1b4bc71 100644
--- a/src/libbluray/bdj/java/org/bluray/media/PlaybackPlayItemEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/PlaybackPlayItemEvent.java
@@ -22,17 +22,18 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class PlaybackPlayItemEvent extends EventObject {
-    public PlaybackPlayItemEvent(PlaybackControl source, int playItem)
-    {
+    public PlaybackPlayItemEvent(PlaybackControl source, int playItem) {
         super(source);
         this.playItem = playItem;
     }
 
-    public int getPlayItem()
-    {
+    public int getPlayItem() {
         return playItem;
     }
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",playItem=" + playItem + "]";
+    }
 
-    private int playItem;
+    private final int playItem;
     private static final long serialVersionUID = -2550042660300066017L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java b/src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java
index 78f22f2..fc3d295 100644
--- a/src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java
+++ b/src/libbluray/bdj/java/org/bluray/media/StreamNotAvailableException.java
@@ -20,13 +20,11 @@
 package org.bluray.media;
 
 public class StreamNotAvailableException extends Exception {
-    public StreamNotAvailableException()
-    {
+    public StreamNotAvailableException() {
         super();
     }
 
-    public StreamNotAvailableException(String reason)
-    {
+    public StreamNotAvailableException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/SubtitleStyleNotAvailableException.java b/src/libbluray/bdj/java/org/bluray/media/SubtitleStyleNotAvailableException.java
index b584729..a1ff155 100644
--- a/src/libbluray/bdj/java/org/bluray/media/SubtitleStyleNotAvailableException.java
+++ b/src/libbluray/bdj/java/org/bluray/media/SubtitleStyleNotAvailableException.java
@@ -20,13 +20,11 @@
 package org.bluray.media;
 
 public class SubtitleStyleNotAvailableException extends Exception {
-    public SubtitleStyleNotAvailableException()
-    {
+    public SubtitleStyleNotAvailableException() {
         super();
     }
 
-    public SubtitleStyleNotAvailableException(String reason)
-    {
+    public SubtitleStyleNotAvailableException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/TextSubtitleNotAvailableException.java b/src/libbluray/bdj/java/org/bluray/media/TextSubtitleNotAvailableException.java
index d40fb7a..850ed73 100644
--- a/src/libbluray/bdj/java/org/bluray/media/TextSubtitleNotAvailableException.java
+++ b/src/libbluray/bdj/java/org/bluray/media/TextSubtitleNotAvailableException.java
@@ -20,13 +20,11 @@
 package org.bluray.media;
 
 public class TextSubtitleNotAvailableException extends Exception {
-    public TextSubtitleNotAvailableException()
-    {
+    public TextSubtitleNotAvailableException() {
         super();
     }
 
-    public TextSubtitleNotAvailableException(String reason)
-    {
+    public TextSubtitleNotAvailableException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/UOMaskTableChangedEvent.java b/src/libbluray/bdj/java/org/bluray/media/UOMaskTableChangedEvent.java
index bc347ea..224ce93 100644
--- a/src/libbluray/bdj/java/org/bluray/media/UOMaskTableChangedEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/UOMaskTableChangedEvent.java
@@ -22,8 +22,7 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class UOMaskTableChangedEvent extends EventObject {
-    public UOMaskTableChangedEvent(UOMaskTableControl source)
-    {
+    public UOMaskTableChangedEvent(UOMaskTableControl source) {
         super(source);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/media/UOMaskedEvent.java b/src/libbluray/bdj/java/org/bluray/media/UOMaskedEvent.java
index 3f89762..2f252f2 100644
--- a/src/libbluray/bdj/java/org/bluray/media/UOMaskedEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/media/UOMaskedEvent.java
@@ -22,17 +22,19 @@ package org.bluray.media;
 import java.util.EventObject;
 
 public class UOMaskedEvent extends EventObject {
-    public UOMaskedEvent(UOMaskTableControl source, int position)
-    {
+    public UOMaskedEvent(UOMaskTableControl source, int position) {
         super(source);
         this.position = position;
     }
 
-    public int getUOMaskPosition()
-    {
+    public int getUOMaskPosition() {
         return position;
     }
 
-    private int position;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",position=" + position + "]";
+    }
+
+    private final int position;
     private static final long serialVersionUID = -1417936916531803863L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/net/BDLocator.java b/src/libbluray/bdj/java/org/bluray/net/BDLocator.java
index a0b593b..f8e2327 100644
--- a/src/libbluray/bdj/java/org/bluray/net/BDLocator.java
+++ b/src/libbluray/bdj/java/org/bluray/net/BDLocator.java
@@ -23,8 +23,85 @@ import org.davic.net.Locator;
 import org.davic.net.InvalidLocatorException;
 
 import org.videolan.BDJUtil;
+import org.videolan.Logger;
 
 public class BDLocator extends Locator {
+
+    /*
+    /* range checks
+     */
+
+    private void checkDiscId(String disc) throws InvalidLocatorException {
+        if (disc == null) {
+            return;
+        }
+        if (disc.length() == 32) {
+            try {
+                new java.math.BigInteger(disc, 16);
+                return;
+            } catch (NumberFormatException e) {
+            }
+        }
+        logger.error("Invalid Disc ID: " + disc);
+        throw new InvalidLocatorException();
+    }
+
+    private void checkTitle(int title) throws InvalidLocatorException {
+        if ((title >= -1) && (title <= 999)) {
+            return;
+        }
+        if ((title == 65534) || (title == 65535)) {
+            // "resume" and First Play
+            return;
+        }
+        logger.error("Invalid title number: " + title);
+        throw new InvalidLocatorException();
+    }
+
+    private void checkPlaylist(int pl) throws InvalidLocatorException {
+        if ((pl >= -1) && (pl <= 1999)) {
+            return;
+        }
+        logger.error("Invalid playlist id: " + pl);
+        throw new InvalidLocatorException();
+    }
+
+    private void checkPlayitem(int pi) throws InvalidLocatorException {
+        if ((pi >= -1) && (pi <= 998)) {
+            return;
+        }
+        logger.error("Invalid playitem id: " + pi);
+        throw new InvalidLocatorException();
+    }
+
+    private void checkMark(int mark) throws InvalidLocatorException {
+        if ((mark >= -1) && (mark <= 998)) {
+            return;
+        }
+        logger.error("Invalid playmark id: " + mark);
+        throw new InvalidLocatorException();
+    }
+
+    private void checkJar(int jar) throws InvalidLocatorException {
+        if ((jar >= -1) && (jar <= 99999)) {
+            return;
+        }
+        logger.error("Invalid JAR id: " + jar);
+        throw new InvalidLocatorException();
+    }
+
+    private void checkSound(int sound) throws InvalidLocatorException {
+        if ((sound >= -1) && (sound <= 127)) {
+            return;
+        }
+        logger.error("Invalid sound id: " + sound);
+        throw new InvalidLocatorException();
+    }
+
+    /*
+     *
+     */
+
     public BDLocator(String url) throws InvalidLocatorException {
         super(url);
         try {
@@ -36,13 +113,18 @@ public class BDLocator extends Locator {
                 throw new InvalidLocatorException();
 
         } catch (InvalidLocatorException e) {
-            System.err.println("Invalid locator: " + url);
+            logger.error("Invalid locator: " + url);
             throw e;
         }
     }
 
     public BDLocator(String disc, int titleNum, int playList) throws InvalidLocatorException {
         super(null);
+
+        checkDiscId(disc);
+        checkTitle(titleNum);
+        checkPlaylist(playList);
+
         this.disc = disc;
         this.titleNum = titleNum;
         this.playList = playList;
@@ -51,8 +133,17 @@ public class BDLocator extends Locator {
 
     public BDLocator(String disc, int titleNum, int jar, int sound) throws InvalidLocatorException {
         super(null);
-        if ((jar >= 0) && (sound >= 0))
+
+        checkDiscId(disc);
+        checkTitle(titleNum);
+        checkJar(jar);
+        checkSound(sound);
+
+        if ((jar >= 0) && (sound >= 0)) {
+            logger.error("Invalid locator: jar ID and sound ID set");
             throw new InvalidLocatorException();
+        }
+
         this.disc = disc;
         this.titleNum = titleNum;
         this.jar = jar;
@@ -63,11 +154,19 @@ public class BDLocator extends Locator {
     public BDLocator(String disc, int titleNum, int playList, int playItem, int mark, String[] componentTags)
             throws InvalidLocatorException {
         super(null);
+
+        checkDiscId(disc);
+        checkTitle(titleNum);
+        checkPlaylist(playList);
+        checkPlayitem(playItem);
+        checkMark(mark);
+
         this.disc = disc;
         this.titleNum = titleNum;
         this.playList = playList;
         this.playItem = playItem;
         this.mark = mark;
+
         if (componentTags != null) {
             try {
                 for (int i = 0; i < componentTags.length; i++) {
@@ -82,16 +181,23 @@ public class BDLocator extends Locator {
                         secondaryVideoNum = Integer.parseInt(comp.substring(3));
                     else if (comp.startsWith("P:"))
                         textStreamNum = Integer.parseInt(comp.substring(2));
-                    else
+                    else {
+                        logger.error("Invalid locator: unknown component tag in " + comp);
                         throw new InvalidLocatorException();
+                    }
                 }
             } catch (NumberFormatException e) {
+                logger.error("Invalid locator: invalid component tag found");
                 throw new InvalidLocatorException();
             }
         }
         url = getUrl();
     }
 
+    /*
+     *
+     */
+
     public boolean equals(Object obj) {
         if (obj == null)
             return false;
@@ -201,6 +307,10 @@ public class BDLocator extends Locator {
         return textStreamNum;
     }
 
+    /*
+     *
+     */
+
     public void setPlayListId(int id) {
         if ((id >= 0) && (id != playList)) {
             playList = id;
@@ -320,6 +430,10 @@ public class BDLocator extends Locator {
         return str;
     }
 
+    /*
+     * parsing (used in constructor)
+     */
+
     private boolean parseJar(String str) throws InvalidLocatorException {
         if (!str.startsWith("JAR:"))
             return false;
@@ -358,18 +472,24 @@ public class BDLocator extends Locator {
             String element = str.substring(begin, end);
             try {
                 if (playList < 0) {
-                    if ((end - begin) == 32)
+                    if ((end - begin) == 32) {
+                        checkDiscId(element);
                         disc = element;
-                    else if ((end - begin) <= 4)
+                    } else if ((end - begin) <= 4) {
                         titleNum = Integer.parseInt(element, 16);
-                    else if (element.startsWith("PLAYLIST:"))
+                        checkTitle(titleNum);
+                    } else if (element.startsWith("PLAYLIST:")) {
                         playList = Integer.parseInt(element.substring(9));
-                    else
+                        checkPlaylist(playList);
+                    } else {
                         throw new InvalidLocatorException();
+                    }
                 } else if (element.startsWith("MARK:")) {
                     mark = Integer.parseInt(element.substring(5));
+                    checkMark(mark);
                 } else if (element.startsWith("ITEM:")) {
                     playItem = Integer.parseInt(element.substring(5));
+                    checkPlayitem(playItem);
                 } else if (element.startsWith("A1:")) {
                     primaryAudioNum = Integer.parseInt(element.substring(3));
                     if (primaryAudioNum < 0)
@@ -396,9 +516,11 @@ public class BDLocator extends Locator {
                         throw new InvalidLocatorException();
                     isTag = true;
                 } else {
+                    logger.error("Unknown tag: " + element);
                     throw new InvalidLocatorException();
                 }
             } catch (NumberFormatException e) {
+                logger.error("Parse error: " + e);
                 throw new InvalidLocatorException();
             }
             if (end >= length)
@@ -437,4 +559,6 @@ public class BDLocator extends Locator {
     protected int playList = -1;
     protected int sound = -1;
     protected int titleNum = -1;
+
+    private static final Logger logger = Logger.getLogger(BDLocator.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java b/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java
index 5ea1c57..d8082af 100644
--- a/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java
+++ b/src/libbluray/bdj/java/org/bluray/storage/StorageManager.java
@@ -20,12 +20,11 @@
 package org.bluray.storage;
 
 public class StorageManager {
+
+    private static final StorageManager instance = new StorageManager();
+
     public static StorageManager getInstance() {
-        synchronized (StorageManager.class) {
-            if (instance == null)
-                instance = new StorageManager();
-            return instance;
-        }
+        return instance;
     }
 
     protected StorageManager() {
@@ -38,6 +37,4 @@ public class StorageManager {
     public DataAreaInfo getPersistentDataAreaInfo() {
         return new PersistentDataAreaInfo();
     }
-
-    private static StorageManager instance = null;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java b/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java
index 7adbb96..fd659ba 100644
--- a/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java
+++ b/src/libbluray/bdj/java/org/bluray/system/RegisterAccess.java
@@ -21,31 +21,25 @@ package org.bluray.system;
 import org.videolan.Libbluray;
 
 public class RegisterAccess {
-    private RegisterAccess()
-    {
-        
+    private RegisterAccess() {
     }
-    
-    public static RegisterAccess getInstance()
-    {
+
+    public static RegisterAccess getInstance() {
         return instance;
     }
-    
-    public int getGPR(int num)
-    {
+
+    public int getGPR(int num) {
         return Libbluray.readGPR(num);
     }
-    
-    public int getPSR(int num)
-    {
+
+    public int getPSR(int num) {
         return Libbluray.readPSR(num);
     }
-    
-    public void setGPR(int num, int value)
-    {
+
+    public void setGPR(int num, int value) {
         Libbluray.writeGPR(num, value);
     }
-    
+
     public static final int PSR_AUDIO_STN = 1;
     public static final int PSR_PG_TXTST_STN = 2;
     public static final int PSR_ANGLE_NR = 3;
@@ -54,7 +48,7 @@ public class RegisterAccess {
     public static final int PSR_PLAYLIST_ID = 6;
     public static final int PSR_PLAYITEM_ID = 7;
     public static final int PSR_PRES_TIME = 8;
-    
+
     public static final int PSR_USER_STYLE_NR = 12;
     public static final int PSR_PARENTAL_LVL = 13;
     public static final int PSR_SECONDARY_AUDIO_STN = 14;
@@ -64,10 +58,10 @@ public class RegisterAccess {
     public static final int PSR_MENU_DESCR_LANG_CODE = 18;
     public static final int PSR_COUNTRY_CODE = 19;
     public static final int PSR_REGION_PLAYBACK_CODE = 20;
-    
+
     public static final int PSR_VIDEO_CAPABILITY = 29;
     public static final int PSR_PLAYER_CAP_TXTST = 30;
     public static final int PSR_PLAYER_PROFILE = 31;
-    
+
     private static final RegisterAccess instance = new RegisterAccess();
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/CodingType.java b/src/libbluray/bdj/java/org/bluray/ti/CodingType.java
index 9fe9a8a..d7e24f3 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/CodingType.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/CodingType.java
@@ -20,13 +20,13 @@
 package org.bluray.ti;
 
 public class CodingType {
-    protected CodingType(String name)
-    {
+    protected CodingType(String name) {
         this.name = name;
+        if (name == null)
+            throw new NullPointerException("name is null");
     }
 
-    public String toString()
-    {
+    public String toString() {
         return name;
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java b/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java
index 833291c..9861598 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscEjectedEvent.java
@@ -20,10 +20,7 @@
 package org.bluray.ti;
 
 public class DiscEjectedEvent extends DiscStatusEvent {
-    public DiscEjectedEvent(Object source)
-    {
+    public DiscEjectedEvent(Object source) {
         super(source);
     }
-
-    private static final long serialVersionUID = -5165934355777383590L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java b/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java
index 0fe4bee..c9d2fb3 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscInsertedEvent.java
@@ -20,10 +20,7 @@
 package org.bluray.ti;
 
 public class DiscInsertedEvent extends DiscStatusEvent {
-    public DiscInsertedEvent(Object source)
-    {
+    public DiscInsertedEvent(Object source) {
         super(source);
     }
-
-    private static final long serialVersionUID = -474637357700362624L;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java b/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java
index 2e30af9..a5feddd 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscManager.java
@@ -21,11 +21,19 @@ package org.bluray.ti;
 
 import java.util.LinkedList;
 
+import org.videolan.BDJListeners;
+
 public class DiscManager {
-    public static synchronized DiscManager getDiscManager() {
-        if (instance == null)
-            instance = new DiscManager();
-        return instance;
+
+    private static DiscManager instance;
+    private static final Object instanceLock = new Object();
+
+    public static DiscManager getDiscManager() {
+        synchronized (instanceLock) {
+            if (instance == null)
+                instance = new DiscManager();
+            return instance;
+        }
     }
 
     public void expectNextDisc(String[] discIds) {
@@ -33,26 +41,26 @@ public class DiscManager {
     }
 
     public Disc getCurrentDisc() {
-        return disc;
+        return new DiscImpl(discId);
     }
 
     public void addDiscStatusEventListener(DiscStatusListener listener) {
-        synchronized(listeners) {
-            listeners.add(listener);
-        }
+        listeners.add(listener);
     }
 
     public void removeDiscStatusEventListener(DiscStatusListener listener) {
-        synchronized(listeners) {
-            listeners.remove(listener);
-        }
+        listeners.remove(listener);
     }
 
+    // XXX not allowed to add new public methods -- should be done in Impl class
     public void setCurrentDisc(String id) {
-        disc = new DiscImpl(id);
+        if (org.videolan.BDJXletContext.getCurrentContext() == null) {
+            discId = id;
+        } else {
+            System.err.println("Ignoring disc ID (from Xlet)");
+        }
     }
 
-    private LinkedList listeners = new LinkedList();
-    private static DiscManager instance;
-    private DiscImpl disc = null;
+    private BDJListeners listeners = new BDJListeners();
+    private String discId = null;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/DiscStatusEvent.java b/src/libbluray/bdj/java/org/bluray/ti/DiscStatusEvent.java
index e19377e..476dc93 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/DiscStatusEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/DiscStatusEvent.java
@@ -21,8 +21,7 @@ package org.bluray.ti;
 import java.util.EventObject;
 
 public class DiscStatusEvent extends EventObject {
-    public DiscStatusEvent(Object source)
-    {
+    public DiscStatusEvent(Object source) {
         super(source);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java b/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java
index cde7c5e..05eda8c 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/PlayItemImpl.java
@@ -33,36 +33,39 @@ import org.videolan.StreamInfo;
 import org.videolan.TIClip;
 
 public class PlayItemImpl implements PlayItem {
-    protected PlayItemImpl(int playlistId, int playitemId, TIClip clip, Title service)
-    {
+    protected PlayItemImpl(int playlistId, int playitemId, TIClip clip, Title service) {
         this.playlistId = playlistId;
         this.playitemId = playitemId;
         this.clip = clip;
         this.service = service;
     }
 
-    public Locator getLocator()
-    {
+    public int getPlayItemId() {
+        return playitemId;
+    }
+
+    public int getPlayListId() {
+        return playlistId;
+    }
+
+    public Locator getLocator() {
         int title = Libbluray.getCurrentTitle();
         try {
-            return new BDLocator("bd://" + title + ".PLAYLIST:" + playlistId + ".ITEM:" + playitemId);
+            return new BDLocator("bd://" + Integer.toHexString(title) + ".PLAYLIST:" + playlistId + ".ITEM:" + playitemId);
         } catch (InvalidLocatorException e) {
             return null;
         }
     }
 
-    public ServiceInformationType getServiceInformationType()
-    {
+    public ServiceInformationType getServiceInformationType() {
         return TitleInformationType.BD_ROM;
     }
 
-    public Date getUpdateTime()
-    {
+    public Date getUpdateTime() {
         return null;
     }
 
-    public ServiceComponent[] getComponents()
-    {
+    public ServiceComponent[] getComponents() {
         StreamInfo[] video = clip.getVideoStreams();
         StreamInfo[] audio = clip.getVideoStreams();
         StreamInfo[] pg = clip.getVideoStreams();
@@ -92,8 +95,8 @@ public class PlayItemImpl implements PlayItem {
         return components;
     }
 
-    int playlistId;
-    int playitemId;
-    TIClip clip;
-    Title service;
+    private int playlistId;
+    private int playitemId;
+    private TIClip clip;
+    private Title service;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java b/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java
index 088c7c8..1300d25 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/PlayListImpl.java
@@ -31,26 +31,22 @@ import org.videolan.TIClip;
 import org.videolan.PlaylistInfo;
 
 public class PlayListImpl implements PlayList {
-    protected PlayListImpl(String filename, Title service)
-    {
+    protected PlayListImpl(String filename, Title service) {
         this.filename = filename;
         this.id = Integer.parseInt(filename);
         this.playlist = Libbluray.getPlaylistInfo(id);
         this.service = service;
     }
 
-    public String getFileName()
-    {
+    public String getFileName() {
         return filename;
     }
 
-    public int getId()
-    {
+    public int getId() {
         return id;
     }
 
-    public PlayItem[] getPlayItems()
-    {
+    public PlayItem[] getPlayItems() {
         TIClip[] clips = playlist.getClips();
         PlayItem[] items = new PlayItem[clips.length];
 
@@ -61,8 +57,7 @@ public class PlayListImpl implements PlayList {
         return items;
     }
 
-    public Locator getLocator()
-    {
+    public Locator getLocator() {
         int title = Libbluray.getCurrentTitle();
 
         try {
@@ -72,18 +67,16 @@ public class PlayListImpl implements PlayList {
         }
     }
 
-    public ServiceInformationType getServiceInformationType()
-    {
+    public ServiceInformationType getServiceInformationType() {
         return TitleInformationType.BD_ROM;
     }
 
-    public Date getUpdateTime()
-    {
+    public Date getUpdateTime() {
         return null;
     }
 
-    String filename;
-    PlaylistInfo playlist;
-    int id;
-    Title service;
+    private String filename;
+    private PlaylistInfo playlist;
+    private int id;
+    private Title service;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java b/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java
index 656a3cd..da2c2f7 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleComponentImpl.java
@@ -32,8 +32,7 @@ import org.videolan.StreamInfo;
 
 public class TitleComponentImpl implements TitleComponent {
     protected TitleComponentImpl(int stream_number, StreamInfo stream, StreamType type, boolean primary,
-                                 int playlistId, int playitemId, Title service)
-    {
+                                 int playlistId, int playitemId, Title service) {
         this.stream_number = stream_number;
         this.stream = stream;
         this.type = type;
@@ -112,11 +111,11 @@ public class TitleComponentImpl implements TitleComponent {
         return stream.getSubPathId();
     }
 
-    int stream_number;
-    StreamInfo stream;
-    StreamType type;
-    boolean primary;
-    int playlistId;
-    int playitemId;
-    Title service;
+    private int stream_number;
+    private StreamInfo stream;
+    private StreamType type;
+    private boolean primary;
+    private int playlistId;
+    private int playitemId;
+    private Title service;
 }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
index a63f2d1..e4f216e 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
@@ -52,6 +52,12 @@ public class TitleImpl implements Title {
     }
 
     public String getName() {
+        if (titleNum == 0)
+            return "Top Menu";
+        if (titleNum == 65535)
+            return "First Playback";
+        if (titleNum == 65534)
+            return "Suspended Title";
         return "Title " + titleNum;
     }
 
@@ -69,6 +75,15 @@ public class TitleImpl implements Title {
         return TitleType.UNKNOWN;
     }
 
+    public boolean equals(Object obj) {
+        if (!(obj instanceof TitleImpl)) {
+            return false;
+        }
+        TitleImpl other = (TitleImpl)obj;
+        int otherNum = other.getTitleNum();
+        return otherNum == titleNum;
+    }
+
     public boolean hasMultipleInstances() {
         return false;
     }
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleType.java b/src/libbluray/bdj/java/org/bluray/ti/TitleType.java
index 2d6dfd8..116ee16 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleType.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleType.java
@@ -22,8 +22,7 @@ package org.bluray.ti;
 import javax.tv.service.ServiceType;
 
 public class TitleType extends ServiceType {
-    protected TitleType(String name)
-    {
+    protected TitleType(String name) {
         super(name);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java b/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java
index 48d70be..507fe53 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java
@@ -103,7 +103,10 @@ public class TitleContextImpl implements TitleContext {
     public void select(Locator[] locators)
         throws InvalidLocatorException, InvalidServiceComponentException, SecurityException {
 
-        org.videolan.Logger.unimplemented("TitleContextImpl", "select(Locator[])");
+        Logger.unimplemented("TitleContextImpl", "select(Locator[])");
+
+        for (int i = 0; i < locators.length; i++)
+            logger.info("  [" + i + "]: " + locators[i]);
 
         select(SIManager.createInstance().getService(locators[0]));
     }
diff --git a/src/libbluray/bdj/java/org/bluray/ui/FrameAccurateAnimation.java b/src/libbluray/bdj/java/org/bluray/ui/FrameAccurateAnimation.java
index 1c3bfd5..aaab395 100644
--- a/src/libbluray/bdj/java/org/bluray/ui/FrameAccurateAnimation.java
+++ b/src/libbluray/bdj/java/org/bluray/ui/FrameAccurateAnimation.java
@@ -28,13 +28,11 @@ import org.videolan.Logger;
 
 public abstract class FrameAccurateAnimation extends Component {
 
-    public static final float getDefaultFrameRate()
-    {
+    public static final float getDefaultFrameRate() {
         return defaultRate;
     }
 
-    public static boolean setDefaultFrameRate(float framerate)
-    {
+    public static boolean setDefaultFrameRate(float framerate) {
         if (framerate != FRAME_RATE_23_976 &&
             framerate != FRAME_RATE_24 &&
             framerate != FRAME_RATE_25 &&
@@ -49,13 +47,11 @@ public abstract class FrameAccurateAnimation extends Component {
         return true;
     }
 
-    public FrameAccurateAnimation()
-    {
+    public FrameAccurateAnimation() {
         logger.unimplemented("FrameAccurateAnimation");
     }
 
-    public FrameAccurateAnimation(AnimationParameters params)
-    {
+    public FrameAccurateAnimation(AnimationParameters params) {
         context = BDJXletContext.getCurrentContext();
         if (context != null) {
             context.addFAA(this);
@@ -66,8 +62,7 @@ public abstract class FrameAccurateAnimation extends Component {
         this.params = new AnimationParameters(params);
     }
 
-    public synchronized void destroy()
-    {
+    public synchronized void destroy() {
         if (context != null) {
             context.removeFAA(this);
             context = null;
@@ -76,27 +71,23 @@ public abstract class FrameAccurateAnimation extends Component {
         destroyImpl();
     }
 
-    public long getCompletedFrameCount()
-    {
+    public long getCompletedFrameCount() {
         logger.unimplemented("getCompletedFrameCount");
         return 0;
     }
 
-    public float getFrameRate()
-    {
+    public float getFrameRate() {
         logger.unimplemented("getFrameRate");
         // TODO: rate of background video. if none, defaultRate.
         return getDefaultFrameRate();
     }
 
-    public Graphics getGraphics()
-    {
+    public Graphics getGraphics() {
         logger.unimplemented("getGraphics");
         return super.getGraphics();
     }
 
-    public int[] getRepeatCounts()
-    {
+    public int[] getRepeatCounts() {
         int[] repeatCount = null;
         if (params != null && params.repeatCount != null) {
             repeatCount = (int[])params.repeatCount.clone();
@@ -104,41 +95,34 @@ public abstract class FrameAccurateAnimation extends Component {
         return repeatCount;
     }
 
-    public int getThreadPriority()
-    {
+    public int getThreadPriority() {
         return params.threadPriority;
     }
 
-    public synchronized boolean isAnimated()
-    {
+    public synchronized boolean isAnimated() {
         return running;
     }
 
-    public void paint(Graphics g)
-    {
+    public void paint(Graphics g) {
         // should be implemented in derived classes
         logger.unimplemented("paint");
     }
 
     public synchronized void resetStartStopTime(
-            FrameAccurateAnimationTimer newTimer)
-    {
+            FrameAccurateAnimationTimer newTimer) {
         params.faaTimer = new FrameAccurateAnimationTimer(newTimer);
         logger.unimplemented("resetStartStopTime");
     }
 
-    public void setBounds(int x, int y, int width, int height)
-    {
+    public void setBounds(int x, int y, int width, int height) {
         super.setBounds(x, y, width, height);
     }
 
-    public void setLocation(int x, int y)
-    {
+    public void setLocation(int x, int y) {
         super.setLocation(x, y);
     }
 
-    public void setThreadPriority(int p)
-    {
+    public void setThreadPriority(int p) {
         params.threadPriority = p;
     }
 
@@ -157,8 +141,7 @@ public abstract class FrameAccurateAnimation extends Component {
         logger.unimplemented("destroyImpl");
     }
 
-    public synchronized void start()
-    {
+    public synchronized void start() {
         if (!running) {
             running = true;
             // TODO: compare timer against video
@@ -171,16 +154,14 @@ public abstract class FrameAccurateAnimation extends Component {
         }
     }
 
-    public synchronized void stop()
-    {
+    public synchronized void stop() {
         if (running) {
             running = false;
             stopImpl();
         }
     }
 
-    public String toString()
-    {
+    public String toString() {
         return "FrameAccurateAnimation";
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/ui/ImageFrameAccurateAnimation.java b/src/libbluray/bdj/java/org/bluray/ui/ImageFrameAccurateAnimation.java
index 834a57f..b713e95 100644
--- a/src/libbluray/bdj/java/org/bluray/ui/ImageFrameAccurateAnimation.java
+++ b/src/libbluray/bdj/java/org/bluray/ui/ImageFrameAccurateAnimation.java
@@ -39,8 +39,8 @@ public class ImageFrameAccurateAnimation extends FrameAccurateAnimation
     implements ImageObserver/*, java.awt.MenuContainer*/ {
     public static ImageFrameAccurateAnimation getInstance(Image[] images,
             Dimension size, AnimationParameters params, int playmode)
-            throws NullPointerException, IllegalArgumentException
-    {
+            throws NullPointerException, IllegalArgumentException {
+
         if (images == null || size == null || params == null)
             throw new NullPointerException();
         if (playmode < PLAY_REPEATING || playmode > PLAY_ONCE)
@@ -75,36 +75,31 @@ public class ImageFrameAccurateAnimation extends FrameAccurateAnimation
     }
 
     private ImageFrameAccurateAnimation(Image[] images,
-            Dimension size, AnimationParameters params, int playmode)
-    {
+            Dimension size, AnimationParameters params, int playmode) {
+
         super(params);
         this.images = ((Image[])images.clone());
         this.size = ((Dimension)size.clone());
         this.playmode = playmode;
     }
 
-    public AnimationParameters getAnimationParameters()
-    {
+    public AnimationParameters getAnimationParameters() {
         return new AnimationParameters(params);
     }
 
-    public Image[] getImages()
-    {
+    public Image[] getImages() {
         return (Image[])images.clone();
     }
 
-    public int getPlayMode()
-    {
+    public int getPlayMode() {
         return playmode;
     }
 
-    public int getPosition()
-    {
+    public int getPosition() {
         return position;
     }
 
-    public void prepareImages()
-    {
+    public void prepareImages() {
         if (prepared) {
             return;
         }
@@ -130,31 +125,27 @@ public class ImageFrameAccurateAnimation extends FrameAccurateAnimation
         prepared = true;
     }
 
-    public void setPlayMode(int mode) throws IllegalArgumentException
-    {
+    public void setPlayMode(int mode) throws IllegalArgumentException {
         if (mode < PLAY_REPEATING  || mode > PLAY_ONCE)
             throw new IllegalArgumentException();
         this.playmode = mode;
     }
 
-    public void setPosition(int position)
-    {
+    public void setPosition(int position) {
         if (position < 0 || position >= images.length)
             throw new IllegalArgumentException();
         this.position = position;
     }
 
 
-    protected void destroyImpl()
-    {
+    protected void destroyImpl() {
         stopImpl();
 
         images = null;
         scaledImages = null;
     }
 
-    protected void startImpl()
-    {
+    protected void startImpl() {
         if (!prepared) {
             prepareImages();
         }
@@ -164,16 +155,14 @@ public class ImageFrameAccurateAnimation extends FrameAccurateAnimation
         }
     }
 
-    protected void stopImpl()
-    {
+    protected void stopImpl() {
         if (animation != null) {
             animation.stop();
             animation = null;
         }
     }
 
-    public void paint(Graphics g)
-    {
+    public void paint(Graphics g) {
         if (images != null && images[position] != null) {
             if (!g.drawImage(images[position], super.getBounds().x, super.getBounds().y, this)) {
                 logger.warning("paint(" + position + ") failed");
@@ -254,7 +243,6 @@ public class ImageFrameAccurateAnimation extends FrameAccurateAnimation
         }
     }
 
-
     public static final int PLAY_REPEATING = 1;
     public static final int PLAY_ALTERNATING = 2;
     public static final int PLAY_ONCE = 3;
diff --git a/src/libbluray/bdj/java/org/bluray/ui/SyncFrameAccurateAnimation.java b/src/libbluray/bdj/java/org/bluray/ui/SyncFrameAccurateAnimation.java
index 6c75607..941c612 100644
--- a/src/libbluray/bdj/java/org/bluray/ui/SyncFrameAccurateAnimation.java
+++ b/src/libbluray/bdj/java/org/bluray/ui/SyncFrameAccurateAnimation.java
@@ -31,8 +31,8 @@ import org.videolan.Logger;
 public class SyncFrameAccurateAnimation extends FrameAccurateAnimation {
     public static SyncFrameAccurateAnimation getInstance(Dimension size,
             int numFrames, AnimationParameters params)
-            throws NullPointerException, IllegalArgumentException
-    {
+            throws NullPointerException, IllegalArgumentException {
+
         if (size == null || params == null)
             throw new NullPointerException();
         if (numFrames < 1)
@@ -58,47 +58,40 @@ public class SyncFrameAccurateAnimation extends FrameAccurateAnimation {
     }
 
     private SyncFrameAccurateAnimation(Dimension size,
-            int numFrames, AnimationParameters params)
-    {
+            int numFrames, AnimationParameters params) {
         super(params);
         logger.unimplemented("SyncFrameAccurateAnimation");
     }
 
     public boolean finishDrawing(long frameNumber)
-            throws IllegalArgumentException
-    {
+            throws IllegalArgumentException {
         logger.unimplemented("finishDrawing");
         return true;
     }
 
     public boolean finishDrawing(long frameNumber, Rectangle[] updateArea)
-            throws IllegalArgumentException
-    {
+            throws IllegalArgumentException {
         logger.unimplemented("finishDrawing");
         return true;
     }
 
     public Time getAnimationFrameTime(long animationFrame)
-            throws IllegalStateException
-    {
+            throws IllegalStateException {
         logger.unimplemented("getAnimationFrameTime");
         return new Time(40000000);
     }
 
-    public void paint(Graphics graphics)
-    {
+    public void paint(Graphics graphics) {
         logger.unimplemented("paint");
     }
 
-    public void setBounds(int x, int y, int width, int height)
-    {
+    public void setBounds(int x, int y, int width, int height) {
         logger.unimplemented("setBounds");
         super.setBounds(x, y, width, height);
     }
 
     public Graphics2D startDrawing(long frameNumber)
-            throws IllegalArgumentException
-    {
+            throws IllegalArgumentException {
         logger.unimplemented("startDrawing");
         return null;
     }
diff --git a/src/libbluray/bdj/java/org/bluray/ui/event/HRcEvent.java b/src/libbluray/bdj/java/org/bluray/ui/event/HRcEvent.java
index c98dbc7..ba2bd7d 100644
--- a/src/libbluray/bdj/java/org/bluray/ui/event/HRcEvent.java
+++ b/src/libbluray/bdj/java/org/bluray/ui/event/HRcEvent.java
@@ -23,8 +23,7 @@ import java.awt.Component;
 
 public abstract class HRcEvent extends org.havi.ui.event.HRcEvent {
     public HRcEvent(Component source, int id, long when, int modifiers,
-            int keyCode, char keyChar)
-    {
+            int keyCode, char keyChar) {
         super(source, id, when, modifiers, keyCode, keyChar);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/vfs/VFSManager.java b/src/libbluray/bdj/java/org/bluray/vfs/VFSManager.java
index 66ac4e8..a852f3d 100644
--- a/src/libbluray/bdj/java/org/bluray/vfs/VFSManager.java
+++ b/src/libbluray/bdj/java/org/bluray/vfs/VFSManager.java
@@ -27,58 +27,58 @@ import org.videolan.Logger;
 public class VFSManager {
 
     private static VFSManager instance = null;
+    private static final Object instanceLock = new Object();
 
     public static VFSManager getInstance() throws SecurityException,
-            UnsupportedOperationException
-    {
-        if (instance == null) {
-            instance = new VFSManager();
-        }
+            UnsupportedOperationException {
+
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null)
+            sm.checkPermission(new VFSPermission("*"));
 
-        return instance;
+        synchronized (instanceLock) {
+            if (instance == null) {
+                instance = new VFSManager();
+            }
+            return instance;
+        }
     }
 
-    protected VFSManager()
-    {
+    protected VFSManager() {
         state = STABLE;
     }
 
-    public boolean disableClip(String streamfile)
-    {
+    public boolean disableClip(String streamfile) {
         logger.unimplemented("disableClip");
         return true;
     }
 
-    public boolean enableClip(String streamfile)
-    {
+    public boolean enableClip(String streamfile) {
         logger.unimplemented("enableClip");
         return true;
     }
 
-    public String[] getDisabledClipIDs()
-    {
+    public String[] getDisabledClipIDs() {
         logger.unimplemented("getDisabledClipIDs");
         return new String[]{};
     }
 
-    public int getState()
-    {
+    public int getState() {
         return state;
     }
 
-    public boolean isEnabledClip(String clipID)
-    {
+    public boolean isEnabledClip(String clipID) {
         logger.unimplemented("isEnabledClip");
         return true;
     }
 
     public void requestUpdating(String manifestfile, String signaturefile,
-            boolean initBackupRegs) throws PreparingFailedException
-    {
+            boolean initBackupRegs) throws PreparingFailedException {
         state = PREPARING;
 
         BUMFAsset[] assets = BUMFParser.parse(manifestfile);
         if (assets == null) {
+            logger.error("manifest parsing failed");
             state = STABLE;
             throw new PreparingFailedException();
         }
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeEvent.java b/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeEvent.java
index 3a884b7..d39c291 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeEvent.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeEvent.java
@@ -22,8 +22,8 @@ package org.blurayx.s3d.media;
 import java.io.Serializable;
 import java.util.EventObject;
 
-public class AlignedSubtitleChangeEvent extends EventObject implements Serializable
-{
+public class AlignedSubtitleChangeEvent extends EventObject implements Serializable {
+
     private int subtitleAlignment;
 
     public AlignedSubtitleChangeEvent(AlignedSubtitleControl source, int subtitleAlignment) {
@@ -34,4 +34,4 @@ public class AlignedSubtitleChangeEvent extends EventObject implements Serializa
     public int getAlignedSubtitle() {
         return subtitleAlignment;
     }
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeListener.java b/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeListener.java
index bf623db..3b1fdd4 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeListener.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleChangeListener.java
@@ -21,7 +21,6 @@ package org.blurayx.s3d.media;
 
 import java.util.EventListener;
 
-public abstract interface AlignedSubtitleChangeListener extends EventListener
-{
+public abstract interface AlignedSubtitleChangeListener extends EventListener {
     public abstract void alignedSubtitleChange(AlignedSubtitleChangeEvent paramAlignedSubtitleChangeEvent);
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleControl.java b/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleControl.java
index cde06ec..27c925a 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleControl.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/media/AlignedSubtitleControl.java
@@ -21,8 +21,8 @@ package org.blurayx.s3d.media;
 
 import javax.media.Control;
 
-public abstract interface AlignedSubtitleControl extends Control
-{
+public abstract interface AlignedSubtitleControl extends Control {
+
     public abstract int getAlignedSubtitle();
 
     public abstract void setAlignedSubtitle(int paramInt)
@@ -35,4 +35,4 @@ public abstract interface AlignedSubtitleControl extends Control
     public static final int NOT_ALIGNED = 0;
     public static final int TOP_ALIGNED = 2;
     public static final int BOTTOM_ALIGNED = 3;
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeEvent.java b/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeEvent.java
index 6a992bd..2187b0e 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeEvent.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeEvent.java
@@ -22,8 +22,8 @@ package org.blurayx.s3d.media;
 import java.io.Serializable;
 import java.util.EventObject;
 
-public class GraphicsOffsetSequenceChangeEvent extends EventObject implements Serializable
-{
+public class GraphicsOffsetSequenceChangeEvent extends EventObject implements Serializable {
+
     private int sequenceId;
 
     public GraphicsOffsetSequenceChangeEvent(GraphicsOffsetSequenceControl source, int sequenceId) {
@@ -34,4 +34,4 @@ public class GraphicsOffsetSequenceChangeEvent extends EventObject implements Se
     public int getOffsetSequenceId() {
         return sequenceId;
     }
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeListener.java b/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeListener.java
index c3626d1..2bf6899 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeListener.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceChangeListener.java
@@ -21,7 +21,6 @@ package org.blurayx.s3d.media;
 
 import java.util.EventListener;
 
-public abstract interface GraphicsOffsetSequenceChangeListener extends EventListener
-{
+public abstract interface GraphicsOffsetSequenceChangeListener extends EventListener {
     public abstract void offsetSequenceChange(GraphicsOffsetSequenceChangeEvent paramGraphicsOffsetSequenceChangeEvent);
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceControl.java b/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceControl.java
index 886e34e..21083e1 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceControl.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/media/GraphicsOffsetSequenceControl.java
@@ -21,8 +21,8 @@ package org.blurayx.s3d.media;
 
 import javax.media.Control;
 
-public abstract interface GraphicsOffsetSequenceControl extends Control
-{
+public abstract interface GraphicsOffsetSequenceControl extends Control {
+
     public abstract int getSequenceId();
 
     public abstract void setSequenceId(int paramInt)
@@ -31,4 +31,4 @@ public abstract interface GraphicsOffsetSequenceControl extends Control
     public abstract void addOffsetSequenceChangeListener(GraphicsOffsetSequenceChangeListener paramGraphicsOffsetSequenceChangeListener);
 
     public abstract void removeOffsetSequenceChangeListener(GraphicsOffsetSequenceChangeListener paramGraphicsOffsetSequenceChangeListener);
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/system/StereoscopicRegisters.java b/src/libbluray/bdj/java/org/blurayx/s3d/system/StereoscopicRegisters.java
index d5b6b3b..0209666 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/system/StereoscopicRegisters.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/system/StereoscopicRegisters.java
@@ -19,10 +19,9 @@
 
 package org.blurayx.s3d.system;
 
-public abstract interface StereoscopicRegisters
-{
+public abstract interface StereoscopicRegisters {
     public static final int PSR_OUTPUT_MODE_PREFERENCE = 21;
     public static final int PSR_STEREOSCOPIC_STATUS = 22;
     public static final int PSR_DISPLAY_CAPABILITY = 23;
     public static final int PSR_3D_CAPABILITY = 24;
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ti/StereoscopicCodingType.java b/src/libbluray/bdj/java/org/blurayx/s3d/ti/StereoscopicCodingType.java
index d1c35b8..adabd1d 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ti/StereoscopicCodingType.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ti/StereoscopicCodingType.java
@@ -24,8 +24,8 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import org.bluray.ti.CodingType;
 
-public class StereoscopicCodingType
-{
+public class StereoscopicCodingType {
+
     public static final CodingType MPEG4_MVC_VIDEO =
         (CodingType)AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/DirectDrawS3D.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/DirectDrawS3D.java
index 4154674..220e77d 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/DirectDrawS3D.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/DirectDrawS3D.java
@@ -22,24 +22,21 @@ package org.blurayx.s3d.ui;
 import java.awt.Image;
 import java.awt.Rectangle;
 
-public class DirectDrawS3D
-{
+public class DirectDrawS3D {
+
     public void drawStereoscopic(Image leftImage, int leftX, int leftY,
                                  Rectangle[] leftUpdateAreas,
                                  Image rightImage, int rightX, int rightY,
-                                 Rectangle[] rightUpdateAreas)
-    {
+                                 Rectangle[] rightUpdateAreas) {
     }
 
     public void drawStereoscopicImages(Image[] leftImages, int[] leftXs, int[] leftYs,
                                        Rectangle[] leftUpdateAreas,
                                        Image[] rightImages, int[] rightXs, int[] rightYs,
-                                       Rectangle[] rightUpdateAreas)
-    {
+                                       Rectangle[] rightUpdateAreas) {
     }
 
-    public static DirectDrawS3D getInstance()
-    {
+    public static DirectDrawS3D getInstance() {
         org.videolan.Logger.unimplemented("DirectDrawS3D", "getInstance");
         return null;
     }
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigTemplateS3D.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigTemplateS3D.java
index c4b28f7..29b5652 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigTemplateS3D.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigTemplateS3D.java
@@ -22,8 +22,8 @@ package org.blurayx.s3d.ui;
 import org.havi.ui.HBackgroundConfigTemplate;
 import org.havi.ui.HBackgroundConfiguration;
 
-public class HBackgroundConfigTemplateS3D extends HBackgroundConfigTemplate
-{
+public class HBackgroundConfigTemplateS3D extends HBackgroundConfigTemplate {
+
     public static final int S3D = 17;
 
     protected int getPreferenceCount() {
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigurationS3D.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigurationS3D.java
index 2928230..0248304 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigurationS3D.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HBackgroundConfigurationS3D.java
@@ -26,12 +26,12 @@ import org.havi.ui.HPermissionDeniedException;
 import org.havi.ui.HScreenRectangle;
 import org.havi.ui.HStillImageBackgroundConfiguration;
 
-public class HBackgroundConfigurationS3D extends HStillImageBackgroundConfiguration
-{
+public class HBackgroundConfigurationS3D extends HStillImageBackgroundConfiguration {
+
     public void displayImage(HBackgroundImage leftImage,
                              HBackgroundImage rightImage)
-        throws IOException, HPermissionDeniedException, HConfigurationException
-    {
+        throws IOException, HPermissionDeniedException, HConfigurationException {
+
         displayImage(leftImage, rightImage,
                      new HScreenRectangle(0.0f, 0.0f, 1.0f, 1.0f),
                      new HScreenRectangle(0.0f, 0.0f, 1.0f, 1.0f));
@@ -40,9 +40,9 @@ public class HBackgroundConfigurationS3D extends HStillImageBackgroundConfigurat
     public void displayImage(HBackgroundImage leftImage,
                              HBackgroundImage rightImage,
                              HScreenRectangle leftUpdateArea,
-                             HScreenRectangle rightUpdateAreaparamHScreenRectangle2)
-        throws IOException, HPermissionDeniedException, HConfigurationException
-    {
+                             HScreenRectangle rightUpdateArea)
+        throws IOException, HPermissionDeniedException, HConfigurationException {
+
         displayImage(leftImage, leftUpdateArea);
         org.videolan.Logger.unimplemented("HBackgroundConfigurationS3D", "displayImage");
     }
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigTemplateS3D.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigTemplateS3D.java
index 20a47f6..c397638 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigTemplateS3D.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigTemplateS3D.java
@@ -21,8 +21,8 @@ package org.blurayx.s3d.ui;
 
 import org.havi.ui.HGraphicsConfigTemplate;
 
-public class HGraphicsConfigTemplateS3D extends HGraphicsConfigTemplate
-{
+public class HGraphicsConfigTemplateS3D extends HGraphicsConfigTemplate {
+
     public static final int S3D = 17;
 
     protected int getPreferenceCount() {
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigurationS3D.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigurationS3D.java
index f497991..5a20003 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigurationS3D.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HGraphicsConfigurationS3D.java
@@ -23,16 +23,15 @@ import org.havi.ui.HConfigurationException;
 import org.havi.ui.HGraphicsConfiguration;
 import org.havi.ui.HPermissionDeniedException;
 
-public class HGraphicsConfigurationS3D extends HGraphicsConfiguration
-{
-    public int getOffsetValue()
-    {
+public class HGraphicsConfigurationS3D extends HGraphicsConfiguration {
+
+    public int getOffsetValue() {
         return 0;
     }
 
     public void setOffsetValue(int offset)
-        throws HPermissionDeniedException, HConfigurationException
-    {
+        throws HPermissionDeniedException, HConfigurationException {
+
         org.videolan.Logger.unimplemented("HGraphicsConfigurationS3D", "setOffsetValue");
     }
 }
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HVideoConfigTemplateS3D.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HVideoConfigTemplateS3D.java
index 30c314d..71e271d 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/HVideoConfigTemplateS3D.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/HVideoConfigTemplateS3D.java
@@ -21,8 +21,8 @@ package org.blurayx.s3d.ui;
 
 import org.bluray.ui.BDVideoConfigTemplate;
 
-public class HVideoConfigTemplateS3D extends BDVideoConfigTemplate
-{
+public class HVideoConfigTemplateS3D extends BDVideoConfigTemplate {
+
     public static final int S3D = 17;
 
     protected int getPreferenceCount() {
diff --git a/src/libbluray/bdj/java/org/blurayx/s3d/ui/S3DProperty.java b/src/libbluray/bdj/java/org/blurayx/s3d/ui/S3DProperty.java
index b613e93..738ebf9 100644
--- a/src/libbluray/bdj/java/org/blurayx/s3d/ui/S3DProperty.java
+++ b/src/libbluray/bdj/java/org/blurayx/s3d/ui/S3DProperty.java
@@ -19,15 +19,15 @@
 
 package org.blurayx.s3d.ui;
 
-public class S3DProperty
-{
+public class S3DProperty {
+
     public static final S3DProperty ONE_PLANE = new S3DProperty("ONE_PLANE");
     public static final S3DProperty TWO_PLANES = new S3DProperty("TWO_PLANES");
     public static final S3DProperty TWOD_OUTPUT = new S3DProperty("TWOD_OUTPUT");
 
-    private String value;
-    protected S3DProperty(String value)
-    {
-        this.value = value;
+    private String name;
+
+    protected S3DProperty(String name) {
+        this.name = name;
     }
 }
diff --git a/src/libbluray/bdj/java/org/davic/media/AudioLanguageControl.java b/src/libbluray/bdj/java/org/davic/media/AudioLanguageControl.java
index abceff3..1096bb9 100644
--- a/src/libbluray/bdj/java/org/davic/media/AudioLanguageControl.java
+++ b/src/libbluray/bdj/java/org/davic/media/AudioLanguageControl.java
@@ -20,5 +20,4 @@
 package org.davic.media;
 
 public interface AudioLanguageControl extends LanguageControl {
-
 }
diff --git a/src/libbluray/bdj/java/org/davic/media/LanguageNotAvailableException.java b/src/libbluray/bdj/java/org/davic/media/LanguageNotAvailableException.java
index ff5dafb..04be90e 100644
--- a/src/libbluray/bdj/java/org/davic/media/LanguageNotAvailableException.java
+++ b/src/libbluray/bdj/java/org/davic/media/LanguageNotAvailableException.java
@@ -20,13 +20,11 @@
 package org.davic.media;
 
 public class LanguageNotAvailableException extends javax.media.MediaException {
-    public LanguageNotAvailableException()
-    {
+    public LanguageNotAvailableException() {
         super();
     }
 
-    public LanguageNotAvailableException(String reason)
-    {
+    public LanguageNotAvailableException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/davic/media/MediaFreezeException.java b/src/libbluray/bdj/java/org/davic/media/MediaFreezeException.java
index a41474d..200b247 100644
--- a/src/libbluray/bdj/java/org/davic/media/MediaFreezeException.java
+++ b/src/libbluray/bdj/java/org/davic/media/MediaFreezeException.java
@@ -20,13 +20,11 @@
 package org.davic.media;
 
 public class MediaFreezeException extends javax.media.MediaException {
-    public MediaFreezeException()
-    {
+    public MediaFreezeException() {
         super();
     }
 
-    public MediaFreezeException(String reason)
-    {
+    public MediaFreezeException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/davic/media/MediaPresentedEvent.java b/src/libbluray/bdj/java/org/davic/media/MediaPresentedEvent.java
index 6bd0e4e..ce489a3 100644
--- a/src/libbluray/bdj/java/org/davic/media/MediaPresentedEvent.java
+++ b/src/libbluray/bdj/java/org/davic/media/MediaPresentedEvent.java
@@ -23,8 +23,7 @@ import javax.media.ControllerEvent;
 import javax.media.Controller;
 
 public class MediaPresentedEvent extends ControllerEvent {
-    public MediaPresentedEvent(Controller source)
-    {
+    public MediaPresentedEvent(Controller source) {
         super(source);
     }
 
diff --git a/src/libbluray/bdj/java/org/davic/media/MediaTimeEvent.java b/src/libbluray/bdj/java/org/davic/media/MediaTimeEvent.java
index ca906c6..9f39a41 100644
--- a/src/libbluray/bdj/java/org/davic/media/MediaTimeEvent.java
+++ b/src/libbluray/bdj/java/org/davic/media/MediaTimeEvent.java
@@ -19,9 +19,9 @@
 
 package org.davic.media;
 
-public class MediaTimeEvent {
-    public MediaTimeEvent(Object source, long eventTime, int ID)
-    {
+public class MediaTimeEvent extends java.util.EventObject {
+    public MediaTimeEvent(Object source, long eventTime, int ID) {
+        super(source);
         this.source = source;
         this.eventTime = eventTime;
         this.eventId = ID;
@@ -38,8 +38,8 @@ public class MediaTimeEvent {
     public Object getSource() {
         return source;
     }
-    
-    private Object source;
-    private long eventTime;
-    private int eventId;
+
+    private final Object source;
+    private final long eventTime;
+    private final int eventId;
 }
diff --git a/src/libbluray/bdj/java/org/davic/media/MediaTimePositionChangedEvent.java b/src/libbluray/bdj/java/org/davic/media/MediaTimePositionChangedEvent.java
index 20cb099..dfa3bd0 100644
--- a/src/libbluray/bdj/java/org/davic/media/MediaTimePositionChangedEvent.java
+++ b/src/libbluray/bdj/java/org/davic/media/MediaTimePositionChangedEvent.java
@@ -19,16 +19,12 @@
 package org.davic.media;
 
 public class MediaTimePositionChangedEvent extends javax.media.RestartingEvent {
-    public MediaTimePositionChangedEvent(javax.media.Controller source)
-    {
-
+    public MediaTimePositionChangedEvent(javax.media.Controller source) {
         super(source, 0, 0, 0, null);
-
     }
 
     public MediaTimePositionChangedEvent(javax.media.Controller from,
-            int previous, int current, int target, javax.media.Time mediaTime)
-    {
+            int previous, int current, int target, javax.media.Time mediaTime) {
         super(from, previous, current, target, mediaTime);
     }
 
diff --git a/src/libbluray/bdj/java/org/davic/media/NotAuthorizedException.java b/src/libbluray/bdj/java/org/davic/media/NotAuthorizedException.java
index 8d70687..7e0302a 100644
--- a/src/libbluray/bdj/java/org/davic/media/NotAuthorizedException.java
+++ b/src/libbluray/bdj/java/org/davic/media/NotAuthorizedException.java
@@ -22,13 +22,11 @@ package org.davic.media;
 import java.io.IOException;
 
 public class NotAuthorizedException extends IOException {
-    public NotAuthorizedException()
-    {
+    public NotAuthorizedException() {
         super();
     }
 
-    public NotAuthorizedException(String reason)
-    {
+    public NotAuthorizedException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/davic/media/ResourceReturnedEvent.java b/src/libbluray/bdj/java/org/davic/media/ResourceReturnedEvent.java
index ee53521..3712f43 100644
--- a/src/libbluray/bdj/java/org/davic/media/ResourceReturnedEvent.java
+++ b/src/libbluray/bdj/java/org/davic/media/ResourceReturnedEvent.java
@@ -20,11 +20,10 @@
 package org.davic.media;
 
 public class ResourceReturnedEvent extends javax.media.ControllerEvent {
-    public ResourceReturnedEvent(javax.media.Controller controller)
-	{
-		super(controller);
-	}
-    
+    public ResourceReturnedEvent(javax.media.Controller controller) {
+        super(controller);
+    }
+
     private static final long serialVersionUID = 833405652804231956L;
 }
 
diff --git a/src/libbluray/bdj/java/org/davic/media/ResourceWithdrawnEvent.java b/src/libbluray/bdj/java/org/davic/media/ResourceWithdrawnEvent.java
index 20db564..67e582b 100644
--- a/src/libbluray/bdj/java/org/davic/media/ResourceWithdrawnEvent.java
+++ b/src/libbluray/bdj/java/org/davic/media/ResourceWithdrawnEvent.java
@@ -20,10 +20,9 @@
 package org.davic.media;
 
 public class ResourceWithdrawnEvent extends javax.media.ControllerEvent {
-    public ResourceWithdrawnEvent(javax.media.Controller controller)
-    {
+    public ResourceWithdrawnEvent(javax.media.Controller controller) {
         super(controller);
     }
-    
+
     private static final long serialVersionUID = -7166847584806713058L;
 }
diff --git a/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedException.java b/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedException.java
index 6d10614..72bd0eb 100644
--- a/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedException.java
+++ b/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedException.java
@@ -20,25 +20,21 @@
 package org.davic.mpeg;
 
 public class NotAuthorizedException extends Exception implements NotAuthorizedInterface {
-    public NotAuthorizedException()
-    {
+    public NotAuthorizedException() {
         super();
     }
 
-    public NotAuthorizedException(String reason)
-    {
+    public NotAuthorizedException(String reason) {
         super(reason);
     }
 
-    public int[] getReason(int index) throws IndexOutOfBoundsException
-    {
+    public int[] getReason(int index) throws IndexOutOfBoundsException {
         return null;
     }
-    
-    public int getType()
-    {
+
+    public int getType() {
         return 0;
     }
-    
+
     private static final long serialVersionUID = 1567106534419982722L;
 }
diff --git a/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedInterface.java b/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedInterface.java
index c9d7402..b60346d 100644
--- a/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedInterface.java
+++ b/src/libbluray/bdj/java/org/davic/mpeg/NotAuthorizedInterface.java
@@ -21,9 +21,9 @@ package org.davic.mpeg;
 
 public interface NotAuthorizedInterface {
     public int getType();
-    
+
     //public Service getService();
-    
+
     //public ElementaryStream[] getElementaryStreams();
 
     public int[] getReason(int index)
diff --git a/src/libbluray/bdj/java/org/davic/net/InvalidLocatorException.java b/src/libbluray/bdj/java/org/davic/net/InvalidLocatorException.java
index f9e6a7d..6c5f537 100644
--- a/src/libbluray/bdj/java/org/davic/net/InvalidLocatorException.java
+++ b/src/libbluray/bdj/java/org/davic/net/InvalidLocatorException.java
@@ -19,13 +19,11 @@
 package org.davic.net;
 
 public class InvalidLocatorException extends Exception {
-    public InvalidLocatorException()
-    {
+    public InvalidLocatorException() {
         super();
     }
 
-    public InvalidLocatorException(String reason)
-    {
+    public InvalidLocatorException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/davic/net/Locator.java b/src/libbluray/bdj/java/org/davic/net/Locator.java
index 2d8dce7..cdc7d6b 100644
--- a/src/libbluray/bdj/java/org/davic/net/Locator.java
+++ b/src/libbluray/bdj/java/org/davic/net/Locator.java
@@ -35,5 +35,13 @@ public class Locator implements javax.tv.locator.Locator {
         return url;
     }
 
+    public boolean equals(Object obj) {
+        if (obj == null || !(obj instanceof Locator) || url == null)
+            return false;
+
+        Locator locator = (Locator)obj;
+        return toExternalForm().equals(locator.toExternalForm());
+    }
+
     protected String url;
 }
diff --git a/src/libbluray/bdj/java/org/davic/net/TransportDependentLocator.java b/src/libbluray/bdj/java/org/davic/net/TransportDependentLocator.java
index 610933a..4bc9290 100644
--- a/src/libbluray/bdj/java/org/davic/net/TransportDependentLocator.java
+++ b/src/libbluray/bdj/java/org/davic/net/TransportDependentLocator.java
@@ -20,5 +20,4 @@
 package org.davic.net;
 
 public interface TransportDependentLocator {
-
 }
diff --git a/src/libbluray/bdj/java/org/davic/resources/ResourceStatusEvent.java b/src/libbluray/bdj/java/org/davic/resources/ResourceStatusEvent.java
index 5467596..bf94622 100644
--- a/src/libbluray/bdj/java/org/davic/resources/ResourceStatusEvent.java
+++ b/src/libbluray/bdj/java/org/davic/resources/ResourceStatusEvent.java
@@ -20,18 +20,9 @@
 package org.davic.resources;
 
 public class ResourceStatusEvent extends java.util.EventObject {
-    public ResourceStatusEvent(Object source)
-    {
+    public ResourceStatusEvent(Object source) {
         super(source);
-
-        this.source = source;
-    }
-
-    public Object getSource()
-    {
-        return source;
     }
 
-    private Object source;
     private static final long serialVersionUID = 2431644213385584745L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/application/AppAttributes.java b/src/libbluray/bdj/java/org/dvb/application/AppAttributes.java
index 72ea305..365ee98 100644
--- a/src/libbluray/bdj/java/org/dvb/application/AppAttributes.java
+++ b/src/libbluray/bdj/java/org/dvb/application/AppAttributes.java
@@ -23,7 +23,6 @@ import org.davic.net.Locator;
 
 public abstract interface AppAttributes {
 
-
     public abstract AppIcon getAppIcon();
 
     public abstract AppID getIdentifier();
@@ -33,7 +32,7 @@ public abstract interface AppAttributes {
     public abstract String getName();
 
     public abstract String getName(String language)
-      throws LanguageNotAvailableException;
+        throws LanguageNotAvailableException;
 
     public abstract String[][] getNames();
 
@@ -48,12 +47,12 @@ public abstract interface AppAttributes {
     public abstract int getType();
 
     public abstract int[] getVersions(String profile)
-      throws IllegalProfileParameterException;
+        throws IllegalProfileParameterException;
 
     public abstract boolean isStartable();
 
     public abstract boolean isVisible();
-    
+
     public static final int DVB_HTML_application = 2;
     public static final int DVB_J_application = 1;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/application/AppID.java b/src/libbluray/bdj/java/org/dvb/application/AppID.java
index 366f95e..df6eeda 100644
--- a/src/libbluray/bdj/java/org/dvb/application/AppID.java
+++ b/src/libbluray/bdj/java/org/dvb/application/AppID.java
@@ -22,29 +22,24 @@ package org.dvb.application;
 import java.io.Serializable;
 
 public class AppID implements Serializable {
-    public AppID(int oid, int aid)
-    {
+    public AppID(int oid, int aid) {
         this.oid = oid;
         this.aid = aid;
     }
-    
-    public int getOID()
-    {
+
+    public int getOID() {
         return oid;
     }
-    
-    public int getAID()
-    {
+
+    public int getAID() {
         return aid;
     }
-    
-    public String toString()
-    {
+
+    public String toString() {
         return Long.toString(((long)oid << 16) + aid, 16);
     }
 
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + aid;
@@ -52,13 +47,8 @@ public class AppID implements Serializable {
         return result;
     }
 
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
+    public boolean equals(Object obj) {
+        if (!(obj instanceof AppID))
             return false;
         AppID other = (AppID) obj;
         if (aid != other.aid)
@@ -68,8 +58,6 @@ public class AppID implements Serializable {
         return true;
     }
 
-    int oid;
-    int aid;
-
-    private static final long serialVersionUID = 1;
+    private int oid;
+    private int aid;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/application/AppProxy.java b/src/libbluray/bdj/java/org/dvb/application/AppProxy.java
index 85993f3..df98a0d 100644
--- a/src/libbluray/bdj/java/org/dvb/application/AppProxy.java
+++ b/src/libbluray/bdj/java/org/dvb/application/AppProxy.java
@@ -43,5 +43,4 @@ public interface AppProxy {
 
     public void removeAppStateChangeEventListener(
             AppStateChangeEventListener listener);
-
 }
diff --git a/src/libbluray/bdj/java/org/dvb/application/AppStateChangeEvent.java b/src/libbluray/bdj/java/org/dvb/application/AppStateChangeEvent.java
index 9c6237f..1e601bb 100644
--- a/src/libbluray/bdj/java/org/dvb/application/AppStateChangeEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/application/AppStateChangeEvent.java
@@ -23,8 +23,7 @@ import java.util.EventObject;
 
 public class AppStateChangeEvent extends EventObject {
     public AppStateChangeEvent(AppID appid, int fromstate, int tostate,
-            Object source, boolean hasFailed)
-    {
+            Object source, boolean hasFailed) {
         super(source);
 
         this.appid = appid;
@@ -33,29 +32,29 @@ public class AppStateChangeEvent extends EventObject {
         this.hasFailed = hasFailed;
     }
 
-    public AppID getAppID()
-    {
+    public AppID getAppID() {
         return appid;
     }
 
-    public int getFromState()
-    {
+    public int getFromState() {
         return fromstate;
     }
 
-    public int getToState()
-    {
+    public int getToState() {
         return tostate;
     }
 
-    public boolean hasFailed()
-    {
+    public boolean hasFailed() {
         return hasFailed;
     }
 
-    private AppID appid;
-    private int fromstate;
-    private int tostate;
-    private boolean hasFailed;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",appid=" + appid + ",fromstate=" + fromstate + ",tostate=" + tostate + ",hasFailed=" + hasFailed + "]";
+    }
+
+    private final AppID appid;
+    private final int fromstate;
+    private final int tostate;
+    private final boolean hasFailed;
     private static final long serialVersionUID = -5634352176873439145L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/application/AppsControlPermission.java b/src/libbluray/bdj/java/org/dvb/application/AppsControlPermission.java
index 92d9c0c..ab520f9 100644
--- a/src/libbluray/bdj/java/org/dvb/application/AppsControlPermission.java
+++ b/src/libbluray/bdj/java/org/dvb/application/AppsControlPermission.java
@@ -23,35 +23,29 @@ import java.security.BasicPermission;
 import java.security.Permission;
 
 public final class AppsControlPermission extends BasicPermission {
-    public AppsControlPermission()
-    {
-        super("toto");
+    public AppsControlPermission() {
+        super("*");
     }
 
-    public AppsControlPermission(String name, String actions)
-    {
-        super(name);
+    public AppsControlPermission(String name, String actions) {
+        super("*");
     }
 
-    public String getActions()
-    {
+    public String getActions() {
         // actions should be always null
         return null;
     }
 
-    public boolean implies(Permission perm)
-    {
+    public boolean implies(Permission perm) {
         return perm instanceof AppsControlPermission;
     }
 
-    public boolean equals(Object obj)
-    {
+    public boolean equals(Object obj) {
         return obj instanceof AppsControlPermission;
     }
 
-    public int hashCode()
-    {
-        return getClass().hashCode();
+    public int hashCode() {
+        return 0;
     }
 
     private static final long serialVersionUID = 4003360685455291075L;
diff --git a/src/libbluray/bdj/java/org/dvb/application/AppsDatabaseEvent.java b/src/libbluray/bdj/java/org/dvb/application/AppsDatabaseEvent.java
index c00282d..beb39f8 100644
--- a/src/libbluray/bdj/java/org/dvb/application/AppsDatabaseEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/application/AppsDatabaseEvent.java
@@ -22,24 +22,25 @@ package org.dvb.application;
 import java.util.EventObject;
 
 public class AppsDatabaseEvent extends EventObject {
-    public AppsDatabaseEvent(int id, AppID appid, Object source)
-    {
+    public AppsDatabaseEvent(int id, AppID appid, Object source) {
         super(source);
 
         this.appid = appid;
         this.id = id;
     }
 
-    public AppID getAppID()
-    {
+    public AppID getAppID() {
         return appid;
     }
 
-    public int getEventId()
-    {
+    public int getEventId() {
         return id;
     }
 
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",id=" + id + ",appid" + appid + "]";
+    }
+
     static public final int NEW_DATABASE = 0;
     static public final int APP_CHANGED = 1;
     static public final int APP_ADDED = 2;
diff --git a/src/libbluray/bdj/java/org/dvb/application/CurrentServiceFilter.java b/src/libbluray/bdj/java/org/dvb/application/CurrentServiceFilter.java
index ea4b6ab..c6393f6 100644
--- a/src/libbluray/bdj/java/org/dvb/application/CurrentServiceFilter.java
+++ b/src/libbluray/bdj/java/org/dvb/application/CurrentServiceFilter.java
@@ -20,11 +20,14 @@
 package org.dvb.application;
 
 public class CurrentServiceFilter extends AppsDatabaseFilter {
+
+    private final AppsDatabase db = AppsDatabase.getAppsDatabase();
+
     public CurrentServiceFilter() {
         super();
     }
 
     public boolean accept(AppID appid) {
-        return true;
+        return db.getAppProxy(appid) != null;
     }
 }
diff --git a/src/libbluray/bdj/java/org/dvb/application/IllegalProfileParameterException.java b/src/libbluray/bdj/java/org/dvb/application/IllegalProfileParameterException.java
index 27b7454..264336b 100644
--- a/src/libbluray/bdj/java/org/dvb/application/IllegalProfileParameterException.java
+++ b/src/libbluray/bdj/java/org/dvb/application/IllegalProfileParameterException.java
@@ -20,13 +20,11 @@
 package org.dvb.application;
 
 public class IllegalProfileParameterException extends Exception {
-    public IllegalProfileParameterException()
-    {
+    public IllegalProfileParameterException() {
         super();
     }
 
-    public IllegalProfileParameterException(String reason)
-    {
+    public IllegalProfileParameterException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/application/LanguageNotAvailableException.java b/src/libbluray/bdj/java/org/dvb/application/LanguageNotAvailableException.java
index 2353bb2..c2aca35 100644
--- a/src/libbluray/bdj/java/org/dvb/application/LanguageNotAvailableException.java
+++ b/src/libbluray/bdj/java/org/dvb/application/LanguageNotAvailableException.java
@@ -20,13 +20,11 @@
 package org.dvb.application;
 
 public class LanguageNotAvailableException extends Exception {
-    public LanguageNotAvailableException()
-    {
+    public LanguageNotAvailableException() {
         super();
     }
 
-    public LanguageNotAvailableException(String reason)
-    {
+    public LanguageNotAvailableException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/application/RunningApplicationsFilter.java b/src/libbluray/bdj/java/org/dvb/application/RunningApplicationsFilter.java
index 764119c..2340f06 100644
--- a/src/libbluray/bdj/java/org/dvb/application/RunningApplicationsFilter.java
+++ b/src/libbluray/bdj/java/org/dvb/application/RunningApplicationsFilter.java
@@ -26,9 +26,9 @@ public class RunningApplicationsFilter extends AppsDatabaseFilter {
     }
 
     public boolean accept(AppID appid) {
-    	AppProxy proxy = AppsDatabase.getAppsDatabase().getAppProxy(appid);
-    	if (proxy == null)
-    	    return false;
+        AppProxy proxy = AppsDatabase.getAppsDatabase().getAppProxy(appid);
+        if (proxy == null)
+            return false;
         return proxy.getState() == AppProxy.STARTED;
     }
 }
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/AsynchronousLoadingEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/AsynchronousLoadingEvent.java
index 5b091ba..305f25d 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/AsynchronousLoadingEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/AsynchronousLoadingEvent.java
@@ -22,13 +22,11 @@ package org.dvb.dsmcc;
 import java.util.EventObject;
 
 public abstract class AsynchronousLoadingEvent extends EventObject {
-    public AsynchronousLoadingEvent(DSMCCObject source)
-    {
+    public AsynchronousLoadingEvent(DSMCCObject source) {
         super(source);
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return super.getSource();
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCException.java
index c8526a7..7c1d8e8 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCException.java
@@ -22,13 +22,11 @@ package org.dvb.dsmcc;
 import java.io.IOException;
 
 public class DSMCCException extends IOException {
-    public DSMCCException()
-    {
+    public DSMCCException() {
         super();
     }
 
-    public DSMCCException(String reason)
-    {
+    public DSMCCException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCObject.java b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCObject.java
index 1bc462d..c5ab861 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCObject.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCObject.java
@@ -28,41 +28,34 @@ import java.security.cert.X509Certificate;
 import org.videolan.Logger;
 
 public class DSMCCObject extends File {
-    public DSMCCObject(String path)
-    {
+    public DSMCCObject(String path) {
         super(path);
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "");
     }
 
-    public DSMCCObject(String path, String name)
-    {
+    public DSMCCObject(String path, String name) {
         super(path, name);
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "");
     }
 
-    public DSMCCObject(DSMCCObject dir, String name)
-    {
+    public DSMCCObject(DSMCCObject dir, String name) {
         super(dir.getPath(), name);
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "");
     }
 
-    public boolean isLoaded()
-    {
+    public boolean isLoaded() {
         return loaded;
     }
 
-    public boolean isStream()
-    {
+    public boolean isStream() {
         return stream;
     }
 
-    public boolean isStreamEvent()
-    {
+    public boolean isStreamEvent() {
         return streamEvent;
     }
 
-    public boolean isObjectKindKnown()
-    {
+    public boolean isObjectKindKnown() {
         return true;
     }
 
@@ -70,20 +63,19 @@ public class DSMCCObject extends File {
             InterruptedIOException, MPEGDeliveryException,
             ServerDeliveryException, InvalidPathNameException,
             NotEntitledException, ServiceXFRException,
-            InsufficientResourcesException
-    {
+            InsufficientResourcesException {
+
         if (!super.exists())
             throw new InvalidPathNameException();
-        
+
         this.loaded = true;
     }
 
     public void asynchronousLoad(AsynchronousLoadingEventListener listener)
-            throws InvalidPathNameException
-    {
+            throws InvalidPathNameException {
         try {
             synchronousLoad();
-            
+
             listener.receiveEvent(new SuccessEvent(this));
         } catch (DSMCCException e) {
             // never really thrown so don't care
@@ -92,33 +84,28 @@ public class DSMCCObject extends File {
         }
     }
 
-    public void abort() throws NothingToAbortException
-    {
+    public void abort() throws NothingToAbortException {
         throw new NothingToAbortException();
     }
 
-    public static boolean prefetch(String path, byte priority)
-    {
+    public static boolean prefetch(String path, byte priority) {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "prefetch");
         return false;
     }
 
-    public static boolean prefetch(DSMCCObject dir, String path, byte priority)
-    {
+    public static boolean prefetch(DSMCCObject dir, String path, byte priority) {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "prefetch");
         return false;
     }
 
-    public void unload() throws NotLoadedException
-    {
+    public void unload() throws NotLoadedException {
         if (loaded)
             throw new NotLoadedException();
 
         loaded = false;
     }
 
-    public URL getURL()
-    {
+    public URL getURL() {
         String url = "file://" + super.getAbsolutePath();
         try {
             return new URL(url);
@@ -130,36 +117,31 @@ public class DSMCCObject extends File {
     }
 
     public void addObjectChangeEventListener(ObjectChangeEventListener listener)
-            throws InsufficientResourcesException
-    {
+            throws InsufficientResourcesException {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "addObjectChangeEventListener");
         throw new Error("Not implemented"); // NOTE: probably unnecessary
     }
 
     public void removeObjectChangeEventListener(
-            ObjectChangeEventListener listener)
-    {
+            ObjectChangeEventListener listener) {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "removeObjectChangeEventListener");
         throw new Error("Not implemented"); // NOTE: probably unnecessary
     }
 
     public void loadDirectoryEntry(AsynchronousLoadingEventListener listener)
-            throws InvalidPathNameException
-    {
+            throws InvalidPathNameException {
         if (!super.exists())
             throw new InvalidPathNameException();
 
         listener.receiveEvent(new SuccessEvent(this));
     }
 
-    public void setRetrievalMode(int retrieval_mode)
-    {
+    public void setRetrievalMode(int retrieval_mode) {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "setRetrievalMode");
         throw new Error("Not implemented");
     }
 
-    public X509Certificate[][] getSigners()
-    {
+    public X509Certificate[][] getSigners() {
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "getSigners");
         throw new Error("Not implemented");
     }
@@ -168,8 +150,8 @@ public class DSMCCObject extends File {
             throws InvalidFormatException, InterruptedIOException,
             MPEGDeliveryException, ServerDeliveryException,
             InvalidPathNameException, NotEntitledException,
-            ServiceXFRException, InsufficientResourcesException
-    {
+            ServiceXFRException, InsufficientResourcesException {
+
         org.videolan.Logger.unimplemented(DSMCCObject.class.getName(), "getSigners");
         throw new Error("Not implemented");
     }
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStream.java b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStream.java
index 12fee68..68aea71 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStream.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStream.java
@@ -24,73 +24,60 @@ import org.davic.net.Locator;
 
 public class DSMCCStream implements Serializable {
     public DSMCCStream(DSMCCObject aDSMCCObject) throws NotLoadedException,
-            IllegalObjectTypeException
-    {
+            IllegalObjectTypeException {
         org.videolan.Logger.unimplemented(DSMCCStream.class.getName(), "");
         throw new Error("Not implemented");
     }
 
     public DSMCCStream(String path) throws IOException,
-            IllegalObjectTypeException
-    {
+            IllegalObjectTypeException {
         org.videolan.Logger.unimplemented(DSMCCStream.class.getName(), "");
         throw new Error("Not implemented");
     }
 
     public DSMCCStream(String path, String name) throws IOException,
-            IllegalObjectTypeException
-    {
+            IllegalObjectTypeException {
         org.videolan.Logger.unimplemented(DSMCCStream.class.getName(), "");
         throw new Error("Not implemented");
     }
 
-    public long getDuration()
-    {
+    public long getDuration() {
         throw new Error("Not implemented");
     }
 
-    public long getNPT() throws MPEGDeliveryException
-    {
+    public long getNPT() throws MPEGDeliveryException {
         throw new Error("Not implemented");
     }
 
-    public Locator getStreamLocator()
-    {
+    public Locator getStreamLocator() {
         throw new Error("Not implemented");
     }
 
-    public boolean isMPEGProgram()
-    {
+    public boolean isMPEGProgram() {
         throw new Error("Not implemented");
     }
 
-    public boolean isAudio()
-    {
+    public boolean isAudio() {
         throw new Error("Not implemented");
     }
 
-    public boolean isVideo()
-    {
+    public boolean isVideo() {
         throw new Error("Not implemented");
     }
 
-    public boolean isData()
-    {
+    public boolean isData() {
         throw new Error("Not implemented");
     }
 
-    public NPTRate getNPTRate() throws MPEGDeliveryException
-    {
+    public NPTRate getNPTRate() throws MPEGDeliveryException {
         throw new Error("Not implemented");
     }
 
-    public void addNPTListener(NPTListener listener)
-    {
+    public void addNPTListener(NPTListener listener) {
         throw new Error("Not implemented");
     }
 
-    public void removeNPTListener(NPTListener listener)
-    {
+    public void removeNPTListener(NPTListener listener) {
         throw new Error("Not implemented");
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStreamEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStreamEvent.java
index e8662a1..a4c259a 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStreamEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/DSMCCStreamEvent.java
@@ -23,49 +23,45 @@ import java.io.IOException;
 public class DSMCCStreamEvent extends DSMCCStream {
 
     public DSMCCStreamEvent(DSMCCObject aDSMCCObject)
-            throws NotLoadedException, IllegalObjectTypeException
-    {
+            throws NotLoadedException, IllegalObjectTypeException {
+
         super(aDSMCCObject);
         org.videolan.Logger.unimplemented(DSMCCStreamEvent.class.getName(), "");
         throw new Error("Not implemented");
     }
 
     public DSMCCStreamEvent(String path) throws IOException,
-            IllegalObjectTypeException
-    {
+            IllegalObjectTypeException {
+
         super(path);
         org.videolan.Logger.unimplemented(DSMCCStreamEvent.class.getName(), "");
         throw new Error("Not implemented");
     }
 
     public DSMCCStreamEvent(String path, String name) throws IOException,
-            IllegalObjectTypeException
-    {
+            IllegalObjectTypeException {
+
         super(path, name);
         org.videolan.Logger.unimplemented(DSMCCStreamEvent.class.getName(), "");
         throw new Error("Not implemented");
     }
 
     public synchronized int subscribe(String eventName, StreamEventListener l)
-            throws UnknownEventException, InsufficientResourcesException
-    {
+            throws UnknownEventException, InsufficientResourcesException {
         throw new Error("Not implemented");
     }
 
     public synchronized void unsubscribe(int eventId, StreamEventListener l)
-            throws UnknownEventException
-    {
+            throws UnknownEventException {
         throw new Error("Not implemented");
     }
 
     public synchronized void unsubscribe(String eventName, StreamEventListener l)
-            throws UnknownEventException
-    {
+            throws UnknownEventException {
         throw new Error("Not implemented");
     }
 
-    public String[] getEventList()
-    {
+    public String[] getEventList() {
         throw new Error("Not implemented");
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/IllegalObjectTypeException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/IllegalObjectTypeException.java
index 317e578..ca4d764 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/IllegalObjectTypeException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/IllegalObjectTypeException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class IllegalObjectTypeException extends DSMCCException {
-    public IllegalObjectTypeException()
-    {
+    public IllegalObjectTypeException() {
         super();
     }
 
-    public IllegalObjectTypeException(String reason)
-    {
+    public IllegalObjectTypeException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesEvent.java
index 7028c9c..21dd2d3 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesEvent.java
@@ -20,15 +20,13 @@
 package org.dvb.dsmcc;
 
 public class InsufficientResourcesEvent extends AsynchronousLoadingEvent {
-    public InsufficientResourcesEvent(DSMCCObject source)
-    {
+    public InsufficientResourcesEvent(DSMCCObject source) {
         super(source);
-        
+
         this.source = source;
     }
 
-    public java.lang.Object getSource()
-    {
+    public java.lang.Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesException.java
index 391a3d0..a8a5699 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InsufficientResourcesException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class InsufficientResourcesException extends DSMCCException {
-    public InsufficientResourcesException()
-    {
+    public InsufficientResourcesException() {
         super();
     }
 
-    public InsufficientResourcesException(String reason)
-    {
+    public InsufficientResourcesException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidAddressException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidAddressException.java
index 0c74d86..79180a0 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidAddressException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidAddressException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class InvalidAddressException extends DSMCCException {
-    public InvalidAddressException()
-    {
+    public InvalidAddressException() {
         super();
     }
 
-    public InvalidAddressException(String reason)
-    {
+    public InvalidAddressException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatEvent.java
index 7821219..2daaea0 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatEvent.java
@@ -20,15 +20,13 @@
 package org.dvb.dsmcc;
 
 public class InvalidFormatEvent extends AsynchronousLoadingEvent {
-    public InvalidFormatEvent(DSMCCObject source)
-    {
+    public InvalidFormatEvent(DSMCCObject source) {
         super(source);
-        
+
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatException.java
index 73989d6..b60ed65 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidFormatException.java
@@ -21,13 +21,11 @@ package org.dvb.dsmcc;
 
 public class InvalidFormatException extends DSMCCException {
 
-    public InvalidFormatException()
-    {
+    public InvalidFormatException() {
         super();
     }
 
-    public InvalidFormatException(String reason)
-    {
+    public InvalidFormatException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathNameException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathNameException.java
index 85f76d3..caa356e 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathNameException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathNameException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class InvalidPathNameException extends DSMCCException {
-    public InvalidPathNameException()
-    {
+    public InvalidPathNameException() {
         super();
     }
 
-    public InvalidPathNameException(String reason)
-    {
+    public InvalidPathNameException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathnameEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathnameEvent.java
index 2a3bd99..a479b8c 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathnameEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/InvalidPathnameEvent.java
@@ -20,15 +20,13 @@
 package org.dvb.dsmcc;
 
 public class InvalidPathnameEvent extends AsynchronousLoadingEvent {
-    public InvalidPathnameEvent(DSMCCObject source)
-    {
+    public InvalidPathnameEvent(DSMCCObject source) {
         super(source);
 
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/LoadingAbortedEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/LoadingAbortedEvent.java
index 19b51e6..29cad87 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/LoadingAbortedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/LoadingAbortedEvent.java
@@ -20,14 +20,12 @@
 package org.dvb.dsmcc;
 
 public class LoadingAbortedEvent extends AsynchronousLoadingEvent {
-    public LoadingAbortedEvent(DSMCCObject source)
-    {
+    public LoadingAbortedEvent(DSMCCObject source) {
         super(source);
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryErrorEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryErrorEvent.java
index 811e28e..3ccf1ea 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryErrorEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryErrorEvent.java
@@ -20,14 +20,12 @@
 package org.dvb.dsmcc;
 
 public class MPEGDeliveryErrorEvent extends AsynchronousLoadingEvent {
-    public MPEGDeliveryErrorEvent(DSMCCObject source)
-    {
+    public MPEGDeliveryErrorEvent(DSMCCObject source) {
         super(source);
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryException.java
index dac3667..e6c2a39 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/MPEGDeliveryException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class MPEGDeliveryException extends DSMCCException {
-    public MPEGDeliveryException()
-    {
+    public MPEGDeliveryException() {
         super();
     }
 
-    public MPEGDeliveryException(String reason)
-    {
+    public MPEGDeliveryException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTDiscontinuityEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTDiscontinuityEvent.java
index d8d0043..5694867 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTDiscontinuityEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTDiscontinuityEvent.java
@@ -20,21 +20,18 @@
 package org.dvb.dsmcc;
 
 public class NPTDiscontinuityEvent extends NPTStatusEvent {
-    public NPTDiscontinuityEvent(DSMCCStream source, long before, long after)
-    {
+    public NPTDiscontinuityEvent(DSMCCStream source, long before, long after) {
         super(source);
 
         this.before = before;
         this.after = after;
     }
 
-    public long getLastNPT()
-    {
+    public long getLastNPT() {
         return before;
     }
 
-    public long getFirstNPT()
-    {
+    public long getFirstNPT() {
         return after;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTPresentEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTPresentEvent.java
index f7e60f5..0709656 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTPresentEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTPresentEvent.java
@@ -20,8 +20,7 @@
 package org.dvb.dsmcc;
 
 public class NPTPresentEvent extends NPTStatusEvent {
-    public NPTPresentEvent(DSMCCStream source)
-    {
+    public NPTPresentEvent(DSMCCStream source) {
         super(source);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRate.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRate.java
index 7e8c8f5..c2b736a 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRate.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRate.java
@@ -24,19 +24,16 @@ import java.io.Serializable;
 public class NPTRate implements Serializable {
 
     // should only be called internally
-    public NPTRate(int numerator, int denominator)
-    {
+    public NPTRate(int numerator, int denominator) {
         this.numerator = numerator;
         this.denominator = denominator;
     }
 
-    public int getNumerator()
-    {
+    public int getNumerator() {
         return numerator;
     }
 
-    public int getDenominator()
-    {
+    public int getDenominator() {
         return denominator;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRateChangeEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRateChangeEvent.java
index 98b78fc..243cafd 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRateChangeEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRateChangeEvent.java
@@ -21,21 +21,18 @@
 package org.dvb.dsmcc;
 
 public class NPTRateChangeEvent extends java.util.EventObject {
-    public NPTRateChangeEvent(DSMCCStream source, NPTRate rate)
-    {
+    public NPTRateChangeEvent(DSMCCStream source, NPTRate rate) {
         super(source);
 
         this.source = source;
         this.rate = rate;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    public NPTRate getRate()
-    {
+    public NPTRate getRate() {
         return rate;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRemovedEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRemovedEvent.java
index 2a60b7a..03eb394 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRemovedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTRemovedEvent.java
@@ -20,10 +20,9 @@
 package org.dvb.dsmcc;
 
 public class NPTRemovedEvent extends NPTStatusEvent {
-    public NPTRemovedEvent(DSMCCStream source)
-    {
+    public NPTRemovedEvent(DSMCCStream source) {
         super(source);
     }
-    
+
     private static final long serialVersionUID = -317867772336548880L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTStatusEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTStatusEvent.java
index e682b50..08c0ab9 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NPTStatusEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NPTStatusEvent.java
@@ -20,15 +20,13 @@
 package org.dvb.dsmcc;
 
 public abstract class NPTStatusEvent extends java.util.EventObject {
-    public NPTStatusEvent(DSMCCStream source)
-    {
+    public NPTStatusEvent(DSMCCStream source) {
         super(source);
 
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledEvent.java
index 4f40d3a..481426d 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledEvent.java
@@ -20,15 +20,13 @@
 package org.dvb.dsmcc;
 
 public class NotEntitledEvent extends AsynchronousLoadingEvent {
-    public NotEntitledEvent(DSMCCObject source)
-    {
+    public NotEntitledEvent(DSMCCObject source) {
         super(source);
 
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledException.java
index 55e3665..134593a 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NotEntitledException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class NotEntitledException extends DSMCCException {
-    public NotEntitledException()
-    {
+    public NotEntitledException() {
         super();
     }
 
-    public NotEntitledException(String reason)
-    {
+    public NotEntitledException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NotLoadedException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NotLoadedException.java
index a36ca38..def72e2 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NotLoadedException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NotLoadedException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class NotLoadedException extends DSMCCException {
-    public NotLoadedException()
-    {
+    public NotLoadedException() {
         super();
     }
 
-    public NotLoadedException(String reason)
-    {
+    public NotLoadedException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/NothingToAbortException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/NothingToAbortException.java
index ac362a4..e2d0a90 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/NothingToAbortException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/NothingToAbortException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class NothingToAbortException extends DSMCCException {
-    public NothingToAbortException()
-    {
+    public NothingToAbortException() {
         super();
     }
 
-    public NothingToAbortException(String reason)
-    {
+    public NothingToAbortException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ObjectChangeEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ObjectChangeEvent.java
index 14310d3..d6d0486 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ObjectChangeEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ObjectChangeEvent.java
@@ -22,24 +22,18 @@ package org.dvb.dsmcc;
 import java.util.EventObject;
 
 public class ObjectChangeEvent extends EventObject {
-    public ObjectChangeEvent(DSMCCObject source, int aVersionNumber)
-
-    {
+    public ObjectChangeEvent(DSMCCObject source, int aVersionNumber) {
         super(source);
 
         this.source = source;
         this.aVersionNumber = aVersionNumber;
     }
 
-    public int getNewVersionNumber()
-
-    {
+    public int getNewVersionNumber() {
         return aVersionNumber;
-
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryErrorEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryErrorEvent.java
index 3709f53..b994504 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryErrorEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryErrorEvent.java
@@ -20,15 +20,13 @@
 package org.dvb.dsmcc;
 
 public class ServerDeliveryErrorEvent extends AsynchronousLoadingEvent {
-    public ServerDeliveryErrorEvent(DSMCCObject source)
-    {
+    public ServerDeliveryErrorEvent(DSMCCObject source) {
         super(source);
 
         this.source = source;
     }
 
-    public java.lang.Object getSource()
-    {
+    public java.lang.Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryException.java
index d68e850..df0cdc3 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ServerDeliveryException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class ServerDeliveryException extends DSMCCException {
-    public ServerDeliveryException()
-    {
+    public ServerDeliveryException() {
         super();
     }
 
-    public ServerDeliveryException(String reason)
-    {
+    public ServerDeliveryException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceDomain.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceDomain.java
index cfa78b4..e7e4861 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceDomain.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceDomain.java
@@ -28,22 +28,18 @@ import org.videolan.MountException;
 import org.videolan.MountManager;
 
 public class ServiceDomain {
-    public ServiceDomain()
-    {
-
+    public ServiceDomain() {
     }
 
     public void attach(Locator dvbService, int carouselId)
             throws ServiceXFRException, InterruptedIOException,
-            MPEGDeliveryException
-    {
+            MPEGDeliveryException {
         org.videolan.Logger.unimplemented("ServiceDomain", "attach");
         throw new Error("Not implemented");
     }
 
     public void attach(Locator locator) throws DSMCCException,
-            InterruptedIOException, MPEGDeliveryException
-    {
+            InterruptedIOException, MPEGDeliveryException {
         BDLocator bdl = checkLocator(locator);
         if (bdl == null)
             throw new DSMCCException("invalid BDLocator");
@@ -62,28 +58,25 @@ public class ServiceDomain {
 
     public void attach(byte[] NSAPAddress) throws DSMCCException,
             InterruptedIOException, InvalidAddressException,
-            MPEGDeliveryException
-    {
+            MPEGDeliveryException {
         org.videolan.Logger.unimplemented("ServiceDomain", "attach");
         throw new Error("Not implemented");
     }
 
-    public void detach() throws NotLoadedException
-    {
+    public void detach() throws NotLoadedException {
         if (mountPoint == null)
             throw new NotLoadedException();
     }
 
-    public byte[] getNSAPAddress() throws NotLoadedException
-    {
+    public byte[] getNSAPAddress() throws NotLoadedException {
         org.videolan.Logger.unimplemented("ServiceDomain", "getNSAPAddress");
         throw new Error("Not implemented");
     }
 
     public static URL getURL(Locator locator)
             throws NotLoadedException, InvalidLocatorException,
-            FileNotFoundException
-    {
+            FileNotFoundException {
+
         BDLocator bdl = checkLocator(locator);
         if (bdl == null)
             throw new InvalidLocatorException("invalid BDLocator");
@@ -105,29 +98,24 @@ public class ServiceDomain {
         throw new InvalidLocatorException();
     }
 
-    public DSMCCObject getMountPoint()
-    {
+    public DSMCCObject getMountPoint() {
         return mountPoint;
     }
 
-    public boolean isNetworkConnectionAvailable()
-    {
+    public boolean isNetworkConnectionAvailable() {
         org.videolan.Logger.unimplemented("ServiceDomain", "isNetworkConnectionAvailable");
         return false;
     }
 
-    public boolean isAttached()
-    {
+    public boolean isAttached() {
         return mountPoint != null;
     }
 
-    public Locator getLocator()
-    {
+    public Locator getLocator() {
         return locator;
     }
 
-    private static BDLocator checkLocator(Locator locator)
-    {
+    private static BDLocator checkLocator(Locator locator) {
         if (!(locator instanceof BDLocator))
             return null;
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRErrorEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRErrorEvent.java
index a325563..89b793e 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRErrorEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRErrorEvent.java
@@ -20,21 +20,18 @@
 package org.dvb.dsmcc;
 
 public class ServiceXFRErrorEvent extends AsynchronousLoadingEvent {
-    public ServiceXFRErrorEvent(DSMCCObject source, ServiceXFRReference ref)
-    {
+    public ServiceXFRErrorEvent(DSMCCObject source, ServiceXFRReference ref) {
         super(source);
 
         this.source = source;
         this.ref = ref;
     }
 
-    public java.lang.Object getSource()
-    {
+    public java.lang.Object getSource() {
         return source;
     }
 
-    public ServiceXFRReference getServiceXFR()
-    {
+    public ServiceXFRReference getServiceXFR() {
         return ref;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRException.java
index 2cbf6a1..4bf1798 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRException.java
@@ -21,18 +21,15 @@ package org.dvb.dsmcc;
 
 public class ServiceXFRException extends DSMCCException {
     public ServiceXFRException(org.davic.net.Locator aService, int carouselId,
-            String pathName)
-    {
+            String pathName) {
         this.ref = new ServiceXFRReference(aService, carouselId, pathName);
     }
 
-    public ServiceXFRException(byte[] NSAPAddress, String pathName)
-    {
+    public ServiceXFRException(byte[] NSAPAddress, String pathName) {
         this.ref = new ServiceXFRReference(NSAPAddress, pathName);
     }
 
-    public ServiceXFRReference getServiceXFR()
-    {
+    public ServiceXFRReference getServiceXFR() {
         return ref;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRReference.java b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRReference.java
index 9e5ff5a..3084aa6 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRReference.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/ServiceXFRReference.java
@@ -25,35 +25,29 @@ import org.davic.net.Locator;
 
 public class ServiceXFRReference implements Serializable {
     public ServiceXFRReference(Locator serviceLocator, int carouselId,
-            String pathName)
-    {
+            String pathName) {
         org.videolan.Logger.unimplemented(ServiceXFRReference.class.getName(), "");
         throw new Error("Not implemented");
     }
 
-    public ServiceXFRReference(byte[] nsapAddress, String pathName)
-    {
+    public ServiceXFRReference(byte[] nsapAddress, String pathName) {
         org.videolan.Logger.unimplemented(ServiceXFRReference.class.getName(), "");
         throw new Error("Not implemented");
     }
 
-    public Locator getLocator()
-    {
+    public Locator getLocator() {
         throw new Error("Not implemented");
     }
 
-    public int getCarouselId()
-    {
+    public int getCarouselId() {
         throw new Error("Not implemented");
     }
 
-    public String getPathName()
-    {
+    public String getPathName() {
         throw new Error("Not implemented");
     }
 
-    public byte[] getNSAPAddress()
-    {
+    public byte[] getNSAPAddress() {
         throw new Error("Not implemented");
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/StreamEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/StreamEvent.java
index c44f2ab..b28e671 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/StreamEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/StreamEvent.java
@@ -21,10 +21,9 @@ package org.dvb.dsmcc;
 
 public class StreamEvent extends java.util.EventObject {
     public StreamEvent(DSMCCStreamEvent source, long npt, String name,
-            int eventId, byte[] eventData)
-    {
+            int eventId, byte[] eventData) {
         super(source);
-        
+
         this.source = source;
         this.npt = npt;
         this.name = name;
@@ -32,35 +31,30 @@ public class StreamEvent extends java.util.EventObject {
         this.eventData = eventData;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    public String getEventName()
-    {
+    public String getEventName() {
         return name;
     }
 
-    public int getEventId()
-    {
+    public int getEventId() {
         return eventId;
     }
 
-    public long getEventNPT()
-    {
+    public long getEventNPT() {
         return npt;
     }
 
-    public byte[] getEventData()
-    {
+    public byte[] getEventData() {
         return eventData;
     }
 
     private DSMCCStreamEvent source;
     private long npt;
     private String name;
-    private int eventId; 
+    private int eventId;
     private byte[] eventData;
     private static final long serialVersionUID = -8054274744134638856L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/SuccessEvent.java b/src/libbluray/bdj/java/org/dvb/dsmcc/SuccessEvent.java
index 9fffa57..f1acad9 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/SuccessEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/SuccessEvent.java
@@ -20,14 +20,12 @@
 package org.dvb.dsmcc;
 
 public class SuccessEvent extends AsynchronousLoadingEvent {
-    public SuccessEvent(DSMCCObject source)
-    {
+    public SuccessEvent(DSMCCObject source) {
         super(source);
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/dsmcc/UnknownEventException.java b/src/libbluray/bdj/java/org/dvb/dsmcc/UnknownEventException.java
index 3f0f8bf..f587fe7 100644
--- a/src/libbluray/bdj/java/org/dvb/dsmcc/UnknownEventException.java
+++ b/src/libbluray/bdj/java/org/dvb/dsmcc/UnknownEventException.java
@@ -20,13 +20,11 @@
 package org.dvb.dsmcc;
 
 public class UnknownEventException extends DSMCCException {
-    public UnknownEventException()
-    {
+    public UnknownEventException() {
         super();
     }
 
-    public UnknownEventException(String reason)
-    {
+    public UnknownEventException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/event/EventManager.java b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
index 844b72d..54ce6ac 100644
--- a/src/libbluray/bdj/java/org/dvb/event/EventManager.java
+++ b/src/libbluray/bdj/java/org/dvb/event/EventManager.java
@@ -36,8 +36,11 @@ import org.videolan.GUIManager;
 import org.videolan.Logger;
 
 public class EventManager implements ResourceServer {
+
+    private static final Object instanceLock = new Object();
+
     public static EventManager getInstance() {
-        synchronized (EventManager.class) {
+        synchronized (instanceLock) {
             if (instance == null)
                 instance = new EventManager();
             return instance;
@@ -46,7 +49,7 @@ public class EventManager implements ResourceServer {
 
     public static void shutdown() {
         EventManager e;
-        synchronized (EventManager.class) {
+        synchronized (instanceLock) {
             e = instance;
             instance = null;
         }
@@ -164,10 +167,13 @@ public class EventManager implements ResourceServer {
                 if (item.context == context) {
                     if (item.userEvents.contains(ue)) {
                         result = BDJHelper.postKeyEvent(type, modifiers, keyCode);
+                        logger.info("Key posted to exclusive AWT event listener, r=" + result);
                         return true;
                     }
                 }
             }
+        } else {
+            logger.info("No focused HScene found !");
         }
 
         for (Iterator it = exclusiveUserEventListener.iterator(); it.hasNext(); ) {
@@ -179,6 +185,7 @@ public class EventManager implements ResourceServer {
             }
             if (item.userEvents.contains(ue)) {
                 item.context.putUserEvent(new UserEventAction(item, ue));
+                logger.info("Key posted to exclusive UE listener");
                 return true;
             }
         }
@@ -194,6 +201,7 @@ public class EventManager implements ResourceServer {
             }
             if (item.userEvents.contains(ue)) {
                 item.context.putUserEvent(new UserEventAction(item, ue));
+                logger.info("Key posted to shared UE listener");
                 result = true;
             }
         }
diff --git a/src/libbluray/bdj/java/org/dvb/event/OverallRepository.java b/src/libbluray/bdj/java/org/dvb/event/OverallRepository.java
index cb93aac..9674198 100644
--- a/src/libbluray/bdj/java/org/dvb/event/OverallRepository.java
+++ b/src/libbluray/bdj/java/org/dvb/event/OverallRepository.java
@@ -20,15 +20,13 @@
 package org.dvb.event;
 
 public class OverallRepository extends UserEventRepository {
-    public OverallRepository()
-    {
+    public OverallRepository() {
         this("OverallRepository");
     }
 
-    public OverallRepository(String name)
-    {
+    public OverallRepository(String name) {
         super(name);
-        
+
         super.addAllArrowKeys();
         super.addAllColourKeys();
         super.addAllNumericKeys();
diff --git a/src/libbluray/bdj/java/org/dvb/event/RepositoryDescriptor.java b/src/libbluray/bdj/java/org/dvb/event/RepositoryDescriptor.java
index 6efa0d1..99b0704 100644
--- a/src/libbluray/bdj/java/org/dvb/event/RepositoryDescriptor.java
+++ b/src/libbluray/bdj/java/org/dvb/event/RepositoryDescriptor.java
@@ -24,22 +24,19 @@ import org.davic.resources.ResourceProxy;
 
 public class RepositoryDescriptor implements ResourceProxy {
 
-    protected RepositoryDescriptor(ResourceClient client, String name)
-    {
+    protected RepositoryDescriptor(ResourceClient client, String name) {
         this.name = name;
         this.client = client;
     }
 
-    public String getName()
-    {
+    public String getName() {
         return name;
     }
 
-    public ResourceClient getClient()
-    {
+    public ResourceClient getClient() {
         return client;
     }
-    
+
     private String name;
     private ResourceClient client;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/event/UserEvent.java b/src/libbluray/bdj/java/org/dvb/event/UserEvent.java
index 43f7f9c..001b90b 100644
--- a/src/libbluray/bdj/java/org/dvb/event/UserEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/event/UserEvent.java
@@ -23,10 +23,9 @@ import java.awt.event.KeyEvent;
 
 public class UserEvent extends java.util.EventObject {
     public UserEvent(Object source, int family, int type, int code,
-            int modifiers, long when)
-    {
+            int modifiers, long when) {
         super(source);
-        
+
         this.family = family;
         this.type = type;
         this.code = code;
@@ -34,10 +33,9 @@ public class UserEvent extends java.util.EventObject {
         this.when = when;
     }
 
-    public UserEvent(Object source, int family, char keyChar, long when)
-    {
+    public UserEvent(Object source, int family, char keyChar, long when) {
         super(source);
-       
+
         this.family = family;
         this.type = KeyEvent.KEY_TYPED;
         this.code = keyChar;
@@ -45,56 +43,46 @@ public class UserEvent extends java.util.EventObject {
         this.when = when;
     }
 
-    public int getFamily()
-    {
+    public int getFamily() {
         return family;
     }
 
-    public int getType()
-    {
+    public int getType() {
         return type;
     }
 
-    public int getCode()
-    {
+    public int getCode() {
         return code;
     }
 
-    public char getKeyChar()
-    {
+    public char getKeyChar() {
         return (char) code;
     }
 
-    public int getModifiers()
-    {
+    public int getModifiers() {
         return modifiers;
     }
 
-    public boolean isShiftDown()
-    {
+    public boolean isShiftDown() {
         return (KeyEvent.SHIFT_MASK & modifiers) != 0;
     }
 
-    public boolean isControlDown()
-    {
+    public boolean isControlDown() {
         return (KeyEvent.CTRL_MASK & modifiers) != 0;
     }
 
-    public boolean isMetaDown()
-    {
+    public boolean isMetaDown() {
         return (KeyEvent.META_MASK & modifiers) != 0;
     }
 
-    public boolean isAltDown()
-    {
+    public boolean isAltDown() {
         return (KeyEvent.ALT_MASK & modifiers) != 0;
     }
 
-    public long getWhen()
-    {
+    public long getWhen() {
         return when;
     }
-    
+
     public static final int UEF_KEY_EVENT = 1;
 
     private int family;
@@ -102,5 +90,5 @@ public class UserEvent extends java.util.EventObject {
     private int code;
     private int modifiers;
     private long when;
-    private static final long serialVersionUID = -4734616177850745290L; 
+    private static final long serialVersionUID = -4734616177850745290L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/event/UserEventAvailableEvent.java b/src/libbluray/bdj/java/org/dvb/event/UserEventAvailableEvent.java
index e5b7335..ed5479a 100644
--- a/src/libbluray/bdj/java/org/dvb/event/UserEventAvailableEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/event/UserEventAvailableEvent.java
@@ -22,13 +22,11 @@ package org.dvb.event;
 import org.davic.resources.ResourceStatusEvent;
 
 public class UserEventAvailableEvent extends ResourceStatusEvent {
-    public UserEventAvailableEvent(Object source)
-    {
+    public UserEventAvailableEvent(Object source) {
         super(source);
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return super.getSource();
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/event/UserEventListener.java b/src/libbluray/bdj/java/org/dvb/event/UserEventListener.java
index a933230..227739c 100644
--- a/src/libbluray/bdj/java/org/dvb/event/UserEventListener.java
+++ b/src/libbluray/bdj/java/org/dvb/event/UserEventListener.java
@@ -23,5 +23,4 @@ import java.util.EventListener;
 
 public interface UserEventListener extends EventListener {
     public void userEventReceived(UserEvent event);
-
 }
diff --git a/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java b/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java
index 5888608..0632e4f 100644
--- a/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java
+++ b/src/libbluray/bdj/java/org/dvb/event/UserEventRepository.java
@@ -27,13 +27,11 @@ import org.havi.ui.event.HRcEvent;
 
 public class UserEventRepository extends RepositoryDescriptor {
 
-    public UserEventRepository(String name)
-    {
+    public UserEventRepository(String name) {
         super(null, name);
     }
 
-    public void addUserEvent(UserEvent event)
-    {
+    public void addUserEvent(UserEvent event) {
         if (contains(event)) {
             return;
         }
@@ -41,8 +39,7 @@ public class UserEventRepository extends RepositoryDescriptor {
         events.add(event);
     }
 
-    public UserEvent[] getUserEvent()
-    {
+    public UserEvent[] getUserEvent() {
         int size = events.size();
         UserEvent[] userEvents = new UserEvent[size];
         for (int i = 0; i < size; i++)
@@ -50,21 +47,18 @@ public class UserEventRepository extends RepositoryDescriptor {
         return userEvents;
     }
 
-    public void removeUserEvent(UserEvent event)
-    {
+    public void removeUserEvent(UserEvent event) {
         events.remove(event);
     }
 
-    public void addKey(int keycode)
-    {
+    public void addKey(int keycode) {
         addUserEvent(new UserEvent(this, UserEvent.UEF_KEY_EVENT,
                                    KeyEvent.KEY_PRESSED, keycode, 0, 0));
         addUserEvent(new UserEvent(this, UserEvent.UEF_KEY_EVENT,
                                    KeyEvent.KEY_RELEASED, keycode, 0, 0));
     }
 
-    public void removeKey(int keycode)
-    {
+    public void removeKey(int keycode) {
         for(Iterator it = events.iterator(); it.hasNext() == true; ) {
             UserEvent event = (UserEvent)it.next();
 
@@ -73,8 +67,7 @@ public class UserEventRepository extends RepositoryDescriptor {
         }
     }
 
-    public void addAllNumericKeys()
-    {
+    public void addAllNumericKeys() {
         addKey(HRcEvent.VK_0);
         addKey(HRcEvent.VK_1);
         addKey(HRcEvent.VK_2);
@@ -87,24 +80,21 @@ public class UserEventRepository extends RepositoryDescriptor {
         addKey(HRcEvent.VK_9);
     }
 
-    public void addAllColourKeys()
-    {
+    public void addAllColourKeys() {
         addKey(HRcEvent.VK_COLORED_KEY_0);
         addKey(HRcEvent.VK_COLORED_KEY_1);
         addKey(HRcEvent.VK_COLORED_KEY_2);
         addKey(HRcEvent.VK_COLORED_KEY_3);
     }
 
-    public void addAllArrowKeys()
-    {
+    public void addAllArrowKeys() {
         addKey(HRcEvent.VK_LEFT);
         addKey(HRcEvent.VK_RIGHT);
         addKey(HRcEvent.VK_UP);
         addKey(HRcEvent.VK_DOWN);
     }
 
-    public void removeAllNumericKeys()
-    {
+    public void removeAllNumericKeys() {
         removeKey(HRcEvent.VK_0);
         removeKey(HRcEvent.VK_1);
         removeKey(HRcEvent.VK_2);
@@ -117,25 +107,22 @@ public class UserEventRepository extends RepositoryDescriptor {
         removeKey(HRcEvent.VK_9);
     }
 
-    public void removeAllColourKeys()
-    {
+    public void removeAllColourKeys() {
         removeKey(HRcEvent.VK_COLORED_KEY_0);
         removeKey(HRcEvent.VK_COLORED_KEY_1);
         removeKey(HRcEvent.VK_COLORED_KEY_2);
         removeKey(HRcEvent.VK_COLORED_KEY_3);
     }
 
-    public void removeAllArrowKeys()
-    {
+    public void removeAllArrowKeys() {
         removeKey(HRcEvent.VK_LEFT);
         removeKey(HRcEvent.VK_RIGHT);
         removeKey(HRcEvent.VK_UP);
         removeKey(HRcEvent.VK_DOWN);
     }
 
-    boolean contains(UserEvent event)
-    {
-        for(Iterator it = events.iterator(); it.hasNext() == true; ) {
+    boolean contains(UserEvent event) {
+        for (Iterator it = events.iterator(); it.hasNext() == true; ) {
             UserEvent e = (UserEvent)it.next();
             if (e.getFamily() == event.getFamily() && e.getType() == event.getType() && e.getCode() == event.getCode()) {
                 return true;
@@ -146,14 +133,12 @@ public class UserEventRepository extends RepositoryDescriptor {
 
     /* deep copy */
 
-    private UserEventRepository(UserEventRepository r)
-    {
+    private UserEventRepository(UserEventRepository r) {
         super(r.getClient(), r.getName());
         events = ((LinkedList)r.events.clone());
     }
 
-    protected UserEventRepository getNewInstance()
-    {
+    protected UserEventRepository getNewInstance() {
         return new UserEventRepository(this);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/event/UserEventUnavailableEvent.java b/src/libbluray/bdj/java/org/dvb/event/UserEventUnavailableEvent.java
index 580bfd9..4e5f96e 100644
--- a/src/libbluray/bdj/java/org/dvb/event/UserEventUnavailableEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/event/UserEventUnavailableEvent.java
@@ -19,17 +19,16 @@
 
 package org.dvb.event;
 
-public class UserEventUnavailableEvent extends
-        org.davic.resources.ResourceStatusEvent {
-    public UserEventUnavailableEvent(Object source)
-    {
+import org.davic.resources.ResourceStatusEvent;
+
+public class UserEventUnavailableEvent extends ResourceStatusEvent {
+    public UserEventUnavailableEvent(Object source) {
         super(source);
 
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java b/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
index 8ad8e51..6054849 100644
--- a/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
+++ b/src/libbluray/bdj/java/org/dvb/io/ixc/IxcRegistry.java
@@ -30,10 +30,12 @@ import org.videolan.IxcRegistryImpl;
 
 public class IxcRegistry {
 
+    private static final Object instanceLock = new Object();
+
     private static IxcRegistryImpl registry = null;
 
     private static IxcRegistryImpl getIxcRegistry() {
-        synchronized (IxcRegistry.class) {
+        synchronized (instanceLock) {
             if (registry == null) {
                 registry = new IxcRegistryImpl();
             }
@@ -43,7 +45,7 @@ public class IxcRegistry {
 
     public static void shutdown() {
         IxcRegistryImpl r;
-        synchronized (IxcRegistry.class) {
+        synchronized (instanceLock) {
             r = registry;
             registry = null;
         }
diff --git a/src/libbluray/bdj/java/org/dvb/io/persistent/FileAccessPermissions.java b/src/libbluray/bdj/java/org/dvb/io/persistent/FileAccessPermissions.java
index 3b83822..6458b5e 100644
--- a/src/libbluray/bdj/java/org/dvb/io/persistent/FileAccessPermissions.java
+++ b/src/libbluray/bdj/java/org/dvb/io/persistent/FileAccessPermissions.java
@@ -21,63 +21,65 @@ package org.dvb.io.persistent;
 
 public class FileAccessPermissions {
     public FileAccessPermissions(boolean readWorld, boolean writeWorld,
-            boolean readOrganisation, boolean writeOrganisation,
-            boolean readApplication, boolean writeApplication)
-    {
+            boolean readOrganization, boolean writeOrganization,
+            boolean readApplication, boolean writeApplication) {
         this.readWorld = readWorld;
         this.writeWorld = writeWorld;
-        this.readOrganisation = readOrganisation;
-        this.writeOrganisation = writeOrganisation;
+        this.readOrganization = readOrganization;
+        this.writeOrganization = writeOrganization;
         this.readApplication = readApplication;
         this.writeApplication = writeApplication;
     }
 
-    public boolean hasReadWorldAccessRight()
-    {
+    public boolean hasReadWorldAccessRight() {
         return readWorld;
     }
 
-    public boolean hasWriteWorldAccessRight()
-    {
+    public boolean hasWriteWorldAccessRight() {
         return writeWorld;
     }
 
-    public boolean hasReadOrganisationAccessRight()
-    {
-        return readOrganisation;
+    public boolean hasReadOrganizationAccessRight() {
+        return readOrganization;
     }
 
-    public boolean hasWriteOrganisationAccessRight()
-    {
-        return writeOrganisation;
+    public boolean hasWriteOrganizationAccessRight() {
+        return writeOrganization;
     }
 
-    public boolean hasReadApplicationAccessRight()
-    {
+    public boolean hasReadApplicationAccessRight() {
         return readApplication;
     }
 
-    public boolean hasWriteApplicationAccessRight()
-    {
+    public boolean hasWriteApplicationAccessRight() {
         return writeApplication;
     }
 
     public void setPermissions(boolean ReadWorld, boolean WriteWorld,
-            boolean ReadOrganisation, boolean WriteOrganisation,
-            boolean ReadApplication, boolean WriteApplication)
-    {
+            boolean ReadOrganization, boolean WriteOrganization,
+            boolean ReadApplication, boolean WriteApplication) {
         this.readWorld = ReadWorld;
         this.writeWorld = WriteWorld;
-        this.readOrganisation = ReadOrganisation;
-        this.writeOrganisation = WriteOrganisation;
+        this.readOrganization = ReadOrganization;
+        this.writeOrganization = WriteOrganization;
         this.readApplication = ReadApplication;
         this.writeApplication = WriteApplication;
     }
 
+    public String toString() {
+        return this.getClass().getName() +
+            "[rApp=" + readApplication +
+            ",wApp=" + writeApplication +
+            ",rOrg=" + readOrganization +
+            ",wOrg=" + writeOrganization +
+            ",rWorld=" + readWorld +
+            ",wWorld=" + writeWorld + "]";
+    }
+
     private boolean readWorld;
     private boolean writeWorld;
-    private boolean readOrganisation;
-    private boolean writeOrganisation;
+    private boolean readOrganization;
+    private boolean writeOrganization;
     private boolean readApplication;
     private boolean writeApplication;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/io/persistent/FileAttributes.java b/src/libbluray/bdj/java/org/dvb/io/persistent/FileAttributes.java
index 65c3d29..e733a97 100644
--- a/src/libbluray/bdj/java/org/dvb/io/persistent/FileAttributes.java
+++ b/src/libbluray/bdj/java/org/dvb/io/persistent/FileAttributes.java
@@ -29,53 +29,44 @@ public class FileAttributes {
     public static final int PRIORITY_MEDIUM = 2;
     public static final int PRIORITY_HIGH = 3;
 
-    protected FileAttributes(Date expiration_date,
-            FileAccessPermissions permissions, int priority)
-    {
+    protected FileAttributes(Date expirationDate,
+            FileAccessPermissions permissions, int priority) {
+        this.expirationDate = expirationDate;
         this.permissions = permissions;
         this.priority = priority;
     }
 
-    public Date getExpirationDate()
-    {
-        org.videolan.Logger.unimplemented(FileAttributes.class.getName(), "getExpirationDate");
-        return null;
+    public Date getExpirationDate() {
+        return expirationDate;
     }
 
-    public void setExpirationDate(Date d)
-    {
-        // expiration dates are for losers
+    public void setExpirationDate(Date d) {
+        this.expirationDate = d;
     }
 
-    public FileAccessPermissions getPermissions()
-    {
+    public FileAccessPermissions getPermissions() {
         return permissions;
     }
 
-    public void setPermissions(FileAccessPermissions permissions)
-    {
+    public void setPermissions(FileAccessPermissions permissions) {
         this.permissions = permissions;
     }
 
-    public int getPriority()
-    {
+    public int getPriority() {
         return priority;
     }
 
-    public void setPriority(int priority)
-    {
+    public void setPriority(int priority) {
         this.priority = priority;
     }
 
     public static void setFileAttributes(FileAttributes p, File f)
-            throws IOException
-    {
+            throws IOException {
         org.videolan.Logger.unimplemented(FileAttributes.class.getName(), "setFileAttributes");
         // not implemented
     }
 
-    public static FileAttributes getFileAttributes(File f) throws IOException
-    {
+    public static FileAttributes getFileAttributes(File f) throws IOException {
         boolean r = f.canRead();
         boolean w = f.canWrite();
 
@@ -84,6 +75,12 @@ public class FileAttributes {
         return new FileAttributes(null, permissions, PRIORITY_LOW);
     }
 
+    public String toString() {
+        return this.getClass().getName() + "[priority=" + priority + ",permissions=" +
+            permissions + ",expirationDate=" + expirationDate + "]";
+    }
+
     private FileAccessPermissions permissions;
     private int priority;
+    private Date expirationDate;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/ActiveFormatDescriptionChangedEvent.java b/src/libbluray/bdj/java/org/dvb/media/ActiveFormatDescriptionChangedEvent.java
index a145065..54906e6 100644
--- a/src/libbluray/bdj/java/org/dvb/media/ActiveFormatDescriptionChangedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/ActiveFormatDescriptionChangedEvent.java
@@ -20,18 +20,20 @@
 package org.dvb.media;
 
 public class ActiveFormatDescriptionChangedEvent extends VideoFormatEvent {
-    public ActiveFormatDescriptionChangedEvent(Object source, int newFormat)
-    {
+    public ActiveFormatDescriptionChangedEvent(Object source, int newFormat) {
         super(source);
 
         this.newFormat = newFormat;
     }
 
-    public int getNewFormat()
-    {
+    public int getNewFormat() {
         return newFormat;
     }
 
-    private int newFormat;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",newFormat=" + newFormat + "]";
+    }
+
+    private final int newFormat;
     private static final long serialVersionUID = -1102487117285915146L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/AspectRatioChangedEvent.java b/src/libbluray/bdj/java/org/dvb/media/AspectRatioChangedEvent.java
index 04b92d2..5503f0b 100644
--- a/src/libbluray/bdj/java/org/dvb/media/AspectRatioChangedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/AspectRatioChangedEvent.java
@@ -20,18 +20,20 @@
 package org.dvb.media;
 
 public class AspectRatioChangedEvent extends VideoFormatEvent {
-    public AspectRatioChangedEvent(Object source, int newRatio)
-    {
+    public AspectRatioChangedEvent(Object source, int newRatio) {
         super(source);
-        
+
         this.newRatio = newRatio;
     }
 
-    public int getNewRatio()
-    {
+    public int getNewRatio() {
         return newRatio;
     }
 
-    private int newRatio;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",newRatio=" + newRatio + "]";
+    }
+
+    private final int newRatio;
     private static final long serialVersionUID = -897298629574550910L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/CAException.java b/src/libbluray/bdj/java/org/dvb/media/CAException.java
index bb6c760..df6cfee 100644
--- a/src/libbluray/bdj/java/org/dvb/media/CAException.java
+++ b/src/libbluray/bdj/java/org/dvb/media/CAException.java
@@ -20,13 +20,11 @@
 package org.dvb.media;
 
 public class CAException extends java.io.IOException {
-    public CAException()
-    {
+    public CAException() {
         super();
     }
 
-    public CAException(String reason)
-    {
+    public CAException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/media/CAStopEvent.java b/src/libbluray/bdj/java/org/dvb/media/CAStopEvent.java
index 2c2e580..12f54f9 100644
--- a/src/libbluray/bdj/java/org/dvb/media/CAStopEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/CAStopEvent.java
@@ -24,23 +24,25 @@ import javax.media.Controller;
 import javax.media.MediaLocator;
 
 public class CAStopEvent extends StopEvent {
-    public CAStopEvent(Controller source)
-    {
+    public CAStopEvent(Controller source) {
         super(source, 0, 0, 0, null);
+        this.stream = null;
     }
 
     public CAStopEvent(Controller source, int previous, int current,
-            int target, MediaLocator stream)
-    {
+            int target, MediaLocator stream) {
         super(source, previous, current, target, null);
         this.stream = stream;
     }
 
-    public MediaLocator getStream()
-    {
+    public MediaLocator getStream() {
         return stream;
     }
 
-    private MediaLocator stream;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",stream=" + stream + "]";
+    }
+
+    private final MediaLocator stream;
     private static final long serialVersionUID = 4964383050657791426L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/DFCChangedEvent.java b/src/libbluray/bdj/java/org/dvb/media/DFCChangedEvent.java
index 616c2d7..d28cccf 100644
--- a/src/libbluray/bdj/java/org/dvb/media/DFCChangedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/DFCChangedEvent.java
@@ -20,18 +20,20 @@
 package org.dvb.media;
 
 public class DFCChangedEvent extends VideoFormatEvent {
-    public DFCChangedEvent(Object source, int newDFC)
-    {
+    public DFCChangedEvent(Object source, int newDFC) {
         super(source);
 
         this.newDFC = newDFC;
     }
 
-    public int getNewDFC()
-    {
+    public int getNewDFC() {
         return newDFC;
     }
 
-    private int newDFC;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",newDFC=" + newDFC + "]";
+    }
+
+    private final int newDFC;
     private static final long serialVersionUID = -4351969268893058245L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/NoComponentSelectedEvent.java b/src/libbluray/bdj/java/org/dvb/media/NoComponentSelectedEvent.java
index aab5672..84e61c1 100644
--- a/src/libbluray/bdj/java/org/dvb/media/NoComponentSelectedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/NoComponentSelectedEvent.java
@@ -25,18 +25,20 @@ import javax.media.Controller;
 
 public class NoComponentSelectedEvent extends StopEvent {
     public NoComponentSelectedEvent(Controller source, int previous,
-            int current, int target, MediaLocator stream)
-    {
+            int current, int target, MediaLocator stream) {
         super(source, 0, 0, 0, null);
 
         this.stream = stream;
     }
 
-    public MediaLocator getStream()
-    {
+    public MediaLocator getStream() {
         return stream;
     }
 
-    private MediaLocator stream;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",stream=" + stream + "]";
+    }
+
+    private final MediaLocator stream;
     private static final long serialVersionUID = -5650793101305031432L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/PresentationChangedEvent.java b/src/libbluray/bdj/java/org/dvb/media/PresentationChangedEvent.java
index 3b8252e..3e15025 100644
--- a/src/libbluray/bdj/java/org/dvb/media/PresentationChangedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/PresentationChangedEvent.java
@@ -25,29 +25,30 @@ import javax.media.MediaLocator;
 
 public class PresentationChangedEvent extends ControllerEvent {
     public PresentationChangedEvent(Controller source, MediaLocator stream,
-            int reason)
-    {
+            int reason) {
         super(source);
 
         this.stream = stream;
         this.reason = reason;
     }
 
-    public MediaLocator getStream()
-    {
+    public MediaLocator getStream() {
         return stream;
     }
 
-    public int getReason()
-    {
+    public int getReason() {
         return reason;
     }
 
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",stream=" + stream + ",reason=" + reason + "]";
+    }
+
     public static final int STREAM_UNAVAILABLE = 0x00;
     public static final int CA_FAILURE = 0x01;
     public static final int CA_RETURNED = 0x02;
 
-    private MediaLocator stream;
-    private int reason;
+    private final MediaLocator stream;
+    private final int reason;
     private static final long serialVersionUID = 7465215844040053752L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/ServiceRemovedEvent.java b/src/libbluray/bdj/java/org/dvb/media/ServiceRemovedEvent.java
index 80fc335..7abaae6 100644
--- a/src/libbluray/bdj/java/org/dvb/media/ServiceRemovedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/ServiceRemovedEvent.java
@@ -24,26 +24,27 @@ import javax.media.StopEvent;
 import javax.media.Controller;
 
 public class ServiceRemovedEvent extends StopEvent {
-    public ServiceRemovedEvent(Controller source)
-    {
+    public ServiceRemovedEvent(Controller source) {
         super(source, 0, 0, 0, null);
 
         this.stream = null;
     }
 
     public ServiceRemovedEvent(Controller source, int previous, int current,
-            int target, MediaLocator stream)
-    {
+            int target, MediaLocator stream) {
         super(source, 0, 0, 0, null);
 
         this.stream = stream;
     }
 
-    public MediaLocator getStream()
-    {
+    public MediaLocator getStream() {
         return stream;
     }
 
-    private MediaLocator stream;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",stream=" + stream + "]";
+    }
+
+    private final MediaLocator stream;
     private static final long serialVersionUID = -7235988242857485021L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/StopByResourceLossEvent.java b/src/libbluray/bdj/java/org/dvb/media/StopByResourceLossEvent.java
index e5ffa71..5ceeb03 100644
--- a/src/libbluray/bdj/java/org/dvb/media/StopByResourceLossEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/StopByResourceLossEvent.java
@@ -25,18 +25,20 @@ import javax.media.Controller;
 
 public class StopByResourceLossEvent extends StopEvent {
     public StopByResourceLossEvent(Controller source, int previous,
-            int current, int target, MediaLocator stream)
-    {
+            int current, int target, MediaLocator stream) {
         super(source, 0, 0, 0, null);
 
         this.stream = stream;
     }
 
-    public MediaLocator getStream()
-    {
+    public MediaLocator getStream() {
         return stream;
     }
 
-    private MediaLocator stream;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",stream=" + stream + "]";
+    }
+
+    private final MediaLocator stream;
     private static final long serialVersionUID = -2924890229807383503L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/SubtitleAvailableEvent.java b/src/libbluray/bdj/java/org/dvb/media/SubtitleAvailableEvent.java
index c55dea4..775eadb 100644
--- a/src/libbluray/bdj/java/org/dvb/media/SubtitleAvailableEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/SubtitleAvailableEvent.java
@@ -22,18 +22,16 @@ package org.dvb.media;
 import java.util.EventObject;
 
 public class SubtitleAvailableEvent extends EventObject {
-    public SubtitleAvailableEvent(Object source)
-    {
+    public SubtitleAvailableEvent(Object source) {
         super(source);
 
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    private Object source;
+    protected final Object source;
     private static final long serialVersionUID = -7714072037836958718L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/SubtitleNotAvailableEvent.java b/src/libbluray/bdj/java/org/dvb/media/SubtitleNotAvailableEvent.java
index 80eeba5..089f766 100644
--- a/src/libbluray/bdj/java/org/dvb/media/SubtitleNotAvailableEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/SubtitleNotAvailableEvent.java
@@ -22,17 +22,15 @@ package org.dvb.media;
 import java.util.EventObject;
 
 public class SubtitleNotAvailableEvent extends EventObject {
-    public SubtitleNotAvailableEvent(Object source)
-    {
+    public SubtitleNotAvailableEvent(Object source) {
         super(source);
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    private Object source;
+    protected final Object source;
     private static final long serialVersionUID = -5092068346063671440L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/SubtitleNotSelectedEvent.java b/src/libbluray/bdj/java/org/dvb/media/SubtitleNotSelectedEvent.java
index c4372c1..94a9ffe 100644
--- a/src/libbluray/bdj/java/org/dvb/media/SubtitleNotSelectedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/SubtitleNotSelectedEvent.java
@@ -22,17 +22,15 @@ package org.dvb.media;
 import java.util.EventObject;
 
 public class SubtitleNotSelectedEvent extends EventObject {
-    public SubtitleNotSelectedEvent(Object source)
-    {
+    public SubtitleNotSelectedEvent(Object source) {
         super(source);
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    private Object source;
+    protected final Object source;
     private static final long serialVersionUID = 158958833178309906L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/SubtitleSelectedEvent.java b/src/libbluray/bdj/java/org/dvb/media/SubtitleSelectedEvent.java
index a189c38..6899b60 100644
--- a/src/libbluray/bdj/java/org/dvb/media/SubtitleSelectedEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/SubtitleSelectedEvent.java
@@ -22,17 +22,15 @@ package org.dvb.media;
 import java.util.EventObject;
 
 public class SubtitleSelectedEvent extends EventObject {
-    public SubtitleSelectedEvent(Object source)
-    {
+    public SubtitleSelectedEvent(Object source) {
         super(source);
         this.source = source;
     }
 
-    public Object getSource()
-    {
+    public Object getSource() {
         return source;
     }
 
-    private Object source;
+    protected final Object source;
     private static final long serialVersionUID = -4464632374027942754L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/VideoFormatEvent.java b/src/libbluray/bdj/java/org/dvb/media/VideoFormatEvent.java
index b69715a..e3b7e46 100644
--- a/src/libbluray/bdj/java/org/dvb/media/VideoFormatEvent.java
+++ b/src/libbluray/bdj/java/org/dvb/media/VideoFormatEvent.java
@@ -22,10 +22,16 @@ package org.dvb.media;
 import java.util.EventObject;
 
 public abstract class VideoFormatEvent extends EventObject {
-    public VideoFormatEvent(Object source)
-    {
+    public VideoFormatEvent(Object source) {
         super(source);
+
+        this.source = source;
+    }
+
+    public Object getSource() {
+        return source;
     }
 
+    protected final Object source;
     private static final long serialVersionUID = 8432740055225331694L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/media/VideoFormatListener.java b/src/libbluray/bdj/java/org/dvb/media/VideoFormatListener.java
index 3136e44..d083f14 100644
--- a/src/libbluray/bdj/java/org/dvb/media/VideoFormatListener.java
+++ b/src/libbluray/bdj/java/org/dvb/media/VideoFormatListener.java
@@ -21,9 +21,8 @@ package org.dvb.media;
 
 import java.util.EventListener;
 
-public interface VideoFormatListener extends EventListener
-{
-	public void receiveVideoFormatEvent(VideoFormatEvent event);
+public interface VideoFormatListener extends EventListener {
+    public void receiveVideoFormatEvent(VideoFormatEvent event);
 }
 
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBAlphaComposite.java b/src/libbluray/bdj/java/org/dvb/ui/DVBAlphaComposite.java
index d93e666..51cdc33 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBAlphaComposite.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBAlphaComposite.java
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016  Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -21,30 +22,24 @@ package org.dvb.ui;
 
 public final class DVBAlphaComposite {
 
-    private DVBAlphaComposite(int rule)
-    {
-        this.rule = rule;
-        this.alpha = 1.0f;
+    private DVBAlphaComposite(int rule) {
+        this(rule, 1.0f);
     }
 
-    private DVBAlphaComposite(int rule, float alpha)
-    {
+    private DVBAlphaComposite(int rule, float alpha) {
         this.rule = rule;
         this.alpha = alpha;
     }
 
-    public int getRule()
-    {
+    public int getRule() {
         return rule;
     }
 
-    public float getAlpha()
-    {
+    public float getAlpha() {
         return alpha;
     }
 
-    public static DVBAlphaComposite getInstance(int rule)
-    {
+    public static DVBAlphaComposite getInstance(int rule) {
         switch (rule) {
         case CLEAR:
             return Clear;
@@ -63,17 +58,29 @@ public final class DVBAlphaComposite {
         case DST_OUT:
             return DstOut;
         default:
+            System.err.println("Unknown composite rule");
             throw new IllegalArgumentException("Unknown rule");
         }
     }
 
-    public static DVBAlphaComposite getInstance(int rule, float alpha)
-    {
+    public static DVBAlphaComposite getInstance(int rule, float alpha) {
+        if (rule < 1 || rule > 8) {
+            System.err.println("Unknown composite rule");
+            throw new IllegalArgumentException("Unknown rule");
+        }
+
+        if (alpha < 0.0f || alpha > 1.0f) {
+            System.err.println("Alpha value out of range");
+            throw new IllegalArgumentException("invalid alpha");
+        }
+
+        if (alpha >= 1.0f)
+            return getInstance(rule);
+
         return new DVBAlphaComposite(rule, alpha);
     }
 
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 31;
         int result = 1;
         result = prime * result + Float.floatToIntBits(alpha);
@@ -81,16 +88,13 @@ public final class DVBAlphaComposite {
         return result;
     }
 
-    public boolean equals(Object obj)
-    {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
+    public boolean equals(Object obj) {
+        if (!(obj instanceof DVBAlphaComposite))
             return false;
+
         DVBAlphaComposite other = (DVBAlphaComposite) obj;
-        if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha))
+        //if (Float.floatToIntBits(alpha) != Float.floatToIntBits(other.alpha))
+        if (Float.compare(alpha, other.alpha) != 0)
             return false;
         if (rule != other.rule)
             return false;
@@ -108,17 +112,13 @@ public final class DVBAlphaComposite {
 
     public static final DVBAlphaComposite Clear = new DVBAlphaComposite(CLEAR);
     public static final DVBAlphaComposite Src = new DVBAlphaComposite(SRC);
-    public static final DVBAlphaComposite SrcOver = new DVBAlphaComposite(
-            SRC_OVER);
-    public static final DVBAlphaComposite DstOver = new DVBAlphaComposite(
-            DST_OVER);
+    public static final DVBAlphaComposite SrcOver = new DVBAlphaComposite(SRC_OVER);
+    public static final DVBAlphaComposite DstOver = new DVBAlphaComposite(DST_OVER);
     public static final DVBAlphaComposite SrcIn = new DVBAlphaComposite(SRC_IN);
     public static final DVBAlphaComposite DstIn = new DVBAlphaComposite(DST_IN);
-    public static final DVBAlphaComposite SrcOut = new DVBAlphaComposite(
-            SRC_OUT);
-    public static final DVBAlphaComposite DstOut = new DVBAlphaComposite(
-            DST_OUT);
+    public static final DVBAlphaComposite SrcOut = new DVBAlphaComposite(SRC_OUT);
+    public static final DVBAlphaComposite DstOut = new DVBAlphaComposite(DST_OUT);
 
-    float alpha;
-    int rule;
+    private float alpha;
+    private int rule;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java b/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java
index 4b5728f..740847c 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBBufferedImage.java
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016  Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,28 +28,45 @@ import java.awt.Image;
 import java.awt.image.BufferedImage;
 import java.awt.image.ImageObserver;
 import java.awt.image.ImageProducer;
+import java.awt.image.RasterFormatException;
 
 public class DVBBufferedImage extends Image {
-    public DVBBufferedImage(int width, int height)
-    {
+    public DVBBufferedImage(int width, int height) {
         this(width, height, TYPE_BASE);
     }
 
-    public DVBBufferedImage(int width, int height, int type)
-    {
+    public DVBBufferedImage(int width, int height, int type) {
+        if (type != TYPE_BASE && type != TYPE_ADVANCED) {
+            throw new IllegalArgumentException(err("Unknown image type " + type));
+        }
+        if (width <= 0 || height <= 0) {
+            throw new IllegalArgumentException(err("Invalid size:" + width + "x" + height));
+        }
         this.type = type;
+
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice gd = ge.getDefaultScreenDevice();
         GraphicsConfiguration gc = gd.getDefaultConfiguration();
         bufferedImage = gc.createCompatibleImage(width, height);
+
+        if (bufferedImage == null) {
+            err("Error creating buffered image");
+        }
     }
 
     private DVBBufferedImage(BufferedImage image, int type) {
+        if (image == null) {
+            throw new IllegalArgumentException(err("null image"));
+        }
         this.type = type;
         this.bufferedImage = image;
     }
 
     public DVBGraphics createGraphics() {
+        if (bufferedImage == null) {
+            err("disposed");
+            return null;
+        }
         DVBGraphics gfx = new DVBGraphicsImpl(bufferedImage.createGraphics());
         gfx.type = type;
         return gfx;
@@ -59,18 +77,29 @@ public class DVBBufferedImage extends Image {
     }
 
     public void flush() {
-        bufferedImage.flush();
+        if (bufferedImage != null) {
+            bufferedImage.flush();
+        }
     }
 
     public Graphics getGraphics() {
+        if (bufferedImage == null) {
+            return null;
+        }
         return bufferedImage.getGraphics();
     }
 
     public int getHeight() {
+        if (bufferedImage == null) {
+            return -1;
+        }
         return bufferedImage.getHeight();
     }
 
     public int getHeight(ImageObserver observer) {
+        if (bufferedImage == null) {
+            return -1;
+        }
         return bufferedImage.getHeight(observer);
     }
 
@@ -79,49 +108,102 @@ public class DVBBufferedImage extends Image {
     }
 
     public Object getProperty(String name, ImageObserver observer) {
+        if (bufferedImage == null) {
+            return null;
+        }
         return bufferedImage.getProperty(name, observer);
     }
 
     public int getRGB(int x, int y) {
+        if (bufferedImage == null) {
+             throw new ArrayIndexOutOfBoundsException(err("disposed"));
+        }
+
+        int width = bufferedImage.getWidth();
+        int height = bufferedImage.getHeight();
+        if (x < 0 || y < 0 || x >= width || y >= height) {
+            throw new ArrayIndexOutOfBoundsException(err("getRGB out of bounds"));
+        }
+
         return bufferedImage.getRGB(x, y);
     }
 
     public int[] getRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
+        if (bufferedImage == null) {
+             throw new ArrayIndexOutOfBoundsException(err("disposed"));
+        }
+
+        int width = bufferedImage.getWidth();
+        int height = bufferedImage.getHeight();
+        if (startX < 0 || startY < 0 || startX + w >= width || startY + height >= height) {
+            throw new ArrayIndexOutOfBoundsException(err("getRGB out of bounds"));
+        }
+
         return bufferedImage.getRGB(startX, startY, w, h, rgbArray, offset, scansize);
     }
 
     public Image getScaledInstance(int width, int height, int hints) {
+        if (bufferedImage == null) {
+            return null;
+        }
         return bufferedImage.getScaledInstance(width, height, hints);
     }
 
     public ImageProducer getSource() {
+        if (bufferedImage == null) {
+            return null;
+        }
         return bufferedImage.getSource();
     }
 
     public DVBBufferedImage getSubimage(int x, int y, int w, int h) throws DVBRasterFormatException {
-        BufferedImage subImage = bufferedImage.getSubimage(x, y, w, h);
-        return new DVBBufferedImage(subImage, this.type);
+        if (bufferedImage == null) {
+            return null;
+        }
+        try {
+            BufferedImage subImage = bufferedImage.getSubimage(x, y, w, h);
+            return new DVBBufferedImage(subImage, this.type);
+        } catch (RasterFormatException e) {
+            throw new DVBRasterFormatException(err(e.getMessage()));
+        }
     }
 
     public int getWidth() {
+        if (bufferedImage == null) {
+            return -1;
+        }
         return bufferedImage.getWidth();
     }
 
     public int getWidth(ImageObserver observer) {
+        if (bufferedImage == null) {
+            return -1;
+        }
         return bufferedImage.getWidth(observer);
     }
 
     public void setRGB(int x, int y, int rgb) {
-        this.bufferedImage.setRGB(x, y, rgb);
+        if (bufferedImage == null) {
+            throw new ArrayIndexOutOfBoundsException(err("disposed"));
+        }
+        bufferedImage.setRGB(x, y, rgb);
     }
 
     public void setRGB(int startX, int startY, int w, int h, int[] rgbArray, int offset, int scansize) {
+        if (bufferedImage == null) {
+            throw new ArrayIndexOutOfBoundsException(err("disposed"));
+        }
         bufferedImage.setRGB(startX, startY, w, h, rgbArray, offset, scansize);
     }
 
     public String toString()
     {
-        return new String("DVBBufferedImage");
+        return getClass().getName() + "[img=" + bufferedImage + "]";
+    }
+
+    private String err(String msg) {
+        System.err.println("DVBBufferedImage: " + msg);
+        return msg;
     }
 
     public static final int TYPE_ADVANCED = 20;
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBColor.java b/src/libbluray/bdj/java/org/dvb/ui/DVBColor.java
index 65956b5..090e1a0 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBColor.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBColor.java
@@ -23,55 +23,45 @@ import java.awt.Color;
 import javax.tv.graphics.AlphaColor;
 
 public class DVBColor extends AlphaColor {
-    public DVBColor(float r, float g, float b, float a)
-    {
+    public DVBColor(float r, float g, float b, float a) {
         super(r, g, b, a);
     }
 
-    public DVBColor(int r, int g, int b, int a)
-    {
+    public DVBColor(int r, int g, int b, int a) {
         super(r, g, b, a);
     }
 
-    public DVBColor(int rgba, boolean hasAlpha)
-    {
+    public DVBColor(int rgba, boolean hasAlpha) {
         super(rgba, hasAlpha);
     }
 
-    public DVBColor(Color color)
-    {
+    public DVBColor(Color color) {
         super(color);
     }
 
-    public Color brighter()
-    {
-        return super.brighter();
+    public Color brighter() {
+        return new DVBColor(super.brighter());
     }
 
-    public Color darker()
-    {
-        return super.darker();
+    public Color darker() {
+        return new DVBColor(super.darker());
     }
 
-    public boolean equals(Object obj)
-    {
+    public boolean equals(Object obj) {
         return super.equals(obj);
     }
 
-    public int getAlpha()
-    {
+    public int getAlpha() {
         return super.getAlpha();
     }
 
-    public int getRGB()
-    {
+    public int getRGB() {
         return super.getRGB();
     }
 
-    public String toString()
-    {
+    public String toString() {
         return super.toString();
     }
-    
+
     private static final long serialVersionUID = -5411538049776187650L;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBGraphics.java b/src/libbluray/bdj/java/org/dvb/ui/DVBGraphics.java
index 2f1f1f1..60273a7 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBGraphics.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBGraphics.java
@@ -23,15 +23,10 @@ import java.awt.Color;
 import java.awt.Graphics2D;
 
 public abstract class DVBGraphics extends Graphics2D {
-    protected DVBGraphics(Graphics2D gfx)
-    {
-        this.gfx = gfx;
-    }
 
     public abstract int[] getAvailableCompositeRules();
 
-    public DVBColor getBestColorMatch(Color c)
-    {
+    public DVBColor getBestColorMatch(Color c) {
         return new DVBColor(c);
     }
 
@@ -39,8 +34,7 @@ public abstract class DVBGraphics extends Graphics2D {
 
     public abstract DVBAlphaComposite getDVBComposite();
 
-    public int getType()
-    {
+    public int getType() {
         return type;
     }
 
@@ -49,12 +43,9 @@ public abstract class DVBGraphics extends Graphics2D {
     public abstract void setDVBComposite(DVBAlphaComposite comp)
             throws UnsupportedDrawingOperationException;
 
-    public String toString()
-    {
-        return getClass().getName() + "[font=" + getFont() + ",color="
-                + getColor() + "]";
+    public String toString() {
+        return getClass().getName() + "[font=" + getFont() + ",color=" + getColor() + "]";
     }
-    
+
     protected int type = DVBBufferedImage.TYPE_BASE;
-    protected Graphics2D gfx;
 }
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBRasterFormatException.java b/src/libbluray/bdj/java/org/dvb/ui/DVBRasterFormatException.java
index f9c7779..ca17d50 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBRasterFormatException.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBRasterFormatException.java
@@ -19,11 +19,8 @@
 
 package org.dvb.ui;
 
-import java.awt.image.RasterFormatException;
-
-public class DVBRasterFormatException extends RasterFormatException {
-    public DVBRasterFormatException(String reason)
-    {
+public class DVBRasterFormatException extends Exception {
+    public DVBRasterFormatException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/DVBTextLayoutManager.java b/src/libbluray/bdj/java/org/dvb/ui/DVBTextLayoutManager.java
index 39f4529..a1c4ccf 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/DVBTextLayoutManager.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/DVBTextLayoutManager.java
@@ -25,14 +25,12 @@ import org.havi.ui.HVisible;
 
 public class DVBTextLayoutManager implements org.havi.ui.HTextLayoutManager {
 
-    public void render(String markedUpString, java.awt.Graphics g, HVisible v, Insets insets)
-    {
+    public void render(String markedUpString, java.awt.Graphics g, HVisible v, Insets insets) {
         /* this class is defined in GEM specifications */
         logger.unimplemented("render(" + markedUpString + ")");
     }
 
-    public DVBTextLayoutManager()
-    {
+    public DVBTextLayoutManager() {
         this(HORIZONTAL_START_ALIGN, VERTICAL_START_ALIGN, LINE_ORIENTATION_HORIZONTAL, START_CORNER_UPPER_LEFT, true,
              /* linespace = (point size of the default font for HVisible) + 7 */ 12 + 7,
              0, 56);
@@ -40,8 +38,7 @@ public class DVBTextLayoutManager implements org.havi.ui.HTextLayoutManager {
 
     public DVBTextLayoutManager(int horizontalAlign, int verticalAlign,
             int lineOrientation, int startCorner, boolean wrap, int linespace,
-            int letterspace, int horizontalTabSpace)
-    {
+            int letterspace, int horizontalTabSpace) {
         this.horizontalAlign = horizontalAlign;
         this.verticalAlign = verticalAlign;
         this.lineOrientation = lineOrientation;
@@ -52,103 +49,83 @@ public class DVBTextLayoutManager implements org.havi.ui.HTextLayoutManager {
         this.horizontalTabSpace = horizontalTabSpace;
     }
 
-    public void setHorizontalAlign(int horizontalAlign)
-    {
+    public void setHorizontalAlign(int horizontalAlign) {
         this.horizontalAlign = horizontalAlign;
     }
 
-    public void setVerticalAlign(int verticalAlign)
-    {
+    public void setVerticalAlign(int verticalAlign) {
         this.verticalAlign = verticalAlign;
     }
 
-    public void setLineOrientation(int lineOrientation)
-    {
+    public void setLineOrientation(int lineOrientation) {
         this.lineOrientation = lineOrientation;
     }
 
-    public void setStartCorner(int startCorner)
-    {
+    public void setStartCorner(int startCorner) {
         this.startCorner = startCorner;
     }
 
-    public void setTextWrapping(boolean wrap)
-    {
+    public void setTextWrapping(boolean wrap) {
         this.wrap = wrap;
     }
 
-    public void setLineSpace(int lineSpace)
-    {
+    public void setLineSpace(int lineSpace) {
         this.linespace = lineSpace;
     }
 
-    public void setLetterSpace(int letterSpace)
-    {
+    public void setLetterSpace(int letterSpace) {
         this.letterspace = letterSpace;
     }
 
-    public void setHorizontalTabSpacing(int horizontalTabSpace)
-    {
+    public void setHorizontalTabSpacing(int horizontalTabSpace) {
         this.horizontalTabSpace = horizontalTabSpace;
     }
 
-    public int getHorizontalAlign()
-    {
+    public int getHorizontalAlign() {
         return horizontalAlign;
     }
 
-    public int getVerticalAlign()
-    {
+    public int getVerticalAlign() {
         return verticalAlign;
     }
 
-    public int getLineOrientation()
-    {
+    public int getLineOrientation() {
         return lineOrientation;
     }
 
-    public int getStartCorner()
-    {
+    public int getStartCorner() {
         return startCorner;
     }
 
-    public boolean getTextWrapping()
-    {
+    public boolean getTextWrapping() {
         return wrap;
     }
 
-    public int getLineSpace()
-    {
+    public int getLineSpace() {
         return linespace;
     }
 
-    public int getLetterSpace()
-    {
+    public int getLetterSpace() {
         return letterspace;
     }
 
-    public int getHorizontalTabSpacing()
-    {
+    public int getHorizontalTabSpacing() {
         return horizontalTabSpace;
     }
 
-    public void setInsets(Insets insets)
-    {
+    public void setInsets(Insets insets) {
         this.insets = insets;
     }
 
-    public Insets getInsets()
-    {
+    public Insets getInsets() {
         return this.insets;
     }
 
-    public void addTextOverflowListener(TextOverflowListener listener)
-    {
+    public void addTextOverflowListener(TextOverflowListener listener) {
         logger.unimplemented("addTextOverflowListener");
     }
 
-    public void removeTextOverflowListener(TextOverflowListener listener)
-    {
+    public void removeTextOverflowListener(TextOverflowListener listener) {
         logger.unimplemented("removeTextOverflowListener");
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java b/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java
index 3b0c913..355e954 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/FontFactory.java
@@ -34,16 +34,22 @@ import org.videolan.FontIndexData;
 import org.videolan.Logger;
 
 public class FontFactory {
-    public static synchronized void loadDiscFonts() {
+    public static void loadDiscFonts() {
         unloadDiscFonts();
+
+        // fonts are loaded on demand
     }
 
-    public static synchronized void unloadDiscFonts() {
-        fonts = null;
-        fontIds = null;
+    public static void unloadDiscFonts() {
+        synchronized (fontsLock) {
+            fonts = null;
+            fontIds = null;
+        }
     }
 
-    private static synchronized void readDiscFonts() throws FontFormatException, IOException {
+    private static void readDiscFonts() throws FontFormatException, IOException {
+        synchronized (fontsLock) {
+
         if (fonts != null)
             return;
 
@@ -57,6 +63,7 @@ public class FontFactory {
             try {
                 File fontFile = org.videolan.BDJLoader.addFont(data.getFileName());
                 if (fontFile == null) {
+                    logger.error("error caching font");
                     throw new IOException("error caching font");
                 }
 
@@ -84,7 +91,7 @@ public class FontFactory {
                 }
             }
         }
-
+        }
     }
 
     public FontFactory() throws FontFormatException, IOException {
@@ -99,6 +106,7 @@ public class FontFactory {
 
             File fontFile = org.videolan.BDJLoader.addFont(inStream);
             if (fontFile == null) {
+                logger.error("error caching font");
                 throw new IOException("error caching font");
             }
 
@@ -118,10 +126,15 @@ public class FontFactory {
         }
     }
 
+    // used by root window / .bdjo default font
     public Font createFont(String fontId) {
         Font font = null;
-        synchronized (FontFactory.class) {
-            font = (Font)fontIds.get(fontId);
+        synchronized (fontsLock) {
+            if (fontIds == null) {
+                logger.error("no disc fonts loaded");
+            } else {
+                font = (Font)fontIds.get(fontId);
+            }
         }
         if (font != null) {
             return font.deriveFont(0, 12);
@@ -134,6 +147,7 @@ public class FontFactory {
         logger.info("Creating font: " + name + " " + style + " " + size);
 
         if (style < 0 || size <= 0 || (style & ~3) != 0) {
+            logger.error("invalid font size / style");
             throw new IllegalArgumentException();
         }
 
@@ -148,8 +162,9 @@ public class FontFactory {
 
         /* Factory created for fonts in dvb.fontindex */
         Font font = null;
-        synchronized (FontFactory.class) {
-            font = (Font)fonts.get(name + "." + style);
+        synchronized (fontsLock) {
+            if (fonts != null)
+                font = (Font)fonts.get(name + "." + style);
         }
 
         if (font == null) {
@@ -162,6 +177,8 @@ public class FontFactory {
 
     private Font urlFont = null;
 
+    private static final Object fontsLock = new Object();
+
     private static Map fonts = null;
     private static Map fontIds = null;
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/FontFormatException.java b/src/libbluray/bdj/java/org/dvb/ui/FontFormatException.java
index 0a947e2..43728a7 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/FontFormatException.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/FontFormatException.java
@@ -20,13 +20,11 @@
 package org.dvb.ui;
 
 public class FontFormatException extends Exception {
-    public FontFormatException()
-    {
+    public FontFormatException() {
         super();
     }
 
-    public FontFormatException(String reason)
-    {
+    public FontFormatException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/FontNotAvailableException.java b/src/libbluray/bdj/java/org/dvb/ui/FontNotAvailableException.java
index 95a3bb9..226b5a2 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/FontNotAvailableException.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/FontNotAvailableException.java
@@ -20,13 +20,11 @@
 package org.dvb.ui;
 
 public class FontNotAvailableException extends Exception {
-    public FontNotAvailableException()
-    {
+    public FontNotAvailableException() {
         super();
     }
 
-    public FontNotAvailableException(String reason)
-    {
+    public FontNotAvailableException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/TestOpacity.java b/src/libbluray/bdj/java/org/dvb/ui/TestOpacity.java
index 32e8984..b2f5b8f 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/TestOpacity.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/TestOpacity.java
@@ -20,7 +20,7 @@
 package org.dvb.ui;
 
 public interface TestOpacity {
-	public boolean isOpaque();
+    public boolean isOpaque();
 }
 
 
diff --git a/src/libbluray/bdj/java/org/dvb/ui/UnsupportedDrawingOperationException.java b/src/libbluray/bdj/java/org/dvb/ui/UnsupportedDrawingOperationException.java
index ee0b4a8..6d6b05c 100644
--- a/src/libbluray/bdj/java/org/dvb/ui/UnsupportedDrawingOperationException.java
+++ b/src/libbluray/bdj/java/org/dvb/ui/UnsupportedDrawingOperationException.java
@@ -20,8 +20,7 @@
 package org.dvb.ui;
 
 public class UnsupportedDrawingOperationException extends Exception {
-    public UnsupportedDrawingOperationException(String reason)
-    {
+    public UnsupportedDrawingOperationException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/dvb/user/Preference.java b/src/libbluray/bdj/java/org/dvb/user/Preference.java
index 99e49a9..e80c002 100644
--- a/src/libbluray/bdj/java/org/dvb/user/Preference.java
+++ b/src/libbluray/bdj/java/org/dvb/user/Preference.java
@@ -24,7 +24,6 @@ import java.util.Vector;
 
 public class Preference {
     protected Preference() {
-
     }
 
     public Preference(String name, String value) {
diff --git a/src/libbluray/bdj/java/org/dvb/user/UserPreferenceManager.java b/src/libbluray/bdj/java/org/dvb/user/UserPreferenceManager.java
index af86b4e..1367d1d 100644
--- a/src/libbluray/bdj/java/org/dvb/user/UserPreferenceManager.java
+++ b/src/libbluray/bdj/java/org/dvb/user/UserPreferenceManager.java
@@ -27,8 +27,10 @@ public class UserPreferenceManager {
     private UserPreferenceManager() {
     }
 
+    private static final Object instanceLock = new Object();
+
     public static UserPreferenceManager getInstance() {
-        synchronized (UserPreferenceManager.class) {
+        synchronized (instanceLock) {
             if (instance == null)
                 instance = new UserPreferenceManager();
             return instance;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HActionInputPreferred.java b/src/libbluray/bdj/java/org/havi/ui/HActionInputPreferred.java
index a745750..40afdbe 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HActionInputPreferred.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HActionInputPreferred.java
@@ -21,8 +21,7 @@ package org.havi.ui;
 
 import org.havi.ui.event.HActionEvent;
 
-public interface HActionInputPreferred 
-{
+public interface HActionInputPreferred {
     public void processHActionEvent(HActionEvent event);
 
     public String getActionCommand();
diff --git a/src/libbluray/bdj/java/org/havi/ui/HAnimateLook.java b/src/libbluray/bdj/java/org/havi/ui/HAnimateLook.java
index ee04b89..fc113c1 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HAnimateLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HAnimateLook.java
@@ -21,60 +21,59 @@ package org.havi.ui;
 
 import java.awt.Graphics;
 import java.awt.Dimension;
+import java.awt.Insets;
+
+import org.videolan.Logger;
 
 public class HAnimateLook implements HExtendedLook {
-    public HAnimateLook()
-    {
-        org.videolan.Logger.unimplemented(HAnimateLook.class.getName(), "");
+    public HAnimateLook() {
+        logger.unimplemented("");
     }
 
-    public void fillBackground(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void fillBackground(Graphics g, HVisible visible, int state) {
+        logger.unimplemented("");
     }
 
-    public void renderBorders(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderBorders(Graphics g, HVisible visible, int state) {
+        logger.unimplemented("");
     }
 
-    public void renderVisible(java.awt.Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderVisible(Graphics g, HVisible visible, int state) {
+        logger.unimplemented("renderVisible");
     }
 
-    public void showLook(java.awt.Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void showLook(Graphics g, HVisible visible, int state) {
+        logger.unimplemented("renderVisible");
     }
 
-    public void widgetChanged(HVisible visible, HChangeData[] changes)
-    {
-        throw new Error("Not implemented");
+    public void widgetChanged(HVisible visible, HChangeData[] changes) {
+        logger.unimplemented("renderVisible");
     }
 
-    public Dimension getMinimumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMinimumSize(HVisible hvisible) {
+        logger.unimplemented("getMinimumSize");
+        return hvisible.getSize();
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getPreferredSize(HVisible hvisible) {
+        logger.unimplemented("getPreferredSize");
+        return hvisible.getSize();
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMaximumSize(HVisible hvisible) {
+        logger.unimplemented("getMaximumSize");
+        return hvisible.getSize();
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public boolean isOpaque(HVisible visible) {
+        logger.unimplemented("getMaximumSize");
+        return false;
     }
 
-    public java.awt.Insets getInsets(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Insets getInsets(HVisible hvisible) {
+        logger.unimplemented("getMaximumSize");
+        return new Insets(0, 0, 0, 0);
     }
+
+    private static final Logger logger = Logger.getLogger(HAnimateLook.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HAnimation.java b/src/libbluray/bdj/java/org/havi/ui/HAnimation.java
index fc7fb36..5e7da31 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HAnimation.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HAnimation.java
@@ -23,109 +23,102 @@ import java.awt.Image;
 import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
+import org.videolan.Logger;
+
 public class HAnimation extends HStaticAnimation implements HNavigable {
-    public HAnimation()
-    {
-        org.videolan.Logger.unimplemented(HAnimation.class.getName(), "");
+    public HAnimation() {
+        this(null, 1, 1, -1);
     }
 
-    public HAnimation(Image[] images, int delay, int playMode, int repeatCount,
-            int x, int y, int width, int height)
-    {
-        org.videolan.Logger.unimplemented(HAnimation.class.getName(), "");
+    public HAnimation(Image[] images, int delay, int playMode, int repeatCount) {
+        this(images, null, delay, playMode, repeatCount, 0, 0, 0, 0);
     }
 
-    public HAnimation(Image[] imagesNormal, Image[] imagesFocused, int delay,
-            int playMode, int repeatCount, int x, int y, int width, int height)
-    {
-        org.videolan.Logger.unimplemented(HAnimation.class.getName(), "");
+    public HAnimation(Image[] images, int delay, int playMode, int repeatCount,
+                      int x, int y, int width, int height) {
+        this(images, null, delay, playMode, repeatCount, x, y, width, height);
     }
 
-    public HAnimation(Image[] images, int delay, int playMode, int repeatCount)
-    {
-        org.videolan.Logger.unimplemented(HAnimation.class.getName(), "");
+    public HAnimation(Image[] imagesNormal, Image[] imagesFocused, int delay,
+                      int playMode, int repeatCount) {
+        this(imagesNormal, imagesFocused, delay, playMode, repeatCount, 0, 0, 0, 0);
     }
 
     public HAnimation(Image[] imagesNormal, Image[] imagesFocused, int delay,
-            int playMode, int repeatCount)
-    {
-        org.videolan.Logger.unimplemented(HAnimation.class.getName(), "");
+            int playMode, int repeatCount, int x, int y, int width, int height) {
+
+        super(imagesNormal, delay, playMode, repeatCount, x, y, width, height);
+
+        logger.unimplemented("");
     }
 
-    public static void setDefaultLook(HAnimateLook hlook)
-    {
+    public static void setDefaultLook(HAnimateLook hlook) {
         DefaultLook = hlook;
     }
 
-    public static HAnimateLook getDefaultLook()
-    {
+    public static HAnimateLook getDefaultLook() {
         if (DefaultLook == null)
-            org.videolan.Logger.unimplemented("", "getDefaultLook");
+            logger.unimplemented("getDefaultLook");
         return DefaultLook;
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        logger.unimplemented("setMove");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        logger.unimplemented("getMove");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        logger.unimplemented("setFocusTravelsal");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        logger.unimplemented("");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        logger.unimplemented("");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        logger.unimplemented("");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        logger.unimplemented("");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        logger.unimplemented("");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener listener)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener listener) {
+        logger.unimplemented("");
     }
 
-    public void removeHFocusListener(HFocusListener listener)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener listener) {
+        logger.unimplemented("");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        logger.unimplemented("");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent event)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent event) {
+        logger.unimplemented("");
     }
 
     private static HAnimateLook DefaultLook = null;
 
+    private static final Logger logger = Logger.getLogger(HAnimation.class.getName());
+
     private static final long serialVersionUID = 4460392782940525395L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HBackgroundConfiguration.java b/src/libbluray/bdj/java/org/havi/ui/HBackgroundConfiguration.java
index d063731..c16ce2d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HBackgroundConfiguration.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HBackgroundConfiguration.java
@@ -23,7 +23,6 @@ import java.awt.Color;
 
 public class HBackgroundConfiguration extends HScreenConfiguration {
     protected HBackgroundConfiguration() {
-
     }
 
     protected HBackgroundConfiguration(HBackgroundConfigTemplate hbct, Color color) {
diff --git a/src/libbluray/bdj/java/org/havi/ui/HBackgroundDevice.java b/src/libbluray/bdj/java/org/havi/ui/HBackgroundDevice.java
index e932560..a4e1ee2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HBackgroundDevice.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HBackgroundDevice.java
@@ -53,7 +53,7 @@ public class HBackgroundDevice extends HScreenDevice {
     public HBackgroundConfiguration getBestConfiguration(HBackgroundConfigTemplate hbcta[]) {
         int score = -1;
         HBackgroundConfiguration hbc = null;
-        for (int i = 0; i < hbcArray.length; i++) 
+        for (int i = 0; i < hbcArray.length; i++)
             for (int j = 0; j < hbcta.length; j++)
                 if (hbcta[j].match(hbcArray[i]) > score)
                     hbc = hbcArray[i];
diff --git a/src/libbluray/bdj/java/org/havi/ui/HBackgroundImage.java b/src/libbluray/bdj/java/org/havi/ui/HBackgroundImage.java
index 4b145f9..125fa93 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HBackgroundImage.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HBackgroundImage.java
@@ -40,6 +40,10 @@ public class HBackgroundImage implements ImageObserver {
     }
 
     public HBackgroundImage(byte pixels[]) {
+        if (pixels == null) {
+            System.err.println("null pixels from " + org.videolan.Logger.dumpStack());
+            return;
+        }
         producer = new ByteArrayImageSource(pixels);
         img = Toolkit.getDefaultToolkit().createImage(producer);
     }
@@ -100,7 +104,7 @@ public class HBackgroundImage implements ImageObserver {
         }
         for (int i = 0; i < list.size(); i++) {
             HBackgroundImageListener listener = (HBackgroundImageListener)list.get(i);
-            if (event.getID()== HBackgroundImageEvent.BACKGROUNDIMAGE_LOADED)
+            if (event.getID() == HBackgroundImageEvent.BACKGROUNDIMAGE_LOADED)
                 listener.imageLoaded(event);
             else
                 listener.imageLoadFailed(event);
diff --git a/src/libbluray/bdj/java/org/havi/ui/HChangeData.java b/src/libbluray/bdj/java/org/havi/ui/HChangeData.java
index 4b7410e..562ddb2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HChangeData.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HChangeData.java
@@ -19,14 +19,13 @@
 
 package org.havi.ui;
 
-public class HChangeData
-{
-    public HChangeData(int hint, Object data)
-    {
+public class HChangeData {
+
+    public HChangeData(int hint, Object data) {
         this.hint = hint;
         this.data = data;
     }
-    
+
     public int hint;
     public Object data;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HComponent.java b/src/libbluray/bdj/java/org/havi/ui/HComponent.java
index c853952..8f06402 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HComponent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HComponent.java
@@ -26,41 +26,34 @@ import org.dvb.ui.TestOpacity;
 
 import java.awt.BDToolkit;
 
-public abstract class HComponent extends Component implements HMatteLayer,
-        TestOpacity {
-    public HComponent()
-    {
+public abstract class HComponent extends Component implements HMatteLayer, TestOpacity {
+
+    public HComponent() {
         this(0, 0, 0, 0);
         BDToolkit.addComponent(this);
     }
 
-    public HComponent(int x, int y, int width, int height)
-    {
+    public HComponent(int x, int y, int width, int height) {
         setBounds(x, y, width, height);
     }
 
-    public void setMatte(HMatte m) throws HMatteException
-    {
+    public void setMatte(HMatte m) throws HMatteException {
         matte = m;
     }
 
-    public HMatte getMatte()
-    {
+    public HMatte getMatte() {
         return matte;
     }
 
-    public boolean isDoubleBuffered()
-    {
+    public boolean isDoubleBuffered() {
         return false;
     }
 
-    public boolean isOpaque()
-    {
+    public boolean isOpaque() {
         return false;
     }
 
-    public void setEnabled(boolean b)
-    {
+    public void setEnabled(boolean b) {
         if (b != super.isEnabled()) {
             super.setEnabled(b);
             super.setFocusable(b);
@@ -68,13 +61,11 @@ public abstract class HComponent extends Component implements HMatteLayer,
         }
     }
 
-    public boolean isEnabled()
-    {
+    public boolean isEnabled() {
         return super.isEnabled();
     }
 
-    protected void processEvent(AWTEvent event)
-    {
+    protected void processEvent(AWTEvent event) {
         org.videolan.Logger.unimplemented(HComponent.class.getName(), "processEvent");
 
         super.processEvent(event);
diff --git a/src/libbluray/bdj/java/org/havi/ui/HConfigurationException.java b/src/libbluray/bdj/java/org/havi/ui/HConfigurationException.java
index 659fd62..826ae3e 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HConfigurationException.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HConfigurationException.java
@@ -20,13 +20,11 @@
 package org.havi.ui;
 
 public class HConfigurationException extends java.lang.Exception {
-    public HConfigurationException()
-    {
+    public HConfigurationException() {
         super();
     }
 
-    public HConfigurationException(String reason)
-    {
+    public HConfigurationException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HContainer.java b/src/libbluray/bdj/java/org/havi/ui/HContainer.java
index 4dc147f..d8f2dd9 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HContainer.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HContainer.java
@@ -27,39 +27,32 @@ import org.dvb.ui.TestOpacity;
 
 public class HContainer extends Container implements HMatteLayer,
         HComponentOrdering, TestOpacity {
-    public HContainer()
-    {
+    public HContainer() {
         this(0,0,0,0);
     }
 
-    public HContainer(int x, int y, int width, int height)
-    {
+    public HContainer(int x, int y, int width, int height) {
         setBounds(x,y,width,height);
     }
 
-    public void setMatte(HMatte m) throws HMatteException
-    {
+    public void setMatte(HMatte m) throws HMatteException {
         org.videolan.Logger.unimplemented("HContainer", "setMatte");
         throw new HMatteException("Matte is not supported");
     }
 
-    public HMatte getMatte()
-    {
-        return hMatte;
+    public HMatte getMatte() {
+        return null;
     }
 
-    public boolean isDoubleBuffered()
-    {
+    public boolean isDoubleBuffered() {
         return false;   // can this be true ?
     }
 
-    public boolean isOpaque()
-    {
+    public boolean isOpaque() {
         return false;   // can this be true ?
     }
 
-    private int getOffset(java.awt.Component c) throws ArrayIndexOutOfBoundsException
-    {
+    private int getOffset(java.awt.Component c) throws ArrayIndexOutOfBoundsException {
         Component cs[] = getComponents();
         for (int i = 0; i < cs.length; ++i)
             if (cs[i] == c) return i;
@@ -67,28 +60,21 @@ public class HContainer extends Container implements HMatteLayer,
         throw new ArrayIndexOutOfBoundsException("Component not contained within");
     }
 
-    private void checkLineage(java.awt.Component c)
-    {
+    private void checkLineage(java.awt.Component c) {
         if (c.getParent() != this) throw new ArrayIndexOutOfBoundsException("Component not contained within");
     }
 
-    public Component addBefore(Component component, Component behind)
-    {
+    public Component addBefore(Component component, Component behind) {
         // check to see if behind is an element of this container
-        try
-        {
+        try {
             getOffset(behind);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return null;
         }
 
         if (component == behind) return component;
-        synchronized (getTreeLock())
-        {
-            try
-            {
+        synchronized (getTreeLock()) {
+            try {
                 // Explicitly remove component if in this container.
                 // Should have no effect if not in this container.
                 // This must be done so that problems don't occur
@@ -98,31 +84,23 @@ public class HContainer extends Container implements HMatteLayer,
                 int offset = getOffset(behind);
 
                 return add(component, offset);
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 return null;
             }
         }
     }
 
-    public Component addAfter(Component component, Component front)
-    {
+    public Component addAfter(Component component, Component front) {
         // check to see if front is an element of this container
-        try
-        {
+        try {
             getOffset(front);
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             return null;
         }
 
         if (component == front) return component;
-        synchronized (getTreeLock())
-        {
-            try
-            {
+        synchronized (getTreeLock()) {
+            try {
                 // Explicitly remove component if in this container.
                 // Should have no effect if not in this container.
                 // This must be done so that problems don't occur
@@ -132,20 +110,15 @@ public class HContainer extends Container implements HMatteLayer,
                 int offset = getOffset(front);
 
                 return add(component, offset + 1);
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 return null;
             }
         }
     }
 
-    public boolean popToFront(Component component)
-    {
-        synchronized (getTreeLock())
-        {
-            try
-            {
+    public boolean popToFront(Component component) {
+        synchronized (getTreeLock()) {
+            try {
                 // Ensure it is there
                 checkLineage(component);
 
@@ -154,20 +127,15 @@ public class HContainer extends Container implements HMatteLayer,
                 remove(component);
                 add(component, 0);
                 return true;
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 return false;
             }
         }
     }
 
-    public boolean pushToBack(Component component)
-    {
-        synchronized (getTreeLock())
-        {
-            try
-            {
+    public boolean pushToBack(Component component) {
+        synchronized (getTreeLock()) {
+            try {
                 // Ensure it is there
                 checkLineage(component);
 
@@ -176,77 +144,58 @@ public class HContainer extends Container implements HMatteLayer,
                 remove(component);
                 add(component, -1);
                 return true;
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 return false;
             }
         }
     }
 
-    public boolean pop(Component component)
-    {
-        synchronized (getTreeLock())
-        {
-            try
-            {
+    public boolean pop(Component component) {
+        synchronized (getTreeLock()) {
+            try {
                 int offset = getOffset(component);
 
-                if (offset > 0)
-                {
+                if (offset > 0) {
                     // explicitly remove component
                     // (even if reparenting is implicit)
                     remove(component);
                     add(component, offset - 1);
                     return true;
                 }
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
             }
             return false;
         }
     }
 
-    public boolean push(Component component)
-    {
-        synchronized (getTreeLock())
-        {
-            try
-            {
+    public boolean push(Component component) {
+        synchronized (getTreeLock()) {
+            try {
                 int offset = getOffset(component);
                 int count = getComponentCount();
 
-                if (offset == (count - 1))
-                {
+                if (offset == (count - 1)) {
                     return true;
                 }
 
-                if (offset < (count - 1))
-                {
+                if (offset < (count - 1)) {
                     // explicitly remove component
                     // (even if reparenting is implicit)
                     remove(component);
                     add(component, offset + 1);
                     return true;
                 }
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
             }
 
             return false;
         }
     }
 
-    public boolean popInFrontOf(Component move, Component behind)
-    {
-        synchronized (getTreeLock())
-        {
-            try
-            {
-                if (move != behind)
-                {
+    public boolean popInFrontOf(Component move, Component behind) {
+        synchronized (getTreeLock()) {
+            try {
+                if (move != behind) {
                     // Ensure they are present
                     checkLineage(move);
                     checkLineage(behind);
@@ -258,22 +207,16 @@ public class HContainer extends Container implements HMatteLayer,
                     addBefore(move, behind);
                 }
                 return true;
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 return false;
             }
         }
     }
 
-    public boolean pushBehind(Component move, Component front)
-    {
-        synchronized (getTreeLock())
-        {
-            try
-            {
-                if (move != front)
-                {
+    public boolean pushBehind(Component move, Component front) {
+        synchronized (getTreeLock()) {
+            try {
+                if (move != front) {
                     // Ensure they are present
                     checkLineage(move);
                     checkLineage(front);
@@ -285,30 +228,24 @@ public class HContainer extends Container implements HMatteLayer,
                     addAfter(move, front);
                 }
                 return true;
-            }
-            catch (Exception e)
-            {
+            } catch (Exception e) {
                 return false;
             }
         }
     }
 
-    public void group()
-    {
+    public void group() {
         grouped = true;
     }
 
-    public void ungroup()
-    {
+    public void ungroup() {
         grouped = false;
     }
 
-    public boolean isGrouped()
-    {
+    public boolean isGrouped() {
        return grouped;
     }
 
-    private HMatte hMatte = null;
     private boolean grouped = false;
 
     private static final long serialVersionUID = 263606166411114032L;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HDefaultTextLayoutManager.java b/src/libbluray/bdj/java/org/havi/ui/HDefaultTextLayoutManager.java
index 54b2bbc..4ab9201 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HDefaultTextLayoutManager.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HDefaultTextLayoutManager.java
@@ -31,8 +31,7 @@ import org.videolan.StrUtil;
 public class HDefaultTextLayoutManager implements HTextLayoutManager {
     static final Insets ZERO_INSETS = new Insets(0, 0, 0, 0);
 
-    public HDefaultTextLayoutManager()
-    {
+    public HDefaultTextLayoutManager() {
     }
 
     public Dimension getMinimumSize(HVisible hvisible)
@@ -67,18 +66,15 @@ public class HDefaultTextLayoutManager implements HTextLayoutManager {
         return size;
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
+    public Dimension getMaximumSize(HVisible hvisible) {
         return new Dimension(Short.MAX_VALUE, Short.MAX_VALUE);
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
+    public Dimension getPreferredSize(HVisible hvisible) {
         return getMinimumSize(hvisible);
     }
 
-    public void render(String markedUpString, Graphics g, HVisible v, Insets insets)
-    {
+    public void render(String markedUpString, Graphics g, HVisible v, Insets insets) {
         if (markedUpString == null)
             return;
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsConfiguration.java b/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsConfiguration.java
index c4f8bed..ccabbc0 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsConfiguration.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsConfiguration.java
@@ -20,25 +20,21 @@
 package org.havi.ui;
 
 public class HEmulatedGraphicsConfiguration extends HGraphicsConfiguration {
-    protected HEmulatedGraphicsConfiguration()
-    {
+    protected HEmulatedGraphicsConfiguration() {
         org.videolan.Logger.unimplemented(null, "HEmulatedGraphicsConfiguration");
     }
 
-    public HGraphicsConfigTemplate getConfigTemplate()
-    {
+    public HGraphicsConfigTemplate getConfigTemplate() {
         org.videolan.Logger.unimplemented("HEmulatedGraphicsConfiguration", "getConfigTemplate");
         return null;
     }
 
-    public HGraphicsConfigTemplate getEmulation()
-    {
+    public HGraphicsConfigTemplate getEmulation() {
         org.videolan.Logger.unimplemented("HEmulatedGraphicsConfiguration", "getEmulation");
         return null;
     }
 
-    public HGraphicsConfigTemplate getImplementation()
-    {
+    public HGraphicsConfigTemplate getImplementation() {
         org.videolan.Logger.unimplemented("HEmulatedGraphicsConfiguration", "getImplementation");
         return null;
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsDevice.java b/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsDevice.java
index 1f7b3b2..6f282d8 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsDevice.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HEmulatedGraphicsDevice.java
@@ -20,15 +20,13 @@
 package org.havi.ui;
 
 public abstract class HEmulatedGraphicsDevice extends HGraphicsDevice {
-    protected HEmulatedGraphicsDevice()
-    {
+    protected HEmulatedGraphicsDevice() {
         org.videolan.Logger.unimplemented(null, "HEmulatedGraphicsDevice");
     }
 
     public boolean setGraphicsConfiguration(HEmulatedGraphicsConfiguration hegc)
             throws SecurityException, HPermissionDeniedException,
-            HConfigurationException
-    {
+            HConfigurationException {
         org.videolan.Logger.unimplemented("HEmulatedGraphicsDevice", "setGraphicsConfiguration");
         return false;
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HEventMulticaster.java b/src/libbluray/bdj/java/org/havi/ui/HEventMulticaster.java
index 4cfec9c..9bb5651 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HEventMulticaster.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HEventMulticaster.java
@@ -49,17 +49,15 @@ public class HEventMulticaster implements HBackgroundImageListener,
         HItemListener, HTextListener, HKeyListener, ResourceStatusListener {
 
 
-    protected HEventMulticaster(EventListener a, EventListener b)
-    {
+    protected HEventMulticaster(EventListener a, EventListener b) {
         this.a = a;
         this.b = b;
     }
 
-    protected EventListener remove(EventListener oldListener)
-    {
-        if (oldListener == a) 
+    protected EventListener remove(EventListener oldListener) {
+        if (oldListener == a)
             return b;
-        else if (oldListener == b) 
+        else if (oldListener == b)
             return a;
         EventListener a2 = removeInternal(a, oldListener);
         EventListener b2 = removeInternal(b, oldListener);
@@ -69,8 +67,7 @@ public class HEventMulticaster implements HBackgroundImageListener,
             return addInternal(a2, b2);
     }
 
-    protected static EventListener addInternal(EventListener a, EventListener b)
-    {
+    protected static EventListener addInternal(EventListener a, EventListener b) {
         if (a == null)
             return b;
         else if (b == null)
@@ -80,8 +77,7 @@ public class HEventMulticaster implements HBackgroundImageListener,
     }
 
     protected static EventListener removeInternal(EventListener listener,
-            EventListener oldListener)
-    {
+            EventListener oldListener) {
         if (listener == null || listener.equals(oldListener))
             return null;
         else if (listener instanceof HEventMulticaster)
@@ -91,26 +87,22 @@ public class HEventMulticaster implements HBackgroundImageListener,
     }
 
     public static HBackgroundImageListener add(HBackgroundImageListener a,
-            HBackgroundImageListener b)
-    {
+            HBackgroundImageListener b) {
         return (HBackgroundImageListener) addInternal(a, b);
     }
 
     public static HBackgroundImageListener remove(
             HBackgroundImageListener listener,
-            HBackgroundImageListener oldListener)
-    {
+            HBackgroundImageListener oldListener) {
         return (HBackgroundImageListener) removeInternal(listener, oldListener);
     }
 
-    public static WindowListener add(WindowListener a, WindowListener b)
-    {
+    public static WindowListener add(WindowListener a, WindowListener b) {
         return (WindowListener) addInternal(a, b);
     }
 
     public static WindowListener remove(WindowListener listener,
-            WindowListener oldListener)
-    {
+            WindowListener oldListener) {
         return (WindowListener) removeInternal(listener, oldListener);
     }
 
@@ -122,247 +114,205 @@ public class HEventMulticaster implements HBackgroundImageListener,
 
     public static HScreenConfigurationListener add(
             HScreenConfigurationListener a, HScreenConfigurationListener b,
-            HScreenConfigTemplate template)
-    {
-        
+            HScreenConfigTemplate template) {
         return (HScreenConfigurationListener) addInternal(a, b);
     }
 
     public static HScreenConfigurationListener remove(
             HScreenConfigurationListener listener,
-            HScreenConfigurationListener oldListener)
-    {
+            HScreenConfigurationListener oldListener) {
         return (HScreenConfigurationListener) removeInternal(listener,
                 oldListener);
     }
 
     public static HScreenLocationModifiedListener add(
-            HScreenLocationModifiedListener a, HScreenLocationModifiedListener b)
-    {
+            HScreenLocationModifiedListener a, HScreenLocationModifiedListener b) {
         return (HScreenLocationModifiedListener) addInternal(a, b);
     }
 
     public static HScreenLocationModifiedListener remove(
             HScreenLocationModifiedListener listener,
-            HScreenLocationModifiedListener oldListener)
-    {
+            HScreenLocationModifiedListener oldListener) {
         return (HScreenLocationModifiedListener) removeInternal(listener,
                 oldListener);
     }
 
-    public static HTextListener add(HTextListener a, HTextListener b)
-    {
+    public static HTextListener add(HTextListener a, HTextListener b) {
         return (HTextListener) addInternal(a, b);
     }
 
     public static HTextListener remove(HTextListener listener,
-            HTextListener oldListener)
-    {
+            HTextListener oldListener) {
         return (HTextListener) removeInternal(listener, oldListener);
     }
 
-    public static HItemListener add(HItemListener a, HItemListener b)
-    {
+    public static HItemListener add(HItemListener a, HItemListener b) {
         return (HItemListener) addInternal(a, b);
     }
 
     public static HItemListener remove(HItemListener listener,
-            HItemListener oldListener)
-    {
+            HItemListener oldListener) {
         return (HItemListener) removeInternal(listener, oldListener);
     }
 
-    public static HFocusListener add(HFocusListener a, HFocusListener b)
-    {
+    public static HFocusListener add(HFocusListener a, HFocusListener b) {
         return (HFocusListener) addInternal(a, b);
     }
 
     public static HFocusListener remove(HFocusListener listener,
-            HFocusListener oldListener)
-    {
+            HFocusListener oldListener) {
         return (HFocusListener) removeInternal(listener, oldListener);
     }
 
     public static HAdjustmentListener add(HAdjustmentListener a,
-            HAdjustmentListener b)
-    {
+            HAdjustmentListener b) {
         return (HAdjustmentListener) addInternal(a, b);
     }
 
     public static HAdjustmentListener remove(HAdjustmentListener listener,
-            HAdjustmentListener oldListener)
-    {
+            HAdjustmentListener oldListener) {
         return (HAdjustmentListener) removeInternal(listener, oldListener);
     }
 
-    public static HActionListener add(HActionListener a, HActionListener b)
-    {
+    public static HActionListener add(HActionListener a, HActionListener b) {
         return (HActionListener) addInternal(a, b);
     }
 
     public static HActionListener remove(HActionListener listener,
-            HActionListener oldListener)
-    {
+            HActionListener oldListener) {
         return (HActionListener) removeInternal(listener, oldListener);
     }
 
-    public static HKeyListener add(HKeyListener a, HKeyListener b)
-    {
+    public static HKeyListener add(HKeyListener a, HKeyListener b) {
         return (HKeyListener) addInternal(a, b);
     }
 
     public static HKeyListener remove(HKeyListener listener,
-            HKeyListener oldListener)
-    {
+            HKeyListener oldListener) {
         return (HKeyListener) removeInternal(listener, oldListener);
     }
 
     public static ResourceStatusListener add(ResourceStatusListener a,
-            ResourceStatusListener b)
-    {
+            ResourceStatusListener b) {
         return (ResourceStatusListener) addInternal(a, b);
     }
 
     public static ResourceStatusListener remove(
-            ResourceStatusListener listener, ResourceStatusListener oldListener)
-    {
+            ResourceStatusListener listener, ResourceStatusListener oldListener) {
         return (ResourceStatusListener) removeInternal(listener, oldListener);
     }
 
-    public void imageLoaded(HBackgroundImageEvent event)
-    {
+    public void imageLoaded(HBackgroundImageEvent event) {
         if (a != null) ((HBackgroundImageListener)a).imageLoaded(event);
         if (b != null) ((HBackgroundImageListener)b).imageLoaded(event);
     }
 
-    public void imageLoadFailed(HBackgroundImageEvent event)
-    {
+    public void imageLoadFailed(HBackgroundImageEvent event) {
         if (a != null) ((HBackgroundImageListener)a).imageLoadFailed(event);
         if (b != null) ((HBackgroundImageListener)b).imageLoadFailed(event);
     }
 
-    public void report(HScreenConfigurationEvent event)
-    {
+    public void report(HScreenConfigurationEvent event) {
         if (a != null) ((HScreenConfigurationListener)a).report(event);
         if (b != null) ((HScreenConfigurationListener)b).report(event);
     }
 
-    public void report(HScreenLocationModifiedEvent event)
-    {
+    public void report(HScreenLocationModifiedEvent event) {
         if (a != null) ((HScreenLocationModifiedListener)a).report(event);
         if (b != null) ((HScreenLocationModifiedListener)b).report(event);
     }
 
-    public void windowOpened(WindowEvent event)
-    {
+    public void windowOpened(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowOpened(event);
         if (b != null) ((WindowListener)b).windowOpened(event);
     }
 
-    public void windowClosing(WindowEvent event)
-    {
+    public void windowClosing(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowClosing(event);
         if (b != null) ((WindowListener)b).windowClosing(event);
     }
 
-    public void windowClosed(WindowEvent event)
-    {
+    public void windowClosed(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowClosed(event);
         if (b != null) ((WindowListener)b).windowClosed(event);
     }
 
-    public void windowIconified(WindowEvent event)
-    {
+    public void windowIconified(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowIconified(event);
         if (b != null) ((WindowListener)b).windowIconified(event);
     }
 
-    public void windowDeiconified(WindowEvent event)
-    {
+    public void windowDeiconified(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowDeiconified(event);
         if (b != null) ((WindowListener)b).windowDeiconified(event);
     }
 
-    public void windowActivated(WindowEvent event)
-    {
+    public void windowActivated(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowActivated(event);
         if (b != null) ((WindowListener)b).windowActivated(event);
     }
 
-    public void windowDeactivated(WindowEvent event)
-    {
+    public void windowDeactivated(WindowEvent event) {
         if (a != null) ((WindowListener)a).windowDeactivated(event);
         if (b != null) ((WindowListener)b).windowDeactivated(event);
     }
 
-    public void actionPerformed(ActionEvent event)
-    {
+    public void actionPerformed(ActionEvent event) {
         if (a != null) ((HActionListener)a).actionPerformed(event);
         if (b != null) ((HActionListener)b).actionPerformed(event);
     }
 
-    public void focusLost(FocusEvent event)
-    {
+    public void focusLost(FocusEvent event) {
         if (a != null) ((HFocusListener)a).focusLost(event);
         if (b != null) ((HFocusListener)b).focusLost(event);
     }
 
-    public void focusGained(FocusEvent event)
-    {
+    public void focusGained(FocusEvent event) {
         if (a != null) ((HFocusListener)a).focusGained(event);
         if (b != null) ((HFocusListener)b).focusGained(event);
     }
 
-    public void valueChanged(HAdjustmentEvent event)
-    {
+    public void valueChanged(HAdjustmentEvent event) {
         if (a != null) ((HAdjustmentListener)a).valueChanged(event);
         if (b != null) ((HAdjustmentListener)b).valueChanged(event);
     }
 
-    public void selectionChanged(HItemEvent event)
-    {
+    public void selectionChanged(HItemEvent event) {
         if (a != null) ((HItemListener)a).selectionChanged(event);
         if (b != null) ((HItemListener)b).selectionChanged(event);
     }
 
-    public void currentItemChanged(HItemEvent event)
-    {
+    public void currentItemChanged(HItemEvent event) {
         if (a != null) ((HItemListener)a).currentItemChanged(event);
         if (b != null) ((HItemListener)b).currentItemChanged(event);
     }
 
-    public void textChanged(HTextEvent event)
-    {
+    public void textChanged(HTextEvent event) {
         if (a != null) ((HTextListener)a).textChanged(event);
         if (b != null) ((HTextListener)b).textChanged(event);
     }
 
-    public void caretMoved(HTextEvent event)
-    {
+    public void caretMoved(HTextEvent event) {
         if (a != null) ((HTextListener)a).caretMoved(event);
         if (b != null) ((HTextListener)b).caretMoved(event);
     }
 
-    public void keyTyped(KeyEvent event)
-    {
+    public void keyTyped(KeyEvent event) {
         if (a != null) ((HKeyListener)a).keyTyped(event);
         if (b != null) ((HKeyListener)b).keyTyped(event);
     }
 
-    public void keyPressed(KeyEvent event)
-    {
+    public void keyPressed(KeyEvent event) {
         if (a != null) ((HKeyListener)a).keyPressed(event);
         if (b != null) ((HKeyListener)b).keyPressed(event);
     }
 
-    public void keyReleased(KeyEvent event)
-    {
+    public void keyReleased(KeyEvent event) {
         if (a != null) ((HKeyListener)a).keyReleased(event);
         if (b != null) ((HKeyListener)b).keyReleased(event);
     }
 
-    public void statusChanged(ResourceStatusEvent event)
-    {
+    public void statusChanged(ResourceStatusEvent event) {
         if (a != null) ((ResourceStatusListener)a).statusChanged(event);
         if (b != null) ((ResourceStatusListener)b).statusChanged(event);
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HFlatEffectMatte.java b/src/libbluray/bdj/java/org/havi/ui/HFlatEffectMatte.java
index 4f3a2b2..0944ee2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HFlatEffectMatte.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HFlatEffectMatte.java
@@ -29,18 +29,15 @@ public class HFlatEffectMatte implements HMatte, HAnimateEffect {
     private int position = 0;
     private int repeatCount = -1;
 
-    public HFlatEffectMatte()
-    {
+    public HFlatEffectMatte() {
     }
 
-    public HFlatEffectMatte(float[] data)
-    {
+    public HFlatEffectMatte(float[] data) {
         this();
         setMatteData(data);
     }
 
-    public void setMatteData(float[] data)
-    {
+    public void setMatteData(float[] data) {
         if (data == null) {
             matteData = null;
             return;
@@ -52,28 +49,23 @@ public class HFlatEffectMatte implements HMatte, HAnimateEffect {
         matteData = data;
     }
 
-    public float[] getMatteData()
-    {
+    public float[] getMatteData() {
         return matteData;
     }
 
-    public void start()
-    {
+    public void start() {
         isAnimated = true;
     }
 
-    public void stop()
-    {
+    public void stop() {
         isAnimated = false;
     }
 
-    public boolean isAnimated()
-    {
+    public boolean isAnimated() {
         return isAnimated;
     }
 
-    public void setPosition(int position)
-    {
+    public void setPosition(int position) {
         if (matteData == null)
             return;
         if (position < 0)
@@ -84,13 +76,11 @@ public class HFlatEffectMatte implements HMatte, HAnimateEffect {
         this.position = position;
     }
 
-    public int getPosition()
-    {
+    public int getPosition() {
         return position;
     }
 
-    public void setRepeatCount(int count)
-    {
+    public void setRepeatCount(int count) {
         if (count <= 0 && count != -1) {
             org.videolan.Logger.getLogger("HImageEffectMatte").error("setRepeatCount(): invalid count");
             throw new IllegalArgumentException("setRepeatCount(): invalid count");
@@ -99,25 +89,21 @@ public class HFlatEffectMatte implements HMatte, HAnimateEffect {
         repeatCount = count;
     }
 
-    public int getRepeatCount()
-    {
+    public int getRepeatCount() {
         return repeatCount;
     }
 
-    public void setDelay(int count)
-    {
+    public void setDelay(int count) {
         if (count < 1)
             count = 1;
         delay = count;
     }
 
-    public int getDelay()
-    {
+    public int getDelay() {
         return delay;
     }
 
-    public void setPlayMode(int mode)
-    {
+    public void setPlayMode(int mode) {
         if (mode != PLAY_REPEATING && mode != PLAY_ALTERNATING) {
             org.videolan.Logger.getLogger("HFlatEffectMatte").error("setPlayMode(): invalid mode");
             throw new IllegalArgumentException("setPlayMode(): invalid mode");
@@ -125,8 +111,7 @@ public class HFlatEffectMatte implements HMatte, HAnimateEffect {
         this.mode = mode;
     }
 
-    public int getPlayMode()
-    {
+    public int getPlayMode() {
         return mode;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HFlatMatte.java b/src/libbluray/bdj/java/org/havi/ui/HFlatMatte.java
index b0855ff..7e0bbb2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HFlatMatte.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HFlatMatte.java
@@ -23,23 +23,19 @@ package org.havi.ui;
 public class HFlatMatte implements HMatte {
     private float data;
 
-    public HFlatMatte()
-    {
+    public HFlatMatte() {
         this.data = 1.0F;
     }
 
-    public HFlatMatte(float data)
-    {
+    public HFlatMatte(float data) {
         this.data = data;
     }
 
-    public void setMatteData(float data)
-    {
+    public void setMatteData(float data) {
         this.data = data;
     }
 
-    public float getMatteData()
-    {
+    public float getMatteData() {
         return data;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HFontCapabilities.java b/src/libbluray/bdj/java/org/havi/ui/HFontCapabilities.java
index 0dea4a2..d4c989c 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HFontCapabilities.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HFontCapabilities.java
@@ -22,19 +22,16 @@ package org.havi.ui;
 import java.awt.Font;
 
 public class HFontCapabilities {
-    protected HFontCapabilities()
-    {
+    protected HFontCapabilities() {
         org.videolan.Logger.unimplemented(null, "HFontCapabilities");
     }
 
-    public static int[] getSupportedCharacterRanges(Font font)
-    {
+    public static int[] getSupportedCharacterRanges(Font font) {
         org.videolan.Logger.unimplemented("HFontCapabilities", "getSupportedCharacterRanges");
         return null;
     }
 
-    public static boolean isCharAvailable(Font font, char c)
-    {
+    public static boolean isCharAvailable(Font font, char c) {
         org.videolan.Logger.unimplemented("HFontCapabilities", "isCharAvailable");
         return true;
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HGraphicButton.java b/src/libbluray/bdj/java/org/havi/ui/HGraphicButton.java
index deec92a..5ca6e7d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HGraphicButton.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HGraphicButton.java
@@ -27,139 +27,120 @@ import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
 public class HGraphicButton extends HIcon implements HActionable {
-    public HGraphicButton()
-    {
+    public HGraphicButton() {
         org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public HGraphicButton(Image image, int x, int y, int width, int height)
-    {
+    public HGraphicButton(Image image, int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
     public HGraphicButton(Image imageNormal, Image imageFocused,
-            Image imageActioned, int x, int y, int width, int height)
-    {
+            Image imageActioned, int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public HGraphicButton(Image image)
-    {
+    public HGraphicButton(Image image) {
         org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
     public HGraphicButton(Image imageNormal, Image imageFocused,
-            Image imageActioned)
-    {
+            Image imageActioned) {
         org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public static void setDefaultLook(HGraphicLook hlook)
-    {
+    public static void setDefaultLook(HGraphicLook hlook) {
         DefaultLook = hlook;
     }
 
-    public static HGraphicLook getDefaultLook()
-    {
+    public static HGraphicLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public void addHActionListener(HActionListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHActionListener(HActionListener l) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public void removeHActionListener(HActionListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHActionListener(HActionListener l) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public void setActionCommand(String command)
-    {
-        throw new Error("Not implemented");
+    public void setActionCommand(String command) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public void setActionSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setActionSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public HSound getActionSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getActionSound() {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return null;
     }
 
-    public void processHActionEvent(HActionEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHActionEvent(HActionEvent evt) {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
     }
 
-    public String getActionCommand()
-    {
-        throw new Error("Not implemented");
+    public String getActionCommand() {
+        org.videolan.Logger.unimplemented(HGraphicButton.class.getName(), "");
+        return "";
     }
 
     private static HGraphicLook DefaultLook = null;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HGraphicLook.java b/src/libbluray/bdj/java/org/havi/ui/HGraphicLook.java
index bc9c997..c01d7d3 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HGraphicLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HGraphicLook.java
@@ -23,70 +23,53 @@ import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.Insets;
 
-public class HGraphicLook 
-    implements HExtendedLook
-{
-    public HGraphicLook()
-    {
+public class HGraphicLook implements HExtendedLook {
+    public HGraphicLook() {
     }
 
-    public void fillBackground(Graphics g, HVisible visible, int state)
-    {
+    public void fillBackground(Graphics g, HVisible visible, int state) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "fillBackground");
-        throw new Error("Not implemented");
     }
 
-    public void renderBorders(Graphics g, HVisible visible, int state)
-    {
+    public void renderBorders(Graphics g, HVisible visible, int state) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "renderBorders");
-        throw new Error("Not implemented");
     }
 
-    public void renderVisible(Graphics g, HVisible visible, int state)
-    {
+    public void renderVisible(Graphics g, HVisible visible, int state) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "renderVisible");
-        throw new Error("Not implemented");
     }
-    
-    public void showLook(Graphics g, HVisible visible, int state)
-    {
+
+    public void showLook(Graphics g, HVisible visible, int state) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "showLook");
-        throw new Error("Not implemented");
     }
 
-   public void widgetChanged (HVisible visible, HChangeData[] changes)
-    {
+    public void widgetChanged (HVisible visible, HChangeData[] changes) {
         if (visible.isVisible()) visible.repaint();
     }
-    
-    public Dimension getMinimumSize(HVisible hvisible)
-    {
+
+    public Dimension getMinimumSize(HVisible hvisible) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "getMinimumSize");
-        throw new Error("Not implemented");
+        return null;
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
+    public Dimension getPreferredSize(HVisible hvisible) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "getPreferredSize");
-        throw new Error("Not implemented");
+        return null;
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
+    public Dimension getMaximumSize(HVisible hvisible) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "getMaximumSize");
-        throw new Error("Not implemented");
+        return null;
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
+    public boolean isOpaque(HVisible visible) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "isOpaque");
-        throw new Error("Not implemented");
+        return false;
     }
 
-    public Insets getInsets(HVisible hvisible)
-    {
+    public Insets getInsets(HVisible hvisible) {
         org.videolan.Logger.unimplemented(HGraphicLook.class.getName(), "getInsets");
-        throw new Error("Not implemented");
+        return new Insets(0, 0, 0, 0);
     }
 }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HGraphicsConfiguration.java b/src/libbluray/bdj/java/org/havi/ui/HGraphicsConfiguration.java
index 33de7d4..ce18d61 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HGraphicsConfiguration.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HGraphicsConfiguration.java
@@ -31,7 +31,6 @@ import java.awt.Color;
 
 public class HGraphicsConfiguration extends HScreenConfiguration {
     protected HGraphicsConfiguration() {
-
     }
 
     HGraphicsConfiguration(HGraphicsConfigTemplate hgct) {
@@ -78,26 +77,25 @@ public class HGraphicsConfiguration extends HScreenConfiguration {
 
     public Color getPunchThroughToBackgroundColor(int percentage) {
         org.videolan.Logger.unimplemented("HGraphicsConfigTemplate", "");
-        throw new Error("Not implemented");
+        return null;
     }
 
     public Color getPunchThroughToBackgroundColor(int percentage, HVideoDevice hvd) {
         org.videolan.Logger.unimplemented("HGraphicsConfigTemplate", "");
-        throw new Error("Not implemented");
+        return null;
     }
 
     public Color getPunchThroughToBackgroundColor(Color color, int percentage) {
         org.videolan.Logger.unimplemented("HGraphicsConfigTemplate", "");
-        throw new Error("Not implemented");
+        return null;
     }
 
     public Color getPunchThroughToBackgroundColor(Color color, int percentage, HVideoDevice v) {
         org.videolan.Logger.unimplemented("HGraphicsConfigTemplate", "");
-        throw new Error("Not implemented");
+        return null;
     }
 
     public void dispose(Color c) {
-
     }
 
     private HGraphicsConfigTemplate hgct;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HIcon.java b/src/libbluray/bdj/java/org/havi/ui/HIcon.java
index c3c7084..53352d3 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HIcon.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HIcon.java
@@ -24,102 +24,91 @@ import java.awt.Image;
 import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
+import org.videolan.BDJXletContext;
+import org.videolan.Logger;
+
 public class HIcon extends HStaticIcon implements HNavigable {
-    public HIcon()
-    {
+    public HIcon() {
         org.videolan.Logger.unimplemented(HIcon.class.getName(), "");
     }
 
-    public HIcon(Image image)
-    {
+    public HIcon(Image image) {
         org.videolan.Logger.unimplemented(HIcon.class.getName(), "");
     }
 
-    public HIcon(Image image, int x, int y, int width, int height)
-    {
+    public HIcon(Image image, int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HIcon.class.getName(), "");
     }
 
     public HIcon(Image imageNormal, Image imageFocus, int x, int y, int width,
-            int height)
-    {
+            int height) {
         org.videolan.Logger.unimplemented(HIcon.class.getName(), "");
     }
 
-    public static void setDefaultLook(HGraphicLook hlook)
-    {
-        DefaultLook = hlook;
+    public static void setDefaultLook(HGraphicLook hlook) {
+        BDJXletContext.setXletDefaultLook(PROPERTY_LOOK, hlook);
     }
 
-    public static HGraphicLook getDefaultLook()
-    {
-        if (DefaultLook == null)
-            org.videolan.Logger.unimplemented("", "getDefaultLook");
-        return DefaultLook;
+    public static HGraphicLook getDefaultLook() {
+        return (HGraphicLook)BDJXletContext.getXletDefaultLook(PROPERTY_LOOK, DEFAULT_LOOK);
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        Logger.unimplemented("", "");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        Logger.unimplemented("", "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        Logger.unimplemented("", "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        Logger.unimplemented("", "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        Logger.unimplemented("", "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        Logger.unimplemented("", "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        Logger.unimplemented("", "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        Logger.unimplemented("", "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        Logger.unimplemented("", "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        Logger.unimplemented("", "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        Logger.unimplemented("", "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        Logger.unimplemented("", "");
     }
 
-    private static HGraphicLook DefaultLook = null;
+    static final Class DEFAULT_LOOK = HGraphicLook.class;
+    private static final String PROPERTY_LOOK = HIcon.class.getName();
 
     private static final long serialVersionUID = 2006124827619610922L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HImageEffectMatte.java b/src/libbluray/bdj/java/org/havi/ui/HImageEffectMatte.java
index 136b01d..3d1cfe9 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HImageEffectMatte.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HImageEffectMatte.java
@@ -33,18 +33,15 @@ public class HImageEffectMatte implements HMatte, HAnimateEffect {
     private int position = 0;
     private int repeatCount = -1;
 
-    public HImageEffectMatte()
-    {
+    public HImageEffectMatte() {
     }
 
-    public HImageEffectMatte(Image[] data)
-    {
+    public HImageEffectMatte(Image[] data) {
         this();
         setMatteData(data);
     }
 
-    public void setMatteData(Image[] data)
-    {
+    public void setMatteData(Image[] data) {
         if (data == null) {
             matteData = null;
             offsets = null;
@@ -61,13 +58,11 @@ public class HImageEffectMatte implements HMatte, HAnimateEffect {
             offsets[i] = new Point(0, 0);
     }
 
-    public Image[] getMatteData()
-    {
+    public Image[] getMatteData() {
         return matteData;
     }
 
-    public void setOffset(Point p, int index)
-    {
+    public void setOffset(Point p, int index) {
         if (p == null) {
             org.videolan.Logger.getLogger("HImageEffectMatte").error("setOffset(): no point");
             throw new IllegalArgumentException("setOffset(): point is null");
@@ -81,28 +76,23 @@ public class HImageEffectMatte implements HMatte, HAnimateEffect {
         offsets[index] = p;
     }
 
-    public Point getOffset(int index)
-    {
+    public Point getOffset(int index) {
         return offsets[index];
     }
 
-    public void start()
-    {
+    public void start() {
         isAnimated = true;
     }
 
-    public void stop()
-    {
+    public void stop() {
         isAnimated = false;
     }
 
-    public boolean isAnimated()
-    {
+    public boolean isAnimated() {
         return isAnimated;
     }
 
-    public void setPosition(int position)
-    {
+    public void setPosition(int position) {
         if (matteData == null)
             return;
         if (position < 0)
@@ -113,13 +103,11 @@ public class HImageEffectMatte implements HMatte, HAnimateEffect {
         this.position = position;
     }
 
-    public int getPosition()
-    {
+    public int getPosition() {
         return position;
     }
 
-    public void setRepeatCount(int count)
-    {
+    public void setRepeatCount(int count) {
         if (count <= 0 && count != -1) {
             org.videolan.Logger.getLogger("HImageEffectMatte").error("setRepeatCount(): invalid count");
             throw new IllegalArgumentException("setRepeatCount(): invalid count");
@@ -128,25 +116,21 @@ public class HImageEffectMatte implements HMatte, HAnimateEffect {
         repeatCount = count;
     }
 
-    public int getRepeatCount()
-    {
+    public int getRepeatCount() {
         return repeatCount;
     }
 
-    public void setDelay(int count)
-    {
+    public void setDelay(int count) {
         if (count < 1)
             count = 1;
         delay = count;
     }
 
-    public int getDelay()
-    {
+    public int getDelay() {
         return delay;
     }
 
-    public void setPlayMode(int mode)
-    {
+    public void setPlayMode(int mode) {
         if (mode != PLAY_REPEATING && mode != PLAY_ALTERNATING) {
             org.videolan.Logger.getLogger("HImageEffectMatte").error("setPlayMode(): invalid mode");
             throw new IllegalArgumentException("setPlayMode(): invalid mode");
@@ -154,8 +138,7 @@ public class HImageEffectMatte implements HMatte, HAnimateEffect {
         this.mode = mode;
     }
 
-    public int getPlayMode()
-    {
+    public int getPlayMode() {
         return mode;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HImageHints.java b/src/libbluray/bdj/java/org/havi/ui/HImageHints.java
index ed2ea45..bb1e7b2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HImageHints.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HImageHints.java
@@ -20,18 +20,15 @@
 package org.havi.ui;
 
 public class HImageHints {
-    public HImageHints()
-    {
+    public HImageHints() {
         type = NATURAL_IMAGE;
     }
 
-    public void setType(int type)
-    {
+    public void setType(int type) {
         this.type = type;
     }
 
-    public int getType()
-    {
+    public int getType() {
         return type;
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HImageMatte.java b/src/libbluray/bdj/java/org/havi/ui/HImageMatte.java
index 6773c20..41855f8 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HImageMatte.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HImageMatte.java
@@ -27,32 +27,26 @@ public class HImageMatte implements HMatte {
     private Image data = null;
     private Point offset = new Point(0, 0);
 
-    public HImageMatte()
-    {
+    public HImageMatte() {
     }
 
-    public HImageMatte(Image data)
-    {
+    public HImageMatte(Image data) {
         this.data = data;
     }
 
-    public void setMatteData(Image data)
-    {
+    public void setMatteData(Image data) {
         this.data = data;
     }
 
-    public Image getMatteData()
-    {
+    public Image getMatteData() {
         return this.data;
     }
 
-    public void setOffset(Point p)
-    {
+    public void setOffset(Point p) {
         this.offset = p;
     }
 
-    public Point getOffset()
-    {
+    public Point getOffset() {
         return this.offset;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HInvalidLookException.java b/src/libbluray/bdj/java/org/havi/ui/HInvalidLookException.java
index 67b243d..1748108 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HInvalidLookException.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HInvalidLookException.java
@@ -20,15 +20,13 @@
 package org.havi.ui;
 
 public class HInvalidLookException extends HUIException {
-    public HInvalidLookException()
-    {
+    public HInvalidLookException() {
         super();
     }
 
-    public HInvalidLookException(String reason)
-    {
+    public HInvalidLookException(String reason) {
         super(reason);
     }
-    
+
     private static final long serialVersionUID = -930701028428083791L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HListElement.java b/src/libbluray/bdj/java/org/havi/ui/HListElement.java
index 2e37d42..c784d6d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HListElement.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HListElement.java
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016  Petri Hintukainen
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,33 +23,31 @@ package org.havi.ui;
 import java.awt.Image;
 
 public class HListElement {
-    public HListElement(String label)
-    {
-        org.videolan.Logger.unimplemented(HListElement.class.getName(), "");
+    public HListElement(String label) {
+        this.label = label;
     }
 
-    public HListElement(Image icon, String label)
-    {
-        org.videolan.Logger.unimplemented(HListElement.class.getName(), "");
+    public HListElement(Image icon, String label) {
+        this.label = label;
+        this.icon = icon;
     }
 
-    public String getLabel()
-    {
-        throw new Error("Not implemented");
+    public String getLabel() {
+        return label;
     }
 
-    public Image getIcon()
-    {
-        throw new Error("Not implemented");
+    public Image getIcon() {
+        return icon;
     }
 
-    public void setLabel(String label)
-    {
-        throw new Error("Not implemented");
+    public void setLabel(String label) {
+        this.label = label;
     }
 
-    public void setIcon(Image icon)
-    {
-        throw new Error("Not implemented");
+    public void setIcon(Image icon) {
+        this.icon = icon;
     }
+
+    private Image icon = null;
+    private String label = null;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HListGroup.java b/src/libbluray/bdj/java/org/havi/ui/HListGroup.java
index 2892da4..c154107 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HListGroup.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HListGroup.java
@@ -25,272 +25,243 @@ import org.havi.ui.event.HFocusListener;
 import org.havi.ui.event.HItemEvent;
 
 public class HListGroup extends HVisible implements HItemValue {
-    public HListGroup()
-    {
+    public HListGroup() {
         org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public HListGroup(HListElement[] items)
-    {
+    public HListGroup(HListElement[] items) {
         org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public HListGroup(HListElement[] items, int x, int y, int width, int height)
-    {
+    public HListGroup(HListElement[] items, int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
-        throw new Error("Not implemented");
+    public void setLook(HLook hlook) throws HInvalidLookException {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public static void setDefaultLook(HListGroupLook look)
-    {
+    public static void setDefaultLook(HListGroupLook look) {
         DefaultLook = look;
     }
 
-    public static HListGroupLook getDefaultLook()
-    {
+    public static HListGroupLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public HListElement[] getListContent()
-    {
-        throw new Error("Not implemented");
+    public HListElement[] getListContent() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void setListContent(HListElement[] elements)
-    {
-        throw new Error("Not implemented");
+    public void setListContent(HListElement[] elements) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void addItem(HListElement item, int index)
-    {
-        throw new Error("Not implemented");
+    public void addItem(HListElement item, int index) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void addItems(HListElement[] items, int index)
-    {
-        throw new Error("Not implemented");
+    public void addItems(HListElement[] items, int index)  {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public HListElement getItem(int index)
-    {
-        throw new Error("Not implemented");
+    public HListElement getItem(int index) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public int getIndex(HListElement item)
-    {
-        throw new Error("Not implemented");
+    public int getIndex(HListElement item) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return 0;
     }
 
-    public int getNumItems()
-    {
-        throw new Error("Not implemented");
+    public int getNumItems() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return 0;
     }
 
-    public HListElement removeItem(int index)
-    {
-        throw new Error("Not implemented");
+    public HListElement removeItem(int index) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void removeAllItems()
-    {
-        throw new Error("Not implemented");
+    public void removeAllItems() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public int getCurrentIndex()
-    {
-        throw new Error("Not implemented");
+    public int getCurrentIndex() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return 0;
     }
 
-    public HListElement getCurrentItem()
-    {
-        throw new Error("Not implemented");
+    public HListElement getCurrentItem() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public boolean setCurrentItem(int index)
-    {
-        throw new Error("Not implemented");
+    public boolean setCurrentItem(int index) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return false;
     }
 
-    public int[] getSelectionIndices()
-    {
-        throw new Error("Not implemented");
+    public int[] getSelectionIndices() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public HListElement[] getSelection()
-    {
-        throw new Error("Not implemented");
+    public HListElement[] getSelection() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void clearSelection()
-    {
-        throw new Error("Not implemented");
+    public void clearSelection() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public int getNumSelected()
-    {
-        throw new Error("Not implemented");
+    public int getNumSelected() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return 0;
     }
 
-    public boolean getMultiSelection()
-    {
-        throw new Error("Not implemented");
+    public boolean getMultiSelection() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return false;
     }
 
-    public void setMultiSelection(boolean multi)
-    {
-        throw new Error("Not implemented");
+    public void setMultiSelection(boolean multi) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void setItemSelected(int index, boolean sel)
-    {
-        throw new Error("Not implemented");
+    public void setItemSelected(int index, boolean sel) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public boolean isItemSelected(int index)
-    {
-        throw new Error("Not implemented");
+    public boolean isItemSelected(int index) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return false;
     }
 
-    public int getScrollPosition()
-    {
-        throw new Error("Not implemented");
+    public int getScrollPosition() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return 0;
     }
 
-    public void setScrollPosition(int scroll)
-    {
-        throw new Error("Not implemented");
+    public void setScrollPosition(int scroll) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public Dimension getIconSize()
-    {
-        throw new Error("Not implemented");
+    public Dimension getIconSize() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void setIconSize(Dimension size)
-    {
-        throw new Error("Not implemented");
+    public void setIconSize(Dimension size) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public Dimension getLabelSize()
-    {
-        throw new Error("Not implemented");
+    public Dimension getLabelSize() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void setLabelSize(Dimension size)
-    {
-        throw new Error("Not implemented");
+    public void setLabelSize(Dimension size) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public int getOrientation()
-    {
-        throw new Error("Not implemented");
+    public int getOrientation() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return 0;
     }
 
-    public void setOrientation(int orient)
-    {
-        throw new Error("Not implemented");
+    public void setOrientation(int orient) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void addItemListener(org.havi.ui.event.HItemListener l)
-    {
-        throw new Error("Not implemented");
+    public void addItemListener(org.havi.ui.event.HItemListener l) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void removeItemListener(org.havi.ui.event.HItemListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeItemListener(org.havi.ui.event.HItemListener l) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void setSelectionSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setSelectionSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public HSound getSelectionSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getSelectionSound() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return null;
     }
 
-    public boolean getSelectionMode()
-    {
-        throw new Error("Not implemented");
+    public boolean getSelectionMode() {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
+        return false;
     }
 
-    public void setSelectionMode(boolean edit)
-    {
-        throw new Error("Not implemented");
+    public void setSelectionMode(boolean edit) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
-    public void processHItemEvent(HItemEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHItemEvent(HItemEvent evt) {
+        org.videolan.Logger.unimplemented(HListGroup.class.getName(), "");
     }
 
     public static final int ITEM_NOT_FOUND = -1;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HListGroupLook.java b/src/libbluray/bdj/java/org/havi/ui/HListGroupLook.java
index 9022c3a..2ba9736 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HListGroupLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HListGroupLook.java
@@ -25,78 +25,72 @@ import java.awt.Dimension;
 import java.awt.Graphics;
 
 public class HListGroupLook implements HExtendedLook, HAdjustableLook {
-    public HListGroupLook()
-    {
+    public HListGroupLook() {
         org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
     }
 
-    public void showLook(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void showLook(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
     }
 
-    public void fillBackground(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void fillBackground(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
     }
 
-    public void renderBorders(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderBorders(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
     }
 
-    public void renderVisible(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderVisible(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
     }
 
-    public void widgetChanged(HVisible visible, HChangeData[] changes)
-    {
-        throw new Error("Not implemented");
+    public void widgetChanged(HVisible visible, HChangeData[] changes) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
     }
 
-    public Dimension getMinimumSize(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMinimumSize(HVisible visible) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getPreferredSize(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getPreferredSize(HVisible visible) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getMaximumSize(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMaximumSize(HVisible visible) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return null;
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public boolean isOpaque(HVisible visible) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return false;
     }
 
-    public java.awt.Insets getInsets(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Insets getInsets(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return null;
     }
 
-    public int hitTest(HOrientable component, Point pt)
-    {
-        throw new Error("Not implemented");
+    public int hitTest(HOrientable component, Point pt) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return 0;
     }
 
-    public Integer getValue(HOrientable component, Point pt)
-    {
-        throw new Error("Not implemented");
+    public Integer getValue(HOrientable component, Point pt) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return null;
     }
 
-    public Insets getElementInsets()
-    {
-        throw new Error("Not implemented");
+    public Insets getElementInsets() {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return null;
     }
 
-    public int getNumVisible(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public int getNumVisible(HVisible visible) {
+        org.videolan.Logger.unimplemented(HListGroupLook.class.getName(), "");
+        return 0;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HMatte.java b/src/libbluray/bdj/java/org/havi/ui/HMatte.java
index f0fd6d0..079ddc4 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HMatte.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HMatte.java
@@ -20,5 +20,4 @@
 package org.havi.ui;
 
 public interface HMatte {
-
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HMatteException.java b/src/libbluray/bdj/java/org/havi/ui/HMatteException.java
index 553c03f..0b9d281 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HMatteException.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HMatteException.java
@@ -20,13 +20,11 @@
 package org.havi.ui;
 
 public class HMatteException extends HUIException {
-    public HMatteException()
-    {
+    public HMatteException() {
         super();
     }
 
-    public HMatteException(String reason)
-    {
+    public HMatteException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HMultilineEntry.java b/src/libbluray/bdj/java/org/havi/ui/HMultilineEntry.java
index 8b7906d..23759ef 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HMultilineEntry.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HMultilineEntry.java
@@ -23,58 +23,47 @@ import java.awt.Color;
 import java.awt.Font;
 
 public class HMultilineEntry extends HSinglelineEntry {
-    public HMultilineEntry()
-    {
+    public HMultilineEntry() {
         org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
     public HMultilineEntry(String text, int x, int y, int width, int height,
-            int maxChars, Font font, Color color)
-    {
+            int maxChars, Font font, Color color) {
         org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
-    public HMultilineEntry(int x, int y, int width, int height, int maxChars)
-    {
+    public HMultilineEntry(int x, int y, int width, int height, int maxChars) {
         org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
-        throw new Error("Not implemented");
     }
 
-    public HMultilineEntry(String text, int maxChars, Font font, Color color)
-    {
+    public HMultilineEntry(String text, int maxChars, Font font, Color color) {
         org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
-    public HMultilineEntry(int maxChars)
-    {
+    public HMultilineEntry(int maxChars) {
         org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
-    public static void setDefaultLook(HMultilineEntryLook look)
-    {
+    public static void setDefaultLook(HMultilineEntryLook look) {
         DefaultLook = look;
     }
 
-    public static HSinglelineEntryLook getDefaultLook()
-    {
+    public static HSinglelineEntryLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
-        throw new Error("Not implemented");
+    public void setLook(HLook hlook) throws HInvalidLookException {
+        org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
-    public void caretNextLine()
-    {
-        throw new Error("Not implemented");
+    public void caretNextLine() {
+        org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
-    public void caretPreviousLine()
-    {
-        throw new Error("Not implemented");
+    public void caretPreviousLine() {
+        org.videolan.Logger.unimplemented(HMultilineEntry.class.getName(), "");
     }
 
     private static HSinglelineEntryLook DefaultLook = null;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HMultilineEntryLook.java b/src/libbluray/bdj/java/org/havi/ui/HMultilineEntryLook.java
index 011fef6..9bddd32 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HMultilineEntryLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HMultilineEntryLook.java
@@ -23,83 +23,76 @@ import java.awt.Dimension;
 import java.awt.Insets;
 
 public class HMultilineEntryLook extends HSinglelineEntryLook {
-    public HMultilineEntryLook()
-    {
+    public HMultilineEntryLook() {
         org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
     }
 
-    public void fillBackground(java.awt.Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void fillBackground(java.awt.Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
     }
 
-    public void renderBorders(java.awt.Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderBorders(java.awt.Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
     }
 
-    public void renderVisible(java.awt.Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderVisible(java.awt.Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
     }
 
-    public void showLook(java.awt.Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void showLook(java.awt.Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
     }
 
-    public void widgetChanged(HVisible visible, HChangeData[] changes)
-    {
-        throw new Error("Not implemented");
+    public void widgetChanged(HVisible visible, HChangeData[] changes) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
     }
 
-    public Dimension getMinimumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMinimumSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getPreferredSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMaximumSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public boolean isOpaque(HVisible visible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return false;
     }
 
-    public Insets getInsets(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Insets getInsets(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public int getCaretPositionNextLine(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public int getCaretPositionNextLine(HVisible visible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return 0;
     }
 
-    public int getCaretPositionPreviousLine(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public int getCaretPositionPreviousLine(HVisible visible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return 0;
     }
 
-    public int getCaretCharPositionForLine(HVisible visible, int line)
-    {
-        throw new Error("Not implemented");
+    public int getCaretCharPositionForLine(HVisible visible, int line) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return 0;
     }
 
-    public int[] getVisibleSoftLineBreakPositions(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public int[] getVisibleSoftLineBreakPositions(HVisible visible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return null;
     }
-
-    public int[] getSoftLineBreakPositions(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public int[] getSoftLineBreakPositions(HVisible visible) {
+        org.videolan.Logger.unimplemented(HMultilineEntryLook.class.getName(), "");
+        return null;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HNoInputPreferred.java b/src/libbluray/bdj/java/org/havi/ui/HNoInputPreferred.java
index bff7b26..b609ae2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HNoInputPreferred.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HNoInputPreferred.java
@@ -20,5 +20,4 @@
 package org.havi.ui;
 
 public interface HNoInputPreferred {
-
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HPermissionDeniedException.java b/src/libbluray/bdj/java/org/havi/ui/HPermissionDeniedException.java
index 3478bcd..01e201a 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HPermissionDeniedException.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HPermissionDeniedException.java
@@ -20,13 +20,11 @@
 package org.havi.ui;
 
 public class HPermissionDeniedException extends Exception {
-    public HPermissionDeniedException()
-    {
+    public HPermissionDeniedException() {
         super();
     }
 
-    public HPermissionDeniedException(String reason)
-    {
+    public HPermissionDeniedException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HRange.java b/src/libbluray/bdj/java/org/havi/ui/HRange.java
index 6f14eab..39318c4 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HRange.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HRange.java
@@ -23,93 +23,81 @@ import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
 public class HRange extends HStaticRange implements HNavigable {
-    public HRange()
-    {
+    public HRange() {
         org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
     public HRange(int orientation, int minimum, int maximum, int value, int x,
-            int y, int width, int height)
-    {
+            int y, int width, int height) {
         org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public HRange(int orientation, int minimum, int maximum, int value)
-    {
+    public HRange(int orientation, int minimum, int maximum, int value) {
         org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public static void setDefaultLook(HRangeLook look)
-    {
+    public static void setDefaultLook(HRangeLook look) {
         DefaultLook = look;
     }
 
-    public static HRangeLook getDefaultLook()
-    {
+    public static HRangeLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        org.videolan.Logger.unimplemented(HRange.class.getName(), "");
     }
 
     private static HRangeLook DefaultLook = null;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HRangeLook.java b/src/libbluray/bdj/java/org/havi/ui/HRangeLook.java
index 20b8f08..fa39eef 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HRangeLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HRangeLook.java
@@ -25,68 +25,62 @@ import java.awt.Point;
 import java.awt.Dimension;
 
 public class HRangeLook implements HExtendedLook, HAdjustableLook {
-    public HRangeLook()
-    {
+    public HRangeLook() {
         org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
     }
 
-    public void fillBackground(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void fillBackground(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
     }
 
-    public void renderBorders(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderBorders(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
     }
 
-    public void renderVisible(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderVisible(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
     }
 
-    public void showLook(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void showLook(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
     }
 
-    public void widgetChanged(HVisible visible, HChangeData[] changes)
-    {
-        throw new Error("Not implemented");
+    public void widgetChanged(HVisible visible, HChangeData[] changes) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
     }
 
-    public Dimension getMinimumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMinimumSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getPreferredSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMaximumSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return null;
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public boolean isOpaque(HVisible visible) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return false;
     }
 
-    public Insets getInsets(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Insets getInsets(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return null;
     }
 
-    public int hitTest(HOrientable component, Point pt)
-    {
-        throw new Error("Not implemented");
+    public int hitTest(HOrientable component, Point pt) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return 0;
     }
 
-    public Integer getValue(HOrientable component, Point pt)
-    {
-        throw new Error("Not implemented");
+    public Integer getValue(HOrientable component, Point pt) {
+        org.videolan.Logger.unimplemented(HRangeLook.class.getName(), "");
+        return null;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HRangeValue.java b/src/libbluray/bdj/java/org/havi/ui/HRangeValue.java
index f02a7ce..6356c72 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HRangeValue.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HRangeValue.java
@@ -25,148 +25,129 @@ import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
 public class HRangeValue extends HRange implements HAdjustmentValue {
-    public HRangeValue()
-    {
+    public HRangeValue() {
         org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
     public HRangeValue(int orientation, int minimum, int maximum, int value,
-            int x, int y, int width, int height)
-    {
+            int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public HRangeValue(int orientation, int minimum, int maximum, int value)
-    {
+    public HRangeValue(int orientation, int minimum, int maximum, int value) {
         org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public static void setDefaultLook(HRangeLook look)
-    {
+    public static void setDefaultLook(HRangeLook look) {
         DefaultLook = look;
     }
 
-    public static HRangeLook getDefaultLook()
-    {
+    public static HRangeLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public void setUnitIncrement(int increment)
-    {
-        throw new Error("Not implemented");
+    public void setUnitIncrement(int increment) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public int getUnitIncrement()
-    {
-        throw new Error("Not implemented");
+    public int getUnitIncrement() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return 0;
     }
 
-    public void setBlockIncrement(int increment)
-    {
-        throw new Error("Not implemented");
+    public void setBlockIncrement(int increment) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public int getBlockIncrement()
-    {
-        throw new Error("Not implemented");
+    public int getBlockIncrement() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return 0;
     }
 
-    public void addAdjustmentListener(HAdjustmentListener l)
-    {
-        throw new Error("Not implemented");
+    public void addAdjustmentListener(HAdjustmentListener l) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public void removeAdjustmentListener(HAdjustmentListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeAdjustmentListener(HAdjustmentListener l) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public void setAdjustmentSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setAdjustmentSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public HSound getAdjustmentSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getAdjustmentSound() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return null;
     }
 
-    public boolean getAdjustMode()
-    {
-        throw new Error("Not implemented");
+    public boolean getAdjustMode() {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
+        return false;
     }
 
-    public void setAdjustMode(boolean adjust)
-    {
-        throw new Error("Not implemented");
+    public void setAdjustMode(boolean adjust) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
-    public void processHAdjustmentEvent(HAdjustmentEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHAdjustmentEvent(HAdjustmentEvent evt) {
+        org.videolan.Logger.unimplemented(HRangeValue.class.getName(), "");
     }
 
     private static HRangeLook DefaultLook = null;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScene.java b/src/libbluray/bdj/java/org/havi/ui/HScene.java
index 926781a..50f6ac4 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScene.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScene.java
@@ -36,12 +36,16 @@ import java.util.Map;
 import org.havi.ui.event.HEventGroup;
 import org.videolan.BDJXletContext;
 import org.videolan.GUIManager;
+import org.videolan.Logger;
 import java.awt.BDToolkit;
 
 
 public class HScene extends Container implements HComponentOrdering {
     protected HScene() {
         context = BDJXletContext.getCurrentContext();
+        if (context == null) {
+            logger.error("HScene() created from privileged context: " + Logger.dumpStack());
+        }
         BDToolkit.addComponent(this);
     }
 
@@ -52,8 +56,7 @@ public class HScene extends Container implements HComponentOrdering {
     public void paint(Graphics g) {
         if (backgroundMode == BACKGROUND_FILL) {
             g.setColor(getBackground());
-            g.fillRect(super.getX(), super.getY(), super.getWidth(), super
-                    .getHeight());
+            g.fillRect(super.getX(), super.getY(), super.getWidth(), super.getHeight());
         }
 
         if (image != null) {
@@ -378,15 +381,27 @@ public class HScene extends Container implements HComponentOrdering {
     }
 
     public void setVisible(boolean visible) {
+        if (visible == isVisible())
+            return;
         super.setVisible(visible);
+
+        /*
+         * This doesn't work
+         *  - visible state of other HScenes is never restored
+         *     => no focus, key events are lost
+         *  - Scenes are not wiped from GUI
+
         if (visible) {
             for (int i = 0; i < GUIManager.getInstance().getComponentCount(); i++) {
                     Component c = GUIManager.getInstance().getComponent(i);
                     if (c != this)
                         c.setVisible(false);
-    }
+            }
         }
-        GUIManager.getInstance().setVisible(visible);
+        */
+
+        if (visible)
+            GUIManager.getInstance().setVisible(visible);
     }
 
     public int getBackgroundMode() {
@@ -432,5 +447,7 @@ public class HScene extends Container implements HComponentOrdering {
     private boolean shortcutsEnabled = true;
     private BDJXletContext context;
 
+    private static final Logger logger = Logger.getLogger(HScene.class.getName());
+
     private static final long serialVersionUID = 422730746877212409L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreen.java b/src/libbluray/bdj/java/org/havi/ui/HScreen.java
index 600e70c..0336a8d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreen.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreen.java
@@ -20,88 +20,75 @@
 package org.havi.ui;
 
 public class HScreen {
-    private HScreen()
-    {
+    private HScreen() {
         hVideoDevice = new HVideoDevice();
         hGraphicsDevice = new HGraphicsDevice();
         hBackgroundDevice = new HBackgroundDevice();
     }
 
-    public static HScreen[] getHScreens()
-    {
+    public static HScreen[] getHScreens() {
          HScreen[] screens = new HScreen[1];
          screens[0] = DEFAULT_HSCREEN;
          return screens;
     }
 
-    public static HScreen getDefaultHScreen()
-    {
+    public static HScreen getDefaultHScreen() {
         return DEFAULT_HSCREEN;
     }
 
-    public HVideoDevice[] getHVideoDevices()
-    {
+    public HVideoDevice[] getHVideoDevices() {
         HVideoDevice[] devices = new HVideoDevice[1];
         devices[0] = hVideoDevice;
         return devices;
     }
 
-    public HVideoDevice getDefaultHVideoDevice()
-    {
+    public HVideoDevice getDefaultHVideoDevice() {
         return hVideoDevice;
     }
 
-    public HVideoConfiguration getBestConfiguration(HVideoConfigTemplate[] hvcta)
-    {
+    public HVideoConfiguration getBestConfiguration(HVideoConfigTemplate[] hvcta) {
         return hVideoDevice.getBestConfiguration(hvcta);
     }
 
-    public HGraphicsDevice[] getHGraphicsDevices()
-    {
+    public HGraphicsDevice[] getHGraphicsDevices() {
         HGraphicsDevice[] devices = new HGraphicsDevice[1];
         devices[0] = hGraphicsDevice;
         return devices;
     }
 
-    public HGraphicsDevice getDefaultHGraphicsDevice()
-    {
+    public HGraphicsDevice getDefaultHGraphicsDevice() {
         return hGraphicsDevice;
     }
 
     public HGraphicsConfiguration getBestConfiguration(
-            HGraphicsConfigTemplate[] hgcta)
-    {
+            HGraphicsConfigTemplate[] hgcta) {
         return hGraphicsDevice.getBestConfiguration(hgcta);
     }
 
-    public HBackgroundDevice[] getHBackgroundDevices()
-    {
+    public HBackgroundDevice[] getHBackgroundDevices() {
         HBackgroundDevice[] devices = new HBackgroundDevice[1];
         devices[0] = hBackgroundDevice;
         return devices;
     }
 
-    public HBackgroundDevice getDefaultHBackgroundDevice()
-    {
+    public HBackgroundDevice getDefaultHBackgroundDevice() {
         return hBackgroundDevice;
     }
 
     public HBackgroundConfiguration getBestConfiguration(
-            HBackgroundConfigTemplate[] hbcta)
-    {
+            HBackgroundConfigTemplate[] hbcta) {
         return hBackgroundDevice.getBestConfiguration(hbcta);
     }
 
     public HScreenConfiguration[] getCoherentScreenConfigurations(
-            HScreenConfigTemplate[] hscta)
-    {
+            HScreenConfigTemplate[] hscta) {
+
         if ((hscta == null) || (hscta.length == 0))
             throw new IllegalArgumentException("HScreenConfigTemplate[] hscta cannot be null");
 
         HScreenConfiguration[] hsc = new HScreenConfiguration[hscta.length];
 
-        for (int i = 0; i < hscta.length; i++)
-        {
+        for (int i = 0; i < hscta.length; i++) {
             if ((hscta[i] instanceof HVideoConfigTemplate))
                 hsc[i] = hVideoDevice.getBestConfiguration((HVideoConfigTemplate)hscta[i]);
             else if ((hscta[i] instanceof HGraphicsConfigTemplate))
@@ -117,8 +104,8 @@ public class HScreen {
 
     public boolean setCoherentScreenConfigurations(HScreenConfiguration[] hsca)
             throws java.lang.SecurityException, HPermissionDeniedException,
-            HConfigurationException
-    {
+            HConfigurationException {
+
         if ((hsca == null) || (hsca.length == 0))
             throw new IllegalArgumentException("HScreenConfiguration[] hsca cannot be null");
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java b/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java
index 8d323e7..adf1641 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java
@@ -22,6 +22,8 @@ package org.havi.ui;
 import java.awt.Dimension;
 import java.util.Arrays;
 
+import org.videolan.Logger;
+
 public abstract class HScreenConfigTemplate {
     HScreenConfigTemplate() {
         objectArray = new Object[getPreferenceObjectCount()];
@@ -30,35 +32,47 @@ public abstract class HScreenConfigTemplate {
     }
 
     public void setPreference(int preference, int priority) {
-        if ((priority < REQUIRED) || (priority > REQUIRED_NOT))
+        if ((priority < REQUIRED) || (priority > REQUIRED_NOT)) {
+            logger.error("invalid priority " + priority);
             throw new IllegalArgumentException("invalid priority");
+        }
         int index = getPreferenceIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         priorityArray[index] = priority;
     }
 
     public void setPreference(int preference, Object object, int priority) {
-        if ((priority < REQUIRED) || (priority > REQUIRED_NOT))
+        if ((priority < REQUIRED) || (priority > REQUIRED_NOT)) {
+            logger.error("invalid priority " + priority);
             throw new IllegalArgumentException("invalid priority");
+        }
         int index = getPreferenceObjectIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         objectArray[index] = object;
         priorityArray[getPreferenceIndex(preference)] = priority;
     }
 
     public int getPreferencePriority(int preference) {
         int index = getPreferenceIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         return priorityArray[getPreferenceIndex(preference)];
     }
 
     public Object getPreferenceObject(int preference) {
         int index = getPreferenceObjectIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         return objectArray[getPreferenceObjectIndex(preference)];
     }
 
@@ -169,4 +183,6 @@ public abstract class HScreenConfigTemplate {
 
         { 960, 540, 16, 9 },
     };
+
+    private static final Logger logger = Logger.getLogger(HScreenConfigTemplate.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenConfiguration.java b/src/libbluray/bdj/java/org/havi/ui/HScreenConfiguration.java
index 74aa224..466c591 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenConfiguration.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenConfiguration.java
@@ -24,7 +24,6 @@ import java.awt.Dimension;
 
 public abstract class HScreenConfiguration extends Object {
     HScreenConfiguration() {
-
     }
 
     HScreenConfiguration(HScreenConfigTemplate hsct) {
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenDevice.java b/src/libbluray/bdj/java/org/havi/ui/HScreenDevice.java
index 76c7f85..f9f1035 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenDevice.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenDevice.java
@@ -56,7 +56,7 @@ public class HScreenDevice implements ResourceProxy, ResourceServer {
 
     public Dimension getScreenAspectRatio() {
         org.videolan.Logger.unimplemented(HScreenDevice.class.getName(), "getScreenAspectRatio");
-        throw new Error("Not implemented");
+        return new Dimension(16, 9);
     }
 
     public boolean reserveDevice(ResourceClient client) {
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenDimension.java b/src/libbluray/bdj/java/org/havi/ui/HScreenDimension.java
index b643005..c72271b 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenDimension.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenDimension.java
@@ -20,14 +20,15 @@
 package org.havi.ui;
 
 public class HScreenDimension {
-    public HScreenDimension(float width, float height)
-    {
-        this.width = width;
-        this.height = height;
+    public HScreenDimension(float width, float height) {
+        setSize(width, height);
     }
 
-    public void setSize(float width, float height)
-    {
+    public void setSize(float width, float height) {
+        if (width < 0.0f)
+            width = 0.0f;
+        if (height < 0.0f)
+            height = 0.0f;
         this.width = width;
         this.height = height;
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java b/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
index e7f259c..ea43bbd 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
@@ -20,16 +20,30 @@
 package org.havi.ui;
 
 public class HScreenPoint {
-    public HScreenPoint(float x, float y)
-    {
+    public HScreenPoint(float x, float y) {
+        setLocation(x, y);
+    }
+
+    public void setLocation(float x, float y) {
         this.x = x;
         this.y = y;
     }
 
-    public void setLocation(float x, float y)
+    public boolean equals(Object obj)
     {
-        this.x = x;
-        this.y = y;
+        if (!(obj instanceof HScreenPoint))
+            return false;
+
+        HScreenPoint other = (HScreenPoint)obj;
+        Float x1 = new Float(this.x);
+        Float y1 = new Float(this.y);
+        Float x2 = new Float(other.x);
+        Float y2 = new Float(other.y);
+        return x1.equals(x2) && y1.equals(y2);
+    }
+
+    public String toString() {
+        return "[" + x + "," + y + "]";
     }
 
     public float x;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java b/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java
index c89b0f8..f2deb82 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java
@@ -20,29 +20,40 @@
 package org.havi.ui;
 
 public class HScreenRectangle {
-    public HScreenRectangle(float x, float y, float width, float height)
-    {
-        this.x = x;
-        this.y = y;
-        this.width = width;
-        this.height = height;
+    public HScreenRectangle(float x, float y, float width, float height) {
+        setLocation(x, y);
+        setSize(width, height);
     }
 
-    public void setLocation(float x, float y)
-    {
+    public void setLocation(float x, float y) {
         this.x = x;
         this.y = y;
     }
 
-    public void setSize(float width, float height)
-    {
-        this.width = width;
-        this.height = height;
+    public void setSize(float width, float height) {
+        this.width = Math.max(0.0f, width);
+        this.height = Math.max(0.0f, height);
     }
 
-    public String toString()
+    public boolean equals(Object obj)
     {
-        return "HScreenRectangle[" + x + "," + y + " " + width + "x" + height + "]";
+        if (!(obj instanceof HScreenRectangle))
+            return false;
+
+        HScreenRectangle other = (HScreenRectangle)obj;
+        Float x1 = new Float(this.x);
+        Float y1 = new Float(this.y);
+        Float w1 = new Float(this.width);
+        Float h1 = new Float(this.height);
+        Float x2 = new Float(other.x);
+        Float y2 = new Float(other.y);
+        Float w2 = new Float(other.width);
+        Float h2 = new Float(other.height);
+        return x1.equals(x2) && y1.equals(y2) && w1.equals(w2) && h1.equals(h2);
+    }
+
+    public String toString() {
+        return getClass().getName() + "[" + x + "," + y + " " + width + "x" + height + "]";
     }
 
     public float x;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntry.java b/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntry.java
index cba1a66..de55fcc 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntry.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntry.java
@@ -29,240 +29,216 @@ import org.havi.ui.event.HTextEvent;
 import org.havi.ui.event.HTextListener;
 
 public class HSinglelineEntry extends HVisible implements HTextValue {
-    public HSinglelineEntry()
-    {
+    public HSinglelineEntry() {
         org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
     public HSinglelineEntry(String text, int x, int y, int width, int height,
-            int maxChars, Font font, Color color)
-    {
+            int maxChars, Font font, Color color) {
         org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public HSinglelineEntry(int x, int y, int width, int height, int maxChars)
-    {
+    public HSinglelineEntry(int x, int y, int width, int height, int maxChars) {
         org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public HSinglelineEntry(String text, int maxChars, Font font, Color color)
-    {
+    public HSinglelineEntry(String text, int maxChars, Font font, Color color) {
         org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public HSinglelineEntry(int maxChars)
-    {
+    public HSinglelineEntry(int maxChars) {
         org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void setTextContent(String string, int state)
-    {
-        throw new Error("Not implemented");
+    public void setTextContent(String string, int state) {
+        super.setTextContent(string, ALL_STATES);
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "setTextContent");
     }
 
-    public String getTextContent(int state)
-    {
-        throw new Error("Not implemented");
+    public String getTextContent(int state) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return "";
     }
 
-    public int getCaretCharPosition()
-    {
-        throw new Error("Not implemented");
+    public int getCaretCharPosition() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return 0;
     }
 
-    public int setCaretCharPosition(int position)
-    {
-        throw new Error("Not implemented");
+    public int setCaretCharPosition(int position) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return 0;
     }
 
-    public void setType(int type)
-    {
-        throw new Error("Not implemented");
+    public void setType(int type) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void setValidInput(char[] inputChars)
-    {
-        throw new Error("Not implemented");
+    public void setValidInput(char[] inputChars) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public boolean echoCharIsSet()
-    {
-        throw new Error("Not implemented");
+    public boolean echoCharIsSet() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return false;
     }
 
-    public char getEchoChar()
-    {
-        throw new Error("Not implemented");
+    public char getEchoChar() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return 0;
     }
 
-    public void setEchoChar(char c)
-    {
-        throw new Error("Not implemented");
+    public void setEchoChar(char c) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public static void setDefaultLook(HSinglelineEntryLook look)
-    {
+    public static void setDefaultLook(HSinglelineEntryLook look) {
         DefaultLook = look;
     }
 
-    public static HSinglelineEntryLook getDefaultLook()
-    {
+    public static HSinglelineEntryLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
-        throw new Error("Not implemented");
+    public void setLook(HLook hlook) throws HInvalidLookException {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public boolean insertChar(char c)
-    {
-        throw new Error("Not implemented");
+    public boolean insertChar(char c) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return false;
     }
 
-    public boolean deletePreviousChar()
-    {
-        throw new Error("Not implemented");
+    public boolean deletePreviousChar() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return false;
     }
 
-    public boolean deleteNextChar()
-    {
-        throw new Error("Not implemented");
+    public boolean deleteNextChar() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return false;
     }
 
-    public void caretNextCharacter()
-    {
-        throw new Error("Not implemented");
+    public void caretNextCharacter() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void caretPreviousCharacter()
-    {
-        throw new Error("Not implemented");
+    public void caretPreviousCharacter() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void setMaxChars(int maxChars)
-    {
-        throw new Error("Not implemented");
+    public void setMaxChars(int maxChars) {
+        if (maxChars < 0)
+            this.maxChars = 0;
+        else
+            this.maxChars = maxChars;
     }
 
-    public int getMaxChars()
-    {
-        throw new Error("Not implemented");
+    public int getMaxChars() {
+        return maxChars;
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
-        throw new Error("Not implemented");
+    public HNavigable getMove(int keyCode) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void addHKeyListener(HKeyListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHKeyListener(HKeyListener l) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void removeHKeyListener(HKeyListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHKeyListener(HKeyListener l) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void addHTextListener(HTextListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHTextListener(HTextListener l) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void removeHTextListener(HTextListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHTextListener(HTextListener l) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public boolean getEditMode()
-    {
-        throw new Error("Not implemented");
+    public boolean getEditMode() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return false;
     }
 
-    public void setEditMode(boolean edit)
-    {
-        throw new Error("Not implemented");
+    public void setEditMode(boolean edit) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public int getType()
-    {
-        throw new Error("Not implemented");
+    public int getType() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return 0;
     }
 
-    public char[] getValidInput()
-    {
-        throw new Error("Not implemented");
+    public char[] getValidInput() {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
+        return null;
     }
 
-    public void processHTextEvent(HTextEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHTextEvent(HTextEvent evt) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
-    public void processHKeyEvent(HKeyEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHKeyEvent(HKeyEvent evt) {
+        org.videolan.Logger.unimplemented(HSinglelineEntry.class.getName(), "");
     }
 
+    private int maxChars;
+
     private static HSinglelineEntryLook DefaultLook = null;
 
     private static final long serialVersionUID = 7577783421311076636L;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntryLook.java b/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntryLook.java
index a9424a4..5a6b624 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntryLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HSinglelineEntryLook.java
@@ -24,58 +24,52 @@ import java.awt.Graphics;
 import java.awt.Insets;
 
 public class HSinglelineEntryLook implements HExtendedLook {
-    public HSinglelineEntryLook()
-    {
+    public HSinglelineEntryLook() {
         org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
     }
 
-    public void fillBackground(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void fillBackground(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
     }
 
-    public void renderBorders(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderBorders(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
     }
 
-    public void renderVisible(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void renderVisible(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
     }
 
-    public void showLook(Graphics g, HVisible visible, int state)
-    {
-        throw new Error("Not implemented");
+    public void showLook(Graphics g, HVisible visible, int state) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
     }
 
-    public void widgetChanged(HVisible visible, HChangeData[] changes)
-    {
-        throw new Error("Not implemented");
+    public void widgetChanged(HVisible visible, HChangeData[] changes) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
     }
 
-    public Dimension getMinimumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMinimumSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getPreferredSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Dimension getMaximumSize(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
+        return null;
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
-        throw new Error("Not implemented");
+    public boolean isOpaque(HVisible visible) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
+        return false;
     }
 
-    public Insets getInsets(HVisible hvisible)
-    {
-        throw new Error("Not implemented");
+    public Insets getInsets(HVisible hvisible) {
+        org.videolan.Logger.unimplemented(HSinglelineEntryLook.class.getName(), "");
+        return null;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HStaticAnimation.java b/src/libbluray/bdj/java/org/havi/ui/HStaticAnimation.java
index 778f7af..ac65972 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStaticAnimation.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStaticAnimation.java
@@ -23,93 +23,81 @@ import java.awt.Image;
 
 public class HStaticAnimation extends HVisible implements HNoInputPreferred,
         HAnimateEffect {
-    public HStaticAnimation()
-    {
+    public HStaticAnimation() {
         org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
     public HStaticAnimation(Image[] imagesNormal, int delay, int playMode,
-            int repeatCount, int x, int y, int width, int height)
-    {
+            int repeatCount, int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
     public HStaticAnimation(Image[] imagesNormal, int delay, int playMode,
-            int repeatCount)
-    {
+            int repeatCount) {
         org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
-        throw new Error("Not implemented");
+    public void setLook(HLook hlook) throws HInvalidLookException {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public static void setDefaultLook(HAnimateLook hlook)
-    {
+    public static void setDefaultLook(HAnimateLook hlook) {
         DefaultLook = hlook;
     }
 
-    public static HAnimateLook getDefaultLook()
-    {
+    public static HAnimateLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void start()
-    {
-        throw new Error("Not implemented");
+    public void start() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public void stop()
-    {
-        throw new Error("Not implemented");
+    public void stop() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public boolean isAnimated()
-    {
-        throw new Error("Not implemented");
+    public boolean isAnimated() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
+        return false;
     }
 
-    public void setPosition(int position)
-    {
-        throw new Error("Not implemented");
+    public void setPosition(int position) {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public int getPosition()
-    {
-        throw new Error("Not implemented");
+    public int getPosition() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
+        return 0;
     }
 
-    public void setRepeatCount(int count)
-    {
-        throw new Error("Not implemented");
+    public void setRepeatCount(int count) {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public int getRepeatCount()
-    {
-        throw new Error("Not implemented");
+    public int getRepeatCount() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
+        return 0;
     }
 
-    public void setDelay(int count)
-    {
-        throw new Error("Not implemented");
+    public void setDelay(int count) {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public int getDelay()
-    {
-        throw new Error("Not implemented");
+    public int getDelay() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
+        return 0;
     }
 
-    public void setPlayMode(int mode)
-    {
-        throw new Error("Not implemented");
+    public void setPlayMode(int mode) {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
     }
 
-    public int getPlayMode()
-    {
-        throw new Error("Not implemented");
+    public int getPlayMode() {
+        org.videolan.Logger.unimplemented(HStaticAnimation.class.getName(), "");
+        return 0;
     }
 
     private static HAnimateLook DefaultLook = null;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java b/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java
index 1233e48..2aef0f4 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStaticIcon.java
@@ -23,38 +23,32 @@ import java.awt.Image;
 import org.videolan.BDJXletContext;
 
 public class HStaticIcon extends HVisible implements HNoInputPreferred {
-    public HStaticIcon()
-    {
+    public HStaticIcon() {
         super(getDefaultLook());
     }
 
-    public HStaticIcon(Image imageNormal, int x, int y, int width, int height)
-    {
+    public HStaticIcon(Image imageNormal, int x, int y, int width, int height) {
         super(getDefaultLook(), x, y, width, height);
         setGraphicContent(imageNormal, NORMAL_STATE);
     }
 
-    public HStaticIcon(Image imageNormal)
-    {
+    public HStaticIcon(Image imageNormal) {
         super(getDefaultLook());
         setGraphicContent(imageNormal, NORMAL_STATE);
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
+    public void setLook(HLook hlook) throws HInvalidLookException {
         if ((hlook != null) && !(hlook instanceof HGraphicLook)) {
             throw new HInvalidLookException();
         }
         super.setLook(hlook);
     }
 
-    public static void setDefaultLook(HGraphicLook hlook)
-    {
+    public static void setDefaultLook(HGraphicLook hlook) {
         BDJXletContext.setXletDefaultLook(PROPERTY_LOOK,hlook);
     }
 
-    public static HGraphicLook getDefaultLook()
-    {
+    public static HGraphicLook getDefaultLook() {
         return (HGraphicLook) BDJXletContext.getXletDefaultLook(PROPERTY_LOOK,DEFAULT_LOOK);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HStaticRange.java b/src/libbluray/bdj/java/org/havi/ui/HStaticRange.java
index 385327d..1c5c060 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStaticRange.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStaticRange.java
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2010  William Hahne
+ * Copyright (C) 2016  Petri Hintukainen
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,105 +20,117 @@
 
 package org.havi.ui;
 
+import org.videolan.Logger;
+
 public class HStaticRange extends HVisible implements HNoInputPreferred,
         HOrientable {
-    public HStaticRange()
-    {
-        org.videolan.Logger.unimplemented(HStaticRange.class.getName(), "");
+
+    public HStaticRange() {
+        this(0, 0, 100, 0, 0, 0, -1, -1);
     }
 
-    public HStaticRange(int orientation, int minimum, int maximum, int value,
-            int x, int y, int width, int height)
-    {
-        org.videolan.Logger.unimplemented(HStaticRange.class.getName(), "");
+    public HStaticRange(int orientation, int minimum, int maximum, int value) {
+        this(orientation, minimum, maximum, value, 0, 0, -1, -1);
     }
 
-    public HStaticRange(int orientation, int minimum, int maximum, int value)
-    {
-        org.videolan.Logger.unimplemented(HStaticRange.class.getName(), "");
+    public HStaticRange(int orientation, int minimum, int maximum, int value,
+            int x, int y, int width, int height) {
+
+        super(getDefaultLook(), x, y, width, height);
+
+        logger.unimplemented("");
+
+        setOrientation(orientation);
+        setRange(minimum, maximum);
+        setValue(value);
+        setHorizontalAlignment(HALIGN_CENTER);
+        setVerticalAlignment(VALIGN_CENTER);
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
-        throw new Error("Not implemented");
+    public void setLook(HLook hlook) throws HInvalidLookException {
+        if (hlook == null || (hlook instanceof HRangeLook)) {
+            super.setLook(hlook);
+        } else {
+            logger.error("invalid look");
+            throw new HInvalidLookException();
+        }
     }
 
-    public static void setDefaultLook(HRangeLook look)
-    {
+    public static void setDefaultLook(HRangeLook look) {
         DefaultLook = look;
     }
 
-    public static HRangeLook getDefaultLook()
-    {
+    public static HRangeLook getDefaultLook() {
         if (DefaultLook == null)
-            org.videolan.Logger.unimplemented("", "getDefaultLook");
+            Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public int getOrientation()
-    {
-        throw new Error("Not implemented");
+    public int getOrientation() {
+        return orientation;
     }
 
-    public void setOrientation(int orient)
-    {
-        throw new Error("Not implemented");
+    public void setOrientation(int orient) {
+        logger.unimplemented("setOrientation");
+        this.orientation = orient;
     }
 
-    public boolean setRange(int minimum, int maximum)
-    {
-        throw new Error("Not implemented");
+    public boolean setRange(int minimum, int maximum) {
+        logger.unimplemented("setRange");
+        return false;
     }
 
-    public int getMinValue()
-    {
-        throw new Error("Not implemented");
+    public int getMinValue() {
+        return minimum;
     }
 
-    public int getMaxValue()
-    {
-        throw new Error("Not implemented");
+    public int getMaxValue() {
+        return maximum;
     }
 
-    public void setValue(int value)
-    {
-        throw new Error("Not implemented");
+    public void setValue(int value) {
+        logger.unimplemented("setValue");
     }
 
-    public int getValue()
-    {
-        throw new Error("Not implemented");
+    public int getValue() {
+        return value;
     }
 
-    public void setThumbOffsets(int minOffset, int maxOffset)
-    {
-        throw new Error("Not implemented");
+    public void setThumbOffsets(int minOffset, int maxOffset) {
+        logger.unimplemented("setThumbOffset");
     }
 
-    public int getThumbMinOffset()
-    {
-        throw new Error("Not implemented");
+    public int getThumbMinOffset() {
+        return minOffset;
     }
 
-    public int getThumbMaxOffset()
-    {
-        throw new Error("Not implemented");
+    public int getThumbMaxOffset() {
+        return maxOffset;
     }
 
-    public void setBehavior(int behavior)
-    {
-        throw new Error("Not implemented");
+    public void setBehavior(int behavior) {
+        logger.unimplemented("");
+        this.behavior = behavior;
     }
 
-    public int getBehavior()
-    {
-        throw new Error("Not implemented");
+    public int getBehavior() {
+        return behavior;
     }
 
+    private int value = 0;
+    private int minimum = 0;
+    private int maximum = 100;
+    private int orientation = 0;
+    private int behavior = SLIDER_BEHAVIOR;
+    private int minOffset = 0;
+    private int maxOffset = 0;
+
     public final static int SLIDER_BEHAVIOR = 0;
     public final static int SCROLLBAR_BEHAVIOR = 1;
 
     private static HRangeLook DefaultLook = null;
 
     private static final long serialVersionUID = 3871722305722412744L;
+
+    private static final Logger logger = Logger.getLogger(HStaticRange.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HStaticText.java b/src/libbluray/bdj/java/org/havi/ui/HStaticText.java
index c83da34..9495aea 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStaticText.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStaticText.java
@@ -27,13 +27,11 @@ import org.videolan.BDJXletContext;
 import org.videolan.Logger;
 
 public class HStaticText extends HVisible implements HNoInputPreferred {
-    public HStaticText()
-    {
+    public HStaticText() {
         this(null, 0, 0, 0, 0);
     }
 
-    public HStaticText(String textNormal, int x, int y, int width, int height)
-    {
+    public HStaticText(String textNormal, int x, int y, int width, int height) {
         super(getDefaultLook(), x, y, width, height);
         setTextContent(textNormal, ALL_STATES);
         logger.info("HStaticText " + textNormal + " at " + x + "," + y + " " + width + "x" + height);
@@ -41,8 +39,7 @@ public class HStaticText extends HVisible implements HNoInputPreferred {
 
     public HStaticText(String textNormal, int x, int y, int width, int height,
             Font font, Color foreground, Color background,
-            HTextLayoutManager tlm)
-    {
+            HTextLayoutManager tlm) {
         this(textNormal, x, y, width, height);
         setFont(font);
         setForeground(foreground);
@@ -50,15 +47,13 @@ public class HStaticText extends HVisible implements HNoInputPreferred {
         setTextLayoutManager(tlm);
     }
 
-    public HStaticText(String textNormal)
-    {
+    public HStaticText(String textNormal) {
         this(textNormal, 0, 0, 0, 0);
         setTextContent(textNormal, NORMAL_STATE);
     }
 
     public HStaticText(String textNormal, Font font, Color foreground,
-            Color background, HTextLayoutManager tlm)
-    {
+            Color background, HTextLayoutManager tlm) {
         this(textNormal, 0, 0, 0, 0);
         setFont(font);
         setForeground(foreground);
@@ -66,20 +61,17 @@ public class HStaticText extends HVisible implements HNoInputPreferred {
         setTextLayoutManager(tlm);
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
+    public void setLook(HLook hlook) throws HInvalidLookException {
         if ((hlook != null) && !(hlook instanceof HTextLook))
             throw new HInvalidLookException();
         super.setLook(hlook);
     }
 
-    public static void setDefaultLook(HTextLook hlook)
-    {
+    public static void setDefaultLook(HTextLook hlook) {
         BDJXletContext.setXletDefaultLook(PROPERTY_LOOK,hlook);
     }
 
-    public static HTextLook getDefaultLook()
-    {
+    public static HTextLook getDefaultLook() {
         return (HTextLook) BDJXletContext.getXletDefaultLook(PROPERTY_LOOK,DEFAULT_LOOK);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HStillImageBackgroundConfiguration.java b/src/libbluray/bdj/java/org/havi/ui/HStillImageBackgroundConfiguration.java
index ba04092..99a354d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HStillImageBackgroundConfiguration.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HStillImageBackgroundConfiguration.java
@@ -25,7 +25,6 @@ import java.io.IOException;
 public class HStillImageBackgroundConfiguration extends
         HBackgroundConfiguration {
     protected HStillImageBackgroundConfiguration() {
-
     }
 
     protected HStillImageBackgroundConfiguration(HBackgroundConfigTemplate hbct, Color color) {
@@ -39,8 +38,7 @@ public class HStillImageBackgroundConfiguration extends
 
     public void displayImage(HBackgroundImage image, HScreenRectangle r)
             throws IOException, HPermissionDeniedException,
-            HConfigurationException
-    {
+            HConfigurationException {
         this.image = image;
         this.rect = r;
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HText.java b/src/libbluray/bdj/java/org/havi/ui/HText.java
index f7609b7..04bda22 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HText.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HText.java
@@ -26,32 +26,28 @@ import java.awt.Font;
 import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
+import org.videolan.BDJXletContext;
 import org.videolan.Logger;
 
 public class HText extends HStaticText implements HNavigable {
-    public HText()
-    {
+    public HText() {
         this(null);
     }
 
-    public HText(String text)
-    {
+    public HText(String text) {
         this(text, text, 0, 0, 0, 0);
     }
 
-    public HText(String textNormal, String textFocus)
-    {
+    public HText(String textNormal, String textFocus) {
         this(textNormal, textFocus, 0, 0, 0, 0);
     }
 
-    public HText(String text, int x, int y, int width, int height)
-    {
+    public HText(String text, int x, int y, int width, int height) {
         this(text, text, x, y, width, height);
     }
 
     public HText(String textNormal, String textFocus, int x, int y, int width,
-            int height)
-    {
+            int height) {
         super(textNormal, x, y, width, height);
         try {
             setLook(getDefaultLook());
@@ -68,27 +64,23 @@ public class HText extends HStaticText implements HNavigable {
     }
 
     public HText(String text, Font font, Color foreground, Color background,
-            HTextLayoutManager tlm)
-    {
+            HTextLayoutManager tlm) {
         this(text, text, 0, 0, 0, 0, font, foreground, background, tlm);
     }
 
     public HText(String textNormal, String textFocus, Font font,
-            Color foreground, Color background, HTextLayoutManager tlm)
-    {
+            Color foreground, Color background, HTextLayoutManager tlm) {
         this(textNormal, textFocus, 0, 0, 0, 0, font, foreground, background, tlm);
     }
 
     public HText(String text, int x, int y, int width, int height, Font font,
-            Color foreground, Color background, HTextLayoutManager tlm)
-    {
+            Color foreground, Color background, HTextLayoutManager tlm) {
         this(text, text, x, y, width, height, font, foreground, background, tlm);
     }
 
     public HText(String textNormal, String textFocus, int x, int y, int width,
             int height, Font font, Color foreground, Color background,
-            HTextLayoutManager tlm)
-    {
+            HTextLayoutManager tlm) {
         this(textNormal, textFocus, x, y, width, height);
         setFont(font);
         setForeground(foreground);
@@ -96,90 +88,74 @@ public class HText extends HStaticText implements HNavigable {
         setTextLayoutManager(tlm);
     }
 
-    public static void setDefaultLook(HTextLook look)
-    {
-        DefaultLook = look;
-    }
-
-    public static HTextLook getDefaultLook()
-    {
-        if (DefaultLook == null)
-            DefaultLook = new HTextLook();
-        return DefaultLook;
-    }
-
-    public void setMove(int keyCode, HNavigable target)
-    {
+    public void setMove(int keyCode, HNavigable target) {
         logger.unimplemented("setMove");
     }
 
-    public HNavigable getMove(int keyCode)
-    {
+    public HNavigable getMove(int keyCode) {
         logger.unimplemented("getMove");
         return this;
     }
 
-    public boolean isFocusable()
-    {
+    public boolean isFocusable() {
         return true;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
+            HNavigable left, HNavigable right) {
         logger.unimplemented("setFocusTraversal");
     }
 
-    public boolean isSelected()
-    {
+    public boolean isSelected() {
         logger.unimplemented("isSelected");
         return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
+    public void setGainFocusSound(HSound sound) {
         logger.unimplemented("setGainFocusSound");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
+    public void setLoseFocusSound(HSound sound) {
         logger.unimplemented("setLoseFocusSound");
     }
 
-    public HSound getGainFocusSound()
-    {
+    public HSound getGainFocusSound() {
         logger.unimplemented("getGainFocusSound");
         return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
+    public HSound getLoseFocusSound() {
         logger.unimplemented("getLoseFocusSound");
         return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
+    public void addHFocusListener(HFocusListener l) {
         logger.unimplemented("addHFocusListener");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
+    public void removeHFocusListener(HFocusListener l) {
         logger.unimplemented("removeHFocusListener");
     }
 
-    public int[] getNavigationKeys()
-    {
+    public int[] getNavigationKeys() {
         logger.unimplemented("getNavigationKeys");
         return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
+    public void processHFocusEvent(HFocusEvent evt) {
         logger.unimplemented("processHFocusEvent");
     }
 
-    private static HTextLook DefaultLook = null;
+    public static void setDefaultLook(HTextLook hlook) {
+        BDJXletContext.setXletDefaultLook(PROPERTY_LOOK, hlook);
+    }
+
+    public static HTextLook getDefaultLook() {
+        return (HTextLook) BDJXletContext.getXletDefaultLook(PROPERTY_LOOK, DEFAULT_LOOK);
+    }
+
+    static final Class DEFAULT_LOOK = HTextLook.class;
+    private static final String PROPERTY_LOOK = HText.class.getName();
 
     private static final long serialVersionUID = -8178609258303529066L;
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HTextButton.java b/src/libbluray/bdj/java/org/havi/ui/HTextButton.java
index 0ac5e1c..2d72a3b 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HTextButton.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HTextButton.java
@@ -27,140 +27,122 @@ import org.havi.ui.event.HFocusEvent;
 import org.havi.ui.event.HFocusListener;
 
 public class HTextButton extends HText implements HActionable {
-    public HTextButton()
-    {
+    public HTextButton() {
         org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public HTextButton(String text, int x, int y, int width, int height)
-    {
+    public HTextButton(String text, int x, int y, int width, int height) {
         org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
     public HTextButton(String text, int x, int y, int width, int height,
             Font font, Color foreground, Color background,
-            HTextLayoutManager tlm)
-    {
+            HTextLayoutManager tlm) {
         org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public HTextButton(String text)
-    {
+    public HTextButton(String text) {
         org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
     public HTextButton(String text, Font font, Color foreground,
-            Color background, HTextLayoutManager tlm)
-    {
+            Color background, HTextLayoutManager tlm) {
         org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public static void setDefaultLook(HTextLook hlook)
-    {
+    public static void setDefaultLook(HTextLook hlook) {
         DefaultLook = hlook;
     }
 
-    public static HTextLook getDefaultLook()
-    {
+    public static HTextLook getDefaultLook() {
         if (DefaultLook == null)
             org.videolan.Logger.unimplemented("", "getDefaultLook");
         return DefaultLook;
     }
 
-    public void setMove(int keyCode, HNavigable target)
-    {
-        throw new Error("Not implemented");
+    public void setMove(int keyCode, HNavigable target) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
     public HNavigable getMove(int keyCode)
     {
-        throw new Error("Not implemented");
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return null;
     }
 
     public void setFocusTraversal(HNavigable up, HNavigable down,
-            HNavigable left, HNavigable right)
-    {
-        throw new Error("Not implemented");
+            HNavigable left, HNavigable right) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public boolean isSelected()
-    {
-        throw new Error("Not implemented");
+    public boolean isSelected() {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return false;
     }
 
-    public void setGainFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setGainFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public void setLoseFocusSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setLoseFocusSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public HSound getGainFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getGainFocusSound() {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return null;
     }
 
-    public HSound getLoseFocusSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getLoseFocusSound() {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return null;
     }
 
-    public void addHFocusListener(HFocusListener l)
-    {
-         throw new Error("Not implemented");
+    public void addHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public void removeHFocusListener(HFocusListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHFocusListener(HFocusListener l) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public int[] getNavigationKeys()
-    {
-        throw new Error("Not implemented");
+    public int[] getNavigationKeys() {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return null;
     }
 
-    public void processHFocusEvent(HFocusEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHFocusEvent(HFocusEvent evt) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public void addHActionListener(HActionListener l)
-    {
-        throw new Error("Not implemented");
+    public void addHActionListener(HActionListener l) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public void removeHActionListener(HActionListener l)
-    {
-        throw new Error("Not implemented");
+    public void removeHActionListener(HActionListener l) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public void setActionCommand(String command)
-    {
-        throw new Error("Not implemented");
+    public void setActionCommand(String command) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public void setActionSound(HSound sound)
-    {
-        throw new Error("Not implemented");
+    public void setActionSound(HSound sound) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public HSound getActionSound()
-    {
-        throw new Error("Not implemented");
+    public HSound getActionSound() {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return null;
     }
 
-    public void processHActionEvent(HActionEvent evt)
-    {
-        throw new Error("Not implemented");
+    public void processHActionEvent(HActionEvent evt) {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
     }
 
-    public String getActionCommand()
-    {
-        throw new Error("Not implemented");
+    public String getActionCommand() {
+        org.videolan.Logger.unimplemented(HTextButton.class.getName(), "");
+        return null;
     }
 
     private static HTextLook DefaultLook = null;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HTextLook.java b/src/libbluray/bdj/java/org/havi/ui/HTextLook.java
index dc4f8d5..295e9f0 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HTextLook.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HTextLook.java
@@ -29,12 +29,10 @@ import org.videolan.Logger;
 
 public class HTextLook implements HExtendedLook {
 
-    public HTextLook()
-    {
+    public HTextLook() {
     }
 
-    public void fillBackground(Graphics g, HVisible visible, int state)
-    {
+    public void fillBackground(Graphics g, HVisible visible, int state) {
         if (visible.getBackgroundMode() == HVisible.BACKGROUND_FILL) {
             Color color = visible.getBackground();
             Dimension dimension = visible.getSize();
@@ -43,8 +41,7 @@ public class HTextLook implements HExtendedLook {
         }
     }
 
-    public void renderBorders(Graphics g, HVisible visible, int state)
-    {
+    public void renderBorders(Graphics g, HVisible visible, int state) {
         Insets insets = getInsets(visible);
         Color fg = visible.getForeground();
         Dimension dimension = visible.getSize();
@@ -58,8 +55,7 @@ public class HTextLook implements HExtendedLook {
         }
     }
 
-    public void renderVisible(Graphics g, HVisible visible, int state)
-    {
+    public void renderVisible(Graphics g, HVisible visible, int state) {
         String text = visible.getTextContent(state);
         Insets insets = getInsets(visible);
         if (text == null) {
@@ -68,38 +64,32 @@ public class HTextLook implements HExtendedLook {
         logger.unimplemented("renderVisible[text=" + text + "]");
     }
 
-    public void showLook(Graphics g, HVisible visible, int state)
-    {
+    public void showLook(Graphics g, HVisible visible, int state) {
         fillBackground(g, visible, state);
         renderVisible(g, visible, state);
         renderBorders(g, visible, state);
     }
 
-    public void widgetChanged(HVisible visible, HChangeData[] changes)
-    {
+    public void widgetChanged(HVisible visible, HChangeData[] changes) {
         visible.repaint();
     }
 
-    public Dimension getMinimumSize(HVisible hvisible)
-    {
+    public Dimension getMinimumSize(HVisible hvisible) {
         logger.unimplemented("getMinimumSize");
         return null;
     }
 
-    public Dimension getPreferredSize(HVisible hvisible)
-    {
+    public Dimension getPreferredSize(HVisible hvisible) {
         logger.unimplemented("getPreferredSize");
         return null;
     }
 
-    public Dimension getMaximumSize(HVisible hvisible)
-    {
+    public Dimension getMaximumSize(HVisible hvisible) {
         logger.unimplemented("getMAximumSize");
         return null;
     }
 
-    public boolean isOpaque(HVisible visible)
-    {
+    public boolean isOpaque(HVisible visible) {
         if (visible.getBackgroundMode() != 1) {
             return false;
         }
@@ -112,8 +102,7 @@ public class HTextLook implements HExtendedLook {
         return true;
     }
 
-    public Insets getInsets(HVisible visible)
-    {
+    public Insets getInsets(HVisible visible) {
         if (!visible.getBordersEnabled()) {
             return new Insets(0, 0, 0, 0);
         }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HToggleButton.java b/src/libbluray/bdj/java/org/havi/ui/HToggleButton.java
index 8ae31dc..953b0d2 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HToggleButton.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HToggleButton.java
@@ -24,35 +24,30 @@ import java.awt.Image;
 import org.videolan.BDJXletContext;
 
 public class HToggleButton extends HGraphicButton implements HSwitchable {
-    public HToggleButton()
-    {
+    public HToggleButton() {
         super();
         iniz();
     }
 
-    public HToggleButton(Image image, int x, int y, int width, int height)
-    {
+    public HToggleButton(Image image, int x, int y, int width, int height) {
         super(image, x, y, width, height);
         iniz();
     }
 
-    public HToggleButton(Image image)
-    {
+    public HToggleButton(Image image) {
         super(image);
         iniz();
     }
 
     public HToggleButton(Image image, int x, int y, int width, int height,
-            boolean state)
-    {
+            boolean state) {
         this(image, x, y, width, height);
         setSwitchableState(state);
     }
 
     public HToggleButton(Image imageNormal, Image imageFocused,
             Image imageActioned, Image imageNormalActioned, int x, int y,
-            int width, int height, boolean state)
-    {
+            int width, int height, boolean state) {
         super(imageNormal, imageFocused, imageActioned, x, y, width, height);
         setGraphicContent(imageNormalActioned, ACTIONED_STATE);
         setSwitchableState(state);
@@ -60,8 +55,7 @@ public class HToggleButton extends HGraphicButton implements HSwitchable {
     }
 
     public HToggleButton(Image imageNormal, Image imageFocused,
-            Image imageActioned, Image imageNormalActioned, boolean state)
-    {
+            Image imageActioned, Image imageNormalActioned, boolean state) {
         super(imageNormal, imageFocused, imageActioned);
         setGraphicContent(imageNormalActioned, ACTIONED_STATE);
         setSwitchableState(state);
@@ -69,14 +63,12 @@ public class HToggleButton extends HGraphicButton implements HSwitchable {
     }
 
     public HToggleButton(Image image, int x, int y, int width, int height,
-            boolean state, HToggleGroup group)
-    {
+            boolean state, HToggleGroup group) {
         this(image, x, y, width, height, state);
         setToggleGroup(group);
     }
 
-    public HToggleButton(Image image, boolean state, HToggleGroup group)
-    {
+    public HToggleButton(Image image, boolean state, HToggleGroup group) {
         this(image);
         setSwitchableState(state);
         setToggleGroup(group);
@@ -84,30 +76,26 @@ public class HToggleButton extends HGraphicButton implements HSwitchable {
 
     public HToggleButton(Image imageNormal, Image imageFocused,
             Image imageActioned, Image imageNormalActioned, int x, int y,
-            int width, int height, boolean state, HToggleGroup group)
-    {
+            int width, int height, boolean state, HToggleGroup group) {
         this(imageNormal, imageFocused, imageActioned, imageNormalActioned, x, y, width, height, state);
         setToggleGroup(group);
     }
 
     public HToggleButton(Image imageNormal, Image imageFocused,
             Image imageActioned, Image imageNormalActioned, boolean state,
-            HToggleGroup group)
-    {
+            HToggleGroup group) {
         this(imageNormal, imageFocused, imageActioned, imageNormalActioned, state);
         setToggleGroup(group);
     }
 
-    private void iniz()
-    {
+    private void iniz() {
         try {
             setLook(getDefaultLook());
         } catch (HInvalidLookException ignored) {
         }
     }
 
-    public void setToggleGroup(HToggleGroup group)
-    {
+    public void setToggleGroup(HToggleGroup group) {
         HToggleGroup oldGroup = toggleGroup;
 
         // Remove ourselves if already a member of a group
@@ -127,44 +115,36 @@ public class HToggleButton extends HGraphicButton implements HSwitchable {
         }
     }
 
-    public HToggleGroup getToggleGroup()
-    {
+    public HToggleGroup getToggleGroup() {
         return toggleGroup;
     }
 
-    public void removeToggleGroup()
-    {
+    public void removeToggleGroup() {
         setToggleGroup(null);
     }
 
-    public static void setDefaultLook(HGraphicLook hlook)
-    {
+    public static void setDefaultLook(HGraphicLook hlook) {
         BDJXletContext.setXletDefaultLook(PROPERTY_LOOK, hlook);
     }
 
-    public static HGraphicLook getDefaultLook()
-    {
+    public static HGraphicLook getDefaultLook() {
         return (HGraphicLook) BDJXletContext.getXletDefaultLook(PROPERTY_LOOK, DEFAULT_LOOK);
     }
 
-    public boolean getSwitchableState()
-    {
+    public boolean getSwitchableState() {
         return (getInteractionState() & ACTIONED_STATE_BIT) != 0;
     }
 
-    public void setSwitchableState(boolean state)
-    {
+    public void setSwitchableState(boolean state) {
         int old = getInteractionState();
         setInteractionState(state ? (old | ACTIONED_STATE_BIT) : (old & ~ACTIONED_STATE_BIT));
     }
 
-    public void setUnsetActionSound(HSound sound)
-    {
+    public void setUnsetActionSound(HSound sound) {
         unsetActionSound = sound;
     }
 
-    public HSound getUnsetActionSound()
-    {
+    public HSound getUnsetActionSound() {
         return unsetActionSound;
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HToggleGroup.java b/src/libbluray/bdj/java/org/havi/ui/HToggleGroup.java
index 8bd4366..6ff12a7 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HToggleGroup.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HToggleGroup.java
@@ -24,17 +24,14 @@ import java.util.Vector;
 
 public class HToggleGroup {
 
-    public HToggleGroup()
-    {
+    public HToggleGroup() {
     }
 
-    public HToggleButton getCurrent()
-    {
+    public HToggleButton getCurrent() {
         return current;
     }
 
-    public void setCurrent(HToggleButton selection)
-    {
+    public void setCurrent(HToggleButton selection) {
         // Treat null as unselection
         if (selection == null) {
             HToggleButton tmp = getCurrent();
@@ -56,8 +53,7 @@ public class HToggleGroup {
         }
     }
 
-    public void setForcedSelection(boolean forceSelection)
-    {
+    public void setForcedSelection(boolean forceSelection) {
         this.forceSelection = forceSelection;
 
         // Enforce new setting
@@ -66,26 +62,22 @@ public class HToggleGroup {
         }
     }
 
-    public boolean getForcedSelection()
-    {
+    public boolean getForcedSelection() {
         return forceSelection;
     }
 
-    public void setEnabled(boolean enable)
-    {
+    public void setEnabled(boolean enable) {
         enabled = enable;
         for (Enumeration e = buttons.elements(); e.hasMoreElements();) {
             setEnabled((HToggleButton) e.nextElement(), enable);
         }
     }
 
-    public boolean isEnabled()
-    {
+    public boolean isEnabled() {
         return enabled;
     }
 
-    protected void add(HToggleButton button)
-    {
+    protected void add(HToggleButton button) {
         // Only add if not already added
         if (!buttons.contains(button)) {
             buttons.addElement(button);
@@ -106,8 +98,7 @@ public class HToggleGroup {
         }
     }
 
-    protected void remove(HToggleButton button)
-    {
+    protected void remove(HToggleButton button) {
         if (!buttons.removeElement(button)) {
             throw new IllegalArgumentException("Not a member of this HToggleGroup");
         } else {
@@ -122,16 +113,14 @@ public class HToggleGroup {
     }
 
 
-    private void unswitch(HToggleButton button)
-    {
+    private void unswitch(HToggleButton button) {
         for (Enumeration e = buttons.elements(); e.hasMoreElements();) {
             HToggleButton b = (HToggleButton) e.nextElement();
             if (b != button) b.setSwitchableState(false);
         }
     }
 
-    private void forceSelect()
-    {
+    private void forceSelect() {
         // assert(getCurrent() == null);
         if (buttons.size() > 0) {
             HToggleButton b = (HToggleButton) buttons.elementAt(0);
@@ -140,8 +129,7 @@ public class HToggleGroup {
         }
     }
 
-    private void setEnabled(HToggleButton tb, boolean enable)
-    {
+    private void setEnabled(HToggleButton tb, boolean enable) {
         if (false) { // If HAVi 1.1
             tb.setEnabled(enable);
         } else {
diff --git a/src/libbluray/bdj/java/org/havi/ui/HUIException.java b/src/libbluray/bdj/java/org/havi/ui/HUIException.java
index eede917..9b69dea 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HUIException.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HUIException.java
@@ -20,13 +20,11 @@
 package org.havi.ui;
 
 public class HUIException extends Exception {
-    public HUIException()
-    {
+    public HUIException() {
         super();
     }
 
-    public HUIException(String reason)
-    {
+    public HUIException(String reason) {
         super(reason);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/HVideoComponent.java b/src/libbluray/bdj/java/org/havi/ui/HVideoComponent.java
index 27ee4a0..b0b9c5f 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HVideoComponent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HVideoComponent.java
@@ -22,27 +22,23 @@ package org.havi.ui;
 import org.havi.ui.event.HScreenLocationModifiedListener;
 
 public class HVideoComponent extends HComponent {
-    protected HVideoComponent()
-    {
+    protected HVideoComponent() {
         org.videolan.Logger.unimplemented(HVideoComponent.class.getName(), "");
     }
 
-    public HVideoDevice getVideoDevice()
-    {
+    public HVideoDevice getVideoDevice() {
         org.videolan.Logger.unimplemented(HVideoComponent.class.getName(), "getVideoDevice");
         return new HVideoDevice();
     }
 
     public void addOnScreenLocationModifiedListener(
-            HScreenLocationModifiedListener slml)
-    {
+            HScreenLocationModifiedListener slml) {
         org.videolan.Logger.unimplemented(HVideoComponent.class.getName(),
                                           "addOnScreenLocationModifiedListener");
     }
 
     public void removeOnScreenLocationModifiedListener(
-            HScreenLocationModifiedListener slml)
-    {
+            HScreenLocationModifiedListener slml) {
         org.videolan.Logger.unimplemented(HVideoComponent.class.getName(),
                                           "removeOnScreenLocationModifiedListener");
     }
diff --git a/src/libbluray/bdj/java/org/havi/ui/HVideoConfiguration.java b/src/libbluray/bdj/java/org/havi/ui/HVideoConfiguration.java
index a22fcbf..7d8bf6d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HVideoConfiguration.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HVideoConfiguration.java
@@ -21,7 +21,6 @@ package org.havi.ui;
 
 public class HVideoConfiguration extends HScreenConfiguration {
     protected HVideoConfiguration() {
-
     }
 
     HVideoConfiguration(HVideoConfigTemplate hvct) {
diff --git a/src/libbluray/bdj/java/org/havi/ui/HVisible.java b/src/libbluray/bdj/java/org/havi/ui/HVisible.java
index 2eb49d6..590701f 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HVisible.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HVisible.java
@@ -29,18 +29,15 @@ import java.util.Map;
 import org.videolan.Logger;
 
 public class HVisible extends HComponent implements HState {
-    public HVisible()
-    {
+    public HVisible() {
         this(null);
     }
 
-    public HVisible(HLook hlook)
-    {
+    public HVisible(HLook hlook) {
         this(hlook, 0, 0, 0, 0);
     }
 
-    public HVisible(HLook hlook, int x, int y, int width, int height)
-    {
+    public HVisible(HLook hlook, int x, int y, int width, int height) {
         super(x, y, width, height);
         hLook = hlook;
         TextLayoutManager = new HDefaultTextLayoutManager();
@@ -48,48 +45,40 @@ public class HVisible extends HComponent implements HState {
         content = new Object[LAST_STATE - FIRST_STATE + 1];
     }
 
-    public boolean isFocusTraversable()
-    {
+    public boolean isFocusTraversable() {
         if (this instanceof HNavigable || this instanceof HSelectionInputPreferred) {
             return true;
         }
         return false;
     }
 
-    public void paint(Graphics g)
-    {
+    public void paint(Graphics g) {
         if (hLook != null)
             hLook.showLook(g, this, InteractionState);
     }
 
-    public void update(Graphics g)
-    {
+    public void update(Graphics g) {
         g.setColor(getBackground());
         paint(g);
     }
 
-    public void setTextContent(String string, int state)
-    {
+    public void setTextContent(String string, int state) {
         setContentImpl(string, state, TEXT_CONTENT_CHANGE);
     }
 
-    public void setGraphicContent(Image image, int state)
-    {
+    public void setGraphicContent(Image image, int state) {
         setContentImpl(image, state, GRAPHIC_CONTENT_CHANGE);
     }
 
-    public void setAnimateContent(Image[] imageArray, int state)
-    {
+    public void setAnimateContent(Image[] imageArray, int state) {
         setContentImpl(imageArray, state, ANIMATE_CONTENT_CHANGE);
     }
 
-    public void setContent(Object object, int state)
-    {
+    public void setContent(Object object, int state) {
         setContentImpl(object, state, CONTENT_CHANGE);
     }
 
-    private void setContentImpl(Object object, int state, int hint)
-    {
+    private void setContentImpl(Object object, int state, int hint) {
         int states = LAST_STATE - FIRST_STATE + 1;
 
         Object[] oldData = new Object[states + 1];
@@ -154,34 +143,29 @@ public class HVisible extends HComponent implements HState {
         return content[state - FIRST_STATE];
     }
 
-    public void setLook(HLook hlook) throws HInvalidLookException
-    {
+    public void setLook(HLook hlook) throws HInvalidLookException {
         hLook = hlook;
     }
 
-    public HLook getLook()
-    {
+    public HLook getLook() {
         return hLook;
     }
 
-    public Dimension getPreferredSize()
-    {
+    public Dimension getPreferredSize() {
         if (hLook != null) {
             return hLook.getPreferredSize(this);
         }
         return getSize();
     }
 
-    public Dimension getMaximumSize()
-    {
+    public Dimension getMaximumSize() {
         if (hLook != null) {
             return hLook.getMaximumSize(this);
         }
         return getSize();
     }
 
-    public Dimension getMinimumSize()
-    {
+    public Dimension getMinimumSize() {
         if (hLook != null) {
             return hLook.getMinimumSize(this);
         }
@@ -195,8 +179,7 @@ public class HVisible extends HComponent implements HState {
             setInteractionState(InteractionState | FOCUSED_STATE_BIT);
     }
 
-    protected void setInteractionState(int state)
-    {
+    protected void setInteractionState(int state) {
         if (InteractionState == state)
             return;
 
@@ -205,28 +188,23 @@ public class HVisible extends HComponent implements HState {
         visibleChanged(STATE_CHANGE, oldState);
     }
 
-    public int getInteractionState()
-    {
+    public int getInteractionState() {
         return InteractionState;
     }
 
-    public void setTextLayoutManager(HTextLayoutManager manager)
-    {
+    public void setTextLayoutManager(HTextLayoutManager manager) {
         TextLayoutManager = manager;
     }
 
-    public HTextLayoutManager getTextLayoutManager()
-    {
+    public HTextLayoutManager getTextLayoutManager() {
         return TextLayoutManager;
     }
 
-    public int getBackgroundMode()
-    {
+    public int getBackgroundMode() {
         return BackgroundMode;
     }
 
-    public void setBackgroundMode(int mode)
-    {
+    public void setBackgroundMode(int mode) {
         if (mode != BACKGROUND_FILL && mode != NO_BACKGROUND_FILL) {
             logger.info("mode out of range in setBackgroundMode()");
             throw new IllegalArgumentException("Unknown background fill mode");
@@ -234,34 +212,29 @@ public class HVisible extends HComponent implements HState {
         BackgroundMode = mode;
     }
 
-    public boolean isOpaque()
-    {
+    public boolean isOpaque() {
         if (hLook == null) {
             return false;
         }
         return hLook.isOpaque(this);
     }
 
-    public void setDefaultSize(Dimension defaultSize)
-    {
+    public void setDefaultSize(Dimension defaultSize) {
         this.defaultSize = defaultSize;
     }
 
-    public Dimension getDefaultSize()
-    {
+    public Dimension getDefaultSize() {
         return defaultSize;
     }
 
-    public Object getLookData(Object key)
-    {
+    public Object getLookData(Object key) {
         if (lookData == null || !lookData.containsKey(key)) {
             return null;
         }
         return lookData.get(key);
     }
 
-    public void setLookData(Object key, Object data)
-    {
+    public void setLookData(Object key, Object data) {
         if (lookData == null) {
             lookData = new Hashtable();
         }
@@ -277,8 +250,7 @@ public class HVisible extends HComponent implements HState {
         lookData.put(key, data);
     }
 
-    public void setHorizontalAlignment(int halign)
-    {
+    public void setHorizontalAlignment(int halign) {
         if (halign != HALIGN_LEFT && halign != HALIGN_CENTER &&
             halign != HALIGN_RIGHT && halign != HALIGN_JUSTIFY) {
             logger.info("align out of range in setHorizontalAlignment()");
@@ -289,8 +261,7 @@ public class HVisible extends HComponent implements HState {
         visibleChanged(UNKNOWN_CHANGE, new Integer(UNKNOWN_CHANGE));
     }
 
-    public void setVerticalAlignment(int valign)
-    {
+    public void setVerticalAlignment(int valign) {
         if (valign != VALIGN_TOP && valign != VALIGN_CENTER &&
             valign != VALIGN_BOTTOM && valign != VALIGN_JUSTIFY) {
             logger.info("align out of range in setVerticalAlignment()");
@@ -301,18 +272,15 @@ public class HVisible extends HComponent implements HState {
         visibleChanged(UNKNOWN_CHANGE, new Integer(UNKNOWN_CHANGE));
     }
 
-    public int getHorizontalAlignment()
-    {
+    public int getHorizontalAlignment() {
         return halign;
     }
 
-    public int getVerticalAlignment()
-    {
+    public int getVerticalAlignment() {
         return valign;
     }
 
-    public void setResizeMode(int resize)
-    {
+    public void setResizeMode(int resize) {
         if (resize != RESIZE_NONE && resize != RESIZE_PRESERVE_ASPECT &&
             resize != RESIZE_ARBITRARY) {
             logger.info("resize out of range in setResizeMode()");
@@ -323,13 +291,11 @@ public class HVisible extends HComponent implements HState {
         visibleChanged(UNKNOWN_CHANGE, new Integer(UNKNOWN_CHANGE));
     }
 
-    public int getResizeMode()
-    {
+    public int getResizeMode() {
         return resizeMode;
     }
 
-    public void setEnabled(boolean b)
-    {
+    public void setEnabled(boolean b) {
         super.setEnabled(b);
         if (b) {
             setInteractionState(InteractionState & (~DISABLED_STATE_BIT));
@@ -338,8 +304,7 @@ public class HVisible extends HComponent implements HState {
         }
     }
 
-    public void setBordersEnabled(boolean enable)
-    {
+    public void setBordersEnabled(boolean enable) {
         if (enable == BordersEnabled)
             return;
 
@@ -352,8 +317,7 @@ public class HVisible extends HComponent implements HState {
         }
     }
 
-    public boolean getBordersEnabled()
-    {
+    public boolean getBordersEnabled() {
         return BordersEnabled;
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HActionEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HActionEvent.java
index 7094518..fccb13a 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HActionEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HActionEvent.java
@@ -23,23 +23,17 @@ import java.awt.event.ActionEvent;
 import org.havi.ui.HActionInputPreferred;
 
 public class HActionEvent extends ActionEvent {
-    public HActionEvent(HActionInputPreferred source, int id, String command)
-    {
+    public HActionEvent(HActionInputPreferred source, int id, String command) {
         super(source, id, command);
-
-        this.command = command;
     }
 
-    public String getActionCommand()
-    {
-        return command;
+    public String getActionCommand() {
+        return super.getActionCommand();
     }
 
-    public int getModifiers()
-    {
-        return 0;
+    public int getModifiers() {
+        return super.getModifiers();
     }
 
-    private String command;
     private static final long serialVersionUID = -906983727975217421L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HActionListener.java b/src/libbluray/bdj/java/org/havi/ui/event/HActionListener.java
index 6b612fd..9b52fac 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HActionListener.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HActionListener.java
@@ -22,5 +22,4 @@ package org.havi.ui.event;
 import java.awt.event.ActionListener;
 
 public interface HActionListener extends ActionListener {
-
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HAdjustmentEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HAdjustmentEvent.java
index 28d137f..7ef5b85 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HAdjustmentEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HAdjustmentEvent.java
@@ -23,8 +23,7 @@ import java.awt.AWTEvent;
 import org.havi.ui.HAdjustmentInputPreferred;
 
 public class HAdjustmentEvent extends AWTEvent {
-    public HAdjustmentEvent(HAdjustmentInputPreferred source, int id)
-    {
+    public HAdjustmentEvent(HAdjustmentInputPreferred source, int id) {
         super(source, id);
     }
 
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HBackgroundImageEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HBackgroundImageEvent.java
index a860c03..3597e43 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HBackgroundImageEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HBackgroundImageEvent.java
@@ -22,22 +22,18 @@ package org.havi.ui.event;
 import java.util.EventObject;
 
 public class HBackgroundImageEvent extends EventObject {
-    public HBackgroundImageEvent(Object source, int id)
-    {
+    public HBackgroundImageEvent(Object source, int id) {
         super(source);
 
-        this.source = source;
         this.id = id;
     }
 
-    public Object getSource()
-    {
-        return source;
+    public int getID() {
+        return id;
     }
 
-    public int getID()
-    {
-        return id;
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",id=" + id + "]";
     }
 
     public static final int BACKGROUNDIMAGE_FIRST = 1;
@@ -47,7 +43,6 @@ public class HBackgroundImageEvent extends EventObject {
     public static final int BACKGROUNDIMAGE_INVALID = 4;
     public static final int BACKGROUNDIMAGE_LAST = 4;
 
-    private Object source;
-    private int id;
+    private final int id;
     private static final long serialVersionUID = 4941828555539092236L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HEventRepresentation.java b/src/libbluray/bdj/java/org/havi/ui/event/HEventRepresentation.java
index 9d1c2ab..ca0be4a 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HEventRepresentation.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HEventRepresentation.java
@@ -22,9 +22,8 @@ package org.havi.ui.event;
 import java.awt.Color;
 import java.awt.Image;
 
-public class HEventRepresentation extends Object {
-    protected HEventRepresentation(boolean supported, String text, Color color, Image symbol) {
-        this.supported = supported;
+public class HEventRepresentation {
+    protected HEventRepresentation(String text, Color color, Image symbol) {
         this.text = text;
         this.color = color;
         this.symbol = symbol;
@@ -39,7 +38,7 @@ public class HEventRepresentation extends Object {
     }
 
     public boolean isSupported() {
-        return supported;
+        return type != ER_TYPE_NOT_SUPPORTED;
     }
 
     protected void setType(int aType) {
@@ -91,7 +90,6 @@ public class HEventRepresentation extends Object {
     public static final int ER_TYPE_COLOR = 2;
     public static final int ER_TYPE_SYMBOL = 4;
 
-    private boolean supported;
     private String text;
     private Color color;
     private Image symbol;
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HFocusEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HFocusEvent.java
index d594997..5734fce 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HFocusEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HFocusEvent.java
@@ -25,28 +25,26 @@ public class HFocusEvent extends java.awt.event.FocusEvent {
     public static final int HFOCUS_LAST = FOCUS_TRANSFER;
     public static final int NO_TRANSFER_ID = -1;
 
-    public HFocusEvent(java.awt.Component source, int id)
-    {
+    public HFocusEvent(java.awt.Component source, int id) {
         super(source, id, false);
 
         this.transfer = NO_TRANSFER_ID;
     }
 
-    public HFocusEvent(java.awt.Component source, int id, int transfer)
-    {
+    public HFocusEvent(java.awt.Component source, int id, int transfer) {
         super(source, id, false);
 
         this.transfer = transfer;
     }
 
-    public boolean isTemporary()
-    {
+    public boolean isTemporary() {
         return false;
     }
 
-    public int getTransferId()
-    {
-        return transfer;
+    public int getTransferId() {
+        if (getID() == FOCUS_TRANSFER)
+            return transfer;
+        return NO_TRANSFER_ID;
     }
 
     private int transfer;
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HFocusListener.java b/src/libbluray/bdj/java/org/havi/ui/event/HFocusListener.java
index 52dffbb..7ced199 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HFocusListener.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HFocusListener.java
@@ -22,5 +22,4 @@ package org.havi.ui.event;
 import java.awt.event.FocusListener;
 
 public interface HFocusListener extends FocusListener {
-
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HItemEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HItemEvent.java
index d222389..a211f56 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HItemEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HItemEvent.java
@@ -24,18 +24,20 @@ import java.awt.AWTEvent;
 import org.havi.ui.HSelectionInputPreferred;
 
 public class HItemEvent extends AWTEvent {
-    public HItemEvent(HSelectionInputPreferred source, int id, Object item)
-    {
+    public HItemEvent(HSelectionInputPreferred source, int id, Object item) {
         super(source, id);
 
         this.item = item;
     }
 
-    public Object getItem()
-    {
+    public Object getItem() {
         return item;
     }
 
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",id=" + id + ",item=" + item + "]";
+    }
+
     public static final int ITEM_FIRST = HAdjustmentEvent.ADJUST_LAST + 1;
     public static final int ITEM_START_CHANGE = ITEM_FIRST;
     public static final int ITEM_TOGGLE_SELECTED = ITEM_FIRST + 1;
@@ -52,6 +54,6 @@ public class HItemEvent extends AWTEvent {
     public static final int ITEM_END_CHANGE = ITEM_FIRST + 12;
     public static final int ITEM_LAST = ITEM_FIRST + 12;
 
-    private Object item;
+    private final Object item;
     private static final long serialVersionUID = -487680187698958380L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HKeyEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HKeyEvent.java
index 30fa6f7..2d058c7 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HKeyEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HKeyEvent.java
@@ -23,16 +23,14 @@ import java.awt.Component;
 
 public class HKeyEvent extends HRcEvent {
     public HKeyEvent(Component source, int id, long when, int modifiers,
-            int keyCode, char keyChar)
-    {
+            int keyCode, char keyChar) {
         super(source, id, when, modifiers, keyCode, keyChar);
     }
 
     public HKeyEvent(Component source, int id, long when, int modifiers,
-            int keyCode)
-    {
+            int keyCode) {
         super(source, id, when, modifiers, keyCode);
     }
-    
+
     private static final long serialVersionUID = 1896658905645675252L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HKeyListener.java b/src/libbluray/bdj/java/org/havi/ui/event/HKeyListener.java
index ce8d3b4..700b33b 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HKeyListener.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HKeyListener.java
@@ -22,5 +22,4 @@ package org.havi.ui.event;
 import java.awt.event.KeyListener;
 
 public interface HKeyListener extends KeyListener {
-
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HMouseCapabilities.java b/src/libbluray/bdj/java/org/havi/ui/event/HMouseCapabilities.java
index 6c7d381..74f9f8d 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HMouseCapabilities.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HMouseCapabilities.java
@@ -20,13 +20,10 @@
 package org.havi.ui.event;
 
 public class HMouseCapabilities {
-    protected HMouseCapabilities()
-    {
-
+    protected HMouseCapabilities() {
     }
 
-    public static boolean getInputDeviceSupported()
-    {
-        return true;
+    public static boolean getInputDeviceSupported() {
+        return false;
     }
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HRcCapabilities.java b/src/libbluray/bdj/java/org/havi/ui/event/HRcCapabilities.java
index 2dc03d6..812dd3a 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HRcCapabilities.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HRcCapabilities.java
@@ -34,7 +34,7 @@ public class HRcCapabilities extends HKeyCapabilities {
     public static HEventRepresentation getRepresentation(int keyCode) {
         if (!isSupported(keyCode))
             return null;
-        return new HEventRepresentation(true, getKeyText(keyCode), getKeyColor(keyCode), null);
+        return new HEventRepresentation(getKeyText(keyCode), getKeyColor(keyCode), null);
     }
 
     public static boolean getInputDeviceSupported() {
@@ -71,7 +71,7 @@ public class HRcCapabilities extends HKeyCapabilities {
             case HRcEvent.VK_BASS_BOOST_UP:
                 return "Bass Boost Up";
             case HRcEvent.VK_CHANNEL_DOWN:
-                return "Channel DOwn";
+                return "Channel Down";
             case HRcEvent.VK_CHANNEL_UP:
                 return "Channel Up";
             case HRcEvent.VK_CLEAR_FAVORITE_0:
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HRcEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HRcEvent.java
index 696d3f3..d14ca8c 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HRcEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HRcEvent.java
@@ -24,17 +24,21 @@ import java.awt.event.KeyEvent;
 
 public class HRcEvent extends KeyEvent {
     public HRcEvent(Component source, int id, long when, int modifiers,
-            int keyCode)
-    {
+            int keyCode) {
         super(source, id, when, modifiers, keyCode, (char)keyCode);
     }
 
     public HRcEvent(Component source, int id, long when, int modifiers,
-            int keyCode, char keyChar)
-    {
+            int keyCode, char keyChar) {
         super(source, id, when, modifiers, keyCode, keyChar);
     }
 
+    public String toString() {
+        return getClass().getName() + "[source=" + this.source + ",id=" + getID() +
+            ",when=" + getWhen() + ",modifiers=" + getModifiers() +
+            ",keyCode=" + getKeyCode() + ",keyChar=" + getKeyChar() + "]";
+    }
+
     public static final int RC_FIRST = 400;
     public static final int VK_COLORED_KEY_0 = 403;
     public static final int VK_COLORED_KEY_1 = VK_COLORED_KEY_0 + 1;
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HScreenConfigurationEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HScreenConfigurationEvent.java
index 262428c..5991b30 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HScreenConfigurationEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HScreenConfigurationEvent.java
@@ -20,10 +20,9 @@
 package org.havi.ui.event;
 
 public class HScreenConfigurationEvent extends java.util.EventObject {
-    public HScreenConfigurationEvent(Object source)
-    {
+    public HScreenConfigurationEvent(Object source) {
         super(source);
     }
-    
+
     private static final long serialVersionUID = 8631615705134051342L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReleasedEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReleasedEvent.java
index ae196ad..9356a8c 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReleasedEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReleasedEvent.java
@@ -22,18 +22,9 @@ package org.havi.ui.event;
 import org.davic.resources.ResourceStatusEvent;
 
 public class HScreenDeviceReleasedEvent extends ResourceStatusEvent {
-    public HScreenDeviceReleasedEvent(Object source)
-    {
+    public HScreenDeviceReleasedEvent(Object source) {
         super(source);
-
-        this.source = source;
-    }
-
-    public Object getSource()
-    {
-        return source;
     }
 
-    private Object source;
     private static final long serialVersionUID = -5310071769898889888L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReservedEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReservedEvent.java
index e8ca26e..a9288be 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReservedEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HScreenDeviceReservedEvent.java
@@ -22,18 +22,9 @@ package org.havi.ui.event;
 import org.davic.resources.ResourceStatusEvent;
 
 public class HScreenDeviceReservedEvent extends ResourceStatusEvent {
-    public HScreenDeviceReservedEvent(Object source)
-    {
+    public HScreenDeviceReservedEvent(Object source) {
         super(source);
-
-        this.source = source;
-    }
-
-    public Object getSource()
-    {
-        return source;
     }
 
-    private Object source;
     private static final long serialVersionUID = 944596304967870290L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HScreenLocationModifiedEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HScreenLocationModifiedEvent.java
index 2dc4c1b..f33b7b5 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HScreenLocationModifiedEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HScreenLocationModifiedEvent.java
@@ -22,18 +22,9 @@ package org.havi.ui.event;
 import java.util.EventObject;
 
 public class HScreenLocationModifiedEvent extends EventObject {
-    public HScreenLocationModifiedEvent(Object source)
-    {
+    public HScreenLocationModifiedEvent(Object source) {
         super(source);
-
-        this.source = source;
-    }
-
-    public Object getSource()
-    {
-        return source;
     }
 
-    private Object source;
     private static final long serialVersionUID = -2915447586541903280L;
 }
diff --git a/src/libbluray/bdj/java/org/havi/ui/event/HTextEvent.java b/src/libbluray/bdj/java/org/havi/ui/event/HTextEvent.java
index 2442906..ab20ca9 100644
--- a/src/libbluray/bdj/java/org/havi/ui/event/HTextEvent.java
+++ b/src/libbluray/bdj/java/org/havi/ui/event/HTextEvent.java
@@ -23,8 +23,7 @@ import org.havi.ui.HKeyboardInputPreferred;
 import java.awt.AWTEvent;
 
 public class HTextEvent extends AWTEvent {
-    public HTextEvent(HKeyboardInputPreferred source, int id)
-    {
+    public HTextEvent(HKeyboardInputPreferred source, int id) {
         super(source, id);
     }
 
diff --git a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
index 72ba458..1bacac0 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJAppProxy.java
@@ -89,12 +89,21 @@ class BDJAppProxy implements DVBJProxy, Runnable {
         }
     }
 
-    public void stop(boolean force) {
+    public void stop(boolean force, int timeout) {
         AppCommand cmd = new AppCommand(AppCommand.CMD_STOP, new Boolean(force));
         synchronized(cmds) {
             cmds.addLast(cmd);
             cmds.notifyAll();
         }
+        if (timeout > 0) {
+            if (!cmd.waitDone(timeout)) {
+                logger.error("stop() timeout: Xlet " + context.getThreadGroup().getName());
+            }
+        }
+    }
+
+    public void stop(boolean force) {
+        stop(force, -1);
     }
 
     public void pause() {
@@ -243,6 +252,8 @@ class BDJAppProxy implements DVBJProxy, Runnable {
                 context.closeSockets();
                 context.getThreadGroup().waitForShutdown(1000, 1 + context.numEventQueueThreads());
 
+                context.exitXlet();
+
             } catch (Throwable e) {
                 logger.error("doStop() failed: " + e + "\n" + Logger.dumpStack(e));
                 state = INVALID;
diff --git a/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java b/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java
index ca39f12..7a22dba 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJAppsDatabase.java
@@ -31,16 +31,21 @@ import org.videolan.bdjo.AppEntry;
 import org.videolan.bdjo.Bdjo;
 
 public class BDJAppsDatabase extends AppsDatabase {
+
+    private static final Object instanceLock = new Object();
+
     static public AppsDatabase getAppsDatabase() {
-        synchronized (BDJAppsDatabase.class) {
+        synchronized (instanceLock) {
             if (instance == null)
                 instance = new BDJAppsDatabase();
             return instance;
         }
     }
 
+    private static final Object appTableLock = new Object();
+
     public int size() {
-        synchronized (this) {
+        synchronized (appTableLock) {
             if (appTable == null)
                 return 0;
             return appTable.length;
@@ -49,7 +54,7 @@ public class BDJAppsDatabase extends AppsDatabase {
 
     public Enumeration getAppIDs(AppsDatabaseFilter filter) {
         Vector ids = new Vector();
-        synchronized (this) {
+        synchronized (appTableLock) {
             if (appTable != null)
                 for (int i = 0; i < appTable.length; i++)
                     if (filter.accept(appTable[i].getIdentifier()))
@@ -60,7 +65,7 @@ public class BDJAppsDatabase extends AppsDatabase {
 
     public Enumeration getAppAttributes(AppsDatabaseFilter filter) {
         Vector attributes = new Vector();
-        synchronized (this) {
+        synchronized (appTableLock) {
             if (appTable != null)
                 for (int i = 0; i < size(); i++)
                     if (filter.accept(appTable[i].getIdentifier()))
@@ -70,7 +75,7 @@ public class BDJAppsDatabase extends AppsDatabase {
     }
 
     public AppAttributes getAppAttributes(AppID key) {
-        synchronized (this) {
+        synchronized (appTableLock) {
             if (appTable != null)
                 for (int i = 0; i < size(); i++)
                     if (key.equals(appTable[i].getIdentifier()))
@@ -80,7 +85,7 @@ public class BDJAppsDatabase extends AppsDatabase {
     }
 
     public AppProxy getAppProxy(AppID key) {
-        synchronized (this) {
+        synchronized (appTableLock) {
             if ((appTable != null) && (appProxys != null))
                 for (int i = 0; i < size(); i++)
                     if (key.equals(appTable[i].getIdentifier()))
@@ -94,7 +99,7 @@ public class BDJAppsDatabase extends AppsDatabase {
     }
 
     protected void newDatabase(Bdjo bdjo, BDJAppProxy[] appProxys) {
-        synchronized (this) {
+        synchronized (appTableLock) {
             this.bdjo = bdjo;
             this.appProxys = appProxys;
             this.appTable = (bdjo != null) ? bdjo.getAppTable() : null;
diff --git a/src/libbluray/bdj/java/org/videolan/BDJLoader.java b/src/libbluray/bdj/java/org/videolan/BDJLoader.java
index 59410c5..b2bcff3 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJLoader.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJLoader.java
@@ -185,11 +185,6 @@ public class BDJLoader {
                 throw new InvalidObjectException("bdjo not loaded");
             AppEntry[] appTable = bdjo.getAppTable();
 
-            // initialize AppCaches
-            if (vfsCache != null) {
-                vfsCache.add(bdjo.getAppCaches());
-            }
-
             // reuse appProxys
             BDJAppProxy[] proxys = new BDJAppProxy[appTable.length];
             AppsDatabase db = AppsDatabase.getAppsDatabase();
@@ -215,7 +210,6 @@ public class BDJLoader {
                             proxy.stop(true);
                         } else {
                             logger.info("Keeping xlet " + appTable[i].getInitialClass());
-                            proxy.getXletContext().update(appTable[i], bdjo.getAppCaches());
                             proxys[i] = proxy;
                             proxy = null;
                         }
@@ -240,6 +234,11 @@ public class BDJLoader {
             Libbluray.setUOMask(terminfo.getMenuCallMask(), terminfo.getTitleSearchMask());
             Libbluray.setKeyInterest(bdjo.getKeyInterestTable());
 
+            // initialize AppCaches
+            if (vfsCache != null) {
+                vfsCache.add(bdjo.getAppCaches());
+            }
+
             // initialize appProxys
             for (int i = 0; i < appTable.length; i++) {
                 if (proxys[i] == null) {
@@ -256,6 +255,7 @@ public class BDJLoader {
                     }
                     logger.info("Loaded class: " + appTable[i].getInitialClass() + p + " from " + appTable[i].getBasePath() + ".jar");
                 } else {
+                    proxys[i].getXletContext().update(appTable[i], bdjo.getAppCaches());
                     logger.info("Reused class: " + appTable[i].getInitialClass() +     " from " + appTable[i].getBasePath() + ".jar");
                 }
             }
@@ -266,6 +266,19 @@ public class BDJLoader {
             // notify AppsDatabase
             ((BDJAppsDatabase)BDJAppsDatabase.getAppsDatabase()).newDatabase(bdjo, proxys);
 
+            // auto start playlist
+            try {
+                PlayListTable plt = bdjo.getAccessiblePlaylists();
+                if ((plt != null) && (plt.isAutostartFirst())) {
+                    logger.info("Auto-starting playlist");
+                    String[] pl = plt.getPlayLists();
+                    if (pl.length > 0)
+                        Manager.createPlayer(new MediaLocator(new BDLocator("bd://PLAYLIST:" + pl[0]))).start();
+                }
+            } catch (Exception e) {
+                logger.error("loadN(): autoplaylist failed: " + e + "\n" + Logger.dumpStack(e));
+            }
+
             // now run all the xlets
             for (int i = 0; i < appTable.length; i++) {
                 int code = appTable[i].getControlCode();
@@ -282,15 +295,6 @@ public class BDJLoader {
 
             logger.info("Finished initializing and starting xlets.");
 
-            // auto start playlist
-            PlayListTable plt = bdjo.getAccessiblePlaylists();
-            if ((plt != null) && (plt.isAutostartFirst())) {
-                logger.info("Auto-starting playlist");
-                String[] pl = plt.getPlayLists();
-                if (pl.length > 0)
-                    Manager.createPlayer(new MediaLocator(new BDLocator("bd://PLAYLIST:" + pl[0]))).start();
-            }
-
             return true;
 
         } catch (Throwable e) {
diff --git a/src/libbluray/bdj/java/org/videolan/BDJThreadGroup.java b/src/libbluray/bdj/java/org/videolan/BDJThreadGroup.java
index 4943a7e..905bb4a 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJThreadGroup.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJThreadGroup.java
@@ -39,7 +39,7 @@ class BDJThreadGroup extends ThreadGroup {
         }
 
         if (e instanceof ThreadDeath) {
-            logger.error("Thread " + t + " killed" + stack);
+            logger.error("Thread " + t + " killed" /*+ stack*/);
         } else {
             logger.error("Unhandled exception in thread " + t + ": " + e + stack);
         }
@@ -85,8 +85,11 @@ class BDJThreadGroup extends ThreadGroup {
             waitForShutdown(500, 0);
         }
 
+        if (destroyed) return;
+
         try {
             destroy();
+            destroyed = true;
         } catch (IllegalThreadStateException e) {
             logger.error("ThreadGroup destroy failed: " + e);
         }
@@ -109,6 +112,7 @@ class BDJThreadGroup extends ThreadGroup {
         }
     }
 
+    private boolean destroyed = false;
     private final BDJXletContext context;
     private static final Logger logger = Logger.getLogger(BDJThreadGroup.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index 359cd28..4f3e725 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -70,7 +70,12 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
         try {
             int homeJarID = Integer.parseInt(home);
             long time = System.currentTimeMillis();
-            homeMountPoint = MountManager.mount(homeJarID, false) + java.io.File.separator;
+            homeMountPoint = MountManager.mount(homeJarID, false);
+            if (homeMountPoint == null) {
+                logger.error("Failed mounting " + home + ".jar");
+            } else {
+                homeMountPoint = homeMountPoint + java.io.File.separator;
+            }
             time = System.currentTimeMillis() - time;
             logger.info("Mounted Xlet home directory from " + home + ".jar " +
                         "to " + homeMountPoint + "(" + time + "ms)");
@@ -194,6 +199,8 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
      * Event queues
      */
 
+    private final Object cbLock = new Object();
+
     protected void setEventQueue(EventQueue eq) {
         eventQueue = eq;
     }
@@ -219,21 +226,21 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
 
     protected boolean putCallback(BDJAction cb)
     {
-        synchronized (this) {
+        synchronized (cbLock) {
             return putCallbackImpl(cb, callbackQueue);
         }
     }
 
     protected boolean putMediaCallback(BDJAction cb)
     {
-        synchronized (this) {
+        synchronized (cbLock) {
             return putCallbackImpl(cb, mediaQueue);
         }
     }
 
     public boolean putUserEvent(BDJAction cb)
     {
-        synchronized (this) {
+        synchronized (cbLock) {
             return putCallbackImpl(cb, userEventQueue);
         }
     }
@@ -439,19 +446,27 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
                 entry.getInitialClass());
     }
 
-    protected void release() {
+    protected void exitXlet() {
+        // Called from AppProxy when destroyXlet() has been called.
+        // Release as much resources as possible while running in Xlet context.
+
+        org.dvb.io.ixc.IxcRegistry.unbindAll(this);
 
         closeSockets();
         removeAllFAA();
         stopIxcThreads();
-        defaultLooks.clear();
 
-        org.dvb.io.ixc.IxcRegistry.unbindAll(this);
+        defaultLooks.clear();
 
         if (sceneFactory != null) {
             sceneFactory.dispose();
             sceneFactory = null;
         }
+    }
+
+    protected void release() {
+
+        exitXlet();
 
         callbackQueue.shutdown();
         userEventQueue.shutdown();
@@ -475,13 +490,15 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
         } catch (InvocationTargetException e) {
         }
 
+        synchronized (cbLock) {
+            callbackQueue = null;
+            userEventQueue = null;
+            mediaQueue = null;
+        }
         synchronized (this) {
             threadGroup = null;
             loader = null;
             container = null;
-            callbackQueue = null;
-            userEventQueue = null;
-            mediaQueue = null;
             defaultLooks = null;
             released = true;
         }
diff --git a/src/libbluray/bdj/java/org/videolan/GUIManager.java b/src/libbluray/bdj/java/org/videolan/GUIManager.java
index 0c7f578..27c2826 100644
--- a/src/libbluray/bdj/java/org/videolan/GUIManager.java
+++ b/src/libbluray/bdj/java/org/videolan/GUIManager.java
@@ -30,14 +30,18 @@ public class GUIManager extends BDRootWindow {
     private GUIManager() {
     }
 
-    public static synchronized GUIManager createInstance() {
-        if (instance == null) {
-            instance = new GUIManager();
-        } else {
-            instance.clearOverlay();
-            instance.setDefaultFont(null);
+    private static final Object instanceLock = new Object();
+
+    public static GUIManager createInstance() {
+        synchronized (instanceLock) {
+            if (instance == null) {
+                instance = new GUIManager();
+            } else {
+                instance.clearOverlay();
+                instance.setDefaultFont(null);
+            }
+            return instance;
         }
-        return instance;
     }
 
     public static synchronized GUIManager getInstance() {
@@ -69,7 +73,7 @@ public class GUIManager extends BDRootWindow {
     }
 
     protected static void shutdown() throws Throwable {
-        synchronized (GUIManager.class) {
+        synchronized (instanceLock) {
             if (instance != null) {
                 instance.setVisible(false);
                 instance.removeAll();
diff --git a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
index 144f1ab..2413c2d 100644
--- a/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/IxcRegistryImpl.java
@@ -452,7 +452,7 @@ public class IxcRegistryImpl {
         }
         Object remoteObj = wrapOrCopy(wrappedObj, wrappedObj.context, (BDJXletContext)xc);
 
-        Debug("IxcRegistry.lookup(" + path + ") => " + remoteObj);
+        Debug("IxcRegistry.lookup(" + path + ") => OK");
 
         return (Remote)remoteObj;
     }
@@ -510,8 +510,8 @@ public class IxcRegistryImpl {
     }
 
     public void unbindAll(XletContext xc) {
-
-        if (null != BDJXletContext.getCurrentContext()) {
+        XletContext requestor = BDJXletContext.getCurrentContext();
+        if (requestor != null && requestor != xc) {
             logger.error("unbindAll(ctx) from wrong thread: " + Logger.dumpStack());
             return;
         }
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 6a97ad7..80b275d 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -135,7 +135,9 @@ public class Libbluray {
         PackageManager.commitContentPrefixList();
         PackageManager.commitProtocolPrefixList();
 
-        BDFontMetrics.init();
+        try {
+            BDFontMetrics.init();
+        } catch (Throwable t) {}
 
         System.setProperty("mhp.profile.enhanced_broadcast", "YES");
         System.setProperty("mhp.profile.interactive_broadcast", "YES");
@@ -157,16 +159,28 @@ public class Libbluray {
 
         System.setProperty("dvb.returnchannel.timeout", "30");
 
+        /* get profile from PSR */
+        int psr31 = readPSR(PSR_PROFILE_VERSION);
+        int profile = psr31 >> 16;
+        boolean p11 = (profile & 0x01) != 0;
+        boolean p2  = (profile & 0x02) != 0;
+        boolean p5  = (profile & 0x10) != 0;
+
         System.setProperty("bluray.profile.1", "YES");
         System.setProperty("bluray.p1.version.major", "1");
-        System.setProperty("bluray.p1.version.minor", "1");
+        System.setProperty("bluray.p1.version.minor", p11 ? "1" : "0");
         System.setProperty("bluray.p1.version.micro", "0");
 
-        System.setProperty("bluray.profile.2", "YES");
+        System.setProperty("bluray.profile.2", p2 ? "YES" : "NO");
         System.setProperty("bluray.p2.version.major", "1");
         System.setProperty("bluray.p2.version.minor", "0");
         System.setProperty("bluray.p2.version.micro", "0");
 
+        System.setProperty("bluray.profile.5", p5 ? "YES" : "NO");
+        System.setProperty("bluray.p5.version.major", "1");
+        System.setProperty("bluray.p5.version.minor", "0");
+        System.setProperty("bluray.p5.version.micro", "0");
+
         System.setProperty("bluray.disc.avplayback.readcapability", "NO");
 
         System.setProperty("bluray.video.fullscreenSD", "YES");
@@ -533,6 +547,7 @@ public class Libbluray {
         case BDJ_EVENT_END_OF_PLAYLIST:
         case BDJ_EVENT_PTS:
         case BDJ_EVENT_UO_MASKED:
+        case BDJ_EVENT_SEEK:
             PlayerManager.getInstance().onEvent(event, param);
             break;
         case BDJ_EVENT_RATE:
@@ -616,6 +631,7 @@ public class Libbluray {
     public  static final int BDJ_EVENT_AUDIO_STREAM             = 14;
     public  static final int BDJ_EVENT_SECONDARY_STREAM         = 15;
     public  static final int BDJ_EVENT_UO_MASKED                = 16;
+    public  static final int BDJ_EVENT_SEEK                     = 17;
 
     /* TODO: use org/bluray/system/RegisterAccess instead */
     public static final int PSR_IG_STREAM_ID     = 0;
@@ -656,6 +672,9 @@ public class Libbluray {
     public static final int AACS_MEDIA_PMSN        = 3;
     public static final int AACS_DEVICE_BINDING_ID = 4;
     public static final int AACS_DEVICE_NONCE      = 5;
+    public static final int AACS_MEDIA_KEY         = 6;
+    public static final int AACS_CONTENT_CERT_ID   = 7;
+    public static final int AACS_BDJ_ROOT_CERT_HASH= 8;
 
     private static native byte[] getAacsDataN(long np, int type);
     private static native TitleInfo[] getTitleInfosN(long np);
diff --git a/src/libbluray/bdj/java/org/videolan/MountManager.java b/src/libbluray/bdj/java/org/videolan/MountManager.java
index 5c9660a..6f6fd52 100644
--- a/src/libbluray/bdj/java/org/videolan/MountManager.java
+++ b/src/libbluray/bdj/java/org/videolan/MountManager.java
@@ -185,6 +185,7 @@ public class MountManager {
                 new PrivilegedAction() {
                     public Object run() {
                         if (mountPoint.decRefCount() < 1) {
+                            logger.error("Removing JAR " + id + " from mount cache");
                             mountPoints.remove(id);
                         }
                         return null;
diff --git a/src/libbluray/bdj/java/org/videolan/VFSCache.java b/src/libbluray/bdj/java/org/videolan/VFSCache.java
index 22fe1f0..04bacb5 100644
--- a/src/libbluray/bdj/java/org/videolan/VFSCache.java
+++ b/src/libbluray/bdj/java/org/videolan/VFSCache.java
@@ -295,7 +295,8 @@ class VFSCache {
         String relPath = absPath.substring(vfsRootLength);
         String[] names = Libbluray.listBdFiles(relPath, true);
         if (names != null) {
-            /* this is directory */
+            /* this is directory. Make sure it exists. */
+            Libbluray.cacheBdRomFile(relPath + "/", cacheRoot + relPath + "/");
             return;
         }
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
index 92269f1..a9e25e8 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/BDHandler.java
@@ -44,6 +44,7 @@ import javax.media.RealizeCompleteEvent;
 import javax.media.ResourceUnavailableEvent;
 import javax.media.StartEvent;
 import javax.media.StopByRequestEvent;
+import javax.media.StopTimeChangeEvent;
 import javax.media.Time;
 import javax.media.TimeBase;
 import javax.media.TransitionEvent;
@@ -52,8 +53,9 @@ import javax.media.protocol.DataSource;
 import javax.tv.locator.Locator;
 import javax.tv.service.selection.ServiceContentHandler;
 
+import org.davic.media.MediaTimePositionChangedEvent;
+
 import org.bluray.media.OverallGainControl;
-import org.bluray.net.BDLocator;
 
 import org.videolan.BDJAction;
 import org.videolan.BDJActionManager;
@@ -102,6 +104,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
     }
 
     public int getTargetState() {
+        Logger.unimplemented("BDHandler", "getTargetState()");
         synchronized (this) {
             return targetState;
         }
@@ -184,6 +187,8 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         checkUnrealized();
         // TODO: actually stopping when stop time is hit needs to be implemented
         this.stopTime = stopTime;
+
+        postStopTimeChangeEvent();
     }
 
     public Time getMediaTime() {
@@ -218,6 +223,11 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         action.waitEnd();
     }
 
+    public void setMediaTimePosition(Time mediaTime) {
+        setMediaTime(mediaTime);
+        postMediaTimePositionChangedEvent();
+    }
+
     public Time mapToTimeBase(Time t) throws ClockStoppedException {
         if (state != Started)
             throw new ClockStoppedException();
@@ -257,11 +267,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
     }
 
     public Locator[] getServiceContentLocators() {
-        if (locator == null)
-            return new Locator[0];
-        Locator[] locators = new Locator[1];
-        locators[0] = locator;
-        return locators;
+        return new Locator[0];
     }
 
     public void realize() {
@@ -366,7 +372,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
 
     protected void doEndOfMediaReached(int playlist) {
         if (state == Started) {
-            ControllerErrorEvent error = doStop();
+            ControllerErrorEvent error = doStop(true);
             if (error == null) {
                 state = Prefetched;
                 notifyListeners(new EndOfMediaEvent(this, Started, Prefetched, Prefetched, getMediaTime()));
@@ -376,6 +382,9 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         }
     }
 
+    protected void doSeekNotify(long tick) {
+        updateTime(new Time(tick * TO_SECONDS));
+    }
 
     protected void doPlaylistStarted(int playlist) {};
     protected void doChapterReached(int chapter) {};
@@ -406,8 +415,9 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
         return null;
     }
 
-    protected ControllerErrorEvent doStop() {
+    protected ControllerErrorEvent doStop(boolean eof) {
         baseMediaTime = getMediaNanoseconds();
+        rate = 1.0f;
         return null;
     }
 
@@ -434,6 +444,14 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
      *
      */
 
+    private void postStopTimeChangeEvent() {
+        notifyListeners(new StopTimeChangeEvent(this, getStopTime()));
+    }
+
+    protected void postMediaTimePositionChangedEvent() {
+        notifyListeners(new MediaTimePositionChangedEvent(this, getState(), getState(), getState(), getMediaTime()));
+    }
+
     private void notifyListeners(ControllerEvent event) {
         listeners.putCallback(event);
     }
@@ -521,7 +539,7 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
     private boolean doStopAction() {
         switch (state) {
         case Started:
-            ControllerErrorEvent error = doStop();
+            ControllerErrorEvent error = doStop(false);
             if (error == null) {
                 state = Prefetched;
                 notifyListeners(new StopByRequestEvent(this, Started, Prefetched, Prefetched, getMediaTime()));
@@ -655,6 +673,9 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
                 case Libbluray.BDJ_EVENT_UO_MASKED:
                     player.doUOMasked(param2);
                     break;
+                case Libbluray.BDJ_EVENT_SEEK:
+                    player.doSeekNotify(param2 * 2 /* 45kHz -> 90kHz */);
+                    break;
                 default:
                     System.err.println("Unknown ACTION_STATUS: id " + param + ", value " + param2);
                     break;
@@ -693,7 +714,6 @@ public abstract class BDHandler implements Player, ServiceContentHandler {
     protected long baseTime;
     protected float rate = 1.0f;
     protected Control[] controls = null;
-    protected BDLocator locator = null;
     private BDJListeners listeners = new BDJListeners();
     private BDJXletContext ownerContext;
     boolean isClosed = false;
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
index cc06e84..d45358b 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/PlayerManager.java
@@ -19,6 +19,7 @@
 package org.videolan.media.content;
 
 import java.util.ArrayList;
+import org.videolan.Logger;
 
 public class PlayerManager {
 
@@ -81,7 +82,7 @@ public class PlayerManager {
             return;
         }
 
-        System.err.println("unknown player type: " + player.getClass().getName());
+        logger.error("unknown player type: " + player.getClass().getName());
     }
 
     protected boolean allocateResource(BDHandler player) {
@@ -91,6 +92,9 @@ public class PlayerManager {
             }
             synchronized (playlistPlayerLock) {
                 if (playlistPlayer != null && player != playlistPlayer) {
+
+                    logger.info("allocateResource(): Stopping old playlist player");
+
                     playlistPlayer.stop();
                     playlistPlayer.deallocate();
                 }
@@ -108,7 +112,7 @@ public class PlayerManager {
             return true;
         }
 
-        System.err.println("unknown player type: " + player.getClass().getName());
+        logger.error("allocateResource(): unknown player type: " + player.getClass().getName());
         return false;
     }
 
@@ -153,4 +157,6 @@ public class PlayerManager {
         }
         }
     }
+
+    private static final Logger logger = Logger.getLogger(PlayerManager.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java
index 04ad80e..594eeb1 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java
@@ -26,9 +26,9 @@ import javax.media.IncompatibleSourceException;
 import javax.media.Time;
 import javax.media.protocol.DataSource;
 
-
-import org.videolan.media.content.playlist.OverallGainControlImpl;
-import org.videolan.media.content.playlist.PanningControlImpl;
+import org.videolan.media.content.control.MediaTimePositionControlImpl;
+import org.videolan.media.content.control.OverallGainControlImpl;
+import org.videolan.media.content.control.PanningControlImpl;
 
 import org.videolan.media.content.BDHandler;
 
@@ -70,10 +70,11 @@ public class Handler extends BDHandler {
         return super.doStart(at);
     }
 
-    protected ControllerErrorEvent doStop() {
-        return super.doStop();
+    /*
+    protected ControllerErrorEvent doStop(boolean eof) {
+        return super.doStop(eof);
     }
-
+    */
     /*
     protected BDLocator getLocator() {
         return locator;
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/GainControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/control/GainControlImpl.java
similarity index 98%
rename from src/libbluray/bdj/java/org/videolan/media/content/playlist/GainControlImpl.java
rename to src/libbluray/bdj/java/org/videolan/media/content/control/GainControlImpl.java
index e52587a..3593e1a 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/GainControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/control/GainControlImpl.java
@@ -17,7 +17,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.videolan.media.content.playlist;
+package org.videolan.media.content.control;
 
 import java.awt.Component;
 import javax.media.GainControl;
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/audio/MediaTimePositionControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/control/MediaTimePositionControlImpl.java
similarity index 84%
rename from src/libbluray/bdj/java/org/videolan/media/content/audio/MediaTimePositionControlImpl.java
rename to src/libbluray/bdj/java/org/videolan/media/content/control/MediaTimePositionControlImpl.java
index f841ce6..6472824 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/audio/MediaTimePositionControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/control/MediaTimePositionControlImpl.java
@@ -17,7 +17,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.videolan.media.content.audio;
+package org.videolan.media.content.control;
 
 import java.awt.Component;
 
@@ -25,8 +25,10 @@ import javax.media.Time;
 
 import org.davic.media.MediaTimePositionControl;
 
+import org.videolan.media.content.BDHandler;
+
 public class MediaTimePositionControlImpl implements MediaTimePositionControl {
-    protected MediaTimePositionControlImpl(Handler player) {
+    public MediaTimePositionControlImpl(BDHandler player) {
         this.player = player;
     }
 
@@ -35,7 +37,7 @@ public class MediaTimePositionControlImpl implements MediaTimePositionControl {
     }
 
     public Time setMediaTimePosition(Time mediaTime) {
-        player.setMediaTime(mediaTime);
+        player.setMediaTimePosition(mediaTime);
         return player.getMediaTime();
     }
 
@@ -43,5 +45,5 @@ public class MediaTimePositionControlImpl implements MediaTimePositionControl {
         return player.getMediaTime();
     }
 
-    private Handler player;
+    private BDHandler player;
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/OverallGainControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/control/OverallGainControlImpl.java
similarity index 96%
rename from src/libbluray/bdj/java/org/videolan/media/content/playlist/OverallGainControlImpl.java
rename to src/libbluray/bdj/java/org/videolan/media/content/control/OverallGainControlImpl.java
index daa27c6..6e0829a 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/OverallGainControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/control/OverallGainControlImpl.java
@@ -18,7 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.videolan.media.content.playlist;
+package org.videolan.media.content.control;
 
 import java.awt.Component;
 import org.bluray.media.OverallGainControl;
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PanningControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/control/PanningControlImpl.java
similarity index 98%
rename from src/libbluray/bdj/java/org/videolan/media/content/playlist/PanningControlImpl.java
rename to src/libbluray/bdj/java/org/videolan/media/content/control/PanningControlImpl.java
index 973da50..9a6ee70 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PanningControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/control/PanningControlImpl.java
@@ -18,7 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.videolan.media.content.playlist;
+package org.videolan.media.content.control;
 
 import java.awt.Component;
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryGainControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/control/PrimaryGainControlImpl.java
similarity index 92%
rename from src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryGainControlImpl.java
rename to src/libbluray/bdj/java/org/videolan/media/content/control/PrimaryGainControlImpl.java
index 8db96ee..2c1e651 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryGainControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/control/PrimaryGainControlImpl.java
@@ -18,7 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.videolan.media.content.playlist;
+package org.videolan.media.content.control;
 
 import java.awt.Component;
 import org.bluray.media.PrimaryGainControl;
@@ -26,7 +26,7 @@ import org.bluray.media.PrimaryGainControl;
 import org.videolan.media.content.BDHandler;
 
 public class PrimaryGainControlImpl extends GainControlImpl implements PrimaryGainControl {
-    PrimaryGainControlImpl(BDHandler player) {
+    public PrimaryGainControlImpl(BDHandler player) {
         this.player = player;
     }
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryGainControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/control/SecondaryGainControlImpl.java
similarity index 92%
rename from src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryGainControlImpl.java
rename to src/libbluray/bdj/java/org/videolan/media/content/control/SecondaryGainControlImpl.java
index f6f1ab0..6cf7d48 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryGainControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/control/SecondaryGainControlImpl.java
@@ -18,7 +18,7 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-package org.videolan.media.content.playlist;
+package org.videolan.media.content.control;
 
 import java.awt.Component;
 import org.bluray.media.SecondaryGainControl;
@@ -26,7 +26,7 @@ import org.bluray.media.SecondaryGainControl;
 import org.videolan.media.content.BDHandler;
 
 public class SecondaryGainControlImpl extends GainControlImpl implements SecondaryGainControl {
-    SecondaryGainControlImpl(BDHandler player) {
+    public SecondaryGainControlImpl(BDHandler player) {
         this.player = player;
     }
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/BackgroundVideoPresentationControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/BackgroundVideoPresentationControlImpl.java
index 21f6de5..ae6464c 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/BackgroundVideoPresentationControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/BackgroundVideoPresentationControlImpl.java
@@ -35,7 +35,8 @@ import org.videolan.TIClip;
 public class BackgroundVideoPresentationControlImpl extends VideoControl
                 implements BackgroundVideoPresentationControl, AWTVideoSizeControl {
     protected BackgroundVideoPresentationControlImpl(Handler player) {
-        super(player, 0);
+        super(0);
+        this.player = player;
     }
 
     protected StreamInfo[] getStreams() {
@@ -137,4 +138,6 @@ public class BackgroundVideoPresentationControlImpl extends VideoControl
         Rectangle dr = size.getDestination();
         return new AWTVideoSize(sr, dr);
     }
+
+    private Handler player;
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/DVBMediaSelectControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/DVBMediaSelectControlImpl.java
index 00a4705..4540984 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/DVBMediaSelectControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/DVBMediaSelectControlImpl.java
@@ -158,7 +158,7 @@ public class DVBMediaSelectControlImpl implements DVBMediaSelectControl{
     }
 
     public Locator[] getCurrentSelection() {
-        BDLocator locator = player.getLocator();
+        BDLocator locator = player.getCurrentLocator();
         if (locator == null)
             return new Locator[0];
         String[] tags = locator.getComponentTags();
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
index 8728628..8134e0c 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
@@ -37,14 +37,20 @@ import org.bluray.media.InvalidPlayListException;
 import org.bluray.net.BDLocator;
 import org.bluray.system.RegisterAccess;
 import org.bluray.ti.selection.TitleContextImpl;
+
 import org.videolan.BDJAction;
-import org.videolan.BDJActionManager;
 import org.videolan.Libbluray;
 import org.videolan.Logger;
 import org.videolan.PlaylistInfo;
 import org.videolan.TIClip;
 import org.videolan.media.content.BDHandler;
 
+import org.videolan.media.content.control.MediaTimePositionControlImpl;
+import org.videolan.media.content.control.OverallGainControlImpl;
+import org.videolan.media.content.control.PanningControlImpl;
+import org.videolan.media.content.control.PrimaryGainControlImpl;
+import org.videolan.media.content.control.SecondaryGainControlImpl;
+
 public class Handler extends BDHandler {
     public Handler() {
         controls = new Control[18];
@@ -69,67 +75,101 @@ public class Handler extends BDHandler {
     }
 
     public void setSource(DataSource source) throws IOException, IncompatibleSourceException {
+
+        /* validate source */
+        BDLocator newLocator;
+        try {
+            newLocator = new BDLocator(source.getLocator().toExternalForm());
+        } catch (org.davic.net.InvalidLocatorException e) {
+            logger.error("incompatible source: " + source);
+            throw new IncompatibleSourceException();
+        } catch (Exception e) {
+            logger.error("unexpected expection: " + e);
+            throw new IncompatibleSourceException();
+        }
+
+        if (!newLocator.isPlayListItem()) {
+            logger.error("not playlist: " + newLocator);
+            throw new IncompatibleSourceException();
+        }
+
+        /* get playlist info */
+        PlaylistInfo newPi = Libbluray.getPlaylistInfo(newLocator.getPlayListId());
+        if (newPi == null) {
+            logger.error("getPlaylistInfo failed for " + newLocator);
+            throw new IOException();
+        }
+
+        /* commit changes and prefetch */
         synchronized (this) {
-            try {
-                locator = new BDLocator(source.getLocator().toExternalForm());
-                currentLocator = null;
-            } catch (org.davic.net.InvalidLocatorException e) {
-                throw new IncompatibleSourceException();
-            }
-            if (!locator.isPlayListItem())
-                throw new IncompatibleSourceException();
-            pi = Libbluray.getPlaylistInfo(locator.getPlayListId());
-            if (pi == null)
-                throw new IOException();
+
+            sourceLocator = newLocator;
+            currentLocator = null;
+            pi = newPi;
+
             baseMediaTime = 0;
             if (state == Prefetched)
                 doPrefetch();
         }
     }
 
+    public Locator[] getServiceContentLocators() {
+        if (sourceLocator == null)
+            return new Locator[0];
+        Locator[] locators = new Locator[1];
+        if (currentLocator != null && getState() >= Prefetched)
+            locators[0] = currentLocator;
+        else
+            locators[0] = sourceLocator;
+        return locators;
+    }
+
     public Time getDuration() {
-        long duration = pi.getDuration() ;
-        return new Time(duration * TO_SECONDS);
+        if (pi != null) {
+            long duration = pi.getDuration();
+            return new Time(duration * TO_SECONDS);
+        }
+        return DURATION_UNKNOWN;
     }
 
     protected ControllerErrorEvent doPrefetch() {
         synchronized (this) {
             try {
                 int stream;
-                stream = locator.getPrimaryAudioStreamNumber();
+                stream = sourceLocator.getPrimaryAudioStreamNumber();
                 if (stream > 0)
                     Libbluray.writePSR(Libbluray.PSR_PRIMARY_AUDIO_ID, stream);
-                stream = locator.getPGTextStreamNumber();
+                stream = sourceLocator.getPGTextStreamNumber();
                 if (stream > 0) {
                     Libbluray.writePSR(Libbluray.PSR_PG_STREAM, stream, 0x00000fff);
                 }
-                stream = locator.getSecondaryVideoStreamNumber();
+                stream = sourceLocator.getSecondaryVideoStreamNumber();
                 if (stream > 0) {
                     Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, stream << 8, 0x0000ff00);
                 }
-                stream = locator.getSecondaryAudioStreamNumber();
+                stream = sourceLocator.getSecondaryAudioStreamNumber();
                 if (stream > 0) {
                     Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, stream, 0x000000ff);
                 }
 
-                int pl = locator.getPlayListId();
+                int plId = sourceLocator.getPlayListId();
                 long time = -1;
-                int pi = -1, mark = -1;
+                int piId = -1, mark = -1;
                 if (baseMediaTime != 0) {
                     time = (long)(baseMediaTime * FROM_NAROSECONDS);
-                } /*else*/ if (locator.getMarkId() > 0) {
-                    mark = locator.getMarkId();
-                } /*else*/ if (locator.getPlayItemId() > 0) {
-                    pi = locator.getPlayItemId();
+                } /*else*/ if (sourceLocator.getMarkId() > 0) {
+                    mark = sourceLocator.getMarkId();
+                } /*else*/ if (sourceLocator.getPlayItemId() > 0) {
+                    piId = sourceLocator.getPlayItemId();
                 }
 
-                if (!Libbluray.selectPlaylist(pl, pi, mark, time)) {
+                if (!Libbluray.selectPlaylist(plId, piId, mark, time)) {
                     return new ConnectionErrorEvent(this);
                 }
 
                 updateTime(new Time(Libbluray.tellTime() * TO_SECONDS));
 
-                currentLocator = new BDLocator(locator.toExternalForm());
+                currentLocator = new BDLocator(sourceLocator.toExternalForm());
             } catch (Exception e) {
                 return new ConnectionErrorEvent(this);
             }
@@ -158,9 +198,12 @@ public class Handler extends BDHandler {
         }
     }
 
-    protected ControllerErrorEvent doStop() {
+    protected ControllerErrorEvent doStop(boolean eof) {
         Libbluray.selectRate(0.0f, false);
-        return super.doStop();
+        if (!eof) {
+            Libbluray.stopPlaylist();
+        }
+        return super.doStop(eof);
     }
 
     protected void doSeekTime(Time at) {
@@ -267,14 +310,14 @@ public class Handler extends BDHandler {
 
     protected void doAudioStreamChanged(int param) {
         if (currentLocator != null) {
-            locator.setPrimaryAudioStreamNumber(param);
+            currentLocator.setPrimaryAudioStreamNumber(param);
             postMediaSelectSucceeded(currentLocator);
         }
     }
 
     private void doSecondaryVideoChanged(int stream, boolean enable) {
         if (currentLocator != null) {
-            locator.setSecondaryVideoStreamNumber(stream);
+            currentLocator.setSecondaryVideoStreamNumber(stream);
             postMediaSelectSucceeded(currentLocator);
         }
 
@@ -283,7 +326,7 @@ public class Handler extends BDHandler {
 
     private void doSecondaryAudioChanged(int stream, boolean enable) {
         if (currentLocator != null) {
-            locator.setSecondaryAudioStreamNumber(stream);
+            currentLocator.setSecondaryAudioStreamNumber(stream);
             postMediaSelectSucceeded(currentLocator);
         }
     }
@@ -295,12 +338,12 @@ public class Handler extends BDHandler {
 
     protected void doEndOfMediaReached(int playlist) {
         synchronized (this) {
-            if (locator == null) {
-                System.err.println("endOfMedia(" + playlist + ") ignored: no current locator");
+            if (currentLocator == null) {
+                logger.error("endOfMedia(" + playlist + ") ignored: no current locator");
                 return;
             }
-            if (locator.getPlayListId() != playlist) {
-                System.err.println("endOfMedia ignored: playlist does not match (" + playlist + " != " + locator.getPlayListId());
+            if (currentLocator.getPlayListId() != playlist) {
+                logger.error("endOfMedia ignored: playlist does not match (" + playlist + " != " + currentLocator.getPlayListId());
                 return;
             }
         }
@@ -308,8 +351,15 @@ public class Handler extends BDHandler {
         super.doEndOfMediaReached(playlist);
     }
 
-    protected BDLocator getLocator() {
-        return locator;
+    protected void doSeekNotify(long tick) {
+        super.doSeekNotify(Libbluray.tellTime());
+    }
+
+    /* used by DVBMediaSelectControlImpl */
+    protected BDLocator getCurrentLocator() {
+        if (currentLocator != null)
+            return currentLocator;
+        return sourceLocator;
     }
 
     protected PlaylistInfo getPlaylistInfo() {
@@ -332,16 +382,32 @@ public class Handler extends BDHandler {
 
     protected void selectPlayList(BDLocator locator)
             throws InvalidPlayListException, InvalidLocatorException, ClockStartedError {
+
+        if (locator == null) {
+            logger.error("null locator");
+            throw new NullPointerException();
+        }
+        if (!locator.isPlayListItem()) {
+            logger.error("not playlist: " + locator);
+            throw new InvalidLocatorException(locator);
+        }
+
+        PlaylistInfo newPi = Libbluray.getPlaylistInfo(locator.getPlayListId());
+        if (newPi == null) {
+            logger.error("invalid playlist");
+            throw new InvalidPlayListException();
+        }
+
         synchronized (this) {
-            if (getState() == Started)
+            if (getState() == Started) {
+                logger.error("throw ClockStartedError");
                 throw new ClockStartedError();
-            if (!locator.isPlayListItem())
-                throw new InvalidLocatorException(locator);
-            pi = Libbluray.getPlaylistInfo(locator.getPlayListId());
-            if (pi == null)
-                throw new InvalidPlayListException();
-            this.locator = locator;
+            }
+
+            this.pi = newPi;
+            this.sourceLocator = locator;
             this.currentLocator = null;
+
             baseMediaTime = 0;
             if (state == Prefetched)
                 doPrefetch();
@@ -379,18 +445,18 @@ public class Handler extends BDHandler {
                 if ((player.getState() == Prefetched) || (player.getState() == Started)) {
                     Libbluray.seekMark(param);
                     player.updateTime(new Time(Libbluray.tellTime() * TO_SECONDS));
-                } else if (player.locator != null) {
-                    player.locator.setMarkId(param);
-                    player.locator.setPlayItemId(-1);
+                } else if (player.sourceLocator != null) {
+                    player.sourceLocator.setMarkId(param);
+                    player.sourceLocator.setPlayItemId(-1);
                 }
                 break;
             case ACTION_SEEK_PLAYITEM:
                 if ((player.getState() == Prefetched) || (player.getState() == Started)) {
                     Libbluray.seekPlayItem(param);
                     player.updateTime(new Time(Libbluray.tellTime() * TO_SECONDS));
-                } else if (player.locator != null) {
-                    player.locator.setMarkId(-1);
-                    player.locator.setPlayItemId(param);
+                } else if (player.sourceLocator != null) {
+                    player.sourceLocator.setMarkId(-1);
+                    player.sourceLocator.setPlayItemId(param);
                 }
                 break;
             }
@@ -406,4 +472,7 @@ public class Handler extends BDHandler {
 
     private PlaylistInfo pi = null;
     private BDLocator currentLocator = null;
+    private BDLocator sourceLocator = null;
+
+    private static final Logger logger = Logger.getLogger(Handler.class.getName());
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java
deleted file mode 100644
index 74c9541..0000000
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/MediaTimePositionControlImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of libbluray
- * Copyright (C) 2010  William Hahne
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-package org.videolan.media.content.playlist;
-
-import java.awt.Component;
-
-import javax.media.Time;
-
-import org.davic.media.MediaTimePositionControl;
-
-public class MediaTimePositionControlImpl implements MediaTimePositionControl {
-    protected MediaTimePositionControlImpl(Handler player) {
-        this.player = player;
-    }
-
-    public Component getControlComponent() {
-        return null;
-    }
-
-    public Time setMediaTimePosition(Time mediaTime) {
-        player.setMediaTime(mediaTime);
-        return player.getMediaTime();
-    }
-
-    public Time getMediaTimePosition() {
-        return player.getMediaTime();
-    }
-
-    private Handler player;
-}
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
index 91c0e54..0792ab6 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PiPControlImpl.java
@@ -37,7 +37,8 @@ import org.videolan.TIClip;
 
 public class PiPControlImpl extends VideoControl implements PiPControl, AsynchronousPiPControl {
     protected PiPControlImpl(Handler player) {
-        super(player, 1);
+        super(1);
+        this.player = player;
     }
 
     protected StreamInfo[] getStreams() {
@@ -117,5 +118,6 @@ public class PiPControlImpl extends VideoControl implements PiPControl, Asynchro
         return null;
     }
 
+    private Handler player;
     private BDJListeners listeners = new BDJListeners();
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryAudioControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryAudioControlImpl.java
index 8091387..17ebdf5 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryAudioControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/PrimaryAudioControlImpl.java
@@ -26,7 +26,7 @@ import org.videolan.TIClip;
 
 public class PrimaryAudioControlImpl extends StreamControl implements PrimaryAudioControl {
     protected PrimaryAudioControlImpl(Handler player) {
-        super(player);
+        this.player = player;
     }
 
     protected StreamInfo[] getStreams() {
@@ -47,4 +47,6 @@ public class PrimaryAudioControlImpl extends StreamControl implements PrimaryAud
     protected void setStreamNumber(int num) {
         Libbluray.writePSR(Libbluray.PSR_PRIMARY_AUDIO_ID, num);
     }
+
+    private Handler player;
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryAudioControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryAudioControlImpl.java
index ea2cd5e..548eef9 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryAudioControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SecondaryAudioControlImpl.java
@@ -26,7 +26,7 @@ import org.videolan.TIClip;
 
 public class SecondaryAudioControlImpl extends StreamControl implements SecondaryAudioControl {
     protected SecondaryAudioControlImpl(Handler player) {
-        super(player);
+        this.player = player;
     }
 
     protected StreamInfo[] getStreams() {
@@ -47,4 +47,6 @@ public class SecondaryAudioControlImpl extends StreamControl implements Secondar
     protected void setStreamNumber(int num) {
         Libbluray.writePSR(Libbluray.PSR_SECONDARY_AUDIO_VIDEO, num, 0x000000ff);
     }
+
+    private Handler player;
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/StreamControl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/StreamControl.java
index be0cd06..d2b8356 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/StreamControl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/StreamControl.java
@@ -29,8 +29,7 @@ import org.davic.media.NotAuthorizedException;
 import org.videolan.StreamInfo;
 
 public abstract class StreamControl implements Control {
-    protected StreamControl(Handler player) {
-        this.player = player;
+    protected StreamControl() {
     }
 
     protected abstract StreamInfo[] getStreams();
@@ -125,6 +124,4 @@ public abstract class StreamControl implements Control {
         }
         throw new LanguageNotAvailableException();
     }
-
-    protected Handler player;
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
index 3d5f1d5..b82e084 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/SubtitlingControlImpl.java
@@ -38,7 +38,7 @@ import org.videolan.TIClip;
 
 public class SubtitlingControlImpl extends StreamControl implements SubtitlingControl {
     protected SubtitlingControlImpl(Handler player) {
-        super(player);
+        this.player = player;
     }
 
     protected StreamInfo[] getStreams() {
@@ -137,6 +137,6 @@ public class SubtitlingControlImpl extends StreamControl implements SubtitlingCo
         }
     }
 
-
+    private Handler player;
     private BDJListeners listeners = new BDJListeners();
 }
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/VideoControl.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/VideoControl.java
index eafa781..5e46b65 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/VideoControl.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/VideoControl.java
@@ -29,8 +29,7 @@ import org.havi.ui.HVideoConfiguration;
 import org.videolan.StreamInfo;
 
 public abstract class VideoControl extends StreamControl implements VideoPresentationControl {
-    protected VideoControl(Handler player, int plane) {
-        super(player);
+    protected VideoControl(int plane) {
         this.plane = plane;
     }
 
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java
index af04c42..d762051 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/sound/Handler.java
@@ -37,9 +37,9 @@ import javax.media.protocol.DataSource;
 
 import org.bluray.net.BDLocator;
 
-//import org.videolan.media.content.playlist.MediaTimePositionControlImpl;
-import org.videolan.media.content.playlist.OverallGainControlImpl;
-import org.videolan.media.content.playlist.PanningControlImpl;
+import org.videolan.media.content.control.MediaTimePositionControlImpl;
+import org.videolan.media.content.control.OverallGainControlImpl;
+import org.videolan.media.content.control.PanningControlImpl;
 
 import org.videolan.media.content.BDHandler;
 
@@ -96,9 +96,11 @@ public class Handler extends BDHandler {
         return null;
     }
 
-    protected ControllerErrorEvent doStop() {
-        return super.doStop();
+    /*
+    protected ControllerErrorEvent doStop(boolean eof) {
+        return super.doStop(eof);
     }
+    */
 
     protected BDLocator getLocator() {
         return locator;
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/sound/MediaTimePositionControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/sound/MediaTimePositionControlImpl.java
deleted file mode 100644
index b74791d..0000000
--- a/src/libbluray/bdj/java/org/videolan/media/content/sound/MediaTimePositionControlImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This file is part of libbluray
- * Copyright (C) 2010  William Hahne
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- */
-
-package org.videolan.media.content.sound;
-
-import java.awt.Component;
-
-import javax.media.Time;
-
-import org.davic.media.MediaTimePositionControl;
-
-public class MediaTimePositionControlImpl implements MediaTimePositionControl {
-    protected MediaTimePositionControlImpl(Handler player) {
-        this.player = player;
-    }
-
-    public Component getControlComponent() {
-        return null;
-    }
-
-    public Time setMediaTimePosition(Time mediaTime) {
-        player.setMediaTime(mediaTime);
-        return player.getMediaTime();
-    }
-
-    public Time getMediaTimePosition() {
-        return player.getMediaTime();
-    }
-
-    private Handler player;
-}
diff --git a/src/libbluray/bdj/java/org/videolan/media/protocol/bd/DataSource.java b/src/libbluray/bdj/java/org/videolan/media/protocol/bd/DataSource.java
index 69ff78f..2ff554c 100644
--- a/src/libbluray/bdj/java/org/videolan/media/protocol/bd/DataSource.java
+++ b/src/libbluray/bdj/java/org/videolan/media/protocol/bd/DataSource.java
@@ -34,7 +34,7 @@ public class DataSource extends javax.media.protocol.DataSource {
 
     public Time getDuration() {
         org.videolan.Logger.unimplemented(DataSource.class.getName(), "getDuration");
-        return null;
+        return DURATION_UNKNOWN;
     }
 
     public String getContentType() {
diff --git a/src/libbluray/bdj/java/org/videolan/media/protocol/file/DataSource.java b/src/libbluray/bdj/java/org/videolan/media/protocol/file/DataSource.java
index bb00bb2..2dad4a9 100644
--- a/src/libbluray/bdj/java/org/videolan/media/protocol/file/DataSource.java
+++ b/src/libbluray/bdj/java/org/videolan/media/protocol/file/DataSource.java
@@ -33,7 +33,7 @@ public class DataSource extends javax.media.protocol.DataSource {
 
     public Time getDuration() {
         org.videolan.Logger.unimplemented(DataSource.class.getName(), "getDuration");
-        return null;
+        return DURATION_UNKNOWN;
     }
 
     public String getContentType() {
diff --git a/src/libbluray/bdj/native/java_awt_BDGraphics.c b/src/libbluray/bdj/native/java_awt_BDGraphics.c
index 1b96254..e228b5d 100644
--- a/src/libbluray/bdj/native/java_awt_BDGraphics.c
+++ b/src/libbluray/bdj/native/java_awt_BDGraphics.c
@@ -67,7 +67,7 @@ Java_java_awt_BDGraphics_drawStringN(JNIEnv * env, jobject obj, jlong ftFace, js
     cls = (*env)->GetObjectClass(env, obj);
     mid = (*env)->GetMethodID(env, cls, "drawPoint", "(III)V");
 
-    a = (rgb >> 24) & 0xff;
+    a = ((unsigned)rgb >> 24) & 0xff;
     c = rgb & 0xffffff;
 
     for (i = 0; i < length; i++) {
@@ -76,7 +76,7 @@ Java_java_awt_BDGraphics_drawStringN(JNIEnv * env, jobject obj, jlong ftFace, js
                 for (k = 0; k < face->glyph->bitmap.width; k++) {
                     jint pixel;
                     pixel = face->glyph->bitmap.buffer[j*face->glyph->bitmap.pitch + k];
-                    pixel = ((a * pixel / 255) << 24) | c;
+                    pixel = ((unsigned)(a * pixel / 255) << 24) | c;
                     (*env)->CallVoidMethod(env, obj, mid,
                                            x + face->glyph->bitmap_left + k,
                                            y - face->glyph->bitmap_top + j,
diff --git a/src/libbluray/bdj/native/org_videolan_Libbluray.c b/src/libbluray/bdj/native/org_videolan_Libbluray.c
index c940ec5..980ebf5 100644
--- a/src/libbluray/bdj/native/org_videolan_Libbluray.c
+++ b/src/libbluray/bdj/native/org_videolan_Libbluray.c
@@ -193,14 +193,25 @@ JNIEXPORT jbyteArray JNICALL Java_org_videolan_Libbluray_getAacsDataN
 {
     BLURAY* bd = (BLURAY*)(intptr_t)np;
     const uint8_t *data = bd_get_aacs_data(bd, type);
+    size_t data_size = 16;
 
     BD_DEBUG(DBG_JNI, "getAacsDataN(%d) -> %p\n", (int)type, (const void *)data);
 
     if (!data) {
         return NULL;
     }
-    jbyteArray array = (*env)->NewByteArray(env, 16);
-    (*env)->SetByteArrayRegion(env, array, 0, 16, (const jbyte *)data);
+    if (type == 1/*BD_AACS_DISC_ID*/) {
+        data_size = 20;
+    }
+    if (type == 7/*BD_AACS_CONTENT_CERT_ID*/) {
+        data_size = 6;
+    }
+    if (type == 8/*BD_AACS_BDJ_ROOT_CERT_HASH*/) {
+        data_size = 20;
+    }
+
+    jbyteArray array = (*env)->NewByteArray(env, data_size);
+    (*env)->SetByteArrayRegion(env, array, 0, data_size, (const jbyte *)data);
     return array;
 }
 
diff --git a/src/libbluray/bdnav/clpi_parse.c b/src/libbluray/bdnav/clpi_parse.c
index ec57a38..394347e 100644
--- a/src/libbluray/bdnav/clpi_parse.c
+++ b/src/libbluray/bdnav/clpi_parse.c
@@ -359,8 +359,8 @@ _parse_cpi_info(BITSTREAM *bits, CLPI_CL *cl)
     return _parse_cpi(bits, &cl->cpi);
 }
 
-static uint32_t
-_find_stc_spn(const CLPI_CL *cl, uint8_t stc_id)
+uint32_t
+clpi_find_stc_spn(const CLPI_CL *cl, uint8_t stc_id)
 {
     int ii;
     CLPI_ATC_SEQ *atc;
@@ -401,7 +401,7 @@ clpi_lookup_spn(const CLPI_CL *cl, uint32_t timestamp, int before, uint8_t stc_i
     // Use sequence info to find spn_stc_start before doing
     // PTS search. The spn_stc_start defines the point in
     // the EP map to start searching.
-    stc_spn = _find_stc_spn(cl, stc_id);
+    stc_spn = clpi_find_stc_spn(cl, stc_id);
     for (ii = 0; ii < entry->num_ep_coarse; ii++) {
         ref = entry->coarse[ii].ref_ep_fine_id;
         if (entry->coarse[ii].spn_ep >= stc_spn) {
diff --git a/src/libbluray/bdnav/clpi_parse.h b/src/libbluray/bdnav/clpi_parse.h
index 38490e5..2263f66 100644
--- a/src/libbluray/bdnav/clpi_parse.h
+++ b/src/libbluray/bdnav/clpi_parse.h
@@ -27,6 +27,7 @@
 
 struct bd_disc;
 
+BD_PRIVATE uint32_t clpi_find_stc_spn(const CLPI_CL *cl, uint8_t stc_id);
 BD_PRIVATE uint32_t clpi_lookup_spn(const CLPI_CL *cl, uint32_t timestamp, int before, uint8_t stc_id);
 BD_PRIVATE uint32_t clpi_access_point(const CLPI_CL *cl, uint32_t pkt, int next, int angle_change, uint32_t *time);
 BD_PRIVATE CLPI_CL* clpi_parse(const char *path) BD_ATTR_MALLOC;
diff --git a/src/libbluray/bdnav/meta_parse.c b/src/libbluray/bdnav/meta_parse.c
index a9a7edc..c65ac9e 100644
--- a/src/libbluray/bdnav/meta_parse.c
+++ b/src/libbluray/bdnav/meta_parse.c
@@ -185,7 +185,7 @@ META_ROOT *meta_parse(BD_DISC *disc)
                     root->dl_entries[i].toc_entries = NULL;
                     root->dl_entries[i].thumbnails = NULL;
                     _parseManifestNode(root_element, &root->dl_entries[i]);
-                    XML_FREE(doc);
+                    xmlFreeDoc(doc);
                 }
             X_FREE(data);
         }
diff --git a/src/libbluray/bdnav/mpls_parse.c b/src/libbluray/bdnav/mpls_parse.c
index da01f7b..e196118 100644
--- a/src/libbluray/bdnav/mpls_parse.c
+++ b/src/libbluray/bdnav/mpls_parse.c
@@ -671,7 +671,7 @@ _parse_playlistmark(BITSTREAM *bits, MPLS_PL *pl)
 
     plm = calloc(pl->mark_count, sizeof(MPLS_PLM));
     for (ii = 0; ii < pl->mark_count; ii++) {
-        plm[ii].mark_id       = bs_read(bits, 8);
+        bs_skip(bits, 8); /* reserved */
         plm[ii].mark_type     = bs_read(bits, 8);
         plm[ii].play_item_ref = bs_read(bits, 16);
         plm[ii].time          = bs_read(bits, 32);
diff --git a/src/libbluray/bdnav/mpls_parse.h b/src/libbluray/bdnav/mpls_parse.h
index f9f7a18..94bfa67 100644
--- a/src/libbluray/bdnav/mpls_parse.h
+++ b/src/libbluray/bdnav/mpls_parse.h
@@ -94,7 +94,6 @@ typedef struct
 
 typedef struct
 {
-    uint8_t         mark_id;
     uint8_t         mark_type;
     uint16_t        play_item_ref;
     uint32_t        time;
diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
index 39be4b7..7c91f0b 100644
--- a/src/libbluray/bdnav/navigation.c
+++ b/src/libbluray/bdnav/navigation.c
@@ -1,6 +1,7 @@
 /*
  * This file is part of libbluray
  * Copyright (C) 2009-2010  John Stebbins
+ * Copyright (C) 2010-2016  Petri Hintukainen
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,6 +26,7 @@
 
 #include "clpi_parse.h"
 #include "mpls_parse.h"
+#include "bdparse.h"
 
 #include "disc/disc.h"
 
@@ -36,6 +38,43 @@
 #include <stdlib.h>
 #include <string.h>
 
+/*
+ * Utils
+ */
+
+static uint32_t
+_pl_duration(MPLS_PL *pl)
+{
+    unsigned ii;
+    uint32_t duration = 0;
+    MPLS_PI *pi;
+
+    for (ii = 0; ii < pl->list_count; ii++) {
+        pi = &pl->play_item[ii];
+        duration += pi->out_time - pi->in_time;
+    }
+    return duration;
+}
+
+static uint32_t
+_pl_chapter_count(MPLS_PL *pl)
+{
+    unsigned ii, chapters = 0;
+
+    // Count the number of "entry" marks (skipping "link" marks)
+    // This is the the number of chapters
+    for (ii = 0; ii < pl->mark_count; ii++) {
+        if (pl->play_mark[ii].mark_type == BD_MARK_ENTRY) {
+            chapters++;
+        }
+    }
+    return chapters;
+}
+
+/*
+ * Check if two playlists are the same
+ */
+
 static int _stream_cmp(MPLS_STREAM *a, MPLS_STREAM *b)
 {
     if (a->stream_type == b->stream_type &&
@@ -92,6 +131,19 @@ static int _pi_cmp(MPLS_PI *pi1, MPLS_PI *pi2)
     return 0;
 }
 
+static int _pm_cmp(MPLS_PLM *pm1, MPLS_PLM *pm2)
+{
+    if (pm1->mark_type     == pm2->mark_type     &&
+        pm1->play_item_ref == pm2->play_item_ref &&
+        pm1->time          == pm2->time          &&
+        pm1->entry_es_pid  == pm2->entry_es_pid  &&
+        pm1->duration      == pm2->duration ) {
+        return 0;
+    }
+
+    return 1;
+}
+
 static int _pl_cmp(MPLS_PL *pl1, MPLS_PL *pl2)
 {
     unsigned ii;
@@ -102,6 +154,12 @@ static int _pl_cmp(MPLS_PL *pl1, MPLS_PL *pl2)
     if (pl1->mark_count != pl2->mark_count) {
         return 1;
     }
+
+    for (ii = 0; ii < pl1->mark_count; ii++) {
+        if (_pm_cmp(&pl1->play_mark[ii], &pl2->play_mark[ii])) {
+            return 1;
+        }
+    }
     for (ii = 0; ii < pl1->list_count; ii++) {
         if (_pi_cmp(&pl1->play_item[ii], &pl2->play_item[ii])) {
             return 1;
@@ -111,6 +169,10 @@ static int _pl_cmp(MPLS_PL *pl1, MPLS_PL *pl2)
     return 0;
 }
 
+/*
+ * Playlist filtering
+ */
+
 /* return 0 if duplicate playlist */
 static int _filter_dup(MPLS_PL *pl_list[], unsigned count, MPLS_PL *pl)
 {
@@ -154,26 +216,122 @@ _filter_repeats(MPLS_PL *pl, unsigned repeats)
       pi = &pl->play_item[ii];
       // Ignore titles with repeated segments
       if (_find_repeats(pl, pi->clip[0].clip_id, pi->in_time, pi->out_time) > repeats) {
-        return 0;
+          return 0;
       }
     }
     return 1;
 }
 
-static uint32_t
-_pl_duration(MPLS_PL *pl)
+/*
+ * find main movie playlist
+ */
+
+#define DBG_MAIN_PL DBG_NAV
+
+static void _video_props(MPLS_STN *s, int *full_hd, int *mpeg12)
 {
     unsigned ii;
-    uint32_t duration = 0;
-    MPLS_PI *pi;
+    *mpeg12 = 1;
+    *full_hd = 0;
+    for (ii = 0; ii < s->num_video; ii++) {
+        if (s->video[ii].coding_type > 4) {
+            *mpeg12 = 0;
+        }
+        if (s->video[ii].format == BD_VIDEO_FORMAT_1080I || s->video[ii].format == BD_VIDEO_FORMAT_1080P) {
+            *full_hd = 1;
+        }
+    }
+}
 
-    for (ii = 0; ii < pl->list_count; ii++) {
-        pi = &pl->play_item[ii];
-        duration += pi->out_time - pi->in_time;
+static void _audio_props(MPLS_STN *s, int *hd_audio)
+{
+    unsigned ii;
+    *hd_audio = 0;
+    for (ii = 0; ii < s->num_audio; ii++) {
+        if (s->audio[ii].format == BD_STREAM_TYPE_AUDIO_LPCM || s->audio[ii].format >= BD_STREAM_TYPE_AUDIO_TRUHD) {
+            *hd_audio = 1;
+        }
     }
-    return duration;
 }
 
+static int _cmp_video_props(const MPLS_PL *p1, const MPLS_PL *p2)
+{
+    MPLS_STN *s1 = &p1->play_item[0].stn;
+    MPLS_STN *s2 = &p2->play_item[0].stn;
+    int fhd1, fhd2, mp12_1, mp12_2;
+
+    _video_props(s1, &fhd1, &mp12_1);
+    _video_props(s2, &fhd2, &mp12_2);
+
+    /* prefer Full HD over HD/SD */
+    if (fhd1 != fhd2)
+        return fhd2 - fhd1;
+
+    /* prefer H.264/VC1 over MPEG1/2 */
+    return mp12_2 - mp12_1;
+}
+
+static int _cmp_audio_props(const MPLS_PL *p1, const MPLS_PL *p2)
+{
+    MPLS_STN *s1 = &p1->play_item[0].stn;
+    MPLS_STN *s2 = &p2->play_item[0].stn;
+    int hda1, hda2;
+
+    _audio_props(s1, &hda1);
+    _audio_props(s2, &hda2);
+
+    /* prefer HD audio formats */
+    return hda2 - hda1;
+}
+
+static int _pl_guess_main_title(MPLS_PL *p1, MPLS_PL *p2)
+{
+    uint32_t d1 = _pl_duration(p1);
+    uint32_t d2 = _pl_duration(p2);
+
+    /* if both longer than 30 min */
+    if (d1 > 30*60*45000 && d2 > 30*60*45000) {
+
+        /* prefer many chapters over no chapters */
+        int chap1 = _pl_chapter_count(p1);
+        int chap2 = _pl_chapter_count(p2);
+        int chap_diff = chap2 - chap1;
+        if ((chap1 < 2 || chap2 < 2) && (chap_diff < -5 || chap_diff > 5)) {
+            /* chapter count differs by more than 5 */
+            BD_DEBUG(DBG_MAIN_PL, "main title: chapter count difference %d\n", chap_diff);
+            return chap_diff;
+        }
+
+        /* Check video: prefer HD over SD, H.264/VC1 over MPEG1/2 */
+        int vid_diff = _cmp_video_props(p1, p2);
+        if (vid_diff) {
+            BD_DEBUG(DBG_MAIN_PL, "main title: video properties difference %d\n", vid_diff);
+            return vid_diff;
+        }
+
+        /* compare audio: prefer HD audio */
+        int aud_diff = _cmp_audio_props(p1, p2);
+        if (aud_diff) {
+            BD_DEBUG(DBG_MAIN_PL, "main title: audio properties difference %d\n", aud_diff);
+            return aud_diff;
+        }
+    }
+
+    /* compare playlist duration, select longer playlist */
+    if (d1 < d2) {
+        return 1;
+    }
+    if (d1 > d2) {
+        return -1;
+    }
+
+    return 0;
+}
+
+/*
+ * title list
+ */
+
 NAV_TITLE_LIST* nav_get_title_list(BD_DISC *disc, uint32_t flags, uint32_t min_title_length)
 {
     BD_DIR_H *dir;
@@ -241,7 +399,8 @@ NAV_TITLE_LIST* nav_get_title_list(BD_DISC *disc, uint32_t flags, uint32_t min_t
             /* main title guessing */
             if (_filter_dup(pl_list, ii, pl) &&
                 _filter_repeats(pl, 2)) {
-                if (_pl_duration(pl_list[ii]) >= _pl_duration(pl_list[title_list->main_title_idx])) {
+
+                if (_pl_guess_main_title(pl_list[ii], pl_list[title_list->main_title_idx]) <= 0) {
                     title_list->main_title_idx = ii;
                 }
             }
@@ -270,6 +429,10 @@ void nav_free_title_list(NAV_TITLE_LIST *title_list)
     X_FREE(title_list);
 }
 
+/*
+ *
+ */
+
 uint8_t nav_lookup_aspect(NAV_CLIP *clip, int pid)
 {
     CLPI_PROG *progs;
@@ -312,7 +475,7 @@ _fill_mark(NAV_TITLE *title, NAV_MARK *mark, int entry)
     } else {
         mark->clip_pkt = clip->start_pkt;
     }
-    mark->title_pkt = clip->title_pkt + mark->clip_pkt;
+    mark->title_pkt = clip->title_pkt + mark->clip_pkt - clip->start_pkt;
     mark->clip_time = plm->time;
 
     // Calculate start of mark relative to beginning of playlist
@@ -441,12 +604,14 @@ static void _fill_clip(NAV_TITLE *title,
     *pos += clip->end_pkt - clip->start_pkt;
     clip->title_time = *time;
     *time += clip->out_time - clip->in_time;
+
+    clip->stc_spn = clpi_find_stc_spn(clip->cl, mpls_clip[clip->angle].stc_id);
 }
 
 NAV_TITLE* nav_title_open(BD_DISC *disc, const char *playlist, unsigned angle)
 {
     NAV_TITLE *title = NULL;
-    unsigned ii, ss, chapters = 0;
+    unsigned ii, ss;
     uint32_t pos = 0;
     uint32_t time = 0;
 
@@ -506,15 +671,8 @@ NAV_TITLE* nav_title_open(BD_DISC *disc, const char *playlist, unsigned angle)
         }
     }
 
-    // Count the number of "entry" marks (skipping "link" marks)
-    // This is the the number of chapters
-    for (ii = 0; ii < title->pl->mark_count; ii++) {
-        if (title->pl->play_mark[ii].mark_type == BD_MARK_ENTRY) {
-            chapters++;
-        }
-    }
-    title->chap_list.count = chapters;
-    title->chap_list.mark = calloc(chapters, sizeof(NAV_MARK));
+    title->chap_list.count = _pl_chapter_count(title->pl);
+    title->chap_list.mark = calloc(title->chap_list.count, sizeof(NAV_MARK));
     title->mark_list.count = title->pl->mark_count;
     title->mark_list.mark = calloc(title->pl->mark_count, sizeof(NAV_MARK));
 
@@ -577,32 +735,22 @@ NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_
     return clip;
 }
 
-uint32_t nav_chapter_get_current(NAV_CLIP *clip, uint32_t clip_pkt)
+uint32_t nav_chapter_get_current(NAV_TITLE * title, uint32_t title_pkt)
 {
     NAV_MARK * mark;
-    NAV_TITLE *title;
     uint32_t ii;
 
-    // Clip can be null if we haven't started the first clip yet
-    if (clip == NULL) {
+    if (title == NULL) {
         return 0;
     }
-    title = clip->title;
     for (ii = 0; ii < title->chap_list.count; ii++) {
         mark = &title->chap_list.mark[ii];
-        if (mark->clip_ref > clip->ref)
-        {
-            if (ii)
-                return ii-1;
-            else
-                return 0;
-        }
-        if (mark->clip_ref == clip->ref && mark->clip_pkt <= clip_pkt) {
+        if (mark->title_pkt <= title_pkt) {
             if ( ii == title->chap_list.count - 1 ) {
                 return ii;
             }
             mark = &title->chap_list.mark[ii+1];
-            if (mark->clip_ref != clip->ref || mark->clip_pkt > clip_pkt) {
+            if (mark->title_pkt > title_pkt) {
                 return ii;
             }
         }
diff --git a/src/libbluray/bdnav/navigation.h b/src/libbluray/bdnav/navigation.h
index 67a020a..7d2d325 100644
--- a/src/libbluray/bdnav/navigation.h
+++ b/src/libbluray/bdnav/navigation.h
@@ -85,6 +85,8 @@ struct nav_clip_s
     NAV_TITLE *title;
 
     CLPI_CL  *cl;
+
+    uint32_t stc_spn;  /* start packet of clip STC sequence */
 };
 
 typedef struct nav_clip_list_s NAV_CLIP_LIST;
@@ -146,7 +148,7 @@ BD_PRIVATE NAV_CLIP* nav_packet_search(NAV_TITLE *title, uint32_t pkt, uint32_t
 BD_PRIVATE NAV_CLIP* nav_time_search(NAV_TITLE *title, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
 BD_PRIVATE void nav_clip_time_search(NAV_CLIP *clip, uint32_t tick, uint32_t *clip_pkt, uint32_t *out_pkt);
 BD_PRIVATE NAV_CLIP* nav_chapter_search(NAV_TITLE *title, unsigned chapter, uint32_t *clip_pkt, uint32_t *out_pkt);
-BD_PRIVATE uint32_t nav_chapter_get_current(NAV_CLIP *clip, uint32_t clip_pkt);
+BD_PRIVATE uint32_t nav_chapter_get_current(NAV_TITLE *title, uint32_t title_pkt);
 BD_PRIVATE NAV_CLIP* nav_mark_search(NAV_TITLE *title, unsigned mark, uint32_t *clip_pkt, uint32_t *out_pkt);
 BD_PRIVATE uint32_t nav_angle_change_search(NAV_CLIP *clip, uint32_t pkt, uint32_t *time);
 BD_PRIVATE NAV_CLIP* nav_set_angle(NAV_TITLE *title, NAV_CLIP *clip, unsigned angle);
diff --git a/src/libbluray/bdnav/sound_parse.c b/src/libbluray/bdnav/sound_parse.c
index b5d11fd..7c267da 100644
--- a/src/libbluray/bdnav/sound_parse.c
+++ b/src/libbluray/bdnav/sound_parse.c
@@ -169,7 +169,7 @@ static SOUND_DATA *_sound_parse(BD_FILE_H *fp)
 
     data_offsets = calloc(num_sounds, sizeof(uint32_t));
     data = calloc(1, sizeof(SOUND_DATA));
-    if (!data_offsets | !data) {
+    if (!data_offsets || !data) {
         BD_DEBUG(DBG_CRIT, "out of memory\n");
         goto error;
     }
diff --git a/src/libbluray/bluray-version.h b/src/libbluray/bluray-version.h
index 65df0af..dc4f536 100644
--- a/src/libbluray/bluray-version.h
+++ b/src/libbluray/bluray-version.h
@@ -27,9 +27,9 @@
 
 #define BLURAY_VERSION_MAJOR 0
 #define BLURAY_VERSION_MINOR 9
-#define BLURAY_VERSION_MICRO 2
+#define BLURAY_VERSION_MICRO 3
 
-#define BLURAY_VERSION_STRING "0.9.2"
+#define BLURAY_VERSION_STRING "0.9.3"
 
 #define BLURAY_VERSION \
     BLURAY_VERSION_CODE(BLURAY_VERSION_MAJOR, BLURAY_VERSION_MINOR, BLURAY_VERSION_MICRO)
diff --git a/src/libbluray/bluray.c b/src/libbluray/bluray.c
index 1aedf2c..0e60b68 100644
--- a/src/libbluray/bluray.c
+++ b/src/libbluray/bluray.c
@@ -28,6 +28,7 @@
 #include "bluray_internal.h"
 #include "register.h"
 #include "util/array.h"
+#include "util/event_queue.h"
 #include "util/macro.h"
 #include "util/logging.h"
 #include "util/strutl.h"
@@ -59,14 +60,6 @@
 #include <string.h>
 
 
-#define MAX_EVENTS 31  /* 2^n - 1 */
-typedef struct bd_event_queue_s {
-    BD_MUTEX mutex;
-    unsigned in;  /* next free slot */
-    unsigned out; /* next event */
-    BD_EVENT ev[MAX_EVENTS+1];
-} BD_EVENT_QUEUE;
-
 typedef enum {
     title_undef = 0,
     title_hdmv,
@@ -200,83 +193,55 @@ void bd_get_version(int *major, int *minor, int *micro)
  * Navigation mode event queue
  */
 
-static void _init_event_queue(BLURAY *bd)
+static int _get_event(BLURAY *bd, BD_EVENT *ev)
 {
-    if (!bd->event_queue) {
-        bd->event_queue = calloc(1, sizeof(struct bd_event_queue_s));
-        if (bd->event_queue) {
-            bd_mutex_init(&bd->event_queue->mutex);
-        }
-    } else {
-        bd_mutex_lock(&bd->event_queue->mutex);
-        bd->event_queue->in  = 0;
-        bd->event_queue->out = 0;
-        memset(bd->event_queue->ev, 0, sizeof(bd->event_queue->ev));
-        bd_mutex_unlock(&bd->event_queue->mutex);
+    int result = event_queue_get(bd->event_queue, ev);
+    if (!result) {
+        ev->event = BD_EVENT_NONE;
     }
+    return result;
 }
 
-static void _free_event_queue(BLURAY *bd)
+static int _queue_event(BLURAY *bd, uint32_t event, uint32_t param)
 {
+    int result = 0;
     if (bd->event_queue) {
-        bd_mutex_destroy(&bd->event_queue->mutex);
-        X_FREE(bd->event_queue);
-    }
-}
-
-static int _get_event(BLURAY *bd, BD_EVENT *ev)
-{
-    struct bd_event_queue_s *eq = bd->event_queue;
-
-    if (eq) {
-        bd_mutex_lock(&eq->mutex);
-
-        if (eq->in != eq->out) {
-
-            *ev = eq->ev[eq->out];
-            eq->out = (eq->out + 1) & MAX_EVENTS;
-
-            bd_mutex_unlock(&eq->mutex);
-            return 1;
+        BD_EVENT ev = { event, param };
+        result = event_queue_put(bd->event_queue, &ev);
+        if (!result) {
+            BD_DEBUG(DBG_BLURAY|DBG_CRIT, "_queue_event(%d, %d): queue overflow !\n", event, param);
         }
-
-        bd_mutex_unlock(&eq->mutex);
     }
-
-    ev->event = BD_EVENT_NONE;
-
-    return 0;
+    return result;
 }
 
-static int _queue_event(BLURAY *bd, uint32_t event, uint32_t param)
-{
-    struct bd_event_queue_s *eq = bd->event_queue;
-
-    if (eq) {
-        bd_mutex_lock(&eq->mutex);
-
-        unsigned new_in = (eq->in + 1) & MAX_EVENTS;
-
-        if (new_in != eq->out) {
-            eq->ev[eq->in].event = event;
-            eq->ev[eq->in].param = param;
-            eq->in = new_in;
-
-            bd_mutex_unlock(&eq->mutex);
-            return 1;
-        }
+/*
+ * PSR utils
+ */
 
-        bd_mutex_unlock(&eq->mutex);
+static void _update_time_psr(BLURAY *bd, uint32_t time)
+{
+    /*
+     * Update PSR8: Presentation Time
+     * The PSR8 represents presentation time in the playing interval from IN_time until OUT_time of
+     * the current PlayItem, measured in units of a 45 kHz clock.
+     */
 
-        BD_DEBUG(DBG_BLURAY|DBG_CRIT, "_queue_event(%d, %d): queue overflow !\n", event, param);
+    if (!bd->title || !bd->st0.clip) {
+        return;
+    }
+    if (time < bd->st0.clip->in_time) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_update_time_psr(): timestamp before clip start\n");
+        return;
+    }
+    if (time > bd->st0.clip->out_time) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_update_time_psr(): timestamp after clip end\n");
+        return;
     }
 
-    return 0;
+    bd_psr_write(bd->regs, PSR_TIME, time);
 }
 
-/*
- * PSR utils
- */
 
 static void _update_stream_psr_by_lang(BD_REGISTERS *regs,
                                        uint32_t psr_lang, uint32_t psr_stream,
@@ -413,7 +378,7 @@ static int _is_interactive_title(BLURAY *bd)
 
 static void _update_chapter_psr(BLURAY *bd)
 {
-    if (!_is_interactive_title(bd)) {
+    if (!_is_interactive_title(bd) && bd->title->chap_list.count > 0) {
         uint32_t current_chapter = bd_get_current_chapter(bd);
         bd_psr_write(bd->regs, PSR_CHAPTER,  current_chapter + 1);
     }
@@ -588,6 +553,10 @@ static int _open_m2ts(BLURAY *bd, BD_STREAM *st)
 {
     _close_m2ts(st);
 
+    if (!st->clip) {
+        return 0;
+    }
+
     st->fp = disc_open_stream(bd->disc, st->clip->name);
 
     st->clip_size = 0;
@@ -952,6 +921,7 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
     bd->disc_info.bdplus_handled     = enc_info->bdplus_handled;
     bd->disc_info.bdplus_gen         = enc_info->bdplus_gen;
     bd->disc_info.bdplus_date        = enc_info->bdplus_date;
+    bd->disc_info.no_menu_support    = enc_info->no_menu_support;
 
     bd->disc_info.udf_volume_id      = disc_volume_id(bd->disc);
 
@@ -1098,6 +1068,12 @@ static void _fill_disc_info(BLURAY *bd, BD_ENC_INFO *enc_info)
         indx_free(&index);
     }
 
+#if 0
+    if (!bd->disc_info.first_play_supported || !bd->disc_info.top_menu_supported) {
+        bd->disc_info.no_menu_support = 1;
+    }
+#endif
+
     if (bd->disc_info.bdj_detected) {
         BDID_DATA *bdid = bdid_get(bd->disc); /* parse id.bdmv */
         if (bdid) {
@@ -1418,8 +1394,7 @@ BLURAY *bd_init(void)
 
 static int _bd_open(BLURAY *bd,
                     const char *device_path, const char *keyfile_path,
-                    void *read_blocks_handle,
-                    int (*read_blocks)(void *handle, void *buf, int lba, int num_blocks))
+                    fs_access *p_fs)
 {
     BD_ENC_INFO enc_info;
 
@@ -1431,7 +1406,7 @@ static int _bd_open(BLURAY *bd,
         return 0;
     }
 
-    bd->disc = disc_open(device_path, read_blocks_handle, read_blocks,
+    bd->disc = disc_open(device_path, p_fs,
                          &enc_info, keyfile_path,
                          (void*)bd->regs, (void*)bd_psr_read, (void*)bd_psr_write);
 
@@ -1451,7 +1426,7 @@ int bd_open_disc(BLURAY *bd, const char *device_path, const char *keyfile_path)
         return 0;
     }
 
-    return _bd_open(bd, device_path, keyfile_path, NULL, NULL);
+    return _bd_open(bd, device_path, keyfile_path, NULL);
 }
 
 int bd_open_stream(BLURAY *bd,
@@ -1462,7 +1437,21 @@ int bd_open_stream(BLURAY *bd,
         return 0;
     }
 
-    return _bd_open(bd, NULL, NULL, read_blocks_handle, read_blocks);
+    fs_access fs = { read_blocks_handle, read_blocks, NULL, NULL };
+    return _bd_open(bd, NULL, NULL, &fs);
+}
+
+int bd_open_files(BLURAY *bd,
+                  void *handle,
+                  struct bd_dir_s *(*open_dir)(void *handle, const char *rel_path),
+                  struct bd_file_s *(*open_file)(void *handle, const char *rel_path))
+{
+    if (!open_dir || !open_file) {
+        return 0;
+    }
+
+    fs_access fs = { handle, NULL, open_dir, open_file };
+    return _bd_open(bd, NULL, NULL, &fs);
 }
 
 BLURAY *bd_open(const char *device_path, const char *keyfile_path)
@@ -1504,7 +1493,7 @@ void bd_close(BLURAY *bd)
     sound_free(&bd->sound_effects);
     bd_registers_free(bd->regs);
 
-    _free_event_queue(bd);
+    event_queue_destroy(&bd->event_queue);
     array_free((void**)&bd->titles);
     _storage_free(bd);
 
@@ -1535,8 +1524,7 @@ static void _find_next_playmark(BLURAY *bd)
         if (pos > bd->s_pos) {
             bd->next_mark = ii;
             bd->next_mark_pos = pos;
-            _update_chapter_psr(bd);
-            return;
+            break;
         }
     }
 
@@ -1572,11 +1560,12 @@ static void _seek_internal(BLURAY *bd,
 {
     if (_seek_stream(bd, &bd->st0, clip, clip_pkt) >= 0) {
 
-        _queue_event(bd, BD_EVENT_SEEK, 0);
-
         /* update title position */
         bd->s_pos = (uint64_t)title_pkt * 192;
 
+        _queue_event(bd, BD_EVENT_SEEK, 0);
+        _bdj_event(bd, BDJ_EVENT_SEEK, 0);
+
         /* playmark tracking */
         _find_next_playmark(bd);
 
@@ -1713,7 +1702,7 @@ uint32_t bd_get_current_chapter(BLURAY *bd)
     bd_mutex_lock(&bd->mutex);
 
     if (bd->title) {
-        ret = nav_chapter_get_current(bd->st0.clip, SPN(bd->st0.clip_pos));
+        ret = nav_chapter_get_current(bd->title, SPN(bd->s_pos));
     }
 
     bd_mutex_unlock(&bd->mutex);
@@ -1843,14 +1832,22 @@ static int64_t _clip_seek_time(BLURAY *bd, uint32_t tick)
 {
     uint32_t clip_pkt, out_pkt;
 
-    if (tick < bd->st0.clip->out_time) {
-
-        // Find the closest access unit to the requested position
-        nav_clip_time_search(bd->st0.clip, tick, &clip_pkt, &out_pkt);
+    if (!bd->title || !bd->st0.clip) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_clip_seek_time(): no playlist playing\n");
+        return -1;
+    }
 
-        _seek_internal(bd, bd->st0.clip, out_pkt, clip_pkt);
+    if (tick >= bd->st0.clip->out_time) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "_clip_seek_time(): timestamp after clip end (%u < %u)\n",
+                 bd->st0.clip->out_time, tick);
+        return -1;
     }
 
+    // Find the closest access unit to the requested position
+    nav_clip_time_search(bd->st0.clip, tick, &clip_pkt, &out_pkt);
+
+    _seek_internal(bd, bd->st0.clip, out_pkt, clip_pkt);
+
     return bd->s_pos;
 }
 
@@ -1863,6 +1860,14 @@ static int _bd_read(BLURAY *bd, unsigned char *buf, int len)
         out_len = 0;
         BD_DEBUG(DBG_STREAM, "Reading [%d bytes] at %"PRIu64"...\n", len, bd->s_pos);
 
+        if (st->clip == NULL) {
+            // We previously reached the last clip.  Nothing
+            // else to read.
+            _queue_event(bd, BD_EVENT_END_OF_TITLE, 0);
+            bd->end_of_playlist |= 1;
+            return 0;
+        }
+
         while (len > 0) {
             uint32_t clip_pkt;
 
@@ -1891,13 +1896,6 @@ static int _bd_read(BLURAY *bd, unsigned char *buf, int len)
                     }
                 }
             }
-            if (st->clip == NULL) {
-                // We previously reached the last clip.  Nothing
-                // else to read.
-                _queue_event(bd, BD_EVENT_END_OF_TITLE, 0);
-                bd->end_of_playlist |= 1;
-                return 0;
-            }
             if (st->int_buf_off == 6144 || clip_pkt >= st->clip->end_pkt) {
 
                 // Do we need to get the next clip?
@@ -2290,12 +2288,7 @@ static int _open_playlist(BLURAY *bd, const char *f_name, unsigned angle)
 
     bd_psr_write(bd->regs, PSR_PLAYLIST, atoi(bd->title->name));
     bd_psr_write(bd->regs, PSR_ANGLE_NUMBER, bd->title->angle + 1);
-
-    if (_is_interactive_title(bd)) {
-        bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
-    } else {
-        bd_psr_write(bd->regs, PSR_CHAPTER, 1);
-    }
+    bd_psr_write(bd->regs, PSR_CHAPTER, 0xffff);
 
     // Get the initial clip of the playlist
     bd->st0.clip = nav_next_clip(bd->title, NULL);
@@ -2539,6 +2532,9 @@ uint32_t bd_get_titles(BLURAY *bd, uint8_t flags, uint32_t min_title_length)
 
 int bd_get_main_title(BLURAY *bd)
 {
+    if (!bd) {
+        return -1;
+    }
     if (bd->title_type != title_undef) {
         BD_DEBUG(DBG_CRIT | DBG_BLURAY, "bd_get_main_title() can't be used with BluRay menus\n");
     }
@@ -2745,7 +2741,7 @@ int bd_set_player_setting(BLURAY *bd, uint32_t idx, uint32_t value)
     for (i = 0; i < sizeof(map) / sizeof(map[0]); i++) {
         if (idx == map[i].idx) {
             bd_mutex_lock(&bd->mutex);
-            result = !bd_psr_setting_write(bd->regs, idx, value);
+            result = !bd_psr_setting_write(bd->regs, map[i].psr, value);
             bd_mutex_unlock(&bd->mutex);
             return result;
         }
@@ -2862,6 +2858,14 @@ void bd_stop_bdj(BLURAY *bd)
  * Navigation mode interface
  */
 
+static void _set_scr(BLURAY *bd, int64_t pts)
+{
+    if (pts >= 0) {
+        uint32_t tick = (uint32_t)(((uint64_t)pts) >> 1);
+        _update_time_psr(bd, tick);
+    }
+}
+
 static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
 {
     /* PSR restore events are handled internally.
@@ -2889,7 +2893,7 @@ static void _process_psr_restore_event(BLURAY *bd, BD_PSR_EVENT *ev)
             bd_seek_playitem(bd, ev->new_val);
             return;
         case PSR_TIME:
-            bd_seek_time(bd, ((int64_t)ev->new_val) << 1);
+            _clip_seek_time(bd, ev->new_val);
             _init_ig_stream(bd);
             _run_gc(bd, GC_CTRL_INIT_MENU, 0);
             return;
@@ -2934,10 +2938,6 @@ static void _process_psr_write_event(BLURAY *bd, BD_PSR_EVENT *ev)
             _bdj_event  (bd, BDJ_EVENT_PLAYITEM,ev->new_val);
             _queue_event(bd, BD_EVENT_PLAYITEM, ev->new_val);
             break;
-        case PSR_CHAPTER:
-            _bdj_event  (bd, BDJ_EVENT_CHAPTER, ev->new_val);
-            _queue_event(bd, BD_EVENT_CHAPTER,  ev->new_val);
-            break;
         case PSR_TIME:
             _bdj_event  (bd, BDJ_EVENT_PTS,     ev->new_val);
             break;
@@ -2967,6 +2967,13 @@ static void _process_psr_change_event(BLURAY *bd, BD_PSR_EVENT *ev)
             disc_event(bd->disc, DISC_EVENT_TITLE, ev->new_val);
             break;
 
+        case PSR_CHAPTER:
+            _bdj_event  (bd, BDJ_EVENT_CHAPTER, ev->new_val);
+            if (ev->new_val != 0xffff) {
+                _queue_event(bd, BD_EVENT_CHAPTER,  ev->new_val);
+            }
+            break;
+
         /* stream selection */
 
         case PSR_IG_STREAM_ID:
@@ -3119,6 +3126,11 @@ static int _play_title(BLURAY *bd, unsigned title)
         return 0;
     }
 
+    if (bd->disc_info.no_menu_support) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_play(): no menu support\n");
+        return 0;
+    }
+
     /* first play object ? */
     if (title == BLURAY_TITLE_FIRST_PLAY) {
 
@@ -3208,7 +3220,7 @@ int bd_play(BLURAY *bd)
     }
 
     if (!bd->event_queue) {
-        _init_event_queue(bd);
+        bd->event_queue = event_queue_new(sizeof(BD_EVENT));
 
         bd_psr_lock(bd->regs);
         bd_psr_register_cb(bd->regs, _process_psr_event, bd);
@@ -3260,9 +3272,7 @@ int bd_play_title(BLURAY *bd, unsigned title)
 
 static int _try_menu_call(BLURAY *bd, int64_t pts)
 {
-    if (pts >= 0) {
-        bd_psr_write(bd->regs, PSR_TIME, (uint32_t)(((uint64_t)pts) >> 1));
-    }
+    _set_scr(bd, pts);
 
     if (bd->title_type == title_undef) {
         BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_menu_call(): bd_play() not called\n");
@@ -3474,7 +3484,7 @@ int bd_read_ext(BLURAY *bd, unsigned char *buf, int len, BD_EVENT *event)
 int bd_get_event(BLURAY *bd, BD_EVENT *event)
 {
     if (!bd->event_queue) {
-        _init_event_queue(bd);
+        bd->event_queue = event_queue_new(sizeof(BD_EVENT));
 
         bd_psr_register_cb(bd->regs, _process_psr_event, bd);
         _queue_initial_psr_events(bd);
@@ -3491,13 +3501,6 @@ int bd_get_event(BLURAY *bd, BD_EVENT *event)
  * user interaction
  */
 
-static void _set_scr(BLURAY *bd, int64_t pts)
-{
-    if (pts >= 0) {
-        bd_psr_write(bd->regs, PSR_TIME, (uint32_t)(((uint64_t)pts) >> 1));
-    }
-}
-
 void bd_set_scr(BLURAY *bd, int64_t pts)
 {
     bd_mutex_lock(&bd->mutex);
diff --git a/src/libbluray/bluray.h b/src/libbluray/bluray.h
index ae9f412..cbf16fc 100644
--- a/src/libbluray/bluray.h
+++ b/src/libbluray/bluray.h
@@ -92,6 +92,7 @@ typedef struct {
     /* Disc ID */
     uint8_t  disc_id[20];
 
+    /* BD-J */
     uint8_t  bdj_detected;     /* 1 if disc uses BD-J */
     uint8_t  bdj_supported;    /* 1 if BD-J support was compiled in */
     uint8_t  libjvm_detected;  /* 1 if usable Java VM was found */
@@ -119,6 +120,9 @@ typedef struct {
     char bdj_disc_id[33];    /* (BD-J) disc ID */
 
     const char *udf_volume_id; /* optional UDF volume identifier */
+
+    uint8_t no_menu_support;   /* 1 if this disc can't be played using on-disc menus */
+
 } BLURAY_DISC_INFO;
 
 /*
@@ -204,6 +208,11 @@ typedef enum {
     BLURAY_STILL_INFINITE = 0x02,
 } bd_still_mode_e;
 
+typedef enum {
+    BLURAY_MARK_ENTRY     = 0x01,  /* entry mark for chapter search */
+    BLURAY_MARK_LINK      = 0x02,  /* link point */
+} bd_mark_type_e;
+
 typedef struct bd_stream_info {
     uint8_t     coding_type;
     uint8_t     format;
@@ -232,25 +241,25 @@ typedef struct bd_clip {
     BLURAY_STREAM_INFO *sec_audio_streams;
     BLURAY_STREAM_INFO *sec_video_streams;
 
-    uint64_t           start_time;
-    uint64_t           in_time;
-    uint64_t           out_time;
+    uint64_t           start_time;  /* start media time, 90kHz, ("playlist time") */
+    uint64_t           in_time;     /* start timestamp, 90kHz */
+    uint64_t           out_time;    /* end timestamp, 90kHz */
 } BLURAY_CLIP_INFO;
 
 typedef struct bd_chapter {
     uint32_t    idx;
-    uint64_t    start;
-    uint64_t    duration;
-    uint64_t    offset;
+    uint64_t    start;     /* start media time, 90kHz, ("playlist time") */
+    uint64_t    duration;  /* duration */
+    uint64_t    offset;    /* distance from title start, bytes */
     unsigned    clip_ref;
 } BLURAY_TITLE_CHAPTER;
 
 typedef struct bd_mark {
     uint32_t    idx;
-    int         type;
-    uint64_t    start;
-    uint64_t    duration;
-    uint64_t    offset;
+    int         type;      /* bd_mark_type_e */
+    uint64_t    start;     /* mark media time, 90kHz, ("playlist time") */
+    uint64_t    duration;  /* time to next mark */
+    uint64_t    offset;    /* mark distance from title start, bytes */
     unsigned    clip_ref;
 } BLURAY_TITLE_MARK;
 
@@ -332,6 +341,22 @@ int bd_open_stream(BLURAY *bd,
                    int (*read_blocks)(void *handle, void *buf, int lba, int num_blocks));
 
 /**
+ *  Open BluRay disc
+ *
+ * @param bd  BLURAY object
+ * @param handle  opaque handle for open_dir and open_file
+ * @param open_dir  function used to open a directory
+ * @param open_file  function used to open a file
+ * @return 1 on success, 0 if error
+ */
+struct bd_dir_s;
+struct bd_file_s;
+int bd_open_files(BLURAY *bd,
+                  void *handle,
+                  struct bd_dir_s *(*open_dir)(void *handle, const char *rel_path),
+                  struct bd_file_s *(*open_file)(void *handle, const char *rel_path));
+
+/**
  *  Close BluRay disc
  *
  * @param bd  BLURAY object
@@ -733,7 +758,8 @@ typedef enum {
      * status
      */
 
-    /* Nothing to do. Playlist is not playing, but title applet is running. */
+    /* Nothing to do. Playlist is not playing, but title applet is running.
+     * Application should not call bd_read*() immediately again to avoid busy loop. */
     BD_EVENT_IDLE                   = 29,
 
     /* Pop-Up menu available */
diff --git a/src/libbluray/decoders/graphics_controller.c b/src/libbluray/decoders/graphics_controller.c
index dabde1c..98f3239 100644
--- a/src/libbluray/decoders/graphics_controller.c
+++ b/src/libbluray/decoders/graphics_controller.c
@@ -361,6 +361,10 @@ static int _save_page_state(GRAPHICS_CONTROLLER *gc)
         GC_TRACE("_save_page_state(): no bog data !\n");
         return -1;
     }
+    if (!gc->igs || !gc->igs->ics) {
+        GC_TRACE("_save_page_state(): no IG composition\n");
+        return -1;
+    }
 
     PG_DISPLAY_SET *s       = gc->igs;
     BD_IG_PAGE     *page    = NULL;
@@ -825,6 +829,8 @@ void gc_free(GRAPHICS_CONTROLLER **p)
 
         bd_mutex_destroy(&gc->mutex);
 
+        X_FREE(gc->saved_bog_data);
+
         X_FREE(*p);
     }
 }
diff --git a/src/libbluray/decoders/graphics_processor.h b/src/libbluray/decoders/graphics_processor.h
index f1d7690..643483a 100644
--- a/src/libbluray/decoders/graphics_processor.h
+++ b/src/libbluray/decoders/graphics_processor.h
@@ -29,7 +29,6 @@
 #include <stdint.h>
 
 typedef struct graphics_processor_s GRAPHICS_PROCESSOR;
-struct pes_buffer_s;
 
 /*
  * PG_DISPLAY_SET
diff --git a/src/libbluray/decoders/m2ts_demux.c b/src/libbluray/decoders/m2ts_demux.c
index a05fc95..9d166df 100644
--- a/src/libbluray/decoders/m2ts_demux.c
+++ b/src/libbluray/decoders/m2ts_demux.c
@@ -44,6 +44,32 @@ struct m2ts_demux_s
     PES_BUFFER *buf;
 };
 
+/*
+ *
+ */
+
+static PES_BUFFER *_flush(M2TS_DEMUX *p)
+{
+    PES_BUFFER *result = NULL;
+
+    result = p->buf;
+    p->buf = NULL;
+
+    return result;
+}
+
+void m2ts_demux_reset(M2TS_DEMUX *p)
+{
+    if (p) {
+        PES_BUFFER *buf = _flush(p);
+        pes_buffer_free(&buf);
+    }
+}
+
+/*
+ *
+ */
+
 M2TS_DEMUX *m2ts_demux_init(uint16_t pid)
 {
     M2TS_DEMUX *p = calloc(1, sizeof(*p));
@@ -58,11 +84,50 @@ M2TS_DEMUX *m2ts_demux_init(uint16_t pid)
 void m2ts_demux_free(M2TS_DEMUX **p)
 {
     if (p && *p) {
-        pes_buffer_free(&(*p)->buf);
+        m2ts_demux_reset(*p);
         X_FREE(*p);
     }
 }
 
+/*
+ *
+ */
+
+static int _realloc(PES_BUFFER *p, size_t size)
+{
+    uint8_t *tmp = realloc(p->buf, size);
+
+    if (!tmp) {
+        BD_DEBUG(DBG_DECODE | DBG_CRIT, "out of memory\n");
+        return -1;
+    }
+
+    p->size = size;
+    p->buf = tmp;
+
+    return 0;
+}
+
+static int _add_ts(PES_BUFFER *p, uint8_t *buf, unsigned len)
+{
+    // realloc
+    if (p->size < p->len + len) {
+        if (_realloc(p, p->size * 2) < 0) {
+            return -1;
+        }
+    }
+
+    // append
+    memcpy(p->buf + p->len, buf, len);
+    p->len += len;
+
+    return 0;
+}
+
+/*
+ * Parsing
+ */
+
 static int64_t _parse_timestamp(uint8_t *p)
 {
     int64_t ts;
@@ -74,96 +139,72 @@ static int64_t _parse_timestamp(uint8_t *p)
     return ts;
 }
 
-/*
- * _add_ts()
- * - add ts payload to buffer.
- * - parse PES header if pusi is set.
- * - return:
- *   < 0   error (incorrect PES header)
- *   = 0   PES packet continue
- *   > 0   PES packet payload length from PES header
- */
-static int _add_ts(PES_BUFFER *p, unsigned pusi, uint8_t *buf, unsigned len)
+static int _parse_pes(PES_BUFFER *p, uint8_t *buf, unsigned len)
 {
-    unsigned result = 0;
+    int result = 0;
+
+    if (len < 6) {
+        BD_DEBUG(DBG_DECODE, "invalid BDAV TS (PES header not in single TS packet)\n");
+        return -1;
+    }
+    if (buf[0] || buf[1] || buf[2] != 1) {
+        BD_DEBUG(DBG_DECODE, "invalid PES header (00 00 01)");
+        return -1;
+    }
+
+    // Parse PES header
+    unsigned pes_pid    = buf[3];
+    unsigned pes_length = buf[4] << 8 | buf[5];
+    unsigned hdr_len    = 6;
 
-    if (pusi) {
+    if (pes_pid != 0xbf) {
 
-        if (len < 6) {
+        if (len < 9) {
             BD_DEBUG(DBG_DECODE, "invalid BDAV TS (PES header not in single TS packet)\n");
             return -1;
         }
-        if (buf[0] || buf[1] || buf[2] != 1) {
-            BD_DEBUG(DBG_DECODE, "invalid PES header (00 00 01)");
-            return -1;
-        }
-
-        // Parse PES header
-        unsigned pes_pid    = buf[3];
-        unsigned pes_length = buf[4] << 8 | buf[5];
-        unsigned hdr_len    = 6;
-
-        if (pes_pid != 0xbf) {
-
-            if (len < 9) {
-                BD_DEBUG(DBG_DECODE, "invalid BDAV TS (PES header not in single TS packet)\n");
-                return -1;
-            }
-
-            unsigned pts_exists = buf[7] & 0x80;
-            unsigned dts_exists = buf[7] & 0x40;
-            hdr_len += buf[8] + 3;
 
-            if (len < hdr_len) {
-                BD_DEBUG(DBG_DECODE, "invalid BDAV TS (PES header not in single TS packet)\n");
-                return -1;
-            }
+        unsigned pts_exists = buf[7] & 0x80;
+        unsigned dts_exists = buf[7] & 0x40;
+        hdr_len += buf[8] + 3;
 
-            if (pts_exists) {
-                p->pts = _parse_timestamp(buf + 9);
-            }
-            if (dts_exists) {
-                p->dts = _parse_timestamp(buf + 14);
-            }
+        if (len < hdr_len) {
+            BD_DEBUG(DBG_DECODE, "invalid BDAV TS (PES header not in single TS packet)\n");
+            return -1;
         }
 
-        buf += hdr_len;
-        len -= hdr_len;
-
-        result = pes_length + 6 - hdr_len;
+        if (pts_exists) {
+            p->pts = _parse_timestamp(buf + 9);
+        }
+        if (dts_exists) {
+            p->dts = _parse_timestamp(buf + 14);
+        }
     }
 
-    // realloc
-    if (p->size < p->len + len) {
-        uint8_t *tmp;
-        p->size *= 2;
-        p->size = BD_MAX(p->size, BD_MAX(result, 0x100));
-        tmp     = realloc(p->buf, p->size);
-        if (!tmp) {
-            BD_DEBUG(DBG_DECODE | DBG_CRIT, "out of memory\n");
-            p->size = 0;
-            return -1;
-        }
-        p->buf = tmp;
+    result = pes_length + 6 - hdr_len;
+
+    if (_realloc(p, BD_MAX(result, 0x100)) < 0) {
+        return -1;
     }
 
-    // append
-    memcpy(p->buf + p->len, buf, len);
-    p->len += len;
+    p->len = len - hdr_len;
+    memcpy(p->buf, buf + hdr_len, p->len);
 
     return result;
 }
 
+
+/*
+ *
+ */
+
 PES_BUFFER *m2ts_demux(M2TS_DEMUX *p, uint8_t *buf)
 {
     uint8_t   *end = buf + 6144;
     PES_BUFFER *result = NULL;
 
     if (!buf) {
-        // flush
-        result = p->buf;
-        p->buf = NULL;
-        return result;
+        return _flush(p);
     }
 
     for (; buf < end; buf += 192) {
@@ -202,21 +243,27 @@ PES_BUFFER *m2ts_demux(M2TS_DEMUX *p, uint8_t *buf)
                 pes_buffer_free(&p->buf);
             }
             p->buf = pes_buffer_alloc();
-        }
-
-        if (!p->buf) {
-            BD_DEBUG(DBG_DECODE, "skipping packet (no pusi seen)\n");
-            continue;
-        }
-
-        int r = _add_ts(p->buf, pusi, buf + 4 + payload_offset, 188 - payload_offset);
-        if (r) {
+            if (!buf) {
+                continue;
+            }
+            int r = _parse_pes(p->buf, buf + 4 + payload_offset, 188 - payload_offset);
             if (r < 0) {
-                BD_DEBUG(DBG_DECODE, "skipping block (PES header error)\n");
                 pes_buffer_free(&p->buf);
                 continue;
             }
             p->pes_length = r;
+
+        } else {
+
+            if (!p->buf) {
+                BD_DEBUG(DBG_DECODE, "skipping packet (no pusi seen)\n");
+                continue;
+            }
+
+            if (_add_ts(p->buf, buf + 4 + payload_offset, 188 - payload_offset) < 0) {
+                pes_buffer_free(&p->buf);
+                continue;
+            }
         }
 
         if (p->buf->len == p->pes_length) {
diff --git a/src/libbluray/decoders/m2ts_demux.h b/src/libbluray/decoders/m2ts_demux.h
index 96f29fd..a344b59 100644
--- a/src/libbluray/decoders/m2ts_demux.h
+++ b/src/libbluray/decoders/m2ts_demux.h
@@ -34,6 +34,8 @@ typedef struct m2ts_demux_s M2TS_DEMUX;
 BD_PRIVATE M2TS_DEMUX *m2ts_demux_init(uint16_t pid);
 BD_PRIVATE void        m2ts_demux_free(M2TS_DEMUX **);
 
+BD_PRIVATE void m2ts_demux_reset(M2TS_DEMUX *);
+
 /*
  *   Demux aligned unit (mpeg-ts + pes).
  *   input:  aligned unit (6144 bytes). NULL to flush demuxer buffer.
diff --git a/src/libbluray/disc/aacs.c b/src/libbluray/disc/aacs.c
index 3059d66..e44b5a7 100644
--- a/src/libbluray/disc/aacs.c
+++ b/src/libbluray/disc/aacs.c
@@ -41,12 +41,9 @@ struct bd_aacs {
 
     /* function pointers */
     fptr_int       decrypt_unit;
+    fptr_int       decrypt_bus;
 
-    fptr_p_void    get_vid;
-    fptr_p_void    get_pmsn;
-    fptr_p_void    get_device_binding_id;
-    fptr_p_void    get_device_nonce;
-    fptr_p_void    get_media_key;
+    int            impl_id;
 };
 
 
@@ -58,15 +55,19 @@ static void _libaacs_close(BD_AACS *p)
     }
 }
 
-void libaacs_unload(BD_AACS **p)
+static void _unload(BD_AACS *p)
 {
-    if (p && *p) {
-        _libaacs_close(*p);
+    _libaacs_close(p);
 
-        if ((*p)->h_libaacs) {
-            dl_dlclose((*p)->h_libaacs);
-        }
+    if (p->h_libaacs) {
+        dl_dlclose(p->h_libaacs);
+    }
+}
 
+void libaacs_unload(BD_AACS **p)
+{
+    if (p && *p) {
+        _unload(*p);
         X_FREE(*p);
     }
 }
@@ -82,7 +83,11 @@ int libaacs_required(void *have_file_handle, int (*have_file)(void *, const char
     return 0;
 }
 
-static void *_open_libaacs(void)
+#define IMPL_USER       0
+#define IMPL_LIBAACS    1
+#define IMPL_LIBMMBD    2
+
+static void *_open_libaacs(int *impl_id)
 {
     const char * const libaacs[] = {
       getenv("LIBAACS_PATH"),
@@ -91,10 +96,11 @@ static void *_open_libaacs(void)
     };
     unsigned ii;
 
-    for (ii = 0; ii < sizeof(libaacs) / sizeof(libaacs[0]); ii++) {
+    for (ii = *impl_id; ii < sizeof(libaacs) / sizeof(libaacs[0]); ii++) {
         if (libaacs[ii]) {
             void *handle = dl_dlopen(libaacs[ii], "0");
             if (handle) {
+                *impl_id = ii;
                 BD_DEBUG(DBG_BLURAY, "Using %s for AACS\n", libaacs[ii]);
                 return handle;
             }
@@ -105,14 +111,15 @@ static void *_open_libaacs(void)
     return NULL;
 }
 
-BD_AACS *libaacs_load(void)
+static BD_AACS *_load(int impl_id)
 {
     BD_AACS *p = calloc(1, sizeof(BD_AACS));
     if (!p) {
         return NULL;
     }
+    p->impl_id = impl_id;
 
-    p->h_libaacs = _open_libaacs();
+    p->h_libaacs = _open_libaacs(&p->impl_id);
     if (!p->h_libaacs) {
         X_FREE(p);
         return NULL;
@@ -121,11 +128,7 @@ BD_AACS *libaacs_load(void)
     BD_DEBUG(DBG_BLURAY, "Loading aacs library (%p)\n", p->h_libaacs);
 
     *(void **)(&p->decrypt_unit) = dl_dlsym(p->h_libaacs, "aacs_decrypt_unit");
-    *(void **)(&p->get_vid)      = dl_dlsym(p->h_libaacs, "aacs_get_vid");
-    *(void **)(&p->get_pmsn)     = dl_dlsym(p->h_libaacs, "aacs_get_pmsn");
-    *(void **)(&p->get_device_binding_id) = dl_dlsym(p->h_libaacs, "aacs_get_device_binding_id");
-    *(void **)(&p->get_device_nonce)      = dl_dlsym(p->h_libaacs, "aacs_get_device_nonce");
-    *(void **)(&p->get_media_key)         = dl_dlsym(p->h_libaacs, "aacs_get_mk");
+    *(void **)(&p->decrypt_bus)  = dl_dlsym(p->h_libaacs, "aacs_decrypt_bus");
 
     if (!p->decrypt_unit) {
         BD_DEBUG(DBG_BLURAY | DBG_CRIT, "libaacs dlsym failed! (%p)\n", p->h_libaacs);
@@ -143,6 +146,11 @@ BD_AACS *libaacs_load(void)
     return p;
 }
 
+BD_AACS *libaacs_load(int force_mmbd)
+{
+    return _load(force_mmbd ? IMPL_LIBMMBD : 0);
+}
+
 int libaacs_open(BD_AACS *p, const char *device,
                    void *file_open_handle, void *file_open_fp,
                    const char *keyfile_path)
@@ -180,6 +188,22 @@ int libaacs_open(BD_AACS *p, const char *device,
         BD_DEBUG(DBG_BLURAY, "aacs_open() not found\n");
     }
 
+    if (error_code) {
+        /* failed. try next aacs implementation if available. */
+        BD_AACS *p2 = _load(p->impl_id + 1);
+        if (p2) {
+            if (!libaacs_open(p2, device, file_open_handle, file_open_fp, keyfile_path)) {
+                /* succeed - swap implementations */
+                _unload(p);
+                *p = *p2;
+                X_FREE(p2);
+                return 0;
+            }
+            /* failed - report original errors */
+            libaacs_unload(&p2);
+        }
+    }
+
     if (p->aacs) {
         if (aacs_get_mkb_version) {
             p->mkbv = aacs_get_mkb_version(p->aacs);
@@ -217,63 +241,55 @@ int libaacs_decrypt_unit(BD_AACS *p, uint8_t *buf)
     return 0;
 }
 
-/*
- *
- */
-
-static const uint8_t *_get_vid(BD_AACS *p)
+int libaacs_decrypt_bus(BD_AACS *p, uint8_t *buf)
 {
-    if (!p->get_vid) {
-        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_vid() dlsym failed!\n");
-        return NULL;
+    if (p && p->aacs && p->decrypt_bus) {
+        if (p->decrypt_bus(p->aacs, buf) > 0) {
+            return 0;
+        }
     }
 
-    return (const uint8_t*)p->get_vid(p->aacs);
+    BD_DEBUG(DBG_AACS | DBG_CRIT, "Unable to BUS decrypt unit (AACS)!\n");
+    return -1;
 }
 
-static const uint8_t *_get_pmsn(BD_AACS *p)
-{
-    if (!p->get_pmsn) {
-        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_pmsn() dlsym failed!\n");
-        return NULL;
-    }
+/*
+ *
+ */
 
-    return (const uint8_t*)p->get_pmsn(p->aacs);
+uint32_t libaacs_get_mkbv(BD_AACS *p)
+{
+    return p ? p->mkbv : 0;
 }
 
-static const uint8_t *_get_device_binding_id(BD_AACS *p)
+int libaacs_get_bec_enabled(BD_AACS *p)
 {
-    if (!p->get_device_binding_id) {
-        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_device_binding_id() dlsym failed!\n");
-        return NULL;
-    }
+    fptr_int get_bec;
 
-    return (const uint8_t*)p->get_device_binding_id(p->aacs);
-}
+    if (!p || !p->h_libaacs) {
+        return 0;
+    }
 
-static const uint8_t *_get_device_nonce(BD_AACS *p)
-{
-    if (!p->get_device_nonce) {
-        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_device_nonce() dlsym failed!\n");
-        return NULL;
+    *(void **)(&get_bec) = dl_dlsym(p->h_libaacs, "aacs_get_bus_encryption");
+    if (!get_bec) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_bus_encryption() dlsym failed!\n");
+        return 0;
     }
 
-    return (const uint8_t*)p->get_device_nonce(p->aacs);
+    return get_bec(p->aacs) == 3;
 }
 
-static const uint8_t *_get_media_key(BD_AACS *p)
+static const uint8_t *_get_data(BD_AACS *p, const char *func)
 {
-    if (!p->get_media_key) {
-        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_get_mk() dlsym failed!\n");
+    fptr_p_void fp;
+
+    *(void **)(&fp) = dl_dlsym(p->h_libaacs, func);
+    if (!fp) {
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "%s() dlsym failed!\n", func);
         return NULL;
     }
 
-    return (const uint8_t*)p->get_media_key(p->aacs);
-}
-
-uint32_t libaacs_get_mkbv(BD_AACS *p)
-{
-    return p ? p->mkbv : 0;
+    return (const uint8_t*)fp(p->aacs);
 }
 
 static const char *_type2str(int type)
@@ -285,6 +301,8 @@ static const char *_type2str(int type)
     case BD_AACS_DEVICE_BINDING_ID:  return "DEVICE_BINDING_ID";
     case BD_AACS_DEVICE_NONCE:       return "DEVICE_NONCE";
     case BD_AACS_MEDIA_KEY:          return "MEDIA_KEY";
+    case BD_AACS_CONTENT_CERT_ID:    return "CONTENT_CERT_ID";
+    case BD_AACS_BDJ_ROOT_CERT_HASH: return "BDJ_ROOT_CERT_HASH";
     default: return "???";
     }
 }
@@ -301,19 +319,25 @@ BD_PRIVATE const uint8_t *libaacs_get_aacs_data(BD_AACS *p, int type)
             return p->disc_id;
 
         case BD_AACS_MEDIA_VID:
-            return _get_vid(p);
+            return _get_data(p, "aacs_get_vid");
 
         case BD_AACS_MEDIA_PMSN:
-            return _get_pmsn(p);
+            return _get_data(p, "aacs_get_pmsn");
 
         case BD_AACS_DEVICE_BINDING_ID:
-            return _get_device_binding_id(p);
+            return _get_data(p, "aacs_get_device_binding_id");
 
         case BD_AACS_DEVICE_NONCE:
-            return _get_device_nonce(p);
+            return _get_data(p, "aacs_get_device_nonce");
 
         case BD_AACS_MEDIA_KEY:
-            return _get_media_key(p);
+            return _get_data(p, "aacs_get_mk");
+
+        case BD_AACS_CONTENT_CERT_ID:
+            return _get_data(p, "aacs_get_content_cert_id");
+
+        case BD_AACS_BDJ_ROOT_CERT_HASH:
+            return _get_data(p, "aacs_get_bdj_root_cert_hash");
     }
 
     BD_DEBUG(DBG_BLURAY | DBG_CRIT, "get_aacs_data(): unknown query %d\n", type);
diff --git a/src/libbluray/disc/aacs.h b/src/libbluray/disc/aacs.h
index 856bf87..58dd6c6 100644
--- a/src/libbluray/disc/aacs.h
+++ b/src/libbluray/disc/aacs.h
@@ -28,7 +28,7 @@
 typedef struct bd_aacs BD_AACS;
 
 BD_PRIVATE int  libaacs_required(void *h, int (*have_file)(void *, const char *, const char *));
-BD_PRIVATE BD_AACS *libaacs_load(void);
+BD_PRIVATE BD_AACS *libaacs_load(int force_mmbd);
 BD_PRIVATE int  libaacs_open(BD_AACS *p, const char *device,
                              void *file_open_handle, void *file_open_fp,
                              const char *keyfile_path);
@@ -36,8 +36,10 @@ BD_PRIVATE void libaacs_unload(BD_AACS **p);
 
 BD_PRIVATE void libaacs_select_title(BD_AACS *p, uint32_t title);
 BD_PRIVATE int  libaacs_decrypt_unit(BD_AACS *p, uint8_t *buf);
+BD_PRIVATE int  libaacs_decrypt_bus(BD_AACS *p, uint8_t *buf);
 
 BD_PRIVATE uint32_t libaacs_get_mkbv(BD_AACS *p);
+BD_PRIVATE int      libaacs_get_bec_enabled(BD_AACS *p);
 
 #define BD_AACS_DISC_ID            1
 #define BD_AACS_MEDIA_VID          2
@@ -45,6 +47,8 @@ BD_PRIVATE uint32_t libaacs_get_mkbv(BD_AACS *p);
 #define BD_AACS_DEVICE_BINDING_ID  4
 #define BD_AACS_DEVICE_NONCE       5
 #define BD_AACS_MEDIA_KEY          6
+#define BD_AACS_CONTENT_CERT_ID    7
+#define BD_AACS_BDJ_ROOT_CERT_HASH 8
 
 BD_PRIVATE const uint8_t *libaacs_get_aacs_data(BD_AACS *p, int type);
 
diff --git a/src/libbluray/disc/bdplus.c b/src/libbluray/disc/bdplus.c
index 363719f..44fee89 100644
--- a/src/libbluray/disc/bdplus.c
+++ b/src/libbluray/disc/bdplus.c
@@ -46,6 +46,8 @@ struct bd_bdplus {
 
     /* old API */
     fptr_p_void    title;
+
+    int impl_id;
 };
 
 
@@ -57,15 +59,19 @@ static void _libbdplus_close(BD_BDPLUS *p)
     }
 }
 
-void libbdplus_unload(BD_BDPLUS **p)
+static void _unload(BD_BDPLUS *p)
 {
-    if (p && *p) {
-        _libbdplus_close(*p);
+    _libbdplus_close(p);
 
-        if ((*p)->h_libbdplus) {
-            dl_dlclose((*p)->h_libbdplus);
-        }
+    if (p->h_libbdplus) {
+        dl_dlclose(p->h_libbdplus);
+    }
+}
 
+void libbdplus_unload(BD_BDPLUS **p)
+{
+    if (p && *p) {
+        _unload(*p);
         X_FREE(*p);
     }
 }
@@ -81,7 +87,11 @@ int libbdplus_required(void *have_file_handle, int (*have_file)(void *, const ch
     return 0;
 }
 
-static void *_libbdplus_open(void)
+#define IMPL_USER       0
+#define IMPL_LIBBDPLUS  1
+#define IMPL_LIBMMBD    2
+
+static void *_libbdplus_open(int *impl_id)
 {
     const char * const libbdplus[] = {
       getenv("LIBBDPLUS_PATH"),
@@ -90,10 +100,11 @@ static void *_libbdplus_open(void)
     };
     unsigned ii;
 
-    for (ii = 0; ii < sizeof(libbdplus) / sizeof(libbdplus[0]); ii++) {
+    for (ii = *impl_id; ii < sizeof(libbdplus) / sizeof(libbdplus[0]); ii++) {
         if (libbdplus[ii]) {
             void *handle = dl_dlopen(libbdplus[ii], "0");
             if (handle) {
+                *impl_id = ii;
                 BD_DEBUG(DBG_BLURAY, "Using %s for BD+\n", libbdplus[ii]);
                 return handle;
             }
@@ -104,16 +115,22 @@ static void *_libbdplus_open(void)
     return NULL;
 }
 
-BD_BDPLUS *libbdplus_load(void)
+int libbdplus_is_mmbd(BD_BDPLUS *p)
+{
+    return p && (p->impl_id == IMPL_LIBMMBD);
+}
+
+static BD_BDPLUS *_load(int impl_id)
 {
     BD_BDPLUS *p = calloc(1, sizeof(BD_BDPLUS));
     if (!p) {
         return NULL;
     }
+    p->impl_id = impl_id;
 
     BD_DEBUG(DBG_BDPLUS, "attempting to load libbdplus\n");
 
-    p->h_libbdplus = _libbdplus_open();
+    p->h_libbdplus = _libbdplus_open(&p->impl_id);
     if (!p->h_libbdplus) {
         X_FREE(p);
         return NULL;
@@ -144,6 +161,11 @@ BD_BDPLUS *libbdplus_load(void)
     return p;
 }
 
+BD_BDPLUS *libbdplus_load()
+{
+    return _load(0);
+}
+
 int libbdplus_init(BD_BDPLUS *p, const char *root,
                    void *file_open_handle, void *file_open_fp,
                    const uint8_t *vid, const uint8_t *mk)
@@ -153,6 +175,28 @@ int libbdplus_init(BD_BDPLUS *p, const char *root,
 
     _libbdplus_close(p);
 
+    /* force libmmbd BD+ if no AACS media key:
+     * - libbdplus requires media key
+     * - libmmbd does not export media key
+     *   (=> libbdplus won't work with libmmbd AACS)
+     */
+    if (mk == NULL && p->impl_id == IMPL_LIBBDPLUS) {
+        BD_BDPLUS *p2 = _load(IMPL_LIBMMBD);
+        if (p2) {
+            if (!libbdplus_init(p2, root, file_open_handle, file_open_fp, vid, mk)) {
+                /* succeed - swap implementations */
+                _unload(p);
+                *p = *p2;
+                X_FREE(p2);
+                return 0;
+            }
+            /* failed - continue with original bd+ implementation */
+            libbdplus_unload(&p2);
+        }
+    }
+
+    /* */
+
     *(void **)(&bdplus_init) = dl_dlsym(p->h_libbdplus, "bdplus_init");
     *(void **)(&set_fopen)   = dl_dlsym(p->h_libbdplus, "bdplus_set_fopen");
 
diff --git a/src/libbluray/disc/bdplus.h b/src/libbluray/disc/bdplus.h
index 7e1382d..6589d88 100644
--- a/src/libbluray/disc/bdplus.h
+++ b/src/libbluray/disc/bdplus.h
@@ -29,6 +29,7 @@ typedef struct bd_bdplus BD_BDPLUS;
 
 BD_PRIVATE int  libbdplus_required(void *have_file_handle, int (*have_file)(void *, const char *, const char *));
 BD_PRIVATE BD_BDPLUS *libbdplus_load(void);
+BD_PRIVATE int  libbdplus_is_mmbd(BD_BDPLUS *);
 BD_PRIVATE int  libbdplus_init(BD_BDPLUS *p, const char *root,
                                void *open_file_handle, void *open_file_fp,
                                const uint8_t *vid, const uint8_t *mk);
diff --git a/src/libbluray/disc/dec.c b/src/libbluray/disc/dec.c
index 290dd4d..ebe2c39 100644
--- a/src/libbluray/disc/dec.c
+++ b/src/libbluray/disc/dec.c
@@ -179,18 +179,7 @@ static int _libaacs_init(BD_DEC *dec, struct dec_dev *dev,
     int result;
     const uint8_t *disc_id;
 
-    libaacs_unload(&dec->aacs);
-
-    i->aacs_detected = libaacs_required((void*)dev, _bdrom_have_file);
-    if (!i->aacs_detected) {
-        /* no AACS */
-        return 1; /* no error if libaacs is not needed */
-    }
-
-    dec->aacs = libaacs_load();
-    i->libaacs_detected = !!dec->aacs;
     if (!dec->aacs) {
-        /* no libaacs */
         return 0;
     }
 
@@ -205,7 +194,7 @@ static int _libaacs_init(BD_DEC *dec, struct dec_dev *dev,
     }
 
     if (result) {
-        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_open() failed!\n");
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "aacs_open() failed: %d!\n", result);
         libaacs_unload(&dec->aacs);
         return 0;
     }
@@ -218,15 +207,6 @@ static int _libbdplus_init(BD_DEC *dec, struct dec_dev *dev,
                            BD_ENC_INFO *i,
                            void *regs, void *psr_read, void *psr_write)
 {
-    libbdplus_unload(&dec->bdplus);
-
-    i->bdplus_detected = libbdplus_required((void*)dev, _bdrom_have_file);
-    if (!i->bdplus_detected) {
-        return 0;
-    }
-
-    dec->bdplus = libbdplus_load();
-    i->libbdplus_detected = !!dec->bdplus;
     if (!dec->bdplus) {
         return 0;
     }
@@ -259,9 +239,47 @@ static int _libbdplus_init(BD_DEC *dec, struct dec_dev *dev,
     i->bdplus_gen     = libbdplus_get_gen(dec->bdplus);
     i->bdplus_date    = libbdplus_get_date(dec->bdplus);
     i->bdplus_handled = 1;
+
+    if (i->bdplus_date == 0) {
+        // libmmbd -> no menu support
+        BD_DEBUG(DBG_BLURAY | DBG_CRIT, "WARNING: using libmmbd for BD+. On-disc menus will not work.\n");
+        i->no_menu_support = 1;
+    }
+
     return 1;
 }
 
+static int _dec_detect(struct dec_dev *dev, BD_ENC_INFO *i)
+{
+    /* Check for AACS */
+    i->aacs_detected = libaacs_required((void*)dev, _bdrom_have_file);
+    if (!i->aacs_detected) {
+        /* No AACS (=> no BD+) */
+        return 0;
+    }
+
+    /* check for BD+ */
+    i->bdplus_detected = libbdplus_required((void*)dev, _bdrom_have_file);
+    return 1;
+}
+
+static void _dec_load(BD_DEC *dec, BD_ENC_INFO *i)
+{
+    int force_mmbd_aacs = 0;
+
+    if (i->bdplus_detected) {
+        /* load BD+ library and check BD+ library type. libmmbd doesn't work with libaacs */
+        dec->bdplus = libbdplus_load();
+        force_mmbd_aacs = dec->bdplus && libbdplus_is_mmbd(dec->bdplus);
+    }
+
+    /* load AACS library */
+    dec->aacs = libaacs_load(force_mmbd_aacs);
+
+    i->libaacs_detected   = !!dec->aacs;
+    i->libbdplus_detected = !!dec->bdplus;
+}
+
 /*
  *
  */
@@ -270,16 +288,38 @@ BD_DEC *dec_init(struct dec_dev *dev, BD_ENC_INFO *enc_info,
                  const char *keyfile_path,
                  void *regs, void *psr_read, void *psr_write)
 {
-    BD_DEC *dec = calloc(1, sizeof(BD_DEC));
-    if (dec) {
-        memset(enc_info, 0, sizeof(*enc_info));
-        _libaacs_init(dec, dev, enc_info, keyfile_path);
+    BD_DEC *dec = NULL;
+
+    memset(enc_info, 0, sizeof(*enc_info));
+
+    /* detect AACS/BD+ */
+    if (!_dec_detect(dev, enc_info)) {
+        return NULL;
+    }
+
+    dec = calloc(1, sizeof(BD_DEC));
+    if (!dec) {
+        return NULL;
+    }
+
+    /* load compatible libraries */
+    _dec_load(dec, enc_info);
+
+    /* init decoding libraries */
+    /* BD+ won't help unless AACS works ... */
+    if (_libaacs_init(dec, dev, enc_info, keyfile_path)) {
         _libbdplus_init(dec, dev, enc_info, regs, psr_read, psr_write);
+    }
 
-        if (!enc_info->bdplus_handled && !enc_info->aacs_handled) {
-            X_FREE(dec);
-        }
+    if (!enc_info->aacs_handled) {
+        /* AACS failed, clean up */
+        dec_close(&dec);
     }
+
+    /* BD+ failure may be non-fatal (not all titles in disc use BD+).
+     * Keep working AACS decoder even if BD+ init failed
+     */
+
     return dec;
 }
 
diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c
index 8f275b8..defa084 100644
--- a/src/libbluray/disc/disc.c
+++ b/src/libbluray/disc/disc.c
@@ -177,7 +177,7 @@ static void _comb_dir_append(BD_DIR_H *dp, BD_DIRENT *entry)
     }
 
     /* append */
-    priv = realloc(priv, sizeof(*priv) + priv->count * sizeof(BD_DIRENT));
+    priv = realloc(dp->internal, sizeof(*priv) + priv->count * sizeof(BD_DIRENT));
     if (!priv) {
         return;
     }
@@ -249,8 +249,7 @@ static void _set_paths(BD_DISC *p, const char *device_path)
 }
 
 BD_DISC *disc_open(const char *device_path,
-                   void *read_blocks_handle,
-                   int (*read_blocks)(void *handle, void *buf, int lba, int num_blocks),
+                   fs_access *p_fs,
                    struct bd_enc_info *enc_info,
                    const char *keyfile_path,
                    void *regs, void *psr_read, void *psr_write)
@@ -258,13 +257,19 @@ BD_DISC *disc_open(const char *device_path,
     BD_DISC *p = _disc_init();
 
     if (p) {
+        if (p_fs && p_fs->open_dir) {
+            p->fs_handle          = p_fs->fs_handle;
+            p->pf_file_open_bdrom = p_fs->open_file;
+            p->pf_dir_open_bdrom  = p_fs->open_dir;
+        }
+
         _set_paths(p, device_path);
 
 #ifdef ENABLE_UDF
         /* check if disc root directory can be opened. If not, treat it as device/image file. */
         BD_DIR_H *dp_img = device_path ? dir_open(device_path) : NULL;
         if (!dp_img) {
-            void *udf = udf_image_open(device_path, read_blocks_handle, read_blocks);
+            void *udf = udf_image_open(device_path, p_fs ? p_fs->fs_handle : NULL, p_fs ? p_fs->read_blocks : NULL);
             if (!udf) {
                 BD_DEBUG(DBG_FILE | DBG_CRIT, "failed opening UDF image %s\n", device_path);
             } else {
@@ -282,9 +287,6 @@ BD_DISC *disc_open(const char *device_path,
             dir_close(dp_img);
             BD_DEBUG(DBG_FILE, "%s does not seem to be image file or device node\n", device_path);
         }
-#else
-        (void)read_blocks_handle;
-        (void)read_blocks;
 #endif
 
         struct dec_dev dev = { p->fs_handle, p->pf_file_open_bdrom, p, (file_openFp)disc_open_path, p->disc_root, device_path };
@@ -452,6 +454,11 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa
     BD_FILE_H *fp_out;
     int64_t    got;
 
+    if (rel_path[strlen(rel_path) - 1] == '/') {
+        file_mkdirs(cache_path);
+        return 0;
+    }
+
     /* input file from BD-ROM */
     fp_in = p->pf_file_open_bdrom(p->fs_handle, rel_path);
     if (!fp_in) {
@@ -470,20 +477,20 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa
         return -1;
     }
 
-    while (1) {
+    do {
         uint8_t buf[16*2048];
         got = file_read(fp_in, buf, sizeof(buf));
-        if (got <= 0) {
-            break;
-        }
-        if (fp_out->write(fp_out, buf, got) != got) {
+
+        /* we'll call write(fp, buf, 0) after EOF. It is used to check for errors. */
+        if (got < 0 || fp_out->write(fp_out, buf, got) != got) {
             BD_DEBUG(DBG_FILE | DBG_CRIT, "error caching file %s\n", rel_path);
             file_close(fp_out);
             file_close(fp_in);
             (void)file_unlink(cache_path);
             return -1;
         }
-    }
+    } while (got > 0);
+
     BD_DEBUG(DBG_FILE, "cached %s to %s\n", rel_path, cache_path);
 
     file_close(fp_out);
diff --git a/src/libbluray/disc/disc.h b/src/libbluray/disc/disc.h
index 8bbde7b..13f91d1 100644
--- a/src/libbluray/disc/disc.h
+++ b/src/libbluray/disc/disc.h
@@ -29,6 +29,18 @@ struct bd_file_s;
 struct bd_dir_s;
 struct bd_enc_info;
 
+/* application provided file system access (optional) */
+typedef struct fs_access {
+    void *fs_handle;
+
+    /* method 1: block (device) access */
+    int (*read_blocks)(void *fs_handle, void *buf, int lba, int num_blocks);
+
+    /* method 2: file access */
+    struct bd_dir_s  *(*open_dir) (void *fs_handle, const char *rel_path);
+    struct bd_file_s *(*open_file)(void *fs_handle, const char *rel_path);
+} fs_access;
+
 /*
  * BluRay Virtual File System
  *
@@ -38,8 +50,7 @@ struct bd_enc_info;
 typedef struct bd_disc BD_DISC;
 
 BD_PRIVATE BD_DISC *disc_open(const char *device_path,
-                              void *read_blocks_handle,
-                              int (*read_blocks)(void *handle, void *buf, int lba, int num_blocks),
+                              fs_access *p_fs,
                               struct bd_enc_info *enc_info,
                               const char *keyfile_path,
                               void *regs, void *psr_read, void *psr_write);
diff --git a/src/libbluray/disc/enc_info.h b/src/libbluray/disc/enc_info.h
index d45d891..47ca94f 100644
--- a/src/libbluray/disc/enc_info.h
+++ b/src/libbluray/disc/enc_info.h
@@ -34,6 +34,8 @@ typedef struct bd_enc_info {
     uint8_t  disc_id[20];
     uint8_t  bdplus_gen;
     uint32_t bdplus_date;
+
+    uint8_t  no_menu_support;
 } BD_ENC_INFO;
 
 #endif /* _BD_DISC_ENC_INFO_H_ */
diff --git a/src/libbluray/hdmv/hdmv_vm.c b/src/libbluray/hdmv/hdmv_vm.c
index 7c6ba37..617d521 100644
--- a/src/libbluray/hdmv/hdmv_vm.c
+++ b/src/libbluray/hdmv/hdmv_vm.c
@@ -1058,9 +1058,9 @@ static int _hdmv_step(HDMV_VM *p)
                         case INSN_PLAY_PL:      _play_at(p, dst,  -1,  -1); break;
                         case INSN_PLAY_PL_PI:   _play_at(p, dst, src,  -1); break;
                         case INSN_PLAY_PL_PM:   _play_at(p, dst,  -1, src); break;
-                        case INSN_TERMINATE_PL: _play_stop(p);              break;
                         case INSN_LINK_PI:      _play_at(p,  -1, dst,  -1); break;
                         case INSN_LINK_MK:      _play_at(p,  -1,  -1, dst); break;
+                        case INSN_TERMINATE_PL: if (!_play_stop(p)) { inc_pc = 0; } break;
                         default:
                             BD_DEBUG(DBG_HDMV|DBG_CRIT, "unknown BRANCH/PLAY option %d in opcode 0x%08x\n",
                                      insn->branch_opt, *(uint32_t*)insn);
diff --git a/src/libbluray/hdmv/mobj_print.c b/src/libbluray/hdmv/mobj_print.c
index 4361a76..375ead5 100644
--- a/src/libbluray/hdmv/mobj_print.c
+++ b/src/libbluray/hdmv/mobj_print.c
@@ -321,7 +321,7 @@ static uint32_t _cmd_to_u32(HDMV_INSN *insn)
         uint8_t u8[4];
     } tmp;
     tmp.insn = *insn;
-    return (tmp.u8[0] << 24) | (tmp.u8[1] << 16) | (tmp.u8[2] << 8) | tmp.u8[3];
+    return ((unsigned)tmp.u8[0] << 24) | (tmp.u8[1] << 16) | (tmp.u8[2] << 8) | tmp.u8[3];
 }
 
 int mobj_sprint_cmd(char *buf, MOBJ_CMD *cmd)
diff --git a/src/libbluray/player_settings.h b/src/libbluray/player_settings.h
index 809b5ab..6709303 100644
--- a/src/libbluray/player_settings.h
+++ b/src/libbluray/player_settings.h
@@ -102,6 +102,22 @@ enum {
 
 
 /*
+ * BLURAY_PLAYER_SETTING_DISPLAY_CAP (PSR23)
+ *
+ * Display capability (bit mask) and display size
+ */
+
+#define BLURAY_DCAP_1080p_720p_3D           0x01  /* capable of 1920x1080 23.976Hz and 1280x720 59.94Hz 3D */
+#define BLURAY_DCAP_720p_50Hz_3D            0x02  /* capable of 1280x720 50Hz 3D */
+#define BLURAY_DCAP_NO_3D_CLASSES_REQUIRED  0x04  /* 3D glasses are not required */
+#define BLURAY_DCAP_INTERLACED_3D           0x08  /* */
+
+/* horizintal display size in centimeters */
+#define BLURAY_DCAP_DISPLAY_SIZE_UNDEFINED  0
+#define BLURAY_DCAP_DISPLAY_SIZE(cm)        (((cm) > 0xfff ? 0xfff : (cm)) << 8)
+
+
+/*
  * BLURAY_PLAYER_SETTING_VIDEO_CAP (PSR29)
  *
  * Player capability for video (bit mask)
@@ -116,10 +132,30 @@ enum {
  * BLURAY_PLAYER_SETTING_PLAYER_PROFILE (PSR31)
  *
  * Player profile and version
+ *
+ * Profile 1, version 1.0: no local storage, no VFS, no internet
+ * Profile 1, version 1.1: PiP, VFS, sec. audio, 256MB local storage, no internet
+ * Profile 2, version 2.0: BdLive (internet), 1GB local storage
  */
 
 enum {
+    BLURAY_PLAYER_PROFILE_1_v1_0 = ((0x00 << 16) | (0x0100)),   /* Profile 1, version 1.0 (Initial Standard Profile) */
+    BLURAY_PLAYER_PROFILE_1_v1_1 = ((0x01 << 16) | (0x0110)),   /* Profile 1, version 1.1 (secondary stream support) */
     BLURAY_PLAYER_PROFILE_2_v2_0 = ((0x03 << 16) | (0x0200)),   /* Profile 2, version 2.0 (network access, BdLive) */
+    BLURAY_PLAYER_PROFILE_3_v2_0 = ((0x08 << 16) | (0x0200)),   /* Profile 3, version 2.0 (audio only player) */
+    BLURAY_PLAYER_PROFILE_5_v2_4 = ((0x13 << 16) | (0x0240)),   /* Profile 5, version 2.4 (3D) */
+};
+
+
+/*
+ * BLURAY_PLAYER_SETTING_DECODE_PG
+ *
+ * Enable Presentation Graphics and Text Subtitle decoder
+ */
+
+enum {
+    BLURAY_PG_TEXTST_DECODER_DISABLE  = 0,  /* disable both decoders */
+    BLURAY_PG_TEXTST_DECODER_ENABLE   = 1,  /* enable both decoders */
 };
 
 #endif /* BD_PLAYER_SETTINGS_H_ */
diff --git a/src/libbluray/register.c b/src/libbluray/register.c
index 6a2f13f..60bd06c 100644
--- a/src/libbluray/register.c
+++ b/src/libbluray/register.c
@@ -530,3 +530,33 @@ void registers_restore(BD_REGISTERS *p, const uint32_t *psr, const uint32_t *gpr
 
     bd_psr_unlock(p);
 }
+
+/*
+ *
+ */
+
+void psr_init_3D(BD_REGISTERS *p, int initial_mode)
+{
+    bd_psr_lock(p);
+
+    bd_psr_setting_write(p, PSR_OUTPUT_PREFER,
+                         BLURAY_OUTPUT_PREFER_3D);
+
+    bd_psr_setting_write(p, PSR_DISPLAY_CAP,
+                         BLURAY_DCAP_1080p_720p_3D |
+                         BLURAY_DCAP_720p_50Hz_3D |
+                         BLURAY_DCAP_NO_3D_CLASSES_REQUIRED |
+                         BLURAY_DCAP_INTERLACED_3D |
+                         0);
+
+    bd_psr_setting_write(p, PSR_3D_CAP,
+                         /* TODO */ 0xffffffff );
+
+    bd_psr_setting_write(p, PSR_PROFILE_VERSION,
+                         BLURAY_PLAYER_PROFILE_5_v2_4);
+
+    bd_psr_write(p, PSR_3D_STATUS,
+                 !!initial_mode);
+
+    bd_psr_unlock(p);
+}
diff --git a/src/libbluray/register.h b/src/libbluray/register.h
index c936aca..18e5bf5 100644
--- a/src/libbluray/register.h
+++ b/src/libbluray/register.h
@@ -263,6 +263,8 @@ void bd_psr_register_cb(BD_REGISTERS *, void (*callback)(void*,BD_PSR_EVENT*), v
  */
 void bd_psr_unregister_cb(BD_REGISTERS *, void (*callback)(void*,BD_PSR_EVENT*), void *cb_handle);
 
+BD_PRIVATE void psr_init_3D(BD_REGISTERS *, int initial_mode);
+
 
 /*
  * save / restore registers between playback sessions
diff --git a/src/util/bits.c b/src/util/bits.c
index 53eb25a..850031f 100644
--- a/src/util/bits.c
+++ b/src/util/bits.c
@@ -122,10 +122,12 @@ void bs_seek( BITSTREAM *bs, int64_t off, int whence)
     }
 }
 
+#if 0
 void bb_seek_byte( BITBUFFER *bb, int64_t off)
 {
     bb_seek(bb, off << 3, SEEK_SET);
 }
+#endif
 
 void bs_seek_byte( BITSTREAM *s, int64_t off)
 {
@@ -167,7 +169,7 @@ uint32_t bb_read( BITBUFFER *bb, int i_count )
             return( i_result );
         } else {
             /* less in the buffer than requested */
-           i_result |= (*bb->p&i_mask[bb->i_left]) << -i_shr;
+           i_result |= (unsigned)(*bb->p&i_mask[bb->i_left]) << -i_shr;
            i_count  -= bb->i_left;
            bb->p++;
            bb->i_left = 8;
diff --git a/src/util/bits.h b/src/util/bits.h
index df8be8a..dc7e9d8 100644
--- a/src/util/bits.h
+++ b/src/util/bits.h
@@ -58,7 +58,7 @@ BD_PRIVATE void bb_init( BITBUFFER *bb, const uint8_t *p_data, size_t i_data );
 BD_PRIVATE void bs_init( BITSTREAM *bs, BD_FILE_H *fp );
 BD_PRIVATE void bb_seek( BITBUFFER *bb, int64_t off, int whence);
 BD_PRIVATE void bs_seek( BITSTREAM *bs, int64_t off, int whence);
-BD_PRIVATE void bb_seek_byte( BITBUFFER *bb, int64_t off);
+//BD_PRIVATE void bb_seek_byte( BITBUFFER *bb, int64_t off);
 BD_PRIVATE void bs_seek_byte( BITSTREAM *s, int64_t off);
 BD_PRIVATE void bb_skip( BITBUFFER *bb, size_t i_count );
 BD_PRIVATE void bs_skip( BITSTREAM *bs, size_t i_count );  /* note: i_count must be less than BF_BUF_SIZE */
diff --git a/src/util/event_queue.c b/src/util/event_queue.c
new file mode 100644
index 0000000..976201d
--- /dev/null
+++ b/src/util/event_queue.c
@@ -0,0 +1,104 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2010-2016  Petri Hintukainen <phintuka at users.sourceforge.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "event_queue.h"
+
+#include "util/macro.h"
+#include "util/mutex.h"
+
+#include <string.h>
+
+
+#define MAX_EVENTS 31  /* 2^n - 1 */
+
+struct bd_event_queue {
+    BD_MUTEX mutex;
+    size_t   event_size;
+    unsigned in;  /* next free slot */
+    unsigned out; /* next event */
+
+    unsigned char ev[1];
+};
+
+
+void event_queue_destroy(BD_EVENT_QUEUE **pp)
+{
+    if (pp && *pp) {
+        BD_EVENT_QUEUE *eq = *pp;
+        bd_mutex_destroy(&eq->mutex);
+        X_FREE(*pp);
+    }
+}
+
+BD_EVENT_QUEUE *event_queue_new(size_t event_size)
+{
+    BD_EVENT_QUEUE *eq = calloc(1, sizeof(BD_EVENT_QUEUE) + event_size * (MAX_EVENTS + 1));
+    if (eq) {
+        bd_mutex_init(&eq->mutex);
+        eq->event_size = event_size;
+    }
+    return eq;
+}
+
+int event_queue_get(BD_EVENT_QUEUE *eq, void *ev)
+{
+    int result = 0;
+
+    if (eq) {
+        bd_mutex_lock(&eq->mutex);
+
+        if (eq->in != eq->out) {
+
+            memcpy(ev, &eq->ev[eq->out * eq->event_size], eq->event_size);
+            eq->out = (eq->out + 1) & MAX_EVENTS;
+
+            result = 1;
+        }
+
+        bd_mutex_unlock(&eq->mutex);
+    }
+
+    return result;
+}
+
+int event_queue_put(BD_EVENT_QUEUE *eq, const void *ev)
+{
+    int result = 0;
+
+    if (eq) {
+        bd_mutex_lock(&eq->mutex);
+
+        unsigned new_in = (eq->in + 1) & MAX_EVENTS;
+
+        if (new_in != eq->out) {
+            memcpy(&eq->ev[eq->in * eq->event_size], ev, eq->event_size);
+            eq->in = new_in;
+
+            result = 1;
+        }
+
+        bd_mutex_unlock(&eq->mutex);
+    }
+
+    return result;
+}
diff --git a/src/libbluray/bdnav/bdid_parse.h b/src/util/event_queue.h
similarity index 60%
copy from src/libbluray/bdnav/bdid_parse.h
copy to src/util/event_queue.h
index aacc4d9..6331b7d 100644
--- a/src/libbluray/bdnav/bdid_parse.h
+++ b/src/util/event_queue.h
@@ -1,6 +1,6 @@
 /*
  * This file is part of libbluray
- * Copyright (C) 2012  Petri Hintukainen <phintuka at users.sourceforge.net>
+ * Copyright (C) 2010-2016  Petri Hintukainen <phintuka at users.sourceforge.net>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -17,22 +17,19 @@
  * <http://www.gnu.org/licenses/>.
  */
 
-#if !defined(_BDID_PARSE_H_)
-#define _BDID_PARSE_H_
+#if !defined(BD_EVENT_QUEUE_H_)
+#define BD_EVENT_QUEUE_H_
 
 #include "util/attributes.h"
 
-#include <stdint.h>
+#include <stddef.h>
 
-typedef struct bdid_s {
-    char org_id[9];
-    char disc_id[33];
-} BDID_DATA;
+typedef struct bd_event_queue BD_EVENT_QUEUE;
 
+BD_PRIVATE BD_EVENT_QUEUE *event_queue_new(size_t event_size);
+BD_PRIVATE void            event_queue_destroy(BD_EVENT_QUEUE **);
 
-struct bd_disc;
+BD_PRIVATE int event_queue_get(BD_EVENT_QUEUE *eq, void *ev);
+BD_PRIVATE int event_queue_put(BD_EVENT_QUEUE *eq, const void *ev);
 
-BD_PRIVATE BDID_DATA* bdid_get(struct bd_disc *disc); /* parse id.bdmv */
-BD_PRIVATE void       bdid_free(BDID_DATA **p);
-
-#endif // _BDID_PARSE_H_
+#endif /* BD_EVENT_QUEUE_H_ */
diff --git a/src/util/macro.h b/src/util/macro.h
index dd6067a..9b8595a 100644
--- a/src/util/macro.h
+++ b/src/util/macro.h
@@ -25,7 +25,7 @@
 
 #define MKINT_BE16(X) ( (X)[0] << 8 | (X)[1] )
 #define MKINT_BE24(X) ( (X)[0] << 16 | (X)[1] << 8 | (X)[2] )
-#define MKINT_BE32(X) ( (X)[0] << 24 | (X)[1] << 16 |  (X)[2] << 8 | (X)[3] )
+#define MKINT_BE32(X) ( (unsigned)((X)[0]) << 24 | (X)[1] << 16 |  (X)[2] << 8 | (X)[3] )
 #define X_FREE(X)     ( free(X), X = NULL )
 
 #define BD_MIN(a,b) ((a)<(b)?(a):(b))

-- 
libbluray packaging



More information about the pkg-multimedia-commits mailing list