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 | |
---|
21 | required="autoconf automake libtool libmy-static libmy-shared" |
---|
22 | set -e |
---|
23 | . ./test/init.sh || exit 99 |
---|
24 | |
---|
25 | cat > configure.ac <<EOF |
---|
26 | AC_INIT([hello], [1.0]) |
---|
27 | AC_CONFIG_MACRO_DIR([m4]) |
---|
28 | AM_INIT_AUTOMAKE([foreign]) |
---|
29 | AC_LANG([C++]) |
---|
30 | AC_PROG_CXXCPP |
---|
31 | AC_PROG_CXX |
---|
32 | LT_INIT |
---|
33 | |
---|
34 | YAT_USE_LIBTOOL_PUSH |
---|
35 | |
---|
36 | rm -fr .libs |
---|
37 | |
---|
38 | LDFLAGS="-L$abs_top_builddir/test/lib" |
---|
39 | AC_MSG_CHECKING([whether linking against -lmy-shared works]) |
---|
40 | LIBS=-lmy-shared |
---|
41 | YAT_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 | |
---|
51 | LIBS=-lmy-static |
---|
52 | AC_MSG_CHECKING([whether linking against -lmy-static works]) |
---|
53 | YAT_LT_LINK_LA_IFELSE([ |
---|
54 | namespace theplu { |
---|
55 | namespace yat { |
---|
56 | namespace 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 | |
---|
67 | AC_CONFIG_FILES([Makefile]) |
---|
68 | AC_OUTPUT |
---|
69 | EOF |
---|
70 | |
---|
71 | bootstrap |
---|
72 | if ./configure; then |
---|
73 | echo OK; |
---|
74 | else |
---|
75 | tail -n 500 config.log; |
---|
76 | exit_fail configure failed; |
---|
77 | fi |
---|
78 | |
---|
79 | exit_success |
---|