zlibとlibpngをMac OS X 10.5.8 Lepord 、Xcode 3.1.3の環境でビルド

zlib-1.2.3

ディレクトリ内のファイル
$ ls
ChangeLog	algorithm.txt	crc32.h		inffast.c	make_vms.com	trees.h		zutil.c
FAQ		amiga		deflate.c	inffast.h	minigzip.c	uncompr.c	zutil.h
INDEX		as400		deflate.h	inffixed.h	msdos		win32
Makefile	compress.c	example.c	inflate.c	old		zconf.h
Makefile.in	configure	examples	inflate.h	projects	zconf.in.h
README		contrib		gzio.c		inftrees.c	qnx		zlib.3
adler32.c	crc32.c		infback.c	inftrees.h	trees.c		zlib.h
./configure
$ ./configure
Checking for gcc...
Building static library libz.a version 1.2.3 with gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.
make
Atotok-iMac:zlib-1.2.3 kuru$ make
gcc -O3 -DUSE_MMAP   -c -o example.o example.c
gcc -O3 -DUSE_MMAP   -c -o adler32.o adler32.c
gcc -O3 -DUSE_MMAP   -c -o compress.o compress.c
gcc -O3 -DUSE_MMAP   -c -o crc32.o crc32.c
gcc -O3 -DUSE_MMAP   -c -o gzio.o gzio.c
gcc -O3 -DUSE_MMAP   -c -o uncompr.o uncompr.c
gcc -O3 -DUSE_MMAP   -c -o deflate.o deflate.c
gcc -O3 -DUSE_MMAP   -c -o trees.o trees.c
gcc -O3 -DUSE_MMAP   -c -o zutil.o zutil.c
gcc -O3 -DUSE_MMAP   -c -o inflate.o inflate.c
gcc -O3 -DUSE_MMAP   -c -o infback.o infback.c
gcc -O3 -DUSE_MMAP   -c -o inftrees.o inftrees.c
gcc -O3 -DUSE_MMAP   -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o 
gcc -O3 -DUSE_MMAP -o example example.o -L. libz.a
gcc -O3 -DUSE_MMAP   -c -o minigzip.o minigzip.c
gcc -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.a
sudo make install
$ sudo make install

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.a /usr/local/lib
cd /usr/local/lib; chmod 755 libz.a
cd /usr/local/lib; if test -f libz.1.2.3.dylib; then \
	  rm -f libz.dylib libz.1.dylib; \
	  ln -s libz.1.2.3.dylib libz.dylib; \
	  ln -s libz.1.2.3.dylib libz.1.dylib; \
	  (ldconfig || true)  >/dev/null 2>&1; \
	fi
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
ls -al /usr/local/lib
Atotok-iMac:zlib-1.2.3 kuru$ ls -al /usr/local/lib
total 184
drwxr-xr-x  3 root  wheel    102  9 14 15:45 .
drwxr-xr-x  5 root  wheel    170  9 14 15:45 ..
-rw-r--r--  1 root  wheel  91128  9 14 15:45 libz.a
make distclean
Atotok-iMac:zlib-1.2.3 kuru$ make distclean
rm -f *.o *~ example minigzip \
	   libz.* foo.gz so_locations \
	   _match.s maketree contrib/infback9/*.o
cp -p Makefile.in Makefile
cp -p zconf.in.h zconf.h
rm -f .DS_Store
./configure --shared
Atotok-iMac:zlib-1.2.3 kuru$ ./configure --shared
Checking for gcc...
Checking for shared library support...
Building shared library libz.1.2.3.dylib with gcc.
Checking for unistd.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for errno.h... Yes.
Checking for mmap support... Yes.
make
Atotok-iMac:zlib-1.2.3 kuru$ make
gcc -fPIC -O3 -DUSE_MMAP   -c -o example.o example.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o adler32.o adler32.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o compress.o compress.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o crc32.o crc32.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o gzio.o gzio.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o uncompr.o uncompr.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o deflate.o deflate.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o trees.o trees.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o zutil.o zutil.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o inflate.o inflate.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o infback.o infback.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o inftrees.o inftrees.c
gcc -fPIC -O3 -DUSE_MMAP   -c -o inffast.o inffast.c
gcc -dynamiclib -install_name /usr/local/lib/libz.1.dylib -compatibility_version 1 -current_version 1.2.3 -o libz.1.2.3.dylib adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
rm -f libz.dylib libz.1.dylib
ln -s libz.1.2.3.dylib libz.dylib
ln -s libz.1.2.3.dylib libz.1.dylib
gcc -fPIC -O3 -DUSE_MMAP -o example example.o -L. libz.1.2.3.dylib
gcc -fPIC -O3 -DUSE_MMAP   -c -o minigzip.o minigzip.c
gcc -fPIC -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.1.2.3.dylib
Atotok-iMac:zlib-1.2.3 kuru$ ls -al /usr/local/lib
total 184
drwxr-xr-x  3 root  wheel    102  9 14 15:45 .
drwxr-xr-x  5 root  wheel    170  9 14 15:45 ..
-rw-r--r--  1 root  wheel  91128  9 14 15:45 libz.a
sudo make install
Atotok-iMac:zlib-1.2.3 kuru$ sudo make install
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.1.2.3.dylib /usr/local/lib
cd /usr/local/lib; chmod 755 libz.1.2.3.dylib
cd /usr/local/lib; if test -f libz.1.2.3.dylib; then \
	  rm -f libz.dylib libz.1.dylib; \
	  ln -s libz.1.2.3.dylib libz.dylib; \
	  ln -s libz.1.2.3.dylib libz.1.dylib; \
	  (ldconfig || true)  >/dev/null 2>&1; \
	fi
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
ls -al /usr/local/lib
$ ls -al /usr/local/lib
total 384
drwxr-xr-x  6 root  wheel    204  9 14 15:47 .
drwxr-xr-x  5 root  wheel    170  9 14 15:45 ..
-rwxr-xr-x  1 root  wheel  90944  9 14 15:47 libz.1.2.3.dylib
lrwxr-xr-x  1 root  wheel     16  9 14 15:47 libz.1.dylib -> libz.1.2.3.dylib
-rw-r--r--  1 root  wheel  91128  9 14 15:47 libz.a
lrwxr-xr-x  1 root  wheel     16  9 14 15:47 libz.dylib -> libz.1.2.3.dylib

libpng-1.2.12

ディレクトリ内のファイル
$ ls
ANNOUNCE	aclocal.m4	depcomp		mkinstalldirs	pngnow.png	pngwio.c
CHANGES		autogen.sh	example.c	png.5		pngpread.c	pngwrite.c
INSTALL		config.guess	install-sh	png.c		pngread.c	pngwtran.c
KNOWNBUG	config.h	libpng-config	png.h		pngrio.c	pngwutil.c
LICENSE		config.h.in	libpng.3	pngbar.jpg	pngrtran.c	projects
Makefile	config.log	libpng.pc	pngbar.png	pngrutil.c	scripts
Makefile.am	config.status	libpng.txt	pngconf.h	pngset.c	stamp-h1
Makefile.in	config.sub	libpngpf.3	pngerror.c	pngtest.c	test-pngtest.sh
README		configure	libtool		pnggccrd.c	pngtest.png
TODO		configure.ac	ltmain.sh	pngget.c	pngtrans.c
Y2KINFO		contrib		missing		pngmem.c	pngvc
./configure
$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... i386-apple-darwin9.8.0
checking host system type... i386-apple-darwin9.8.0

   ・
   ・
   ・
   ・

checking whether the g++ linker (/usr/libexec/gcc/i686-apple-darwin9/4.0.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin9.8.0 dyld
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for ANSI C header files... (cached) yes
checking malloc.h usability... no
checking malloc.h presence... no
checking for malloc.h... no
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for working strtod... yes
checking for memset... yes
checking for pow... yes
checking for zlibVersion in -lz... yes
checking if assembler code in pnggccrd.c can be compiled... yes
checking if libraries can be versioned... no
configure: WARNING: *** You have not enabled versioned symbols.
configure: pkgconfig directory is ${libdir}/pkgconfig
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libpng.pc
config.status: creating libpng-config
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
make
$ make
make  all-am
if /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I. -I.  -DPNG_CONFIGURE_LIBPNG   -g -O2 -MT libpng12_la-png.lo -MD -MP -MF ".deps/libpng12_la-png.Tpo" -c -o libpng12_la-png.lo `test -f 'png.c' || echo './'`png.c; \
	then mv -f ".deps/libpng12_la-png.Tpo" ".deps/libpng12_la-png.Plo"; else rm -f ".deps/libpng12_la-png.Tpo"; exit 1; fi
mkdir .libs

   ・
   ・
   ・
   ・
   ・

 /usr/bin/install -c -m 644 'libpng12.pc' '/usr/local/lib/pkgconfig/libpng12.pc'
test -z "/usr/local/include/libpng12" || /bin/sh ./mkinstalldirs "/usr/local/include/libpng12"
mkdir /usr/local/include/libpng12
 /usr/bin/install -c -m 644 'png.h' '/usr/local/include/libpng12/png.h'
 /usr/bin/install -c -m 644 'pngconf.h' '/usr/local/include/libpng12/pngconf.h'
make  install-data-hook
cd /usr/local/include; rm -f png.h pngconf.h
cd /usr/local/include; ln -s libpng12/png.h png.h
cd /usr/local/include; ln -s libpng12/pngconf.h pngconf.h
cd /usr/local/lib/pkgconfig; rm -f libpng.pc
cd /usr/local/lib/pkgconfig; ln -s libpng12.pc libpng.pc
sudo make install
$ sudo make install
cp zlib.h zconf.h /usr/local/include
chmod 644 /usr/local/include/zlib.h /usr/local/include/zconf.h
cp libz.1.2.3.dylib /usr/local/lib
cd /usr/local/lib; chmod 755 libz.1.2.3.dylib
cd /usr/local/lib; if test -f libz.1.2.3.dylib; then \
	  rm -f libz.dylib libz.1.dylib; \
	  ln -s libz.1.2.3.dylib libz.dylib; \
	  ln -s libz.1.2.3.dylib libz.1.dylib; \
	  (ldconfig || true)  >/dev/null 2>&1; \
	fi
cp zlib.3 /usr/local/share/man/man3
chmod 644 /usr/local/share/man/man3/zlib.3
ls -al /usr/local/lib
$ ls -al /usr/local/lib
total 2600
drwxr-xr-x  18 root  wheel     612  9 14 15:49 .
drwxr-xr-x   7 root  wheel     238  9 14 15:49 ..
-rwxr-xr-x   1 root  wheel  189640  9 14 15:49 libpng.3.12.0.dylib
lrwxr-xr-x   1 root  wheel      19  9 14 15:49 libpng.3.dylib -> libpng.3.12.0.dylib
lrwxr-xr-x   1 root  wheel      10  9 14 15:49 libpng.a -> libpng12.a
lrwxr-xr-x   1 root  wheel      19  9 14 15:49 libpng.dylib -> libpng.3.12.0.dylib
lrwxr-xr-x   1 root  wheel      11  9 14 15:49 libpng.la -> libpng12.la
lrwxr-xr-x   1 root  wheel      11  9 14 15:49 libpng.so -> libpng12.so
-rwxr-xr-x   1 root  wheel  189972  9 14 15:49 libpng12.0.12.0.dylib
lrwxr-xr-x   1 root  wheel      21  9 14 15:49 libpng12.0.dylib -> libpng12.0.12.0.dylib
-rw-r--r--   1 root  wheel  713824  9 14 15:49 libpng12.a
lrwxr-xr-x   1 root  wheel      21  9 14 15:49 libpng12.dylib -> libpng12.0.12.0.dylib
-rwxr-xr-x   1 root  wheel     818  9 14 15:49 libpng12.la
-rwxr-xr-x   1 root  wheel   90944  9 14 15:47 libz.1.2.3.dylib
lrwxr-xr-x   1 root  wheel      16  9 14 15:47 libz.1.dylib -> libz.1.2.3.dylib
-rw-r--r--   1 root  wheel   91128  9 14 15:47 libz.a
lrwxr-xr-x   1 root  wheel      16  9 14 15:47 libz.dylib -> libz.1.2.3.dylib
drwxr-xr-x   4 root  wheel     136  9 14 15:49 pkgconfig