[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
B. Package tools
If you are creating a software package that uses the GiNaC library,
setting the correct command line options for the compiler and linker can
be difficult. The pkg-config
utility makes this process
easier. GiNaC supplies all necessary data in ‘ginac.pc’ (installed
into /usr/local/lib/pkgconfig
by default). To compile a simple
program use (6)
g++ -o simple `pkg-config --cflags --libs ginac` simple.cpp |
This command line might expand to (for example):
g++ -o simple -lginac -lcln simple.cpp |
Not only is the form using pkg-config
easier to type, it will
work on any system, no matter how GiNaC was configured.
For packages configured using GNU automake, pkg-config
also
provides the PKG_CHECK_MODULES
macro to automate the process of
checking for libraries
PKG_CHECK_MODULES(MYAPP, ginac >= MINIMUM_VERSION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) |
This macro:
-
Determines the location of GiNaC using data from ‘ginac.pc’, which is
either found in the default
pkg-config
search path, or from the environment variablePKG_CONFIG_PATH
. - Tests the installed libraries to make sure that their version is later than MINIMUM-VERSION.
-
If the required version was found, sets the
MYAPP_CFLAGS
variable to the output ofpkg-config --cflags ginac
and theMYAPP_LIBS
variable to the output ofpkg-config --libs ginac
, and calls ‘AC_SUBST()’ for these variables so they can be used in generated makefiles, and then executes ACTION-IF-FOUND. - If the required version was not found, executes ACTION-IF-NOT-FOUND.
B.0.1 Configuring a package that uses GiNaC | ||
B.0.2 Example of a package using GiNaC |