Index: trunk/SophyaLib/BuildMgr/configure
===================================================================
--- trunk/SophyaLib/BuildMgr/configure	(revision 3818)
+++ 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
