Index: trunk/ArchTOIPipe/Kernel/Makefile.in
===================================================================
--- trunk/ArchTOIPipe/Kernel/Makefile.in	(revision 1662)
+++ trunk/ArchTOIPipe/Kernel/Makefile.in	(revision 1663)
@@ -40,4 +40,5 @@
  ifeq ($(CXX), cxx)
   CXXFLAGS := -O -g -D__USE_STD_IOSTREAM
+  LIBS := $(LIBS) -pthread
  endif
 endif
@@ -77,4 +78,5 @@
 libatkern.a: $(FILES)
 	$(AR) -cr libatkern.a $(FILES)
+	ranlib libatkern.a
 	ln -f libatkern.a ../libatkern.a
 
@@ -84,11 +86,11 @@
 
 %: %.o $(FILES)
-	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -pthread -o $@ -lm
+	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS)  -o $@ -lm
 
 %.o:$(srcdir)/%.cc
-	$(COMPILE.cc) -pthread -o $@ $<
+	$(COMPILE.cc) -o $@ $<
 
 %.o:$(srcdir)/%.c
-	$(COMPILE.c) -pthread -o $@ $<
+	$(COMPILE.c)  -o $@ $<
 
 
Index: trunk/ArchTOIPipe/Kernel/toiprocessor.cc
===================================================================
--- trunk/ArchTOIPipe/Kernel/toiprocessor.cc	(revision 1662)
+++ trunk/ArchTOIPipe/Kernel/toiprocessor.cc	(revision 1663)
@@ -2,5 +2,16 @@
 #include "toimanager.h"
 #include <pthread.h>
+
+#ifdef HAVE_VALUES_H
 #include <values.h>
+#endif
+
+#ifndef MAXINT
+#define MAXINT 2147483647
+#endif
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
 
 #ifdef WITH_SOPHYA
@@ -88,10 +99,10 @@
 
 int TOIProcessor::getMaxIn() {
-  int nIn = inIx.size();
-  int maxIn = MAXINT;
+  int_4 nIn = inIx.size();
+  int_4 maxIn = MAXINT;
   for (int i=0; i<nIn; i++) {
     TOI* toi = inTOIs[i];
     if (toi == NULL) continue;  // Protection - Reza  13/3/2001
-    int x = toi->getMaxSn();
+    int_4 x = toi->getMaxSn();
     if (x < maxIn) maxIn = x;
   }
Index: trunk/ArchTOIPipe/ProcWSophya/Makefile.in
===================================================================
--- trunk/ArchTOIPipe/ProcWSophya/Makefile.in	(revision 1662)
+++ trunk/ArchTOIPipe/ProcWSophya/Makefile.in	(revision 1663)
@@ -40,4 +40,5 @@
  ifeq ($(CXX), cxx)
   CXXFLAGS := -O -g -D__USE_STD_IOSTREAM
+  LIBS := $(LIBS) -pthread
  endif
 endif
@@ -76,4 +77,5 @@
 libatsop.a: $(FILES)
 	$(AR) -cr libatsop.a $(FILES) 
+	ranlib libatkern.a
 	ln -f libatsop.a ../libatsop.a
 
@@ -83,11 +85,11 @@
 
 %: %.o $(FILES)
-	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -pthread -o $@ -lm
+	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS)  -o $@ -lm
 
 %.o:$(srcdir)/%.cc
-	$(COMPILE.cc) -pthread -o $@ $<
+	$(COMPILE.cc)  -o $@ $<
 
 %.o:$(srcdir)/%.c
-	$(COMPILE.c) -pthread -o $@ $<
+	$(COMPILE.c) -o $@ $<
 
 
Index: trunk/ArchTOIPipe/Processors/Makefile.in
===================================================================
--- trunk/ArchTOIPipe/Processors/Makefile.in	(revision 1662)
+++ trunk/ArchTOIPipe/Processors/Makefile.in	(revision 1663)
@@ -40,4 +40,5 @@
  ifeq ($(CXX), cxx)
   CXXFLAGS := -O -g -D__USE_STD_IOSTREAM
+  LIBS := $(LIBS) -pthread
  endif
 endif
@@ -75,4 +76,5 @@
 libatproc.a: $(FILES)
 	$(AR) -cr libatproc.a $(FILES)  
+	ranlib libatproc.a
 	ln -f libatproc.a ../libatproc.a
 
@@ -83,11 +85,11 @@
 
 %: %.o $(FILES)
-	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -pthread -o $@ -lm
+	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS)  -o $@ -lm
 
 %.o:$(srcdir)/%.cc
-	$(COMPILE.cc) -pthread -o $@ $<
+	$(COMPILE.cc)  -o $@ $<
 
 %.o:$(srcdir)/%.c
-	$(COMPILE.c) -pthread -o $@ $<
+	$(COMPILE.c)  -o $@ $<
 
 
Index: trunk/ArchTOIPipe/TestPipes/Makefile.in
===================================================================
--- trunk/ArchTOIPipe/TestPipes/Makefile.in	(revision 1662)
+++ trunk/ArchTOIPipe/TestPipes/Makefile.in	(revision 1663)
@@ -40,4 +40,5 @@
  ifeq ($(CXX), cxx)
   CXXFLAGS := -O -g -D__USE_STD_IOSTREAM
+  LIBS := $(LIBS) -pthread
  endif
 endif
@@ -81,11 +82,11 @@
 
 %: %.o $(FILES) $(LIBDEPS)
-	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -pthread -o $@ -lm
+	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@ -lm
 
 %.o:$(srcdir)/%.cc
-	$(COMPILE.cc) -pthread -o $@ $<
+	$(COMPILE.cc) -o $@ $<
 
 %.o:$(srcdir)/%.c
-	$(COMPILE.c) -pthread -o $@ $<
+	$(COMPILE.c) -o $@ $<
 
 
Index: trunk/ArchTOIPipe/conf.h.in
===================================================================
--- trunk/ArchTOIPipe/conf.h.in	(revision 1662)
+++ trunk/ArchTOIPipe/conf.h.in	(revision 1663)
@@ -16,4 +16,7 @@
 #undef SIZEOF_LONG
 
+/* The number of bytes in a long long.  */
+#undef SIZEOF_LONG_LONG
+
 /* The number of bytes in a long double.  */
 #undef SIZEOF_LONG_DOUBLE
@@ -24,2 +27,8 @@
 /* Define if you have the m library (-lm).  */
 #undef HAVE_LIBM
+
+/* Define if you have the values.h header.  */
+#undef HAVE_VALUES_H
+
+
+
Index: trunk/ArchTOIPipe/config.h
===================================================================
--- trunk/ArchTOIPipe/config.h	(revision 1662)
+++ trunk/ArchTOIPipe/config.h	(revision 1663)
@@ -9,4 +9,11 @@
 #ifndef WITH_SOPHYA
 #define NO_SOPHYA
+
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+  #define int_4 int4_t
+  #define int_8 int8_t
+  #define uint_8 uint8_t
+#else
 #if SIZEOF_SHORT == 4
   #define int_4  short int
@@ -19,8 +26,14 @@
 #if SIZEOF_LONG == 8
   #define int_8 long
+  #define uint_8 unsigned long
+#elif SIZEOF_LONG_LONG == 8
+  #define int_8 long long
+  #define uint_8 unsigned long long
 #else
-  #error long is not 8 bytes...  
+  #error no 8-byte long int...
+#endif
 #endif
 #endif
 
 #endif
+
Index: trunk/ArchTOIPipe/configure
===================================================================
--- trunk/ArchTOIPipe/configure	(revision 1662)
+++ trunk/ArchTOIPipe/configure	(revision 1663)
@@ -1028,6 +1028,45 @@
 
 
+echo $ac_n "checking size of long long""... $ac_c" 1>&6
+echo "configure:1032: checking size of long long" >&5
+if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test "$cross_compiling" = yes; then
+    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1040 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+main()
+{
+  FILE *f=fopen("conftestval", "w");
+  if (!f) exit(1);
+  fprintf(f, "%d\n", sizeof(long long));
+  exit(0);
+}
+EOF
+if { (eval echo configure:1051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ac_cv_sizeof_long_long=`cat conftestval`
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_sizeof_long_long=0
+fi
+rm -fr conftest*
+fi
+
+fi
+echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6
+cat >> confdefs.h <<EOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+EOF
+
+
 echo $ac_n "checking size of float""... $ac_c" 1>&6
-echo "configure:1032: checking size of float" >&5
+echo "configure:1071: checking size of float" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_float'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1037,5 +1076,5 @@
 else
   cat > conftest.$ac_ext <<EOF
-#line 1040 "configure"
+#line 1079 "configure"
 #include "confdefs.h"
 #include <stdio.h>
@@ -1048,5 +1087,5 @@
 }
 EOF
-if { (eval echo configure:1051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_float=`cat conftestval`
@@ -1068,5 +1107,5 @@
 
 echo $ac_n "checking size of double""... $ac_c" 1>&6
-echo "configure:1071: checking size of double" >&5
+echo "configure:1110: checking size of double" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1076,5 +1115,5 @@
 else
   cat > conftest.$ac_ext <<EOF
-#line 1079 "configure"
+#line 1118 "configure"
 #include "confdefs.h"
 #include <stdio.h>
@@ -1087,5 +1126,5 @@
 }
 EOF
-if { (eval echo configure:1090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_double=`cat conftestval`
@@ -1107,5 +1146,5 @@
 
 echo $ac_n "checking size of long double""... $ac_c" 1>&6
-echo "configure:1110: checking size of long double" >&5
+echo "configure:1149: checking size of long double" >&5
 if eval "test \"`echo '$''{'ac_cv_sizeof_long_double'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1115,5 +1154,5 @@
 else
   cat > conftest.$ac_ext <<EOF
-#line 1118 "configure"
+#line 1157 "configure"
 #include "confdefs.h"
 #include <stdio.h>
@@ -1126,5 +1165,5 @@
 }
 EOF
-if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1168: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_sizeof_long_double=`cat conftestval`
@@ -1148,5 +1187,5 @@
 
 echo $ac_n "checking "for cfitsio lib"""... $ac_c" 1>&6
-echo "configure:1151: checking "for cfitsio lib"" >&5
+echo "configure:1190: checking "for cfitsio lib"" >&5
 MACHDIR=`uname`-$CXX
 if test -f $ARCHBASEREP/$MACHDIR/Libs/libcfitsio.a; then
@@ -1173,5 +1212,5 @@
 
 echo $ac_n "checking "for cfitsio includes"""... $ac_c" 1>&6
-echo "configure:1176: checking "for cfitsio includes"" >&5
+echo "configure:1215: checking "for cfitsio includes"" >&5
 if test -f $CFITSIODIR/fitsio.h; then
   cfitsincdir='-I$(CFITSIODIR)'
@@ -1185,5 +1224,5 @@
 
 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
-echo "configure:1188: checking for sin in -lm" >&5
+echo "configure:1227: checking for sin in -lm" >&5
 ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
@@ -1193,5 +1232,5 @@
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1196 "configure"
+#line 1235 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
@@ -1204,5 +1243,5 @@
 ; return 0; }
 EOF
-if { (eval echo configure:1207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
@@ -1233,5 +1272,5 @@
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1236: checking how to run the C preprocessor" >&5
+echo "configure:1275: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
@@ -1248,5 +1287,5 @@
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1251 "configure"
+#line 1290 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -1254,5 +1293,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1257: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1265,5 +1304,5 @@
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1268 "configure"
+#line 1307 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -1271,5 +1310,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1274: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1282,5 +1321,5 @@
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1285 "configure"
+#line 1324 "configure"
 #include "confdefs.h"
 #include <assert.h>
@@ -1288,5 +1327,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1291: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1330: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1313,10 +1352,10 @@
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1316: checking for ANSI C header files" >&5
+echo "configure:1355: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1321 "configure"
+#line 1360 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
@@ -1326,5 +1365,5 @@
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1329: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1368: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
@@ -1343,5 +1382,5 @@
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1346 "configure"
+#line 1385 "configure"
 #include "confdefs.h"
 #include <string.h>
@@ -1361,5 +1400,5 @@
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1364 "configure"
+#line 1403 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
@@ -1382,5 +1421,5 @@
 else
   cat > conftest.$ac_ext <<EOF
-#line 1385 "configure"
+#line 1424 "configure"
 #include "confdefs.h"
 #include <ctype.h>
@@ -1393,5 +1432,5 @@
 
 EOF
-if { (eval echo configure:1396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
@@ -1415,4 +1454,44 @@
 
 fi
+
+for ac_hdr in values.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1462: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1467 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
 
 
Index: trunk/ArchTOIPipe/configure.in
===================================================================
--- trunk/ArchTOIPipe/configure.in	(revision 1662)
+++ trunk/ArchTOIPipe/configure.in	(revision 1663)
@@ -22,4 +22,5 @@
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
 AC_CHECK_SIZEOF(float)
 AC_CHECK_SIZEOF(double)
@@ -70,4 +71,5 @@
 dnl Checks for header files.
 AC_HEADER_STDC
+AC_CHECK_HEADERS(values.h stdint.h)
 
 outfiles="Makefile kernel/Makefile processors/Makefile pipes/Makefile"
