From: Todd C. Miller Date: Fri, 8 Aug 2014 17:03:24 +0000 (-0600) Subject: Add --disable-shared-libutil configure option. It may only be used X-Git-Tag: SUDO_1_8_11^2~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76a6dad4249b290635818dff5cf69482c1582a11;p=sudo Add --disable-shared-libutil configure option. It may only be used in conjunction with the --enable-static-sudoers option. --- diff --git a/INSTALL b/INSTALL index ba2b278e6..d2b030b8c 100644 --- a/INSTALL +++ b/INSTALL @@ -193,6 +193,15 @@ Compilation options: not prevent other plugins from being used and the noexec option will continue to function. + --disable-shared-libutil + Disable the use of the dynamic libsudo_util library. By + default, sudo, the sudoers plugin and the associated sudo + utilities are linked against a shared version of libsudo_util. + If the --disable-shared-libutil option is specified, a + static version of the libsudo_util library will be used + instead. This option may only be used in conjunction with + the --enable-static-sudoers option. + --enable-zlib[=location] Enable the use of the zlib compress library when storing I/O log files. If specified, location is the base directory diff --git a/NEWS b/NEWS index fef3e09d9..9064a67af 100644 --- a/NEWS +++ b/NEWS @@ -30,7 +30,9 @@ What's new in Sudo 1.8.11 that of other gettext-enabled packages. * Sudo and its associated programs now link against a shared version - of libsudo_util. + of libsudo_util. The --disable-shared-libutil configure option + may be used to force static linking if the --enable-static-sudoers + option is also specified. * It is now possible to match an environment variable's value as well as its name using env_keep and env_check. This can be used diff --git a/configure b/configure index 206fdc05d..684700370 100755 --- a/configure +++ b/configure @@ -780,6 +780,7 @@ SUDO_OBJS SUDOERS_OBJS COMMON_OBJS LT_DEP_LIBS +LT_STATIC_LIBUTIL LT_STATIC LT_LDEXPORTS LT_LDDEP @@ -937,6 +938,7 @@ enable_admin_flag enable_nls enable_rpath enable_static_sudoers +enable_shared_libutil with_selinux enable_gss_krb5_ccache_name enable_shared @@ -1605,6 +1607,8 @@ Optional Features: --disable-rpath Disable passing of -Rpath to the linker --enable-static-sudoers Build the sudoers policy module as part of the sudo binary instead as a plugin + --disable-shared-libutil + Disable use of the libsudo_util shared library. --enable-gss-krb5-ccache-name Use GSS-API to set the Kerberos V cred cache name --enable-shared[=PKGS] build shared libraries [default=yes] @@ -2976,6 +2980,7 @@ $as_echo "$as_me: Configuring Sudo version $PACKAGE_VERSION" >&6;} + # @@ -5794,6 +5799,14 @@ else fi +# Check whether --enable-shared_libutil was given. +if test "${enable_shared_libutil+set}" = set; then : + enableval=$enable_shared_libutil; +else + enable_shared_libutil=yes +fi + + # Check whether --with-selinux was given. if test "${with_selinux+set}" = set; then : @@ -22047,6 +22060,21 @@ case "$lt_cv_dlopen" in ;; esac +# +# We can only disable linking with the shared libsudo_util if +# sudoers is linked statically too. +# +if test "$enable_shared_libutil" = "no"; then + if test X"$STATIC_SUDOERS" = X""; then + as_fn_error $? "\"--disable-shared-libutil may only be specified with --enable-static-sudoers or when dynamic linking is disabled.\"" "$LINENO" 5 + else + # Disable use shared version of libsudo_util. + LT_STATIC_LIBUTIL="--tag=disable-shared" + fi +else + LT_STATIC_LIBUTIL="$LT_STATIC" +fi + # On HP-UX, you cannot dlopen() a shared object that uses pthreads unless # the main program is linked against -lpthread. We have no knowledge of # what libraries a plugin may depend on (e.g. HP-UX LDAP which uses pthreads) diff --git a/configure.ac b/configure.ac index 31db4d9a8..55729b83e 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,7 @@ AC_SUBST([LT_LDOPT]) AC_SUBST([LT_LDDEP]) AC_SUBST([LT_LDEXPORTS]) AC_SUBST([LT_STATIC]) +AC_SUBST([LT_STATIC_LIBUTIL]) AC_SUBST([LT_DEP_LIBS]) AC_SUBST([COMMON_OBJS]) AC_SUBST([SUDOERS_OBJS]) @@ -1454,6 +1455,10 @@ AC_ARG_ENABLE(static-sudoers, [AS_HELP_STRING([--enable-static-sudoers], [Build the sudoers policy module as part of the sudo binary instead as a plugin])], [], [enable_static_sudoers=no]) +AC_ARG_ENABLE(shared_libutil, +[AS_HELP_STRING([--disable-shared-libutil], [Disable use of the libsudo_util shared library.])], +[], [enable_shared_libutil=yes]) + AC_ARG_WITH(selinux, [AS_HELP_STRING([--with-selinux], [enable SELinux support])], [case $with_selinux in yes) SELINUX_USAGE="[[-r role]] [[-t type]] " @@ -3611,6 +3616,21 @@ case "$lt_cv_dlopen" in ;; esac +# +# We can only disable linking with the shared libsudo_util if +# sudoers is linked statically too. +# +if test "$enable_shared_libutil" = "no"; then + if test X"$STATIC_SUDOERS" = X""; then + AC_MSG_ERROR(["--disable-shared-libutil may only be specified with --enable-static-sudoers or when dynamic linking is disabled."]) + else + # Disable use shared version of libsudo_util. + LT_STATIC_LIBUTIL="--tag=disable-shared" + fi +else + LT_STATIC_LIBUTIL="$LT_STATIC" +fi + # On HP-UX, you cannot dlopen() a shared object that uses pthreads unless # the main program is linked against -lpthread. We have no knowledge of # what libraries a plugin may depend on (e.g. HP-UX LDAP which uses pthreads) diff --git a/lib/util/Makefile.in b/lib/util/Makefile.in index 53df7c1ec..ee7158c30 100644 --- a/lib/util/Makefile.in +++ b/lib/util/Makefile.in @@ -45,7 +45,7 @@ shlib_opt = util.opt # Compiler & tools to use CC = @CC@ -LIBTOOL = @LIBTOOL@ @LT_STATIC@ +LIBTOOL = @LIBTOOL@ @LT_STATIC_LIBUTIL@ SED = @SED@ # Our install program supports extra flags... @@ -182,9 +182,12 @@ progname_test: $(PROGNAME_TEST_OBJS) pre-install: install: install-dirs - if [ X"$(shlib_enable)" = X"yes" ]; then \ - INSTALL_BACKUP='~' $(LIBTOOL) --quiet --mode=install $(INSTALL) $(INSTALL_OWNER) libsudo_util.la $(DESTDIR)$(libexecdir)/sudo; \ - fi + case "$(LIBTOOL)" in \ + *disable-shared*) ;; \ + *) if [ X"$(shlib_enable)" = X"yes" ]; then \ + INSTALL_BACKUP='~' $(LIBTOOL) --quiet --mode=install $(INSTALL) $(INSTALL_OWNER) libsudo_util.la $(DESTDIR)$(libexecdir)/sudo; \ + fi;; \ + esac install-dirs: $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libexecdir)/sudo