Copyright © 2004 John D. Ramsdell.
Permission to copy without fee all or part of this material is granted provided that the copies are not made or distributed for direct commercial advantage, this copyright notice and the title of the publication and its date appear, and notice in given that copying is by permission of John D. Ramsdell.
This manual describes a version of Csound distributed with a GNU Build System (GBS). The GBS distribution is configured and built using the usual commands:
./configure make make install
By default, no shared libraries are build, however, the system can be configured to do so. This may be of particular interest to Cygwin Windows users interested in building a Csound DLL that does not require the presence of the Cygwin DLL. To build a Csound DLL in Cygwin, configure with:
./configure --enable-shared=yes --enable-cygwin=no
Csound configuration options are listed as follows:
./configure --help
The GBS distribution builds and installs programs, libraries, and headers. One library provides the Csound API. After installation, the GBS distribution makes the Csound API header available to C and C++ programs with:
#include <csound/csound.h>
The program csound-config
prints the compiler options
required to build and link programs that use the Csound API. For
small applications, the easiest way to use this programs is to start
your project's Makefile
with the following:
CFLAGS=`csound-config --cflags` CXXFLAGS=`csound-config --cxxflags` LDFLAGS=`csound-config --ldflags` LDLIBS=`csound-config --libs`
Projects that use autoconf
can make use of the
csound-config
program by including the following text in its
configure.ac
:
AC_ARG_VAR([CSOUND_CONFIG], [Path to the Csound configuration script when available]) AC_PATH_PROG([CSOUND_CONFIG], [csound-config]) if test -n "$CSOUND_CONFIG"; then CFLAGS="$CFLAGS `$CSOUND_CONFIG --cflags`" CXXFLAGS="$CXXFLAGS `$CSOUND_CONFIG --cxxflags`" LDFLAGS="$LDFLAGS `$CSOUND_CONFIG --ldflags`" LIBS="$LIBS `$CSOUND_CONFIG --static --libs`" else AC_MSG_ERROR(cannot find Csound package) fi
Note that the author of this configure.ac
specified that the
Csound library be statically linked into their program even if a
shared version of the library is available.
The csound-config
program can be used even when the GBS
distribution is not installed. The --inplace
option will
print the appropriate compiler options for a version of Csound built
within the source directories.
The complete set of options supported by csound-config
follow:
$ csound-config --help Usage: csound-config [options] Options: --prefix[=DIR] Show or set the prefix --exec-prefix[=DIR] Show or set the exec-prefix --basename Show the package base name --version Show the version --cflags Show the flags to compile C with Csound --cxxflags Show the flags to compile C++ with Csound --ldflags Show the flags to link with Csound --libs Show the library flags to link with Csound --static When displaying libraries, show the static ones --cc Show C compiler used to build Csound --cxx Show C++ compiler used to build Csound --inplace Use the build directory instead the install directories