summaryrefslogtreecommitdiff
path: root/docs/reference/build-howto.xml
blob: 975dfd557c87b9b37dd898b6fa016c9c2b76e7cd (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
<?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>

<para>
If you are using any of the GNOME-specific features of
<application>libsoup</application> (such as automatic proxy
configuration), you must require
"<literal>libsoup-gnome-2.4</literal>" instead:
</para>

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

<para>
You can also make <application>libsoup-gnome</application> an optional
dependency:
</para>

<informalexample><programlisting>
PKG_CHECK_MODULES(LIBSOUP_GNOME,
		  [libsoup-gnome-2.4 >= 2.26],
		  [LIBSOUP_CFLAGS="$LIBSOUP_GNOME_CFLAGS"
		   LIBSOUP_LIBS="$LIBSOUP_GNOME_LIBS"
		   AC_DEFINE(HAVE_LIBSOUP_GNOME, 1, [Have libsoup-gnome])],
		  [PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.26])])
AC_SUBST(LIBSOUP_CFLAGS)
AC_SUBST(LIBSOUP_LIBS)
</programlisting></informalexample>

<para>
This will allow the application to be built with either plain
<application>libsoup</application> or with
<application>libsoup-gnome</application>, and it will define the C
preprocessor symbol <literal>HAVE_LIBSOUP_GNOME</literal> if
<application>libsoup-gnome</application> features are available.
</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>
or, for <application>libsoup-gnome</application>:
</para>

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

<para>
Including individual headers besides the two main header files is not
recommended. You may include both <literal>soup.h</literal> and
<literal>soup-gnome.h</literal> (though this is not required; the
latter automatically includes the former).
</para>

</refsect2>

</refentry>