pkgconfig.html 2.4 KB

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