Prevent invalid inclusions when HAVE_* is set to 0.

When including zconf.h from an external project that already has HAVE_UNISTD_H declared to a non-empty define (in this case =0), the inclusion of unistd.h is incorrectly applied. This breaks inclusion of zlib in several projects on windows and other platforms without unistd.h. This patch changes behaviour so that HAVE_UNISTD_H is checked to see if it is defined as blank or not equal to '0' before inclusion of the header.
pull/493/head
Matt Oliver 5 years ago
parent d71dc66fa8
commit 88baa583b9
  1. 12
      zconf.h.cmakein
  2. 12
      zconf.h.in

@ -434,11 +434,19 @@ typedef uLong FAR uLongf;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1
# define Z_HAVE_UNISTD_H
# elif HAVE_UNISTD_H != 0
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1
# define Z_HAVE_STDARG_H
# elif HAVE_STDARG_H != 0
# define Z_HAVE_STDARG_H
# endif
#endif
#ifdef STDC

@ -432,11 +432,19 @@ typedef uLong FAR uLongf;
#endif
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
# if ~(~HAVE_UNISTD_H + 0) == 0 && ~(~HAVE_UNISTD_H + 1) == 1
# define Z_HAVE_UNISTD_H
# elif HAVE_UNISTD_H != 0
# define Z_HAVE_UNISTD_H
# endif
#endif
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
# if ~(~HAVE_STDARG_H + 0) == 0 && ~(~HAVE_STDARG_H + 1) == 1
# define Z_HAVE_STDARG_H
# elif HAVE_STDARG_H != 0
# define Z_HAVE_STDARG_H
# endif
#endif
#ifdef STDC

Loading…
Cancel
Save