Print this page
8411 Build should warn when linking against libraries outside proto area

@@ -20,10 +20,12 @@
 #
 #
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
+# Copyright 2017 RackTop Systems.
+#
 
 LIBRARY= libldap.a
 VERS= .5
 
 # Definition of all the objects macros

@@ -81,10 +83,13 @@
                 $(UTILOBJS:%.o=../sources/ldap/util/%.c)
 
 LIBS =          $(DYNLIB) $(LINTLIB)
 DYNFLAGS +=     $(ZNODELETE)
 
+# Allow the NSS libraries to be taken from outside the proto area.
+$(ADJUNCT_PROTO_NOT_SET)DYNFLAGS += $(NSS_LIBS:-l%=$(ZASSERTDEFLIB)=lib%.so)
+
 CPPFLAGS=       $(COM_INC) $(CPPFLAGS.master)
 
 # definitions for lint
 
 $(LINTLIB):=    SRCS=../sources/ldap/common/llib-lldap

@@ -118,12 +123,22 @@
 CERRWARN +=     -_gcc=-Wno-unused-function
 CERRWARN +=     -_gcc=-Wno-unused-variable
 CERRWARN +=     -_gcc=-Wno-unused-value
 CERRWARN +=     -_gcc=-Wno-address
 
-LDLIBS +=       -lsasl -lsocket -lnsl -lmd -lc
+# Override the default linker path so that libraries found in the host
+# directories will trigger the -zassert-deflib logic.
+LDLIBS32 +=     -YP,$(DEFLDPATH):$(NSS_LDPATH)
+LDLIBS64 +=     -YP,$(DEFLDPATH64):$(NSS_LDPATH64)
 
+# Only add -L options for the NSS directories if ADJUNCT_PROTO is being
+# used because it disables the -zassert-deflib logic.
+$(ADJUNCT_PROTO_SET)LDLIBS32 += -L$(NSS_LDPATH)
+$(ADJUNCT_PROTO_SET)LDLIBS64 += -L$(NSS_LDPATH64)
+
+LDLIBS +=       -lsasl -lsocket -lnsl -lmd -lc $(NSS_LIBS)
+
 .KEEP_STATE:
 
 # include library targets
 include ../../Makefile.targ