Index: libtool/ChangeLog diff -c libtool/ChangeLog:1.922 libtool/ChangeLog:1.922.2.35 *** libtool/ChangeLog:1.922 Tue Apr 24 17:05:37 2001 --- libtool/ChangeLog Sun Sep 2 18:48:29 2001 *************** *** 1,3 **** --- 1,251 ---- + 2001-09-03 Gary V. Vaughan + + GNU libtool 1.4.1 was released. + + * configure.in: Bumped version to 1.4.1. + * config.sub, config.guess: Synchronised from ftp.gnu.org. + * doc/texinfo.tex: Ditto. + * NEWS: Updated. + * TODO: Remove fixed bugs. + + * ltdl.m4 (AC_CHECK_TYPES): This macro was introduced in Autoconf + 2.5x. Backported a fallback implementation (directly to ltdl.m4) + from Autoconf 2.50, so that we can still bootstrap with Autoconf + 2.13. + + From Marius Vollmer : + * libltdl/ltdl.c (tryall_dlopen_module): Don't forget to propogate + errors over recurse levels. + + 2001-09-03 Brad + + * libtool.m4 [openbsd*]: More improvements to the OpenBSD port. + + * libtool.m4 (deplibs_check_method) [aix*]: Removed redundant + setting of this variable. + + 2001-09-02 Gary V. Vaughan + + From Albert Chin : + * libtool.m4 (_LT_AC_LANG_C_CONFIG) [aix4*]: Be careful with + shared namespaces for static and shared libs. + (AC_LIBTOOL_DLOPEN_SELF): If all else fails, try dld_link from GNU + DLD. + + 2001-09-02 Christopher Pfisterer + + * libtool.m4, ltmain.in: Linker flag and version numbering fixes + for darwin. + + 2001-09-02 Gary V. Vaughan + + Backported the following patches from the development branch: + + Based on a patch from Marius Vollmer : + * NEWS: updated. + * ltdl.m4 (AC_LIB_LTDL): Check for unistd.h. + * libltdl/ltdl.c: Include unistd.h if it exists. + (LTDL_SEARCHPATH_VAR): Macro to prevent hardcoding + "LTDL_LIBRARY_PATH". + (LTDL_ARCHIVE_EXT): Macro to prevent hardcoding ".la". + (archive_ext): Have only one copy of ".la" in the readonly + segment of the compiled library. + (find_handle_callback): Don't bother trying to dlopen the file if + it doesn't exist. + (find_handle): Don't bother searching for files if no search_path + was supplied. + (file_not_found): A new function to determine whether the last + error was due to a file not found condition. + (try_dlopen): Renamed from lt_dlopen() and changed to have the + same footprint as tryall_dlopen. This involved a minor rewrite of + much of the internals of this function. + (lt_dlopen): A new function wrapped arounf try_dlopen(). + (lt_dlopenext): If a file already has a suitable extension, don't + bother adding additional extensions and trying to open those. + Tidy up the rest of the code to prevent continued searching with + an eventual FILE_NOT_FOUND when a genuine failure earlier in the + search process could be legitimately reported. + + * libltdl/ltdl.c (argz_create_sep): Don't forget to include the + terminating '\0' when counting argz_len. + (argz_create_sep): When canonicalizing argz, don't forget to copy + the terminating '\0', incase canonicalization has shortened argz. + (argz_stringify): Don't covert the final '\0' to a separator. + + * libltdl/ltdl.c (lt_dlhandle_next): Now we can loop through all + loaded module handles as originally intended. + + * libltdl/ltdl.c (lt_dlseterror): Oops. This never worked + either, due to a pair of typos. Now fixed. + + * libltdl/ltdl.c (N_ELEMENTS): Deleted. How come nobody noticed + there was no way this could have ever worked? + (lt_dlcaller_set_data): Now that valid caller_ids must be + non-zero, allocate an addition entry in the caller_data vector and + use a zero valued key as the end marker. + (lt_dlcaller_get_data): Iterate up to the end marker in one pass. + + * libltdl/ltdl.c (lt_dlcaller_register): Caller ids are allocated + starting from value `1', so that clients can use a value of zero + to indicate that libltdl has not yet initialised. + + * libltdl/ltdl.c (find_file_callback): Fix a multiple free() + bug. + (tryall_dlopen_module): Remove some unused variables. + + * libltdl/ltdl.c (lt_dlinsertsearchdir): Calculate the address + of the end of user_search_path correctly. + + * libltdl/ltdl.c (rpl_argz_stringify): New fallback implementation. + * ltdl.m4 (AC_LTDL_FUNC_ARGZ): Test for argz_stringify in libc. + * libltdl/ltdl.c (lt_argz_insertinorder): Renamed from + lt_argz_insert to make room for... + (lt_argz_insert): Wraps argz_insert with libltdl error handling. + (lt_dlpath_insertdir): Insert new path elements into an + argzized path. + (lt_dlinsertsearchdir): New function to insert new search + directories anywhere into user_search_path using the above. + (lt_dladdsearchdir): Rewritten to use lt_dlpath_insertdir. + * libltdl/ltdl.h (lt_dlinsertsearchdir): Prototype for export. + * doc/libtool.texi (Libltdl interface): Document it. + + 2001-08-18 Brad + + * ltmain.in: Do not remove -lm from deplibs for OpenBSD. + + 2001-08-05 Gary V. Vaughan + + From Brad : + * libtool.m4 (archive_cmds) [darwin, newsos, sysv4]: Replace + 1.3 era $linkopts references with $linker_flags. + + From Brad : + * libtool.m4 [openbsd]: OpenBSD can build modules without a `lib' + prefix and version number. + + 2001-08-04 Gary V. Vaughan + + From Edouard G. Parmelan + * libtool.m4 [darwin, openbsd]: Fix quoting problems with + unquoted [] expressions. + + 2001-07-29 Albert Chin-A-Young + + * libtool.m4: Prefer shl_load to dlopen on HP-UX because + dlopen won't work properly without a patch. + + 2001-07-12 Dan McNichol + + From albert chin + * libtool.m4: Fix AIX run-time-linking when using gcc. + + From albert chin + * ltmain.in: Fix a case where the lockfile is not removed, thus + causing libtool to loop forever waiting for it to be removed. + + 2001-07-05 Gary V. Vaughan + + * libtool.m4 (_LT_AC_LTCONFIG_HACK): Revert to 1.3.x + sematics, and always build static libs when the host machine + cannot build shared libs. Even if static libs were explicitly + disabled. + + * libtool.m4 (AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE) [HPUX]: Define + lt_cv_sys_global_symbol_to_c_name_address to be a sed expression + for mangling the output of the symbol pipe into a brace delimited + C declaration of symbol name and address. + * ltmain.in: Use it to generate the fooS.c symbol name to address + map. + + 2001-06-30 Gary V. Vaughan + + Porting test improvements from multi-language-branch: + * tests/defs: Find and set the value of CC probed by libtool.m4 + * tests/link-2.test: Use a .lo wrapper script, and the value of + CC set by defs instead of hardcoding gcc. + * tests/link.test: Use the value of CC set by defs instead of + hardcoding gcc. + * tests/quote.test: Ditto. + * tests/suffix.test: Ditto. + + * libtool.m4 (_LT_AC_LTCONFIG_HACK) [aix*]: Always set + lt_prog_compiler_wl to `-Wl'. + Reported by Albert Chin-A-Young + + 2001-06-29 Gary V. Vaughan + + From Tim Van Holder + * tests/suffix.test: Typo in 2nd for loop. + + From Bruno Haible + * libtool.m4: undefine the m4 builtin `symbols', so that the + string `symbols' can be used in the rest of the code without + causing errors with autoconf-2.13. + + From "Golubev I. N." + * tests/Makefile.am (CPPLAGS): Typo. s/CPPLAGS/CPPFLAGS. + + * mdemo/Makefile,am (foo1_la_LIBADD): Add libsub.la, since foo1 + does use symbols from libsub.la -- only platforms that allow + undefined symbols in libraries were able to cope with this + previously. + Reported by Robert Collins + + From "Golubev I. N." + * libtool.m4 (AC_LIBTOOL_PROG_LD_SHLIBS) [sco3.2v5*]: Needs + -wl,-Bexport to make self dlopen work. + + From Chris Leishman + * libtool,m4 (_LT_AC_LTCONFIG_HACK) [darwin]: Cheap hack to + help fake a C++ compilation. + + From Bruno Haible + * NEWS: Updated. + * libtool.m4 (_LT_AC_LTCONFIG_HACK): Make sure ac_objext is + set to `lo' when testing for compiler output to *.lo filenames. + + 2001-06-28 Gary V. Vaughan + + From Alexander Bluhm + * libltdl/ltdl.c (lt_dlopen): Fix bad memory initialisation + assumptions. + + 2001-06-27 Gary V. Vaughan + + From brad@openbsd.org: + * NEWS: Updated. + * libtool.m4 (_LT_AC_LTCONFIG_HACK) [openbsd]: Improved support + for various openbsd platforms. + * ltmain.in: Ditto, + + 2001-05-20 Peter Eisentraut + + * libtool.m4 (_LT_AC_LTCONFIG_HACK): Fix typo in variable name. + + 2001-05-20 Alexandre Oliva + + * libtool.m4 (allow_undefined_flag) [aix4* | aix5*]: Fix quote + error. + + * ltmain.in (exec_cmd): New variable. Don't exec programs within + the big `case'; set the variable instead, and exec the cmd + afterwards, so that the shell gets a chance to clean up here-doc + files. + * NEWS: Update. + + 2001-05-16 Alan Modra + + * libtool.m4 (lt_cv_deplibs_check_method): pass_all for hppa*-linux. + + 2001-05-03 Andreas Jaeger , Andreas Schwab + + * ltmain.in (relink_command): Arrange for wrapper script to save + output to a variable and display it only if relinking fails. + + 2001-05-03 Alexandre Oliva + + * configure.in: Bumped version to 1.4.0a. + 2001-04-25 Gary V. Vaughan GNU libtool 1.4 was released. *************** *** 11,17 **** * libtool.m4: Support $host_os as /sysv5uw7*/ from newer config.guess in addition to older /unixware*/. Use compiler driver, not linker, for linking shared libraries. ! 2001-04-24 Gary V. Vaughan * libtool.m4, ltmain.in, libltdl/configure.in, --- 259,265 ---- * libtool.m4: Support $host_os as /sysv5uw7*/ from newer config.guess in addition to older /unixware*/. Use compiler driver, not linker, for linking shared libraries. ! 2001-04-24 Gary V. Vaughan * libtool.m4, ltmain.in, libltdl/configure.in, *************** *** 48,54 **** * ltmain.in (argument parsing): support dl[pre]open for both .o and .lo files * ltmain.in (deplibs_check): use portable test syntax ! * ltmain.in (help): document -prefer-[non-]pic flags * ltmain.in: improve readablity by adding some comments, rename uninst_* to notinst_* (more adequate name) --- 296,302 ---- * ltmain.in (argument parsing): support dl[pre]open for both .o and .lo files * ltmain.in (deplibs_check): use portable test syntax ! * ltmain.in (help): document -prefer-[non-]pic flags * ltmain.in: improve readablity by adding some comments, rename uninst_* to notinst_* (more adequate name) *************** *** 73,79 **** suite. * libltdl/ltdl.c (lt_dlexit): Quit loop if only resident modules are left. ! 2001-04-23 Gary V. Vaughan * doc/PLATFORMS: With this patch, my Solaris boxes now pass the --- 321,327 ---- suite. * libltdl/ltdl.c (lt_dlexit): Quit loop if only resident modules are left. ! 2001-04-23 Gary V. Vaughan * doc/PLATFORMS: With this patch, my Solaris boxes now pass the *************** *** 132,138 **** * libtool.m4: Improve NetBSD support. * ltmain.in: ditto. ! 2001-04-19 Dan McNichol * libtool.m4: Build standard shared libraries on AIX POWER --- 380,386 ---- * libtool.m4: Improve NetBSD support. * ltmain.in: ditto. ! 2001-04-19 Dan McNichol * libtool.m4: Build standard shared libraries on AIX POWER *************** *** 145,151 **** uses a SYSV type linker. Add a comment telling what to do if the TOC starts getting too large on AIX. * NEWS: mention aix5 support. ! 2001-04-18 Alexandre Oliva * TODO: Add -L- flag. --- 393,399 ---- uses a SYSV type linker. Add a comment telling what to do if the TOC starts getting too large on AIX. * NEWS: mention aix5 support. ! 2001-04-18 Alexandre Oliva * TODO: Add -L- flag. *************** *** 216,222 **** * libltdl/ltdl.c (sys_shl_open): Return a NULL module handle for self opening. (sys_shl_close): Be careful not to close a NULL module handle. ! (sys_shl_sym): Allow shl_findsym() to open NULL modules, but discard the modified module address it returns. * libltdl/ltdl.c (lt_dlopen): When reading the .la file, --- 464,470 ---- * libltdl/ltdl.c (sys_shl_open): Return a NULL module handle for self opening. (sys_shl_close): Be careful not to close a NULL module handle. ! (sys_shl_sym): Allow shl_findsym() to open NULL modules, but discard the modified module address it returns. * libltdl/ltdl.c (lt_dlopen): When reading the .la file, *************** *** 263,282 **** * libtoolize.in: Check configure.ac and prefer configure.ac to configure.in. ! * libtoolize.in: change recommendation from AM_PROG_LIBTOOL to AC_PROG_LIBTOOL. * libtool.m4: Generate dll/import libraries for cygwin according to the following: libFOO.a (static lib), libFOO.dll.a (import ! lib), cygFOO-version.dll (dll). Update postinstall_cmds and postuninstall_cmds to reflect this. ! * ltmain.in: Generate installed .la files with dlnames set to ../bin/cygFOO-version.dll for normal dlls. dlls for modules remain with the .la file. * libltdl/ltdl.c: Use windows paths while calling LoadLibrary. ! 2001-03-16 Albert Chin * libtool.m4 (save_CPPFLAGS): Fix typo. --- 511,530 ---- * libtoolize.in: Check configure.ac and prefer configure.ac to configure.in. ! * libtoolize.in: change recommendation from AM_PROG_LIBTOOL to AC_PROG_LIBTOOL. * libtool.m4: Generate dll/import libraries for cygwin according to the following: libFOO.a (static lib), libFOO.dll.a (import ! lib), cygFOO-version.dll (dll). Update postinstall_cmds and postuninstall_cmds to reflect this. ! * ltmain.in: Generate installed .la files with dlnames set to ../bin/cygFOO-version.dll for normal dlls. dlls for modules remain with the .la file. * libltdl/ltdl.c: Use windows paths while calling LoadLibrary. ! 2001-03-16 Albert Chin * libtool.m4 (save_CPPFLAGS): Fix typo. *************** *** 300,310 **** From Tor Lillqvist * libtool.m4 (export_symbols): On Windows, if the export_symbols file (which has been passed to libtool with the -export-symbols ! command line switch) already is a .def file, use it as is. * libtool.m4 (library_names_spec): Using m4 quotes correctly this time around! ! From Tor Lillqvist * libtool.m4 (library_names_spec): Use an appropriate filename prefix for dlls -- lib for mingw; cyg for cygwin; pw for pw32. --- 548,558 ---- From Tor Lillqvist * libtool.m4 (export_symbols): On Windows, if the export_symbols file (which has been passed to libtool with the -export-symbols ! command line switch) already is a .def file, use it as is. * libtool.m4 (library_names_spec): Using m4 quotes correctly this time around! ! From Tor Lillqvist * libtool.m4 (library_names_spec): Use an appropriate filename prefix for dlls -- lib for mingw; cyg for cygwin; pw for pw32. *************** *** 3480,3483 **** Continued in ChangeLog.0 ! $Revision: 1.922 $ $Date: 2001/04/25 00:05:37 $ --- 3728,3731 ---- Continued in ChangeLog.0 ! $Revision: 1.922.2.35 $ $Date: 2001/09/03 01:48:29 $ Index: libtool/NEWS diff -c libtool/NEWS:1.91 libtool/NEWS:1.91.2.6 *** libtool/NEWS:1.91 Tue Apr 24 17:05:37 2001 --- libtool/NEWS Sun Sep 2 18:48:29 2001 *************** *** 1,5 **** --- 1,13 ---- NEWS - list of user-visible changes between releases of GNU Libtool + New in 1.4.1: 2001-09-03; CVS version 1.4.0a, Libtool team: + * Better error messages from libltdl when loading fails. + * Don't leave here-doc files behind. + * Improved support for OpenBSD. + * Libtool will build with autoconf-2.50 and higher. + * Plug memory management bugs in libltdl. + * Prefer shl_load to dlopen for better operation on HP-UX. + New in 1.4: 2001-04-25; CVS version 1.3e, Libtool team: * Support for aix5*. * Bugfixes. Index: libtool/TODO diff -c libtool/TODO:1.46 libtool/TODO:1.46.2.1 *** libtool/TODO:1.46 Tue Apr 24 13:30:21 2001 --- libtool/TODO Sun Sep 2 18:48:29 2001 *************** *** 4,22 **** * Figure out why zsh echo builtin's removal of \ escapes is not detected by libtool's echo selector. - * Port the migration of all code from ltconfig into libtool.m4 to the - multi-language-branch, so that CVS automake can remove its references - to ltconfig. - * Fix the following bugs in libltdl: ! - error reporting of tryall_dlopen(): ! if the file actually doesn't exist (stat() fails or it wasn't dlpreopened) ! -> report `file not found' ! if it cannot be loaded (e.g. due to missing dependencies) ! -> report dlerror ! open question: which error should be reported if all dlloaders fail ! or if a specific module type can only be loaded by one of them, how report its dlerror? ! Also report dlerror() for dlclose and dlsym if available - Make sure that the dependency_libs of a dlpreopened module won't be loaded. * Check whether the version of libtool.m4 is compatible with --- 4,11 ---- * Figure out why zsh echo builtin's removal of \ escapes is not detected by libtool's echo selector. * Fix the following bugs in libltdl: ! - Report dlerror() for dlclose and dlsym if available - Make sure that the dependency_libs of a dlpreopened module won't be loaded. * Check whether the version of libtool.m4 is compatible with Index: libtool/config.guess diff -c libtool/config.guess:1.9 libtool/config.guess:1.9.2.1 *** libtool/config.guess:1.9 Tue Apr 24 17:05:38 2001 --- libtool/config.guess Sun Sep 2 18:48:29 2001 *************** *** 3,9 **** # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. ! timestamp='2001-04-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by --- 3,9 ---- # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. ! timestamp='2001-08-23' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by *************** *** 52,58 **** GNU config.guess ($timestamp) Originally written by Per Bothner. ! Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO --- 52,58 ---- GNU config.guess ($timestamp) Originally written by Per Bothner. ! Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO *************** *** 95,119 **** # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. ! case $CC_FOR_BUILD,$HOST_CC,$CC in ! ,,) echo "int dummy(){}" > $dummy.c for c in cc gcc c89 ; do ! ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 if test $? = 0 ; then ! CC_FOR_BUILD="$c"; break ! fi ! done ! rm -f $dummy.c $dummy.o $dummy.rel if test x"$CC_FOR_BUILD" = x ; then ! CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; ! esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. ! # (ghazi@noc.rutgers.edu 8/24/94.) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi --- 95,119 ---- # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. ! set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ! ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ! ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then ! CC_FOR_BUILD="$c"; break ; ! fi ; ! done ; ! rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then ! CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; ! esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. ! # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi *************** *** 150,155 **** --- 150,156 ---- # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then *************** *** 204,209 **** --- 205,211 ---- jsr \$26,exit .end main EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in *************** *** 225,230 **** --- 227,235 ---- 2-307) UNAME_MACHINE="alphaev67" ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; esac fi rm -f $dummy.s $dummy *************** *** 328,333 **** --- 333,341 ---- aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; + sparc*:NetBSD:*) + echo `uname -p`-unknown-netbsd${UNAME_RELEASE} + exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *************** *** 406,411 **** --- 414,420 ---- exit (-1); } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 *************** *** 486,491 **** --- 495,501 ---- exit(0); } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 *************** *** 586,591 **** --- 596,602 ---- exit (0); } EOF + eval $set_cc_for_build (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy *************** *** 623,628 **** --- 634,640 ---- exit (0); } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 *************** *** 633,639 **** 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; ! *9??*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) --- 645,651 ---- 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; ! *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) *************** *** 677,688 **** echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) ! echo ymp-cray-unicos${UNAME_RELEASE} exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ ! -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' --- 689,701 ---- echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) ! echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ ! -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ ! -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' *************** *** 763,859 **** echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) ! cat >$dummy.c < /* for printf() prototype */ ! int main (int argc, char *argv[]) { ! #else ! int main (argc, argv) int argc; char *argv[]; { ! #endif ! #ifdef __MIPSEB__ ! printf ("%s-unknown-linux-gnu\n", argv[1]); ! #endif ! #ifdef __MIPSEL__ ! printf ("%sel-unknown-linux-gnu\n", argv[1]); ! #endif ! return 0; ! } ! EOF ! $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 ! rm -f $dummy.c $dummy ;; ppc:Linux:*:*) ! # Determine Lib Version ! cat >$dummy.c < ! #if defined(__GLIBC__) ! extern char __libc_version[]; ! extern char __libc_release[]; ! #endif ! main(argc, argv) ! int argc; ! char *argv[]; ! { ! #if defined(__GLIBC__) ! printf("%s %s\n", __libc_version, __libc_release); ! #else ! printf("unknown\n"); ! #endif ! return 0; ! } ! EOF ! LIBC="" ! $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ! if test "$?" = 0 ; then ! ./$dummy | grep 1\.99 > /dev/null ! if test "$?" = 0 ; then LIBC="libc1" ; fi ! fi ! rm -f $dummy.c $dummy ! echo powerpc-unknown-linux-gnu${LIBC} exit 0 ;; alpha:Linux:*:*) ! cat <$dummy.s ! .data ! \$Lformat: ! .byte 37,100,45,37,120,10,0 # "%d-%x\n" ! .text ! .globl main ! .align 4 ! .ent main ! main: ! .frame \$30,16,\$26,0 ! ldgp \$29,0(\$27) ! .prologue 1 ! .long 0x47e03d80 # implver \$0 ! lda \$2,-1 ! .long 0x47e20c21 # amask \$2,\$1 ! lda \$16,\$Lformat ! mov \$0,\$17 ! not \$1,\$18 ! jsr \$26,printf ! ldgp \$29,0(\$26) ! mov 0,\$16 ! jsr \$26,exit ! .end main ! EOF ! LIBC="" ! $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null ! if test "$?" = 0 ; then ! case `./$dummy` in ! 0-0) UNAME_MACHINE="alpha" ;; ! 1-0) UNAME_MACHINE="alphaev5" ;; ! 1-1) UNAME_MACHINE="alphaev56" ;; ! 1-101) UNAME_MACHINE="alphapca56" ;; ! 2-303) UNAME_MACHINE="alphaev6" ;; ! 2-307) UNAME_MACHINE="alphaev67" ;; ! esac ! objdump --private-headers $dummy | \ ! grep ld.so.1 > /dev/null ! if test "$?" = 0 ; then ! LIBC="libc1" ! fi ! fi ! rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) --- 776,804 ---- echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) ! case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in ! big) echo mips-unknown-linux-gnu && exit 0 ;; ! little) echo mipsel-unknown-linux-gnu && exit 0 ;; ! esac ;; ppc:Linux:*:*) ! echo powerpc-unknown-linux-gnu ! exit 0 ;; ! ppc64:Linux:*:*) ! echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) ! case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ! EV5) UNAME_MACHINE=alphaev5 ;; ! EV56) UNAME_MACHINE=alphaev56 ;; ! PCA56) UNAME_MACHINE=alphapca56 ;; ! PCA57) UNAME_MACHINE=alphapca56 ;; ! EV6) UNAME_MACHINE=alphaev6 ;; ! EV67) UNAME_MACHINE=alphaev67 ;; ! EV68*) UNAME_MACHINE=alphaev68 ;; ! esac ! objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null ! if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) *************** *** 883,920 **** # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ! ld_supported_emulations=`cd /; ld --help 2>&1 \ ! | sed -ne '/supported emulations:/!d s/[ ][ ]*/ /g ! s/.*supported emulations: *// s/ .*// p'` ! case "$ld_supported_emulations" in ! i*86linux) ! echo "${UNAME_MACHINE}-pc-linux-gnuaout" ! exit 0 ! ;; ! elf_i*86) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; ! i*86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ! exit 0 ! ;; ! esac ! # Either a pre-BFD a.out linker (linux-gnuoldld) ! # or one that does not give us useful --help. ! # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. ! # If ld does not provide *any* "supported emulations:" ! # that means it is gnuoldld. ! test -z "$ld_supported_emulations" && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 ! case "${UNAME_MACHINE}" in ! i*86) ! VENDOR=pc; ! ;; ! *) ! VENDOR=unknown; ! ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c <&1 \ ! | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g ! s/.*supported targets: *// s/ .*// p'` ! case "$ld_supported_targets" in ! elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; ! a.out-i386-linux) ! echo "${UNAME_MACHINE}-pc-linux-gnuaout" ! exit 0 ;; ! coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ! exit 0 ;; ! "") ! # Either a pre-BFD a.out linker (linux-gnuoldld) or ! # one that does not give us useful --help. ! echo "${UNAME_MACHINE}-pc-linux-gnuoldld" ! exit 0 ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c <= 2 ! printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); # else ! printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif # else ! printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); # endif #else ! printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); #endif return 0; } EOF $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions - # are messed up and put the nodename in both sysname and nodename. i*86:DYNIX/ptx:4*:*) echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) --- 862,889 ---- #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 ! printf ("%s-pc-linux-gnu\n", argv[1]); # else ! printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else ! printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else ! printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) *************** *** 966,979 **** echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; ! i*86:*:5:7*) ! # Fixed at (any) Pentium or better ! UNAME_MACHINE=i586 ! if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then ! echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} ! else ! echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} ! fi exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then --- 902,914 ---- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; ! i*86:*:5:[78]*) ! case `/bin/uname -X | grep "^Machine"` in ! *486*) UNAME_MACHINE=i486 ;; ! *Pentium) UNAME_MACHINE=i586 ;; ! *Pent*|*Celeron) UNAME_MACHINE=i686 ;; ! esac ! echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then *************** *** 1067,1074 **** echo ns32k-sni-sysv fi exit 0 ;; ! PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ! # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) --- 1002,1009 ---- echo ns32k-sni-sysv fi exit 0 ;; ! PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort ! # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) *************** *** 1080,1085 **** --- 1015,1024 ---- # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; *************** *** 1172,1177 **** --- 1111,1122 ---- *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 *************** *** 1291,1296 **** --- 1236,1242 ---- } EOF + eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy Index: libtool/config.sub diff -c libtool/config.sub:1.8 libtool/config.sub:1.8.2.1 *** libtool/config.sub:1.8 Tue Apr 24 17:05:38 2001 --- libtool/config.sub Sun Sep 2 18:48:29 2001 *************** *** 3,9 **** # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. ! timestamp='2001-04-20' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software --- 3,9 ---- # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. ! timestamp='2001-08-23' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software *************** *** 117,123 **** # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in ! nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; --- 117,123 ---- # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in ! nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *************** *** 157,162 **** --- 157,170 ---- os=-vxworks basic_machine=$1 ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; -hiux*) os=-hiuxwe2 ;; *************** *** 215,240 **** case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. ! tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ ! | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ ! | pyramid | mn10200 | mn10300 | tron | a29k \ ! | 580 | i960 | h8300 \ ! | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ ! | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ ! | hppa64 \ ! | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ ! | alphaev6[78] \ ! | we32k | ns16k | clipper | i370 | sh | sh[34] \ ! | powerpc | powerpcle \ ! | 1750a | dsp16xx | pdp10 | pdp11 \ ! | mips16 | mips64 | mipsel | mips64el \ ! | mips64orion | mips64orionel | mipstx39 | mipstx39el \ ! | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ ! | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ ! | sparc | sparclet | sparclite | sparc64 | sparcv9 | sparcv9b \ ! | v850 | c4x \ ! | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ ! | pj | pjl | h8500) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) --- 223,257 ---- case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. ! 1750a | 580 \ ! | a29k \ ! | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ ! | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ ! | c4x | clipper \ ! | d10v | d30v | dsp16xx \ ! | fr30 \ ! | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ ! | i370 | i860 | i960 | ia64 \ ! | m32r | m68000 | m68k | m88k | mcore \ ! | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ ! | mips64vr4100 | mips64vr4100el | mips64vr4300 \ ! | mips64vr4300el | mips64vr5000 | mips64vr5000el \ ! | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ ! | mn10200 | mn10300 \ ! | ns16k | ns32k \ ! | openrisc \ ! | pdp10 | pdp11 | pj | pjl \ ! | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ ! | pyramid \ ! | s390 | s390x \ ! | sh | sh[34] | sh[34]eb | shbe | shle \ ! | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ ! | stormy16 | strongarm \ ! | tahoe | thumb | tic80 | tron \ ! | v850 \ ! | we32k \ ! | x86 | xscale \ ! | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) *************** *** 242,248 **** basic_machine=$basic_machine-unknown os=-none ;; ! m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | w65) ;; # We use `pc' rather than `unknown' --- 259,265 ---- basic_machine=$basic_machine-unknown os=-none ;; ! m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' *************** *** 257,287 **** exit 1 ;; # Recognize the basic CPU types with company name. ! # FIXME: clean up the formatting here. ! vax-* | tahoe-* | i*86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ ! | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ ! | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ ! | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ ! | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ ! | xmp-* | ymp-* \ ! | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ ! | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ ! | hppa2.0n-* | hppa64-* \ ! | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ ! | alphaev6[78]-* \ ! | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ ! | clipper-* | orion-* \ ! | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ ! | sparc64-* | sparcv9-* | sparcv9b-* | sparc86x-* \ ! | mips16-* | mips64-* | mipsel-* \ ! | mips64el-* | mips64orion-* | mips64orionel-* \ ! | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ ! | mipstx39-* | mipstx39el-* | mcore-* \ ! | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ ! | [cjt]90-* \ ! | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ ! | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ ! | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. --- 274,316 ---- exit 1 ;; # Recognize the basic CPU types with company name. ! 580-* \ ! | a29k-* \ ! | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ ! | alphapca5[67]-* | arc-* \ ! | arm-* | armbe-* | armle-* | armv*-* \ ! | bs2000-* \ ! | c[123]* | c30-* | [cjt]90-* | c54x-* \ ! | clipper-* | cray2-* | cydra-* \ ! | d10v-* | d30v-* \ ! | elxsi-* \ ! | f30[01]-* | f700-* | fr30-* | fx80-* \ ! | h8300-* | h8500-* \ ! | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ ! | i*86-* | i860-* | i960-* | ia64-* \ ! | m32r-* \ ! | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ ! | m88110-* | m88k-* | mcore-* \ ! | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ ! | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ ! | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ ! | mipsle-* | mipstx39-* | mipstx39el-* \ ! | none-* | np1-* | ns16k-* | ns32k-* \ ! | orion-* \ ! | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ ! | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ ! | pyramid-* \ ! | romp-* | rs6000-* \ ! | s390-* | s390x-* \ ! | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ ! | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ ! | sparcv9-* | sparcv9b-* | stormy16-* | strongarm-* | sv1-* \ ! | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ ! | v850-* | vax-* \ ! | we32k-* \ ! | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ ! | ymp-* \ ! | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. *************** *** 727,732 **** --- 756,771 ---- ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; ps2) basic_machine=i386-ibm ;; *************** *** 881,886 **** --- 920,929 ---- basic_machine=hppa1.1-winbond os=-proelf ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; xmp) basic_machine=xmp-cray os=-unicos *************** *** 934,940 **** we32k) basic_machine=we32k-att ;; ! sh3 | sh4) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) --- 977,983 ---- we32k) basic_machine=we32k-att ;; ! sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) *************** *** 1018,1028 **** | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ ! | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) --- 1061,1073 ---- | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ ! | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ ! | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) *************** *** 1345,1350 **** --- 1390,1398 ---- ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari + ;; + -vos*) + vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` Index: libtool/configure.in diff -c libtool/configure.in:1.52 libtool/configure.in:1.52.2.2 *** libtool/configure.in:1.52 Tue Apr 24 17:05:38 2001 --- libtool/configure.in Sun Sep 2 18:48:29 2001 *************** *** 2,8 **** AC_INIT(ltmain.in) ! AM_INIT_AUTOMAKE(libtool, 1.4) # This is a sanity check so we can see which version is used in bug reports. # It is assumed that we only want to see the date extension for cvs libtool --- 2,8 ---- AC_INIT(ltmain.in) ! AM_INIT_AUTOMAKE(libtool, 1.4.1) # This is a sanity check so we can see which version is used in bug reports. # It is assumed that we only want to see the date extension for cvs libtool Index: libtool/libtool.m4 diff -c libtool/libtool.m4:1.166 libtool/libtool.m4:1.166.2.20 *** libtool/libtool.m4:1.166 Tue Apr 24 16:40:42 2001 --- libtool/libtool.m4 Sun Sep 2 16:31:08 2001 *************** *** 23,28 **** --- 23,31 ---- ## the same distribution terms that you use for the rest of that program. # serial 46 AC_PROG_LIBTOOL + + builtin([undefine],[symbols]) + AC_DEFUN([AC_PROG_LIBTOOL], [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl *************** *** 179,184 **** --- 182,190 ---- # Transform an extracted symbol line into a proper C declaration lt_cv_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + # Transform an extracted symbol line into symbol name and symbol address + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + # Define system-specific variables. case $host_os in aix*) *************** *** 189,194 **** --- 195,201 ---- ;; hpux*) # Its linker distinguishes data from code symbols lt_cv_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" ;; irix*) [symcode='[BCDEGRST]'] *************** *** 260,282 **** cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ ! # define lt_ptr_t void * #else ! # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; ! lt_ptr_t address; } [lt_preloaded_symbols[] =] { EOF ! sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext ! {0, (lt_ptr_t) 0} }; #ifdef __cplusplus --- 267,289 ---- cat <> conftest.$ac_ext #if defined (__STDC__) && __STDC__ ! # define lt_ptr void * #else ! # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; ! lt_ptr address; } [lt_preloaded_symbols[] =] { EOF ! sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr) \&\2},/" < "$nlist" >> conftest.$ac_ext cat <<\EOF >> conftest.$ac_ext ! {0, (lt_ptr) 0} }; #ifdef __cplusplus *************** *** 320,329 **** global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" if test -z "$lt_cv_sys_global_symbol_pipe"; then global_symbol_to_cdecl= else global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" fi ! if test -z "$global_symbol_pipe$global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) --- 327,339 ---- global_symbol_pipe="$lt_cv_sys_global_symbol_pipe" if test -z "$lt_cv_sys_global_symbol_pipe"; then global_symbol_to_cdecl= + global_symbol_to_c_name_address= else global_symbol_to_cdecl="$lt_cv_global_symbol_to_cdecl" + global_symbol_to_c_name_address="$lt_cv_global_symbol_to_c_name_address" fi ! if test -z "$global_symbol_pipe$global_symbol_to_cdec$global_symbol_to_c_name_address"; ! then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) *************** *** 350,356 **** # will find an echo command which doesn;t interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], ! [AC_DIVERT_PUSH(NOTICE)]) _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # Check that we are running under the correct shell. --- 360,366 ---- # will find an echo command which doesn;t interpret backslashes. AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], [ifdef([AC_DIVERSION_NOTICE], [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], ! [AC_DIVERT_PUSH(NOTICE)]) _LT_AC_LIBTOOL_SYS_PATH_SEPARATOR # Check that we are running under the correct shell. *************** *** 614,629 **** ;; *) ! AC_CHECK_LIB(dl, dlopen, [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], ! [AC_CHECK_FUNC(dlopen, lt_cv_dlopen="dlopen", ! [AC_CHECK_FUNC(shl_load, lt_cv_dlopen="shl_load", ! [AC_CHECK_LIB(svld, dlopen, ! [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], ! [AC_CHECK_LIB(dld, shl_load, ! [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ]) ! ]) ! ]) ]) ;; esac --- 624,645 ---- ;; *) ! AC_CHECK_FUNC([shl_load], ! [lt_cv_dlopen="shl_load"], ! [AC_CHECK_LIB([dld], [shl_load], ! [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], ! [AC_CHECK_FUNC([dlopen], ! [lt_cv_dlopen="dlopen"], ! [AC_CHECK_LIB([dl], [dlopen], ! [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], ! [AC_CHECK_LIB([svld], [dlopen], ! [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], ! [AC_CHECK_LIB([dld], [dld_link], ! [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) ! ]) ]) ! ]) ! ]) ]) ;; esac *************** *** 758,765 **** old_postuninstall_cmds= if test -n "$RANLIB"; then old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" - old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" fi # Allow CC to be a program name with arguments. --- 774,788 ---- old_postuninstall_cmds= if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" fi # Allow CC to be a program name with arguments. *************** *** 785,791 **** ## FIXME: this should be a separate macro ## ! AC_ARG_WITH(pic, [ --with-pic try to use only PIC/non-PIC objects [default=use both]], pic_mode="$withval", pic_mode=default) test -z "$pic_mode" && pic_mode=default --- 808,814 ---- ## FIXME: this should be a separate macro ## ! AC_ARG_WITH(pic, [ --with-pic try to use only PIC/non-PIC objects [default=use both]], pic_mode="$withval", pic_mode=default) test -z "$pic_mode" && pic_mode=default *************** *** 813,819 **** # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but ! # we not sure about C++ programs. lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" ;; amigaos*) --- 836,842 ---- # libC (AIX C++ library), which obviously doesn't included in libraries # list by gcc. This cause undefined symbols with -static flags. # This hack allows C programs to be linked with "-static -ldl", but ! # not sure about C++ programs. lt_cv_prog_cc_static="$lt_cv_prog_cc_static ${lt_cv_prog_cc_wl}-lC" ;; amigaos*) *************** *** 848,860 **** # PORTME Check for PIC flags for the system compiler. case $host_os in aix3* | aix4* | aix5*) # All AIX code is PIC. if test "$host_cpu" = ia64; then ! # AIX 5 now supports IA64 processor ! lt_cv_prog_cc_static='-Bstatic' ! lt_cv_prog_cc_wl='-Wl,' else ! lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; --- 871,883 ---- # PORTME Check for PIC flags for the system compiler. case $host_os in aix3* | aix4* | aix5*) + lt_cv_prog_cc_wl='-Wl,' # All AIX code is PIC. if test "$host_cpu" = ia64; then ! # AIX 5 now supports IA64 processor ! lt_cv_prog_cc_static='-Bstatic' else ! lt_cv_prog_cc_static='-bnso -bI:/lib/syscalls.exp' fi ;; *************** *** 910,918 **** lt_cv_prog_cc_pic='-KPIC' lt_cv_prog_cc_static='-Bstatic' if test "x$host_vendor" = xsni; then ! lt_cv_prog_cc_wl='-LD' else ! lt_cv_prog_cc_wl='-Wl,' fi ;; --- 933,941 ---- lt_cv_prog_cc_pic='-KPIC' lt_cv_prog_cc_static='-Bstatic' if test "x$host_vendor" = xsni; then ! lt_cv_prog_cc_wl='-LD' else ! lt_cv_prog_cc_wl='-Wl,' fi ;; *************** *** 1063,1068 **** --- 1086,1093 ---- lt_cv_compiler_o_lo=no save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -c -o conftest.lo" + save_objext="$ac_objext" + ac_objext=lo AC_TRY_COMPILE([], [int some_variable = 0;], [dnl # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings *************** *** 1072,1081 **** lt_cv_compiler_o_lo=yes fi ]) CFLAGS="$save_CFLAGS" ]) compiler_o_lo=$lt_cv_compiler_o_lo ! AC_MSG_RESULT([$compiler_c_lo]) else compiler_o_lo=no fi --- 1097,1107 ---- lt_cv_compiler_o_lo=yes fi ]) + ac_objext="$save_objext" CFLAGS="$save_CFLAGS" ]) compiler_o_lo=$lt_cv_compiler_o_lo ! AC_MSG_RESULT([$compiler_o_lo]) else compiler_o_lo=no fi *************** *** 1180,1186 **** extract_expsyms_cmds= case $host_os in ! cygwin* | mingw* | pw32* ) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. --- 1206,1212 ---- extract_expsyms_cmds= case $host_os in ! cygwin* | mingw* | pw32*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. *************** *** 1188,1194 **** with_gnu_ld=no fi ;; ! esac ld_shlibs=yes --- 1214,1222 ---- with_gnu_ld=no fi ;; ! openbsd*) ! with_gnu_ld=no ! ;; esac ld_shlibs=yes *************** *** 1294,1311 **** # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then ! cp $export_symbols $output_objdir/$soname-def; else ! echo EXPORTS > $output_objdir/$soname-def; ! _lt_hint=1; ! cat $export_symbols | while read symbol; do ! set dummy \$symbol; ! case \[$]# in ! 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; ! *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; ! esac; ! _lt_hint=`expr 1 + \$_lt_hint`; ! done; fi~ '"$ltdll_cmds"' $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ --- 1322,1339 ---- # is EXPORTS), use it as is. # If DATA tags from a recent dlltool are present, honour them! archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then ! cp $export_symbols $output_objdir/$soname-def; else ! echo EXPORTS > $output_objdir/$soname-def; ! _lt_hint=1; ! cat $export_symbols | while read symbol; do ! set dummy \$symbol; ! case \[$]# in ! 2) echo " \[$]2 @ \$_lt_hint ; " >> $output_objdir/$soname-def;; ! *) echo " \[$]2 @ \$_lt_hint \[$]3 ; " >> $output_objdir/$soname-def;; ! esac; ! _lt_hint=`expr 1 + \$_lt_hint`; ! done; fi~ '"$ltdll_cmds"' $CC -Wl,--base-file,$output_objdir/$soname-base '$lt_cv_cc_dll_switch' -Wl,-e,'$dll_entry' -o $output_objdir/$soname '$ltdll_obj'$libobjs $deplibs $compiler_flags~ *************** *** 1400,1479 **** ;; aix4* | aix5*) # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_libdir_separator=':' if test "$GCC" = yes; then ! collect2name=`${CC} -print-prog-name=collect2` ! if test -f "$collect2name" && \ ! strings "$collect2name" | grep resolve_lib_name >/dev/null ! then ! # We have reworked collect2 ! hardcode_direct=yes ! else ! # We have old collect2 ! hardcode_direct=unsupported ! # It fails to find uninstalled libraries when the uninstalled ! # path is not listed in the libpath. Setting hardcode_minus_L ! # to unsupported forces relinking ! hardcode_minus_L=yes ! hardcode_libdir_flag_spec='-L$libdir' ! hardcode_libdir_separator= ! fi shared_flag='-shared' else if test "$host_cpu" = ia64; then ! shared_flag='-G' else ! shared_flag='${wl}-bM:SRE' fi - hardcode_direct=yes fi - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # Test if we are trying to use run time linking, or normal AIX style linking. - # If -brtl is somewhere in LDFLAGS, we need to do run time linking. - aix_use_runtimelinking=no - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then - aix_use_runtimelinking=yes - break - fi - done - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi # It seems that -bexpall can do strange things, so it is better to # generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' ! allow_undefined_flag=' -Wl,-G' ! archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else if test "$host_cpu" = ia64; then ! hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' ! allow_undefined_flag="-znodefs" ! archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else ! hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' ! # Warning - without using the other run time loading flags, -berok will ! # link without error, but may produce a broken library. ! allow_undefined_flag='${wl}-berok" ! # This is a bit strange, but is similar to how AIX traditionally builds ! # it's shared libraries. ! archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' fi fi ;; --- 1428,1523 ---- ;; aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + hardcode_direct=yes archive_cmds='' hardcode_libdir_separator=':' if test "$GCC" = yes; then ! case $host_os in aix4.[[012]]|aix4.[[012]].*) ! collect2name=`${CC} -print-prog-name=collect2` ! if test -f "$collect2name" && \ ! strings "$collect2name" | grep resolve_lib_name >/dev/null ! then ! # We have reworked collect2 ! hardcode_direct=yes ! else ! # We have old collect2 ! hardcode_direct=unsupported ! # It fails to find uninstalled libraries when the uninstalled ! # path is not listed in the libpath. Setting hardcode_minus_L ! # to unsupported forces relinking ! hardcode_minus_L=yes ! hardcode_libdir_flag_spec='-L$libdir' ! hardcode_libdir_separator= ! fi ! esac ! shared_flag='-shared' else + # not using gcc if test "$host_cpu" = ia64; then ! shared_flag='${wl}-G' else ! if test "$aix_use_runtimelinking" = yes; then ! shared_flag='${wl}-G' ! else ! shared_flag='${wl}-bM:SRE' ! fi fi fi # It seems that -bexpall can do strange things, so it is better to # generate a list of symbols to export. always_export_symbols=yes if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' ! archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then ! hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' ! allow_undefined_flag="-z nodefs" ! archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname ${wl}-h$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" else ! hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' ! # Warning - without using the other run time loading flags, ! # -berok will link without error, but may produce a broken library. ! allow_undefined_flag='${wl}-berok' ! # This is a bit strange, but is similar to how AIX traditionally builds ! # it's shared libraries. ! archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols"' ~$AR -crlo $objdir/$libname$release.a $objdir/$soname' fi fi ;; *************** *** 1505,1515 **** ;; darwin* | rhapsody*) ! allow_undefined_flag='-undefined suppress' # FIXME: Relying on posixy $() will cause problems for # cross-compilation, but unfortunately the echo tests do not # yet detect zsh echo's removal of \ escapes. ! archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linkopts -install_name $rpath/$soname $(test -n "$verstring" -a x$verstring != x0.0 && echo $verstring)' # We need to add '_' to the symbols in $export_symbols first #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' hardcode_direct=yes --- 1549,1566 ---- ;; darwin* | rhapsody*) ! case "$host_os" in ! rhapsody* | darwin1.[[012]]) ! allow_undefined_flag='-undefined suppress' ! ;; ! *) # Darwin 1.3 on ! allow_undefined_flag='-flat_namespace -undefined suppress' ! ;; ! esac # FIXME: Relying on posixy $() will cause problems for # cross-compilation, but unfortunately the echo tests do not # yet detect zsh echo's removal of \ escapes. ! archive_cmds='$nonopt $(test "x$module" = xyes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags -install_name $rpath/$soname $verstring' # We need to add '_' to the symbols in $export_symbols first #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols' hardcode_direct=yes *************** *** 1584,1590 **** ;; newsos6) ! archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: --- 1635,1641 ---- ;; newsos6) ! archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: *************** *** 1592,1601 **** ;; openbsd*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; os2*) --- 1643,1666 ---- ;; openbsd*) hardcode_direct=yes hardcode_shlibpath_var=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case "$host_os" in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi ;; os2*) *************** *** 1640,1645 **** --- 1705,1711 ---- hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes + export_dynamic_flag_spec='${wl}-Bexport' ;; solaris*) *************** *** 1675,1681 **** sysv4) if test "x$host_vendor" = xsno; then ! archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linkopts' hardcode_direct=yes # is this really true??? else archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' --- 1741,1747 ---- sysv4) if test "x$host_vendor" = xsno; then ! archive_cmds='$LD -G -Bsymbolic -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? else archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' *************** *** 1846,1865 **** case $host_os in [ aix4 | aix4.[01] | aix4.[01].*)] if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' ! echo ' yes ' ! echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then ! : else ! can_build_shared=no fi ;; esac ! # AIX (on Power*) has no versioning support, so currently we can not hardcode correct ! # soname into executable. Probably we can add versioning support to ! # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then ! # If using run time linking (on AIX 4.2 or later) use lib.so instead of ! # lib.a to let people know that these are not typical AIX shared libraries. library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 --- 1912,1933 ---- case $host_os in [ aix4 | aix4.[01] | aix4.[01].*)] if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' ! echo ' yes ' ! echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then ! : else ! can_build_shared=no fi ;; esac ! # AIX (on Power*) has no versioning support, so currently we can ! # not hardcode correct soname into executable. Probably we can ! # add versioning support to collect2, so additional links can ! # be useful in future. if test "$aix_use_runtimelinking" = yes; then ! # If using run time linking (on AIX 4.2 or later) use lib.so ! # instead of lib.a to let people know that these are not ! # typical AIX shared libraries. library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' else # We preserve .a as extension for shared libraries through AIX4.2 *************** *** 1868,1874 **** soname_spec='${libname}${release}.so$major' fi shlibpath_var=LIBPATH - deplibs_check_method=pass_all fi ;; --- 1936,1941 ---- *************** *** 2081,2089 **** openbsd*) version_type=sunos ! if test "$with_gnu_ld" = yes; then ! need_lib_prefix=no ! need_version=no fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' --- 2148,2166 ---- openbsd*) version_type=sunos ! need_lib_prefix=no ! need_version=no ! if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then ! case "$host_os" in ! openbsd2.[[89]] | openbsd2.[[89]].*) ! shlibpath_overrides_runpath=no ! ;; ! *) ! shlibpath_overrides_runpath=yes ! ;; ! esac ! else ! shlibpath_overrides_runpath=yes fi library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' *************** *** 2200,2205 **** --- 2277,2317 ---- ## ## END FIXME + ## FIXME: this should be a separate macro + ## + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case "$host_os" in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + ## + ## END FIXME + + ## FIXME: this should be a separate macro + ## + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + ## + ## END FIXME + if test "$hardcode_action" = relink; then # Fast installation is not supported enable_fast_install=no *************** *** 2299,2304 **** --- 2411,2417 ---- old_striplib striplib file_magic_cmd export_symbols_cmds \ deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + global_symbol_to_c_name_address \ hardcode_libdir_flag_spec hardcode_libdir_separator \ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do *************** *** 2365,2376 **** # Whether or not to build shared libraries. build_libtool_libs=$enable_shared - # Whether or not to add -lc for building shared libraries. - build_libtool_need_lc=$need_lc - # Whether or not to build static libraries. build_old_libs=$enable_static # Whether or not to optimize for fast installation. fast_install=$enable_fast_install --- 2478,2489 ---- # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static + # Whether or not to add -lc for building shared libraries. + build_libtool_need_lc=$need_lc + # Whether or not to optimize for fast installation. fast_install=$enable_fast_install *************** *** 2536,2541 **** --- 2649,2657 ---- # Transform the output of nm in a proper C declaration global_symbol_to_cdecl=$lt_global_symbol_to_cdecl + # Transform the output of nm in a C name address pair + global_symbol_to_c_name_address=$lt_global_symbol_to_c_name_address + # This is the shared library runtime path variable. runpath_var=$runpath_var *************** *** 2658,2666 **** # return TRUE; # } # /* ltdll.c ends here */ ! # This is a source program that is used to create import libraries ! # on Windows for dlls which lack them. Don't remove nor modify the ! # starting and closing comments # /* impgen.c starts here */ # /* Copyright (C) 1999-2000 Free Software Foundation, Inc. # --- 2774,2782 ---- # return TRUE; # } # /* ltdll.c ends here */ ! # This is a source program that is used to create import libraries ! # on Windows for dlls which lack them. Don't remove nor modify the ! # starting and closing comments # /* impgen.c starts here */ # /* Copyright (C) 1999-2000 Free Software Foundation, Inc. # *************** *** 3148,3154 **** lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in ! rhapsody* | darwin1.[012]) lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` ;; *) # Darwin 1.3 on --- 3264,3270 ---- lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' lt_cv_file_magic_cmd='/usr/bin/file -L' case "$host_os" in ! rhapsody* | darwin1.[[012]]) lt_cv_file_magic_test_file=`echo /System/Library/Frameworks/System.framework/Versions/*/System | head -1` ;; *) # Darwin 1.3 on *************** *** 3207,3213 **** # This must be Linux ELF. linux-gnu*) case $host_cpu in ! alpha* | i*86 | powerpc* | sparc* | ia64* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM --- 3323,3329 ---- # This must be Linux ELF. linux-gnu*) case $host_cpu in ! alpha* | hppa* | i*86 | powerpc* | sparc* | ia64* ) lt_cv_deplibs_check_method=pass_all ;; *) # glibc up to 2.1.1 does not perform some relocations on ARM *************** *** 3228,3233 **** --- 3344,3359 ---- [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'] lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + + openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi ;; osf3* | osf4* | osf5*) Index: libtool/ltdl.m4 diff -c libtool/ltdl.m4:1.21 libtool/ltdl.m4:1.21.2.2 *** libtool/ltdl.m4:1.21 Tue Apr 24 15:53:48 2001 --- libtool/ltdl.m4 Sun Sep 2 18:22:13 2001 *************** *** 24,56 **** # AC_LIB_LTDL # ----------- AC_DEFUN(AC_LIB_LTDL, ! [AC_PREREQ(2.13)dnl ! AC_REQUIRE([AC_PROG_CC])dnl ! AC_REQUIRE([AC_C_CONST])dnl - # Perform all the checks necessary for compilation of the ltdl objects - # -- including compiler checks (above) and header checks (below). - AC_REQUIRE([AC_HEADER_STDC])dnl - AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl - - AC_CHECK_HEADERS(malloc.h memory.h stdlib.h stdio.h ctype.h dl.h sys/dl.h dld.h) - AC_CHECK_HEADERS(string.h strings.h, break) - AC_CHECK_FUNCS(strchr index, break) - AC_CHECK_FUNCS(strrchr rindex, break) - AC_CHECK_FUNCS(memcpy bcopy, break) - AC_CHECK_FUNCS(strcmp) - - 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 - AC_REQUIRE([AC_LTDL_SYMBOL_USCORE])dnl - AC_REQUIRE([AC_LTDL_DLSYM_USCORE])dnl - AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS])dnl ])# AC_LIB_LTDL # AC_LTDL_ENABLE_INSTALL --- 24,59 ---- # AC_LIB_LTDL # ----------- + # Perform all the checks necessary for compilation of the ltdl objects + # -- including compiler checks and header checks. AC_DEFUN(AC_LIB_LTDL, ! [AC_PREREQ(2.13) ! AC_REQUIRE([AC_PROG_CC]) ! AC_REQUIRE([AC_C_CONST]) ! AC_REQUIRE([AC_HEADER_STDC]) ! AC_REQUIRE([AC_HEADER_DIRENT]) ! AC_REQUIRE([_LT_AC_CHECK_DLFCN]) ! AC_REQUIRE([AC_LTDL_ENABLE_INSTALL]) ! AC_REQUIRE([AC_LTDL_SHLIBEXT]) ! AC_REQUIRE([AC_LTDL_SHLIBPATH]) ! AC_REQUIRE([AC_LTDL_SYSSEARCHPATH]) ! AC_REQUIRE([AC_LTDL_OBJDIR]) ! AC_REQUIRE([AC_LTDL_DLPREOPEN]) ! AC_REQUIRE([AC_LTDL_DLLIB]) ! AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) ! AC_REQUIRE([AC_LTDL_DLSYM_USCORE]) ! AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS]) ! AC_REQUIRE([AC_LTDL_FUNC_ARGZ]) ! ! AC_CHECK_HEADERS([errno.h malloc.h memory.h stdlib.h stdio.h ctype.h unistd.h]) ! AC_CHECK_HEADERS([dl.h sys/dl.h dld.h]) ! AC_CHECK_HEADERS([string.h strings.h], break) ! ! AC_CHECK_FUNCS([strchr index], break) ! AC_CHECK_FUNCS([strrchr rindex], break) ! AC_CHECK_FUNCS([memcpy bcopy], break) ! AC_CHECK_FUNCS([memmove strcmp]) ])# AC_LIB_LTDL # AC_LTDL_ENABLE_INSTALL *************** *** 280,282 **** --- 283,325 ---- [Define if dlsym() requires a leading underscode in symbol names. ]) fi ])# AC_LTDL_DLSYM_USCORE + + + # AC_CHECK_TYPES(TYPES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], + # [INCLUDES]) + # --------------------------------------------------------------- + # This macro did not exist in Autoconf 2.13, which we do still support + ifdef([AC_CHECK_TYPES], [], + [define([AC_CHECK_TYPES], + [AC_CACHE_CHECK([for $1], ac_Type, + [AC_TRY_LINK([$4], + [if (($1 *) 0) + return 0; + if (sizeof ($1)) + return 0;], + [ac_Type=yes], + [ac_Type=no])]) + if test "x$ac_Type" = xyes; then + ifelse([$2], [], [:], [$2]) + else + ifelse([$3], [], [:], [$3]) + fi]) + ])# AC_CHECK_TYPES + + + # AC_LTDL_FUNC_ARGZ + # ----------------- + AC_DEFUN([AC_LTDL_FUNC_ARGZ], + [AC_CHECK_HEADERS([argz.h]) + + AC_CHECK_TYPES([error_t], + [], + [AC_DEFINE([error_t], [int], + [Define to a type to use for \`error_t' if it is not otherwise available.])], + [#if HAVE_ARGZ_H + # include + #endif]) + + AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify]) + ])# AC_LTDL_FUNC_ARGZ + Index: libtool/ltmain.in diff -c libtool/ltmain.in:1.259 libtool/ltmain.in:1.259.2.7 *** libtool/ltmain.in:1.259 Tue Apr 24 16:22:34 2001 --- libtool/ltmain.in Sun Sep 2 15:18:21 2001 *************** *** 202,207 **** --- 202,212 ---- exit 1 fi + # If this variable is set in any of the actions, the command in it + # will be execed at the end. This prevents here-documents from being + # left over by shells. + exec_cmd= + if test -z "$show_help"; then # Infer the operation mode. *************** *** 615,620 **** --- 620,629 ---- # Now arrange that obj and lo_libobj become the same file $show "(cd $xdir && $LN_S $baseobj $libobj)" if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $run $rm "$lockfile" + fi exit 0 else error=$? *************** *** 1031,1036 **** --- 1040,1057 ---- # These systems don't actually have a C library (as such) test "X$arg" = "X-lc" && continue ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + esac + fi + if test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; esac fi deplibs="$deplibs $arg" *************** *** 1911,1927 **** echo "*** Therefore, libtool will create a static module, that should work " echo "*** as long as the dlopening application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then ! 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 ! build_libtool_libs=module ! build_old_libs=yes else ! build_libtool_libs=no fi fi else --- 1932,1948 ---- echo "*** Therefore, libtool will create a static module, that should work " echo "*** as long as the dlopening application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then ! 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 ! build_libtool_libs=module ! build_old_libs=yes else ! build_libtool_libs=no fi fi else *************** *** 2312,2317 **** --- 2333,2348 ---- if test -z "$vinfo" && test -n "$release"; then major= verstring="0.0" + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring="" + ;; + *) + verstring="0.0" + ;; + esac if test "$need_version" = no; then versuffix= else *************** *** 2408,2413 **** --- 2439,2447 ---- *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; + *-*-openbsd*) + # Do not include libc due to us having libc/libc_r. + ;; *) # Add libc to deplibs on all other systems if necessary. if test $build_libtool_need_lc = "yes"; then *************** *** 3287,3313 **** #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ ! # define lt_ptr_t void * #else ! # define lt_ptr_t char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; ! lt_ptr_t address; } lt_preloaded_symbols[] = {\ " ! sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ ! -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ ! < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ ! {0, (lt_ptr_t) 0} }; /* This works around a problem in FreeBSD linker */ --- 3321,3345 ---- #undef lt_preloaded_symbols #if defined (__STDC__) && __STDC__ ! # define lt_ptr void * #else ! # define lt_ptr char * # define const #endif /* The mapping between symbol names and symbols. */ const struct { const char *name; ! lt_ptr address; } lt_preloaded_symbols[] = {\ " ! eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" $echo >> "$output_objdir/$dlsyms" "\ ! {0, (lt_ptr) 0} }; /* This works around a problem in FreeBSD linker */ *************** *** 3618,3625 **** # relink executable if necessary if test -n \"\$relink_command\"; then ! if (eval \$relink_command); then : else $rm \"\$progdir/\$file\" exit 1 fi --- 3650,3658 ---- # relink executable if necessary if test -n \"\$relink_command\"; then ! if relink_command_output=\`eval \$relink_command 2>&1\`; then : else + $echo \"\$relink_command_output\" >&2 $rm \"\$progdir/\$file\" exit 1 fi *************** *** 4368,4378 **** if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" ! exec $SHELL $0 --finish$current_libdirs ! exit 1 fi - - exit 0 ;; # libtool finish mode --- 4401,4410 ---- if test -n "$current_libdirs"; then # Maybe just do a dry run. test -n "$run" && current_libdirs=" -n$current_libdirs" ! exec_cmd='$SHELL $0 --finish$current_libdirs' ! else ! exit 0 fi ;; # libtool finish mode *************** *** 4575,4585 **** LANG="$save_LANG"; export LANG fi ! # Now actually exec the command. ! eval "exec \$cmd$args" ! ! $echo "$modename: cannot exec \$cmd$args" ! exit 1 else # Display what would be done. if test -n "$shlibpath_var"; then --- 4607,4614 ---- LANG="$save_LANG"; export LANG fi ! # Now prepare to actually exec the command. ! exec_cmd='"$cmd"$args' else # Display what would be done. if test -n "$shlibpath_var"; then *************** *** 4641,4654 **** # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ ! || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then ! : elif test -d "$file"; then ! exit_status=1 continue elif test "$rmforce" = yes; then ! continue fi rmfiles="$file" --- 4670,4683 ---- # Don't error if the file doesn't exist and rm -f was used. if (test -L "$file") >/dev/null 2>&1 \ ! || (test -h "$file") >/dev/null 2>&1 \ || test -f "$file"; then ! : elif test -d "$file"; then ! exit_status=1 continue elif test "$rmforce" = yes; then ! continue fi rmfiles="$file" *************** *** 4744,4753 **** ;; esac ! $echo "$modename: invalid operation mode \`$mode'" 1>&2 ! $echo "$generic_help" 1>&2 ! exit 1 fi # test -z "$show_help" # We need to display help for each of the modes. case $mode in --- 4773,4789 ---- ;; esac ! if test -z "$exec_cmd"; then ! $echo "$modename: invalid operation mode \`$mode'" 1>&2 ! $echo "$generic_help" 1>&2 ! exit 1 ! fi fi # test -z "$show_help" + + if test -n "$exec_cmd"; then + eval exec $exec_cmd + exit 1 + fi # We need to display help for each of the modes. case $mode in Index: libtool/libltdl/ltdl.c diff -c libtool/libltdl/ltdl.c:1.134 libtool/libltdl/ltdl.c:1.134.2.3 *** libtool/libltdl/ltdl.c:1.134 Tue Apr 24 15:53:48 2001 --- libtool/libltdl/ltdl.c Sun Sep 2 17:22:51 2001 *************** *** 29,34 **** --- 29,38 ---- # include #endif + #if HAVE_UNISTD_H + # include + #endif + #if HAVE_STDIO_H # include #endif *************** *** 57,62 **** --- 61,94 ---- # include #endif + #if HAVE_ERRNO_H + # include + #endif + + #if HAVE_DIRENT_H + # include + # define LT_D_NAMLEN(dirent) (strlen((dirent)->d_name)) + #else + # define dirent direct + # define LT_D_NAMLEN(dirent) ((dirent)->d_namlen) + # if HAVE_SYS_NDIR_H + # include + # endif + # if HAVE_SYS_DIR_H + # include + # endif + # if HAVE_NDIR_H + # include + # endif + #endif + + #if HAVE_ARGZ_H + # include + #endif + + /* I have never seen a system without this: */ + #include + #include "ltdl.h" *************** *** 85,90 **** --- 117,130 ---- /* --- MANIFEST CONSTANTS --- */ + /* Standard libltdl search path environment variable name */ + #undef LTDL_SEARCHPATH_VAR + #define LTDL_SEARCHPATH_VAR "LTDL_LIBRARY_PATH" + + /* Standard libtool archive file extension. */ + #undef LTDL_ARCHIVE_EXT + #define LTDL_ARCHIVE_EXT ".la" + /* max. filename length */ #ifndef LT_FILENAME_MAX # define LT_FILENAME_MAX 1024 *************** *** 101,348 **** - /* --- TYPE DEFINITIONS -- */ - - - /* This type is used for the array of caller data sets in each handler. */ - typedef struct { - lt_dlcaller_id key; - lt_ptr data; - } lt_caller_data; - - - - - /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */ - - - /* Extract the diagnostic strings from the error table macro in the same - order as the enumberated indices in ltdl.h. */ - - static const char *lt_dlerror_strings[] = - { - #define LT_ERROR(name, diagnostic) (diagnostic), - lt_dlerror_table - #undef LT_ERROR - - 0 - }; - - /* This structure is used for the list of registered loaders. */ - struct lt_dlloader { - struct lt_dlloader *next; - const char *loader_name; /* identifying name for each loader */ - const char *sym_prefix; /* prefix for symbols */ - lt_module_open *module_open; - lt_module_close *module_close; - lt_find_sym *find_sym; - lt_dlloader_exit *dlloader_exit; - lt_user_data dlloader_data; - }; - - struct lt_dlhandle_struct { - struct lt_dlhandle_struct *next; - lt_dlloader *loader; /* dlopening interface */ - lt_dlinfo info; - int depcount; /* number of dependencies */ - lt_dlhandle *deplibs; /* dependencies */ - lt_module module; /* system module handle */ - lt_ptr system; /* system specific data */ - lt_caller_data *caller_data; /* per caller associated data */ - int flags; /* various boolean stats */ - }; - - /* Various boolean flags can be stored in the flags field of an - lt_dlhandle_struct... */ - #define LT_DLGET_FLAG(handle, flag) (((handle)->flags & (flag)) == (flag)) - #define LT_DLSET_FLAG(handle, flag) ((handle)->flags |= (flag)) - - #define LT_DLRESIDENT_FLAG (0x01 << 0) - /* ...add more flags here... */ - - #define LT_DLIS_RESIDENT(handle) LT_DLGET_FLAG(handle, LT_DLRESIDENT_FLAG) - - - #define LT_DLSTRERROR(name) lt_dlerror_strings[LT_CONC(LT_ERROR_,name)] - - 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 - - - - - /* --- MUTEX LOCKING --- */ - - - /* Macros to make it easier to run the lock functions only if they have - been registered. The reason for the complicated lock macro is to - ensure that the stored error message from the last error is not - accidentally erased if the current function doesn't generate an - error of its own. */ - #define MUTEX_LOCK() LT_STMT_START { \ - if (mutex_lock) (*mutex_lock)(); } LT_STMT_END - #define MUTEX_UNLOCK() LT_STMT_START { \ - if (mutex_unlock) (*mutex_unlock)(); } LT_STMT_END - #define MUTEX_SETERROR(errormsg) LT_STMT_START { \ - if (mutex_seterror) (*mutex_seterror) (errormsg); \ - else last_error = (errormsg); } LT_STMT_END - #define MUTEX_GETERROR(errormsg) LT_STMT_START { \ - if (mutex_seterror) errormsg = (*mutex_geterror)(); \ - else (errormsg) = last_error; } LT_STMT_END - - /* The mutex functions stored here are global, and are necessarily the - same for all threads that wish to share access to libltdl. */ - static lt_dlmutex_lock *mutex_lock = 0; - static lt_dlmutex_unlock *mutex_unlock = 0; - static lt_dlmutex_seterror *mutex_seterror = 0; - static lt_dlmutex_geterror *mutex_geterror = 0; - static const char *last_error = 0; - - - /* Either set or reset the mutex functions. Either all the arguments must - be valid functions, or else all can be NULL to turn off locking entirely. - The registered functions should be manipulating a static global lock - from the lock() and unlock() callbacks, which needs to be reentrant. */ - int - lt_dlmutex_register (lock, unlock, seterror, geterror) - lt_dlmutex_lock *lock; - lt_dlmutex_unlock *unlock; - lt_dlmutex_seterror *seterror; - lt_dlmutex_geterror *geterror; - { - lt_dlmutex_unlock *old_unlock = unlock; - int errors = 0; - - /* Lock using the old lock() callback, if any. */ - MUTEX_LOCK (); - - if ((lock && unlock && seterror && geterror) - || !(lock || unlock || seterror || geterror)) - { - mutex_lock = lock; - mutex_unlock = unlock; - mutex_geterror = geterror; - } - else - { - MUTEX_SETERROR (LT_DLSTRERROR (INVALID_MUTEX_ARGS)); - ++errors; - } - - /* Use the old unlock() callback we saved earlier, if any. Otherwise - record any errors using internal storage. */ - if (old_unlock) - (*old_unlock) (); - - /* Return the number of errors encountered during the execution of - this function. */ - return errors; - } - - - - /* --- MEMORY HANDLING --- */ - - LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)) - = (lt_ptr (*) LT_PARAMS((size_t))) malloc; - LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)) - = (void (*) LT_PARAMS((lt_ptr))) free; ! static lt_ptr rpl_realloc LT_PARAMS((lt_ptr ptr, ! size_t size)); #define LT_DLMALLOC(tp, n) ((tp *) lt_dlmalloc ((n) * sizeof(tp))) #define LT_DLREALLOC(tp, p, n) ((tp *) rpl_realloc ((p), (n) * sizeof(tp))) #define LT_DLFREE(p) \ LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END #define LT_DLMEM_REASSIGN(p, q) LT_STMT_START { \ ! if ((p) != (q)) { lt_dlfree (p); (p) = (q); } \ } LT_STMT_END - - /* --- ERROR MESSAGES --- */ - - - static const char **user_error_strings = 0; - static int errorcount = LT_ERROR_MAX; - - int - lt_dladderror (diagnostic) - const char *diagnostic; - { - int index = 0; - int result = -1; - const char **temp = (const char **) 0; - - MUTEX_LOCK (); - - index = errorcount - LT_ERROR_MAX; - temp = LT_DLREALLOC (const char *, user_error_strings, 1 + index); - if (temp == 0) - { - MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); - } - else - { - user_error_strings = temp; - user_error_strings[index] = diagnostic; - result = errorcount++; - } - - MUTEX_UNLOCK (); - - return result; - } - - int - lt_dlseterror (index) - int index; - { - int errors = 0; - - MUTEX_LOCK (); - - if (index >= errorcount || index < 0) - { - /* Ack! Error setting the error message! */ - MUTEX_SETERROR (LT_DLSTRERROR (INVALID_ERRORCODE)); - ++errors; - } - else if (index < LT_ERROR_MAX) - { - /* No error setting the error message! */ - MUTEX_SETERROR (lt_dlerror_strings[errorcount]); - } - else - { - /* No error setting the error message! */ - MUTEX_SETERROR (user_error_strings[errorcount - LT_ERROR_MAX]); - } - - MUTEX_UNLOCK (); - - return errors; - } - - - - /* --- REPLACEMENT FUNCTIONS --- */ #undef strdup #define strdup rpl_strdup ! static char * strdup(str) const char *str; { --- 141,190 ---- /* --- MEMORY HANDLING --- */ ! /* These are the functions used internally. In addition to making ! use of the associated function pointers above, they also perform ! error handling. */ ! static char *lt_estrdup LT_PARAMS((const char *str)); ! static lt_ptr lt_emalloc LT_PARAMS((size_t size)); ! static lt_ptr lt_erealloc LT_PARAMS((lt_ptr addr, size_t size)); ! ! static lt_ptr rpl_realloc LT_PARAMS((lt_ptr ptr, size_t size)); ! ! /* These are the pointers that can be changed by the caller: */ ! LT_GLOBAL_DATA lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)) ! = (lt_ptr (*) LT_PARAMS((size_t))) malloc; ! LT_GLOBAL_DATA lt_ptr (*lt_dlrealloc) LT_PARAMS((lt_ptr ptr, size_t size)) ! = (lt_ptr (*) LT_PARAMS((lt_ptr, size_t))) rpl_realloc; ! LT_GLOBAL_DATA void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)) ! = (void (*) LT_PARAMS((lt_ptr))) free; + /* The following macros reduce the amount of typing needed to cast + assigned memory. */ #define LT_DLMALLOC(tp, n) ((tp *) lt_dlmalloc ((n) * sizeof(tp))) #define LT_DLREALLOC(tp, p, n) ((tp *) rpl_realloc ((p), (n) * sizeof(tp))) #define LT_DLFREE(p) \ LT_STMT_START { if (p) (p) = (lt_dlfree (p), (lt_ptr) 0); } LT_STMT_END + #define LT_EMALLOC(tp, n) ((tp *) lt_emalloc ((n) * sizeof(tp))) + #define LT_EREALLOC(tp, p, n) ((tp *) lt_erealloc ((p), (n) * sizeof(tp))) + #define LT_DLMEM_REASSIGN(p, q) LT_STMT_START { \ ! if ((p) != (q)) { lt_dlfree (p); (p) = (q); (q) = 0; } \ } LT_STMT_END /* --- REPLACEMENT FUNCTIONS --- */ #undef strdup #define strdup rpl_strdup ! static char *strdup LT_PARAMS((const char *str)); ! ! char * strdup(str) const char *str; { *************** *** 366,372 **** #undef strcmp #define strcmp rpl_strcmp ! static int strcmp (str1, str2) const char *str1; const char *str2; --- 208,216 ---- #undef strcmp #define strcmp rpl_strcmp ! static int strcmp LT_PARAMS((const char *str1, const char *str2)); ! ! int strcmp (str1, str2) const char *str1; const char *str2; *************** *** 395,409 **** # define strchr index # else # define strchr rpl_strchr ! static const char* strchr(str, ch) const char *str; int ch; { const char *p; ! for (p = str; *p != (char)ch && *p != '\0'; ++p) /*NOWORK*/; return (*p == (char)ch) ? p : 0; --- 239,255 ---- # define strchr index # else # define strchr rpl_strchr + + static const char *strchr LT_PARAMS((const char *str, int ch)); ! const char* strchr(str, ch) const char *str; int ch; { const char *p; ! for (p = str; *p != (char)ch && *p != LT_EOS_CHAR; ++p) /*NOWORK*/; return (*p == (char)ch) ? p : 0; *************** *** 412,432 **** # endif #endif /* !HAVE_STRCHR */ #if ! HAVE_STRRCHR # if HAVE_RINDEX # define strrchr rindex # else # define strrchr rpl_strrchr ! static const char* strrchr(str, ch) const char *str; int ch; { const char *p, *q = 0; ! for (p = str; *p != '\0'; ++p) { if (*p == (char) ch) { --- 258,281 ---- # endif #endif /* !HAVE_STRCHR */ + #if ! HAVE_STRRCHR # if HAVE_RINDEX # define strrchr rindex # else # define strrchr rpl_strrchr + + static const char *strrchr LT_PARAMS((const char *str, int ch)); ! const char* strrchr(str, ch) const char *str; int ch; { const char *p, *q = 0; ! for (p = str; *p != LT_EOS_CHAR; ++p) { if (*p == (char) ch) { *************** *** 441,448 **** #endif /* NOTE: Neither bcopy nor the memcpy implementation below can ! reliably handle copying in overlapping areas of memory, so ! do not rely on this behaviour when invoking memcpy later. */ #if ! HAVE_MEMCPY # if HAVE_BCOPY --- 290,298 ---- #endif /* NOTE: Neither bcopy nor the memcpy implementation below can ! reliably handle copying in overlapping areas of memory. Use ! memmove (for which there is a fallback implmentation below) ! if you need that behaviour. */ #if ! HAVE_MEMCPY # if HAVE_BCOPY *************** *** 450,459 **** # else # define memcpy rpl_memcpy ! static char * memcpy (dest, src, size) ! char *dest; ! const char *src; size_t size; { size_t i = 0; --- 300,311 ---- # else # define memcpy rpl_memcpy ! static lt_ptr memcpy LT_PARAMS((lt_ptr dest, const lt_ptr src, size_t size)); ! ! lt_ptr memcpy (dest, src, size) ! lt_ptr dest; ! const lt_ptr src; size_t size; { size_t i = 0; *************** *** 466,486 **** return dest; } ! # endif ! #endif /* According to Alexandre Oliva , ``realloc is not entirely portable'' In any case we want to use the allocator supplied by the user without burdening them with an lt_dlrealloc function pointer to maintain. Instead implement our own version (with known boundary conditions) using lt_dlmalloc and lt_dlfree. */ ! static lt_ptr ! rpl_realloc (ptr, size) lt_ptr ptr; size_t size; { ! if (size < 1) { /* For zero or less bytes, free the original memory */ if (ptr != 0) --- 318,372 ---- return dest; } ! # endif /* !HAVE_BCOPY */ ! #endif /* !HAVE_MEMCPY */ ! ! #if ! HAVE_MEMMOVE ! # define memmove rpl_memmove ! ! static lt_ptr memmove LT_PARAMS((lt_ptr dest, const lt_ptr src, size_t size)); ! ! lt_ptr ! memmove (dest, src, size) ! lt_ptr dest; ! const lt_ptr src; ! size_t size; ! { ! size_t i; + if (dest < src) + for (i = 0; i < size; ++i) + { + dest[i] = src[i]; + } + else if (dest > src) + for (i = size -1; i >= 0; --i) + { + dest[i] = src[i]; + } + + return dest; + } + + #endif /* !HAVE_MEMMOVE */ + + /* According to Alexandre Oliva , ``realloc is not entirely portable'' In any case we want to use the allocator supplied by the user without burdening them with an lt_dlrealloc function pointer to maintain. Instead implement our own version (with known boundary conditions) using lt_dlmalloc and lt_dlfree. */ ! ! #undef realloc ! #define realloc rpl_realloc ! ! lt_ptr ! realloc (ptr, size) lt_ptr ptr; size_t size; { ! if (size <= 0) { /* For zero or less bytes, free the original memory */ if (ptr != 0) *************** *** 499,515 **** { /* Allocate a new block, copy and free the old block. */ lt_ptr mem = lt_dlmalloc (size); ! if (mem) ! { ! memcpy (mem, ptr, size); ! lt_dlfree (ptr); ! } ! /* Note that the contents of PTR are not damaged if there is ! insufficient memory to realloc. */ ! return mem; ! } } --- 385,887 ---- { /* Allocate a new block, copy and free the old block. */ lt_ptr mem = lt_dlmalloc (size); + + if (mem) + { + memcpy (mem, ptr, size); + lt_dlfree (ptr); + } + + /* Note that the contents of PTR are not damaged if there is + insufficient memory to realloc. */ + return mem; + } + } + + + #if ! HAVE_ARGZ_APPEND + # define argz_append rpl_argz_append + + static error_t argz_append LT_PARAMS((char **pargz, size_t *pargz_len, + const char *buf, size_t buf_len)); + + error_t + argz_append (pargz, pargz_len, buf, buf_len) + char **pargz; + size_t *pargz_len; + const char *buf; + size_t buf_len; + { + size_t argz_len; + char *argz; + + assert (pargz); + assert (pargz_len); + assert ((*pargz && *pargz_len) || (!*pargz && !*pargz_len)); + + /* If nothing needs to be appended, no more work is required. */ + if (buf_len == 0) + return 0; + + /* Ensure there is enough room to append BUF_LEN. */ + argz_len = *pargz_len + buf_len; + argz = LT_DLREALLOC (char, *pargz, argz_len); + if (!argz) + return ENOMEM; + + /* Copy characters from BUF after terminating '\0' in ARGZ. */ + memcpy (argz + *pargz_len, buf, buf_len); + + /* Assign new values. */ + *pargz = argz; + *pargz_len = argz_len; + + return 0; + } + #endif /* !HAVE_ARGZ_APPEND */ + + + #if ! HAVE_ARGZ_CREATE_SEP + # define argz_create_sep rpl_argz_create_sep + + static error_t argz_create_sep LT_PARAMS((const char *str, int delim, + char **pargz, size_t *pargz_len)); + + error_t + argz_create_sep (str, delim, pargz, pargz_len) + const char *str; + int delim; + char **pargz; + size_t *pargz_len; + { + size_t argz_len; + char *argz = 0; + + assert (str); + assert (pargz); + assert (pargz_len); + + /* Make a copy of STR, but replacing each occurence of + DELIM with '\0'. */ + argz_len = 1+ LT_STRLEN (str); + if (argz_len) + { + const char *p; + char *q; + + argz = LT_DLMALLOC (char, argz_len); + if (!argz) + return ENOMEM; + + for (p = str, q = argz; *p != LT_EOS_CHAR; ++p) + { + if (*p == delim) + { + /* Ignore leading delimiters, and fold consecutive + delimiters in STR into a single '\0' in ARGZ. */ + if ((q > argz) && (q[-1] != LT_EOS_CHAR)) + *q++ = LT_EOS_CHAR; + else + --argz_len; + } + else + *q++ = *p; + } + /* Copy terminating LT_EOS_CHAR. */ + *q = *p; + } + + /* If ARGZ_LEN has shrunk to nothing, release ARGZ's memory. */ + if (!argz_len) + LT_DLFREE (argz); + + /* Assign new values. */ + *pargz = argz; + *pargz_len = argz_len; + + return 0; + } + #endif /* !HAVE_ARGZ_CREATE_SEP */ + + + #if ! HAVE_ARGZ_INSERT + # define argz_insert rpl_argz_insert + + static error_t argz_insert LT_PARAMS((char **pargz, size_t *pargz_len, + char *before, const char *entry)); + + error_t + argz_insert (pargz, pargz_len, before, entry) + char **pargz; + size_t *pargz_len; + char *before; + const char *entry; + { + assert (pargz); + assert (pargz_len); + assert (entry && *entry); + + /* Either PARGZ/PARGZ_LEN is empty and BEFORE is NULL, + or BEFORE points into an address within the ARGZ vector. */ + assert ((!*pargz && !*pargz_len && !before) + || ((*pargz <= before) && (before < (*pargz + *pargz_len)))); + + /* No BEFORE address indicates ENTRY should be inserted after the + current last element. */ + if (!before) + return argz_append (pargz, pargz_len, entry, 1+ LT_STRLEN (entry)); + + /* This probably indicates a programmer error, but to preserve + semantics, scan back to the start of an entry if BEFORE points + into the middle of it. */ + while ((before >= *pargz) && (before[-1] != LT_EOS_CHAR)) + --before; + + { + size_t entry_len = 1+ LT_STRLEN (entry); + size_t argz_len = *pargz_len + entry_len; + size_t offset = before - *pargz; + char *argz = LT_DLREALLOC (char, *pargz, argz_len); + + if (!argz) + return ENOMEM; + + /* Make BEFORE point to the equivalent offset in ARGZ that it + used to have in *PARGZ incase realloc() moved the block. */ + before = argz + offset; + + /* Move the ARGZ entries starting at BEFORE up into the new + space at the end -- making room to copy ENTRY into the + resulting gap. */ + memmove (before + entry_len, before, *pargz_len - offset); + memcpy (before, entry, entry_len); + + /* Assign new values. */ + *pargz = argz; + *pargz_len = argz_len; + } + + return 0; + } + #endif /* !HAVE_ARGZ_INSERT */ + + + #if ! HAVE_ARGZ_NEXT + # define argz_next rpl_argz_next + + static char *argz_next LT_PARAMS((char *argz, size_t argz_len, + const char *entry)); + + char * + argz_next (argz, argz_len, entry) + char *argz; + size_t argz_len; + const char *entry; + { + assert ((argz && argz_len) || (!argz && !argz_len)); + + if (entry) + { + /* Either ARGZ/ARGZ_LEN is empty, or ENTRY points into an address + within the ARGZ vector. */ + assert ((!argz && !argz_len) + || ((argz <= entry) && (entry < (argz + argz_len)))); + + /* Move to the char immediately after the terminating + '\0' of ENTRY. */ + entry = 1+ strchr (entry, LT_EOS_CHAR); + + /* Return either the new ENTRY, or else NULL if ARGZ is + exhausted. */ + return (entry >= argz + argz_len) ? 0 : (char *) entry; + } + else + { + /* This should probably be flagged as a programmer error, + since starting an argz_next loop with the iterator set + to ARGZ is safer. To preserve semantics, handle the NULL + case by returning the start of ARGZ (if any). */ + if (argz_len > 0) + return argz; + else + return 0; + } + } + #endif /* !HAVE_ARGZ_NEXT */ + + + + #if ! HAVE_ARGZ_STRINGIFY + # define argz_stringify rpl_argz_stringify + + static void argz_stringify LT_PARAMS((char *argz, size_t argz_len, + int sep)); + + void + argz_stringify (argz, argz_len, sep) + char *argz; + size_t argz_len; + int sep; + { + assert ((argz && argz_len) || (!argz && !argz_len)); + + if (sep) + { + --argz_len; /* don't stringify the terminating EOS */ + while (--argz_len > 0) + { + if (argz[argz_len] == LT_EOS_CHAR) + argz[argz_len] = sep; + } + } + } + #endif /* !HAVE_ARGZ_STRINGIFY */ + + + + + /* --- TYPE DEFINITIONS -- */ + + + /* This type is used for the array of caller data sets in each handler. */ + typedef struct { + lt_dlcaller_id key; + lt_ptr data; + } lt_caller_data; + + + + + /* --- OPAQUE STRUCTURES DECLARED IN LTDL.H --- */ + + + /* Extract the diagnostic strings from the error table macro in the same + order as the enumerated indices in ltdl.h. */ + + static const char *lt_dlerror_strings[] = + { + #define LT_ERROR(name, diagnostic) (diagnostic), + lt_dlerror_table + #undef LT_ERROR + + 0 + }; + + /* This structure is used for the list of registered loaders. */ + struct lt_dlloader { + struct lt_dlloader *next; + const char *loader_name; /* identifying name for each loader */ + const char *sym_prefix; /* prefix for symbols */ + lt_module_open *module_open; + lt_module_close *module_close; + lt_find_sym *find_sym; + lt_dlloader_exit *dlloader_exit; + lt_user_data dlloader_data; + }; + + struct lt_dlhandle_struct { + struct lt_dlhandle_struct *next; + lt_dlloader *loader; /* dlopening interface */ + lt_dlinfo info; + int depcount; /* number of dependencies */ + lt_dlhandle *deplibs; /* dependencies */ + lt_module module; /* system module handle */ + lt_ptr system; /* system specific data */ + lt_caller_data *caller_data; /* per caller associated data */ + int flags; /* various boolean stats */ + }; + + /* Various boolean flags can be stored in the flags field of an + lt_dlhandle_struct... */ + #define LT_DLGET_FLAG(handle, flag) (((handle)->flags & (flag)) == (flag)) + #define LT_DLSET_FLAG(handle, flag) ((handle)->flags |= (flag)) + + #define LT_DLRESIDENT_FLAG (0x01 << 0) + /* ...add more flags here... */ + + #define LT_DLIS_RESIDENT(handle) LT_DLGET_FLAG(handle, LT_DLRESIDENT_FLAG) + + + #define LT_DLSTRERROR(name) lt_dlerror_strings[LT_CONC(LT_ERROR_,name)] + + static const char objdir[] = LTDL_OBJDIR; + static const char archive_ext[] = LTDL_ARCHIVE_EXT; + #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 + + + + + /* --- MUTEX LOCKING --- */ + + + /* Macros to make it easier to run the lock functions only if they have + been registered. The reason for the complicated lock macro is to + ensure that the stored error message from the last error is not + accidentally erased if the current function doesn't generate an + error of its own. */ + #define LT_DLMUTEX_LOCK() LT_STMT_START { \ + if (lt_dlmutex_lock_func) (*lt_dlmutex_lock_func)(); \ + } LT_STMT_END + #define LT_DLMUTEX_UNLOCK() LT_STMT_START { \ + if (lt_dlmutex_unlock_func) (*lt_dlmutex_unlock_func)();\ + } LT_STMT_END + #define LT_DLMUTEX_SETERROR(errormsg) LT_STMT_START { \ + if (lt_dlmutex_seterror_func) \ + (*lt_dlmutex_seterror_func) (errormsg); \ + else lt_dllast_error = (errormsg); } LT_STMT_END + #define LT_DLMUTEX_GETERROR(errormsg) LT_STMT_START { \ + if (lt_dlmutex_seterror_func) \ + (errormsg) = (*lt_dlmutex_geterror_func) (); \ + else (errormsg) = lt_dllast_error; } LT_STMT_END + + /* The mutex functions stored here are global, and are necessarily the + same for all threads that wish to share access to libltdl. */ + static lt_dlmutex_lock *lt_dlmutex_lock_func = 0; + static lt_dlmutex_unlock *lt_dlmutex_unlock_func = 0; + static lt_dlmutex_seterror *lt_dlmutex_seterror_func = 0; + static lt_dlmutex_geterror *lt_dlmutex_geterror_func = 0; + static const char *lt_dllast_error = 0; + + + /* Either set or reset the mutex functions. Either all the arguments must + be valid functions, or else all can be NULL to turn off locking entirely. + The registered functions should be manipulating a static global lock + from the lock() and unlock() callbacks, which needs to be reentrant. */ + int + lt_dlmutex_register (lock, unlock, seterror, geterror) + lt_dlmutex_lock *lock; + lt_dlmutex_unlock *unlock; + lt_dlmutex_seterror *seterror; + lt_dlmutex_geterror *geterror; + { + lt_dlmutex_unlock *old_unlock = unlock; + int errors = 0; + + /* Lock using the old lock() callback, if any. */ + LT_DLMUTEX_LOCK (); + + if ((lock && unlock && seterror && geterror) + || !(lock || unlock || seterror || geterror)) + { + lt_dlmutex_lock_func = lock; + lt_dlmutex_unlock_func = unlock; + lt_dlmutex_geterror_func = geterror; + } + else + { + LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_MUTEX_ARGS)); + ++errors; + } + + /* Use the old unlock() callback we saved earlier, if any. Otherwise + record any errors using internal storage. */ + if (old_unlock) + (*old_unlock) (); + + /* Return the number of errors encountered during the execution of + this function. */ + return errors; + } + + + + + /* --- ERROR HANDLING --- */ + + + static const char **user_error_strings = 0; + static int errorcount = LT_ERROR_MAX; + + int + lt_dladderror (diagnostic) + const char *diagnostic; + { + int errindex = 0; + int result = -1; + const char **temp = (const char **) 0; + + assert (diagnostic); + + LT_DLMUTEX_LOCK (); + + errindex = errorcount - LT_ERROR_MAX; + temp = LT_EREALLOC (const char *, user_error_strings, 1 + errindex); + if (temp) + { + user_error_strings = temp; + user_error_strings[errindex] = diagnostic; + result = errorcount++; + } + + LT_DLMUTEX_UNLOCK (); + + return result; + } + + int + lt_dlseterror (errindex) + int errindex; + { + int errors = 0; + + LT_DLMUTEX_LOCK (); + + if (errindex >= errorcount || errindex < 0) + { + /* Ack! Error setting the error message! */ + LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_ERRORCODE)); + ++errors; + } + else if (errindex < LT_ERROR_MAX) + { + /* No error setting the error message! */ + LT_DLMUTEX_SETERROR (lt_dlerror_strings[errindex]); + } + else + { + /* No error setting the error message! */ + LT_DLMUTEX_SETERROR (user_error_strings[errindex - LT_ERROR_MAX]); + } ! LT_DLMUTEX_UNLOCK (); ! return errors; ! } ! ! lt_ptr ! lt_emalloc (size) ! size_t size; ! { ! lt_ptr mem = lt_dlmalloc (size); ! if (size && !mem) ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return mem; ! } ! ! lt_ptr ! lt_erealloc (addr, size) ! lt_ptr addr; ! size_t size; ! { ! lt_ptr mem = realloc (addr, size); ! if (size && !mem) ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return mem; ! } ! ! char * ! lt_estrdup (str) ! const char *str; ! { ! char *dup = strdup (str); ! if (LT_STRLEN (str) && !dup) ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return dup; } *************** *** 584,590 **** if (!module) { ! MUTEX_SETERROR (DLERROR (CANNOT_OPEN)); } return module; --- 956,962 ---- if (!module) { ! LT_DLMUTEX_SETERROR (DLERROR (CANNOT_OPEN)); } return module; *************** *** 599,605 **** if (dlclose (module) != 0) { ! MUTEX_SETERROR (DLERROR (CANNOT_CLOSE)); ++errors; } --- 971,977 ---- if (dlclose (module) != 0) { ! LT_DLMUTEX_SETERROR (DLERROR (CANNOT_CLOSE)); ++errors; } *************** *** 616,622 **** if (!address) { ! MUTEX_SETERROR (DLERROR (SYMBOL_NOT_FOUND)); } return address; --- 988,994 ---- if (!address) { ! LT_DLMUTEX_SETERROR (DLERROR (SYMBOL_NOT_FOUND)); } return address; *************** *** 693,701 **** { static shl_t self = (shl_t) 0; lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L); ! /* Since searching for a symbol against a NULL module handle will also ! look in everything else that was already loaded and exported with the -E compiler flag, we always cache a handle saved before any modules are loaded. */ if (!self) --- 1065,1073 ---- { static shl_t self = (shl_t) 0; lt_module module = shl_load (filename, LT_BIND_FLAGS, 0L); ! /* Since searching for a symbol against a NULL module handle will also ! look in everything else that was already loaded and exported with the -E compiler flag, we always cache a handle saved before any modules are loaded. */ if (!self) *************** *** 703,709 **** lt_ptr address; shl_findsym (&self, "main", TYPE_UNDEFINED, &address); } ! if (!filename) { module = self; --- 1075,1081 ---- lt_ptr address; shl_findsym (&self, "main", TYPE_UNDEFINED, &address); } ! if (!filename) { module = self; *************** *** 714,723 **** if (!module) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); } } ! return module; } --- 1086,1095 ---- if (!module) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); } } ! return module; } *************** *** 730,736 **** if (module && (shl_unload ((shl_t) (module)) != 0)) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } --- 1102,1108 ---- if (module && (shl_unload ((shl_t) (module)) != 0)) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } *************** *** 748,763 **** /* sys_shl_open should never return a NULL module handle */ if (module == (lt_module) 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); } else if (!shl_findsym((shl_t*) &module, symbol, TYPE_UNDEFINED, &address)) { if (!address) { ! MUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); } } ! return address; } --- 1120,1135 ---- /* sys_shl_open should never return a NULL module handle */ if (module == (lt_module) 0) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); } else if (!shl_findsym((shl_t*) &module, symbol, TYPE_UNDEFINED, &address)) { if (!address) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); } } ! return address; } *************** *** 808,828 **** if (ext) { /* FILENAME already has an extension. */ ! searchname = strdup (filename); } else { /* Append a `.' to stop Windows from adding an implicit `.dll' extension. */ ! searchname = LT_DLMALLOC (char, 2+ strlen (filename)); ! if (!searchname) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 0; ! } ! strcpy (searchname, filename); ! strcat (searchname, "."); } #if __CYGWIN__ { --- 1180,1197 ---- if (ext) { /* FILENAME already has an extension. */ ! searchname = lt_estrdup (filename); } else { /* Append a `.' to stop Windows from adding an implicit `.dll' extension. */ ! searchname = LT_EMALLOC (char, 2+ LT_STRLEN (filename)); ! if (searchname) ! sprintf (searchname, "%s.", filename); } + if (!searchname) + return 0; #if __CYGWIN__ { *************** *** 843,849 **** We check whether LoadLibrary is returning a handle to an already loaded module, and simulate failure if we find one. */ ! MUTEX_LOCK (); cur = handles; while (cur) { --- 1212,1218 ---- We check whether LoadLibrary is returning a handle to an already loaded module, and simulate failure if we find one. */ ! LT_DLMUTEX_LOCK (); cur = handles; while (cur) { *************** *** 860,870 **** cur = cur->next; } ! MUTEX_UNLOCK (); if (cur || !module) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); module = 0; } --- 1229,1239 ---- cur = cur->next; } ! LT_DLMUTEX_UNLOCK (); if (cur || !module) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); module = 0; } *************** *** 880,886 **** if (FreeLibrary(module) == 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } --- 1249,1255 ---- if (FreeLibrary(module) == 0) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } *************** *** 897,903 **** if (!address) { ! MUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); } return address; --- 1266,1272 ---- if (!address) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); } return address; *************** *** 942,948 **** if (image <= 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); image = 0; } --- 1311,1317 ---- if (image <= 0) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); image = 0; } *************** *** 958,964 **** if (unload_add_on ((image_id) module) != B_OK) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } --- 1327,1333 ---- if (unload_add_on ((image_id) module) != B_OK) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } *************** *** 976,982 **** if (get_image_symbol (image, symbol, B_SYMBOL_TYPE_ANY, address) != B_OK) { ! MUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); address = 0; } --- 1345,1351 ---- if (get_image_symbol (image, symbol, B_SYMBOL_TYPE_ANY, address) != B_OK) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); address = 0; } *************** *** 1010,1023 **** { lt_module module = strdup (filename); ! if (!module) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! module = 0; ! } ! else if (dld_link (filename) != 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); LT_DLFREE (module); module = 0; } --- 1379,1387 ---- { lt_module module = strdup (filename); ! if (dld_link (filename) != 0) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_OPEN)); LT_DLFREE (module); module = 0; } *************** *** 1034,1040 **** if (dld_unlink_by_file ((char*)(module), 1) != 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } else --- 1398,1404 ---- if (dld_unlink_by_file ((char*)(module), 1) != 0) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CANNOT_CLOSE)); ++errors; } else *************** *** 1055,1061 **** if (!address) { ! MUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); } return address; --- 1419,1425 ---- if (!address) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); } return address; *************** *** 1090,1096 **** { int errors = 0; ! MUTEX_LOCK (); preloaded_symbols = 0; if (default_preloaded_symbols) --- 1454,1460 ---- { int errors = 0; ! LT_DLMUTEX_LOCK (); preloaded_symbols = 0; if (default_preloaded_symbols) *************** *** 1098,1104 **** errors = lt_dlpreload (default_preloaded_symbols); } ! MUTEX_UNLOCK (); return errors; } --- 1462,1468 ---- errors = lt_dlpreload (default_preloaded_symbols); } ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 1108,1114 **** { lt_dlsymlists_t *lists; ! MUTEX_LOCK (); lists = preloaded_symbols; while (lists) --- 1472,1478 ---- { lt_dlsymlists_t *lists; ! LT_DLMUTEX_LOCK (); lists = preloaded_symbols; while (lists) *************** *** 1120,1126 **** } preloaded_symbols = 0; ! MUTEX_UNLOCK (); return 0; } --- 1484,1490 ---- } preloaded_symbols = 0; ! LT_DLMUTEX_UNLOCK (); return 0; } *************** *** 1141,1147 **** lt_dlsymlists_t *lists; int errors = 0; ! MUTEX_LOCK (); lists = preloaded_symbols; while (lists) --- 1505,1511 ---- lt_dlsymlists_t *lists; int errors = 0; ! LT_DLMUTEX_LOCK (); lists = preloaded_symbols; while (lists) *************** *** 1153,1173 **** lists = lists->next; } ! tmp = LT_DLMALLOC (lt_dlsymlists_t, 1); if (tmp) { tmp->syms = preloaded; tmp->next = preloaded_symbols; preloaded_symbols = tmp; } else { - MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ++errors; } done: ! MUTEX_UNLOCK (); return errors; } --- 1517,1537 ---- lists = lists->next; } ! tmp = LT_EMALLOC (lt_dlsymlists_t, 1); if (tmp) { + memset (tmp, 0, sizeof(lt_dlsymlists_t)); tmp->syms = preloaded; tmp->next = preloaded_symbols; preloaded_symbols = tmp; } else { ++errors; } done: ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 1179,1193 **** lt_dlsymlists_t *lists; lt_module module = (lt_module) 0; ! MUTEX_LOCK (); lists = preloaded_symbols; if (!lists) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_SYMBOLS)); goto done; } if (!filename) { filename = "@PROGRAM@"; --- 1543,1561 ---- lt_dlsymlists_t *lists; lt_module module = (lt_module) 0; ! LT_DLMUTEX_LOCK (); lists = preloaded_symbols; if (!lists) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_SYMBOLS)); goto done; } + /* Can't use NULL as the reflective symbol header, as NULL is + used to mark the end of the entire symbol list. Self-dlpreopened + symbols follow this magic number, chosen to be an unlikely + clash with a real module name. */ if (!filename) { filename = "@PROGRAM@"; *************** *** 1210,1219 **** lists = lists->next; } ! MUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); done: ! MUTEX_UNLOCK (); return module; } --- 1578,1587 ---- lists = lists->next; } ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); done: ! LT_DLMUTEX_UNLOCK (); return module; } *************** *** 1246,1252 **** ++syms; } ! MUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); return 0; } --- 1614,1620 ---- ++syms; } ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); return 0; } *************** *** 1262,1267 **** --- 1630,1691 ---- /* --- DYNAMIC MODULE LOADING --- */ + /* The type of a function used at each iteration of foreach_dirinpath(). */ + typedef int foreach_callback_func LT_PARAMS((char *filename, lt_ptr data1, + lt_ptr data2)); + + static int foreach_dirinpath LT_PARAMS((const char *search_path, + const char *base_name, + foreach_callback_func *func, + lt_ptr data1, lt_ptr data2)); + + static int find_file_callback LT_PARAMS((char *filename, lt_ptr data, + lt_ptr ignored)); + static int find_handle_callback LT_PARAMS((char *filename, lt_ptr data, + lt_ptr ignored)); + static int foreachfile_callback LT_PARAMS((char *filename, lt_ptr data1, + lt_ptr data2)); + + + static int canonicalize_path LT_PARAMS((const char *path, + char **pcanonical)); + static int argzize_path LT_PARAMS((const char *path, + char **pargz, + size_t *pargz_len)); + static FILE *find_file LT_PARAMS((const char *search_path, + const char *base_name, + char **pdir)); + static lt_dlhandle *find_handle LT_PARAMS((const char *search_path, + const char *base_name, + lt_dlhandle *handle)); + static int find_module LT_PARAMS((lt_dlhandle *handle, + const char *dir, + const char *libdir, + const char *dlname, + const char *old_name, + int installed)); + static int free_vars LT_PARAMS((char *dlname, char *oldname, + char *libdir, char *deplibs)); + static int load_deplibs LT_PARAMS((lt_dlhandle handle, + char *deplibs)); + static int trim LT_PARAMS((char **dest, + const char *str)); + static int try_dlopen LT_PARAMS((lt_dlhandle *handle, + const char *filename)); + static int tryall_dlopen LT_PARAMS((lt_dlhandle *handle, + const char *filename)); + static int unload_deplibs LT_PARAMS((lt_dlhandle handle)); + static int lt_argz_insert LT_PARAMS((char **pargz, + size_t *pargz_len, + char *before, + const char *entry)); + static int lt_argz_insertinorder LT_PARAMS((char **pargz, + size_t *pargz_len, + const char *entry)); + static int lt_dlpath_insertdir LT_PARAMS((char **ppath, + char *before, + const char *dir)); + static char *user_search_path= 0; static lt_dlloader *loaders = 0; static lt_dlhandle handles = 0; *************** *** 1273,1279 **** { int errors = 0; ! MUTEX_LOCK (); /* Initialize only at first call. */ if (++initialized == 1) --- 1697,1703 ---- { int errors = 0; ! LT_DLMUTEX_LOCK (); /* Initialize only at first call. */ if (++initialized == 1) *************** *** 1300,1316 **** if (presym_init (presym.dlloader_data)) { ! MUTEX_SETERROR (LT_DLSTRERROR (INIT_LOADER)); ++errors; } else if (errors != 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (DLOPEN_NOT_SUPPORTED)); ++errors; } } ! MUTEX_UNLOCK (); return errors; } --- 1724,1740 ---- if (presym_init (presym.dlloader_data)) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INIT_LOADER)); ++errors; } else if (errors != 0) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (DLOPEN_NOT_SUPPORTED)); ++errors; } } ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 1327,1342 **** } else { - const char *errormsg = 0; - presym_free_symlists(); ! ! MUTEX_LOCK (); if (default_preloaded_symbols) { errors = lt_dlpreload (default_preloaded_symbols); } ! MUTEX_UNLOCK (); } return errors; --- 1751,1764 ---- } else { presym_free_symlists(); ! ! LT_DLMUTEX_LOCK (); if (default_preloaded_symbols) { errors = lt_dlpreload (default_preloaded_symbols); } ! LT_DLMUTEX_UNLOCK (); } return errors; *************** *** 1346,1354 **** lt_dlpreload_default (preloaded) const lt_dlsymlist *preloaded; { ! MUTEX_LOCK (); default_preloaded_symbols = preloaded; ! MUTEX_UNLOCK (); return 0; } --- 1768,1776 ---- lt_dlpreload_default (preloaded) const lt_dlsymlist *preloaded; { ! LT_DLMUTEX_LOCK (); default_preloaded_symbols = preloaded; ! LT_DLMUTEX_UNLOCK (); return 0; } *************** *** 1357,1371 **** { /* shut down libltdl */ lt_dlloader *loader; - const char *errormsg; int errors = 0; ! MUTEX_LOCK (); loader = loaders; if (!initialized) { ! MUTEX_SETERROR (LT_DLSTRERROR (SHUTDOWN)); ++errors; goto done; } --- 1779,1792 ---- { /* shut down libltdl */ lt_dlloader *loader; int errors = 0; ! LT_DLMUTEX_LOCK (); loader = loaders; if (!initialized) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SHUTDOWN)); ++errors; goto done; } *************** *** 1421,1427 **** } done: ! MUTEX_UNLOCK (); return errors; } --- 1842,1848 ---- } done: ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 1435,1442 **** const char *saved_error; int errors = 0; ! MUTEX_GETERROR (saved_error); ! MUTEX_LOCK (); cur = handles; loader = loaders; --- 1856,1863 ---- const char *saved_error; int errors = 0; ! LT_DLMUTEX_GETERROR (saved_error); ! LT_DLMUTEX_LOCK (); cur = handles; loader = loaders; *************** *** 1469,1478 **** cur = *handle; if (filename) { ! cur->info.filename = strdup (filename); if (!cur->info.filename) { - MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ++errors; goto done; } --- 1890,1898 ---- cur = *handle; if (filename) { ! cur->info.filename = lt_estrdup (filename); if (!cur->info.filename) { ++errors; goto done; } *************** *** 1503,1517 **** } cur->loader = loader; ! last_error = saved_error; ! done: ! MUTEX_UNLOCK (); return errors; } static int find_module (handle, dir, libdir, dlname, old_name, installed) lt_dlhandle *handle; const char *dir; --- 1923,1986 ---- } cur->loader = loader; ! LT_DLMUTEX_SETERROR (saved_error); ! done: ! LT_DLMUTEX_UNLOCK (); return errors; } static int + tryall_dlopen_module (handle, prefix, dirname, dlname) + lt_dlhandle *handle; + const char *prefix; + const char *dirname; + const char *dlname; + { + int error = 0; + char *filename = 0; + size_t filename_len = 0; + size_t dirname_len = LT_STRLEN (dirname); + + assert (handle); + assert (dirname); + assert (dlname); + #ifdef LT_DIRSEP_CHAR + /* Only canonicalized names (i.e. with DIRSEP chars already converted) + should make it into this function: */ + assert (strchr (dirname, LT_DIRSEP_CHAR) == 0); + #endif + + if (dirname[dirname_len -1] == '/') + --dirname_len; + filename_len = dirname_len + 1 + LT_STRLEN (dlname); + + /* Allocate memory, and combine DIRNAME and MODULENAME into it. + The PREFIX (if any) is handled below. */ + filename = LT_EMALLOC (char, dirname_len + 1 + filename_len + 1); + if (!filename) + return 1; + + sprintf (filename, "%.*s/%s", (int) dirname_len, dirname, dlname); + + /* Now that we have combined DIRNAME and MODULENAME, if there is + also a PREFIX to contend with, simply recurse with the arguments + shuffled. Otherwise, attempt to open FILENAME as a module. */ + if (prefix) + { + error += tryall_dlopen_module (handle, 0, prefix, filename); + } + else if (tryall_dlopen (handle, filename) != 0) + { + ++error; + } + + LT_DLFREE (filename); + return error; + } + + static int find_module (handle, dir, libdir, dlname, old_name, installed) lt_dlhandle *handle; const char *dir; *************** *** 1520,1771 **** const char *old_name; int installed; { ! int error; ! char *filename; ! ! /* try to open the old library first; if it was dlpreopened, we want the preopened version of it, even if a dlopenable ! module is available */ ! if (old_name && tryall_dlopen(handle, old_name) == 0) { return 0; } ! /* try to open the dynamic library */ if (dlname) { - size_t len; - /* try to open the installed module */ if (installed && libdir) { ! len = strlen (libdir) + 1 + strlen (dlname); ! filename = LT_DLMALLOC (char, 1+ len); ! ! if (!filename) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 1; ! } ! ! sprintf (filename, "%s/%s", libdir, dlname); ! error = (tryall_dlopen (handle, filename) != 0); ! LT_DLFREE (filename); ! ! if (!error) ! { ! return 0; ! } } /* try to open the not-installed module */ if (!installed) { ! len = (dir ? strlen (dir) : 0) + strlen (objdir) + strlen (dlname); ! filename = LT_DLMALLOC (char, 1+ len); ! ! if (!filename) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 1; ! } ! ! if (dir) ! { ! strcpy (filename, dir); ! } ! else ! { ! *filename = 0; ! } ! strcat(filename, objdir); ! strcat(filename, dlname); ! ! error = tryall_dlopen (handle, filename) != 0; ! LT_DLFREE (filename); ! if (!error) ! { ! return 0; ! } } /* maybe it was moved to another directory */ { ! len = (dir ? strlen (dir) : 0) + strlen (dlname); ! filename = LT_DLMALLOC (char, 1+ len); ! if (dir) { ! strcpy (filename, dir); } ! else { ! *filename = 0; } ! strcat(filename, dlname); ! ! error = (tryall_dlopen (handle, filename) != 0); ! LT_DLFREE (filename); ! if (!error) { ! return 0; } } - } ! return 1; } ! static char* ! canonicalize_path (path) const char *path; { ! char *canonical = 0; ! if (path && *path) ! { ! char *ptr = strdup (path); ! canonical = ptr; ! #ifdef LT_DIRSEP_CHAR ! /* Avoid this overhead where '/' is the only separator. */ ! while (ptr = strchr (ptr, LT_DIRSEP_CHAR)) { ! *ptr++ = '/'; } ! #endif } ! return canonical; } ! static lt_ptr ! find_file (basename, search_path, pdir, handle) ! const char *basename; const char *search_path; ! char **pdir; ! lt_dlhandle *handle; ! { ! /* When handle != NULL search a library, otherwise a file ! return NULL on failure, otherwise the file/handle. */ ! ! lt_ptr result = 0; ! char *filename = 0; ! int filenamesize= 0; ! int lenbase = strlen (basename); ! char *canonical = 0; ! char *next = 0; ! MUTEX_LOCK (); if (!search_path || !*search_path) { ! MUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); goto cleanup; } ! canonical = canonicalize_path (search_path); ! if (!canonical) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! goto cleanup; ! } ! next = canonical; ! while (next) ! { ! int lendir; ! char *cur = next; ! next = strchr (cur, LT_PATHSEP_CHAR); ! if (!next) ! { ! next = cur + strlen (cur); ! } ! lendir = next - cur; ! if (*next == LT_PATHSEP_CHAR) ! { ! ++next; ! } ! else { ! next = 0; } ! if (lendir == 0) ! { ! continue; ! } ! if (lendir + 1 + lenbase >= filenamesize) ! { ! LT_DLFREE (filename); ! filenamesize = lendir + 1 + lenbase + 1; ! filename = LT_DLMALLOC (char, filenamesize); ! if (!filename) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! goto cleanup; ! } ! } ! strncpy(filename, cur, lendir); ! if (filename[lendir-1] != '/') ! { ! filename[lendir++] = '/'; ! } ! strcpy(filename+lendir, basename); ! if (handle) ! { ! if (tryall_dlopen (handle, filename) == 0) ! { ! result = (lt_ptr) handle; ! goto cleanup; ! } ! } ! else ! { ! FILE *file = fopen (filename, LT_READTEXT_MODE); ! if (file) ! { ! LT_DLFREE (*pdir); ! filename[lendir] = '\0'; ! *pdir = strdup(filename); ! if (!*pdir) ! { ! /* We could have even avoided the strdup, ! but there would be some memory overhead. */ ! *pdir = filename; ! filename = 0; ! } ! result = (lt_ptr) file; ! goto cleanup; ! } ! } } ! MUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); ! cleanup: ! LT_DLFREE (filename); ! LT_DLFREE (canonical); ! MUTEX_UNLOCK (); ! return result; } static int ! load_deplibs(handle, deplibs) lt_dlhandle handle; char *deplibs; { #if LTDL_DLOPEN_DEPLIBS ! char *p, *save_search_path; int depcount = 0; int i; char **names = 0; --- 1989,2288 ---- const char *old_name; int installed; { ! /* Try to open the old library first; if it was dlpreopened, we want the preopened version of it, even if a dlopenable ! module is available. */ ! if (old_name && tryall_dlopen (handle, old_name) == 0) { return 0; } ! /* Try to open the dynamic library. */ if (dlname) { /* try to open the installed module */ if (installed && libdir) { ! if (tryall_dlopen_module (handle, 0, libdir, dlname) == 0) ! return 0; } /* try to open the not-installed module */ if (!installed) { ! if (tryall_dlopen_module (handle, dir, objdir, dlname) == 0) ! return 0; } /* maybe it was moved to another directory */ { ! if (tryall_dlopen_module (handle, 0, dir, dlname) == 0) ! return 0; ! } ! } ! ! return 1; ! } ! ! static int ! canonicalize_path (path, pcanonical) ! const char *path; ! char **pcanonical; ! { ! char *canonical = 0; ! ! assert (path && *path); ! assert (pcanonical); ! ! canonical = LT_EMALLOC (char, 1+ LT_STRLEN (path)); ! if (!canonical) ! return 1; ! ! { ! size_t dest = 0; ! size_t src; ! for (src = 0; path[src] != LT_EOS_CHAR; ++src) ! { ! /* Path separators are not copied to the beginning or end of ! the destination, or if another separator would follow ! immediately. */ ! if (path[src] == LT_PATHSEP_CHAR) { ! if ((dest == 0) ! || (path[1+ src] == LT_PATHSEP_CHAR) ! || (path[1+ src] == LT_EOS_CHAR)) ! continue; } ! ! /* Anything other than a directory separator is copied verbatim. */ ! if ((path[src] != '/') ! #ifdef LT_DIRSEP_CHAR ! && (path[src] != LT_DIRSEP_CHAR) ! #endif ! ) { ! canonical[dest++] = path[src]; } ! /* Directory separators are converted and copied only if they are ! not at the end of a path -- i.e. before a path separator or ! NULL terminator. */ ! else if ((path[1+ src] != LT_PATHSEP_CHAR) ! && (path[1+ src] != LT_EOS_CHAR) ! #ifdef LT_DIRSEP_CHAR ! && (path[1+ src] != LT_DIRSEP_CHAR) ! #endif ! && (path[1+ src] != '/')) { ! canonical[dest++] = '/'; } } ! /* Add an end-of-string marker at the end. */ ! canonical[dest] = LT_EOS_CHAR; ! } ! ! /* Assign new value. */ ! *pcanonical = canonical; ! ! return 0; } ! static int ! argzize_path (path, pargz, pargz_len) const char *path; + char **pargz; + size_t *pargz_len; { ! error_t error; ! assert (path); ! assert (pargz); ! assert (pargz_len); ! if ((error = argz_create_sep (path, LT_PATHSEP_CHAR, pargz, pargz_len))) ! { ! switch (error) { ! case ENOMEM: ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! break; ! default: ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (UNKNOWN)); ! break; } ! ! return 1; } ! return 0; } ! /* Repeatedly call FUNC with each LT_PATHSEP_CHAR delimited element ! of SEARCH_PATH and references to DATA1 and DATA2, until FUNC returns ! non-zero or all elements are exhausted. If BASE_NAME is non-NULL, ! it is appended to each SEARCH_PATH element before FUNC is called. */ ! static int ! foreach_dirinpath (search_path, base_name, func, data1, data2) const char *search_path; ! const char *base_name; ! foreach_callback_func *func; ! lt_ptr data1; ! lt_ptr data2; ! { ! int result = 0; ! int filenamesize = 0; ! int lenbase = LT_STRLEN (base_name); ! int argz_len = 0; ! char *argz = 0; ! char *filename = 0; ! char *canonical = 0; ! LT_DLMUTEX_LOCK (); if (!search_path || !*search_path) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); goto cleanup; } ! if (canonicalize_path (search_path, &canonical) != 0) ! goto cleanup; ! if (argzize_path (canonical, &argz, &argz_len) != 0) ! goto cleanup; ! { ! char *dir_name = 0; ! while ((dir_name = argz_next (argz, argz_len, dir_name))) ! { ! int lendir = LT_STRLEN (dir_name); ! if (lendir +1 +lenbase >= filenamesize) { ! LT_DLFREE (filename); ! filenamesize = lendir +1 +lenbase +1; /* "/d" + '/' + "f" + '\0' */ ! filename = LT_EMALLOC (char, filenamesize); ! if (!filename) ! goto cleanup; } ! strncpy (filename, dir_name, lendir); ! if (base_name && *base_name) ! { ! if (filename[lendir -1] != '/') ! filename[lendir++] = '/'; ! strcpy (filename +lendir, base_name); ! } ! if ((result = (*func) (filename, data1, data2))) ! { ! break; ! } ! } ! } ! cleanup: ! LT_DLFREE (argz); ! LT_DLFREE (canonical); ! LT_DLFREE (filename); ! LT_DLMUTEX_UNLOCK (); ! return result; ! } ! /* If FILEPATH can be opened, store the name of the directory component ! in DATA1, and the opened FILE* structure address in DATA2. Otherwise ! DATA1 is unchanged, but DATA2 is set to a pointer to NULL. */ ! static int ! find_file_callback (filename, data1, data2) ! char *filename; ! lt_ptr data1; ! lt_ptr data2; ! { ! char **pdir = (char **) data1; ! FILE **pfile = (FILE **) data2; ! int is_done = 0; ! ! assert (filename && *filename); ! assert (pdir); ! assert (pfile); ! ! if ((*pfile = fopen (filename, LT_READTEXT_MODE))) ! { ! char *dirend = strrchr (filename, '/'); ! ! if (dirend > filename) ! *dirend = LT_EOS_CHAR; ! ! LT_DLFREE (*pdir); ! *pdir = lt_estrdup (filename); ! is_done = (*pdir == 0) ? -1 : 1; } ! return is_done; ! } ! static FILE * ! find_file (search_path, base_name, pdir) ! const char *search_path; ! const char *base_name; ! char **pdir; ! { ! FILE *file = 0; ! foreach_dirinpath (search_path, base_name, find_file_callback, pdir, &file); ! return file; ! } ! ! static int ! find_handle_callback (filename, data, ignored) ! char *filename; ! lt_ptr data; ! lt_ptr ignored; ! { ! lt_dlhandle *handle = (lt_dlhandle *) data; ! int found = access (filename, R_OK); ! ! /* Bail out if file cannot be read... */ ! if (!found) ! return 0; ! ! /* Try to dlopen the file, but do not continue searching in any ! case. */ ! if (tryall_dlopen (handle, filename) != 0) ! *handle = 0; ! ! return 1; ! } ! ! /* If HANDLE was found return it, otherwise return 0. If HANDLE was ! found but could not be opened, *HANDLE will be set to 0. */ ! static lt_dlhandle * ! find_handle (search_path, base_name, handle) ! const char *search_path; ! const char *base_name; ! lt_dlhandle *handle; ! { ! if (!search_path) ! return 0; ! ! if (!foreach_dirinpath (search_path, base_name, find_handle_callback, ! handle, 0)) ! return 0; ! ! return handle; } static int ! load_deplibs (handle, deplibs) lt_dlhandle handle; char *deplibs; { #if LTDL_DLOPEN_DEPLIBS ! char *p, *save_search_path = 0; int depcount = 0; int i; char **names = 0; *************** *** 1781,1792 **** } ++errors; ! MUTEX_LOCK (); ! save_search_path = strdup (user_search_path); ! if (user_search_path && !save_search_path) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! goto cleanup; } /* extract search paths and count deplibs */ --- 2298,2309 ---- } ++errors; ! LT_DLMUTEX_LOCK (); ! if (user_search_path) { ! save_search_path = lt_estrdup (user_search_path); ! if (!save_search_path) ! goto cleanup; } /* extract search paths and count deplibs */ *************** *** 1828,1834 **** LT_DLFREE (user_search_path); user_search_path = save_search_path; ! MUTEX_UNLOCK (); if (!depcount) { --- 2345,2351 ---- LT_DLFREE (user_search_path); user_search_path = save_search_path; ! LT_DLMUTEX_UNLOCK (); if (!depcount) { *************** *** 1836,1846 **** goto cleanup; } ! names = LT_DLMALLOC (char *, depcount * sizeof (char*)); if (!names) ! { ! goto cleanup; ! } /* now only extract the actual deplibs */ depcount = 0; --- 2353,2361 ---- goto cleanup; } ! names = LT_EMALLOC (char *, depcount * sizeof (char*)); if (!names) ! goto cleanup; /* now only extract the actual deplibs */ depcount = 0; *************** *** 1866,1890 **** *end = 0; /* set a temporary string terminator */ if (strncmp(p, "-l", 2) == 0) { ! name = LT_DLMALLOC (char, 3+ /* "lib" */ strlen (p+2) + 1); if (name) ! { ! sprintf (name, "lib%s", p+2); ! } } else ! { ! name = strdup(p); ! } ! if (name) ! { ! names[depcount++] = name; ! } ! else ! { ! goto cleanup_names; ! } *end = save; } p = end; --- 2381,2398 ---- *end = 0; /* set a temporary string terminator */ if (strncmp(p, "-l", 2) == 0) { ! size_t name_len = 3+ /* "lib" */ LT_STRLEN (p + 2); ! name = LT_EMALLOC (char, 1+ name_len); if (name) ! sprintf (name, "lib%s", p+2); } else ! name = lt_estrdup(p); ! if (!name) ! goto cleanup_names; ! ! names[depcount++] = name; *end = save; } p = end; *************** *** 1900,1910 **** { int j = 0; ! handle->deplibs = (lt_dlhandle*) LT_DLMALLOC (lt_dlhandle *, depcount); if (!handle->deplibs) ! { ! goto cleanup; ! } for (i = 0; i < depcount; ++i) { --- 2408,2416 ---- { int j = 0; ! handle->deplibs = (lt_dlhandle*) LT_EMALLOC (lt_dlhandle *, depcount); if (!handle->deplibs) ! goto cleanup; for (i = 0; i < depcount; ++i) { *************** *** 1933,1939 **** } static int ! unload_deplibs(handle) lt_dlhandle handle; { int i; --- 2439,2445 ---- } static int ! unload_deplibs (handle) lt_dlhandle handle; { int i; *************** *** 1961,1982 **** /* remove the leading and trailing "'" from str and store the result in dest */ const char *end = strrchr (str, '\''); ! int len = strlen (str); char *tmp; LT_DLFREE (*dest); if (len > 3 && str[0] == '\'') { ! tmp = LT_DLMALLOC (char, end - str); if (!tmp) ! { ! last_error = LT_DLSTRERROR (NO_MEMORY); ! return 1; ! } strncpy(tmp, &str[1], (end - str) - 1); ! tmp[len-3] = '\0'; *dest = tmp; } else --- 2467,2485 ---- /* remove the leading and trailing "'" from str and store the result in dest */ const char *end = strrchr (str, '\''); ! int len = LT_STRLEN (str); char *tmp; LT_DLFREE (*dest); if (len > 3 && str[0] == '\'') { ! tmp = LT_EMALLOC (char, end - str); if (!tmp) ! return 1; strncpy(tmp, &str[1], (end - str) - 1); ! tmp[len-3] = LT_EOS_CHAR; *dest = tmp; } else *************** *** 1988,1994 **** } static int ! free_vars( dlname, oldname, libdir, deplibs) char *dlname; char *oldname; char *libdir; --- 2491,2497 ---- } static int ! free_vars (dlname, oldname, libdir, deplibs) char *dlname; char *oldname; char *libdir; *************** *** 2002,2087 **** return 0; } ! lt_dlhandle ! lt_dlopen (filename) const char *filename; { ! lt_dlhandle handle = 0, newhandle; ! const char *ext; ! const char *saved_error; ! char *canonical = 0, *basename = 0, *dir = 0, *name = 0; ! MUTEX_GETERROR (saved_error); /* dlopen self? */ if (!filename) { ! handle = (lt_dlhandle) LT_DLMALLOC (struct lt_dlhandle_struct, 1); ! if (!handle) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 0; ! } ! handle->info.ref_count = 0; ! handle->depcount = 0; ! handle->deplibs = 0; ! handle->caller_data = 0; ! newhandle = handle; /* lt_dlclose()ing yourself is very bad! Disallow it. */ ! LT_DLSET_FLAG (handle, LT_DLRESIDENT_FLAG); if (tryall_dlopen (&newhandle, 0) != 0) { ! LT_DLFREE (handle); ! return 0; } goto register_handle; } ! canonical = canonicalize_path (filename); ! if (!canonical) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! LT_DLFREE (handle); ! return 0; } /* If the canonical module name is a path (relative or absolute) then split it into a directory part and a name part. */ ! basename = strrchr (canonical, '/'); ! if (basename) { ! ++basename; ! dir = LT_DLMALLOC (char, basename - canonical + 1); if (!dir) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! handle = 0; goto cleanup; } ! strncpy (dir, canonical, basename - canonical); ! dir[basename - canonical] = '\0'; } else ! { ! basename = canonical; ! } /* Check whether we are opening a libtool module (.la extension). */ ! ext = strrchr(basename, '.'); ! if (ext && strcmp(ext, ".la") == 0) { /* this seems to be a libtool module */ ! FILE *file = 0; ! int i; ! char *dlname = 0, *old_name = 0; ! char *libdir = 0, *deplibs = 0; ! char *line; size_t line_len; ! int error = 0; /* if we can't find the installed flag, it is probably an installed libtool archive, produced with an old version --- 2505,2598 ---- return 0; } ! int ! try_dlopen (phandle, filename) ! lt_dlhandle *phandle; const char *filename; { ! const char * ext = 0; ! const char * saved_error = 0; ! char * canonical = 0; ! char * base_name = 0; ! char * dir = 0; ! char * name = 0; ! int errors = 0; ! lt_dlhandle newhandle; ! ! assert (phandle); ! assert (*phandle == 0); ! LT_DLMUTEX_GETERROR (saved_error); /* dlopen self? */ if (!filename) { ! *phandle = (lt_dlhandle) LT_EMALLOC (struct lt_dlhandle_struct, 1); ! if (*phandle == 0) ! return 1; ! memset (*phandle, 0, sizeof(struct lt_dlhandle_struct)); ! newhandle = *phandle; /* lt_dlclose()ing yourself is very bad! Disallow it. */ ! LT_DLSET_FLAG (*phandle, LT_DLRESIDENT_FLAG); if (tryall_dlopen (&newhandle, 0) != 0) { ! LT_DLFREE (*phandle); ! return 1; } + goto register_handle; } ! assert (filename && *filename); ! ! /* Doing this immediately allows internal functions to safely ! assume only canonicalized paths are passed. */ ! if (canonicalize_path (filename, &canonical) != 0) { ! ++errors; ! goto cleanup; } /* If the canonical module name is a path (relative or absolute) then split it into a directory part and a name part. */ ! base_name = strrchr (canonical, '/'); ! if (base_name) { ! size_t dirlen = (1+ base_name) - canonical; ! ! dir = LT_EMALLOC (char, 1+ dirlen); if (!dir) { ! ++errors; goto cleanup; } + + strncpy (dir, canonical, dirlen); + dir[dirlen] = LT_EOS_CHAR; ! ++base_name; } else ! LT_DLMEM_REASSIGN (base_name, canonical); + assert (base_name && *base_name); + /* Check whether we are opening a libtool module (.la extension). */ ! ext = strrchr (base_name, '.'); ! if (ext && strcmp (ext, archive_ext) == 0) { /* this seems to be a libtool module */ ! FILE * file = 0; ! char * dlname = 0; ! char * old_name = 0; ! char * libdir = 0; ! char * deplibs = 0; ! char * line = 0; size_t line_len; ! int i; /* if we can't find the installed flag, it is probably an installed libtool archive, produced with an old version *************** *** 2089,2141 **** int installed = 1; /* extract the module name from the file name */ ! name = LT_DLMALLOC (char, ext - basename + 1); if (!name) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! handle = 0; goto cleanup; } /* canonicalize the module name */ ! for (i = 0; i < ext - basename; ++i) { ! if (isalnum ((int)(basename[i]))) { ! name[i] = basename[i]; } else { name[i] = '_'; } } - name[ext - basename] = '\0'; - /* Now try to open the .la file. If there is no directory name component, try to find it first in user_search_path and then other prescribed paths. Otherwise (or in any case if the module was not yet found) try opening just the module name as passed. */ if (!dir) { ! file = (FILE*) find_file(basename, user_search_path, &dir, 0); if (!file) { ! file = (FILE*) find_file(basename, getenv("LTDL_LIBRARY_PATH"), ! &dir, 0); } #ifdef LTDL_SHLIBPATH_VAR if (!file) { ! 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 } --- 2600,2659 ---- int installed = 1; /* extract the module name from the file name */ ! name = LT_EMALLOC (char, ext - base_name + 1); if (!name) { ! ++errors; goto cleanup; } /* canonicalize the module name */ ! for (i = 0; i < ext - base_name; ++i) { ! if (isalnum ((int)(base_name[i]))) { ! name[i] = base_name[i]; } else { name[i] = '_'; } } + name[ext - base_name] = LT_EOS_CHAR; /* Now try to open the .la file. If there is no directory name component, try to find it first in user_search_path and then other prescribed paths. Otherwise (or in any case if the module was not yet found) try opening just the module name as passed. */ if (!dir) { ! const char *search_path; ! ! LT_DLMUTEX_LOCK (); ! search_path = user_search_path; ! if (search_path) ! file = find_file (user_search_path, base_name, &dir); ! LT_DLMUTEX_UNLOCK (); ! if (!file) { ! search_path = getenv (LTDL_SEARCHPATH_VAR); ! if (search_path) ! file = find_file (search_path, base_name, &dir); } #ifdef LTDL_SHLIBPATH_VAR if (!file) { ! search_path = getenv (LTDL_SHLIBPATH_VAR); ! if (search_path) ! file = find_file (search_path, base_name, &dir); } #endif #ifdef LTDL_SYSSEARCHPATH ! if (!file && sys_search_path) { ! file = find_file (sys_search_path, base_name, &dir); } #endif } *************** *** 2143,2181 **** { file = fopen (filename, LT_READTEXT_MODE); } - if (!file) - { - MUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); - } if (!file) { ! handle = 0; goto cleanup; } line_len = LT_FILENAME_MAX; ! line = LT_DLMALLOC (char, line_len); if (!line) { fclose (file); ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! handle = 0; goto cleanup; } /* read the .la file */ ! while (!feof(file)) { if (!fgets (line, line_len, file)) { break; } - ! /* Handle the case where we occasionally need to read a line that is longer than the initial buffer size. */ ! while (line[strlen(line) -1] != '\n') { line = LT_DLREALLOC (char, line, line_len *2); if (!fgets (&line[line_len -1], line_len +1, file)) --- 2661,2696 ---- { file = fopen (filename, LT_READTEXT_MODE); } + /* If we didn't find the file by now, it really isn't there. Set + the status flag, and bail out. */ if (!file) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); ! ++errors; goto cleanup; } line_len = LT_FILENAME_MAX; ! line = LT_EMALLOC (char, line_len); if (!line) { fclose (file); ! ++errors; goto cleanup; } /* read the .la file */ ! while (!feof (file)) { if (!fgets (line, line_len, file)) { break; } ! /* Handle the case where we occasionally need to read a line that is longer than the initial buffer size. */ ! while (line[LT_STRLEN(line) -1] != '\n') { line = LT_DLREALLOC (char, line, line_len *2); if (!fgets (&line[line_len -1], line_len +1, file)) *************** *** 2194,2200 **** #define STR_DLNAME "dlname=" if (strncmp (line, STR_DLNAME, sizeof (STR_DLNAME) - 1) == 0) { ! error = trim (&dlname, &line[sizeof (STR_DLNAME) - 1]); } #undef STR_OLD_LIBRARY --- 2709,2715 ---- #define STR_DLNAME "dlname=" if (strncmp (line, STR_DLNAME, sizeof (STR_DLNAME) - 1) == 0) { ! errors += trim (&dlname, &line[sizeof (STR_DLNAME) - 1]); } #undef STR_OLD_LIBRARY *************** *** 2202,2214 **** else if (strncmp (line, STR_OLD_LIBRARY, sizeof (STR_OLD_LIBRARY) - 1) == 0) { ! error = trim (&old_name, &line[sizeof (STR_OLD_LIBRARY) - 1]); } #undef STR_LIBDIR #define STR_LIBDIR "libdir=" else if (strncmp (line, STR_LIBDIR, sizeof (STR_LIBDIR) - 1) == 0) { ! error = trim (&libdir, &line[sizeof(STR_LIBDIR) - 1]); } #undef STR_DL_DEPLIBS --- 2717,2729 ---- else if (strncmp (line, STR_OLD_LIBRARY, sizeof (STR_OLD_LIBRARY) - 1) == 0) { ! errors += trim (&old_name, &line[sizeof (STR_OLD_LIBRARY) - 1]); } #undef STR_LIBDIR #define STR_LIBDIR "libdir=" else if (strncmp (line, STR_LIBDIR, sizeof (STR_LIBDIR) - 1) == 0) { ! errors += trim (&libdir, &line[sizeof(STR_LIBDIR) - 1]); } #undef STR_DL_DEPLIBS *************** *** 2216,2222 **** else if (strncmp (line, STR_DL_DEPLIBS, sizeof (STR_DL_DEPLIBS) - 1) == 0) { ! error = trim (&deplibs, &line[sizeof (STR_DL_DEPLIBS) - 1]); } else if (strcmp (line, "installed=yes\n") == 0) { --- 2731,2737 ---- else if (strncmp (line, STR_DL_DEPLIBS, sizeof (STR_DL_DEPLIBS) - 1) == 0) { ! errors += trim (&deplibs, &line[sizeof (STR_DL_DEPLIBS) - 1]); } else if (strcmp (line, "installed=yes\n") == 0) { *************** *** 2233,2450 **** sizeof (STR_LIBRARY_NAMES) - 1) == 0) { char *last_libname; ! error = trim (&dlname, &line[sizeof (STR_LIBRARY_NAMES) - 1]); ! if (! error && dlname && ! (last_libname = strrchr (dlname, ' ')) != NULL) { ! last_libname = strdup (last_libname + 1); LT_DLMEM_REASSIGN (dlname, last_libname); } } ! if (error) ! { ! break; ! } } fclose (file); LT_DLFREE (line); /* allocate the handle */ ! handle = (lt_dlhandle) LT_DLMALLOC (struct lt_dlhandle_struct, 1); ! if (!handle || error) ! { ! LT_DLFREE (handle); ! if (!error) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! } free_vars (dlname, old_name, libdir, deplibs); ! /* handle is already set to 0 */ goto cleanup; } ! handle->info.ref_count = 0; ! if (load_deplibs (handle, deplibs) == 0) { ! newhandle = handle; /* find_module may replace newhandle */ if (find_module (&newhandle, dir, libdir, dlname, old_name, installed)) { ! unload_deplibs (handle); ! error = 1; } } else { ! error = 1; } free_vars (dlname, old_name, libdir, deplibs); ! if (error) { ! LT_DLFREE (handle); goto cleanup; } ! if (handle != newhandle) { ! unload_deplibs (handle); } } else { /* not a libtool module */ ! handle = (lt_dlhandle) LT_DLMALLOC (struct lt_dlhandle_struct, 1); ! if (!handle) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! /* handle is already set to 0 */ goto cleanup; } ! handle->info.ref_count = 0; ! /* non-libtool modules don't have dependencies */ ! handle->depcount = 0; ! handle->deplibs = 0; ! newhandle = handle; /* If the module has no directory name component, try to find it first in user_search_path and then other prescribed paths. Otherwise (or in any case if the module was not yet found) try opening just the module name as passed. */ ! if ((dir || (!find_file (basename, user_search_path, 0, &newhandle) ! && !find_file (basename, getenv ("LTDL_LIBRARY_PATH"), ! 0, &newhandle) #ifdef LTDL_SHLIBPATH_VAR ! && !find_file (basename, getenv (LTDL_SHLIBPATH_VAR), ! 0, &newhandle) #endif #ifdef LTDL_SYSSEARCHPATH ! && !find_file (basename, sys_search_path, 0, &newhandle) #endif ! )) && tryall_dlopen (&newhandle, filename)) { ! LT_DLFREE (handle); goto cleanup; } } register_handle: ! LT_DLMEM_REASSIGN (handle, newhandle); ! if (handle->info.ref_count == 0) { ! handle->info.ref_count = 1; ! handle->info.name = name; ! handle->next = handles; ! MUTEX_LOCK (); ! handles = handle; ! MUTEX_UNLOCK (); ! ! name = 0; /* don't free this during `cleanup' */ } ! MUTEX_SETERROR (saved_error); cleanup: LT_DLFREE (dir); LT_DLFREE (name); LT_DLFREE (canonical); return handle; } lt_dlhandle lt_dlopenext (filename) const char *filename; { ! lt_dlhandle handle; ! char *tmp; ! int len; ! const char *saved_error; - MUTEX_GETERROR (saved_error); - if (!filename) { return lt_dlopen (filename); } ! len = strlen (filename); ! if (!len) { ! MUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); ! return 0; } ! /* try "filename.la" */ ! tmp = LT_DLMALLOC (char, len+4); if (!tmp) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 0; ! } strcpy (tmp, filename); ! strcat (tmp, ".la"); ! handle = lt_dlopen (tmp); ! if (handle) { - MUTEX_SETERROR (saved_error); LT_DLFREE (tmp); return handle; } #ifdef LTDL_SHLIB_EXT ! /* try "filename.EXT" */ ! if (strlen(shlib_ext) > 3) { LT_DLFREE (tmp); ! tmp = LT_DLMALLOC (char, len + strlen (shlib_ext) + 1); if (!tmp) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 0; ! } strcpy (tmp, filename); } else { ! tmp[len] = '\0'; } strcat(tmp, shlib_ext); ! handle = lt_dlopen (tmp); ! if (handle) { - MUTEX_SETERROR (saved_error); LT_DLFREE (tmp); return handle; } #endif ! /* try the normal file name */ ! handle = lt_dlopen (filename); ! if (handle) { ! return handle; } - MUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); - LT_DLFREE (tmp); return 0; } int lt_dlclose (handle) lt_dlhandle handle; { lt_dlhandle cur, last; int errors = 0; ! MUTEX_LOCK (); /* check whether the handle is valid */ last = cur = handles; --- 2748,3246 ---- sizeof (STR_LIBRARY_NAMES) - 1) == 0) { char *last_libname; ! errors += trim (&dlname, &line[sizeof (STR_LIBRARY_NAMES) - 1]); ! if (!errors ! && dlname ! && (last_libname = strrchr (dlname, ' ')) != 0) { ! last_libname = lt_estrdup (last_libname + 1); ! if (!last_libname) ! { ! ++errors; ! goto cleanup; ! } LT_DLMEM_REASSIGN (dlname, last_libname); } } ! if (errors) ! break; } fclose (file); LT_DLFREE (line); /* allocate the handle */ ! *phandle = (lt_dlhandle) LT_EMALLOC (struct lt_dlhandle_struct, 1); ! if (*phandle == 0) ! ++errors; + if (errors) + { free_vars (dlname, old_name, libdir, deplibs); ! LT_DLFREE (*phandle); goto cleanup; } + + assert (*phandle); ! memset (*phandle, 0, sizeof(struct lt_dlhandle_struct)); ! if (load_deplibs (*phandle, deplibs) == 0) { ! newhandle = *phandle; /* find_module may replace newhandle */ if (find_module (&newhandle, dir, libdir, dlname, old_name, installed)) { ! unload_deplibs (*phandle); ! ++errors; } } else { ! ++errors; } free_vars (dlname, old_name, libdir, deplibs); ! if (errors) { ! LT_DLFREE (*phandle); goto cleanup; } ! if (*phandle != newhandle) { ! unload_deplibs (*phandle); } } else { /* not a libtool module */ ! *phandle = (lt_dlhandle) LT_EMALLOC (struct lt_dlhandle_struct, 1); ! if (*phandle == 0) { ! ++errors; goto cleanup; } ! ! memset (*phandle, 0, sizeof (struct lt_dlhandle_struct)); ! newhandle = *phandle; /* If the module has no directory name component, try to find it first in user_search_path and then other prescribed paths. Otherwise (or in any case if the module was not yet found) try opening just the module name as passed. */ ! if ((dir || (!find_handle (user_search_path, base_name, &newhandle) ! && !find_handle (getenv (LTDL_SEARCHPATH_VAR), base_name, ! &newhandle) #ifdef LTDL_SHLIBPATH_VAR ! && !find_handle (getenv (LTDL_SHLIBPATH_VAR), base_name, ! &newhandle) #endif #ifdef LTDL_SYSSEARCHPATH ! && !find_handle (sys_search_path, base_name, &newhandle) #endif ! ))) { ! tryall_dlopen (&newhandle, filename); ! } ! ! if (!newhandle) ! { ! LT_DLFREE (*phandle); ! ++errors; goto cleanup; } } register_handle: ! LT_DLMEM_REASSIGN (*phandle, newhandle); ! if ((*phandle)->info.ref_count == 0) { ! (*phandle)->info.ref_count = 1; ! LT_DLMEM_REASSIGN ((*phandle)->info.name, name); ! LT_DLMUTEX_LOCK (); ! (*phandle)->next = handles; ! handles = *phandle; ! LT_DLMUTEX_UNLOCK (); } ! LT_DLMUTEX_SETERROR (saved_error); cleanup: LT_DLFREE (dir); LT_DLFREE (name); LT_DLFREE (canonical); + return errors; + } + + lt_dlhandle + lt_dlopen (filename) + const char *filename; + { + lt_dlhandle handle = 0; + + /* Just incase we missed a code path in try_dlopen() that reports + an error, but forgets to reset handle... */ + if (try_dlopen (&handle, filename) != 0) + return 0; + return handle; } + /* If the last error messge store was `FILE_NOT_FOUND', then return + non-zero. */ + int + file_not_found () + { + const char *error = 0; + + LT_DLMUTEX_GETERROR (error); + if (error == LT_DLSTRERROR (FILE_NOT_FOUND)) + return 1; + + return 0; + } + + /* If FILENAME has an ARCHIVE_EXT or SHLIB_EXT extension, try to + open the FILENAME as passed. Otherwise try appending ARCHIVE_EXT, + and if a file is still not found try again with SHLIB_EXT appended + instead. */ lt_dlhandle lt_dlopenext (filename) const char *filename; { ! lt_dlhandle handle = 0; ! char * tmp = 0; ! char * ext = 0; ! int len; ! int errors = 0; ! int file_found = 1; /* until proven otherwise */ if (!filename) { return lt_dlopen (filename); } + + assert (filename); ! len = LT_STRLEN (filename); ! ext = strrchr (filename, '.'); ! ! /* If FILENAME already bears a suitable extension, there is no need ! to try appending additional extensions. */ ! if (ext && ((strcmp (ext, archive_ext) == 0) ! #ifdef LTDL_SHLIB_EXT ! || (strcmp (ext, shlib_ext) == 0) ! #endif ! )) { ! return lt_dlopen (filename); } ! /* First try appending ARCHIVE_EXT. */ ! tmp = LT_EMALLOC (char, len + LT_STRLEN (archive_ext) + 1); if (!tmp) ! return 0; ! strcpy (tmp, filename); ! strcat (tmp, archive_ext); ! errors = try_dlopen (&handle, tmp); ! ! /* If we found FILENAME, stop searching -- whether we were able to ! load the file as a module or not. If the file exists but loading ! failed, it is better to return an error message here than to ! report FILE_NOT_FOUND when the alternatives (foo.so etc) are not ! in the module search path. */ ! if (handle || ((errors > 0) && file_not_found ())) { LT_DLFREE (tmp); return handle; } #ifdef LTDL_SHLIB_EXT ! /* Try appending SHLIB_EXT. */ ! if (LT_STRLEN (shlib_ext) > LT_STRLEN (archive_ext)) { LT_DLFREE (tmp); ! tmp = LT_EMALLOC (char, len + LT_STRLEN (shlib_ext) + 1); if (!tmp) ! return 0; ! strcpy (tmp, filename); } else { ! tmp[len] = LT_EOS_CHAR; } strcat(tmp, shlib_ext); ! errors = try_dlopen (&handle, tmp); ! ! /* As before, if the file was found but loading failed, return now ! with the current error message. */ ! if (handle || ((errors > 0) && file_not_found ())) { LT_DLFREE (tmp); return handle; } #endif + + /* Still here? Then we really did fail to locate any of the file + names we tried. */ + LT_DLMUTEX_SETERROR (LT_DLSTRERROR (FILE_NOT_FOUND)); + LT_DLFREE (tmp); + return 0; + } + + + int + lt_argz_insert (pargz, pargz_len, before, entry) + char **pargz; + size_t *pargz_len; + char *before; + const char *entry; + { + error_t error; ! if ((error = argz_insert (pargz, pargz_len, before, entry))) { ! switch (error) ! { ! case ENOMEM: ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! break; ! default: ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (UNKNOWN)); ! break; ! } ! return 1; } return 0; } int + lt_argz_insertinorder (pargz, pargz_len, entry) + char **pargz; + size_t *pargz_len; + const char *entry; + { + char *before = 0; + + assert (pargz); + assert (pargz_len); + assert (entry && *entry); + + if (*pargz) + while ((before = argz_next (*pargz, *pargz_len, before))) + { + int cmp = strcmp (entry, before); + + if (cmp < 0) break; + if (cmp == 0) return 0; /* No duplicates! */ + } + + return lt_argz_insert (pargz, pargz_len, before, entry); + } + + int + lt_argz_insertdir (pargz, pargz_len, dirnam, dp) + char **pargz; + size_t *pargz_len; + const char *dirnam; + struct dirent *dp; + { + char *buf = 0; + size_t buf_len = 0; + char *end = 0; + size_t end_offset = 0; + size_t dir_len = 0; + int errors = 0; + + assert (pargz); + assert (pargz_len); + assert (dp); + + dir_len = LT_STRLEN (dirnam); + end = dp->d_name + LT_D_NAMLEN(dp); + + /* Ignore version numbers. */ + { + char *p; + for (p = end; p -1 > dp->d_name; --p) + if (strchr (".0123456789", p[-1]) == 0) + break; + + if (*p == '.') + end = p; + } + + /* Ignore filename extension. */ + { + char *p; + for (p = end -1; p > dp->d_name; --p) + if (*p == '.') + { + end = p; + break; + } + } + + /* Prepend the directory name. */ + end_offset = end - dp->d_name; + buf_len = dir_len + 1+ end_offset; + buf = LT_EMALLOC (char, 1+ buf_len); + if (!buf) + return ++errors; + + assert (buf); + + strcpy (buf, dirnam); + strcat (buf, "/"); + strncat (buf, dp->d_name, end_offset); + buf[buf_len] = LT_EOS_CHAR; + + /* Try to insert (in order) into ARGZ/ARGZ_LEN. */ + if (lt_argz_insertinorder (pargz, pargz_len, buf) != 0) + ++errors; + + LT_DLFREE (buf); + + return errors; + } + + int + list_files_by_dir (dirnam, pargz, pargz_len) + const char *dirnam; + char **pargz; + size_t *pargz_len; + { + DIR *dirp = 0; + int errors = 0; + + assert (dirnam && *dirnam); + assert (pargz); + assert (pargz_len); + assert (dirnam[LT_STRLEN(dirnam) -1] != '/'); + + dirp = opendir (dirnam); + if (dirp) + { + struct dirent *dp = 0; + + while ((dp = readdir (dirp))) + if (dp->d_name[0] != '.') + if (lt_argz_insertdir (pargz, pargz_len, dirnam, dp)) + { + ++errors; + break; + } + + closedir (dirp); + } + else + ++errors; + + return errors; + } + + + /* If there are any files in DIRNAME, call the function passed in + DATA1 (with the name of each file and DATA2 as arguments). */ + static int + foreachfile_callback (dirname, data1, data2) + char *dirname; + lt_ptr data1; + lt_ptr data2; + { + int (*func) LT_PARAMS((const char *filename, lt_ptr data)) + = (int (*) LT_PARAMS((const char *filename, lt_ptr data))) data1; + + int is_done = 0; + char *argz = 0; + size_t argz_len = 0; + + if (list_files_by_dir (dirname, &argz, &argz_len) != 0) + goto cleanup; + if (!argz) + goto cleanup; + + { + char *filename = 0; + while ((filename = argz_next (argz, argz_len, filename))) + if ((is_done = (*func) (filename, data2))) + break; + } + + cleanup: + LT_DLFREE (argz); + + return is_done; + } + + + /* Call FUNC for each unique extensionless file in SEARCH_PATH, along + with DATA. The filenames passed to FUNC would be suitable for + passing to lt_dlopenext. The extensions are stripped so that + individual modules do not generate several entries (e.g. libfoo.la, + libfoo.so, libfoo.so.1, libfoo.so.1.0.0). If SEARCH_PATH is NULL, + then the same directories that lt_dlopen would search are examined. */ + int + lt_dlforeachfile (search_path, func, data) + const char *search_path; + int (*func) LT_PARAMS ((const char *filename, lt_ptr data)); + lt_ptr data; + { + int is_done = 0; + + if (search_path) + { + /* If a specific path was passed, search only the directories + listed in it. */ + is_done = foreach_dirinpath (search_path, 0, + foreachfile_callback, func, data); + } + else + { + /* Otherwise search the default paths. */ + is_done = foreach_dirinpath (user_search_path, 0, + foreachfile_callback, func, data); + if (!is_done) + { + is_done = foreach_dirinpath (getenv("LTDL_LIBRARY_PATH"), 0, + foreachfile_callback, func, data); + } + + #ifdef LTDL_SHLIBPATH_VAR + if (!is_done) + { + is_done = foreach_dirinpath (getenv(LTDL_SHLIBPATH_VAR), 0, + foreachfile_callback, func, data); + } + #endif + #ifdef LTDL_SYSSEARCHPATH + if (!is_done) + { + is_done = foreach_dirinpath (getenv(LTDL_SYSSEARCHPATH), 0, + foreachfile_callback, func, data); + } + #endif + } + + return is_done; + } + + int lt_dlclose (handle) lt_dlhandle handle; { lt_dlhandle cur, last; int errors = 0; ! LT_DLMUTEX_LOCK (); /* check whether the handle is valid */ last = cur = handles; *************** *** 2456,2462 **** if (!cur) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); ++errors; goto done; } --- 3252,3258 ---- if (!cur) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); ++errors; goto done; } *************** *** 2492,2503 **** if (LT_DLIS_RESIDENT (handle)) { ! MUTEX_SETERROR (LT_DLSTRERROR (CLOSE_RESIDENT_MODULE)); ++errors; } done: ! MUTEX_UNLOCK (); return errors; } --- 3288,3299 ---- if (LT_DLIS_RESIDENT (handle)) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (CLOSE_RESIDENT_MODULE)); ++errors; } done: ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 2515,2554 **** if (!handle) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); return 0; } if (!symbol) { ! MUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); return 0; } ! lensym = strlen(symbol); ! if (handle->loader->sym_prefix) ! { ! lensym += strlen(handle->loader->sym_prefix); ! } ! ! if (handle->info.name) ! { ! lensym += strlen(handle->info.name); ! } if (lensym + LT_SYMBOL_OVERHEAD < LT_SYMBOL_LENGTH) { sym = lsym; } else - { - sym = LT_DLMALLOC (char, lensym + LT_SYMBOL_OVERHEAD + 1); - } - - if (!sym) { ! MUTEX_SETERROR (LT_DLSTRERROR (BUFFER_OVERFLOW)); ! return 0; } data = handle->loader->dlloader_data; --- 3311,3341 ---- if (!handle) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); return 0; } if (!symbol) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (SYMBOL_NOT_FOUND)); return 0; } ! lensym = LT_STRLEN (symbol) + LT_STRLEN (handle->loader->sym_prefix) ! + LT_STRLEN (handle->info.name); if (lensym + LT_SYMBOL_OVERHEAD < LT_SYMBOL_LENGTH) { sym = lsym; } else { ! sym = LT_EMALLOC (char, lensym + LT_SYMBOL_OVERHEAD + 1); ! if (!sym) ! { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (BUFFER_OVERFLOW)); ! return 0; ! } } data = handle->loader->dlloader_data; *************** *** 2556,2562 **** { const char *saved_error; ! MUTEX_GETERROR (saved_error); /* this is a libtool module */ if (handle->loader->sym_prefix) --- 3343,3349 ---- { const char *saved_error; ! LT_DLMUTEX_GETERROR (saved_error); /* this is a libtool module */ if (handle->loader->sym_prefix) *************** *** 2582,2588 **** } return address; } ! MUTEX_SETERROR (saved_error); } /* otherwise try "symbol" */ --- 3369,3375 ---- } return address; } ! LT_DLMUTEX_SETERROR (saved_error); } /* otherwise try "symbol" */ *************** *** 2610,2619 **** { const char *error; ! MUTEX_GETERROR (error); ! MUTEX_SETERROR (0); ! return error; } int --- 3397,3478 ---- { const char *error; ! LT_DLMUTEX_GETERROR (error); ! LT_DLMUTEX_SETERROR (0); ! return error ? error : LT_DLSTRERROR (UNKNOWN); ! } ! ! int ! lt_dlpath_insertdir (ppath, before, dir) ! char **ppath; ! char *before; ! const char *dir; ! { ! int errors = 0; ! char *canonical = 0; ! char *argz = 0; ! size_t argz_len = 0; ! ! assert (ppath); ! assert (dir && *dir); ! ! if (canonicalize_path (dir, &canonical) != 0) ! { ! ++errors; ! goto cleanup; ! } ! ! assert (canonical && *canonical); ! ! /* If *PPATH is empty, set it to DIR. */ ! if (*ppath == 0) ! { ! assert (!before); /* BEFORE cannot be set without PPATH. */ ! assert (dir); /* Without DIR, don't call this function! */ ! ! *ppath = lt_estrdup (dir); ! if (*ppath == 0) ! ++errors; ! ! return errors; ! } ! ! assert (ppath && *ppath); ! ! if (argzize_path (*ppath, &argz, &argz_len) != 0) ! { ! ++errors; ! goto cleanup; ! } ! ! /* Convert BEFORE into an equivalent offset into ARGZ. This only works ! if *PPATH is already canonicalized, and hence does not change length ! with respect to ARGZ. We canonicalize each entry as it is added to ! the search path, and don't call this function with (uncanonicalized) ! user paths, so this is a fair assumption. */ ! if (before) ! { ! assert (*ppath <= before); ! assert (before - *ppath <= strlen (*ppath)); ! ! before = before - *ppath + argz; ! } ! ! if (lt_argz_insert (&argz, &argz_len, before, dir) != 0) ! { ! ++errors; ! goto cleanup; ! } ! ! argz_stringify (argz, argz_len, LT_PATHSEP_CHAR); ! LT_DLMEM_REASSIGN (*ppath, argz); ! ! cleanup: ! LT_DLFREE (canonical); ! LT_DLFREE (argz); ! ! return errors; } int *************** *** 2622,2661 **** { int errors = 0; ! if (!search_dir || !strlen(search_dir)) { ! return errors; } ! MUTEX_LOCK (); ! if (!user_search_path) { ! user_search_path = strdup (search_dir); ! if (!user_search_path) { ! last_error = LT_DLSTRERROR (NO_MEMORY); ! ++errors; } } - else - { - size_t len = strlen (user_search_path) + 1 + strlen (search_dir); - char *new_search_path = LT_DLMALLOC (char, 1+ len); ! if (!new_search_path) { - MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ++errors; - } - else - { - sprintf (new_search_path, "%s%c%s", user_search_path, - LT_PATHSEP_CHAR, search_dir); - - LT_DLMEM_REASSIGN (user_search_path, new_search_path); } } - MUTEX_UNLOCK (); return errors; } --- 3481,3527 ---- { int errors = 0; ! if (search_dir && *search_dir) { ! LT_DLMUTEX_LOCK (); ! if (lt_dlpath_insertdir (&user_search_path, 0, search_dir) != 0) ! ++errors; ! LT_DLMUTEX_UNLOCK (); } + + return errors; + } + + int + lt_dlinsertsearchdir (before, search_dir) + const char *before; + const char *search_dir; + { + int errors = 0; ! if (before) { ! LT_DLMUTEX_LOCK (); ! if ((before < user_search_path) ! || (before >= user_search_path + LT_STRLEN (user_search_path))) { ! LT_DLMUTEX_UNLOCK (); ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_POSITION)); ! return 1; } + LT_DLMUTEX_UNLOCK (); } ! if (search_dir && *search_dir) ! { ! LT_DLMUTEX_LOCK (); ! if (lt_dlpath_insertdir (&user_search_path, ! (char *) before, search_dir) != 0) { ++errors; } + LT_DLMUTEX_UNLOCK (); } return errors; } *************** *** 2664,2687 **** lt_dlsetsearchpath (search_path) const char *search_path; { ! int errors = 0; ! MUTEX_LOCK (); LT_DLFREE (user_search_path); ! MUTEX_UNLOCK (); ! if (!search_path || !strlen (search_path)) { return errors; } ! MUTEX_LOCK (); ! user_search_path = strdup (search_path); ! if (!user_search_path) ! { ! ++errors; ! } ! MUTEX_UNLOCK (); return errors; } --- 3530,3550 ---- lt_dlsetsearchpath (search_path) const char *search_path; { ! int errors = 0; ! LT_DLMUTEX_LOCK (); LT_DLFREE (user_search_path); ! LT_DLMUTEX_UNLOCK (); ! if (!search_path || !LT_STRLEN (search_path)) { return errors; } ! LT_DLMUTEX_LOCK (); ! if (canonicalize_path (search_path, &user_search_path) != 0) ! ++errors; ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 2691,2699 **** { const char *saved_path; ! MUTEX_LOCK (); saved_path = user_search_path; ! MUTEX_UNLOCK (); return saved_path; } --- 3554,3562 ---- { const char *saved_path; ! LT_DLMUTEX_LOCK (); saved_path = user_search_path; ! LT_DLMUTEX_UNLOCK (); return saved_path; } *************** *** 2706,2712 **** if (!handle) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); ++errors; } else --- 3569,3575 ---- if (!handle) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); ++errors; } else *************** *** 2723,2729 **** { if (!handle) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); return -1; } --- 3586,3592 ---- { if (!handle) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); return -1; } *************** *** 2741,2747 **** { if (!handle) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); return 0; } --- 3604,3610 ---- { if (!handle) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_HANDLE)); return 0; } *************** *** 2752,2758 **** lt_dlhandle_next (place) lt_dlhandle place; { ! return place ? place->next : (lt_dlhandle) 0; } int --- 3615,3621 ---- lt_dlhandle_next (place) lt_dlhandle place; { ! return place ? place->next : handles; } int *************** *** 2763,2769 **** int errors = 0; lt_dlhandle cur; ! MUTEX_LOCK (); cur = handles; while (cur) --- 3626,3632 ---- int errors = 0; lt_dlhandle cur; ! LT_DLMUTEX_LOCK (); cur = handles; while (cur) *************** *** 2778,2784 **** } } ! MUTEX_UNLOCK (); return errors; } --- 3641,3647 ---- } } ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 2786,2803 **** lt_dlcaller_id lt_dlcaller_register () { ! static int last_caller_id = -1; int result; ! MUTEX_LOCK (); result = ++last_caller_id; ! MUTEX_UNLOCK (); return result; } - #define N_ELEMENTS(a) (sizeof(a) / sizeof(*(a))) - lt_ptr lt_dlcaller_set_data (key, handle, data) lt_dlcaller_id key; --- 3649,3664 ---- lt_dlcaller_id lt_dlcaller_register () { ! static lt_dlcaller_id last_caller_id = 0; int result; ! LT_DLMUTEX_LOCK (); result = ++last_caller_id; ! LT_DLMUTEX_UNLOCK (); return result; } lt_ptr lt_dlcaller_set_data (key, handle, data) lt_dlcaller_id key; *************** *** 2810,2819 **** /* This needs to be locked so that the caller data can be updated simultaneously by different threads. */ ! MUTEX_LOCK (); if (handle->caller_data) ! n_elements = N_ELEMENTS (handle->caller_data); for (i = 0; i < n_elements; ++i) { --- 3671,3681 ---- /* This needs to be locked so that the caller data can be updated simultaneously by different threads. */ ! LT_DLMUTEX_LOCK (); if (handle->caller_data) ! while (handle->caller_data[n_elements].key) ! ++n_elements; for (i = 0; i < n_elements; ++i) { *************** *** 2825,2855 **** } /* Ensure that there is enough room in this handle's caller_data ! array to accept a new element. */ if (i == n_elements) { lt_caller_data *temp ! = LT_DLREALLOC (lt_caller_data, handle->caller_data, 1+ n_elements); ! if (temp == 0) { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! stale = (lt_ptr) 0; goto done; } - else - { - handle->caller_data = temp; - } /* We only need this if we needed to allocate a new caller_data. */ handle->caller_data[i].key = key; } handle->caller_data[i].data = data; done: ! MUTEX_UNLOCK (); return stale; } --- 3687,3715 ---- } /* Ensure that there is enough room in this handle's caller_data ! array to accept a new element (and an empty end marker). */ if (i == n_elements) { lt_caller_data *temp ! = LT_DLREALLOC (lt_caller_data, handle->caller_data, 2+ n_elements); ! if (!temp) { ! stale = 0; goto done; } + handle->caller_data = temp; + /* We only need this if we needed to allocate a new caller_data. */ handle->caller_data[i].key = key; + handle->caller_data[1+ i].key = 0; } handle->caller_data[i].data = data; done: ! LT_DLMUTEX_UNLOCK (); return stale; } *************** *** 2860,2878 **** lt_dlhandle handle; { lt_ptr result = (lt_ptr) 0; - int n_elements = 0; /* This needs to be locked so that the caller data isn't updated by another thread part way through this function. */ ! MUTEX_LOCK (); ! ! if (handle->caller_data) ! n_elements = N_ELEMENTS (handle->caller_data); /* Locate the index of the element with a matching KEY. */ { int i; ! for (i = 0; i < n_elements; ++i) { if (handle->caller_data[i].key == key) { --- 3720,3734 ---- lt_dlhandle handle; { lt_ptr result = (lt_ptr) 0; /* This needs to be locked so that the caller data isn't updated by another thread part way through this function. */ ! LT_DLMUTEX_LOCK (); /* Locate the index of the element with a matching KEY. */ { int i; ! for (i = 0; handle->caller_data[i].key; ++i) { if (handle->caller_data[i].key == key) { *************** *** 2882,2888 **** } } ! MUTEX_UNLOCK (); return result; } --- 3738,3744 ---- } } ! LT_DLMUTEX_UNLOCK (); return result; } *************** *** 2906,2922 **** || (dlloader->module_close == 0) || (dlloader->find_sym == 0)) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); return 1; } /* Create a new dlloader node with copies of the user callbacks. */ ! node = LT_DLMALLOC (lt_dlloader, 1); ! if (node == 0) ! { ! MUTEX_SETERROR (LT_DLSTRERROR (NO_MEMORY)); ! return 1; ! } node->next = 0; node->loader_name = loader_name; --- 3762,3775 ---- || (dlloader->module_close == 0) || (dlloader->find_sym == 0)) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); return 1; } /* Create a new dlloader node with copies of the user callbacks. */ ! node = LT_EMALLOC (lt_dlloader, 1); ! if (!node) ! return 1; node->next = 0; node->loader_name = loader_name; *************** *** 2927,2933 **** node->find_sym = dlloader->find_sym; node->dlloader_data = dlloader->dlloader_data; ! MUTEX_LOCK (); if (!loaders) { /* If there are no loaders, NODE becomes the list! */ --- 3780,3786 ---- node->find_sym = dlloader->find_sym; node->dlloader_data = dlloader->dlloader_data; ! LT_DLMUTEX_LOCK (); if (!loaders) { /* If there are no loaders, NODE becomes the list! */ *************** *** 2960,2966 **** if (ptr->next != place) { ! last_error = LT_DLSTRERROR (INVALID_LOADER); ++errors; } else --- 3813,3819 ---- if (ptr->next != place) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); ++errors; } else *************** *** 2971,2977 **** } } ! MUTEX_UNLOCK (); return errors; } --- 3824,3830 ---- } } ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 2986,3003 **** if (!place) { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); return 1; } ! MUTEX_LOCK (); /* Fail if there are any open modules which use this loader. */ for (handle = handles; handle; handle = handle->next) { if (handle->loader == place) { ! MUTEX_SETERROR (LT_DLSTRERROR (REMOVE_LOADER)); ++errors; goto done; } --- 3839,3856 ---- if (!place) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); return 1; } ! LT_DLMUTEX_LOCK (); /* Fail if there are any open modules which use this loader. */ for (handle = handles; handle; handle = handle->next) { if (handle->loader == place) { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (REMOVE_LOADER)); ++errors; goto done; } *************** *** 3032,3038 **** LT_DLFREE (place); done: ! MUTEX_UNLOCK (); return errors; } --- 3885,3891 ---- LT_DLFREE (place); done: ! LT_DLMUTEX_UNLOCK (); return errors; } *************** *** 3043,3051 **** { lt_dlloader *next; ! MUTEX_LOCK (); next = place ? place->next : loaders; ! MUTEX_UNLOCK (); return next; } --- 3896,3904 ---- { lt_dlloader *next; ! LT_DLMUTEX_LOCK (); next = place ? place->next : loaders; ! LT_DLMUTEX_UNLOCK (); return next; } *************** *** 3058,3070 **** if (place) { ! MUTEX_LOCK (); name = place ? place->loader_name : 0; ! MUTEX_UNLOCK (); } else { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); } return name; --- 3911,3923 ---- if (place) { ! LT_DLMUTEX_LOCK (); name = place ? place->loader_name : 0; ! LT_DLMUTEX_UNLOCK (); } else { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); } return name; *************** *** 3078,3090 **** if (place) { ! MUTEX_LOCK (); data = place ? &(place->dlloader_data) : 0; ! MUTEX_UNLOCK (); } else { ! MUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); } return data; --- 3931,3943 ---- if (place) { ! LT_DLMUTEX_LOCK (); data = place ? &(place->dlloader_data) : 0; ! LT_DLMUTEX_UNLOCK (); } else { ! LT_DLMUTEX_SETERROR (LT_DLSTRERROR (INVALID_LOADER)); } return data; *************** *** 3096,3102 **** { lt_dlloader *place = 0; ! MUTEX_LOCK (); for (place = loaders; place; place = place->next) { if (strcmp (place->loader_name, loader_name) == 0) --- 3949,3955 ---- { lt_dlloader *place = 0; ! LT_DLMUTEX_LOCK (); for (place = loaders; place; place = place->next) { if (strcmp (place->loader_name, loader_name) == 0) *************** *** 3104,3110 **** break; } } ! MUTEX_UNLOCK (); return place; } --- 3957,3963 ---- break; } } ! LT_DLMUTEX_UNLOCK (); return place; } Index: libtool/libltdl/ltdl.h diff -c libtool/libltdl/ltdl.h:1.53 libtool/libltdl/ltdl.h:1.53.2.1 *** libtool/libltdl/ltdl.h:1.53 Fri Feb 23 14:58:20 2001 --- libtool/libltdl/ltdl.h Sun Sep 2 11:54:31 2001 *************** *** 34,39 **** --- 34,42 ---- /* --- MACROS FOR PORTABILITY --- */ + /* Saves on those hard to debug '\0' typos.... */ + #define LT_EOS_CHAR '\0' + /* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at the end of C declarations. */ *************** *** 82,87 **** --- 85,92 ---- # define LT_CONC(s,t) s/**/t #endif + /* LT_STRLEN can be used safely on NULL pointers. */ + #define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0) *************** *** 146,155 **** extern int lt_dlinit LT_PARAMS((void)); extern int lt_dlexit LT_PARAMS((void)); ! /* Module search path manipultation. */ ! extern int lt_dladdsearchdir LT_PARAMS((const char *search_dir)); ! extern int lt_dlsetsearchpath LT_PARAMS((const char *search_path)); ! extern const char *lt_dlgetsearchpath LT_PARAMS((void)); /* Portable libltdl versions of the system dlopen() API. */ extern lt_dlhandle lt_dlopen LT_PARAMS((const char *filename)); --- 151,166 ---- extern int lt_dlinit LT_PARAMS((void)); extern int lt_dlexit LT_PARAMS((void)); ! /* Module search path manipulation. */ ! extern int lt_dladdsearchdir LT_PARAMS((const char *search_dir)); ! extern int lt_dlinsertsearchdir LT_PARAMS((const char *before, ! const char *search_dir)); ! extern int lt_dlsetsearchpath LT_PARAMS((const char *search_path)); ! extern const char *lt_dlgetsearchpath LT_PARAMS((void)); ! extern int lt_dlforeachfile LT_PARAMS(( ! const char *search_path, ! int (*func) (const char *filename, lt_ptr data), ! lt_ptr data)); /* Portable libltdl versions of the system dlopen() API. */ extern lt_dlhandle lt_dlopen LT_PARAMS((const char *filename)); *************** *** 171,177 **** typedef void lt_dlmutex_lock LT_PARAMS((void)); typedef void lt_dlmutex_unlock LT_PARAMS((void)); ! typedef void lt_dlmutex_seterror LT_PARAMS((const char *error)); typedef const char *lt_dlmutex_geterror LT_PARAMS((void)); extern int lt_dlmutex_register LT_PARAMS((lt_dlmutex_lock *lock, --- 182,188 ---- typedef void lt_dlmutex_lock LT_PARAMS((void)); typedef void lt_dlmutex_unlock LT_PARAMS((void)); ! typedef void lt_dlmutex_seterror LT_PARAMS((const char *errmsg)); typedef const char *lt_dlmutex_geterror LT_PARAMS((void)); extern int lt_dlmutex_register LT_PARAMS((lt_dlmutex_lock *lock, *************** *** 185,192 **** /* --- MEMORY HANDLING --- */ ! /* Pointers to memory management functions to be used by libltdl. */ LT_SCOPE lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)); LT_SCOPE void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)); --- 196,208 ---- /* --- MEMORY HANDLING --- */ ! /* By default, the realloc function pointer is set to our internal ! realloc implementation which iself uses lt_dlmalloc and lt_dlfree. ! libltdl relies on a featureful realloc, but if you are sure yours ! has the right semantics then you can assign it directly. Generally, ! it is safe to assign just a malloc() and a free() function. */ LT_SCOPE lt_ptr (*lt_dlmalloc) LT_PARAMS((size_t size)); + LT_SCOPE lt_ptr (*lt_dlrealloc) LT_PARAMS((lt_ptr ptr, size_t size)); LT_SCOPE void (*lt_dlfree) LT_PARAMS((lt_ptr ptr)); *************** *** 275,282 **** extern const char *lt_dlloader_name LT_PARAMS((lt_dlloader *place)); extern lt_user_data *lt_dlloader_data LT_PARAMS((lt_dlloader *place)); extern int lt_dlloader_add LT_PARAMS((lt_dlloader *place, ! const struct lt_user_dlloader *dlloader, ! const char *loader_name)); extern int lt_dlloader_remove LT_PARAMS(( const char *loader_name)); --- 291,298 ---- extern const char *lt_dlloader_name LT_PARAMS((lt_dlloader *place)); extern lt_user_data *lt_dlloader_data LT_PARAMS((lt_dlloader *place)); extern int lt_dlloader_add LT_PARAMS((lt_dlloader *place, ! const struct lt_user_dlloader *dlloader, ! const char *loader_name)); extern int lt_dlloader_remove LT_PARAMS(( const char *loader_name)); *************** *** 307,313 **** LT_ERROR(INVALID_ERRORCODE, "invalid errorcode") \ LT_ERROR(SHUTDOWN, "library already shutdown") \ LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module") \ ! LT_ERROR(INVALID_MUTEX_ARGS, "invalid mutex handler registration") /* Enumerate the symbolic error names. */ enum { --- 323,330 ---- LT_ERROR(INVALID_ERRORCODE, "invalid errorcode") \ LT_ERROR(SHUTDOWN, "library already shutdown") \ LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module") \ ! LT_ERROR(INVALID_MUTEX_ARGS, "invalid mutex handler registration") \ ! LT_ERROR(INVALID_POSITION, "invalid search path insert position") /* Enumerate the symbolic error names. */ enum { Index: libtool/mdemo/Makefile.am diff -c libtool/mdemo/Makefile.am:1.43 libtool/mdemo/Makefile.am:1.43.2.1 *** libtool/mdemo/Makefile.am:1.43 Tue Sep 5 04:03:05 2000 --- libtool/mdemo/Makefile.am Thu Jun 28 19:38:04 2001 *************** *** 9,15 **** lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la foo1_la_SOURCES = foo1.c ! foo1_la_LIBADD = $(LIBM) foo1_la_LDFLAGS = -module -avoid-version libfoo2_la_SOURCES = foo2.c --- 9,15 ---- lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la foo1_la_SOURCES = foo1.c ! foo1_la_LIBADD = $(LIBM) libsub.la foo1_la_LDFLAGS = -module -avoid-version libfoo2_la_SOURCES = foo2.c Index: libtool/tests/Makefile.am diff -c libtool/tests/Makefile.am:1.28 libtool/tests/Makefile.am:1.28.2.1 *** libtool/tests/Makefile.am:1.28 Tue Apr 24 10:13:01 2001 --- libtool/tests/Makefile.am Fri Jun 29 10:06:56 2001 *************** *** 38,46 **** $(top_builddir)/libtool: cd $(top_builddir) && $(MAKE) all ! # We should export these variables when we run ltconfig. CFLAGS = @CFLAGS@ ! CPPLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ --- 38,46 ---- $(top_builddir)/libtool: cd $(top_builddir) && $(MAKE) all ! # We should export these variables when we build the libtool script. CFLAGS = @CFLAGS@ ! CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ Index: libtool/tests/defs diff -c libtool/tests/defs:1.1.1.6 libtool/tests/defs:1.1.1.6.8.1 *** libtool/tests/defs:1.1.1.6 Sun Mar 8 21:34:02 1998 --- libtool/tests/defs Sat Jun 30 13:27:42 2001 *************** *** 12,17 **** --- 12,18 ---- libtool="../libtool" make="${MAKE-make}" + SHELL="${CONFIG_SHELL-/bin/sh}" prefix="./_inst" if test "$need_prefix" = yes; then *************** *** 22,27 **** --- 23,31 ---- test -d $prefix && rm -rf $prefix prefix=NONE fi + + # Extract CC from the libtool configuration + eval `$libtool --config | grep '^CC='` # See how redirections should work. case "$VERBOSE" in Index: libtool/tests/link-2.test diff -c libtool/tests/link-2.test:1.1.1.3 libtool/tests/link-2.test:1.1.1.3.8.1 *** libtool/tests/link-2.test:1.1.1.3 Tue Apr 1 10:59:30 1997 --- libtool/tests/link-2.test Sat Jun 30 13:27:42 2001 *************** *** 10,19 **** fi . $srcdir/defs || exit 1 # Try a sample link command. ! linkresult=`$libtool -n --mode=link gcc -o something foo.o hell.lo` ! test $? -eq 0 || exit 1 echo "$linkresult" case "$linkresult" in --- 10,30 ---- fi . $srcdir/defs || exit 1 + rm -f hell.lo + cat > hell.lo <&1; exit 0) | grep 'cannot'; then : else ! echo "recognized foo.$ext as a valid source file" status=1 fi done --- 29,35 ---- for name in $bad_names; do if ($libtool -n --mode=compile compiler -c $name 2>&1; exit 0) | grep 'cannot'; then : else ! echo "incorrectly recognized $name as a valid source file" status=1 fi done