diff options
author | Gary V. Vaughan <gary@gnu.org> | 2011-11-23 15:17:49 +0700 |
---|---|---|
committer | Gary V. Vaughan <gary@gnu.org> | 2012-10-04 20:11:05 +0700 |
commit | 656f63b761797efafe26691809183e49f7dcb4d6 (patch) | |
tree | 900da7f023f05e82658a6ad6f4d79fa2affeaa01 /tests | |
parent | bcc0740c8bea00db2219de693de8c93cfcad78ab (diff) | |
download | libtool-656f63b761797efafe26691809183e49f7dcb4d6.tar.gz |
tests: migrate legacy tests/demo tests to Autotest.
* tests/demo.at: New autotest groups, based on...
* tests/demo-conf.test, tests/demo-deplibs.test,
tests/demo-exec.test, tests/demo-hardcode.test,
tests/demo-inst.test, tests/demo-make.test,
tests/demo-nofast-exec.test, tests/demo-nofast-inst.test,
tests/demo-nofast-make.test, tests/demo-nofast-unst.test,
tests/demo-nofast.test, tests/demo-noinst-link.test,
tests/demo-nopic-exec.test, tests/demo-nopic-make.test,
tests/demo-nopic.test, tests/demo-pic-exec.test,
tests/demo-pic-make.test, tests/demo-pic.test,
tests/demo-relink.test, tests/demo-shared-exec.test,
tests/demo-shared-inst.test, tests/demo-shared-make.test,
tests/demo-shared-unst.test, tests/demo-shared.test,
tests/demo-static-exec.test, tests/demo-static-inst.test,
tests/demo-static-make.test, tests/demo-static-unst.test,
tests/demo-static.test, tests/demo-unst.test: ...these legacy
test cases, now removed.
* tests/demo/Makefile.am, tests/demo/README,
tests/demo/configure.ac, tests/demo/dlmain.c, tests/demo/foo.c,
tests/demo/foo.h, tests/demo/hell1.c, tests/demo/hell2.c,
tests/demo/hello.c, tests/demo/main.c: Remove.
* configure.ac (CONF_SUBDIRS): Remove tests/demo.
* Makefile.am: Adjust.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
Diffstat (limited to 'tests')
43 files changed, 826 insertions, 1388 deletions
diff --git a/tests/demo-conf.test b/tests/demo-conf.test deleted file mode 100755 index 1ef9fa2f..00000000 --- a/tests/demo-conf.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# demo-conf.test - try configuring the demo 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/demo" -func_make_distclean -func_configure -func_check_static_shared "yes" "yes" - -exit 0 diff --git a/tests/demo-deplibs.test b/tests/demo-deplibs.test deleted file mode 100755 index 2e4c99f8..00000000 --- a/tests/demo-deplibs.test +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# demo-deplibs.test - check whether the shared library check method is OK -# -# 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 "demo-conf" "tests/demo/libhello.la" - -func_mkprefixdir -func_cd "tests/demo" -echo "linking a shared library against a static library" -func_make "deplibs-check" -func_exec_init "uninstalled" -func_exec_check "hell0$EXEEXT" "check your deplibs_check_method" -func_exec "./hell0$EXEEXT" "" "check your deplibs_check_method" - -exit $exec_status diff --git a/tests/demo-exec.test b/tests/demo-exec.test deleted file mode 100755 index b586e946..00000000 --- a/tests/demo-exec.test +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/sh -# demo-exec.test - check that programs in the ../demo subdirectory are viable -# -# Copyright (C) 2003, 2004, 2005 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 "demo-make" "tests/demo/hell$EXEEXT" - -func_rmprefixdir -func_exec_init "uninstalled" -func_exec "tests/demo/hell_static$EXEEXT" 'Welcome to GNU Hell' -func_exec "tests/demo/hell$EXEEXT" 'Welcome to GNU Hell' -func_exec "tests/demo/helldl$EXEEXT" '(Welcome to .*GNU Hell|unsupported)' - -exit $exec_status diff --git a/tests/demo-hardcode.test b/tests/demo-hardcode.test deleted file mode 100755 index 269c2ff3..00000000 --- a/tests/demo-hardcode.test +++ /dev/null @@ -1,129 +0,0 @@ -#! /bin/sh -# demo-hardcode.test - check to see what the system linker hardcodes -# -# 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 "demo-inst" "$prefix/lib/libhello.la" - -func_mkprefixdir -func_cd "tests/demo" - -# Check to make sure we have a dynamic library. -func_get_config "library_names" "cat ./libhello.la" -test -z "$library_names" \ - && func_skip "Exiting: demo/libhello.la is not a shared library" - -func_make "hardcode" - -# Extra tools we might need -: ${DUMPSTABS=dumpstabs} - -# Suck in all the hardcode_* variable settings. -func_msg "Finding libtool.m4's guesses at hardcoding values" -func_get_config 'hardcode_direct -hardcode_minus_L -hardcode_shlibpath_var -hardcode_libdir_flag_spec' "./libtool --config" ": fatal" - -echo "= Searching for hardcoded library directories in each program" -for file in hc-*; do - case $file in - hc-direct) expected="$hardcode_direct" ;; - hc-libpath) expected="$hardcode_shlibpath_var" ;; - hc-minusL) expected="$hardcode_minus_L" ;; - - hc-libflag) - if test -n "$hardcode_libdir_flag_spec"; then - expected=yes - else - expected=unsupported - fi - ;; - - *) - continue - ;; - esac - - # Discover whether the objdir really was hardcoded. - hardcoded=no - - # Solaris cc may store the command line in a debugging section, - # which leads to false positives. Unfortunately, Solaris strip - # is not capable to remove the section (unlike GNU binutils strip). - # So we use dumpstabs if it seems to work. - if { $DUMPSTABS -d $file; } >/dev/null 2>&1; then - if $DUMPSTABS -d $file 2>/dev/null | $FGREP "$objdir" >/dev/null 2>&1; then - hardcoded=yes - else - hardcoded=no - fi - # At least AIX fgrep doesn't work for binary files, and AIX also - # doesn't have strings(1), so we need this strange conversion - # (which only works on ASCII). - # AIX fgrep also has a limited line length, so we turn unprintable - # characters into newlines. - elif cat $file | (tr '\000-\037\200-\377' '\n' || cat) 2>/dev/null \ - | $FGREP "$objdir" > /dev/null 2>&1; then - hardcoded=yes - elif $FGREP "$objdir" $file > /dev/null 2>&1; then - # We retry fgrep without tr, in case the above lead to a false negative. - hardcoded=yes - elif (sed -e '1!d' $file | grep 'unsupported') >/dev/null 2>&1; then - hardcoded=unsupported - fi - - # Check the result. - case $hardcoded in - yes) - if test yes = "$expected"; then - echo "$objdir was hardcoded in \`$file', as libtool expected" - else - echo "$objdir was hardcoded in \`$file', which fooled libtool" 1>&2 - exit_status=1 - fi - ;; - - no) - if test no = "$expected"; then - echo "$objdir was not hardcoded in \`$file', as libtool expected" - else - echo "$objdir was not hardcoded in \`$file', which fooled libtool" 1>&2 - exit_status=1 - fi - ;; - - unsupported) - if test unsupported = "$expected"; then - echo "\`$file' was not linked properly, as libtool expected" - else - echo "\`$file' was not linked properly, which fooled libtool" 1>&2 - exit_status=1 - fi - ;; - esac -done - -exit $exit_status diff --git a/tests/demo-inst.test b/tests/demo-inst.test deleted file mode 100755 index 3bd5ea60..00000000 --- a/tests/demo-inst.test +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# demo-inst.test - try installing from the demo 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 "demo-make" "tests/demo/hell$EXEEXT" - -func_mkprefixdir -func_cd "tests/demo" -func_make "install" -func_exec_init "installed" -func_exec "$prefix/bin/hell_static$EXEEXT" 'Welcome to GNU Hell' -func_exec "$prefix/bin/hell$EXEEXT" 'Welcome to GNU Hell' -func_exec "$prefix/bin/helldl$EXEEXT" '(Welcome to .*GNU Hell|unsupported)' - -exit $status diff --git a/tests/demo-make.test b/tests/demo-make.test deleted file mode 100755 index a1f9bfd4..00000000 --- a/tests/demo-make.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# demo-make.test - try building in the demo 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 "demo-conf" "tests/demo/Makefile" - -func_rmprefixdir -func_cd "tests/demo" -func_make - -exit 0 diff --git a/tests/demo-nofast-exec.test b/tests/demo-nofast-exec.test deleted file mode 100755 index 6745d2e4..00000000 --- a/tests/demo-nofast-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-exec.test diff --git a/tests/demo-nofast-inst.test b/tests/demo-nofast-inst.test deleted file mode 100755 index 0213f20d..00000000 --- a/tests/demo-nofast-inst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-inst.test diff --git a/tests/demo-nofast-make.test b/tests/demo-nofast-make.test deleted file mode 100755 index 04bee2fe..00000000 --- a/tests/demo-nofast-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-make.test diff --git a/tests/demo-nofast-unst.test b/tests/demo-nofast-unst.test deleted file mode 100755 index 97a250f5..00000000 --- a/tests/demo-nofast-unst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-unst.test diff --git a/tests/demo-nofast.test b/tests/demo-nofast.test deleted file mode 100755 index 6b50f4a5..00000000 --- a/tests/demo-nofast.test +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# demo-nofast.test - try configuring the ../demo 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/demo" -func_make_distclean -func_configure "--enable-fast-install=no" - -if func_grep '^hardcode_action=relink' libtool; then - rm -f Makefile - exit 77 -fi - -exit 0 diff --git a/tests/demo-noinst-link.test b/tests/demo-noinst-link.test deleted file mode 100755 index 5654ff97..00000000 --- a/tests/demo-noinst-link.test +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -# demo-noinst-link.test - make sure we do not link with an installed -# library when an uninstalled one is to be used -# -# Copyright (C) 2003, 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_restore_files () -{ - mv -f "$objdir"/temp/libs/* "$objdir" - mv -f "$objdir/temp/libhello.la" "$objdir/temp/hell$EXEEXT" . - rm -rf "$objdir/temp" -} - -func_save_files () -{ - func_mkdir_p "$objdir/temp/libs" - cp -f libhello.la "hell$EXEEXT" "$objdir/temp" - cp -f "$objdir"/* "$objdir"/temp/libs -} - -func_require "demo-inst" "$prefix/lib/libhello.la" - -func_mkprefixdir -func_cd "tests/demo" - -# AIX 5.3 `/bin/sh' will invoke the trap for 0 at the end of a -# function, so we set the trap outside of a function to be portable. -trap func_restore_files 0 1 2 13 15 -func_save_files - -func_msg "removing \`libhello.la' and \`hell' from demo" -rm -f libhello.la "hell$EXEEXT" - -status=$EXIT_SUCCESS -func_msg "linking \`hell' with a broken \`demo/libhello.la'" -if $MAKE "hell$EXEEXT" libhello_la_OBJECTS=hello.lo; then - func_msg "Succeeded: this means the installed library was used, which is wrong" - status=$EXIT_FAILURE -fi - -exit $status diff --git a/tests/demo-nopic-exec.test b/tests/demo-nopic-exec.test deleted file mode 100755 index 6745d2e4..00000000 --- a/tests/demo-nopic-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-exec.test diff --git a/tests/demo-nopic-make.test b/tests/demo-nopic-make.test deleted file mode 100755 index 04bee2fe..00000000 --- a/tests/demo-nopic-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-make.test diff --git a/tests/demo-nopic.test b/tests/demo-nopic.test deleted file mode 100755 index b44f34b0..00000000 --- a/tests/demo-nopic.test +++ /dev/null @@ -1,56 +0,0 @@ -#! /bin/sh -# demo-nopic.test - try configuring the ../demo subdirectory -# -# Copyright (C) 2003, 2004, 2010 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 - -case $host in -hppa*|x86_64*|s390*) - func_skip "$host doesn't like non-PIC shared libs" - ;; -*-solaris*|*-sunos*) - func_skip "libtool does not build non-PIC shared libs on $host" - ;; -esac - -if test "$build" = "$host" && test -d "/etc/selinux"; then - _selinux=`getenforce 2>/dev/null || echo "Disabled"` - case $_selinux in - *Enforcing) - _sebool_allow_execmod=`getsebool allow_execmod 2>/dev/null` - case $_sebool_allow_execmod in - *off) - func_skip "SELinux policy disallows" - ;; - esac - ;; - esac -fi - -func_rmprefixdir -func_cd "tests/demo" -func_make_distclean -func_configure "--with-pic=no" - -exit 0 diff --git a/tests/demo-pic-exec.test b/tests/demo-pic-exec.test deleted file mode 100755 index 6745d2e4..00000000 --- a/tests/demo-pic-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-exec.test diff --git a/tests/demo-pic-make.test b/tests/demo-pic-make.test deleted file mode 100755 index 04bee2fe..00000000 --- a/tests/demo-pic-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-make.test diff --git a/tests/demo-pic.test b/tests/demo-pic.test deleted file mode 100755 index cce0184c..00000000 --- a/tests/demo-pic.test +++ /dev/null @@ -1,33 +0,0 @@ -#! /bin/sh -# demo-pic.test - try configuring the ../demo 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_rmprefixdir -func_cd "tests/demo" -func_make_distclean -func_configure "--with-pic=yes" - -exit 0 diff --git a/tests/demo-relink.test b/tests/demo-relink.test deleted file mode 100755 index 4b32fba6..00000000 --- a/tests/demo-relink.test +++ /dev/null @@ -1,107 +0,0 @@ -#! /bin/sh -# demo-relink.test - check to see whether shlibpath overrides runpath -# -# 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_restore_files () -{ - mv -f "$objdir"/temp/libs/* "$objdir" - mv -f "$objdir/temp/libhello.la" . - rm -rf "$objdir/temp" -} - -func_save_files () -{ - func_mkdir_p "$objdir/temp/libs" - cp -f libhello.la "$objdir/temp" - cp -f "$objdir"/libhello.* "$objdir/lt-hell$EXEEXT" "$objdir/temp/libs" -} - -func_require "demo-inst" "$prefix/lib/libhello.la" "tests/demo/libhello.la" - -func_mkprefixdir -func_cd "tests/demo" - -# Check to make sure we have a dynamic library. -func_get_config "library_names" "cat libhello.la" -test -z "$library_names" \ - && func_skip "Exiting: demo/libhello.la is not a shared library" - -# AIX 5.3 `/bin/sh' will invoke the trap for 0 at the end of a -# function, so we set the trap outside of a function to be portable. -func_save_files -trap func_restore_files 0 1 2 13 15 - -func_get_config 'shlibpath_overrides_runpath -hardcode_action -hardcode_direct -hardcode_into_libs' "./libtool --config" ": fatal" - -./hell$EXEEXT # so that it links on-demand if needed - -func_msg "removing libhello.la from demo" -rm -f libhello.la "$objdir"/libhello.* - -func_msg "running demo/hell" -if ./hell$EXEEXT; then - : -elif test relink,yes = "$hardcode_action,$hardcode_direct"; then - func_msg "Ok, uninstalled programs fail after uninstalled libraries are removed." - func_msg "This works in other configurations, but not in this particular one." -else - func_fail "Exiting: demo/hell does not run, maybe libhello was not installed" -fi - -func_msg "linking a broken demo/libhello.la" -func_make libhello.la libhello_la_OBJECTS=hello.lo \ - || func_fail "Exiting: cannot link broken libhello.la" -rm -f libhello.la - -func_msg "running demo/hell with broken libhello.la" -if (./hell) 2>&1; then - func_msg "Exiting: demo/hell runs even though libhello.la is incomplete" - func_fail "shlibpath_overrides_runpath should be set to no" -else - func_msg "Failed, as expected" -fi - -if test relink = "$hardcode_action"; then - func_msg "Exiting: install-time relinking is required" - exit $EXIT_SUCCESS -fi - -if test yes != "$shlibpath_overrides_runpath"; then - rm -f $objdir/lt-hell$EXEEXT || exit $EXIT_FAILURE - cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT || exit $EXIT_FAILURE - func_msg "running demo/hell with installed libhello.la" - if ./hell; then - func_msg "Worked, as expected" - else - func_msg "shlibpath_overrides_runpath should be set to yes" - status=$EXIT_FAILURE - fi -fi - -exit $status diff --git a/tests/demo-shared-exec.test b/tests/demo-shared-exec.test deleted file mode 100755 index 6745d2e4..00000000 --- a/tests/demo-shared-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-exec.test diff --git a/tests/demo-shared-inst.test b/tests/demo-shared-inst.test deleted file mode 100755 index 0213f20d..00000000 --- a/tests/demo-shared-inst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-inst.test diff --git a/tests/demo-shared-make.test b/tests/demo-shared-make.test deleted file mode 100755 index 04bee2fe..00000000 --- a/tests/demo-shared-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-make.test diff --git a/tests/demo-shared-unst.test b/tests/demo-shared-unst.test deleted file mode 100755 index 97a250f5..00000000 --- a/tests/demo-shared-unst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-unst.test diff --git a/tests/demo-shared.test b/tests/demo-shared.test deleted file mode 100755 index 422307b3..00000000 --- a/tests/demo-shared.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# demo-shared.test - try configuring the demo 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/demo" -func_make_distclean -func_configure "--disable-static" -func_check_static_shared "no" "yes" - -exit 0 diff --git a/tests/demo-static-exec.test b/tests/demo-static-exec.test deleted file mode 100755 index 6745d2e4..00000000 --- a/tests/demo-static-exec.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-exec.test diff --git a/tests/demo-static-inst.test b/tests/demo-static-inst.test deleted file mode 100755 index 0213f20d..00000000 --- a/tests/demo-static-inst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-inst.test diff --git a/tests/demo-static-make.test b/tests/demo-static-make.test deleted file mode 100755 index 04bee2fe..00000000 --- a/tests/demo-static-make.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-make.test diff --git a/tests/demo-static-unst.test b/tests/demo-static-unst.test deleted file mode 100755 index 97a250f5..00000000 --- a/tests/demo-static-unst.test +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -. tests/defs || exit 1 -. $abs_srcdir/tests/demo-unst.test diff --git a/tests/demo-static.test b/tests/demo-static.test deleted file mode 100755 index 59eb493a..00000000 --- a/tests/demo-static.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# demo-static.test - try configuring the demo 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/demo" -func_make_distclean -func_configure "--disable-shared" -func_check_static_shared "yes" "no" - -exit 0 diff --git a/tests/demo-unst.test b/tests/demo-unst.test deleted file mode 100755 index 98208798..00000000 --- a/tests/demo-unst.test +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# demo-unst.test - try uninstalling in the demo 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 "demo-inst" "$prefix/bin/hell$EXEEXT" "tests/demo/Makefile" - -func_mkprefixdir -func_cd "tests/demo" -func_make_uninstall - -exit 0 diff --git a/tests/demo.at b/tests/demo.at new file mode 100644 index 00000000..d2fafad9 --- /dev/null +++ b/tests/demo.at @@ -0,0 +1,800 @@ +# demo.at -- Linking and loading. -*- Autotest -*- +# +# Copyright (C) 2003, 2004, 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([Linking and loading.]) + +## ------------------------------------------- ## +## Some functions shared by later tests cases. ## +## ------------------------------------------- ## + +# This function needs to be used, rather than 'exit', when a 'trap' handler is +# in effect that refers to $?. +func_exit () +{ + (exit $1); exit $1 +} + +func_restore_files () +{ + test -n "$objdir" || exit 1 + mv -f "$objdir"/temp/libs/* "$objdir" + mv -f "$objdir/temp/libhello.la" . + rm -rf "$objdir/temp" +} + +func_save_files () +{ + test -n "$objdir" || exit 1 + $lt_INSTALL -d "$objdir/temp/libs" + cp -f libhello.la "$objdir/temp" + cp -f "$objdir"/libhello.* "$objdir/lt-hell$EXEEXT" "$objdir/temp/libs" +} + + +# _LT_DEMO_SETUP +# -------------- +m4_define([_LT_DEMO_SETUP], +[AT_DATA([configure.ac], +[[AC_INIT([demo], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AM_INIT_AUTOMAKE +AC_PROG_CC + +LT_INIT([dlopen win32-dll]) +AC_SUBST([LIBTOOL_DEPS]) +STATIC= +test yes = "$enable_static" && STATIC=-static +AC_SUBST([STATIC]) + +case $lt_cv_sys_global_symbol_pipe in + ?*) binary_helldl=yes ;; +esac +AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"]) + +LT_LIB_M +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADERS([config.h:config.in.h]) +AC_OUTPUT +]]) + +AT_DATA([Makefile.am], +[[AUTOMAKE_OPTIONS = no-dependencies foreign +ACLOCAL_AMFLAGS = -I m4 + +# Build a libtool library, libhello.la for installation in libdir. +lib_LTLIBRARIES = libhello.la +libhello_la_SOURCES = hello.c foo.c +libhello_la_LIBADD = $(LIBM) +libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1 +libhello_la_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO + +include_HEADERS = foo.h + +if BINARY_HELLDL +BUILD_helldl = helldl +else +BUILD_helldl = +endif + +bin_PROGRAMS = hell hell_static $(BUILD_helldl) + +# Build hell from main.c and libhello.la +hell_SOURCES = main.c +hell_LDADD = libhello.la + +# Create a statically linked version of hell. +hell_static_SOURCES = main.c +hell_static_LDADD = libhello.la +hell_static_LDFLAGS = $(STATIC) + +if BINARY_HELLDL + +# Create a version of hell that does a preloaded dlopen. +helldl_SOURCES = dlmain.c +helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la +helldl_DEPENDENCIES = libhello.la + +else + +# Create a script that says that -dlopen is not supported. +bin_SCRIPTS = helldl +helldl helldl$(EXEEXT): + rm -rf $@ + echo '#! /bin/sh' > $@ + echo 'echo sorry, -dlopen is unsupported' >> $@ + chmod +x $@ + +endif + +libtool: $(LIBTOOL_DEPS) + $(SHELL) ./config.status --recheck + +include $(srcdir)/demo.mk +]]) + +AT_DATA([demo.mk], +[[## Don't abort for lack of demo.mk +]]) + +AT_DATA([foo.h], +[[#ifndef FOO_H +#define FOO_H + +/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and + * earlier do not define __CYGWIN__. This snippet allows us to check + * for __CYGWIN__ reliably for both current, old, and (probable) future + * releases. + */ +#ifdef __CYGWIN32__ +# ifndef __CYGWIN__ +# define __CYGWIN__ +# endif +#endif + +#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__ +# ifdef BUILDING_LIBHELLO +# ifdef DLL_EXPORT +# define LIBHELLO_SCOPE extern __declspec (dllexport) +# endif +# else +# define LIBHELLO_SCOPE extern __declspec (dllimport) +# endif +#endif +#ifndef LIBHELLO_SCOPE +# define LIBHELLO_SCOPE extern +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* Silly constants that the functions return. */ +#define HELLO_RET 0xe110 +#define FOO_RET 0xf00 + +#ifdef __cplusplus +extern "C" { +#endif + +int foo (void); +int hello (void); +LIBHELLO_SCOPE int nothing; + +#ifdef __cplusplus +} +#endif + +#endif +]]) + +AT_DATA([foo.c], +[[#include <config.h> +#include <stdio.h> +#include <math.h> + +#include "foo.h" + +/* Give a global variable definition. */ +int nothing = FOO_RET; + +int foo (void) { + printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0)); + return FOO_RET; +} +]]) + +AT_DATA([hell1.c], +[[#include <config.h> +int hell1 (void) { return 1; } +]]) + +AT_DATA([hell2.c], +[[#include <config.h> +int hell2 (void) { return 2; } +]]) + +AT_DATA([hello.c], +[[#include <config.h> +#include <stdio.h> + +#include "foo.h" + +int hello (void) { + printf ("** This is not GNU Hello. There is no built-in mail reader. **\n"); + return HELLO_RET; +} +]]) + +AT_DATA([main.c], +[[#include <config.h> +#include <stdio.h> + +#include "foo.h" + +int main () +{ + printf ("Welcome to GNU Hell!\n"); + + /* Try assigning to the nothing variable. */ + nothing = 1; + + /* Just call the functions and check return values. */ + if (foo () != FOO_RET) + return 1; + + if (hello () != HELLO_RET) + return 2; + + return 0; +} +]]) + +AT_DATA([dlmain.c], +[[#include <config.h> +#include <stdio.h> +#include <string.h> + +#include "foo.h" + +#define STREQ !strcmp + +#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols + +typedef struct +{ + const char *name; + void *address; +} lt_dlsymlist; + +extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[]; + +int main () +{ + const lt_dlsymlist *s; + int (*pfoo)() = 0; + int (*phello)() = 0; + int *pnothing = 0; + + printf ("Welcome to *modular* GNU Hell!\n"); + + /* Look up the symbols we require for this demonstration. */ + s = lt_preloaded_symbols; + while (s->name) + { + if (s->address) { + const char *name = s->name; + printf ("found symbol: %s\n", name); + if (STREQ ("hello", name)) + phello = (int(*)())s->address; + else if (STREQ ("foo", name)) + pfoo = (int(*)())s->address; + else if (STREQ ("nothing", name)) +#ifndef _WIN32 + /* In an ideal world we could do this... */ + pnothing = (int*)s->address; +#else /* !_WIN32 */ + /* In an ideal world a shared lib would be able to export data */ + pnothing = (int*)¬hing; +#endif + } else + printf ("found file: %s\n", s->name); + s ++; + } + + /* Try assigning to the nothing variable. */ + if (pnothing) + *pnothing = 1; + else + fprintf (stderr, "did not find the `nothing' variable\n"); + + /* Just call the functions and check return values. */ + if (pfoo) + { + if ((*pfoo) () != FOO_RET) + return 1; + } + else + fprintf (stderr, "did not find the `foo' function\n"); + + if (phello) + { + if ((*phello) () != HELLO_RET) + return 3; + } + else + fprintf (stderr, "did not find the `hello' function\n"); + + return 0; +} +]]) + +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_DEMO_SETUP + + +# _LT_CHECK_EXECUTE([TARGETS]) +# ---------------------------- +# Run the listed make rules, and check that the built binaries work. +m4_define([_LT_CHECK_EXECUTE], +[LT_AT_CHECK_EXECUTE([$1], + [./hell_static], [./hell]) +AT_CHECK([./helldl$EXEEXT | + $EGREP '(Welcome to .*GNU Hell|unsupported)'], 0, [ignore]) +]) + + +# _LT_CHECK_INSTALL +# ----------------- +# Run the make install rule, and check that installed binaries work too. +m4_define([_LT_CHECK_INSTALL], +[# Windows hosts search for dlls in the command path. +PATH=$prefixdir/lib:$PATH + +LT_AT_CHECK_EXECUTE([install], + [$prefixdir/bin/hell_static], [$prefixdir/bin/hell]) +AT_CHECK([$prefixdir/bin/helldl$EXEEXT | + $EGREP '(Welcome to .*GNU Hell|unsupported)'], 0, [ignore]) +]) + + +## ------------ ## +## Demo static. ## +## ------------ ## + +AT_SETUP([link against a preloaded static library]) + +_LT_DEMO_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 + + +## ------------ ## +## Demo shared. ## +## ------------ ## + +AT_SETUP([build and dynamically load a module]) + +_LT_DEMO_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 + + +## ---------- ## +## Demo conf. ## +## ---------- ## + +AT_SETUP([preload static and dynamic module]) + +_LT_DEMO_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 + + +## ------------ ## +## Demo deplib. ## +## ------------ ## + +# This is one of the essential tests for deplibs_check_method=pass_all. +# If this one passes with pass_all, it is likely that pass_all works. + +AT_SETUP([deplibs_check_method]) + +_LT_DEMO_SETUP + +AT_DATA([demo.mk], +[[EXTRA_LIBRARIES = libhell0.a +libhell0_a_SOURCES = +libhell0_a_LIBADD = hello.$(OBJEXT) foo.$(OBJEXT) +EXTRA_LTLIBRARIES = libhell1.la libhell2.la +libhell1_la_SOURCES = hell1.c +libhell1_la_LIBADD = -L. -lhell0 +libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir) +libhell1_la_DEPENDENCIES = libhell0.a +libhell2_la_SOURCES = hell2.c +libhell2_la_LIBADD = -L. -lhell0 +libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir) +libhell2_la_DEPENDENCIES = libhell0.a +EXTRA_PROGRAMS = hell0 +hell0_SOURCES = main.c +hell0_LDADD = libhell1.la libhell2.la $(LIBM) + +# 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we +# must explicitly list the wrapper script 'hell0'. (bin_PROGRAMS +# are handled seamlessly by automake rules; the extra step is only +# necessary for EXTRA_PROGRAMS) +CLEANFILES = $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0 + +deplibs-check: hell0$(EXEEXT) +]]) + +LT_AT_CHECK_CONFIG([--disable-static]) +LT_AT_MAKE([deplibs-check]) +LT_AT_EXEC_CHECK([./hell0], 0, [expout]) + +AT_CLEANUP + + +## ------------ ## +## Demo nofast. ## +## ------------ ## + +AT_SETUP([disable fast install]) + +_LT_DEMO_SETUP + +LT_AT_CHECK_CONFIG([--enable-fast-install=no]) +AT_CHECK([$EGREP '^hardcode_action=relink' libtool && (exit 77)], 1) + +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL +LT_AT_CHECK_UNINSTALL + +AT_CLEANUP + + +## --------- ## +## Demo pic. ## +## --------- ## + +AT_SETUP([force PIC objects]) + +_LT_DEMO_SETUP + +LT_AT_CHECK_CONFIG([--with-pic]) +_LT_CHECK_EXECUTE + +AT_CLEANUP + + +## ----------- ## +## Demo nopic. ## +## ----------- ## + +AT_SETUP([force non-PIC objects]) + +AT_CHECK([case $host in +hppa*|x86_64*|s390*) + # These hosts cannot use non-PIC shared libs + exit 77 ;; +*-solaris*|*-sunos*) + # Libtool does not build non-PIC shared libs on these hosts + exit 77 ;; +esac + +if test "X$build" = "X$host" && test -d "/etc/selinux"; then + _selinux=`getenforce 2>/dev/null || echo "Disabled"` + case $_selinux in + *Enforcing) + _sebool_allow_execmod=`getsebool allow_execmod 2>/dev/null` + case $_sebool_allow_execmod in + *off) + # SELinux policy disallows non-PIC + exit 77 + ;; + esac + ;; + esac +fi +]) + +_LT_DEMO_SETUP +LT_AT_CHECK_CONFIG([--with-pic=no]) +_LT_CHECK_EXECUTE + +AT_CLEANUP + + +## -------------- ## +## Demo hardcode. ## +## -------------- ## + +AT_SETUP([hardcoding library path]) + +_LT_DEMO_SETUP + +AT_DATA([demo.mk], +[[hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL +CLEANFILES = $(hardcode_tests) + +# Unfortunately, in order to test libtool thoroughly, we need access +# to its private directory. +objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'` + +# Test programs to see what gets hardcoded. +.PHONY: hardcode +hardcode: $(hardcode_tests) +SET_HARDCODE_FLAGS = \ + eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'` +hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la + @rm -f hc-direct + @echo "You may ignore any linking errors from the following command:" + @shlib=./$(objdir)/libhello.a; \ + eval "`grep '^library_names' libhello.la`"; \ + for lib in $$library_names; do \ + shlib="./$(objdir)/$$lib"; \ + done; \ + $(SET_HARDCODE_FLAGS); \ + libdir=$(libdir); \ + flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ + echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ + eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@" + +hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la + @$(SET_HARDCODE_FLAGS); \ + libdir=`pwd`/$(objdir); \ + flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ + if test -z "$$flag"; then \ + echo "echo unsupported > $@"; \ + echo unsupported > $@ || status="$$?"; \ + else \ + echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \ + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \ + fi; \ + exit $$status + +hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la + @rm -f hc-libpath + @echo "You may ignore any linking errors from the following command:" + @$(SET_HARDCODE_FLAGS); \ + eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \ + libdir=$(libdir); \ + flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ + echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ + eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@" + +hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES) + @rm -f hc-minusL + @$(SET_HARDCODE_FLAGS); \ + libdir=$(libdir); \ + flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ + echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ + eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@" +]]) + +LT_AT_CHECK_CONFIG([--disable-static]) +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL + +eval `$EGREP '^library_names=' libhello.la` +AT_CHECK([test -n "$library_names" || (exit 77)]) + +# Extra tools we may need +: ${DUMPSTABS="dumpstabs"} + +LT_AT_MAKE([hardcode]) + +eval "`$LIBTOOL --config | $EGREP '^hardcode_(direct|minus_L|shlibpath_var|libdir_flag_spec)='`" + +AT_CHECK([[exit_status=0 +for file in hc-*; do + case $file in + hc-direct) expected="$hardcode_direct" ;; + hc-libpath) expected="$hardcode_shlibpath_var" ;; + hc-minusL) expected="$hardcode_minus_L" ;; + + hc-libflag) + if test -n "$hardcode_libdir_flag_spec"; then + expected=yes + else + expected=unsupported + fi + ;; + + *) + continue + ;; + esac + + # Discover whether the objdir really was hardcoded. + hardcoded=no + + # Solaris cc may store the command line in a debugging section, + # which leads to false positives. Unfortunately, Solaris strip + # is not capable to remove the section (unlike GNU binutils strip). + # So we use dumpstabs if it seems to work. + if { $DUMPSTABS -d $file; } >/dev/null 2>&1; then + if $DUMPSTABS -d $file 2>/dev/null | $FGREP "$objdir" >/dev/null 2>&1; then + hardcoded=yes + else + hardcoded=no + fi + + # At least AIX fgrep doesn't work for binary files, and AIX also + # doesn't have strings(1), so we need this strange conversion + # (which only works on ASCII). + # AIX fgrep also has a limited line length, so we turn unprintable + # characters into newlines. + elif cat $file | (tr '\000-\037\200-\377' '\n' || cat) 2>/dev/null \ + | $FGREP "$objdir" > /dev/null 2>&1; then + hardcoded=yes + + elif $FGREP "$objdir" $file > /dev/null 2>&1; then + # We retry fgrep without tr, in case the above lead to a false negative. + hardcoded=yes + elif (sed -e '1!d' $file | grep 'unsupported') >/dev/null 2>&1; then + hardcoded=unsupported + fi + + # Check the result. + case $hardcoded in + yes) + if test yes = "$expected"; then + echo "$objdir was hardcoded in \`$file', as libtool expected" + else + echo "$objdir was hardcoded in \`$file', which fooled libtool" 1>&2 + exit_status=1 + fi + ;; + + no) + if test no = "$expected"; then + echo "$objdir was not hardcoded in \`$file', as libtool expected" + else + echo "$objdir was not hardcoded in \`$file', which fooled libtool" 1>&2 + exit_status=1 + fi + ;; + + unsupported) + if test unsupported = "$expected"; then + echo "\`$file' was not linked properly, as libtool expected" + else + echo "\`$file' was not linked properly, which fooled libtool" 1>&2 + exit_status=1 + fi + ;; + esac +done +]], 0, [ignore]) + +AT_CLEANUP + + +## ------------ ## +## Demo relink. ## +## ------------ ## + +AT_SETUP([binary relinking at install time]) +AT_KEYWORDS([interactive])dnl This test causes a popup on Windows + +_LT_DEMO_SETUP + +LT_AT_CHECK_CONFIG +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL + +# Check to make sure we have a dynamic library. +eval `$EGREP '^library_names=' libhello.la` +AT_CHECK([test -n "$library_names" || (exit 77)]) + +func_save_files +# AIX 5.3 `/bin/sh' will invoke the trap for 0 at the end of a +# function, so we set the trap outside of a function to be portable. +trap func_restore_files 0 1 2 13 15 + +eval "`$LIBTOOL --config | $EGREP '^shlibpath_overrides_runpath='`" +eval "`$LIBTOOL --config | $EGREP '^hardcode_(action|direct|into_libs)='`" + +# Allow the binary to link on-demand if need be. +./hell$EXEEXT >/dev/null || : + +# Remove libhello.la from build tree. +rm -f libhello.la "$objdir"/libhello.* + +# Either uninstalled ./hell will run using the just installed libraries +# when the uninstalled libs are missing, or relinking at install time +# is necessary, and the uninstalled ./hell has only the uninstalled +# library paths hardcoded. +AT_CHECK([./hell$EXEEXT >/dev/null || test relink,yes = "$hardcode_action,$hardcode_direct"]) + +# Link an incomplete libhello.la. +LT_AT_MAKE([libhello.la], [libhello_la_OBJECTS=hello.lo]) +AT_CHECK([test -f libhello.la]) + +# Try running uninstalled ./hell with only broken libhello.la in build tree. +# If the following has normal exit status, shlibpath_overrides_runpath is +# wrong, and should be set to `no' on this host. +# The unusual `|| (exit 1)' is to normalize all non-zero exit statuses. +LT_AT_CHECK([./hell || (exit 1)], 1, [ignore], [ignore]) + +test relink = "$hardcode_action" || +test yes = "$shlibpath_overrides_runpath" || +{ + AT_CHECK([rm -f $objdir/lt-hell$EXEEXT]) + AT_CHECK([cp $objdir/hell$EXEEXT $objdir/lt-hell$EXEEXT]) + + # Running demo/hell with installed libhello.la. + # If the following check fails, then shlibpath_overrides_runpath is + # wrong, and should be set to `yes' on this host. + LT_AT_CHECK([./hell], 0, [expout]) +} + +func_restore_files + +# Undo the effect of the previous 'trap' command. Some shellology: +# We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to +# execute the command "-". "trap '' ..." is fine only for signal 0 (= normal +# exit); for the others we need to call 'exit' explicitly. The value of $? is +# 128 + signal number and is set before the trap-registered command is run. +trap '' 0 +trap 'func_exit $?' 1 2 3 13 15 + +AT_CLEANUP + + +## ----------------- ## +## Demo noinst link. ## +## ----------------- ## + +AT_SETUP([uninstalled libraries have priority]) + +_LT_DEMO_SETUP + +LT_AT_CHECK_CONFIG +_LT_CHECK_EXECUTE +_LT_CHECK_INSTALL + +# Remove libhello.la and hell from build tree. +rm -f libhello.la "hell$EXEEXT" + +# If this check fails (i.e. the make succeeds), then the installed library +# was used, which is wrong. +AT_CHECK([$unset LIBTOOL LIBTOOLIZE; $MAKE hell$EXEEXT libhello_la_OBJECTS=hello.lo || (exit 1)], + [1], [ignore], [ignore]) + +AT_CLEANUP diff --git a/tests/demo/.gitignore b/tests/demo/.gitignore deleted file mode 100644 index 0e0f6fcd..00000000 --- a/tests/demo/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/hc-direct -/hc-libflag -/hc-libpath -/hc-minusL -/hell -/hell_static -/helldl diff --git a/tests/demo/Makefile.am b/tests/demo/Makefile.am deleted file mode 100644 index 3cf17c68..00000000 --- a/tests/demo/Makefile.am +++ /dev/null @@ -1,178 +0,0 @@ -## Makefile.am -- Process this file with automake to produce Makefile.in -## -## Copyright (C) 2003, 2004, 2005, 2010 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)/../.. - -# Build a libtool library, libhello.la for installation in libdir. -lib_LTLIBRARIES = libhello.la -libhello_la_SOURCES = hello.c foo.c -libhello_la_LIBADD = $(LIBM) -libhello_la_LDFLAGS = -no-undefined -version-info 3:12:1 -libhello_la_AM_CPPFLAGS = $(AM_CPPFLAGS) -DBUILDING_LIBHELLO - -include_HEADERS = foo.h - -if BINARY_HELLDL -BUILD_helldl = helldl -else -BUILD_helldl = -endif - -bin_PROGRAMS = hell hell_static $(BUILD_helldl) - -# Build hell from main.c and libhello.la -hell_SOURCES = main.c -hell_LDADD = libhello.la - -# Create a statically linked version of hell. -hell_static_SOURCES = main.c -hell_static_LDADD = libhello.la -hell_static_LDFLAGS = $(STATIC) - -if BINARY_HELLDL - -# Create a version of hell that does a preloaded dlopen. -helldl_SOURCES = dlmain.c -helldl_LDFLAGS = -export-dynamic -dlpreopen libhello.la -helldl_DEPENDENCIES = libhello.la - -else - -bin_SCRIPTS = helldl -# create a script that says that -dlopen is not supported -helldl helldl$(EXEEXT): - rm -f $@ - echo '#! /bin/sh' > $@ - echo '-dlopen is unsupported' >> $@ - chmod +x $@ -endif - -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status --recheck - -#---------------------------------------------------------------------- -# The following declarations are only used in the testsuite: -#---------------------------------------------------------------------- - -hardcode_tests = hc-direct hc-libflag hc-libpath hc-minusL -CLEANFILES = $(hardcode_tests) - -# Unfortunately, in order to test libtool thoroughly, we need access -# to its private directory. -objdir = `$(LIBTOOL) --config | sed -n -e 's/^objdir=\(.*\)$$/\1/p'` - -# The following rules are only for the libtool demo and tests. -# Regenerate our acinclude.m4 only if it doesn't exist. -$(srcdir)/acinclude.m4: - rm -f $(srcdir)/acinclude.m4 - cd $(srcdir) && $(LN_S) ../libtool.m4 acinclude.m4 - - -# Test programs to see what gets hardcoded. -.PHONY: hardcode -hardcode: $(hardcode_tests) -SET_HARDCODE_FLAGS = \ - eval `$(LIBTOOL) --config | sed -n -e '/^hardcode_.*=/p; /^wl=/p'` -hc-direct: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la - @rm -f hc-direct - @echo "You may ignore any linking errors from the following command:" - @shlib=./$(objdir)/libhello.a; \ - eval "`grep '^library_names' libhello.la`"; \ - for lib in $$library_names; do \ - shlib="./$(objdir)/$$lib"; \ - done; \ - $(SET_HARDCODE_FLAGS); \ - libdir=$(libdir); \ - flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ - echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ - eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$shlib $(LIBS) $(LIBM) $$flag || echo unsupported > $@" - -hc-libflag: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la - @$(SET_HARDCODE_FLAGS); \ - libdir=`pwd`/$(objdir); \ - flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ - if test -z "$$flag"; then \ - echo "echo unsupported > $@"; \ - echo unsupported > $@ || status="$$?"; \ - else \ - echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM)"; \ - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) $$flag -L$(libdir) -lhello $(LIBS) $(LIBM) || status="$$?"; \ - fi; \ - exit $$status - -hc-libpath: $(hell_OBJECTS) $(hell_DEPENDENCIES) $(libdir)/libhello.la - @rm -f hc-libpath - @echo "You may ignore any linking errors from the following command:" - @$(SET_HARDCODE_FLAGS); \ - eval `$(LIBTOOL) --config | grep '^shlibpath_var='`; \ - libdir=$(libdir); \ - flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ - echo "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ - eval "$$shlibpath_var=./$(objdir) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@" - -hc-minusL: $(hell_OBJECTS) $(hell_DEPENDENCIES) - @rm -f hc-minusL - @$(SET_HARDCODE_FLAGS); \ - libdir=$(libdir); \ - flag=`eval echo \"$$hardcode_libdir_flag_spec\"`; \ - echo "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@"; \ - eval "$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(hell_OBJECTS) -L./$(objdir) -lhello $(LIBS) $(LIBM) $$flag || echo unsupported > $@" - -# This is one of the essential tests for deplibs_check_method=pass_all. -# If this one passes with pass_all, it is likely that pass_all works -EXTRA_LIBRARIES = libhell0.a -libhell0_a_SOURCES = -libhell0_a_LIBADD = hello.$(OBJEXT) foo.$(OBJEXT) -EXTRA_LTLIBRARIES = libhell1.la libhell2.la -libhell1_la_SOURCES = hell1.c -libhell1_la_LIBADD = -L. -lhell0 -libhell1_la_LDFLAGS = -no-undefined -rpath $(libdir) -libhell1_la_DEPENDENCIES = libhell0.a -libhell2_la_SOURCES = hell2.c -libhell2_la_LIBADD = -L. -lhell0 -libhell2_la_LDFLAGS = -no-undefined -rpath $(libdir) -libhell2_la_DEPENDENCIES = libhell0.a -EXTRA_PROGRAMS = hell0 -hell0_SOURCES = main.c -hell0_LDADD = libhell1.la libhell2.la $(LIBM) - -# 'hell0' in EXTRA_PROGRAMS gets translated to 'hell0.exe'; but we -# must explicitly list the wrapper script 'hell0'. (bin_PROGRAMS -# are handled seamlessly by automake rules; the extra step is only -# necessary for EXTRA_PROGRAMS) -CLEANFILES += $(EXTRA_LIBRARIES) $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) hell0 - -deplibs-check: hell0$(EXEEXT) - -# 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/demo/README b/tests/demo/README deleted file mode 100644 index 511fd839..00000000 --- a/tests/demo/README +++ /dev/null @@ -1,9 +0,0 @@ -This is GNU hell, an example package that uses GNU libtool with an -Automake-generated environment to build a simple library and program. - -Admittedly, it would be better if this was a more realistic example, -say, a program that actually did something useful, but we can't have -everything. - -Send bug reports and comments about GNU hell to the libtool mailing -list <bug-libtool@gnu.org>. diff --git a/tests/demo/configure.ac b/tests/demo/configure.ac deleted file mode 100644 index 27a0da56..00000000 --- a/tests/demo/configure.ac +++ /dev/null @@ -1,73 +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([demo], [1.0], [bug-libtool@gnu.org]) -AC_CONFIG_SRCDIR([hello.c]) -AC_CONFIG_AUX_DIR([../../build-aux]) - - -## ------------------------ ## -## Automake Initialisation. ## -## ------------------------ ## -AM_INIT_AUTOMAKE - - -## ---------------- ## -## compiler checks. ## -## ---------------- ## -AC_PROG_CC - - -## ----------------------- ## -## Libtool initialisation. ## -## ----------------------- ## -LT_INIT([dlopen win32-dll]) -AC_SUBST([LIBTOOL_DEPS]) - -STATIC= -test yes = "$enable_static" && STATIC=-static -AC_SUBST([STATIC]) - -case $lt_cv_sys_global_symbol_pipe in - ?*) binary_helldl=yes ;; -esac -AM_CONDITIONAL([BINARY_HELLDL], [test yes = "$binary_helldl"]) - - -## --------------------------- ## -## Libraries required by demo. ## -## --------------------------- ## -LT_LIB_M - - -## -------- ## -## Outputs. ## -## -------- ## -AC_CONFIG_FILES([Makefile]) -AC_OUTPUT diff --git a/tests/demo/dlmain.c b/tests/demo/dlmain.c deleted file mode 100644 index 495ae7cb..00000000 --- a/tests/demo/dlmain.c +++ /dev/null @@ -1,97 +0,0 @@ -/* dlmain.c -- hello test program that uses simulated dynamic linking - - Copyright (C) 1996-1999, 2004, 2006, 2007, 2010 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. -*/ - -#include "foo.h" -#include <stdio.h> -#include <string.h> - -#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols - -typedef struct -{ - const char *name; - lt_ptr_t address; -} lt_dlsymlist; - -extern LT_DLSYM_CONST lt_dlsymlist lt_preloaded_symbols[]; - -int -main () -{ - const lt_dlsymlist *s; - int (*pfoo)() = 0; - int (*phello)() = 0; - int *pnothing = 0; - - printf ("Welcome to *modular* GNU Hell!\n"); - - /* Look up the symbols we require for this demonstration. */ - s = lt_preloaded_symbols; - while (s->name) - { - if (s->address) { - const char *name = s->name; - printf ("found symbol: %s\n", name); - if (!strcmp ("hello", name)) - phello = (int(*)())s->address; - else if (!strcmp ("foo", name)) - pfoo = (int(*)())s->address; - else if (!strcmp ("nothing", name)) -#ifndef _WIN32 - /* In an ideal world we could do this... */ - pnothing = (int*)s->address; -#else /* !_WIN32 */ - /* In an ideal world a shared lib would be able to export data */ - pnothing = (int*)¬hing; -#endif - } else - printf ("found file: %s\n", s->name); - s ++; - } - - /* Try assigning to the nothing variable. */ - if (pnothing) - *pnothing = 1; - else - fprintf (stderr, "did not find the `nothing' variable\n"); - - /* Just call the functions and check return values. */ - if (pfoo) - { - if ((*pfoo) () != FOO_RET) - return 1; - } - else - fprintf (stderr, "did not find the `foo' function\n"); - - if (phello) - { - if ((*phello) () != HELLO_RET) - return 3; - } - else - fprintf (stderr, "did not find the `hello' function\n"); - - return 0; -} diff --git a/tests/demo/foo.c b/tests/demo/foo.c deleted file mode 100644 index 4f32f3c3..00000000 --- a/tests/demo/foo.c +++ /dev/null @@ -1,38 +0,0 @@ -/* foo.c -- trivial test function for libfoo - - Copyright (C) 1996-1999, 2007 Free Software Foundation, Inc. - Written by Gordon Matzigkeit, 1996 - - 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> - -/* Give a global variable definition. */ -int nothing = FOO_RET; - -int -foo () -{ - printf ("cos (0.0) = %g\n", (double) cos ((double) 0.0)); - return FOO_RET; -} diff --git a/tests/demo/foo.h b/tests/demo/foo.h deleted file mode 100644 index 9ee7f2ec..00000000 --- a/tests/demo/foo.h +++ /dev/null @@ -1,102 +0,0 @@ -/* foo.h -- interface to the libfoo library - - Copyright (C) 1996-1999, 2010 Free Software Foundation, Inc. - Written by Gord Matzigkeit, 1996 - - 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 - -/* At some point, cygwin will stop defining __CYGWIN32__, but b19 and - * earlier do not define __CYGWIN__. This snippet allows us to check - * for __CYGWIN__ reliably for both current, old, and (probable) future - * releases. - */ -#ifdef __CYGWIN32__ -# ifndef __CYGWIN__ -# define __CYGWIN__ -# endif -#endif - -#if (defined _WIN32 || defined _WIN32_WCE) && !defined __GNUC__ -# ifdef BUILDING_LIBHELLO -# ifdef DLL_EXPORT -# define LIBHELLO_SCOPE extern __declspec (dllexport) -# endif -# else -# define LIBHELLO_SCOPE extern __declspec (dllimport) -# endif -#endif -#ifndef LIBHELLO_SCOPE -# define LIBHELLO_SCOPE extern -#endif - -/* __BEGIN_DECLS should be used at the beginning of your declarations, - so that C++ compilers don't mangle their names. Use __END_DECLS at - the end of C declarations. */ -#undef __BEGIN_DECLS -#undef __END_DECLS -#ifdef __cplusplus -# define __BEGIN_DECLS extern "C" { -# define __END_DECLS } -#else -# define __BEGIN_DECLS /* empty */ -# define __END_DECLS /* empty */ -#endif - -/* LTDL_PARAMS is a macro used to wrap function prototypes, so that compilers - that don't understand ANSI C prototypes still work, and ANSI C - compilers can issue warnings about type mismatches. */ -#undef LTDL_PARAMS -#if defined __STDC__ || defined _AIX || (defined __mips && defined _SYSTYPE_SVR4) || defined __CYGWIN__ || defined __cplusplus -# define LT_PARAMS(protos) protos -# define lt_ptr_t void* -#else -# define LT_PARAMS(protos) () -# define lt_ptr_t char* -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined __osf__ -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* Silly constants that the functions return. */ -#define HELLO_RET 0xe110 -#define FOO_RET 0xf00 - - -/* Declarations. Note the wonderful use of the above macros. */ -__BEGIN_DECLS -int foo LT_PARAMS((void)); -int hello LT_PARAMS((void)); -LIBHELLO_SCOPE int nothing; -__END_DECLS - -#endif /* !_FOO_H_ */ diff --git a/tests/demo/hell1.c b/tests/demo/hell1.c deleted file mode 100644 index 3e656172..00000000 --- a/tests/demo/hell1.c +++ /dev/null @@ -1,25 +0,0 @@ -/* hell1.c -- hello test program that uses simulated dynamic linking - - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Gord Matzigkeit, 1996 - - 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. -*/ - -int hell1() { return 1; } diff --git a/tests/demo/hell2.c b/tests/demo/hell2.c deleted file mode 100644 index 91a75488..00000000 --- a/tests/demo/hell2.c +++ /dev/null @@ -1,25 +0,0 @@ -/* hell2.c -- hello test program that uses simulated dynamic linking - - Copyright (C) 1996 Free Software Foundation, Inc. - Written by Gord Matzigkeit, 1996 - - 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. -*/ - -int hell2() { return 2; } diff --git a/tests/demo/hello.c b/tests/demo/hello.c deleted file mode 100644 index fc08c1ac..00000000 --- a/tests/demo/hello.c +++ /dev/null @@ -1,34 +0,0 @@ -/* hello.c -- trivial test function for libfoo - - Copyright (C) 1996-1999 Free Software Foundation, Inc. - Written by Gord Matzigkeit, 1996 - - 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> - -int -hello () -{ - printf ("** This is not GNU Hello. There is no built-in mail reader. **\n"); - return HELLO_RET; -} diff --git a/tests/demo/main.c b/tests/demo/main.c deleted file mode 100644 index eaa0c606..00000000 --- a/tests/demo/main.c +++ /dev/null @@ -1,44 +0,0 @@ -/* main.c -- trivial hello test program - - Copyright (C) 1996-1999, 2006 Free Software Foundation, Inc. - Written by Gord Matzigkeit, 1996 - - 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> - -int -main () -{ - printf ("Welcome to GNU Hell!\n"); - - /* Try assigning to the nothing variable */ - nothing = 1; - - /* Just call the functions and check return values. */ - if (foo () != FOO_RET) - return 1; - - if (hello () != HELLO_RET) - return 2; - - return 0; -} diff --git a/tests/testsuite.at b/tests/testsuite.at index b8aeb135..19713028 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -36,6 +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 '^(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 @@ -224,6 +225,31 @@ m4_define([LT_AT_CHECK_CONFIG_], ]) +# LT_AT_CHECK_EXECUTE([TARGETS], [PROGRAM], ...) +# ---------------------------------------------- +# Run the listed make rules, and check that the following PROGRAMs work. +m4_define([LT_AT_CHECK_EXECUTE], +[LT_AT_MAKE([$1]) +m4_if([$#], 0, [], + [$#], 1, [], [$0_(m4_shift($@))]) +]) +m4_define([LT_AT_CHECK_EXECUTE_], +[LT_AT_EXEC_CHECK([$1], 0, [expout]) +m4_if([$#], 1, [], [$0(m4_shift($@))]) +]) + + +# LT_AT_CHECK_UNINSTALL +# --------------------- +# Make sure uninstallation is complete. +m4_define([LT_AT_CHECK_UNINSTALL], +[LT_AT_MAKE([uninstall]) + +leftovers=`find $prefixdir ! -type d ! -name '.*' -print` +AT_CHECK([test -z "$leftovers"]) +]) + + # LT_AT_HOST_DATA(FILE, CONTENTS) # ------------------------------- # Ensure correct line ending for expected output of host executables. |