Salome HOME
SALOME 6.5.0 preparation: fix performance problem in modify la files procedure
authorvsr <vsr@opencascade.com>
Tue, 29 May 2012 12:55:24 +0000 (12:55 +0000)
committervsr <vsr@opencascade.com>
Tue, 29 May 2012 12:55:24 +0000 (12:55 +0000)
config_files/common.sh

index 2e0e61210c29c1a44169ced06ed57661be27a198..bcb3e516220e22af680476863a8350d83ed2b707 100755 (executable)
@@ -670,6 +670,92 @@ cd $ldir
 ldir=`pwd`
 la_files=`find . -name "*.la"`
 
+# netgen dir
+netgendir=`printenv NETGENHOME`
+# freetype dir
+freetypedir=`printenv FREETYPEDIR`
+# ftgl dir
+ftgldir=`printenv FTGLDIR`
+# gl2ps dir
+gl2psdir=`printenv GL2PSHOME`
+# freeimage dir
+freeimagedir=`printenv FREEIMAGEDIR`
+# tbb dir
+tbbbasedir=`printenv TBBHOME`
+TBBKERNEL='cc4.1.0_libc2.4_kernel2.6.16.21'
+if test `uname -m` = "x86_64" ; then
+    export TBBMODE="intel64/$TBBKERNEL"
+else
+    export TBBMODE="ia32/$TBBKERNEL"
+fi
+tbbdir=${tbbbasedir}/lib/$TBBMODE
+# cgns dir
+cgnslibdir=`printenv CGNSHOME`
+# occt dir
+casdir=`printenv CASROOT`/lib
+if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
+if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
+# omniorb dir
+omnidir=`printenv OMNIORBDIR`/lib
+# vtk dir
+vtkpath=`printenv VTKHOME`
+if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
+    LIB_PREFIX=64
+elif [ -d ${vtkpath}/lib ] ; then
+    LIB_PREFIX=""
+else
+    LIB_PREFIX=64
+fi
+vtkldir=${vtkpath}/lib${LIB_PREFIX}
+vtkdir=${vtkldir}/vtk-5.0
+# hdf dir
+hdfdir=`printenv HDF5HOME`/lib
+# med dir
+meddir=`printenv MED3HOME`/lib
+# qwt dir
+qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
+# python dir
+where_python=`which python`                 # e.g. /usr/bin/python
+if [ -n "$where_python" ] ; then
+    where_python=`dirname $where_python`    # --> /usr/bin
+    where_python=`dirname $where_python`    # --> /usr
+    python_version=`python -c "import sys; print sys.version[:3]"`
+    pythondir=${where_python}/lib/python${python_version}
+fi
+# sip dir
+sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
+# pyqt dir
+pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
+# tcl/tk dir
+tcldir=`printenv TCLHOME`/lib
+# boost dir
+boostdir=`printenv BOOSTDIR`/lib
+# blsurf dir
+blsurfdir=`printenv BLSURFHOME`/lib
+# libxml2 dir
+libxmldir=`printenv LIBXML_DIR`/lib
+# metis dir
+metisdir=`printenv METISDIR`
+# scotch dir
+scotchbindir=`printenv SCOTCHDIR`/bin
+scotchlibdir=`printenv SCOTCHDIR`/lib
+# gl dir
+if test `uname -m` = "x86_64" ; then
+    libGLpath=/usr/lib64/libGL.la
+else
+    libGLpath=/usr/lib/libGL.la
+fi
+# graphviz dir
+graphvizdir=`printenv GRAPHVIZHOME`/lib
+# qscintilla dir
+qscintilladir=`printenv QSCINTILLA_DIR`/lib
+# expat dir
+expatdir=${EXPAT_ROOT}/lib
+# paraview dir
+paraviewdir=`printenv PVHOME`/lib
+# qt dir
+qtdir=`printenv QTDIR`/lib
+
 for l in X ${la_files}; do
 
 if [ "$l" != "X" ] ; then
@@ -689,72 +775,42 @@ if [ "$l" != "X" ] ; then
        fi
     done
 
-   # . process CASCASDE products dependencies
-    netgendir=`printenv NETGENHOME`
-    freetypedir=`printenv FREETYPEDIR`
-    ftgldir=`printenv FTGLDIR`
-    gl2psdir=`printenv GL2PSHOME`
-    freeimagedir=`printenv FREEIMAGEDIR`
-    tbbbasedir=`printenv TBBHOME`
-    cgnslibdir=`printenv CGNSHOME`
+    # . process netgen dependencies
+    if [ -n "${netgendir}" ] && [ -d "${netgendir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*netgen-[0-9.]\+/lib% \1${netgendir}/lib%g" $l
+    fi
 
-    TBBKERNEL='cc4.1.0_libc2.4_kernel2.6.16.21'
-    if test `uname -m` = "x86_64" ; then
-       export TBBMODE="intel64/$TBBKERNEL"
-    else
-       export TBBMODE="ia32/$TBBKERNEL"
+    # . process freetype dependencies
+    if [ -n "${freetypedir}" ] && [ -d "${freetypedir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freetype-[0-9.]\+/lib% \1${freetypedir}/lib%g" $l
     fi
 
-    tbbdir=${tbbbasedir}/lib/$TBBMODE
+    # . process ftgl dependencies
+    if [ -n "${ftgldir}" ] && [ -d "${ftgldir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ftgl-[0-9.]\+/lib% \1${ftgldir}/lib%g" $l
+    fi
 
-       if [ -n "${netgendir}" ] && [ -d "${netgendir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/netgen-[0-9]\.[0-9]\.[0-9][0-9]/lib[[:space:]]\)\(.*\)%\1 -L${netgendir}/lib \3%g" \
-               -e 's%\(.*\)\([[:space:]].*libnglib.la\)\(.*\)%\1 -lnglib \3%g' $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l    
-       if [ -n "${freetypedir}" ] && [ -d "${freetypedir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/freetype-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 -L${freetypedir}/lib \3%g" \
-               -e 's%\(.*\)\([[:space:]].*libfreetype.la\)\(.*\)%\1 -lfreetype \3%g' $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
-       if [ -n "${ftgldir}" ] && [ -d "${ftgldir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/ftgl-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 -L${ftgldir}/lib \3%g" \
-               -e 's%\(.*\)\([[:space:]].*libftgl.la\)\(.*\)%\1 -lftgl \3%g' $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
-       if [ -n "${gl2psdir}" ] && [ -d "${gl2psdir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/gl2ps-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 -L${gl2psdir}/lib \3%g" $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
-       if [ -n "${freeimagedir}" ] && [ -d "${freeimagedir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/freeimage-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 -L${freeimagedir}/lib \3%g" $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
-       if [ -n "${freeimagedir}" ] && [ -d "${freeimagedir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/freeimage-[0-9]\.[0-9][0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 -L${freeimagedir}/lib \3%g" $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
-       if [ -n "${tbbdir}" ] && [ -d "${tbbdir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/tbb[^[:space:]]*/lib[^[:space:]]*\)\(.*\)%\1 -L${tbbdir} \3%g" $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
-       if [ -n "${cgnslibdir}" ] && [ -d "${cgnslibdir}" ] ; then
-           sed -e "s%\(.*\)\([[:space:]].*-L.*/cgnslib-[0-9]\.[0-9]\.[0-9]/lib[[:space:]]\)\(.*\)%\1 -L${cgnslibdir}/lib \3%g" $l > _$l
-           mv -f _$l $l
-       fi
-       chmod a+x $l
+    # . process gl2ps dependencies
+    if [ -n "${gl2psdir}" ] && [ -d "${gl2psdir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*gl2ps-[0-9.]\+/lib% \1${gl2psdir}/lib%g" $l
+    fi
+    
+    # . process freeimage dependencies
+    if [ -n "${freeimagedir}" ] && [ -d "${freeimagedir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*freeimage-[0-9.]\+/lib% \1${freeimagedir}/lib%g" $l
+    fi
+
+    # . process tbb dependencies
+    if [ -n "${tbbdir}" ] && [ -d "${tbbdir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*tbb[^[:space:]]*/lib[^[:space:]]*% \1${tbbdir}%g" $l
+    fi
+    
+    # . process cgns dependencies
+    if [ -n "${cgnslibdir}" ] && [ -d "${cgnslibdir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*cgnslib-[0-9.]\+/lib% \1${cgnslibdir}/lib%g" $l
+    fi
 
     # . process CAS.CADE dependencies
-    casdir=`printenv CASROOT`/lib
-    if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/Linux/lib ; fi
-    if [ ! -d ${casdir} ] ; then casdir=`printenv CASROOT`/lin/lib ; fi
     if [ -n "${CASROOT}" ] && [ -d "${casdir}" ] ; then
         sed -e "s%-L[^[:space:]]*OCCT[^[:space:]]*/install/lib%-L${casdir}%g" \
            -e "s%[^[:space:]]*OCCT[^[:space:]]*/install/lib/%${casdir}/%g"   \
@@ -764,178 +820,106 @@ if [ "$l" != "X" ] ; then
     fi
 
     # . process omniORB dependencies
-    omnidir=`printenv OMNIORBDIR`/lib/i586_linux_2.0_glibc2.1
-    if [ ! -d ${omnidir} ] ; then omnidir=`printenv OMNIORBDIR`/lib ; fi
     if [ -n "${OMNIORBDIR}" ] && [ -d "${omnidir}" ] ; then
-       # echo $l $OMNIORBDIR $omnidir
-       sed -e "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g" \
-           -e "s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*omni[^[:space:]]*%-L${omnidir}%g;s%-R[^[:space:]]*omni[^[:space:]]*%-R${omnidir}%g" $l
     fi
 
     # . process VTK dependencies
-    vtkpath=`printenv VTKHOME`
-    if [ `uname -m` = "x86_64" ] && [ -d ${vtkpath}/lib64 ] ; then
-       LIB_PREFIX=64
-    elif [ -d ${vtkpath}/lib ] ; then
-       LIB_PREFIX=""
-    else
-       LIB_PREFIX=64
-    fi
-    vtkldir=${vtkpath}/lib${LIB_PREFIX}
-    vtkdir=${vtkldir}/vtk-5.0
     if [ -n "${VTKHOME}" ] && [ -d "${vtkdir}" ] && [ -d "${vtkldir}" ] ; then
-       # echo $l $VTKHOME $vtkdir
-       sed -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g" \
-           -e "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)/vtk\-5\.0%-L${vtkdir}%g;s%-L[^[:space:]]*VTK[^[:space:]]*/\(lib\|lib64\)%-L${vtkldir}%g" $l
     fi
 
     # . process HDF dependencies
-    hdfdir=`printenv HDF5HOME`/lib
     if [ -n "${HDF5HOME}" ] && [ -d "${hdfdir}" ] ; then
-       # echo $l $HDF5HOME $hdfdir
-       sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*hdf[^[:space:]/]*/lib% \1${hdfdir}%g" $l
     fi
 
     # . process MED dependencies
-    meddir=`printenv MED3HOME`/lib
     if [ -n "${MED3HOME}" ] && [ -d "${meddir}" ] ; then
-       # echo $l $MED3HOME $meddir
-       sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*med[^[:space:]/]*/lib% \1${meddir}%g" $l
     fi
 
     # . process qwt dependencies
-    qwtdir=`find_in_path libqwt.so ${LD_LIBRARY_PATH}`
     if [ -n "${qwtdir}" ] && [ -d "${qwtdir}" ] ; then
-       # echo $l $qwtdir
-       sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qwt[^[:space:]/]*/lib% \1${qwtdir}%g" $l
     fi
 
     # . process qt dependencies
-    qtdir=`printenv QTDIR`/lib
     if [ -n "${QTDIR}" ] && [ -d "${qtdir}" ] ; then
-       # echo $l $QTDIR $qtdir
-       sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*qt[^[:space:]/]*/lib% \1${qtdir}%g" $l
     fi
 
     # . process python dependencies
-    where_python=`which python`                 # e.g. /usr/bin/python
-    if [ -n "$where_python" ] ; then
-        where_python=`dirname $where_python`    # --> /usr/bin
-        where_python=`dirname $where_python`    # --> /usr
-       python_version=`python -c "import sys; print sys.version[:3]"`
-       # echo $l $where_python $python_version
-       sed -e "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${where_python}/lib/python${python_version}\1%g" $l > $l"_"
-       mv -f $l"_" $l
+    if [ -n "${pythondir}" ] && [ -d "${pythondir}" ] ; then
+       sed -i "s%-L[^[:space:]]*python[0-9]\.[0-9]\([^[:space:]]*\)%-L${pythondir}\1%g" $l
     fi
 
     # . process sip dependencies
-    sipdir=`find_in_path sip.so ${LD_LIBRARY_PATH}`
     if [ -n "${sipdir}" ] && [ -d "${sipdir}" ] ; then
-       # echo $l $sipdir
-       sed -e "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*sip[^[:space:]]*%-L${sipdir}%g" $l
     fi
 
     # . process PyQt dependencies
-    pyqtdir=`find_in_path Qt.so ${LD_LIBRARY_PATH}`
     if [ -n "${pyqtdir}" ] && [ -d "${pyqtdir}" ] ; then
-       # echo $l $pyqtdir
-       sed -e "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*PyQt[^[:space:]]*%-L${pyqtdir}%g" $l
     fi
 
     # . process tcl/tk dependencies
-    tcldir=`printenv TCLHOME`/lib
     if [ -n "${tcldir}" ] && [ -d "${tcldir}" ] ; then
-       # echo $l $TCLHOME $tcldir
-       sed -e "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*tcltk[^[:space:]]*/lib%-L${tcldir}%g" $l
     fi
 
     # . process boost dependencies
-    boostdir=`printenv BOOSTDIR`/lib
     if [ -n "${boostdir}" ] && [ -d "${boostdir}" ] ; then
-       # echo $l $BOOSTDIR $boostdir
-       sed -e "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*boost[^[:space:]]*/lib%-L${boostdir}%g" $l
     fi
 
     # . process blsurf dependencies
-    blsurfdir=`printenv BLSURFHOME`/lib
     if [ -n "${blsurfdir}" ] && [ -d "${blsurfdir}" ] ; then
-       # echo $l $BOOSTDIR $boostdir
-       sed -e "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l > $l"_"
-       mv -f $l"_" $l
+       sed -i "s%-L[^[:space:]]*BLSurf[^[:space:]]*/lib%-L${blsurfdir}%g" $l
     fi
 
     # . process libxml dependencies
-    libxmldir=`printenv LIBXML_DIR`/lib
-    if [ ! -d ${libxmldir} ] ; then libxmldir=`printenv  LIBXML_DIR`/lib ; fi
-    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9]/lib% \1${libxmldir}%g" $l > $l"_"
-    mv -f $l"_" $l     
-    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" $l > $l"_"
-    mv -f $l"_" $l
+    if [ -n "${libxmldir}" ] && [ -d "${libxmldir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2-[0-9]\.[0-9]\.[0-9]/lib% \1${libxmldir}%g;s%[[:space:]]\(-L\)\?[^[:space:]]*libxml2/lib% \1${libxmldir}%g" $l
+    fi
 
     # . process metis dependencies
-    metisdir=`printenv METISDIR`
-    if [ ! -d ${metisdir} ] ; then metisdir=`printenv  METISDIR` ; fi
-    sed -e "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l > $l"_"
-    mv -f $l"_" $l     
+    if [ -n "${metisdir}" ] && [ -d "${metisdir}" ] ; then
+       sed -i "s%-L[^[:space:]]*metis[^[:space:]]*%-L${metisdir}%g" $l
+    fi
 
     # . process scotch dependencies
-    scotchdir=`printenv SCOTCHDIR`/bin
-    if [ ! -d ${scotchdir} ] ; then scotchdir=`printenv SCOTCHDIR`/bin ; fi
-    sed    -e "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchdir}%g" $l > $l"_"
-    mv -f $l"_" $l     
-    scotchlib=`printenv SCOTCHDIR`/lib
-    if [ ! -d ${scotchlib} ] ; then scotchlib=`printenv SCOTCHDIR`/lib ; fi
-    sed    -e "s%-L[^[:space:]]*scotch[^[:space:]]*/lib%-L${scotchlib}%g" $l > $l"_"
-    mv -f $l"_" $l     
+    if [ -n "${scotchbindir}" ] && [ -d "${scotchbindir}" ] ; then
+       sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/bin%-L${scotchbindir}%g" $l
+    fi
+    if [ -n "${scotchlibdir}" ] && [ -d "${scotchlibdir}" ] ; then
+       sed -i "s%-L[^[:space:]]*scotch[^[:space:]]*/lib%-L${scotchlibdir}%g" $l
+    fi
 
     # . process libGL.la dependencies
-    if test `uname -m` = "x86_64" ; then
-      libGLpath=/usr/lib64/libGL.la
-    else
-      libGLpath=/usr/lib/libGL.la
-    fi
-    sed -e "s%$libGLpath%""%g" $l > $l"_"
-    mv -f $l"_" $l
+    sed -i "s%$libGLpath%""%g" $l
 
     # . process graphviz dependencies
-    graphvizdir=`printenv GRAPHVIZHOME`/lib
-    if [ ! -d ${graphvizdir} ] ; then graphvizdir=`printenv GRAPHVIZHOME`/lib ; fi
-    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g" \
-       -e "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" $l > $l"_"
-    chmod -f --reference=$l $l"_"
-    mv -f $l"_" $l     
+    if [ -n "${graphvizdir}" ] && [ -d "${graphvizdir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz-[0-9]\.[0-9]\+\.[0-9]/lib% \1${graphvizdir}%g;s%[[:space:]]\(-L\)\?[^[:space:]]*graphviz/lib% \1${graphvizdir}%g" $l
+    fi
+
     # . process QScintilla dependencies
-    qscintilladir=`printenv QSCINTILLA_DIR`/lib
-    if [ ! -d ${qscintilladir} ] ; then qscintilladir=`printenv QSCINTILLA_DIR`/lib ; fi
-    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" $l > $l"_"
-    chmod -f --reference=$l $l"_"
-    mv -f $l"_" $l     
+    if [ -n "${qscintilladir}" ] && [ -d "${qscintilladir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*QScintilla-[0-9]\.[0-9]\(\.[0-9]\)\?/lib% \1${qscintilladir}%g" $l
+    fi
 
     # . process expat-2.0.1 dependencies
-    expatdir=${EXPAT_ROOT}/lib
-    sed -e "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g" \
-       -e "s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" $l > $l"_"
-    chmod -f --reference=$l $l"_"
-    mv -f $l"_" $l     
+    if [ -n "${expatdir}" ] && [ -d "${expatdir}" ] ; then
+       sed -i "s%-L[^[:space:]]*expat[^[:space:]]*/lib%-L${expatdir}%g;s%[^[:space:]]*expat[^[:space:]]*/lib/libexpat.la%-lexpat%g" $l
+    fi
 
     # . process ParaView dependencies
-    paraviewdir=`printenv PVHOME`/lib
-    if [ ! -d ${paraviewdir} ] ; then paraviewdir=`printenv PVHOME`/lib ; fi
-    sed -e "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]\+\.[0-9]/lib% \1${paraviewdir}%g" $l > $l"_"
-    chmod -f --reference=$l $l"_"
-    mv -f $l"_" $l 
-
+    if [ -n "${paraviewdir}" ] && [ -d "${paraviewdir}" ] ; then
+       sed -i "s%[[:space:]]\(-L\)\?[^[:space:]]*ParaView-[0-9]\.[0-9]\+\.[0-9]/lib% \1${paraviewdir}%g" $l
+    fi
+    
 fi
 done