Index: /trunk/psconfig/INSTALL
===================================================================
--- /trunk/psconfig/INSTALL	(revision 12838)
+++ /trunk/psconfig/INSTALL	(revision 12839)
@@ -22,5 +22,5 @@
 following line in ~/.psconfigrc (otherwise not needed):
 
-set PSCONFIG = INSTALL_PATH
+set PSCONFDIR = INSTALL_PATH
 
 where INSTALL_PATH is the top-level directory for all binary
Index: /trunk/psconfig/pschecklibs
===================================================================
--- /trunk/psconfig/pschecklibs	(revision 12838)
+++ /trunk/psconfig/pschecklibs	(revision 12839)
@@ -31,10 +31,14 @@
 endif
 
-# set paths for PSVERSION
+# set install paths for PSVERSION
 set libdir  = `source psconfig.sh --libs $PSVERSION`
 set incdir  = `source psconfig.sh --include $PSVERSION`
 
+# make these directories
+mkdir -p $libdir
+mkdir -p $incdir
+
 # I supplement this list with LD_LIBRARY_PATH below
-set syslibpath = "/lib /usr/lib /usr/X11R6/lib /usr/openwin/lib /usr/local/lib"
+set syslibpath = "/lib /usr/lib /usr/X11R6/lib /usr/local/lib "
 set needlibs   = ""
 set needlibs   = "$needlibs png"
@@ -52,7 +56,6 @@
 set needlibs   = "$needlibs m"
 
-# /usr/local/include/libpng is really pretty lame...
-set sysincpath = "/usr/include /usr/local/include /usr/X11R6/include /usr/openwin/include /usr/local/include/libpng"
-
+# I supplement this list with CPATH below
+set sysincpath = "/usr/include /usr/local/include /usr/X11R6/include "
 set needincs = ""
 set needincs = "$needincs X11/Xatom.h"
@@ -103,8 +106,8 @@
 set needincs = "$needincs time.h"
 set needincs = "$needincs unistd.h"
-set needincs = "$needincs values.h"
 set needincs = "$needincs zlib.h"
 
 # XXX need to have options for non-ANSI includes? (ie, varargs.h)
+# set needincs = "$needincs values.h" - this only provides values already defined in limits.h?
 # set needincs = "$needincs libxml/parser.h"
 # set needincs = "$needincs cfuncs.h" - from non-ANSI option in ohana.h
@@ -118,4 +121,5 @@
 set sys=`uname -s` 
 set ranlib = "ranlib"
+set dlltype = "so"
 switch ($sys)
  case IRIX64:
@@ -130,4 +134,6 @@
    endif
    # sun (at least) seems to need the socket library (linux does not)
+   set syslibpath = "$syslibpath /usr/openwin/lib"
+   set sysincpath = "$sysincpath /usr/openwin/include"
    set needlibs = "$needlibs libsocket libnsl"
    set ranlib = "touch"
@@ -141,4 +147,14 @@
     set syslibpath = "/lib64 /usr/lib64 /usr/X11R6/lib64 $syslibpath"
    endif
+   breaksw;
+ case Darwin:
+   set arch="darwin";
+   set mach=`uname -m`
+   if ("$mach" == "i386") then
+    set arch="darwin_x86";
+   endif
+   set syslibpath = "$syslibpath /sw/lib /usr/local/lib/mysql"
+   set sysincpath = "$sysincpath /sw/include /usr/include/sys"
+   set dlltype = dylib
    breaksw;
  case HP-UX:
@@ -169,8 +185,20 @@
     foreach g ( $libdir $libpath $syslibpath )
         if (! -e $g) continue
-	set name = $g/lib$f.a
-	if (-e $name[1]) goto got_lib;
-	set name = $g/lib$f.so*
-	if (-e $name[1]) goto got_lib;
+        set name = $g/lib$f.a
+        if (-e $name[1]) goto got_lib;
+        set name = $g/lib$f.$dlltype
+        if (-e $name[1]) goto got_lib;
+    end
+    # if we find a .so.N without a matching .so, we link this in
+    # the installed libdir
+    foreach g ( $libpath $syslibpath )
+        set name = $g/lib$f.$dlltype*
+        echo "libname: $name"
+        if (-e $name[1]) then
+          echo "making link to numbers .$dlltype library $libdir/lib$f.$dlltype"
+          ln -s $name[$#name] $libdir/lib$f.$dlltype
+          if ($status) exit 1
+          goto got_lib
+        endif
     end
     echo "missing lib$f"
@@ -185,8 +213,18 @@
 foreach f ( ncurses curses termcap )
     foreach g ( $libdir $libpath $syslibpath )
-	set name = $g/lib$f.a
-	if (-e $name[1]) goto got_curses;
-	set name = $g/lib$f.so*
-	if (-e $name[1]) goto got_curses;
+        set name = $g/lib$f.a
+        if (-e $name[1]) goto got_curses;
+        set name = $g/lib$f.$dlltype
+        if (-e $name[1]) goto got_curses;
+    end
+    # if we find a .so.N without a matching .so, we link this in
+    # the installed libdir
+    foreach g ( $libpath $syslibpath )
+        set name = $g/lib$f.$dlltype*
+        if ($#name > 0) then
+          echo "making link to numbers .$dlltype library $libdir/lib$f.$dlltype"
+          ln -s $name[$#name] $libdir/lib$f.$dlltype
+          goto got_curses;
+        endif
     end
 end
Index: /trunk/psconfig/psconfig.bash
===================================================================
--- /trunk/psconfig/psconfig.bash	(revision 12838)
+++ /trunk/psconfig/psconfig.bash	(revision 12839)
@@ -1,8 +1,10 @@
 # this script sets the PS IPP build environment for BASH shell users
 
-INSTALL=/home/kiawe/eugene/src.alala/panstarrs/ipp/psconfig
+if [ -z $INSTALL ]; then
+  INSTALL=/home/kiawe/eugene/src.alala/panstarrs/ipp/psconfig
+fi
 
 if (( $# == 0 )); then
-  /bin/csh $INSTALL/psconfig.sh
+  /bin/csh $INSTALL/psconfig.csh
   return 0
 fi
@@ -14,7 +16,7 @@
 
 version=$1
-psconfigure=`/bin/csh $INSTALL/psconfig.sh --psconfigure $version`
-psautogen=`/bin/csh $INSTALL/psconfig.sh --psautogen $version`
-psperlbuild=`/bin/csh $INSTALL/psconfig.sh --psperlbuild $version`
+psconfigure=`/bin/csh $INSTALL/psconfig.csh --psconfigure $version`
+psautogen=`/bin/csh $INSTALL/psconfig.csh --psautogen $version`
+psperlbuild=`/bin/csh $INSTALL/psconfig.csh --psperlbuild $version`
 alias psconfigure=$psconfigure
 alias psautogen=$psautogen
@@ -22,12 +24,12 @@
 
 # psconfig env variables
-export PSCONFDIR=`/bin/csh $INSTALL/psconfig.sh --psconfdir $version`
-export PSVERSION=`/bin/csh $INSTALL/psconfig.sh --psversion $version`
+export PSCONFDIR=`/bin/csh $INSTALL/psconfig.csh --psconfdir $version`
+export PSVERSION=`/bin/csh $INSTALL/psconfig.csh --psversion $version`
 
 # environment variables
-export PATH=`/bin/csh $INSTALL/psconfig.sh --path $version`
-export ARCH=`/bin/csh $INSTALL/psconfig.sh --arch $version`
-export LD_LIBRARY_PATH=`/bin/csh $INSTALL/psconfig.sh --ld_library_path $version`
-export PKG_CONFIG_PATH=`/bin/csh $INSTALL/psconfig.sh --pkg_config_path $version`
-export ACLOCAL_FLAGS=`/bin/csh $INSTALL/psconfig.sh --aclocal_flags $version`
-export PERL5LIB=`/bin/csh $INSTALL/psconfig.sh --perl5lib $version`
+export PATH=`/bin/csh $INSTALL/psconfig.csh --path $version`
+export ARCH=`/bin/csh $INSTALL/psconfig.csh --arch $version`
+export LD_LIBRARY_PATH=`/bin/csh $INSTALL/psconfig.csh --ld_library_path $version`
+export PKG_CONFIG_PATH=`/bin/csh $INSTALL/psconfig.csh --pkg_config_path $version`
+export ACLOCAL_FLAGS=`/bin/csh $INSTALL/psconfig.csh --aclocal_flags $version`
+export PERL5LIB=`/bin/csh $INSTALL/psconfig.csh --perl5lib $version`
Index: /trunk/psconfig/psconfig.csh
===================================================================
--- /trunk/psconfig/psconfig.csh	(revision 12839)
+++ /trunk/psconfig/psconfig.csh	(revision 12839)
@@ -0,0 +1,460 @@
+#/bin/csh -f
+# this file is sourced using the command 'psconfig'
+
+# list the defined psconfig versions
+set show_prefix = 0
+set show_libs = 0
+set show_bin = 0
+set show_arch = 0
+set show_path = 0
+set show_include = 0
+set show_configure = 0
+set show_autogen = 0
+set show_perlbuild = 0
+set show_perldir = 0
+set show_perl5lib = 0
+set show_psversion = 0
+set show_psconfdir = 0
+set show_ld_library_path = 0
+set show_pkg_config_path = 0
+set show_aclocal_flags = 0
+set args = ""
+while ($#argv) 
+  switch ($argv[1])
+    case --help:
+      goto help;
+    case --list:
+      /bin/ls $PSCONFDIR | grep -v "\<man\>" | grep -v "\<share\>" | awk -v dir=$PSCONFDIR -F. '{printf "%s : %-10s : %s\n", dir, $1, $2}'
+      exit 0
+    case --prefix:
+      set show_prefix = 1
+      breaksw
+    case --libs:
+      set show_libs = 1
+      breaksw
+    case --bin
+      set show_bin = 1
+      breaksw
+    case --include
+      set show_include = 1
+      breaksw
+    case --psconfigure:
+      set show_configure = 1
+      breaksw;   
+    case --psautogen:
+      set show_autogen = 1
+      breaksw;
+    case --psperlbuild:
+      set show_perlbuild = 1
+      breaksw;
+    case --perldir:
+      set show_perldir = 1
+      breaksw;
+    case --perl5lib:
+      set show_perl5lib = 1
+      breaksw;
+    case --psversion
+      set show_psversion = 1
+      breaksw;
+    case --psconfdir
+      set show_psconfdir = 1
+      breaksw;
+    case --ld_library_path
+      set show_ld_library_path = 1
+      breaksw;
+    case --pkg_config_path
+      set show_pkg_config_path = 1
+      breaksw;
+    case --arch
+      set show_arch = 1
+      breaksw;
+    case --path
+      set show_path = 1
+      breaksw;
+    case --aclocal_flags
+      set show_aclocal_flags = 1
+      breaksw;
+    case -*:
+      echo "unknown option $1"
+      goto help;
+    default:
+      set args=($args $1);
+      breaksw;
+  endsw
+  shift
+end
+if ($#args != 1) goto usage
+if ("$args" == "") goto usage
+
+# make this configurable by the user
+if (! $?PSCONFDIR) then
+  setenv PSCONFDIR {$HOME}/psconfig
+endif
+
+if (! $?PSVERSION) then
+  setenv PSVERSION default
+endif
+
+if (-e $HOME/.psconfigrc) then
+  source $HOME/.psconfigrc
+endif
+
+setenv PSVERSION $args[1]
+
+if ($?CPATH == 0) setenv CPATH
+if ($?LD_LIBRARY_PATH == 0) setenv LD_LIBRARY_PATH
+if ($?PKG_CONFIG_PATH == 0) setenv PKG_CONFIG_PATH
+if ($?PERL5LIB == 0) setenv PERL5LIB
+
+# identify system architecture
+set sys=`uname -s` 
+if ("$sys" == "SunOS") then
+ set ver = `uname -r | awk '{print substr($1,1,1)}'`;
+ if ($ver > 4) then 
+   set sys = "Solaris"
+ endif
+endif
+if ("$sys" == "Linux") then
+ grep "Sidious" /etc/issue > /dev/null
+ if ($status == 0) then 
+  set sys = Sidious
+ endif
+ grep "Red Hat Enterprise" /etc/issue > /dev/null
+ if ($status == 0) then 
+  set sys = RedHat
+ endif
+endif
+
+# determine architecture-dependent paths & variables for all shells
+switch ($sys)
+ case IRIX64:
+   setenv ARCH irix;
+   breaksw;
+
+ case Solaris:
+   setenv ARCH sol
+   breaksw;
+
+ case SunOs:
+   setenv ARCH sun4
+   breaksw;
+
+ case Linux:
+   setenv ARCH linux;
+   set mach=`uname -m`
+   if ("$mach" == "x86_64") setenv ARCH lin64
+   breaksw;
+
+ case Darwin:
+   setenv ARCH darwin;
+   set mach=`uname -m`
+   if ("$mach" == "i386") setenv ARCH darwin_x86
+   breaksw;
+
+ case Sidious:
+   setenv ARCH sid;
+   breaksw;
+
+ case RedHat:
+   setenv ARCH linrh;
+   breaksw;
+
+ case HP-UX:
+    setenv ARCH hp;
+    breaksw;
+
+ default:
+   echo "unknown architecture";
+   setenv ARCH unknown;
+   breaksw;
+endsw
+ 
+setenv PSCONFIG $PSVERSION.$ARCH
+
+set newpath = ""
+set pathlist = `echo $PATH | tr ':' '\n'`
+foreach name ($pathlist)
+  echo $name | grep $PSCONFDIR > /dev/null
+  if ($status == 0) continue
+  if ($newpath == "") then
+    set newpath = {$name}:
+  else
+    set newpath = {$newpath}{$name}:
+  endif
+end
+set bindir = {$PSCONFDIR}/{$PSCONFIG}/bin
+if ("$PSCONFIG" == "none") then
+  setenv PATH {$newpath}
+else
+  setenv PATH {$bindir}:{$newpath}
+endif
+
+set mandir  = {$PSCONFDIR}/man
+set newpath = ""
+set pathlist = `echo $MANPATH | tr ':' '\n'`
+foreach name ($pathlist)
+  echo $name | grep $PSCONFDIR > /dev/null
+  if ($status == 0) continue
+  if ($newpath == "") then
+    set newpath = {$name}:
+  else
+    set newpath = {$newpath}{$name}:
+  endif
+end
+if ("$PSCONFIG" == "none") then
+  if ("$newpath" == "") then
+    unsetenv MANPATH
+  else
+    setenv MANPATH {$newpath}
+  endif 
+else
+  if ("$newpath" == "") then
+    setenv MANPATH {$mandir}:
+  else
+    setenv MANPATH {$mandir}:{$newpath}
+  endif 
+endif 
+
+# set CPATH, used to find include files
+set incdir  = {$PSCONFDIR}/{$PSCONFIG}/include
+set newpath = ""
+set pathlist = `echo $CPATH | tr ':' '\n'`
+foreach name ($pathlist)
+  echo $name | grep $PSCONFDIR > /dev/null
+  if ($status == 0) continue
+  if ($newpath == "") then
+    set newpath = {$name}:
+  else
+    set newpath = {$newpath}{$name}:
+  endif
+end
+if ("$PSCONFIG" == "none") then
+  if ("$newpath" == "") then
+    unsetenv CPATH
+  else
+    setenv CPATH {$newpath}
+  endif 
+else
+  if ("$newpath" == "") then
+    setenv CPATH {$incdir}:
+  else
+    setenv CPATH {$incdir}:{$newpath}
+  endif 
+endif 
+
+# set LIBRARY_PATH and LD_LIBRARY_PATH, used to find libraries
+set libdir  = {$PSCONFDIR}/{$PSCONFIG}/lib
+set newpath = ""
+set pathlist = `echo $LD_LIBRARY_PATH | tr ':' '\n'`
+foreach name ($pathlist)
+  echo $name | grep $PSCONFDIR > /dev/null
+  if ($status == 0) continue
+  if ($newpath == "") then
+    set newpath = {$name}:
+  else
+    set newpath = {$newpath}{$name}:
+  endif
+end
+if ("$PSCONFIG" == "none") then
+  if ("$newpath" == "") then
+    unsetenv LD_LIBRARY_PATH
+    unsetenv LIBRARY_PATH
+  else
+    setenv LD_LIBRARY_PATH {$newpath}
+    setenv LIBRARY_PATH {$newpath}
+  endif 
+else
+  if ("$newpath" == "") then
+    setenv LD_LIBRARY_PATH {$libdir}:
+    setenv LIBRARY_PATH {$libdir}:
+  else
+    setenv LD_LIBRARY_PATH {$libdir}:{$newpath}
+    setenv LIBRARY_PATH {$libdir}:{$newpath}
+  endif 
+endif 
+
+# Build wants to put things in prefix/*, MakeMaker wants to put them in prefix/perl5/*
+set plibdir  = {$PSCONFDIR}/{$PSCONFIG}/lib
+# set plib5dir = {$PSCONFDIR}/{$PSCONFIG}/lib/perl5
+set newpath = ""
+set pathlist = `echo $PERL5LIB | tr ':' '\n'`
+# build newpath with contents of PERL5LIB excluding PSCONFDIR entries
+foreach name ($pathlist)
+  echo $name | grep $PSCONFDIR > /dev/null
+  if ($status == 0) continue
+  if ($newpath == "") then
+    set newpath = {$name}:
+  else
+    set newpath = {$newpath}{$name}:
+  endif
+end
+if ("$PSCONFIG" == "none") then
+  if ("$newpath" == "") then
+    unsetenv PERL5LIB
+  else
+    setenv PERL5LIB {$newpath}
+  endif 
+else
+  if ("$newpath" == "") then
+    setenv PERL5LIB {$plibdir}:
+    # setenv PERL5LIB {$plibdir}:{$plib5dir}:
+  else
+    setenv PERL5LIB {$plibdir}:{$newpath}
+    # setenv PERL5LIB {$plibdir}:{$plib5dir}:{$newpath}
+  endif 
+endif 
+
+set newpath = ""
+set pathlist = `echo $PKG_CONFIG_PATH | tr ':' '\n'`
+foreach name ($pathlist)
+  echo $name | grep $PSCONFDIR > /dev/null
+  if ($status == 0) continue
+  if ($newpath == "") then
+    set newpath = {$name}:
+  else
+    set newpath = {$newpath}{$name}:
+  endif
+end
+if ("$PSCONFIG" == "none") then
+  if ("$newpath" == "") then
+    unsetenv PKG_CONFIG_PATH
+  else
+    setenv PKG_CONFIG_PATH {$newpath}
+  endif
+else
+  if ("$newpath" == "") then
+    setenv PKG_CONFIG_PATH {$PSCONFDIR}/{$PSCONFIG}/lib/pkgconfig:
+  else
+    setenv PKG_CONFIG_PATH {$PSCONFDIR}/{$PSCONFIG}/lib/pkgconfig:{$newpath}
+  endif
+endif
+
+if ("$PSCONFIG" == "none") then
+  alias  psconfigure configure
+  alias  psautogen autogen.sh
+  alias  psperlbuild perl Build.PL
+else
+  alias  psconfigure configure --prefix={$PSCONFDIR}/{$PSCONFIG} --bindir=$bindir --libdir=$libdir --mandir=$mandir --includedir=$incdir --sysconfdir={$PSCONFDIR}/{$PSCONFIG}/etc --datadir={$PSCONFDIR}/share
+  alias  psautogen autogen.sh  --prefix={$PSCONFDIR}/{$PSCONFIG} --bindir=$bindir --libdir=$libdir --mandir=$mandir --includedir=$incdir --sysconfdir={$PSCONFDIR}/{$PSCONFIG}/etc --datadir={$PSCONFDIR}/share
+  alias  psperlbuild perl Build.PL --prefix {$PSCONFDIR}/{$PSCONFIG} --install_path script=$bindir --install_path arch=$bindir --install_path bin=$bindir --install_path lib=$libdir --install_path bindoc={$PSCONFDIR}/man/man1 --install_path libdoc={$PSCONFDIR}/man/man3
+  setenv ACLOCAL_FLAGS "-I $PSCONFDIR/share/aclocal"
+endif
+
+# list selected environment variables
+if ($show_prefix) then
+  echo $PSCONFDIR/$PSVERSION.$ARCH
+  exit 0
+endif
+if ($show_libs) then
+  echo $PSCONFDIR/$PSVERSION.$ARCH/lib
+  exit 0
+endif
+if ($show_bin) then
+  echo $PSCONFDIR/$PSVERSION.$ARCH/bin
+  exit 0
+endif
+if ($show_include) then
+  echo $PSCONFDIR/$PSVERSION.$ARCH/include
+  exit 0
+endif
+
+# list the defined psconfig versions
+if ($show_configure) then
+  alias psconfigure 
+  exit 0
+endif
+
+# list the defined psconfig versions
+if ($show_autogen) then
+  alias psautogen
+  exit 0
+endif
+
+# list the defined psconfig versions
+if ($show_perlbuild) then
+  alias psperlbuild
+  exit 0
+endif
+
+if ($show_perldir) then
+  echo $plibdir
+  exit 0
+endif
+
+if ($show_perl5lib) then
+  echo $PERL5LIB
+  exit 0
+endif
+
+if ($show_psversion) then
+  echo $PSVERSION
+  exit 0
+endif
+
+if ($show_psconfdir) then
+  echo $PSCONFDIR
+  exit 0
+endif
+
+if ($show_ld_library_path) then
+  echo $LD_LIBRARY_PATH
+  exit 0
+endif
+
+if ($show_pkg_config_path) then
+  echo $PKG_CONFIG_PATH
+  exit 0
+endif
+
+if ($show_arch) then
+  echo $ARCH
+  exit 0
+endif
+
+if ($show_path) then
+  echo $PATH
+  exit 0
+endif
+
+if ($show_aclocal_flags) then
+  echo $ACLOCAL_FLAGS
+  exit 0
+endif
+
+
+
+exit 0
+
+usage:
+  if (! $?PSCONFDIR) echo "PSCONFDIR is not set : run psconfig with an argument to setup"
+  if (! $?PSVERSION) echo "PSVERSION is not set : run psconfig with an argument to setup"
+  if (! $?ARCH)      echo "ARCH is not set : run psconfig with an argument to setup"
+  echo $PSCONFDIR : $PSVERSION : $ARCH 
+  echo "psconfig --help for additional info"
+  exit 2
+
+help:
+  echo "psconfig: set or show the current pslib configuration information"
+  echo "USAGE: psconfig (version) : set configuration to specified version"
+  echo "       psconfig --bin     : return the current path"
+  echo "       psconfig --libs    : return the current library path"
+  echo "       psconfig --include"
+  echo 
+  echo "       psconfig --prefix  : show prefix directory"
+  echo "       psconfig --psconfigure"
+  echo "       psconfig --psautogen"
+  echo "       psconfig --psperlbuild"
+  echo "       psconfig --perldir"
+  echo "       psconfig --perl5lib"
+  echo "       psconfig --psversion"
+  echo "       psconfig --psconfdir"
+  echo "       psconfig --ld_library_path"
+  echo "       psconfig --pkg_config_path"
+  echo "       psconfig --arch"
+  echo "       psconfig --path"
+  echo "       psconfig --aclocal_flags"
+  echo
+  echo "       psconfig --list    : list currently availabe configuration versions"
+  echo "       psconfig --help    : this listing"
+  echo " use ~/.psconfigrc to set PSCONFDIR as desired"
+  exit 1
Index: unk/psconfig/psconfig.sh
===================================================================
--- /trunk/psconfig/psconfig.sh	(revision 12838)
+++ 	(revision )
@@ -1,449 +1,0 @@
-#/bin/csh -f
-# this file is sourced using the command 'psconfig'
-
-# list the defined psconfig versions
-set show_prefix = 0
-set show_libs = 0
-set show_bin = 0
-set show_arch = 0
-set show_path = 0
-set show_include = 0
-set show_configure = 0
-set show_autogen = 0
-set show_perlbuild = 0
-set show_perldir = 0
-set show_perl5lib = 0
-set show_psversion = 0
-set show_psconfdir = 0
-set show_ld_library_path = 0
-set show_pkg_config_path = 0
-set show_aclocal_flags = 0
-set args = ""
-while ($#argv) 
-  switch ($argv[1])
-    case --help:
-      goto help;
-    case --list:
-      /bin/ls $PSCONFDIR | grep -v "\<man\>" | grep -v "\<share\>" | awk -v dir=$PSCONFDIR -F. '{printf "%s : %-10s : %s\n", dir, $1, $2}'
-      exit 0
-    case --prefix:
-      set show_prefix = 1
-      breaksw
-    case --libs:
-      set show_libs = 1
-      breaksw
-    case --bin
-      set show_bin = 1
-      breaksw
-    case --include
-      set show_include = 1
-      breaksw
-    case --psconfigure:
-      set show_configure = 1
-      breaksw;   
-    case --psautogen:
-      set show_autogen = 1
-      breaksw;
-    case --psperlbuild:
-      set show_perlbuild = 1
-      breaksw;
-    case --perldir:
-      set show_perldir = 1
-      breaksw;
-    case --perl5lib:
-      set show_perl5lib = 1
-      breaksw;
-    case --psversion
-      set show_psversion = 1
-      breaksw;
-    case --psconfdir
-      set show_psconfdir = 1
-      breaksw;
-    case --ld_library_path
-      set show_ld_library_path = 1
-      breaksw;
-    case --pkg_config_path
-      set show_pkg_config_path = 1
-      breaksw;
-    case --arch
-      set show_arch = 1
-      breaksw;
-    case --path
-      set show_path = 1
-      breaksw;
-    case --aclocal_flags
-      set show_aclocal_flags = 1
-      breaksw;
-    case -*:
-      echo "unknown option $1"
-      goto help;
-    default:
-      set args=($args $1);
-      breaksw;
-  endsw
-  shift
-end
-if ($#args != 1) goto usage
-if ("$args" == "") goto usage
-
-# make this configurable by the user
-setenv PSCONFDIR {$HOME}/psconfig
-setenv PSVERSION default
-
-if (-e $HOME/.psconfigrc) then
-  source $HOME/.psconfigrc
-endif
-
-setenv PSVERSION $args[1]
-
-if ($?CPATH == 0) setenv CPATH
-if ($?LD_LIBRARY_PATH == 0) setenv LD_LIBRARY_PATH
-if ($?PKG_CONFIG_PATH == 0) setenv PKG_CONFIG_PATH
-if ($?PERL5LIB == 0) setenv PERL5LIB
-
-# identify system architecture
-set sys=`uname -s` 
-if ("$sys" == "SunOS") then
- set ver = `uname -r | awk '{print substr($1,1,1)}'`;
- if ($ver > 4) then 
-   set sys = "Solaris"
- endif
-endif
-if ("$sys" == "Linux") then
- grep "Sidious" /etc/issue > /dev/null
- if ($status == 0) then 
-  set sys = Sidious
- endif
- grep "Red Hat Enterprise" /etc/issue > /dev/null
- if ($status == 0) then 
-  set sys = RedHat
- endif
-endif
-
-# determine architecture-dependent paths & variables for all shells
-switch ($sys)
- case IRIX64:
-   setenv ARCH irix;
-   breaksw;
-
- case Solaris:
-   setenv ARCH sol
-   breaksw;
-
- case SunOs:
-   setenv ARCH sun4
-   breaksw;
-
- case Linux:
-   setenv ARCH linux;
-   set mach=`uname -m`
-   if ("$mach" == "x86_64") setenv ARCH lin64
-   breaksw;
-
- case Sidious:
-   setenv ARCH sid;
-   breaksw;
-
- case RedHat:
-   setenv ARCH linrh;
-   breaksw;
-
- case HP-UX:
-    setenv ARCH hp;
-    breaksw;
-
- default:
-   echo "unknown architecture";
-   setenv ARCH unknown;
-   breaksw;
-endsw
- 
-setenv PSCONFIG $PSVERSION.$ARCH
-
-set newpath = ""
-set pathlist = `echo $PATH | tr ':' '\n'`
-foreach name ($pathlist)
-  echo $name | grep $PSCONFDIR > /dev/null
-  if ($status == 0) continue
-  if ($newpath == "") then
-    set newpath = {$name}:
-  else
-    set newpath = {$newpath}{$name}:
-  endif
-end
-set bindir = {$PSCONFDIR}/{$PSCONFIG}/bin
-if ("$PSCONFIG" == "none") then
-  setenv PATH {$newpath}
-else
-  setenv PATH {$bindir}:{$newpath}
-endif
-
-set mandir  = {$PSCONFDIR}/man
-set newpath = ""
-set pathlist = `echo $MANPATH | tr ':' '\n'`
-foreach name ($pathlist)
-  echo $name | grep $PSCONFDIR > /dev/null
-  if ($status == 0) continue
-  if ($newpath == "") then
-    set newpath = {$name}:
-  else
-    set newpath = {$newpath}{$name}:
-  endif
-end
-if ("$PSCONFIG" == "none") then
-  if ("$newpath" == "") then
-    unsetenv MANPATH
-  else
-    setenv MANPATH {$newpath}
-  endif 
-else
-  if ("$newpath" == "") then
-    setenv MANPATH {$mandir}:
-  else
-    setenv MANPATH {$mandir}:{$newpath}
-  endif 
-endif 
-
-# set CPATH, used to find include files
-set incdir  = {$PSCONFDIR}/{$PSCONFIG}/include
-set newpath = ""
-set pathlist = `echo $CPATH | tr ':' '\n'`
-foreach name ($pathlist)
-  echo $name | grep $PSCONFDIR > /dev/null
-  if ($status == 0) continue
-  if ($newpath == "") then
-    set newpath = {$name}:
-  else
-    set newpath = {$newpath}{$name}:
-  endif
-end
-if ("$PSCONFIG" == "none") then
-  if ("$newpath" == "") then
-    unsetenv CPATH
-  else
-    setenv CPATH {$newpath}
-  endif 
-else
-  if ("$newpath" == "") then
-    setenv CPATH {$incdir}:
-  else
-    setenv CPATH {$incdir}:{$newpath}
-  endif 
-endif 
-
-# set LIBRARY_PATH and LD_LIBRARY_PATH, used to find libraries
-set libdir  = {$PSCONFDIR}/{$PSCONFIG}/lib
-set newpath = ""
-set pathlist = `echo $LD_LIBRARY_PATH | tr ':' '\n'`
-foreach name ($pathlist)
-  echo $name | grep $PSCONFDIR > /dev/null
-  if ($status == 0) continue
-  if ($newpath == "") then
-    set newpath = {$name}:
-  else
-    set newpath = {$newpath}{$name}:
-  endif
-end
-if ("$PSCONFIG" == "none") then
-  if ("$newpath" == "") then
-    unsetenv LD_LIBRARY_PATH
-    unsetenv LIBRARY_PATH
-  else
-    setenv LD_LIBRARY_PATH {$newpath}
-    setenv LIBRARY_PATH {$newpath}
-  endif 
-else
-  if ("$newpath" == "") then
-    setenv LD_LIBRARY_PATH {$libdir}:
-    setenv LIBRARY_PATH {$libdir}:
-  else
-    setenv LD_LIBRARY_PATH {$libdir}:{$newpath}
-    setenv LIBRARY_PATH {$libdir}:{$newpath}
-  endif 
-endif 
-
-# Build wants to put things in prefix/*, MakeMaker wants to put them in prefix/perl5/*
-set plibdir  = {$PSCONFDIR}/{$PSCONFIG}/lib
-# set plib5dir = {$PSCONFDIR}/{$PSCONFIG}/lib/perl5
-set newpath = ""
-set pathlist = `echo $PERL5LIB | tr ':' '\n'`
-# build newpath with contents of PERL5LIB excluding PSCONFDIR entries
-foreach name ($pathlist)
-  echo $name | grep $PSCONFDIR > /dev/null
-  if ($status == 0) continue
-  if ($newpath == "") then
-    set newpath = {$name}:
-  else
-    set newpath = {$newpath}{$name}:
-  endif
-end
-if ("$PSCONFIG" == "none") then
-  if ("$newpath" == "") then
-    unsetenv PERL5LIB
-  else
-    setenv PERL5LIB {$newpath}
-  endif 
-else
-  if ("$newpath" == "") then
-    setenv PERL5LIB {$plibdir}:
-    # setenv PERL5LIB {$plibdir}:{$plib5dir}:
-  else
-    setenv PERL5LIB {$plibdir}:{$newpath}
-    # setenv PERL5LIB {$plibdir}:{$plib5dir}:{$newpath}
-  endif 
-endif 
-
-set newpath = ""
-set pathlist = `echo $PKG_CONFIG_PATH | tr ':' '\n'`
-foreach name ($pathlist)
-  echo $name | grep $PSCONFDIR > /dev/null
-  if ($status == 0) continue
-  if ($newpath == "") then
-    set newpath = {$name}:
-  else
-    set newpath = {$newpath}{$name}:
-  endif
-end
-if ("$PSCONFIG" == "none") then
-  if ("$newpath" == "") then
-    unsetenv PKG_CONFIG_PATH
-  else
-    setenv PKG_CONFIG_PATH {$newpath}
-  endif
-else
-  if ("$newpath" == "") then
-    setenv PKG_CONFIG_PATH {$PSCONFDIR}/{$PSCONFIG}/lib/pkgconfig:
-  else
-    setenv PKG_CONFIG_PATH {$PSCONFDIR}/{$PSCONFIG}/lib/pkgconfig:{$newpath}
-  endif
-endif
-
-if ("$PSCONFIG" == "none") then
-  alias  psconfigure configure
-  alias  psautogen autogen.sh
-  alias  psperlbuild perl Build.PL
-else
-  alias  psconfigure configure --prefix={$PSCONFDIR}/{$PSCONFIG} --bindir=$bindir --libdir=$libdir --mandir=$mandir --includedir=$incdir --sysconfdir={$PSCONFDIR}/{$PSCONFIG}/etc --datadir={$PSCONFDIR}/share
-  alias  psautogen autogen.sh  --prefix={$PSCONFDIR}/{$PSCONFIG} --bindir=$bindir --libdir=$libdir --mandir=$mandir --includedir=$incdir --sysconfdir={$PSCONFDIR}/{$PSCONFIG}/etc --datadir={$PSCONFDIR}/share
-  alias  psperlbuild perl Build.PL --prefix {$PSCONFDIR}/{$PSCONFIG} --install_path script=$bindir --install_path arch=$bindir --install_path bin=$bindir --install_path lib=$libdir --install_path bindoc={$PSCONFDIR}/man/man1 --install_path libdoc={$PSCONFDIR}/man/man3
-  setenv ACLOCAL_FLAGS "-I $PSCONFDIR/share/aclocal"
-endif
-
-# list selected environment variables
-if ($show_prefix) then
-  echo $PSCONFDIR/$PSVERSION.$ARCH
-  exit 0
-endif
-if ($show_libs) then
-  echo $PSCONFDIR/$PSVERSION.$ARCH/lib
-  exit 0
-endif
-if ($show_bin) then
-  echo $PSCONFDIR/$PSVERSION.$ARCH/bin
-  exit 0
-endif
-if ($show_include) then
-  echo $PSCONFDIR/$PSVERSION.$ARCH/include
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ($show_configure) then
-  alias psconfigure 
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ($show_autogen) then
-  alias psautogen
-  exit 0
-endif
-
-# list the defined psconfig versions
-if ($show_perlbuild) then
-  alias psperlbuild
-  exit 0
-endif
-
-if ($show_perldir) then
-  echo $plibdir
-  exit 0
-endif
-
-if ($show_perl5lib) then
-  echo $PERL5LIB
-  exit 0
-endif
-
-if ($show_psversion) then
-  echo $PSVERSION
-  exit 0
-endif
-
-if ($show_psconfdir) then
-  echo $PSCONFDIR
-  exit 0
-endif
-
-if ($show_ld_library_path) then
-  echo $LD_LIBRARY_PATH
-  exit 0
-endif
-
-if ($show_pkg_config_path) then
-  echo $PKG_CONFIG_PATH
-  exit 0
-endif
-
-if ($show_arch) then
-  echo $ARCH
-  exit 0
-endif
-
-if ($show_path) then
-  echo $PATH
-  exit 0
-endif
-
-if ($show_aclocal_flags) then
-  echo $ACLOCAL_FLAGS
-  exit 0
-endif
-
-
-
-exit 0
-
-usage:
-  if (! $?PSCONFDIR) echo "PSCONFDIR is not set : run psconfig with an argument to setup"
-  if (! $?PSVERSION) echo "PSVERSION is not set : run psconfig with an argument to setup"
-  if (! $?ARCH)      echo "ARCH is not set : run psconfig with an argument to setup"
-  echo $PSCONFDIR : $PSVERSION : $ARCH 
-  echo "psconfig --help for additional info"
-  exit 2
-
-help:
-  echo "psconfig: set or show the current pslib configuration information"
-  echo "USAGE: psconfig (version) : set configuration to specified version"
-  echo "       psconfig --bin     : return the current path"
-  echo "       psconfig --libs    : return the current library path"
-  echo "       psconfig --include"
-  echo 
-  echo "       psconfig --prefix  : show prefix directory"
-  echo "       psconfig --psconfigure"
-  echo "       psconfig --psautogen"
-  echo "       psconfig --psperlbuild"
-  echo "       psconfig --perldir"
-  echo "       psconfig --perl5lib"
-  echo "       psconfig --psversion"
-  echo "       psconfig --psconfdir"
-  echo "       psconfig --ld_library_path"
-  echo "       psconfig --pkg_config_path"
-  echo "       psconfig --arch"
-  echo "       psconfig --path"
-  echo "       psconfig --aclocal_flags"
-  echo
-  echo "       psconfig --list    : list currently availabe configuration versions"
-  echo "       psconfig --help    : this listing"
-  echo " use ~/.psconfigrc to set PSCONFDIR as desired"
-  exit 1
