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