Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 1 | |
Glenn Randers-Pehrson | 6667601 | 2010-10-16 07:18:09 -0500 | [diff] [blame^] | 2 | Installing libpng |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 3 | |
Glenn Randers-Pehrson | ddfebd3 | 2006-02-22 09:19:25 -0600 | [diff] [blame] | 4 | On Unix/Linux and similar systems, you can simply type |
| 5 | |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 6 | ./configure [--prefix=/path] |
Glenn Randers-Pehrson | ddfebd3 | 2006-02-22 09:19:25 -0600 | [diff] [blame] | 7 | make check |
| 8 | make install |
| 9 | |
| 10 | and ignore the rest of this document. |
| 11 | |
Glenn Randers-Pehrson | 6bc53be | 2006-06-16 07:52:03 -0500 | [diff] [blame] | 12 | If configure does not work on your system and you have a reasonably |
| 13 | up-to-date set of tools, running ./autogen.sh before running ./configure |
| 14 | may fix the problem. You can also run the individual commands in |
| 15 | autogen.sh with the --force option, if supported by your version of |
Glenn Randers-Pehrson | 6667601 | 2010-10-16 07:18:09 -0500 | [diff] [blame^] | 16 | the tools. To be really sure that you aren't using any of the included |
| 17 | pre-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-Pehrson | 6bc53be | 2006-06-16 07:52:03 -0500 | [diff] [blame] | 25 | |
| 26 | Instead, you can use one of the custom-built makefiles in the |
Glenn Randers-Pehrson | ddfebd3 | 2006-02-22 09:19:25 -0600 | [diff] [blame] | 27 | "scripts" directory |
| 28 | |
| 29 | cp scripts/makefile.system makefile |
| 30 | make test |
| 31 | make install |
| 32 | |
Glenn Randers-Pehrson | 9d27a1b | 2009-11-15 07:59:06 -0600 | [diff] [blame] | 33 | The files that are presently available in the scripts directory |
| 34 | are listed and described in scripts/README.txt. |
| 35 | |
Glenn Randers-Pehrson | ddfebd3 | 2006-02-22 09:19:25 -0600 | [diff] [blame] | 36 | Or you can use one of the "projects" in the "projects" directory. |
| 37 | |
| 38 | Before installing libpng, you must first install zlib, if it |
| 39 | is not already on your system. zlib can usually be found |
| 40 | wherever you got libpng. zlib can be placed in another directory, |
| 41 | at the same level as libpng. |
| 42 | |
Glenn Randers-Pehrson | 5b754aa | 2009-08-26 12:16:18 -0500 | [diff] [blame] | 43 | If you want to use "cmake" (see www.cmake.org), type |
Glenn Randers-Pehrson | 7edd458 | 2006-12-07 19:16:44 -0600 | [diff] [blame] | 44 | |
| 45 | cmake . -DCMAKE_INSTALL_PREFIX=/path |
| 46 | make |
| 47 | make install |
| 48 | |
Glenn Randers-Pehrson | ddfebd3 | 2006-02-22 09:19:25 -0600 | [diff] [blame] | 49 | If your system already has a preinstalled zlib you will still need |
| 50 | to have access to the zlib.h and zconf.h include files that |
| 51 | correspond to the version of zlib that's installed. |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 52 | |
| 53 | You can rename the directories that you downloaded (they |
Glenn Randers-Pehrson | 6667601 | 2010-10-16 07:18:09 -0500 | [diff] [blame^] | 54 | might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5" |
| 55 | or "zlib125") so that you have directories called "zlib" and "libpng". |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 56 | |
| 57 | Your 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-Pehrson | be199c1 | 2009-11-12 13:57:42 -0600 | [diff] [blame] | 65 | CMakeLists.txt => "cmake" script |
Glenn Randers-Pehrson | 22ad8f0 | 2009-11-14 07:25:31 -0600 | [diff] [blame] | 66 | configuration files: |
| 67 | configure.ac, configure, Makefile.am, Makefile.in, |
Glenn Randers-Pehrson | 39515c9 | 2010-08-28 06:21:35 -0500 | [diff] [blame] | 68 | autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in, |
| 69 | libpng-config.in, aclocal.m4, config.h.in, config.sub, |
Glenn Randers-Pehrson | 22ad8f0 | 2009-11-14 07:25:31 -0600 | [diff] [blame] | 70 | depcomp, install-sh, mkinstalldirs, test-pngtest.sh |
Glenn Randers-Pehrson | 860ab2b | 1999-10-14 07:43:10 -0500 | [diff] [blame] | 71 | contrib |
| 72 | gregbook |
Glenn Randers-Pehrson | be199c1 | 2009-11-12 13:57:42 -0600 | [diff] [blame] | 73 | pngminim |
Glenn Randers-Pehrson | 6d8f3b0 | 1999-10-23 08:39:18 -0500 | [diff] [blame] | 74 | pngminus |
| 75 | pngsuite |
Glenn Randers-Pehrson | db66d44 | 2000-06-23 21:38:16 -0500 | [diff] [blame] | 76 | visupng |
Glenn Randers-Pehrson | fbbb5ec | 2001-01-15 22:01:20 -0600 | [diff] [blame] | 77 | projects |
Glenn Randers-Pehrson | be199c1 | 2009-11-12 13:57:42 -0600 | [diff] [blame] | 78 | visualc71 |
Glenn Randers-Pehrson | 6667601 | 2010-10-16 07:18:09 -0500 | [diff] [blame^] | 79 | vstudio |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 80 | scripts |
| 81 | makefile.* |
Glenn Randers-Pehrson | be199c1 | 2009-11-12 13:57:42 -0600 | [diff] [blame] | 82 | *.def (module definition files) |
Glenn Randers-Pehrson | 8c66786 | 2010-08-24 16:16:35 -0500 | [diff] [blame] | 83 | etc. |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 84 | pngtest.png |
| 85 | etc. |
| 86 | zlib |
| 87 | README |
| 88 | *.h |
| 89 | *.c |
| 90 | contrib |
| 91 | etc. |
| 92 | |
Glenn Randers-Pehrson | 61c32d9 | 2000-02-04 23:40:16 -0600 | [diff] [blame] | 93 | If the line endings in the files look funny, you may wish to get the other |
| 94 | distribution of libpng. It is available in both tar.gz (UNIX style line |
| 95 | endings) and zip (DOS style line endings) formats. |
| 96 | |
Glenn Randers-Pehrson | 9c3ab68 | 2006-02-20 22:09:05 -0600 | [diff] [blame] | 97 | If you are building libpng with MSVC, you can enter the |
Glenn Randers-Pehrson | be199c1 | 2009-11-12 13:57:42 -0600 | [diff] [blame] | 98 | libpng projects\visualc6 or visualc71 directory and follow the instructions |
| 99 | in README.txt. |
Glenn Randers-Pehrson | d436672 | 2000-06-04 14:29:29 -0500 | [diff] [blame] | 100 | |
Glenn Randers-Pehrson | a2aebb5 | 2009-11-14 17:58:32 -0600 | [diff] [blame] | 101 | Otherwise enter the zlib directory and follow the instructions in zlib/README, |
Glenn Randers-Pehrson | ddfebd3 | 2006-02-22 09:19:25 -0600 | [diff] [blame] | 102 | then come back here and run "configure" or choose the appropriate |
| 103 | makefile.sys in the scripts directory. |
Glenn Randers-Pehrson | db66d44 | 2000-06-23 21:38:16 -0500 | [diff] [blame] | 104 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 105 | Copy the file (or files) that you need from the |
| 106 | scripts directory into this directory, for example |
| 107 | |
Glenn Randers-Pehrson | 860ab2b | 1999-10-14 07:43:10 -0500 | [diff] [blame] | 108 | MSDOS example: copy scripts\makefile.msc makefile |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 109 | UNIX example: cp scripts/makefile.std makefile |
| 110 | |
| 111 | Read the makefile to see if you need to change any source or |
| 112 | target directories to match your preferences. |
| 113 | |
| 114 | Then read pngconf.h to see if you want to make any configuration |
| 115 | changes. |
| 116 | |
Glenn Randers-Pehrson | 9c3ab68 | 2006-02-20 22:09:05 -0600 | [diff] [blame] | 117 | Then just run "make" which will create the libpng library in |
| 118 | this directory and "make test" which will run a quick test that reads |
| 119 | the "pngtest.png" file and writes a "pngout.png" file that should be |
| 120 | identical to it. Look for "9782 zero samples" in the output of the |
| 121 | test. For more confidence, you can run another test by typing |
| 122 | "pngtest pngnow.png" and looking for "289 zero samples" in the output. |
| 123 | Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare |
Glenn Randers-Pehrson | 6d8f3b0 | 1999-10-23 08:39:18 -0500 | [diff] [blame] | 124 | your output with the result shown in contrib/pngsuite/README. |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 125 | |
| 126 | Most of the makefiles will allow you to run "make install" to |
| 127 | put the library in its final resting place (if you want to |
| 128 | do that, run "make install" in the zlib directory first if necessary). |
Glenn Randers-Pehrson | d1e8c86 | 2002-06-20 06:54:34 -0500 | [diff] [blame] | 129 | Some also allow you to run "make test-installed" after you have |
Glenn Randers-Pehrson | 0cc2f95 | 2002-10-03 06:32:37 -0500 | [diff] [blame] | 130 | run "make install". |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 131 | |
Glenn Randers-Pehrson | 9c3ab68 | 2006-02-20 22:09:05 -0600 | [diff] [blame] | 132 | If you encounter a compiler error message complaining about the |
| 133 | lines |
Glenn Randers-Pehrson | 9d27a1b | 2009-11-15 07:59:06 -0600 | [diff] [blame] | 134 | |
Glenn Randers-Pehrson | 9c3ab68 | 2006-02-20 22:09:05 -0600 | [diff] [blame] | 135 | __png.h__ already includes setjmp.h; |
| 136 | __dont__ include it again.; |
Glenn Randers-Pehrson | 9d27a1b | 2009-11-15 07:59:06 -0600 | [diff] [blame] | 137 | |
| 138 | this means you have compiled another module that includes setjmp.h, |
Glenn Randers-Pehrson | 9c3ab68 | 2006-02-20 22:09:05 -0600 | [diff] [blame] | 139 | which is hazardous because the two modules might not include exactly |
| 140 | the same setjmp.h. If you are sure that you know what you are doing |
| 141 | and that they are exactly the same, then you can comment out or |
| 142 | delete the two lines. Better yet, use the cexcept interface |
| 143 | instead, as demonstrated in contrib/visupng of the libpng distribution. |
| 144 | |
Glenn Randers-Pehrson | 08a3343 | 1998-03-07 06:06:55 -0600 | [diff] [blame] | 145 | Further information can be found in the README and libpng.txt |
Glenn Randers-Pehrson | 9c3ab68 | 2006-02-20 22:09:05 -0600 | [diff] [blame] | 146 | files, in the individual makefiles, in png.h, and the manual pages |
| 147 | libpng.3 and png.5. |