* tests/tagdemo.at: New autotest groups, based on... tests/tagdemo-conf.test, tests/tagdemo-exec.test, tests/tagdemo-make.test, tests/tagdemo-shared-exec.test, tests/tagdemo-shared-make.test, tests/tagdemo-shared.test, tests/tagdemo-static-exec.test, tests/tagdemo-static-make.test, tests/tagdemo-static.test, tests/tagdemo-undef-exec.test, tests/tagdemo-undef-make.test, tests/tagdemo-undef.test: ...these legacy tests, now removed. * tests/tagdemo/.gitignore, tests/tagdemo/Makefile.am, tests/tagdemo/README, tests/tagdemo/baz.cpp, tests/tagdemo/baz.h, tests/tagdemo/configure.ac, tests/tagdemo/conv.cpp, tests/tagdemo/conv.h, tests/tagdemo/foo.cpp, tests/tagdemo/foo.h, tests/tagdemo/main.cpp: Remove. * configure.ac (CONF_SUBDIRS): Remove tests/tagdemo. * Makefile.am: Adjust.
Signed-off-by: Gary V. Vaughan <g...@gnu.org> --- Makefile.am | 32 +--- configure.ac | 2 +- tests/tagdemo-conf.test | 34 ---- tests/tagdemo-exec.test | 34 ---- tests/tagdemo-make.test | 34 ---- tests/tagdemo-shared-exec.test | 3 - tests/tagdemo-shared-make.test | 3 - tests/tagdemo-shared.test | 34 ---- tests/tagdemo-static-exec.test | 3 - tests/tagdemo-static-make.test | 3 - tests/tagdemo-static.test | 34 ---- tests/tagdemo-undef-exec.test | 3 - tests/tagdemo-undef-make.test | 3 - tests/tagdemo-undef.test | 50 ----- tests/tagdemo.at | 408 ++++++++++++++++++++++++++++++++++++++++ tests/tagdemo/.gitignore | 1 - tests/tagdemo/Makefile.am | 63 ------ tests/tagdemo/README | 6 - tests/tagdemo/baz.cpp | 38 ---- tests/tagdemo/baz.h | 46 ----- tests/tagdemo/configure.ac | 96 ---------- tests/tagdemo/conv.cpp | 32 --- tests/tagdemo/conv.h | 35 ---- tests/tagdemo/foo.cpp | 68 ------- tests/tagdemo/foo.h | 59 ------ tests/tagdemo/main.cpp | 79 -------- 26 files changed, 411 insertions(+), 792 deletions(-) delete mode 100755 tests/tagdemo-conf.test delete mode 100755 tests/tagdemo-exec.test delete mode 100755 tests/tagdemo-make.test delete mode 100755 tests/tagdemo-shared-exec.test delete mode 100755 tests/tagdemo-shared-make.test delete mode 100755 tests/tagdemo-shared.test delete mode 100755 tests/tagdemo-static-exec.test delete mode 100755 tests/tagdemo-static-make.test delete mode 100755 tests/tagdemo-static.test delete mode 100755 tests/tagdemo-undef-exec.test delete mode 100755 tests/tagdemo-undef-make.test delete mode 100755 tests/tagdemo-undef.test create mode 100644 tests/tagdemo.at delete mode 100644 tests/tagdemo/.gitignore delete mode 100644 tests/tagdemo/Makefile.am delete mode 100644 tests/tagdemo/README delete mode 100644 tests/tagdemo/baz.cpp delete mode 100644 tests/tagdemo/baz.h delete mode 100644 tests/tagdemo/configure.ac delete mode 100644 tests/tagdemo/conv.cpp delete mode 100644 tests/tagdemo/conv.h delete mode 100644 tests/tagdemo/foo.cpp delete mode 100644 tests/tagdemo/foo.h delete mode 100644 tests/tagdemo/main.cpp diff --git a/Makefile.am b/Makefile.am index 28eee5c..ac76788 100644 --- a/Makefile.am +++ b/Makefile.am @@ -681,6 +681,7 @@ TESTSUITE_AT = tests/testsuite.at \ tests/subproject.at \ tests/nonrecursive.at \ tests/recursive.at \ + tests/tagdemo.at \ tests/template.at \ tests/ctor.at \ tests/exceptions.at \ @@ -805,32 +806,6 @@ clean-local: clean-local-legacy # using the new framework above. When the migration is # complete this section should be removed. -CXX_TESTS = \ - tests/tagdemo-static.test \ - tests/tagdemo-static-make.test \ - tests/tagdemo-static-exec.test \ - tests/tagdemo-conf.test \ - tests/tagdemo-make.test \ - tests/tagdemo-exec.test \ - tests/tagdemo-shared.test \ - tests/tagdemo-shared-make.test \ - tests/tagdemo-shared-exec.test \ - tests/tagdemo-undef.test \ - tests/tagdemo-undef-make.test \ - tests/tagdemo-undef-exec.test - -tests/tagdemo-undef-exec.log: tests/tagdemo-undef-make.log -tests/tagdemo-undef-make.log: tests/tagdemo-undef.log -tests/tagdemo-undef.log: tests/tagdemo-shared-exec.log -tests/tagdemo-shared-exec.log: tests/tagdemo-shared-make.log -tests/tagdemo-shared-make.log: tests/tagdemo-shared.log -tests/tagdemo-shared.log: tests/tagdemo-exec.log -tests/tagdemo-exec.log: tests/tagdemo-make.log -tests/tagdemo-make.log: tests/tagdemo-conf.log -tests/tagdemo-conf.log: tests/tagdemo-static-exec.log -tests/tagdemo-static-exec.log: tests/tagdemo-static-make.log -tests/tagdemo-static-make.log: tests/tagdemo-static.log - F77_TESTS = \ tests/f77demo-static.test \ tests/f77demo-static-make.test \ @@ -932,9 +907,6 @@ tests/pdemo-make.log: tests/pdemo-conf.log INTERACTIVE_TESTS = NONINTERACTIVE_TESTS = $(COMMON_TESTS) -if HAVE_CXX -NONINTERACTIVE_TESTS += $(CXX_TESTS) -endif if HAVE_F77 # f77demo-static-exec.test might be interactive on MSYS. INTERACTIVE_TESTS += $(F77_TESTS) @@ -948,7 +920,7 @@ defs = tests/defs defs_in = $(tests_dir)/defs.in EXTRA_DIST += $(defs_in) $(defs_m4sh) \ - $(COMMON_TESTS) $(CXX_TESTS) $(F77_TESTS) $(FC_TESTS) \ + $(COMMON_TESTS) $(F77_TESTS) $(FC_TESTS) \ $(INTERACTIVE_TESTS) DIST_SUBDIRS += $(CONF_SUBDIRS) diff --git a/configure.ac b/configure.ac index d136799..ab0fc04 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,7 @@ AC_SUBST([pkgaux_scripts]) # All subdirectories that are configured on demand, but that must be # included in the distribution. CONF_SUBDIRS="tests/f77demo tests/fcdemo \ - tests/mdemo tests/mdemo2 tests/pdemo tests/tagdemo" + tests/mdemo tests/mdemo2 tests/pdemo" AC_SUBST([CONF_SUBDIRS]) DIST_MAKEFILE_LIST= diff --git a/tests/tagdemo-conf.test b/tests/tagdemo-conf.test deleted file mode 100755 index 96dfc3a..0000000 --- a/tests/tagdemo-conf.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# tagdemo-conf.test - try configuring the tagdemo subdirectory -# -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2003 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -. tests/defs || exit 1 - -func_mkprefixdir -func_cd "tests/tagdemo" -func_make_distclean -func_configure -func_check_static_shared "yes" "yes" - -exit 0 diff --git a/tests/tagdemo-exec.test b/tests/tagdemo-exec.test deleted file mode 100755 index 6f90109..0000000 --- a/tests/tagdemo-exec.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# tagdemo-exec.test - check that programs in the tagdemo subdirectory are viable -# -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2003 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -. tests/defs || exit 1 - -func_require "tagdemo-make" "tests/tagdemo/tagdemo$EXEEXT" - -func_rmprefixdir -func_exec_init "uninstalled" -func_exec "tests/tagdemo/tagdemo$EXEEXT" - -exit $exec_status diff --git a/tests/tagdemo-make.test b/tests/tagdemo-make.test deleted file mode 100755 index 235dc7f..0000000 --- a/tests/tagdemo-make.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# tagdemo-make.test - try building in the tagdemo subdirectory -# -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2003 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -. tests/defs || exit 1 - -func_require "tagdemo-conf" "tests/tagdemo/Makefile" - -func_rmprefixdir -func_cd "tests/tagdemo" -func_make - -exit 0 diff --git a/tests/tagdemo-shared-exec.test b/tests/tagdemo-shared-exec.test deleted file mode 100755 index 43338b0..0000000 --- a/tests/tagdemo-shared-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/tagdemo-exec.test diff --git a/tests/tagdemo-shared-make.test b/tests/tagdemo-shared-make.test deleted file mode 100755 index 6add5f1..0000000 --- a/tests/tagdemo-shared-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/tagdemo-make.test diff --git a/tests/tagdemo-shared.test b/tests/tagdemo-shared.test deleted file mode 100755 index 6fe671f..0000000 --- a/tests/tagdemo-shared.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# tagdemo-shared.test - try configuring the tagdemo subdirectory for shared libs -# -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2003 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -. tests/defs || exit 1 - -func_mkprefixdir -func_cd "tests/tagdemo" -func_make_distclean -func_configure "--disable-static" -func_check_static_shared "no" "yes" - -exit 0 diff --git a/tests/tagdemo-static-exec.test b/tests/tagdemo-static-exec.test deleted file mode 100755 index 43338b0..0000000 --- a/tests/tagdemo-static-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/tagdemo-exec.test diff --git a/tests/tagdemo-static-make.test b/tests/tagdemo-static-make.test deleted file mode 100755 index 6add5f1..0000000 --- a/tests/tagdemo-static-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/tagdemo-make.test diff --git a/tests/tagdemo-static.test b/tests/tagdemo-static.test deleted file mode 100755 index 6c5785f..0000000 --- a/tests/tagdemo-static.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# tagdemo-static.test - try configuring tagdemo subdirectory for static libs -# -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2003 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -. tests/defs || exit 1 - -func_mkprefixdir -func_cd "tests/tagdemo" -func_make_distclean -func_configure "--disable-shared" -func_check_static_shared "yes" "no" - -exit 0 diff --git a/tests/tagdemo-undef-exec.test b/tests/tagdemo-undef-exec.test deleted file mode 100755 index 43338b0..0000000 --- a/tests/tagdemo-undef-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/tagdemo-exec.test diff --git a/tests/tagdemo-undef-make.test b/tests/tagdemo-undef-make.test deleted file mode 100755 index 6add5f1..0000000 --- a/tests/tagdemo-undef-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/tagdemo-make.test diff --git a/tests/tagdemo-undef.test b/tests/tagdemo-undef.test deleted file mode 100755 index 89d97cd..0000000 --- a/tests/tagdemo-undef.test +++ /dev/null @@ -1,50 +0,0 @@ -#! /bin/sh -# tagdemo-undef - test generating shared libraries with undefined symbols -# -# Copyright (C) 2003, 2004, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2003 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -. tests/defs || exit 1 - - -func_mkprefixdir -func_cd "tests/tagdemo" -func_make_distclean -func_configure "--disable-static" - -grep '^allow_undefined_flag=.\{0,1\}unsupported.\{0,1\}$' ./libtool >/dev/null 2>&1 \ - && func_skip "$host doesn't support undefined symbols in shared libs" - -if test -f ./libtool; then - $SED 's|allow_undefined=no|allow_undefined=yes|g' ./libtool > ltnew -else - exit 1 -fi - -if test -f ./ltnew; then - rm -f libtool - mv ltnew libtool -else - exit 1 -fi - -exit 0 diff --git a/tests/tagdemo.at b/tests/tagdemo.at new file mode 100644 index 0000000..d1f254e --- /dev/null +++ b/tests/tagdemo.at @@ -0,0 +1,408 @@ +# cdemo.at -- Using Automake to build a program and library -*- Autotest -*- +# +# Copyright (C) 2003, 2004, 2005, 2011 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2003 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +#### + + +AT_BANNER([C++ language support.]) + + +# _LT_SETUP +# --------- +m4_define([_LT_SETUP], +[LT_AT_TAG([CXX]) +AT_KEYWORDS([libtool]) + +AT_DATA([configure.ac], +[[AC_INIT([tagdemo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CANONICAL_TARGET +AM_INIT_AUTOMAKE +AC_PROG_CC +AC_PROG_CPP +AC_PROG_CC_C_O +AC_PROG_CXX +AC_PROG_CXXCPP + +# Check for namespace support and new-style headers +AC_LANG_PUSH([C++]) +AC_MSG_CHECKING([whether the compiler implements namespaces]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]], + [[using namespace A::B; return i;]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_NAMESPACES],[1], + [define if the compiler implements namespaces])], + [AC_MSG_RESULT([no])]) + +AC_MSG_CHECKING([whether the compiler has ISO C++ iostream]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <iostream> +#ifdef HAVE_NAMESPACES +using namespace std; +#endif ]], [[cout << "bingo\n"; return 0;]])], + [AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_IOSTREAM],[1], + [define if the compiler has ISO C++ iostream])], + [AC_MSG_RESULT([no])]) +AC_LANG_POP([C++]) + +AC_LANG([C++]) +LT_INIT + +LT_LIB_M +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +]]) + +AT_DATA([Makefile.am], +[[AUTOMAKE_OPTIONS = no-dependencies foreign +ACLOCAL_AMFLAGS = -I m4 + +noinst_LTLIBRARIES = libconv.la +lib_LTLIBRARIES = libfoo.la libbaz.la + +libfoo_la_SOURCES = foo.cpp +libfoo_la_LDFLAGS = -no-undefined +libfoo_la_LIBADD = libconv.la $(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 + +# Test convenience libraries. +libconv_la_SOURCES = conv.cpp +libconv_la_LDFLAGS = -no-undefined + +noinst_HEADERS = foo.h baz.h conv.h + +bin_PROGRAMS = tagdemo + +tagdemo_SOURCES = main.cpp +tagdemo_LDADD = libbaz.la libfoo.la + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck +]]) + +AT_DATA([main.cpp], +[[#include "foo.h" +#include "baz.h" +#include "conv.h" +#if HAVE_IOSTREAM +# include <iostream> +#else +# include <iostream.h> +#endif +#if HAVE_NAMESPACES +namespace std { } +using namespace std; +#endif + +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; + + // -------------- + + if (convenience()) + cout << "convenience is ok!" << endl; + + return 0; +} +]]) + +AT_DATA([foo.h], +[[#ifndef FOO_H +#define FOO_H +// 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 +]]) + +AT_DATA([foo.cpp], +[[#include "foo.h" +#ifdef HAVE_IOSTREAM +# include <iostream> +#else +# include <iostream.h> +#endif +#ifdef HAVE_NAMESPACES +namespace std { } +using namespace std; +#endif + +#include <math.h> + +// 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(); +} +]]) + +AT_DATA([baz.h], +[[#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 +]]) + +AT_DATA([baz.cpp], +[[#include "foo.h" +#include "baz.h" + +// -------------------------------------------------------------------- +// Our C++ derived class methods. + + +int +barbaz_derived::baz(void) +{ + foobar_derived FB; + + return FB.foo(); +} +]]) + +AT_DATA([conv.h], +[[#ifndef CONV_H +#define CONV_H + +// Our C test functions. +extern "C" +{ + int convenience(void); +} + +#endif +]]) + +AT_DATA([conv.cpp], +[[#include "conv.h" + +//Our C function. +int convenience (void) { return 1; } +]]) + +AT_DATA([expout], +[[Welcome to GNU libtool tagdemo C++! +** This is libfoo (tagdemo) ** +foobar::hello returned: 57616 +foobar::hello is ok! +cos (0.0) = 1 +foobar::foo is ok! +cos (0.0) = 1 +barbaz::baz is ok! +convenience is ok! +]]) + +prefixdir=`pwd`/_inst +]) # _LT_SETUP + + +# _LT_CHECK_CONFIG (CONFIGURE-ARGS, [GREP-EXPRESSION], ...) +# --------------------------------------------------------- +# Bootstrap and configure the project, and check each GREP-EXPRESSION +# works on the resulting libtool script. +m4_define([_LT_CHECK_CONFIG], +[LT_AT_BOOTSTRAP([], [-I m4], [ignore], [--add-missing], [], [$1], [ignore]) +m4_if([$#], 0, [], + [$#], 1, [], [$0_(m4_shift($@))]) +]) +m4_define([_LT_CHECK_CONFIG_], +[AT_CHECK([$EGREP '$1' libtool], 0, [ignore]) + m4_if([$#], 1, [], [$0(m4_shift($@))]) +]) + + +# _LT_CHECK_EXECUTE([TARGETS]) +# ---------------------------- +# Run the listed make rules, and check that the built binaries work. +m4_define([_LT_CHECK_EXECUTE], +[LT_AT_MAKE([$1]) +LT_AT_EXEC_CHECK([./tagdemo], 0, [expout]) +]) + + +## --------------- ## +## Tagdemo static. ## +## --------------- ## + +AT_SETUP([static library]) + +_LT_SETUP + +_LT_CHECK_CONFIG([--disable-shared], + [^build_old_libs=yes], [^build_libtool_libs=no]) +_LT_CHECK_EXECUTE + +AT_CLEANUP + + +## --------------- ## +## Tagdemo shared. ## +## --------------- ## + +AT_SETUP([shared library]) + +_LT_SETUP + +_LT_CHECK_CONFIG([--disable-static], + [^build_old_libs=no], [^build_libtool_libs=yes]) +_LT_CHECK_EXECUTE + +AT_CLEANUP + + +## ------------- ## +## Tagdemo conf. ## +## ------------- ## + +AT_SETUP([shared and static together]) + +_LT_SETUP + +_LT_CHECK_CONFIG([], + [^build_old_libs=yes], [^build_libtool_libs=yes]) +_LT_CHECK_EXECUTE + +AT_CLEANUP + + +## -------------- ## +## Tagdemo undef. ## +## -------------- ## + +AT_SETUP([allow_undefined_flag]) + +_LT_SETUP + +LT_AT_BOOTSTRAP([], [-I m4], [ignore], [--add-missing], [], + [--disable-static], [ignore]) +AT_CHECK([grep -E "^allow_undefined_flag=.\{0,1\}unsupported.\{0,1\}$" libtool && (exit 77)], + 1, [ignore]) +sed 's|allow_undefined=no|allow_undefined=yes|g' libtool > ltnew && mv -f ltnew libtool +_LT_AT_CHECK_EXECUTE + + +AT_CLEANUP diff --git a/tests/tagdemo/.gitignore b/tests/tagdemo/.gitignore deleted file mode 100644 index 7451dd9..0000000 --- a/tests/tagdemo/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/tagdemo diff --git a/tests/tagdemo/Makefile.am b/tests/tagdemo/Makefile.am deleted file mode 100644 index 71a7825..0000000 --- a/tests/tagdemo/Makefile.am +++ /dev/null @@ -1,63 +0,0 @@ -## Makefile.am -- Process this file with automake to produce Makefile.in -## -## Copyright (C) 2003, 2004, 2005, 2011 Free Software Foundation -## Written by Gary V. Vaughan, 2003 -## -## This file is part of GNU Libtool. -## -## GNU Libtool 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. -## -## GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -## can be downloaded from http://www.gnu.org/licenses/gpl.html, -## or obtained by writing to the Free Software Foundation, Inc., -## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -##### - -AUTOMAKE_OPTIONS = no-dependencies foreign -ACLOCAL_AMFLAGS = -I ../../m4 -AM_CPPFLAGS = -I$(top_srcdir)/../.. - -noinst_LTLIBRARIES = libconv.la -lib_LTLIBRARIES = libfoo.la libbaz.la - -libfoo_la_SOURCES = foo.cpp -libfoo_la_LDFLAGS = -no-undefined -libfoo_la_LIBADD = libconv.la $(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 - -# Test convenience libraries. -libconv_la_SOURCES = conv.cpp -libconv_la_LDFLAGS = -no-undefined - -noinst_HEADERS = foo.h baz.h conv.h - -bin_PROGRAMS = tagdemo - -tagdemo_SOURCES = main.cpp -tagdemo_LDADD = libbaz.la libfoo.la - -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status --recheck - -# Workaround a bug in Autoconf-2.61 and earlier that don't clean up -# file droppings left by many compilers: -distclean-local: - ac_files="a.out.* a.exe.* a_out.exe.* b.out.* conftest.*"; \ - for ac_file in $$ac_files; do \ - case $$ac_file in \ - *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) rm -rf $$ac_file ;; \ - esac; \ - done diff --git a/tests/tagdemo/README b/tests/tagdemo/README deleted file mode 100644 index b82576d..0000000 --- a/tests/tagdemo/README +++ /dev/null @@ -1,6 +0,0 @@ -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 library from C++ sources, which is then -linked to a C++ program. diff --git a/tests/tagdemo/baz.cpp b/tests/tagdemo/baz.cpp deleted file mode 100644 index 2e47e3e..0000000 --- a/tests/tagdemo/baz.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// -*- C++ -*- -// baz.cpp -- a slightly more complicated test library -// -// Copyright (C) 1998-2000 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 deleted file mode 100644 index 2737a2c..0000000 --- a/tests/tagdemo/baz.h +++ /dev/null @@ -1,46 +0,0 @@ -// -*- C++ -*- -// baz.h -- interface to the libfoo* libraries -// -// Copyright (C) 1998-1999 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 deleted file mode 100644 index 36f3591..0000000 --- a/tests/tagdemo/configure.ac +++ /dev/null @@ -1,96 +0,0 @@ -# Process this file with autoconf to create configure. -*- autoconf -*- -# -# Copyright (C) 2001, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#### - -AC_PREREQ(2.54) - - -## ------------------------ ## -## Autoconf initialisation. ## -## ------------------------ ## -AC_INIT([tagdemo], [1.0], [bug-libt...@gnu.org]) -AC_CONFIG_SRCDIR([foo.cpp]) -AC_CONFIG_AUX_DIR([../../build-aux]) - -AC_CANONICAL_TARGET - - -## ------------------------ ## -## Automake Initialisation. ## -## ------------------------ ## -AM_INIT_AUTOMAKE - - -## ---------------- ## -## Compiler checks. ## -## ---------------- ## -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CC_C_O - -AC_PROG_CXX -AC_PROG_CXXCPP - -# Check for namespace support and new-style headers -AC_LANG_PUSH([C++]) -AC_MSG_CHECKING([whether the compiler implements namespaces]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[namespace A { namespace B { int i = 0; }}]], - [[using namespace A::B; return i;]])], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_NAMESPACES],[1], - [define if the compiler implements namespaces])], - [AC_MSG_RESULT([no])]) - -AC_MSG_CHECKING([whether the compiler has ISO C++ iostream]) -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include <iostream> -#ifdef HAVE_NAMESPACES -using namespace std; -#endif ]], [[cout << "bingo\n"; return 0;]])], - [AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_IOSTREAM],[1], - [define if the compiler has ISO C++ iostream])], - [AC_MSG_RESULT([no])]) -AC_LANG_POP([C++]) - - -## ----------------------- ## -## Libtool initialisation. ## -## ----------------------- ## - -# Set the test language to C++. -AC_LANG([C++]) -LT_INIT - - -## ------------------------------ ## -## Libraries required by tagdemo. ## -## ------------------------------ ## -LT_LIB_M - - -## -------- ## -## Outputs. ## -## -------- ## -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/tests/tagdemo/conv.cpp b/tests/tagdemo/conv.cpp deleted file mode 100644 index 44f7000..0000000 --- a/tests/tagdemo/conv.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -*- C++ -*- -// conv.cpp -- trivial convenience test library -// -// Copyright (C) 1998-2000 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -#include "conv.h" - -// Our C functions. -int -convenience(void) -{ - return 1; -} diff --git a/tests/tagdemo/conv.h b/tests/tagdemo/conv.h deleted file mode 100644 index 56ff71b..0000000 --- a/tests/tagdemo/conv.h +++ /dev/null @@ -1,35 +0,0 @@ -// -*- C++ -*- -// conv.h -- part of the interface to the libfoo* libraries -// -// Copyright (C) 1998-1999 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -// Only include this header file once. -#ifndef _CONV_H_ -#define _CONV_H_ 1 - -// Our C test functions. -extern "C" -{ - int convenience(void); -} - -#endif /* !_CONV_H_ */ diff --git a/tests/tagdemo/foo.cpp b/tests/tagdemo/foo.cpp deleted file mode 100644 index 2572619..0000000 --- a/tests/tagdemo/foo.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -*- C++ -*- -// foo.cpp -- trivial test library -// -// Copyright (C) 1998-2000, 2007 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -#include "foo.h" -#ifdef HAVE_IOSTREAM -# include <iostream> -#else -# include <iostream.h> -#endif -#ifdef HAVE_NAMESPACES -namespace std { } -using namespace std; -#endif - -#include <math.h> - -// 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 deleted file mode 100644 index e7d6746..0000000 --- a/tests/tagdemo/foo.h +++ /dev/null @@ -1,59 +0,0 @@ -// -*- C++ -*- -// foo.h -- interface to the libfoo* libraries -// -// Copyright (C) 1998-1999 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 deleted file mode 100644 index ea642c3..0000000 --- a/tests/tagdemo/main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -*- C++ -*- -// main.cpp -- tagdemo test program -// -// Copyright (C) 1998-2000 Free Software Foundation, Inc. -// Written by Thomas Tanner, 1998 -// -// This file is part of GNU Libtool. -// -// GNU Libtool 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. -// -// GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -// can be downloaded from http://www.gnu.org/licenses/gpl.html, -// or obtained by writing to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -#include "foo.h" -#include "baz.h" -#include "conv.h" -#ifdef HAVE_IOSTREAM -# include <iostream> -#else -# include <iostream.h> -#endif -#ifdef HAVE_NAMESPACES -namespace std { } -using namespace std; -#endif - - -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; - - // -------------- - - if (convenience()) - cout << "convenience is ok!" << endl; - - return 0; -} -- 1.7.7.4 Cheers, -- Gary V. Vaughan (gary AT gnu DOT org)