I finally did get gd installed. My goal was to install the Perl module GD.pm, so that's what the last half of the instructions describe. For gd and the dependencies, I cheated, using Fink. The default Fink gd installation is configured to use X11 graphics libraries, and I don't know how to tell Fink not to do this "deluxe" gd installation, so this whole process takes longer than would a manual installation of libgd, libpng, and libjpeg. But using Fink was the only way I was able to get around some conflicts with the OS X dynamic library system.
If you don't have Fink, go to the Fink web site, and get the binary Fink installer. Double click the Fink installer, to install the Fink base system. In your home directory, add "source /sw/bin/init.csh" to the top of .cshrc (to place whatever Fink installs on your directory path). Then, make this change "live" by typing
source .cshrc
at the command prompt. To actually download gd and its dependencies, go
fink install gd
When the Fink installer dialog starts and asks which X11 option to use, say
3 for Xfree86-base. This means Fink will install tons of stuff.
If you have X11 and related libraries and know that they work and know how to tell Fink where to find them, then use options 1 or 2. But otherwise, 3 is probably safest.
Then Fink asks if you want to install a set of dependencies. Say "Y" to accept all.
Then let it chug for a few hours or over night.
Then get GD.pm from http://stein.cshl.org/WWW/software/GD/
Edit Makefile.PL , replacing the @INC and @LIBPATH lines with
my @INC = qw(-I/sw/include);
my @LIBPATH = qw(-L/sw/lib );
Then run "perl Makefile.PL" .
During the installer dialog, answer "y n n" to install GD only with jpeg support (not freetype or XPM).
Then "make test" and "sudo make install".
To test GD.pm, go into the demos folder in GD-1.33, choose and copy one of the demo files, and make these edits:
- change the #! line if necessary (probably to #!/usr/bin/perl )
- comment out the "binmode STDOUT" line
- open a file to write the .png file:
open (OUT, "> file_path/test_file.png")
or die "couldn't open file_path/test_file.png: $!";
- change the print line to:
print OUT $im->png;
Then see if test_file.png looks like a .png. That's it!