It seems like OpenUnix's ld uses LD_LIBRARY_PATH to search for

libraries.  What's worse, the directories given in LD_LIBRARY_PATH are
checked first!  Therefore, we need a hack to prepend all the
directories we give with -L to the current value of LD_LIBRARY_PATH,
thereby temporarly forming a hacked value.

Only copy LIBEXTRAS if they are given.

Svr5 doesn't use -z allextract...
This commit is contained in:
Richard Levitte 2003-04-08 08:36:20 +00:00
parent f65a75786b
commit e96133e4cf

View File

@ -88,11 +88,17 @@ CALC_VERSIONS= \
LINK_APP= \ LINK_APP= \
( $(DEBUG); \ ( $(DEBUG); \
LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq | while read d; do echo -n $${d}:; done'`; \
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
$$LDCMD $(LDFLAGS) $$LDFLAGS -o $$APPNAME $(OBJECTS) $$LIBDEPS ) $$LDCMD $(LDFLAGS) $$LDFLAGS -o $$APPNAME $(OBJECTS) $$LIBDEPS )
LINK_SO= \ LINK_SO= \
( $(DEBUG); \ ( $(DEBUG); \
nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \ nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq | while read d; do echo -n $${d}:; done'`; \
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
$$SHAREDCMD $(SHARED_LDFLAGS) $$SHAREDFLAGS -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \ $$SHAREDCMD $(SHARED_LDFLAGS) $$SHAREDFLAGS -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
$$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS ) && \ $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS ) && \
$(SYMLINK_SO); ( $(DEBUG); rm -f lib$(LIBNAME).exp ) $(SYMLINK_SO); ( $(DEBUG); rm -f lib$(LIBNAME).exp )
@ -122,7 +128,8 @@ LINK_SO_A_VIA_O= \
$(LINK_SO) && rm -f $(LIBNAME).o $(LINK_SO) && rm -f $(LIBNAME).o
LINK_SO_A_UNPACKED= \ LINK_SO_A_UNPACKED= \
UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \ UNPACKDIR=link_tmp.$$$$; rm -rf $$UNPACKDIR; mkdir $$UNPACKDIR; \
(cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && cp $(LIBEXTRAS) $$UNPACKDIR && \ (cd $$UNPACKDIR; ar x ../lib$(LIBNAME).a) && \
([ -z "$(LIBEXTRAS)" ] || cp $(LIBEXTRAS) $$UNPACKDIR) && \
SHOBJECTS=$$UNPACKDIR/*.o; \ SHOBJECTS=$$UNPACKDIR/*.o; \
$(LINK_SO) && rm -rf $$UNPACKDIR $(LINK_SO) && rm -rf $$UNPACKDIR
@ -457,11 +464,11 @@ link_o.svr3:
else \ else \
$(CALC_VERSIONS); \ $(CALC_VERSIONS); \
SHARE_FLAG='-G'; \ SHARE_FLAG='-G'; \
(${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAGS='-shared'; \ (${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
SHLIB=lib$(LIBNAME).so; \ SHLIB=lib$(LIBNAME).so; \
SHLIB_SUFFIX=; \ SHLIB_SUFFIX=; \
LIBDEPS="$(LIBDEPS) -lc"; \ LIBDEPS="$(LIBDEPS) -lc"; \
ALLSYMSFLAGS='-z allextract'; \ ALLSYMSFLAGS=''; \
NOALLSYMSFLAGS=''; \ NOALLSYMSFLAGS=''; \
SHAREDFLAGS="$${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \ SHAREDFLAGS="$${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
SHAREDCMD='$(CC)'; \ SHAREDCMD='$(CC)'; \
@ -473,11 +480,11 @@ link_a.svr3:
else \ else \
$(CALC_VERSIONS); \ $(CALC_VERSIONS); \
SHARE_FLAG='-G'; \ SHARE_FLAG='-G'; \
(${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAGS='-shared'; \ (${CC} -v 2>&1 | grep gcc) > /dev/null && SHARE_FLAG='-shared'; \
SHLIB=lib$(LIBNAME).so; \ SHLIB=lib$(LIBNAME).so; \
SHLIB_SUFFIX=; \ SHLIB_SUFFIX=; \
LIBDEPS="$(LIBDEPS) -lc"; \ LIBDEPS="$(LIBDEPS) -lc"; \
ALLSYMSFLAGS='-z allextract'; \ ALLSYMSFLAGS=''; \
NOALLSYMSFLAGS=''; \ NOALLSYMSFLAGS=''; \
SHAREDFLAGS="$${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \ SHAREDFLAGS="$${SHARE_FLAG} -h $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX"; \
SHAREDCMD='$(CC)'; \ SHAREDCMD='$(CC)'; \