From 59abbf0c1001c0f45c1ae279b8aa656c5469fc16 Mon Sep 17 00:00:00 2001 From: Gordon Matzigkeit Date: Sun, 19 Apr 1998 19:29:28 +0000 Subject: [PATCH] *** empty log message *** --- AUTHORS | 4 +- ChangeLog | 5 ++ Makefile.am | 3 +- NEWS | 10 ++- TODO | 49 ++++++++---- doc/libtool.texi | 194 +++++++++++++++++++++++++++++++---------------- libtool.m4 | 18 ++--- ltconfig.in | 65 ++++++++++------ ltmain.in | 68 ++++++++++++----- tests/quote.test | 26 +++++-- 10 files changed, 298 insertions(+), 144 deletions(-) diff --git a/AUTHORS b/AUTHORS index eb706249..0a2771e5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,5 @@ -Authors of GNU Libtool. +Authors of GNU Libtool. The following people contributed enough in +order to warrant exchanging legal papers with the Free Software +Foundation. Gordon Matzigkeit. Designed and implemented libtool. diff --git a/ChangeLog b/ChangeLog index 69d554da..07428bc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 1998-04-19 Gordon Matzigkeit + * Makefile.am (maintainer-rekey): New rule to force us to change + Project-Version after we make a release. This keeps all version + numbers in sync, rather than branching just before the release. + (maintainer-release, maintainer-checkin): Use maintainer-rekey. + * ltmain.in (finish): Notice when a finish command fails, so that we can add it to the list of recommendations. diff --git a/Makefile.am b/Makefile.am index e678909a..10e11c2d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -112,6 +112,7 @@ maintainer-rekey: if test "X$$newver" = "X$(VERSION)"; then \ if test -f "$(released)"; then \ echo "New development cycle: change Project-Version in $(top_srcdir)/$(PACKAGE).prj."; \ + exit 1; \ else \ echo "No need to rekey any files"; \ fi; \ @@ -121,7 +122,7 @@ maintainer-rekey: cd $(top_srcdir) && $(PRCS) rekey -f $(PACKAGE) $(rekey_files); \ fi -maintainer-release: distcheck +maintainer-release: maintainer-rekey distcheck cd $(top_srcdir) && $(PRCS) checkin -f $(PACKAGE) echo timestamp > "$(released)" @echo "============================="; \ diff --git a/NEWS b/NEWS index 3287d867..0a444c11 100644 --- a/NEWS +++ b/NEWS @@ -1,17 +1,19 @@ NEWS - list of user-visible changes between releases of GNU Libtool -New: +New in 1.2a - 1998-04-19, Gordon Matzigkeit: * Bug fixes. +* ltconfig accepts an `--output' option to specify the name of the + generated libtool. * New `--debug' flag to turn on shell script tracing for libtool, libtoolize, and ltconfig. -* Changed `libtool --features' to print out all configuration variables. +* Added `libtool --config' to print out all configuration variables. * Support for *-*-hpux11*. - + New in 1.2 - 1998-03-20, Gordon Matzigkeit: * Minor bug fixes to provide a stable public release. * Libtool no longer causes Solaris printf to barf due to silly 2110-byte static buffers. - + New in 1.1 - 1998-03-08, Gordon Matzigkeit: * Bug fixes. * http://www.profitpress.com/libtool/ is libtool's homepage. diff --git a/TODO b/TODO index 5ecda015..a480fe21 100644 --- a/TODO +++ b/TODO @@ -1,20 +1,41 @@ For next public release: ************************ -* Try expr "..." : '^\(.*\)$' as a replacement for long echos on -Solaris. Or awk. Or perl? +* Create a new library version_type, `irix'. Janos Farkas writes: -* Remove references to `ltmain.sh' in generated files, because it's -name really is an internal implementation detail. +I just realized I also have mortal access to an SGI system, and found +this in the dso.5 page, this looks more informative :) + + Versioning of Shared Objects. + + QUICK OVERVIEW + + For a shared object to be versioned the following needs to be done: + + * Version strings consist of 3 parts and a dot: The string "sgi", + a decimal number (the major number), a dot, and a decimal number + (the minor number). + + * Add the command -set_version sgi1.0 to the command to build + the shared object (cc -shared, ld -shared, etc.). + + * Whenever you make a COMPATIBLE change update the minor version + number (the one after the dot), and add the latest version string + to colon-separated list of version strings, e.g., -set_version + sgi1.0:sgi1.1:sgi1.3 + + * Whenever you make an INCOMPATIBLE change, update the + major version number. Pass this as the version list, e.g., + -set_version sgi2.0. Change the filename of the OLD shared object + by adding a dot followed by the previous major number to the filename + of the shared object. DO NOT CHANGE the soname of the object. + No change to the file contents are necessary or desirable. Simply + rename the file. * Inter-library dependencies should be fully tracked by libtool. Reminded by Alexandre Oliva. This requires looking up installed libtool libraries for transparent support. -* Get rid of the sections that try to change behaviour for GNU ld. We -really should make our shared library support just depend on the -compiler type. - * Alexandre Oliva suggests that we hardcode paths into libraries, as well as binaries: `... -Wl,-soname -Wl,/tmp/libtest.so.0 ...'. @@ -23,8 +44,6 @@ AIX 4), distinguishes between global function and global variable references. This means that we cannot declare every symbol as `extern char'. Find a workaround. -* Maybe show other maintainers my nasty ~/bin/libtool trick. - In the future: ************** @@ -68,6 +87,11 @@ notes. Things to think about: ********************** +* For OSes with symbol export lists, we should add some flags to allow +packages to specify explicit lists, or to bypass them entirely. +Automatic-generation using nm must be the default, since that is +simplest. + * Talk with RMS about his so-called `automatic package generation tool.' This is probably what Thomas has been murmuring about for the Hurd. We'll need to integrate package-supplied programs such as @@ -78,8 +102,3 @@ like libtool should be distributed as part of such a binary package. * Maybe implement full support for other orthogonal library types (libhello_g, libhello_p, 64 vs 32-bit ABI's, etc). Make these types configurable. - -* Add support for windoze DLL's, and maybe other jumptable libs. -Check out Lesstif and Tcl configuration again (maybe they would be -interested in libtool by now?). The Cygnus win32 project may also be -of value, though it still seems pretty rudimentary right now. diff --git a/doc/libtool.texi b/doc/libtool.texi index 13d136c5..49acbcd8 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -111,8 +111,7 @@ libtool. * Maintaining:: Information used by the libtool maintainer. * Index:: Full index. -@detailmenu - --- The Detailed Node Listing --- +@detailmenu --- The Detailed Node Listing --- Introduction @@ -197,6 +196,7 @@ Maintenance notes for libtool * Tested platforms:: When libtool was last tested. * Platform quirks:: Information about different library systems. * libtool script contents:: Configuration information that libtool uses. +* Cheap tricks:: Making libtool maintainership easier. Platform quirks @@ -502,17 +502,18 @@ arguments (@pxref{Compile mode}): @example a23$ @kbd{libtool gcc -g -O -c foo.c} gcc -g -O -c foo.c -ln -s foo.o foo.lo +echo timestamp > foo.lo a23$ @kbd{libtool gcc -g -O -c hello.c} gcc -g -O -c hello.c -ln -s hello.o hello.lo +echo timestamp > hello.lo a23$ @end example -Note that libtool creates two object files for each invocation. The -@samp{.lo} file is a library object, and the @samp{.o} file is a -standard object file. On @samp{a23}, these files are identical, because -only static libraries are supported. +Note that libtool creates two files for each invocation. The @samp{.lo} +file is a library object, which may be built into a shared library, and +the @samp{.o} file is a standard object file. On @samp{a23}, the +library objects are just timestamps, because only static libraries are +supported. On shared library systems, libtool automatically inserts the PIC generation flags into the compilation command, so that the library @@ -522,14 +523,17 @@ object and the standard object differ: burger$ @kbd{libtool gcc -g -O -c foo.c} gcc -g -O -c -fPIC -DPIC foo.c mv -f foo.o foo.lo -gcc -g -O -c foo.c +gcc -g -O -c foo.c >/dev/null 2>&1 burger$ @kbd{libtool gcc -g -O -c hello.c} gcc -g -O -c -fPIC -DPIC hello.c mv -f hello.o hello.lo -gcc -g -O -c hello.c +gcc -g -O -c hello.c >/dev/null 2>&1 burger$ @end example +Notice that the second run of GCC has its output discarded. This is +done so that compiler warnings aren't annoyingly duplicated. + @node Linking libraries @section Linking libraries @@ -565,10 +569,10 @@ the same ones you would use to produce an executable named @file{libhello.la} with your compiler (@pxref{Link mode}): @example -burger$ @kbd{libtool gcc -g -O -o libhello.la foo.o hello.o} +a23$ @kbd{libtool gcc -g -O -o libhello.la foo.o hello.o} libtool: cannot build libtool library `libhello.la' from non-libtool \ objects -burger$ +a23$ @end example Aha! Libtool caught a common error@dots{} trying to build a library @@ -576,10 +580,10 @@ from standard objects instead of library objects. This doesn't matter for static libraries, but on shared library systems, it is of great importance. -So, let's try again, this time with the library object -files:@footnote{Remember that we need to add @kbd{-lm} to the link -command line because @file{foo.c} uses the @code{cos(3)} math library -function. @xref{Using libtool}.} +So, let's try again, this time with the library object files. Remember +also that we need to add @kbd{-lm} to the link command line because +@file{foo.c} uses the @code{cos(3)} math library function (@pxref{Using +libtool}): @example a23$ @kbd{libtool gcc -g -O -o libhello.la foo.lo hello.lo -lm} @@ -746,16 +750,16 @@ until we link it against at least a few more programs. If @file{hell} was a complicated program, you would certainly want to test and debug it before installing it on your system. In the above -section, you saw how the libtool wrapper script makes it possible to -run the program directly, but unfortunately, it interferes with the -debugger: +section, you saw how the libtool wrapper script makes it possible to run +the program directly, but unfortunately, this mechanism interferes with +the debugger: @example burger$ @kbd{gdb hell} GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. -There is absolutely no warranty for GDB; type "show warranty" for details. -GDB 4.16 (i386-unknown-netbsd), Copyright 1996 Free Software Foundation, Inc... +There is no warranty for GDB; type "show warranty" for details. +GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. "hell": not in executable format: File format not recognized @@ -771,8 +775,8 @@ burger$ @kbd{gdb @value{objdir}/hell} trick:/home/src/libtool/demo$ gdb .libs/hell GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. -There is absolutely no warranty for GDB; type "show warranty" for details. -GDB 4.16 (i386-unknown-netbsd), Copyright 1996 Free Software Foundation, Inc... +There is no warranty for GDB; type "show warranty" for details. +GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. (gdb) @kbd{break main} Breakpoint 1 at 0x8048547: file main.c, line 29. (gdb) @kbd{run} @@ -794,8 +798,8 @@ the executable wrapper (@pxref{Execute mode}): burger$ @kbd{libtool gdb hell} GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. -There is absolutely no warranty for GDB; type "show warranty" for details. -GDB 4.16 (i386-unknown-netbsd), Copyright 1996 Free Software Foundation, Inc... +There is no warranty for GDB; type "show warranty" for details. +GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. (gdb) @kbd{break main} Breakpoint 1 at 0x8048547: file main.c, line 29. (gdb) @kbd{run} @@ -844,9 +848,9 @@ ranlib /usr/local/lib/libhello.a a23# @end example -Note that the libtool library @file{libhello.la} is also installed, for -informational purposes, and to help libtool with uninstallation -(@pxref{Uninstall mode}). +Note that the libtool library @file{libhello.la} is also installed, to +help libtool with uninstallation (@pxref{Uninstall mode}) and to help +programs with dlopening (@pxref{Dlopened modules}). Here is the shared library example: @@ -879,10 +883,24 @@ further hints on what to do (@pxref{Finish mode}): @example burger# @kbd{libtool -n --finish /usr/local/lib} -ldconfig -m /usr/local/lib -To link against installed libraries in LIBDIR, users may have to: - - add LIBDIR to their `LD_LIBRARY_PATH' environment variable - - use the `-LLIBDIR' linker flag +PATH="$PATH:/sbin" ldconfig -m /usr/local/lib +---------------------------------------------------------------------- +Libraries have been installed in: + /usr/local/lib + +To link against installed libraries in a given directory, LIBDIR, +you must use the `-LLIBDIR' flag during linking. + + You will also need to do one of the following: + - add LIBDIR to the `LD_LIBRARY_PATH' environment variable + during execution + - add LIBDIR to the `LD_RUN_PATH' environment variable + during linking + - use the `-RLIBDIR' linker flag + +See any operating system documentation about shared libraries for +more information, such as the ld(1) and ld.so(8) manual pages. +---------------------------------------------------------------------- burger# @end example @@ -930,7 +948,7 @@ To do this, you should ignore libtool entirely, and just use the old @code{ar} and @code{ranlib} commands to create a static library. If you want to install the library (but you probably don't), then you -may use libtool if you want: +may use libtool: @example burger$ @kbd{libtool ./install-sh -c libhello.a /local/lib/libhello.a} @@ -958,13 +976,16 @@ creating a standalone binary. Use libtool to do the linking and add the The @code{libtool} program has the following synopsis: @example -libtool [@var{option}]@dots{} [@var{mode-arg}]... +libtool [@var{option}]@dots{} [@var{mode-arg}]@dots{} @end example @noindent and accepts the following options: @table @samp +@item --config +Display libtool configuration variables and exit. + @item --debug Dump a trace of shell script execution to standard output. This produces a lot of output, so you may wish to pipe it to @code{more(1)} @@ -976,9 +997,8 @@ Don't create, modify, or delete any files, just show what commands would be executed by libtool. @item --features -Display libtool configuration information and exit. This provides a way -for packages to determine whether shared or static libraries will be -built. +Display basic configuration options. This provides a way for packages +to determine whether shared or static libraries will be built. @item --finish Same as @samp{--mode=finish}. @@ -1363,6 +1383,13 @@ Display a help message and exit. Do not use @code{config.sub} to verify that @var{host} is a valid canonical host system name. +@item --output=@var{file} +@item -o @var{file} +Instead of creating a libtool script called @code{libtool}, create one +called @var{file}. This can be useful if you want to create libtool +scripts for cross-compilers, or you want to have more than one libtool +in the same directory. + @item --quiet @itemx --silent Do not print informational messages when running configuration tests. @@ -1475,17 +1502,18 @@ libraries. You can modify these defaults by calling either the @code{AM_DISABLE_SHARED} or @code{AM_DISABLE_STATIC} macros: @example -# Turn off shared libraries during beta-testing, since they make the -# build process take too long. +# Turn off shared libraries during beta-testing, since they +# make the build process take too long. AM_DISABLE_SHARED AM_PROG_LIBTOOL @end example -The user may specify a modified form of @samp{--enable-shared} and -@samp{--enable-static} to choose whether shared or static libraries are -built based on the name of the package. For example, to have shared -@samp{bfd} and @samp{gdb} libraries built, but not shared @samp{libg++}, -you can run all three @code{configure} scripts as follows: +The user may specify modified forms of both the @samp{--enable-shared} +and @samp{--enable-static} flags to choose whether shared or static +libraries are built based on the name of the package. For example, to +have shared @samp{bfd} and @samp{gdb} libraries built, but not shared +@samp{libg++}, you can run all three @code{configure} scripts as +follows: @example trick$ ./configure --enable-shared=bfd,gdb @@ -1493,9 +1521,10 @@ trick$ ./configure --enable-shared=bfd,gdb In general, specifying @samp{--enable-shared=@var{pkgs}} is the same as specifying @samp{--enable-shared} to every package named in the -@var{pkgs} list, and @samp{--disable-shared} to every other package. -The @samp{--enable-static=@var{pkgs}} flag behaves similarly, except it -translates into @samp{--enable-static} and @samp{--disable-static}. +comma-separated @var{pkgs} list, and @samp{--disable-shared} to every +other package. The @samp{--enable-static=@var{pkgs}} flag behaves +similarly, but it uses @samp{--enable-static} and +@samp{--disable-static}. The package name @samp{default} matches any packages which have not set their name in the @code{PACKAGE} environment variable. @@ -1881,8 +1910,8 @@ trick$ @kbd{ls /usr/lib/libbfd*} trick$ @end example -On @samp{trick}, @file{/usr/lib/libbfd.so} is just a symbolic link to -@file{/usr/lib/libbfd.so.2.7.0.2}, which was distributed as a part of +On @samp{trick}, @file{/usr/lib/libbfd.so} is a symbolic link to +@file{libbfd.so.2.7.0.2}, which was distributed as a part of @samp{binutils-2.7.0.2}. Unfortunately, this convention conflicts directly with libtool's idea of @@ -1904,9 +1933,9 @@ trick$ @end example In this case, @file{/usr/lib/libbfd.so} is a symbolic link to -@file{/usr/lib/libbfd-2.9.0.so.0.0.0}. This makes it obvious that the -user is dealing with @samp{binutils-2.9.0}, without compromising -libtool's idea of interface versions. +@file{libbfd-2.9.0.so.0.0.0}. This makes it obvious that the user is +dealing with @samp{binutils-2.9.0}, without compromising libtool's idea +of interface versions. Note that this option actually causes a modification of the library name, so do not use it unless you want to break binary compatibility @@ -2123,12 +2152,12 @@ libraries are found. This restriction is only necessary to preserve compatibility with static library systems and simple dynamic library systems. -Some platforms, such as AIX, do not even allow you this flexibility. In -order to build a shared library, it must be entirely self-contained -(that is, have no references to external symbols), and you need to -specify the @var{-no-undefined} flag to allow a shared library to be -built. By default, libtool builds only static libraries on these kinds -of platforms. +Some platforms, such as AIX and Windows 95, do not even allow you this +flexibility. In order to build a shared library, it must be entirely +self-contained (that is, have references only to symbols that are found +in the @samp{.lo} files or the specified @samp{-l} libraries), and you +need to specify the @var{-no-undefined} flag. By default, libtool +builds only static libraries on these kinds of platforms. @node Dlopened modules @chapter Dlopened modules @@ -2561,6 +2590,7 @@ porting libtool to new systems, or writing your own libtool. * Tested platforms:: When libtool was last tested. * Platform quirks:: Information about different library systems. * libtool script contents:: Configuration information that libtool uses. +* Cheap tricks:: Making libtool maintainership easier. @end menu @node New ports @@ -2629,7 +2659,7 @@ The following is a list of valuable documentation references: @itemize @bullet @item -SGI's IRIX Manual Pages, +SGI's IRIX Manual Pages, which can be found at @url{http://techpubs.sgi.com/cgi-bin/infosrch.cgi?cmd=browse&db=man}. @item @@ -2721,12 +2751,14 @@ use the @code{ar ts} command, instead. @cindex libtool implementation The @code{libtool} script is generated by @code{ltconfig} -(@pxref{Configuring}). Ever since libtool version 0.7, this script -simply sets shell variables, then sources the libtool backend, -@code{ltmain.sh}. +(@pxref{Configuring}). From libtool version 0.7 to 1.0, this script +simply set shell variables, then sourced the libtool backend, +@code{ltmain.sh}. @code{ltconfig} from libtool version 1.1 and later +inlines the contents of @code{ltmain.sh} into the generated +@code{libtool}, which improves performance on many systems. -Here is a listing of each of these variables, and how they are used -within @code{ltmain.sh}: +Here is a listing of each of the configuration variables, and how they +are used within @code{ltmain.sh}: @defvar AR The name of the system library archiver. @@ -2936,6 +2968,40 @@ generally exits with an error message. Variables ending in @samp{_spec} are @code{eval}ed before being used by libtool. +@node Cheap tricks +@section Cheap tricks + +Here are a few tricks that you can use in order to make maintainership +easier: + +@itemize @bullet +@item +When people report bugs, ask them to use the @samp{--config}, +@samp{--debug}, or @samp{--features} flags, if you think they will help +you. These flags are there to help you get information directly, rather +than having to trust second-hand observation. + +@item +Rather than reconfiguring libtool every time I make a change to +@code{ltconfig.in} or @code{ltmain.in}, I keep a permanent +@code{libtool} script in my @var{PATH}, which sources @code{ltmain.in} +directly. + +The following steps describe how to create such a script, where +@code{/home/src/libtool} is the directory containing the libtool source +tree, and @code{/home/src/libtool/libtool} is a libtool script that has +been configured for your platform, and : + +@example +trick$ @kbd{sed '/^# ltmain\.sh/q' /usr/local/bin/libtool > ~/bin/libtool} +trick$ @kbd{cat >> ~/bin/libtool +LTCONFIG_VERSION="@@VERSION@@" +. /home/src/libtool/ltmain.in} +trick$ @kbd{chmod +x ~/bin/libtool} +trick$ +@end example +@end itemize + @page @node Index @unnumbered Index diff --git a/libtool.m4 b/libtool.m4 index 94c15bb7..b3554edc 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -78,6 +78,10 @@ LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \ ${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]) + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log ]) # AM_ENABLE_SHARED - implement the --enable-shared flag @@ -225,13 +229,10 @@ fi]) AC_DEFUN(AM_PROG_NM, [AC_MSG_CHECKING([for BSD-compatible nm]) AC_CACHE_VAL(ac_cv_path_NM, -[case "$NM" in -changequote(,)dnl -/* | [A-Za-z]:\\*) -changequote([,])dnl - ac_cv_path_NM="$NM" # Let the user override the test with a path. - ;; -*) +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do test -z "$ac_dir" && ac_dir=. @@ -251,8 +252,7 @@ changequote([,])dnl done IFS="$ac_save_ifs" test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm - ;; -esac]) +fi]) NM="$ac_cv_path_NM" AC_MSG_RESULT([$NM]) AC_SUBST(NM) diff --git a/ltconfig.in b/ltconfig.in index aff17fb1..25181909 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -46,8 +46,7 @@ else # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # - # So, first we look for a working echo in the user's PATH, and if we - # can't find one, we emulate echo with printf '%s\n' + # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" for dir in $PATH /usr/ucb; do if test -f $dir/echo && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t'; then @@ -58,12 +57,23 @@ else IFS="$save_ifs" if test "X$echo" = Xecho; then - # We didn't find a better echo, so try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t'; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else - # Oops. We lost, so just stick with echo. - echo=echo + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi fi fi fi @@ -90,6 +100,7 @@ rm="rm -f" help="Try \`$progname --help' for more information." # Global variables: +default_ofile=libtool can_build_shared=yes enable_shared=yes # All known linkers require a `.a' archive for static linking. @@ -101,6 +112,7 @@ ac_config_guess= ac_config_sub= host= nonopt= +ofile="$default_ofile" verify_host=yes with_gcc=no with_gnu_ld=no @@ -142,6 +154,7 @@ Generate a system-specific libtool script. --disable-static do not build static libraries --help display this help and exit --no-verify do not verify that HOST is a valid host type +-o, --output=FILE specify the output file [default=$default_ofile] --quiet same as \`--silent' --silent do not print informational messages --srcdir=DIR find \`config.guess' in DIR @@ -173,6 +186,9 @@ EOM --no-verify) verify_host=no ;; + --output | -o) prev=ofile ;; + --output=*) ofile="$optarg" ;; + --version) echo "$PROGRAM (GNU $PACKAGE) $VERSION"; exit 0 ;; --with-gcc) with_gcc=yes ;; @@ -827,7 +843,11 @@ else ;; irix5* | irix6*) - archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs' + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs' + else + archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs' + fi hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' ;; @@ -1138,7 +1158,7 @@ amigaos*) freebsd2* | freebsd3*) version_type=sunos library_names_spec='${libname}${release}.so.$versuffix $libname.so' - finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1177,7 +1197,7 @@ linux-gnu*) version_type=linux library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major $libname.so' soname_spec='${libname}${release}.so.$major' - finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH if test -f /lib/ld.so.1; then @@ -1194,7 +1214,7 @@ linux-gnu*) netbsd* | openbsd*) version_type=sunos library_names_spec='${libname}${release}.so.$versuffix' - finish_cmds='PATH="$PATH:/sbin" ldconfig -m $libdir' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1229,7 +1249,7 @@ solaris2*) sunos4*) version_type=sunos library_names_spec='${libname}${release}.so.$versuffix' - finish_cmds='PATH="$PATH:/usr/etc" ldconfig $libdir' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH ;; @@ -1319,14 +1339,13 @@ for var in ltecho old_CC old_CFLAGS old_CPPFLAGS old_LD old_NM old_RANLIB \ esac done -ofile=libtool -trap "$rm $ofile; exit 1" 1 2 15 -echo creating $ofile -$rm $ofile -cat < $ofile +trap "$rm \"$ofile\"; exit 1" 1 2 15 +echo "creating $ofile" +$rm "$ofile" +cat < "$ofile" #! $SHELL -# libtool - Provide generalized library-building support services. +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $PROGRAM - GNU $PACKAGE $VERSION # NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. # @@ -1498,7 +1517,7 @@ EOF case "$host_os" in aix3*) - cat <<\EOF >> $ofile + cat <<\EOF >> "$ofile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems @@ -1511,13 +1530,13 @@ EOF ;; esac -echo '### END LIBTOOL CONFIG' >> $ofile -echo >> $ofile +echo '### END LIBTOOL CONFIG' >> "$ofile" +echo >> "$ofile" # Append the ltmain.sh script. -cat "$ltmain" >> $ofile || (rm -f $ofile; exit 1) +cat "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) -chmod +x $ofile +chmod +x "$ofile" exit 0 # Local Variables: diff --git a/ltmain.in b/ltmain.in index 7de29368..5478f6dd 100644 --- a/ltmain.in +++ b/ltmain.in @@ -111,6 +111,11 @@ do exit 0 ;; + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + --debug) echo "$progname: enabling shell trace mode" set -x @@ -121,7 +126,17 @@ do ;; --features) - sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi exit 0 ;; @@ -581,7 +596,7 @@ if test -z "$show_help"; then old_library= # Check to see that this really is a libtool archive. - if (sed -e '2q' $arg | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 exit 1 @@ -1421,7 +1436,7 @@ dld_preloaded_symbols[] = #! $SHELL # $output - temporary wrapper script for $objdir/$output -# Generated by ltmain.sh - GNU $PACKAGE $VERSION +# Generated by $PROGRAM - GNU $PACKAGE $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. @@ -1556,7 +1571,7 @@ fi\ if test -z "$run"; then $echo > $output "\ # $output - a libtool library file -# Generated by ltmain.sh - GNU $PACKAGE $VERSION +# Generated by $PROGRAM - GNU $PACKAGE $VERSION # The name that we can dlopen(3). dlname='$dlname' @@ -1627,7 +1642,7 @@ libdir='$install_libdir'\ opts= prev= install_type= - isdir= + isdir=no stripme= for arg do @@ -1697,7 +1712,7 @@ libdir='$install_libdir'\ # Check to see that the destination is a directory. test -d "$dest" && isdir=yes - if test -n "$isdir"; then + if test "$isdir" = yes; then destdir="$dest" destname= else @@ -1747,7 +1762,7 @@ libdir='$install_libdir'\ *.la) # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -1883,8 +1898,16 @@ libdir='$install_libdir'\ ;; *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then link_against_libtool_libs= finalize_command= @@ -1940,8 +1963,8 @@ libdir='$install_libdir'\ fi fi - $show "$install_prog$stripme $file $dest" - $run eval "$install_prog\$stripme \$file \$dest" || exit $? + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? ;; esac done @@ -1984,6 +2007,7 @@ libdir='$install_libdir'\ finish) modename="$modename: finish" libdirs="$nonopt" + admincmds= if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for dir @@ -1999,19 +2023,21 @@ libdir='$install_libdir'\ for cmd in $cmds; do IFS="$save_ifs" $show "$cmd" - $run eval "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" done IFS="$save_ifs" fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" - $run eval "$cmds" + $run eval "$cmds" || admincmds="$admincmds + $cmds" fi done fi - echo "------------------------------------------------------------------------------" + echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do echo " $libdir" @@ -2020,7 +2046,7 @@ libdir='$install_libdir'\ echo "To link against installed libraries in a given directory, LIBDIR," echo "you must use the \`-LLIBDIR' flag during linking." echo - echo " You will also need to do one of the following:" + echo " You will also need to do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" @@ -2035,13 +2061,16 @@ libdir='$install_libdir'\ echo " - use the \`$flag' linker flag" fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" echo "more information, such as the ld(1) and ld.so(8) manual pages." - echo "------------------------------------------------------------------------------" + echo "----------------------------------------------------------------------" exit 0 ;; @@ -2070,7 +2099,7 @@ libdir='$install_libdir'\ case "$file" in *.la) # Check to see that this really is a libtool archive. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then : + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : else $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 $echo "$help" 1>&2 @@ -2141,7 +2170,7 @@ libdir='$install_libdir'\ -*) ;; *) # Do a test to see if this is really a libtool program. - if (sed -e '4q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; @@ -2206,7 +2235,7 @@ libdir='$install_libdir'\ case "$name" in *.la) # Possibly a libtool archive, so verify it. - if (sed -e '2q' $file | egrep '^# Generated by ltmain\.sh') >/dev/null 2>&1; then + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then . $dir/$name # Delete the libtool libraries and symlinks. @@ -2285,9 +2314,10 @@ case "$mode" in Provide generalized library-building support services. + --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files - --features display configuration information and exit + --features display basic configuration information and exit --finish same as \`--mode=finish' --help display this help message and exit --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] diff --git a/tests/quote.test b/tests/quote.test index 16fd0967..f671f82b 100755 --- a/tests/quote.test +++ b/tests/quote.test @@ -16,12 +16,11 @@ status=0 echo=echo if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : else - # The Solaris, AIX and Digital Unix default echo program unquotes + # The Solaris, AIX, and Digital Unix default echo programs unquote # backslashes. This makes it impossible to quote backslashes using # echo "$something" | sed 's/\\/\\\\/g' # - # So, first we look for a working echo in the user's PATH, and if we - # can't find one, we emulate echo with printf '%s\n' + # So, first we look for a working echo in the user's PATH. IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}:" for dir in $PATH /usr/ucb; do if test -f $dir/echo && test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t'; then @@ -32,12 +31,23 @@ else IFS="$save_ifs" if test "X$echo" = Xecho; then - # We didn't find a better echo, so try using printf. - echo='printf %s\n' - if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t'; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif test -f /bin/ksh && test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} else - # Oops. We lost, so just stick with echo. - echo=echo + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then : + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi fi fi fi