1999-03-19 Alexandre Oliva <oliva@dcc.unicamp.br>
+ * demo/Makefile.am (hc-direct, hc-libpath, hc-minusL): link with
+ $$hardcode_libdir_flag_spec, if available, with libdir=$(libdir),
+ to make sure the hardcode_* variables will produce the expected
+ results even in the presence of a hardcoding flag; depend on
+ libhello.la having been installed already
+ (hc-libflag): link with the installed library, but try to
+ hard-code the uninstalled one
+ * doc/libtool.texi: document the changes
+
* tests/*.test: when a test fails, skip tests that depend on it.
If a certain configuration is not supported, skip all its tests.
# Test programs to see what gets hardcoded.
.PHONY: hardcode
hardcode: $(hardcode_tests)
-hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
@rm -f hc-direct
@echo "You may ignore any linking errors from the following command:"
@shlib=./$(objdir)/libhello.a; \
for lib in $$library_names; do \
shlib="./$(objdir)/$$lib"; \
done; \
- echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm || echo unsupported > $@"; \
- eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm || echo unsupported > $@"
-
-# We need to create an alias for $(objdir) so that this test works regardless
-# of $hardcode_minus_L
-hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES)
- rm -rf hc-libflag _hclibs
- mkdir _hclibs
- objdir=$(objdir); cd _hclibs && for lib in ../$$objdir/libhello*; do \
- $(LN_S) $$lib `echo "$$lib" | sed 's%^.*/%%'` || exit 1; \
- done
- @eval `egrep -e '^(hardcode_.*|wl)=' ../libtool`; \
+ eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \
+ libdir=$(libdir); \
+ flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm $$flag || echo unsupported > $@"; \
+ eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib -lm $$flag || echo unsupported > $@"
+
+hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+ @eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \
libdir=`pwd`/$(objdir); \
flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
if test -z "$$flag"; then \
echo "echo unsupported > $@"; \
echo unsupported > $@ || status="$$?"; \
else \
- echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L./_hclibs -lhello -lm"; \
- $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L./_hclibs -lhello -lm || status="$$?"; \
+ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello -lm"; \
+ $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello -lm || status="$$?"; \
fi; \
- echo "rm -rf _hclibs"; \
- rm -rf _hclibs; \
exit $$status
-hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
@rm -f hc-libpath
@echo "You may ignore any linking errors from the following command:"
- @eval `egrep -e '^shlibpath_var=' ../libtool`; \
- echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm || echo unsupported > $@"; \
- eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm || echo unsupported > $@"
+ @eval `egrep -e '^(shlibpath_var|hardcode_.*|wl)=' libtool`; \
+ libdir=$(libdir); \
+ flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+ echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm $$flag || echo unsupported > $@"; \
+ eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello -lm $$flag || echo unsupported > $@"
hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
@rm -f hc-minusL
- $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm
+ @eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \
+ libdir=$(libdir); \
+ flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+ echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm $$flag || echo unsupported > $@"; \
+ eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm $$flag || echo unsupported > $@"
$(OBJECTS): libtool
libtool: $(LIBTOOL_DEPS)
@defvar hardcode_direct
Set to @samp{yes} or @samp{no}, depending on whether the linker
hardcodes directories if a library is directly specified on the command
-line (such as @samp{@var{dir}/lib@var{name}.a}).
+line (such as @samp{@var{dir}/lib@var{name}.a}) when
+@var{hardcode_libdir_flag_spec} is specified.
@end defvar
@defvar hardcode_libdir_flag_spec
Flag to hardcode a @var{libdir} variable into a binary, so that the
dynamic linker searches @var{libdir} for shared libraries at runtime.
+If it is empty, libtool will try to use some other hardcoding mechanism.
+If everything else fails, it will fallback to
+@samp{hardcode_action=relink}.
@end defvar
@defvar hardcode_libdir_separator
@defvar hardcode_minus_L
Set to @samp{yes} or @samp{no}, depending on whether the linker
hardcodes directories specified by @samp{-L} flags into the resulting
-executable.
+executable when @var{hardcode_libdir_flag_spec} is specified.
@end defvar
@defvar hardcode_shlibpath_var
Set to @samp{yes} or @samp{no}, depending on whether the linker
hardcodes directories by writing the contents of @samp{$shlibpath_var}
-into the resulting executable. Set to @samp{unsupported} if directories
-specified by @samp{$shlibpath_var} are searched at run time, but not at
-link time.
+into the resulting executable when @var{hardcode_libdir_flag_spec} is
+specified. Set to @samp{unsupported} if directories specified by
+@samp{$shlibpath_var} are searched at run time, but not at link time.
@end defvar
@defvar host