source: trunk/test/yat_m4_test.sh.in @ 1693

Last change on this file since 1693 was 1693, checked in by Peter, 13 years ago

fixes #451 - add test for yat.m4

File size: 1.9 KB
RevLine 
[1693]1#! @SHELL@
2# @configure_input@
3# $Id$
4
5# Copyright (C) 2009 Peter Johansson
6#
7# This file is part of the yat library, http://dev.thep.lu.se/yat
8#
9# The yat library is free software; you can redistribute it
10# and/or modify it under the terms of the GNU General Public License as
11# published by the Free Software Foundation; either version 3 of the
12# License, or (at your option) any later version.
13#
14# The yat library is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17# General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with yat. If not, see <http://www.gnu.org/licenses/>.
21
22
23# build a `hello world' project that uses macro YAT_CHECK_YAT in its
24# configure.ac. The macro only works with an installed yat, so the
25# test should be run after `make install'.
26
27
28prefix=@prefix@
29exec_prefix=@exec_prefix@
30bindir=@bindir@
31
32rm -rf yathello
33@MKDIR_P@ yathello && cd yathello
34cat > configure.ac <<EOF
35AC_INIT([hello],[1.0])
36AC_CONFIG_SRCDIR([hello.cc])
37AM_INIT_AUTOMAKE([foreign])
38AC_CONFIG_MACRO_DIR([.])
39AC_LANG(C++)
40AC_PROG_CXXCPP
41AC_PROG_CXX
42AC_PROG_LIBTOOL
43YAT_CHECK_YAT([0.4], ,AC_MSG_ERROR([could not find required version of yat]))
44AC_CONFIG_FILES([Makefile])
45AC_OUTPUT
46EOF
47
48cat > Makefile.am <<EOF
49ACLOCAL_AMFLAGS = -I .
50AM_CPPFLAGS = \$(YAT_CPPFLAGS)
51AM_CXXFLAGS = \$(YAT_CXXFLAGS)
52LDADD = \$(YAT_LA_FILE)
53check_PROGRAMS = hello
54TESTS = hello
55hello_SOURCES = hello.cc
56EOF
57
58cat > hello.cc <<EOF
59#include <yat/utility/Vector.h>
60#include <yat/utility/Matrix.h>
61#include <iostream>
62#include <string>
63int main(void)
64{
65theplu::yat::utility::Matrix m(10,3);
66m(1,1)=1.0;
67theplu::yat::utility::Vector v(m.row_const_view(1));
68if (v(1)!=1.0)
69  return 1;
70return 0;
71}
72EOF
73
74cp @abs_top_srcdir@/build_support/yat.m4 .
75
76autoreconf -sivf && ./configure --with-yat=$bindir && make check
Note: See TracBrowser for help on using the repository browser.