Compiling the GLib package

Compiling the GLib Package — How to compile GLib itself

Building the Library on UNIX

On UNIX, GLib uses the standard GNU build system, using autoconf for package configuration and resolving portability issues, automake for building makefiles that comply with the GNU Coding Standards, and libtool for building shared libraries on multiple platforms. The normal sequence for compiling and installing the GLib library is thus:


          ./configure
          make
          make install
        

The standard options provided by GNU autoconf may be passed to the configure script. Please see the autoconf documentation or run ./configure --help for information about the standard options.

Extra Configuration Options

In addition to the normal options, the configure script in the GTK+ library supports these additional arguments:

configure [--enable-debug=[no|minimum|yes]] [--disable-gc-friendly | --enable-gc-friendly] [--disable-mem-pools | --enable-mem-pools] [--disable-threads | --enable-threads] [--with-threads=[none|posix|dce|solaris|win32]] [--disable-included-printf | --enable-included-printf] [--disable-gtk-doc | --enable-gtk-doc]

--enable-debug Turns on various amounts of debugging support. Setting this to 'no' disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and all cast checks between different object types. Setting it to 'minimum' disables only cast checks. Setting it to 'yes' enables runtime debugging. The default is 'minimum'. Note that 'no' is fast, but dangerous as it tends to destabilize even mostly bug-free software by changing the effect of many bugs from simple warnings into fatal crashes. Thus --enable-debug=no should not be used for stable releases of gtk+.

--disable-gc-friendly and --enable-gc-friendly When enabled all memory freed by the application, but retained by GLib for performance reasons is set to zero, thus making deployed garbage collection or memory profiling tools detect unlinked memory correctly. This will make GLib slightly slower and is thus disabled by default.

--disable-mem-pools and --enable-mem-pools Many small chunks of memory are often allocated via collective pools in GLib and are cached after release to speed up reallocations. For sparse memory systems this behaviour is often inferior, so memory pools can be disabled to avoid excessive caching and force atomic maintenance of chunks through the g_malloc() and g_free() functions. Code currently affected by this:

  • GList, GSList, GNode allocations

  • GMemChunks become basically non-effective

  • GSignal disables all caching (potentially very slow)

  • GType doesn't honour the GTypeInfo n_preallocs field anymore

  • the GBSearchArray flag G_BSEARCH_ALIGN_POWER2 becomes non-functional

--disable-threads and --enable-threads Do not compile GLib to be multi thread safe. GLib will be slightly faster then. This is however not recommended, as many programs rely on GLib being multi thread safe.

--with-threads Specify a thread implementation to use.

  • 'posix' and 'dce' can be used interchangeable to mean the different versions of posix threads. configure tries to find out, which one is installed.

  • 'solaris' uses the native Solaris thread implementation.

  • 'none' means that GLib will be thread safe, but does not have a default thread implementation. This has to be supplied to g_thread_init() by the programmer.

--disable-included-printf and --enable-included-printf By default the configure script will try to auto-detect whether the C library provides a suitable set of printf() functions. In detail, configure checks that the semantics of snprintf() are as specified by C99 and that positional parameters as specified in the Single Unix Specification are supported. If this not the case, GLib will include an implementation of the printf() family. These options can be used to explicitly control whether an implementation fo the printf() family should be included or not.

--disable-gtk-doc and --enable-gtk-doc By default the configure script will try to auto-detect whether the gtk-doc package is installed. If it is, then it will use it to extract and build the documentation for the GLib library. These options can be used to explicitly control whether gtk-doc should be used or not. If it is not used, the distributed, pre-generated HTML files will be installed instead of building them on your machine.