From: Gordon Matzigkeit Date: Tue, 1 Apr 1997 19:18:28 +0000 (+0000) Subject: Initial revision X-Git-Tag: release-1-0a~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f7fb238bdd8af3ca4a8c65f48dbca634644071a;p=thirdparty%2Flibtool.git Initial revision --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 000000000..eb706249e --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +Authors of GNU Libtool. + +Gordon Matzigkeit. Designed and implemented libtool. diff --git a/PACKAGES b/PACKAGES new file mode 100644 index 000000000..b3f50f63f --- /dev/null +++ b/PACKAGES @@ -0,0 +1,5 @@ +Packages using libtool: + +http://www.ens.fr/~laburthe/claire.html +ftp://ftp.x.org/contrib/widgets/motif/spinbox/ +The GNU Guile project. diff --git a/PLATFORMS b/PLATFORMS new file mode 100644 index 000000000..3d28217dd --- /dev/null +++ b/PLATFORMS @@ -0,0 +1,24 @@ +---------------------------------------------------------------------- +canonical host name compiler libtool results + release +---------------------------------------------------------------------- +alpha-dec-osf3.2 gcc 0.7a fail +alpha-dec-osf3.2 cc 0.7a fail +hppa1.1-hp-hpux9.05 gcc 0.7a fail +hppa1.1-hp-hpux9.05 cc 0.7a fail +hppa1.1-hp-hpux10.10 cc 0.7a fail +mips-sgi-irix5.3 gcc 0.7a fail +mips-sgi-irix5.3 cc 0.7a fail +mips-sgi-irix6.2 cc -32 0.7a fail +mips-sgi-irix6.2 cc -n32 0.7a fail +rs6000-ibm-aix3.2.5 gcc* 0.7a gcc bug, fail demo-unst +rs6000-ibm-aix3.2.5 xlc 0.7a fail demo-unst +rs6000-ibm-aix4.1.4.0 gcc 0.7a fail demo-inst +rs6000-ibm-aix4.1.4.0 xlc 0.7a fail demo-inst +sparc-sun-sunos4.1.3_U1 gcc 0.7a ok +sparc-sun-sunos4.1.3_U1 cc 0.7a ok +sparc-sun-solaris2.4 gcc 0.7a ok +sparc-sun-solaris2.4 cc 0.7a ok +---------------------------------------------------------------------- + +* GCC version 2.6.1. diff --git a/README-alpha b/README-alpha new file mode 100644 index 000000000..beb921a22 --- /dev/null +++ b/README-alpha @@ -0,0 +1,14 @@ +This is an alpha testing release of GNU libtool. + +Please do not send any bug reports or questions about it to public +forums (such as GNU newsgroups and mailing lists), send them directly +to Gordon Matzigkeit . + +There are several references to a future release of Automake in +libtool, that may not work with your own copy of Automake. Gordon is +working closely with Tom Tromey to integrate libtool patches into +Automake. + +In the meantime, just ignore these references, or ask Gord for his +modified version of automake-1.1g that supports all the features +described in the libtool manual. diff --git a/README-automake b/README-automake new file mode 100644 index 000000000..31b3f8491 --- /dev/null +++ b/README-automake @@ -0,0 +1,27 @@ +There are several references to a future release of Automake in +libtool, that may not work with your own copy of Automake. Only +releases of Automake after automake-1.1j work with libtool. + +You can find the latest Automake prerelease (warning: it may have +bugs) at: + + + +Once Automake 1.2 is released, you should get it from your closest GNU +mirror. + +** If you get automake-1.1k, you'll need to apply the following patch +before installing it: + +diff -u automake-1.1k/automake.in.orig automake-1.1k/automake.in +--- automake-1.1k/automake.in.orig Sun Dec 8 04:03:10 1996 ++++ automake-1.1k/automake.in Sun Dec 8 04:03:12 1996 +@@ -4294,7 +4294,7 @@ + { + # Note that we explicitly set the mode, to avoid + # lossage if the program name isn't what we expect. +- $more_xform = 's/\@LIBTOOL\@/$(LIBTOOL) --mode=install/;'; ++ $more_xform = 's/\@LIBTOOL\@/\$(LIBTOOL) --mode=install/;'; + } + else + { diff --git a/demo/README b/demo/README new file mode 100644 index 000000000..1e8e5db8f --- /dev/null +++ b/demo/README @@ -0,0 +1,9 @@ +This is GNU hell, an example package that uses GNU libtool with an +Automake-generated environment to build a simple library and program. + +Admittedly, it would be better if this was a more realistic example, +say, a program that actually did something useful, but we can't have +everything. + +Send bug reports and comments about GNU hell to Gord Matzigkeit +. diff --git a/demo/configure.in b/demo/configure.in new file mode 100644 index 000000000..76a40296d --- /dev/null +++ b/demo/configure.in @@ -0,0 +1,9 @@ +dnl Initialize the hell package. +AC_INIT(hello.c) +AM_INIT_AUTOMAKE(hell,0.0) + +AC_PROG_CC +AM_PROG_LIBTOOL + +dnl Output the makefile +AC_OUTPUT(Makefile) diff --git a/demo/foo.h b/demo/foo.h new file mode 100644 index 000000000..93ece42a5 --- /dev/null +++ b/demo/foo.h @@ -0,0 +1,27 @@ +/* foo.h -- interface to the libfoo library + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of GNU Libtool. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Written by Gordon Matzigkeit */ + +/* Silly constants that the functions return. */ +#define HELLO_RET 0xe110 +#define FOO_RET 0xf00 + +/* Function declarations. */ +int foo (); +int hello (); diff --git a/demo/hello.c b/demo/hello.c new file mode 100644 index 000000000..a77bf8b99 --- /dev/null +++ b/demo/hello.c @@ -0,0 +1,28 @@ +/* hello.c -- trivial test function for libfoo + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of GNU Libtool. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Written by Gordon Matzigkeit */ +#include "foo.h" +#include + +int +hello () +{ + printf ("** This is not GNU Hello. There is no built-in mail reader. **\n"); + return HELLO_RET; +} diff --git a/demo/libinfo b/demo/libinfo new file mode 100644 index 000000000..dc4cb7c6a --- /dev/null +++ b/demo/libinfo @@ -0,0 +1,7 @@ +# libinfo - used by libtool for library version information +# +# Comments begin with a hash sign. +# +# Each non-comment line has the following format: +# libNAME CURRENT AGE REVISION +libhell 3 1 12 diff --git a/demo/main.c b/demo/main.c new file mode 100644 index 000000000..c07640f80 --- /dev/null +++ b/demo/main.c @@ -0,0 +1,36 @@ +/* main.c -- trivial hello test program + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of GNU Libtool. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* Written by Gordon Matzigkeit */ +#include "foo.h" +#include + +int +main () +{ + printf ("Welcome to GNU Hell!\n"); + + /* Just call the functions and check return values. */ + if (foo () != FOO_RET) + return 1; + + if (hello () != HELLO_RET) + return 2; + + return 0; +} diff --git a/demo/run.test b/demo/run.test new file mode 100644 index 000000000..6a962ae24 --- /dev/null +++ b/demo/run.test @@ -0,0 +1,21 @@ +#! /bin/sh +# run.test - Check that hell is viable. + +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi + +# See how redirections should work. +if test -z "$VERBOSE"; then + exec > /dev/null 2>&1 +fi + +echo "=== Running test $0" + +# Attempt to execute the program we built. +if ./hell | grep 'GNU Hell' > /dev/null; then + exit 0 +else + exit 1 +fi diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 000000000..e0fafe1ee --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,21 @@ +## Process Makefile.am with automake to create Makefile.in. +## +## Copyright (C) 1996 Free Software Foundation, Inc. +## This Makefile.am is free software; the Free Software Foundation +## gives unlimited permission to copy, distribute and modify it. +## +## Written by Gordon Matzigkeit +AUTOMAKE_OPTIONS = gnits + +CLEANFILES = aclibtool.T +MAINTAINERCLEANFILES = aclibtool.texi + +info_TEXINFOS = libtool.texi +libtool_TEXINFOS = aclibtool.texi + +## Quoted version of $(top_srcdir)/libtool.m4. +$(srcdir)/aclibtool.texi: $(top_srcdir)/libtool.m4 + rm -f aclibtool.T + sed -e 's/{/@{/g' -e 's/}/@}/g' $(top_srcdir)/libtool.m4 \ + > aclibtool.T + mv aclibtool.T $(srcdir)/aclibtool.texi diff --git a/doc/platforms.texi b/doc/platforms.texi new file mode 100644 index 000000000..56d1765cb --- /dev/null +++ b/doc/platforms.texi @@ -0,0 +1,31 @@ +-------------------------------------------------------- +canonical host name compiler libtool results + release +-------------------------------------------------------- +alpha-dec-osf3.2 cc 0.8 ok +alpha-dec-osf3.2 gcc 0.8 ok +hppa1.1-hp-hpux9.05 cc 0.8 ok* +hppa1.1-hp-hpux9.05 gcc 0.8 ok* +hppa1.1-hp-hpux10.10 cc 0.8 ok +i386-unknown-freebsd2.1.5 gcc 0.5 ok +i386-unknown-gnu0.0 gcc 0.5 ok +i386-unknown-linux2.0.16 gcc 0.9 ok +i386-unknown-netbsd1.2 gcc 0.9 ok +mips-sgi-irix5.3 cc 0.8 ok +mips-sgi-irix5.3 gcc 0.8 ok +mips-sgi-irix6.2 cc -32 0.8 ok +mips-sgi-irix6.2 cc -n32 0.8 fail +rs6000-ibm-aix3.2.5 xlc 0.8 ok +rs6000-ibm-aix3.2.5 gcc 0.8 ok +rs6000-ibm-aix4.1.4.0 xlc 0.9 ok +rs6000-ibm-aix4.1.4.0 gcc 0.7c ok +sparc-sun-linux2.1.14 gcc 0.7c ok +sparc-sun-sunos4.1.3_U1 cc 0.7a ok +sparc-sun-sunos4.1.3_U1 gcc 0.7a ok +sparc-sun-solaris2.4 cc 0.7a ok +sparc-sun-solaris2.4 gcc 0.7a ok +sparc-sun-solaris2.5.1 gcc 0.9 ok +-------------------------------------------------------- + +* `sh internal 2K buffer overflow', under investigation. In the +meantime, set the CONFIG_SHELL environment variable to /usr/bin/ksh. diff --git a/libtool.m4 b/libtool.m4 new file mode 100644 index 000000000..e7397fbcb --- /dev/null +++ b/libtool.m4 @@ -0,0 +1,28 @@ +## +## Configure libtool for the target system. +## +# serial 1 AM_PROG_LIBTOOL +AC_DEFUN(AM_PROG_LIBTOOL, +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_RANLIB]) + +# Always use our own libtool. +LIBTOOL='$(top_builddir)/libtool' +AC_SUBST(LIBTOOL) + +dnl Allow the --disable-shared flag to stop us from building shared libs. +AC_ARG_ENABLE(shared, +[ --enable-shared build shared libraries [default=yes]], +test "$enableval" = no && libtool_shared=" --disable-shared", +libtool_shared=) + +libtool_flags="$libtool_shared" +test "$silent" = yes && libtool_flags="$libtool_flags --silent" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" LD="$LD" RANLIB="$RANLIB" \ +$ac_aux_dir/ltconfig $libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \ +|| AC_MSG_ERROR([libtool configure failed]) +]) diff --git a/replfunc.m4 b/replfunc.m4 new file mode 100644 index 000000000..32f0b8803 --- /dev/null +++ b/replfunc.m4 @@ -0,0 +1,55 @@ +## replfunc.m4 - libtool-aware AM_REPLACE_FUNC macro and friends. +## Copyright (C) 1997 Free Software Foundation, Inc. +## Gordon Matzigkeit , 1997 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 1 AM_REPLACE_FUNCS +dnl AM_REPLACE_FUNCS(FUNCTION...) +AC_DEFUN(AM_REPLACE_FUNCS, +[AC_CHECK_FUNCS([$1], , [LIBOBJS="$LIBOBJS ${ac_func}.o" +LTLIBOBJS="$LTLIBOBJS ${ac_func}.lo"]) +AC_SUBST(LIBOBJS)dnl +AC_SUBST(LTLIBOBJS)dnl +]) + + +dnl AM_FUNC_ALLOCA +AC_DEFUN(AM_FUNC_ALLOCA, +[AC_REQUIRE([AC_FUNC_ALLOCA])dnl +test $ac_cv_func_alloca_works = no && LTALLOCA=alloca.lo +AC_SUBST(LTALLOCA)dnl +]) + + +dnl AM_FUNC_MEMCMP +AC_DEFUN(AM_FUNC_MEMCMP, +[AC_REQUIRE([AC_FUNC_MEMCMP])dnl +test $ac_cv_func_memcmp_clean = no && LTLIBOBJS="$LTLIBOBJS memcmp.lo" +AC_SUBST(LTLIBOBJS)dnl +]) + + +dnl AM_STRUCT_ST_BLOCKS +AC_DEFUN(AM_STRUCT_ST_BLOCKS, +[AC_REQUIRE([AC_STRUCT_ST_BLOCKS])dnl +test $ac_cv_struct_st_blocks = no && LTLIBOBJS="$LTLIBOBJS fileblocks.lo" +AC_SUBST(LTLIBOBJS)dnl +]) diff --git a/tests/defs b/tests/defs new file mode 100644 index 000000000..fbb6cc586 --- /dev/null +++ b/tests/defs @@ -0,0 +1,28 @@ +# -*- sh -*- +# Defines for Libtool testing environment. +# Gord Matzigkeit , 1996 + +# Check that srcdir is set to an absolute path. +case "$srcdir" in +/*) ;; +*) srcdir=`cd $srcdir && pwd` ;; +esac + +prefix="./=inst" +if test -d $prefix; then + rm -rf $prefix +fi +if test "$need_prefix" = yes; then + # An absolute path to a test installation directory. + mkdir $prefix + prefix=`cd $prefix && pwd` +else + prefix=NONE +fi + +# See how redirections should work. +if test -z "$VERBOSE"; then + exec > /dev/null 2>&1 +fi + +echo "=== Running test $0" diff --git a/tests/demo-conf.test b/tests/demo-conf.test new file mode 100755 index 000000000..0505e7435 --- /dev/null +++ b/tests/demo-conf.test @@ -0,0 +1,28 @@ +#! /bin/sh +# demo-conf.test - try configuring the ../demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../demo || mkdir ../demo + +# Change to our build directory. +cd ../demo || exit 1 + +# Possibly clean up the distribution. +if test -f config.cache; then + echo "= Running make distclean in ../demo" + make distclean || rm -f config.cache +fi + +# Configure the demonstration. +echo "= Configuring in ../demo (prefix=$prefix)" +$srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix || exit 1 + +exit 0 diff --git a/tests/demo-exec.test b/tests/demo-exec.test new file mode 100755 index 000000000..488e0fbb5 --- /dev/null +++ b/tests/demo-exec.test @@ -0,0 +1,33 @@ +#! /bin/sh +# demo-exec.test - check that programs in the ../demo subdirectory are viable + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +if test -f ../demo/hell; then : +else + echo "You must run demo-make.test before running $0" 1>&2 + exit 1 +fi + +# Check to see if the programs really run. +echo "Executing uninstalled programs in ../demo" + +if ../demo/hell.static | grep 'GNU Hell'; then : +else + echo "$0: cannot execute ./hell.static" 1>&2 + exit 1 +fi + +if ../demo/hell | grep 'GNU Hell'; then : +else + echo "$0: cannot execute ./hell" 1>&2 + exit 1 +fi + +exit 0 diff --git a/tests/demo-inst.test b/tests/demo-inst.test new file mode 100755 index 000000000..d0564ff3b --- /dev/null +++ b/tests/demo-inst.test @@ -0,0 +1,43 @@ +#! /bin/sh +# demo-inst.test - try installing from the ../demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Check that things are built. +if test -f ../demo/hell; then : +else + echo "You must run demo-make.test before $0" 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../demo || exit 1 + +echo "= Running make install in ../demo" +make install || exit 1 + +echo "= Executing installed programs" +if $prefix/bin/hell.static | grep 'GNU Hell'; then : +else + echo "$0: cannot execute $prefix/bin/hell.static" 1>&2 + exit 1 +fi + +if $prefix/bin/hell | grep 'GNU Hell'; then : +else + echo "$0: cannot execute $prefix/bin/hell" 1>&2 + + # Simple check to see if they are superuser. + if test -w /; then : + else + echo "You may need to run $0 as the superuser." + fi + exit 1 +fi +exit 0 diff --git a/tests/demo-make.test b/tests/demo-make.test new file mode 100755 index 000000000..9f9bf8dc6 --- /dev/null +++ b/tests/demo-make.test @@ -0,0 +1,24 @@ +#! /bin/sh +# demo-make.test - try building in the ../demo subdirectory + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +if test -f ../demo/Makefile; then : +else + echo "You must run demo-conf.test before running $0" 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../demo || exit 1 + +# Do the actual build. +echo "Making in ../demo" +make || exit 1 +exit 0 diff --git a/tests/demo-unst.test b/tests/demo-unst.test new file mode 100755 index 000000000..693ea1bdb --- /dev/null +++ b/tests/demo-unst.test @@ -0,0 +1,33 @@ +#! /bin/sh +# demo.test - try uninstalling in the ../demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +if test "$prefix/bin/hell"; then : +else + echo "You must run demo-inst.test before $0." 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../demo || exit 1 + +echo "= Running make uninstall in ../demo" +make uninstall || exit 1 + +# See that there were no files leftover in $prefix. +leftovers=`find $prefix ! -type d -print` +if test -n "$leftovers"; then + echo "= Leftover after make uninstall:" + ls -l $leftovers + exit 1 +fi + +exit 0 diff --git a/tests/demo.test b/tests/demo.test new file mode 100644 index 000000000..713a612f6 --- /dev/null +++ b/tests/demo.test @@ -0,0 +1,51 @@ +#! /bin/sh +# demo.test - try building in the ../demo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../demo || mkdir ../demo + +# Change to our build directory. +cd ../demo || exit 1 + +# Possibly clean up the distribution. +if test -f config.cache; then + echo "= Running make distclean in ../demo" + make distclean || rm -f config.cache +fi + +# Configure the demonstration. +echo "= Configuring in ../demo (prefix=$prefix)" +$srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix || exit 1 + +# Do the actual build. +echo "= Running make in ../demo" +make || exit 1 + +echo "= Running make check in ../demo" +make check || exit 1 + +echo "= Running make install in ../demo" +make install || exit 1 + +# FIXME - only fail with installcheck if we are superuser. +echo "= Running make installcheck in ../demo" +make installcheck || exit 1 + +echo "= Running make uninstall in ../demo" +make uninstall || exit 1 + +# Clean up the distribution. +make distclean + +# Delete the directory tree we created. +rm -rf $prefix + +exit 0 diff --git a/tests/hardcode.test b/tests/hardcode.test new file mode 100755 index 000000000..b50309ac7 --- /dev/null +++ b/tests/hardcode.test @@ -0,0 +1,81 @@ +#! /bin/sh +# hardcode.test - check to see what the system linker hardcodes + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Check that things are built. +if test -f ../demo/hell; then : +else + echo "You must run demo-make.test before $0" 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../demo || exit 1 + +echo "= Running $make hardcode in ../demo" +$make hardcode || exit 1 + +echo "= Finding ltconfig's guesses at hardcoding values" +status=0 +hardcode_direct=NONE +hardcode_minus_L=NONE +hardcode_shlibpath_var=NONE + +# Suck in all the hardcode_* variable settings. +eval `egrep -e '^hardcode_' ./libtool 2>/dev/null` + +if test "$hardcode_direct" = NONE; then + echo "hardcode_direct not set in ../demo/libtool" 1>&2 + status=1 +fi + +if test "$hardcode_minus_L" = NONE; then + echo "hardcode_minus_L not set in ../demo/libtool" 1>&2 + status=1 +fi + +if test "$hardcode_shlibpath_var" = NONE; then + echo "hardcode_shlibpath_var not set in ../demo/libtool" 1>&2 + status=1 +fi + +test $status -eq 0 || exit $status + +echo "= Searching for hardcoded library directories in each program" +for file in hc-*; do + case "$file" in + hc-direct) expected="$hardcode_direct" ;; + hc-libpath) expected="$hardcode_shlibpath_var" ;; + hc-minusL) expected="$hardcode_minus_L" ;; + *) + echo "unknown file \`$file'" 1>&2 + continue + ;; + esac + + if grep '.libs' $file > /dev/null; then + if test $expected = yes; then + echo ".libs was hardcoded in \`$file', as libtool expected" + else + echo ".libs was hardcoded in \`$file', which fooled libtool" 1>&2 + status=1 + fi + else + if test $expected = yes; then + echo ".libs was not hardcoded in \`$file', which fooled libtool" 1>&2 + status=1 + else + echo ".libs was not hardcoded in \`$file', as libtool expected" + fi + fi +done + +exit $status diff --git a/tests/link-2.test b/tests/link-2.test new file mode 100755 index 000000000..f4d38eddf --- /dev/null +++ b/tests/link-2.test @@ -0,0 +1,29 @@ +#! /bin/sh +# link.test - check that .lo files and .l_o files aren't made into programs. + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Try a sample link command. +linkresult=`$libtool -n --mode=link gcc -o something foo.o hello.l_o hell.lo` + +test $? = 0 || exit 1 + +echo "$linkresult" +case "$linkresult" in +*".lo "*) + echo "$0: .lo files should not be linked into programs" + exit 1 + ;; + +*".l_o "*) + echo "$0: .l_o files should not be linked into programs" + exit 1 + ;; +esac +exit 0 diff --git a/tests/link.test b/tests/link.test new file mode 100755 index 000000000..6257d5b12 --- /dev/null +++ b/tests/link.test @@ -0,0 +1,14 @@ +#! /bin/sh +# link.test - make sure that linking against libraries is legal. + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Try a sample link command. +$libtool -n --mode=link gcc -o gettext ../lib/libnlsut.a +exit $? diff --git a/tests/suffix.test b/tests/suffix.test new file mode 100755 index 000000000..2e249ed80 --- /dev/null +++ b/tests/suffix.test @@ -0,0 +1,36 @@ +#! /bin/sh +# suffix.test - check that libtool knows how to transform source suffices. + +# Extensions taken from the ones that Automake recognizes. +extensions="C F S c c++ cc cpp cxx f f90 for" +bad_names="foo." + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +status=0 +for ext in $extensions; do + # Try a sample compile command. + if ($libtool -n --mode=compile compiler -c foo.$ext 2>&1; exit 0) | grep 'cannot'; then + status=1 + else + echo "recognized foo.$ext as a valid source file" + fi +done + +# Make sure that invalid suffixes are not recognized. +for name in $bad_names; do + if ($libtool -n --mode=compile compiler -c $name 2>&1; exit 0) | grep 'cannot'; then : + else + echo "recognized foo.$ext as a valid source file" + status=1 + fi +done + +exit $status diff --git a/tests/test-e.test b/tests/test-e.test new file mode 100644 index 000000000..25a22b560 --- /dev/null +++ b/tests/test-e.test @@ -0,0 +1,19 @@ +#! /bin/sh +# test-e.test - check that we haven't accidentally used test -e + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Check that test -e isn't used in our portable shell scripts. +if grep -n 'test -e' $srcdir/../ltconfig $srcdir/../ltmain.sh; then + echo "use test -f, not test -e to check for file existence" + exit 1 +fi + +exit 0 + diff --git a/tests/tlibtool b/tests/tlibtool new file mode 100644 index 000000000..2522d5e51 --- /dev/null +++ b/tests/tlibtool @@ -0,0 +1,82 @@ +#! /bin/sh + +# tlibtool - A little test version of libtool. +if test -z "$srcdir"; then + echo "tlibtool: you must set \`\$srcdir' before running this test program" 1>&2 + exit 1 +fi + +# Use @VERSION@ so that we can use ../ltmain.sh.in directly. +LTCONFIG_VERSION="@VERSION@" + +# Whether or not to build libtool libraries. +build_libtool_libs=yes + +# Whether or not to build old-style libraries. +build_old_libs=yes + +# The host system. +host_alias="i386-unknown-netbsd1.2" +host="i386-unknown-netbsd1.2" + +# The linker used to build libraries. +LD='ld' + +# How to create reloadable object files. +reload_flag=' -r' +reload_cmds='$LD$reload_flag -o $output$reload_objs' + +# How to pass a linker flag through the compiler. +wl='-Wl,' + +# Additional compiler flags for building library objects. +pic_flag=' -fPIC' + +# Compiler flag to prevent dynamic linking. +link_static_flag='-static' + +# Pattern to match compiler flags for creating libNAME_p libraries: +profile_flag_pattern='-pg?' + +# Library versioning type. +version_type=sunos + +# List of archive names. First name is the real one, the rest are links. +lib_names='$libname.so.$versuffix' + +# The coded name of the library, if different from the real name. +soname_spec='' + +# Commands used to build and install an old-style archive. +RANLIB='ranlib' +old_archive_cmds='ar cru $oldlib$oldobjs;$RANLIB $oldlib' +old_postinstall_cmds='chmod 644 $oldlib;$RANLIB $oldlib' + +# Commands used to build and install a shared archive. +archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs' +postinstall_cmds='' + +# Commands used to finish a libtool library installation in a directory. +finish_cmds='ldconfig -m $libdir' + +# The flag that specifies a runtime search path when linking. +link_rpath_flag='-R$libdir' + +# How to strip a library file. +striplib='strip -x' +old_striplib='' + +# This is the shared library path variable. +shlibpath_var=LD_LIBRARY_PATH + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the +# the resulting binary. +hardcode_shlibpath_var=no + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=no + +# Execute the libtool backend. +. $srcdir/../ltmain.sh.in +exit 1