diff --git a/ChangeLog b/ChangeLog index b967f0ce..a90e197b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,51 @@ +2000-01-19 Thomas Tanner + + * ltmain.in: rewrite of the ILD code, merge linking code for + programs, libraries and objects, allow linking of shared libraries + against static libraries/objects on platforms that support it + but print a warning, fix some typos + + * partially revert my previous change and + update only copyright notices of files that were actually modified + + * NEWS: update + + * libltdl/Makefile.am: version number was wrong + + * libltdl/ltdl.c (tryall_dlopen): revert Gary's change + since it breaks dlpreopening + * ltdl.m4: ditto + + * libltdl/ltdl.c (sys_search_path): search in the system default + library search path, too + * ltdl.m4 (AC_LTDL_SYSSEARCHPATH): extract the path + + * libltdl/ltdl.c (find_module): remove bogus file_not_found_error + + * libltdl/ltdl.c (load_deplibs): implement loading of dependency + libraries + * libltdl/ltdl.c (unload_deplibs): implement unloading of dependency + libraries + * libltdl/ltdl.c (lt_dlexit): correctly close all modules and + their dependencies + + * libltdl/ltdl.c (lt_dlforeach): new function + * libltdl/ltdl.h: ditto + * doc/libtool.texi (using libltdl): document it + + * libtool.m4: reformatting, only add -I$topsrc_dir/libltdl to + INCLTDL + + * libtoolize.in: reformatting + * ltconfig.in: reformatting + * ltmain.in: reformatting + + * mdemo/configure.in: AC_SUBST INCLTDL + * mdemo/Makefile.am: use INCLTDL + + * tests/Makefile.am: reexport OBJEXT and EXEEXT + * tests/dryrun.test: use them for building main.obj and mdemo.exe + 2000-01-17 Gary V. Vaughan * libltdl/ltdl.c (tryall_dlopen): Abort with diff --git a/NEWS b/NEWS index ba55ddc2..5a2f0be5 100644 --- a/NEWS +++ b/NEWS @@ -1,16 +1,20 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 1.3d: 2000-??-??; CVS version 1.3c, Libtool team: -* libltdl can now be built as a dll with win32. -* m4 macros needed to configure libltdl split out into libltdl/ltdl.m4. -* Start of support code for cross-compiling to win32. -* Improved support for mingw32. -* Improved support for Compaq Tru64 V5.0, and Digital Unix V4.*. * New "-no-install" flag to avoid the use of executable wrapper scripts. * New --with-pic flag to control the generation of PIC/non-PIC code. * New --build flag to ltconfig to help with build cross compilation environments is inherited from --build flag passed to configure. -* Various bugfixes +* Support for hardcoding run-time paths (-R) into libraries. +* Libtool now allows you to link shared libraries against static code. +* New functions lt_dlgetdata, lt_dlsetdata, lt_dlgetinfo, lt_dlforeach + in libltdl can be used to store application specific data in handles. +* "-Xcompiler" and "-Wc," does now work in compile mode, too. +* Start of support code for cross-compiling to win32. +* libltdl can now be built as a dll with win32. +* m4 macros needed to configure libltdl split out into libltdl/ltdl.m4. +* Improved support for mingw32, Compaq Tru64 V5.0 and Digital Unix V4.*. +* Many bugfixes (especially in libltdl) New in 1.3.4: 1999-12-08, CVS version 1.3.3a, Libtool team: * Support for Compaq Tru64 V5.0. diff --git a/cdemo/foo.c b/cdemo/foo.c index f27c173c..3854c435 100644 --- a/cdemo/foo.c +++ b/cdemo/foo.c @@ -1,5 +1,5 @@ /* foo.c -- trivial test library - Copyright (C) 1998-2000 Free Software Foundation, Inc. + Copyright (C) 1998-1999 Free Software Foundation, Inc. Originally by Thomas Tanner This file is part of GNU Libtool. diff --git a/cdemo/foo.h b/cdemo/foo.h index d6d5bdc4..48dc9127 100644 --- a/cdemo/foo.h +++ b/cdemo/foo.h @@ -1,5 +1,5 @@ /* foo.h -- interface to the libfoo* libraries - Copyright (C) 1998-2000 Free Software Foundation, Inc. + Copyright (C) 1998-1999 Free Software Foundation, Inc. Originally by Thomas Tanner This file is part of GNU Libtool. diff --git a/cdemo/main.c b/cdemo/main.c index 15df0900..89da831b 100644 --- a/cdemo/main.c +++ b/cdemo/main.c @@ -1,5 +1,5 @@ /* main.c -- cdemo test program - Copyright (C) 1998-2000 Free Software Foundation, Inc. + Copyright (C) 1998-1999 Free Software Foundation, Inc. Originally by Thomas Tanner This file is part of GNU Libtool. diff --git a/demo/dlmain.c b/demo/dlmain.c index 026f766d..7c123bb8 100644 --- a/demo/dlmain.c +++ b/demo/dlmain.c @@ -1,5 +1,5 @@ /* dlmain.c -- hello test program that uses simulated dynamic linking - Copyright (C) 1996-2000 Free Software Foundation, Inc. + Copyright (C) 1996-1999 Free Software Foundation, Inc. This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/demo/foo.c b/demo/foo.c index ae9b6d8b..4b677399 100644 --- a/demo/foo.c +++ b/demo/foo.c @@ -1,5 +1,5 @@ /* foo.c -- trivial test function for libfoo - Copyright (C) 1996-2000 Free Software Foundation, Inc. + Copyright (C) 1996-1999 Free Software Foundation, Inc. Gordon Matzigkeit , 1996 This file is part of GNU Libtool. diff --git a/demo/foo.h b/demo/foo.h index 2979874d..6d4fee70 100644 --- a/demo/foo.h +++ b/demo/foo.h @@ -1,5 +1,5 @@ /* foo.h -- interface to the libfoo library - Copyright (C) 1996-2000 Free Software Foundation, Inc. + Copyright (C) 1996-1999 Free Software Foundation, Inc. Gordon Matzigkeit , 1996 This file is part of GNU Libtool. diff --git a/demo/hello.c b/demo/hello.c index 848407a0..ec9a639b 100644 --- a/demo/hello.c +++ b/demo/hello.c @@ -1,5 +1,5 @@ /* hello.c -- trivial test function for libfoo - Copyright (C) 1996-2000 Free Software Foundation, Inc. + Copyright (C) 1996-1999 Free Software Foundation, Inc. This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/demo/main.c b/demo/main.c index d0de6e5c..d40dc592 100644 --- a/demo/main.c +++ b/demo/main.c @@ -1,5 +1,5 @@ /* main.c -- trivial hello test program - Copyright (C) 1996-2000 Free Software Foundation, Inc. + Copyright (C) 1996-1999 Free Software Foundation, Inc. This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l1/l1.c b/depdemo/l1/l1.c index 574554d2..ba2fa773 100644 --- a/depdemo/l1/l1.c +++ b/depdemo/l1/l1.c @@ -1,5 +1,5 @@ /* l1.c -- trivial test library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l1/l1.h b/depdemo/l1/l1.h index d140bfce..fa70bb8b 100644 --- a/depdemo/l1/l1.h +++ b/depdemo/l1/l1.h @@ -1,5 +1,5 @@ /* l1.h -- interface to a trivial library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l2/l2.c b/depdemo/l2/l2.c index bcfea684..555d0688 100644 --- a/depdemo/l2/l2.c +++ b/depdemo/l2/l2.c @@ -1,5 +1,5 @@ /* l2.c -- trivial test library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l2/l2.h b/depdemo/l2/l2.h index 97ac379f..893e26bd 100644 --- a/depdemo/l2/l2.h +++ b/depdemo/l2/l2.h @@ -1,5 +1,5 @@ /* l2.h -- interface to a trivial library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l3/l3.c b/depdemo/l3/l3.c index b41c5c52..de75bd6f 100644 --- a/depdemo/l3/l3.c +++ b/depdemo/l3/l3.c @@ -1,5 +1,5 @@ /* l3.c -- trivial test library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l3/l3.h b/depdemo/l3/l3.h index 9fa7fffc..d9b79fb0 100644 --- a/depdemo/l3/l3.h +++ b/depdemo/l3/l3.h @@ -1,5 +1,5 @@ /* l3.h -- interface to a trivial library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l4/l4.c b/depdemo/l4/l4.c index bf5fdc8a..d99d0200 100644 --- a/depdemo/l4/l4.c +++ b/depdemo/l4/l4.c @@ -1,5 +1,5 @@ /* l4.c -- trivial test library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/l4/l4.h b/depdemo/l4/l4.h index c7f110bb..17ab6ea2 100644 --- a/depdemo/l4/l4.h +++ b/depdemo/l4/l4.h @@ -1,5 +1,5 @@ /* l4.h -- interface to a trivial library - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/main.c b/depdemo/main.c index 7339111f..6940b624 100644 --- a/depdemo/main.c +++ b/depdemo/main.c @@ -1,5 +1,5 @@ /* main.c -- inter-library dependency test program - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/depdemo/sysdep.h b/depdemo/sysdep.h index a241078f..40dcfbd4 100644 --- a/depdemo/sysdep.h +++ b/depdemo/sysdep.h @@ -1,5 +1,5 @@ /* sysdep.h -- system dependent declarations - Copyright (C) 1998-2000 Thomas Tanner + Copyright (C) 1998-1999 Thomas Tanner This file is part of GNU Libtool. This program is free software; you can redistribute it and/or modify diff --git a/doc/libtool.texi b/doc/libtool.texi index f28659b4..e1303d78 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -3001,6 +3001,15 @@ the module @var{handle}. The contents of the struct must not be modified. Return @code{NULL} on failure. @end deftypefun +@deftypefun int lt_dlforeach (int (*@var{func})(lt_dlhandle @var{handle}, lt_ptr_t @var{data}), lt_ptr_t @var{data}) +For each loaded module call the function @var{func}. The argument +@var{handle} is the handle of one of the loaded modules, @var{data} is +the @var{data} argument passed to @code{lt_dlforeach}. +As soon as @var{func} returns a non-zero value for one of the handles, +@code{lt_dlforeach} will stop calling @var{func} and immediately return 1. +Otherwise 0 is returned. +@end deftypefun + @deftypevar {lt_ptr_t (*} lt_dlmalloc ) (size_t size) @deftypevarx {void (*} lt_dlfree ) (lt_ptr_t ptr) These variables are set to @code{malloc} and @code{free}, by default, diff --git a/libltdl/Makefile.am b/libltdl/Makefile.am index aafac4c9..1f01d23e 100644 --- a/libltdl/Makefile.am +++ b/libltdl/Makefile.am @@ -14,7 +14,7 @@ noinst_LTLIBRARIES = libltdlc.la endif libltdl_la_SOURCES = ltdl.c -libltdl_la_LDFLAGS = -no-undefined -version-info 2:1:2 +libltdl_la_LDFLAGS = -no-undefined -version-info 2:0:2 libltdl_la_LIBADD = $(LIBADD_DL) libltdlc_la_SOURCES = ltdl.c diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 901991d0..1d009a38 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -54,10 +54,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA #include #endif -#if HAVE_UNISTD_H -#include -#endif - #if HAVE_STDIO_H #include #endif @@ -95,10 +91,14 @@ static const char objdir[] = LTDL_OBJDIR; #ifdef LTDL_SHLIB_EXT static const char shlib_ext[] = LTDL_SHLIB_EXT; #endif +#ifdef LTDL_SYSSEARCHPATH +static const char sys_search_path[] = LTDL_SYSSEARCHPATH; +#endif static const char unknown_error[] = "unknown error"; static const char dlopen_not_supported_error[] = "dlopen support not available"; static const char file_not_found_error[] = "file not found"; +static const char deplib_not_found_error[] = "dependency library not found"; static const char no_symbols_error[] = "no symbols defined"; static const char cannot_open_error[] = "can't open the module"; static const char cannot_close_error[] = "can't close the module"; @@ -883,7 +883,7 @@ lt_dlexit LTDL_PARAMS((void)) { /* shut down libltdl */ lt_dltype_t *type = types; - int errors; + int errors, level; if (!initialized) { last_error = shutdown_error; @@ -895,10 +895,15 @@ lt_dlexit LTDL_PARAMS((void)) } /* close all modules */ errors = 0; - while (handles) { - /* FIXME: what if a module depends on another one? */ - if (lt_dlclose(handles)) - errors++; + for (level = 1; handles; level++) { + lt_dlhandle cur = handles; + while (cur) { + lt_dlhandle tmp = cur; + cur = cur->next; + if (tmp->info.ref_count <= level) + if (lt_dlclose(tmp)) + errors++; + } } initialized = 0; while (type) { @@ -944,10 +949,6 @@ tryall_dlopen (handle, filename) } } else cur->info.filename = 0; - if (access (filename, F_OK) < 0) { - last_error = file_not_found_error; - return 1; - } while (type) { if (type->lib_open(cur, filename) == 0) break; @@ -1032,7 +1033,6 @@ find_module (handle, dir, libdir, dlname, old_name, installed) return 0; } } - last_error = file_not_found_error; return 1; } @@ -1145,24 +1145,123 @@ cleanup: static int load_deplibs(handle, deplibs) lt_dlhandle handle; - const char *deplibs; + char *deplibs; { - /* FIXME: load deplibs */ + char *p, *save_search_path; + int i; + int ret = 1, depcount = 0; + char **names = 0; + lt_dlhandle *handles = 0; + handle->depcount = 0; - handle->deplibs = 0; - /* Just to silence gcc -Wall */ - deplibs = 0; - return 0; + if (!deplibs) + return 0; + save_search_path = strdup(user_search_path); + if (user_search_path && !save_search_path) { + last_error = memory_error; + return 1; + } + p = deplibs; + /* extract search paths and count deplibs */ + while (*p) { + if (!isspace(*p)) { + char *end = p+1; + while (*end && !isspace(*end)) end++; + if (strncmp(p, "-L", 2) == 0 || + strncmp(p, "-R", 2) == 0) { + char save = *end; + *end = 0; /* set a temporary string terminator */ + if (lt_dladdsearchdir(p+2)) + goto cleanup; + *end = save; + } else + depcount++; + p = end; + } else + p++; + } + if (!depcount) { + ret = 0; + goto cleanup; + } + names = lt_dlmalloc(depcount * sizeof(char*)); + if (!names) + goto cleanup; + handles = lt_dlmalloc(depcount * sizeof(lt_dlhandle*)); + if (!handles) + goto cleanup; + depcount = 0; + /* now only extract the actual deplibs */ + p = deplibs; + while (*p) { + if (!isspace(*p)) { + char *end = p+1; + while (*end && !isspace(*end)) end++; + if (strncmp(p, "-L", 2) != 0 && + strncmp(p, "-R", 2) != 0) { + char *name; + char save = *end; + *end = 0; /* set a temporary string terminator */ + if (strncmp(p, "-l", 2) == 0) { + name = lt_dlmalloc(3+ /* "lib" */ + strlen(p+2)+strlen(shlib_ext)+1); + if (name) + sprintf(name, "lib%s%s", p+2, shlib_ext); + } else + name = strdup(p); + if (name) + names[depcount++] = name; + else + goto cleanup_names; + *end = save; + } + p = end; + } else + p++; + } + /* load the deplibs (in reverse order) */ + for (i = 0; i < depcount; i++) { + lt_dlhandle handle = lt_dlopen(names[depcount-1-i]); + if (!handle) { + int j; + for (j = 0; j < i; j++) + lt_dlclose(handles[j]); + last_error = deplib_not_found_error; + goto cleanup_names; + } + handles[i] = handle; + } + handle->depcount = depcount; + handle->deplibs = handles; + handles = 0; + ret = 0; +cleanup_names: + for (i = 0; i < depcount; i++) + lt_dlfree(names[i]); +cleanup: + if (names) + lt_dlfree(names); + if (handles) + lt_dlfree(handles); + /* restore the old search path */ + if (user_search_path) + lt_dlfree(user_search_path); + user_search_path = save_search_path; + return ret; } static int unload_deplibs(handle) lt_dlhandle handle; { - /* FIXME: unload deplibs */ - /* Just to silence gcc -Wall */ - handle = 0; - return 0; + int i; + int errors = 0; + + if (!handle->depcount) + return 0; + for (i = 0; i < handle->depcount; i++) + errors += lt_dlclose(handle->deplibs[i]); + return errors; } static inline int @@ -1302,6 +1401,12 @@ lt_dlopen (filename) file = (FILE*) find_file(basename, getenv(LTDL_SHLIBPATH_VAR), &dir, 0); +#endif +#ifdef LTDL_SYSSEARCHPATH + if (!file) + file = (FILE*) find_file(basename, + sys_search_path, + &dir, 0); #endif } if (!file) { @@ -1413,6 +1518,10 @@ lt_dlopen (filename) && !find_file(basename, getenv(LTDL_SHLIBPATH_VAR), 0, &newhandle) +#endif +#ifdef LTDL_SYSSEARCHPATH + && !find_file(basename, sys_search_path, + 0, &newhandle) #endif ))) { lt_dlfree(handle); @@ -1694,3 +1803,19 @@ lt_dlgetinfo (handle) } return &(handle->info); } + +int +lt_dlforeach (func, data) + int (*func) LTDL_PARAMS((lt_dlhandle handle, lt_ptr_t data)); + lt_ptr_t data; +{ + lt_dlhandle cur = handles; + while (cur) { + lt_dlhandle tmp = cur; + cur = cur->next; + if (func(tmp, data)) + return 1; + } + return 0; +} + diff --git a/libltdl/ltdl.h b/libltdl/ltdl.h index 76c451a4..9b31b2c4 100644 --- a/libltdl/ltdl.h +++ b/libltdl/ltdl.h @@ -147,6 +147,8 @@ extern const char *lt_dlgetsearchpath LTDL_PARAMS((void)); extern int lt_dlsetdata LTDL_PARAMS((lt_dlhandle handle, lt_ptr_t data)); extern lt_ptr_t lt_dlgetdata LTDL_PARAMS((lt_dlhandle handle)); extern const lt_dlinfo *lt_dlgetinfo LTDL_PARAMS((lt_dlhandle handle)); +extern int lt_dlforeach LTDL_PARAMS(( + int (*func)(lt_dlhandle handle, lt_ptr_t data), lt_ptr_t data)); #define LTDL_SET_PRELOADED_SYMBOLS() LTDL_STMT_START{ \ extern const lt_dlsymlist lt_preloaded_symbols[]; \ diff --git a/libtool.m4 b/libtool.m4 index b712e5d7..5bccb8fe 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -307,15 +307,15 @@ dnl not every word. This closes a longstanding sh security hole. if test -f $ac_dir/$1; then lt_cv_path_FILE="$ac_dir/$1" if test -n "$file_magic_test_file"; then - case "$deplibs_check_method" in - "file_magic "*) - file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" FILE="$lt_cv_path_FILE" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - egrep "$file_magic_regex" > /dev/null; then - : - else - cat <&2 + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. @@ -327,8 +327,8 @@ dnl not every word. This closes a longstanding sh security hole. *** bug-libtool@gnu.org EOF - fi ;; - esac + fi ;; + esac fi break fi @@ -637,8 +637,7 @@ AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; esac LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la - INCLTDL=ifelse($#,1,-I$1, - ['-I${top_builddir}/libltdl -I${top_srcdir}/libltdl']) + INCLTDL=ifelse($#,1,-I$1,['-I${top_srcdir}/libltdl']) ]) # AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for @@ -662,8 +661,7 @@ AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl 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 - INCLTDL=ifelse($#,1,-I$1, - ['-I${top_builddir}/libltdl -I${top_srcdir}/libltdl']) + INCLTDL=ifelse($#,1,-I$1,['-I${top_srcdir}/libltdl']) else ac_configure_args="$ac_configure_args --enable-ltdl-install=no" LIBLTDL="-lltdl" diff --git a/libtoolize.in b/libtoolize.in index 5b90ae1d..3bcdbf6d 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -238,12 +238,12 @@ if test -z "$automake"; then instserial=`grep '^# serial ' $ltdl_m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` if test -z "$instserial"; then - echo "$progname: warning: no serial number on \`$ltdl_m4'" 1>&2 + echo "$progname: warning: no serial number on \`$ltdl_m4'" 1>&2 else - # If the local macro has no serial number, we assume it's ancient. - localserial=`grep '^# serial ' aclocal.m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` + # If the local macro has no serial number, we assume it's ancient. + localserial=`grep '^# serial ' aclocal.m4 | grep 'AC_LIB_LTDL' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` - test -z "$localserial" && localserial=0 + test -z "$localserial" && localserial=0 if test "$localserial" -lt "$instserial"; then echo "You should $updatemsg." diff --git a/ltconfig.in b/ltconfig.in index 29a7f5e3..b81e3517 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -1042,7 +1042,7 @@ EOF if test "x$lt_cv_need_dllmain" = "xyes"; then ltdll_obj='$objdir/$soname-ltdll.'"$objext " ltdll_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ - test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~' + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~' else ltdll_obj= ltdll_cmds= @@ -1061,10 +1061,10 @@ EOF _lt_hint=1; cat $export_symbols | while read symbol; do set dummy \$symbol; - case \$# in - 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; - *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; - esac; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; + esac; _lt_hint=`expr 1 + \$_lt_hint`; done~ '"$ltdll_cmds"' @@ -1134,9 +1134,9 @@ EOF *) # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else - whole_archive_flag_spec= + whole_archive_flag_spec= fi ;; esac diff --git a/ltdl.m4 b/ltdl.m4 index 12961f95..90627d23 100644 --- a/ltdl.m4 +++ b/ltdl.m4 @@ -33,7 +33,7 @@ dnl of the ltdl objects -- including compiler checks (above) and header dnl checks (below). AC_REQUIRE([AC_HEADER_STDC])dnl -AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h unistd.h ctype.h dlfcn.h dl.h dld.h) +AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dlfcn.h dl.h dld.h) AC_CHECK_HEADERS(string.h strings.h, break) AC_CHECK_FUNCS(strchr index, break) AC_CHECK_FUNCS(strrchr rindex, break) @@ -41,6 +41,7 @@ AC_CHECK_FUNCS(strrchr rindex, break) AC_REQUIRE([AC_LTDL_ENABLE_INSTALL])dnl AC_REQUIRE([AC_LTDL_SHLIBEXT])dnl AC_REQUIRE([AC_LTDL_SHLIBPATH])dnl +AC_REQUIRE([AC_LTDL_SYSSEARCHPATH])dnl AC_REQUIRE([AC_LTDL_OBJDIR])dnl AC_REQUIRE([AC_LTDL_DLPREOPEN])dnl AC_REQUIRE([AC_LTDL_DLLIB])dnl @@ -96,6 +97,28 @@ if test -n "$libltdl_cv_shlibpath_var"; then fi ]) +AC_DEFUN(AC_LTDL_SYSSEARCHPATH, +[AC_REQUIRE([AC_LTDL_SNARF_CONFIG])dnl +AC_CACHE_CHECK([for the default library search path], + libltdl_cv_sys_search_path, [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$libltdl_cv_sys_search_path"; then + case "$lt_target" in + *-*-mingw*) pathsep=";" ;; + *) pathsep=":" ;; + esac + sys_search_path= + for dir in $libltdl_cv_sys_search_path; do + if test -z "$sys_search_path"; then + sys_search_path="$dir" + else + sys_search_path="$sys_search_path$pathsep$dir" + fi + done + AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path", + [Define to the system default library search path. ]) +fi +]) + AC_DEFUN(AC_LTDL_OBJDIR, [AC_CACHE_CHECK([for objdir], libltdl_cv_objdir, [libltdl_cv_objdir="$objdir" diff --git a/ltmain.c b/ltmain.c index eb60e742..8252dc4d 100644 --- a/ltmain.c +++ b/ltmain.c @@ -1,5 +1,5 @@ /* ltmain.c - C implementation of GNU Libtool - * Copyright (C) 1998-2000 Free Software Foundation, Inc. + * Copyright (C) 1998-1999 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/ltmain.in b/ltmain.in index 8fc3deea..148a37c6 100644 --- a/ltmain.in +++ b/ltmain.in @@ -287,16 +287,16 @@ if test -z "$show_help"; then # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" + arg="\"$arg\"" ;; esac - # Add the previous argument to base_compile. - if test -z "$base_compile"; then + # Add the previous argument to base_compile. + if test -z "$base_compile"; then base_compile="$lastarg" - else + else base_compile="$base_compile $lastarg" - fi + fi continue ;; esac @@ -317,13 +317,13 @@ if test -z "$show_help"; then ;; -Xcompiler) - prev=xcompiler - continue + prev=xcompiler + continue ;; -Wc,*) - args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` - lastarg= + args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` + lastarg= IFS="${IFS= }"; save_ifs="$IFS"; IFS=',' for arg in $args; do IFS="$save_ifs" @@ -341,7 +341,7 @@ if test -z "$show_help"; then IFS="$save_ifs" lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` - # Add the arguments to base_compile. + # Add the arguments to base_compile. if test -z "$base_compile"; then base_compile="$lastarg" else @@ -381,7 +381,7 @@ if test -z "$show_help"; then # in scan sets, so we specify it separately. case "$lastarg" in *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - lastarg="\"$lastarg\"" + lastarg="\"$lastarg\"" ;; esac @@ -1312,6 +1312,22 @@ compiler." eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" lib_search_path="$lib_search_path $sys_lib_search_path $shlib_search_path" + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + # Create the object directory. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + case "$output" in "") $echo "$modename: you must specify an output file" 1>&2 @@ -1328,70 +1344,665 @@ compiler." linkmode=prog ;; esac - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - - # Create the object directory. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status + save_deplibs="$deplibs" + deplibs= + newdependency_libs= + uninst_path= # paths that contain uninstalled libtool libraries + new_lib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + case $linkmode in + lib) + passes="link" + ;; + prog) + alldeplibs=no + link_against_libtool_libs= + passes="scan link" + ;; + *) passes="link" + ;; + esac + for pass in $passes; do + if test "$linkmode,$pass" = "prog,link"; then + save_deplibs="$deplibs %DEPLIBS% $dependency_libs" fi - fi - if test $linkmode != lib && test $linkmode != prog; then - # Find libtool convenience libraries - for deplib in $deplibs; do + for deplib in $save_deplibs; do + lib= + found=no case "$deplib" in - -l* | -L*) - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives/objects" 1>&2 + -l*) + if test $linkmode != lib && test $linkmode != prog; then + $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 + continue + fi + name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` + for searchdir in $lib_search_path; do + # Search the libtool library + lib="$searchdir/lib${name}.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + if test "$linkmode,$pass" = "prog,link"; then + compile_command="$compile_command $deplib" + finalize_command="$finalize_command $deplib" + else + deplibs="$deplibs $deplib" + test $linkmode = lib && newdependency_libs="$newdependency_libs $deplib" + fi + continue + fi + ;; + -L*) + case $linkmode in + lib) + case "$deplibs " in + *" $deplib "*) ;; + *) + deplibs="$deplibs $deplib" + newdependency_libs="$newdependency_libs $deplib" + new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + ;; + esac + ;; + prog) + if test $pass = scan; then + deplibs="$deplibs $deplib" + new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` + else + compile_command="$compile_command $deplib" + finalize_command="$finalize_command $deplib" + fi + ;; + *) + $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 + ;; + esac continue ;; + -R*) + if test "$linkmode,$pass" = "prog,link"; then + dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + fi + ;; + *.a | *.lib) + if test $linkmode = prog; then + if test $pass = scan; then + deplibs="$deplibs $deplib" + else + compile_command="$compile_command $deplib" + finalize_command="$finalize_command $deplib" + fi + continue + elif test $linkmode = lib; then + if test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $deplib." + 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." + else + echo + echo "*** Warning: Linking the shared library $output against the" + echo "*** static library $deplib is not portable!" + deplibs="$deplibs $deplib" + fi + continue + fi + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + *) + lib="$deplib" + ;; esac - if test -f "$deplib"; then : + if test $found = yes || test -f "$lib"; then : else - $echo "$modename: cannot find the library \`$deplib'" 1>&2 + $echo "$modename: cannot find the library \`$lib'" 1>&2 exit 1 fi - libdir= - old_library= # Check to see that this really is a libtool archive. - if (sed -e '2q' $deplib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 exit 1 fi - ladir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$deplib" && ladir="." + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + + libdir= + library_names= + old_library= + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes # Read the .la file - case "$deplib" in - */* | *\\*) . $deplib ;; - *) . ./$deplib ;; + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; esac - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$deplib'" 1>&2 + if test $linkmode != lib && test $linkmode != prog; then + # only check for convenience libraries + if test -z "$old_library"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + if test -n "$libdir"; then + $echo "$modename: \`$lib' is not a convenience library" 1>&2 + exit 1 + fi + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + continue + fi + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 exit 1 fi - if test -n "$libdir"; then - $echo "$modename: \`$deplib' is not a convenience library" 1>&2 - exit 1 + if test "$linkmode,$pass" = "prog,scan"; then + new_lib_search_path="$new_lib_search_path $ladir" + deplibs="$deplibs $lib" + + for deplib in $dependency_libs; do + case "$deplib" in + -L*) new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test + esac + + if test "$link_all_deplibs" != no || \ + test "$fast_install" != no || \ + test "$build_libtool_libs" = no || \ + test -z "$library_names"; then + # Need to link against all dependency_libs + deplibs="$deplibs $deplib" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$newdependency_libs $deplib" + fi + done + continue fi + + # We need an absolute path. + case "$ladir" in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + abs_ladir="$ladir" + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + $echo "$modename: warning: library \`$lib' was moved." 1>&2 + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$libdir" + absdir="$libdir" + fi + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + uninst_path="$uninst_path $abs_ladir" + fi + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $ladir/$objdir/$old_library" + old_convenience="$old_convenience $ladir/$objdir/$old_library" + if test $linkmode = lib; then + deplibs="$deplibs $ladir/$objdir/$old_library" + newdependency_libs="$newdependency_libs $dependency_libs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_command="$compile_command $dir/$old_library" + finalize_command="$finalize_command $dir/$old_library" + fi + continue + fi + + if test "$linkmode,$pass" = "prog,link"; then + hardcode=yes + test "$hardcode_into_libs" = all && test "$alldeplibs" = yes && hardcode=no + if test "$hardcode" = yes && test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; 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 + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # Do we only need to link against static libraries? + continue + fi + fi + + link_static=no # Whether this library is linked statically + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $lib" + test "X$installed" = xno && need_relink=yes + # This is a shared library + if test $linkmode = lib && test "$hardcode_into_libs" = all; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + libname=`eval \\$echo \"$libname_spec\"` + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi + + if test $linkmode = lib; then + + add_dir= + add_shlibpath= + add_name=no + if test "$mode" != relink; then + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + deplibs="$deplibs $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add_name=yes + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add_name=yes + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + deplibs="$deplibs $dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + add_name=yes + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add_name=yes + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + if test -n "$add_shlibpath"; then + case ":$compile_shlibpath:" in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + else + # Install command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + deplibs="$deplibs $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add_name=yes + elif test "$hardcode_shlibpath_var" = yes; then + add_name=yes + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add_name=yes + fi + fi + if test "$hardcode_direct" != yes && \ + test "$hardcode_minus_L" != yes && \ + test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + fi + if test -n "$add_dir"; then + case "$deplibs " in + *" $add_dir "*) ;; + *) deplibs="$deplibs $add_dir" ;; + esac + fi + test "$add_name" = yes && deplibs="$deplibs -l$name" + + else + + lib_linked=yes + add_dir= + add_shlibpath= + add_name=no + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add_name=yes + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add_name=yes + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" + add_name=yes + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$absdir" + add_name=yes + else + lib_linked=no + fi + ;; + + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + if test -n "$add_dir"; then + case "$compile_command " in + *" $add_dir "*) ;; + *) compile_command="$compile_command $add_dir" ;; + esac + fi + if test -n "$add_shlibpath"; then + case ":$compile_shlibpath:" in + *":$add_shlibpath:"*) ;; + *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; + esac + fi + test "$add_name" = yes && compile_command="$compile_command -l$name" + + add_dir= + add_name=no + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add_name=yes + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; + esac + add_name=yes + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + add_name=yes + fi + if test -n "$add_dir"; then + case "$finalize_command " in + *" $add_dir "*) ;; + *) finalize_command="$finalize_command $add_dir" ;; + esac + fi + test "$add_name" = yes && finalize_command="$finalize_command -l$name" + + fi + elif test $linkmode = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if 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 $lib." + 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." + else + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs $dir/$old_library" + link_static=yes + fi + fi + + if test "$linkmode" = "lib"; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" = no || test $build_old_libs = yes || + test $link_static = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case "$libdir" in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + new_lib_search_path="$new_lib_search_path $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$newdependency_libs $abs_ladir/$laname" + # ... and its dependency_libs + newdependency_libs="$newdependency_libs $dependency_libs" + + if test $link_all_deplibs != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + case "$deplib" in + -L*) path="$deplib" ;; + *.la) + if grep "^installed=no" $deplib > /dev/null; then + dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$deplib" && dir="." + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + absdir="$dir" + fi + ;; + esac + path="-L$absdir/$objdir" + else + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + path="-L$libdir" + fi + ;; + *) + continue + ;; + esac + case "$deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi + fi done - fi + dependency_libs="$newdependency_libs" + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $new_lib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + lib_search_path="$lib_search_path $sys_lib_search_path" + done case "$linkmode" in oldlib) @@ -1452,9 +2063,16 @@ compiler." ;; esac - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 + exit 1 + else + echo + echo "*** Warning: Linking the shared library $output against the non-libtool" + echo "*** objects $objs is not portable!" + libobjs="$libobjs $objs" + fi fi if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then @@ -1652,381 +2270,6 @@ compiler." oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi - # Save some variables - name_save=$name - libname_save=$libname - - # Find libtool libraries and add their dependencies and directories - save_deplibs="$deplibs" - deplibs= # libraries to link (used in archive_cmds) - newdependency_libs= # all dependency libraries - uninst_path= # paths that contain uninstalled libtool libraries - new_lib_search_path= - for deplib in $save_deplibs; do - lib= - case "$deplib" in - -L*) - case "$deplibs " in - *" $deplib "*) ;; - *) - deplibs="$deplibs $deplib" - newdependency_libs="$newdependency_libs $deplib" - new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - esac - continue - ;; - -l*) - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - found=no - for searchdir in $lib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - deplibs="$deplibs $deplib" - newdependency_libs="$newdependency_libs $deplib" - continue - fi - ;; - *) - lib="$deplib" - if test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - ;; - esac - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - 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="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - - # Read the .la file - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - deplibs="$deplibs $ladir/$objdir/$old_library" - newdependency_libs="$newdependency_libs $dependency_libs" - continue - fi - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - uninst_path="$uninst_path $abs_ladir" - fi - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - link_static=no # Whether this library is linked statically - - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - # This is a shared library - if test "$hardcode_into_libs" = all; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi - - add_dir= - add_shlibpath= - add_name=no - if test "$mode" != relink; then - lib_linked=yes - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - deplibs="$deplibs $dir/$linklib" - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add_name=yes - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add_name=yes - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - deplibs="$deplibs $dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - add_name=yes - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add_name=yes - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - if test -n "$add_shlibpath"; then - case ":$compile_shlibpath:" in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - else - # Install command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - deplibs="$deplibs $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add_name=yes - elif test "$hardcode_shlibpath_var" = yes; then - add_name=yes - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - add_name=yes - fi - fi - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - if test -n "$add_dir"; then - case "$deplibs " in - *" $add_dir "*) ;; - *) deplibs="$deplibs $add_dir" ;; - esac - fi - test "$add_name" = yes && deplibs="$deplibs -l$name" - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if 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." - else - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs $dir/$old_library" - link_static=yes - fi - fi - - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" = no || test $build_old_libs = yes || - test $link_static = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case "$libdir" in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - new_lib_search_path="$new_lib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$newdependency_libs $abs_ladir/$laname" - # ... and its dependency_libs - newdependency_libs="$newdependency_libs $dependency_libs" - - if test $link_all_deplibs != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case "$deplib" in - -L*) path="$deplib" ;; - *.la) - if grep "^installed=no" $deplib > /dev/null; then - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - path="-L$absdir/$objdir" - else - eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - if test -z "$libdir"; then - $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 - exit 1 - fi - path="-L$libdir" - fi - ;; - *) - continue - ;; - esac - case "$deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi - done - - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $new_lib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - lib_search_path="$lib_search_path $sys_lib_search_path" - dependency_libs="$newdependency_libs" - # Eliminate all temporary directories. for path in $uninst_path; do lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` @@ -2049,10 +2292,6 @@ compiler." fi fi - # Restore the variables - libname=$libname_save - name=$name_save - if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case "$host" in @@ -2663,442 +2902,6 @@ EOF fi fi - # Find libtool libraries and add their dependencies - save_deplibs="$deplibs" - deplibs= - newdependency_libs= - new_lib_search_path= - for deplib in $save_deplibs; do - lib= - case "$deplib" in - *.a | *.lib) - deplibs="$deplibs $deplib" - continue - ;; - -L*) - deplibs="$deplibs $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//'` - found=no - for searchdir in $lib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - deplibs="$deplibs $deplib" - continue - fi - ;; - *) - lib="$deplib" - if test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - ;; - esac - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - - # Read the .la file - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`" ### testsuite: skip nested quoting test - deplibs="$deplibs $lib" - - for deplib in $dependency_libs; do - case "$deplib" in - -L*) - new_lib_search_path="$new_lib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` ### testsuite: skip nested quoting test - ;; - esac - - if test "$link_all_deplibs" != no || \ - test "$fast_install" != no || \ - test "$build_libtool_libs" = no || \ - test -z "$library_names"; then - # Need to link against all dependency_libs - deplibs="$deplibs $deplib" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$newdependency_libs $deplib" - fi - done - done - dependency_libs="$newdependency_libs" - - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $new_lib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - lib_search_path="$lib_search_path $sys_lib_search_path" - - # Find libtool libraries and add their directories - alldeplibs=no - link_against_libtool_libs= - - for deplib in $deplibs @DEPLIBS@ $dependency_libs; do - lib= - case "$deplib" in - -L* | *.a | *.lib) - compile_command="$compile_command $deplib" - finalize_command="$finalize_command $deplib" - continue - ;; - -R*) - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - @DEPLIBS@) - alldeplibs=yes - continue - ;; - -l*) - name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` - found=no - for searchdir in $lib_search_path; do - # Search the libtool library - lib="$searchdir/lib${name}.la" - if test -f "$lib"; then - found=yes - break - fi - done - if test "$found" != yes; then - compile_command="$compile_command $deplib" - finalize_command="$finalize_command $deplib" - continue - fi - ;; - *) - lib="$deplib" - if test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - ;; - esac - libdir= - library_names= - old_library= - - # Check to see that this really is a libtool archive. - if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : - else - $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 - exit 1 - fi - - 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="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$abs_ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes - - # Read the .la file - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done - - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 - fi - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - fi - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - - hardcode=yes - test "$hardcode_into_libs" = all && test "$alldeplibs" = yes && hardcode=no - if test "$hardcode" = yes && test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; 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 - *" $dir "*) ;; - *" $absdir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - fi - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { 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 -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then - link_against_libtool_libs="$link_against_libtool_libs $lib" - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - $show "extracting exported symbol list from \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi - - lib_linked=yes - add_dir= - add_shlibpath= - add_name=no - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add_name=yes - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add_name=yes - else - lib_linked=no - fi - ;; - - relink) - if test "$hardcode_direct" = yes; then - compile_command="$compile_command $absdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" - add_name=yes - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$absdir" - add_name=yes - else - lib_linked=no - fi - ;; - - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - if test -n "$add_dir"; then - case "$compile_command " in - *" $add_dir "*) ;; - *) compile_command="$compile_command $add_dir" ;; - esac - fi - if test -n "$add_shlibpath"; then - case ":$compile_shlibpath:" in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - test "$add_name" = yes && compile_command="$compile_command -l$name" - - add_dir= - add_name=no - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add_name=yes - elif test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - add_name=yes - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - add_name=yes - fi - if test -n "$add_dir"; then - case "$finalize_command " in - *" $add_dir "*) ;; - *) finalize_command="$finalize_command $add_dir" ;; - esac - fi - test "$add_name" = yes && finalize_command="$finalize_command -l$name" - else - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$dir";; - esac - finalize_command="$finalize_command -l$name" - fi - fi - done - if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do @@ -4571,8 +4374,8 @@ relink_command=\"$relink_command\"" if test -z "$run"; then if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" + # Export the shlibpath_var. + eval "export $shlibpath_var" fi # Restore saved enviroment variables @@ -4591,8 +4394,8 @@ relink_command=\"$relink_command\"" else # Display what would be done. if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" fi $echo "$cmd$args" exit 0 diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index 1eda10ea..bd23885e 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = no-dependencies foreign -INCLUDES = -I$(srcdir)/../libltdl +INCLUDES = $(INCLTDL) EXTRA_DIST = acinclude.m4 diff --git a/mdemo/configure.in b/mdemo/configure.in index 363d18de..7faa720e 100644 --- a/mdemo/configure.in +++ b/mdemo/configure.in @@ -12,6 +12,7 @@ dnl Since the package is flat, we need not use the line above, dnl and not having macros in LIBLTDL allows us to build LIBLTDL dnl on demand even with broken makes AC_LIBLTDL_CONVENIENCE(../libltdl) +AC_SUBST(INCLTDL) AC_SUBST(LIBLTDL) AC_LIBTOOL_WIN32_DLL diff --git a/mdemo/foo.h b/mdemo/foo.h index d6d5bdc4..48dc9127 100644 --- a/mdemo/foo.h +++ b/mdemo/foo.h @@ -1,5 +1,5 @@ /* foo.h -- interface to the libfoo* libraries - Copyright (C) 1998-2000 Free Software Foundation, Inc. + Copyright (C) 1998-1999 Free Software Foundation, Inc. Originally by Thomas Tanner This file is part of GNU Libtool. diff --git a/mdemo/foo1.c b/mdemo/foo1.c index 67144c98..a6a28dd2 100644 --- a/mdemo/foo1.c +++ b/mdemo/foo1.c @@ -1,5 +1,5 @@ /* foo1.c -- trivial test library - Copyright (C) 1998-2000 Free Software Foundation, Inc. + Copyright (C) 1998-1999 Free Software Foundation, Inc. Originally by Thomas Tanner This file is part of GNU Libtool. diff --git a/mdemo/foo2.c b/mdemo/foo2.c index 503dc402..a747d4c6 100644 --- a/mdemo/foo2.c +++ b/mdemo/foo2.c @@ -1,5 +1,5 @@ /* foo2.c -- trivial test library - Copyright (C) 1998-2000 Free Software Foundation, Inc. + Copyright (C) 1998-1999 Free Software Foundation, Inc. Originally by Thomas Tanner This file is part of GNU Libtool. diff --git a/mkstamp b/mkstamp index ff4fd0d1..08239af9 100755 --- a/mkstamp +++ b/mkstamp @@ -1,7 +1,7 @@ #! /bin/sh # mkstamp - extract data from Revision and Date RCS tags in a file -# Copyright (C) 1999-2000 Free Software Foundation, Inc. +# Copyright (C) 1999 Free Software Foundation, Inc. # Alexandre Oliva # # This file is free software; you can redistribute it and/or modify it diff --git a/tests/Makefile.am b/tests/Makefile.am index 83f4a13d..c7ec7846 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -46,7 +46,8 @@ LIBS = @LIBS@ # Be sure to reexport important environment variables. TESTS_ENVIRONMENT = CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ LD="$(LD)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \ - LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" + LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ + OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" EXTRA_DIST = defs $(TESTS) diff --git a/tests/dryrun.test b/tests/dryrun.test index 5a8d20f1..0fd60d95 100755 --- a/tests/dryrun.test +++ b/tests/dryrun.test @@ -43,7 +43,7 @@ mv $objdir/libtool.new libtool # main.o is not compiled with libtool, but it depends on it, so make # sure it is up-to-date -$make main.o || exit 1 +$make main.$OBJEXT || exit 1 echo "= Making object files in ../mdemo (dry run)" ls -l . $objdir > $before @@ -65,12 +65,12 @@ $make foo1.la libfoo2.la || exit 1 echo "= Making programs in ../mdemo (dry run)" ls -l . $objdir > $before -force_dry_run=yes $make mdemo mdemo.static 1>&2 || exit $? +force_dry_run=yes $make mdemo$EXEEXT mdemo.static 1>&2 || exit $? ls -l . $objdir > $after cmp $before $after > /dev/null || exit 1 # Now really make them echo "= Making programs in ../mdemo" -$make mdemo mdemo.static || exit 1 +$make mdemo$EXEEXT mdemo.static || exit 1 echo "= Running $make install in ../mdemo (dry run)" # Libtool does not create these directories @@ -88,7 +88,7 @@ $make install || exit 1 echo "= Running $make uninstall in ../mdemo (dry run)" # Libtool does not uninstall the programs, remove them first -rm -f $prefix/bin/mdemo $prefix/bin/mdemo.static +rm -f $prefix/bin/mdemo$EXEEXT $prefix/bin/mdemo.static ls -l . $objdir > $before ls -lR $prefix >> $before force_dry_run=yes $make uninstall 1>&2 || exit $?