Index: trunk/psLib/Makefile.am
===================================================================
--- trunk/psLib/Makefile.am	(revision 3119)
+++ trunk/psLib/Makefile.am	(revision 3120)
@@ -3,5 +3,5 @@
 AUTOMAKE_OPTIONS = foreign 1.4
 
-SUBDIRS = src test
+SUBDIRS = src test swig
 
 bin_SCRIPTS = pslib-config
Index: trunk/psLib/configure.in
===================================================================
--- trunk/psLib/configure.in	(revision 3119)
+++ trunk/psLib/configure.in	(revision 3120)
@@ -124,5 +124,5 @@
 AC_CONFIG_FILES([ src/image/Makefile ])
 AC_CONFIG_FILES([ src/sysUtils/Makefile ])
-AC_CONFIG_FILES([ src/swig/Makefile ])
+AC_CONFIG_FILES([ swig/Makefile ])
 AC_CONFIG_FILES([ test/Makefile ])
 AC_CONFIG_FILES([ test/astronomy/Makefile ])
Index: trunk/psLib/src/Makefile.am
===================================================================
--- trunk/psLib/src/Makefile.am	(revision 3119)
+++ trunk/psLib/src/Makefile.am	(revision 3120)
@@ -3,5 +3,5 @@
 AUTOMAKE_OPTIONS = foreign 1.4
 
-SUBDIRS = astronomy collections dataManip fileUtils image sysUtils swig
+SUBDIRS = astronomy collections dataManip fileUtils image sysUtils
 
 INCLUDES = \
Index: trunk/psLib/swig/Makefile.am
===================================================================
--- trunk/psLib/swig/Makefile.am	(revision 3120)
+++ trunk/psLib/swig/Makefile.am	(revision 3120)
@@ -0,0 +1,42 @@
+# not a GNU package. You can remove this line, if
+# have all needed files, that a GNU package needs
+AUTOMAKE_OPTIONS = foreign 1.4
+
+EXTRA_DIST = PsLib.i PsLibModule/Makefile.PL
+
+CLEANFILES = PsLibModule/PsLib_wrap.c PsLibModule/PsLib.pm \
+PsLibModule/Makefile PsLibModule/pm_to_blib PsLibModule/PsLib.bs \
+PsLibModule/PsLib_wrap.o PsLibModule/setup.txt
+
+SRCDIR = $(shell cd $(top_srcdir)/src && pwd)
+
+INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/astronomy -I$(SRCDIR)/collections \
+-I$(SRCDIR)/dataManip -I$(SRCDIR)/fileUtils -I$(SRCDIR)/image \
+-I$(SRCDIR)/sysUtils
+
+####################################################
+## PsLibModule swig build section.  
+
+PsLibModule/setup.txt:Makefile
+	echo "includes=$(INCLUDES)" > PsLibModule/setup.txt
+	echo "ldflags=-L$(libdir) -lpslib" >> PsLibModule/setup.txt
+	echo "cflags=-Wno-unused -Wno-strict-aliasing" >> PsLibModule/setup.txt
+
+PsLibModule/PsLib_wrap.c: PsLib.i
+	$(SWIG) -perl $(INCLUDES) -w451 -o $@ $?
+
+PsLibModule/Makefile:PsLibModule/Makefile.PL PsLibModule/setup.txt
+	cd PsLibModule && $(PERL) Makefile.PL
+
+all: PsLibModule/PsLib_wrap.c
+
+swig:PsLibModule/PsLib_wrap.c PsLibModule/Makefile
+	cd PsLibModule && make
+
+swig-install: PsLibModule-build
+	cd PsLibModule && make install
+
+install-exec-hook: swig swig-install
+
+uninstall-local: PsLibModule/Makefile
+	cd PsLibModule && make clean
Index: trunk/psLib/swig/PsLib.i
===================================================================
--- trunk/psLib/swig/PsLib.i	(revision 3120)
+++ trunk/psLib/swig/PsLib.i	(revision 3120)
@@ -0,0 +1,45 @@
+%module PsLib
+
+%{
+#define PS_ALLOW_MALLOC 
+#define SWIG
+#include "pslib.h"
+%}
+
+%include "cpointer.i"
+
+/**
+ * Typemap to map FILE* input to the script's native file descriptor wrapper.
+ * Used for such functions as psErrorStackPrint and psTraceSetDestination.
+ */
+%typemap(in) FILE * {
+#if defined(SWIGPERL)
+   if (!SvOK($input)) {
+      $1 = NULL;      
+   } else {
+      $1 = PerlIO_findFILE(IoIFP(sv_2io($input)));
+   }
+#elif defined(SWIGPYTHON)
+    if ($input == Py_None) {
+	$1 = NULL;
+    } else if (!PyFile_Check($input)) {
+	PyErr_SetString(PyExc_TypeError, "Need a file!");
+	goto fail;
+    } else {
+	$1 = PyFile_AsFile($input);
+    }
+#endif
+}
+
+%{
+typedef struct { float re, im; } swig_psC32;  ///< 32-bit complex floating point
+typedef struct { double re, im; } swig_psC64; ///< 64-bit complex floating point
+%}
+
+/* the actual including of headers are found in each of the directories. */
+%include "sysUtils.i"
+%include "image.i"
+%include "fileUtils.i"
+%include "dataManip.i"
+%include "collections.i"
+%include "astronomy.i"
