blob: a50293d04c82c5f5b1d4f99e2d4270040909be14 [file] [log] [blame]
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -06001
Glenn Randers-Pehrson66676012010-10-16 07:18:09 -05002Installing libpng
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -06003
Glenn Randers-Pehrsonddfebd32006-02-22 09:19:25 -06004On Unix/Linux and similar systems, you can simply type
5
Glenn Randers-Pehrson7edd4582006-12-07 19:16:44 -06006 ./configure [--prefix=/path]
Glenn Randers-Pehrsonddfebd32006-02-22 09:19:25 -06007 make check
8 make install
9
10and ignore the rest of this document.
11
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -050012If configure does not work on your system and you have a reasonably
13up-to-date set of tools, running ./autogen.sh before running ./configure
14may fix the problem. You can also run the individual commands in
15autogen.sh with the --force option, if supported by your version of
Glenn Randers-Pehrson66676012010-10-16 07:18:09 -050016the tools. To be really sure that you aren't using any of the included
17pre-built scripts, you can do this:
18
19 ../configure --enable-maintainer-mode
20 make maintainer-clean
21 ../configure [--prefix=/path] [other options]
22 make
23 make install
24 make check
Glenn Randers-Pehrson6bc53be2006-06-16 07:52:03 -050025
26Instead, you can use one of the custom-built makefiles in the
Glenn Randers-Pehrsonddfebd32006-02-22 09:19:25 -060027"scripts" directory
28
29 cp scripts/makefile.system makefile
30 make test
31 make install
32
Glenn Randers-Pehrson9d27a1b2009-11-15 07:59:06 -060033The files that are presently available in the scripts directory
34are listed and described in scripts/README.txt.
35
Glenn Randers-Pehrsonddfebd32006-02-22 09:19:25 -060036Or you can use one of the "projects" in the "projects" directory.
37
38Before installing libpng, you must first install zlib, if it
39is not already on your system. zlib can usually be found
40wherever you got libpng. zlib can be placed in another directory,
41at the same level as libpng.
42
Glenn Randers-Pehrson5b754aa2009-08-26 12:16:18 -050043If you want to use "cmake" (see www.cmake.org), type
Glenn Randers-Pehrson7edd4582006-12-07 19:16:44 -060044
45 cmake . -DCMAKE_INSTALL_PREFIX=/path
46 make
47 make install
48
Glenn Randers-Pehrsonddfebd32006-02-22 09:19:25 -060049If your system already has a preinstalled zlib you will still need
50to have access to the zlib.h and zconf.h include files that
51correspond to the version of zlib that's installed.
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060052
53You can rename the directories that you downloaded (they
Glenn Randers-Pehrson66676012010-10-16 07:18:09 -050054might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
55or "zlib125") so that you have directories called "zlib" and "libpng".
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060056
57Your directory structure should look like this:
58
59 .. (the parent directory)
60 libpng (this directory)
61 INSTALL (this file)
62 README
63 *.h
64 *.c
Glenn Randers-Pehrsonbe199c12009-11-12 13:57:42 -060065 CMakeLists.txt => "cmake" script
Glenn Randers-Pehrson22ad8f02009-11-14 07:25:31 -060066 configuration files:
67 configure.ac, configure, Makefile.am, Makefile.in,
Glenn Randers-Pehrson39515c92010-08-28 06:21:35 -050068 autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
69 libpng-config.in, aclocal.m4, config.h.in, config.sub,
Glenn Randers-Pehrson22ad8f02009-11-14 07:25:31 -060070 depcomp, install-sh, mkinstalldirs, test-pngtest.sh
Glenn Randers-Pehrson860ab2b1999-10-14 07:43:10 -050071 contrib
72 gregbook
Glenn Randers-Pehrsonbe199c12009-11-12 13:57:42 -060073 pngminim
Glenn Randers-Pehrson6d8f3b01999-10-23 08:39:18 -050074 pngminus
75 pngsuite
Glenn Randers-Pehrsondb66d442000-06-23 21:38:16 -050076 visupng
Glenn Randers-Pehrsonfbbb5ec2001-01-15 22:01:20 -060077 projects
Glenn Randers-Pehrsonbe199c12009-11-12 13:57:42 -060078 visualc71
Glenn Randers-Pehrson66676012010-10-16 07:18:09 -050079 vstudio
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060080 scripts
81 makefile.*
Glenn Randers-Pehrsonbe199c12009-11-12 13:57:42 -060082 *.def (module definition files)
Glenn Randers-Pehrson8c667862010-08-24 16:16:35 -050083 etc.
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -060084 pngtest.png
85 etc.
86 zlib
87 README
88 *.h
89 *.c
90 contrib
91 etc.
92
Glenn Randers-Pehrson61c32d92000-02-04 23:40:16 -060093If the line endings in the files look funny, you may wish to get the other
94distribution of libpng. It is available in both tar.gz (UNIX style line
95endings) and zip (DOS style line endings) formats.
96
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -060097If you are building libpng with MSVC, you can enter the
Glenn Randers-Pehrsonbe199c12009-11-12 13:57:42 -060098libpng projects\visualc6 or visualc71 directory and follow the instructions
99in README.txt.
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -0500100
Glenn Randers-Pehrsona2aebb52009-11-14 17:58:32 -0600101Otherwise enter the zlib directory and follow the instructions in zlib/README,
Glenn Randers-Pehrsonddfebd32006-02-22 09:19:25 -0600102then come back here and run "configure" or choose the appropriate
103makefile.sys in the scripts directory.
Glenn Randers-Pehrsondb66d442000-06-23 21:38:16 -0500104
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600105Copy the file (or files) that you need from the
106scripts directory into this directory, for example
107
Glenn Randers-Pehrson860ab2b1999-10-14 07:43:10 -0500108 MSDOS example: copy scripts\makefile.msc makefile
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600109 UNIX example: cp scripts/makefile.std makefile
110
111Read the makefile to see if you need to change any source or
112target directories to match your preferences.
113
114Then read pngconf.h to see if you want to make any configuration
115changes.
116
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600117Then just run "make" which will create the libpng library in
118this directory and "make test" which will run a quick test that reads
119the "pngtest.png" file and writes a "pngout.png" file that should be
120identical to it. Look for "9782 zero samples" in the output of the
121test. For more confidence, you can run another test by typing
122"pngtest pngnow.png" and looking for "289 zero samples" in the output.
123Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
Glenn Randers-Pehrson6d8f3b01999-10-23 08:39:18 -0500124your output with the result shown in contrib/pngsuite/README.
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600125
126Most of the makefiles will allow you to run "make install" to
127put the library in its final resting place (if you want to
128do that, run "make install" in the zlib directory first if necessary).
Glenn Randers-Pehrsond1e8c862002-06-20 06:54:34 -0500129Some also allow you to run "make test-installed" after you have
Glenn Randers-Pehrson0cc2f952002-10-03 06:32:37 -0500130run "make install".
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600131
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600132If you encounter a compiler error message complaining about the
133lines
Glenn Randers-Pehrson9d27a1b2009-11-15 07:59:06 -0600134
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600135 __png.h__ already includes setjmp.h;
136 __dont__ include it again.;
Glenn Randers-Pehrson9d27a1b2009-11-15 07:59:06 -0600137
138this means you have compiled another module that includes setjmp.h,
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600139which is hazardous because the two modules might not include exactly
140the same setjmp.h. If you are sure that you know what you are doing
141and that they are exactly the same, then you can comment out or
142delete the two lines. Better yet, use the cexcept interface
143instead, as demonstrated in contrib/visupng of the libpng distribution.
144
Glenn Randers-Pehrson08a33431998-03-07 06:06:55 -0600145Further information can be found in the README and libpng.txt
Glenn Randers-Pehrson9c3ab682006-02-20 22:09:05 -0600146files, in the individual makefiles, in png.h, and the manual pages
147libpng.3 and png.5.