Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: libsndfile : pkg-config Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0: Chris@0:
Chris@0:

libsndfile and pkg-config

Chris@0: Chris@0:

Chris@0: From version 1.0.0 libsndfile has had the ability to read and write files of Chris@0: greater than 2 Gig in size on most OSes even if sizeof (long) == 4. Chris@0: OSes which support this feature include Linux (2.4 kernel, glibc6) on x86, PPC and Chris@0: probably others, Win32, MacOS X, *BSD, Solaris and probably others. Chris@0: OSes on 64 bit processors where the default compile environment is LP64 (longs and Chris@0: pointers are 64 bit ie Linux on DEC/Compaq/HP Alpha processors) automatically Chris@0: support large file access. Chris@0:

Chris@0:

Chris@0: Other OSes including Linux on 32 bit processors, 32 bit Solaris and others require Chris@0: special compiler flags to add large file support. Chris@0: This applies to both the compilation of the library itself and the compilation of Chris@0: programs which link to the library. Chris@0:

Chris@0:

Chris@0: Note : People using Win32, MacOS (both OS X and pre-OS X) or *BSD can disregard the Chris@0: rest of this document as it does not apply to either of these OSes. Chris@0:

Chris@0:

Chris@0: The pkg-config program makes finding the correct compiler flag values and Chris@0: library location far easier. Chris@0: During the installation of libsndfile, a file named sndfile.pc is installed Chris@0: in the directory ${libdir}/pkgconfig (ie if libsndfile is installed in Chris@0: /usr/local/lib, sndfile.pc will be installed in Chris@0: /usr/local/lib/pkgconfig/). Chris@0:

Chris@0:

Chris@0: In order for pkg-config to find sndfile.pc it may be necessary to point the Chris@0: environment variable PKG_CONFIG_PATH in the right direction. Chris@0:

Chris@0:
Chris@0:         export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
Chris@0: 	
Chris@0: Chris@0:

Chris@0: Then, to compile a C file into an object file, the command would be: Chris@0:

Chris@0:
Chris@0:         gcc `pkg-config --cflags sndfile` -c somefile.c
Chris@0: 	
Chris@0:

Chris@0: and to link a number of objects into an executable that links against libsndfile, Chris@0: the command would be: Chris@0:

Chris@0:
Chris@0:         gcc `pkg-config --libs sndfile` obj1.o obj2.o -o program
Chris@0: 	
Chris@0: Chris@0:

Chris@0: Obviously all this can be rolled into a Makefile for easier maintenance. Chris@0:

Chris@0: Chris@0: