]> granicus.if.org Git - sudo/commitdiff
Check for zlib.h in addition to libz.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 16 Jun 2010 20:40:02 +0000 (16:40 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 16 Jun 2010 20:40:02 +0000 (16:40 -0400)
--HG--
branch : 1.7

config.h.in
configure
configure.in
defaults.c
iolog.c
sudoreplay.c

index 792b40c5e36e7c0c17eb49d389badbf394be0edb..36f488f521db049aef69a99ec3eb1e200b3db7ed 100644 (file)
 /* Define to 1 if you have the `waitpid' function. */
 #undef HAVE_WAITPID
 
-/* Define to 1 if you the `zlib' library. */
-#undef HAVE_ZLIB
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
 
 /* Define to 1 if you have the `_getpty' function. */
 #undef HAVE__GETPTY
index 5b854c47c97c481bc29f7150c461a97e9da5ede1..7613516c7d6959d02815e26f699eaa4c29615a68 100755 (executable)
--- a/configure
+++ b/configure
@@ -18059,12 +18059,12 @@ _ACEOF
        # Check whether --enable-zlib was given.
 if test "${enable_zlib+set}" = set; then :
   enableval=$enable_zlib;  case "$enableval" in
-           yes)    $as_echo "#define HAVE_ZLIB 1" >>confdefs.h
+           yes)    $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h
 
                    ZLIB="-lz"
                    ;;
            no)     ;;
-           *)      $as_echo "#define HAVE_ZLIB 1" >>confdefs.h
+           *)      $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h
 
                    CPPFLAGS="${CPPFLAGS} -I${enableval}/include"
 
 $as_echo "$ac_cv_lib_z_gzdopen" >&6; }
 if test "x$ac_cv_lib_z_gzdopen" = x""yes; then :
 
-               $as_echo "#define HAVE_ZLIB 1" >>confdefs.h
+               for ac_header in zlib.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_zlib_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_ZLIB_H 1
+_ACEOF
+ ZLIB="-lz"
+fi
+
+done
 
-               ZLIB="-lz"
 
 fi
 
@@ -20467,8 +20476,6 @@ fi
 
 
 
-
-
 
 
 
index 2ad34a48af701178f484794b40a171cd0cbb6191..ee956112d16a32b1bfc27a275fca1226a75067f7 100644 (file)
@@ -2669,11 +2669,11 @@ if test "${with_iologdir-yes}" != "no"; then
        AC_ARG_ENABLE(zlib,
        [AS_HELP_STRING([--enable-zlib[[=PATH]]], [Whether to enable or disable zlib])],
        [ case "$enableval" in
-           yes)    AC_DEFINE(HAVE_ZLIB)
+           yes)    AC_DEFINE(HAVE_ZLIB_H)
                    ZLIB="-lz"
                    ;;
            no)     ;;
-           *)      AC_DEFINE(HAVE_ZLIB)
+           *)      AC_DEFINE(HAVE_ZLIB_H)
                    CPPFLAGS="${CPPFLAGS} -I${enableval}/include"
                    SUDO_APPEND_LIBPATH(ZLIB, [$enableval/lib])
                    ZLIB="${ZLIB} -lz"
@@ -2682,8 +2682,7 @@ if test "${with_iologdir-yes}" != "no"; then
        ])
        if test X"$enable_zlib" = X""; then
            AC_CHECK_LIB(z, gzdopen, [
-               AC_DEFINE(HAVE_ZLIB)
-               ZLIB="-lz"
+               AC_CHECK_HEADERS(zlib.h, [ZLIB="-lz"])
            ])
        fi
     ], [
@@ -2856,7 +2855,6 @@ AH_TEMPLATE(WITHOUT_PASSWD, [Define to avoid using the passwd/shadow file for au
 AH_TEMPLATE(sig_atomic_t, [Define to `int' if <signal.h> does not define.])
 AH_TEMPLATE(__signed, [Define to `signed' or nothing if compiler does not support a signed type qualifier.])
 AH_TEMPLATE(USING_NONUNIX_GROUPS, [Define to 1 if using a non-Unix group lookup implementation.])
-AH_TEMPLATE(HAVE_ZLIB, [Define to 1 if you the `zlib' library.])
 
 dnl
 dnl Bits to copy verbatim into config.h.in
index 247167795e348a1c4ad5545db20ddd19fe30dbb4..daa30019f46d759a01d524025a5f167df347add4 100644 (file)
@@ -469,7 +469,7 @@ init_defaults()
     def_timestamp_timeout = TIMEOUT;
     def_passwd_timeout = PASSWORD_TIMEOUT;
     def_passwd_tries = TRIES_FOR_PASSWORD;
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     def_compress_io = TRUE;
 #endif
 
diff --git a/iolog.c b/iolog.c
index e67bd3fed5da5b967d16107cf13d5b84c8bd08f6..3391a76ca0c5fa3aa973a66c5e9b2e6433aaba8e 100644 (file)
--- a/iolog.c
+++ b/iolog.c
@@ -47,7 +47,7 @@
 #include <signal.h>
 #include <pwd.h>
 #include <grp.h>
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
 # include <zlib.h>
 #endif
 
@@ -55,7 +55,7 @@
 
 union io_fd {
     FILE *f;
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     gzFile g;
 #endif
     void *v;
@@ -206,7 +206,7 @@ open_io_fd(pathbuf, len, suffix, docompress)
     fd = open(pathbuf, O_CREAT|O_EXCL|O_WRONLY, S_IRUSR|S_IWUSR);
     if (fd != -1) {
        fcntl(fd, F_SETFD, FD_CLOEXEC);
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
        if (docompress)
            vfd = gzdopen(fd, "w");
        else
@@ -307,7 +307,7 @@ io_log_close()
     for (i = 0; i < IOFD_MAX; i++) {
        if (io_fds[i].v == NULL)
            continue;
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
        if (def_compress_io)
            gzclose(io_fds[i].g);
        else
@@ -329,7 +329,7 @@ log_io(buf, len, idx)
 
     sigprocmask(SIG_BLOCK, &ttyblock, &omask);
 
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     if (def_compress_io)
        gzwrite(io_fds[idx].g, buf, len);
     else
@@ -338,7 +338,7 @@ log_io(buf, len, idx)
     delay.tv_sec = now.tv_sec;
     delay.tv_usec = now.tv_usec;
     timevalsub(&delay, &last_time);
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     if (def_compress_io)
        gzprintf(io_fds[IOFD_TIMING].g, "%d %f %d\n", idx,
            delay.tv_sec + ((double)delay.tv_usec / 1000000), len);
index 357f1a2a5444eb6db84d09e95567807f42a6f917..75dbc8e4032d6c187e23a5c2d4bb6184cb239352 100644 (file)
@@ -76,7 +76,7 @@
 #ifdef HAVE_REGCOMP
 # include <regex.h>
 #endif
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
 # include <zlib.h>
 #endif
 #include <signal.h>
@@ -110,7 +110,7 @@ char **Argv;
 
 union io_fd {
     FILE *f;
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     gzFile g;
 #endif
     void *v;
@@ -341,7 +341,7 @@ main(argc, argv)
     /*
      * Timing file consists of line of the format: "%f %d\n"
      */
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     while (gzgets(io_fds[IOFD_TIMING].g, buf, sizeof(buf)) != NULL) {
 #else
     while (fgets(buf, sizeof(buf), io_fds[IOFD_TIMING].f) != NULL) {
@@ -383,7 +383,7 @@ main(argc, argv)
                len = sizeof(buf);
            else
                len = nbytes;
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
            nread = gzread(io_fds[idx].g, buf, len);
 #else
            nread = fread(buf, 1, len, io_fds[idx].f);
@@ -444,7 +444,7 @@ open_io_fd(char *path, int len, const char *suffix)
     path[len] = '\0';
     strlcat(path, suffix, PATH_MAX);
 
-#ifdef HAVE_ZLIB
+#ifdef HAVE_ZLIB_H
     return gzopen(path, "r");
 #else
     return fopen(path, "r");