manpagez: man pages & more
html files: libsoup-2.4
Home | html | info | man

Compiling with libsoup

Compiling with libsoup — Notes on compiling

Using pkg-config

Like other GNOME libraries, libsoup uses pkg-config to provide compiler options. The package name is "libsoup-2.4". So in your configure script, you might specify something like:

1
2
3
PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26])
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)

The "2.4" in the package name is the "API version" (indicating "the version of the libsoup API that first appeared in version 2.4") and is essentially just part of the package name.


API Availability and Deprecation Warnings

If you want to restrict your program to a particular libsoup version or range of versions, you can define SOUP_VERSION_MIN_REQUIRED and/or SOUP_VERSION_MAX_ALLOWED. Eg:

1
2
LIBSOUP_CFLAGS="$LIBSOUP_CFLAGS -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_36"
LIBSOUP_CFLAGS="$LIBSOUP_CFLAGS -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_40"

The SOUP_VERSION_MIN_REQUIRED declaration states that the code is not expected to compile on versions of libsoup older than the indicated version (here, 2.36), and so the compiler should print warnings if the code uses functions that were deprecated as of that release.

The SOUP_VERSION_MAX_ALLOWED declaration states that the code is expected to compile on versions of libsoup up to the indicated version (here, 2.40), and so, when compiling the program against a newer version than that, the compiler should print warnings if the code uses functions that did not yet exist in the max-allowed release.

You can use SOUP_CHECK_VERSION to check the version of libsoup at compile time, to compile different code for different libsoup versions. (If you are setting SOUP_VERSION_MIN_REQUIRED and SOUP_VERSION_MAX_ALLOWED to different versions, as in the example above, then you almost certainly need to be doing this.)


Headers

Code using libsoup should do:

1
#include <libsoup/soup.h>

Including individual headers rather than soup.h is not recommended.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.