diff options
30 files changed, 789 insertions, 1191 deletions
diff --git a/Makefile.am b/Makefile.am index 817ec4c8..0d7ef0b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -673,6 +673,7 @@ TESTSUITE_AT = tests/testsuite.at \ tests/resident.at \ tests/slist.at \ tests/need_lib_prefix.at \ + tests/mdemo.at \ tests/standalone.at \ tests/subproject.at \ tests/nonrecursive.at \ @@ -850,43 +851,9 @@ COMMON_TESTS = \ tests/quote.test \ tests/suffix.test \ tests/tagtrace.test \ - tests/mdemo-static.test \ - tests/mdemo-static-make.test \ - tests/mdemo-static-exec.test \ - tests/mdemo-static-inst.test \ - tests/mdemo-static-unst.test \ - tests/mdemo-conf.test \ - tests/mdemo-make.test \ - tests/mdemo-exec.test \ - tests/mdemo-inst.test \ - tests/mdemo-unst.test \ - tests/mdemo-dryrun.test \ tests/mdemo2-conf.test \ tests/mdemo2-make.test \ - tests/mdemo2-exec.test \ - tests/mdemo-shared.test \ - tests/mdemo-shared-make.test \ - tests/mdemo-shared-exec.test \ - tests/mdemo-shared-inst.test \ - tests/mdemo-shared-unst.test - -tests/mdemo-shared-unst.log: tests/mdemo-shared-inst.log -tests/mdemo-shared-inst.log: tests/mdemo-shared-exec.log -tests/mdemo-shared-exec.log: tests/mdemo-shared-make.log -tests/mdemo-shared-make.log: tests/mdemo-shared.log -tests/mdemo-shared.log: $(ORDER) tests/mdemo-dryrun.log \ - tests/mdemo2-exec.log - -tests/mdemo-dryrun.log: tests/mdemo-unst.log -tests/mdemo-unst.log: tests/mdemo-inst.log -tests/mdemo-inst.log: tests/mdemo-exec.log -tests/mdemo-exec.log: tests/mdemo-make.log -tests/mdemo-make.log: tests/mdemo-conf.log -tests/mdemo-conf.log: $(ORDER) tests/mdemo-static-unst.log -tests/mdemo-static-unst.log: tests/mdemo-static-inst.log -tests/mdemo-static-inst.log: tests/mdemo-static-exec.log -tests/mdemo-static-exec.log: tests/mdemo-static-make.log -tests/mdemo-static-make.log: tests/mdemo-static.log + tests/mdemo2-exec.test tests/mdemo2-exec.log: tests/mdemo2-make.log tests/mdemo2-make.log: tests/mdemo2-conf.log \ diff --git a/configure.ac b/configure.ac index fa9d2c9b..7a4099bb 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/mdemo2" AC_SUBST([CONF_SUBDIRS]) DIST_MAKEFILE_LIST= diff --git a/tests/mdemo-conf.test b/tests/mdemo-conf.test deleted file mode 100755 index 5742af01..00000000 --- a/tests/mdemo-conf.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mdemo-conf.test - try configuring the mdemo 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/mdemo" -func_make_distclean -func_configure -func_check_static_shared "yes" "yes" - -exit 0 diff --git a/tests/mdemo-dryrun.test b/tests/mdemo-dryrun.test deleted file mode 100755 index 678891de..00000000 --- a/tests/mdemo-dryrun.test +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh -# mdemo-dryrun.test - check whether the --dry-run mode works properly -# -# 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 "mdemo-conf" "tests/mdemo/Makefile" - -func_mkprefixdir -func_cd "tests/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' -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 -rm -f $objdir/libtool.new -sed 's/^opt_dry_run=.*$/opt_dry_run=${force_dry_run-false}/' < libtool > $objdir/libtool.new -chmod +x $objdir/libtool.new -mv libtool $objdir/libtool -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. -func_make main.$objext - -func_msg "Making object files in mdemo (dry run)" -# ls -l in MSYS sometimes shows year, not time, for really fresh files. -sleep 1 -ls -l . $objdir | grep -v total > $before -force_dry_run=: $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 -func_make foo1.lo foo2.lo libsub.la - -func_msg "Making libraries in mdemo (dry run)" -# ls -l in MSYS sometimes shows year, not time, for really fresh files. -sleep 1 -ls -l . $objdir | grep -v total > $before -force_dry_run=: $MAKE foo1.la libfoo2.la || exit $? -ls -l . $objdir | grep -v total > $after -cmp $before $after > /dev/null || exit 1 -# Now really make them -func_make foo1.la libfoo2.la - -func_msg "Making programs in ../mdemo (dry run)" -# ls -l in MSYS sometimes shows year, not time, for really fresh files. -sleep 1 -ls -l . $objdir | grep -v total > $before -force_dry_run=: $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 -func_make mdemo$EXEEXT mdemo_static$EXEEXT - -func_msg "Running $MAKE install in ../mdemo (dry run)" -# Libtool does not create these directories -func_mkdir_p "$prefix/bin" -func_mkdir_p "$prefix/lib" -# ls -l in MSYS sometimes shows year, not time, for really fresh files. -sleep 1 -ls -l . $objdir | grep -v total > $before -ls -lR $prefix | grep -v total >> $before -force_dry_run=: $MAKE install 1>&2 || exit 1 -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 -func_make install - -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" -# ls -l in MSYS sometimes shows year, not time, for really fresh files. -sleep 1 -ls -l . $objdir | grep -v total > $before -ls -lR $prefix | grep -v total >> $before -force_dry_run=: $MAKE uninstall 1>&2 || exit $? -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 -func_make uninstall - -rm -f $before $after libtool -mv $objdir/libtool libtool - -exit 0 diff --git a/tests/mdemo-exec.test b/tests/mdemo-exec.test deleted file mode 100755 index ee3014ef..00000000 --- a/tests/mdemo-exec.test +++ /dev/null @@ -1,39 +0,0 @@ -#! /bin/sh -# mdemo-exec.test - check that programs in the mdemo subdirectory are viable -# -# Copyright (C) 2003, 2004, 2005, 2007 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 "mdemo-make" "tests/mdemo/mdemo$EXEEXT" - -func_rmprefixdir -func_exec_init "uninstalled" -func_exec "tests/mdemo/mdemo_static$EXEEXT tests/mdemo/foo1.la tests/mdemo/libfoo2.la" \ - "try_iterate: .*libfoo2" -func_exec "tests/mdemo/mdemo$EXEEXT tests/mdemo/foo1.la tests/mdemo/libfoo2.la" \ - "try_iterate: .*libfoo2" -func_exec "tests/mdemo/mdemo_static$EXEEXT `pwd`/tests/mdemo/foo1.la `pwd`/tests/mdemo/libfoo2.la" -func_exec "tests/mdemo/mdemo$EXEEXT `pwd`/tests/mdemo/foo1.la `pwd`/tests/mdemo/libfoo2.la" - -exit $exec_status diff --git a/tests/mdemo-inst.test b/tests/mdemo-inst.test deleted file mode 100755 index d611836b..00000000 --- a/tests/mdemo-inst.test +++ /dev/null @@ -1,37 +0,0 @@ -#! /bin/sh -# mdemo-inst.test - try installing from the mdemo 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 "mdemo-make" "tests/mdemo/mdemo$EXEEXT" - -func_mkprefixdir -func_cd "tests/mdemo" -func_make "install" -func_exec_init "installed" -func_exec "$prefix/bin/mdemo_static$EXEEXT $prefix/lib/foo1.la $prefix/lib/libfoo2.la" -func_exec "$prefix/bin/mdemo$EXEEXT $prefix/lib/foo1.la $prefix/lib/libfoo2.la" - -exit $status diff --git a/tests/mdemo-make.test b/tests/mdemo-make.test deleted file mode 100755 index 29c4cd48..00000000 --- a/tests/mdemo-make.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mdemo-make.test - try building in the mdemo 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 "mdemo-conf" "tests/mdemo/Makefile" - -func_rmprefixdir -func_cd "tests/mdemo" -func_make - -exit 0 diff --git a/tests/mdemo-shared-exec.test b/tests/mdemo-shared-exec.test deleted file mode 100755 index 17240b03..00000000 --- a/tests/mdemo-shared-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-exec.test diff --git a/tests/mdemo-shared-inst.test b/tests/mdemo-shared-inst.test deleted file mode 100755 index 7b8f7a69..00000000 --- a/tests/mdemo-shared-inst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-inst.test diff --git a/tests/mdemo-shared-make.test b/tests/mdemo-shared-make.test deleted file mode 100755 index ef661d82..00000000 --- a/tests/mdemo-shared-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-make.test diff --git a/tests/mdemo-shared-unst.test b/tests/mdemo-shared-unst.test deleted file mode 100755 index 100ab8e3..00000000 --- a/tests/mdemo-shared-unst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-unst.test diff --git a/tests/mdemo-shared.test b/tests/mdemo-shared.test deleted file mode 100755 index fb32764a..00000000 --- a/tests/mdemo-shared.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mdemo-shared.test - try configuring the mdemo 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/mdemo" -func_make_distclean -func_configure "--disable-static" -func_check_static_shared "no" "yes" - -exit 0 diff --git a/tests/mdemo-static-exec.test b/tests/mdemo-static-exec.test deleted file mode 100755 index 17240b03..00000000 --- a/tests/mdemo-static-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-exec.test diff --git a/tests/mdemo-static-inst.test b/tests/mdemo-static-inst.test deleted file mode 100755 index 7b8f7a69..00000000 --- a/tests/mdemo-static-inst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-inst.test diff --git a/tests/mdemo-static-make.test b/tests/mdemo-static-make.test deleted file mode 100755 index ef661d82..00000000 --- a/tests/mdemo-static-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-make.test diff --git a/tests/mdemo-static-unst.test b/tests/mdemo-static-unst.test deleted file mode 100755 index 100ab8e3..00000000 --- a/tests/mdemo-static-unst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/mdemo-unst.test diff --git a/tests/mdemo-static.test b/tests/mdemo-static.test deleted file mode 100755 index 5df535d8..00000000 --- a/tests/mdemo-static.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mdemo-static.test - try configuring the mdemo 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/mdemo" -func_make_distclean -func_configure "--disable-shared" -func_check_static_shared "yes" "no" - -exit 0 diff --git a/tests/mdemo-unst.test b/tests/mdemo-unst.test deleted file mode 100755 index e808e31e..00000000 --- a/tests/mdemo-unst.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mdemo-unst.test - try uninstalling in the mdemo 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 "mdemo-inst" "$prefix/bin/mdemo$EXEEXT" "tests/mdemo/Makefile" - -func_mkprefixdir -func_cd "tests/mdemo" -func_make_uninstall - -exit 0 diff --git a/tests/mdemo.at b/tests/mdemo.at new file mode 100644 index 00000000..30721495 --- /dev/null +++ b/tests/mdemo.at @@ -0,0 +1,785 @@ +# demo.at -- Dynamic ltdl runtime loading -*- Autotest -*- +# +# Copyright (C) 1998, 2002, 2003, 2004, 2011 Free Software Foundation, Inc. +# Written by Thomas Tanner, 1998 +# Written by Greg Eisenhauer, 2002 +# Rewritten 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([Dynamic ltdl runtime loading.]) + +# _LT_SETUP +# --------- +m4_define([_LT_SETUP], +[dnl We can't use AT_DATA here, because we need an unquoted here- +dnl document to splice in the path to the top level libltdl directory, +dnl but, we do need to double m4-quote to prevent premature expansion +dnl of any active m4 symbols in the here-doc content, and to maintain +dnl the square-bracket symbols as is. +[cat >configure.ac <<_EOT_ +AC_INIT([mdemo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +LT_CONFIG_LTDL_DIR([libltdl]) +AM_INIT_AUTOMAKE +AC_PROG_CC +LT_INIT([dlopen win32-dll]) +LTDL_INIT([nonrecursive]) +AC_SUBST([LIBTOOL_DEPS]) +AC_SUBST([INCLTDL]) +AC_SUBST([LIBLTDL]) +STATIC= +test yes = "$enable_static" && STATIC=-static +AC_SUBST([STATIC]) +LT_LIB_M +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADERS([config.h:config.in.h]) +AC_OUTPUT +_EOT_] + + +[cat >Makefile.am <<_EOT_ +AUTOMAKE_OPTIONS = no-dependencies foreign +ACLOCAL_AMFLAGS = -I m4 +AM_CPPFLAGS = \$(INCLTDL) +AM_LDFLAGS = + +noinst_LTLIBRARIES = +EXTRA_LTLIBRARIES = + +include_HEADERS = + +EXTRA_DIST = + +BUILT_SOURCES = +CLEANFILES = +MOSTLYCLEANFILES = + +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 + +## Use -export-symbols-regex here explicitly because libltdl marks +## its exported symbols, and we use libltdl as a convenience archive. +## Thus, on w32, auto-exporting is turned off. +libmlib_la_SOURCES = mlib.c +libmlib_la_LIBADD = \$(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la +libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*" +libmlib_la_DEPENDENCIES = \$(LIBLTDL) libsub.la foo1.la libfoo2.la + +noinst_HEADERS = foo.h + +\$(LIBLTDL): ${top_build_prefix}libtool \ + ${top_build_prefix}config.h $top_srcdir/libltdl/ltdl.c \ + $top_srcdir/libltdl/ltdl.h + cd $top_build_prefix; \$(MAKE) \`echo \$(LIBLTDL) | sed 's|.*\.\./\.\./libltdl/|libltdl/|g'\` +# Do not error out if toplevel config.h does not exist: +${top_build_prefix}config.h: + +bin_PROGRAMS = mdemo mdemo_static + +# 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) + +libtool: \$(LIBTOOL_DEPS) + \$(SHELL) ./config.status --recheck + +include \$(srcdir)/libltdl/ltdl.mk +include \$(srcdir)/mdemo.mk +_EOT_] + +AT_DATA([mdemo.mk], +[[# Don't abort for lack of mdemo.mk +]]) + +AT_DATA([foo.h], +[[#ifndef FOO_H +#define FOO_H + +/* Silly constants that the functions return. */ +#define HELLO_RET 0xe110 +#define FOO_RET 0xf00 + +#ifdef __cplusplus +extern "C" { +#endif + +int sub (void); + +#ifdef __cplusplus +} +#endif + +#endif +]]) + +AT_DATA([foo1.c], +[[#include <config.h> +#include <stdio.h> +#include <math.h> + +#include "foo.h" + +#define nothing foo1_LTX_nothing +#define foo1 foo1_LTX_foo1 +#define hello foo1_LTX_hello + +/* Give a global variable definition. */ +int nothing = FOO_RET; + +/* private function */ +int _foo1_helper (void) { + sub (); + return FOO_RET; +} + +/* export functions */ +#ifdef __cplusplus +extern "C" { +#endif + +int foo1 (void) { + 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; +} + +#ifdef __cplusplus +} +#endif +]]) + +AT_DATA([foo2.c], +[[#include <config.h> +#include <stdio.h> +#include <math.h> + +#include "foo.h" + +#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 (void) { + sub (); + return FOO_RET; +} + +/* export functions */ +#ifdef __cplusplus +extern "C" { +#endif + +int foo2 (void) { + 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; +} + +#ifdef __cplusplus +} +#endif +]]) + +AT_DATA([mlib.c], +[[#include <config.h> +#include <stdio.h> + +#include "foo.h" +#include "ltdl.h" + +int test_dl (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 (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; +} +]]) + +AT_DATA([sub.c], +[[#include <config.h> +#include <stdio.h> +void sub (void) { printf ("sub() called\n"); } +]]) + +AT_DATA([main.c], +[[#include <config.h> +#include <stdio.h> +#include <string.h> + +#include "foo.h" +#include "ltdl.h" + +#ifdef __cplusplus +# define EXPORT extern "C" +#else +# define EXPORT extern +#endif + +EXPORT int myfunc (void); + +int +test_dl (char *filename, int test_ext) +{ + lt_dlhandle handle; + const lt_dlinfo *info; + int (*pfoo1)() = 0; + int (*pfoo2)() = 0; + int (*phello)() = 0; + int *pnothing = 0; + int ret = 0; + + if (test_ext) + handle = lt_dlopenext (filename); + else + 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; +} + +static int +callback (const char *filename, void *data) +{ + printf ("%s: %s\n", (char *)data, filename); + return 0; +} + +static int +try_iterate (const char *search_path) +{ + char *s = "try_iterate"; + return lt_dlforeachfile (search_path, callback, s); +} + +/* cheap dirname clone. We require a '/' separator, nonempty and large + enough input, not ending with '/', and we will overwrite the input. */ +static char * +my_dirname (char *path) +{ + char *p = strrchr (path, '/'); + if (p) + *p = '\0'; + else + { + path[0] = '.'; + path[1] = '\0'; + } + return path; +} + +int +main (int argc, char **argv) +{ + int i; + int ret = 0; + char *p; + + 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], 0)) + ret = 1; + p = strrchr(argv[i], '.'); + if (p) + { + *p = '\0'; + if (test_dl(argv[i], 1)) + ret = 1; + *p = '.'; + } + } + + if (test_dlself()) + ret = 1; + + for (i = 1; i < argc; i++) + if (argv[i][0] != '\0') + { + my_dirname (argv[i]); + if (try_iterate (argv[i])) + ret = 1; + } + + lt_dlexit(); + return ret; +} +]]) + +AT_DATA([expout], +[[Welcome to GNU Hell! +cos (0.0) = 1 +** This is not GNU Hello. There is no built-in mail reader. ** +]]) + +prefixdir=`pwd`/_inst +]) # _LT_SETUP + + +# _LT_CHECK_EXECUTE +# ----------------- +# Run the listed make rules, and check that the built binaries work. +m4_define([_LT_CHECK_EXECUTE], +[LT_AT_MAKE +LT_AT_EXEC_CHECK([./mdemo_static], 0, [ignore], [], + [./foo1.la ./libfoo2.la | grep '^try_iterate: ']) +LT_AT_EXEC_CHECK([./mdemo], 0, [ignore], [], + [./foo1.la ./libfoo2.la | grep '^try_iterate: ']) +LT_AT_EXEC_CHECK([./mdemo_static], 0, [ignore], [], + [`pwd`/foo1.la `pwd`/libfoo2.la | grep '^try_iterate: ']) +LT_AT_EXEC_CHECK([./mdemo], 0, [ignore], [], + [`pwd`/foo1.la `pwd`/libfoo2.la | grep '^try_iterate: ']) +]) + +# _LT_CHECK_INSTALL +# ----------------- +# Run the make install rule, and check that installed binaries work too. +m4_define([_LT_CHECK_INSTALL], +[LT_AT_MAKE([install]) + +# Windows hosts search for dlls in the command path. +PATH=$prefixdir/lib:$PATH + +LT_AT_EXEC_CHECK([$prefixdir/bin/mdemo_static], 0, [ignore], [], + [$prefixdir/lib/foo1.la $prefixdir/lib/libfoo2.la | grep '^try_iterate: ']) +LT_AT_EXEC_CHECK([$prefixdir/bin/mdemo], 0, [ignore], [], + [$prefixdir/lib/foo1.la $prefixdir/lib/libfoo2.la | grep '^try_iterate: ']) +]) + + +## ------------- ## +## Mdemo static. ## +## ------------- ## + +AT_SETUP([dynamically ltdl preload static modules]) + +_LT_SETUP + +LT_AT_CHECK_CONFIG([--disable-shared], + [^build_old_libs=yes], [^build_libtool_libs=no]) +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL +LT_AT_CHECK_UNINSTALL + +AT_CLEANUP + + +## ------------- ## +## Mdemo shared. ## +## ------------- ## + +AT_SETUP([dynamically ltdl load a shared module]) + +_LT_SETUP + +LT_AT_CHECK_CONFIG([--disable-static], + [^build_old_libs=no], [^build_libtool_libs=yes]) +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL +LT_AT_CHECK_UNINSTALL + +AT_CLEANUP + + +## ----------- ## +## Mdemo conf. ## +## ----------- ## + +AT_SETUP([ltdl load shared and static modules]) + +_LT_SETUP + +LT_AT_CHECK_CONFIG([], + [^build_old_libs=yes], [^build_libtool_libs=yes]) +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL +LT_AT_CHECK_UNINSTALL + +AT_CLEANUP + + +## ------------- ## +## Mdemo dryrun. ## +## ------------- ## + +AT_SETUP([ltdl dryrun]) + +_LT_SETUP + +LT_AT_CHECK_CONFIG +LT_AT_MAKE([all-local libltdl/libltdlc.la]) + +# 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' +$lt_INSTALL -d "$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 +sed 's|^opt_dry_run=.*$|opt_dry_run=$force_dry_run|' libtool > ltnew && mv ltnew libtool +export force_dry_run + +# 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. +force_dry_run=false +LT_AT_MAKE([main.$objext]) + +# Making object files +# ls -l in MSYS sometimes shows year, not time, for really fresh files. +sleep 1 +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before" +force_dry_run=: +LT_AT_MAKE([foo1.lo foo2.lo libsub.la]) +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after" +AT_CHECK([cmp "$before" "$after"], 0, [ignore]) + +# Now really make them +force_dry_run=false +LT_AT_MAKE([foo1.lo foo2.lo libsub.la]) + +# Making libraries +sleep 1 # for MSYS +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before" +force_dry_run=: +LT_AT_MAKE([foo1.la libfoo2.la]) +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after" +AT_CHECK([cmp "$before" "$after"], 0, [ignore]) + +# Now really make them +force_dry_run=false +LT_AT_MAKE([foo1.la libfoo2.la]) + +# Making programs +sleep 1 # for MSYS +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before" +force_dry_run=: +LT_AT_MAKE([mdemo$EXEEXT mdemo_static$EXEEXT]) +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after" +AT_CHECK([cmp "$before" "$after"], 0, [ignore]) + +# Running $MAKE install +# Libtool does not create these directories +$lt_INSTALL -d "$prefixdir/bin" +$lt_INSTALL -d "$prefixdir/include" +$lt_INSTALL -d "$prefixdir/lib" + +sleep 1 # for MSYS +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before" +ls -lR "$prefixdir" | $EGREP -v '(^total|testsuite.log$)' >> "$before" +force_dry_run=: +LT_AT_MAKE([install]) + +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after" +ls -lR "$prefixdir" | $EGREP -v '(^total|testsuite.log$)' >> "$after" +AT_CHECK([cmp "$before" "$after"], 0, [ignore]) + +# Now really install +force_dry_run=false +LT_AT_MAKE([install]) + +# Running $MAKE uninstall +# Libtool does not uninstall the programs, remove them first +rm -f "$prefixdir/bin/mdemo$EXEEXT" "$prefixdir/bin/mdemo_static$EXEEXT" + +sleep 1 # for MSYS +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$before" +ls -lR "$prefixdir" | $EGREP -v '(^total|testsuite.log$)' >> "$before" +force_dry_run=: +LT_AT_MAKE([uninstall]) +ls -l . "$objdir" | $EGREP -v '(^total|testsuite.log$)' > "$after" +ls -lR "$prefixdir" | $EGREP -v '(^total|testsuite.log$)' >> "$after" +AT_CHECK([cmp "$before" "$after"], 0, [ignore]) + +# Now really uninstall +force_dry_run=false +LT_AT_CHECK_UNINSTALL + +AT_CLEANUP diff --git a/tests/mdemo/.gitignore b/tests/mdemo/.gitignore deleted file mode 100644 index 458a9c6b..00000000 --- a/tests/mdemo/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/mdemo -/mdemo_static diff --git a/tests/mdemo/Makefile.am b/tests/mdemo/Makefile.am deleted file mode 100644 index ff9e4592..00000000 --- a/tests/mdemo/Makefile.am +++ /dev/null @@ -1,87 +0,0 @@ -## Makefile.am -- Process this file with automake to produce Makefile.in -## -## Copyright (C) 2003, 2004, 2005, 2007, 2008 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)/../.. $(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 - -## Use -export-symbols-regex here explicitly because libltdl marks -## its exported symbols, and we use libltdl as a convenience archive. -## Thus, on w32, auto-exporting is turned off. -libmlib_la_SOURCES = mlib.c -libmlib_la_LIBADD = $(LIBLTDL) "-dlopen" foo1.la "-dlopen" libfoo2.la -libmlib_la_LDFLAGS = -no-undefined -export-symbols-regex ".*" -libmlib_la_DEPENDENCIES = $(LIBLTDL) libsub.la foo1.la libfoo2.la - -noinst_HEADERS = foo.h - -bin_PROGRAMS = mdemo mdemo_static - -top_distdir = ../.. -$(LIBLTDL): $(top_distdir)/libtool \ - $(top_distdir)/config.h $(srcdir)/$(top_distdir)/libltdl/ltdl.c \ - $(srcdir)/$(top_distdir)/libltdl/ltdl.h - (cd $(top_distdir); $(MAKE) `echo $(LIBLTDL) | sed 's|.*\.\./libltdl/|libltdl/|g'`) -# Do not error out if toplevel config.h does not exist: -$(top_distdir)/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) - -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/mdemo/README b/tests/mdemo/README deleted file mode 100644 index aa4cebb8..00000000 --- a/tests/mdemo/README +++ /dev/null @@ -1,16 +0,0 @@ -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 deleted file mode 100644 index 8476b5d5..00000000 --- a/tests/mdemo/configure.ac +++ /dev/null @@ -1,72 +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([mdemo], [1.0], [bug-libtool@gnu.org]) -AC_CONFIG_SRCDIR([main.c]) -AC_CONFIG_AUX_DIR([../../build-aux]) - - -## ------------------------ ## -## Automake Initialisation. ## -## ------------------------ ## -AM_INIT_AUTOMAKE - - -## ------------------ ## -## C compiler checks. ## -## ------------------ ## -AC_PROG_CC - - -## ----------------------- ## -## Libtool initialisation. ## -## ----------------------- ## -LTDL_CONVENIENCE([../../libltdl]) -AC_SUBST([INCLTDL]) -AC_SUBST([LIBLTDL]) - -LT_INIT([dlopen win32-dll]) -AC_SUBST(LIBTOOL_DEPS) - -STATIC= -test yes = "$enable_static" && STATIC="-static" -AC_SUBST([STATIC]) - - -## ---------------------------- ## -## Libraries required by mdemo. ## -## ---------------------------- ## -LT_LIB_M - - -## -------- ## -## Outputs. ## -## -------- ## -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/tests/mdemo/foo.h b/tests/mdemo/foo.h deleted file mode 100644 index 8820813f..00000000 --- a/tests/mdemo/foo.h +++ /dev/null @@ -1,48 +0,0 @@ -/* foo.h -- interface to the libfoo* libraries - - Copyright (C) 1998-1999, 2006 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 - -/* __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 - -/* 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 deleted file mode 100644 index 452ee59f..00000000 --- a/tests/mdemo/foo1.c +++ /dev/null @@ -1,61 +0,0 @@ -/* foo1.c -- trivial test library - - Copyright (C) 1998-1999, 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" -#include <stdio.h> -#include <math.h> - -#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 */ -__BEGIN_DECLS - -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; -} - -__END_DECLS diff --git a/tests/mdemo/foo2.c b/tests/mdemo/foo2.c deleted file mode 100644 index e2632858..00000000 --- a/tests/mdemo/foo2.c +++ /dev/null @@ -1,61 +0,0 @@ -/* foo2.c -- trivial test library - - Copyright (C) 1998-1999, 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" -#include <stdio.h> -#include <math.h> - -#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 */ -__BEGIN_DECLS - -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; -} - -__END_DECLS diff --git a/tests/mdemo/main.c b/tests/mdemo/main.c deleted file mode 100644 index ea732a9e..00000000 --- a/tests/mdemo/main.c +++ /dev/null @@ -1,254 +0,0 @@ -/* main.c -- mdemo test program - - Copyright (C) 1998-2000, 2006, 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" -#include "ltdl.h" -#include <stdio.h> -#include <string.h> - -LT_BEGIN_C_DECLS -extern int myfunc (void); -LT_END_C_DECLS - -int -test_dl (char *filename, int test_ext) -{ - lt_dlhandle handle; - const lt_dlinfo *info; - int (*pfoo1)() = 0; - int (*pfoo2)() = 0; - int (*phello)() = 0; - int *pnothing = 0; - int ret = 0; - - if (test_ext) - handle = lt_dlopenext (filename); - else - 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; -} - -static int -callback (const char *filename, void *data) -{ - printf ("%s: %s\n", (char *)data, filename); - return 0; -} - -static int -try_iterate (const char *search_path) -{ - char *s = "try_iterate"; - return lt_dlforeachfile (search_path, callback, s); -} - -/* cheap dirname clone. We require a '/' separator, nonempty and large - enough input, not ending with '/', and we will overwrite the input. */ -static char * -my_dirname (char *path) -{ - char *p = strrchr (path, '/'); - if (p) - *p = '\0'; - else - { - path[0] = '.'; - path[1] = '\0'; - } - return path; -} - -int -main (int argc, char **argv) -{ - int i; - int ret = 0; - char *p; - - 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], 0)) - ret = 1; - p = strrchr(argv[i], '.'); - if (p) - { - *p = '\0'; - if (test_dl(argv[i], 1)) - ret = 1; - *p = '.'; - } - } - - if (test_dlself()) - ret = 1; - - for (i = 1; i < argc; i++) - if (argv[i][0] != '\0') - { - my_dirname (argv[i]); - if (try_iterate (argv[i])) - ret = 1; - } - - lt_dlexit(); - return ret; -} diff --git a/tests/mdemo/mlib.c b/tests/mdemo/mlib.c deleted file mode 100644 index 38374a44..00000000 --- a/tests/mdemo/mlib.c +++ /dev/null @@ -1,136 +0,0 @@ -/* mlib.c -- mlib library - - Copyright (C) 2002, 2006 Free Software Foundation, Inc. - Written by Greg Eisenhauer, 2002 - Extracted from mdemo.c - - 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 "ltdl.h" -#include <stdio.h> - -int -test_dl (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 (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 deleted file mode 100644 index eed001fb..00000000 --- a/tests/mdemo/sub.c +++ /dev/null @@ -1,31 +0,0 @@ -/* sub.c -- trivial test library - - Copyright (C) 1998-1999, 2006 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 <stdio.h> - -void -sub () -{ - printf ("sub() called\n"); -} diff --git a/tests/testsuite.at b/tests/testsuite.at index 19713028..60ff5d5e 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -36,7 +36,7 @@ for tool in ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF; do done export ACLOCAL AUTOHEADER AUTOCONF AUTOMAKE AUTORECONF eval `$LIBTOOL --config | grep '^EGREP='` -eval `$LIBTOOL --config | $EGREP '^(FGREP|objdir)'` +eval `$LIBTOOL --config | $EGREP '^(FGREP|objdir|objext)'` eval `$LIBTOOL --config | $EGREP '^(host|host_os|host_alias|build|build_alias|to_host_file_cmd|to_tool_file_cmd)='` configure_options=--prefix=/nonexistent if test -n "$host_alias"; then |