2245 |
21 Apr 10 |
peter |
#! /bin/sh |
2245 |
21 Apr 10 |
peter |
# $Id$ |
2245 |
21 Apr 10 |
peter |
3 |
# |
3855 |
02 Jan 20 |
peter |
# Copyright (C) 2010, 2011, 2012, 2013, 2019 Peter Johansson |
2245 |
21 Apr 10 |
peter |
5 |
# |
2245 |
21 Apr 10 |
peter |
# This file is part of the yat library, http://dev.thep.lu.se/yat |
2245 |
21 Apr 10 |
peter |
7 |
# |
2245 |
21 Apr 10 |
peter |
# The yat library is free software; you can redistribute it |
2245 |
21 Apr 10 |
peter |
# and/or modify it under the terms of the GNU General Public License as |
2245 |
21 Apr 10 |
peter |
# published by the Free Software Foundation; either version 3 of the |
2245 |
21 Apr 10 |
peter |
# License, or (at your option) any later version. |
2245 |
21 Apr 10 |
peter |
12 |
# |
2245 |
21 Apr 10 |
peter |
# The yat library is distributed in the hope that it will be useful, |
2245 |
21 Apr 10 |
peter |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2245 |
21 Apr 10 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2245 |
21 Apr 10 |
peter |
# General Public License for more details. |
2245 |
21 Apr 10 |
peter |
17 |
# |
2245 |
21 Apr 10 |
peter |
# You should have received a copy of the GNU General Public License |
2245 |
21 Apr 10 |
peter |
# along with yat. If not, see <http://www.gnu.org/licenses/>. |
2245 |
21 Apr 10 |
peter |
20 |
|
2245 |
21 Apr 10 |
peter |
21 |
|
2245 |
21 Apr 10 |
peter |
# build a `hello world' project that uses macro YAT_LT_LINK_IFELSE in its |
2245 |
21 Apr 10 |
peter |
# configure.ac. Test if the macro works against an uninstalled yat. |
2245 |
21 Apr 10 |
peter |
24 |
|
2245 |
21 Apr 10 |
peter |
25 |
required="autoconf automake libtool" |
2245 |
21 Apr 10 |
peter |
26 |
|
2245 |
21 Apr 10 |
peter |
27 |
set -e |
2245 |
21 Apr 10 |
peter |
28 |
|
3036 |
03 Jun 13 |
peter |
29 |
. ./test/init.sh || exit 99 |
2245 |
21 Apr 10 |
peter |
30 |
|
2245 |
21 Apr 10 |
peter |
31 |
cat >> configure.ac <<EOF |
2394 |
06 Jan 11 |
peter |
32 |
YAT_USE_LIBTOOL_PUSH |
2376 |
20 Dec 10 |
peter |
33 |
AC_MSG_CHECKING([libtool linking]) |
2376 |
20 Dec 10 |
peter |
34 |
YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM], |
2376 |
20 Dec 10 |
peter |
35 |
[], |
2376 |
20 Dec 10 |
peter |
36 |
[AC_MSG_ERROR([cannot libtool link simple program])]) |
2376 |
20 Dec 10 |
peter |
37 |
AC_MSG_RESULT([ok]) |
2376 |
20 Dec 10 |
peter |
38 |
|
2376 |
20 Dec 10 |
peter |
39 |
AC_MSG_CHECKING([libtool linking against -lrapakalja]) |
2376 |
20 Dec 10 |
peter |
40 |
LIBS=-lrapakalja |
2376 |
20 Dec 10 |
peter |
41 |
YAT_LT_LINK_IFELSE([AC_LANG_PROGRAM], |
2376 |
20 Dec 10 |
peter |
42 |
[AC_MSG_ERROR([unexpectedly succesful linking with $LIBS])]) |
2376 |
20 Dec 10 |
peter |
43 |
AC_MSG_RESULT([no (as expected)]) |
2376 |
20 Dec 10 |
peter |
44 |
|
2245 |
21 Apr 10 |
peter |
45 |
YAT_FIND_YAT |
2739 |
07 Jun 12 |
peter |
46 |
m4_define([PROG], |
2245 |
21 Apr 10 |
peter |
47 |
[AC_LANG_PROGRAM([@%:@include <string> |
2245 |
21 Apr 10 |
peter |
48 |
namespace theplu{ |
2245 |
21 Apr 10 |
peter |
49 |
namespace yat { |
2245 |
21 Apr 10 |
peter |
50 |
namespace utility { |
2245 |
21 Apr 10 |
peter |
51 |
std::string version(void); |
2245 |
21 Apr 10 |
peter |
52 |
}}} |
2739 |
07 Jun 12 |
peter |
53 |
], |
2245 |
21 Apr 10 |
peter |
54 |
[using namespace theplu::yat::utility; |
2245 |
21 Apr 10 |
peter |
55 |
std::string s=version(); |
2245 |
21 Apr 10 |
peter |
56 |
]) |
2245 |
21 Apr 10 |
peter |
57 |
]) |
2376 |
20 Dec 10 |
peter |
58 |
AC_MSG_CHECKING([libtool linking against -lyat]) |
2245 |
21 Apr 10 |
peter |
59 |
LIBS=\`\$yat_config --link-libtool\`; |
2245 |
21 Apr 10 |
peter |
60 |
YAT_LT_LINK_IFELSE([PROG], |
2245 |
21 Apr 10 |
peter |
61 |
[test_result=ok; AC_SUBST(test_result)], |
2245 |
21 Apr 10 |
peter |
62 |
[AC_MSG_ERROR([cannot libtool link yat])]) |
2394 |
06 Jan 11 |
peter |
63 |
AC_MSG_RESULT([ok]) |
2245 |
21 Apr 10 |
peter |
64 |
AC_CONFIG_FILES([Makefile]) |
2245 |
21 Apr 10 |
peter |
65 |
AC_OUTPUT |
2245 |
21 Apr 10 |
peter |
66 |
EOF |
2245 |
21 Apr 10 |
peter |
67 |
|
2245 |
21 Apr 10 |
peter |
# bootstrapping |
2245 |
21 Apr 10 |
peter |
69 |
bootstrap |
3825 |
18 Jul 19 |
peter |
70 |
if ./configure CXX="$CXX" $configure_opts --with-yat=$YAT_CONFIG; then |
2245 |
21 Apr 10 |
peter |
71 |
echo OK; |
2245 |
21 Apr 10 |
peter |
72 |
else |
2376 |
20 Dec 10 |
peter |
73 |
tail -n 500 config.log; |
2520 |
11 Jul 11 |
peter |
74 |
exit_fail configure failed; |
2245 |
21 Apr 10 |
peter |
75 |
fi |
2245 |
21 Apr 10 |
peter |
76 |
|
2520 |
11 Jul 11 |
peter |
77 |
grep test_result Makefile || exit_fail |
2622 |
06 Nov 11 |
peter |
78 |
exit_success |