Index: /trunk/psconfig/pschecklibs.pl
===================================================================
--- /trunk/psconfig/pschecklibs.pl	(revision 14426)
+++ /trunk/psconfig/pschecklibs.pl	(revision 14426)
@@ -0,0 +1,435 @@
+#!/usr/bin/env perl
+
+$tagsets = "tagsets";
+
+# default system library locations
+# @libpath = ( "/lib", "/usr/lib", "/usr/X11R6/lib", "/usr/local/lib" );
+@libpath = ( "/lib/foo");
+@binpath = ( );
+@incpath = ( "/usr/include", "/usr/local/include", "/usr/X11R6/include" );
+
+$version = "";
+$build = 0;
+@tARGV = ();
+for (; @ARGV > 0; ) {
+    if ($ARGV[0] eq "-version") {
+	$version = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-build") {
+	$build = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-h")     { &usage (); }
+    if ($ARGV[0] eq "help")   { &usage (); }
+    if ($ARGV[0] eq "-help")  { &usage (); }
+    if ($ARGV[0] eq "--help") { &usage (); }
+    if ($ARGV[0] eq "-list")  { &list_distributions(); }
+    @tARGV = (@tARGV, $ARGV[0]);
+    shift;
+}
+@ARGV = @tARGV;
+if ( @ARGV > 1) { &usage(); }
+
+if ( @ARGV == 0) { 
+    @list = <$tagsets/*.libs>;
+    $file = $list[-1];
+} else {
+    $file = "$tagsets/$ARGV[0].libs";
+}
+print "examining C libraries based on $file\n\n";
+
+# load the C libraries list
+open (FILE, $file) || die "ERROR: can't open C libraries list: $file\n";
+@list = <FILE>;
+close (FILE);
+
+# set the psconfig version:
+if ("$version" eq "") {
+    $version = $ENV{'PSVERSION'};
+}
+if ("$version" eq "") {
+    $version = "default";
+}
+
+# set the lib and include paths set by psconfig
+$bindir      = `csh psconfig.csh --bin $version`;         chomp $bindir;
+$libdir      = `csh psconfig.csh --libs $version`;        chomp $libdir;
+$mandir      = `csh psconfig.csh --man $version`;         chomp $mandir;
+$incdir      = `csh psconfig.csh --include $version`;     chomp $incdir;
+$psconfigure = `csh psconfig.csh --psconfigure $version`; chomp $psconfigure;
+$prefix      = `csh psconfig.csh --prefix $version`;      chomp $prefix;
+$homedir     = `pwd`; chomp $homedir;
+
+print "psconfig version: $version\n";
+print "bindir: $bindir\n";
+print "libdir: $libdir\n";
+print "incdir: $incdir\n";
+print "mandir: $mandir\n";
+print "\n";
+
+# create the directories above if not found:
+if (! -e $libdir) { vsystem ("mkdir -p $libdir"); }
+if (! -e $incdir) { vsystem ("mkdir -p $incdir"); }
+if (! -e $bindir) { vsystem ("mkdir -p $bindir"); }
+if (! -e $mandir) { vsystem ("mkdir -p $mandir"); }
+if (! -e "$mandir/man1") { vsystem ("mkdir -p $mandir/man1"); }
+if (! -e "$mandir/man3") { vsystem ("mkdir -p $mandir/man3"); }
+
+# add the path defined by LIBRARY_PATH
+@tmppath = split (":", $ENV{'LIBRARY_PATH'});
+if (@tmppath) {
+    unshift @libpath, @tmppath;
+}
+# search for, and drop, existing libdir entry in libpath?
+unshift @libpath, $libdir;
+
+# add the path defined by PATH
+@tmppath = split (":", $ENV{'PATH'});
+if (@tmppath) {
+    unshift @binpath, @tmppath;
+}
+# search for, and drop, existing libdir entry in libpath?
+unshift @binpath, $bindir;
+
+# add the path defined by PATH
+@tmppath = split (":", $ENV{'CPATH'});
+if (@tmppath) {
+    unshift @incpath, @tmppath;
+}
+# search for, and drop, existing libdir entry in libpath?
+unshift @incpath, $incdir;
+
+# add the system paths specified for each architecture
+&checkarch ();
+print "setting architecture to: $arch\n"; 
+print "searching for libraries in: @libpath\n";
+print "searching for programs in: @binpath\n";
+print "\n";
+
+# read the lib distribution file, search / build each entry
+@faillibs = ();
+@failincs = ();
+foreach $line (@list) {
+    chop $line;
+    if ($line =~ m|^\s*$|) { next; }
+    if ($line =~ m|^\s*\#|) { next; }
+
+    ($type, $name, $altnames, $altpaths, $tarball, $tardir, $use_equals, $configure_opts, $make_opts, $install_opts) = split (" ", $line);
+    if (($use_equals ne "Y") && ($use_equals ne "N")) { die "invalid value for use_equals field\n"; }
+
+    ## check for the C library
+    if ($type eq "lib") { 
+	$found = &checklib ($name, $altnames, $altpaths);
+    } 
+    if ($type eq "bin") { 
+	$found = &checkbin ($name, $altnames, $altpaths);
+    }	
+    if ($type eq "inc") { 
+	$found = &checkinc ($name, $altnames, $altpaths);
+    }	
+
+    if ($found) {
+	print "pass $name ($found)\n";
+	next;
+    } else {
+	print "fail $name\n";
+	push @faillibs, "$name";
+    }	
+
+    if (! $build) { next; }
+    if ($type eq "inc") {
+	print "ERROR: missing header file from library which is supposedly installed\n";
+	next;
+    }
+
+    if ($tarball eq "NONE") {
+	print "ERROR: require tarball for $name\n";
+	exit 1;
+    }
+
+    ## try to build the module from ../../extlibs/$tarball
+
+    # go to extlibs and unpack the tarball
+    chdir "../../extlibs";
+
+    print "extract $name from $tarball\n";
+    vsystem ("tar xvzf $tarball");
+    
+    print "tardir: $tardir\n";
+
+    # enter the directory and build
+    chdir $tardir;
+
+    # build the library using psconfigure, make, make install
+    if ($configure_opts eq "NONE") { 
+	if ($use_equals eq "Y") {
+	    vsystem ("configure --prefix=$prefix");
+	} else {
+	    vsystem ("configure --prefix $prefix");
+	}
+    } else {
+	$configure_opts = join (' ', split (',', $configure_opts));
+	vsystem ("configure --prefix=$prefix $configure_opts");
+    }
+    if ($?) { &failure($name, "failure in configure"); }
+    
+    if ($make_opts eq "NONE") { 
+	vsystem ("make");
+    } else {
+	$make_opts = join (' ', split (',', $make_opts));
+	vsystem ("make $make_opts");
+    }
+    if ($?) { &failure($name, "failure in make"); }
+
+    if ($install_opts eq "NONE") {
+	vsystem ("make install");
+    } else {
+	$install_opts = join (' ', split (',', $install_opts));
+	vsystem ("make install $install_opts");
+    }
+    if ($?) { &failure($name, "failure in make install"); }
+
+    chdir $homedir;
+}
+if ($build) { exit 0; }
+print "\n";
+
+if (@faillibs > 0) {
+    print "The following C libraries are missing from your system\n";
+    foreach $name (@faillibs) {
+	print "  $name\n";
+    }
+    print "\n";
+    print "you may install them in your local path by re-running pschecklibs with -build\n";
+} else {
+    print "no C libraries are missing from your system\n";
+}
+exit 0;
+
+sub checklib {
+    my $name = $_[0];
+    my $altnames = $_[1];
+    my $altpaths = $_[2];
+    
+    @subdirs = ".";
+    if ($altpaths ne "NONE") {
+	@altpaths = split (',', $altpaths);
+	push @subdirs, @altpaths;
+    }
+    
+    @trynames = ($name);
+    if ($altnames ne "NONE") {
+	@altnames = split (',', $altnames);
+	push @trynames, @altnames;
+    }
+
+    # try each of the possible library names
+    foreach $tryname (@trynames) { 
+	# try each of the library paths, with the default as well as each altpath
+	foreach $topdir ( @libpath ) {
+	    foreach $subdir ( @subdirs ) {
+		if ($subdir eq ".") {
+		    $path = $topdir;
+		} else {
+		    $path = "$topdir/$subdir";
+		}
+		# print "trying $path\n";
+		if (! -e $path) { next; }
+		$libname = "$path/$tryname.a";
+		if (-e $libname) { return $libname; }
+		# print "no $libname\n";
+		$libname = "$path/$tryname.$dlltype";
+		if (-e $libname) { return $libname; }
+		# print "no $libname\n";
+	    }
+	}
+
+	# if we failed to find the basic named library files, try the
+	# versions libraries if we find only a .so.N without a matching
+	# .so, we link this in the installed libdir
+	foreach $topdir ( @libpath ) {
+	    foreach $subdir ( @subdirs ) {
+		if ($subdir eq ".") {
+		    $path = $topdir;
+		} else {
+		    $path = "$topdir/$subdir";
+		}
+		if (! -e $path) { next; }
+		@libnames = <$path/$tryname.$dlltype*>;
+		if (@libnames > 0) { 
+		    $libname = @libnames[-1];
+		    # print "making link to numbered .$dlltype library $libdir/$f.$dlltype\n";
+		    symlink $libname, "$libdir/$f.$dlltype";
+		    if ($?) { exit 1; }
+		    return $libname; 
+		}
+		# print "no $path/$tryname.$dlltype*\n";
+	    }
+	}
+    }
+    return 0;
+}
+
+sub checkbin {
+    my $name = $_[0];
+    my $altnames = $_[1];
+    my $altpaths = $_[2];
+    
+    # XXX drop this for bin?
+    @subdirs = ".";
+    if ($altpaths ne "NONE") {
+	@altpaths = split (',', $altpaths);
+	push @subdirs, @altpaths;
+    }
+    
+    # try each of the library paths, with the default as well as each altpath
+    foreach $topdir ( @binpath ) {
+	foreach $subdir ( @subdirs ) {
+	    if ($subdir eq ".") {
+		$path = $topdir;
+	    } else {
+		$path = "$topdir/$subdir";
+	    }
+	    # print "trying $path\n";
+	    if (! -e $path) { next; }
+	    $binname = "$path/$name";
+	    if (-e $binname) { return $binname; }
+	}
+    }
+    return 0;
+}
+
+sub checkinc {
+    my $name = $_[0];
+    my $altnames = $_[1];
+    my $altpaths = $_[2];
+    
+    @subdirs = ".";
+    if ($altpaths ne "NONE") {
+	@altpaths = split (',', $altpaths);
+	push @subdirs, @altpaths;
+    }
+    
+    # try each of the library paths, with the default as well as each altpath
+    foreach $topdir ( @incpath ) {
+	foreach $subdir ( @subdirs ) {
+	    if ($subdir eq ".") {
+		$path = $topdir;
+	    } else {
+		$path = "$topdir/$subdir";
+	    }
+	    if (! -e $path) { next; }
+	    $incname = "$path/$name";
+	    if (-e $incname) { return $incname; }
+	}
+    }
+
+    return 0;
+}
+
+sub checkarch {
+    # we are going to supplement the global libpath supplied
+    
+    # check the hardware architecture:
+    $sys=`uname -s`; chomp $sys;
+
+    # default values
+    $ranlib = "ranlib";
+    $dlltype = "so";
+
+    if ($sys eq "IRIX64") {
+	$arch = "irix";
+	return;
+    }
+
+    if ($sys eq "SunOS") {
+	$ver=`uname -r | awk '{print substr($1,1,1)}'`;
+	if ($ver == 5) {
+	    $arch = "sol";
+	} else {
+	    $arch="sun4";
+	}
+
+	# sun (at least) seems to need the socket library (linux does not)
+	push @libpath, "/usr/openwin/lib";
+	push @incpath, "/usr/openwin/include";
+
+	# XXX this is a problem
+	print STDERR "need to add system dependent libraries (eg, libsocket, libnsl)\n";
+	exit 1;
+	$needlibs = "$needlibs libsocket libnsl";
+	$ranlib = "touch";
+	return;
+    }
+
+    if ($sys eq "Linux") {
+	$arch = "linux";
+
+	if (-e "/etc/sidious.config") { 
+	    $arch = "sid";
+	    return;
+	}
+
+	$mach = `uname -m`; chomp $mach;
+
+	if ($mach eq "x86_64") {
+	    $arch = "lin64";
+	    unshift @libpath, "/lib64";
+	    unshift @libpath, "/usr/lib64";
+	    unshift @libpath, "/usr/X11R6/lib64";
+	    return;
+	}
+	return;
+    }
+
+    if ($sys eq "Darwin") {
+	$arch = "darwin";
+	$mach = `uname -m`; chomp $mach;
+	if ($mach == "i386") {
+	    $arch="darwin_x86";
+	} else {
+	    unshift @libpath, "/sw/lib";
+	    unshift @incpath, "/sw/include";
+	    unshift @incpath, "/usr/include/sys";
+	    $dlltype = "dylib";
+	}
+	return;
+    }
+
+    if ($sys eq "HP-UX") {
+	$arch = "hpux";
+	return;
+    }
+    
+    print "unknown architecture";
+    exit 1;
+}
+
+sub usage {
+    print STDERR "USAGE: pscheckperl [-version] [-build]\n";
+    exit 2;
+}
+
+sub vsystem {
+    print STDERR "@_\n";
+    $status = system ("@_");
+    $status;
+}
+
+sub list_distributions {
+    @list = <$tagsets/*.perl>;
+    foreach $line (@list) {
+	chomp $line;
+	($dist) = $line =~ m|$tagsets/(\S*).perl|;
+	print STDERR "$dist\n";
+    }
+    exit 2;
+}
+
+sub failure {
+    system ("ls");
+    die "problem building $_[0] : $_[1]\n";
+    print "\033]0; ** pschecklibs: failure  ** \007";
+}
+
Index: /trunk/psconfig/tagsets/ipp-2.2.libs
===================================================================
--- /trunk/psconfig/tagsets/ipp-2.2.libs	(revision 14426)
+++ /trunk/psconfig/tagsets/ipp-2.2.libs	(revision 14426)
@@ -0,0 +1,88 @@
+# this file defines C libraries and C headers needed by the ipp, and information on finding them
+
+# directories to search: /lib, /usr/lib, /usr/X11R6/lib, etc.
+# modifications based on the architecture (eg, PATH/lib64, etc)
+# additional locations based on the env variables
+# dlltype to use
+
+# each entry contains:
+#   type : lib / include
+#   name 
+#   alternate names
+#   alternate paths
+#   tarball name
+#   tar directory
+#   configure options
+#   make options
+#   make install options
+
+lib libm                 NONE           NONE   NONE                     NONE             Y NONE NONE NONE
+lib libX11               NONE           NONE   NONE                     NONE             Y NONE NONE NONE
+lib libpthread           NONE           NONE   NONE                     NONE             Y NONE NONE NONE
+lib libncurses           curses,termcap NONE   ncurses-5.6.tar.gz       ncurses-5.6      Y NONE NONE NONE
+lib libreadline          NONE           NONE   readline-5.2.tar.gz      readline-5.2     Y NONE NONE NONE
+lib libz                 NONE           NONE   zlib-1.2.3.tar.gz        zlib-1.2.3       Y --shared NONE NONE
+lib libpng               NONE           NONE   libpng-1.2.15.tar.gz     libpng-1.2.15    Y NONE NONE NONE
+lib libjpeg              NONE           jpeg   jpegsrc.v6b.tar.gz       jpeg-6b          Y NONE NONE install-lib
+lib libcfitsio           NONE           NONE   cfitsio2510.tar.gz       cfitsio          Y NONE NONE NONE
+lib libmysqlclient       NONE           mysql  mysql-5.0.27.tar.gz      mysql-5.0.27     Y NONE NONE NONE
+lib libgsl               NONE           NONE   gsl-1.6.tar.gz           gsl-1.6          Y NONE NONE NONE
+lib libfftw3f            NONE           NONE   fftw-3.0.1.tar.gz        fftw-3.0.1       Y --enable-float,--enable-shared,--disable-fortran NONE NONE
+
+bin pkg-config           NONE           NONE   pkg-config-0.22.tar.gz   pkg-config-0.22  Y NONE NONE NONE
+
+inc X11/Xatom.h          NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc X11/Xlib.h           NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc X11/Xresource.h      NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc X11/Xutil.h          NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc X11/cursorfont.h     NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc X11/keysym.h         NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc X11/keysymdef.h      NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc arpa/inet.h          NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc assert.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc complex.h            NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc ctype.h              NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc errno.h              NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc fcntl.h              NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc fitsio.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc glob.h               NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc gsl/gsl_randist.h    NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc gsl/gsl_rng.h        NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc inttypes.h           NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc jpeglib.h            NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc limits.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc malloc.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc math.h               NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc memory.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc netdb.h              NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc netinet/ip.h         NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc png.h                NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc pthread.h            NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc readline/history.h   NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc readline/readline.h  NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc regex.h              NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc signal.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc stdint.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc stdio.h              NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc stdlib.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc string.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/ipc.h            NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/resource.h       NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/sem.h            NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/socket.h         NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/stat.h           NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/time.h           NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/types.h          NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/uio.h            NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/un.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc sys/wait.h           NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc time.h               NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc unistd.h             NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+inc zlib.h               NONE           NONE   NONE                     NONE             N NONE NONE NONE 
+
+# xml is currently not used by IPP
+# lib xml2       NONE           NONE   NONE                     NONE             Y NONE NONE NONE
+
+# doxygen is having some unknown build issues on alala
+# bin doxygen            NONE NONE doxygen-1.5.1.src.tar.gz doxygen-1.5.1    N NONE NONE NONE
+
