From 3e89f4c492d3b70234ba4ba7a1fa18c8c589e307 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Tue, 30 Mar 1999 19:22:41 +0000 Subject: [PATCH] * doc/libtool.texi: fixed a typo * libtoolize.in: add the libtool scripts to libltdl.tar.gz * libtool.m4: don't AC_SUBST(USE_SYMBOL_UNDERSCORE), AC_CHECK_LIBM sets LIBM, AC_LIBLTDL_INSTALLABLE doesn't work when libltdl is already installed * *demo/Makefile.am: use LIBM * *demo/configure.in: AC_SUBST LIBM * libltdl/configure.in: use ac_cv_sys_symbol_underscore instead of USE_SYMBOL_UNDERSCORE * ltconfig.in: added link_all_deplibs variable * doc/libtool.texi: document it * ltmain.in: always search for libname.la - don't eval libname_spec, when linking libraries against static ones just print a warning and add them to dependency_libs, add -lc before deplibs, always link all dependencies of a static library or if link_all_deplibs is yes, hardcode library paths if hardcode_into_libs is no, don't link against dependency_libs that already are deplibs --- ChangeLog | 21 ++++++ NEWS | 2 +- cdemo/Makefile.am | 1 + cdemo/configure.in | 1 + demo/Makefile.am | 19 +++--- demo/configure.in | 1 + depdemo/configure.in | 1 + depdemo/l4/Makefile.am | 2 +- doc/libtool.texi | 7 +- libltdl/configure.in | 2 +- libtool.m4 | 28 ++++---- libtoolize.in | 24 ++++++- ltconfig.in | 5 ++ ltmain.in | 143 +++++++++++++++++++++++++---------------- mdemo/Makefile.am | 2 + mdemo/configure.in | 1 + 16 files changed, 177 insertions(+), 83 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9a1dcbad..d45bd9754 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +1999-03-30 Thomas Tanner + + * doc/libtool.texi: fixed a typo + * libtoolize.in: add the libtool scripts to libltdl.tar.gz + * libtool.m4: don't AC_SUBST(USE_SYMBOL_UNDERSCORE), + AC_CHECK_LIBM sets LIBM, AC_LIBLTDL_INSTALLABLE doesn't work + when libltdl is already installed + * *demo/Makefile.am: use LIBM + * *demo/configure.in: AC_SUBST LIBM + * libltdl/configure.in: use ac_cv_sys_symbol_underscore instead of + USE_SYMBOL_UNDERSCORE + * ltconfig.in: added link_all_deplibs variable + * doc/libtool.texi: document it + * ltmain.in: always search for libname.la - don't eval libname_spec, + when linking libraries against static ones just print a warning + and add them to dependency_libs, add -lc before deplibs, + always link all dependencies of a static library or if + link_all_deplibs is yes, hardcode library paths if + hardcode_into_libs is no, don't link against dependency_libs + that already are deplibs + 1999-03-30 Alexandre Oliva * ltconfig.in (aix4*, collect2name): make sure collect2 exists diff --git a/NEWS b/NEWS index e68a743dc..ba7931f16 100644 --- a/NEWS +++ b/NEWS @@ -3,7 +3,7 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 1.3b: 1999-??-??; CVS version 1.3a, Libtool team: * Complete inter-library dependencies support. It's now possible to link libtool libraries against other libtool libraries. -* Already-installed libtool libraries will be found. +* Libtool is able to find already-installed libtool libraries. * Support for linking DLLs on Win32 * New demos and tests * Various bugfixes diff --git a/cdemo/Makefile.am b/cdemo/Makefile.am index ab054957c..4f9d2930a 100644 --- a/cdemo/Makefile.am +++ b/cdemo/Makefile.am @@ -7,6 +7,7 @@ EXTRA_DIST = acinclude.m4 noinst_LTLIBRARIES = libfoo.la libfoo_la_SOURCES = foo.c +libfoo_la_LIBADD = $(LIBM) noinst_HEADERS = foo.h diff --git a/cdemo/configure.in b/cdemo/configure.in index eea60fb90..cc1fed444 100644 --- a/cdemo/configure.in +++ b/cdemo/configure.in @@ -11,6 +11,7 @@ AC_SUBST(LIBTOOL_DEPS) AC_CHECK_HEADERS(math.h) AC_CHECK_LIBM +AC_SUBST(LIBM) dnl Output the makefile AC_OUTPUT(Makefile) diff --git a/demo/Makefile.am b/demo/Makefile.am index f83e5c213..fcd17a9d2 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -10,6 +10,7 @@ CLEANFILES = $(hardcode_tests) # Build a libtool library, libhello.la for installation in libdir. lib_LTLIBRARIES = libhello.la libhello_la_SOURCES = hello.c foo.c +libhello_la_LIBADD = $(LIBM) libhello_la_LDFLAGS = -version-info 3:12:1 include_HEADERS = foo.h @@ -60,7 +61,7 @@ libhell1_la_LIBADD = -L. -lhell0 # libtool rejects libhell0.la libhell2_la_LIBADD = -L. -lhell0 # we have to use -L/-l. Why? bin_PROGRAMS += hell0 hell0_SOURCES = main.c -hell0_LDADD = libhell1.la libhell2.la +hell0_LDADD = libhell1.la libhell2.la $(LIBM) # Unfortunately, in order to test libtool thoroughly, we need access # to its private directory. @@ -89,8 +90,8 @@ hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \ libdir=$(libdir); \ flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ - echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $$flag || echo unsupported > $@"; \ - eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $$flag || echo unsupported > $@" + echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ + eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@" hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la @eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \ @@ -100,8 +101,8 @@ hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la echo "echo unsupported > $@"; \ echo unsupported > $@ || status="$$?"; \ else \ - echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS)"; \ - $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) || status="$$?"; \ + echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \ + $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \ fi; \ exit $$status @@ -111,16 +112,16 @@ hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la @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 $(LIBS) $$flag || echo unsupported > $@"; \ - eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $$flag || echo unsupported > $@" + echo "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ + eval "$$shlibpath_var=./$(objdir) $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@" hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES) @rm -f hc-minusL @eval `egrep -e '^(hardcode_.*|wl)=' libtool`; \ libdir=$(libdir); \ flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ - echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $$flag || echo unsupported > $@"; \ - eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $$flag || echo unsupported > $@" + echo "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ + eval "$(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@" $(OBJECTS): libtool libtool: $(LIBTOOL_DEPS) diff --git a/demo/configure.in b/demo/configure.in index c419b56b6..4257eca1b 100644 --- a/demo/configure.in +++ b/demo/configure.in @@ -23,6 +23,7 @@ grep '^global_symbol_pipe=..*$' ./libtool >/dev/null]) AC_CHECK_HEADERS(string.h math.h) AC_CHECK_LIBM +AC_SUBST(LIBM) dnl Output the makefile AC_OUTPUT(Makefile) diff --git a/depdemo/configure.in b/depdemo/configure.in index e4e317e7b..157b5127d 100644 --- a/depdemo/configure.in +++ b/depdemo/configure.in @@ -18,6 +18,7 @@ AC_SUBST(STATIC) AC_CHECK_HEADERS(math.h) AC_CHECK_LIBM +AC_SUBST(LIBM) dnl Output the makefile AC_OUTPUT( diff --git a/depdemo/l4/Makefile.am b/depdemo/l4/Makefile.am index 45c6b675d..544fb7b4f 100644 --- a/depdemo/l4/Makefile.am +++ b/depdemo/l4/Makefile.am @@ -4,4 +4,4 @@ INCLUDES = -I$(top_srcdir) lib_LTLIBRARIES = libl4.la libl4_la_SOURCES = l4.c l4.h -libl4_la_LIBADD = $(top_builddir)/l3/libl3.la +libl4_la_LIBADD = $(top_builddir)/l3/libl3.la $(LIBM) diff --git a/doc/libtool.texi b/doc/libtool.texi index be2d1992a..0f1192be3 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -2590,7 +2590,7 @@ implementation of @file{libltdl} services, it requires GNU DLD, or it will only emulate dynamic linking with libtool's dlpreopening mechanism. @noindent -libltdl supports currently the following dynamic linking mechanims: +libltdl supports currently the following dynamic linking mechanisms: @itemize @bullet @item @@ -3865,6 +3865,11 @@ the rest are symbolic links to the file. The name in the list is the file name that the linker finds when given @samp{-l@var{name}}. @end defvar +@defvar link_all_deplibs +Whether libtool must link a program against all its dependency libraries. +Set to @samp{yes} or @samp{no}. Default is @samp{no}. +@end defvar + @defvar link_static_flag Linker flag (passed through the C compiler) used to prevent dynamic linking. diff --git a/libltdl/configure.in b/libltdl/configure.in index 2a0bb859c..ab7756609 100644 --- a/libltdl/configure.in +++ b/libltdl/configure.in @@ -137,7 +137,7 @@ if test "$test_dlerror" = yes; then fi AC_SYS_SYMBOL_UNDERSCORE -if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then +if test x"$ac_cv_sys_symbol_underscore" = xyes; then if test x"$ac_cv_func_dlopen" = xyes || test x"$ac_cv_lib_dl_dlopen" = xyes ; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], diff --git a/libtool.m4 b/libtool.m4 index 68ac62403..0c5a99304 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -563,23 +563,22 @@ fi rm -rf conftest* ]) AC_MSG_RESULT($ac_cv_sys_symbol_underscore) -USE_SYMBOL_UNDERSCORE=${ac_cv_sys_symbol_underscore=no} -AC_SUBST(USE_SYMBOL_UNDERSCORE)dnl ]) # AC_CHECK_LIBM - check for math library AC_DEFUN(AC_CHECK_LIBM, [AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= case "$host" in *-*-beos* | *-*-cygwin*) # These system don't have libm ;; *-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl) - AC_CHECK_LIB(m, cos) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) - AC_CHECK_LIB(m, cos) + AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac ]) @@ -611,15 +610,20 @@ AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [ # appropriate in the Makefiles. # In the future, this macro may have to be called after AC_PROG_LIBTOOL. AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [ - AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [ - case "$enable_ltdl_install" in - no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;; - "") enable_ltdl_install=yes - ac_configure_args="$ac_configure_args --enable-ltdl-install" ;; - esac + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi ]) - if test x"$enable_ltdl_install" != x"no"; then + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" fi ]) diff --git a/libtoolize.in b/libtoolize.in index 342ba6988..6c9ad0b30 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -251,11 +251,31 @@ done if test "x$ltdl_tar" = x"yes"; then if test "x$dry_run" = x"yes"; then - echo "(cd $pkgdatadir > /dev/null && tar -cf - libltdl | gzip --best) > libltdl.tar.gz" + echo "tar -cf - libltdl | gzip --best > libltdl.tar.gz" elif test -f libltdl.tar.gz && test -z "$force"; then test -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2 else - (cd $pkgdatadir > /dev/null && tar -cf - libltdl | gzip --best) > libltdl.tar.gz + test -d libltdl && ${rm}r libltdl + $mkdir libltdl + ltdlfiles=`cd $pkgdatadir && ls libltdl/*` + for file in $ltdlfiles; do + if $cp $pkgdatadir/$file $file; then : + else + echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2 + status=1 + break + fi + done + for file in $files; do + if $cp $pkgdatadir/$file libltdl/$file; then : + else + echo "$progname: cannot copy \`$pkgdatadir/$file' to \`libltdl/$file'" 1>&2 + status=1 + break + fi + done + tar -cf - libltdl | gzip --best > libltdl.tar.gz + ${rm}r libltdl fi fi diff --git a/ltconfig.in b/ltconfig.in index 3e48bff12..169d4e9c4 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -1008,6 +1008,7 @@ hardcode_direct=no hardcode_minus_L=no hardcode_shlibpath_var=unsupported runpath_var= +link_all_deplibs=no always_export_symbols=no export_symbols_cmds='$NM $libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' # include_expsyms should be a list of space-separated symbols to be *always* @@ -1318,6 +1319,7 @@ else $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no + link_all_deplibs=yes ;; sunos4*) @@ -2687,6 +2689,9 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + # Compile-time system search path for libraries sys_lib_search_path_spec=$sys_lib_search_path_spec diff --git a/ltmain.in b/ltmain.in index bd6c5835c..cf1028e60 100644 --- a/ltmain.in +++ b/ltmain.in @@ -1574,11 +1574,10 @@ compiler." ;; -l*) name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - libname=`eval \\$echo \"$libname_spec\"` found=no for searchdir in $lib_search_path; do # Search the libtool library - lib="$searchdir/$libname.la" + lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break @@ -1825,21 +1824,15 @@ compiler." fi test "$add_name" = yes && deplibs="$deplibs -l$name" elif test "$build_libtool_libs" = yes && test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. echo echo "*** Warning: This library needs some functionality provided by $libname." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." - continue - else - # Check for old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$lib'" 1>&2 - exit 1 - fi - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs $dir/$old_library" fi if test -n "$dependency_libs"; then @@ -2127,7 +2120,7 @@ EOF ;; *) # Add libc to deplibs on all other systems. - deplibs="$deplibs -lc" + deplibs="-lc $deplibs" ;; esac fi @@ -2421,9 +2414,10 @@ EOF fi fi - # Find libtool libraries and add their dependencies/rpaths + # Find libtool libraries and add their dependencies old_deplibs="$deplibs" deplibs= + absdeplibs= newdependency_libs= new_lib_search_path= for deplib in $old_deplibs; do @@ -2431,16 +2425,16 @@ EOF case "$deplib" in -L*) deplibs="$deplibs $deplib" + absdeplibs="$absdeplibs $deplib" new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` continue ;; -l*) name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - libname=`eval \\$echo \"$libname_spec\"` found=no for searchdir in $lib_search_path; do # Search the libtool library - lib="$searchdir/$libname.la" + lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break @@ -2448,6 +2442,7 @@ EOF done if test "$found" != yes; then deplibs="$deplibs $deplib" + absdeplibs="$absdeplibs $deplib" continue fi ;; @@ -2494,22 +2489,64 @@ EOF fi new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`" - deplibs="$deplibs $lib" - + for deplib in $dependency_libs; do case "$deplib" in - -L*) new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`" ;; - *) ;; - esac - # Make sure dependency_libs contains only unique - # libraries and directories. - case "$newdependency_libs " in - *" $deplib "*) ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; + -L*) + new_lib_search_path="$new_lib_search_path `$echo "X$deplib" | $Xsed -e 's/^-L//'`" + ;; esac + + if test "$link_all_deplibs" = yes || \ + test "$fast_install" = yes || \ + test "$build_libtool_libs" = no || \ + test -z "$library_names"; then + # Need to link against all dependency_libs + case "$absdeplibs " in + *" $deplib "*) ;; + *) + deplibs="$deplibs $deplib" + absdeplibs="$absdeplibs $deplib" + ;; + esac + elif test "$hardcode_into_libs" = no; then + # Need to hardcode shared library paths + # or/and link against static libraries + case "$newdependency_libs " in + *" $deplib "*) ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + fi done + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + # We need an absolute path. + case "$ladir" in + /* | [A-Za-z]:[/\\]*) ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: cannot determine absolute directory name of \`$ladir'" 1>&2 + exit 1 + fi + ladir="$abs_ladir" + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + deplibs="$deplibs $lib" + absdeplibs="$absdeplibs $ladir/$laname" + done + + # Eliminate all dependency_libs that are already contained in deplibs + dependency_libs= + for deplib in $newdependency_libs; do + case "$deplibs " in + *" $deplib "*) ;; + *) dependency_libs="$dependency_libs $deplib" ;; + esac done - dependency_libs="$newdependency_libs" # Make sure lib_search_path contains only unique directories. lib_search_path= @@ -2523,25 +2560,14 @@ EOF # Find libtool libraries and add their directories alldeplibs=no - linkalldeplibs=no - if test "$fast_install" = yes || test "$build_libtool_libs" = no || \ - test "$deplibs_check_method" = none; then - linkalldeplibs=yes - fi link_against_libtool_libs= for deplib in $deplibs @DEPLIBS@ $dependency_libs; do lib= case "$deplib" in -L*) - case "$compile_command " in - *" $deplib "*) ;; - *) compile_command="$compile_command $deplib";; - esac - case "$finalize_command " in - *" $deplib "*) ;; - *) finalize_command="$finalize_command $deplib";; - esac + compile_command="$compile_command $deplib" + finalize_command="$finalize_command $deplib" continue ;; -R*) @@ -2554,19 +2580,15 @@ EOF continue ;; @DEPLIBS@) - if test "$hardcode_into_libs" = yes; then - break - fi alldeplibs=yes continue ;; -l*) name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - libname=`eval \\$echo \"$libname_spec\"` found=no for searchdir in $lib_search_path; do # Search the libtool library - lib="$searchdir/$libname.la" + lib="$searchdir/lib${name}.la" if test -f "$lib"; then found=yes break @@ -2652,7 +2674,22 @@ EOF fi name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - if test "$build_libtool_libs" = yes && test -n "$library_names"; then + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + compile_command="$compile_command $dir/$old_library" + finalize_command="$finalize_command $dir/$old_library" + continue + fi + + hardcode=yes + test "$hardcode_into_libs" = yes && test "$alldeplibs" = yes && hardcode=no + + if test "$hardcode" = yes && \ + test "$build_libtool_libs" = yes && \ + test -n "$library_names"; then + # We need to hardcode the library path if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. case "$temp_rpath " in @@ -2686,19 +2723,13 @@ EOF esac fi - if test "$alldeplibs" = yes && test "$linkalldeplibs" = no; then + if test "$alldeplibs" = yes && \ + test "$build_libtool_libs" = yes && \ + test -n "$library_names"; then + # Do we only need to link against static libraries? continue fi - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - compile_command="$compile_command $dir/$old_library" - finalize_command="$finalize_command $dir/$old_library" - continue - fi - if test "$build_libtool_libs" = yes && test -n "$library_names"; then link_against_libtool_libs="$link_against_libtool_libs $lib" diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index c6f5f48f4..56983e48c 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -9,9 +9,11 @@ EXTRA_DIST = acinclude.m4 lib_LTLIBRARIES = foo1.la libfoo2.la foo1_la_SOURCES = foo1.c +foo1_la_LIBADD = $(LIBM) foo1_la_LDFLAGS = -module -avoid-version libfoo2_la_SOURCES = foo2.c +libfoo2_la_LIBADD = $(LIBM) libfoo2_la_LDFLAGS = -module noinst_HEADERS = foo.h diff --git a/mdemo/configure.in b/mdemo/configure.in index 495670dd5..cc46255e0 100644 --- a/mdemo/configure.in +++ b/mdemo/configure.in @@ -27,6 +27,7 @@ AC_SUBST(STATIC) AC_CHECK_HEADERS(math.h) AC_CHECK_LIBM +AC_SUBST(LIBM) dnl Output the makefile AC_OUTPUT(Makefile) -- 2.47.3