Configuration Options

From reSIProcate
Jump to: navigation, search

Autotools / UNIX build configuration (reSIProcate >= 1.8)[edit]

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

Library locations[edit]

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.

E.g.


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

Header locations[edit]

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.

E.g.


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

Using non-default compiler and tools or cross-compiling[edit]

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 \
    CXX=/opt/studio/sunstudio12.1/bin/CC


Using distcc, ccache and other compiler wrappers[edit]

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 \
      CC=distcc
  pump make -j8

Just using ccache:

  ./configure \
      CC=ccache
  make

Using distcc and ccache together:

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

Compile profiles (small builds, debug builds, optimised, etc)[edit]

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[edit]

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

  ./configure CPPFLAGS="-DNDEBUG"

Using Google malloc[edit]

Just add tcmalloc to LDFLAGS

  ./configure LDFLAGS="-ltcmalloc"

Using Google performance profiling libs[edit]

  ./configure LDFLAGS="-lprofiler"

configure options supported with command line flags[edit]

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.
  
  Configuration:
    -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
                            [/usr/local]
    --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                            [PREFIX]
  
  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]
    --enable-fast-install[=PKGS]
                            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
                            both]
    --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[edit]

Debian and derivatives like Ubuntu[edit]

Use git-buildpackage with the official Debian packaging artifacts

 git clone git://git.debian.org/pkg-voip/resiprocate.git

Fedora and RPM-based distributions[edit]

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[edit]

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 clone https://github.com/resiprocate/resiprocate
 cd resiprocate
 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
 make -C rutil check

FreeBSD[edit]

Similar to Mac OS X / Darwin, but with a slightly different configure command, this one worked for me:

 ./configure --prefix=/usr/local/resiprocate --with-ssl CPPFLAGS="-I/usr/local/include -I/usr/local/include/db47 -I`pwd`/contrib/asio" LDFLAGS="-L/usr/local/lib -L/usr/local/lib/db47"


Solaris[edit]

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: http://list.resiprocate.org/archive/resiprocate-devel/msg07995.html

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)[edit]

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:

     --with-toolchain="..."
       Which toolchain do you want to use?
       Valid values are: [gnu, intel, sunpro, msgnu, gnu-cross]
     --with-cross-platform="..."
       What is the name your toolchain uses for the cross platform?
     --with-cross-tool-prefix="..."
       What is the prefix for the cross-compiler binaries?
     --with-cross-compiler-dir="..."
       Where is your cross compiler installed?
     --with-compile-type="..."
       What compile profile will you use?
       Valid values are: [debug, nodebug, opt, gopt, prof, small]
     --enable-shared-libs
     --disable-shared-libs
       Should the resip libraries be built shared?
     --enable-force-pic
     --disable-force-pic
       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.
     --enable-distcc
     --disable-distcc
       Will you be using distcc?
     --enable-ccache
     --disable-ccache
       Will you be using ccache?
     --enable-repro
     --disable-repro
       Build the Repro proxy server?
     --repro-db="..."
       Which database should be used with Repro?
       Valid values are: [berkeley-db4]
     --db4-headers="..."
       Where is db_cxx.h?
     --enable-radius
     --disable-radius
       Build the RADIUS authentication module? (requires radiusclient-ng)
     --enable-tfm
     --disable-tfm
       Build the TFM test framework?
     --enable-recon
     --disable-recon
       Build the reCon Conversation Manager? (requires dtls-srtp patched OpenSSL)
     --enable-return-client
     --disable-return-client
       Build the reTurn client?
     --enable-return-server
     --disable-return-server
       Build the reTurn server?
     --boost-headers="..."
       Where is boost/config.hpp?
     --enable-sipx-installed
     --disable-sipx-installed
       Are the sipX libraries and headers installed?
     --libsipx-lib="..."
       Where is the common root of the sipX libraries?
     --sipx-libdir="..."
       Where are the sipX libraries installed?
     --sipx-incdir="..."
       Where are the sipX header files installed?
     --enable-ssl
     --disable-ssl
       Include SIP over TLS, SMIME or Identity header support? (Requires OpenSSL)
     --enable-dtls
     --disable-dtls
       Do you want to include SIP over DTLS support? (Requires OpenSSL 0.9.8+)
     --with-ssl-location="..."
       Where is OpenSSL? (leave blank to use installed copy)
     --enable-curl
     --disable-curl
       Should DUM use curl to retreive identity information?
     --enable-google-malloc
     --disable-google-malloc
       Use the Google malloc() implementation?
     --enable-random-thread-local
     --disable-random-thread-local
       Use Thread Local Storage with random_r() to generate random numbers?
       See Random_number_generation for details.
     --enable-google-cpuperf
     --disable-google-cpuperf
       Use Google cpuperf?
     --enable-ipv6
     --disable-ipv6
       Compile in IPv6 support?
     --enable-epoll
     --disable-epoll
       Compile in stack support for epoll() system call?
       Enabled by default if system header file present.
     --enable-popt
     --disable-popt
       Use popt to read commandline options?
       Test apps and repro make use of popt.
     --popt-headers="..."
       Where is popt.h?
     --popt-lib="..."
       Where is libpopt?
     --enable-resip-fixed-point
     --disable-resip-fixed-point
       Compile with no floating point functions?
     --enable-pedantic-stack
     --disable-pedantic-stack
       Force stack to fully parse every message it receives?
     --prefix="..."
       Where should the libraries be installed?
     --with-resolver="..."
       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.

     --ares-prefix="..."
       Where should ares be installed?
     --cares-headers="..."
       If using c-ares, the directory containing its headers.
     --cares-libs="..."
       If using c-ares, the directory containing its libraries.