]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Add support for name mangling
authorDženan Zukić <dzenan.zukic@kitware.com>
Mon, 6 Sep 2021 20:39:28 +0000 (16:39 -0400)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 9 Oct 2021 07:19:55 +0000 (09:19 +0200)
This is useful when zlib-ng is embedded into another library,
such as ITK: https://itk.org/

Closes #1025.

Co-authored-by: Mika Lindqvist <postmaster@raasu.org>
26 files changed:
.gitattributes
CMakeLists.txt
Makefile.in
configure
gzread.c.in [moved from gzread.c with 99% similarity]
win32/Makefile.a64
win32/Makefile.arm
win32/Makefile.msc
win32/replace.vbs [new file with mode: 0644]
win32/zlib-ng.def [deleted file]
win32/zlib-ng.def.in [new file with mode: 0644]
win32/zlib-ng1.rc
win32/zlib.def [deleted file]
win32/zlib.def.in [new file with mode: 0644]
win32/zlib1.rc
win32/zlibcompat.def [deleted file]
win32/zlibcompat.def.in [new file with mode: 0644]
zconf-ng.h.in
zconf.h.in
zlib-ng.h.in [moved from zlib-ng.h with 99% similarity]
zlib.h.in [moved from zlib.h with 98% similarity]
zlib.pc.cmakein
zlib.pc.in
zlib_name_mangling-ng.h.in [new file with mode: 0644]
zlib_name_mangling.h.empty [new file with mode: 0644]
zlib_name_mangling.h.in [new file with mode: 0644]

index 68ec3a174ec37435881058518962c55082924f3a..0414401042bfebb48af639eac8ee8277a5553471 100644 (file)
@@ -2,3 +2,5 @@
 *.c text
 *.h text
 Makefile text
+configure text eol=lf
+testCVEinputs.sh text eol=lf
\ No newline at end of file
index dcd07ad6023b34c96abb529b3a4531446d2eff0c..342a9b8c91096578a5181b8e239c44c6623d60fd 100644 (file)
@@ -26,7 +26,7 @@ if(NOT CMAKE_C_STANDARD IN_LIST VALID_C_STANDARDS)
 endif()
 
 # Parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
-file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h _zlib_h_contents)
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h.in _zlib_h_contents)
 string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([0-9]+.[0-9]+.[0-9]+).*\".*"
         "\\1" ZLIB_HEADER_VERSION ${_zlib_h_contents})
 string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
@@ -86,6 +86,10 @@ option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF)
 option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF)
 option(WITH_UNALIGNED "Support unaligned reads on platforms that support it" ON)
 
+set(ZLIB_SYMBOL_PREFIX "" CACHE STRING "Give this prefix to all publicly exported symbols.
+Useful when embedding into a larger library.
+Default is no prefix (empty prefix).")
+
 # Add multi-choice option
 set(WITH_SANITIZER AUTO CACHE STRING "Enable sanitizer support")
 set_property(CACHE WITH_SANITIZER PROPERTY STRINGS "Memory" "Address" "Undefined" "Thread")
@@ -111,6 +115,7 @@ endif()
 option(INSTALL_UTILS "Copy minigzip and minideflate during install" OFF)
 
 mark_as_advanced(FORCE
+    ZLIB_SYMBOL_PREFIX
     ZLIB_DUAL_LINK
     WITH_REDUCED_MEM
     WITH_ACLE WITH_NEON
@@ -841,7 +846,8 @@ endif()
 
 set(ZLIB_PUBLIC_HDRS
     ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h
-    zlib${SUFFIX}.h
+    ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h
+    ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.h
 )
 set(ZLIB_PRIVATE_HDRS
     adler32_p.h
@@ -901,7 +907,7 @@ set(ZLIB_GZFILE_PRIVATE_HDRS
 )
 set(ZLIB_GZFILE_SRCS
     gzlib.c
-    gzread.c
+    ${CMAKE_CURRENT_BINARY_DIR}/gzread.c
     gzwrite.c
 )
 
@@ -1040,6 +1046,23 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein
     ${ZLIB_PC} @ONLY)
 configure_file(${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h.cmakein
     ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib${SUFFIX}.h.in
+    ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.h @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gzread.c.in
+    ${CMAKE_CURRENT_BINARY_DIR}/gzread.c @ONLY)
+
+
+if (NOT ZLIB_SYMBOL_PREFIX STREQUAL "")
+    add_feature_info(ZLIB_SYMBOL_PREFIX ON "Publicly exported symbols have a custom prefix")
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib_name_mangling${SUFFIX}.h.in
+        ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h @ONLY)
+else()
+    add_feature_info(ZLIB_SYMBOL_PREFIX OFF "Publicly exported symbols DO NOT have a custom prefix")
+    configure_file(${CMAKE_CURRENT_SOURCE_DIR}/zlib_name_mangling.h.empty
+        ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h COPYONLY)
+endif()
+# add_definitions(-DZLIB_SYMBOL_PREFIX=${ZLIB_SYMBOL_PREFIX}) # not needed
+
 
 if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
     install(TARGETS ${ZLIB_INSTALL_LIBRARIES}
@@ -1048,8 +1071,10 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
         LIBRARY DESTINATION "${LIB_INSTALL_DIR}")
 endif()
 if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL)
-    install(FILES zlib${SUFFIX}.h
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zlib${SUFFIX}.h
         DESTINATION "${INC_INSTALL_DIR}" RENAME zlib${SUFFIX}.h)
+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zlib_name_mangling${SUFFIX}.h
+        DESTINATION "${INC_INSTALL_DIR}" RENAME zlib_name_mangling${SUFFIX}.h)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h
         DESTINATION "${INC_INSTALL_DIR}" RENAME zconf${SUFFIX}.h)
 endif()
index fb6a30c24790167faeef610a66eebe1a51f6731d..8e855e456dcbef6196d0557f51aa369bcfc0481a 100644 (file)
@@ -57,6 +57,8 @@ EXE=
 SRCDIR=.
 INCLUDES=-I$(SRCDIR)
 
+BUILDDIR=.
+
 ARCHDIR=arch/generic
 ARCH_STATIC_OBJS=
 ARCH_SHARED_OBJS=
@@ -225,7 +227,7 @@ example_dict_fuzzer$(EXE): example_dict_fuzzer.o standalone_fuzz_target_runner.o
 minigzip_fuzzer$(EXE): minigzip_fuzzer.o standalone_fuzz_target_runner.o $(OBJG) $(STATICLIB)
        $(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) minigzip_fuzzer.o $(OBJG) $(STATICLIB) -lpthread
 
-infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
+infcover.o: $(SRCDIR)/test/infcover.c zlib$(SUFFIX).h zconf$(SUFFIX).h zlib_name_mangling$(SUFFIX).h
        $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c
 
 infcover$(EXE): infcover.o $(STATICLIB)
@@ -275,9 +277,24 @@ zlibrc.o: win32/zlib$(SUFFIX)1.rc
 %.lo: $(SRCDIR)/%.c
        $(CC) $(SFLAGS) -DPIC $(INCLUDES) -c -o $@ $<
 
-$(OBJG): %.o: $(SRCDIR)/%.c
+gzlib.o: $(SRCDIR)/gzlib.c
+       $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
+
+gzlib.lo: $(SRCDIR)/gzlib.c
+       $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
+
+gzread.o: gzread.c
        $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
 
+gzread.lo: gzread.c
+       $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
+
+gzwrite.o: $(SRCDIR)/gzwrite.c
+       $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
+
+gzwrite.lo: $(SRCDIR)/gzwrite.c
+       $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
+
 $(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS)
 ifneq ($(SHAREDTARGET),)
        $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC)
@@ -393,10 +410,11 @@ install-libs: install-shared install-static
 
 install: install-libs
        -@if [ ! -d $(DESTDIR)$(includedir)   ]; then mkdir -p $(DESTDIR)$(includedir); fi
-       rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
-       cp $(SRCDIR)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h
+       rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h
+       cp zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h
        cp zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
-       chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
+       cp zlib_name_mangling$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h
+       chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h
 
 uninstall-static:
        cd $(DESTDIR)$(libdir) && rm -f $(STATICLIB)
@@ -410,7 +428,7 @@ ifneq ($(IMPORTLIB),)
 endif
 
 uninstall: uninstall-static uninstall-shared
-       cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h
+       cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h zlib_name_mangling$(SUFFIX).h
        cd $(DESTDIR)$(pkgconfigdir) && rm -f $(PKGFILE)
 
 mostlyclean: clean
@@ -437,7 +455,7 @@ maintainer-clean: distclean
 distclean: clean
        @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) distclean; fi
        @if [ -f test/Makefile ]; then $(MAKE) -C test distclean; fi
-       rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein
+       rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein zlib$(SUFFIX).h zlib_name_mangling$(SUFFIX)}.h
        -@rm -f .DS_Store
 # Reset Makefile if building inside source tree
        @if [ -f Makefile.in ]; then \
index 765ea443596ea0aa61a4d3f16ac394665cda3f3e..af1c7c431d66aa1c7718209ad73d438ecd91fb50 100755 (executable)
--- a/configure
+++ b/configure
@@ -113,6 +113,7 @@ neonflag=
 noltoflag="-fno-lto"
 vgfmaflag="-march=z13"
 vmxflag="-maltivec"
+symbol_prefix=""
 without_optimizations=0
 without_new_strategies=0
 reducedmem=0
@@ -150,6 +151,7 @@ case "$1" in
       echo '  configure [--prefix=PREFIX]  [--eprefix=EXPREFIX]' | tee -a configure.log
       echo '    [--static] [--32] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
       echo '    [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
+      echo '    [--sprefix=SYMBOL_PREFIX]   Adds a prefix to all exported symbols' | tee -a configure.log
       echo '    [--warn]                    Enables extra compiler warnings' | tee -a configure.log
       echo '    [--debug]                   Enables extra debug prints during operation' | tee -a configure.log
       echo '    [--zlib-compat]             Compiles for zlib-compatible API instead of zlib-ng API' | tee -a configure.log
@@ -171,12 +173,14 @@ case "$1" in
         exit 0 ;;
     -p*=* | --prefix=*) prefix=$(echo $1 | sed 's/.*=//'); shift ;;
     -e*=* | --eprefix=*) exec_prefix=$(echo $1 | sed 's/.*=//'); shift ;;
+    -m*=* | --sprefix=*) symbol_prefix=$(echo $1 | sed 's/.*=//'); shift ;;
     -l*=* | --libdir=*) libdir=$(echo $1 | sed 's/.*=//'); shift ;;
     --sharedlibdir=*) sharedlibdir=$(echo $1 | sed 's/.*=//'); shift ;;
     -i*=* | --includedir=*) includedir=$(echo $1 | sed 's/.*=//');shift ;;
     -u*=* | --uname=*) uname=$(echo $1 | sed 's/.*=//');shift ;;
     -p* | --prefix) prefix="$2"; shift; shift ;;
     -e* | --eprefix) exec_prefix="$2"; shift; shift ;;
+    -m* | --sprefix) symbol_prefix="$2"; shift; shift ;;
     -l* | --libdir) libdir="$2"; shift; shift ;;
     -i* | --includedir) includedir="$2"; shift; shift ;;
     -s* | --shared | --enable-shared) shared=1; shift ;;
@@ -282,15 +286,15 @@ MAPNAME=${LIBNAME2}.map
 
 # extract zlib version numbers from zlib.h
 if test $compat -eq 0; then
-  VER=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib-ng.h)
-  VER3=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib-ng.h)
-  VER2=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib-ng.h)
-  VER1=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib-ng.h)
+  VER=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib-ng.h.in)
+  VER3=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib-ng.h.in)
+  VER2=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib-ng.h.in)
+  VER1=$(sed -n -e '/ZLIBNG_VERSION "/s/.*"\([0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib-ng.h.in)
 else
-  VER=$(sed -n -e '/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib.h)
-  VER3=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib.h)
-  VER2=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib.h)
-  VER1=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib.h)
+  VER=$(sed -n -e '/ZLIB_VERSION "/s/.*"\(.*\)".*/\1/p' < ${SRCDIR}/zlib.h.in)
+  VER3=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p' < ${SRCDIR}/zlib.h.in)
+  VER2=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\.[0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib.h.in)
+  VER1=$(sed -n -e '/ZLIB_VERSION "/s/.*"\([0-9]*\)\..*/\1/p' < ${SRCDIR}/zlib.h.in)
 fi
 
 show $cc -c $test.c
@@ -790,9 +794,21 @@ else
   echo "Checking for strerror... No." | tee -a configure.log
 fi
 
-# We need to remove zconf.h from source directory if building outside of it
+# We need to remove consigured files (zconf.h etc) from source directory if building outside of it
 if [ "$SRCDIR" != "$BUILDDIR" ]; then
     rm -f $SRCDIR/zconf${SUFFIX}.h
+    rm -f $SRCDIR/zlib${SUFFIX}.h
+    rm -f $SRCDIR/zlib_name_mangling${SUFFIX}.h
+fi
+
+# Rename @ZLIB_SYMBOL_PREFIX@ to $symbol_prefix in gzread.c, zlib.h and zlib_name_mangling.h
+sed < $SRCDIR/gzread.c.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > gzread.c
+sed < $SRCDIR/zlib${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib${SUFFIX}.h
+if [[ ! -z $symbol_prefix ]]; then
+  sed < $SRCDIR/zlib_name_mangling${SUFFIX}.h.in "s/@ZLIB_SYMBOL_PREFIX@/$symbol_prefix/g" > zlib_name_mangling${SUFFIX}.h
+else
+  # symbol_prefix is not set, copy the empty mangling header
+  cp -p $SRCDIR/zlib_name_mangling.h.empty zlib_name_mangling${SUFFIX}.h
 fi
 
 # copy clean zconf.h for subsequent edits
@@ -1755,6 +1771,7 @@ echo bindir = $bindir >> configure.log
 echo libdir = $libdir >> configure.log
 echo mandir = $mandir >> configure.log
 echo prefix = $prefix >> configure.log
+echo symbol_prefix = $symbol_prefix >> configure.log
 echo sharedlibdir = $sharedlibdir >> configure.log
 echo uname = $uname >> configure.log
 echo sse2flag = $sse2flag >> configure.log
@@ -1814,6 +1831,7 @@ sed < $SRCDIR/Makefile.in "
 /^prefix *=/s#=.*#= $prefix#
 /^exec_prefix *=/s#=.*#= $exec_prefix#
 /^bindir *=/s#=.*#= $bindir#
+/^symbol_prefix *=/s#=.*#= $symbol_prefix#
 /^libdir *=/s#=.*#= $libdir#
 /^sharedlibdir *=/s#=.*#= $sharedlibdir#
 /^includedir *=/s#=.*#= $includedir#
@@ -1887,7 +1905,7 @@ sed < $SRCDIR/$ARCHDIR/Makefile.in "
 /^SUFFIX *=/s#=.*#=$SUFFIX#
 /^SRCDIR *=/s#=.*#=$SRCDIR/$ARCHDIR#
 /^SRCTOP *=/s#=.*#=$SRCDIR#
-/^TOPDIR *=/s#=.*#=$BUILDDIR#
+/^BUILDDIR *=/s#=.*#=$BUILDDIR#
 /^AVX2FLAG *=/s#=.*#=$avx2flag#
 /^SSE2FLAG *=/s#=.*#=$sse2flag#
 /^SSSE3FLAG *=/s#=.*#=$ssse3flag#
@@ -1971,6 +1989,7 @@ sed < $SRCDIR/zlib.pc.in "
 /^prefix *=/s#=.*#=$prefix#
 /^exec_prefix *=/s#=.*#=$exec_prefix#
 /^bindir *=/s#=.*#=$bindir#
+/^symbol_prefix *=/s#=.*#=$symbol_prefix#
 /^libdir *=/s#=.*#=$libdir#
 /^sharedlibdir *=/s#=.*#=$sharedlibdir#
 /^includedir *=/s#=.*#=$includedir#
similarity index 99%
rename from gzread.c
rename to gzread.c.in
index c3b3a035fcca28374b037947cf32746259d543b4..3e1dc1d1323c8a48db725cbb930ab565030d3b5a 100644 (file)
--- a/gzread.c
@@ -406,8 +406,8 @@ size_t Z_EXPORT PREFIX(gzfread)(void *buf, size_t size, size_t nitems, gzFile fi
 }
 
 /* -- see zlib.h -- */
-#undef gzgetc
-#undef zng_gzgetc
+#undef @ZLIB_SYMBOL_PREFIX@gzgetc
+#undef @ZLIB_SYMBOL_PREFIX@zng_gzgetc
 int Z_EXPORT PREFIX(gzgetc)(gzFile file) {
     unsigned char buf[1];
     gz_state *state;
index 418558b1377b251def5e420ddde9023b8fe102f8..580b5bfb1d812d0eb866d8649774ce5fe3b67cf1 100644 (file)
@@ -16,6 +16,7 @@ LOC =
 STATICLIB = zlib.lib
 SHAREDLIB = zlib1.dll
 IMPLIB    = zdll.lib
+SYMBOL_PREFIX =
 
 CC = cl
 LD = link
@@ -103,8 +104,25 @@ OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj adler32_neon.obj chunkset_n
 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
      example.exe minigzip.exe example_d.exe minigzip_d.exe
 
-zconf: $(TOP)/zconf$(SUFFIX).h.in
-     $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+!if "$(SYMBOL_PREFIX)" != ""
+zlib_name_mangling$(SUFFIX).h: zlib_name_mangling$(SUFFIX).h.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\zlib_name_mangling$(SUFFIX).h.in zlib_name_mangling$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+!else
+zlib_name_mangling$(SUFFIX).h: zlib_name_mangling.h.empty
+       $(CP) $(TOP)\zlib_name_mangling.h.empty zlib_name_mangling$(SUFFIX).h
+!endif
+
+zlib$(SUFFIX).h: zlib$(SUFFIX).h.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\zlib$(SUFFIX).h.in zlib$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+
+gzread.c: gzread.c.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\gzread.c.in gzread.c "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+
+zconf: $(TOP)/zconf$(SUFFIX).h.in $(TOP)/zlib$(SUFFIX).h $(TOP)/zlib_name_mangling$(SUFFIX).h
+       $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+
+$(TOP)/win32/$(DEFFILE): $(TOP)/win32/$(DEFFILE).in
+       cscript $(TOP)\win32\replace.vbs $(TOP)/win32/$(DEFFILE).in $(TOP)/win32/$(DEFFILE) "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
 
 $(STATICLIB): zconf $(OBJS)
        $(AR) $(ARFLAGS) -out:$@ $(OBJS)
@@ -218,3 +236,9 @@ clean:
 
 distclean: clean
        -del zconf$(SUFFIX).h
+       -del zlib$(SUFFIX).h
+       -del zlib_name_mangling$(SUFFIX).h
+       -del $(TOP)\win32\zlib.def
+       -del $(TOP)\win32\zlibcompat.def
+       -del $(TOP)\win32\zlib-ng.def
+       -del gzread.c
index c44c4d8c865e3c444140879a9900545bc5048299..12b08dc67147dcb464a3563412bfc5b0630ea606 100644 (file)
@@ -16,6 +16,7 @@ LOC =
 STATICLIB = zlib.lib
 SHAREDLIB = zlib1.dll
 IMPLIB    = zdll.lib
+SYMBOL_PREFIX =
 
 CC = cl
 LD = link
@@ -115,8 +116,25 @@ OBJS = $(OBJS) adler32_neon.obj chunkset_neon.obj slide_hash_neon.obj
 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
      example.exe minigzip.exe example_d.exe minigzip_d.exe
 
-zconf: $(TOP)/zconf$(SUFFIX).h.in
-     $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+!if "$(SYMBOL_PREFIX)" != ""
+zlib_name_mangling$(SUFFIX).h: zlib_name_mangling$(SUFFIX).h.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\zlib_name_mangling$(SUFFIX).h.in zlib_name_mangling$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+!else
+zlib_name_mangling$(SUFFIX).h: zlib_name_mangling.h.empty
+       $(CP) $(TOP)\zlib_name_mangling.h.empty zlib_name_mangling$(SUFFIX).h
+!endif
+
+zlib$(SUFFIX).h: zlib$(SUFFIX).h.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\zlib$(SUFFIX).h.in zlib$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+
+gzread.c: gzread.c.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\gzread.c.in gzread.c "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+
+zconf: $(TOP)/zconf$(SUFFIX).h.in $(TOP)/zlib$(SUFFIX).h $(TOP)/zlib_name_mangling$(SUFFIX).h
+       $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+
+$(TOP)/win32/$(DEFFILE): $(TOP)/win32/$(DEFFILE).in
+       cscript $(TOP)\win32\replace.vbs $(TOP)/win32/$(DEFFILE).in $(TOP)/win32/$(DEFFILE) "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
 
 $(STATICLIB): zconf $(OBJS)
        $(AR) $(ARFLAGS) -out:$@ $(OBJS)
@@ -229,3 +247,9 @@ clean:
 
 distclean: clean
        -del zconf$(SUFFIX).h
+       -del zlib$(SUFFIX).h
+       -del zlib_name_mangling$(SUFFIX).h
+       -del $(TOP)\win32\zlib.def
+       -del $(TOP)\win32\zlibcompat.def
+       -del $(TOP)\win32\zlib-ng.def
+       -del gzread.c
index eec878f249acecff0c34d5df740bbc2aee4bee6e..ef3f237ffce20ca4b192e57317df9967f55e3cbb 100644 (file)
@@ -16,6 +16,7 @@ LOC =
 STATICLIB = zlib.lib
 SHAREDLIB = zlib1.dll
 IMPLIB    = zdll.lib
+SYMBOL_PREFIX =
 
 CC = cl
 LD = link
@@ -107,8 +108,25 @@ OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj
 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
      example.exe minigzip.exe example_d.exe minigzip_d.exe
 
-zconf: $(TOP)/zconf$(SUFFIX).h.in
-     $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+!if "$(SYMBOL_PREFIX)" != ""
+zlib_name_mangling$(SUFFIX).h: zlib_name_mangling$(SUFFIX).h.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\zlib_name_mangling$(SUFFIX).h.in zlib_name_mangling$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+!else
+zlib_name_mangling$(SUFFIX).h: zlib_name_mangling.h.empty
+       $(CP) $(TOP)\zlib_name_mangling.h.empty zlib_name_mangling$(SUFFIX).h
+!endif
+
+zlib$(SUFFIX).h: zlib$(SUFFIX).h.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\zlib$(SUFFIX).h.in zlib$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+
+gzread.c: gzread.c.in
+       cscript $(TOP)\win32\replace.vbs $(TOP)\gzread.c.in gzread.c "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
+
+zconf: $(TOP)/zconf$(SUFFIX).h.in $(TOP)/zlib$(SUFFIX).h $(TOP)/zlib_name_mangling$(SUFFIX).h
+       $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
+
+$(TOP)/win32/$(DEFFILE): $(TOP)/win32/$(DEFFILE).in
+       cscript $(TOP)\win32\replace.vbs $(TOP)/win32/$(DEFFILE).in $(TOP)/win32/$(DEFFILE) "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
 
 $(STATICLIB): zconf $(OBJS)
        $(AR) $(ARFLAGS) -out:$@ $(OBJS)
@@ -226,3 +244,9 @@ clean:
 
 distclean: clean
        -del zconf$(SUFFIX).h
+       -del zlib$(SUFFIX).h
+       -del zlib_name_mangling$(SUFFIX).h
+       -del $(TOP)\win32\zlib.def
+       -del $(TOP)\win32\zlibcompat.def
+       -del $(TOP)\win32\zlib-ng.def
+       -del gzread.c
diff --git a/win32/replace.vbs b/win32/replace.vbs
new file mode 100644 (file)
index 0000000..6779971
--- /dev/null
@@ -0,0 +1,15 @@
+strInputFileName = Wscript.Arguments(0)
+strOutputFileName = Wscript.Arguments(1)
+strOldText = Wscript.Arguments(2)
+strNewText = Wscript.Arguments(3)
+
+Set objFSO = CreateObject("Scripting.FileSystemObject")
+Set objFile = objFSO.OpenTextFile(strInputFileName, 1)
+
+strText = objFile.ReadAll
+objFile.Close
+strNewText = Replace(strText, strOldText, strNewText)
+
+Set objFile = objFSO.OpenTextFile(strOutputFileName, 2, True)
+objFile.Write strNewText
+objFile.Close
diff --git a/win32/zlib-ng.def b/win32/zlib-ng.def
deleted file mode 100644 (file)
index 467d790..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-; zlib-ng data compression library
-EXPORTS
-; basic functions
-    zlibng_version
-    zng_deflate
-    zng_deflateEnd
-    zng_inflate
-    zng_inflateEnd
-; advanced functions
-    zng_deflateSetDictionary
-    zng_deflateGetDictionary
-    zng_deflateCopy
-    zng_deflateReset
-    zng_deflateParams
-    zng_deflateTune
-    zng_deflateBound
-    zng_deflatePending
-    zng_deflatePrime
-    zng_deflateSetHeader
-    zng_deflateSetParams
-    zng_deflateGetParams
-    zng_inflateSetDictionary
-    zng_inflateGetDictionary
-    zng_inflateSync
-    zng_inflateCopy
-    zng_inflateReset
-    zng_inflateReset2
-    zng_inflatePrime
-    zng_inflateMark
-    zng_inflateGetHeader
-    zng_inflateBack
-    zng_inflateBackEnd
-    zng_zlibCompileFlags
-; utility functions
-    zng_compress
-    zng_compress2
-    zng_compressBound
-    zng_uncompress
-    zng_uncompress2
-; checksum functions
-    zng_adler32
-    zng_adler32_z
-    zng_crc32
-    zng_crc32_z
-    zng_adler32_combine
-    zng_crc32_combine
-; various hacks, don't look :)
-    zng_deflateInit_
-    zng_deflateInit2_
-    zng_inflateInit_
-    zng_inflateInit2_
-    zng_inflateBackInit_
-    zng_zError
-    zng_inflateSyncPoint
-    zng_get_crc_table
-    zng_inflateUndermine
-    zng_inflateValidate
-    zng_inflateCodesUsed
-    zng_inflateResetKeep
-    zng_deflateResetKeep
diff --git a/win32/zlib-ng.def.in b/win32/zlib-ng.def.in
new file mode 100644 (file)
index 0000000..642acf7
--- /dev/null
@@ -0,0 +1,60 @@
+; zlib-ng data compression library
+EXPORTS
+; basic functions
+    @ZLIB_SYMBOL_PREFIX@zlibng_version
+    @ZLIB_SYMBOL_PREFIX@zng_deflate
+    @ZLIB_SYMBOL_PREFIX@zng_deflateEnd
+    @ZLIB_SYMBOL_PREFIX@zng_inflate
+    @ZLIB_SYMBOL_PREFIX@zng_inflateEnd
+; advanced functions
+    @ZLIB_SYMBOL_PREFIX@zng_deflateSetDictionary
+    @ZLIB_SYMBOL_PREFIX@zng_deflateGetDictionary
+    @ZLIB_SYMBOL_PREFIX@zng_deflateCopy
+    @ZLIB_SYMBOL_PREFIX@zng_deflateReset
+    @ZLIB_SYMBOL_PREFIX@zng_deflateParams
+    @ZLIB_SYMBOL_PREFIX@zng_deflateTune
+    @ZLIB_SYMBOL_PREFIX@zng_deflateBound
+    @ZLIB_SYMBOL_PREFIX@zng_deflatePending
+    @ZLIB_SYMBOL_PREFIX@zng_deflatePrime
+    @ZLIB_SYMBOL_PREFIX@zng_deflateSetHeader
+    @ZLIB_SYMBOL_PREFIX@zng_deflateSetParams
+    @ZLIB_SYMBOL_PREFIX@zng_deflateGetParams
+    @ZLIB_SYMBOL_PREFIX@zng_inflateSetDictionary
+    @ZLIB_SYMBOL_PREFIX@zng_inflateGetDictionary
+    @ZLIB_SYMBOL_PREFIX@zng_inflateSync
+    @ZLIB_SYMBOL_PREFIX@zng_inflateCopy
+    @ZLIB_SYMBOL_PREFIX@zng_inflateReset
+    @ZLIB_SYMBOL_PREFIX@zng_inflateReset2
+    @ZLIB_SYMBOL_PREFIX@zng_inflatePrime
+    @ZLIB_SYMBOL_PREFIX@zng_inflateMark
+    @ZLIB_SYMBOL_PREFIX@zng_inflateGetHeader
+    @ZLIB_SYMBOL_PREFIX@zng_inflateBack
+    @ZLIB_SYMBOL_PREFIX@zng_inflateBackEnd
+    @ZLIB_SYMBOL_PREFIX@zng_zlibCompileFlags
+; utility functions
+    @ZLIB_SYMBOL_PREFIX@zng_compress
+    @ZLIB_SYMBOL_PREFIX@zng_compress2
+    @ZLIB_SYMBOL_PREFIX@zng_compressBound
+    @ZLIB_SYMBOL_PREFIX@zng_uncompress
+    @ZLIB_SYMBOL_PREFIX@zng_uncompress2
+; checksum functions
+    @ZLIB_SYMBOL_PREFIX@zng_adler32
+    @ZLIB_SYMBOL_PREFIX@zng_adler32_z
+    @ZLIB_SYMBOL_PREFIX@zng_crc32
+    @ZLIB_SYMBOL_PREFIX@zng_crc32_z
+    @ZLIB_SYMBOL_PREFIX@zng_adler32_combine
+    @ZLIB_SYMBOL_PREFIX@zng_crc32_combine
+; various hacks, don't look :)
+    @ZLIB_SYMBOL_PREFIX@zng_deflateInit_
+    @ZLIB_SYMBOL_PREFIX@zng_deflateInit2_
+    @ZLIB_SYMBOL_PREFIX@zng_inflateInit_
+    @ZLIB_SYMBOL_PREFIX@zng_inflateInit2_
+    @ZLIB_SYMBOL_PREFIX@zng_inflateBackInit_
+    @ZLIB_SYMBOL_PREFIX@zng_zError
+    @ZLIB_SYMBOL_PREFIX@zng_inflateSyncPoint
+    @ZLIB_SYMBOL_PREFIX@zng_get_crc_table
+    @ZLIB_SYMBOL_PREFIX@zng_inflateUndermine
+    @ZLIB_SYMBOL_PREFIX@zng_inflateValidate
+    @ZLIB_SYMBOL_PREFIX@zng_inflateCodesUsed
+    @ZLIB_SYMBOL_PREFIX@zng_inflateResetKeep
+    @ZLIB_SYMBOL_PREFIX@zng_deflateResetKeep
index b53906904b848e2590766792efe28154223c3e05..f524131462531664d9750ede67bcabaf291a8c0c 100644 (file)
@@ -1,5 +1,5 @@
 #include <winver.h>
-#include "../zlib-ng.h"
+#include "zlib-ng.h"
 
 #ifdef GCC_WINDRES
 VS_VERSION_INFO                VERSIONINFO
diff --git a/win32/zlib.def b/win32/zlib.def
deleted file mode 100644 (file)
index 6764420..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-; zlib data compression library
-EXPORTS
-; basic functions
-    zlibVersion
-    deflate
-    deflateEnd
-    inflate
-    inflateEnd
-; advanced functions
-    deflateSetDictionary
-    deflateGetDictionary
-    deflateCopy
-    deflateReset
-    deflateParams
-    deflateTune
-    deflateBound
-    deflatePending
-    deflatePrime
-    deflateSetHeader
-    inflateSetDictionary
-    inflateGetDictionary
-    inflateSync
-    inflateCopy
-    inflateReset
-    inflateReset2
-    inflatePrime
-    inflateMark
-    inflateGetHeader
-    inflateBack
-    inflateBackEnd
-    zlibCompileFlags
-; utility functions
-    compress
-    compress2
-    compressBound
-    uncompress
-    uncompress2
-; large file functions
-    adler32_combine64
-    crc32_combine64
-; checksum functions
-    adler32
-    adler32_z
-    crc32
-    crc32_z
-    adler32_combine
-    crc32_combine
-; various hacks, don't look :)
-    deflateInit_
-    deflateInit2_
-    inflateInit_
-    inflateInit2_
-    inflateBackInit_
-    zError
-    inflateSyncPoint
-    get_crc_table
-    inflateUndermine
-    inflateValidate
-    inflateCodesUsed
-    inflateResetKeep
-    deflateResetKeep
diff --git a/win32/zlib.def.in b/win32/zlib.def.in
new file mode 100644 (file)
index 0000000..66a6f66
--- /dev/null
@@ -0,0 +1,61 @@
+; zlib data compression library
+EXPORTS
+; basic functions
+    @ZLIB_SYMBOL_PREFIX@zlibVersion
+    @ZLIB_SYMBOL_PREFIX@deflate
+    @ZLIB_SYMBOL_PREFIX@deflateEnd
+    @ZLIB_SYMBOL_PREFIX@inflate
+    @ZLIB_SYMBOL_PREFIX@inflateEnd
+; advanced functions
+    @ZLIB_SYMBOL_PREFIX@deflateSetDictionary
+    @ZLIB_SYMBOL_PREFIX@deflateGetDictionary
+    @ZLIB_SYMBOL_PREFIX@deflateCopy
+    @ZLIB_SYMBOL_PREFIX@deflateReset
+    @ZLIB_SYMBOL_PREFIX@deflateParams
+    @ZLIB_SYMBOL_PREFIX@deflateTune
+    @ZLIB_SYMBOL_PREFIX@deflateBound
+    @ZLIB_SYMBOL_PREFIX@deflatePending
+    @ZLIB_SYMBOL_PREFIX@deflatePrime
+    @ZLIB_SYMBOL_PREFIX@deflateSetHeader
+    @ZLIB_SYMBOL_PREFIX@inflateSetDictionary
+    @ZLIB_SYMBOL_PREFIX@inflateGetDictionary
+    @ZLIB_SYMBOL_PREFIX@inflateSync
+    @ZLIB_SYMBOL_PREFIX@inflateCopy
+    @ZLIB_SYMBOL_PREFIX@inflateReset
+    @ZLIB_SYMBOL_PREFIX@inflateReset2
+    @ZLIB_SYMBOL_PREFIX@inflatePrime
+    @ZLIB_SYMBOL_PREFIX@inflateMark
+    @ZLIB_SYMBOL_PREFIX@inflateGetHeader
+    @ZLIB_SYMBOL_PREFIX@inflateBack
+    @ZLIB_SYMBOL_PREFIX@inflateBackEnd
+    @ZLIB_SYMBOL_PREFIX@zlibCompileFlags
+; utility functions
+    @ZLIB_SYMBOL_PREFIX@compress
+    @ZLIB_SYMBOL_PREFIX@compress2
+    @ZLIB_SYMBOL_PREFIX@compressBound
+    @ZLIB_SYMBOL_PREFIX@uncompress
+    @ZLIB_SYMBOL_PREFIX@uncompress2
+; large file functions
+    @ZLIB_SYMBOL_PREFIX@adler32_combine64
+    @ZLIB_SYMBOL_PREFIX@crc32_combine64
+; checksum functions
+    @ZLIB_SYMBOL_PREFIX@adler32
+    @ZLIB_SYMBOL_PREFIX@adler32_z
+    @ZLIB_SYMBOL_PREFIX@crc32
+    @ZLIB_SYMBOL_PREFIX@crc32_z
+    @ZLIB_SYMBOL_PREFIX@adler32_combine
+    @ZLIB_SYMBOL_PREFIX@crc32_combine
+; various hacks, don't look :)
+    @ZLIB_SYMBOL_PREFIX@deflateInit_
+    @ZLIB_SYMBOL_PREFIX@deflateInit2_
+    @ZLIB_SYMBOL_PREFIX@inflateInit_
+    @ZLIB_SYMBOL_PREFIX@inflateInit2_
+    @ZLIB_SYMBOL_PREFIX@inflateBackInit_
+    @ZLIB_SYMBOL_PREFIX@zError
+    @ZLIB_SYMBOL_PREFIX@inflateSyncPoint
+    @ZLIB_SYMBOL_PREFIX@get_crc_table
+    @ZLIB_SYMBOL_PREFIX@inflateUndermine
+    @ZLIB_SYMBOL_PREFIX@inflateValidate
+    @ZLIB_SYMBOL_PREFIX@inflateCodesUsed
+    @ZLIB_SYMBOL_PREFIX@inflateResetKeep
+    @ZLIB_SYMBOL_PREFIX@deflateResetKeep
index 11be5f49f962165eeb9c2c32cca790617f66332c..ee0b287953ffb213c8a27569c856f374c3f20b71 100644 (file)
@@ -1,5 +1,5 @@
 #include <winver.h>
-#include "../zlib.h"
+#include "zlib.h"
 
 #ifdef GCC_WINDRES
 VS_VERSION_INFO                VERSIONINFO
diff --git a/win32/zlibcompat.def b/win32/zlibcompat.def
deleted file mode 100644 (file)
index a2188b0..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-; zlib data compression library
-EXPORTS
-; basic functions
-    zlibVersion
-    deflate
-    deflateEnd
-    inflate
-    inflateEnd
-; advanced functions
-    deflateSetDictionary
-    deflateGetDictionary
-    deflateCopy
-    deflateReset
-    deflateParams
-    deflateTune
-    deflateBound
-    deflatePending
-    deflatePrime
-    deflateSetHeader
-    inflateSetDictionary
-    inflateGetDictionary
-    inflateSync
-    inflateCopy
-    inflateReset
-    inflateReset2
-    inflatePrime
-    inflateMark
-    inflateGetHeader
-    inflateBack
-    inflateBackEnd
-    zlibCompileFlags
-; utility functions
-    compress
-    compress2
-    compressBound
-    uncompress
-    uncompress2
-    gzopen
-    gzdopen
-    gzbuffer
-    gzsetparams
-    gzread
-    gzfread
-    gzwrite
-    gzfwrite
-    gzprintf
-    gzvprintf
-    gzputs
-    gzgets
-    gzputc
-    gzgetc
-    gzungetc
-    gzflush
-    gzseek
-    gzrewind
-    gztell
-    gzoffset
-    gzeof
-    gzdirect
-    gzclose
-    gzclose_r
-    gzclose_w
-    gzerror
-    gzclearerr
-; large file functions
-    gzopen64
-    gzseek64
-    gztell64
-    gzoffset64
-    adler32_combine64
-    crc32_combine64
-; checksum functions
-    adler32
-    adler32_z
-    crc32
-    crc32_z
-    adler32_combine
-    crc32_combine
-; various hacks, don't look :)
-    deflateInit_
-    deflateInit2_
-    inflateInit_
-    inflateInit2_
-    inflateBackInit_
-    gzgetc_
-    zError
-    inflateSyncPoint
-    get_crc_table
-    inflateUndermine
-    inflateValidate
-    inflateCodesUsed
-    inflateResetKeep
-    deflateResetKeep
-    gzopen_w
diff --git a/win32/zlibcompat.def.in b/win32/zlibcompat.def.in
new file mode 100644 (file)
index 0000000..dbb3c3f
--- /dev/null
@@ -0,0 +1,94 @@
+; zlib data compression library
+EXPORTS
+; basic functions
+    @ZLIB_SYMBOL_PREFIX@zlibVersion
+    @ZLIB_SYMBOL_PREFIX@deflate
+    @ZLIB_SYMBOL_PREFIX@deflateEnd
+    @ZLIB_SYMBOL_PREFIX@inflate
+    @ZLIB_SYMBOL_PREFIX@inflateEnd
+; advanced functions
+    @ZLIB_SYMBOL_PREFIX@deflateSetDictionary
+    @ZLIB_SYMBOL_PREFIX@deflateGetDictionary
+    @ZLIB_SYMBOL_PREFIX@deflateCopy
+    @ZLIB_SYMBOL_PREFIX@deflateReset
+    @ZLIB_SYMBOL_PREFIX@deflateParams
+    @ZLIB_SYMBOL_PREFIX@deflateTune
+    @ZLIB_SYMBOL_PREFIX@deflateBound
+    @ZLIB_SYMBOL_PREFIX@deflatePending
+    @ZLIB_SYMBOL_PREFIX@deflatePrime
+    @ZLIB_SYMBOL_PREFIX@deflateSetHeader
+    @ZLIB_SYMBOL_PREFIX@inflateSetDictionary
+    @ZLIB_SYMBOL_PREFIX@inflateGetDictionary
+    @ZLIB_SYMBOL_PREFIX@inflateSync
+    @ZLIB_SYMBOL_PREFIX@inflateCopy
+    @ZLIB_SYMBOL_PREFIX@inflateReset
+    @ZLIB_SYMBOL_PREFIX@inflateReset2
+    @ZLIB_SYMBOL_PREFIX@inflatePrime
+    @ZLIB_SYMBOL_PREFIX@inflateMark
+    @ZLIB_SYMBOL_PREFIX@inflateGetHeader
+    @ZLIB_SYMBOL_PREFIX@inflateBack
+    @ZLIB_SYMBOL_PREFIX@inflateBackEnd
+    @ZLIB_SYMBOL_PREFIX@zlibCompileFlags
+; utility functions
+    @ZLIB_SYMBOL_PREFIX@compress
+    @ZLIB_SYMBOL_PREFIX@compress2
+    @ZLIB_SYMBOL_PREFIX@compressBound
+    @ZLIB_SYMBOL_PREFIX@uncompress
+    @ZLIB_SYMBOL_PREFIX@uncompress2
+    @ZLIB_SYMBOL_PREFIX@gzopen
+    @ZLIB_SYMBOL_PREFIX@gzdopen
+    @ZLIB_SYMBOL_PREFIX@gzbuffer
+    @ZLIB_SYMBOL_PREFIX@gzsetparams
+    @ZLIB_SYMBOL_PREFIX@gzread
+    @ZLIB_SYMBOL_PREFIX@gzfread
+    @ZLIB_SYMBOL_PREFIX@gzwrite
+    @ZLIB_SYMBOL_PREFIX@gzfwrite
+    @ZLIB_SYMBOL_PREFIX@gzprintf
+    @ZLIB_SYMBOL_PREFIX@gzvprintf
+    @ZLIB_SYMBOL_PREFIX@gzputs
+    @ZLIB_SYMBOL_PREFIX@gzgets
+    @ZLIB_SYMBOL_PREFIX@gzputc
+    @ZLIB_SYMBOL_PREFIX@gzgetc
+    @ZLIB_SYMBOL_PREFIX@gzungetc
+    @ZLIB_SYMBOL_PREFIX@gzflush
+    @ZLIB_SYMBOL_PREFIX@gzseek
+    @ZLIB_SYMBOL_PREFIX@gzrewind
+    @ZLIB_SYMBOL_PREFIX@gztell
+    @ZLIB_SYMBOL_PREFIX@gzoffset
+    @ZLIB_SYMBOL_PREFIX@gzeof
+    @ZLIB_SYMBOL_PREFIX@gzdirect
+    @ZLIB_SYMBOL_PREFIX@gzclose
+    @ZLIB_SYMBOL_PREFIX@gzclose_r
+    @ZLIB_SYMBOL_PREFIX@gzclose_w
+    @ZLIB_SYMBOL_PREFIX@gzerror
+    @ZLIB_SYMBOL_PREFIX@gzclearerr
+; large file functions
+    @ZLIB_SYMBOL_PREFIX@gzopen64
+    @ZLIB_SYMBOL_PREFIX@gzseek64
+    @ZLIB_SYMBOL_PREFIX@gztell64
+    @ZLIB_SYMBOL_PREFIX@gzoffset64
+    @ZLIB_SYMBOL_PREFIX@adler32_combine64
+    @ZLIB_SYMBOL_PREFIX@crc32_combine64
+; checksum functions
+    @ZLIB_SYMBOL_PREFIX@adler32
+    @ZLIB_SYMBOL_PREFIX@adler32_z
+    @ZLIB_SYMBOL_PREFIX@crc32
+    @ZLIB_SYMBOL_PREFIX@crc32_z
+    @ZLIB_SYMBOL_PREFIX@adler32_combine
+    @ZLIB_SYMBOL_PREFIX@crc32_combine
+; various hacks, don't look :)
+    @ZLIB_SYMBOL_PREFIX@deflateInit_
+    @ZLIB_SYMBOL_PREFIX@deflateInit2_
+    @ZLIB_SYMBOL_PREFIX@inflateInit_
+    @ZLIB_SYMBOL_PREFIX@inflateInit2_
+    @ZLIB_SYMBOL_PREFIX@inflateBackInit_
+    @ZLIB_SYMBOL_PREFIX@gzgetc_
+    @ZLIB_SYMBOL_PREFIX@zError
+    @ZLIB_SYMBOL_PREFIX@inflateSyncPoint
+    @ZLIB_SYMBOL_PREFIX@get_crc_table
+    @ZLIB_SYMBOL_PREFIX@inflateUndermine
+    @ZLIB_SYMBOL_PREFIX@inflateValidate
+    @ZLIB_SYMBOL_PREFIX@inflateCodesUsed
+    @ZLIB_SYMBOL_PREFIX@inflateResetKeep
+    @ZLIB_SYMBOL_PREFIX@deflateResetKeep
+    @ZLIB_SYMBOL_PREFIX@gzopen_w
index 66ab4cf6626dd8e8f87041cc8be8dcce29895d03..21629c7b30e91660b8fd67adf33e3fb5a1e1e6aa 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef ZCONFNG_H
 #define ZCONFNG_H
 
+#include "zlib_name_mangling-ng.h"
+
 #if !defined(_WIN32) && defined(__WIN32__)
 #  define _WIN32
 #endif
index 2c6b12dff179086179ebbb9a9bfdb8acd511c926..fef6bab42dbf6cb780431a28707da3bc5665bee6 100644 (file)
@@ -6,6 +6,8 @@
 #ifndef ZCONF_H
 #define ZCONF_H
 
+#include "zlib_name_mangling.h"
+
 #if !defined(_WIN32) && defined(__WIN32__)
 #  define _WIN32
 #endif
similarity index 99%
rename from zlib-ng.h
rename to zlib-ng.h.in
index 36750cf1d7694743b395984be097126e75884f7c..260370781678f6d3f9e681bd1458c892cb963011 100644 (file)
--- a/zlib-ng.h
@@ -1800,13 +1800,13 @@ Z_EXTERN Z_EXPORT int32_t zng_inflateInit2_(zng_stream *strm, int32_t  windowBit
 Z_EXTERN Z_EXPORT int32_t zng_inflateBackInit_(zng_stream *strm, int32_t windowBits, uint8_t *window,
                                          const char *version, int32_t stream_size);
 
-#define zng_deflateInit(strm, level) zng_deflateInit_((strm), (level), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
-#define zng_inflateInit(strm) zng_inflateInit_((strm), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
-#define zng_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+#define @ZLIB_SYMBOL_PREFIX@zng_deflateInit(strm, level) zng_deflateInit_((strm), (level), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
+#define @ZLIB_SYMBOL_PREFIX@zng_inflateInit(strm) zng_inflateInit_((strm), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
+#define @ZLIB_SYMBOL_PREFIX@zng_deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
         zng_deflateInit2_((strm), (level), (method), (windowBits), (memLevel), \
                      (strategy), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
-#define zng_inflateInit2(strm, windowBits) zng_inflateInit2_((strm), (windowBits), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
-#define zng_inflateBackInit(strm, windowBits, window) \
+#define @ZLIB_SYMBOL_PREFIX@zng_inflateInit2(strm, windowBits) zng_inflateInit2_((strm), (windowBits), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
+#define @ZLIB_SYMBOL_PREFIX@zng_inflateBackInit(strm, windowBits, window) \
                         zng_inflateBackInit_((strm), (windowBits), (window), ZLIBNG_VERSION, (int32_t)sizeof(zng_stream))
 
 #ifdef WITH_GZFILEOP
@@ -1824,7 +1824,7 @@ struct gzFile_s {
     z_off64_t pos;
 };
 Z_EXTERN Z_EXPORT int32_t zng_gzgetc_(gzFile file);  /* backward compatibility */
-#  define zng_gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (zng_gzgetc)(g))
+#  define @ZLIB_SYMBOL_PREFIX@zng_gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (@ZLIB_SYMBOL_PREFIX@zng_gzgetc)(g))
 
 #endif /* WITH_GZFILEOP */
 
similarity index 98%
rename from zlib.h
rename to zlib.h.in
index 842559485d40b7e9ee9458defa94c2e4c4fac341..40d1f73e2edf1d63be1a2868ca5992712b4832db 100644 (file)
--- a/zlib.h
+++ b/zlib.h.in
@@ -1757,13 +1757,13 @@ Z_EXTERN int Z_EXPORT deflateInit2_(z_stream *strm, int  level, int  method, int
 Z_EXTERN int Z_EXPORT inflateInit2_(z_stream *strm, int  windowBits, const char *version, int stream_size);
 Z_EXTERN int Z_EXPORT inflateBackInit_(z_stream *strm, int windowBits, unsigned char *window,
                                       const char *version, int stream_size);
-#define deflateInit(strm, level) deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateInit(strm) inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
-#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
+#define @ZLIB_SYMBOL_PREFIX@deflateInit(strm, level) deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream))
+#define @ZLIB_SYMBOL_PREFIX@inflateInit(strm) inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream))
+#define @ZLIB_SYMBOL_PREFIX@deflateInit2(strm, level, method, windowBits, memLevel, strategy) \
         deflateInit2_((strm), (level), (method), (windowBits), (memLevel), \
                      (strategy), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateInit2(strm, windowBits) inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(z_stream))
-#define inflateBackInit(strm, windowBits, window) \
+#define @ZLIB_SYMBOL_PREFIX@inflateInit2(strm, windowBits) inflateInit2_((strm), (windowBits), ZLIB_VERSION, (int)sizeof(z_stream))
+#define @ZLIB_SYMBOL_PREFIX@inflateBackInit(strm, windowBits, window) \
                         inflateBackInit_((strm), (windowBits), (window), ZLIB_VERSION, (int)sizeof(z_stream))
 
 
@@ -1781,7 +1781,7 @@ struct gzFile_s {
     z_off64_t pos;
 };
 Z_EXTERN int Z_EXPORT gzgetc_(gzFile file);  /* backward compatibility */
-#  define gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (gzgetc)(g))
+#  define @ZLIB_SYMBOL_PREFIX@gzgetc(g) ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : (@ZLIB_SYMBOL_PREFIX@gzgetc)(g))
 
 /* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or
  * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if
@@ -1801,21 +1801,21 @@ Z_EXTERN int Z_EXPORT gzgetc_(gzFile file);  /* backward compatibility */
 #endif
 
 #if !defined(Z_INTERNAL) && defined(Z_WANT64)
-#    define gzopen gzopen64
-#    define gzseek gzseek64
-#    define gztell gztell64
-#    define gzoffset gzoffset64
-#    define adler32_combine adler32_combine64
-#    define crc32_combine crc32_combine64
-#    define crc32_combine_gen crc32_combine_gen64
+#    define @ZLIB_SYMBOL_PREFIX@gzopen @ZLIB_SYMBOL_PREFIX@gzopen64
+#    define @ZLIB_SYMBOL_PREFIX@gzseek @ZLIB_SYMBOL_PREFIX@gzseek64
+#    define @ZLIB_SYMBOL_PREFIX@gztell @ZLIB_SYMBOL_PREFIX@gztell64
+#    define @ZLIB_SYMBOL_PREFIX@gzoffset @ZLIB_SYMBOL_PREFIX@gzoffset64
+#    define @ZLIB_SYMBOL_PREFIX@adler32_combine @ZLIB_SYMBOL_PREFIX@adler32_combine64
+#    define @ZLIB_SYMBOL_PREFIX@crc32_combine @ZLIB_SYMBOL_PREFIX@crc32_combine64
+#    define @ZLIB_SYMBOL_PREFIX@crc32_combine_gen @ZLIB_SYMBOL_PREFIX@crc32_combine_gen64
 #  ifndef Z_LARGE64
-     Z_EXTERN gzFile Z_EXPORT gzopen64(const char *, const char *);
-     Z_EXTERN z_off_t Z_EXPORT gzseek64(gzFile, z_off_t, int);
-     Z_EXTERN z_off_t Z_EXPORT gztell64(gzFile);
-     Z_EXTERN z_off_t Z_EXPORT gzoffset64(gzFile);
-     Z_EXTERN unsigned long Z_EXPORT adler32_combine64(unsigned long, unsigned long, z_off_t);
-     Z_EXTERN unsigned long Z_EXPORT crc32_combine64(unsigned long, unsigned long, z_off_t);
-     Z_EXTERN void Z_EXPORT crc32_combine_gen64(uint32_t *op, z_off64_t);
+     Z_EXTERN gzFile Z_EXPORT @ZLIB_SYMBOL_PREFIX@gzopen64(const char *, const char *);
+     Z_EXTERN z_off_t Z_EXPORT @ZLIB_SYMBOL_PREFIX@gzseek64(gzFile, z_off_t, int);
+     Z_EXTERN z_off_t Z_EXPORT @ZLIB_SYMBOL_PREFIX@gztell64(gzFile);
+     Z_EXTERN z_off_t Z_EXPORT @ZLIB_SYMBOL_PREFIX@gzoffset64(gzFile);
+     Z_EXTERN unsigned long Z_EXPORT @ZLIB_SYMBOL_PREFIX@adler32_combine64(unsigned long, unsigned long, z_off_t);
+     Z_EXTERN unsigned long Z_EXPORT @ZLIB_SYMBOL_PREFIX@crc32_combine64(unsigned long, unsigned long, z_off_t);
+     Z_EXTERN void Z_EXPORT @ZLIB_SYMBOL_PREFIX@crc32_combine_gen64(uint32_t *op, z_off64_t);
 #  endif
 #else
    Z_EXTERN gzFile Z_EXPORT gzopen(const char *, const char *);
index 9b64252dc2a1133ba4522a7f9da509fb3c35a7ad..3d440ce6bdcc1134844b4eff7d06d98c3071412a 100644 (file)
@@ -1,5 +1,6 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 exec_prefix=${prefix}
+symbol_prefix=@ZLIB_SYMBOL_PREFIX@
 libdir=@PC_LIB_INSTALL_DIR@
 sharedlibdir=${libdir}
 includedir=@PC_INC_INSTALL_DIR@
index d0a6766b5c245bb006c4cf4eb203e81da975ece7..a0678fbe03f0961597495f6e3541d93e364207ea 100644 (file)
@@ -1,5 +1,6 @@
 prefix=@prefix@
 exec_prefix=@exec_prefix@
+symbol_prefix=@symbol_prefix@
 libdir=@libdir@
 sharedlibdir=@sharedlibdir@
 includedir=@includedir@
diff --git a/zlib_name_mangling-ng.h.in b/zlib_name_mangling-ng.h.in
new file mode 100644 (file)
index 0000000..7c754fc
--- /dev/null
@@ -0,0 +1,173 @@
+/* zlib_name_mangling.h has been automatically generated from
+ * zlib_name_mangling.h.in because ZLIB_SYMBOL_PREFIX was set.
+ */
+
+#ifndef ZLIB_NAME_MANGLING_H
+#define ZLIB_NAME_MANGLING_H
+
+/* all linked symbols and init macros */
+#define zng__dist_code            @ZLIB_SYMBOL_PREFIX@zng__dist_code
+#define zng__length_code          @ZLIB_SYMBOL_PREFIX@zng__length_code
+#define zng__tr_align             @ZLIB_SYMBOL_PREFIX@zng__tr_align
+#define zng__tr_flush_bits        @ZLIB_SYMBOL_PREFIX@zng__tr_flush_bits
+#define zng__tr_flush_block       @ZLIB_SYMBOL_PREFIX@zng__tr_flush_block
+#define zng__tr_init              @ZLIB_SYMBOL_PREFIX@zng__tr_init
+#define zng__tr_stored_block      @ZLIB_SYMBOL_PREFIX@zng__tr_stored_block
+#define zng__tr_tally             @ZLIB_SYMBOL_PREFIX@zng__tr_tally
+#define zng_adler32               @ZLIB_SYMBOL_PREFIX@zng_adler32
+#define zng_adler32_combine       @ZLIB_SYMBOL_PREFIX@zng_adler32_combine
+#define zng_adler32_combine64     @ZLIB_SYMBOL_PREFIX@zng_adler32_combine64
+#define zng_adler32_z             @ZLIB_SYMBOL_PREFIX@zng_adler32_z
+#ifndef Z_SOLO
+#  define zng_compress              @ZLIB_SYMBOL_PREFIX@zng_compress
+#  define zng_compress2             @ZLIB_SYMBOL_PREFIX@zng_compress2
+#  define zng_compressBound         @ZLIB_SYMBOL_PREFIX@zng_compressBound
+#endif
+#define zng_crc32                 @ZLIB_SYMBOL_PREFIX@zng_crc32
+#define zng_crc32_combine         @ZLIB_SYMBOL_PREFIX@zng_crc32_combine
+#define zng_crc32_combine64       @ZLIB_SYMBOL_PREFIX@zng_crc32_combine64
+#define zng_crc32_z               @ZLIB_SYMBOL_PREFIX@zng_crc32_z
+#define zng_deflate               @ZLIB_SYMBOL_PREFIX@zng_deflate
+#define zng_deflateBound          @ZLIB_SYMBOL_PREFIX@zng_deflateBound
+#define zng_deflateCopy           @ZLIB_SYMBOL_PREFIX@zng_deflateCopy
+#define zng_deflateEnd            @ZLIB_SYMBOL_PREFIX@zng_deflateEnd
+#define zng_deflateGetDictionary  @ZLIB_SYMBOL_PREFIX@zng_deflateGetDictionary
+#define zng_deflateInit           @ZLIB_SYMBOL_PREFIX@zng_deflateInit
+#define zng_deflateInit2          @ZLIB_SYMBOL_PREFIX@zng_deflateInit2
+#define zng_deflateInit2_         @ZLIB_SYMBOL_PREFIX@zng_deflateInit2_
+#define zng_deflateInit_          @ZLIB_SYMBOL_PREFIX@zng_deflateInit_
+#define zng_deflateParams         @ZLIB_SYMBOL_PREFIX@zng_deflateParams
+#define zng_deflatePending        @ZLIB_SYMBOL_PREFIX@zng_deflatePending
+#define zng_deflatePrime          @ZLIB_SYMBOL_PREFIX@zng_deflatePrime
+#define zng_deflateReset          @ZLIB_SYMBOL_PREFIX@zng_deflateReset
+#define zng_deflateResetKeep      @ZLIB_SYMBOL_PREFIX@zng_deflateResetKeep
+#define zng_deflateSetDictionary  @ZLIB_SYMBOL_PREFIX@zng_deflateSetDictionary
+#define zng_deflateSetHeader      @ZLIB_SYMBOL_PREFIX@zng_deflateSetHeader
+#define zng_deflateTune           @ZLIB_SYMBOL_PREFIX@zng_deflateTune
+#define zng_deflate_copyright     @ZLIB_SYMBOL_PREFIX@zng_deflate_copyright
+#define zng_get_crc_table         @ZLIB_SYMBOL_PREFIX@zng_get_crc_table
+#ifndef Z_SOLO
+#  define zng_gz_error              @ZLIB_SYMBOL_PREFIX@zng_gz_error
+#  define zng_gz_intmax             @ZLIB_SYMBOL_PREFIX@zng_gz_intmax
+#  define zng_gz_strwinerror        @ZLIB_SYMBOL_PREFIX@zng_gz_strwinerror
+#  define zng_gzbuffer              @ZLIB_SYMBOL_PREFIX@zng_gzbuffer
+#  define zng_gzclearerr            @ZLIB_SYMBOL_PREFIX@zng_gzclearerr
+#  define zng_gzclose               @ZLIB_SYMBOL_PREFIX@zng_gzclose
+#  define zng_gzclose_r             @ZLIB_SYMBOL_PREFIX@zng_gzclose_r
+#  define zng_gzclose_w             @ZLIB_SYMBOL_PREFIX@zng_gzclose_w
+#  define zng_gzdirect              @ZLIB_SYMBOL_PREFIX@zng_gzdirect
+#  define zng_gzdopen               @ZLIB_SYMBOL_PREFIX@zng_gzdopen
+#  define zng_gzeof                 @ZLIB_SYMBOL_PREFIX@zng_gzeof
+#  define zng_gzerror               @ZLIB_SYMBOL_PREFIX@zng_gzerror
+#  define zng_gzflush               @ZLIB_SYMBOL_PREFIX@zng_gzflush
+#  define zng_gzfread               @ZLIB_SYMBOL_PREFIX@zng_gzfread
+#  define zng_gzfwrite              @ZLIB_SYMBOL_PREFIX@zng_gzfwrite
+#  define zng_gzgetc                @ZLIB_SYMBOL_PREFIX@zng_gzgetc
+#  define zng_gzgetc_               @ZLIB_SYMBOL_PREFIX@zng_gzgetc_
+#  define zng_gzgets                @ZLIB_SYMBOL_PREFIX@zng_gzgets
+#  define zng_gzoffset              @ZLIB_SYMBOL_PREFIX@zng_gzoffset
+#  define zng_gzoffset64            @ZLIB_SYMBOL_PREFIX@zng_gzoffset64
+#  define zng_gzopen                @ZLIB_SYMBOL_PREFIX@zng_gzopen
+#  define zng_gzopen64              @ZLIB_SYMBOL_PREFIX@zng_gzopen64
+#  ifdef _WIN32
+#    define zng_gzopen_w              @ZLIB_SYMBOL_PREFIX@zng_gzopen_w
+#  endif
+#  define zng_gzprintf              @ZLIB_SYMBOL_PREFIX@zng_gzprintf
+#  define zng_gzputc                @ZLIB_SYMBOL_PREFIX@zng_gzputc
+#  define zng_gzputs                @ZLIB_SYMBOL_PREFIX@zng_gzputs
+#  define zng_gzread                @ZLIB_SYMBOL_PREFIX@zng_gzread
+#  define zng_gzrewind              @ZLIB_SYMBOL_PREFIX@zng_gzrewind
+#  define zng_gzseek                @ZLIB_SYMBOL_PREFIX@zng_gzseek
+#  define zng_gzseek64              @ZLIB_SYMBOL_PREFIX@zng_gzseek64
+#  define zng_gzsetparams           @ZLIB_SYMBOL_PREFIX@zng_gzsetparams
+#  define zng_gztell                @ZLIB_SYMBOL_PREFIX@zng_gztell
+#  define zng_gztell64              @ZLIB_SYMBOL_PREFIX@zng_gztell64
+#  define zng_gzungetc              @ZLIB_SYMBOL_PREFIX@zng_gzungetc
+#  define zng_gzvprintf             @ZLIB_SYMBOL_PREFIX@zng_gzvprintf
+#  define zng_gzwrite               @ZLIB_SYMBOL_PREFIX@zng_gzwrite
+#endif
+#define zng_inflate               @ZLIB_SYMBOL_PREFIX@zng_inflate
+#define zng_inflateBack           @ZLIB_SYMBOL_PREFIX@zng_inflateBack
+#define zng_inflateBackEnd        @ZLIB_SYMBOL_PREFIX@zng_inflateBackEnd
+#define zng_inflateBackInit       @ZLIB_SYMBOL_PREFIX@zng_inflateBackInit
+#define zng_inflateBackInit_      @ZLIB_SYMBOL_PREFIX@zng_inflateBackInit_
+#define zng_inflateCodesUsed      @ZLIB_SYMBOL_PREFIX@zng_inflateCodesUsed
+#define zng_inflateCopy           @ZLIB_SYMBOL_PREFIX@zng_inflateCopy
+#define zng_inflateEnd            @ZLIB_SYMBOL_PREFIX@zng_inflateEnd
+#define zng_inflateGetDictionary  @ZLIB_SYMBOL_PREFIX@zng_inflateGetDictionary
+#define zng_inflateGetHeader      @ZLIB_SYMBOL_PREFIX@zng_inflateGetHeader
+#define zng_inflateInit           @ZLIB_SYMBOL_PREFIX@zng_inflateInit
+#define zng_inflateInit2          @ZLIB_SYMBOL_PREFIX@zng_inflateInit2
+#define zng_inflateInit2_         @ZLIB_SYMBOL_PREFIX@zng_inflateInit2_
+#define zng_inflateInit_          @ZLIB_SYMBOL_PREFIX@zng_inflateInit_
+#define zng_inflateMark           @ZLIB_SYMBOL_PREFIX@zng_inflateMark
+#define zng_inflatePrime          @ZLIB_SYMBOL_PREFIX@zng_inflatePrime
+#define zng_inflateReset          @ZLIB_SYMBOL_PREFIX@zng_inflateReset
+#define zng_inflateReset2         @ZLIB_SYMBOL_PREFIX@zng_inflateReset2
+#define zng_inflateResetKeep      @ZLIB_SYMBOL_PREFIX@zng_inflateResetKeep
+#define zng_inflateSetDictionary  @ZLIB_SYMBOL_PREFIX@zng_inflateSetDictionary
+#define zng_inflateSync           @ZLIB_SYMBOL_PREFIX@zng_inflateSync
+#define zng_inflateSyncPoint      @ZLIB_SYMBOL_PREFIX@zng_inflateSyncPoint
+#define zng_inflateUndermine      @ZLIB_SYMBOL_PREFIX@zng_inflateUndermine
+#define zng_inflateValidate       @ZLIB_SYMBOL_PREFIX@zng_inflateValidate
+#define zng_inflate_copyright     @ZLIB_SYMBOL_PREFIX@zng_inflate_copyright
+#define zng_inflate_fast          @ZLIB_SYMBOL_PREFIX@zng_inflate_fast
+#define zng_inflate_table         @ZLIB_SYMBOL_PREFIX@zng_inflate_table
+#ifndef Z_SOLO
+#  define zng_uncompress            @ZLIB_SYMBOL_PREFIX@zng_uncompress
+#  define zng_uncompress2           @ZLIB_SYMBOL_PREFIX@zng_uncompress2
+#endif
+#define zng_zError                @ZLIB_SYMBOL_PREFIX@zng_zError
+#ifndef Z_SOLO
+#  define zng_zcalloc               @ZLIB_SYMBOL_PREFIX@zng_zcalloc
+#  define zng_zcfree                @ZLIB_SYMBOL_PREFIX@zng_zcfree
+#endif
+#define zng_zlibCompileFlags      @ZLIB_SYMBOL_PREFIX@zng_zlibCompileFlags
+#define zng_zlibVersion           @ZLIB_SYMBOL_PREFIX@zng_zlibVersion
+
+/* all zlib typedefs in zlib.h and zconf.h */
+#define Byte                  @ZLIB_SYMBOL_PREFIX@Byte
+#define Bytef                 @ZLIB_SYMBOL_PREFIX@Bytef
+#define alloc_func            @ZLIB_SYMBOL_PREFIX@alloc_func
+#define charf                 @ZLIB_SYMBOL_PREFIX@charf
+#define free_func             @ZLIB_SYMBOL_PREFIX@free_func
+#ifndef Z_SOLO
+#  define gzFile                @ZLIB_SYMBOL_PREFIX@gzFile
+#endif
+#define gz_header             @ZLIB_SYMBOL_PREFIX@gz_header
+#define gz_headerp            @ZLIB_SYMBOL_PREFIX@gz_headerp
+#define in_func               @ZLIB_SYMBOL_PREFIX@in_func
+#define intf                  @ZLIB_SYMBOL_PREFIX@intf
+#define out_func              @ZLIB_SYMBOL_PREFIX@out_func
+#define uInt                  @ZLIB_SYMBOL_PREFIX@uInt
+#define uIntf                 @ZLIB_SYMBOL_PREFIX@uIntf
+#define uLong                 @ZLIB_SYMBOL_PREFIX@uLong
+#define uLongf                @ZLIB_SYMBOL_PREFIX@uLongf
+#define voidp                 @ZLIB_SYMBOL_PREFIX@voidp
+#define voidpc                @ZLIB_SYMBOL_PREFIX@voidpc
+#define voidpf                @ZLIB_SYMBOL_PREFIX@voidpf
+
+/* all zlib structs in zlib.h and zconf.h */
+#define zng_gz_header_s           @ZLIB_SYMBOL_PREFIX@zng_gz_header_s
+#define internal_state            @ZLIB_SYMBOL_PREFIX@internal_state
+
+/* zlib-ng specific symbols */
+#define zng_deflate_param         @ZLIB_SYMBOL_PREFIX@zng_deflate_param
+#define zng_deflate_param_value   @ZLIB_SYMBOL_PREFIX@zng_deflate_param_value
+#define zng_deflateSetParams      @ZLIB_SYMBOL_PREFIX@zng_deflateSetParams
+#define zng_deflateGetParams      @ZLIB_SYMBOL_PREFIX@zng_deflateGetParams
+
+#define zlibng_version         @ZLIB_SYMBOL_PREFIX@zlibng_version
+#define zng_zError             @ZLIB_SYMBOL_PREFIX@zng_zError
+#define zng_inflateSyncPoint   @ZLIB_SYMBOL_PREFIX@zng_inflateSyncPoint
+#define zng_get_crc_table      @ZLIB_SYMBOL_PREFIX@zng_get_crc_table
+#define zng_inflateUndermine   @ZLIB_SYMBOL_PREFIX@zng_inflateUndermine
+#define zng_inflateValidate    @ZLIB_SYMBOL_PREFIX@zng_inflateValidate
+#define zng_inflateCodesUsed   @ZLIB_SYMBOL_PREFIX@zng_inflateCodesUsed
+#define zng_inflateResetKeep   @ZLIB_SYMBOL_PREFIX@zng_inflateResetKeep
+#define zng_deflateResetKeep   @ZLIB_SYMBOL_PREFIX@zng_deflateResetKeep
+
+#define zng_gzopen_w           @ZLIB_SYMBOL_PREFIX@zng_gzopen_w
+#define zng_gzvprintf          @ZLIB_SYMBOL_PREFIX@zng_gzvprintf
+
+#endif /* ZLIB_NAME_MANGLING_H */
diff --git a/zlib_name_mangling.h.empty b/zlib_name_mangling.h.empty
new file mode 100644 (file)
index 0000000..b24cb83
--- /dev/null
@@ -0,0 +1,8 @@
+/* zlib_name_mangling.h has been automatically generated from
+ * zlib_name_mangling.h.empty because ZLIB_SYMBOL_PREFIX was NOT set.
+ */
+
+#ifndef ZLIB_NAME_MANGLING_H
+#define ZLIB_NAME_MANGLING_H
+
+#endif /* ZLIB_NAME_MANGLING_H */
diff --git a/zlib_name_mangling.h.in b/zlib_name_mangling.h.in
new file mode 100644 (file)
index 0000000..07265f3
--- /dev/null
@@ -0,0 +1,157 @@
+/* zlib_name_mangling.h has been automatically generated from
+ * zlib_name_mangling.h.in because ZLIB_SYMBOL_PREFIX was set.
+ */
+
+#ifndef ZLIB_NAME_MANGLING_H
+#define ZLIB_NAME_MANGLING_H
+
+/* all linked symbols and init macros */
+#define _dist_code            @ZLIB_SYMBOL_PREFIX@_dist_code
+#define _length_code          @ZLIB_SYMBOL_PREFIX@_length_code
+#define _tr_align             @ZLIB_SYMBOL_PREFIX@_tr_align
+#define _tr_flush_bits        @ZLIB_SYMBOL_PREFIX@_tr_flush_bits
+#define _tr_flush_block       @ZLIB_SYMBOL_PREFIX@_tr_flush_block
+#define _tr_init              @ZLIB_SYMBOL_PREFIX@_tr_init
+#define _tr_stored_block      @ZLIB_SYMBOL_PREFIX@_tr_stored_block
+#define _tr_tally             @ZLIB_SYMBOL_PREFIX@_tr_tally
+#define adler32               @ZLIB_SYMBOL_PREFIX@adler32
+#define adler32_combine       @ZLIB_SYMBOL_PREFIX@adler32_combine
+#define adler32_combine64     @ZLIB_SYMBOL_PREFIX@adler32_combine64
+#define adler32_z             @ZLIB_SYMBOL_PREFIX@adler32_z
+#ifndef Z_SOLO
+#  define compress              @ZLIB_SYMBOL_PREFIX@compress
+#  define compress2             @ZLIB_SYMBOL_PREFIX@compress2
+#  define compressBound         @ZLIB_SYMBOL_PREFIX@compressBound
+#endif
+#define crc32                 @ZLIB_SYMBOL_PREFIX@crc32
+#define crc32_combine         @ZLIB_SYMBOL_PREFIX@crc32_combine
+#define crc32_combine64       @ZLIB_SYMBOL_PREFIX@crc32_combine64
+#define crc32_z               @ZLIB_SYMBOL_PREFIX@crc32_z
+#define deflate               @ZLIB_SYMBOL_PREFIX@deflate
+#define deflateBound          @ZLIB_SYMBOL_PREFIX@deflateBound
+#define deflateCopy           @ZLIB_SYMBOL_PREFIX@deflateCopy
+#define deflateEnd            @ZLIB_SYMBOL_PREFIX@deflateEnd
+#define deflateGetDictionary  @ZLIB_SYMBOL_PREFIX@deflateGetDictionary
+#define deflateInit           @ZLIB_SYMBOL_PREFIX@deflateInit
+#define deflateInit2          @ZLIB_SYMBOL_PREFIX@deflateInit2
+#define deflateInit2_         @ZLIB_SYMBOL_PREFIX@deflateInit2_
+#define deflateInit_          @ZLIB_SYMBOL_PREFIX@deflateInit_
+#define deflateParams         @ZLIB_SYMBOL_PREFIX@deflateParams
+#define deflatePending        @ZLIB_SYMBOL_PREFIX@deflatePending
+#define deflatePrime          @ZLIB_SYMBOL_PREFIX@deflatePrime
+#define deflateReset          @ZLIB_SYMBOL_PREFIX@deflateReset
+#define deflateResetKeep      @ZLIB_SYMBOL_PREFIX@deflateResetKeep
+#define deflateSetDictionary  @ZLIB_SYMBOL_PREFIX@deflateSetDictionary
+#define deflateSetHeader      @ZLIB_SYMBOL_PREFIX@deflateSetHeader
+#define deflateTune           @ZLIB_SYMBOL_PREFIX@deflateTune
+#define deflate_copyright     @ZLIB_SYMBOL_PREFIX@deflate_copyright
+#define get_crc_table         @ZLIB_SYMBOL_PREFIX@get_crc_table
+#ifndef Z_SOLO
+#  define gz_error              @ZLIB_SYMBOL_PREFIX@gz_error
+#  define gz_intmax             @ZLIB_SYMBOL_PREFIX@gz_intmax
+#  define gz_strwinerror        @ZLIB_SYMBOL_PREFIX@gz_strwinerror
+#  define gzbuffer              @ZLIB_SYMBOL_PREFIX@gzbuffer
+#  define gzclearerr            @ZLIB_SYMBOL_PREFIX@gzclearerr
+#  define gzclose               @ZLIB_SYMBOL_PREFIX@gzclose
+#  define gzclose_r             @ZLIB_SYMBOL_PREFIX@gzclose_r
+#  define gzclose_w             @ZLIB_SYMBOL_PREFIX@gzclose_w
+#  define gzdirect              @ZLIB_SYMBOL_PREFIX@gzdirect
+#  define gzdopen               @ZLIB_SYMBOL_PREFIX@gzdopen
+#  define gzeof                 @ZLIB_SYMBOL_PREFIX@gzeof
+#  define gzerror               @ZLIB_SYMBOL_PREFIX@gzerror
+#  define gzflush               @ZLIB_SYMBOL_PREFIX@gzflush
+#  define gzfread               @ZLIB_SYMBOL_PREFIX@gzfread
+#  define gzfwrite              @ZLIB_SYMBOL_PREFIX@gzfwrite
+#  define gzgetc                @ZLIB_SYMBOL_PREFIX@gzgetc
+#  define gzgetc_               @ZLIB_SYMBOL_PREFIX@gzgetc_
+#  define gzgets                @ZLIB_SYMBOL_PREFIX@gzgets
+#  define gzoffset              @ZLIB_SYMBOL_PREFIX@gzoffset
+#  define gzoffset64            @ZLIB_SYMBOL_PREFIX@gzoffset64
+#  define gzopen                @ZLIB_SYMBOL_PREFIX@gzopen
+#  define gzopen64              @ZLIB_SYMBOL_PREFIX@gzopen64
+#  ifdef _WIN32
+#    define gzopen_w              @ZLIB_SYMBOL_PREFIX@gzopen_w
+#  endif
+#  define gzprintf              @ZLIB_SYMBOL_PREFIX@gzprintf
+#  define gzputc                @ZLIB_SYMBOL_PREFIX@gzputc
+#  define gzputs                @ZLIB_SYMBOL_PREFIX@gzputs
+#  define gzread                @ZLIB_SYMBOL_PREFIX@gzread
+#  define gzrewind              @ZLIB_SYMBOL_PREFIX@gzrewind
+#  define gzseek                @ZLIB_SYMBOL_PREFIX@gzseek
+#  define gzseek64              @ZLIB_SYMBOL_PREFIX@gzseek64
+#  define gzsetparams           @ZLIB_SYMBOL_PREFIX@gzsetparams
+#  define gztell                @ZLIB_SYMBOL_PREFIX@gztell
+#  define gztell64              @ZLIB_SYMBOL_PREFIX@gztell64
+#  define gzungetc              @ZLIB_SYMBOL_PREFIX@gzungetc
+#  define gzvprintf             @ZLIB_SYMBOL_PREFIX@gzvprintf
+#  define gzwrite               @ZLIB_SYMBOL_PREFIX@gzwrite
+#endif
+#define inflate               @ZLIB_SYMBOL_PREFIX@inflate
+#define inflateBack           @ZLIB_SYMBOL_PREFIX@inflateBack
+#define inflateBackEnd        @ZLIB_SYMBOL_PREFIX@inflateBackEnd
+#define inflateBackInit       @ZLIB_SYMBOL_PREFIX@inflateBackInit
+#define inflateBackInit_      @ZLIB_SYMBOL_PREFIX@inflateBackInit_
+#define inflateCodesUsed      @ZLIB_SYMBOL_PREFIX@inflateCodesUsed
+#define inflateCopy           @ZLIB_SYMBOL_PREFIX@inflateCopy
+#define inflateEnd            @ZLIB_SYMBOL_PREFIX@inflateEnd
+#define inflateGetDictionary  @ZLIB_SYMBOL_PREFIX@inflateGetDictionary
+#define inflateGetHeader      @ZLIB_SYMBOL_PREFIX@inflateGetHeader
+#define inflateInit           @ZLIB_SYMBOL_PREFIX@inflateInit
+#define inflateInit2          @ZLIB_SYMBOL_PREFIX@inflateInit2
+#define inflateInit2_         @ZLIB_SYMBOL_PREFIX@inflateInit2_
+#define inflateInit_          @ZLIB_SYMBOL_PREFIX@inflateInit_
+#define inflateMark           @ZLIB_SYMBOL_PREFIX@inflateMark
+#define inflatePrime          @ZLIB_SYMBOL_PREFIX@inflatePrime
+#define inflateReset          @ZLIB_SYMBOL_PREFIX@inflateReset
+#define inflateReset2         @ZLIB_SYMBOL_PREFIX@inflateReset2
+#define inflateResetKeep      @ZLIB_SYMBOL_PREFIX@inflateResetKeep
+#define inflateSetDictionary  @ZLIB_SYMBOL_PREFIX@inflateSetDictionary
+#define inflateSync           @ZLIB_SYMBOL_PREFIX@inflateSync
+#define inflateSyncPoint      @ZLIB_SYMBOL_PREFIX@inflateSyncPoint
+#define inflateUndermine      @ZLIB_SYMBOL_PREFIX@inflateUndermine
+#define inflateValidate       @ZLIB_SYMBOL_PREFIX@inflateValidate
+#define inflate_copyright     @ZLIB_SYMBOL_PREFIX@inflate_copyright
+#define inflate_fast          @ZLIB_SYMBOL_PREFIX@inflate_fast
+#define inflate_table         @ZLIB_SYMBOL_PREFIX@inflate_table
+#ifndef Z_SOLO
+#  define uncompress            @ZLIB_SYMBOL_PREFIX@uncompress
+#  define uncompress2           @ZLIB_SYMBOL_PREFIX@uncompress2
+#endif
+#define zError                @ZLIB_SYMBOL_PREFIX@zError
+#ifndef Z_SOLO
+#  define zcalloc               @ZLIB_SYMBOL_PREFIX@zcalloc
+#  define zcfree                @ZLIB_SYMBOL_PREFIX@zcfree
+#endif
+#define zlibCompileFlags      @ZLIB_SYMBOL_PREFIX@zlibCompileFlags
+#define zlibVersion           @ZLIB_SYMBOL_PREFIX@zlibVersion
+
+/* all zlib typedefs in zlib.h and zconf.h */
+#define Byte                  @ZLIB_SYMBOL_PREFIX@Byte
+#define Bytef                 @ZLIB_SYMBOL_PREFIX@Bytef
+#define alloc_func            @ZLIB_SYMBOL_PREFIX@alloc_func
+#define charf                 @ZLIB_SYMBOL_PREFIX@charf
+#define free_func             @ZLIB_SYMBOL_PREFIX@free_func
+#ifndef Z_SOLO
+#  define gzFile                @ZLIB_SYMBOL_PREFIX@gzFile
+#endif
+#define gz_header             @ZLIB_SYMBOL_PREFIX@gz_header
+#define gz_headerp            @ZLIB_SYMBOL_PREFIX@gz_headerp
+#define in_func               @ZLIB_SYMBOL_PREFIX@in_func
+#define intf                  @ZLIB_SYMBOL_PREFIX@intf
+#define out_func              @ZLIB_SYMBOL_PREFIX@out_func
+#define uInt                  @ZLIB_SYMBOL_PREFIX@uInt
+#define uIntf                 @ZLIB_SYMBOL_PREFIX@uIntf
+#define uLong                 @ZLIB_SYMBOL_PREFIX@uLong
+#define uLongf                @ZLIB_SYMBOL_PREFIX@uLongf
+#define voidp                 @ZLIB_SYMBOL_PREFIX@voidp
+#define voidpc                @ZLIB_SYMBOL_PREFIX@voidpc
+#define voidpf                @ZLIB_SYMBOL_PREFIX@voidpf
+
+/* all zlib structs in zlib.h and zconf.h */
+#define gz_header_s           @ZLIB_SYMBOL_PREFIX@gz_header_s
+#define internal_state        @ZLIB_SYMBOL_PREFIX@internal_state
+
+/* all zlib structs in zutil.h */
+#define z_errmsg              @ZLIB_SYMBOL_PREFIX@z_errmsg
+
+#endif /* ZLIB_NAME_MANGLING_H */