From: Todd C. Miller Date: Wed, 1 Oct 2014 20:32:30 +0000 (-0600) Subject: Instead of building libutil statically for --disable-shared-libutil, X-Git-Tag: SUDO_1_8_12^2~170 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b0481fa3639c571ce9c42cef1864cc749a55788;p=sudo Instead of building libutil statically for --disable-shared-libutil, just treat it as a convenience library. Do the same with sudoers for --enable-static-sudoers. Fixes link errors on Solaris among others when --disable-shared-libutil is used. --- diff --git a/configure b/configure index 7c5714af9..59b884dea 100755 --- a/configure +++ b/configure @@ -781,11 +781,11 @@ SUDO_OBJS SUDOERS_OBJS COMMON_OBJS LT_DEP_LIBS -LT_STATIC_LIBUTIL LT_STATIC LT_LDEXPORTS LT_LDDEP LT_LDFLAGS +LIBUTIL_LDFLAGS SUDOERS_LDFLAGS LDFLAGS CPPFLAGS @@ -22040,11 +22040,10 @@ 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" + # Do not install sudoers or libsudo_util. + SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS}${SUDOERS_LDFLAGS+ }-no-install" + LIBUTIL_LDFLAGS="${LIBUTIL_LDFLAGS}${LIBUTIL_LDFLAGS+ }-no-install" fi -else - LT_STATIC_LIBUTIL="$LT_STATIC" fi # On HP-UX, you cannot dlopen() a shared object that uses pthreads unless diff --git a/configure.ac b/configure.ac index 47713196c..4106f4517 100644 --- a/configure.ac +++ b/configure.ac @@ -21,11 +21,11 @@ AC_SUBST([PROGS]) AC_SUBST([CPPFLAGS]) AC_SUBST([LDFLAGS]) AC_SUBST([SUDOERS_LDFLAGS]) +AC_SUBST([LIBUTIL_LDFLAGS]) AC_SUBST([LT_LDFLAGS]) 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]) @@ -3608,11 +3608,10 @@ 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" + # Do not install sudoers or libsudo_util. + SUDOERS_LDFLAGS="${SUDOERS_LDFLAGS}${SUDOERS_LDFLAGS+ }-no-install" + LIBUTIL_LDFLAGS="${LIBUTIL_LDFLAGS}${LIBUTIL_LDFLAGS+ }-no-install" fi -else - LT_STATIC_LIBUTIL="$LT_STATIC" fi # On HP-UX, you cannot dlopen() a shared object that uses pthreads unless diff --git a/lib/util/Makefile.in b/lib/util/Makefile.in index ad14034be..a65f86325 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_LIBUTIL@ +LIBTOOL = @LIBTOOL@ @LT_STATIC@ SED = @SED@ # Our install program supports extra flags... @@ -60,7 +60,7 @@ CFLAGS = @CFLAGS@ # Flags to pass to the link stage LDFLAGS = @LDFLAGS@ -LT_LDFLAGS = @LT_LDFLAGS@ @LT_LDEXPORTS@ +LT_LDFLAGS = @LIBUTIL_LDFLAGS@ @LT_LDFLAGS@ @LT_LDEXPORTS@ # PIE flags PIE_CFLAGS = @PIE_CFLAGS@ @@ -134,7 +134,12 @@ $(shlib_opt): $(shlib_exp) @$(SED) 's/^/+e /' $(shlib_exp) > $@ libsudo_util.la: $(LTOBJS) @LT_LDDEP@ - $(LIBTOOL) --mode=link $(CC) -o $@ $(LDFLAGS) $(LT_LDFLAGS) $(LTOBJS) -version-info $(SHLIB_VERSION) -rpath $(libexecdir)/sudo @LT_DEP_LIBS@ @LIBDL@ + 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 @LT_DEP_LIBS@ @LIBDL@;; \ + esac siglist.c: mksiglist ./mksiglist > $@ @@ -182,8 +187,8 @@ progname_test: $(PROGNAME_TEST_OBJS) pre-install: install: install-dirs - case "$(LIBTOOL)" in \ - *disable-shared*) ;; \ + case "$(LT_LDFLAGS)" in \ + *-no-install*) ;; \ *) if [ X"$(shlib_enable)" = X"yes" ]; then \ INSTALL_BACKUP='~' $(LIBTOOL) --quiet --mode=install $(INSTALL) $(INSTALL_OWNER) libsudo_util.la $(DESTDIR)$(libexecdir)/sudo; \ fi;; \ diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index 72b2d6906..487314bc2 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -201,7 +201,12 @@ libparsesudoers.la: $(LIBPARSESUDOERS_OBJS) $(LIBTOOL) --mode=link $(CC) -o $@ $(LIBPARSESUDOERS_OBJS) -no-install sudoers.la: $(SUDOERS_OBJS) $(LT_LIBS) libparsesudoers.la @LT_LDDEP@ - $(LIBTOOL) @LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module -avoid-version -rpath $(plugindir) -shrext .so + case "$(LT_LDFLAGS)" in \ + *-no-install*) \ + $(LIBTOOL) @LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module;; \ + *) \ + $(LIBTOOL) @LT_STATIC@ --mode=link $(CC) $(LDFLAGS) $(LT_LDFLAGS) -o $@ $(SUDOERS_OBJS) libparsesudoers.la $(SUDOERS_LIBS) -module -avoid-version -rpath $(plugindir) -shrext .so;; \ + esac visudo: libparsesudoers.la $(VISUDO_OBJS) $(LT_LIBS) $(LIBTOOL) --mode=link $(CC) -o $@ $(VISUDO_OBJS) $(LDFLAGS) $(PIE_LDFLAGS) $(SSP_LDFLAGS) libparsesudoers.la $(LIBS) $(VISUDO_LIBS) @@ -309,9 +314,12 @@ install-doc: install-dirs @LDAP@$(INSTALL) $(INSTALL_OWNER) -m 0755 $(srcdir)/sudoers2ldif $(DESTDIR)$(docdir) install-plugin: sudoers.la install-dirs - if [ X"$(shlib_enable)" = X"yes" ]; then \ - INSTALL_BACKUP='~' $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_OWNER) -m $(shlib_mode) sudoers.la $(DESTDIR)$(plugindir); \ - fi + case "$(LT_LDFLAGS)" in \ + *-no-install*) ;; \ + *) if [ X"$(shlib_enable)" = X"yes" ]; then \ + INSTALL_BACKUP='~' $(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_OWNER) -m $(shlib_mode) sudoers.la $(DESTDIR)$(plugindir); \ + fi;; \ + esac install-sudoers: install-dirs $(INSTALL) -d $(INSTALL_OWNER) -m 0750 $(DESTDIR)$(sudoersdir)/sudoers.d