INSTALL 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. Installing libpng
  2. On Unix/Linux and similar systems, you can simply type
  3. ./configure [--prefix=/path]
  4. make check
  5. make install
  6. and ignore the rest of this document.
  7. If configure does not work on your system, or if you have a need to
  8. change configure.ac or Makefile.am, and you have a reasonably
  9. up-to-date set of tools, running ./autogen.sh in a git clone before
  10. running ./configure may fix the problem. To be really sure that you
  11. aren't using any of the included pre-built scripts, you can do this:
  12. ./configure --enable-maintainer-mode
  13. make maintainer-clean
  14. ./autogen.sh --maintainer --clean
  15. ./autogen.sh --maintainer
  16. ./configure [--prefix=/path] [other options]
  17. make
  18. make install
  19. make check
  20. Instead, you can use one of the custom-built makefiles in the
  21. "scripts" directory
  22. cp scripts/makefile.system makefile
  23. make test
  24. make install
  25. The files that are presently available in the scripts directory
  26. are listed and described in scripts/README.txt.
  27. Or you can use one of the "projects" in the "projects" directory.
  28. Before installing libpng, you must first install zlib, if it
  29. is not already on your system. zlib can usually be found
  30. wherever you got libpng. zlib can be placed in another directory,
  31. at the same level as libpng.
  32. If your system already has a preinstalled zlib you will still need
  33. to have access to the zlib.h and zconf.h include files that
  34. correspond to the version of zlib that's installed.
  35. If you wish to test with a particular zlib that is not first in the
  36. standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
  37. and LD_LIBRARY_PATH in your environment before running "make test"
  38. or "make distcheck":
  39. ZLIBLIB=/path/to/lib export ZLIBLIB
  40. ZLIBINC=/path/to/include export ZLIBINC
  41. CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
  42. LDFLAGS="-L$ZLIBLIB" export LDFLAGS
  43. LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
  44. If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
  45. in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
  46. If you want to use "cmake" (see www.cmake.org), type
  47. cmake . -DCMAKE_INSTALL_PREFIX=/path
  48. make
  49. make install
  50. You can rename the directories that you downloaded (they
  51. might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.7"
  52. or "zlib127") so that you have directories called "zlib" and "libpng".
  53. Your directory structure should look like this:
  54. .. (the parent directory)
  55. libpng (this directory)
  56. INSTALL (this file)
  57. README
  58. *.h
  59. *.c
  60. CMakeLists.txt => "cmake" script
  61. configuration files:
  62. configure.ac, configure, Makefile.am, Makefile.in,
  63. autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
  64. libpng-config.in, aclocal.m4, config.h.in, config.sub,
  65. depcomp, install-sh, mkinstalldirs, test-pngtest.sh
  66. contrib
  67. gregbook
  68. libtests
  69. pngminim
  70. pngminus
  71. pngsuite
  72. visupng
  73. projects
  74. visualc71
  75. vstudio
  76. scripts
  77. makefile.*
  78. *.def (module definition files)
  79. etc.
  80. pngtest.png
  81. etc.
  82. zlib
  83. README
  84. *.h
  85. *.c
  86. contrib
  87. etc.
  88. If the line endings in the files look funny, you may wish to get the other
  89. distribution of libpng. It is available in both tar.gz (UNIX style line
  90. endings) and zip (DOS style line endings) formats.
  91. If you are building libpng with MSVC, you can enter the
  92. libpng projects\visualc6 or visualc71 directory and follow the instructions
  93. in README.txt.
  94. Otherwise enter the zlib directory and follow the instructions in zlib/README,
  95. then come back here and run "configure" or choose the appropriate
  96. makefile.sys in the scripts directory.
  97. Copy the file (or files) that you need from the
  98. scripts directory into this directory, for example
  99. MSDOS example: copy scripts\makefile.msc makefile
  100. UNIX example: cp scripts/makefile.std makefile
  101. Read the makefile to see if you need to change any source or
  102. target directories to match your preferences.
  103. Then read pnglibconf.dfa to see if you want to make any configuration
  104. changes.
  105. Then just run "make" which will create the libpng library in
  106. this directory and "make test" which will run a quick test that reads
  107. the "pngtest.png" file and writes a "pngout.png" file that should be
  108. identical to it. Look for "9782 zero samples" in the output of the
  109. test. For more confidence, you can run another test by typing
  110. "pngtest pngnow.png" and looking for "289 zero samples" in the output.
  111. Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
  112. your output with the result shown in contrib/pngsuite/README.
  113. Most of the makefiles will allow you to run "make install" to
  114. put the library in its final resting place (if you want to
  115. do that, run "make install" in the zlib directory first if necessary).
  116. Some also allow you to run "make test-installed" after you have
  117. run "make install".
  118. Further information can be found in the README and libpng-manual.txt
  119. files, in the individual makefiles, in png.h, and the manual pages
  120. libpng.3 and png.5.
  121. Using the ./configure script -- 16 December 2002.
  122. =================================================
  123. The ./configure script should work compatibly with what scripts/makefile.*
  124. did, however there are some options you might need to add to configure
  125. explicitly, which previously was done semi-automatically (if you didn't edit
  126. scripts/makefile.* yourself, that is)
  127. CFLAGS="-Wall -O -funroll-loops \
  128. -malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
  129. --with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
  130. You can alternatively specify --includedir=/usr/include, /usr/local/include,
  131. /usr/include/libpng%NN%, or whatever.
  132. If you find that the configure script is out-of-date or is not supporting
  133. your platform properly, try running autogen.sh to regenerate "configure",
  134. "Makefile.in", and the other configuration files. Then try configure again.