> I defined HAVE_UNISTD_H right before #include "zlib.h", in
> wtap.h and file.h, it did not work.
>
> I undefined HAVE_UNISTD_H right before #include "zlib.h", in
> wtap.h and file.h, it did not work.
FreeBSD's "/usr/include/zlib.h" includes "zconf.h"; FreeBSD's
"/usr/include/zconf.h" does:
#ifdef HAVE_UNISTD_H
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
which means that, on 4.4-Lite-based systems like {Free,Net,Open}BSD,
"z_off_t" is a "long long" if HAVE_UNISTD_H is defined and a "long" if
it's not.
It's not defined when the FreeBSD "zlib" is built, so if HAVE_UNISTD_H
is defined, "zlib.h" misdeclares "gzseek()":
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
It sounds as if NetBSD has even worse problems. You might want to
suggest to the NetBSD folk that they discuss this with the FreeBSD and
OpenBSD folk as well (I already mentioned this to Jordan Hubbard of the
FreeBSD team; he forwarded it, in turn, to another guy on the FreeBSD
team, but I haven't heard anything about it since then), so that they
can at least try to come up with the same fix.
> It seems I need to turn off zlib support anyway. Isn't it safer
> for ethereal to distribute trustable zlib code in its tarball?
If some of the BSDs are broken in ways that can't be worked around with
the "don't define HAVE_UNISTD_H" hack I put in to work around the
FreeBSD problem, that might be what we have to do.
(I'm surprised that it worked with 0.7.5, though - 0.7.5 was the release
we put out when I discovered the FreeBSD breakage and changed the
Wiretap configuration file not to check whether <unistd.h> existed, and
I don't think we changed that stuff since 0.7.5.)