source: trunk/test/yat_lt_link_la_ifelse_test.sh @ 3110

Last change on this file since 3110 was 3110, checked in by Peter, 9 years ago

Fix test of YAT_LT_LINK_IFELSE. The macro/linking worked also against
static library, which is unexpected. When I modified to an library
with more symbols (libyat) I get the error: "relocation..." as
expected. refs #737.

configure.ac: AC_SUBST lt_vc_objdir from libtool
test/defs.sh.in: define dito
test/gen_libmy_static.sh: copy libyat.a rather than creating a small libmy-static.a from scratch.
yat_lt_link_la_ifelse_test.sh: link against theplu::yat::utility::version(void) as libmy-static now just is a alias for libyat.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1#! /bin/sh
2# $Id: yat_lt_link_la_ifelse_test.sh 3110 2013-11-09 23:42:16Z peter $
3#
4# Copyright (C) 2013 Peter Johansson
5#
6# This file is part of the yat library, http://dev.thep.lu.se/yat
7#
8# The yat library is free software; you can redistribute it
9# and/or modify it under the terms of the GNU General Public License as
10# published by the Free Software Foundation; either version 3 of the
11# License, or (at your option) any later version.
12#
13# The yat library is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with yat. If not, see <http://www.gnu.org/licenses/>.
20
21required="autoconf automake libtool libmy-static libmy-shared"
22set -e
23. ./test/init.sh || exit 99
24
25cat > configure.ac <<EOF
26AC_INIT([hello], [1.0])
27AC_CONFIG_MACRO_DIR([m4])
28AM_INIT_AUTOMAKE([foreign])
29AC_LANG([C++])
30AC_PROG_CXXCPP
31AC_PROG_CXX
32LT_INIT
33
34YAT_USE_LIBTOOL_PUSH
35
36rm -fr .libs
37
38LDFLAGS="-L$abs_top_builddir/test/lib"
39AC_MSG_CHECKING([whether linking against -lmy-shared works])
40LIBS=-lmy-shared
41YAT_LT_LINK_LA_IFELSE([
42    int foo_shared(void);
43    int my_func(void) { return foo_shared(); }
44  ],[
45    AC_MSG_RESULT([yes])
46  ],[
47    AC_MSG_RESULT([no])
48    AC_MSG_FAILURE
49  ])
50
51LIBS=-lmy-static
52AC_MSG_CHECKING([whether linking against -lmy-static works])
53YAT_LT_LINK_LA_IFELSE([
54namespace theplu {
55namespace yat {
56namespace utility {
57    int version(void);
58}}}
59    int my_func(void) { return theplu::yat::utility::version(); }
60  ],[
61    AC_MSG_RESULT([yes])
62    AC_MSG_FAILURE([expected configure to fail])
63  ],[
64    AC_MSG_RESULT([no])
65  ])
66
67AC_CONFIG_FILES([Makefile])
68AC_OUTPUT
69EOF
70
71bootstrap
72if ./configure; then
73    echo OK;
74else
75    tail -n 500 config.log;
76    exit_fail configure failed;
77fi
78
79exit_success
Note: See TracBrowser for help on using the repository browser.