Configuration Options

From reSIProcate
Revision as of 13:11, 23 January 2013 by Dpocock (talk | contribs)
Jump to navigation Jump to search

Autotools / UNIX build configuration (reSIProcate >= 1.8)

Here is a quick summary of how to do some things that were configurable with the legacy build system:

Library locations

If you have libraries in non-standard locations (e.g. /opt/something/lib instead of /usr/lib) then please add those locations to LDFLAGS when running configure.

This may be needed for any of the non-system libraries if you compile them yourself, e.g. libdb, radiusclient-ng, mysqlclient, openssl, boost, sipX, curl, popt or c-ares.


 ./configure \
    LDFLAGS="-L/opt/csw/lib -L/opt/csw/bdb48/lib -DTHREAD=MULTI -mt -dalign -V -v"

Header locations

If you have headers (e.g. db_cxx.h) in non-standard locations (e.g/ /opt/something/include instead of /usr/include) then please add those locations to CPPFLAGS when running configure

This may be needed for any of the non-system libraries if you compile them yourself, e.g. libdb, radiusclient-ng, mysqlclient, openssl, boost, sipX, curl, popt or c-ares.


 ./configure \
    CPPFLAGS="-I/opt/csw/include -I/opt/csw/bdb48/include -mt -V -v"

Using non-default compiler and tools or cross-compiling

If you want to use a compiler or cross-compiler other than the default compiler that autotools finds on your system, you can use the configure variables CC, CXX, LD, etc

Here is an example for using SunStudio on Solaris:

  ./configure \
    CC=/opt/studio/sunstudio12.1/bin/cc \

Using distcc, ccache and other compiler wrappers

Setting CC and CXX also lets you invoke tools like distcc and ccache to speed up the compile

Just distcc:

  export DISTCC_POTENTIAL_HOSTS="localhost host2 host3"
  ./configure \
  pump make -j8

Just using ccache:

  ./configure \

Using distcc and ccache together:

  export DISTCC_POTENTIAL_HOSTS="localhost host2 host3"
  ./configure \
  CCACHE_PREFIX=distcc pump make -j8

Compile profiles (small builds, debug builds, optimised, etc)

The legacy configure offered some compiler profiles with common defaults.

Here are some examples of how to achieve similar behavior with autotools:

Debug vs non-debug builds

To turn off assert() processing in a production build, just add -DNDEBUG to CPPFLAGS, e.g.

  ./configure CPPFLAGS="-DNDEBUG"

Using Google malloc

Just add tcmalloc to LDFLAGS

  ./configure LDFLAGS="-ltcmalloc"

Using Google performance profiling libs

  ./configure LDFLAGS="-lprofiler"

configure options supported with command line flags

You can find all configure options supported by command line flags by running

 ./configure --help

Some of the options are standard autotools capabilities, while others are specific to the reSIProcate project (such as IPv6 and optional TLS support)

Here is an example (current in January 2013):

  `configure' configures resiprocate 1.9.0 to adapt to many kinds of systems.
  Usage: ./configure [OPTION]... [VAR=VALUE]...
  To assign environment variables (e.g., CC, CFLAGS...), specify them as
  VAR=VALUE.  See below for descriptions of some of the useful variables.
  Defaults for the options are specified in brackets.
    -h, --help              display this help and exit
        --help=short        display options specific to this package
        --help=recursive    display the short help of all the included packages
    -V, --version           display version information and exit
    -q, --quiet, --silent   do not print `checking ...' messages
        --cache-file=FILE   cache test results in FILE [disabled]
    -C, --config-cache      alias for `--cache-file=config.cache'
    -n, --no-create         do not create output files
        --srcdir=DIR        find the sources in DIR [configure dir or `..']
  Installation directories:
    --prefix=PREFIX         install architecture-independent files in PREFIX
    --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
  By default, `make install' will install all the files in
  `/usr/local/bin', `/usr/local/lib' etc.  You can specify
  an installation prefix other than `/usr/local' using `--prefix',
  for instance `--prefix=$HOME'.
  For better control, use the options below.
  Fine tuning of the installation directories:
    --bindir=DIR            user executables [EPREFIX/bin]
    --sbindir=DIR           system admin executables [EPREFIX/sbin]
    --libexecdir=DIR        program executables [EPREFIX/libexec]
    --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
    --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
    --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
    --libdir=DIR            object code libraries [EPREFIX/lib]
    --includedir=DIR        C header files [PREFIX/include]
    --oldincludedir=DIR     C header files for non-gcc [/usr/include]
    --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
    --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
    --infodir=DIR           info documentation [DATAROOTDIR/info]
    --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
    --mandir=DIR            man documentation [DATAROOTDIR/man]
    --docdir=DIR            documentation root [DATAROOTDIR/doc/resiprocate]
    --htmldir=DIR           html documentation [DOCDIR]
    --dvidir=DIR            dvi documentation [DOCDIR]
    --pdfdir=DIR            pdf documentation [DOCDIR]
    --psdir=DIR             ps documentation [DOCDIR]
  Program names:
    --program-prefix=PREFIX            prepend PREFIX to installed program names
    --program-suffix=SUFFIX            append SUFFIX to installed program names
    --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
  System types:
    --build=BUILD     configure for building on BUILD [guessed]
    --host=HOST       cross-compile to build programs to run on HOST [BUILD]
  Optional Features:
    --disable-option-checking  ignore unrecognized --enable/--with options
    --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
    --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
    --disable-dependency-tracking  speeds up one-time build
    --enable-dependency-tracking   do not reject slow dependency extractors
    --enable-shared[=PKGS]  build shared libraries [default=yes]
    --enable-static[=PKGS]  build static libraries [default=yes]
                            optimize for fast installation [default=yes]
    --disable-libtool-lock  avoid locking (might break parallel builds)
    --enable-ipv6           Enable IPv6 support
    --enable-dtls           Enable DTLS support (requires OpenSSL)
    --enable-maintainer-mode  enable make rules and dependencies not useful
  			  (and sometimes confusing) to the casual installer
  Optional Packages:
    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
    --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
    --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
    --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
    --with-sysroot=DIR Search for dependent libraries within DIR
                          (or the compiler's sysroot if not specified).
    --with-c-ares           Link against libc-ares (rather than contrib/ares)
    --with-ssl              Link against OpenSSL libraries
    --with-popt             Link against POPT libraries
    --with-sigcomp          Link against Open SigComp libraries for SigComp
    --with-mysql            Link against MySQL client libraries
    --with-geoip            Link against MaxMind GeoIP libraries
    --with-radius           Link against RADIUS client libraries
    --with-b2bua            Build B2BUA lib, no extra dependencies
    --with-tfm              Build TFM, links against Netxx and cppunit
    --with-apps             Build apps, links against various things
    --with-ichat-gw         Build iChat gateway, links against gloox
    --with-recon            Build recon, links against sipX
    --with-p2p              Build P2P, links against S2C and SSL, unfinished
  Some influential environment variables:
    CC          C compiler command
    CFLAGS      C compiler flags
    LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
                nonstandard directory <lib dir>
    LIBS        libraries to pass to the linker, e.g. -l<library>
    CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
                you have headers in a nonstandard directory <include dir>
    CXX         C++ compiler command
    CXXFLAGS    C++ compiler flags
    CPP         C preprocessor
    CXXCPP      C++ preprocessor
  Use these variables to override the choices made by `configure' or to help
  it to find libraries and programs with nonstandard names/locations.
  Report bugs to the package provider.

Common options by platform

Debian and derivatives like Ubuntu

Use git-buildpackage with the official Debian packaging artifacts

 git clone git://

Fedora and RPM-based distributions

The latest tarballs (v1.8.6 and beyond) include an embedded spec file that builds RPMs.

This supports systemd for service control (repro and reTurnServer) - we would welcome contributions of init scripts and a spec file for legacy RPM builds too.

  rpmbuild -tb resiprocate-1.8.6.tar.gz

Mac OS X / Darwin

Platform detail: two test machines provided by Philip and Adam, 10.6 (Snow Leopard) and 10.7 (Lion)

When Adam first tried, the build failed with errors about librt. Daniel has recently tried to fix this, now the whole stack builds and test cases can run.

To build repro and then test cases (verified on both 10.6 and 10.7):

(Note: for 10.6, use db46 and for 10.7, you can use db48)

 git svn clone -Tmain resip-trunk.git
 cd resip-trunk.git
 cd contrib/ares && ./configure && make && cd ../..
 autoreconf --install
 ./configure --with-ssl CPPFLAGS="-I/opt/local/include/db46 -I/opt/local/include/ -I/opt/local/include/boost/" LDFLAGS="-L/opt/local/lib/db46"
 make -C rutil check


Platform detail: OpenCSW build farm - all recent Sparc and x86 variants, zones, etc

Status: stack builds fully on stlport, test cases run. repro fails to link against csw/libdb, because csw is linked with libCstd (not stlport compatible)

Stack fails to build as libCstd, discussed on mailing list:

Note: Solaris issues (stlport and libCstd) are not at all related to the choice of build system. Use of stlport can be chosen manually (if a suitable libdb is available or not required) by passing the arguments to configure:

 ./configure CXXFLAGS="-library=stlport" LDFLAGS="-library=stlport"

More complete example for Solaris:

 autoreconf --install 
 ./configure \
     CC=/opt/studio/sunstudio12.1/bin/cc \
     CXX=/opt/studio/sunstudio12.1/bin/CC \
     CPPFLAGS="-I/opt/csw/include -I/opt/csw/bdb48/include -mt -V -v" \
     LDFLAGS="-L/opt/csw/lib -L/opt/csw/bdb48/lib -DTHREAD=MULTI -mt -dalign -V -v" \
     --with-c-ares --with-ssl
 gmake -j12

(Note that OpenCSW build servers have gmake rather than make)

Legacy UNIX build configuration (reSIProcate <= 1.7)

The legacy build system uses a custom configuration script that can be used to select various options within the project, as well as what parts of the project are built. By default, if you just type 'make', the configuration script is invoked by the makesystem, and some (mostly) sane defaults are chosen for you.

However, if you want to take advantage of the advanced, new, and/or experimental features available within resiprocate, you really want to take advantage of the configuration system. Currently, you have three options:

  • ./configure - Invoke the configuration system in a text questionnaire mode. This can be tedious, but should work under all terminal environments.
  • ./configure -m - Invoke the configuration system in a (somewhat experimental) text-based menu mode. This is much easier to use, but requires a vt100-compatible that is tall enough to accommodate all the configuration options.
  • ./configure -y - Invoke the configuration system in a non-interactive mode. Configuration options will be set to defaults if they don't yet exist, and then any configuration-changing commandline switches will be applied. If the system is already configured, no options will be changed except as specified by commandline switches.

Note that the defaults chosen for some options vary from platform to platform, and even according to what is installed on the system when configuration is invoked.

The various options currently available in the configuration system are:

       Which toolchain do you want to use?
       Valid values are: [gnu, intel, sunpro, msgnu, gnu-cross]
       What is the name your toolchain uses for the cross platform?
       What is the prefix for the cross-compiler binaries?
       Where is your cross compiler installed?
       What compile profile will you use?
       Valid values are: [debug, nodebug, opt, gopt, prof, small]
       Should the resip libraries be built shared?
       Should position-independent-code (PIC) be generated even when
       not building shared libraries? This only applies on x86_64/amd64
       architecture and only when NOT building shared libraries. When enabled,
       the generated static libraries will be PIC, and can then be linked
       into "jumbo" shared libraries.
       Will you be using distcc?
       Will you be using ccache?
       Build the Repro proxy server?
       Which database should be used with Repro?
       Valid values are: [berkeley-db4]
       Where is db_cxx.h?
       Build the RADIUS authentication module? (requires radiusclient-ng)
       Build the TFM test framework?
       Build the reCon Conversation Manager? (requires dtls-srtp patched OpenSSL)
       Build the reTurn client?
       Build the reTurn server?
       Where is boost/config.hpp?
       Are the sipX libraries and headers installed?
       Where is the common root of the sipX libraries?
       Where are the sipX libraries installed?
       Where are the sipX header files installed?
       Include SIP over TLS, SMIME or Identity header support? (Requires OpenSSL)
       Do you want to include SIP over DTLS support? (Requires OpenSSL 0.9.8+)
       Where is OpenSSL? (leave blank to use installed copy)
       Should DUM use curl to retreive identity information?
       Use the Google malloc() implementation?
       Use Thread Local Storage with random_r() to generate random numbers?
       See Random_number_generation for details.
       Use Google cpuperf?
       Compile in IPv6 support?
       Compile in stack support for epoll() system call?
       Enabled by default if system header file present.
       Use popt to read commandline options?
       Test apps and repro make use of popt.
       Where is popt.h?
       Where is libpopt?
       Compile with no floating point functions?
       Force stack to fully parse every message it receives?
       Where should the libraries be installed?
       Which DNS resolution library do you want to use?
       Valid values are: [resip-ares, c-ares]

Support for c-ares remains experimental. Note that using c-ares with resiprocate requires a bleeding-edge copy of c-ares at the moment. See the c-ares project page for information about obtaining a copy of c-ares from their cvs repository.

       Where should ares be installed?
       If using c-ares, the directory containing its headers.
       If using c-ares, the directory containing its libraries.