source: trunk/test/yat_lt_link_ifelse_test.sh @ 2520

Last change on this file since 2520 was 2520, checked in by Peter, 12 years ago

use new functions (r2519) in tests and simplify code

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.4 KB
Line 
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
25required="autoconf automake libtool"
26
27set -e
28
29. ./common_defs.sh || exit 99
30
31cat >> configure.ac <<EOF
32YAT_USE_LIBTOOL_PUSH
33AC_MSG_CHECKING([libtool linking])
34YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM],
35                   [],
36                   [AC_MSG_ERROR([cannot libtool link simple program])])
37AC_MSG_RESULT([ok])
38
39AC_MSG_CHECKING([libtool linking against -lrapakalja])
40LIBS=-lrapakalja
41YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM],
42                   [AC_MSG_ERROR([unexpectedly succesful linking with $LIBS])])
43AC_MSG_RESULT([no (as expected)])
44
45YAT_FIND_YAT
46m4_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           ])
58AC_MSG_CHECKING([libtool linking against -lyat])
59LIBS=\`\$yat_config --link-libtool\`;
60YAT_LT_LINK_IFELSE([PROG],
61                   [test_result=ok; AC_SUBST(test_result)],
62                   [AC_MSG_ERROR([cannot libtool link yat])])
63AC_MSG_RESULT([ok])
64AC_CONFIG_FILES([Makefile])
65AC_OUTPUT
66EOF
67
68# bootstrapping
69bootstrap
70if ./configure --with-yat=$abs_top_builddir/build_support/yat-config; then
71    echo OK;
72else
73    tail -n 500 config.log;
74    exit_fail configure failed;
75fi
76
77grep test_result Makefile || exit_fail
Note: See TracBrowser for help on using the repository browser.