]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
spurious commit abort earlier :-(
authorGary V. Vaughan <gary@gnu.org>
Tue, 14 Oct 2003 21:46:13 +0000 (21:46 +0000)
committerGary V. Vaughan <gary@gnu.org>
Tue, 14 Oct 2003 21:46:13 +0000 (21:46 +0000)
151 files changed:
tests/Makefile.am
tests/assign.test
tests/build-relink.test [deleted file]
tests/build-relink2.test [deleted file]
tests/cdemo-conf.test
tests/cdemo-exec.test
tests/cdemo-make.test
tests/cdemo-shared.test
tests/cdemo-static.test
tests/cdemo/.cvsignore [new file with mode: 0644]
tests/cdemo/Makefile.am [new file with mode: 0644]
tests/cdemo/README [new file with mode: 0644]
tests/cdemo/configure.ac [new file with mode: 0644]
tests/cdemo/foo.c [new file with mode: 0644]
tests/cdemo/foo.h [new file with mode: 0644]
tests/cdemo/main.c [new file with mode: 0644]
tests/defs
tests/demo-conf.test
tests/demo-deplibs.test [new file with mode: 0755]
tests/demo-exec.test
tests/demo-hardcode.test [moved from tests/hardcode.test with 52% similarity]
tests/demo-inst.test
tests/demo-make.test
tests/demo-nofast.test
tests/demo-noinst-link.test [new file with mode: 0755]
tests/demo-nopic.test
tests/demo-pic.test
tests/demo-relink.test [new file with mode: 0755]
tests/demo-shared.test
tests/demo-static.test
tests/demo-unst.test
tests/demo/.cvsignore [new file with mode: 0644]
tests/demo/Makefile.am [new file with mode: 0644]
tests/demo/README [new file with mode: 0644]
tests/demo/configure.ac [new file with mode: 0644]
tests/demo/dlmain.c [new file with mode: 0644]
tests/demo/foo.c [new file with mode: 0644]
tests/demo/foo.h [new file with mode: 0644]
tests/demo/hell1.c [new file with mode: 0644]
tests/demo/hell2.c [new file with mode: 0644]
tests/demo/hello.c [new file with mode: 0644]
tests/demo/main.c [new file with mode: 0644]
tests/depdemo-conf.test
tests/depdemo-exec.test
tests/depdemo-inst.test
tests/depdemo-make.test
tests/depdemo-nofast.test
tests/depdemo-relink.test [new file with mode: 0755]
tests/depdemo-shared.test
tests/depdemo-static.test
tests/depdemo-unst.test
tests/depdemo/.cvsignore [new file with mode: 0644]
tests/depdemo/Makefile.am [new file with mode: 0644]
tests/depdemo/README [new file with mode: 0644]
tests/depdemo/configure.ac [new file with mode: 0644]
tests/depdemo/l1/.cvsignore [new file with mode: 0644]
tests/depdemo/l1/Makefile.am [new file with mode: 0644]
tests/depdemo/l1/l1.c [new file with mode: 0644]
tests/depdemo/l1/l1.h [new file with mode: 0644]
tests/depdemo/l2/.cvsignore [new file with mode: 0644]
tests/depdemo/l2/Makefile.am [new file with mode: 0644]
tests/depdemo/l2/l2.c [new file with mode: 0644]
tests/depdemo/l2/l2.h [new file with mode: 0644]
tests/depdemo/l3/.cvsignore [new file with mode: 0644]
tests/depdemo/l3/Makefile.am [new file with mode: 0644]
tests/depdemo/l3/l3.c [new file with mode: 0644]
tests/depdemo/l3/l3.h [new file with mode: 0644]
tests/depdemo/l4/.cvsignore [new file with mode: 0644]
tests/depdemo/l4/Makefile.am [new file with mode: 0644]
tests/depdemo/l4/l4.c [new file with mode: 0644]
tests/depdemo/l4/l4.h [new file with mode: 0644]
tests/depdemo/main.c [new file with mode: 0644]
tests/depdemo/sysdep.h [new file with mode: 0644]
tests/deplibs.test [deleted file]
tests/f77demo-conf.test
tests/f77demo-exec.test
tests/f77demo-make.test
tests/f77demo-shared.test
tests/f77demo-static.test
tests/f77demo/.cvsignore [new file with mode: 0644]
tests/f77demo/Makefile.am [new file with mode: 0644]
tests/f77demo/README [new file with mode: 0644]
tests/f77demo/config.h [new file with mode: 0644]
tests/f77demo/configure.ac [new file with mode: 0644]
tests/f77demo/cprogram.c [new file with mode: 0644]
tests/f77demo/foo.h [new file with mode: 0644]
tests/f77demo/fooc.c [new file with mode: 0644]
tests/f77demo/foof.f [new file with mode: 0644]
tests/f77demo/fprogram.f [new file with mode: 0644]
tests/link-2.test
tests/link.test
tests/mdemo-conf.test
tests/mdemo-dryrun.test [moved from tests/dryrun.test with 54% similarity]
tests/mdemo-exec.test
tests/mdemo-inst.test
tests/mdemo-make.test
tests/mdemo-shared.test
tests/mdemo-static.test
tests/mdemo-unst.test
tests/mdemo/.cvsignore [new file with mode: 0644]
tests/mdemo/Makefile.am [new file with mode: 0644]
tests/mdemo/README [new file with mode: 0644]
tests/mdemo/configure.ac [new file with mode: 0644]
tests/mdemo/foo.h [new file with mode: 0644]
tests/mdemo/foo1.c [new file with mode: 0644]
tests/mdemo/foo2.c [new file with mode: 0644]
tests/mdemo/main.c [new file with mode: 0644]
tests/mdemo/mlib.c [new file with mode: 0644]
tests/mdemo/sub.c [new file with mode: 0644]
tests/mdemo2-conf.test
tests/mdemo2-exec.test
tests/mdemo2-make.test
tests/mdemo2/.cvsignore [new file with mode: 0644]
tests/mdemo2/Makefile.am [new file with mode: 0644]
tests/mdemo2/README [new file with mode: 0644]
tests/mdemo2/configure.ac [new file with mode: 0644]
tests/mdemo2/main.c [new file with mode: 0644]
tests/noinst-link.test [deleted file]
tests/nomode.test
tests/pdemo-conf.test
tests/pdemo-exec.test
tests/pdemo-inst.test
tests/pdemo-make.test
tests/pdemo/.cvsignore [new file with mode: 0644]
tests/pdemo/Makefile.am [new file with mode: 0644]
tests/pdemo/configure.ac [new file with mode: 0644]
tests/pdemo/foo.h [new file with mode: 0644]
tests/pdemo/longer_file_name_dlmain.c [new file with mode: 0644]
tests/pdemo/longer_file_name_foo.c [new file with mode: 0644]
tests/pdemo/longer_file_name_foo2.c [new file with mode: 0644]
tests/pdemo/longer_file_name_hell1.c [new file with mode: 0644]
tests/pdemo/longer_file_name_hell2.c [new file with mode: 0644]
tests/pdemo/longer_file_name_hello.c [new file with mode: 0644]
tests/pdemo/longer_file_name_main.c [new file with mode: 0644]
tests/quote.test
tests/sh.test
tests/suffix.test
tests/tagdemo-conf.test
tests/tagdemo-exec.test
tests/tagdemo-make.test
tests/tagdemo-shared.test
tests/tagdemo-static.test
tests/tagdemo/.cvsignore [new file with mode: 0644]
tests/tagdemo/Makefile.am [new file with mode: 0644]
tests/tagdemo/README [new file with mode: 0644]
tests/tagdemo/baz.cpp [new file with mode: 0644]
tests/tagdemo/baz.h [new file with mode: 0644]
tests/tagdemo/configure.ac [new file with mode: 0644]
tests/tagdemo/foo.cpp [new file with mode: 0644]
tests/tagdemo/foo.h [new file with mode: 0644]
tests/tagdemo/main.cpp [new file with mode: 0644]

index ab3c34bfdc272f6755f24c77c9ec2fc4594b6273..7f867562daac7b33ac379430230231bf2168b269 100644 (file)
@@ -10,43 +10,42 @@ CXX_TESTS = \
 F77_TESTS = \
        f77demo-static.test f77demo-make.test f77demo-exec.test \
        f77demo-conf.test f77demo-make.test f77demo-exec.test \
-       f77demo-shared.test f77demo-make.test f77demo-exec.test 
+       f77demo-shared.test f77demo-make.test f77demo-exec.test
 
 COMMON_TESTS = \
+       assign.test link.test link-2.test nomode.test \
+       quote.test sh.test suffix.test \
        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 \
+       depdemo-static.test depdemo-make.test depdemo-exec.test \
+       depdemo-inst.test depdemo-unst.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 deplibs.test \
-       depdemo-conf.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test depdemo-unst.test \
+       demo-inst.test demo-unst.test demo-deplibs.test \
+       depdemo-conf.test depdemo-make.test depdemo-exec.test \
+       depdemo-inst.test depdemo-unst.test \
        mdemo-conf.test mdemo-make.test mdemo-exec.test \
-       mdemo-inst.test mdemo-unst.test dryrun.test \
+       mdemo-inst.test mdemo-unst.test mdemo-dryrun.test \
+       mdemo2-conf.test mdemo2-make.test mdemo2-exec.test \
+       pdemo-conf.test pdemo-make.test pdemo-exec.test \
+       pdemo-inst.test pdemo-unst.test \
        demo-nofast.test demo-make.test demo-exec.test \
        demo-inst.test demo-unst.test \
+       depdemo-nofast.test depdemo-make.test depdemo-exec.test \
+       depdemo-inst.test depdemo-unst.test \
        demo-pic.test demo-make.test demo-exec.test \
        demo-nopic.test demo-make.test demo-exec.test \
-       depdemo-nofast.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test depdemo-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 noinst-link.test demo-unst.test \
-       depdemo-shared.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test build-relink2.test \
-       depdemo-unst.test \
+       demo-hardcode.test demo-relink.test demo-noinst-link.test \
+       demo-unst.test \
+       depdemo-shared.test depdemo-make.test depdemo-exec.test \
+       depdemo-inst.test depdemo-relink.test depdemo-unst.test \
        mdemo-shared.test mdemo-make.test mdemo-exec.test \
-       mdemo-inst.test mdemo-unst.test \
-       assign.test link.test link-2.test nomode.test \
-       quote.test sh.test suffix.test pdemo-conf.test \
-       pdemo-make.test pdemo-exec.test pdemo-inst.test \
-       mdemo-conf.test mdemo-make.test mdemo2-conf.test \
-       mdemo2-make.test mdemo2-exec.test
-
+       mdemo-inst.test mdemo-unst.test
 
 if HAVE_CXX
 if HAVE_F77
@@ -67,28 +66,61 @@ demo-conf.test: $(top_builddir)/libtool
 $(top_builddir)/libtool:
        cd $(top_builddir) && $(MAKE) all
 
-# We should export these variables when we build the libtool script.
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-FFLAGS = @FFLAGS@
-
 # Be sure to reexport important environment variables.
 TESTS_ENVIRONMENT = MAKE="$(MAKE)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
        CPPFLAGS="$(CPPFLAGS)" LD="$(LD)" LDFLAGS="$(LDFLAGS)" \
        LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
-       OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" FFLAGS="$(FFLAGS)" 
+       OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)" FFLAGS="$(FFLAGS)"
 
 EXTRA_DIST = defs $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS)
 
 # We need to remove any files that the above tests created.
 clean-local:
-       -test -f ../pdemo/Makefile && cd ../pdemo && $(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
-       -test -f ../tagdemo/Makefile && cd ../tagdemo && $(MAKE) distclean
-       -test -f ../f77demo/Makefile && cd ../f77demo && $(MAKE) distclean
+       -for dir in cdemo demo depdemo f77demo mdemo mdemo2 pdemo tagdemo;  \
+       do                                                                  \
+           test -f $$dir/Makefile && ( cd $$dir && $(MAKE) distclean; );   \
+       done
        rm -rf _inst
+
+## ------------ ##
+## package.m4.  ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+       {                                       \
+         echo '# Signature of the current package.'; \
+         echo 'm4_define([AT_PACKAGE_NAME],      [@PACKAGE_NAME@])'; \
+         echo 'm4_define([AT_PACKAGE_TARNAME],   [@PACKAGE_TARNAME@])'; \
+         echo 'm4_define([AT_PACKAGE_VERSION],   [@PACKAGE_VERSION@])'; \
+         echo 'm4_define([AT_PACKAGE_STRING],    [@PACKAGE_STRING@])'; \
+         echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+       } >$(srcdir)/package.m4
+
+## ------------ ##
+## Test suite.  ##
+## ------------ ##
+
+TESTSUITE_AT = \
+       testsuite.at \
+       demo.at fortran.at tools.at
+TESTSUITE = testsuite
+
+#EXTRA_DIST = $(TESTSUITE_AT) local.at atlocal.in package.m4
+
+#check-local: atconfig $(TESTSUITE)
+#      $(SHELL) $(srcdir)/$(TESTSUITE)
+
+#clean-local:
+#      $(srcdir)/testsuite --clean
+
+AUTOM4TE = autom4te
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(srcdir)/$(TESTSUITE): $(srcdir)/package.m4 local.at $(TESTSUITE_AT)
+       $(AUTOTEST) -I $(srcdir) testsuite.at -o $@
+
+atconfig: $(top_builddir)/config.status
+       cd $(top_builddir) && ./config.status tests/$@
+
+# Run the test suite on the *installed* tree.
+#installcheck-local:
+       $(SHELL) $(srcdir)/$(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
index b9704973fa0ae895d11f3550efd16ad542cd3313..120a67786ecd7194c2380b9e7249ef7922ea9b31 100755 (executable)
@@ -2,19 +2,34 @@
 # assign.test - check that we don't put break or continue on the same
 #               line as an assignment
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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 test -e isn't used in our portable shell scripts.
-if $EGREP -n '[^        ]=[^    ].*(break|continue)' $srcdir/../ltmain.sh; then
-  echo "cannot use \`break' or \`continue' on the same line as an assignment"
-  exit 1
-fi
+$EGREP -n '[^   ]=[^    ].*(break|continue)' $srcdir/../ltmain.sh \
+  && func_fail "cannot use \`break' or \`continue' on the same line as an assignment"
 
-exit 0
+exit $EXIT_SUCCESS
diff --git a/tests/build-relink.test b/tests/build-relink.test
deleted file mode 100755 (executable)
index 015c886..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-#! /bin/sh
-# build-relink.test - check to see whether shlibpath overrides runpath
-
-# Test script header.
-need_prefix=yes
-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 $prefix/lib/libhello.la && cd ../demo && test -f libhello.la; then :
-else
-  echo "You must run demo-inst.test before $0" 1>&2
-  exit 77
-fi
-
-# Check to make sure we have a dynamic library.
-library_names=NONE
-eval `grep '^library_names=' ./libhello.la 2>/dev/null`
-
-if test "$library_names" = NONE; then
-  echo "library_names not set in ../demo/libhello.la" 1>&2
-  exit 1
-elif test -z "$library_names"; then
-  echo "= Exiting: ../demo/libhello.la is not a shared library"
-  exit 77
-fi
-
-# Unfortunately, we need access to libtool internals for this test.
-objdir=NONE
-eval `grep '^objdir=' ./libtool 2>/dev/null`
-if test "$objdir" = NONE; then
-  echo "objdir not set in ../demo/libtool" 1>&2
-  exit 1
-fi
-
-shlibpath_overrides_runpath=NONE
-eval `grep '^shlibpath_overrides_runpath=' ./libtool 2>/dev/null`
-if test "$shlibpath_overrides_runpath" = NONE; then
-  echo "shlibpath_overrides_runpath not set in ../demo/libtool" 1>&2
-  exit 1
-fi
-
-hardcode_action=NONE
-eval `grep '^hardcode_action=' ./libtool 2>/dev/null`
-if test "$hardcode_action" = NONE; then
-  echo "hardcode_action not set in ../demo/libtool" 1>&2
-  exit 1
-fi
-
-hardcode_direct=NONE
-eval `grep '^hardcode_direct=' ./libtool 2>/dev/null`
-if test "$hardcode_direct" = NONE; then
-  echo "hardcode_direct not set in ../demo/libtool" 1>&2
-  exit 1
-fi
-
-hardcode_into_libs=NONE
-eval `grep '^hardcode_into_libs=' ./libtool 2>/dev/null`
-if test "$hardcode_into_libs" = NONE; then
-  echo "hardcode_into_libs not set in ../demo/libtool" 1>&2
-  exit 1
-fi
-
-./hell # so that it links on-demand if needed
-
-echo "removing libhello.la from ../demo"
-rm -f libhello.la $objdir/libhello.*
-
-echo "running ../demo/hell"
-if ./hell; then
-  :
-elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; then
-  echo "Ok, uninstalled programs fail after uninstalled libraries are removed"
-  echo "This works in other configurations, but not in this particular one"
-else
-  echo "= Exiting: ../demo/hell does not run, maybe libhello was not installed"
-  exit 1
-fi
-
-echo "linking a broken ../demo/libhello.la"
-if $make libhello.la libhello_la_OBJECTS=hello.lo; then
-  :
-else
-  echo "= Exiting: cannot link broken libhello.la"
-  exit 1
-fi
-rm -f libhello.la
-
-echo "running ../demo/hell with broken libhello.la"
-if (./hell) 2>&1; then
-  echo "= Exiting: ../demo/hell runs even though libhello.la is incomplete"
-  echo "shlibpath_overrides_runpath should be set to no"
-  exit 1
-else
-  echo "Failed, as expected"
-fi
-
-if test "x$hardcode_action" = xrelink; then
-  echo "= Exiting: install-time relinking is required"
-  exit 0
-fi
-
-if test "$shlibpath_overrides_runpath" != yes; then
-  rm -f $objdir/lt-hell$EXEEXT || exit 1
-  cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT || exit 1
-  echo "running ../demo/hell with installed libhello.la"
-  if ./hell; then
-    echo "Worked, as expected"
-  else
-    echo "shlibpath_overrides_runpath should be set to yes"
-    status=1
-  fi
-  rm -f $objdir/lt-hell$EXEEXT
-fi
-
-exit $status
diff --git a/tests/build-relink2.test b/tests/build-relink2.test
deleted file mode 100755 (executable)
index d0e7c72..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-#! /bin/sh
-# build-relink2.test - check to see whether shlibpath overrides runpath
-
-# Test script header.
-need_prefix=yes
-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 $prefix/lib/extra/libl3.la || test -f $prefix/lib/libl3.la) \
-    && cd ../depdemo && test -f l3/libl3.la; then :
-else
-  echo "You must run depdemo-inst.test before $0" 1>&2
-  exit 77
-fi
-
-# Check to make sure we have a dynamic library.
-library_names=NONE
-eval `grep '^library_names=' ./l3/libl3.la 2>/dev/null`
-
-if test "$library_names" = NONE; then
-  echo "library_names not set in ../depdemo/l3/libl3.la" 1>&2
-  exit 1
-elif test -z "$library_names"; then
-  echo "= Exiting: ../depdemo/l3/libl3.la is not a shared library"
-  exit 77
-fi
-
-# Unfortunately, we need access to libtool internals for this test.
-objdir=NONE
-eval `grep '^objdir=' ./libtool 2>/dev/null`
-if test "$objdir" = NONE; then
-  echo "objdir not set in ../depdemo/libtool" 1>&2
-  exit 1
-fi
-
-shlibpath_overrides_runpath=NONE
-eval `grep '^shlibpath_overrides_runpath=' ./libtool 2>/dev/null`
-if test "$shlibpath_overrides_runpath" = NONE; then
-  echo "shlibpath_overrides_runpath not set in ../depdemo/libtool" 1>&2
-  exit 1
-fi
-
-hardcode_action=NONE
-eval `grep '^hardcode_action=' ./libtool 2>/dev/null`
-if test "$hardcode_action" = NONE; then
-  echo "hardcode_action not set in ../depdemo/libtool" 1>&2
-  exit 1
-fi
-
-hardcode_direct=NONE
-eval `grep '^hardcode_direct=' ./libtool 2>/dev/null`
-if test "$hardcode_direct" = NONE; then
-  echo "hardcode_direct not set in ../depdemo/libtool" 1>&2
-  exit 1
-fi
-
-hardcode_into_libs=NONE
-eval `grep '^hardcode_into_libs=' ./libtool 2>/dev/null`
-if test "$hardcode_into_libs" = NONE; then
-  echo "hardcode_into_libs not set in ../depdemo/libtool" 1>&2
-  exit 1
-fi
-
-./depdemo # so that it links on-demand if needed
-
-echo "removing libl3.la from ../depdemo/l3"
-rm -rf l3/libl3.la l3/$objdir
-
-echo "running ../depdemo/depdemo"
-if ./depdemo ||
-   # On AIX 4.1, when the installed copy of libl3 is loaded, it brings
-   # with it the installed copies of libl1 and libl2, with disjoint
-   # counters var_l1 and var_l2.  This is arguably acceptable behavior,
-   # but it's definitely not enough of a reason for the test to fail.
-   ./depdemo -alt; then
-  :
-elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; then
-  echo "Ok, uninstalled programs fail after uninstalled libraries are removed"
-  echo "This works in other configurations, but not in this particular one"
-else
-  echo "= Exiting: ../depdemo/depdemo does not run, maybe libl3 was not installed"
-  exit 1
-fi
-
-echo "linking a broken ../depdemo/l3/libl3.la"
-if (cd l3; $make libl3.la libl3_la_OBJECTS=../l2/l2.lo); then
-  :
-else
-  echo "= Exiting: cannot link broken libl3.la"
-  exit 1
-fi
-rm -f l3/libl3.la
-
-echo "running ../depdemo/depdemo with broken libl3.la"
-if (./depdemo) 2>&1; then
-  echo "= Exiting: ../depdemo/depdemo runs even though libl3.la is incomplete"
-  echo "shlibpath_overrides_runpath should be set to no"
-  exit 1
-else
-  echo "Failed, as expected"
-fi
-
-if test "x$hardcode_action" = xrelink; then
-  echo "= Exiting: install-time relinking is required"
-  exit 0
-fi
-
-if test "$shlibpath_overrides_runpath" != yes; then
-  rm -f $objdir/lt-depdemo || exit 1
-  cp $objdir/depdemo $objdir/lt-depdemo || exit 1
-  echo "running ../depdemo/depdemo with installed libl3.la"
-  if ./depdemo; then
-    echo "Worked, as expected"
-  else
-    echo "shlibpath_overrides_runpath should be set to yes"
-    status=1
-  fi
-  rm -f $objdir/lt-depdemo
-fi
-
-exit $status
index be65b76915fe02b824cdc60811582aece964718d..6df86fd05f209ce0677a567f1bdd11b3cd289eef 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# cdemo-conf.test - try configuring the ../cdemo subdirectory
+# cdemo-conf.test - try configuring the cdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../cdemo || mkdir ../cdemo
-
-# Change to our build directory.
-cd ../cdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../cdemo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../cdemo/configure --srcdir=$srcdir/../cdemo --prefix=$prefix || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "cdemo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
index f558fdc23aa1ea15fe3901dd28abaa548c7127ba..612162995aa12f465ff32923b5f01aa5e273cfe4 100755 (executable)
@@ -1,28 +1,36 @@
 #! /bin/sh
-# cdemo-exec.test - check that programs in the ../cdemo subdirectory are viable
+# cdemo-exec.test - check that programs in the cdemo subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../cdemo/cdemo$EXEEXT; then :
-else
-  echo "You must run cdemo-make.test before running $0" 1>&2
-  exit 77
-fi
+func_require "cdemo-make" "cdemo/cdemo$EXEEXT"
 
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../cdemo"
-
-if ../cdemo/cdemo; then :
-else
-  echo "$0: cannot execute ../cdemo/cdemo" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "cdemo/cdemo"
 
-exit $status
+exit $exec_status
index 7a357000c838e55d5d40fadad14df32c7487159e..cb7d5dd4378f55e17c675f72274e513363716322 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# cdemo-make.test - try building in the ../cdemo subdirectory
+# cdemo-make.test - try building in the cdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../cdemo/Makefile; then :
-else
-  echo "You must run cdemo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "cdemo-conf" "cdemo/Makefile"
 
-# Change to our build directory.
-cd ../cdemo || exit 1
+func_rmprefixdir
+func_cd "cdemo"
+func_make
 
-# Do the actual build.
-echo "Making in ../cdemo"
-$make || exit 1
 exit 0
index 3b38df30e0f64b06269e4ed812270c7bfe4f8b4b..87704da62c6861fa03e3aaff8b7f90b80a77abb4 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# cdemo-conf.test - try configuring the ../cdemo subdirectory
+# cdemo-shared.test - try configuring the cdemo subdirectory for shared libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../cdemo || mkdir ../cdemo
-
-# Change to our build directory.
-cd ../cdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../cdemo (prefix=$prefix) with --disable-static"
-${CONFIG_SHELL-/bin/sh} $srcdir/../cdemo/configure --srcdir=$srcdir/../cdemo --prefix=$prefix --disable-static || exit 1
-
-if grep '^build_old_libs=no' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "cdemo"
+func_make_distclean
+func_configure "--disable-static"
+func_check_static_shared "no" "yes"
 
 exit 0
index e81b40651d62454b45cf84ac44fbd41cdd9f621e..447a4cb77add4046e56299e4bc06979beed75a2c 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# cdemo-conf.test - try configuring the ../cdemo subdirectory
+# cdemo-static.test - try configuring the cdemo subdirectory for static libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../cdemo || mkdir ../cdemo
-
-# Change to our build directory.
-cd ../cdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../cdemo (prefix=$prefix) with --disable-shared"
-${CONFIG_SHELL-/bin/sh} $srcdir/../cdemo/configure --srcdir=$srcdir/../cdemo --prefix=$prefix --disable-shared || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=no' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "cdemo"
+func_make_distclean
+func_configure "--disable-shared"
+func_check_static_shared "yes" "no"
 
 exit 0
diff --git a/tests/cdemo/.cvsignore b/tests/cdemo/.cvsignore
new file mode 100644 (file)
index 0000000..90cb964
--- /dev/null
@@ -0,0 +1,14 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+conftest*
+libtool
+*.lo
+*.la
+cdemo
diff --git a/tests/cdemo/Makefile.am b/tests/cdemo/Makefile.am
new file mode 100644 (file)
index 0000000..3ac137d
--- /dev/null
@@ -0,0 +1,40 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+noinst_LTLIBRARIES = libfoo.la
+
+libfoo_la_SOURCES = foo.c
+libfoo_la_LIBADD = $(LIBM)
+libfoo_la_LDFLAGS = -no-undefined
+
+noinst_HEADERS = foo.h
+
+bin_PROGRAMS = cdemo
+
+cdemo_SOURCES = main.c
+cdemo_LDADD = libfoo.la
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
diff --git a/tests/cdemo/README b/tests/cdemo/README
new file mode 100644 (file)
index 0000000..fd3e418
--- /dev/null
@@ -0,0 +1,4 @@
+This is cdemo, an example package that uses GNU libtool with an
+Automake-generated environment to build two simple libraries and programs.
+
+It demonstrates how to build convenience libraries
diff --git a/tests/cdemo/configure.ac b/tests/cdemo/configure.ac
new file mode 100644 (file)
index 0000000..0f3830d
--- /dev/null
@@ -0,0 +1,65 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([cdemo], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([main.c])
+AC_CONFIG_AUX_DIR([../../config])
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ------------------ ##
+## C compiler checks. ##
+## ------------------ ##
+AC_PROG_CC
+
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AM_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+
+## ---------------------------- ##
+## C headers required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_HEADERS([math.h])
+
+
+## ---------------------------- ##
+## Libraries required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_LIBM
+AC_SUBST([LIBM])
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/cdemo/foo.c b/tests/cdemo/foo.c
new file mode 100644 (file)
index 0000000..3854c43
--- /dev/null
@@ -0,0 +1,40 @@
+/* foo.c -- trivial test library
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+int
+foo()
+{
+  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
+  return FOO_RET;
+}
+
+int
+hello()
+{
+  printf ("** This is libfoo **\n");
+  return HELLO_RET;
+}
diff --git a/tests/cdemo/foo.h b/tests/cdemo/foo.h
new file mode 100644 (file)
index 0000000..48dc912
--- /dev/null
@@ -0,0 +1,29 @@
+/* foo.h -- interface to the libfoo* libraries
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+/* Silly constants that the functions return. */
+#define HELLO_RET 0xe110
+#define FOO_RET 0xf00
+
+#endif /* !_FOO_H_ */
diff --git a/tests/cdemo/main.c b/tests/cdemo/main.c
new file mode 100644 (file)
index 0000000..89da831
--- /dev/null
@@ -0,0 +1,43 @@
+/* main.c -- cdemo test program
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+#include <stdio.h>
+
+
+int
+main (argc,argv)
+  int argc;
+  char **argv;
+{
+  int value;
+
+  printf ("Welcome to GNU libtool cdemo!\n");
+
+  value = hello();
+  printf ("hello returned: %i\n", value);
+  if (value == HELLO_RET)
+    printf("hello is ok!\n");
+
+  if (foo () == FOO_RET)
+    printf("foo is ok!\n");
+
+  return 0;
+}
index 8713e853f06f5373b4a166afeb49c7d42cdaa34e..3ad5d6c8cc5d686f148dea4a9d390accb1bc6b9e 100644 (file)
@@ -1,6 +1,7 @@
 # -*- sh -*-
 # Defines for Libtool testing environment.
 # Gord Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+# Gary V. Vaughan <gary@gnu.org>, 2003
 
 # Check that srcdir is set to an absolute path.
 case "$srcdir" in
@@ -8,11 +9,16 @@ case "$srcdir" in
 *) srcdir=`cd $srcdir && pwd` ;;
 esac
 
-progname=`echo "$0" | sed 's%^.*/%%'`
+sed_basename='s,^.*/,,g'
+sed_dirname='s,/[^/]*$,,'
+
+progname=`echo "$0" | sed "$sed_basename"`
 
 libtool="../libtool"
+prefix="./_inst"
 make="${MAKE-make}"
 SHELL="${CONFIG_SHELL-/bin/sh}"
+MKDIR="${MKDIR-mkdir}"
 
 if echo a | (grep -E '(a|b)') >/dev/null 2>&1; then
   EGREP='grep -E'
@@ -25,22 +31,6 @@ else
   FGREP='fgrep'
 fi
 
-prefix="./_inst"
-if test "$need_prefix" = yes; then
-  # An absolute path to a test installation directory.
-  test -d $prefix || mkdir $prefix
-  prefix=`cd $prefix && pwd`
-else
-  test -d $prefix && rm -rf $prefix
-  prefix=NONE
-fi
-
-# Extract CC from the libtool configuration
-eval `$libtool --config | grep '^CC='`
-
-# Extract host from the libtool configuration
-eval `$libtool --config | grep '^host='`
-
 # Disable usage of config.site for autoconf, unless DJGPP is present.
 # The DJGPP port of autoconf requires config.site, to work correctly.
 if test -z "$DJGPP"; then
@@ -48,10 +38,272 @@ if test -z "$DJGPP"; then
 fi
 
 # See how redirections should work.
+test "${VERBOSE+set}" != "set" && VERBOSE=no
 case "$VERBOSE" in
 NO | no | 0 | "")
   exec > /dev/null 2>&1
   ;;
 esac
 
+
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_SKIP=77
+
+# func_msg arg...
+# Echo message with prefix.
+func_msg ()
+{
+    echo "=" ${1+"$@"}
+}
+
+# func_error arg...
+# Echo message to standard error.
+func_error ()
+{
+    echo ${1+"$@"} 1>&2
+}
+
+# func_skip arg...
+# Echo message to standard error, and skip the rest of this test.
+func_skip ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_SKIP
+}
+
+# func_fail arg...
+# Echo message to standard error, and fail this test.
+func_fail ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_get_config varname_list src [failp] [regex]
+func_get_config ()
+{
+  my_varname_list="$1"
+  my_src="$2"
+  my_failp="false";  test -z "$3" || my_failp=:
+  my_regex="$4"
+
+  my_exitp=false
+  for my_varname in $my_varname_list; do
+    test -z "$4" && my_regex="^${my_varname}="
+
+    eval $my_varname=NONE
+    eval `eval $my_src | eval grep \"$my_regex\"`
+
+    if eval test x\"\$$my_varname\" = xNONE; then
+      func_error "$my_varname not set in \`$my_src'"
+      $my_failp && my_exitp=:
+    fi
+  done
+
+  $my_exitp && exit $EXIT_FAILURE
+}
+
+
+# Extract objext from the libtool configuration
+func_get_config "objext" "$libtool --config" ": fatal"
+
+# Extract objdir from the libtool configuration
+func_get_config "objdir" "$libtool --config" ": fatal"
+
+# Extract CC from the libtool configuration
+func_get_config "CC" "$libtool --config" ": fatal"
+
+# Extract host from the libtool configuration
+func_get_config "host" "$libtool --config" ": fatal"
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    grep "$1" "$2" >/dev/null 2>&1
+}
+
+# func_mkdir_p dir
+# Make sure the entire path to DIR is available.
+func_mkdir_p ()
+{
+    my_dir=$1
+    my_dirs=
+
+    while test ! -d "$my_dir"; do
+      my_dirs="$my_dir $my_dirs"
+      case $my_dir in */*) ;; *) break ;; esac
+      my_dir=`echo "$my_dir" | sed "$sed_dirname"`
+    done
+   test ! -n "$my_dirs" || $MKDIR $my_dirs
+}
+
+# func_mkprefixdir
+func_mkprefixdir ()
+{
+    # An absolute path to a test installation directory.
+    func_mkdir_p "$prefix"
+    prefix=`cd $prefix && pwd`
+}
+
+# func_rmprefixdir
+func_rmprefixdir ()
+{
+    test -d $prefix && rm -rf $prefix
+    prefix=NONE
+}
+
+# func_cd dir
+# Make sure a directory exists, and then change to it.
+func_cd ()
+{
+    my_dir="$1"
+
+    # Maybe we have a VPATH build, in which case, create a new subdir.
+    func_mkdir_p "$my_dir"
+
+    # Change to our build directory.
+    cd "$my_dir" || exit 1
+}
+
+
+# func_require prereq file [...]
+# If FILE does not exist, give a fatal error regarding running PREREQ first.
+func_require ()
+{
+    my_prereq="$1"; shift
+    my_files=${1+"$@"}
+
+    for my_file in $my_files; do
+      test -f "$my_file" \
+        || func_skip "You must run ${my_prereq}.test before running $0"
+    done
+}
+
+# func_configure [args ...]
+# Configure the demonstration.
+func_configure ()
+{
+    my_args=${1+"$@"}
+    my_dir=`pwd | sed "$sed_basename"`
+    my_testdir="$srcdir/$my_dir"
+
+    test -n "$my_args" && my_args=" $my_args"
+    func_msg "Configuring in $my_dir (--prefix=$prefix$my_args)"
+
+    my_args="--srcdir="\""$my_testdir"\"" --prefix="\""$prefix"\""$my_args"
+
+    eval $SHELL "$my_testdir/configure" $my_args || exit $EXIT_FAILURE
+}
+
+# func_check_static_shared staticp sharedp
+# Determine whether the generated libtool script is configured properly
+# for the expected STATICP and SHAREDP library building
+func_check_static_shared ()
+{
+    my_staticp="$1"
+    my_sharedp="$2"
+
+    if func_grep "^build_old_libs=$staticp" libtool &&
+       func_grep "^build_libtool_libs=$sharedp" libtool; then :
+    else
+      rm -f Makefile
+      exit $EXIT_FAIL
+    fi
+}
+
+
+# func_make [args ...]
+# Do the actual build.
+func_make ()
+{
+    my_args=${1+"$@"}
+    my_dir=`pwd | sed "$sed_basename"`
+
+    func_msg "Running \`$make $my_args' in $my_dir"
+
+    eval $make $my_args || exit $EXIT_FAIL
+}
+
+
+# func_distclean
+# Possibly clean up the distribution.
+func_make_distclean ()
+{
+    if test -f Makefile; then
+      func_make distclean
+    fi
+    rm -rf autom4te.cache config.cache
+}
+
+
+# func_make_uninstall
+# See that there were no files leftover in $prefix.
+# Ignore dotfiles, so that .nfsXXX files don't screw up the test.
+func_make_uninstall ()
+{
+    func_make uninstall
+
+    leftovers=`find $prefix ! -type d ! -name '.*' -print`
+    if test -n "$leftovers"; then
+      func_msg "Leftover after make uninstall:"
+      ls -l $leftovers
+      exit 1
+    fi
+}
+
+
+# func_exec_init mode
+func_exec_init ()
+{
+    func_msg "Executing $1 programs in $my_dir"
+
+    # Windows hosts search for dlls in the command path
+    PATH=$prefix/lib:$PATH
+
+    exec_status=$EXIT_SUCCESS
+}
+
+# func_exec_check program [msg ...]
+# Check to see if PROGRAM was built. If not display MSG.
+func_exec_check ()
+{
+    my_program="$1"
+
+    if test -f "$my_program"; then :
+    else
+      shift
+      func_error "$0: $my_program did not build ${1+$@}"
+      exec_status=$EXIT_FAILURE
+    fi
+}
+
+# func_exec program [exp_output] [msg ...]
+# Check to see if PROGRAM really runs, and produces EXP_OUTPUT if given.
+# If not display MSG.
+func_exec ()
+{
+    my_program="$1"
+    my_exp_output="$2"
+    my_dir=`pwd | sed "$sed_basename"`
+
+    test -n "$my_exp_output" \
+      && my_exp_output="| $EGREP -e "\""$my_exp_output"\"
+
+    if eval $my_program $my_exp_output; then :
+    else
+      shift; shift
+      func_error "$0: cannot execute $my_program ${1+$@}"
+
+      # Simple check to see if they are superuser.
+      if test $exec_status = $EXIT_FAILURE || test -w /; then :
+      else
+        func_msg "You may need to run $0 as the superuser."
+      fi
+      exec_status=$EXIT_FAILURE
+    fi
+}
+
 echo "=== Running $progname"
index 689644528afd4ecdd8f1d5ec85b66977df4da485..3ca4d475489360b2255a6fc80e3334526a1f56c0 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# demo-conf.test - try configuring the ../demo subdirectory
+# demo-conf.test - try configuring the demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# 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 Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../demo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --build=$host || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "demo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
diff --git a/tests/demo-deplibs.test b/tests/demo-deplibs.test
new file mode 100755 (executable)
index 0000000..d0aec51
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# demo-deplibs.test - check whether the shared library check method is OK
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+if test -z "$srcdir"; then
+  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
+  test "$srcdir" = "$0" && srcdir=.
+fi
+. $srcdir/defs || exit 1
+
+func_require "demo-conf" "demo/libhello.la"
+
+func_mkprefixdir
+func_cd "demo"
+echo "linking a shared library against a static library"
+func_make "deplibs-check"
+func_exec_init "uninstalled"
+func_exec_check "hell0$EXEEXT" "check your deplibs_check_method"
+func_exec "./hell0" "" "check your deplibs_check_method"
+
+exit $exec_status
index 9402f443c8d1d2b50a5864ba15f0a00b3c7f5c88..b262d96ca3738b66b7ce0e973658b63ffe9f192a 100755 (executable)
@@ -1,41 +1,38 @@
 #! /bin/sh
 # demo-exec.test - check that programs in the ../demo subdirectory are viable
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
 
-if test -f ../demo/hell$EXEEXT; then :
-else
-  echo "You must run demo-make.test before running $0" 1>&2
-  exit 77
-fi
+func_require "demo-make" "demo/hell$EXEEXT"
 
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../demo"
-
-status=0
-if ../demo/hell_static| grep 'Welcome to GNU Hell'; then :
-else
-  echo "$0: cannot execute ../demo/hell_static" 1>&2
-  status=1
-fi
-
-if ../demo/hell | grep 'Welcome to GNU Hell'; then :
-else
-  echo "$0: cannot execute ../demo/hell" 1>&2
-  status=1
-fi
-
-if ../demo/helldl | $EGREP -e '(Welcome to .*GNU Hell|unsupported)'; then :
-else
-  echo "$0: cannot execute ../demo/helldl" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "demo/hell_static" 'Welcome to GNU Hell'
+func_exec "demo/hell" 'Welcome to GNU Hell'
+func_exec "demo/helldl" '(Welcome to .*GNU Hell|unsupported)'
 
-exit $status
+exit $exec_status
similarity index 52%
rename from tests/hardcode.test
rename to tests/demo-hardcode.test
index f264e03bda2f22f3e0082aadbd8207269064242f..3ab67eae7a24baadfd2664694dcc681c01a8bf5e 100755 (executable)
@@ -1,83 +1,57 @@
 #! /bin/sh
-# hardcode.test - check to see what the system linker hardcodes
+# demo-hardcode.test - check to see what the system linker hardcodes
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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 $prefix/lib/libhello.la && cd ../demo; then :
-else
-  echo "You must run demo-inst.test before $0" 1>&2
-  exit 77
-fi
+func_require "demo-inst" "$prefix/lib/libhello.la"
 
-# Unfortunately, we need access to libtool internals for this test.
-objdir=NONE
-eval `grep '^objdir=' ./libtool 2>/dev/null`
-if test "$objdir" = NONE; then
-  echo "objdir not set in ../demo/libtool" 1>&2
-  exit 1
-fi
+func_mkprefixdir
+func_cd "demo"
 
 # Check to make sure we have a dynamic library.
-library_names=NONE
-eval `grep '^library_names=' ./libhello.la 2>/dev/null`
-
-if test "$library_names" = NONE; then
-  echo "library_names not set in ../demo/libhello.la" 1>&2
-  exit 1
-elif test -z "$library_names"; then
-  echo "= Exiting: ../demo/libhello.la is not a shared library"
-  exit 0
-fi
-
-echo "= Running $make hardcode in ../demo"
-$make hardcode || exit 1
+func_get_config "library_names" "cat ./libhello.la"
+test -z "$library_names" \
+  && func_skip "Exiting: demo/libhello.la is not a shared library"
 
-echo "= Finding libtool.m4's guesses at hardcoding values"
-status=0
-hardcode_direct=NONE
-hardcode_minus_L=NONE
-hardcode_shlibpath_var=NONE
-hardcode_libdir_flag_spec=NONE
+func_make "hardcode"
 
 # Suck in all the hardcode_* variable settings.
-eval `./libtool --config | grep '^hardcode_' 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
-
-if test "$hardcode_libdir_flag_spec" = NONE; then
-  echo "hardcode_libdir_flag_spec not set in ../demo/libtool" 1>&2
-  status=1
-fi
-
-test $status -eq 0 || exit $status
+func_msg "Finding libtool.m4's guesses at hardcoding values"
+func_get_config 'hardcode_direct
+hardcode_minus_L
+hardcode_shlibpath_var
+hardcode_libdir_flag_spec' "libtool --config" ": fatal"
 
 echo "= Searching for hardcoded library directories in each program"
 for file in hc-*; do
   case "$file" in
-  hc-direct) expected="$hardcode_direct" ;;
+  hc-direct)  expected="$hardcode_direct" ;;
   hc-libpath) expected="$hardcode_shlibpath_var" ;;
-  hc-minusL) expected="$hardcode_minus_L" ;;
+  hc-minusL)  expected="$hardcode_minus_L" ;;
 
   hc-libflag)
     if test -n "$hardcode_libdir_flag_spec"; then
@@ -117,7 +91,7 @@ for file in hc-*; do
       echo "$objdir was hardcoded in \`$file', as libtool expected"
     else
       echo "$objdir was hardcoded in \`$file', which fooled libtool" 1>&2
-      status=1
+      exit_status=1
     fi
     ;;
 
@@ -126,7 +100,7 @@ for file in hc-*; do
       echo "$objdir was not hardcoded in \`$file', as libtool expected"
     else
       echo "$objdir was not hardcoded in \`$file', which fooled libtool" 1>&2
-      status=1
+      exit_status=1
     fi
     ;;
 
@@ -135,10 +109,10 @@ for file in hc-*; do
       echo "\`$file' was not linked properly, as libtool expected"
     else
       echo "\`$file' was not linked properly, which fooled libtool" 1>&2
-      status=1
+      exit_status=1
     fi
     ;;
   esac
 done
 
-exit $status
+exit $exit_status
index 9e38d9d0e9f6c599bd3d95ced4c6b9a624fd2718..98e762aeaaf0c01648e5b728fcfd565965a84c92 100755 (executable)
@@ -1,58 +1,40 @@
 #! /bin/sh
-# demo-inst.test - try installing from the ../demo subdirectory
+# demo-inst.test - try installing from the demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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$EXEEXT; then :
-else
-  echo "You must run demo-make.test before $0" 1>&2
-  exit 77
-fi
-
-# Change to our build directory.
-cd ../demo || exit 1
-
-echo "= Running $make install in ../demo"
-$make install || exit 1
-
-echo "= Executing installed programs"
-status=0
-if $prefix/bin/hell_static | grep 'Welcome to GNU Hell'; then :
-else
-  echo "$0: cannot execute $prefix/bin/hell_static" 1>&2
-  status=1
-fi
+func_require "demo-make" "demo/hell$EXEEXT"
 
-if $prefix/bin/hell | grep 'Welcome to 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
-  status=1
-fi
-
-if $prefix/bin/helldl | $EGREP -e '(Welcome to .*GNU Hell|unsupported)'; then :
-else
-  echo "$0: cannot execute $prefix/bin/helldl" 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
-  status=1
-fi
+func_mkprefixdir
+func_cd "demo"
+func_make "install"
+func_exec_init "installed"
+func_exec "$prefix/bin/hell_static" 'Welcome to GNU Hell'
+func_exec "$prefix/bin/hell" 'Welcome to GNU Hell'
+func_exec "$prefix/bin/helldl" '(Welcome to .*GNU Hell|unsupported)'
 
 exit $status
index 8a4a4ba855e9382f5d819983c95cb613d9c15922..7dedcbf6a49d6933684b65e0b4f711f5127e6cef 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# demo-make.test - try building in the ../demo subdirectory
+# demo-make.test - try building in the demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../demo/Makefile; then :
-else
-  echo "You must run demo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "demo-conf" "demo/Makefile"
 
-# Change to our build directory.
-cd ../demo || exit 1
+func_rmprefixdir
+func_cd "demo"
+func_make
 
-# Do the actual build.
-echo "Making in ../demo"
-$make || exit 1
 exit 0
index 73ed59fd7a299659f59e65c1d24a5db65e3df615..01af9638920904014a933e3fcba845287e5d4d3b 100755 (executable)
@@ -1,34 +1,40 @@
 #! /bin/sh
 # demo-nofast.test - try configuring the ../demo subdirectory
 
-# Test script header.
-need_prefix=yes
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
 
-# 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 Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../demo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --build=$host --enable-fast-install=no || exit 1
+func_mkprefixdir
+func_cd "demo"
+func_make_distclean
+func_configure "--enable-fast-install=no"
 
-if grep '^hardcode_action=relink' libtool > /dev/null; then
-  rm -f Makefile && exit 77
+if func_grep '^hardcode_action=relink' libtool; then
+  rm -f Makefile
+  exit 77
 fi
 
 exit 0
diff --git a/tests/demo-noinst-link.test b/tests/demo-noinst-link.test
new file mode 100755 (executable)
index 0000000..f87f740
--- /dev/null
@@ -0,0 +1,62 @@
+#! /bin/sh
+# demo-noinst-link.test - make sure we do not link with an installed
+# library when an uninstalled one is to be used
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+if test -z "$srcdir"; then
+  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
+  test "$srcdir" = "$0" && srcdir=.
+fi
+. $srcdir/defs || exit 1
+
+func_restore_files ()
+{
+    mv -f "$objdir"/temp/libs/* "$objdir"
+    mv -f "$objdir/temp/libhello.la" "$objdir/temp/hell$EXEEXT" .
+    rm -rf "$objdir/temp"
+}
+
+func_save_files ()
+{
+    func_mkdir_p "$objdir/temp/libs"
+    cp -f libhello.la "hell$EXEEXT" "$objdir/temp"
+    cp -f "$objdir"/* "$objdir"/temp/libs
+    trap "func_restore_files" 0 1 2 13 15
+}
+
+func_require "demo-inst" "$prefix/lib/libhello.la"
+
+func_mkprefixdir
+func_cd "demo"
+func_save_files
+
+func_msg "removing \`libhello.la' and \`hell' from demo"
+rm -f libhello.la "hell$EXEEXT"
+
+status=$EXIT_SUCCESS
+func_msg "linking \`hell' with a broken \`demo/libhello.la'"
+if $make "hell$EXEEXT" libhello_la_OBJECTS=hello.lo; then
+  func_msg "Succeeded: this means the installed library was used, which is wrong"
+  status=$EXIT_FAILURE
+fi
+
+exit $status
index f2a4fa6623779835e609b539a46bbab32ce2d592..c31e18116e9bdf1c9b0cc45ccdd97ab60c8ace58 100755 (executable)
@@ -1,30 +1,35 @@
 #! /bin/sh
 # demo-nopic.test - try configuring the ../demo subdirectory
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
 
-# 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 Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../demo (prefix=$prefix) with --without-pic"
-${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --build=$host --with-pic=no || exit 1
+func_rmprefixdir
+func_cd "demo"
+func_make_distclean
+func_configure "--with-pic=no"
 
 exit 0
index 69565bc61c3040b483ed931db8e5594497d21404..cd4c4f91c458c52eceac8bc9377ea8696037a617 100755 (executable)
@@ -1,30 +1,35 @@
 #! /bin/sh
 # demo-pic.test - try configuring the ../demo subdirectory
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
 
-# 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 Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../demo (prefix=$prefix) with --with-pic"
-${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --build=$host --with-pic=yes || exit 1
+func_rmprefixdir
+func_cd "demo"
+func_make_distclean
+func_configure "--with-pic=yes"
 
 exit 0
diff --git a/tests/demo-relink.test b/tests/demo-relink.test
new file mode 100755 (executable)
index 0000000..5162069
--- /dev/null
@@ -0,0 +1,106 @@
+#! /bin/sh
+# demo-relink.test - check to see whether shlibpath overrides runpath
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+if test -z "$srcdir"; then
+  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
+  test "$srcdir" = "$0" && srcdir=.
+fi
+. $srcdir/defs || exit 1
+
+func_restore_files ()
+{
+    mv -f "$objdir"/temp/libs/* "$objdir"
+    mv -f "$objdir/temp/libhello.la" .
+    rm -rf "$objdir/temp"
+}
+
+func_save_files ()
+{
+    func_mkdir_p "$objdir/temp/libs"
+    cp -f libhello.la "$objdir/temp"
+    cp -f "$objdir"/libhello.* "$objdir/lt-hell$EXEEXT" "$objdir/temp/libs"
+    trap "func_restore_files" 0 1 2 13 15
+}
+
+func_require "demo-inst" "$prefix/lib/libhello.la"  "demo/libhello.la"
+
+func_mkprefixdir
+func_cd "demo"
+func_save_files
+
+# Check to make sure we have a dynamic library.
+func_get_config "library_names" "cat libhello.la"
+test -z "$library_names" \
+  && func_fatal_error "Exiting: demo/libhello.la is not a shared library"
+
+func_get_config 'shlibpath_overrides_runpath
+hardcode_action
+hardcode_direct
+hardcode_into_libs' "./libtool --config" ": fatal"
+
+./hell # so that it links on-demand if needed
+
+func_msg "removing libhello.la from demo"
+rm -f libhello.la "$objdir"/libhello.*
+
+func_msg "running demo/hell"
+if ./hell; then
+  :
+elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; then
+  func_msg "Ok, uninstalled programs fail after uninstalled libraries are removed."
+  func_msg "This works in other configurations, but not in this particular one."
+else
+  func_fail "Exiting: demo/hell does not run, maybe libhello was not installed"
+fi
+
+func_msg "linking a broken demo/libhello.la"
+func_make libhello.la libhello_la_OBJECTS=hello.lo \
+  || func_fail "Exiting: cannot link broken libhello.la"
+rm -f libhello.la
+
+func_msg "running demo/hell with broken libhello.la"
+if (./hell) 2>&1; then
+  func_msg "Exiting: demo/hell runs even though libhello.la is incomplete"
+  func_fail "shlibpath_overrides_runpath should be set to no"
+else
+  func_msg "Failed, as expected"
+fi
+
+if test "x$hardcode_action" = xrelink; then
+  func_msg "Exiting: install-time relinking is required"
+  exit $EXIT_SUCCESS
+fi
+
+if test "$shlibpath_overrides_runpath" != yes; then
+  rm -f $objdir/lt-hell$EXEEXT || exit $EXIT_FAILURE
+  cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT || exit $EXIT_FAILURE
+  func_msg "running demo/hell with installed libhello.la"
+  if ./hell; then
+    func_msg "Worked, as expected"
+  else
+    func_msg "shlibpath_overrides_runpath should be set to yes"
+    status=$EXIT_FAILURE
+  fi
+fi
+
+exit $status
index 2f00da0e8ff77c176958e79dfdc87fa5ea52cf6e..248ecc5e54ec2a3db9df0e4016d7f12e2eadc44f 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# demo-conf.test - try configuring the ../demo subdirectory
+# demo-shared.test - try configuring the demo subdirectory for shared libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# 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 Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../demo (prefix=$prefix) with --disable-static"
-${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --build=$host --disable-static || exit 1
-
-if grep '^build_old_libs=no' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "demo"
+func_make_distclean
+func_configure "--disable-static"
+func_check_static_shared "no" "yes"
 
 exit 0
index 58d9544ed749741ba20fcaf85ac01caa0b101305..b32c5f9f9ed31f47df68aa3ce366f3781eb080b8 100755 (executable)
@@ -1,35 +1,17 @@
 #! /bin/sh
-# demo-conf.test - try configuring the ../demo subdirectory
+# demo-static.test - try configuring the demo subdirectory
 
 # Test script header.
-need_prefix=yes
 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
 
-# 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 Makefile; then
-  echo "= Running $make distclean in ../demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../demo (prefix=$prefix) with --disable-shared"
-${CONFIG_SHELL-/bin/sh} $srcdir/../demo/configure --srcdir=$srcdir/../demo --prefix=$prefix --build=$host --disable-shared || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=no' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "demo"
+func_make_distclean
+func_configure "--disable-shared"
+func_check_static_shared "yes" "no"
 
 exit 0
index 172c19b1a9d10c6f3c445ee55fbe524b3de9236d..6aca6759040fde9bfb6b6e8fa328e581746014ba 100755 (executable)
@@ -1,32 +1,36 @@
 #! /bin/sh
-# demo.test - try uninstalling in the ../demo subdirectory
+# demo-unst.test - try uninstalling in the demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Make sure it was installed already
-if test "$prefix/bin/hell" && cd ../demo && test -f Makefile; then :
-else
-  echo "You must run demo-inst.test before $0." 1>&2
-  exit 77
-fi
+func_require "demo-inst" "$prefix/bin/hell$EXEEXT" "demo/Makefile"
 
-echo "= Running $make uninstall in ../demo"
-$make uninstall || exit 1
-
-# See that there were no files leftover in $prefix.
-# Ignore dotfiles, so that .nfsXXX files don't screw up the test.
-leftovers=`find $prefix ! -type d ! -name '.*' -print`
-if test -n "$leftovers"; then
-  echo "= Leftover after make uninstall:"
-  ls -l $leftovers
-  exit 1
-fi
+func_mkprefixdir
+func_cd "demo"
+func_make_uninstall
 
 exit 0
diff --git a/tests/demo/.cvsignore b/tests/demo/.cvsignore
new file mode 100644 (file)
index 0000000..2448112
--- /dev/null
@@ -0,0 +1,20 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+conftest*
+hc-direct
+hc-libflag
+hc-libpath
+hc-minusL
+libtool
+*.lo
+*.la
+hell
+hell_static
+helldl
diff --git a/tests/demo/Makefile.am b/tests/demo/Makefile.am
new file mode 100644 (file)
index 0000000..87fd42a
--- /dev/null
@@ -0,0 +1,163 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I$(top_distdir)/m4
+
+# Build a libtool library, libhello.la for installation in libdir.
+lib_LTLIBRARIES = libhello.la
+libhello_la_SOURCES = hello.c foo.c
+libhello_la_LIBADD = $(LIBM)
+libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
+
+include_HEADERS = foo.h
+
+if BINARY_HELLDL
+BUILD_helldl = helldl
+else
+BUILD_helldl =
+endif
+
+bin_PROGRAMS = hell hell_static $(BUILD_helldl)
+
+# Build hell from main.c and libhello.la
+hell_SOURCES = main.c
+hell_LDADD = libhello.la
+
+# Create a statically linked version of hell.
+hell_static_SOURCES = main.c
+hell_static_LDADD = libhello.la
+hell_static_LDFLAGS = $(STATIC)
+
+if BINARY_HELLDL
+
+# Create a version of hell that does a preloaded dlopen.
+helldl_SOURCES = dlmain.c
+helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
+helldl_DEPENDENCIES = libhello.la
+
+else
+
+bin_SCRIPTS = helldl
+# create a script that says that -dlopen is not supported
+helldl helldl$(EXEEXT):
+       rm -f $@
+       echo '#! /bin/sh' > $@
+       echo '-dlopen is unsupported' >> $@
+       chmod +x $@
+endif
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
+
+#----------------------------------------------------------------------
+# The following declarations are only used in the testsuite:
+#----------------------------------------------------------------------
+
+hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
+CLEANFILES = $(hardcode_tests)
+
+# Unfortunately, in order to test libtool thoroughly, we need access
+# to its private directory.
+objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'`
+
+# The following rules are only for the libtool demo and tests.
+# Regenerate our acinclude.m4 only if it doesn't exist.
+$(srcdir)/acinclude.m4:
+       rm -f $(srcdir)/acinclude.m4
+       cd $(srcdir) && $(LN_S) ../libtool.m4 acinclude.m4
+
+
+# Test programs to see what gets hardcoded.
+.PHONY: hardcode
+hardcode: $(hardcode_tests)
+SET_HARDCODE_FLAGS = \
+  eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'`
+hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+       @rm -f hc-direct
+       @echo "You may ignore any linking errors from the following command:"
+       @shlib=./$(objdir)/libhello.a; \
+         eval "`grep '^library_names' libhello.la`"; \
+         for lib in $$library_names; do \
+           shlib="./$(objdir)/$$lib"; \
+         done; \
+         $(SET_HARDCODE_FLAGS); \
+         libdir=$(libdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
+         eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
+
+hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+       @$(SET_HARDCODE_FLAGS); \
+         libdir=`pwd`/$(objdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         if test -z "$$flag"; then \
+           echo "echo unsupported > $@"; \
+           echo unsupported > $@ || status="$$?"; \
+         else \
+           echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \
+           $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \
+         fi; \
+         exit $$status
+
+hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+       @rm -f hc-libpath
+       @echo "You may ignore any linking errors from the following command:"
+       @$(SET_HARDCODE_FLAGS); \
+         eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \
+         libdir=$(libdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
+         eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
+
+hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+       @rm -f hc-minusL
+       @$(SET_HARDCODE_FLAGS); \
+         libdir=$(libdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
+         eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
+
+# This is one of the essential tests for deplibs_check_method=pass_all.
+# If this one passes with pass_all, it is likely that pass_all works
+EXTRA_LIBRARIES = libhell0.a
+libhell0_a_SOURCES = hello.c foo.c
+EXTRA_LTLIBRARIES = libhell1.la libhell2.la
+libhell1_la_SOURCES = hell1.c
+libhell1_la_LIBADD = -L. -lhell0
+libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir)
+libhell1_la_DEPENDENCIES = libhell0.a
+libhell2_la_SOURCES = hell2.c
+libhell2_la_LIBADD = -L. -lhell0
+libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir)
+libhell2_la_DEPENDENCIES = libhell0.a
+EXTRA_PROGRAMS = hell0
+hell0_SOURCES = main.c
+hell0_LDADD = libhell1.la libhell2.la $(LIBM)
+
+# 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we
+# must explicitly list the wrapper script 'hell0'.  (bin_PROGRAMS
+# are handled seamlessly by automake rules; the extra step is only
+# necessary for EXTRA_PROGRAMS)
+CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0
+
+deplibs-check: hell0$(EXEEXT)
diff --git a/tests/demo/README b/tests/demo/README
new file mode 100644 (file)
index 0000000..511fd83
--- /dev/null
@@ -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 the libtool mailing
+list <bug-libtool@gnu.org>.
diff --git a/tests/demo/configure.ac b/tests/demo/configure.ac
new file mode 100644 (file)
index 0000000..a079e9e
--- /dev/null
@@ -0,0 +1,80 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([demo], [1.0], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([hello.c])
+AC_CONFIG_AUX_DIR([../../config])
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ---------------- ##
+## compiler checks. ##
+## ---------------- ##
+AC_PROG_CC
+AC_C_CONST
+AC_EXEEXT
+
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AC_LIBTOOL_DLOPEN
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+if ./libtool --features | grep '^enable static libraries$' > /dev/null 2>&1; then
+  STATIC=-static
+else
+  STATIC=
+fi
+AC_SUBST([STATIC])
+
+AM_CONDITIONAL([BINARY_HELLDL],
+    [grep '^global_symbol_pipe=..*$' ./libtool >/dev/null])
+
+
+## ---------------------------- ##
+## C headers required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_HEADERS([string.h math.h])
+
+
+## --------------------------- ##
+## Libraries required by demo. ##
+## --------------------------- ##
+AC_CHECK_LIBM
+AC_SUBST([LIBM])
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/demo/dlmain.c b/tests/demo/dlmain.c
new file mode 100644 (file)
index 0000000..7c123bb
--- /dev/null
@@ -0,0 +1,95 @@
+/* dlmain.c -- hello test program that uses simulated dynamic linking
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+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. */
+
+#include "foo.h"
+#include <stdio.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+struct lt_symlist
+{
+  const char *name;
+  lt_ptr_t address;
+};
+
+extern const struct lt_symlist lt_preloaded_symbols[];
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  const struct lt_symlist *s;
+  int (*pfoo)() = 0;
+  int (*phello)() = 0;
+  int *pnothing = 0;
+
+  printf ("Welcome to *modular* GNU Hell!\n");
+
+  /* Look up the symbols we require for this demonstration. */
+  s = lt_preloaded_symbols;
+  while (s->name)
+    {
+      if (s->address) {
+        const char *name = s->name;
+        printf ("found symbol: %s\n", name);
+        if (!strcmp ("hello", name))
+         phello = (int(*)())s->address;
+        else if (!strcmp ("foo", name))
+         pfoo = (int(*)())s->address;
+        else if (!strcmp ("nothing", name))
+#ifndef _WIN32
+         /* In an ideal world we could do this... */
+         pnothing = (int*)s->address;
+#else /* !_WIN32 */
+         /* In an ideal world a shared lib would be able to export data */
+         pnothing = (int*)&nothing;
+#endif
+      } else 
+        printf ("found file: %s\n", s->name);
+      s ++;
+    }
+
+  /* Try assigning to the nothing variable. */
+  if (pnothing)
+    *pnothing = 1;
+  else
+    fprintf (stderr, "did not find the `nothing' variable\n");
+
+  /* Just call the functions and check return values. */
+  if (pfoo)
+    {
+      if ((*pfoo) () != FOO_RET)
+       return 1;
+    }
+  else
+    fprintf (stderr, "did not find the `foo' function\n");
+
+  if (phello)
+    {
+      if ((*phello) () != HELLO_RET)
+       return 3;
+    }
+  else
+    fprintf (stderr, "did not find the `hello' function\n");
+
+  return 0;
+}
diff --git a/tests/demo/foo.c b/tests/demo/foo.c
new file mode 100644 (file)
index 0000000..55fa9d9
--- /dev/null
@@ -0,0 +1,37 @@
+/* foo.c -- trivial test function for libfoo
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+/* Give a global variable definition. */
+int nothing = FOO_RET;
+
+int
+foo ()
+{
+  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
+  return FOO_RET;
+}
diff --git a/tests/demo/foo.h b/tests/demo/foo.h
new file mode 100644 (file)
index 0000000..d1c084f
--- /dev/null
@@ -0,0 +1,73 @@
+/* foo.h -- interface to the libfoo library
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
+ * earlier do not define __CYGWIN__.  This snippit allows us to check
+ * for __CYGWIN__ reliably for both current, old, and (probable) future 
+ * releases.
+ */
+#ifdef __CYGWIN32__
+#  ifndef __CYGWIN__
+#    define __CYGWIN__
+#  endif
+#endif
+
+/* __BEGIN_DECLS should be used at the beginning of your declarations,
+   so that C++ compilers don't mangle their names.  Use __END_DECLS at
+   the end of C declarations. */
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+/* LTDL_PARAMS is a macro used to wrap function prototypes, so that compilers
+   that don't understand ANSI C prototypes still work, and ANSI C
+   compilers can issue warnings about type mismatches. */
+#undef LTDL_PARAMS
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN__) || defined(__cplusplus)
+# define LT_PARAMS(protos) protos
+# define lt_ptr_t     void*
+#else
+# define LT_PARAMS(protos) ()
+# define lt_ptr_t     char*
+#endif
+
+/* Silly constants that the functions return. */
+#define HELLO_RET 0xe110
+#define FOO_RET 0xf00
+
+
+/* Declarations.  Note the wonderful use of the above macros. */
+__BEGIN_DECLS
+int foo LT_PARAMS((void));
+int hello LT_PARAMS((void));
+extern int nothing;
+__END_DECLS
+
+#endif /* !_FOO_H_ */
diff --git a/tests/demo/hell1.c b/tests/demo/hell1.c
new file mode 100644 (file)
index 0000000..52e5148
--- /dev/null
@@ -0,0 +1 @@
+int hell1() { return 1; }
diff --git a/tests/demo/hell2.c b/tests/demo/hell2.c
new file mode 100644 (file)
index 0000000..c1ff477
--- /dev/null
@@ -0,0 +1 @@
+int hell2() { return 2; }
diff --git a/tests/demo/hello.c b/tests/demo/hello.c
new file mode 100644 (file)
index 0000000..3858528
--- /dev/null
@@ -0,0 +1,30 @@
+/* hello.c -- trivial test function for libfoo
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+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. */
+
+/* Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu> */
+#include "foo.h"
+
+#include <stdio.h>
+
+int
+hello ()
+{
+  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
+  return HELLO_RET;
+}
diff --git a/tests/demo/main.c b/tests/demo/main.c
new file mode 100644 (file)
index 0000000..d40dc59
--- /dev/null
@@ -0,0 +1,42 @@
+/* main.c -- trivial hello test program
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+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. */
+
+/* Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu> */
+#include "foo.h"
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  printf ("Welcome to GNU Hell!\n");
+
+  /* Try assigning to the nothing variable */
+  nothing = 1;
+
+  /* Just call the functions and check return values. */
+  if (foo () != FOO_RET)
+    return 1;
+
+  if (hello () != HELLO_RET)
+    return 2;
+
+  return 0;
+}
index da24f98fbe4351e45093d3d0d8265fcb22cb12cd..985e7028031b6f267936d5a9df5d0c2fb3e5e23b 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# depdemo-conf.test - try configuring the ./depdemo subdirectory
+# depdemo-conf.test - try configuring the depdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../depdemo || mkdir ../depdemo
-
-# Change to our build directory.
-cd ../depdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../depdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../depdemo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --build=$host || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "depdemo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
index b299c4cb67604de10b15f0ec3fee0c365aee9033..71c768b15919b6da1ee078a376b7f3cf3ec46954 100755 (executable)
@@ -1,35 +1,37 @@
 #! /bin/sh
-# depdemo-exec.test - check that programs in the ../depdemo subdirectory are viable
+# depdemo-exec.test - check that programs in the depdemo subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../depdemo/depdemo$EXEEXT; then :
-else
-  echo "You must run depdemo-make.test before running $0" 1>&2
-  exit 77
-fi
-
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../depdemo"
+func_require "depdemo-make" "depdemo/depdemo$EXEEXT"
 
-status=0
-if ../depdemo/depdemo_static; then :
-else
-  echo "$0: cannot execute ../depdemo/depdemo_static" 1>&2
-  status=1
-fi
-
-if ../depdemo/depdemo; then :
-else
-  echo "$0: cannot execute ../depdemo/depdemo" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "depdemo/depdemo_static"
+func_exec "depdemo/depdemo"
 
-exit $status
+exit $exec_status
index 85c73b3fc483c7feaa199938a3e2f964fc772b4b..884534182fe7403a87d39e971b5b52340f59e5fd 100755 (executable)
@@ -1,47 +1,39 @@
 #! /bin/sh
-# depdemo-inst.test - try installing from the ../depdemo subdirectory
+# depdemo-inst.test - try installing from the depdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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 ../depdemo/depdemo$EXEEXT; then :
-else
-  echo "You must run depdemo-make.test before $0" 1>&2
-  exit 77
-fi
-
-# Change to our build directory.
-cd ../depdemo || exit 1
-
-echo "= Running $make install in ../depdemo"
-$make install || exit 1
-
-echo "= Executing installed programs"
+func_require "depdemo-make" "depdemo/depdemo$EXEEXT"
 
-status=0
-if $prefix/bin/depdemo_static; then :
-else
-  echo "$0: cannot execute $prefix/bin/depdemo_static" 1>&2
-  status=1
-fi
-
-if $prefix/bin/depdemo; then :
-else
-  echo "$0: cannot execute $prefix/bin/depdemo" 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
-  status=1
-fi
+func_mkprefixdir
+func_cd "depdemo"
+func_make "install"
+func_exec_init "installed"
+func_exec "$prefix/bin/depdemo_static"
+func_exec "$prefix/bin/depdemo"
 
 exit $status
index 5f9b6e8ca61a5d2142877e7bfdcaa659c232334b..a9727d5a2752e5a9c6e9f956807539ef4221d980 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# depdemo-make.test - try building in the ../depdemo subdirectory
+# depdemo-make.test - try building in the depdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../depdemo/Makefile; then :
-else
-  echo "You must run depdemo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "depdemo-conf" "depdemo/Makefile"
 
-# Change to our build directory.
-cd ../depdemo || exit 1
+func_rmprefixdir
+func_cd "depdemo"
+func_make
 
-# Do the actual build.
-echo "Making in ../depdemo"
-$make || exit 1
 exit 0
index 2cbb25d2f779f5981baa09946f3519cbd69415ca..ee04e9a6a127b326fd0b3205e1e5d7a23197cb24 100755 (executable)
@@ -1,34 +1,40 @@
 #! /bin/sh
-# depdemo-conf.test - try configuring the ./depdemo subdirectory
+# depdemo-nofast.test - try configuring the ./depdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../depdemo || mkdir ../depdemo
-
-# Change to our build directory.
-cd ../depdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../depdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../depdemo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --build=$host --enable-fast-install=no || exit 1
+func_mkprefixdir
+func_cd "depdemo"
+func_make_distclean
+func_configure "--enable-fast-install=no"
 
-if grep '^hardcode_action=relink' libtool > /dev/null; then
-  rm -f Makefile && exit 77
+if func_grep '^hardcode_action=relink' libtool; then
+  rm -f Makefile
+  exit 77
 fi
 
 exit 0
diff --git a/tests/depdemo-relink.test b/tests/depdemo-relink.test
new file mode 100755 (executable)
index 0000000..60c5433
--- /dev/null
@@ -0,0 +1,114 @@
+#! /bin/sh
+# depdemo-relink.test - check to see whether shlibpath overrides runpath
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+if test -z "$srcdir"; then
+  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
+  test "$srcdir" = "$0" && srcdir=.
+fi
+. $srcdir/defs || exit 1
+
+func_restore_files ()
+{
+    func_mkdir_p "$objdir"
+    mv -f _fnord/temp/libs/* "l3/$objdir"
+    mv -f "_fnord/temp/libl3.la" "l3"
+    mv -f "_fnord/temp/lt-depdemo$EXEXT" "_fnord/temp/depdemo$EXEXT" "$objdir"
+    rm -rf "_fnord"
+}
+
+func_save_files ()
+{
+    func_mkdir_p "_fnord/temp/libs"
+    cp -f "$objdir/lt-depdemo$EXEEXT" "$objdir/depdemo$EXEEXT" "_fnord/temp"
+    cp -f l3/libl3.la "_fnord/temp"
+    cp -f l3/"$objdir"/* "_fnord/temp/libs"
+    trap "func_restore_files" 0 1 2 13 15
+}
+
+func_require "depdemo-inst" "$prefix/lib/libl3.la"  "depdemo/l3/libl3.la"
+
+func_mkprefixdir
+func_cd "depdemo"
+func_save_files
+
+# Check to make sure we have a dynamic library.
+func_get_config "library_names" "cat l3/libl3.la"
+test -z "$library_names" \
+  && func_fatal_error "Exiting: depdemo/l3/libl3.la is not a shared library"
+
+func_get_config 'shlibpath_overrides_runpath
+hardcode_action
+hardcode_direct
+hardcode_into_libs' "./libtool --config" ": fatal"
+
+./depdemo # so that it links on-demand if needed
+
+func_msg "removing libl3.la from depdemo/l3"
+rm -rf l3/libl3.la l3/$objdir
+
+func_msg "running depdemo/depdemo"
+if ./depdemo ||
+   # On AIX 4.1, when the installed copy of libl3 is loaded, it brings
+   # with it the installed copies of libl1 and libl2, with disjoint
+   # counters var_l1 and var_l2.  This is arguably acceptable behavior,
+   # but it's definitely not enough of a reason for the test to fail.
+   ./depdemo -alt; then
+  :
+elif test "x,$hardcode_action,$hardcode_direct" = x,relink,yes; then
+  func_msg "Ok, uninstalled programs fail after uninstalled libraries are removed"
+  func_msg "This works in other configurations, but not in this particular one"
+else
+  func_fail "Exiting: depdemo/depdemo does not run, maybe libl3 was not installed"
+fi
+
+func_msg "linking a broken depdemo/l3/libl3.la"
+(cd l3 && $make libl3.la libl3_la_OBJECTS=../l2/l2.lo) \
+  || func_fail "Exiting: cannot link broken libl3.la"
+rm -f l3/libl3.la
+
+func_msg "running depdemo/depdemo with broken libl3.la"
+if (./depdemo) 2>&1; then
+  func_msg "Exiting: depdemo/depdemo runs even though libl3.la is incomplete"
+  func_fail "shlibpath_overrides_runpath should be set to no"
+else
+  func_msg "Failed, as expected"
+fi
+
+if test "x$hardcode_action" = xrelink; then
+  func_msg "Exiting: install-time relinking is required"
+  exit $EXIT_SUCCESS
+fi
+
+if test "$shlibpath_overrides_runpath" != yes; then
+  rm -f $objdir/lt-depdemo || exit $EXIT_FAILURE
+  cp $objdir/depdemo $objdir/lt-depdemo || exit $EXIT_FAILURE
+  func_msg "running depdemo/depdemo with installed libl3.la"
+  if ./depdemo; then
+    func_msg "Worked, as expected"
+  else
+    func_msg "shlibpath_overrides_runpath should be set to yes"
+    status=$EXIT_FAILURE
+  fi
+fi
+
+exit $status
index e411fee660e96e7a8d74553110504e3cfab3baef..a4269afb11fabcc1278ab10735f903c6188492bd 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# depdemo-conf.test - try configuring the ../depdemo subdirectory
+# depdemo-shared.test - try configuring the depdemo subdirectory for shared libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../depdemo || mkdir ../depdemo
-
-# Change to our build directory.
-cd ../depdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../depdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../depdemo (prefix=$prefix) with --disable-static"
-${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --build=$host --disable-static || exit 1
-
-if grep '^build_old_libs=no' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "depdemo"
+func_make_distclean
+func_configure "--disable-static"
+func_check_static_shared "no" "yes"
 
 exit 0
index c0bd763c235e950e8e431eb4905a70503ff2c394..efbc2e7afd24f2cd5d75dbab08ce14b26c1360c4 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# depdemo-conf.test - try configuring the ../depdemo subdirectory
+# depdemo-static.test - try configuring the depdemo subdirectory for static libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../depdemo || mkdir ../depdemo
-
-# Change to our build directory.
-cd ../depdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../depdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../depdemo (prefix=$prefix) with --disable-shared"
-${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --build=$host --disable-shared || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=no' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "depdemo"
+func_make_distclean
+func_configure "--disable-shared"
+func_check_static_shared "yes" "no"
 
 exit 0
index 34d54231b0b44c0f66ce01972b7ada37e262a491..ec13602b1fa9dc443f413f60c6a6c0ca74cf9887 100755 (executable)
@@ -1,33 +1,36 @@
 #! /bin/sh
-# depdemo.test - try uninstalling in the ../depdemo subdirectory
+# depdemo-unst.test - try uninstalling in the depdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Make sure it was installed already
-if test "$prefix/bin/hell" && cd ../depdemo && test -f Makefile; then :
-else
-  echo "You must run depdemo-inst.test before $0." 1>&2
-  exit 77
-fi
+func_require "depdemo-inst" "$prefix/bin/depdemo$EXEEXT" "depdemo/Makefile"
 
-echo "= Running $make uninstall in ../depdemo"
-$make uninstall || exit 1
-
-# See that there were no files leftover in $prefix.
-# Ignore dotfiles, so that .nfsXXX files don't screw up the test.
-leftovers=`find $prefix ! -type d ! -name '.*' -print`
-if test -n "$leftovers"; then
-  echo "= Leftover after make uninstall:"
-  ls -l $leftovers
-  ls -l $leftovers > ~/devel/savannah/arse
-  exit 1
-fi
+func_mkprefixdir
+func_cd "depdemo"
+func_make_uninstall
 
 exit 0
diff --git a/tests/depdemo/.cvsignore b/tests/depdemo/.cvsignore
new file mode 100644 (file)
index 0000000..b416949
--- /dev/null
@@ -0,0 +1,15 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+conftest*
+libtool
+*.lo
+*.la
+depdemo
+depdemo_static
diff --git a/tests/depdemo/Makefile.am b/tests/depdemo/Makefile.am
new file mode 100644 (file)
index 0000000..2acf50b
--- /dev/null
@@ -0,0 +1,44 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+SUBDIRS = l1 l2 l3 l4
+
+EXTRA_DIST = sysdep.h
+
+bin_PROGRAMS = depdemo depdemo_static
+
+depdemo_SOURCES = main.c
+depdemo_LDADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la \
+               $(top_builddir)/l4/libl4.la
+depdemo_DEPENDENCIES = $(top_builddir)/l1/libl1.la \
+               $(top_builddir)/l2/libl2.la $(top_builddir)/l4/libl4.la
+
+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/tests/depdemo/README b/tests/depdemo/README
new file mode 100644 (file)
index 0000000..30d7166
--- /dev/null
@@ -0,0 +1,11 @@
+This is depdemo, an example package that uses GNU libtool with an
+Automake-generated environment to build many interdependent libraries
+and a test program.
+
+There are four libraries: l1, l2, l3 and l4.
+l1 depends on nothing.
+l2 depends on l1.
+l3 depends on l1 and l2.
+l4 depends on l3 and libm.
+
+The test program uses l1, l2 and l4.
diff --git a/tests/depdemo/configure.ac b/tests/depdemo/configure.ac
new file mode 100644 (file)
index 0000000..17a9e75
--- /dev/null
@@ -0,0 +1,76 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([depdemo], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([main.c])
+AC_CONFIG_AUX_DIR([../../config])
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ---------------- ##
+## compiler checks. ##
+## ---------------- ##
+AC_PROG_CC
+AC_EXEEXT
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AC_LIBTOOL_WIN32_DLL
+AM_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+## ------------------------------- ##
+## depdemo specific configuration. ##
+## ------------------------------- ##
+if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
+  STATIC=-static
+else
+  STATIC=
+fi
+AC_SUBST([STATIC])
+
+## ---------------------------- ##
+## C headers required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_HEADERS([math.h])
+
+
+## ---------------------------- ##
+## Libraries required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_LIBM
+AC_SUBST([LIBM])
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile l1/Makefile l2/Makefile l3/Makefile l4/Makefile])
+AC_OUTPUT
diff --git a/tests/depdemo/l1/.cvsignore b/tests/depdemo/l1/.cvsignore
new file mode 100644 (file)
index 0000000..09980ae
--- /dev/null
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
diff --git a/tests/depdemo/l1/Makefile.am b/tests/depdemo/l1/Makefile.am
new file mode 100644 (file)
index 0000000..673b072
--- /dev/null
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+AM_CPPFLAGS = -I$(top_srcdir)
+
+lib_LTLIBRARIES = libl1.la
+libl1_la_SOURCES = l1.c l1.h
+libl1_la_LDFLAGS = -no-undefined
diff --git a/tests/depdemo/l1/l1.c b/tests/depdemo/l1/l1.c
new file mode 100644 (file)
index 0000000..ba2fa77
--- /dev/null
@@ -0,0 +1,36 @@
+/* l1.c -- trivial test library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "l1/l1.h"
+#include <stdio.h>
+
+int    var_l1 = 0;
+
+int
+func_l1(indent)
+    int indent;
+{
+  int i;
+
+  for (i = 0; i < indent; i++)
+    putchar(' ');
+  printf("l1 (%i)\n", var_l1);
+  var_l1++;
+  return 0; 
+}
diff --git a/tests/depdemo/l1/l1.h b/tests/depdemo/l1/l1.h
new file mode 100644 (file)
index 0000000..fa70bb8
--- /dev/null
@@ -0,0 +1,31 @@
+/* l1.h -- interface to a trivial library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _L1_H_
+#define _L1_H_ 1
+
+#include "sysdep.h"
+
+__BEGIN_DECLS
+extern int var_l1;
+int    func_l1 __P((int));
+__END_DECLS
+
+#endif /* !_L1_H_ */
diff --git a/tests/depdemo/l2/.cvsignore b/tests/depdemo/l2/.cvsignore
new file mode 100644 (file)
index 0000000..09980ae
--- /dev/null
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
diff --git a/tests/depdemo/l2/Makefile.am b/tests/depdemo/l2/Makefile.am
new file mode 100644 (file)
index 0000000..bf64d8d
--- /dev/null
@@ -0,0 +1,29 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+AM_CPPFLAGS = -I$(top_srcdir)
+
+lib_LTLIBRARIES = libl2.la
+libl2_la_SOURCES = l2.c l2.h
+libl2_la_LDFLAGS = -no-undefined
+libl2_la_LIBADD = $(top_builddir)/l1/libl1.la
diff --git a/tests/depdemo/l2/l2.c b/tests/depdemo/l2/l2.c
new file mode 100644 (file)
index 0000000..555d068
--- /dev/null
@@ -0,0 +1,39 @@
+/* l2.c -- trivial test library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "l2/l2.h"
+
+#include "l1/l1.h"
+#include <stdio.h>
+
+int    var_l2 = 0;
+
+int
+func_l2(indent)
+    int indent;
+{
+  int i;
+
+  for (i = 0; i < indent; i++)
+    putchar(' ');
+  printf("l2 (%i)\n", var_l2);
+  func_l1(indent+1);
+  var_l2 += var_l1;
+  return 0; 
+}
diff --git a/tests/depdemo/l2/l2.h b/tests/depdemo/l2/l2.h
new file mode 100644 (file)
index 0000000..893e26b
--- /dev/null
@@ -0,0 +1,31 @@
+/* l2.h -- interface to a trivial library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _L2_H_
+#define _L2_H_ 1
+
+#include "sysdep.h"
+
+__BEGIN_DECLS
+extern int var_l2;
+int    func_l2 __P((int));
+__END_DECLS
+
+#endif /* !_L2_H_ */
diff --git a/tests/depdemo/l3/.cvsignore b/tests/depdemo/l3/.cvsignore
new file mode 100644 (file)
index 0000000..09980ae
--- /dev/null
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
diff --git a/tests/depdemo/l3/Makefile.am b/tests/depdemo/l3/Makefile.am
new file mode 100644 (file)
index 0000000..0938693
--- /dev/null
@@ -0,0 +1,30 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+extradir    = $(libdir)/extra
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+AM_CPPFLAGS = -I$(top_srcdir)
+
+lib_LTLIBRARIES = libl3.la
+libl3_la_SOURCES = l3.c l3.h
+libl3_la_LDFLAGS = -no-undefined
+libl3_la_LIBADD = $(top_builddir)/l1/libl1.la $(top_builddir)/l2/libl2.la
diff --git a/tests/depdemo/l3/l3.c b/tests/depdemo/l3/l3.c
new file mode 100644 (file)
index 0000000..de75bd6
--- /dev/null
@@ -0,0 +1,41 @@
+/* l3.c -- trivial test library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "l3/l3.h"
+
+#include "l1/l1.h"
+#include "l2/l2.h"
+#include <stdio.h>
+
+int    var_l3 = 0;
+
+int
+func_l3(indent)
+    int indent;
+{
+  int i;
+
+  for (i = 0; i < indent; i++)
+    putchar(' ');
+  printf("l3 (%i)\n", var_l3);
+  func_l1(indent+1);
+  func_l2(indent+1);
+  var_l3 += var_l1 + var_l2;
+  return 0; 
+}
diff --git a/tests/depdemo/l3/l3.h b/tests/depdemo/l3/l3.h
new file mode 100644 (file)
index 0000000..d9b79fb
--- /dev/null
@@ -0,0 +1,31 @@
+/* l3.h -- interface to a trivial library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _L3_H_
+#define _L3_H_ 1
+
+#include "sysdep.h"
+
+__BEGIN_DECLS
+extern int var_l3;
+int    func_l3 __P((int));
+__END_DECLS
+
+#endif /* !_L3_H_ */
diff --git a/tests/depdemo/l4/.cvsignore b/tests/depdemo/l4/.cvsignore
new file mode 100644 (file)
index 0000000..09980ae
--- /dev/null
@@ -0,0 +1,6 @@
+.deps
+.libs
+Makefile
+Makefile.in
+*.lo
+*.la
diff --git a/tests/depdemo/l4/Makefile.am b/tests/depdemo/l4/Makefile.am
new file mode 100644 (file)
index 0000000..64933bd
--- /dev/null
@@ -0,0 +1,29 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+AM_CPPFLAGS = -I$(top_srcdir)
+
+lib_LTLIBRARIES = libl4.la
+libl4_la_SOURCES = l4.c l4.h
+libl4_la_LDFLAGS = -no-undefined
+libl4_la_LIBADD = $(top_builddir)/l3/libl3.la $(LIBM)
diff --git a/tests/depdemo/l4/l4.c b/tests/depdemo/l4/l4.c
new file mode 100644 (file)
index 0000000..d99d020
--- /dev/null
@@ -0,0 +1,46 @@
+/* l4.c -- trivial test library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "l4/l4.h"
+
+#include "l3/l3.h"
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+int    var_l4 = 0;
+
+int
+func_l4(indent)
+    int indent;
+{
+  int i;
+
+  for (i = 0; i < indent; i++)
+    putchar(' ');
+  printf("l4 (%i)\n", var_l4);
+  func_l3(indent+1);
+  for (i = 0; i <= indent; i++)
+    putchar(' ');
+  printf("libm [sin(1.5) = %f]\n", sin(1.5));
+  var_l4 += var_l3;
+  return 0; 
+}
diff --git a/tests/depdemo/l4/l4.h b/tests/depdemo/l4/l4.h
new file mode 100644 (file)
index 0000000..17ab6ea
--- /dev/null
@@ -0,0 +1,31 @@
+/* l4.h -- interface to a trivial library
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _L4_H_
+#define _L4_H_ 1
+
+#include "sysdep.h"
+
+__BEGIN_DECLS
+extern int var_l4;
+int    func_l4 __P((int));
+__END_DECLS
+
+#endif /* !_L4_H_ */
diff --git a/tests/depdemo/main.c b/tests/depdemo/main.c
new file mode 100644 (file)
index 0000000..ef2458d
--- /dev/null
@@ -0,0 +1,46 @@
+/* main.c -- inter-library dependency test program
+   Copyright (C) 1998, 1999, 2000 Free Software Foundation
+   by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "l1/l1.h"
+#include "l2/l2.h"
+#include "l4/l4.h"
+#include <stdio.h>
+#include <string.h>
+
+int
+main (argc,argv)
+    int argc;
+    char **argv;
+{
+  printf("dependencies:\n");
+  func_l1(0);
+  func_l2(0);
+  func_l4(0);
+  if (argc == 2 && strcmp (argv[1], "-alt") == 0
+      && var_l1 + var_l2 + var_l4 == 8)
+       return 0;
+  printf("var_l1(%d) + var_l2(%d) + var_l4(%d) == %d\n",var_l1,var_l2,var_l4, var_l1 + var_l2 + var_l4);
+  if (var_l1 + var_l2 + var_l4 != 20)
+       {
+       printf("var_l1(%d) + var_l2(%d) + var_l4(%d) != 20\n",var_l1,var_l2,var_l4);
+       return 1;
+       }
+  return 0;
+}
diff --git a/tests/depdemo/sysdep.h b/tests/depdemo/sysdep.h
new file mode 100644 (file)
index 0000000..40dcfbd
--- /dev/null
@@ -0,0 +1,47 @@
+/* sysdep.h -- system dependent declarations
+   Copyright (C) 1998-1999 Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _SYSDEP_H_
+#define _SYSDEP_H_ 1
+
+/* __BEGIN_DECLS should be used at the beginning of your declarations,
+   so that C++ compilers don't mangle their names.  Use __END_DECLS at
+   the end of C declarations. */
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+/* __P is a macro used to wrap function prototypes, so that compilers
+   that don't understand ANSI C prototypes still work, and ANSI C
+   compilers can issue warnings about type mismatches. */
+#undef __P
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus)
+# define __P(protos) protos
+#else
+# define __P(protos) ()
+#endif
+
+#endif /* !_SYSDEP_H_ */
diff --git a/tests/deplibs.test b/tests/deplibs.test
deleted file mode 100755 (executable)
index 9b3b06d..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-# deplibs.test - check whether the shared library check method is OK
-
-# Test script header.
-need_prefix=yes
-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/libhello.la && cd ../demo; then :
-else
-  echo "You must run demo-conf.test before $0" 1>&2
-  exit 77
-fi
-
-echo "linking a shared library against a static library"
-if $make deplibs-check && test -f hell0; then :
-else
-  echo "= cannot build the test program, check your deplibs_check_method"
-  status=1
-fi
-
-echo "executing the test program"
-if ./hell0; then :
-else
-  echo "= cannot execute the test program, check your deplibs_check_method"
-  status=1
-fi
-
-exit $status
index 23d7af7b7dd851a7ec548815a2e448d0c1551667..606dcf9a2bccef373d113260dd9c15732487d3bd 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# f77demo-conf.test - try configuring the ../f77demo subdirectory
+# f77demo-conf.test - try configuring the f77demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../f77demo || mkdir ../f77demo
-
-# Change to our build directory.
-cd ../f77demo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../f77demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../f77demo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../f77demo/configure --srcdir=$srcdir/../f77demo --prefix=$prefix || exit 1
-
-if $EGREP '^build_old_libs=yes' libtool > /dev/null &&
-   $EGREP '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "f77demo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
index ac6b85348c93d399188b1c11f60e3f3b65cbc06f..7a23f68a2896ea499e4276738b2aec70bf1d1b35 100755 (executable)
@@ -1,34 +1,37 @@
 #! /bin/sh
-# f77demo-exec.test - check that programs in the ../f77demo subdirectory are viable
+# f77demo-exec.test - check that programs in the f77demo subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../f77demo/fprogram$EXEEXT && test -f ../f77demo/cprogram$EXEEXT; then :
-else
-  echo "You must run f77demo-make.test before running $0" 1>&2
-  exit 77
-fi
-
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../f77demo"
+func_require "f77demo-make" "f77demo/fprogram$EXEEXT" "f77demo/cprogram$EXEEXT"
 
-if ../f77demo/fprogram ; then :
-else
-  echo "$0: cannot execute ../f77demo/fprogram" 1>&2
-  status=1
-fi
-
-if ../f77demo/cprogram ; then :
-else
-  echo "$0: cannot execute ../f77demo/cprogram" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "f77demo/fprogram"
+func_exec "f77demo/cprogram"
 
-exit $status
+exit $exec_status
index 5191d77ee08dee20f532919928e823665f246de1..362e4f9cee5cc2da26a7cf56b0ae9414a9fc30ff 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# f77demo-make.test - try building in the ../f77demo subdirectory
+# f77demo-make.test - try building in the f77demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../f77demo/Makefile; then :
-else
-  echo "You must run f77demo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "f77demo-conf" "f77demo/Makefile"
 
-# Change to our build directory.
-cd ../f77demo || exit 1
+func_rmprefixdir
+func_cd "f77demo"
+func_make
 
-# Do the actual build.
-echo "Making in ../f77demo"
-$make || exit 1
 exit 0
index a54eeec831a8f0c1cd5e427e91a45c31dc0ba8e1..43fb4c12adfa5673c89c1fedfebe81849430d31d 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# f77demo-conf.test - try configuring the ../f77demo subdirectory
+# f77demo-shared.test - try configuring the f77demo subdirectory for shared libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../f77demo || mkdir ../f77demo
-
-# Change to our build directory.
-cd ../f77demo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../f77demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../f77demo (prefix=$prefix) with --disable-static"
-${CONFIG_SHELL-/bin/sh} $srcdir/../f77demo/configure --srcdir=$srcdir/../f77demo --prefix=$prefix --disable-static || exit 1
-
-if $EGREP '^build_old_libs=no' libtool > /dev/null &&
-   $EGREP '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "f77demo"
+func_make_distclean
+func_configure "--disable-static"
+func_check_static_shared "no" "yes"
 
 exit 0
index 3e710366dee81b95801c5e41aa849bb46edbd5ca..b16ccb9b3d853393feb5eaed7fccce1cd674be24 100755 (executable)
@@ -1,44 +1,36 @@
 #! /bin/sh
-# f77demo-conf.test - try configuring the ../f77demo subdirectory
+# f77demo-static.test - try configuring the f77demo subdirectory for static libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../f77demo || mkdir ../f77demo
-
-# Change to our build directory.
-cd ../f77demo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../f77demo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../f77demo (prefix=$prefix) with --disable-shared"
-${CONFIG_SHELL-/bin/sh} $srcdir/../f77demo/configure --srcdir=$srcdir/../f77demo --prefix=$prefix --disable-shared || exit 1
-
-if $EGREP '^build_old_libs=yes' libtool > /dev/null &&
-   $EGREP '^build_libtool_libs=no' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "f77demo"
+func_make_distclean
+func_configure "--disable-shared"
+func_check_static_shared "yes" "no"
 
 exit 0
-
-
-
-
-
-
-
-
-
diff --git a/tests/f77demo/.cvsignore b/tests/f77demo/.cvsignore
new file mode 100644 (file)
index 0000000..30c8944
--- /dev/null
@@ -0,0 +1,17 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+config-h.in
+conftest*
+libtool
+*.lo
+*.la
+stamp-h*
+cprogram
+fprogram
diff --git a/tests/f77demo/Makefile.am b/tests/f77demo/Makefile.am
new file mode 100644 (file)
index 0000000..2757a09
--- /dev/null
@@ -0,0 +1,45 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+noinst_LTLIBRARIES = libfoo.la libmix.la
+
+libfoo_la_SOURCES = foof.f
+libfoo_la_LDFLAGS = -no-undefined
+
+libmix_la_SOURCES = foof.f fooc.c
+libmix_la_LDFLAGS = -no-undefined
+
+noinst_HEADERS = foo.h
+
+bin_PROGRAMS = fprogram cprogram
+
+fprogram_SOURCES = fprogram.f
+fprogram_LDADD = libfoo.la
+
+cprogram_SOURCES = cprogram.c
+cprogram_LDADD = libmix.la
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
diff --git a/tests/f77demo/README b/tests/f77demo/README
new file mode 100644 (file)
index 0000000..11df06c
--- /dev/null
@@ -0,0 +1,16 @@
+This is a short demo of the fortran support in libtool.
+
+fprogram is a pure-fortran program which is linked 
+against the fortran-only library libfoo.la
+
+cprogram is a C program, which is linked against the
+mixed C and fortran library libmix.la. The program
+calls a C function, which in turn calls a fortran 
+function.
+
+This demo requires GNU autoconf, automake, 
+libtool with the F77 tag and quite obvious Fortran 77.
+
+
+
+
diff --git a/tests/f77demo/config.h b/tests/f77demo/config.h
new file mode 100644 (file)
index 0000000..7780fc7
--- /dev/null
@@ -0,0 +1,70 @@
+/* config.h.  Generated by configure.  */
+/* config-h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to dummy `main' function (if any) required to link to the Fortran
+   libraries. */
+/* #undef F77_DUMMY_MAIN */
+
+/* Define to a macro mangling the given C identifier (in lower and upper
+   case), which must not contain underscores, for linking with Fortran. */
+#define F77_FUNC(name,NAME) name ## _
+
+/* As F77_FUNC, but for C identifiers containing underscores. */
+#define F77_FUNC_(name,NAME) name ## __
+
+/* Define if F77 and FC dummy `main' functions are identical. */
+/* #undef FC_DUMMY_MAIN_EQ_F77 */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "f77demo"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-libtool@gnu.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "f77demo"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "f77demo 0.1"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "f77demo"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.1"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "0.1"
diff --git a/tests/f77demo/configure.ac b/tests/f77demo/configure.ac
new file mode 100644 (file)
index 0000000..a1ddbac
--- /dev/null
@@ -0,0 +1,71 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([f77demo], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_HEADERS([config.h:config-h.in])
+AC_CONFIG_SRCDIR([foof.f])
+AC_CONFIG_AUX_DIR([../../config])
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ------------------ ##
+## C compiler checks. ##
+## ------------------ ##
+AC_PROG_CC
+
+## ------------------------ ##
+## Fortran compiler checks. ##
+## ------------------------ ##
+AC_PROG_F77
+dnl Check the flags needed to link f77 programs with ld (i.e. cc)
+AC_F77_LIBRARY_LDFLAGS
+dnl Check for underscoring of external names
+AC_F77_WRAPPERS
+
+# As of the writing of this demo, GNU Autoconf's AC_OBJEXT and
+# AC_EXEEXT macros only works for C compilers!
+# Libtool's setup macro calls AC_OBJEXT and AC_EXEEXT without setting
+# the test language to C.  We do it before any libtool setup macros are
+# called so that the proper values are cached beforehand.  We also do
+# it before any linker flags (LDFLAGS) are set so that fortran specific
+# ones don't break the tests.
+AC_LANG_PUSH([C])
+AC_OBJEXT
+AC_EXEEXT
+AC_LANG_POP
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AM_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/f77demo/cprogram.c b/tests/f77demo/cprogram.c
new file mode 100644 (file)
index 0000000..64edc84
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+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. */
+
+#include "foo.h"
+
+int
+main(int argc, char **argv)
+{
+  int arg,cres,fres;
+  
+  printf ("Welcome to GNU libtool mixed C/Fortran demo!\n");
+  
+  arg=2;
+  
+  cres=csub(arg);
+  
+  printf ("The C subroutine returned, claiming that 2*%d = %d\n",arg,cres);
+  
+  if(cres==2*arg)
+    printf ("The C subroutine is ok!\n");
+  
+  printf("\nCalling the C wrapper routine...\n");
+  fres=fwrapper(arg);
+  
+  printf ("The C wrapper to the fortran subroutine returned,\n"
+         "claiming that 2*%d = %d\n",arg,fres);
+  
+  if(fres==2*arg)
+    printf ("The Fortran 77 subroutine is ok!\n");
+  
+  return 0;
+}
+
diff --git a/tests/f77demo/foo.h b/tests/f77demo/foo.h
new file mode 100644 (file)
index 0000000..4fd21ea
--- /dev/null
@@ -0,0 +1,47 @@
+/* foo.h -- interface to fortran and C libraries
+   Copyright (C) 1998-1999 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+/* config.h is necessary for the fortran name mangling */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* csub is an extremely useful subroutine that
+ * returns the argument multiplied by two :-)
+ */
+extern int csub(int);
+
+/* This routine performs the same action, but
+ * calls the fortran subroutine fsub to do the 
+ * real work.
+ */
+extern int fwrapper(int);
+
+/* fsub does the same thing as csub, i.e. res=arg*2.
+ * Use autoconf macro for fortran function names.
+ * Note that fortran passes args by reference, so
+ * you need to provide pointers to your ints.
+ */
+extern void F77_FUNC(fsub,FSUB)(int *arg, int *res);
+
+
+#endif
diff --git a/tests/f77demo/fooc.c b/tests/f77demo/fooc.c
new file mode 100644 (file)
index 0000000..eac944d
--- /dev/null
@@ -0,0 +1,17 @@
+#include "foo.h"
+
+
+int csub(int arg)
+{
+  return (2*arg);
+}
+
+
+int fwrapper(int arg)
+{
+  int res;
+  printf("Calling the Fortran 77 subroutine from the C wrapper...\n");
+  F77_FUNC(fsub,FSUB)(&arg,&res);
+  printf("Returned from the Fortran 77 subroutine...\n");
+  return res;
+}
diff --git a/tests/f77demo/foof.f b/tests/f77demo/foof.f
new file mode 100644 (file)
index 0000000..6e631fb
--- /dev/null
@@ -0,0 +1,13 @@
+C 
+C This program is free software; you can redistribute it and/or
+C modify it under the terms of the GNU General Public License
+C as published by the Free Software Foundation; either version 2
+C of the License, or (at your option) any later version.
+C 
+
+      subroutine fsub(arg,res)
+      implicit none
+      integer*4 arg,res
+      res=arg*2
+      return
+      end
diff --git a/tests/f77demo/fprogram.f b/tests/f77demo/fprogram.f
new file mode 100644 (file)
index 0000000..bf882f6
--- /dev/null
@@ -0,0 +1,27 @@
+C 
+C This program is free software; you can redistribute it and/or
+C modify it under the terms of the GNU General Public License
+C as published by the Free Software Foundation; either version 2
+C of the License, or (at your option) any later version.
+C 
+
+      program fprogram
+      implicit none
+      integer*4 arg,res
+
+      write(*,*) 'Welcome to GNU libtool Fortran demo!'
+      write(*,*) 'Real programmers write in FORTRAN.'
+      arg=2
+
+      call fsub(arg,res)
+
+      write(*,*) 'fsub returned, saying that 2 *',arg,' =',res
+
+      if (res.eq.4) then
+         write(*,*) 'fsub is ok!'
+      endif
+
+      stop
+      end
+
+         
index 55f360a2429b9bfdb549031be4a5967aaf83877e..33b17d828215f1977d18b18cb84faa28f566eb9a 100755 (executable)
@@ -1,12 +1,29 @@
 #! /bin/sh
-# link.test - check that .lo files aren't made into programs.
+# link-2.test - check that .lo files aren't made into programs.
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
@@ -19,18 +36,17 @@ EOF
 
 # Try a sample link command.
 linkresult=`$libtool -n --mode=link $CC -o something foo.o hell.lo`
-
 res=$?
 
 rm -f hell.lo
 
-test $res -eq 0 || exit 1
+test $res -eq 0 || exit $EXIT_FAILURE
 
 echo "$linkresult"
 case "$linkresult" in
 *".lo "*)
-  echo "$0: .lo files should not be linked into programs"
-  exit 1
+  func_fail "$progname: .lo files should not be linked into programs"
   ;;
 esac
-exit 0
+
+exit $EXIT_SUCCESS
index 4b208487c10e4ee1dcfe8fc70d1c8c7c7cac5604..64fe889844c922547e7541a0aa0c62c9730597b3 100755 (executable)
@@ -1,25 +1,41 @@
 #! /bin/sh
 # link.test - make sure that linking against libraries is legal.
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
 
 # Try a sample link command.
 linkresult=`$libtool -n --mode=link $CC -o gettext ../lib/libnlsut.a`
-test $? -eq 0 || exit 1
+test $? -eq 0 || exit $EXIT_FAILURE
 
 echo "$linkresult"
 case "$linkresult" in
 *../lib/libnlsut.a) ;;
 *)
-  echo "$progname: ../lib/libnlsut.a was not used as expected in linking"
-  exit 1
+  func_fail "$progname: ../lib/libnlsut.a was not used as expected in linking"
   ;;
 esac
-exit 0
+exit $EXIT_SUCCESS
index acfe747dc651b1eee53e5134f73550f469fd1b00..7a39d506cf425f20b4fb459603a198378ea87e70 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# mdemo-conf.test - try configuring the ../mdemo subdirectory
+# mdemo-conf.test - try configuring the mdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../mdemo || mkdir ../mdemo
-
-# Change to our build directory.
-cd ../mdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../mdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../mdemo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../mdemo/configure --srcdir=$srcdir/../mdemo --prefix=$prefix || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "mdemo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
similarity index 54%
rename from tests/dryrun.test
rename to tests/mdemo-dryrun.test
index 0428904b97cdc2d53812184d830362091c00ae36..3d3fa1bacd21b7fcab637761ce70993254ca805c 100755 (executable)
@@ -1,37 +1,44 @@
 #! /bin/sh
-# dryrun.test - check whether the --dry-run mode works properly
+# mdemo-dryrun.test - check whether the --dry-run mode works properly
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-if test -f ../mdemo/Makefile; then :
-else
-  echo "You must run mdemo-conf.test before running $0" 1>&2
-  exit 77
-fi
-
-# Change to our build directory.
-cd ../mdemo || exit 1
-
-echo "= Running $make clean in ../mdemo"
-$make clean || exit 1
+func_require "mdemo-conf" "mdemo/Makefile"
 
-eval `$libtool --config | grep "^objdir="`
+func_mkprefixdir
+func_cd "mdemo"
+func_make "clean"
 
 # create `before' and `after' in a directory deep within objdir,
 # so that their creation and removal does not modify even a timestamp
 # in the output of `ls -l . $objdir'
-for d in $objdir $objdir/temp $objdir/temp/temp; do
-  test -d $d || mkdir $d
-done
-before=$d/before
-after=$d/after
+func_mkdir_p "$objdir/temp/temp"
+before=$objdir/temp/temp/before
+after=$objdir/temp/temp/after
 
 # Create a new libtool script that will enter dry run if the environment
 # variable force_dry_run is set
@@ -44,39 +51,36 @@ mv $objdir/libtool.new libtool
 # main.o is not compiled with libtool, but it depends on it, so make
 # sure it is up-to-date.  libfoo2.la is linked with libsub.la, so make
 # sure it exists, otherwise libtool will complain.
-$make main.$OBJEXT || exit 1
+func_make main.$objext
 
-echo "= Making object files in ../mdemo (dry run)"
+func_msg "Making object files in mdemo (dry run)"
 ls -l . $objdir | grep -v total > $before
 force_dry_run=yes $make foo1.lo foo2.lo sub.lo || exit $?
 ls -l . $objdir | grep -v total > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
-echo "= Making object files in ../mdemo"
-$make foo1.lo foo2.lo libsub.la || exit 1
+func_make foo1.lo foo2.lo libsub.la
 
-echo "= Making libraries in ../mdemo (dry run)"
+func_msg "Making libraries in mdemo (dry run)"
 ls -l . $objdir | grep -v total > $before
 force_dry_run=yes $make foo1.la libfoo2.la || exit $?
 ls -l . $objdir | grep -v total > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
-echo "= Making libraries in ../mdemo"
-$make foo1.la libfoo2.la || exit 1
+func_make foo1.la libfoo2.la
 
-echo "= Making programs in ../mdemo (dry run)"
+func_msg "Making programs in ../mdemo (dry run)"
 ls -l . $objdir | grep -v total > $before
 force_dry_run=yes $make mdemo$EXEEXT mdemo_static$EXEEXT 1>&2 || exit $?
 ls -l . $objdir | grep -v total > $after
 cmp $before $after > /dev/null || exit 1
 # Now really make them
-echo "= Making programs in ../mdemo"
-$make mdemo$EXEEXT mdemo_static$EXEEXT || exit 1
+func_make mdemo$EXEEXT mdemo_static$EXEEXT
 
-echo "= Running $make install in ../mdemo (dry run)"
+func_msg "Running $make install in ../mdemo (dry run)"
 # Libtool does not create these directories
-mkdir $prefix/bin
-mkdir $prefix/lib
+func_mkdir_p "$prefix/bin"
+func_mkdir_p "$prefix/lib"
 ls -l . $objdir | grep -v total > $before
 ls -lR $prefix | grep -v total >> $before
 force_dry_run=yes $make install 1>&2 || exit 1
@@ -84,12 +88,11 @@ ls -l . $objdir | grep -v total > $after
 ls -lR $prefix | grep -v total >> $after
 cmp $before $after > /dev/null || exit 1
 # Now really run it
-echo "= Running $make install in ../mdemo"
-$make install || exit 1
+func_make install
 
-echo "= Running $make uninstall in ../mdemo (dry run)"
+func_msg "Running $make uninstall in ../mdemo (dry run)"
 # Libtool does not uninstall the programs, remove them first
-rm -f $prefix/bin/mdemo$EXEEXT $prefix/bin/mdemo_static$EXEEXT
+rm -f "$prefix/bin/mdemo$EXEEXT" "$prefix/bin/mdemo_static$EXEEXT"
 ls -l . $objdir | grep -v total > $before
 ls -lR $prefix | grep -v total >> $before
 force_dry_run=yes $make uninstall 1>&2 || exit $?
@@ -97,8 +100,7 @@ ls -l . $objdir | grep -v total > $after
 ls -lR $prefix | grep -v total >> $after
 cmp $before $after > /dev/null || exit 1
 # Now really run it
-echo "= Running $make uninstall in ../mdemo"
-$make uninstall || exit 1
+func_make uninstall
 
 rm -f $before $after libtool
 mv $objdir/libtool libtool
index 26834b3dfa242203c0afec7f195bc87982aac718..e6ef81e1eed00ffbe1153674b45c636fee7cb0b0 100755 (executable)
@@ -1,35 +1,37 @@
 #! /bin/sh
-# mdemo-exec.test - check that programs in the ../mdemo subdirectory are viable
+# mdemo-exec.test - check that programs in the mdemo subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../mdemo/mdemo$EXEEXT; then :
-else
-  echo "You must run mdemo-make.test before running $0" 1>&2
-  exit 77
-fi
-
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../mdemo"
+func_require "mdemo-make" "mdemo/mdemo$EXEEXT"
 
-status=0
-if ../mdemo/mdemo_static ../mdemo/foo1.la ../mdemo/libfoo2.la; then :
-else
-  echo "$0: execution of ../mdemo/mdemo_static failed" 1>&2
-  status=1
-fi
-
-if ../mdemo/mdemo ../mdemo/foo1.la ../mdemo/libfoo2.la; then :
-else
-  echo "$0: execution of ../mdemo/mdemo failed" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "mdemo/mdemo_static mdemo/foo1.la mdemo/libfoo2.la"
+func_exec "mdemo/mdemo mdemo/foo1.la mdemo/libfoo2.la"
 
-exit $status
+exit $exec_status
index 2e02e2c64fbcccf286978915cad3c327ff9b5b4d..90c69a1972a91ae9afb9db6c19623dd02a4e70d0 100755 (executable)
@@ -1,50 +1,39 @@
 #! /bin/sh
-# mdemo-inst.test - try installing from the ../mdemo subdirectory
+# mdemo-inst.test - try installing from the mdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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 ../mdemo/mdemo$EXEEXT; then :
-else
-  echo "You must run mdemo-make.test before $0" 1>&2
-  exit 77
-fi
-
-# Change to our build directory.
-cd ../mdemo || exit 1
-
-echo "= Running $make install in ../mdemo"
-$make install || exit 1
-
-echo "= Executing installed programs"
-path_old=$PATH
-PATH=$prefix/lib:$PATH
+func_require "mdemo-make" "mdemo/mdemo$EXEEXT"
 
-status=0
-if $prefix/bin/mdemo_static $prefix/lib/foo1.la $prefix/lib/libfoo2.la; then :
-else
-  echo "$0: cannot execute $prefix/bin/mdemo_static" 1>&2
-  status=1
-fi
-
-if $prefix/bin/mdemo $prefix/lib/foo1.la $prefix/lib/libfoo2.la; then :
-else
-  echo "$0: cannot execute $prefix/bin/mdemo" 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
-  status=1
-fi
+func_mkprefixdir
+func_cd "mdemo"
+func_make "install"
+func_exec_init "installed"
+func_exec "$prefix/bin/mdemo_static $prefix/lib/foo1.la $prefix/lib/libfoo2.la"
+func_exec "$prefix/bin/mdemo $prefix/lib/foo1.la $prefix/lib/libfoo2.la"
 
-PATH=$path_old
 exit $status
index c54b907fc7e1984f3758da620bc18209993da2cc..25a7127fbef4dd6f927732afc84ec21fe43904ab 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# mdemo-make.test - try building in the ../mdemo subdirectory
+# mdemo-make.test - try building in the mdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../mdemo/Makefile; then :
-else
-  echo "You must run mdemo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "mdemo-conf" "mdemo/Makefile"
 
-# Change to our build directory.
-cd ../mdemo || exit 1
+func_rmprefixdir
+func_cd "mdemo"
+func_make
 
-# Do the actual build.
-echo "Making in ../mdemo"
-$make || exit 1
 exit 0
index b23a2348f484b7edd9a5e58ecc659c2c2988c733..08507cf4220a8690575effca77c1d01a1be7482c 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# mdemo-conf.test - try configuring the ../mdemo subdirectory
+# mdemo-shared.test - try configuring the mdemo subdirectory for shared libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../mdemo || mkdir ../mdemo
-
-# Change to our build directory.
-cd ../mdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../mdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../mdemo (prefix=$prefix) with --disable-static"
-${CONFIG_SHELL-/bin/sh} $srcdir/../mdemo/configure --srcdir=$srcdir/../mdemo --prefix=$prefix --disable-static || exit 1
-
-if grep '^build_old_libs=no' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "mdemo"
+func_make_distclean
+func_configure "--disable-static"
+func_check_static_shared "no" "yes"
 
 exit 0
index 6e02922929796e1f22b1511459235dc0988db83c..bd4acd11d61dc0ab38778ded5f2e6b2dbea4f28d 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# mdemo-conf.test - try configuring the ../mdemo subdirectory
+# mdemo-static.test - try configuring the mdemo subdirectory for static libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../mdemo || mkdir ../mdemo
-
-# Change to our build directory.
-cd ../mdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../mdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../mdemo (prefix=$prefix) with --disable-shared"
-${CONFIG_SHELL-/bin/sh} $srcdir/../mdemo/configure --srcdir=$srcdir/../mdemo --prefix=$prefix --disable-shared || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=no' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "mdemo"
+func_make_distclean
+func_configure "--disable-shared"
+func_check_static_shared "yes" "no"
 
 exit 0
index 2ffe4f9f1f1d63ae6f3a49af47bf813c22383fc6..15b6a4925d233fe4ca0fd84e3a65b9c8fb493d67 100755 (executable)
@@ -1,32 +1,36 @@
 #! /bin/sh
-# mdemo.test - try uninstalling in the ../mdemo subdirectory
+# mdemo-unst.test - try uninstalling in the mdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Make sure it was installed already
-if test "$prefix/bin/hell" && cd ../mdemo && test -f Makefile; then :
-else
-  echo "You must run mdemo-inst.test before $0." 1>&2
-  exit 77
-fi
+func_require "mdemo-inst" "$prefix/bin/mdemo$EXEEXT" "mdemo/Makefile"
 
-echo "= Running $make uninstall in ../mdemo"
-$make uninstall || exit 1
-
-# See that there were no files leftover in $prefix.
-# Ignore dotfiles, so that .nfsXXX files don't screw up the test.
-leftovers=`find $prefix ! -type d ! -name '.*' -print`
-if test -n "$leftovers"; then
-  echo "= Leftover after make uninstall:"
-  ls -l $leftovers
-  exit 1
-fi
+func_mkprefixdir
+func_cd "mdemo"
+func_make_uninstall
 
 exit 0
diff --git a/tests/mdemo/.cvsignore b/tests/mdemo/.cvsignore
new file mode 100644 (file)
index 0000000..47c0c4b
--- /dev/null
@@ -0,0 +1,15 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+conftest*
+libtool
+*.lo
+*.la
+mdemo
+mdemo_static
diff --git a/tests/mdemo/Makefile.am b/tests/mdemo/Makefile.am
new file mode 100644 (file)
index 0000000..a005d16
--- /dev/null
@@ -0,0 +1,75 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+INCLUDES = $(INCLTDL)
+
+lib_LTLIBRARIES = libsub.la foo1.la libfoo2.la libmlib.la
+
+foo1_la_SOURCES = foo1.c
+foo1_la_LIBADD = $(LIBM) libsub.la
+foo1_la_LDFLAGS = -no-undefined -module -avoid-version
+
+libfoo2_la_SOURCES = foo2.c
+libfoo2_la_LIBADD = $(LIBM) libsub.la
+libfoo2_la_LDFLAGS = -no-undefined -module -export-symbols-regex "libfoo2.*"
+
+libsub_la_SOURCES = sub.c
+libsub_la_LDFLAGS = -no-undefined
+
+libmlib_la_SOURCES = mlib.c
+libmlib_la_LIBADD = @LIBLTDL@ "-dlopen" foo1.la "-dlopen" libfoo2.la
+libmlib_la_LDFLAGS = -no-undefined
+libmlib_la_DEPENDENCIES = @LIBLTDL@ libsub.la foo1.la libfoo2.la
+
+noinst_HEADERS = foo.h
+
+bin_PROGRAMS = mdemo mdemo_static
+
+## 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@: $(top_distdir)/libtool $(top_distdir)/libltdl/libtool \
+    $(top_distdir)/libltdl/config.h $(srcdir)/$(top_distdir)/libltdl/ltdl.c \
+    $(srcdir)/$(top_distdir)/libltdl/ltdl.h
+       (cd $(top_distdir)/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
+$(top_distdir)/libltdl/libtool $(top_distdir)/libltdl/config.h:
+
+# Create a version of mdemo that does dlopen.
+mdemo_SOURCES = main.c
+mdemo_LDFLAGS = -export-dynamic
+## The quotes around -dlopen below fool automake into accepting it
+mdemo_LDADD = @LIBLTDL@ libsub.la "-dlopen" self \
+               "-dlopen" foo1.la "-dlopen" libfoo2.la
+mdemo_DEPENDENCIES = @LIBLTDL@ libsub.la 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/tests/mdemo/README b/tests/mdemo/README
new file mode 100644 (file)
index 0000000..936396a
--- /dev/null
@@ -0,0 +1,17 @@
+This is mdemo, an example package that uses GNU libtool with an
+Automake-generated environment to build two simple modules and 
+a program.
+
+It demonstrates how to build both dynamic and static libraries
+that can be dlopened. mdemo uses libtool's portable dlopen
+wrapper called "libltdl". 
+All exported symbols are prefixed with "libname_LTX_" to avoid
+symbols conflicts, especially when linking statically.
+libltdl will automatically cut the prefix off to get the real name.
+
+Note that on Windows, for the purposes of illustrating ltdl, the
+libraries *are* built as dll's, but do not have the __declspec
+machinery to make them suitable for loading at link time.  This is
+only for clarity inside this example, look at the example in ../demo
+to see how the __declspec macros should be set up.
+
diff --git a/tests/mdemo/configure.ac b/tests/mdemo/configure.ac
new file mode 100644 (file)
index 0000000..792918c
--- /dev/null
@@ -0,0 +1,80 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([mdemo], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([main.c])
+AC_CONFIG_AUX_DIR([../../config])
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ------------------ ##
+## C compiler checks. ##
+## ------------------ ##
+AC_PROG_CC
+AC_C_CONST
+
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AC_LIBLTDL_CONVENIENCE([../../libltdl])
+AC_SUBST([INCLTDL])
+AC_SUBST([LIBLTDL])
+
+AC_LIBTOOL_WIN32_DLL
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
+  STATIC=-static
+else
+  STATIC=
+fi
+AC_SUBST([STATIC])
+
+
+## ---------------------------- ##
+## C headers required by mdemo. ##
+## ---------------------------- ##
+AC_CHECK_HEADERS([math.h])
+
+
+## ---------------------------- ##
+## Libraries required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_LIBM
+AC_SUBST([LIBM])
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/mdemo/foo.h b/tests/mdemo/foo.h
new file mode 100644 (file)
index 0000000..be28c77
--- /dev/null
@@ -0,0 +1,31 @@
+/* foo.h -- interface to the libfoo* libraries
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+/* Silly constants that the functions return. */
+#define HELLO_RET 0xe110
+#define FOO_RET 0xf00
+
+extern void sub();
+
+#endif /* !_FOO_H_ */
diff --git a/tests/mdemo/foo1.c b/tests/mdemo/foo1.c
new file mode 100644 (file)
index 0000000..e09c5f8
--- /dev/null
@@ -0,0 +1,57 @@
+/* foo1.c -- trivial test library
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+#define nothing foo1_LTX_nothing
+#define foo1   foo1_LTX_foo1
+#define hello  foo1_LTX_hello
+
+/* Give a global variable definition. */
+int nothing;
+
+/* private function */
+int
+_foo1_helper()
+{
+  sub();
+  return FOO_RET;
+}
+
+/* exported functions */
+
+int
+foo1()
+{
+  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
+  return _foo1_helper();
+}
+
+int
+hello()
+{
+  printf ("** This is foolib 1 **\n");
+  return HELLO_RET;
+}
diff --git a/tests/mdemo/foo2.c b/tests/mdemo/foo2.c
new file mode 100644 (file)
index 0000000..443994d
--- /dev/null
@@ -0,0 +1,57 @@
+/* foo2.c -- trivial test library
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+#define nothing libfoo2_LTX_nothing
+#define foo2   libfoo2_LTX_foo2
+#define hello  libfoo2_LTX_hello
+
+/* Give a global variable definition. */
+int nothing;
+
+/* private function */
+int
+_foo2_helper()
+{
+  sub();
+  return FOO_RET;
+}
+
+/* exported functions */
+
+int
+foo2()
+{
+  printf ("sin (0.0) = %g\n", (double) sin ((double) 0.0));
+  return _foo2_helper();
+}
+
+int
+hello()
+{
+  printf ("** This is foolib 2 **\n");
+  return HELLO_RET;
+}
diff --git a/tests/mdemo/main.c b/tests/mdemo/main.c
new file mode 100644 (file)
index 0000000..312fd10
--- /dev/null
@@ -0,0 +1,195 @@
+/* main.c -- mdemo test program
+   Copyright (C) 1998-2000 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+#include "ltdl.h"
+#include <stdio.h>
+
+int
+test_dl (filename)
+  char *filename;
+{
+  lt_dlhandle handle;  
+  const lt_dlinfo *info;
+  int (*pfoo1)() = 0;
+  int (*pfoo2)() = 0;
+  int (*phello)() = 0;
+  int *pnothing = 0;
+  int ret = 0;
+
+  handle = lt_dlopen(filename);
+  if (!handle) {
+    fprintf (stderr, "can't open the module %s!\n", filename);
+    fprintf (stderr, "error was: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  info = lt_dlgetinfo(handle);
+  if (!info) {
+    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
+    return 1;
+  }
+  if (info->name) {
+    printf ("module name: %s\n", info->name);
+  } else {
+    printf ("module is not a libtool module\n");
+  }
+  printf ("module filename: %s\n", info->filename);
+  printf ("module reference count: %i\n", info->ref_count);
+  
+  phello = (int(*)())lt_dlsym(handle, "hello");  
+  if (phello)
+    {
+      int value = (*phello) ();
+      
+      printf ("hello returned: %i\n", value);
+      if (value == HELLO_RET)
+        printf("hello is ok!\n");
+    }
+  else
+    {
+      fprintf (stderr, "did not find the `hello' function\n");
+      fprintf (stderr, "error was: %s\n", lt_dlerror());
+      ret = 1;
+    }
+
+  pnothing = (int*)lt_dlsym(handle, "nothing");  
+  /* Try assigning to the nothing variable. */
+  if (pnothing)
+    *pnothing = 1;
+  else
+    {
+      fprintf (stderr, "did not find the `nothing' variable\n");
+      fprintf (stderr, "error was: %s\n", lt_dlerror());
+      ret = 1;
+    }
+
+  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");  
+  /* Just call the functions and check return values. */
+  if (pfoo1)
+    {
+      if ((*pfoo1) () == FOO_RET)
+        printf("foo1 is ok!\n");
+      else
+       ret = 1;
+    }
+  else {
+    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");  
+    if (pfoo2)
+      {
+        if ((*pfoo2) () == FOO_RET)
+          printf("foo2 is ok!\n");
+        else ret = 1;
+      }
+    else
+      {
+        fprintf (stderr, "did not find any of the `foo' functions\n");
+        fprintf (stderr, "error was: %s\n", lt_dlerror());
+        ret = 1;
+      }
+  }
+  lt_dlclose(handle);
+  return ret;
+}
+
+int
+myfunc ()
+{
+  return HELLO_RET;
+}
+
+int myvar;
+
+int
+test_dlself ()
+{
+  lt_dlhandle handle;  
+  int (*pmyfunc)() = 0;
+  int *pmyvar = 0;
+  int ret = 0;
+
+  handle = lt_dlopen(0);
+  if (!handle) {
+    fprintf (stderr, "can't dlopen the program!\n");
+    fprintf (stderr, "error was: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  pmyfunc = (int(*)())lt_dlsym(handle, "myfunc");  
+  if (pmyfunc)
+    {
+      int value = (*pmyfunc) ();
+      
+      printf ("myfunc returned: %i\n", value);
+      if (value == HELLO_RET)
+        printf("myfunc is ok!\n");
+    }
+  else
+    {
+      fprintf (stderr, "did not find the `myfunc' function\n");
+      fprintf (stderr, "error was: %s\n", lt_dlerror());
+      ret = 1;
+    }
+
+  pmyvar = (int*)lt_dlsym(handle, "myvar");  
+  /* Try assigning to the variable. */
+  if (pmyvar)
+    *pmyvar = 1;
+  else
+    {
+      fprintf (stderr, "did not find the `myvar' variable\n");
+      fprintf (stderr, "error was: %s\n", lt_dlerror());
+      ret = 1;
+    }
+
+  lt_dlclose(handle);
+  return ret;
+}
+
+int
+main (argc, argv)
+  int argc;
+  char **argv;
+{
+  int i;
+  int ret = 0;
+
+  printf ("Welcome to GNU libtool mdemo!\n");
+
+  if (argc < 2) {
+    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
+  }
+
+  LTDL_SET_PRELOADED_SYMBOLS();
+  if (lt_dlinit() != 0) {
+    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  for (i = 1; i < argc; i++)
+    if (test_dl(argv[i]))
+       ret = 1;
+
+  if (test_dlself())
+    ret = 1;
+
+  lt_dlexit();
+  return ret;
+}
diff --git a/tests/mdemo/mlib.c b/tests/mdemo/mlib.c
new file mode 100644 (file)
index 0000000..bb859d3
--- /dev/null
@@ -0,0 +1,134 @@
+/* main.c -- mlib library
+   Copyright (C) 2002 Free Software Foundation, Inc.
+   Originally by greg Eisenhauer <eisen at cc.gatech.edu>
+   Extracted from mdemo.c
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include "foo.h"
+#include "ltdl.h"
+#include <stdio.h>
+
+int
+test_dl (filename)
+  char *filename;
+{
+  lt_dlhandle handle;  
+  const lt_dlinfo *info;
+  int (*pfoo1)() = 0;
+  int (*pfoo2)() = 0;
+  int (*phello)() = 0;
+  int *pnothing = 0;
+  int ret = 0;
+
+  handle = lt_dlopen(filename);
+  if (!handle) {
+    fprintf (stderr, "can't open the module %s!\n", filename);
+    fprintf (stderr, "error was: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  info = lt_dlgetinfo(handle);
+  if (!info) {
+    fprintf (stderr, "can't get module info: %s\n", lt_dlerror());
+    return 1;
+  }
+  if (info->name) {
+    printf ("module name: %s\n", info->name);
+  } else {
+    printf ("module is not a libtool module\n");
+  }
+  printf ("module filename: %s\n", info->filename);
+  printf ("module reference count: %i\n", info->ref_count);
+  
+  phello = (int(*)())lt_dlsym(handle, "hello");  
+  if (phello)
+    {
+      int value = (*phello) ();
+      
+      printf ("hello returned: %i\n", value);
+      if (value == HELLO_RET)
+        printf("hello is ok!\n");
+    }
+  else
+    {
+      fprintf (stderr, "did not find the `hello' function\n");
+      fprintf (stderr, "error was: %s\n", lt_dlerror());
+      ret = 1;
+    }
+
+  pnothing = (int*)lt_dlsym(handle, "nothing");  
+  /* Try assigning to the nothing variable. */
+  if (pnothing)
+    *pnothing = 1;
+  else
+    {
+      fprintf (stderr, "did not find the `nothing' variable\n");
+      fprintf (stderr, "error was: %s\n", lt_dlerror());
+      ret = 1;
+    }
+
+  pfoo1 = (int(*)())lt_dlsym(handle, "foo1");  
+  /* Just call the functions and check return values. */
+  if (pfoo1)
+    {
+      if ((*pfoo1) () == FOO_RET)
+        printf("foo1 is ok!\n");
+      else
+       ret = 1;
+    }
+  else {
+    pfoo2 = (int(*)())lt_dlsym(handle, "foo2");  
+    if (pfoo2)
+      {
+        if ((*pfoo2) () == FOO_RET)
+          printf("foo2 is ok!\n");
+        else ret = 1;
+      }
+    else
+      {
+        fprintf (stderr, "did not find any of the `foo' functions\n");
+        fprintf (stderr, "error was: %s\n", lt_dlerror());
+        ret = 1;
+      }
+  }
+  lt_dlclose(handle);
+  return ret;
+}
+int 
+mlib_func(argc, argv)
+int argc;
+char **argv;
+{
+  int ret = 0;
+  int i;
+  /*
+   * Would be nice if this somehow worked for libraries, not just executables.
+   * LTDL_SET_PRELOADED_SYMBOLS();
+   */
+  if (lt_dlinit() != 0) {
+    fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
+    return 1;
+  }
+
+  for (i = 1; i < argc; i++)
+    if (test_dl(argv[i]))
+       ret = 1;
+
+  lt_dlexit();
+  return ret;
+}
diff --git a/tests/mdemo/sub.c b/tests/mdemo/sub.c
new file mode 100644 (file)
index 0000000..75dc497
--- /dev/null
@@ -0,0 +1,27 @@
+/* sub.c -- trivial test library
+   Copyright (C) 1998-1999 Free Software Foundation, Inc.
+   Originally by Thomas Tanner <tanner@ffii.org>
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include <stdio.h>
+
+void
+sub()
+{
+  printf ("sub() called\n");
+}
index b92dd2247e84f559c0c7a90f80a511b4618f1100..5229db86816943ad5f2a8d5e986490c171a788bb 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# mdemo2-conf.test - try configuring the ../mdemo2 subdirectory
+# mdemo2-conf.test - try configuring the mdemo2 subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../mdemo2 || mkdir ../mdemo2
-
-# Change to our build directory.
-cd ../mdemo2 || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../mdemo2"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../mdemo2 (prefix=$prefix)"
-CONFIG_SITE=/nonexistent ${CONFIG_SHELL-/bin/sh} $srcdir/../mdemo2/configure --srcdir=$srcdir/../mdemo2 --prefix=$prefix || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "mdemo2"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
index 74aaacf69800ca48fcdbfef1cc4ea4a792918042..8b4eb2362062c9bcbc15654c3a7de2f1673c828b 100755 (executable)
@@ -1,35 +1,37 @@
 #! /bin/sh
-# mdemo2-exec.test - check that programs in the ../mdemo2 subdirectory are viable
+# mdemo2-exec.test - check that programs in the mdemo2 subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../mdemo2/mdemo2; then :
-else
-  echo "You must run mdemo2-make.test before running $0" 1>&2
-  exit 77
-fi
-
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../mdemo2"
+func_require "mdemo2-make" "mdemo2/mdemo2$EXEEXT"
 
-status=0
-if ../mdemo2/mdemo2_static ../mdemo/foo1.la ../mdemo/libfoo2.la; then :
-else
-  echo "$0: execution of ../mdemo2/mdemo2_static failed" 1>&2
-  status=1
-fi
-
-if ../mdemo2/mdemo2 ../mdemo/foo1.la ../mdemo/libfoo2.la; then :
-else
-  echo "$0: execution of ../mdemo2/mdemo2 failed" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "mdemo2/mdemo2_static mdemo/foo1.la mdemo/libfoo2.la"
+func_exec "mdemo2/mdemo2 mdemo/foo1.la mdemo/libfoo2.la"
 
-exit $status
+exit $exec_status
index ebaf8b37b243a156d16f50d9e11c682bdb947ae4..650d7cf0f33ac9ffca51c5686e3fd4b9f12a2378 100755 (executable)
@@ -1,31 +1,37 @@
 #! /bin/sh
-# mdemo2-make.test - try building in the ../mdemo2 subdirectory
+# mdemo2-make.test - try building in the mdemo2 subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../mdemo2/Makefile; then :
-else
-  echo "You must run mdemo2-conf.test before running $0" 1>&2
-  exit 77
-fi
-
-if test -f ../mdemo/libmlib.la; then :
-else
-  echo "You must run mdemo-make.test before running $0" 1>&2
-  exit 77
-fi
+func_require "mdemo2-conf" "mdemo2/Makefile"
+func_require "mdemo-make" "mdemo/libmlib.la"
 
-# Change to our build directory.
-cd ../mdemo2 || exit 1
+func_rmprefixdir
+func_cd "mdemo2"
+func_make
 
-# Do the actual build.
-echo "Making in ../mdemo2"
-$make || exit 1
 exit 0
diff --git a/tests/mdemo2/.cvsignore b/tests/mdemo2/.cvsignore
new file mode 100644 (file)
index 0000000..fd7a079
--- /dev/null
@@ -0,0 +1,15 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+conftest*
+libtool
+*.lo
+*.la
+mdemo2
+mdemo2_static
diff --git a/tests/mdemo2/Makefile.am b/tests/mdemo2/Makefile.am
new file mode 100644 (file)
index 0000000..f68e950
--- /dev/null
@@ -0,0 +1,42 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+AM_CPPFLAGS = -I$(top_distdir)/libltdl
+
+bin_PROGRAMS = mdemo2 mdemo2_static
+
+# Create a version of mdemo2 that links a library that does dlopen.
+mdemo2_SOURCES = main.c
+mdemo2_LDFLAGS = -export-dynamic "-dlopen" force
+mdemo2_LDADD = ../mdemo/libmlib.la
+
+# Create a statically linked version of mdemo.
+mdemo2_static_SOURCES = $(mdemo2_SOURCES)
+mdemo2_static_LDFLAGS = $(STATIC) $(mdemo2_LDFLAGS)
+mdemo2_static_LDADD = $(mdemo2_LDADD)
+mdemo2_static_DEPENDENCIES = $(mdemo2_DEPENDENCIES)
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
diff --git a/tests/mdemo2/README b/tests/mdemo2/README
new file mode 100644 (file)
index 0000000..8a1e18b
--- /dev/null
@@ -0,0 +1,5 @@
+This is mdemo2, an example package that attempts to use GNU libtool to
+link with a library that itself does dlopening of libtool modules.
+
+This demo depends upon the libraries generated in ../mdemo.
+
diff --git a/tests/mdemo2/configure.ac b/tests/mdemo2/configure.ac
new file mode 100644 (file)
index 0000000..5a28908
--- /dev/null
@@ -0,0 +1,72 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([mdemo2], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([main.c])
+AC_CONFIG_AUX_DIR([../../config])
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ------------------ ##
+## C compiler checks. ##
+## ------------------ ##
+AC_PROG_CC
+AC_C_CONST
+
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
+  STATIC=-static
+else
+  STATIC=
+fi
+AC_SUBST([STATIC])
+
+
+## ---------------------------- ##
+## C headers required by mdemo2. ##
+## ---------------------------- ##
+
+
+## ---------------------------- ##
+## Libraries required by cdemo. ##
+## ---------------------------- ##
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/mdemo2/main.c b/tests/mdemo2/main.c
new file mode 100644 (file)
index 0000000..7e85a43
--- /dev/null
@@ -0,0 +1,42 @@
+/* main.c -- mdemo2 test program
+   Copyright (C) 2003 Free Software Foundation, Inc.
+   Originally by Greg Eisenhauer < eisen at cc.gatech.edu >
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#include <stdio.h>
+#include "ltdl.h"
+
+int
+main (argc, argv)
+  int argc;
+  char **argv;
+{
+  int ret = 0;
+
+  printf ("Welcome to GNU libtool mdemo2!\n");
+  if (argc < 2) {
+    fprintf (stderr, "usage: %s module [module...]\n", argv[0]);
+  }
+
+/* This must be called in the program to get the preloaded symbols */
+  LTDL_SET_PRELOADED_SYMBOLS();
+
+  ret = mlib_func(argc, argv);
+
+  return ret;
+}
diff --git a/tests/noinst-link.test b/tests/noinst-link.test
deleted file mode 100755 (executable)
index edf3c3f..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-# noinst-link.test - make sure we do not link with an installed
-# library when an uninstalled one is to be used
-
-# Test script header.
-need_prefix=yes
-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 $prefix/lib/libhello.la; then :
-else
-  echo "You must run demo-inst.test before $0" 1>&2
-  exit 77
-fi
-
-# Change to our build directory.
-cd ../demo || exit 77
-
-echo "removing libhello.la and hell from ../demo"
-rm -f libhello.la hell$EXEEXT
-
-echo "linking hell with a broken ../demo/libhello.la"
-if $make hell$EXEEXT libhello_la_OBJECTS=hello.lo; then
-  echo "= Succeeded: this means the installed library was used, which is wrong"
-  status=1
-fi
-
-rm -f libhello.la hell$EXEEXT
-
-exit $status
index 55c9cd246f968fbbded04812dcaec09781daa690..16822abf40172bd369f3ed48570682f663594b4b 100755 (executable)
@@ -1,27 +1,44 @@
 #! /bin/sh
 # nomode.test - check that we can actually get help
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
+status=$EXIT_SUCCESS
 if $libtool --help 2>&1 | grep '^Usage:' >/dev/null; then :
 else
   echo "cannot get top-level help"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # The emoticon below works around a nasty bug in Ultrix /bin/sh
 if ($libtool 2>&1; :) | grep 'you must specify a MODE' >/dev/null; then :
 else
   echo "invalid error when no mode is specified"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 exit $status
index 655b81831ec5531ee1b069895505aae444f8d1c1..30a79add9a9aa439765f454176eed9019fe88885 100755 (executable)
@@ -1,36 +1,37 @@
 #! /bin/sh
-# pdemo-conf.test - try configuring the ../pdemo subdirectory
+# pdemo-conf.test - try configuring the pdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../pdemo || mkdir ../pdemo
-
-# Change to our build directory.
-cd ../pdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../pdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../pdemo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../pdemo/configure --srcdir=$srcdir/../pdemo --prefix=$prefix || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "pdemo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 if test -f ./libtool ; then
   sed 's/^max_cmd_len=*/max_cmd_len=24 # /g' ./libtool > ltnew
index 64d129c16ec58819d869dad1d9565eb90d033905..b5bf7a4b0bfaea6c78876b2879b4576bdb7a31b6 100755 (executable)
@@ -1,41 +1,38 @@
 #! /bin/sh
-# pdemo-exec.test - check that programs in the ../pdemo subdirectory are viable
+# pdemo-exec.test - check that programs in the pdemo subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../pdemo/hell$EXEEXT; then :
-else
-  echo "You must run pdemo-make.test before running $0" 1>&2
-  exit 77
-fi
+func_require "pdemo-make" "pdemo/hell$EXEEXT"
 
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../pdemo"
-
-status=0
-if ../pdemo/hell_static| grep 'Welcome to GNU Hell'; then :
-else
-  echo "$0: cannot execute ../pdemo/hell_static" 1>&2
-  status=1
-fi
-
-if ../pdemo/hell | grep 'Welcome to GNU Hell'; then :
-else
-  echo "$0: cannot execute ../pdemo/hell" 1>&2
-  status=1
-fi
-
-if ../pdemo/helldl | $EGREP -e '(Welcome to .*GNU Hell|unsupported)'; then :
-else
-  echo "$0: cannot execute ../pdemo/helldl" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "pdemo/hell_static" 'Welcome to GNU Hell'
+func_exec "pdemo/hell" 'Welcome to GNU Hell'
+func_exec "pdemo/helldl" '(Welcome to .*GNU Hell|unsupported)'
 
-exit $status
+exit $exec_status
index 9310356e9053af760d1fa86a67751b892a493f0f..98e762aeaaf0c01648e5b728fcfd565965a84c92 100755 (executable)
@@ -1,58 +1,40 @@
 #! /bin/sh
-# pdemo-inst.test - try installing from the ../pdemo subdirectory
+# demo-inst.test - try installing from the demo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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 ../pdemo/hell$EXEEXT; then :
-else
-  echo "You must run pdemo-make.test before $0" 1>&2
-  exit 77
-fi
-
-# Change to our build directory.
-cd ../pdemo || exit 1
-
-echo "= Running $make install in ../pdemo"
-$make install || exit 1
-
-echo "= Executing installed programs"
-status=0
-if $prefix/bin/hell_static | grep 'Welcome to GNU Hell'; then :
-else
-  echo "$0: cannot execute $prefix/bin/hell_static" 1>&2
-  status=1
-fi
+func_require "demo-make" "demo/hell$EXEEXT"
 
-if $prefix/bin/hell | grep 'Welcome to 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
-  status=1
-fi
-
-if $prefix/bin/helldl | $EGREP -e '(Welcome to .*GNU Hell|unsupported)'; then :
-else
-  echo "$0: cannot execute $prefix/bin/helldl" 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
-  status=1
-fi
+func_mkprefixdir
+func_cd "demo"
+func_make "install"
+func_exec_init "installed"
+func_exec "$prefix/bin/hell_static" 'Welcome to GNU Hell'
+func_exec "$prefix/bin/hell" 'Welcome to GNU Hell'
+func_exec "$prefix/bin/helldl" '(Welcome to .*GNU Hell|unsupported)'
 
 exit $status
index 553299e52184cc8e732092af768a0f9f1c032fea..70a8b844c2d92338f35c63a106f452bd0eedaf75 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# pdemo-make.test - try building in the ../pdemo subdirectory
+# pdemo-make.test - try building in the pdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../pdemo/Makefile; then :
-else
-  echo "You must run pdemo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "pdemo-conf" "pdemo/Makefile"
 
-# Change to our build directory.
-cd ../pdemo || exit 1
+func_rmprefixdir
+func_cd "pdemo"
+func_make
 
-# Do the actual build.
-echo "Making in ../pdemo"
-$make || exit 1
 exit 0
diff --git a/tests/pdemo/.cvsignore b/tests/pdemo/.cvsignore
new file mode 100644 (file)
index 0000000..2448112
--- /dev/null
@@ -0,0 +1,20 @@
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+autom4te.cache
+configure
+config.*
+conftest*
+hc-direct
+hc-libflag
+hc-libpath
+hc-minusL
+libtool
+*.lo
+*.la
+hell
+hell_static
+helldl
diff --git a/tests/pdemo/Makefile.am b/tests/pdemo/Makefile.am
new file mode 100644 (file)
index 0000000..a8fcc4d
--- /dev/null
@@ -0,0 +1,157 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+# Build a libtool library, libhello.la for installation in libdir.
+lib_LTLIBRARIES = libhello.la
+libhello_la_SOURCES = longer_file_name_hello.c longer_file_name_foo.c longer_file_name_foo2.c
+libhello_la_LIBADD = $(LIBM)
+libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1
+
+include_HEADERS = foo.h
+
+if BINARY_HELLDL
+BUILD_helldl = helldl
+else
+BUILD_helldl =
+endif
+
+bin_PROGRAMS = hell hell_static $(BUILD_helldl)
+
+# Build hell from longer_file_name_main.c and libhello.la
+hell_SOURCES = longer_file_name_main.c
+hell_LDADD = libhello.la
+
+# Create a statically linked version of hell.
+hell_static_SOURCES = longer_file_name_main.c
+hell_static_LDADD = libhello.la
+hell_static_LDFLAGS = $(STATIC)
+
+if BINARY_HELLDL
+
+# Create a version of hell that does a preloaded dlopen.
+helldl_SOURCES = longer_file_name_dlmain.c
+helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la
+helldl_DEPENDENCIES = libhello.la
+
+else
+
+bin_SCRIPTS = helldl
+# create a script that says that -dlopen is not supported
+helldl helldl$(EXEEXT):
+       rm -f $@
+       echo '#! /bin/sh' > $@
+       echo '-dlopen is unsupported' >> $@
+       chmod +x $@
+endif
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
+
+#----------------------------------------------------------------------
+# The following declarations are only used in the testsuite:
+#----------------------------------------------------------------------
+
+hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL
+CLEANFILES = $(hardcode_tests)
+
+# Unfortunately, in order to test libtool thoroughly, we need access
+# to its private directory.
+objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'`
+
+# Test programs to see what gets hardcoded.
+.PHONY: hardcode
+hardcode: $(hardcode_tests)
+SET_HARDCODE_FLAGS = \
+  eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'`
+hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+       @rm -f hc-direct
+       @echo "You may ignore any linking errors from the following command:"
+       @shlib=./$(objdir)/libhello.a; \
+         eval "`grep '^library_names' libhello.la`"; \
+         for lib in $$library_names; do \
+           shlib="./$(objdir)/$$lib"; \
+         done; \
+         $(SET_HARDCODE_FLAGS); \
+         libdir=$(libdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
+         eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
+
+hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+       @$(SET_HARDCODE_FLAGS); \
+         libdir=`pwd`/$(objdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         if test -z "$$flag"; then \
+           echo "echo unsupported > $@"; \
+           echo unsupported > $@ || status="$$?"; \
+         else \
+           echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \
+           $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \
+         fi; \
+         exit $$status
+
+hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la
+       @rm -f hc-libpath
+       @echo "You may ignore any linking errors from the following command:"
+       @$(SET_HARDCODE_FLAGS); \
+         eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \
+         libdir=$(libdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
+         eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
+
+hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES)
+       @rm -f hc-minusL
+       @$(SET_HARDCODE_FLAGS); \
+         libdir=$(libdir); \
+         flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \
+         echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \
+         eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"
+
+# This is one of the essential tests for deplibs_check_method=pass_all.
+# If this one passes with pass_all, it is likely that pass_all works
+EXTRA_LIBRARIES = libhell0.a
+libhell0_a_SOURCES =
+libhell0_a_LIBADD = longer_file_name_hello.o longer_file_name_foo.o
+EXTRA_LTLIBRARIES = libhell1.la libhell2.la
+libhell1_la_SOURCES = longer_file_name_hell1.c
+libhell1_la_LIBADD = -L. -lhell0
+libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir)
+libhell1_la_DEPENDENCIES = libhell0.a
+libhell2_la_SOURCES = longer_file_name_hell2.c
+libhell2_la_LIBADD = -L. -lhell0
+libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir)
+libhell2_la_DEPENDENCIES = libhell0.a
+EXTRA_PROGRAMS = hell0
+hell0_SOURCES = longer_file_name_main.c
+hell0_LDADD = libhell1.la libhell2.la $(LIBM)
+
+# 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we
+# must explicitly list the wrapper script 'hell0'.  (bin_PROGRAMS
+# are handled seamlessly by automake rules; the extra step is only
+# necessary for EXTRA_PROGRAMS)
+CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0
+
+deplibs-check: hell0
diff --git a/tests/pdemo/configure.ac b/tests/pdemo/configure.ac
new file mode 100644 (file)
index 0000000..d13e533
--- /dev/null
@@ -0,0 +1,78 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright (C) 2001, 2003  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([pdemo], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([longer_file_name_hello.c])
+AC_CONFIG_AUX_DIR([../../config])
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(hell,1.0)
+
+
+## ------------------ ##
+## C compiler checks. ##
+## ------------------ ##
+AC_PROG_CC
+AC_C_CONST
+
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+AC_SUBST([LIBTOOL_DEPS])
+
+if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
+  STATIC=-static
+else
+  STATIC=
+fi
+AC_SUBST([STATIC])
+
+AM_CONDITIONAL([BINARY_HELLDL],
+    [grep '^global_symbol_pipe=..*$' ./libtool >/dev/null])
+
+
+## ---------------------------- ##
+## C headers required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_HEADERS([string.h math.h])
+
+
+## ---------------------------- ##
+## Libraries required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_LIBM
+AC_SUBST([LIBM])
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/pdemo/foo.h b/tests/pdemo/foo.h
new file mode 100644 (file)
index 0000000..6d4fee7
--- /dev/null
@@ -0,0 +1,90 @@
+/* foo.h -- interface to the libfoo library
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+/* Only include this header file once. */
+#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and
+ * earlier do not define __CYGWIN__.  This snippit allows us to check
+ * for __CYGWIN32__ reliably for both old and (probable) future releases.
+ */
+#ifdef __CYGWIN__
+#  ifndef __CYGWIN32__
+#    define __CYGWIN32__
+#  endif
+#endif
+
+/* __BEGIN_DECLS should be used at the beginning of your declarations,
+   so that C++ compilers don't mangle their names.  Use __END_DECLS at
+   the end of C declarations. */
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+/* LTDL_PARAMS is a macro used to wrap function prototypes, so that compilers
+   that don't understand ANSI C prototypes still work, and ANSI C
+   compilers can issue warnings about type mismatches. */
+#undef LTDL_PARAMS
+#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(__CYGWIN32__) || defined(__cplusplus)
+# define LT_PARAMS(protos) protos
+# define lt_ptr_t     void*
+#else
+# define LT_PARAMS(protos) ()
+# define lt_ptr_t     char*
+#endif
+
+#ifdef __CYGWIN32__
+#  ifdef LIBFOO_DLL
+     /* need some (as yet non-existant) automake magic to tell
+      * the object whether the libfoo it will be linked with is
+      * a dll or not, ie whether LIBFOO_DLL is defined or not.
+      */
+#    ifdef _LIBFOO_COMPILATION_
+#      define EXTERN __declspec(dllexport)
+#    else
+#      define EXTERN extern __declspec(dllimport)
+#    endif
+#  else
+#    define EXTERN extern
+#  endif
+#else
+#  define EXTERN extern
+#endif
+
+/* Silly constants that the functions return. */
+#define HELLO_RET 0xe110
+#define FOO_RET 0xf00
+
+
+/* Declarations.  Note the wonderful use of the above macros. */
+__BEGIN_DECLS
+int foo LT_PARAMS((void));
+int hello LT_PARAMS((void));
+EXTERN int nothing;
+__END_DECLS
+
+#endif /* !_FOO_H_ */
diff --git a/tests/pdemo/longer_file_name_dlmain.c b/tests/pdemo/longer_file_name_dlmain.c
new file mode 100644 (file)
index 0000000..7c123bb
--- /dev/null
@@ -0,0 +1,95 @@
+/* dlmain.c -- hello test program that uses simulated dynamic linking
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+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. */
+
+#include "foo.h"
+#include <stdio.h>
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+struct lt_symlist
+{
+  const char *name;
+  lt_ptr_t address;
+};
+
+extern const struct lt_symlist lt_preloaded_symbols[];
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  const struct lt_symlist *s;
+  int (*pfoo)() = 0;
+  int (*phello)() = 0;
+  int *pnothing = 0;
+
+  printf ("Welcome to *modular* GNU Hell!\n");
+
+  /* Look up the symbols we require for this demonstration. */
+  s = lt_preloaded_symbols;
+  while (s->name)
+    {
+      if (s->address) {
+        const char *name = s->name;
+        printf ("found symbol: %s\n", name);
+        if (!strcmp ("hello", name))
+         phello = (int(*)())s->address;
+        else if (!strcmp ("foo", name))
+         pfoo = (int(*)())s->address;
+        else if (!strcmp ("nothing", name))
+#ifndef _WIN32
+         /* In an ideal world we could do this... */
+         pnothing = (int*)s->address;
+#else /* !_WIN32 */
+         /* In an ideal world a shared lib would be able to export data */
+         pnothing = (int*)&nothing;
+#endif
+      } else 
+        printf ("found file: %s\n", s->name);
+      s ++;
+    }
+
+  /* Try assigning to the nothing variable. */
+  if (pnothing)
+    *pnothing = 1;
+  else
+    fprintf (stderr, "did not find the `nothing' variable\n");
+
+  /* Just call the functions and check return values. */
+  if (pfoo)
+    {
+      if ((*pfoo) () != FOO_RET)
+       return 1;
+    }
+  else
+    fprintf (stderr, "did not find the `foo' function\n");
+
+  if (phello)
+    {
+      if ((*phello) () != HELLO_RET)
+       return 3;
+    }
+  else
+    fprintf (stderr, "did not find the `hello' function\n");
+
+  return 0;
+}
diff --git a/tests/pdemo/longer_file_name_foo.c b/tests/pdemo/longer_file_name_foo.c
new file mode 100644 (file)
index 0000000..4b67739
--- /dev/null
@@ -0,0 +1,39 @@
+/* foo.c -- trivial test function for libfoo
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#define _LIBFOO_COMPILATION_
+#include "foo.h"
+#undef _LIBFOO_COMPILATION_
+
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+/* Give a global variable definition. */
+int nothing = FOO_RET;
+
+int
+foo ()
+{
+  printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
+  return FOO_RET;
+}
diff --git a/tests/pdemo/longer_file_name_foo2.c b/tests/pdemo/longer_file_name_foo2.c
new file mode 100644 (file)
index 0000000..0b74731
--- /dev/null
@@ -0,0 +1,36 @@
+/* foo.c -- trivial test function for libfoo
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+USA. */
+
+#define _LIBFOO_COMPILATION_
+#include "foo.h"
+#undef _LIBFOO_COMPILATION_
+
+#include <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+int
+foo2()
+{
+  printf ("foo2 cos (0.0) = %g\n", (double) cos ((double) 0.0));
+  return FOO_RET;
+}
diff --git a/tests/pdemo/longer_file_name_hell1.c b/tests/pdemo/longer_file_name_hell1.c
new file mode 100644 (file)
index 0000000..52e5148
--- /dev/null
@@ -0,0 +1 @@
+int hell1() { return 1; }
diff --git a/tests/pdemo/longer_file_name_hell2.c b/tests/pdemo/longer_file_name_hell2.c
new file mode 100644 (file)
index 0000000..c1ff477
--- /dev/null
@@ -0,0 +1 @@
+int hell2() { return 2; }
diff --git a/tests/pdemo/longer_file_name_hello.c b/tests/pdemo/longer_file_name_hello.c
new file mode 100644 (file)
index 0000000..ec9a639
--- /dev/null
@@ -0,0 +1,32 @@
+/* hello.c -- trivial test function for libfoo
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+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. */
+
+/* Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu> */
+#define _LIBFOO_COMPILATION
+#include "foo.h"
+#undef _LIBFOO_COMPILATION
+
+#include <stdio.h>
+
+int
+hello ()
+{
+  printf ("** This is not GNU Hello.  There is no built-in mail reader. **\n");
+  return HELLO_RET;
+}
diff --git a/tests/pdemo/longer_file_name_main.c b/tests/pdemo/longer_file_name_main.c
new file mode 100644 (file)
index 0000000..09aa5ee
--- /dev/null
@@ -0,0 +1,45 @@
+/* main.c -- trivial hello test program
+   Copyright (C) 1996-1999 Free Software Foundation, Inc.
+   This file is part of GNU Libtool.
+
+This program is free software; you can redistribute it and/or modify
+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. */
+
+/* Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu> */
+#include "foo.h"
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  printf ("Welcome to GNU Hell!\n");
+
+  /* Try assigning to the nothing variable */
+  nothing = 1;
+
+  /* Just call the functions and check return values. */
+  if (foo () != FOO_RET)
+    return 1;
+
+   if (foo2() != FOO_RET)
+    return 1;
+
+ if (hello () != HELLO_RET)
+    return 2;
+
+  return 0;
+}
index e77317a6117a8675fe6f46dcac2020bd7f6fc80c..e7e8487b0702790a04b19440ca2afd3b790b7b41 100755 (executable)
@@ -1,56 +1,36 @@
 #! /bin/sh
 # quote.test - make sure that shell metacharacters do not blow up libtool
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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
 
 # Do the torture test.
-status=0
+status=$EXIT_SUCCESS
 
-echo=echo
-if test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then :
-else
-  # 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.
-  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
-      echo="$dir/echo"
-      break
-    fi
-  done
-  IFS="$save_ifs"
-
-  if test "X$echo" = Xecho; 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 $0 again with it.
-      CONFIG_SHELL=/bin/ksh
-      export CONFIG_SHELL
-      exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"}
-    else
-      # 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
+func_get_config "echo" "../libtool --config"
 
 for mode in compile link install; do
   $echo "== $mode mode"
@@ -85,7 +65,7 @@ for mode in compile link install; do
 
   # Trivial.
   $echo "= trying: no quoting"
-  result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}test" $postargs` || status=1
+  result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}test" $postargs` || status=$EXIT_FAILURE
   # We used to have the contents of $match in the case statement,
   # without an intermediate variable, but it would fail on at least
   # Solaris' and HP-UX's /bin/sh.  Ugh!
@@ -96,14 +76,14 @@ for mode in compile link install; do
     ;;
   *)
     $echo "= failed: $result"
-    status=1
+    status=$EXIT_FAILURE
     ;;
   esac
 
   # Metacharacters that should be backslashified.
   for mchar in \\ \" \` \$; do
     $echo "= trying: \\$mchar quoting"
-    result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=1
+    result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=$EXIT_FAILURE
     match="$preargs ${preflag}${flag}\\${mchar}test\\${mchar} "
     case "$result" in
     *"$match"*)
@@ -111,7 +91,7 @@ for mode in compile link install; do
       ;;
     *)
       $echo "= failed: $result"
-      status=1
+      status=$EXIT_FAILURE
       ;;
     esac
   done
@@ -121,7 +101,7 @@ for mode in compile link install; do
       "'" " " "        "; do
 
     $echo "= trying: \"$mchar\" quoting"
-    result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=1
+    result=`$libtool -n --mode=$mode $preargs ${preflag}"${flag}${mchar}test${mchar}" $postargs` || status=$EXIT_FAILURE
     match="$preargs ${preflag}\"${flag}${mchar}test${mchar}\" "
     case "$result" in
     *"$match"*)
@@ -129,7 +109,7 @@ for mode in compile link install; do
       ;;
     *)
       $echo "= failed: $result"
-      status=1
+      status=$EXIT_FAILURE
       ;;
     esac
   done
index 95907442b238953708cbee8a5fe1e5bb32207166..ffd719e55ec067a6746354d986434caf2d58299b 100755 (executable)
@@ -1,77 +1,94 @@
 #! /bin/sh
 # sh.test - check that we haven't forgotten a `test' command
 
-# Test script header.
-need_prefix=no
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 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 all the "portable" shell scripts.
-status=0
-scripts="$srcdir/../ltmain.sh"
+status=$EXIT_SUCCESS
+scripts="$srcdir/../config/ltmain.sh $srcdir/../libtoolize"
 
 # Check for bad binary operators.
 if $EGREP -n -e "if[   ]+[\"']?\\$.*(=|-[lg][te]|-eq|-ne)" $scripts; then
   echo "use \`if test \$something =' instead of \`if \$something ='"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for bad unary operators.
 if $EGREP -n -e 'if[   ]+-' $scripts; then
   echo "use \`if test -X' instead of \`if -X'"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for using `[' instead of `test'.
 if $EGREP -n -e 'if[   ]+\[' $scripts; then
   echo "use \`if test' instead of \`if ['"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 if $EGREP -n -e 'test[         ]+(![   ])?(-.[         ]+)?"?[.,_x]' $scripts; then
   echo "use \`test \"X...\"' instead of \`test \"x...\"'"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for using test X... instead of test "X...
 if $EGREP -n -e 'test[         ]+(![   ])?(-.[         ]+)?X' $scripts; then
   echo "use \`test \"X...\"' instead of \`test X'"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for using test $... instead of test "$...
 if $EGREP -n -e 'test[         ]+(![   ])?(-.[         ]+)?X?\$' $scripts; then
   echo "use \`test \"\$...\"' instead of \`test \$'"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Never use test -e.
 if $EGREP -n -e 'test[         ]+(![   ])?-e' $scripts; then
   echo "use \`test -f' instead of \`test -e'"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for problems with variable assignments.
 if $EGREP -n -e '[^     ]=[^    ].*(break|continue)' $scripts; then
   echo "assignments on the same line as a \`break' or \`continue' may have no effect"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for uses of Xsed without corresponding echo "X
 if $EGREP -n -e '\$Xsed' $scripts | $EGREP -v -n -e '\$echo \\*"X'; then
   echo "occurrences of \`\$Xsed\' without \`echo \"X\' on the same line"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 # Check for quotes within backquotes within quotes "`"bar"`"
 if $EGREP -n -e '"[^`"]*`[^"`]*"[^"`]*".*`[^`"]*"' $scripts | \
    $EGREP -v "### testsuite: skip nested quoting test$"; then
   echo "nested quotes are dangerous"
-  status=1
+  status=$EXIT_FAILURE
 fi
 
 exit $status
index 11498e05bde3adf0e343a6321d4851defca053a8..1712847f158ee34282218ebc742cc926d5e99cc1 100755 (executable)
@@ -1,25 +1,42 @@
 #! /bin/sh
 # suffix.test - check that libtool knows how to transform source suffices.
 
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
 # Extensions taken from the ones that Automake recognizes, plus Objective C,
 # and GNU Ada.
 extensions="C F S ada adb ads asm c c++ cc cpp cxx f f90 for m s"
 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
+status=$EXIT_SUCCESS
 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
+    status=$EXIT_FAILURE
   else
     echo "recognized foo.$ext as a valid source file"
   fi
@@ -30,7 +47,7 @@ for name in $bad_names; do
   if ($libtool -n --mode=compile compiler -c $name 2>&1; exit 0) | grep 'cannot'; then :
   else
     echo "incorrectly recognized $name as a valid source file"
-    status=1
+    status=$EXIT_FAILURE
   fi
 done
 
index 06edb6ef893a47e2ef43dccb309f99c173a72b68..eda394624e68c21241bc041f0f0330d91aac4e46 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# tagdemo-conf.test - try configuring the ../tagdemo subdirectory
+# tagdemo-conf.test - try configuring the tagdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../tagdemo || mkdir ../tagdemo
-
-# Change to our build directory.
-cd ../tagdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../tagdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../tagdemo (prefix=$prefix)"
-${CONFIG_SHELL-/bin/sh} $srcdir/../tagdemo/configure --srcdir=$srcdir/../tagdemo --prefix=$prefix || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "tagdemo"
+func_make_distclean
+func_configure
+func_check_static_shared "yes" "yes"
 
 exit 0
index a72636e5e46fb77ce832400950b3a84de3eada8a..66ee6cf66a9fa50f8e0c659dcd6e86c4d49e221e 100755 (executable)
@@ -1,28 +1,36 @@
 #! /bin/sh
-# tagdemo-exec.test - check that programs in the ../tagdemo subdirectory are viable
+# tagdemo-exec.test - check that programs in the tagdemo subdirectory are viable
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../tagdemo/tagdemo$EXEEXT; then :
-else
-  echo "You must run tagdemo-make.test before running $0" 1>&2
-  exit 77
-fi
+func_require "tagdemo-make" "tagdemo/tagdemo$EXEEXT"
 
-# Check to see if the programs really run.
-echo "Executing uninstalled programs in ../tagdemo"
-
-if ../tagdemo/tagdemo; then :
-else
-  echo "$0: cannot execute ../tagdemo/tagdemo" 1>&2
-  status=1
-fi
+func_rmprefixdir
+func_exec_init "uninstalled"
+func_exec "tagdemo/tagdemo"
 
-exit $status
+exit $exec_status
index 5cf0d87e648b01dc2a6499cdd86b48c52edf8f15..476ca39a4c66e9757e5fb89cdb55562f6ff85f1e 100755 (executable)
@@ -1,25 +1,36 @@
 #! /bin/sh
-# tagdemo-make.test - try building in the ../tagdemo subdirectory
+# tagdemo-make.test - try building in the tagdemo subdirectory
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# 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
 
-if test -f ../tagdemo/Makefile; then :
-else
-  echo "You must run tagdemo-conf.test before running $0" 1>&2
-  exit 77
-fi
+func_require "tagdemo-conf" "tagdemo/Makefile"
 
-# Change to our build directory.
-cd ../tagdemo || exit 1
+func_rmprefixdir
+func_cd "tagdemo"
+func_make
 
-# Do the actual build.
-echo "Making in ../tagdemo"
-$make || exit 1
 exit 0
index 46c06992b3d15dc360569b1c5bfc78eb1f923b54..abe4e11f516ac177429be02ea85e6e6dea9d4f7c 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# tagdemo-conf.test - try configuring the ../tagdemo subdirectory
+# tagdemo-shared.test - try configuring the tagdemo subdirectory for shared libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../tagdemo || mkdir ../tagdemo
-
-# Change to our build directory.
-cd ../tagdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../tagdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../tagdemo (prefix=$prefix) with --disable-static"
-${CONFIG_SHELL-/bin/sh} $srcdir/../tagdemo/configure --srcdir=$srcdir/../tagdemo --prefix=$prefix --disable-static || exit 1
-
-if grep '^build_old_libs=no' libtool > /dev/null &&
-   grep '^build_libtool_libs=yes' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "tagdemo"
+func_make_distclean
+func_configure "--disable-static"
+func_check_static_shared "no" "yes"
 
 exit 0
index 9f6d85606020745291d8d4aa661568df1341d227..4d1ef4b4cb0e51c7dc3efad8084cd1e719c50c21 100755 (executable)
@@ -1,35 +1,36 @@
 #! /bin/sh
-# tagdemo-conf.test - try configuring the ../tagdemo subdirectory
+# tagdemo-static.test - try configuring tagdemo subdirectory for static libs
+
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# 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, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
 
-# Test script header.
-need_prefix=yes
 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
 
-# Maybe we have a VPATH build, in which case, create a new subdir.
-test -d ../tagdemo || mkdir ../tagdemo
-
-# Change to our build directory.
-cd ../tagdemo || exit 1
-
-# Possibly clean up the distribution.
-if test -f Makefile; then
-  echo "= Running $make distclean in ../tagdemo"
-  $make distclean
-fi
-rm -f config.cache
-
-# Configure the demonstration.
-echo "= Configuring in ../tagdemo (prefix=$prefix) with --disable-shared"
-${CONFIG_SHELL-/bin/sh} $srcdir/../tagdemo/configure --srcdir=$srcdir/../tagdemo --prefix=$prefix --disable-shared || exit 1
-
-if grep '^build_old_libs=yes' libtool > /dev/null &&
-   grep '^build_libtool_libs=no' libtool > /dev/null; then :
-else rm -f Makefile && exit 77
-fi
+func_mkprefixdir
+func_cd "tagdemo"
+func_make_distclean
+func_configure "--disable-shared"
+func_check_static_shared "yes" "no"
 
 exit 0
diff --git a/tests/tagdemo/.cvsignore b/tests/tagdemo/.cvsignore
new file mode 100644 (file)
index 0000000..4b6013d
--- /dev/null
@@ -0,0 +1,14 @@
+.deps
+.libs
+Makefile
+Makefile.in
+autom4te.cache
+acinclude.m4
+aclocal.m4
+configure
+config.*
+conftest*
+libtool
+*.lo
+*.la
+tagdemo
diff --git a/tests/tagdemo/Makefile.am b/tests/tagdemo/Makefile.am
new file mode 100644 (file)
index 0000000..f8f804c
--- /dev/null
@@ -0,0 +1,46 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+##
+## Copyright (C) 2003 Free Software Foundation
+##
+## 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; see the file COPYING.  If not, write to
+## the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+## Boston, MA 02111-1307, USA.
+
+top_distdir = ../..
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS  = -I $(top_distdir)/m4
+
+noinst_LTLIBRARIES = libfoo.la
+lib_LTLIBRARIES = libbaz.la
+
+libfoo_la_SOURCES = foo.cpp
+libfoo_la_LDFLAGS = -no-undefined
+libfoo_la_LIBADD = $(LIBM)
+
+# Test some of the ILD support when using tagged configurations.
+libbaz_la_SOURCES = baz.cpp
+libbaz_la_LDFLAGS = -no-undefined
+libbaz_la_LIBADD = libfoo.la
+
+noinst_HEADERS = foo.h baz.h
+
+bin_PROGRAMS = tagdemo
+
+tagdemo_SOURCES = main.cpp
+tagdemo_LDADD = libbaz.la
+
+$(OBJECTS): libtool
+libtool: $(LIBTOOL_DEPS)
+       $(SHELL) ./config.status --recheck
diff --git a/tests/tagdemo/README b/tests/tagdemo/README
new file mode 100644 (file)
index 0000000..09e04a7
--- /dev/null
@@ -0,0 +1,8 @@
+# $Id$
+
+This directory contains a sample package that demonstrates the use of
+GNU Libtool's multi-language support through the use of configuration
+tags.  It requires GNU autoconf, automake and of course libtool.
+
+The demonstration generates a libraries using the same libtool script,
+which is then linked to a C++ program.
diff --git a/tests/tagdemo/baz.cpp b/tests/tagdemo/baz.cpp
new file mode 100644 (file)
index 0000000..51a5634
--- /dev/null
@@ -0,0 +1,35 @@
+// -*- C++ -*-
+//    baz.cpp -- a slightly more complicated test library
+//    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+//    Originally by Thomas Tanner <tanner@ffii.org>
+//    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+// USA.
+
+#include "foo.h"
+#include "baz.h"
+
+// --------------------------------------------------------------------
+// Our C++ derived class methods.
+
+
+int
+barbaz_derived::baz(void)
+{
+  foobar_derived FB;
+
+  return FB.foo();
+}
diff --git a/tests/tagdemo/baz.h b/tests/tagdemo/baz.h
new file mode 100644 (file)
index 0000000..1c1be2b
--- /dev/null
@@ -0,0 +1,43 @@
+// -*- C++ -*-
+//    baz.h -- interface to the libfoo* libraries
+//    Copyright (C) 1998-1999 Free Software Foundation, Inc.
+//    Originally by Thomas Tanner <tanner@ffii.org>
+//    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+// USA.
+
+// Only include this header file once.
+#ifndef _BAZ_H_
+#define _BAZ_H_ 1
+
+// Our test C++ base class.
+class barbaz
+{
+public:
+  virtual int baz(void) = 0;
+  // Some dummy pure virtual functions.
+};
+
+
+// Our test C++ derived class.
+class barbaz_derived : public barbaz
+{
+public:
+  virtual int baz(void);
+  // Override the base class' pure virtual functions.
+};
+
+#endif /* !_FOO_H_ */
diff --git a/tests/tagdemo/configure.ac b/tests/tagdemo/configure.ac
new file mode 100644 (file)
index 0000000..e605719
--- /dev/null
@@ -0,0 +1,87 @@
+## Process this file with autoconf to create configure. -*- autoconf -*-
+# Copyright 2001  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+AC_PREREQ(2.50)
+
+
+## ------------------------ ##
+## Autoconf initialisation. ##
+## ------------------------ ##
+AC_INIT([tagdemo], [0.1], [bug-libtool@gnu.org])
+AC_CONFIG_SRCDIR([foo.cpp])
+AC_CONFIG_AUX_DIR([../../config])
+
+AC_CANONICAL_TARGET
+
+
+## ------------------------ ##
+## Automake Initialisation. ##
+## ------------------------ ##
+AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION)
+
+
+## ---------------- ##
+## Compiler checks. ##
+## ---------------- ##
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_CC_C_O
+
+AC_PROG_CXX
+AC_PROG_CXXCPP
+
+# As of the writing of this demo, GNU Autoconf's AC_OBJEXT and
+# AC_EXEEXT macros only works for C compilers!
+# Libtool's setup macro calls AC_OBJEXT and AC_EXEEXT without setting
+# the test language to C.  We do it before any libtool setup macros are
+# called so that the proper values are cached beforehand.  We also do
+# it before any linker flags (LDFLAGS) are set so that C++ specific
+# ones don't break the tests.
+AC_LANG_PUSH([C])
+AC_OBJEXT
+AC_EXEEXT
+AC_LANG_POP
+
+
+## ----------------------- ##
+## Libtool initialisation. ##
+## ----------------------- ##
+
+# Set the test language to C++.
+AC_LANG([C++])
+AM_PROG_LIBTOOL
+
+
+## ---------------------------- ##
+## C headers required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_HEADERS([math.h])
+
+
+## ---------------------------- ##
+## Libraries required by cdemo. ##
+## ---------------------------- ##
+AC_CHECK_LIBM
+AC_SUBST([LIBM])
+
+
+## -------- ##
+## Outputs. ##
+## -------- ##
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/tests/tagdemo/foo.cpp b/tests/tagdemo/foo.cpp
new file mode 100644 (file)
index 0000000..ee183cf
--- /dev/null
@@ -0,0 +1,59 @@
+// -*- C++ -*-
+//    foo.cpp -- trivial test library
+//    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+//    Originally by Thomas Tanner <tanner@ffii.org>
+//    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+// USA.
+
+#include "foo.h"
+#include <iostream.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+// Our C functions.
+int
+foo(void)
+{
+  cout << "cos (0.0) = " << (double) cos ((double) 0.0) << endl;
+  return FOO_RET;
+}
+
+int
+hello(void)
+{
+  cout << "** This is libfoo (tagdemo) **" << endl;
+  return HELLO_RET;
+}
+
+
+// --------------------------------------------------------------------
+// Our C++ derived class methods.
+
+
+int
+foobar_derived::foo(void)
+{
+  return ::foo();
+}
+
+int
+foobar_derived::hello(void)
+{
+  return ::hello();
+}
diff --git a/tests/tagdemo/foo.h b/tests/tagdemo/foo.h
new file mode 100644 (file)
index 0000000..2f1f09e
--- /dev/null
@@ -0,0 +1,56 @@
+// -*- C++ -*-
+//    foo.h -- interface to the libfoo* libraries
+//    Copyright (C) 1998-1999 Free Software Foundation, Inc.
+//    Originally by Thomas Tanner <tanner@ffii.org>
+//    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+// USA.
+
+// Only include this header file once.
+#ifndef _FOO_H_
+#define _FOO_H_ 1
+
+// Silly constants that the functions return.
+#define HELLO_RET 0xe110
+#define FOO_RET 0xf00
+
+// Our C test functions.
+extern "C"
+{
+  int foo(void);
+  int hello(void);
+}
+
+// Our test C++ base class.
+class foobar
+{
+public:
+  virtual int foo(void) = 0;
+  virtual int hello(void) = 0;
+  // Some dummy pure virtual functions.
+};
+
+
+// Our test C++ derived class.
+class foobar_derived : public foobar
+{
+public:
+  virtual int foo(void);
+  virtual int hello(void);
+  // Override the base class' pure virtual functions.
+};
+
+#endif /* !_FOO_H_ */
diff --git a/tests/tagdemo/main.cpp b/tests/tagdemo/main.cpp
new file mode 100644 (file)
index 0000000..676acec
--- /dev/null
@@ -0,0 +1,63 @@
+// -*- C++ -*-
+//    main.cpp -- tagdemo test program
+//    Copyright (C) 1998-2000 Free Software Foundation, Inc.
+//    Originally by Thomas Tanner <tanner@ffii.org>
+//    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., 59 Temple Place, Suite 330, Boston, MA  02111-1307
+// USA.
+
+
+#include "foo.h"
+#include "baz.h"
+#include <iostream.h>
+
+
+int
+main (int, char *[])
+{
+  cout << "Welcome to GNU libtool tagdemo C++!" << endl;
+
+  foobar_derived FB;
+  // Instantiate the derived class.
+
+  foobar *fb = &FB;
+  // Have some fun with polymorphism.
+
+  int value = fb->hello();
+
+  cout << "foobar::hello returned: " << value << endl;
+  if (value == HELLO_RET)
+    cout << "foobar::hello is ok!" << endl;
+
+  if (fb->foo() == FOO_RET)
+    cout << "foobar::foo is ok!" << endl;
+
+  // --------------
+
+  barbaz_derived BB;
+  // Instantiate the derived class.
+
+  barbaz *bb = &BB;
+  // Have some fun with polymorphism.
+
+
+  // barbaz_derived::baz() should return FOO_RET since it calls
+  // foobar_derived::foo(), which in turn calls ::foo().
+  if (bb->baz() == FOO_RET)
+    cout << "barbaz::baz is ok!" << endl;
+
+  return 0;
+}