Merge branch 'ds/maint-deflatebound'
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Nov 2007 02:17:20 +0000 (18:17 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Nov 2007 02:17:20 +0000 (18:17 -0800)
* ds/maint-deflatebound:
Improve accuracy of check for presence of deflateBound.

1  2 
Makefile
cache.h
configure.ac
diff --combined Makefile
index cf8ec49d12d59bd0c00f55b4030ebdee146eefeb,783cd5bf6036379d2f17fea76b083679f0b02fd7..0d5590f6cfdd3d6c567eff9d38322071fbba4b9e
+++ b/Makefile
@@@ -28,8 -28,6 +28,8 @@@ all:
  #
  # Define NO_STRCASESTR if you don't have strcasestr.
  #
 +# Define NO_MEMMEM if you don't have memmem.
 +#
  # Define NO_STRLCPY if you don't have strlcpy.
  #
  # Define NO_STRTOUMAX if you don't have strtoumax in the C library.
@@@ -38,8 -36,6 +38,8 @@@
  #
  # Define NO_SETENV if you don't have setenv in the C library.
  #
 +# Define NO_MKDTEMP if you don't have mkdtemp in the C library.
 +#
  # Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link.
  # Enable it on Windows.  By default, symrefs are still used.
  #
@@@ -98,6 -94,8 +98,8 @@@
  # Define OLD_ICONV if your library has an old iconv(), where the second
  # (input buffer pointer) parameter is declared with type (const char **).
  #
+ # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
+ #
  # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
  # that tells runtime paths to dynamic libraries;
  # "-Wl,-rpath=/path/lib" is used instead.
  # If not set it defaults to the bare 'wish'. If it is set to the empty
  # string then NO_TCLTK will be forced (this is used by configure script).
  #
 +# Define THREADED_DELTA_SEARCH if you have pthreads and wish to exploit
 +# parallel delta searching when packing objects.
 +#
  
  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
        @$(SHELL_PATH) ./GIT-VERSION-GEN
@@@ -167,7 -162,6 +169,7 @@@ GITWEB_CONFIG = gitweb_config.per
  GITWEB_HOME_LINK_STR = projects
  GITWEB_SITENAME =
  GITWEB_PROJECTROOT = /pub/git
 +GITWEB_PROJECT_MAXDEPTH = 2007
  GITWEB_EXPORT_OK =
  GITWEB_STRICT_EXPORT =
  GITWEB_BASE_URL =
@@@ -210,10 -204,11 +212,10 @@@ BASIC_LDFLAGS 
  SCRIPT_SH = \
        git-bisect.sh git-checkout.sh \
        git-clean.sh git-clone.sh git-commit.sh \
 -      git-fetch.sh \
        git-ls-remote.sh \
        git-merge-one-file.sh git-mergetool.sh git-parse-remote.sh \
        git-pull.sh git-rebase.sh git-rebase--interactive.sh \
 -      git-repack.sh git-request-pull.sh git-reset.sh \
 +      git-repack.sh git-request-pull.sh \
        git-sh-setup.sh \
        git-am.sh \
        git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
  SCRIPT_PERL = \
        git-add--interactive.perl \
        git-archimport.perl git-cvsimport.perl git-relink.perl \
 -      git-cvsserver.perl git-remote.perl \
 -      git-svnimport.perl git-cvsexportcommit.perl \
 +      git-cvsserver.perl git-remote.perl git-cvsexportcommit.perl \
        git-send-email.perl git-svn.perl
  
  SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
  
  # ... and all the rest that could be moved out of bindir to gitexecdir
  PROGRAMS = \
 -      git-convert-objects$X git-fetch-pack$X \
 -      git-hash-object$X git-index-pack$X git-local-fetch$X \
 +      git-fetch-pack$X \
 +      git-hash-object$X git-index-pack$X \
        git-fast-import$X \
        git-daemon$X \
        git-merge-index$X git-mktag$X git-mktree$X git-patch-id$X \
        git-peek-remote$X git-receive-pack$X \
        git-send-pack$X git-shell$X \
 -      git-show-index$X git-ssh-fetch$X \
 -      git-ssh-upload$X git-unpack-file$X \
 +      git-show-index$X \
 +      git-unpack-file$X \
        git-update-server-info$X \
        git-upload-pack$X \
        git-pack-redundant$X git-var$X \
@@@ -270,6 -266,9 +272,6 @@@ ifndef NO_TCLT
  OTHER_PROGRAMS += gitk-wish
  endif
  
 -# Backward compatibility -- to be removed after 1.0
 -PROGRAMS += git-ssh-pull$X git-ssh-push$X
 -
  # Set paths to tools early so that they can be used for version tests.
  ifndef SHELL_PATH
        SHELL_PATH = /bin/sh
@@@ -289,7 -288,7 +291,7 @@@ LIB_H = 
        run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
        tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
        utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \
 -      mailmap.h remote.h
 +      mailmap.h remote.h parse-options.h transport.h diffcore.h hash.h
  
  DIFF_OBJS = \
        diff.o diff-lib.o diffcore-break.o diffcore-order.o \
  LIB_OBJS = \
        blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \
        date.o diff-delta.o entry.o exec_cmd.o ident.o \
 -      interpolate.o \
 +      pretty.o interpolate.o hash.o \
        lockfile.o \
        patch-ids.o \
        object.o pack-check.o pack-write.o patch-delta.o path.o pkt-line.o \
        write_or_die.o trace.o list-objects.o grep.o match-trees.o \
        alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
        color.o wt-status.o archive-zip.o archive-tar.o shallow.o utf8.o \
 -      convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o
 +      convert.o attr.o decorate.o progress.o mailmap.o symlinks.o remote.o \
 +      transport.o bundle.o walker.o parse-options.o
  
  BUILTIN_OBJS = \
        builtin-add.o \
        builtin-diff-files.o \
        builtin-diff-index.o \
        builtin-diff-tree.o \
 +      builtin-fetch.o \
 +      builtin-fetch-pack.o \
        builtin-fetch--tool.o \
        builtin-fmt-merge-msg.o \
        builtin-for-each-ref.o \
        builtin-reflog.o \
        builtin-config.o \
        builtin-rerere.o \
 +      builtin-reset.o \
        builtin-rev-list.o \
        builtin-rev-parse.o \
        builtin-revert.o \
@@@ -403,27 -398,23 +405,27 @@@ ifeq ($(uname_S),Darwin
        NEEDS_LIBICONV = YesPlease
        OLD_ICONV = UnfortunatelyYes
        NO_STRLCPY = YesPlease
 +      NO_MEMMEM = YesPlease
  endif
  ifeq ($(uname_S),SunOS)
        NEEDS_SOCKET = YesPlease
        NEEDS_NSL = YesPlease
        SHELL_PATH = /bin/bash
        NO_STRCASESTR = YesPlease
 +      NO_MEMMEM = YesPlease
        NO_HSTRERROR = YesPlease
        ifeq ($(uname_R),5.8)
                NEEDS_LIBICONV = YesPlease
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
 +              NO_MKDTEMP = YesPlease
                NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
        endif
        ifeq ($(uname_R),5.9)
                NO_UNSETENV = YesPlease
                NO_SETENV = YesPlease
 +              NO_MKDTEMP = YesPlease
                NO_C99_FORMAT = YesPlease
                NO_STRTOUMAX = YesPlease
        endif
@@@ -435,7 -426,6 +437,7 @@@ ifeq ($(uname_O),Cygwin
        NO_D_TYPE_IN_DIRENT = YesPlease
        NO_D_INO_IN_DIRENT = YesPlease
        NO_STRCASESTR = YesPlease
 +      NO_MEMMEM = YesPlease
        NO_SYMLINK_HEAD = YesPlease
        NEEDS_LIBICONV = YesPlease
        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
  endif
  ifeq ($(uname_S),FreeBSD)
        NEEDS_LIBICONV = YesPlease
 +      NO_MEMMEM = YesPlease
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
 +      NO_MEMMEM = YesPlease
        NEEDS_LIBICONV = YesPlease
        BASIC_CFLAGS += -I/usr/local/include
        BASIC_LDFLAGS += -L/usr/local/lib
@@@ -470,7 -458,6 +472,7 @@@ ifeq ($(uname_S),NetBSD
  endif
  ifeq ($(uname_S),AIX)
        NO_STRCASESTR=YesPlease
 +      NO_MEMMEM = YesPlease
        NO_STRLCPY = YesPlease
        NEEDS_LIBICONV=YesPlease
  endif
@@@ -482,7 -469,6 +484,7 @@@ ifeq ($(uname_S),IRIX64
        NO_IPV6=YesPlease
        NO_SETENV=YesPlease
        NO_STRCASESTR=YesPlease
 +      NO_MEMMEM = YesPlease
        NO_STRLCPY = YesPlease
        NO_SOCKADDR_STORAGE=YesPlease
        SHELL_PATH=/usr/gnu/bin/bash
@@@ -520,9 -506,7 +522,9 @@@ els
        CC_LD_DYNPATH = -R
  endif
  
 -ifndef NO_CURL
 +ifdef NO_CURL
 +      BASIC_CFLAGS += -DNO_CURL
 +else
        ifdef CURLDIR
                # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
                BASIC_CFLAGS += -I$(CURLDIR)/include
        else
                CURL_LIBCURL = -lcurl
        endif
 -      PROGRAMS += git-http-fetch$X
 +      BUILTIN_OBJS += builtin-http-fetch.o
 +      EXTLIBS += $(CURL_LIBCURL)
 +      LIB_OBJS += http.o http-walker.o
        curl_check := $(shell (echo 070908; curl-config --vernum) | sort -r | sed -ne 2p)
        ifeq "$(curl_check)" "070908"
                ifndef NO_EXPAT
@@@ -614,10 -596,6 +616,10 @@@ ifdef NO_SETEN
        COMPAT_CFLAGS += -DNO_SETENV
        COMPAT_OBJS += compat/setenv.o
  endif
 +ifdef NO_MKDTEMP
 +      COMPAT_CFLAGS += -DNO_MKDTEMP
 +      COMPAT_OBJS += compat/mkdtemp.o
 +endif
  ifdef NO_UNSETENV
        COMPAT_CFLAGS += -DNO_UNSETENV
        COMPAT_OBJS += compat/unsetenv.o
@@@ -661,6 -639,10 +663,10 @@@ ifdef OLD_ICON
        BASIC_CFLAGS += -DOLD_ICONV
  endif
  
+ ifdef NO_DEFLATE_BOUND
+       BASIC_CFLAGS += -DNO_DEFLATE_BOUND
+ endif
  ifdef PPC_SHA1
        SHA1_HEADER = "ppc/sha1.h"
        LIB_OBJS += ppc/sha1.o ppc/sha1ppc.o
@@@ -685,15 -667,6 +691,15 @@@ ifdef NO_HSTRERRO
        COMPAT_CFLAGS += -DNO_HSTRERROR
        COMPAT_OBJS += compat/hstrerror.o
  endif
 +ifdef NO_MEMMEM
 +      COMPAT_CFLAGS += -DNO_MEMMEM
 +      COMPAT_OBJS += compat/memmem.o
 +endif
 +
 +ifdef THREADED_DELTA_SEARCH
 +      BASIC_CFLAGS += -DTHREADED_DELTA_SEARCH
 +      EXTLIBS += -lpthread
 +endif
  
  ifeq ($(TCLTK_PATH),)
  NO_TCLTK=NoThanks
@@@ -842,7 -815,6 +848,7 @@@ gitweb/gitweb.cgi: gitweb/gitweb.per
            -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
            -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
            -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
 +          -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \
            -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
            -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
            -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
@@@ -899,23 -871,35 +905,23 @@@ http.o: http.c GIT-CFLAG
        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DGIT_USER_AGENT='"git/$(GIT_VERSION)"' $<
  
  ifdef NO_EXPAT
 -http-fetch.o: http-fetch.c http.h GIT-CFLAGS
 +http-walker.o: http-walker.c http.h GIT-CFLAGS
        $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_EXPAT $<
  endif
  
  git-%$X: %.o $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
  
 -ssh-pull.o: ssh-fetch.c
 -ssh-push.o: ssh-upload.c
 -git-local-fetch$X: fetch.o
 -git-ssh-fetch$X: rsh.o fetch.o
 -git-ssh-upload$X: rsh.o
 -git-ssh-pull$X: rsh.o fetch.o
 -git-ssh-push$X: rsh.o
 -
  git-imap-send$X: imap-send.o $(LIB_FILE)
  
 -http.o http-fetch.o http-push.o: http.h
 -git-http-fetch$X: fetch.o http.o http-fetch.o $(GITLIBS)
 -      $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
 -              $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
 +http.o http-walker.o http-push.o: http.h
  
  git-http-push$X: revision.o http.o http-push.o $(GITLIBS)
        $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
                $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
  
 -$(LIB_OBJS) $(BUILTIN_OBJS) fetch.o: $(LIB_H)
 +$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
  $(patsubst git-%$X,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
 -$(DIFF_OBJS): diffcore.h
  
  $(LIB_FILE): $(LIB_OBJS)
        $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
@@@ -943,10 -927,6 +949,10 @@@ tags
        $(RM) tags
        $(FIND) . -name '*.[hcS]' -print | xargs ctags -a
  
 +cscope:
 +      $(RM) cscope*
 +      $(FIND) . -name '*.[hcS]' -print | xargs cscope -b
 +
  ### Detect prefix changes
  TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
               $(bindir_SQ):$(gitexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
@@@ -974,7 -954,7 +980,7 @@@ endi
  
  ### Testing rules
  
 -TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X
 +TEST_PROGRAMS = test-chmtime$X test-genrandom$X test-date$X test-delta$X test-sha1$X test-match-trees$X test-absolute-path$X test-parse-options$X
  
  all:: $(TEST_PROGRAMS)
  
@@@ -1096,7 -1076,7 +1102,7 @@@ clean
                $(LIB_FILE) $(XDIFF_LIB)
        $(RM) $(ALL_PROGRAMS) $(BUILT_INS) git$X
        $(RM) $(TEST_PROGRAMS)
 -      $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags
 +      $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags cscope*
        $(RM) -r autom4te.cache
        $(RM) config.log config.mak.autogen config.mak.append config.status config.cache
        $(RM) -r $(GIT_TARNAME) .doc-tmp-dir
@@@ -1114,7 -1094,7 +1120,7 @@@ endi
        $(RM) GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
  
  .PHONY: all install clean strip
 -.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS
 +.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags cscope .FORCE-GIT-CFLAGS
  
  ### Check documentation
  #
@@@ -1125,7 -1105,8 +1131,7 @@@ check-docs:
                git-merge-octopus | git-merge-ours | git-merge-recursive | \
                git-merge-resolve | git-merge-stupid | \
                git-add--interactive | git-fsck-objects | git-init-db | \
 -              git-repo-config | git-fetch--tool | \
 -              git-ssh-pull | git-ssh-push ) continue ;; \
 +              git-repo-config | git-fetch--tool ) continue ;; \
                esac ; \
                test -f "Documentation/$$v.txt" || \
                echo "no doc: $$v"; \
diff --combined cache.h
index 497b9f962db0ca7f7c8dda8e848126e22da6685f,ddc011d1929560288371cd209e267a9b15e502f6..f0a25c7ffcd47d663f2d41cd29dbabc57c2cab93
+++ b/cache.h
@@@ -2,12 -2,11 +2,12 @@@
  #define CACHE_H
  
  #include "git-compat-util.h"
 +#include "strbuf.h"
  
  #include SHA1_HEADER
  #include <zlib.h>
  
- #if ZLIB_VERNUM < 0x1200
+ #if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
  #define deflateBound(c,s)  ((s) + (((s) + 7) >> 3) + (((s) + 63) >> 6) + 11)
  #endif
  
@@@ -222,7 -221,6 +222,7 @@@ extern const char *get_git_work_tree(vo
  #define ALTERNATE_DB_ENVIRONMENT "GIT_ALTERNATE_OBJECT_DIRECTORIES"
  
  extern const char **get_pathspec(const char *prefix, const char **pathspec);
 +extern void setup_work_tree(void);
  extern const char *setup_git_directory_gently(int *);
  extern const char *setup_git_directory(void);
  extern const char *prefix_path(const char *prefix, int len, const char *path);
@@@ -272,6 -270,7 +272,6 @@@ extern int ie_match_stat(struct index_s
  extern int ie_modified(struct index_state *, struct cache_entry *, struct stat *, int);
  extern int ce_path_match(const struct cache_entry *ce, const char **pathspec);
  extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path);
 -extern int read_fd(int fd, char **return_buf, unsigned long *return_size);
  extern int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object);
  extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object);
  extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
@@@ -433,7 -432,6 +433,7 @@@ const char *show_date(unsigned long tim
  int parse_date(const char *date, char *buf, int bufsize);
  void datestamp(char *buf, int bufsize);
  unsigned long approxidate(const char *);
 +enum date_mode parse_date_format(const char *format);
  
  extern const char *git_author_info(int);
  extern const char *git_committer_info(int);
@@@ -494,7 -492,6 +494,7 @@@ struct ref 
        unsigned char old_sha1[20];
        unsigned char new_sha1[20];
        unsigned char force;
 +      unsigned char merge;
        struct ref *peer_ref; /* when renaming */
        char name[FLEX_ARRAY]; /* more */
  };
  #define REF_TAGS      (1u << 2)
  
  #define CONNECT_VERBOSE       (1u << 0)
 -extern pid_t git_connect(int fd[2], char *url, const char *prog, int flags);
 -extern int finish_connect(pid_t pid);
 +extern struct child_process *git_connect(int fd[2], char *url, const char *prog, int flags);
 +extern int finish_connect(struct child_process *conn);
  extern int path_match(const char *path, int nr, char **match);
  extern int get_ack(int fd, unsigned char *result_sha1);
  extern struct ref **get_remote_heads(int in, struct ref **list, int nr_match, char **match, unsigned int flags);
@@@ -533,7 -530,6 +533,7 @@@ extern void *unpack_entry(struct packed
  extern unsigned long unpack_object_header_gently(const unsigned char *buf, unsigned long len, enum object_type *type, unsigned long *sizep);
  extern unsigned long get_size_from_delta(struct packed_git *, struct pack_window **, off_t);
  extern const char *packed_object_info_detail(struct packed_git *, off_t, unsigned long *, unsigned long *, unsigned int *, unsigned char *);
 +extern int matches_pack_name(struct packed_git *p, const char *name);
  
  /* Dumb servers support */
  extern int update_server_info(int);
@@@ -589,13 -585,15 +589,13 @@@ extern void *alloc_object_node(void)
  extern void alloc_report(void);
  
  /* trace.c */
 -extern int nfasprintf(char **str, const char *fmt, ...);
 -extern int nfvasprintf(char **str, const char *fmt, va_list va);
  extern void trace_printf(const char *format, ...);
  extern void trace_argv_printf(const char **argv, int count, const char *format, ...);
  
  /* convert.c */
 -extern char *convert_to_git(const char *path, const char *src, unsigned long *sizep);
 -extern char *convert_to_working_tree(const char *path, const char *src, unsigned long *sizep);
 -extern void *convert_sha1_file(const char *path, const unsigned char *sha1, unsigned int mode, enum object_type *type, unsigned long *size);
 +/* returns 1 if *dst was used */
 +extern int convert_to_git(const char *path, const char *src, size_t len, struct strbuf *dst);
 +extern int convert_to_working_tree(const char *path, const char *src, size_t len, struct strbuf *dst);
  
  /* diff.c */
  extern int diff_auto_refresh_index;
diff --combined configure.ac
index bd80517667ad771362d8fcbc88564ca6ec1b092f,ab516db379c00ce6eefbed1d282fb7ad39cc0654..53e9a17c737e10a51b8b33b9cf258744817e6e9a
@@@ -73,7 -73,7 +73,7 @@@ fi 
  AC_ARG_WITH([lib],
   [AS_HELP_STRING([--with-lib=ARG],
                   [ARG specifies alternative name for lib directory])],
 - [if test "$withval" = "no" -o "$withval" = "yes"; then \
 + [if test "$withval" = "no" || test "$withval" = "yes"; then \
        AC_MSG_WARN([You should provide name for --with-lib=ARG]); \
  else \
        GIT_CONF_APPEND_LINE(lib=$withval); \
@@@ -182,6 -182,26 +182,26 @@@ AC_SUBST(NEEDS_LIBICONV
  AC_SUBST(NO_ICONV)
  test -n "$NEEDS_LIBICONV" && LIBS="$LIBS -liconv"
  #
+ # Define NO_DEFLATE_BOUND if deflateBound is missing from zlib.
+ AC_DEFUN([ZLIBTEST_SRC], [
+ #include <zlib.h>
+ int main(void)
+ {
+       deflateBound(0, 0);
+       return 0;
+ }
+ ])
+ AC_MSG_CHECKING([for deflateBound in -lz])
+ old_LIBS="$LIBS"
+ LIBS="$LIBS -lz"
+ AC_LINK_IFELSE(ZLIBTEST_SRC,
+       [AC_MSG_RESULT([yes])],
+       [AC_MSG_RESULT([no])
+       NO_DEFLATE_BOUND=yes])
+ LIBS="$old_LIBS"
+ AC_SUBST(NO_DEFLATE_BOUND)
+ #
  # Define NEEDS_SOCKET if linking with libc is not enough (SunOS,
  # Patrick Mauritz).
  AC_CHECK_LIB([c], [socket],
@@@ -245,9 -265,9 +265,9 @@@ AC_RUN_IFELSE
        [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
                [[char buf[64];
                if (sprintf(buf, "%lld%hhd%jd%zd%td", (long long int)1, (char)2, (intmax_t)3, (size_t)4, (ptrdiff_t)5) != 5)
 -                exit(1);
 +                return 1;
                else if (strcmp(buf, "12345"))
 -                exit(2);]])],
 +                return 2;]])],
        [ac_cv_c_c99_format=yes],
        [ac_cv_c_c99_format=no])
  ])