---
 texk/web2c/configure.ac             |   18 ++----------------
 texk/web2c/synctexdir/ac/synctex.ac |   20 ++++++++++++++++++++
 texk/web2c/synctexdir/am/synctex.am |   33 ++++++++++++++++++++++++---------
 3 files changed, 46 insertions(+), 25 deletions(-)

--- texlive-bin.orig/texk/web2c/configure.ac
+++ texlive-bin/texk/web2c/configure.ac
@@ -33,13 +33,6 @@
 WEB2CVERSION=tex_live_version()
 AC_SUBST([WEB2CVERSION])
 
-dnl Building a shared libsynctex requires a system zlib
-if test "x$enable_shared:$with_system_zlib" = xyes:no; then
-  enable_shared=no
-  ac_configure_args="$ac_configure_args '--disable-shared'"
-fi
-
-dnl Common code for all programs using libkpathsea.
 KPSE_COMMON([web2c programs])
 KPSE_CANONICAL_HOST
 
@@ -217,8 +210,6 @@
 
 AM_CONDITIONAL([WEB], [test "x$enable_web_progs" != xno])
 
-AM_CONDITIONAL([SYNCTEX], [test "x$enable_synctex" != xno])
-
 AS_IF([test "x$enable_ptex:$enable_eptex" = xno:no],
       [enable_pweb_progs=no],
       [enable_pweb_progs=$enable_web_progs])
@@ -401,13 +392,8 @@
 AC_CONFIG_FILES([ctangleboot-sh], [chmod +x ctangleboot-sh])
 AC_CONFIG_FILES([silent-sh], [chmod +x silent-sh])
 
-m4_define([synctex_version], m4_chomp(m4_include([synctexdir/synctex_parser_version.txt]))[.0])
-AC_SUBST([SYNCTEXVERSION], [synctex_version])
-KPSE_LT_VERSION([synctex])
-AS_IF([test "x$enable_synctex" != xno],
-      [AC_SUBST([WANTEDLIBS], [libsynctex.la])])
-
-AC_CONFIG_FILES([synctexdir/synctex.pc])
+dnl Additional code for synctex
+m4_sinclude([synctexdir/ac/synctex.ac])
 
 dnl The subdirectory web2c must be configured for the build system.
 dnl When cross compiling, can not share the cache file with the subdirectory!
--- /dev/null
+++ texlive-bin/texk/web2c/synctexdir/ac/synctex.ac
@@ -0,0 +1,20 @@
+## texk/web2c/synctexdir/ac/synctex.ac: configure.ac fragment for the TeX Live subdirectory texk/web2c/
+dnl
+dnl Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org>
+dnl You may freely use, modify and/or distribute this file.
+dnl
+dnl Additional code for synctex
+dnl
+dnl Building libsynctex as shared library requires a system zlib
+AM_CONDITIONAL([SYSTEM_ZLIB], [test "x$with_system_zlib" = xyes])
+
+AM_CONDITIONAL([SYNCTEX], [test "x$enable_synctex" != xno])
+
+m4_define([synctex_version], m4_chomp(m4_include([synctexdir/synctex_parser_version.txt]))[.0])
+AC_SUBST([SYNCTEXVERSION], [synctex_version])
+KPSE_LT_VERSION([synctex])
+AS_IF([test "x$enable_synctex" != xno],
+      [AC_SUBST([WANTEDLIBS], [libsynctex.la])])
+
+AC_CONFIG_FILES([synctexdir/synctex.pc])
+
--- texlive-bin.orig/texk/web2c/synctexdir/am/synctex.am
+++ texlive-bin/texk/web2c/synctexdir/am/synctex.am
@@ -15,39 +15,54 @@
 
 synctex_CPPFLAGS = -I$(srcdir)/synctexdir
 
-synctex_LDADD =  libsynctex.la $(ZLIB_LIBS)
+if SYSTEM_ZLIB
+libsynctex = libsynctex.la
+else !SYSTEM_ZLIB
+libsynctex = libsynctex.a
+endif !SYSTEM_ZLIB
 
-$(synctex_OBJECTS): libsynctex.la
+synctex_LDADD =  $(libsynctex) $(ZLIB_LIBS)
 
-## The SyncTeX parser library
+$(synctex_OBJECTS): $(libsynctex)
+
+## The (shared or nonshared) SyncTeX parser library
 
 EXTRA_LTLIBRARIES = libsynctex.la
+EXTRA_LIBRARIES += libsynctex.a
+
+if SYNCTEX
+if SYSTEM_ZLIB
 lib_LTLIBRARIES = $(WANTEDLIBS)
+else !SYSTEM_ZLIB
+lib_LIBRARIES = libsynctex.a
+endif !SYSTEM_ZLIB
+endif SYNCTEX
 
 libsynctex_la_CPPFLAGS = -I$(srcdir)/synctexdir $(ZLIB_INCLUDES) -DSYNCTEX_USE_LOCAL_HEADER
+libsynctex_a_CPPFLAGS = $(libsynctex_la_CPPFLAGS)
 
 libsynctex_la_LDFLAGS = -rpath @libdir@ -bindir @bindir@ -no-undefined -version-info $(SYNCTEX_LT_VERSINFO)
 
+libsynctex_la_LIBADD = $(ZLIB_LIBS)
+
 libsynctex_la_SOURCES = \
 	synctexdir/synctex_parser.c \
 	synctexdir/synctex_parser_local.h \
 	synctexdir/synctex_parser_utils.c
-
-libsynctex_la_LIBADD = $(ZLIB_LIBS)
+nodist_libsynctex_a_SOURCES = $(libsynctex_la_SOURCES)
 
 $(libsynctex_la_OBJECTS): $(ZLIB_DEPEND)
+$(libsynctex_a_OBJECTS): $(ZLIB_DEPEND)
 
 syncincludedir = ${includedir}/synctex
 
+pkgconfigdir = ${libdir}/pkgconfig
+
 if SYNCTEX
 syncinclude_HEADERS = \
 	synctexdir/synctex_parser.h \
 	synctexdir/synctex_parser_utils.h
-endif SYNCTEX
 
-pkgconfigdir = ${libdir}/pkgconfig
-
-if SYNCTEX
 pkgconfig_DATA = synctexdir/synctex.pc
 endif SYNCTEX
 
