Index: /trunk/SophyaLib/BuildMgr/AIX_xlC_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/AIX_xlC_make.inc	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/AIX_xlC_make.inc	(revision 3840)
@@ -11,6 +11,7 @@
 
 #  Chemin et librairie pour PI 
-PIINC = 
-PILIBS = -lXm -lXt -lX11 
+PIINC = $(PIEXTINC) -I/usr/include/
+PILIBS = $(PIEXTLIB) -L/usr/lib/ -lXt -lX11 
+
 
 #  Flag preprocesseur
Index: /trunk/SophyaLib/BuildMgr/Darwin_c++_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/Darwin_c++_make.inc	(revision 3840)
+++ /trunk/SophyaLib/BuildMgr/Darwin_c++_make.inc	(revision 3840)
@@ -0,0 +1,60 @@
+# --------- File Darwin_g++_make.inc -------- 
+
+#  Liste des librariries externes 
+SOPEXTLIBS = $(SOPEXTLIBP) $(SOPEXTLIBLIST) -framework Accelerate
+
+#  Chemin et librairie pour PI 
+PIINC = $(PIEXTINC) -I/usr/X11R6/include/
+PILIBS = $(PIEXTLIB) -L/usr/X11R6/lib/ -lXt -lX11 
+
+
+#  Flag preprocesseur
+CPPFLAGS = -DDarwin -I$(SOPHYAINCP)  $(PIINC)
+#  Def compilateur C et flags
+CC = cc
+# Replace [CNFPHFLF] by specific compilation flags below (done by configure)
+CFLAGS = -fno-common -g -O -fPIC CNFPHFLF 
+#  With optimization flags 
+#  CFLAGS = -fno-common -g -fastf -mtune=G5 -fPIC
+#  Def compilateur C++ et flags
+CXX =  c++
+CXXFLAGS = -fno-common -g -O -fPIC  CNFPHFLF 
+# CXXFLAGS = -fno-common -g -fastf -mtune=G5 -fPIC 
+# flags specifiques pour templates repository...
+CXXTEMPFLG =
+#  Compilo fortran
+FC = g77
+FFLAGS =  
+# Pour fabriquer les lib .a
+AR = libtool 
+ARFLAGS = -static -o 
+
+
+#  Ordres de compilation
+CCOMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) -c 
+CXXCOMPILE = $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c 
+FCCOMPILE = $(FC) $(FFLAGS) -c 
+
+#  Extension de nom pour les librairies partagees
+SLEXT = dylib
+#  Fabrication de librairies partagees 
+CMDSHLCXX = $(CXX) $(CXXFLAGS) $(CXXTEMPFLG) -dynamiclib 
+
+
+#  Liste de librairie de base, necessaire pour libsophya
+SOPBASELIBS = -lpthread -lm -lc -ldl 
+LIBFORT = 
+
+# --- Chemin pour l ensemble les librairies SOPHYA , +ExtLibs, +PI
+SOPHYALIBLIST = -L$(SOPHYALIBP) $(SOPMODLIBLIST)  $(SOPBASELIBS)
+SOPHYAEXTLIBLIST = -L$(SOPHYALIBP) $(SOPMODLIBLIST) $(SOPEXTLIBS) $(SOPBASELIBS)
+SOPHYAALLLIBLIST = -L$(SOPHYALIBP) $(SOPMODLIBLIST) $(SOPPILIBLIST) $(PILIBS) $(SOPEXTLIBS) $(SOPBASELIBS)
+
+SOPHYASLBLIST = -L$(SOPHYASLBP) -lsophya  $(SOPBASELIBS)
+SOPHYAEXTSLBLIST = -L$(SOPHYASLBP) -lextsophya -lsophya $(SOPEXTLIBS) $(SOPBASELIBS)
+SOPHYAALLSLBLIST = -L$(SOPHYASLBP) -lPI -lextsophya -lsophya $(PILIBS) $(SOPEXTLIBS) $(SOPBASELIBS)
+
+#  Commande de link pour creation d'executables
+CXXLINK = $(CXX) $(CXXFLAGS) -bind_at_load
+#  Commande de link pour creation de module pouvant etre charge dynamiquement
+CXXDLL = $(CXX) $(CXXFLAGS) -bundle 
Index: /trunk/SophyaLib/BuildMgr/Darwin_g++_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/Darwin_g++_make.inc	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/Darwin_g++_make.inc	(revision 3840)
@@ -5,6 +5,6 @@
 
 #  Chemin et librairie pour PI 
-PIINC = -I/usr/X11R6/include/ -I/sw/include
-PILIBS = -L/sw/lib -lXm -L/usr/X11R6/lib  -lXt -lX11 
+PIINC = $(PIEXTINC) -I/usr/X11R6/include/
+PILIBS = $(PIEXTLIB) -L/usr/X11R6/lib/ -lXt -lX11 
 
 
Index: /trunk/SophyaLib/BuildMgr/IRIX64_CC_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/IRIX64_CC_make.inc	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/IRIX64_CC_make.inc	(revision 3840)
@@ -5,6 +5,6 @@
 
 #  Chemin et librairie pour PI 
-PIINC = 
-PILIBS = -lXm -lXt -lX11 
+PIINC = $(PIEXTINC) -I/usr/include/
+PILIBS = $(PIEXTLIB) -L/usr/lib/ -lXt -lX11 
 
 
Index: /trunk/SophyaLib/BuildMgr/Linux_g++_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/Linux_g++_make.inc	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/Linux_g++_make.inc	(revision 3840)
@@ -6,6 +6,6 @@
 
 #  Chemin et librairie pour PI 
-PIINC = -I/usr/X11R6/include/
-PILIBS = -L/usr/X11R6/lib/ -lXm -lXt -lX11 
+PIINC = $(PIEXTINC) -I/usr/X11R6/include/
+PILIBS = $(PIEXTLIB) -L/usr/X11R6/lib/ -lXt -lX11 
 
 
Index: /trunk/SophyaLib/BuildMgr/Linux_icc_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/Linux_icc_make.inc	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/Linux_icc_make.inc	(revision 3840)
@@ -5,6 +5,6 @@
 
 #  Chemin et librairie pour PI 
-PIINC = -I/usr/X11R6/include/
-PILIBS = -L/usr/X11R6/lib/ -lXm -lXt -lX11 
+PIINC = $(PIEXTINC) -I/usr/X11R6/include/
+PILIBS = $(PIEXTLIB) -L/usr/X11R6/lib/ -lXt -lX11 
 
 
Index: /trunk/SophyaLib/BuildMgr/OSF1_cxx_make.inc
===================================================================
--- /trunk/SophyaLib/BuildMgr/OSF1_cxx_make.inc	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/OSF1_cxx_make.inc	(revision 3840)
@@ -5,6 +5,6 @@
 
 #  Chemin et librairie pour PI 
-PIINC = 
-PILIBS = -lXm -lXt -lX11 
+PIINC = $(PIEXTINC) -I/usr/include/
+PILIBS = $(PIEXTLIB) -L/usr/lib/ -lXt -lX11 
 
 
Index: /trunk/SophyaLib/BuildMgr/README
===================================================================
--- /trunk/SophyaLib/BuildMgr/README	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/README	(revision 3840)
@@ -2,6 +2,7 @@
 == Code Management scripts / top level makefile for SOPHYA ====
 ===============================================================
-              (C) LAL-IN2P3/CNRS   1998-2007 
-              (C) DAPNIA/CEA       1998-2007
+           (C) LAL-IN2P3/CNRS         1998-2010 
+           (C) Universite Paris Sud   1998-2010 
+           (C) IRFU/CEA               1998-2010
 ===============================================================
 
@@ -17,4 +18,14 @@
 csh> cd BuildMgr/
 csh> ./configure -h
+configure [-sbase SOPHYABASE] [-scxx SOPHYACXX] [-incln] 
+  [-minc mymake.inc]  [-compopt 'cc/cxxOptions'] 
+  [-arch64] [-arch32] [-sasz64] [-ldble128] [-nofpic] [-nothsafe] [-boundcheck] [-sodebug]
+  [-extp dir1 -extp dir2 ...] [-extip dir1 -extip dir2 ... ] [-extlp dir1 -extlp dir2 ... ]
+  [-noextlib] [-noext fits] [-noext fftw] [-noext lapack] [-noext astro]
+  [-alsofftwfloat] [-usefftw2] [-uselapack2] 
+  [-wgrdl] [-epip mdir1 -motp mdir2 ...]  [-noPI] [-slballinone]
+  (See SOPHYA manual/web pages for a detailed description of configure options)
+
+###  Configuration example : 
 # configure with c-fitsio, installed in /usr/local/include and /usr/local/lib, 
 # with g++ as cxx compiler. The target installation directory is $HOME/SObjs/ 
@@ -53,10 +64,11 @@
 6/ Currently tested on the following platform/compilers
 -------------------------------------------------------------------------
-Linux 2.4 , 2.6              g++ 3.x 4.0     (GNU g++ compiler)             
+Linux kernel 2.6             g++ 4.1 4.4     (GNU g++ compiler)    
+Linux kernel 2.6             icc 10.1        (Intel compiler)                           
 MacOSX/Darwin 10.3/10.4      g++ 3.3,4.0     (Apple/GNU compiler)
-Linux 2.4                    icc 9.0         (Intel compiler)                  
+MacOSX/Darwin 10.5           g++ 4.0         (Apple/GNU compiler)
+MacOSX/Darwin 10.6           g++ 4.2         (Apple/GNU compiler)
+IBM AIX 5.3                  xlC 8.0         (AIX native compiler)
 HP/Compaq/DEC OSF 5.x        cxx 6.x         (native Tru64/OSF compiler)
-SGI IRIX64                   CC  7.30        (IRIX-64 native compiler)
-IBM AIX (5.3)                xlC 8.0         (AIX native compiler)
 -------------------------------------------------------------------------
 
@@ -119,5 +131,5 @@
 * Tests/         Simple test programs
 
-* PMixer/        skymixer and utility main programs
+* PMixer/        skymixer and utility main programs (obsolete) 
 
 * PrgUtil/       Utility main programs
Index: /trunk/SophyaLib/BuildMgr/configure
===================================================================
--- /trunk/SophyaLib/BuildMgr/configure	(revision 3839)
+++ /trunk/SophyaLib/BuildMgr/configure	(revision 3840)
@@ -30,4 +30,6 @@
 set defextlib = ( /usr/lib /usr/local/lib )
 
+set defepiinc = ( /usr/X11R6/include )
+set defepilib = ( /usr/X11R6/lib )
 
 #----------------------------------------------------------------------
@@ -37,4 +39,5 @@
 set extpathinc
 set extpathlib
+set avecEXT 
 unset incln
 unset mincname
@@ -52,4 +55,10 @@
 unset alsofftwfloat
 unset slballinone
+## variables pour PI (librairie motif, GNU-readline ...)
+set epipath
+unset wgrdl 
+set avecPI
+
+#### boucle de decodage des arguments :
 while ( $#argv > 0 )
 
@@ -60,6 +69,6 @@
   echo '  [-extp dir1 -extp dir2 ...] [-extip dir1 -extip dir2 ... ] [-extlp dir1 -extlp dir2 ... ]'
   echo '  [-noextlib] [-noext fits] [-noext fftw] [-noext lapack] [-noext astro]'
-  echo '  [-noPI] [-slballinone]'
   echo '  [-alsofftwfloat] [-usefftw2] [-uselapack2] '
+  echo '  [-wgrdl] [-epip mdir1 -motp mdir2 ...]  [-noPI] [-slballinone]'
   echo '  (See SOPHYA manual/web pages for a detailed description of configure options)'
   exit -1
@@ -102,4 +111,5 @@
     set SOPEXTOK[$i] = 0
   end  
+  unset avecEXT
 endif
 if( "$1" == "-noext" ) then
@@ -110,7 +120,4 @@
   end
   shift
-endif
-if( "$1" == "-PI" ) then
-  set SOPPIOK = ( 0 0 0 )
 endif
 if( "$1" == "-alsofftwfloat" ) then
@@ -142,4 +149,18 @@
   set uselapack2
 endif
+## Decodage arguments specifique PI
+if( "$1" == "-noPI" ) then
+  set SOPPIOK = ( 0 0 0 )
+  unset avecPI 
+endif
+## compil piapp avec GNU-readline 
+if( "$1" == "-wgrdl" ) then
+  set wgrdl
+endif
+## Chemin motif , readline ...
+if( "$1" == "-epip" ) then
+  set epipath = ( $epipath $2 )
+  shift
+endif
 if( "$1" == "-slballinone" ) then
 # Pour utiliser une seule librairie libsophyaPIext.so au lieu 
@@ -181,5 +202,5 @@
 end
 
-## ------ Detection linux 64 bits ---
+## ------ Detection linux 64 bits, AIX, IRIX ---
 unset linux64
 if ( `uname`  == "Linux" ) then 
@@ -190,4 +211,6 @@
   endif
 endif
+set sname = `uname`
+if ( ( "$sname" == "IRIX64" ) || ( "$sname" == "AIX" ) ) set arch64 
 
 
@@ -313,5 +336,5 @@
 #### lien  des .h des librairies externes
 echo " "
-echo ">>>>>> 3/  Include files for external libraries "
+echo ">>>>>> 3.1/  Include files for external libraries "
 set i = 0
 while ( $i < $#SOPEXT )
@@ -341,4 +364,42 @@
 end
 
+### recherche des .h Motif et si besoin readline 
+set piextinc 
+if ( $?avecPI ) then
+  echo " "
+  echo ">>>>>> 3.2/ searching include files for Motif "
+  foreach d ( $epipath /usr/X11R6/include )
+    set duminc = `find $d -name Xm -print -follow | head -1 `
+    set dumrep = $duminc:h
+    if ( "$dumrep" != "" ) then
+        set piextinc = "-I$dumrep"
+        echo Includes for Motif found in $dumrep
+        break
+      endif
+    end
+    if ( "$dumrep" == "" ) then
+      echo WARNING: Includes for Motif NOT found
+      echo '    expect problems when compiling PI modules, check sophyamake.inc ... '
+    endif
+  endif
+  if ( $?wgrdl ) then 
+    echo ">>>>>> 3.3/ searching include files for GNU readline "
+  foreach d ( $epipath /usr/local )
+    set duminc = `find $d -name readline -print -follow | head -1 `
+    set dumrep2 = $duminc:h
+    if ( "$dumrep2" != "" ) then
+        if ( "$dumrep2" != "$dumrep" )  set piextinc = "-I$dumrep2 $piextinc"
+        echo Includes for readline found in $dumrep
+        break
+      endif
+    end
+    if ( "$dumrep2" == "" ) then
+      echo WARNING: Includes for readline NOT found
+      echo '    expect problems when compiling piapp, check sophyamake.inc ... '
+    endif
+  endif
+
+  endif 
+endif 
 
 #----------------------------------------------------------------------
@@ -376,9 +437,51 @@
 rm -f $fpath
 
+### recherche des librairies Motif et si besoin readline 
+set piextlib = '-L/usr/X11R6/lib -lXm'
+if ( $?avecPI ) then
+  echo " "
+  echo ">>>>>> 4.2/ searching library Motif (libXm.a) "
+  foreach d ( $epipath /usr/X11R6/lib )
+    set dumlib = `find $d -name libXm.a -print -follow | head -1 `
+    set dumrep = $dumlib:h
+    if ( "$dumrep" != "" ) then
+        set piextlib = "-L$dumrep -lXm"
+        echo Motif library found in $dumrep
+        break
+      endif
+    end
+    if ( "$dumrep" == "" ) then
+      echo WARNING: Motif library NOT found
+      echo '    expect problems when for linking with PI, check sophyamake.inc ... '
+    endif
+  endif
+  if ( $?wgrdl ) then 
+    echo ">>>>>> 4.3/ searching libraries for GNU readline "
+  foreach d ( $epipath /usr/local )
+    set dumlib = `find $d -name libreadline.a -print -follow | head -1 `
+    set dumrep2 = $dumlib:h
+    if ( "$dumrep2" != "" ) then
+        if ( "$dumrep2" != "$dumrep" )  then 
+          set piextlib = "$piextlib -L$dumrep -lreadline -lhistory "
+        else 
+          set piextlib = "$piextlib -lreadline -lhistory "
+        endif
+        echo Libraries for readline found in $dumrep
+        break
+      endif
+    end
+    if ( "$dumrep" == "" ) then
+      echo WARNING: libraries for readline NOT found
+      echo '    expect problems for linking piapp, check sophyamake.inc ... '
+    endif
+  endif
+  endif 
+endif 
+
 
 #----------------------------------------------------------------------
 #### Identification des librairies archives Sophya
 echo " "
-echo ">>>>>> 4.2/  Sophya libraries archives "
+echo ">>>>>> 4.4/  Sophya libraries archives "
 set sopmodlib
 set i = 0
@@ -443,4 +546,8 @@
 echo "# PI libraries  " >> $mfile
 echo "SOPPILIBLIST = $soppilib" >> $mfile
+echo "PIEXTINC = $piextinc" >> $mfile
+echo "PIEXTLIB = $piextlib" >> $mfile
+echo "PIEXTINC = $piextinc" 
+echo "PIEXTLIB = $piextlib"
 
 echo " " >> $mfile 
@@ -448,5 +555,4 @@
 
 # --- Gestion des flags modifiants les options de compilation et liste de librairies (par sed)
-set sname = `uname`
 set sprgfile = $TMPDIR/compop.scom
 rm -f $sprgfile
@@ -477,5 +583,12 @@
   echo "/SOPHYAEXTSLBLIST/s/-lextsophya -lsophya/-lAsophyaextPI/" >>  $sprgfile 
 endif
-if ( $?linux64 ) then
+if ( ! $?avecEXT ) then 
+  echo "/SOPHYAEXTSLBLIST/s/-lextsophya/ /"  >>  $sprgfile 
+  echo "/SOPHYAALLSLBLIST/s/-lextsophya/ /"  >>  $sprgfile 
+endif
+if ( ! $?avecPI ) then 
+  echo "/SOPHYAALLSLBLIST/s/-lPI/ /"  >>  $sprgfile 
+endif
+if ( ( $?linux64 ) && ( $?arch64) ) then
   echo "s?-L/usr/X11R6/lib?-L/usr/X11R6/lib64?g" >>  $sprgfile 
 endif
@@ -574,5 +687,8 @@
   echo "#define LAPACK_V2_EXTSOP" >> $sinc/sspvflags.h
 endif
-echo " " >> $sinc/sspvflags.h 
+if( $?wgrdl ) then
+  echo "/*-- Compile piapp with GNU-readline -- */" >> $sinc/sspvflags.h
+  echo "#define PIA_WITH_GNUREADLINE" >> $sinc/sspvflags.h
+endif
 if( $?slballinone ) then
   echo "/*------ Use of single shared lib for SOPHYA+extlibs+PI ---- */" >> $sinc/sspvflags.h
