source: trunk/test/yat_lt_link_ifelse_test.sh @ 2376

Last change on this file since 2376 was 2376, checked in by Peter, 11 years ago

closes #496

  • 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 2376 2010-12-20 01:17:21Z peter $
3#
4# Copyright (C) 2009 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 1
30
31cat >> configure.ac <<EOF
32AC_MSG_CHECKING([libtool linking])
33YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM],
34                   [],
35                   [AC_MSG_ERROR([cannot libtool link simple program])])
36AC_MSG_RESULT([ok])
37
38AC_MSG_CHECKING([libtool linking against -lrapakalja])
39LIBS=-lrapakalja
40YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM],
41                   [AC_MSG_ERROR([unexpectedly succesful linking with $LIBS])])
42AC_MSG_RESULT([no (as expected)])
43
44YAT_FIND_YAT
45m4_define([PROG],
46          [AC_LANG_PROGRAM([@%:@include <string>
47                            namespace theplu{
48                            namespace yat {
49                            namespace utility {
50                              std::string version(void);
51                            }}}
52                           ],
53                           [using namespace theplu::yat::utility;
54                            std::string s=version();
55                           ])
56           ])
57AC_MSG_CHECKING([libtool linking against -lyat])
58LIBS=\`\$yat_config --link-libtool\`;
59YAT_LT_LINK_IFELSE([PROG],
60                   [test_result=ok; AC_SUBST(test_result)],
61                   [AC_MSG_ERROR([cannot libtool link yat])])
62AC_MSG_CHECKING([ok])
63AC_CONFIG_FILES([Makefile])
64AC_OUTPUT
65EOF
66
67# bootstrapping
68bootstrap
69if ./configure --with-yat=$abs_top_builddir/build_support/yat-config; then
70    echo OK;
71else
72    tail -n 500 config.log;
73    exit 1;
74fi
75
76grep test_result Makefile || exit 1
Note: See TracBrowser for help on using the repository browser.