2007-05-09 16:10:19 +08:00
|
|
|
# lt_dladvise.at -- test libltdl functionality -*- Autotest -*-
|
|
|
|
#
|
maint: update copyright notices to include 2013.
* gnulib/: Update to latest upstream.
* AUTHORS, ChangeLog.old, HACKING, Makefile.am, NEWS, README,
THANKS, TODO, bootstrap, bootstrap.conf,
build-aux/edit-readme-alpha, build-aux/ltmain.in, cfg.mk,
configure.ac, doc/libtool.texi, gl/build-aux/bootstrap.in,
gl/build-aux/extract-trace, gl/build-aux/funclib.sh,
gl/build-aux/inline-source, gl/build-aux/options-parser,
libltdl/README, libltdl/argz.c, libltdl/argz_.h,
libltdl/configure.ac, libltdl/libltdl/lt__alloc.h,
libltdl/libltdl/lt__dirent.h, libltdl/libltdl/lt__glibc.h,
libltdl/libltdl/lt__private.h, libltdl/libltdl/lt__strl.h,
libltdl/libltdl/lt_dlloader.h, libltdl/libltdl/lt_error.h,
libltdl/libltdl/lt_system.h, libltdl/libltdl/slist.h,
libltdl/loaders/dld_link.c, libltdl/loaders/dlopen.c,
libltdl/loaders/dyld.c, libltdl/loaders/load_add_on.c,
libltdl/loaders/loadlibrary.c, libltdl/loaders/preopen.c,
libltdl/loaders/shl_load.c, libltdl/lt__alloc.c,
libltdl/lt__dirent.c, libltdl/lt__strl.c, libltdl/lt_dlloader.c,
libltdl/lt_error.c, libltdl/ltdl.c, libltdl/ltdl.h,
libltdl/ltdl.mk, libltdl/slist.c, libtoolize.in, m4/argz.m4,
m4/autobuild.m4, m4/libtool.m4, m4/ltdl.m4, m4/ltoptions.m4,
m4/ltsugar.m4, m4/ltversion.in, m4/lt~obsolete.m4,
tests/am-subdir.at, tests/archive-in-archive.at,
tests/bindir.at, tests/cdemo.at, tests/cmdline_wrap.at,
tests/configure-iface.at, tests/convenience.at, tests/ctor.at,
tests/cwrapper.at, tests/darwin.at, tests/demo.at,
tests/depdemo.at, tests/deplib-in-subdir.at,
tests/deplibs-ident.at, tests/deplibs-mingw.at,
tests/destdir.at, tests/dlloader-api.at,
tests/dumpbin-symbols.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/early-libtool.at, tests/exceptions.at,
tests/execute-mode.at, tests/exeext.at, tests/export.at,
tests/f77demo.at, tests/fail.at, tests/fcdemo.at,
tests/flags.at, tests/help.at, tests/indirect_deps.at,
tests/infer-tag.at, tests/inherited_flags.at, tests/install.at,
tests/lalib-syntax.at, tests/libtool.at, tests/libtoolize.at,
tests/link-order.at, tests/link-order2.at, tests/loadlibrary.at,
tests/localization.at, tests/lt_dladvise.at, tests/lt_dlexit.at,
tests/lt_dlopen.at, tests/lt_dlopen_a.at, tests/lt_dlopenext.at,
tests/ltdl-api.at, tests/ltdl-libdir.at, tests/mdemo.at,
tests/need_lib_prefix.at, tests/no-executables.at,
tests/nocase.at, tests/nonrecursive.at, tests/old-ltdl-iface.at,
tests/old-m4-iface.at, tests/pic_flag.at, tests/recursive.at,
tests/resident.at, tests/runpath-in-lalib.at,
tests/search-path.at, tests/shlibpath.at, tests/slist.at,
tests/standalone.at, tests/static.at, tests/stresstest.at,
tests/subproject.at, tests/sysroot.at, tests/tagdemo.at,
tests/template.at, tests/testsuite.at, tests/versioning.at,
tests/with-pic.at: Bump copyright year.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2013-01-02 01:17:24 +08:00
|
|
|
# Copyright (C) 2007-2009, 2011-2013 Free Software Foundation, Inc.
|
2007-05-09 16:10:19 +08:00
|
|
|
# Written by Gary V. Vaughan, 2007
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
####
|
|
|
|
|
|
|
|
# Try to keep the new interfaces of HEAD separate from those of
|
|
|
|
# branch-1-5 to facilitate testing of older releases.
|
|
|
|
|
|
|
|
AT_SETUP([lt_dlopenadvise library loading])
|
|
|
|
AT_KEYWORDS([libltdl])
|
|
|
|
|
|
|
|
AT_DATA([main.c],
|
|
|
|
[[#include <ltdl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
typedef int funcp (int);
|
|
|
|
|
|
|
|
static int errors = 0;
|
|
|
|
|
|
|
|
static void
|
|
|
|
complain (const char *msg)
|
|
|
|
{
|
|
|
|
const char *errmsg = lt_dlerror ();
|
|
|
|
fprintf (stderr, "%s", msg);
|
|
|
|
if (errmsg)
|
|
|
|
fprintf (stderr, ": %s\n", errmsg);
|
|
|
|
else
|
|
|
|
fprintf (stderr, ".\n");
|
|
|
|
++errors;
|
|
|
|
}
|
|
|
|
|
|
|
|
static lt_dlhandle
|
|
|
|
moduleopen (const char *filename, lt_dladvise advise)
|
|
|
|
{
|
|
|
|
lt_dlhandle handle;
|
|
|
|
|
|
|
|
handle = lt_dlopenadvise (filename, advise);
|
|
|
|
if (!handle)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "can't open the module %s!\n", filename);
|
|
|
|
complain ("error was");
|
|
|
|
}
|
|
|
|
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
moduletest (lt_dlhandle handle, const char *fname, const char *vname)
|
|
|
|
{
|
|
|
|
funcp *f = (funcp *) lt_dlsym (handle, fname);
|
|
|
|
int *v = (int *) lt_dlsym (handle, vname);
|
|
|
|
|
|
|
|
if (!f)
|
|
|
|
{
|
syntax-check: fix violations and implement sc_old_style_quoting.
Modern GNU ASCII quoting in output and comments is done
'like this'.
* cfg.mk (sc_old_style_quoting): Try to catch most instances
of `old style quoting' so that it is not accidentally re-
introduced to the code.
* HACKING, Makefile.am, NEWS, PORTING, README, TODO, bootstrap,
bootstrap.conf, build-aux/edit-readme-alpha,
build-aux/git-hooks/commit-msg, build-aux/ltmain.in,
doc/libtool.texi, gl/build-aux/bootstrap.in,
gl/build-aux/extract-trace, gl/build-aux/funclib.sh,
gl/build-aux/inline-source, gl/build-aux/options-parser,
libltdl/libltdl/slist.h, libltdl/loaders/loadlibrary.c,
libltdl/ltdl.c, libltdl/slist.c, libtoolize.in, m4/argz.m4,
m4/libtool.m4, m4/ltdl.m4, m4/ltoptions.m4, m4/ltsugar.m4,
tests/cmdline_wrap.at, tests/configure-iface.at, tests/demo.at,
tests/depdemo.at, tests/deplib-in-subdir.at,
tests/deplibs-mingw.at, tests/destdir.at, tests/execute-mode.at,
tests/f77demo.at, tests/fail.at, tests/inherited_flags.at,
tests/libtool.at, tests/libtoolize.at, tests/lt_dladvise.at,
tests/lt_dlexit.at, tests/mdemo.at, tests/need_lib_prefix.at,
tests/old-ltdl-iface.at, tests/old-m4-iface.at, tests/static.at,
tests/stresstest.at, tests/testsuite.at, tests/versioning.at:
Convert to upright quotes.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2012-10-22 00:41:07 +08:00
|
|
|
fprintf (stderr, "function '%s' not found\n", fname);
|
2007-05-09 16:10:19 +08:00
|
|
|
++errors;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
if (!v)
|
|
|
|
{
|
syntax-check: fix violations and implement sc_old_style_quoting.
Modern GNU ASCII quoting in output and comments is done
'like this'.
* cfg.mk (sc_old_style_quoting): Try to catch most instances
of `old style quoting' so that it is not accidentally re-
introduced to the code.
* HACKING, Makefile.am, NEWS, PORTING, README, TODO, bootstrap,
bootstrap.conf, build-aux/edit-readme-alpha,
build-aux/git-hooks/commit-msg, build-aux/ltmain.in,
doc/libtool.texi, gl/build-aux/bootstrap.in,
gl/build-aux/extract-trace, gl/build-aux/funclib.sh,
gl/build-aux/inline-source, gl/build-aux/options-parser,
libltdl/libltdl/slist.h, libltdl/loaders/loadlibrary.c,
libltdl/ltdl.c, libltdl/slist.c, libtoolize.in, m4/argz.m4,
m4/libtool.m4, m4/ltdl.m4, m4/ltoptions.m4, m4/ltsugar.m4,
tests/cmdline_wrap.at, tests/configure-iface.at, tests/demo.at,
tests/depdemo.at, tests/deplib-in-subdir.at,
tests/deplibs-mingw.at, tests/destdir.at, tests/execute-mode.at,
tests/f77demo.at, tests/fail.at, tests/inherited_flags.at,
tests/libtool.at, tests/libtoolize.at, tests/lt_dladvise.at,
tests/lt_dlexit.at, tests/mdemo.at, tests/need_lib_prefix.at,
tests/old-ltdl-iface.at, tests/old-m4-iface.at, tests/static.at,
tests/stresstest.at, tests/testsuite.at, tests/versioning.at:
Convert to upright quotes.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2012-10-22 00:41:07 +08:00
|
|
|
fprintf (stderr, "variable '%s' not found\n", vname);
|
2007-05-09 16:10:19 +08:00
|
|
|
++errors;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return f (*v);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
hint_ext (void)
|
|
|
|
{
|
|
|
|
lt_dlhandle handle;
|
|
|
|
lt_dladvise advise;
|
|
|
|
|
|
|
|
if (lt_dladvise_init (&advise) || lt_dladvise_ext (&advise))
|
|
|
|
complain ("error setting advise ext");
|
|
|
|
|
2007-05-22 20:07:06 +08:00
|
|
|
handle = moduleopen ("libdepend", advise);
|
2007-05-09 16:10:19 +08:00
|
|
|
|
|
|
|
if (handle)
|
|
|
|
printf ("depend: %d\n", moduletest (handle, "g", "j"));
|
|
|
|
|
|
|
|
lt_dladvise_destroy (&advise);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
hint_resident (void)
|
|
|
|
{
|
|
|
|
const lt_dlinfo *info;
|
|
|
|
lt_dlhandle handle;
|
|
|
|
lt_dladvise advise;
|
|
|
|
|
|
|
|
if (lt_dladvise_init (&advise) || lt_dladvise_resident (&advise))
|
|
|
|
complain ("error setting advise resident");
|
|
|
|
|
2007-05-22 20:07:06 +08:00
|
|
|
handle = moduleopen ("libresident.la", advise);
|
2007-05-09 16:10:19 +08:00
|
|
|
|
|
|
|
if (handle)
|
|
|
|
{
|
|
|
|
info = lt_dlgetinfo (handle);
|
|
|
|
if (!info->is_resident)
|
|
|
|
complain ("error taking advise resident");
|
|
|
|
|
|
|
|
/* cannot close resident modules */
|
|
|
|
if (lt_dlclose (handle) == 0)
|
|
|
|
complain ("successfully unloaded resident module");
|
|
|
|
|
|
|
|
printf ("resident: %d\n", moduletest (handle, "func", "numb"));
|
|
|
|
}
|
|
|
|
|
|
|
|
lt_dladvise_destroy (&advise);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
hint_local (void)
|
|
|
|
{
|
|
|
|
const lt_dlinfo *info;
|
|
|
|
lt_dlhandle handle;
|
|
|
|
lt_dladvise advise;
|
|
|
|
|
|
|
|
if (lt_dladvise_init (&advise) || lt_dladvise_local (&advise))
|
|
|
|
complain ("error setting advise local");
|
|
|
|
|
2007-05-22 20:07:06 +08:00
|
|
|
handle = moduleopen ("liblocal.la", advise);
|
2007-05-09 16:10:19 +08:00
|
|
|
|
|
|
|
if (handle)
|
|
|
|
{
|
|
|
|
info = lt_dlgetinfo (handle);
|
|
|
|
printf ("local: %d\n", moduletest (handle, "f", "i"));
|
|
|
|
|
|
|
|
/* If the symlocal hint was taken, don't unload this module
|
|
|
|
and test that our local symbolnames won't clash with modglobal. */
|
|
|
|
if (!info->is_symlocal && lt_dlclose (handle))
|
|
|
|
complain ("error unloading modlocal");
|
|
|
|
}
|
|
|
|
|
|
|
|
lt_dladvise_destroy (&advise);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
hint_global (void)
|
|
|
|
{
|
|
|
|
const lt_dlinfo *info;
|
|
|
|
lt_dlhandle handle;
|
|
|
|
lt_dladvise advise;
|
|
|
|
|
|
|
|
if (lt_dladvise_init (&advise) || lt_dladvise_global (&advise))
|
|
|
|
complain ("error setting advise global");
|
|
|
|
|
2007-05-22 20:07:06 +08:00
|
|
|
handle = moduleopen ("libglobal.la", advise);
|
2007-05-09 16:10:19 +08:00
|
|
|
|
|
|
|
if (handle)
|
|
|
|
{
|
|
|
|
info = lt_dlgetinfo (handle);
|
|
|
|
printf ("global: %d\n", moduletest (handle, "f", "i"));
|
|
|
|
|
|
|
|
/* Don't attempt to load moddepend unless modglobal was successfully
|
2008-03-09 02:02:39 +08:00
|
|
|
loaded and the symglobal hint was taken, and the system allows to
|
syntax-check: fix violations and re-enable sc_space_tab.
* cfg.mk (local-checks-to-fix): Remove sc_space_tab from list of
disabled checks.
(exclude_file_name_regexp--sc_space_tab): Don't flag space-tab
sequences in diff files as an error.
* Makefile.am, build-aux/general.m4sh, build-aux/git-hooks/commit-msg,
build-aux/ltmain.m4sh, libltdl/loaders/dyld.c,
libltdl/loaders/shl_load.c, libltdl/ltdl.h, libltdl/ltdl.mk,
libltdl/slist.c, libtoolize.m4sh, m4/ltoptions.m4, tests/demo/dlmain.c,
tests/depdemo/main.c, tests/libtoolize.at, tests/lt_dladvise.at,
tests/pdemo/longer_file_name_dlmain.c, tests/sh.test, tests/static.at,
tests/stresstest.at, tests/template.at: Fix space-tab sequences by
reversing them in regexps, and deleting leading spaces in indentation.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-10-25 10:34:11 +08:00
|
|
|
have undefined symbols. */
|
2008-03-09 02:02:39 +08:00
|
|
|
if (info && info->is_symglobal && HAVE_UNDEFINED_SYMBOLS)
|
2007-05-09 16:10:19 +08:00
|
|
|
{
|
|
|
|
hint_ext ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Fake the output so the test won't fail when using a dlloader
|
|
|
|
unable to take symglobal hints. */
|
|
|
|
printf ("depend: 5\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lt_dladvise_destroy (&advise);
|
|
|
|
}
|
|
|
|
|
2008-08-01 14:12:29 +08:00
|
|
|
void
|
|
|
|
hint_preload (void)
|
|
|
|
{
|
|
|
|
lt_dlhandle handle;
|
|
|
|
lt_dladvise advise;
|
|
|
|
|
|
|
|
if (lt_dladvise_init (&advise) || lt_dladvise_preload (&advise))
|
|
|
|
complain ("error setting advise preload");
|
|
|
|
|
|
|
|
handle = moduleopen ("libpreload.la", advise);
|
|
|
|
|
|
|
|
if (handle)
|
|
|
|
{
|
|
|
|
printf("preload: %d\n", moduletest (handle, "h", "k"));
|
|
|
|
}
|
|
|
|
|
|
|
|
lt_dladvise_destroy (&advise);
|
|
|
|
}
|
|
|
|
|
2007-05-09 16:10:19 +08:00
|
|
|
int
|
2008-01-12 22:07:02 +08:00
|
|
|
main (void)
|
2007-05-09 16:10:19 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
LTDL_SET_PRELOADED_SYMBOLS();
|
|
|
|
|
|
|
|
if (lt_dlinit() != 0)
|
|
|
|
{
|
|
|
|
fprintf (stderr, "error during initialization: %s\n", lt_dlerror());
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
hint_resident ();
|
|
|
|
hint_local ();
|
2010-06-14 11:26:48 +08:00
|
|
|
#ifdef HAVE_SHARED
|
2007-05-09 16:10:19 +08:00
|
|
|
hint_global ();
|
2010-06-14 11:26:48 +08:00
|
|
|
#else
|
|
|
|
/* This ugly hack is because we have symbols with the same name in both the
|
|
|
|
global module and the local one, we can't lt_dlopen the local module
|
|
|
|
locally and then later load the global module globally because of this.
|
|
|
|
Instead of skipping the test entirely, we test what we can and
|
|
|
|
have this hack. */
|
|
|
|
printf ("global: 4\n");
|
|
|
|
printf ("depend: 5\n");
|
|
|
|
#endif
|
2008-08-01 14:12:29 +08:00
|
|
|
hint_preload ();
|
2007-05-09 16:10:19 +08:00
|
|
|
|
|
|
|
if (lt_dlexit () != 0)
|
|
|
|
complain ("error during exit");
|
|
|
|
|
|
|
|
return (errors != 0);
|
|
|
|
}
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([modresident.c],
|
|
|
|
[[#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
int func (int x) { return x / 3; }
|
|
|
|
int numb = 7;
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([modlocal.c],
|
|
|
|
[[#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
int f (int x) { return (x * x) / 10; }
|
|
|
|
int i = 6;
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([modglobal.c],
|
|
|
|
[[#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
int f (int x) { return x - 1; }
|
|
|
|
int i = 5;
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
|
|
|
|
AT_DATA([moddepend.c],
|
|
|
|
[[#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
extern int f (int), i;
|
|
|
|
int g (int x) { return f (i) + x - 3; }
|
|
|
|
int j = 4;
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
|
2008-08-01 14:12:29 +08:00
|
|
|
AT_DATA([modpreload.c],
|
|
|
|
[[#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
int h (int x) { return 2 * x; }
|
|
|
|
int k = 3;
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
]])
|
|
|
|
|
2008-11-24 05:58:06 +08:00
|
|
|
LT_AT_HOST_DATA([expout],
|
2007-05-09 16:10:19 +08:00
|
|
|
[[resident: 2
|
|
|
|
local: 3
|
|
|
|
global: 4
|
|
|
|
depend: 5
|
2008-08-01 14:12:29 +08:00
|
|
|
preload: 6
|
2007-05-09 16:10:19 +08:00
|
|
|
]])
|
|
|
|
|
|
|
|
: ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
|
|
|
|
: ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
|
|
|
|
|
2008-03-02 06:43:04 +08:00
|
|
|
# Skip this test when called from:
|
|
|
|
# make distcheck DISTCHECK_CONFIGURE_FLAGS=--disable-ltdl-install
|
|
|
|
AT_CHECK([case $LIBLTDL in #(
|
tests: migrate tests/sh.test checks to syntax-checks.
Some modernization of the legacy testsuite.
* tests/sh.test: Remove.
* Makefile.am (COMMON_TESTS): Adjust.
* cfg.mk (sc_libtool_m4_cc_basename, sc_prohibit_bracket_as_test)
(sc_prohibit_nested_quotes, sc_prohibit_set_dummy_without_shift)
(sc_prohibit_set_minus_minus, sc_prohibit_test_binary_operators)
(sc_prohibit_test_dollar, sc_prohibit_test_minus_e)
(sc_prohibit_test_unary_operators, sc_prohibit_test_X)
(sc_prohibit_Xsed_withou_X, sc_require_function_nl_brace):
Functionally identical tests to what used to be performed by
sh.test, only with coverage of all files.
* bootstrap, build-aux/edit-readme-alpha,
build-aux/extract-trace, build-aux/getopt.m4sh,
build-aux/ltmain.m4sh, configure.ac, m4/libtool.m4, m4/ltdl.m4,
tests/bindir.at, tests/configure-iface.at, tests/cwrapper.at,
tests/darwin.at, tests/defs.m4sh, tests/demo-hardcode.test,
tests/dlloader-api.at, tests/exceptions.at,
tests/getopt-m4sh.at, tests/lalib-syntax.at, tests/link-2.test,
tests/link-order2.at, tests/loadlibrary.at,
tests/lt_dladvise.at, tests/lt_dlexit.at, tests/lt_dlopen_a.at,
tests/lt_dlopenext.at, tests/need_lib_prefix.at,
tests/nonrecursive.at, tests/recursive.at, tests/resident.at,
tests/standalone.at, tests/static.at, tests/stresstest.at,
tests/subproject.at, tests/sysroot.at, tests/tagtrace.test,
tests/testsuite.at: Fix violations of the new syntax checks.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-17 00:21:18 +08:00
|
|
|
*/_inst/lib/*) test -f "$LIBLTDL" || (exit 77) ;;
|
2008-03-02 06:43:04 +08:00
|
|
|
esac], [], [ignore])
|
|
|
|
|
2008-01-12 19:25:03 +08:00
|
|
|
CPPFLAGS="$LTDLINCL $CPPFLAGS"
|
2007-05-22 20:07:06 +08:00
|
|
|
|
|
|
|
dlopenable='resident local global'
|
2008-08-01 14:12:29 +08:00
|
|
|
dlpreloadable='preload'
|
2007-05-22 20:07:06 +08:00
|
|
|
|
|
|
|
# ------------------------------------------------------------------------- #
|
|
|
|
# The depend test makes no sense unless compiled without -no-undefined. By #
|
|
|
|
# not building the depend module in that case, when this test passes we can #
|
|
|
|
# be sure that hint_global() above, is being correctly informed those hosts #
|
|
|
|
# are reporting not able to accept the global hint to lt_dlopenadvise(). #
|
|
|
|
# ------------------------------------------------------------------------- #
|
|
|
|
|
2009-06-07 22:35:11 +08:00
|
|
|
have_shared=false
|
|
|
|
$LIBTOOL --features | grep 'enable shared libraries' >/dev/null && have_shared=:
|
|
|
|
|
|
|
|
case $host_os,$have_shared in
|
|
|
|
cygwin* | mingw* | cegcc* | *,false)
|
2007-05-22 20:07:06 +08:00
|
|
|
# These hosts do not support linking without -no-undefined
|
2008-03-09 02:02:39 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS -DHAVE_UNDEFINED_SYMBOLS=0"
|
2007-05-22 20:07:06 +08:00
|
|
|
;;
|
|
|
|
*)
|
2008-03-09 02:02:39 +08:00
|
|
|
CPPFLAGS="$CPPFLAGS -DHAVE_UNDEFINED_SYMBOLS=1"
|
2007-05-22 20:07:06 +08:00
|
|
|
dlopenable="$dlopen depend"
|
|
|
|
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c moddepend.c
|
2008-08-16 23:28:30 +08:00
|
|
|
AT_CHECK([$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o libdepend.la ]dnl
|
|
|
|
[moddepend.lo -rpath /foo -avoid-version], [], [ignore], [ignore])
|
2007-05-22 20:07:06 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2010-06-14 11:26:48 +08:00
|
|
|
$have_shared && CPPFLAGS="$CPPFLAGS -DHAVE_SHARED"
|
|
|
|
|
2007-05-22 20:07:06 +08:00
|
|
|
# ------------------------------------------------------------------------- #
|
|
|
|
# Other modules can be tested correctly even when built with -no-undefined. #
|
|
|
|
# ------------------------------------------------------------------------- #
|
|
|
|
|
|
|
|
LDFLAGS="$LDFLAGS -no-undefined"
|
2007-05-09 16:10:19 +08:00
|
|
|
|
|
|
|
$CC $CPPFLAGS $CFLAGS -c main.c
|
2008-08-01 14:12:29 +08:00
|
|
|
for name in resident local global preload; do
|
2008-08-16 23:28:30 +08:00
|
|
|
# FIXME: adding -static to libpreload shouldn't be necessary.
|
|
|
|
# Fix this properly in ltmain, then remove this workaround.
|
tests: migrate tests/sh.test checks to syntax-checks.
Some modernization of the legacy testsuite.
* tests/sh.test: Remove.
* Makefile.am (COMMON_TESTS): Adjust.
* cfg.mk (sc_libtool_m4_cc_basename, sc_prohibit_bracket_as_test)
(sc_prohibit_nested_quotes, sc_prohibit_set_dummy_without_shift)
(sc_prohibit_set_minus_minus, sc_prohibit_test_binary_operators)
(sc_prohibit_test_dollar, sc_prohibit_test_minus_e)
(sc_prohibit_test_unary_operators, sc_prohibit_test_X)
(sc_prohibit_Xsed_withou_X, sc_require_function_nl_brace):
Functionally identical tests to what used to be performed by
sh.test, only with coverage of all files.
* bootstrap, build-aux/edit-readme-alpha,
build-aux/extract-trace, build-aux/getopt.m4sh,
build-aux/ltmain.m4sh, configure.ac, m4/libtool.m4, m4/ltdl.m4,
tests/bindir.at, tests/configure-iface.at, tests/cwrapper.at,
tests/darwin.at, tests/defs.m4sh, tests/demo-hardcode.test,
tests/dlloader-api.at, tests/exceptions.at,
tests/getopt-m4sh.at, tests/lalib-syntax.at, tests/link-2.test,
tests/link-order2.at, tests/loadlibrary.at,
tests/lt_dladvise.at, tests/lt_dlexit.at, tests/lt_dlopen_a.at,
tests/lt_dlopenext.at, tests/need_lib_prefix.at,
tests/nonrecursive.at, tests/recursive.at, tests/resident.at,
tests/standalone.at, tests/static.at, tests/stresstest.at,
tests/subproject.at, tests/sysroot.at, tests/tagtrace.test,
tests/testsuite.at: Fix violations of the new syntax checks.
Signed-off-by: Gary V. Vaughan <gary@gnu.org>
2011-11-17 00:21:18 +08:00
|
|
|
if test preload = "$name"; then
|
2008-08-16 23:28:30 +08:00
|
|
|
st=-static
|
|
|
|
else
|
|
|
|
st=
|
|
|
|
fi
|
2007-05-22 20:07:06 +08:00
|
|
|
$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c mod$name.c
|
2008-08-16 23:28:30 +08:00
|
|
|
AT_CHECK([$LIBTOOL --mode=link $CC -module $CFLAGS $LDFLAGS -o lib$name.la ]dnl
|
|
|
|
[mod$name.lo $st -rpath /foo -avoid-version], [], [ignore], [ignore])
|
2007-05-09 16:10:19 +08:00
|
|
|
done
|
|
|
|
|
2008-08-01 14:12:29 +08:00
|
|
|
preloaded=
|
|
|
|
for module in $dlpreloadable; do
|
|
|
|
preloaded="${preloaded+$preloaded }-dlpreopen lib$module.la"
|
|
|
|
done
|
2007-05-22 20:07:06 +08:00
|
|
|
|
2008-08-01 14:12:29 +08:00
|
|
|
modules=
|
|
|
|
for module in $dlopenable; do
|
|
|
|
modules="${modules+$modules }-dlopen lib$module.la"
|
2007-05-09 16:10:19 +08:00
|
|
|
done
|
|
|
|
|
Add $EXEEXT to all linked programs in the new testsuite.
* tests/convenience.at, tests/ctor.at, tests/darwin.at,
tests/deplibs-ident.at, tests/duplicate_conv.at,
tests/duplicate_deps.at, tests/duplicate_members.at,
tests/export.at, tests/fail.at, tests/indirect_deps.at,
tests/inherited_flags.at, tests/link-order.at,
tests/link-order2.at, tests/lt_dladvise.at, tests/lt_dlexit.at,
tests/need_lib_prefix.at, tests/runpath-in-lalib.at,
tests/search-path.at, tests/shlibpath.at, tests/static.at,
tests/stresstest.at, tests/template.at, tests/testsuite.at:
Use $EXEEXT throughout, except in Makefile.am snippets where
automake takes care of it, and in testsuite macros that take
care of the extension.
Reports by Roumen Petrov and Alon Bar-Lev.
Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
2008-11-24 04:26:09 +08:00
|
|
|
AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o main$EXEEXT main.$OBJEXT $preloaded $modules $LIBLTDL],
|
2008-08-01 14:12:29 +08:00
|
|
|
[], [ignore], [ignore])
|
|
|
|
|
|
|
|
# Remove loadable libpreload module, so we know it is the preloaded module
|
|
|
|
# that is being executed by a successful test invocation:
|
2008-08-16 23:28:30 +08:00
|
|
|
AT_CHECK([$LIBTOOL --mode=clean rm -f libpreload.la], [], [ignore], [ignore])
|
2008-08-01 14:12:29 +08:00
|
|
|
|
|
|
|
LT_AT_NOINST_EXEC_CHECK([./main], [$modules], [], [expout], [])
|
|
|
|
|
2007-05-09 16:10:19 +08:00
|
|
|
AT_CLEANUP
|