1414 |
17 Aug 08 |
peter |
// $Id$ |
1414 |
17 Aug 08 |
peter |
2 |
// |
2119 |
12 Dec 09 |
peter |
// Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
// Copyright (C) 2009, 2011, 2013, 2017, 2018, 2020 Peter Johansson |
1414 |
17 Aug 08 |
peter |
5 |
// |
1414 |
17 Aug 08 |
peter |
// This file is part of the yat library, http://dev.thep.lu.se/yat |
1414 |
17 Aug 08 |
peter |
7 |
// |
1414 |
17 Aug 08 |
peter |
// The yat library is free software; you can redistribute it and/or |
1414 |
17 Aug 08 |
peter |
// modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
// published by the Free Software Foundation; either version 3 of the |
1414 |
17 Aug 08 |
peter |
// License, or (at your option) any later version. |
1414 |
17 Aug 08 |
peter |
12 |
// |
1414 |
17 Aug 08 |
peter |
// The yat library is distributed in the hope that it will be useful, |
1414 |
17 Aug 08 |
peter |
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
1414 |
17 Aug 08 |
peter |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1414 |
17 Aug 08 |
peter |
// General Public License for more details. |
1414 |
17 Aug 08 |
peter |
17 |
// |
1414 |
17 Aug 08 |
peter |
// You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
// along with yat. If not, see <http://www.gnu.org/licenses/>. |
1414 |
17 Aug 08 |
peter |
20 |
|
1414 |
17 Aug 08 |
peter |
21 |
|
1414 |
17 Aug 08 |
peter |
22 |
/** |
1414 |
17 Aug 08 |
peter |
\page build_tool Build Tools |
1414 |
17 Aug 08 |
peter |
24 |
|
1414 |
17 Aug 08 |
peter |
\section yat-config |
1414 |
17 Aug 08 |
peter |
26 |
|
1414 |
17 Aug 08 |
peter |
The \c yat-config script provides information on the local version of |
1415 |
18 Aug 08 |
peter |
the library. For instance the following command shows that yat was |
3133 |
24 Nov 13 |
peter |
installed at prefix \c '/usr/local' |
1414 |
17 Aug 08 |
peter |
30 |
|
3133 |
24 Nov 13 |
peter |
\verbatim |
1415 |
18 Aug 08 |
peter |
#> yat-config --prefix |
1415 |
18 Aug 08 |
peter |
/usr/local |
1414 |
17 Aug 08 |
peter |
\endverbatim |
1414 |
17 Aug 08 |
peter |
35 |
|
1415 |
18 Aug 08 |
peter |
This information can then be used in a Makefile, for example, as follows: |
1414 |
17 Aug 08 |
peter |
37 |
|
1415 |
18 Aug 08 |
peter |
\verbatim |
1415 |
18 Aug 08 |
peter |
BIN=foo |
1415 |
18 Aug 08 |
peter |
SRC=$(BIN).cc |
1448 |
28 Aug 08 |
peter |
OBJECTS=$(SRC:.cc=.o) |
1415 |
18 Aug 08 |
peter |
42 |
|
3581 |
19 Jan 17 |
peter |
CXX=`yat-config --cxx` |
1417 |
19 Aug 08 |
peter |
CPPFLAGS+=`yat-config --cppflags` |
1415 |
18 Aug 08 |
peter |
CXXFLAGS+=`yat-config --cxxflags` |
1415 |
18 Aug 08 |
peter |
LDFLAGS+=`yat-config --ldflags` |
3934 |
10 Jul 20 |
peter |
LDLIBS+=`yat-config --libs` |
1415 |
18 Aug 08 |
peter |
48 |
|
1415 |
18 Aug 08 |
peter |
all: $(BIN) |
1415 |
18 Aug 08 |
peter |
50 |
|
3133 |
24 Nov 13 |
peter |
$(BIN): $(OBJECTS) |
3934 |
10 Jul 20 |
peter |
$(CXX) $(LDFLAGS) $(OBJECTS) -o $(BIN) $(LDLIBS) |
1415 |
18 Aug 08 |
peter |
53 |
|
1415 |
18 Aug 08 |
peter |
.cc.o: |
1415 |
18 Aug 08 |
peter |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ |
1415 |
18 Aug 08 |
peter |
56 |
|
2529 |
26 Jul 11 |
peter |
clean:; $(RM) $(OBJECTS) $(BIN) |
1415 |
18 Aug 08 |
peter |
\endverbatim |
1415 |
18 Aug 08 |
peter |
59 |
|
3133 |
24 Nov 13 |
peter |
or if you are using <a href="http://www.gnu.org/software/make/">GNU |
3133 |
24 Nov 13 |
peter |
Make</a> and prefer using default rules, you can use \c yat-config with |
3133 |
24 Nov 13 |
peter |
62 |
|
3133 |
24 Nov 13 |
peter |
\verbatim |
3133 |
24 Nov 13 |
peter |
CPPFLAGS = `yat-config --cppflags` |
3133 |
24 Nov 13 |
peter |
CXXFLAGS = `yat-config --cxxflags` |
3934 |
10 Jul 20 |
peter |
LDFLAGS = `yat-config --ldflags` |
3934 |
10 Jul 20 |
peter |
LDLIBS = `yat-config --libs` |
3133 |
24 Nov 13 |
peter |
68 |
|
3133 |
24 Nov 13 |
peter |
all: foo |
3133 |
24 Nov 13 |
peter |
\endverbatim |
3133 |
24 Nov 13 |
peter |
71 |
|
1932 |
30 Apr 09 |
peter |
From yat 0.6 an alternative \c CBLAS library can be specified using \c |
1932 |
30 Apr 09 |
peter |
YAT_CBLAS_LIB environment variable. By default the \c CBLAS library |
1932 |
30 Apr 09 |
peter |
detected during configuration of yat is used. |
1932 |
30 Apr 09 |
peter |
75 |
|
3133 |
24 Nov 13 |
peter |
For further information on yat-config use \c 'yat-config \c --help' |
1415 |
18 Aug 08 |
peter |
77 |
|
1796 |
12 Feb 09 |
peter |
\since New in yat 0.5 |
1796 |
12 Feb 09 |
peter |
79 |
|
1414 |
17 Aug 08 |
peter |
\section macro Autoconf Macro |
1414 |
17 Aug 08 |
peter |
81 |
|
3769 |
25 Oct 18 |
peter |
For applications using <a href="http://www.gnu.org/software/autoconf/">GNU |
3133 |
24 Nov 13 |
peter |
Autoconf</a> there is a macro available in \c yat.m4. The macro can be |
3133 |
24 Nov 13 |
peter |
called from your \c configure.ac: |
1414 |
17 Aug 08 |
peter |
85 |
|
3133 |
24 Nov 13 |
peter |
\verbatim |
3133 |
24 Nov 13 |
peter |
YAT_CHECK_YAT([minimum-version=0.5], [action-if-found], [action-if-not-found]) |
1414 |
17 Aug 08 |
peter |
\endverbatim |
1414 |
17 Aug 08 |
peter |
89 |
|
1414 |
17 Aug 08 |
peter |
The argument minimum-version should be the number (\c MAJOR.MINOR or |
1414 |
17 Aug 08 |
peter |
\c MAJOR.MINOR.PATCH) of the version you require. If yat header files |
1414 |
17 Aug 08 |
peter |
and library are not found or the version is not new enough, macro will |
1414 |
17 Aug 08 |
peter |
complain and execute shell command \c action-if-not-found. A suitable |
1414 |
17 Aug 08 |
peter |
\c action-if-not-found could be |
1414 |
17 Aug 08 |
peter |
95 |
|
1414 |
17 Aug 08 |
peter |
\verbatim |
2574 |
02 Oct 11 |
peter |
AC_MSG_FAILURE([could not find required version of yat]) |
1414 |
17 Aug 08 |
peter |
\endverbatim |
1414 |
17 Aug 08 |
peter |
99 |
|
1414 |
17 Aug 08 |
peter |
If the test is successful, \c HAVE_YAT is defined and \c |
1414 |
17 Aug 08 |
peter |
action-if-found is executed. The test calls \c yat-config and sets |
1414 |
17 Aug 08 |
peter |
variables \c YAT_CPPFLAGS, \c YAT_CXXFLAGS, \c YAT_LDFLAGS, \c |
1414 |
17 Aug 08 |
peter |
YAT_LIBS, and \c YAT_LA_FILE. These flags can then be used in the \c |
1414 |
17 Aug 08 |
peter |
Makefile.am. For instance: |
1414 |
17 Aug 08 |
peter |
105 |
|
1414 |
17 Aug 08 |
peter |
\verbatim |
2574 |
02 Oct 11 |
peter |
AM_CPPFLAGS = $(YAT_CPPFLAGS) |
2574 |
02 Oct 11 |
peter |
AM_CXXFLAGS = $(YAT_CXXFLAGS) |
2574 |
02 Oct 11 |
peter |
AM_LDFLAGS = $(YAT_LDFLAGS) |
2574 |
02 Oct 11 |
peter |
LDADD = $(YAT_LIBS) |
1414 |
17 Aug 08 |
peter |
\endverbatim |
1414 |
17 Aug 08 |
peter |
112 |
|
1796 |
12 Feb 09 |
peter |
\note this macro assumes that \c yat-config has been installed; \c |
1796 |
12 Feb 09 |
peter |
yat-config was introduced in yat \b 0.5 and consequently this macro |
1796 |
12 Feb 09 |
peter |
\b does \b not work with yat \b 0.4.x (or older). |
1796 |
12 Feb 09 |
peter |
116 |
|
1414 |
17 Aug 08 |
peter |
117 |
*/ |