From: Thomas Tanner Date: Wed, 19 Jan 2000 20:34:37 +0000 (+0000) Subject: * ltmain.in: rewrite of the ILD code, merge linking code for X-Git-Tag: release-1-3d~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8683e2f1b4f369a967213a2ed139440a78f3646b;p=thirdparty%2Flibtool.git * 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 --- diff --git a/ChangeLog b/ChangeLog index b967f0cec..a90e197b6 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 ba55ddc29..5a2f0be55 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 f27c173c5..3854c4354 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 d6d5bdc4a..48dc9127e 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 15df0900c..89da831bb 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 026f766df..7c123bb8e 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 ae9b6d8b4..4b6773997 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 2979874d9..6d4fee709 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 848407a0d..ec9a639b9 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 d0de6e5c1..d40dc5929 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 574554d2f..ba2fa7734 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 d140bfce4..fa70bb8b0 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 bcfea6846..555d0688f 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 97ac379fb..893e26bde 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 b41c5c52d..de75bd6f3 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 9fa7fffc7..d9b79fb08 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 bf5fdc8a6..d99d0200e 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 c7f110bb4..17ab6ea22 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 7339111f1..6940b624b 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 a241078fe..40dcfbd4f 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 f28659b4e..e1303d780 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 aafac4c94..1f01d23eb 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 901991d03..1d009a38b 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 76c451a44..9b31b2c4b 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 b712e5d7e..5bccb8fe9 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 5b90ae1de..3bcdbf6dd 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 29a7f5e30..b81e35177 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 12961f95d..90627d23a 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 eb60e742a..8252dc4d7 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 8fc3deeaa..148a37c65 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,192 +1344,794 @@ 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 - exit 1 + 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 - if test -n "$libdir"; then - $echo "$modename: \`$deplib' is not a convenience library" 1>&2 + # 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 - - # 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" - done - fi - - case "$linkmode" in - oldlib) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 - fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 - fi + if test "$linkmode,$pass" = "prog,scan"; then + new_lib_search_path="$new_lib_search_path $ladir" + deplibs="$deplibs $lib" - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi + 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 - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - 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%^.*/%%'` + + # 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 -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 - 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" + 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 -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - 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 - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - 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 - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case "$outputname" in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval libname=\"$libname_spec\" - ;; - *) - if test "$module" = no; then - $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 - $echo "$help" 1>&2 - exit 1 - fi - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` - eval libname=\"$libname_spec\" - else - libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + 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 - ;; - esac - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 - exit 1 - 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 - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 - 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 - set dummy $rpath - if test $# -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" + if test $linkmode = lib; then - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - libext=al - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - 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 -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 - fi + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else + 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 - # Parse the version information argument. - IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" + 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 + ;; - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit 1 - 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 + ;; - current="$2" - revision="$3" - age="$4" + *) lib_linked=no ;; + esac - # Check that each of the things are valid numbers. - case "$current" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) - $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit 1 - ;; - 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" - case "$revision" in - 0 | [1-9] | [1-9][0-9]*) ;; - *) + 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 + 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) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + objs="$objs$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + 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 + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 exit 1 @@ -1652,594 +2270,215 @@ 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//'` - ;; + # Eliminate all temporary directories. + for path in $uninst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; 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 + done + if test "$hardcode_into_libs" = no || test $build_old_libs = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # these systems don't actually have a c library (as such)! + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs ;; - *) - lib="$deplib" - if test -f "$lib"; then : + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c <&2 - exit 1 + # Error occured in the first compile. Let's try to salvage the situation: + # Compile a seperate program for each library. + for i in $deplibs; do + name="`expr $i : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" ; then + $rm conftest + $CC -o conftest conftest.c $i + # Did it work? + if test $? -eq 0 ; then + ldd_output=`ldd conftest` + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $i." + 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." + fi + else + droppeddeps=yes + echo + echo "*** Warning! Library $i is needed by this library but I was not able to" + echo "*** make it link in! You will probably need to install it or some" + echo "*** library that it depends on before this library will be fully" + echo "*** functional. Installing it before continuing would be even better." + fi + else + newdeplibs="$newdeplibs $i" + fi + done 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" + file_magic*) + set dummy $deplibs_check_method + file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` + for a_deplib in $deplibs; do + name="`expr $a_deplib : '-l\(.*\)'`" + # If $name is empty we are operating on a -L argument. + if test "$name" != "" ; then + libname=`eval \\$echo \"$libname_spec\"` + for i in $lib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_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." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes 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 + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save - # 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'` - deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` - dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" = no || test $build_old_libs = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - 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 - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *) - # Add libc to deplibs on all other systems. - deplibs="$deplibs -lc" - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case "$deplibs_check_method" in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | sed 's/.* -> //'` - case "$potliblink" in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | sed 10q \ - | egrep "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $a_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." - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ - -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | - grep . >/dev/null; then - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then + if test "$droppeddeps" = yes; then + if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" echo "*** dependencies of module $libname. Therefore, libtool will create" @@ -2249,856 +2488,420 @@ EOF echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" != no; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static - for obj in $libobjs; do - xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$obj"; then - xdir="." - else - xdir="$xdir" - fi - baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - if test ! -f $xdir/$oldobj; then - $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" - $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? - fi - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - eval cmds=\"$export_symbols_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - $show "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags="$linker_flags $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink && test "$hardcode_into_libs" = all; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval cmds=\"$archive_expsym_cmds\" - else - eval cmds=\"$archive_cmds\" - fi - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$mode" = relink && test "$hardcode_into_libs" = all; then - $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? - exit 0 - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case "$output" in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit 1 - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" - status=$? - if test $status -ne 0 && test ! -d "$gentop"; then - exit $status - fi - generated="$generated $gentop" - - for xlib in $convenience; do - # Extract the objects. - case "$xlib" in - [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; - *) xabs=`pwd`"/$xlib" ;; - esac - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - xdir="$gentop/$xlib" - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi - $show "(cd $xdir && $AR x $xabs)" - $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? - - reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi fi + # Done checking deplibs! + deplibs=$newdeplibs fi - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" != no; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi - exit 0 - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop + shlibpath="$finalize_shlibpath" + test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi + + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - $show "echo timestamp > $libobj" - $run eval "echo timestamp > $libobj" || exit $? - exit 0 - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - eval cmds=\"$reload_cmds\" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - else - # Just create a symlink. - $show $rm $libobj - $run $rm $libobj - xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` - if test "X$xdir" = "X$libobj"; then - xdir="." + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" else - xdir="$xdir" + soname="$realname" fi - baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` - oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` - $show "(cd $xdir && $LN_S $oldobj $baseobj)" - $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - exit 0 - ;; + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done - prog) - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 - fi + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - if test "$preload" = yes; then - if test "$dlopen" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - 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 + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' fi - done - if test "$found" != yes; then - deplibs="$deplibs $deplib" - continue fi - ;; - *) - lib="$deplib" - if test -f "$lib"; then : + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit 1 - fi - ;; - esac - libdir= - library_names= - old_library= + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" - # 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 + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi fi - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linker_flags="$linker_flags $flag" + fi - # Read the .la file - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac + # Make a backup of the uninstalled library when relinking + if test "$mode" = relink && test "$hardcode_into_libs" = all; then + $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? + fi - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? done + IFS="$save_ifs" - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit 1 + # Restore the uninstalled library and exit + if test "$mode" = relink && test "$hardcode_into_libs" = all; then + $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? + exit 0 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" + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 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 + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" fi + 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%^.*/%%'` + obj) + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi - # If the library was installed with an old release of libtool, - # it will not redefine variable installed. - installed=yes + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi - # Read the .la file - case "$lib" in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi - # Get the name of the library we link against. - linklib= - for l in $old_library $library_names; do - linklib="$l" - done + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs$old_deplibs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 exit 1 fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac - # 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 + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done fi - name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + fi - 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 + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - # 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 + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop 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 + exit 0 + 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 "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + 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 + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + 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 -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + 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 - ;; + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + 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 - ;; + exit 0 + ;; - *) lib_linked=no ;; - esac + prog) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi - 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" + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi - 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 "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + 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 1eda10ea1..bd23885e3 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 363d18de8..7faa720e8 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 d6d5bdc4a..48dc9127e 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 67144c985..a6a28dd2c 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 503dc402b..a747d4c69 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 ff4fd0d1e..08239af9e 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 83f4a13d9..c7ec7846f 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 5a8d20f14..0fd60d95e 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 $?