Chris@0
|
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
Chris@0
|
2 <HTML>
|
Chris@0
|
3
|
Chris@0
|
4 <HEAD>
|
Chris@0
|
5 <TITLE>
|
Chris@0
|
6 libsndfile : pkg-config
|
Chris@0
|
7 </TITLE>
|
Chris@0
|
8 <META NAME="Author" CONTENT="Erik de Castro Lopo (erikd AT mega-nerd DOT com)">
|
Chris@0
|
9 <LINK REL="stylesheet" HREF="libsndfile.css" TYPE="text/css" MEDIA="all">
|
Chris@0
|
10 <LINK REL="stylesheet" HREF="print.css" TYPE="text/css" MEDIA="print">
|
Chris@0
|
11 </HEAD>
|
Chris@0
|
12
|
Chris@0
|
13 <BODY>
|
Chris@0
|
14
|
Chris@0
|
15 <BR>
|
Chris@0
|
16 <H1>libsndfile and pkg-config</H1>
|
Chris@0
|
17
|
Chris@0
|
18 <P>
|
Chris@0
|
19 From version 1.0.0 libsndfile has had the ability to read and write files of
|
Chris@0
|
20 greater than 2 Gig in size on most OSes even if sizeof (long) == 4.
|
Chris@0
|
21 OSes which support this feature include Linux (2.4 kernel, glibc6) on x86, PPC and
|
Chris@0
|
22 probably others, Win32, MacOS X, *BSD, Solaris and probably others.
|
Chris@0
|
23 OSes on 64 bit processors where the default compile environment is LP64 (longs and
|
Chris@0
|
24 pointers are 64 bit ie Linux on DEC/Compaq/HP Alpha processors) automatically
|
Chris@0
|
25 support large file access.
|
Chris@0
|
26 </P>
|
Chris@0
|
27 <P>
|
Chris@0
|
28 Other OSes including Linux on 32 bit processors, 32 bit Solaris and others require
|
Chris@0
|
29 special compiler flags to add large file support.
|
Chris@0
|
30 This applies to both the compilation of the library itself and the compilation of
|
Chris@0
|
31 programs which link to the library.
|
Chris@0
|
32 </P>
|
Chris@0
|
33 <P>
|
Chris@0
|
34 Note : People using Win32, MacOS (both OS X and pre-OS X) or *BSD can disregard the
|
Chris@0
|
35 rest of this document as it does not apply to either of these OSes.
|
Chris@0
|
36 </P>
|
Chris@0
|
37 <P>
|
Chris@0
|
38 The <B>pkg-config</B> program makes finding the correct compiler flag values and
|
Chris@0
|
39 library location far easier.
|
Chris@0
|
40 During the installation of libsndfile, a file named <B>sndfile.pc</B> is installed
|
Chris@0
|
41 in the directory <B>${libdir}/pkgconfig</B> (ie if libsndfile is installed in
|
Chris@0
|
42 <B>/usr/local/lib</B>, <B>sndfile.pc</B> will be installed in
|
Chris@0
|
43 <B>/usr/local/lib/pkgconfig/</B>).
|
Chris@0
|
44 </P>
|
Chris@0
|
45 <P>
|
Chris@0
|
46 In order for pkg-config to find sndfile.pc it may be necessary to point the
|
Chris@0
|
47 environment variable <B>PKG_CONFIG_PATH</B> in the right direction.
|
Chris@0
|
48 </P>
|
Chris@0
|
49 <PRE>
|
Chris@0
|
50 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
|
Chris@0
|
51 </PRE>
|
Chris@0
|
52
|
Chris@0
|
53 <P>
|
Chris@0
|
54 Then, to compile a C file into an object file, the command would be:
|
Chris@0
|
55 </P>
|
Chris@0
|
56 <PRE>
|
Chris@0
|
57 gcc `pkg-config --cflags sndfile` -c somefile.c
|
Chris@0
|
58 </PRE>
|
Chris@0
|
59 <P>
|
Chris@0
|
60 and to link a number of objects into an executable that links against libsndfile,
|
Chris@0
|
61 the command would be:
|
Chris@0
|
62 </P>
|
Chris@0
|
63 <PRE>
|
Chris@0
|
64 gcc `pkg-config --libs sndfile` obj1.o obj2.o -o program
|
Chris@0
|
65 </PRE>
|
Chris@0
|
66
|
Chris@0
|
67 <P>
|
Chris@0
|
68 Obviously all this can be rolled into a Makefile for easier maintenance.
|
Chris@0
|
69 </P>
|
Chris@0
|
70 </BODY>
|
Chris@0
|
71 </HTML>
|