summaryrefslogtreecommitdiff
path: root/docs/reference/build-howto.xml
blob: bec9a454c36dc7468c71699d184e56a82d94c10c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libsoup-build-howto">
<refmeta>
<refentrytitle>Compiling with libsoup</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBSOUP Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Compiling with libsoup</refname><refpurpose>Notes on compiling</refpurpose>
</refnamediv>

<refsect2>
<title>Using pkg-config</title>

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

<informalexample><programlisting>
PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26])
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
</programlisting></informalexample>

<para>
The "<literal>2.4</literal>" in the package name is the "API version"
(indicating "the version of the <application>libsoup</application> API
that first appeared in version 2.4") and is essentially just part of
the package name.
</para>

</refsect2>

<refsect2>
<title>API Availability and Deprecation Warnings</title>

<para>
If you want to restrict your program to a particular
<application>libsoup</application> version or range of versions, you
can define <link
linkend="SOUP-VERSION-MIN-REQUIRED:CAPS"><literal>SOUP_VERSION_MIN_REQUIRED</literal></link>
and/or <link
linkend="SOUP-VERSION-MAX-ALLOWED:CAPS"><literal>SOUP_VERSION_MAX_ALLOWED</literal></link>.
Eg:
</para>

<informalexample><programlisting>
LIBSOUP_CFLAGS="$LIBSOUP_CFLAGS -DSOUP_VERSION_MIN_REQUIRED=SOUP_VERSION_2_36"
LIBSOUP_CFLAGS="$LIBSOUP_CFLAGS -DSOUP_VERSION_MAX_ALLOWED=SOUP_VERSION_2_40"
</programlisting></informalexample>

<para>
The <literal>SOUP_VERSION_MIN_REQUIRED</literal> declaration states
that the code is not expected to compile on versions of
<application>libsoup</application> 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.
</para>

<para>
The <literal>SOUP_VERSION_MAX_ALLOWED</literal> declaration states
that the code <emphasis>is</emphasis> expected to compile on versions
of <application>libsoup</application> 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.
</para>

<para>
You can use <link
linkend="SOUP-CHECK-VERSION:CAPS"><literal>SOUP_CHECK_VERSION</literal></link>
to check the version of libsoup at compile time, to compile different
code for different <application>libsoup</application> versions. (If
you are setting <literal>SOUP_VERSION_MIN_REQUIRED</literal> and
<literal>SOUP_VERSION_MAX_ALLOWED</literal> to different versions, as
in the example above, then you almost certainly need to be doing
this.)
</para>

</refsect2>

<refsect2>
<title>Headers</title>

<para>
Code using <application>libsoup</application> should do:
</para>

<informalexample><programlisting>
#include &lt;libsoup/soup.h&gt;
</programlisting></informalexample>

<para>
Including individual headers rather than <literal>soup.h</literal> is not
recommended.
</para>

</refsect2>

</refentry>