Version 12 (modified by bennylp, 13 years ago) (diff)


Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems

  1. Supported Targets
  2. Requirements
  3. Running configure
    1. Using Default Settings
    2. Features Customization
    3. Configuring Debug Version and Other Customizations
    4. Configuring TLS Support
  4. Video Support
  5. Cross Compilation
  6. Running make
  7. Build Customizations
  8. Optional: Installing PJSIP
  9. Next: Using pjsip libraries in your applications

Supported Targets

The new, autoconf based GNU build system can be used to build the libraries/applications for the following targets:

  • Linux/uC-Linux (i386, Opteron, Itanium, MIPS, PowerPC, etc.),
  • MacOS X (PowerPC),
  • mingw (i386),
  • FreeBSD and maybe other BSD's (i386, Opteron, etc.),
  • RTEMS with cross compilation (ARM, powerpc),
  • etc.


In order to use PJ's GNU build system, these typical GNU tools are needed:

  • GNU make (other make will not work),
  • GNU binutils for the target, and
  • GNU gcc for the target.

In addition, the following libraries are optional, but they will be used if they are present:

  • ALSA header files/libraries (optional) if ALSA support is wanted.
  • OpenSSL header files/libraries (optional) if TLS support is wanted.

The build system is known to work on the following hosts:

  • Linux, many types of distributions.
  • MacOS X 10.2
  • mingw (Win2K, XP)
  • FreeBSD (must use gmake instead of make)

Building Win32 applications with Cygwin is currently not supported by the autoconf script (there are some conflicts with Windows headers), but one can still use the old configure script by calling ./configure-legacy. More over, cross-compilations might also work with Cygwin using this build system.

Running configure

Using Default Settings

Run "./configure" without any options to let the script detect the appropriate settings for the host:

$ cd pjproject
$ ./configure


The default settings build the libraries in "release" mode, with default CFLAGS set to "-O2". To change the default CFLAGS, we can use the usual "./configure CFLAGS='-g'" construct.

Features Customization

With the new autoconf based build system, most configuration/customization can be specified as configure arguments. The list of customizable features can be viewed by running "./configure --help" command:

$ cd pjproject
$ ./configure --help

Optional Features:

--disable-floating-point  	Disable floating point where possible
--disable-sound 	Exclude sound (i.e. use null sound)
--disable-small-filter 	Exclude small filter in resampling
--disable-large-filter 	Exclude large filter in resampling
--disable-g711-plc 	Exclude G.711 Annex A PLC
--disable-speex-aec 	Exclude Speex Acoustic Echo Canceller/AEC
--disable-g711-codec 	Exclude G.711 codecs from the build
--disable-l16-codec 	Exclude Linear/L16 codec family from the build
--disable-gsm-codec 	Exclude GSM codec in the build
--disable-speex-codec 	Exclude Speex codecs in the build
--disable-ilbc-codec 	Exclude iLBC codec in the build
--disable-tls 	Force excluding TLS support (default is autodetected based on OpenSSL availability)

Configuring Debug Version and Other Customizations

The configure script accepts standard customization, which details can be obtained by executing ./configure --help.

Below is an example of specifying CFLAGS in configure:

$ ./configure CFLAGS="-O3 -DNDEBUG -msoft-float -fno-builtin"

Configuring TLS Support

By default, TLS support is configured based on the availability of OpenSSL header files and libraries. If OpenSSL is available at the default include and library path locations, TLS will be enabled by the configure script.

You can explicitly disable TLS support by giving the configure script --disable-tls option.

Video Support

Please see Video User's Guide for video requirements, build, and usage instructions for pjsip version 2.x.

Cross Compilation

Cross compilation should be supported, using the usual autoconf syntax:

$ ./configure --host=arm-elf-linux

Since cross-compilation is not tested as often as the "normal" build, please watch for the ./configure output for incorrect settings (well ideally this should be done for normal build too).

Please refer to Porting Guide for further information about porting PJ software.

Running make

Once the configure script completes successfully, start the build process by invoking these commands:

$ cd pjproject
$ make dep
$ make


gmake may need to be specified instead of make for some hosts, to invoke GNU make instead of the native make.

Description of all make targets supported by the Makefile's:

allThe default (or first) target to build the libraries/binaries.
dep, dependBuild dependencies rule from the source files.
cleanClean the object files for current target, but keep the output library/binary files intact.
distclean, realcleanRemove all generated files (object, libraries, binaries, and dependency files) for current target.


make can be invoked either in the top-level PJ directory or in build directory under each project to build only the particular project.

Build Customizations

Build features can be customized by specifying the options when running ./configure as described in Running Configure above.

In addition, additional CFLAGS and LDFLAGS options can be put in user.mak file in PJ root directory (this file may need to be created if it doesn't exist). Below is a sample of user.mak file contents:

export CFLAGS += -msoft-float -fno-builtin
export LDFLAGS +=

Optional: Installing PJSIP

Run make install to install the header and library files to the target directory. The default target directory can be customized by specifying --prefix=DIR option to configure script.

$ make install

Next: Using pjsip libraries in your applications

Follow the steps described in building applications with GNU tools