multi-language-branch.
* configure.in: Added pdemo and tagdemo to CONF_SUBDIRS
and merged references to CXX and GCJ from multi-language-branch.
*pdemo: Added test directory from multi-language-branch.
*tagdemo: Added test directory from multi-language-branch.
*tests/Makefile.am: Merged additional tests from
multi-language-branch.
*tests/pdemo-*.test: ditto.
*tests/tagdemo-*.test: ditto.
+2001-05-30 Robert Boehne <rboehne@ricardo-us.com>
+
+ * bootstrap: Added tagdemo and pdemo tests from
+ multi-language-branch.
+ * configure.in: Added pdemo and tagdemo to CONF_SUBDIRS
+ and merged references to CXX and GCJ from multi-language-branch.
+ *pdemo: Added test directory from multi-language-branch.
+ *tagdemo: Added test directory from multi-language-branch.
+ *tests/Makefile.am: Merged additional tests from
+ multi-language-branch.
+ *tests/pdemo-*.test: ditto.
+ *tests/tagdemo-*.test: ditto.
+
2001-05-30 Gary V. Vaughan <gary@gnu.org>
* libtool.m4: Merged ltconfig.in from multi-language-branch.
$AUTOMAKE --gnu --add-missing --copy
$AUTOCONF
-for sub in libltdl demo depdemo mdemo cdemo; do
+for sub in libltdl demo depdemo mdemo cdemo tagdemo pdemo; do
cd $sub
rm -f acinclude.m4 Makefile
cat ../libtool.m4 > acinclude.m4
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
+pushdef([AC_MSG_ERROR], [CXX=no])
+AC_PROG_CXX
+popdef([AC_MSG_ERROR])
+AM_CONDITIONAL(HAVE_CXX, [test "x$CXX" != xno])
+
+LT_AC_PROG_GCJ
+AM_CONDITIONAL(HAVE_GCJ, [test "x$GCJ" != xno])
+
AC_ARG_ENABLE(ltdl-install,
[ --disable-ltdl-install do not install libltdl])
if test x"${enable_ltdl_install+set}" != xset; then
# all subdirectories that are configured on demand, but that must be
# included in the distribution
-CONF_SUBDIRS="cdemo demo depdemo mdemo"
+CONF_SUBDIRS="cdemo pdemo demo depdemo mdemo tagdemo"
AC_SUBST(CONF_SUBDIRS)
ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4"
--- /dev/null
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+configure
+config.*
+conftest*
+hc-direct
+hc-libflag
+hc-libpath
+hc-minusL
+libtool
+*.lo
+*.la
+hell
+hell.static
+helldl
--- /dev/null
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+EXTRA_DIST = acinclude.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 = -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:
+ 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 | egrep -e '^(hardcode_.*|wl)='`
+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 "`egrep '^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 = longer_file_name_hello.c longer_file_name_foo.c
+EXTRA_LTLIBRARIES += libhell1.la libhell2.la
+libhell1_la_SOURCES = longer_file_name_hell1.c
+libhell1_la_LIBADD = -L. -lhell0
+libhell1_la_LDFLAGS = -rpath $(libdir)
+libhell1_la_DEPENDENCIES = libhell0.a
+libhell2_la_SOURCES = longer_file_name_hell2.c
+libhell2_la_LIBADD = -L. -lhell0
+libhell2_la_LDFLAGS = -rpath $(libdir)
+libhell2_la_DEPENDENCIES = libhell0.a
+EXTRA_PROGRAMS += hell0
+hell0_SOURCES = longer_file_name_main.c
+hell0_LDADD = libhell1.la libhell2.la $(LIBM)
+
+CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS)
+
+deplibs-check: hell0
--- /dev/null
+dnl Process this file with autoconf to create configure.
+
+AC_INIT(longer_file_name_hello.c)
+AM_INIT_AUTOMAKE(hell,1.0)
+
+AC_PROG_CC
+AC_C_CONST
+AC_EXEEXT
+AC_LIBTOOL_DLOPEN
+AM_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+if ${CONFIG_SHELL} ./libtool --features | grep "enable static" >/dev/null; then
+ STATIC=-static
+else
+ STATIC=
+fi
+AC_SUBST(STATIC)
+
+AM_CONDITIONAL(BINARY_HELLDL, [dnl
+grep '^global_symbol_pipe=..*$' ./libtool >/dev/null])
+
+AC_CHECK_HEADERS(string.h math.h)
+
+AC_CHECK_LIBM
+AC_SUBST(LIBM)
+
+dnl Output the makefile
+AC_OUTPUT(Makefile)
--- /dev/null
+/* 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_ */
--- /dev/null
+/* 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*)¬hing;
+#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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+int hell1() { return 1; }
--- /dev/null
+int hell2() { return 2; }
--- /dev/null
+/* 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;
+}
--- /dev/null
+/* 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;
+}
--- /dev/null
+.deps
+.libs
+Makefile
+Makefile.in
+acinclude.m4
+aclocal.m4
+configure
+config.*
+conftest*
+libtool
+*.lo
+*.la
+tagdemo
--- /dev/null
+## Process this file with automake to produce Makefile.in
+##
+## $Id$
+
+AUTOMAKE_OPTIONS = no-dependencies foreign
+
+EXTRA_DIST = acinclude.m4
+
+noinst_LTLIBRARIES = libfoo.la
+lib_LTLIBRARIES = libbaz.la
+
+libfoo_la_SOURCES = foo.cpp
+libfoo_la_LIBADD = $(LIBM)
+
+# Test some of the ILD support when using tagged configurations.
+libbaz_la_SOURCES = baz.cpp
+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
--- /dev/null
+# $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.
--- /dev/null
+// -*- 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();
+}
--- /dev/null
+// -*- 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_ */
--- /dev/null
+dnl
+dnl $Id$
+
+dnl
+dnl An autoconf script to automatically configure the sample C++ "foo"
+dnl application.
+dnl Process this file with autoconf to produce a configure script.
+dnl
+
+
+AC_INIT(foo.cpp)dnl
+
+dnl Check what platform we are running on.
+AC_CANONICAL_SYSTEM
+
+dnl Cause GNU Automake to initialize the state of things and run
+dnl some sanity checks
+PACKAGE=foo
+VERSION=0.1
+
+AM_INIT_AUTOMAKE("$PACKAGE", "$VERSION", DUMMY)dnl
+
+dnl Check the C compiler and preprocessor.
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_CC_C_O
+
+dnl Check the C++ compiler and preprocessor.
+AC_PROG_CXX
+AC_PROG_CXXCPP
+
+dnl Set the test language to C++.
+AC_LANG_CPLUSPLUS
+
+# 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_SAVE
+AC_LANG_C
+AC_OBJEXT
+AC_EXEEXT
+AC_LANG_RESTORE
+
+dnl Setup Libtool
+
+dnl Check for libtool and turn on Automake processing for Libtool
+AM_PROG_LIBTOOL
+
+AC_CHECK_HEADERS(math.h)
+
+AC_CHECK_LIBM
+AC_SUBST(LIBM)
+
+AC_OUTPUT([
+ Makefile
+ ],
+ [
+ echo "Done configuring package $PACKAGE"
+ ])
--- /dev/null
+// -*- 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 <stdio.h>
+
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
+
+// Our C functions.
+int
+foo(void)
+{
+ printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0));
+ return FOO_RET;
+}
+
+int
+hello(void)
+{
+ printf ("** This is libfoo (tagdemo) **\n");
+ return HELLO_RET;
+}
+
+
+// --------------------------------------------------------------------
+// Our C++ derived class methods.
+
+
+int
+foobar_derived::foo(void)
+{
+ return ::foo();
+}
+
+int
+foobar_derived::hello(void)
+{
+ return ::hello();
+}
--- /dev/null
+// -*- 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_ */
--- /dev/null
+// -*- 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 <stdio.h>
+
+
+int
+main (int, char *[])
+{
+ printf ("Welcome to GNU libtool tagdemo!\n");
+
+ foobar_derived FB;
+ // Instantiate the derived class.
+
+ foobar *fb = &FB;
+ // Have some fun with polymorphism.
+
+ int value = fb->hello();
+
+ printf ("foobar::hello returned: %i\n", value);
+ if (value == HELLO_RET)
+ printf("foobar::hello is ok!\n");
+
+ if (fb->foo() == FOO_RET)
+ printf("foobar::foo is ok!\n");
+
+ // --------------
+
+ 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)
+ printf("barbaz::baz is ok!\n");
+
+ return 0;
+}
AUTOMAKE_OPTIONS = gnits
-TESTS = cdemo-static.test cdemo-make.test cdemo-exec.test \
+CXX_TESTS = \
+ tagdemo-static.test tagdemo-make.test tagdemo-exec.test \
+ tagdemo-conf.test tagdemo-make.test tagdemo-exec.test \
+ tagdemo-shared.test tagdemo-make.test tagdemo-exec.test
+
+COMMON_TESTS = \
+ cdemo-static.test cdemo-make.test cdemo-exec.test \
demo-static.test demo-make.test demo-exec.test \
demo-inst.test demo-unst.test \
depdemo-static.test depdemo-make.test \
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
+ quote.test sh.test suffix.test pdemo-conf.test \
+ pdemo-make.test pdemo-exec.test pdemo-inst.test
+
+if HAVE_CXX
+TESTS = $(COMMON_TESTS) $(CXX_TESTS)
+else
+TESTS = $(COMMON_TESTS)
+endif
demo-conf.test: $(top_builddir)/libtool
LIBS="$(LIBS)" LN_S="$(LN_S)" NM="$(NM)" RANLIB="$(RANLIB)" \
OBJEXT="$(OBJEXT)" EXEEXT="$(EXEEXT)"
-EXTRA_DIST = defs $(TESTS)
+EXTRA_DIST = defs $(COMMON_TESTS) $(CXX_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
rm -rf _inst
--- /dev/null
+#! /bin/sh
+# pdemo-conf.test - try configuring the ../pdemo 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 ../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_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../pdemo/configure --srcdir=$srcdir/../pdemo --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
+
+if test -f ./libtool ; then
+ sed 's/^max_cmd_len=*/max_cmd_len=24 # /g' ./libtool > ltnew
+else
+ exit 1
+fi
+
+if test -f ./ltnew ; then
+ rm -f libtool
+ mv ltnew libtool
+else
+ exit 1
+fi
+
+exit 0
--- /dev/null
+#! /bin/sh
+# pdemo-exec.test - check that programs in the ../pdemo subdirectory are viable
+
+# 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; then :
+else
+ echo "You must run pdemo-make.test before running $0" 1>&2
+ exit 77
+fi
+
+# 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
+
+exit $status
--- /dev/null
+#! /bin/sh
+# pdemo-inst.test - try installing from the ../pdemo 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
+
+# Check that things are built.
+if test -f ../pdemo/hell; 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
+
+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
+
+exit $status
--- /dev/null
+#! /bin/sh
+# pdemo-make.test - try building in the ../pdemo subdirectory
+
+# 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
+
+# Change to our build directory.
+cd ../pdemo || exit 1
+
+# Do the actual build.
+echo "Making in ../pdemo"
+$make || exit 1
+exit 0
--- /dev/null
+#! /bin/sh
+# tagdemo-conf.test - try configuring the ../tagdemo 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 ../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_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../tagdemo/configure --srcdir=$srcdir/../tagdemo --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
+
+exit 0
--- /dev/null
+#! /bin/sh
+# tagdemo-exec.test - check that programs in the ../tagdemo subdirectory are viable
+
+# 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; then :
+else
+ echo "You must run tagdemo-make.test before running $0" 1>&2
+ exit 77
+fi
+
+# 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
+
+exit $status
--- /dev/null
+#! /bin/sh
+# tagdemo-make.test - try building in the ../tagdemo subdirectory
+
+# 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
+
+# Change to our build directory.
+cd ../tagdemo || exit 1
+
+# Do the actual build.
+echo "Making in ../tagdemo"
+$make || exit 1
+exit 0
--- /dev/null
+#! /bin/sh
+# tagdemo-conf.test - try configuring the ../tagdemo 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 ../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_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../tagdemo/configure --srcdir=$srcdir/../tagdemo --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
+
+exit 0
--- /dev/null
+#! /bin/sh
+# tagdemo-conf.test - try configuring the ../tagdemo 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 ../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_SITE=/dev/null/config/site ${CONFIG_SHELL-/bin/sh} $srcdir/../tagdemo/configure --srcdir=$srcdir/../tagdemo --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
+
+exit 0