1 | #! /bin/sh |
---|
2 | # $Id: yat_lt_link_ifelse_test.sh 2520 2011-07-11 15:55:27Z peter $ |
---|
3 | # |
---|
4 | # Copyright (C) 2010, 2011 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 | |
---|
22 | # build a `hello world' project that uses macro YAT_LT_LINK_IFELSE in its |
---|
23 | # configure.ac. Test if the macro works against an uninstalled yat. |
---|
24 | |
---|
25 | required="autoconf automake libtool" |
---|
26 | |
---|
27 | set -e |
---|
28 | |
---|
29 | . ./common_defs.sh || exit 99 |
---|
30 | |
---|
31 | cat >> configure.ac <<EOF |
---|
32 | YAT_USE_LIBTOOL_PUSH |
---|
33 | AC_MSG_CHECKING([libtool linking]) |
---|
34 | YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM], |
---|
35 | [], |
---|
36 | [AC_MSG_ERROR([cannot libtool link simple program])]) |
---|
37 | AC_MSG_RESULT([ok]) |
---|
38 | |
---|
39 | AC_MSG_CHECKING([libtool linking against -lrapakalja]) |
---|
40 | LIBS=-lrapakalja |
---|
41 | YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM], |
---|
42 | [AC_MSG_ERROR([unexpectedly succesful linking with $LIBS])]) |
---|
43 | AC_MSG_RESULT([no (as expected)]) |
---|
44 | |
---|
45 | YAT_FIND_YAT |
---|
46 | m4_define([PROG], |
---|
47 | [AC_LANG_PROGRAM([@%:@include <string> |
---|
48 | namespace theplu{ |
---|
49 | namespace yat { |
---|
50 | namespace utility { |
---|
51 | std::string version(void); |
---|
52 | }}} |
---|
53 | ], |
---|
54 | [using namespace theplu::yat::utility; |
---|
55 | std::string s=version(); |
---|
56 | ]) |
---|
57 | ]) |
---|
58 | AC_MSG_CHECKING([libtool linking against -lyat]) |
---|
59 | LIBS=\`\$yat_config --link-libtool\`; |
---|
60 | YAT_LT_LINK_IFELSE([PROG], |
---|
61 | [test_result=ok; AC_SUBST(test_result)], |
---|
62 | [AC_MSG_ERROR([cannot libtool link yat])]) |
---|
63 | AC_MSG_RESULT([ok]) |
---|
64 | AC_CONFIG_FILES([Makefile]) |
---|
65 | AC_OUTPUT |
---|
66 | EOF |
---|
67 | |
---|
68 | # bootstrapping |
---|
69 | bootstrap |
---|
70 | if ./configure --with-yat=$abs_top_builddir/build_support/yat-config; then |
---|
71 | echo OK; |
---|
72 | else |
---|
73 | tail -n 500 config.log; |
---|
74 | exit_fail configure failed; |
---|
75 | fi |
---|
76 | |
---|
77 | grep test_result Makefile || exit_fail |
---|