// $Id: build_tool.doxygen 1487 2008-09-10 08:41:36Z jari $ // // Copyright (C) 2008 Peter Johansson // // This file is part of the yat library, http://dev.thep.lu.se/yat // // The yat library is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 3 of the // License, or (at your option) any later version. // // The yat library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with yat. If not, see . /** \page build_tool Build Tools \section yat-config The \c yat-config script provides information on the local version of the library. For instance the following command shows that yat was installed at prefix \c `/usr/local' \verbatim #> yat-config --prefix /usr/local \endverbatim This information can then be used in a Makefile, for example, as follows: \verbatim BIN=foo SRC=$(BIN).cc OBJECTS=$(SRC:.cc=.o) CPPFLAGS+=`yat-config --cppflags` CXXFLAGS+=`yat-config --cxxflags` LDFLAGS+=`yat-config --ldflags` LIBS+=`yat-config --libs` all: $(BIN) $(BIN): $(OBJECTS) $(CXX) $(LDFLAGS) $(OBJECTS) -o $(BIN) $(LIBS) .cc.o: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ clean:; rm -f $(OBJECTS) $(BIN) \endverbatim For further information on yat-config use \c `yat-config \c --help' \section macro Autoconf Macro For applications using autoconf there is a macro available in \c yat.m4. The macro can be called from your \c configure.ac: \verbatim YAT_CHECK_YAT([minimum-version], [action-if-found],[action-if-not-found]) \endverbatim The argument minimum-version should be the number (\c MAJOR.MINOR or \c MAJOR.MINOR.PATCH) of the version you require. If yat header files and library are not found or the version is not new enough, macro will complain and execute shell command \c action-if-not-found. A suitable \c action-if-not-found could be \verbatim AC_MSG_ERROR([could not find required version of yat]) \endverbatim If the test is successful, \c HAVE_YAT is defined and \c action-if-found is executed. The test calls \c yat-config and sets variables \c YAT_CPPFLAGS, \c YAT_CXXFLAGS, \c YAT_LDFLAGS, \c YAT_LIBS, and \c YAT_LA_FILE. These flags can then be used in the \c Makefile.am. For instance: \verbatim AM_CPPFLAGS = $(YAT_CPPFLAGS) AM_CXXFLAGS = $(YAT_CXXFLAGS) AM_LDFLAGS = $(YAT_LDFLAGS) LDADD = $(YAT_LIBS) \endverbatim or when using libtool you could use \c YAT_LA_FILE: \verbatim AM_CPPFLAGS = $(YAT_CPPFLAGS) AM_CXXFLAGS = $(YAT_CXXFLAGS) LDADD = $(YAT_LA_FILE) \endverbatim If you have yat installed with a different prefix than aclocal, for example, if yat is installed in prefix \c /usr/local and aclocal is located in /usr/bin, then you need to tell aclocal (or autoreconf) where to look for \c yat.m4 \verbatim #> aclocal -I /usr/local/share/aclocal \endverbatim */