From 8ab5a3e59b60eebb48cdab404ff584ab01a0fd66 Mon Sep 17 00:00:00 2001 From: Thomas Tanner Date: Sat, 13 Mar 1999 17:46:25 +0000 Subject: [PATCH] * updated * NEWS: next version is 1.3pre * ltconfig.in: removed "must_relink" flag * ltmain.in: implemented fast-install mode, fixed many bugs --- ChangeLog | 7 + Makefile.am | 28 +- NEWS | 89 ++-- README-alpha | 4 +- TODO | 47 +-- cdemo/Makefile.am | 4 + cdemo/configure.in | 1 + configure.in | 23 +- demo/Makefile.am | 4 + demo/configure.in | 2 + depdemo/Makefile.am | 4 + depdemo/configure.in | 1 + doc/libtool.texi | 72 +++- libltdl/Makefile.am | 22 +- libltdl/acconfig.h | 15 - libltdl/configure.in | 75 +++- libltdl/ltdl.c | 100 +++-- libtool.m4 | 173 ++++---- libtoolize.in | 48 ++- ltconfig.in | 558 ++++++++++++++++++++++++-- ltmain.in | 937 +++++++++++++++++++++++++------------------ mdemo/Makefile.am | 19 +- mdemo/configure.in | 8 + mdemo/main.c | 41 +- tests/Makefile.am | 27 +- tests/hardcode.test | 2 +- 26 files changed, 1575 insertions(+), 736 deletions(-) delete mode 100644 libltdl/acconfig.h diff --git a/ChangeLog b/ChangeLog index fbfe06378..26da4db6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +1999-03-13 Thomas Tanner + + * updated + * NEWS: next version is 1.3pre + * ltconfig.in: removed "must_relink" flag + * ltmain.in: implemented fast-install mode, fixed many bugs + 1999-03-09 Gary V. Vaughan * ltmain.in: fixed a bug that causes archive link to fail when diff --git a/Makefile.am b/Makefile.am index 1479f98e3..ffee14cc2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = 1.3e gnits readme-alpha -BUILD_SUBDIRS = . doc tests +BUILD_SUBDIRS = . libltdl doc tests SUBDIRS = $(BUILD_SUBDIRS) DIST_SUBDIRS = $(BUILD_SUBDIRS) $(CONF_SUBDIRS) @@ -15,7 +15,7 @@ aclocal_macros = libtool.m4 EXTRA_DIST = $(aclocal_macros) libtoolize.in ltconfig.in ltmain.in \ libtool.spec -CLEANFILES = libtool libtoolize ltconfig.T ltmain.shT libltdl.tar.gz +CLEANFILES = libtool libtoolize ltconfig.T ltmain.shT # These are required by libtoolize. pkgdata_SCRIPTS = config.guess config.sub ltconfig @@ -30,15 +30,15 @@ bin_SCRIPTS = libtool libtoolize libtool: $(srcdir)/ltmain.sh $(srcdir)/ltconfig CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ LD="$(LD)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ - $(SHELL) $(srcdir)/ltconfig --srcdir=$(srcdir) --output=$@ \ - $(srcdir)/ltmain.sh + $(SHELL) $(srcdir)/ltconfig $(LIBTOOL_FLAGS) --srcdir=$(srcdir) \ + --output=$@ $(srcdir)/ltmain.sh # Experimental C version of libtool. clibtool: $(srcdir)/ltmain.c $(srcdir)/ltconfig CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" \ LD="$(LD)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \ - $(SHELL) $(srcdir)/ltconfig --srcdir=$(srcdir) --output=$@ \ - $(srcdir)/ltmain.c + $(SHELL) $(srcdir)/ltconfig $(LIBTOOL_FLAGS) --srcdir=$(srcdir) \ + --output=$@ $(srcdir)/ltmain.c libtoolize: $(srcdir)/libtoolize.in $(top_builddir)/config.status CONFIG_FILES=libtoolize CONFIG_HEADERS= $(top_builddir)/config.status @@ -80,7 +80,6 @@ update-timestamps: # All our rules should depend on these demo files. all-local check-local: $(ACINCLUDE_M4_LIST) libtool -check-local: libltdl/Makefile @ACINCLUDE_M4_LIST@: $(srcdir)/libtool.m4 rm -f $@ @@ -94,18 +93,9 @@ configure-subdirs distdir: $(DIST_MAKEFILE_LIST) abs_srcdir=`cd $(top_srcdir) && pwd`; \ (cd $$dir && $$abs_srcdir/$$dir/configure) || exit 1 -# Create and install libltdl.tar.gz -install-data-hook: libltdl/Makefile - @echo 'cd libltdl && $(MAKE) distdir distdir=libltdl && tar -cf libltdl.tar libltdl && gzip $(GZIP_ENV) libltdl.tar' - @if (cd libltdl && $(MAKE) distdir distdir=libltdl && \ - tar -cf libltdl.tar libltdl && \ - gzip $(GZIP_ENV) libltdl.tar); then \ - echo "$(INSTALL_DATA) libltdl/libltdl.tar.gz $(pkgdatadir)/libltdl.tar.gz"; \ - $(INSTALL_DATA) libltdl/libltdl.tar.gz $(pkgdatadir)/libltdl.tar.gz; \ - else \ - echo "Warning: without gzip, libtool cannot install libltdl.tar.gz"; \ - fi; \ - rm -rf libltdl/libltdl libltdl/libltdl.tar libltdl/libltdl.tar.gz +# Create and install libltdl +install-data-hook: + cd libltdl && $(MAKE) distdir distdir=$(DESTDIR)$(pkgdatadir)/libltdl ################################################################ ## diff --git a/NEWS b/NEWS index ccd84b12f..575d9f816 100644 --- a/NEWS +++ b/NEWS @@ -1,87 +1,94 @@ NEWS - list of user-visible changes between releases of GNU Libtool -New in 1.2g: CVS version +New in 1.3pre: CVS version; 1.3: 1999-?-?, Libtool team: +* Complete inter-library dependencies support. It's now possible + to link libtool libraries against other libtool libraries. +* Already-installed libtool libraries will be correctly found. * Support for linking dll objects specified on the link line. - +* New demos and tests +* Various bugfixes + New in 1.2e: CVS version; 1.2f: 1999-?-?, Libtool team: -* In order for libtool to attempt to link a shared library (dll) on win32 - platforms, you must pass the -no-undefined flag to libtool in link mode. -* The path to GNU ld now works on cygwin-b18 to cygwin-b20.2 at least. -* Support for IRIX library versioning. -* Improved support for DJGPP envionment. -* Wrapper scripts now work on win32. * libtool will correctly link uninstalled libraries into programs and prefer uninstalled libraries to installed ones * Library paths that are in the system search path are no longer hardcoded. * New fast installation mode, which links the final executable in order to avoid relinking during installation. Programs in the build-tree are relinked when executed. -* New AC_DISABLE_FAST_INSTALL macro to disable the fast-install mode +* New AC_DISABLE_FAST_INSTALL macro to set the default for + the fast-install mode to disabled * New -export-symbols-regex flag, to export symbols selectively by a regular expression +* Support -R for specifying run-time path of programs and library dependencies +* New -avoid-version option to avoid versioning for libraries +* libtool module names no longer need to have a "lib" prefix + (requires automake 1.4). +* New -thread-safe flag, to build thread-safe libraries * Major improvements in libltdl: API documentation, installable version, support for module search paths, support for lt_dlopen(0), can be embedded into packages as a tar file (libltdl.tar.gz), dynamic buffer allocation and buffer overflow checks, new macro LTDL_SET_PRELOADED_SYMBOLS() which must be used in the main program, dynamic memory allocation functions are user-defineable -* If libtool could not satisfy all dependencies of a module - it will only build a static version of it +* New AC_LIBLTDL_CONVENIENCE and AC_LIBLTDL_INSTALLABLE macros, to select + convenience and/or installable versions of libltdl. +* libltdl is now built and installed unless --disable-ltdl-install * New "-dlopen self" flag for dlopening the executable itself -* dld_preloaded_symbols was renamed to lt_preloaded_symbols * New AC_LIBTOOL_DLOPEN macro to check for dlopen support, required if you use -dlopen or -dlpreopen -* New -thread-safe flag, to build thread-safe libraries -* New demos and tests -* Improved shared library checking -* Libtool will now accept *.dll objects on the command line, and generate - an import library on the fly so that it will be linked correctly. -* Support -R for specifying run-time path of programs and library dependencies +* If libtool could not satisfy all dependencies of a module + it will only build a static version of it +* dld_preloaded_symbols was renamed to lt_preloaded_symbols * Support for BeOS -* Improved support for aix3, aix4, SysV 4.3, BSD/OS 4.x and NetBSD -* New -avoid-version option to avoid versioning for libraries +* Improved support for FreeBSD, AIX, IRIX, OSF, SysV 4.3, HP/UX, DJGPP + BSD/OS 4.x and NetBSD +* In order for libtool to attempt to link a shared library (dll) on win32 + platforms, you must pass the -no-undefined flag to libtool in link mode. +* The path to GNU ld now works on cygwin-b18 to cygwin-b20.2 at least. +* Support for IRIX library versioning. +* New demos and tests * Various bugfixes - + New in 1.2c: CVS version; 1.2d: 1998-12-16, Libtool team: * libtool will correctly link already-installed libraries into programs. * New -module flag, to create loadable modules. * New libltdl, a small library for portable dlopening of modules. -It is still undocumented, but you can already find some examples in: + It is still undocumented, but you can already find some examples in: * New mdemo directory, with tests of -module and dlopening examples. -Be aware that libltdl is only known to work on a few platforms such as -GNU/Linux and Solaris2. Some mdemo tests are known to FAIL on several -other platforms; please ignore these failures by now (or work to fix -them :-). + Be aware that libltdl is only known to work on a few platforms such as + GNU/Linux and Solaris2. Some mdemo tests are known to FAIL on several + other platforms; please ignore these failures by now (or work to fix + them :-). * Inter-library dependencies patch finally integrated, but there's -still much porting to do. See PORTING for details (some plans for the -future in mail/deplibs in the CVS tree). + still much porting to do. See PORTING for details (some plans for the + future in mail/deplibs in the CVS tree). * New option -export-symbols to control symbol exporting when possible. * Fixed -export-dynamic problem with C++ programs in egcs 1.1. * New dlpreopen structure. * libtool now supports `-c -o' and subdirectories in sources and -target object names even in platforms whose compilers do not support -this. In this case, file locking occurs to avoid problems with -parallel builds. + target object names even in platforms whose compilers do not support + this. In this case, file locking occurs to avoid problems with + parallel builds. * New `echo' variant that should fix most problems with long command -lines and broken printf programs. + lines and broken printf programs. * Support for DG/UX, UnixWare 7.x and FreeBSD 3.0, and improved -support for Microsoft Windows + support for Microsoft Windows * Various bugfixes * We now have anonymous CVS access to GNU libtool. CVSROOT is -:pserver:anoncvs@anoncvs.gnu.org:/gd/gnu/anoncvsroot. The password -is empty. The directory is libtool. Check our home-page at -http://www.gnu.org/software/libtool/libtool.html for details. + :pserver:anoncvs@anoncvs.gnu.org:/gd/gnu/anoncvsroot. The password + is empty. The directory is libtool. Check our home-page at + http://www.gnu.org/software/libtool/libtool.html for details. * Alexandre Oliva, Thomas Tanner and Gary V. Vaughan have taken over -the maintenance of libtool. + the maintenance of libtool. * Arguments to ltconfig have been changed to allow creation of a -libtool C program, totally unusable as of this release. - + libtool C program, totally unusable as of this release. + New in 1.2b - 1998-07-01, Gordon Matzigkeit: * Libtool needs a new maintainer, since Gordon Matzigkeit has quit. -If you think you can do the job, send mail to bug-libtool@gnu.org. + If you think you can do the job, send mail to bug-libtool@gnu.org. * Bug fixes. * Support for libtool convenience archives. - + New in 1.2a - 1998-04-19, Gordon Matzigkeit: * Bug fixes. * ltconfig accepts an `--output' option to specify the name of the diff --git a/README-alpha b/README-alpha index 3f8a4e090..d42355598 100644 --- a/README-alpha +++ b/README-alpha @@ -50,7 +50,9 @@ libtool mailing list, . = Release procedure * Fetch new versions of the files that are maintained by the FSF. - Unfortunately you need an FSF account to do this. + The most important ones are available for anonymous CVS in the + `common' directory, sibling of the libtool CVS tree: + cvs -d :pserver:anoncvs@anoncvs.gnu.org:/gd/gnu/anoncvsroot checkout common * Update NEWS. diff --git a/TODO b/TODO index 3d0116b55..8d1d1000f 100644 --- a/TODO +++ b/TODO @@ -1,26 +1,11 @@ -For next alpha release: -*********************** - -* Fast installation (linking on demand in the build tree) -must be optional. +For next public release: +************************ * check whether the version of libtool.m4 is compatible with ltconfig/ltmain.sh -* libltdl is broken when configured with --enable-ltdl-install - * check whether the "file" command is available -* update the NEWS file - -* Tom Lane adds that HP-UX's linker, at least (I've also found this on -AIX 4), distinguishes between global function and global variable -references. This means that we cannot declare every symbol as `extern -char'. Find a workaround. - -For next public release: -************************ - * Inter-library dependencies should be fully tracked by libtool and need to work for ltlibraries too. This requires looking up installed libtool libraries for transparent support. @@ -33,6 +18,20 @@ paths into libraries, as well as binaries: `... -Wl,-soname * Lists of exported symbols should be stored in the pseudo library so that the size of lt_preloaded_symbols can be reduced. +* Documentation: + +- libltdl documentation needs to be completed. + +- AC_PROG_LIBTOOL, AC_ENABLE/DISABLE_SHARED/STATIC/FAST_INSTALL, + AC_LIBTOOL_DLOPEN, AC_LIBLTDL_CONVENIENCE/INSTALLABLE are not documented + +- Purpose and usage of convenience libraries must be better documented + +- some new internal variables are not documented yet. + +In the future: +************** + * Godmar Back writes: libltdl uses such stdio functions as fopen, fgets, feof, fclose, and others. These functions are not async-signal-safe. While this does not make @@ -49,20 +48,6 @@ so that the size of lt_preloaded_symbols can be reduced. possible would greatly improve libltdl's ability to be embedded in and used by other systems. -* Documentation: - -- libltdl documentation needs to be completed. - -- AC_PROG_LIBTOOL, AC_ENABLE/DISABLE_SHARED/STATIC, AC_LIBTOOL_DLOPEN - are not documented. - -- Purpose and usage of convenience libraries must be better documented - -- some new internal variables are not documented yet. - -In the future: -************** - * Fix */demo on win32. This may simply require resolving the item below. diff --git a/cdemo/Makefile.am b/cdemo/Makefile.am index 8e9a844a8..4fe099471 100644 --- a/cdemo/Makefile.am +++ b/cdemo/Makefile.am @@ -14,3 +14,7 @@ bin_PROGRAMS = cdemo cdemo_SOURCES = main.c cdemo_LDADD = libfoo.la + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/cdemo/configure.in b/cdemo/configure.in index e39ca3c4b..cf28fa653 100644 --- a/cdemo/configure.in +++ b/cdemo/configure.in @@ -5,6 +5,7 @@ AM_INIT_AUTOMAKE(cdemo,0.1) AC_PROG_CC AC_EXEEXT AM_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) AC_CHECK_HEADERS(math.h) diff --git a/configure.in b/configure.in index 3232168c7..11e13288e 100644 --- a/configure.in +++ b/configure.in @@ -39,12 +39,27 @@ AC_PROG_LN_S dnl For the `lineno' script (which puts line numbers into `ltconfig'). AC_PROG_AWK +dnl Check for dlopen support +AC_LIBTOOL_DLOPEN +AC_LIBTOOL_SETUP + +LIBTOOL_FLAGS="$libtool_flags" +AC_SUBST(LIBTOOL_FLAGS) + +AC_ARG_ENABLE(ltdl-install, +[ --disable-ltdl-install do not install libltdl]) +if test x"${enable_ltdl_install+set}" != xset; then + enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" +fi +AC_CONFIG_SUBDIRS(libltdl) + dnl all subdirectories that are configured on demand, but that must be dnl included in the distribution -CONF_SUBDIRS="libltdl demo mdemo cdemo depdemo" +CONF_SUBDIRS="cdemo demo depdemo mdemo" AC_SUBST(CONF_SUBDIRS) -ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4 " +ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4 ${srcdir}/libltdl/acinclude.m4 " DIST_MAKEFILE_LIST= for dir in $CONF_SUBDIRS; do ACINCLUDE_M4_LIST="$ACINCLUDE_M4_LIST${srcdir}/$dir/acinclude.m4 " @@ -53,6 +68,10 @@ done AC_SUBST(ACINCLUDE_M4_LIST) AC_SUBST(DIST_MAKEFILE_LIST) +AC_OUTPUT_COMMANDS([ + test -f ${saved_top_srcdir}/ltconfig || ${MAKE-make} ${saved_top_srcdir}/ltconfig + test -f ${saved_top_srcdir}/ltmain.sh || ${MAKE-make} ${saved_top_srcdir}/ltmain.sh +], [saved_top_srcdir=${srcdir}]) AC_OUTPUT([Makefile doc/Makefile tests/Makefile]) # Local Variables: diff --git a/demo/Makefile.am b/demo/Makefile.am index cd3ea84b7..8b5413b39 100644 --- a/demo/Makefile.am +++ b/demo/Makefile.am @@ -108,3 +108,7 @@ hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES) @rm -f hc-minusL $(CC) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello -lm + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/demo/configure.in b/demo/configure.in index 67cb0bd21..2641d8614 100644 --- a/demo/configure.in +++ b/demo/configure.in @@ -5,7 +5,9 @@ AM_INIT_AUTOMAKE(hell,1.0) AC_PROG_CC AC_C_CONST AC_EXEEXT +AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then STATIC=-static diff --git a/depdemo/Makefile.am b/depdemo/Makefile.am index ae544a402..04b4aaf9e 100644 --- a/depdemo/Makefile.am +++ b/depdemo/Makefile.am @@ -18,3 +18,7 @@ depdemo_static_SOURCES = $(depdemo_SOURCES) depdemo_static_LDADD = $(depdemo_LDADD) depdemo_static_DEPENDENCIES = $(depdemo_DEPENDENCIES) depdemo_static_LDFLAGS = $(STATIC) + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/depdemo/configure.in b/depdemo/configure.in index 96720c83e..bfd04c2b8 100644 --- a/depdemo/configure.in +++ b/depdemo/configure.in @@ -5,6 +5,7 @@ AM_INIT_AUTOMAKE(depdemo,0.1) AC_PROG_CC AC_EXEEXT AM_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then STATIC=-static diff --git a/doc/libtool.texi b/doc/libtool.texi index 00e2caf3b..4686aab66 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -2623,8 +2623,7 @@ Unresolved symbols in the module are resolved using its dependency libraries and previously dlopened modules. If the executable using this module was linked with the @code{-export-dynamic} flag, then the global symbols in the executable will also be used to resolve references in the -module. Libltdl tries to resolve the symbols immediately and returns -@code{NULL} if that fails. +module. If @var{filename} is NULL @code{lt_dlopen} will return a handle for the program itself, which can be used to access its symbols @@ -2870,6 +2869,7 @@ line as an assignment in the libtool script. @itemx demo-unst.test @itemx demo-static.test @itemx demo-shared.test +@itemx demo-nofast.test @pindex demo-conf.test @pindex demo-exec.test @pindex demo-inst.test @@ -2877,19 +2877,22 @@ line as an assignment in the libtool script. @pindex demo-unst.test @pindex demo-static.test @pindex demo-shared.test +@pindex demo-nofast.test These programs check to see that the @file{demo} subdirectory of the libtool distribution can be configured, built, installed, and uninstalled correctly. The @file{demo} subdirectory contains a demonstration of a trivial -package that uses libtool. The tests @file{cdemo-make.test}, -@file{cdemo-exec.test}, @file{cdemo-inst.test} and -@file{cdemo-unst.test} are executed three times, under three different -libtool configurations: @file{cdemo-conf.test} configures -@file{cdemo/libtool} to build both static and shared libraries, -@file{cdemo-static.test} builds only static libraries -(@samp{--disable-shared}), and @file{cdemo-shared.test} builds only +package that uses libtool. The tests @file{demo-make.test}, +@file{demo-exec.test}, @file{demo-inst.test} and +@file{demo-unst.test} are executed four times, under four different +libtool configurations: @file{demo-conf.test} configures +@file{demo/libtool} to build both static and shared libraries, +@file{demo-static.test} builds only static libraries +(@samp{--disable-shared}), and @file{demo-shared.test} builds only shared libraries (@samp{--disable-static}). +@file{demo-nofast.test} configures @file{demo/libtool} to +disable the fast-install mode (@samp{--enable-fast-install=no}. @item mdemo-conf.test @itemx mdemo-exec.test @@ -2948,6 +2951,12 @@ static and shared libraries, @file{cdemo-static.test} builds only static libraries (@samp{--disable-shared}), and @file{cdemo-shared.test} builds only shared libraries (@samp{--disable-static}). +@item build-relink.test +@pindex build-relink.test +Checks whether variable @var{shlibpath_overrides_runpath} is properly +set. If the test fails and @var{VERBOSE} is set, it will indicate what +the variable should have been set to. + @item hardcode.test @pindex hardcode.test On all systems with shared libraries, the location of the library can be @@ -3475,6 +3484,23 @@ and should write the names of the exported symbols to that file, for the use of @samp{old_archive_from_expsyms_cmds}. @end defvar +@defvar fast_install +Determines whether libtool will privilege the installer or the +developer. The assumption is that installers will seldom run programs +in the build tree, and the developer will seldom install. This is only +meaningful on platforms in which @var{shlibpath_overrides_runpath} is +not @samp{yes}, so @var{fast_install} will be set to @samp{needless} in +this case. If @var{fast_install} set to @samp{yes}, libtool will create +programs that search for installed libraries, and, if a program is run +in the build tree, a new copy will be linked on-demand to use the +yet-to-be-installed libraries. If set to @samp{no}, libtool will create +programs that use the yet-to-be-installed libraries, and will link +a new copy of the program at install time. The default value is +@samp{yes} or @samp{needless}, depending on platform and configuration +flags, and it can be turned from @samp{yes} to @samp{no} with the +configure flag @samp{--disable-fast-install}. +@end defvar + @defvar finish_cmds Commands to tell the dynamic linker how to find shared libraries in a specific directory. @@ -3493,13 +3519,24 @@ A pipeline that takes the output of @var{NM}, and produces a listing of raw symbols followed by their C names. For example: @example -$ @kbd{$NM | $global_symbol_pipe} -@var{symbol1} @var{C-symbol1} -@var{symbol2} @var{C-symbol2} -@var{symbol3} @var{C-symbol3} +$ @kbd{eval "$NM progname | $global_symbol_pipe"} +D @var{symbol1} @var{C-symbol1} +T @var{symbol2} @var{C-symbol2} +C @var{symbol3} @var{C-symbol3} @dots{} $ @end example + +The first column contains the symbol type (used to tell data from code +on some platforms), but its meaning is system dependent. +@end defvar + +@defvar global_symbol_to_cdecl +A pipeline that translates the output of @var{global_symbol_pipe} into +proper C declarations. On platforms whose linkers differentiate code +from data, such as HP/UX, data symbols will be declared as such, and +code symbols will be declared as functions. On platforms that don't +care, everything is assumed to be data. @end defvar @defvar hardcode_action @@ -3640,11 +3677,10 @@ hardcode in the resulting executable. Indicates whether it is possible to override the hard-coded library search path of a program with an environment variable. If this is set to no, libtool may have to create two copies of a program in the build -tree, one to be installed and one to be run in the build tree only. The -latter will be created on-demand, only if the program is actually run in -the build tree. If this is set to yes, libtool will set -@code{shlibpath_var} in the wrapper script before starting the program. -The default value is unknown, which is equivalent to no. +tree, one to be installed and one to be run in the build tree only. +When each of these copies is created depends on the value of +@code{fast_install}. The default value is @samp{unknown}, which is +equivalent to @samp{no}. @end defvar @defvar shlibpath_var diff --git a/libltdl/Makefile.am b/libltdl/Makefile.am index 472ab0510..fd4e05e26 100644 --- a/libltdl/Makefile.am +++ b/libltdl/Makefile.am @@ -2,30 +2,24 @@ # AUTOMAKE_OPTIONS = no-dependencies foreign -LTDL_VERSION = -version-info 1:1:1 - if INSTALL_LTDL include_HEADERS = ltdl.h +lib_LTLIBRARIES = libltdl.la else noinst_HEADERS = ltdl.h endif -noinst_LTLIBRARIES = libltdl.la +if CONVENIENCE_LTDL +noinst_LTLIBRARIES = libltdlc.la +endif libltdl_la_SOURCES = ltdl.c +libltdl_la_LDFLAGS = -version-info 1:1:1 libltdl_la_LIBADD = $(LIBADD_DL) -lib_LTLIBRARIES = @LIBLIBS@ -EXTRA_LTLIBRARIES = - -@TOINST@/libltdl.la: $(libltdl_la_OBJECTS) $(libltdl_la_DEPENDENCIES) - @test -d $(TOINST) || mkdir $(TOINST) - $(LINK) -o $@ $(libltdl_la_OBJECTS) \ - -rpath $(libdir) $(LTDL_VERSION) $(libltdl_la_LIBADD) - -distclean-local: - test -z $(TOINST) || rm -rf $(TOINST) +libltdlc_la_SOURCES = ltdl.c +libltdlc_la_LIBADD = $(LIBADD_DL) +$(OBJECTS): libtool libtool: $(LIBTOOL_DEPS) $(SHELL) ./config.status --recheck -Makefile: libtool diff --git a/libltdl/acconfig.h b/libltdl/acconfig.h deleted file mode 100644 index 78007e00d..000000000 --- a/libltdl/acconfig.h +++ /dev/null @@ -1,15 +0,0 @@ -#undef LTDL_SHLIB_EXT - -#undef LTDL_SHLIBPATH_VAR - -#undef LTDL_OBJDIR - -#undef HAVE_PRELOADED_SYMBOLS - -#undef HAVE_LIBDL - -#undef HAVE_DLD - -#undef HAVE_SHL_LOAD - -#undef NEED_USCORE diff --git a/libltdl/configure.in b/libltdl/configure.in index 3785958af..8eaaede81 100644 --- a/libltdl/configure.in +++ b/libltdl/configure.in @@ -1,30 +1,35 @@ dnl Process this file with autoconf to create configure. dnl Initialize the libltdl package. AC_INIT(ltdl.c) + +if test -z "$enable_ltdl_install$enable_ltdl_convenience"; then + if test -f ${srcdir}/ltconfig && test -f ${srcdir}/ltmain.sh; then + # if libltdl is libtoolized, it is assumed to be stand-alone and + # installed unless the command line overrides it (tested above) + enable_ltdl_install=yes + else + AC_MSG_WARN([*** The top-level configure must select either]) + AC_MSG_WARN([*** [A""C_LIBLTDL_INSTALLABLE] or [A""C_LIBLTDL_CONVENIENCE].]) + AC_MSG_ERROR([*** Maybe you want to --enable-ltdl-install?]) + fi +fi + AM_INIT_AUTOMAKE(libltdl,1.0,-) AM_CONFIG_HEADER(config.h) - AM_MAINTAINER_MODE -TOINST=toinst -AC_SUBST(TOINST) - -AC_ARG_ENABLE(ltdl-install, - [--enable-ltdl-install install libltdl]) -AM_CONDITIONAL(INSTALL_LTDL, test x$enable_ltdl_install = xyes) -if test x$enable_ltdl_install = xyes; then - LIBLIBS=$TOINST/libltdl.la -else - LIBLIBS= -fi -AC_SUBST(LIBLIBS) - AC_PROG_CC AC_C_CONST AC_C_INLINE AM_PROG_LIBTOOL AC_SUBST(LIBTOOL_DEPS) +AC_ARG_ENABLE(ltdl-install, +[ --enable-ltdl-install install libltdl]) + +AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) +AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno) + AC_CACHE_CHECK([which extension is used for shared libraries], libltdl_cv_shlibext, [dnl ( @@ -138,14 +143,50 @@ if test x"$USE_SYMBOL_UNDERSCORE" = xyes; then AC_CACHE_CHECK([whether we have to add an underscore for dlsym], libltdl_cv_need_uscore, [dnl AC_TRY_RUN([ +#if HAVE_DLFCN_H #include +#endif + #include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY); +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 && !ptr2) exit(0); } exit(1); } + if(ptr1 && !ptr2) exit(0); } exit(1); } ], libltdl_cv_need_uscore=no, libltdl_cv_need_uscore=yes, - libltdl_cv_need_uscore=no + libltdl_cv_need_uscore=cross )]) fi fi diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c index 63bb2be56..571215638 100644 --- a/libltdl/ltdl.c +++ b/libltdl/ltdl.c @@ -56,11 +56,7 @@ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. /* max. filename length */ #ifndef LTDL_FILENAME_MAX -# ifdef FILENAME_MAX -# define LTDL_FILENAME_MAX FILENAME_MAX -# else -# define LTDL_FILENAME_MAX 1024 -# endif +#define LTDL_FILENAME_MAX 1024 #endif #undef LTDL_READTEXT_MODE @@ -126,8 +122,6 @@ typedef struct lt_dlhandle_t { lt_ptr_t system; /* system specific data */ } lt_dlhandle_t; -#if ! HAVE_STRDUP - #undef strdup #define strdup xstrdup @@ -138,15 +132,13 @@ strdup(str) char *tmp; if (!str) - return str; + return 0; tmp = (char*) lt_dlmalloc(strlen(str)+1); if (tmp) strcpy(tmp, str); return tmp; } -#endif - #if ! HAVE_STRCHR # if HAVE_INDEX @@ -833,6 +825,8 @@ find_module (handle, dir, libdir, dlname, old_name, installed) 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 */ @@ -842,10 +836,8 @@ find_module (handle, dir, libdir, dlname, old_name, installed) if (dlname) { /* try to open the installed module */ if (installed && libdir) { - int ret; - char *filename = (char*) + filename = (char*) lt_dlmalloc(strlen(libdir)+1+strlen(dlname)+1); - if (!filename) { last_error = memory_error; return 1; @@ -853,18 +845,16 @@ find_module (handle, dir, libdir, dlname, old_name, installed) strcpy(filename, libdir); strcat(filename, "/"); strcat(filename, dlname); - ret = tryall_dlopen(handle, filename) == 0; + error = tryall_dlopen(handle, filename) == 0; lt_dlfree(filename); - if (ret) + if (error) return 0; } /* try to open the not-installed module */ if (!installed) { - int ret; - char *filename = (char*) + filename = (char*) lt_dlmalloc((dir ? strlen(dir) : 0) + strlen(objdir) + strlen(dlname) + 1); - if (!filename) { last_error = memory_error; return 1; @@ -876,16 +866,14 @@ find_module (handle, dir, libdir, dlname, old_name, installed) strcat(filename, objdir); strcat(filename, dlname); - ret = tryall_dlopen(handle, filename) == 0; + error = tryall_dlopen(handle, filename) == 0; lt_dlfree(filename); - if (ret) + if (error) return 0; } - /* hmm, maybe it was moved to another directory. - Should we really support this? */ + /* hmm, maybe it was moved to another directory */ { - int ret; - char *filename = (char*) + filename = (char*) lt_dlmalloc((dir ? strlen(dir) : 0) + strlen(dlname) + 1); if (dir) @@ -893,9 +881,9 @@ find_module (handle, dir, libdir, dlname, old_name, installed) else *filename = 0; strcat(filename, dlname); - ret = tryall_dlopen(handle, filename) == 0; + error = tryall_dlopen(handle, filename) == 0; lt_dlfree(filename); - if (ret) + if (error) return 0; } } @@ -999,23 +987,25 @@ unload_deplibs(handle) } static inline int -trim (dest, s) +trim (dest, str) char **dest; - const char *s; + const char *str; { + /* remove the leading and trailing "'" from str + and store the result in dest */ char *tmp; - char *i = strrchr(s, '\''); - int len = strlen(s); + char *end = strrchr(str, '\''); + int len = strlen(str); if (*dest) lt_dlfree(*dest); - if (len > 3 && s[0] == '\'') { - tmp = (char*) lt_dlmalloc(i - s); + if (len > 3 && str[0] == '\'') { + tmp = (char*) lt_dlmalloc(end - str); if (!tmp) { last_error = memory_error; return 1; } - strncpy(tmp, &s[1], (i - s) - 1); + strncpy(tmp, &str[1], (end - str) - 1); tmp[len-3] = '\0'; *dest = tmp; } else @@ -1092,6 +1082,7 @@ lt_dlopen (filename) int i; char *dlname = 0, *old_name = 0; char *libdir = 0, *deplibs = 0; + char *line; int error = 0; /* if we can't find the installed flag, it is probably an installed libtool archive, produced with an old version @@ -1140,25 +1131,45 @@ lt_dlopen (filename) lt_dlfree(dir); return 0; } + line = (char*) lt_dlmalloc(LTDL_FILENAME_MAX); + if (!line) { + fclose(file); + last_error = memory_error; + return 0; + } /* read the .la file */ while (!feof(file)) { - char line[LTDL_FILENAME_MAX]; - - if (!fgets(line, sizeof(line), file)) + if (!fgets(line, LTDL_FILENAME_MAX, file)) break; if (line[0] == '\n' || line[0] == '#') continue; - if (strncmp(line, "dlname=", 7) == 0) - error = trim(&dlname, &line[7]); +# undef STR_DLNAME +# define STR_DLNAME "dlname=" + if (strncmp(line, STR_DLNAME, + sizeof(STR_DLNAME) - 1) == 0) + error = trim(&dlname, + &line[sizeof(STR_DLNAME) - 1]); else - if (strncmp(line, "old_library=", 12) == 0) - error = trim(&old_name, &line[12]); +# undef STR_OLD_LIBRARY +# define STR_OLD_LIBRARY "old_library=" + if (strncmp(line, STR_OLD_LIBRARY, + sizeof(STR_OLD_LIBRARY) - 1) == 0) + error = trim(&old_name, + &line[sizeof(STR_OLD_LIBRARY) - 1]); else - if (strncmp(line, "libdir=", 7) == 0) - error = trim(&libdir, &line[7]); +# undef STR_LIBDIR +# define STR_LIBDIR "libdir=" + if (strncmp(line, STR_LIBDIR, + sizeof(STR_LIBDIR) - 1) == 0) + error = trim(&libdir, + &line[sizeof(STR_LIBDIR) - 1]); else - if (strncmp(line, "dl_dependency_libs=", 20) == 0) - error = trim(&deplibs, &line[20]); +# undef STR_DL_DEPLIBS +# define STR_DL_DEPLIBS "dl_dependency_libs=" + 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) installed = 1; @@ -1169,6 +1180,7 @@ lt_dlopen (filename) break; } fclose(file); + lt_dlfree(line); /* allocate the handle */ handle = (lt_dlhandle) lt_dlmalloc(sizeof(lt_dlhandle_t)); if (!handle || error) { diff --git a/libtool.m4 b/libtool.m4 index cfa8b6640..f7661efd2 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -21,12 +21,41 @@ ## configuration script generated by Autoconf, you may include it under ## the same distribution terms that you use for the rest of that program. -# serial 32 AC_PROG_LIBTOOL +# serial 35 AC_PROG_LIBTOOL AC_DEFUN(AC_PROG_LIBTOOL, -[AC_PREREQ(2.12.2)dnl +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ +DLLTOOL="$DLLTOOL" AS="$AS" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl -AC_REQUIRE([AC_DISABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_PROG_RANLIB])dnl @@ -37,17 +66,13 @@ AC_REQUIRE([AC_SYS_NM_PARSE])dnl AC_REQUIRE([AC_SYS_SYMBOL_UNDERSCORE])dnl AC_REQUIRE([AC_PROG_LN_S])dnl dnl -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl # Check for any special flags to pass to ltconfig. -libtool_flags= +libtool_flags="--cache-file=$cache_file" test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" -test "$enable_fast_install" = yes && libtool_flags="$libtool_flags --enable-fast-install" -test "x$lt_cv_dlopen" != xno && libtool_flags="$libtool_flags --enable-dlopen" -test "x$lt_cv_dlopen_self" = xyes && libtool_flags="$libtool_flags --enable-dlopen-self" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$lt_dlopen" = yes && libtool_flags="$libtool_flags --enable-dlopen" test "$silent" = yes && libtool_flags="$libtool_flags --silent" test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" @@ -102,59 +127,10 @@ need_locks=yes) if test x"$need_locks" = xno; then libtool_flags="$libtool_flags --disable-lock" fi - - -# Actually configure libtool. ac_aux_dir is where install-sh is found. -CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ -LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ -DLLTOOL="$DLLTOOL" AS="$AS" \ -${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ -$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ -|| AC_MSG_ERROR([libtool configure failed]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" - -# Redirect the config.log output again, so that the ltconfig log is not -# clobbered by the next message. -exec 5>>./config.log ]) # AC_LIBTOOL_DLOPEN - check for dlopen support -AC_DEFUN(AC_LIBTOOL_DLOPEN, -[AC_CACHE_VAL(lt_cv_dlopen, -[lt_cv_dlopen=no lt_cv_dlopen_libs= -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(dld, dld_link, [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC(shl_load, [lt_cv_dlopen="shl_load"], - [AC_CHECK_FUNC(LoadLibrary, [lt_cv_dlopen="LoadLibrary"])] - )] - )] - )] -)]) - -case "$lt_cv_dlopen" in -dlopen) - AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, - [LT_SAVE_LIBS="$LIBS"; LIBS="$lt_cv_dlopen_libs $LIBS" - AC_TRY_RUN([ -#include -#include -fnord() { int i=42;} -main() { void *self, *ptr1, *ptr2; self=dlopen(0,RTLD_LAZY); - if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); - if(ptr1 || ptr2) exit(0); } exit(1); } -], lt_cv_dlopen_self=no, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=cross) - LIBS="$LT_SAVE_LIBS"]) - ;; -# We should probably test other for NULL support in other dlopening -# mechanisms too. -*) - lt_cv_dlopen_self=no - ;; -esac -]) +AC_DEFUN(AC_LIBTOOL_DLOPEN, [lt_dlopen=yes]) # AC_ENABLE_SHARED - implement the --enable-shared flag # Usage: AC_ENABLE_SHARED[(DEFAULT)] @@ -223,12 +199,12 @@ AC_DEFUN(AC_DISABLE_STATIC, [AC_ENABLE_STATIC(no)]) -# AC_DISABLE_FAST_INSTALL - implement the --enable-fast-install flag -# Usage: AC_DISABLE_FAST_INSTALL[(DEFAULT)] +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] # Where DEFAULT is either `yes' or `no'. If omitted, it defaults to # `yes'. -AC_DEFUN(AC_DISABLE_FAST_INSTALL, -[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, yes, no))dnl +AC_DEFUN(AC_ENABLE_FAST_INSTALL, +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl AC_ARG_ENABLE(fast-install, changequote(<<, >>)dnl << --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], @@ -252,9 +228,9 @@ esac], enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl ]) -# AC_ENABLE_FAST_INSTALL - set the default to --enable-fast-install -AC_DEFUN(AC_ENABLE_FAST_INSTALL, -[AC_DISABLE_FAST_INSTALL(no)]) +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, +[AC_ENABLE_FAST_INSTALL(no)]) # AC_PROG_LD - find the path to the GNU or non-GNU linker @@ -325,7 +301,6 @@ else AC_MSG_RESULT(no) fi test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) - AC_SUBST(LD) AC_PROG_LD_GNU ]) @@ -375,7 +350,7 @@ AC_MSG_RESULT([$NM]) AC_SUBST(NM) ]) -# AC_SYS_NM_PARSE - Check for command ro grab the raw symbol name followed +# AC_SYS_NM_PARSE - Check for command to grab the raw symbol name followed # by C symbol name from nm. AC_DEFUN(AC_SYS_NM_PARSE, [AC_REQUIRE([AC_CANONICAL_HOST])dnl @@ -394,7 +369,10 @@ ac_symcode='[BCDEGRST]' ac_sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. -ac_symxfrm='\1 \1' +ac_symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +ac_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case "$host_os" in @@ -404,6 +382,9 @@ aix*) cygwin* | mingw*) ac_symcode='[ABCDGISTW]' ;; +hpux*) + ac_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; irix*) ac_symcode='[BCDEGRST]' ;; @@ -421,10 +402,7 @@ changequote([,])dnl # Try without a prefix undercore, then with it. for ac_symprfx in "" "_"; do - # Write the raw and C identifiers. - # Unlike in ltconfig.in, we need $ac_symprfx before $ac_symxfrm here, - # otherwise AC_SYS_SYMBOL_UNDERSCORE will always be false - ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]$ac_symcode[ ][ ]*$ac_symprfx$ac_sympat$/$ac_symprfx$ac_symxfrm/p'" + ac_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($ac_symcode\)[ ][ ]*\($ac_symprfx\)$ac_sympat$/$ac_symxfrm/p'" # Check to see that the pipe works correctly. ac_pipe_works=no @@ -464,7 +442,7 @@ extern "C" { EOF # Now generate the symbol file. - sed 's/^.* \(.*\)$/extern char \1;/' < "$ac_nlist" >> conftest.c + eval "$ac_global_symbol_to_cdecl"' < "$ac_nlist" >> conftest.c' cat <> conftest.c #if defined (__STDC__) && __STDC__ @@ -484,7 +462,7 @@ lt_preloaded_symbols[] = changequote([,])dnl { EOF - sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$ac_nlist" >> conftest.c cat <<\EOF >> conftest.c {0, (lt_ptr_t) 0} }; @@ -566,10 +544,10 @@ if AC_TRY_EVAL(ac_compile); then ac_nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| $ac_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then # See whether the symbols have a leading underscore. - if egrep '^_nm_test_func' "$ac_nlist" >/dev/null; then + if egrep '^. _nm_test_func' "$ac_nlist" >/dev/null; then ac_cv_sys_symbol_underscore=yes else - if egrep '^nm_test_func ' "$ac_nlist" >/dev/null; then + if egrep '^. nm_test_func ' "$ac_nlist" >/dev/null; then : else echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC @@ -595,6 +573,45 @@ AC_CHECK_LIB(mw, _mwvalidcheckl) AC_CHECK_LIB(m, cos) ]) +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library, adds --enable-ltdl-convenience to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [ + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdlc.la +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library, and adds --enable-ltdl-install to +# the configure arguments. Note that LIBLTDL is not AC_SUBSTed, nor +# is AC_CONFIG_SUBDIRS called. If DIR is not provided, it is assumed +# to be `${top_builddir}/libltdl'. Make sure you start DIR with +# '${top_builddir}/' (note the single quotes!) if your package is not +# flat, and, if you're not using automake, define top_builddir as +# appropriate in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [ + AC_CHECK_LIB(ltdl, main, LIBLTDL="-lltdl", [ + case "$enable_ltdl_install" in + no) AC_MSG_WARN([libltdl not installed, but installation disabled]) ;; + "") enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" ;; + esac + ]) + if test x"$enable_ltdl_install" != x"no"; then + LIBLTDL=ifelse($#,1,$1,['${top_builddir}/libltdl'])/libltdl.la + fi +]) + dnl old names AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl diff --git a/libtoolize.in b/libtoolize.in index 12dc87d14..83876d8f6 100644 --- a/libtoolize.in +++ b/libtoolize.in @@ -44,6 +44,7 @@ help="Try \`$progname --help' for more information." rm="rm -f" ln_s="ln -s" cp="cp -f" +mkdir="mkdir" # Global variables. automake= @@ -102,6 +103,7 @@ EOF rm="echo $rm" test -n "$ln_s" && ln_s="echo $ln_s" cp="echo $cp" + mkdir="echo mkdir" fi ;; @@ -111,11 +113,9 @@ EOF --ltdl) ltdl=yes - ltdl_tar= ;; --ltdl-tar) - ltdl= ltdl_tar=yes ;; @@ -146,7 +146,6 @@ if test -z "$files"; then exit 1 fi files='config.guess config.sub ltconfig ltmain.sh' -test "x$ltdl_tar" = xyes && files="$files libltdl.tar.gz" auxdir=. auxdirline=`egrep '^AC_CONFIG_AUX_DIR' configure.in 2>/dev/null` @@ -228,14 +227,14 @@ if test -z "$automake"; then fi -# Change to the auxillary directory. -if test "$auxdir" != .; then - test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'." - cd $auxdir || exit 1 +if test "x$ltdl" = xyes; then + test -d libltdl || $mkdir libltdl + ltdlfiles=`cd $pkgdatadir && ls libltdl/*` +else + ltdlfiles= fi - -for file in $files; do +for file in $ltdlfiles; do if test -f "$file" && test -z "$force"; then test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2 continue @@ -250,14 +249,37 @@ for file in $files; do fi done -if test "x$ltdl" = xyes; then - if tar xzf $pkgdatadir/libltdl.tar.gz; then : +if test "x$ltdl_tar" = x"yes"; then + if test "x$dry_run" = x"yes"; then + echo "(cd $pkgdatadir > /dev/null && tar -cf - libltdl | gzip --best) > libltdl.tar.gz" + elif test -f libltdl.tar.gz && test -z "$force"; then + test -z "$automake" && echo "$progname: \`libltdl.tar.gz' exists: use \`--force' to overwrite" 1>&2 else - echo "$progname: cannot unpack libltdl.tar.gz" 1>&2 - status=1 + (cd $pkgdatadir > /dev/null && tar -cf - libltdl | gzip --best) > libltdl.tar.gz fi fi +# Change to the auxiliary directory. +if test "$auxdir" != .; then + test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, \`$auxdir'." + cd $auxdir || exit 1 +fi + +for file in $files; do + if test -f "$file" && test -z "$force"; then + test -z "$automake" && echo "$progname: \`$file' exists: use \`--force' to overwrite" 1>&2 + continue + fi + + $rm $file + if test -n "$ln_s" && $ln_s $pkgdatadir/$file $file; then : + elif $cp $pkgdatadir/$file $file; then : + else + echo "$progname: cannot copy \`$pkgdatadir/$file' to \`$file'" 1>&2 + status=1 + fi +done + exit $status # Local Variables: diff --git a/ltconfig.in b/ltconfig.in index 28793ec4b..61e3bfd6c 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -177,9 +177,8 @@ can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking. enable_static=yes -enable_fast_install=no +enable_fast_install=yes enable_dlopen=unknown -enable_dlopen_self=unknown ltmain= silent= srcdir= @@ -192,8 +191,10 @@ verify_host=yes with_gcc=no with_gnu_ld=no need_locks=yes +ac_ext=c objext=o libext=a +cache_file= old_AR="$AR" old_CC="$CC" @@ -232,7 +233,7 @@ Generate a system-specific libtool script. --debug enable verbose shell tracing --disable-shared do not build shared libraries --disable-static do not build static libraries - --enable-fast-install optimize for fast installation + --disable-fast-install do not optimize for fast installation --enable-dlopen enable dlopen support --enable-dlopen-self enable support for dlopening programs --help display this help and exit @@ -245,6 +246,7 @@ Generate a system-specific libtool script. --with-gcc assume that the GNU C compiler will be used --with-gnu-ld assume that the C compiler uses the GNU linker --disable-lock disable file locking + --cache-file=FILE configure cache file LTMAIN is the \`ltmain.sh' shell script fragment or \`ltmain.c' program that provides basic libtool functionality. @@ -263,12 +265,10 @@ EOM --disable-static) enable_static=no ;; - --enable-fast-install) enable_fast_install=yes ;; + --disable-fast-install) enable_fast_install=no ;; --enable-dlopen) enable_dlopen=yes ;; - --enable-dlopen-self) enable_dlopen_self=yes ;; - --quiet | --silent) silent=yes ;; --srcdir) prev=srcdir ;; @@ -286,6 +286,8 @@ EOM --disable-lock) need_locks=no ;; + --cache-file=*) cache_file="$optarg" ;; + -*) echo "$progname: unrecognized option \`$option'" 1>&2 echo "$help" 1>&2 @@ -356,6 +358,11 @@ exec 5>>./config.log if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -941,8 +948,8 @@ if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. - if test -f "${ac_dir}/${ac_prog}"; then - LD="${ac_dir}/${ac_prog}" + if test -f "$ac_dir/$ac_prog"; then + LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. @@ -1386,7 +1393,10 @@ symcode='[BCDEGRST]' sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Transform the above into a raw symbol and a C symbol. -symxfrm='\1 \1' +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" # Define system-specific variables. case "$host_os" in @@ -1396,6 +1406,9 @@ aix*) cygwin* | mingw*) symcode='[ABCDGISTW]' ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; irix*) symcode='[BCDEGRST]' ;; @@ -1413,7 +1426,7 @@ fi for ac_symprfx in "" "_"; do # Write the raw and C identifiers. - global_symbol_pipe="sed -n -e 's/^.*[ ]$symcode[ ][ ]*$ac_symprfx$sympat$/$symxfrm/p'" + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" # Check to see that the pipe works correctly. pipe_works=no @@ -1453,7 +1466,7 @@ extern "C" { EOF # Now generate the symbol file. - sed 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> conftest.c + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' cat <> conftest.c #if defined (__STDC__) && __STDC__ @@ -1471,7 +1484,7 @@ const struct { lt_preloaded_symbols[] = { EOF - sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c cat <<\EOF >> conftest.c {0, (lt_ptr_t) 0} }; @@ -1513,6 +1526,7 @@ EOF break else global_symbol_pipe= + global_symbol_to_cdecl= fi done echo "$ac_t$pipe_works" 1>&6 @@ -1631,7 +1645,6 @@ cygwin* | mingw*) deplibs_check_method='file_magic file format pei*-i386.*architecture: i386' file_magic_cmd='objdump -f' need_lib_prefix=no - shlibpath_overrides_runpath=yes # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; @@ -1851,14 +1864,6 @@ test "$dynamic_linker" = no && can_build_shared=no # Report the final consequences. echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 -# Check relinking. -echo $ac_n "checking whether relinking is necessary... $ac_c" 1>&6 -must_relink=no -if test "$hardcode_action" = relink || test "$shlibpath_overrides_runpath" != yes; then - must_relink=yes -fi -echo "$ac_t$must_relink" 1>&6 - echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 test "$can_build_shared" = "no" && enable_shared=no @@ -1885,6 +1890,15 @@ test "$enable_shared" = yes || enable_static=yes echo "checking whether to build static libraries... $enable_static" 1>&6 +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + echo $ac_n "checking for objdir... $ac_c" 1>&6 rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null @@ -1897,6 +1911,442 @@ fi rmdir .libs 2>/dev/null echo "$ac_t$objdir" 1>&6 +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlopen(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldl $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldld $LIBS" +cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char shl_load(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for LoadLibrary""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking for LoadLibrary" >&5 +if eval "test \"`echo '$''{'ac_cv_func_LoadLibrary'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char LoadLibrary(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_LoadLibrary) || defined (__stub___LoadLibrary) +choke me +#else +LoadLibrary(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_LoadLibrary=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_LoadLibrary=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'LoadLibrary`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="LoadLibrary" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +int fnord = 0; +EOF +ac_try="$ac_compile conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo $progname:@LINENO@: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) exit(0); } exit(1); } + +EOF +if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:@LINENO@: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) exit(0); } exit(1); } + +EOF +if { (eval echo $progname:@LINENO@: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + # Copy echo and quote the copy, instead of the original, because it is # used later. ltecho="$echo" @@ -1921,8 +2371,9 @@ case "$ltmain" in old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ - finish_cmds finish_eval global_symbol_pipe hardcode_libdir_flag_spec \ - hardcode_libdir_separator sys_lib_search_path_spec \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec \ compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do case "$var" in @@ -2105,6 +2556,9 @@ dlopen=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + # Compiler flag to prevent dynamic linking. link_static_flag=$link_static_flag @@ -2172,6 +2626,9 @@ finish_eval=$finish_eval # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$global_symbol_pipe +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + # This is the shared library runtime path variable. runpath_var=$runpath_var @@ -2206,9 +2663,6 @@ hardcode_minus_L=$hardcode_minus_L # the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var -# Whether we must relink. -must_relink=$must_relink - # System search path for libraries. sys_lib_search_path_spec=$sys_lib_search_path_spec @@ -2263,6 +2717,58 @@ EOF echo "FIXME: would compile $ltmain" ;; esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + exit 0 # Local Variables: diff --git a/ltmain.in b/ltmain.in index f630d69e2..81c9894cf 100644 --- a/ltmain.in +++ b/ltmain.in @@ -607,7 +607,7 @@ compiler." modename="$modename: link" relink=no test "$mode" = "relink" && relink=yes - link_command_save="$nonopt" + libtool_args="$nonopt" C_compiler="$CC" # save it, to compile generated C sources CC="$nonopt" case "$host" in @@ -784,12 +784,13 @@ compiler." ;; esac compile_command="$CC" + finalize_command="$CC" - shlibpath= convenience= old_convenience= deplibs= linkopts= + lib_search_path=`pwd` avoid_version=no dlfiles= @@ -809,8 +810,6 @@ compiler." release= rpath= xrpath= - perm_rpath= - temp_rpath= thread_safe=no vinfo= @@ -836,21 +835,23 @@ compiler." while test $# -gt 0; do arg="$1" shift - link_command_save="$link_command_save $arg" + libtool_args="$libtool_args $arg" # If the previous option needs an argument, assign it. if test -n "$prev"; then case "$prev" in output) compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" ;; esac - + case "$prev" in dlfiles|dlprefiles) if test "$preload" = no; then # Add the symbol object into the linking commands. compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" preload=yes fi case "$arg" in @@ -914,6 +915,8 @@ compiler." -all-static) if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + dlopen_self=$dlopen_self_static fi continue ;; @@ -977,7 +980,13 @@ compiler." dir="$absdir" ;; esac - deplibs="$deplibs -L$dir" + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" + ;; + esac continue ;; @@ -1038,6 +1047,8 @@ compiler." # If we have no pic_flag, then this is the same as -all-static. if test -z "$pic_flag" && test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + dlopen_self=$dlopen_self_static fi continue ;; @@ -1054,7 +1065,7 @@ compiler." # Some other compiler flag. -* | +*) - # Unknown arguments in compile_command need + # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` case "$arg" in @@ -1184,6 +1195,7 @@ compiler." # Now actually substitute the argument into the commands. if test -n "$arg"; then compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" fi done @@ -1198,23 +1210,6 @@ compiler." outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" - # Make sure deplibs and lib_search_path contain - # only unique libraries and directories. - lib_search_path=`pwd` - newdeplibs= - for deplib in $deplibs; do - case "$newdeplibs " in - *" $deplib "*) ;; - *) - newdeplibs="$newdeplibs $deplib" - dir="`expr $deplib : '-L\(.*\)'`" - # If this is a -L argument add it to lib_search_path - test -n "$dir" && lib_search_path="$lib_search_path $dir" - ;; - esac - done - deplibs="$newdeplibs" - if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` @@ -1224,10 +1219,6 @@ compiler." eval sys_lib_search_path=\"$sys_lib_search_path_spec\" lib_search_path="$lib_search_path $sys_lib_search_path $shlib_search_path" - # Quote the link command for shipping. - link_command_save=`$echo "X$link_command_save" | $Xsed -e "$sed_quote_subst"` - link_dir_save=`pwd | sed -e $sed_quote_subst` - case "$output" in "") $echo "$modename: you must specify an output file" 1>&2 @@ -1553,6 +1544,7 @@ compiler." newdependency_libs= # all dependency libraries uninst_path= # paths that contain uninstalled libtool libraries rpath= + shlibpath= new_lib_search_path= for deplib in $deplibs; do lib= @@ -1657,14 +1649,19 @@ compiler." name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` if test "$build_libtool_libs" = yes && test -n "$library_names"; then - # Hardcode the library path. - tmpdir="$libdir" - test "$must_relink" = yes && test "$relink" = no && tmpdir="$absdir" - # Make sure the rpath contains only unique directories. - case "$rpath " in - *" $tmpdir "*) ;; - *) rpath="$rpath $tmpdir" ;; - esac + if test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + if test "$relink" = no && test "$absdir" != "$libdir"; then + case "$rpath " in + *" $absdir "*) ;; + *) rpath="$rpath $absdir" ;; + esac + fi + case "$rpath " in + *" $libdir "*) ;; + *) rpath="$rpath $libdir" ;; + esac + fi if test "$relink" = no; then lib_linked=yes @@ -1781,43 +1778,6 @@ compiler." dependency_libs="$temp_xrpath $dependency_libs" fi - dep_rpath= - hardcode_libdirs= - if test -n "$rpath$xrpath" && test "$hardcode_into_libs" = yes && test -n "$hardcode_libdir_flag_spec"; then - for dir in $rpath $xrpath; do - libdir="$dir" - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - # Put the magic libdir with the hardcode flag. - hardcode_libdirs="$dir" - libdir="@HARDCODE_LIBDIRS@" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$dir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$dir" - ;; - esac - libdir= - fi - fi - - if test -n "$libdir"; then - eval flag=\"$hardcode_libdir_flag_spec\" - - dep_rpath="$dep_rpath $flag" - fi - done - fi - - # Substitute the hardcoded libdirs into the dep_rpath. - if test -n "$hardcode_libdir_separator"; then - dep_rpath=`$echo "X$dep_rpath" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - # Restore the variables versuffix=$versuffix_save major=$major_save @@ -1845,12 +1805,13 @@ compiler." droppeddeps=no case "$deplibs_check_method" in pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. newdeplibs=$deplibs - ;; # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it @@ -1958,7 +1919,7 @@ EOF esac done if eval $file_magic_cmd \"\$potlib\" \ - | sed '11,$d' \ + | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" a_deplib="" @@ -2036,6 +1997,65 @@ EOF deplibs=$newdeplibs # Done checking deplibs! + # Now hardcode the library paths + new_rpath= + perm_rpath= + if test "$hardcode_into_libs" = yes && test -n "$rpath$xrpath"; then + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + hardcode_libdirs= + for libdir in $rpath $xrpath; do + # Skip directories that are in the system search path + case " $sys_lib_search_path " in + *" $libdir "*) continue ;; + *) ;; + esac + + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + new_rpath="$new_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval new_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + test -n "$new_rpath" && deplibs="$dep_rpath $deplibs" + + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names @@ -2095,7 +2115,7 @@ EOF linkopts="$linkopts $flag" fi - + # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then @@ -2111,10 +2131,10 @@ EOF done IFS="$save_ifs" if test -n "$export_symbols_regex"; then - $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"$export_symbols\"T" - $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "$export_symbols"T' - $show "$mv \"$export_symbols\"T \"$export_symbols\"" - $run eval '$mv "$export_symbols"T "$export_symbols"' + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' fi fi fi @@ -2135,9 +2155,6 @@ EOF eval cmds=\"$archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" @@ -2268,7 +2285,8 @@ EOF fi if test "$preload" = yes; then - if test "$dlopen" = unknown || test "$dlopen_self" = unknown; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." fi fi @@ -2348,17 +2366,21 @@ EOF new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`" newdeplibs="$newdeplibs $lib" - newdependency_libs="$newdependency_libs $dependency_libs" for deplib in $dependency_libs; do case "$deplib" in - -L*) - new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`" - ;; + -L*) new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`" ;; *) ;; esac + # Make sure dependency_libs contains only unique + # libraries and directories. + case "$newdependency_libs " in + *" $deplib "*) ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac done done + dependency_libs="$newdependency_libs" # Make sure lib_search_path contains only unique directories. lib_search_path= @@ -2370,37 +2392,34 @@ EOF done lib_search_path="$lib_search_path $sys_lib_search_path" - # Make sure deplibs contains only unique libraries and directories. - deplibs= - for deplib in $newdeplibs; do - case "$deplibs " in - *" $deplib "*) ;; - *) deplibs="$deplibs $deplib" ;; - esac - done - - # Make sure dependency_libs contains only unique libraries and directories. - dependency_libs= - for deplib in $newdependency_libs; do - case "$dependency_libs " in - *" $deplib "*) ;; - *) dependency_libs="$dependency_libs $deplib" ;; - esac - done - # Find libtool libraries and add their directories - newdeplibs= alldeplibs=no linkalldeplibs=no - if test "$build_libtool_libs" = no || test "$deplibs_check_method" = none; then + if test "$fast_install" = yes || test "$build_libtool_libs" = no || \ + test "$deplibs_check_method" = none; then linkalldeplibs=yes fi link_against_libtool_libs= + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + perm_rpath= + temp_rpath= + for deplib in $deplibs @DEPLIBS@ $dependency_libs; do lib= case "$deplib" in -L*) - newdeplibs="$newdeplibs $deplib" + compile_command="$compile_command $deplib" + case "$compile_command " in + *" $deplib "*) ;; + *) compile_command="$compile_command $deplib";; + esac + case "$finalize_command " in + *" $deplib "*) ;; + *) finalize_command="$finalize_command $deplib";; + esac continue ;; -R*) @@ -2432,7 +2451,8 @@ EOF fi done if test "$found" != yes; then - newdeplibs="$newdeplibs $deplib" + compile_command="$compile_command $deplib" + finalize_command="$finalize_command $deplib" continue fi ;; @@ -2506,12 +2526,13 @@ EOF fi # This is the magic to use -rpath. - tmpdir="$libdir" - test "$must_relink" = yes && test "$relink" = no && tmpdir="$absdir" - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $tmpdir "*) ;; - *) xrpath="$xrpath $tmpdir" ;; + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; esac fi @@ -2525,114 +2546,138 @@ EOF # It is a libtool convenience library, so add in its objects. convenience="$convenience $dir/$old_library" old_convenience="$old_convenience $dir/$old_library" - newdeplibs="$newdeplibs $dir/$old_library" + compile_command="$compile_command $dir/$old_library" + finalize_command="$finalize_command $dir/$old_library" continue fi - if test "$build_libtool_libs" = yes && - test -n "$library_names" && - test -n "$old_archive_from_expsyms_cmds"; then - - # figure out the soname - set dummy $library_names - realname="$2" - shift; shift - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" - - # If the library has no export list, then create one now - if test -f "$objdir/$soname-def"; then :; else - $show "extracting exported symbol list from \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$extract_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' - eval cmds=\"$old_archive_from_expsyms_cmds\" - for cmd in $cmds; do - IFS="$save_ifs" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$objdir - linklib=$newlib - fi - if test "$build_libtool_libs" = yes && test -n "$library_names"; then link_against_libtool_libs="$link_against_libtool_libs $lib" - if test $relink = no; then - lib_linked=yes - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - newdeplibs="$newdeplibs $dir/$linklib" - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) - shlibpath="$shlibpath$dir:" - ;; - esac - newdeplibs="$newdeplibs -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - shlibpath="$shlibpath$dir:" - newdeplibs="$newdeplibs -l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - newdeplibs="$newdeplibs $dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - newdeplibs="$newdeplibs -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - shlibpath="$shlibpath$dir:" - newdeplibs="$newdeplibs -l$name" - else - lib_linked=no - fi - ;; - *) - lib_linked=no - ;; - esac + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 + # Make a new name for the extract_expsyms_cmds to use + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$objdir + linklib=$newlib + fi + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + else + lib_linked=no fi - else - # Install command for both is simple: just hardcode it. + ;; + + relink) if test "$hardcode_direct" = yes; then - newdeplibs="$newdeplibs $libdir/$linklib" + compile_command="$compile_command $absdir/$linklib" elif test "$hardcode_minus_L" = yes; then - newdeplibs="$newdeplibs -L$libdir -l$name" + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" elif test "$hardcode_shlibpath_var" = yes; then - shlibpath="$shlibpath$libdir:" - newdeplibs="$newdeplibs -l$name" + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" else - # We cannot seem to hardcode it, guess we'll fake it. - newdeplibs="$newdeplibs -L$libdir -l$name" + lib_linked=no fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" fi else # Transform directly to old archives if we don't build new libraries. @@ -2646,63 +2691,124 @@ EOF # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" - newdeplibs="$newdeplibs $dir/$linklib" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" else - newdeplibs="$newdeplibs -L$dir -l$name" + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" fi fi done - deplibs="$newdeplibs" - - # Now hardcode the library paths - dep_rpath= - hardcode_libdirs= if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - # Put the magic libdir with the hardcode flag. - hardcode_libdirs="$libdir" - libdir="@HARDCODE_LIBDIRS@" - else - # Just accumulate the unique libdirs. - case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - libdir= - fi - fi - - if test -n "$libdir"; then - eval flag=\"$hardcode_libdir_flag_spec\" + # This is the magic to use -rpath. + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi - dep_rpath="$dep_rpath $flag" + # Now hardcode the library paths + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + # Skip directories that are in the system search path + case " $sys_lib_search_path " in + *" $libdir "*) continue ;; + *) ;; + esac + + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" fi - done + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" fi + compile_rpath="$rpath" - # Substitute the hardcoded libdirs into the dep_rpath. - if test -n "$hardcode_libdir_separator"; then - dep_rpath=`$echo "X$dep_rpath" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"` + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + # Skip directories that are in the system search path + case " $sys_lib_search_path " in + *" $libdir "*) continue ;; + *) ;; + esac + + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + finalize_rpath="$rpath" - # Add in the deplibs. - test -n "$deplibs" && compile_command="$compile_command $deplibs" - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` if test "X$output_objdir" = "X$output"; then output_objdir="$objdir" @@ -2713,11 +2819,12 @@ EOF if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` fi dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 @@ -2732,8 +2839,8 @@ EOF nlist="$objdir/${output}.nm" if test -d $objdir; then - $show "$rm $nlist ${nlist}T" - $run $rm "$nlist" "${nlist}T" + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" else $show "$mkdir $objdir" $run $mkdir $objdir @@ -2761,20 +2868,44 @@ extern \"C\" { " if test "$dlself" = yes; then - if test -n "$export_symbols"; then - $run eval 'sed -e "s/^\(.*\)/\1 \1/" < "$export_symbols" > "$nlist"' + $show "generating symbol list for \`$output'" + + echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else - # Add our own program objects to the preloaded list. - progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done + $run $rm $export_symbols + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"' + $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' fi fi for arg in $dlprefiles; do $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" done @@ -2783,19 +2914,19 @@ extern \"C\" { test -f "$nlist" || : > "$nlist" # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - $mv "$nlist"T "$nlist" + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : else - $rm "$nlist"T + grep -v "^: " < "$nlist" > "$nlist"S fi if test -n "$exclude_expsyms"; then - egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" + egrep -v " ($exclude_expsyms)$" "$nlist"S > "$nlist"T + $mv "$nlist"T "$nlist"S fi - if test -f "$nlist"; then - sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$output_objdir/$dlsyms" + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' else echo '/* NONE */' >> "$output_objdir/$dlsyms" fi @@ -2820,48 +2951,9 @@ lt_preloaded_symbols[] = {\ " - if test "$dlself" = yes; then - # First entry is the program itself - echo >> "$output_objdir/$dlsyms" "\ - {\"@PROGRAM@\", (lt_ptr_t) 0}," - if test -n "$export_symbols"; then - sed 's/^\(.*\)/ {"\1", (lt_ptr_t) \&\1},/' < "$export_symbols" >> "$output_objdir/$dlsyms" - else - $rm "$nlist" - for arg in $progfiles; do - eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -f "$nlist"; then - if test -n "$exclude_expsyms"; then - egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms" - else - echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - fi - fi - - for arg in $dlprefiles; do - name=`echo "$arg" | sed -e 's%^.*/%%'` - echo >> "$output_objdir/$dlsyms" "\ - {\"$name\", (lt_ptr_t) 0}," - eval "$NM $arg | $global_symbol_pipe > '$nlist'" - - if test -f "$nlist"; then - if test -n "$exclude_expsyms"; then - egrep -v "^($exclude_expsyms) " "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - sed 's/^\(.*\) \(.*\)$/ {"\1", (lt_ptr_t) \&\2},/' < "$nlist" >> "$output_objdir/$dlsyms" - else - echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - done + 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} @@ -2882,11 +2974,12 @@ static const void *lt_preloaded_setup() { pic_flag_for_symtable= case "$host" in - # compiling the symbol table file with pic_flag works around a - # FreeBSD bug that causes programs to crash when -lm is linked - # before any other PIC object. But we must not use pic_flag - # when linking with -static. - *-*-freebsd*) + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*) case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; @@ -2899,6 +2992,7 @@ static const void *lt_preloaded_setup() { # Transform the symbol file into the correct name. compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 @@ -2909,38 +3003,23 @@ static const void *lt_preloaded_setup() { # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. - + # Nullify the symbol file. compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` fi if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then # Replace the output file specification. compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. - $show "$compile_command" - $run eval "$compile_command" + $show "$link_command" + $run eval "$link_command" exit $? fi - # Replace the output file specification. - if test $relink = no; then - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - else - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'T%g'` - fi - - # Create the binary in the object directory, then wrap it. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $objdir; then - exit $status - fi - fi - if test -n "$shlibpath_var"; then # We should set the shlibpath_var rpath= @@ -2959,10 +3038,15 @@ static const void *lt_preloaded_setup() { temp_rpath="$rpath" fi - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi + compile_var= + finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. @@ -2970,28 +3054,68 @@ static const void *lt_preloaded_setup() { for dir in $perm_rpath; do rpath="$rpath$dir:" done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi - if test "$must_relink" = yes && test "$relink" = no; then + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + # AGH! Flame the AIX and HP-UX people for me, will ya? $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi fi - $show "$compile_command" - $run eval "$compile_command" || exit $? - - # Exit if relinking succeeded - test "$relink" = yes && exit 0 + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $objdir; then + exit $status + fi + fi # Delete the old output file. - $run $rm $output + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? # Now create the wrapper script. $show "creating $output" + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case "$0" in @@ -3034,12 +3158,12 @@ sed_quote_subst='$sed_quote_subst' # if CDPATH is set. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi +relink_command=\"$relink_command\" + # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: + # install mode needs the following variable: link_against_libtool_libs='$link_against_libtool_libs' - link_command=\"$link_command_save\" - link_dir=\"$link_dir_save\" else # When we are sourced in execute mode, \$file and \$echo are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then @@ -3084,14 +3208,54 @@ else # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ if test -f \"\$progdir/\$program\"; then" # Export our shlibpath_var if we have one. - if test -n "$shlibpath_var" && test -n "$temp_rpath"; then + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $echo >> $output "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" @@ -3210,6 +3374,10 @@ fi\ test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" + # Quote the link command for shipping. + relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + # Only create the output if not a dry run. if test -z "$run"; then $echo > $output "\ @@ -3238,10 +3406,7 @@ installed=no # Directory that this library needs to be installed in: libdir='$install_libdir' - -link_command=\"$link_command_save\" -link_dir=\"$link_dir_save\"\ -" +relink_command=\"$relink_command\"" # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= @@ -3265,7 +3430,7 @@ link_dir=\"$link_dir_save\"\ $rm "$output_objdir/$outputname"i sed -e 's/^installed=no$/installed=yes/' \ -e "s%^dependency_libs=\(.*\)%dependency_libs='$newdependency_libs'%" \ - -e 's/^link_\(.*\)//' \ + -e 's/^relink_command=\(.*\)//' \ < "$output" > "$output_objdir/$outputname"i || exit 1 fi @@ -3443,8 +3608,7 @@ link_dir=\"$link_dir_save\"\ exit 1 fi - link_command= - link_dir= + relink_command= dependency_libs= # If there is no directory component, then add one. case "$file" in @@ -3453,13 +3617,14 @@ link_dir=\"$link_dir_save\"\ esac # Check the variables that should have been set. - if test -z "$dependency_libs" || test -z "$link_command" || test -z "$link_dir"; then + if test -z "$dependency_libs" || test -z "$relink_command"; then $echo "$modename: invalid libtool pseudo library \`$file'" 1>&2 exit 1 fi finalize=yes - for lib in $dependency_libs; do + deplibs=$dependency_libs + for lib in $deplibs; do case "$lib" in *.la) # Check to see that each library is installed. @@ -3476,8 +3641,7 @@ link_dir=\"$link_dir_save\"\ esac done - link_command= - link_dir= + relink_command= library_names= old_library= dependency_libs= @@ -3505,12 +3669,11 @@ link_dir=\"$link_dir_save\"\ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" - if test "$must_relink" = yes && test "$hardcode_into_libs" = yes; then + if test "$hardcode_into_libs" = yes; then if test "$finalize" = yes; then $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 - finalize_command="cd $link_dir; $SHELL $0 --mode=relink $link_command" - $show "$finalize_command" - if $run eval "$finalize_command"; then : + $show "$relink_command" + if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 continue @@ -3529,7 +3692,7 @@ link_dir=\"$link_dir_save\"\ shift srcname="$realname" - test "$must_relink" = yes && test "$hardcode_into_libs" = yes && srcname="$realname"T + test "$hardcode_into_libs" = yes && srcname="$realname"T # Install the shared library and build the symlinks. $show "$install_prog $dir/$srcname $destdir/$realname" @@ -3631,9 +3794,8 @@ link_dir=\"$link_dir_save\"\ # Do a test to see if this is really a libtool program. if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - link_command= - link_dir= link_against_libtool_libs= + relink_command= # If there is no directory component, then add one. case "$file" in @@ -3642,7 +3804,7 @@ link_dir=\"$link_dir_save\"\ esac # Check the variables that should have been set. - if test -z "$link_against_libtool_libs" || test -z "$link_command" || test -z "$link_dir"; then + if test -z "$link_against_libtool_libs"; then $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 exit 1 fi @@ -3665,30 +3827,30 @@ link_dir=\"$link_dir_save\"\ fi done - link_command= - link_dir= - link_against_libtool_libs= - + relink_command= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; *) . ./$file ;; esac - if test "$must_relink" = yes; then + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes; then + outputname="/tmp/$$-$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 - finalize_command="cd $link_dir; $SHELL $0 --mode=relink $link_command" - $show "$finalize_command" - if $run eval "$finalize_command"; then : + $show "$relink_command" + if $run eval "$relink_command"; then : else $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 continue fi - file="$objdir/$file"T + file="$outputname" else - $echo "$modename: error: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 - continue + $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 fi else # Install the binary that we compiled earlier. @@ -3698,6 +3860,7 @@ link_dir=\"$link_dir_save\"\ $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && $rm $outputname ;; esac done diff --git a/mdemo/Makefile.am b/mdemo/Makefile.am index e2b62f446..67806b887 100644 --- a/mdemo/Makefile.am +++ b/mdemo/Makefile.am @@ -18,24 +18,29 @@ noinst_HEADERS = foo.h bin_PROGRAMS = mdemo mdemo.static -../libltdl/libltdl.la: ../libtool ../libltdl/libtool \ +## use @LIBLTDL@ because some broken makes do not accept macros in targets +## we can only do this because our LIBLTDL does not contain ${top_builddir} +@LIBLTDL@: ../libtool ../libltdl/libtool ../libltdl/config.h \ $(srcdir)/../libltdl/ltdl.c $(srcdir)/../libltdl/ltdl.h - (cd ../libltdl; $(MAKE) libltdl.la) + (cd ../libltdl; $(MAKE) `echo $(LIBLTDL) | sed 's,.*\.\./libltdl/,,g'`) # Without the following line, the check may fail if libltdl/libtool is # removed after libltdl is configured -../libltdl/libtool: +../libltdl/libtool ../libltdl/config.h: # Create a version of mdemo that does dlopen. mdemo_SOURCES = main.c -mdemo_LDFLAGS = -export-dynamic ## FIXME: remove this when libtool and libltdl -## handle dependencies of modules +mdemo_LDFLAGS = -export-dynamic ## The quotes around -dlopen below fool automake into accepting it -mdemo_LDADD = ../libltdl/libltdl.la "-dlopen" self \ +mdemo_LDADD = @LIBLTDL@ "-dlopen" self \ "-dlopen" foo1.la "-dlopen" libfoo2.la -mdemo_DEPENDENCIES = ../libltdl/libltdl.la foo1.la libfoo2.la +mdemo_DEPENDENCIES = @LIBLTDL@ foo1.la libfoo2.la # Create a statically linked version of mdemo. mdemo_static_SOURCES = $(mdemo_SOURCES) mdemo_static_LDFLAGS = $(STATIC) $(mdemo_LDFLAGS) mdemo_static_LDADD = $(mdemo_LDADD) mdemo_static_DEPENDENCIES = $(mdemo_DEPENDENCIES) + +$(OBJECTS): libtool +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck diff --git a/mdemo/configure.in b/mdemo/configure.in index ebada43b6..1c17ed5bc 100644 --- a/mdemo/configure.in +++ b/mdemo/configure.in @@ -7,6 +7,14 @@ AC_C_CONST AC_EXEEXT AC_LIBTOOL_DLOPEN AM_PROG_LIBTOOL +AC_SUBST(LIBTOOL_DEPS) + +dnl AC_LIBLTDL_CONVENIENCE(['${top_builddir}/../libltdl']) +dnl Since the package is flat, we need not use the line above, +dnl and not having macros in LIBLTDL allows us to build LIBLTDL +dnl on demand even with broken makes +AC_LIBLTDL_CONVENIENCE(../libltdl) +AC_SUBST(LIBLTDL) if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then STATIC=-static diff --git a/mdemo/main.c b/mdemo/main.c index 8355f0c90..8376cb2ba 100644 --- a/mdemo/main.c +++ b/mdemo/main.c @@ -31,6 +31,7 @@ test_dl (filename) int (*pfoo2)() = 0; int (*phello)() = 0; int *pnothing = 0; + int ret = 0; handle = lt_dlopen(filename); if (!handle) { @@ -52,30 +53,42 @@ test_dl (filename) printf("hello is ok!\n"); } else - fprintf (stderr, "did not find the `hello' function\n"); + { + fprintf (stderr, "did not find the `hello' function\n"); + ret = 1; + } /* Try assigning to the nothing variable. */ if (pnothing) *pnothing = 1; else - fprintf (stderr, "did not find the `nothing' variable\n"); + { + fprintf (stderr, "did not find the `nothing' variable\n"); + ret = 1; + } /* Just call the functions and check return values. */ if (pfoo1) { if ((*pfoo1) () == FOO_RET) printf("foo1 is ok!\n"); + else + ret = 1; } else if (pfoo2) { if ((*pfoo2) () == FOO_RET) printf("foo2 is ok!\n"); + else ret = 1; } else - fprintf (stderr, "did not find the `foo' function\n"); + { + fprintf (stderr, "did not find the `foo' function\n"); + ret = 1; + } lt_dlclose(handle); - return 0; + return ret; } int @@ -92,6 +105,7 @@ test_dlself () lt_dlhandle handle; int (*pmyfunc)() = 0; int *pmyvar = 0; + int ret = 0; handle = lt_dlopen(0); if (!handle) { @@ -111,16 +125,22 @@ test_dlself () printf("myfunc is ok!\n"); } else - fprintf (stderr, "did not find the `myfunc' function\n"); + { + fprintf (stderr, "did not find the `myfunc' function\n"); + ret = 1; + } /* Try assigning to the variable. */ if (pmyvar) *pmyvar = 1; else - fprintf (stderr, "did not find the `myvar' variable\n"); + { + fprintf (stderr, "did not find the `myvar' variable\n"); + ret = 1; + } lt_dlclose(handle); - return 0; + return ret; } int @@ -129,6 +149,7 @@ main (argc, argv) char **argv; { int i; + int ret = 0; printf ("Welcome GNU libtool mdemo!\n"); @@ -144,11 +165,11 @@ main (argc, argv) for (i = 1; i < argc; i++) if (test_dl(argv[i])) - return 1; + ret = 1; if (test_dlself()) - return 1; + ret = 1; lt_dlexit(); - return 0; + return ret; } diff --git a/tests/Makefile.am b/tests/Makefile.am index 18826ff83..ea59dc77e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,27 +2,29 @@ AUTOMAKE_OPTIONS = gnits -TESTS = demo-static.test demo-make.test demo-exec.test \ - demo-inst.test demo-unst.test hardcode.test \ - mdemo-static.test mdemo-make.test mdemo-exec.test \ - mdemo-inst.test mdemo-unst.test \ - cdemo-static.test cdemo-make.test cdemo-exec.test \ +TESTS = cdemo-static.test cdemo-make.test cdemo-exec.test \ + demo-static.test demo-make.test demo-exec.test \ + demo-inst.test demo-unst.test \ depdemo-static.test depdemo-make.test depdemo-exec.test \ depdemo-inst.test depdemo-unst.test \ - demo-conf.test demo-make.test demo-exec.test \ - demo-inst.test demo-unst.test hardcode.test \ - mdemo-conf.test mdemo-make.test mdemo-exec.test \ + mdemo-static.test mdemo-make.test mdemo-exec.test \ mdemo-inst.test mdemo-unst.test \ cdemo-conf.test cdemo-make.test cdemo-exec.test \ + demo-conf.test demo-make.test demo-exec.test \ + demo-inst.test demo-unst.test \ depdemo-conf.test depdemo-make.test depdemo-exec.test \ depdemo-inst.test depdemo-unst.test \ - demo-shared.test demo-make.test demo-exec.test \ - demo-inst.test demo-unst.test hardcode.test \ - mdemo-shared.test mdemo-make.test mdemo-exec.test \ + mdemo-conf.test mdemo-make.test mdemo-exec.test \ mdemo-inst.test mdemo-unst.test \ + demo-nofast.test demo-make.test demo-exec.test \ + demo-inst.test demo-unst.test \ cdemo-shared.test cdemo-make.test cdemo-exec.test \ + demo-shared.test demo-make.test demo-exec.test demo-inst.test \ + hardcode.test build-relink.test demo-unst.test \ depdemo-shared.test depdemo-make.test depdemo-exec.test \ depdemo-inst.test depdemo-unst.test \ + mdemo-shared.test mdemo-make.test mdemo-exec.test \ + mdemo-inst.test mdemo-unst.test \ link.test link-2.test nomode.test \ quote.test sh.test suffix.test @@ -39,7 +41,8 @@ EXTRA_DIST = defs $(TESTS) # We need to remove any files that the above tests created. clean-local: - -test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean -test -f ../cdemo/Makefile && cd ../cdemo && $(MAKE) distclean + -test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean + -test -f ../depdemo/Makefile && cd ../depdemo && $(MAKE) distclean -test -f ../mdemo/Makefile && cd ../mdemo && $(MAKE) distclean rm -rf _inst diff --git a/tests/hardcode.test b/tests/hardcode.test index 703c4fe60..3e6c7670c 100755 --- a/tests/hardcode.test +++ b/tests/hardcode.test @@ -2,7 +2,7 @@ # hardcode.test - check to see what the system linker hardcodes # Test script header. -need_prefix=no +need_prefix=yes # otherwise it will be removed, and build-relink fails if test -z "$srcdir"; then srcdir=`echo "$0" | sed 's%/[^/]*$%%'` test "$srcdir" = "$0" && srcdir=. -- 2.47.2