Compiling with libsoup
Compiling with libsoup — Notes on compiling
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)
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.
LIBSOUP_CFLAGS="$LIBSOUP_CFLAGS -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_36" LIBSOUP_CFLAGS="$LIBSOUP_CFLAGS -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_40"
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.
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
to check the version of libsoup at compile time, to compile different
code for different libsoup versions. (If
you are setting
SOUP_VERSION_MAX_ALLOWED to different versions, as
in the example above, then you almost certainly need to be doing