Enable the use of the zlib compress library when storing
I/O log files. If specified, location is the base directory
containing the zlib include and lib directories. The special
- values "system" and "builtin" can be used to indicate that
- the system version of zlib should be used or that the version
- of zlib shipped with sudo should be used instead.
- If this option is not specified, configure will use the
- system zlib if it is present.
+ values "system", "builtin", "shared" and "static" can be
+ used to indicate that the system version of zlib should be
+ used or that the version of zlib shipped with sudo should
+ be used instead. If "static" is specified, sudo will
+ statically link the builtin zlib and not install it. If
+ this option is not specified, configure will use the system
+ zlib if it is present, falling back on the sudo version.
--with-incpath=DIR
Adds the specified directory (or directories) to CPPFLAGS
LT_LDEXPORTS
LT_LDDEP
LT_LDFLAGS
+ZLIB_LDFLAGS
LIBUTIL_LDFLAGS
SUDOERS_LDFLAGS
LDFLAGS
+
#
ZLIB="-lz"
;;
- builtin)
+ static|shared|builtin)
# handled below
;;
*)
ZLIB="${ZLIB} -lz"
;;
esac
-if test X"$enable_zlib" = X"builtin"; then
- $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h
+case "$enable_zlib" in
+ builtin|static|dynamic)
+ $as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h
- CPPFLAGS='-I$(top_builddir)/lib/zlib -I$(top_srcdir)/lib/zlib '"${CPPFLAGS}"
- ZLIB="${ZLIB}"' $(top_builddir)/lib/zlib/libz.la'
- ZLIB_SRC=lib/zlib
- ac_config_headers="$ac_config_headers lib/zlib/zconf.h"
+ CPPFLAGS='-I$(top_builddir)/lib/zlib -I$(top_srcdir)/lib/zlib '"${CPPFLAGS}"
+ ZLIB="${ZLIB}"' $(top_builddir)/lib/zlib/libsudo_z.la'
+ ZLIB_SRC=lib/zlib
+ ac_config_headers="$ac_config_headers lib/zlib/zconf.h"
- ac_config_files="$ac_config_files lib/zlib/Makefile"
+ ac_config_files="$ac_config_files lib/zlib/Makefile"
-fi
+ if test X"$enable_shared" = X"no" -o "$enable_zlib" = "static"; then
+ if test "$enable_zlib" = "shared"; then
+ as_fn_error $? "\"Unable to build shared libraries on this system\"" "$LINENO" 5
+ fi
+ # Build as convenience library
+ ZLIB_LDFLAGS=-no-install
+ fi
+ ;;
+esac
ac_fn_c_check_decl "$LINENO" "errno" "ac_cv_have_decl_errno" "
$ac_includes_default
AC_SUBST([LDFLAGS])
AC_SUBST([SUDOERS_LDFLAGS])
AC_SUBST([LIBUTIL_LDFLAGS])
+AC_SUBST([ZLIB_LDFLAGS])
AC_SUBST([LT_LDFLAGS])
AC_SUBST([LT_LDDEP])
AC_SUBST([LT_LDEXPORTS])
AC_DEFINE(HAVE_ZLIB_H)
ZLIB="-lz"
;;
- builtin)
+ static|shared|builtin)
# handled below
;;
*)
ZLIB="${ZLIB} -lz"
;;
esac
-if test X"$enable_zlib" = X"builtin"; then
- AC_DEFINE(HAVE_ZLIB_H)
- CPPFLAGS='-I$(top_builddir)/lib/zlib -I$(top_srcdir)/lib/zlib '"${CPPFLAGS}"
- ZLIB="${ZLIB}"' $(top_builddir)/lib/zlib/libz.la'
- ZLIB_SRC=lib/zlib
- AC_CONFIG_HEADER([lib/zlib/zconf.h])
- AC_CONFIG_FILES([lib/zlib/Makefile])
-fi
+case "$enable_zlib" in
+ builtin|static|dynamic)
+ AC_DEFINE(HAVE_ZLIB_H)
+ CPPFLAGS='-I$(top_builddir)/lib/zlib -I$(top_srcdir)/lib/zlib '"${CPPFLAGS}"
+ ZLIB="${ZLIB}"' $(top_builddir)/lib/zlib/libsudo_z.la'
+ ZLIB_SRC=lib/zlib
+ AC_CONFIG_HEADER([lib/zlib/zconf.h])
+ AC_CONFIG_FILES([lib/zlib/Makefile])
+ if test X"$enable_shared" = X"no" -o "$enable_zlib" = "static"; then
+ if test "$enable_zlib" = "shared"; then
+ AC_MSG_ERROR(["Unable to build shared libraries on this system"])
+ fi
+ # Build as convenience library
+ ZLIB_LDFLAGS=-no-install
+ fi
+ ;;
+esac
dnl
dnl Check for errno declaration in errno.h
top_srcdir = @top_srcdir@
cross_compiling = @CROSS_COMPILING@
+# Where to install things...
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+sbindir = @sbindir@
+sysconfdir = @sysconfdir@
+libexecdir = @libexecdir@
+datarootdir = @datarootdir@
+localstatedir = @localstatedir@
+
+# File extension, mode and map file to use for shared libraries/objects
+shlib_enable = @SHLIB_ENABLE@
+shlib_mode = @SHLIB_MODE@
+shlib_exp = ./zlib.exp
+shlib_map = zlib.map
+shlib_opt = zlib.opt
+
# Compiler & tools to use
CC = @CC@
LIBTOOL = @LIBTOOL@
+# Our install program supports extra flags...
+INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
+INSTALL_OWNER = -o $(install_uid) -g $(install_gid)
+
# C preprocessor flags
CPPFLAGS = -I. -I$(srcdir)
# Usually -O and/or -g
CFLAGS = @CFLAGS@
+# Flags to pass to the link stage
+LT_LDFLAGS = @ZLIB_LDFLAGS@
+LDFLAGS =
+
+# PIE flags
+PIE_CFLAGS = @PIE_CFLAGS@
+PIE_LDFLAGS = @PIE_LDFLAGS@
+
+# Stack smashing protection flags
+SSP_CFLAGS = @SSP_CFLAGS@
+SSP_LDFLAGS = @SSP_LDFLAGS@
+
+# Libtool style shared library version
+SHLIB_VERSION = 0:0:0
+
+# User and group ids the installed files should be "owned" by
+install_uid = 0
+install_gid = 0
+
# OS dependent defines
DEFS = @OSDEFS@
gzread.lo gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo \
trees.lo uncompr.lo zutil.lo
-all: libz.la
+all: libsudo_z.la
Makefile: $(srcdir)/Makefile.in
(cd $(top_builddir) && ./config.status --file lib/zlib/Makefile)
.SUFFIXES: .c .h .lo
.c.lo:
- $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(DEFS) $<
+ $(LIBTOOL) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(DEFS) $<
+
+$(shlib_map): $(shlib_exp)
+ @awk 'BEGIN { print "{\n\tglobal:" } { print "\t\t"$$0";" } END { print "\tlocal:\n\t\t*;\n};" }' $(shlib_exp) > $@
+
+$(shlib_opt): $(shlib_exp)
+ @$(SED) 's/^/+e /' $(shlib_exp) > $@
-libz.la: $(LTOBJS)
- $(LIBTOOL) --mode=link $(CC) -o $@ $(LTOBJS) -no-install
+libsudo_z.la: $(LTOBJS)
+ case "$(LT_LDFLAGS)" in \
+ *-no-install*) \
+ $(LIBTOOL) --mode=link $(CC) -o $@ $(LDFLAGS) $(LT_LDFLAGS) $(LTOBJS);; \
+ *) \
+ $(LIBTOOL) --mode=link $(CC) -o $@ $(LDFLAGS) $(LT_LDFLAGS) $(LTOBJS) -version-info $(SHLIB_VERSION) -rpath $(libexecdir)/sudo;; \
+ esac
pre-install:
install:
+ case "$(LT_LDFLAGS)" in \
+ *-no-install*) ;; \
+ *) if [ X"$(shlib_enable)" = X"yes" ]; then \
+ INSTALL_BACKUP='~' $(LIBTOOL) --quiet --mode=install $(INSTALL) $(INSTALL_OWNER) libsudo_z.la $(DESTDIR)$(libexecdir)/sudo; \
+ fi;; \
+ esac
install-dirs:
install-plugin:
uninstall:
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libexecdir)/sudo/libsudo_z.la
cppcheck:
#define ZCONF_H
/* The following four defines are enabled by sudo's configure script. */
+#undef HAVE_DSO_VISIBILITY
+#undef HAVE_MEMCPY
#undef HAVE_UNISTD_H
#undef HAVE_VSNPRINTF
-#undef HAVE_MEMCPY
#undef _FILE_OFFSET_BITS
#undef _LARGE_FILES
#undef const
+/* We build sudo and its libs with -fvisibility=hidden where supported. */
+#ifdef HAVE_DSO_VISIBILITY
+# if defined(__GNUC__)
+# define ZEXTERN extern __attribute__((__visibility__("default")))
+# elif defined(__SUNPRO_C)
+# define ZEXTERN extern __global
+# elif defined(ZLIB_INTERNAL)
+# define ZEXTERN extern __declspec(dllexport)
+# else
+# define ZEXTERN extern __declspec(dllimport)
+# endif
+#endif
+
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.