From: Andrew Deason Date: Wed, 23 Oct 2019 20:46:16 +0000 (-0500) Subject: Do not build shared-only libs for --disable-shared X-Git-Tag: openafs-devel-1_9_0~173 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=10d176afd23bbf684017a7946dffb1d592ea04fa Do not build shared-only libs for --disable-shared Commit 0f1e54c4 (Pass -shared when linking some shared libraries) changed some of our linking rules to pass -shared to libtool when linking. When building with the --disable-shared configure option, this causes those linker rules to fail, since shared libraries are disabled. Before commit 0f1e54c4, we could build with --disable-shared successfully. To allow us to build again with --disable-shared, just don't build the relevant shared-only libraries at all, when shared libraries are disabled. To accomplish this, introduce a new substitution variable, SHARED_ONLY, which allows certain lines in Makefiles to become commented-out when shared libraries are disabled. Update all of the shared-only libraries to be built conditionally based on this variable. Except for libuafs.la, which appears to be not referenced by anything. Just remove the rules for that instead. Change-Id: I82084a08d2f9c12ca438bd7b1626e1376159c975 Reviewed-on: https://gerrit.openafs.org/13927 Reviewed-by: Cheyenne Wills Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- diff --git a/src/cf/options.m4 b/src/cf/options.m4 index 0e93ff5..904e097 100644 --- a/src/cf/options.m4 +++ b/src/cf/options.m4 @@ -347,4 +347,12 @@ fi if test "x$enable_pthreaded_ubik" = "xyes"; then ENABLE_PTHREADED_UBIK=yes fi + +dnl If the libtool --disable-shared option is specified, comment out the +dnl @SHARED_ONLY@ lines in our Makefiles. +AS_IF([test x"$enable_shared" = xyes], + [SHARED_ONLY=], + [SHARED_ONLY=#]) +AC_SUBST([SHARED_ONLY]) + ]) diff --git a/src/crypto/hcrypto/Makefile.in b/src/crypto/hcrypto/Makefile.in index 3a2ebdf..9b738e0 100644 --- a/src/crypto/hcrypto/Makefile.in +++ b/src/crypto/hcrypto/Makefile.in @@ -42,9 +42,12 @@ UPSTREAM= ${TOP_SRCDIR}/external/heimdal MODULE_INCLUDE=-I${srcdir} -I${TOP_INCDIR}/hcrypto -I$(UPSTREAM)/hcrypto +@SHARED_ONLY@SHARED_LIBS = libafshcrypto.la +@SHARED_ONLY@SHARED_SHLIBS_TOP = ${TOP_LIBDIR}/libafshcrypto.$(SHLIB_SUFFIX) + all: @hcrypto_all_target@ -all-internal: ${HEADERS} ${TOP_LIBDIR}/libafshcrypto.$(SHLIB_SUFFIX) \ +all-internal: ${HEADERS} $(SHARED_SHLIBS_TOP) \ ${TOP_LIBDIR}/libafshcrypto.a \ ${TOP_LIBDIR}/libafshcrypto_lwp.a @@ -54,14 +57,14 @@ buildtools: ${HEADERS} ${TOP_LIBDIR}/libafshcrypto.a install: @hcrypto_install_target@ -install-internal: libafshcrypto.la libafshcrypto.a - ${LT_INSTALL_DATA} libafshcrypto.la ${DESTDIR}${libdir}/libafshcrypto.la - ${RM} ${DESTDIR}${libdir}/libafshcrypto.la +install-internal: $(SHARED_LIBS) libafshcrypto.a + @SHARED_ONLY@${LT_INSTALL_DATA} libafshcrypto.la ${DESTDIR}${libdir}/libafshcrypto.la + @SHARED_ONLY@${RM} ${DESTDIR}${libdir}/libafshcrypto.la ${INSTALL_DATA} libafshcrypto.a ${DESTDIR}${libdir}/libafshcrypto.a -dest: libafshcrypto.la libafshcrypto.a - ${LT_INSTALL_DATA} libafshcrypto.la ${DEST}/lib/libafshcrypto.la - ${RM} ${DEST}/lib/libafshcrypto.la +dest: $(SHARED_LIBS) libafshcrypto.a + @SHARED_ONLY@${LT_INSTALL_DATA} libafshcrypto.la ${DEST}/lib/libafshcrypto.la + @SHARED_ONLY@${RM} ${DEST}/lib/libafshcrypto.la ${INSTALL_DATA} libafshcrypto.a ${DEST}/lib/libafshcrypto.a clean: @@ -80,8 +83,8 @@ libafshcrypto.a: $(LT_objs) libafshcrypto_lwp.a: $(LT_objs) $(LT_LDLIB_lwp) $(LT_objs) -test_cipher: test_cipher.lo libafshcrypto.la - $(LT_LDRULE_static) test_cipher.lo libafshcrypto.la +test_cipher: test_cipher.lo libafshcrypto.a + $(LT_LDRULE_static) test_cipher.lo libafshcrypto.a ${TOP_INCDIR}/hcrypto/aes.h: ${UPSTREAM}/hcrypto/aes.h ${INSTALL_DATA} $? $@ diff --git a/src/kopenafs/Makefile.in b/src/kopenafs/Makefile.in index 111393d..1ece14e 100644 --- a/src/kopenafs/Makefile.in +++ b/src/kopenafs/Makefile.in @@ -24,7 +24,10 @@ MODULE_INCLUDE = -I. -I${srcdir} -I../sys SFLAGS = -I${TOP_INCDIR} SYS = ${srcdir}/../sys -all: ${TOP_LIBDIR}/libkopenafs.${SHLIB_SUFFIX} ${TOP_LIBDIR}/libkopenafs.a \ +@SHARED_ONLY@SHARED_LIBS = libkopenafs.la +@SHARED_ONLY@SHARED_SHLIBS_TOP = ${TOP_LIBDIR}/libkopenafs.${SHLIB_SUFFIX} + +all: $(SHARED_SHLIBS_TOP) ${TOP_LIBDIR}/libkopenafs.a \ ${TOP_INCDIR}/kopenafs.h ${TOP_LIBDIR}/libkopenafs.${SHLIB_SUFFIX}: libkopenafs.la @@ -77,28 +80,28 @@ libkopenafs.a: $(LT_objs) libkopenafs.la: libkopenafs.la.sym $(LT_objs) $(LT_LDLIB_shlib_only) $(LT_objs) -test-unlog: test-unlog.lo libkopenafs.la - $(LT_LDRULE_static) test-unlog.lo libkopenafs.la $(XLIBS) +test-unlog: test-unlog.lo libkopenafs.a + $(LT_LDRULE_static) test-unlog.lo libkopenafs.a $(XLIBS) -test-setpag: test-setpag.lo libkopenafs.la - $(LT_LDRULE_static) test-setpag.lo libkopenafs.la $(XLIBS) +test-setpag: test-setpag.lo libkopenafs.a + $(LT_LDRULE_static) test-setpag.lo libkopenafs.a $(XLIBS) # # Installation targets # -install: libkopenafs.la libkopenafs.a +install: $(SHARED_LIBS) libkopenafs.a ${INSTALL} -d ${DESTDIR}${libdir} ${INSTALL} -d ${DESTDIR}${includedir} - ${LT_INSTALL_DATA} libkopenafs.la ${DESTDIR}${libdir}/libkopenafs.la - ${RM} ${DESTDIR}${libdir}/libkopenafs.la + @SHARED_ONLY@${LT_INSTALL_DATA} libkopenafs.la ${DESTDIR}${libdir}/libkopenafs.la + @SHARED_ONLY@${RM} ${DESTDIR}${libdir}/libkopenafs.la ${INSTALL_DATA} libkopenafs.a ${DESTDIR}${libdir}/libkopenafs.a ${INSTALL_DATA} ${srcdir}/kopenafs.h ${DESTDIR}${includedir}/kopenafs.h -dest: libkopenafs.la libkopenafs.a +dest: $(SHARED_LIBS) libkopenafs.a ${INSTALL} -d ${DEST}/lib ${INSTALL} -d ${DEST}/include - ${LT_INSTALL_DATA} libkopenafs.la ${DEST}/lib/libkopenafs.la - ${RM} ${DEST}/lib/libkopenafs.la + @SHARED_ONLY@${LT_INSTALL_DATA} libkopenafs.la ${DEST}/lib/libkopenafs.la + @SHARED_ONLY@${RM} ${DEST}/lib/libkopenafs.la ${INSTALL_DATA} libkopenafs.a ${DEST}/lib/libkopenafs.a ${INSTALL_DATA} ${srcdir}/kopenafs.h ${DEST}/include/kopenafs.h diff --git a/src/libafsauthent/Makefile.in b/src/libafsauthent/Makefile.in index 4dda1dc..b809747 100644 --- a/src/libafsauthent/Makefile.in +++ b/src/libafsauthent/Makefile.in @@ -34,7 +34,9 @@ LT_deps = \ LT_libs = $(LIB_hcrypto) $(LIB_roken) $(LIB_crypt) $(LIB_AFSDB) $(MT_LIBS) -all: libafsauthent.la libafsauthent_pic.la \ +@SHARED_ONLY@SHARED_LIBS = libafsauthent.la + +all: $(SHARED_LIBS) libafsauthent_pic.la \ $(TOP_LIBDIR)/libafsauthent.a \ $(TOP_LIBDIR)/libafsauthent_pic.a @@ -46,7 +48,7 @@ libafsauthent_pic.la: $(LT_objs) # On AIX, libtool can only produce one of shared and static libraries in a # given invocation, so we need separate rules. -libafsauthent.a: $(LT_objs) libafsauthent.la +libafsauthent.a: $(LT_objs) $(LT_LDLIB_static) $(LT_objs) ${TOP_LIBDIR}/libafsauthent.a: libafsauthent.a @@ -59,10 +61,10 @@ clean: $(LT_CLEAN) $(RM) -f *.o libafsauthent.a -install: libafsauthent.la libafsauthent.a libafsauthent_pic.la +install: $(SHARED_LIBS) libafsauthent.a libafsauthent_pic.la ${INSTALL} -d ${DESTDIR}${libdir} - ${LT_INSTALL_DATA} libafsauthent.la ${DESTDIR}${libdir}/libafsauthent.la - ${RM} ${DESTDIR}${libdir}/libafsauthent.la + @SHARED_ONLY@${LT_INSTALL_DATA} libafsauthent.la ${DESTDIR}${libdir}/libafsauthent.la + @SHARED_ONLY@${RM} ${DESTDIR}${libdir}/libafsauthent.la ${INSTALL_DATA} libafsauthent.a ${DESTDIR}${libdir}/libafsauthent.a ${INSTALL_DATA} .libs/libafsauthent_pic.a ${DESTDIR}${libdir}/libafsauthent_pic.a diff --git a/src/libafsrpc/Makefile.in b/src/libafsrpc/Makefile.in index 0b3a305..997ee30 100644 --- a/src/libafsrpc/Makefile.in +++ b/src/libafsrpc/Makefile.in @@ -30,7 +30,9 @@ LT_objs = \ LT_libs = $(LIB_hcrypto) $(LIB_roken) $(MT_LIBS) $(RXGK_GSSAPI_LIBS) -all: libafsrpc.la libafsrpc.a libafsrpc_pic.la \ +@SHARED_ONLY@SHARED_LIBS = libafsrpc.la + +all: $(SHARED_LIBS) libafsrpc.a libafsrpc_pic.la \ $(TOP_LIBDIR)/libafsrpc.a \ $(TOP_LIBDIR)/libafsrpc_pic.a @@ -53,7 +55,7 @@ libafsrpc_pic.la: $(LT_objs) # AIX needs libafsrpc to also be linked against the syscall import list # On most platforms, libtool will make shared and static libraries at the # same time, but not on AIX, so we need separate rules. -libafsrpc.a: $(LT_objs) libafsrpc.la +libafsrpc.a: $(LT_objs) $(LT_LDLIB_static) $(LT_objs) @set -e; set -x; case "${SYS_NAME}" in \ rs_aix*) \ @@ -66,17 +68,17 @@ ${TOP_LIBDIR}/libafsrpc.a: libafsrpc.a ${TOP_LIBDIR}/libafsrpc_pic.a: libafsrpc_pic.la ${INSTALL_DATA} .libs/libafsrpc_pic.a $@ -install: libafsrpc.la libafsrpc.a libafsrpc_pic.la +install: $(SHARED_LIBS) libafsrpc.a libafsrpc_pic.la ${INSTALL} -d ${DESTDIR}${libdir} - $(LT_INSTALL_DATA) libafsrpc.la $(DESTDIR)$(libdir)/libafsrpc.la - $(RM) $(DESTDIR)$(libdir)/libafsrpc.la + @SHARED_ONLY@$(LT_INSTALL_DATA) libafsrpc.la $(DESTDIR)$(libdir)/libafsrpc.la + @SHARED_ONLY@$(RM) $(DESTDIR)$(libdir)/libafsrpc.la $(INSTALL_DATA) libafsrpc.a $(DESTDIR)$(libdir)/libafsrpc.a $(INSTALL_DATA) .libs/libafsrpc_pic.a $(DESTDIR)$(libdir)/libafsrpc_pic.a -dest: libafsrpc.la libafsrpc.a +dest: $(SHARED_LIBS) libafsrpc.a ${INSTALL} -d ${DEST}/lib - ${LT_INSTALL_DATA} libafsrpc.la ${DEST}/lib/libafsrpc.la - ${RM} ${DEST}/lib/libafsrpc.la + @SHARED_ONLY@${LT_INSTALL_DATA} libafsrpc.la ${DEST}/lib/libafsrpc.la + @SHARED_ONLY@${RM} ${DEST}/lib/libafsrpc.la ${INSTALL_DATA} libafsrpc.a ${DEST}/lib/libafsrpc.a ${INSTALL_DATA} .libs/libafsrpc_pic.a ${DEST}/lib/libafsrpc_pic.a diff --git a/src/libuafs/Makefile.common.in b/src/libuafs/Makefile.common.in index de3d2be..09234cf 100644 --- a/src/libuafs/Makefile.common.in +++ b/src/libuafs/Makefile.common.in @@ -193,9 +193,6 @@ ${TOP_LIBDIR}/libuafs_pic.a: libuafs_pic.la $(LT_objs): h -libuafs.la: $(LT_objs) - $(LT_LDLIB_shlib_only) $(LT_objs) - libuafs.a: $(LT_objs) $(LT_LDLIB_static) $(LT_objs) diff --git a/src/roken/Makefile.in b/src/roken/Makefile.in index 69d61ef..0a36d1f 100644 --- a/src/roken/Makefile.in +++ b/src/roken/Makefile.in @@ -22,23 +22,26 @@ HEADERS = ${TOP_INCDIR}/base64.h \ UPSTREAM = $(TOP_SRCDIR)/external/heimdal/roken +@SHARED_ONLY@SHARED_LIBS = librokenafs.la +@SHARED_ONLY@SHARED_SHLIBS_TOP = $(TOP_LIBDIR)/librokenafs.$(SHLIB_SUFFIX) + # TOP_LIBDIR is a convenient place where we can ensure that both the shared # and static versions of the library will end up (I'm looking at you, AIX). # Otherwise we could just use .libs directly, since only openafs-internal # tools will be linking roken from that directory. -all: $(ROKEN_HEADERS) $(HEADERS) $(TOP_LIBDIR)/librokenafs.$(SHLIB_SUFFIX) \ +all: $(ROKEN_HEADERS) $(HEADERS) $(SHARED_SHLIBS_TOP) \ $(TOP_LIBDIR)/librokenafs.a buildtools: $(ROKEN_HEADERS) $(HEADERS) -install: librokenafs.la librokenafs.a - $(LT_INSTALL_DATA) librokenafs.la $(DESTDIR)$(libdir)/librokenafs.la - $(RM) $(DESTDIR)$(libdir)/librokenafs.la +install: $(SHARED_LIBS) librokenafs.a + @SHARED_ONLY@$(LT_INSTALL_DATA) librokenafs.la $(DESTDIR)$(libdir)/librokenafs.la + @SHARED_ONLY@$(RM) $(DESTDIR)$(libdir)/librokenafs.la $(INSTALL_DATA) librokenafs.a $(DESTDIR)$(libdir)/librokenafs.a -dest: librokenafs.la librokenafs.a - $(LT_INSTALL_DATA) librokenafs.la $(DEST)/lib/librokenafs.la - $(RM) $(DEST)/lib/librokenafs.la +dest: $(SHARED_LIBS) librokenafs.a + @SHARED_ONLY@$(LT_INSTALL_DATA) librokenafs.la $(DEST)/lib/librokenafs.la + @SHARED_ONLY@$(RM) $(DEST)/lib/librokenafs.la $(INSTALL_DATA) librokenafs.a $(DEST)/lib/librokenafs.a clean: