1 # ltdl-libdir.at -- test libltdl functionality -*- Autotest -*-
3 # Copyright (C) 2010 Free Software Foundation, Inc.
4 # This file is part of GNU Libtool.
6 # GNU Libtool is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation; either version 2 of
9 # the License, or (at your option) any later version.
11 # GNU Libtool is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Libtool; see the file COPYING. If not, a copy
18 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
19 # or obtained by writing to the Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 AT_SETUP([libdir of installed modules])
24 AT_KEYWORDS([libltdl])
26 # This test requires shared library support.
27 AT_CHECK([$LIBTOOL --features | grep 'enable shared libraries' || exit 77],
30 # With MinGW, try Windows-style paths only.
31 if pwd -W >/dev/null 2>&1; then
38 mkdir $prefix $libdir $bindir
55 typedef int func_f(void);
58 main (int argc, const char *argv[])
60 lt_dlhandle module = NULL;
64 fprintf(stderr, "lt_dlinit failed '%s'\n", lt_dlerror());
68 module = lt_dlopen("./a.la");
71 fprintf(stderr, "lt_dlopen failed '%s'\n", lt_dlerror());
75 f = (func_f *)lt_dlsym(module, "f");
78 fprintf(stderr, "lt_dlsym failed '%s'\n", lt_dlerror());
83 fprintf(stderr, "f did not return 42\n");
93 : ${LTDLINCL="-I$abs_top_srcdir/libltdl"}
94 : ${LIBLTDL="$abs_builddir/../libltdl/libltdlc.la"}
96 # Skip installcheck if --disable-ltdl-install was used.
97 AT_CHECK([test -f "$LIBLTDL" || exit 77])
99 CPPFLAGS="$LTDLINCL $CPPFLAGS"
100 LDFLAGS="$LDFLAGS -no-undefined"
102 AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c a.c],
103 [], [ignore], [ignore])
104 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o a.la ]dnl
105 [a.lo -rpath $libdir -module -shared -avoid-version],
106 [], [ignore], [ignore])
107 AT_CHECK([$CC $CPPFLAGS $CFLAGS -c m.c],
108 [], [ignore], [ignore])
109 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m$EXEEXT ]dnl
110 [m.$OBJEXT $LIBLTDL],
111 [], [ignore], [ignore])
112 AT_CHECK([$LIBTOOL --mode=install cp a.la $libdir/a.la],
113 [], [ignore], [ignore])
114 AT_CHECK([$LIBTOOL --mode=install cp m$EXEEXT $bindir/m$EXEEXT],
115 [], [ignore], [ignore])
117 # Try finding the module via the libdir entry in a misplaced .la file.
119 mv $libdir/a.la $bindir/a.la
121 LT_AT_EXEC_CHECK([./m],
122 [], [ignore], [ignore])