source: trunk/test/yat_lt_link_ifelse_test.sh @ 2527

Last change on this file since 2527 was 2527, checked in by Peter, 10 years ago

remove compiler test from configure.ac genewrated in common_defs.sh (to speed up tests not using compiler)

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#! /bin/sh
2# $Id: yat_lt_link_ifelse_test.sh 2527 2011-07-26 02:15:29Z 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
32AC_LANG([C++])
33AC_PROG_CXXCPP
34AC_PROG_CXX
35YAT_USE_LIBTOOL_PUSH
36AC_MSG_CHECKING([libtool linking])
37YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM],
38                   [],
39                   [AC_MSG_ERROR([cannot libtool link simple program])])
40AC_MSG_RESULT([ok])
41
42AC_MSG_CHECKING([libtool linking against -lrapakalja])
43LIBS=-lrapakalja
44YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM],
45                   [AC_MSG_ERROR([unexpectedly succesful linking with $LIBS])])
46AC_MSG_RESULT([no (as expected)])
47
48YAT_FIND_YAT
49m4_define([PROG],
50          [AC_LANG_PROGRAM([@%:@include <string>
51                            namespace theplu{
52                            namespace yat {
53                            namespace utility {
54                              std::string version(void);
55                            }}}
56                           ],
57                           [using namespace theplu::yat::utility;
58                            std::string s=version();
59                           ])
60           ])
61AC_MSG_CHECKING([libtool linking against -lyat])
62LIBS=\`\$yat_config --link-libtool\`;
63YAT_LT_LINK_IFELSE([PROG],
64                   [test_result=ok; AC_SUBST(test_result)],
65                   [AC_MSG_ERROR([cannot libtool link yat])])
66AC_MSG_RESULT([ok])
67AC_CONFIG_FILES([Makefile])
68AC_OUTPUT
69EOF
70
71# bootstrapping
72bootstrap
73if ./configure --with-yat=$abs_top_builddir/build_support/yat-config; then
74    echo OK;
75else
76    tail -n 500 config.log;
77    exit_fail configure failed;
78fi
79
80grep test_result Makefile || exit_fail
Note: See TracBrowser for help on using the repository browser.