diff -urN cad/salome.orig/Makefile cad/salome/Makefile
--- cad/salome.orig/Makefile	2010-04-04 18:01:22.000000000 +0200
+++ cad/salome/Makefile	2010-05-02 23:05:25.000000000 +0200
@@ -17,7 +17,7 @@
 
 MAINTAINER=	devel@stasyan.com
 
-OPTIONS= \
+OPTIONS=	\
 		GEOM		"GEOM module" 								on  \
 		MED			"MED module" 								on  \
 		SMESH		"SMESH module (require MED & GEOM)" 		on  \
@@ -28,7 +28,7 @@
 		RANDOMIZER	"Randomizer module" 						on  \
 		SIERPINSKY	"Sierpinsky module" 						on  \
 		CPPUNIT		"build with C++ unit testing framework" 	off \
-		MPI			"build with support parrallel calculation" 	off
+		MPI			"build with support parallel calculation" 	off
 
 RESOURCEDIR=	${DATADIR}/resources
 
diff -urN cad/salome.orig/Makefile.ext cad/salome/Makefile.ext
--- cad/salome.orig/Makefile.ext	2010-02-12 23:17:21.000000000 +0100
+++ cad/salome/Makefile.ext	2010-05-02 22:29:18.000000000 +0200
@@ -4,13 +4,8 @@
 USE_GMAKE=	yes
 USE_LDCONFIG=	yes
 SAL_MODULE=	${PKGNAMESUFFIX:S/-//}
-#.if ${SAL_MODULE} == "med" || ${SAL_MODULE} == "smesh" || ${SAL_MODULE} == "visu" || ${SAL_MODULE} == "sierpinsky" || ${SAL_MODULE} == "multipr"
-.if !${SAL_MODULE} == "gui" 
 USE_FORTRAN=yes
 USE_GCC=        4.4
-.else
-USE_GCC=        4.5
-.endif
 #SAL_MODULE_UPPER=	`${ECHO} ${SAL_MODULE} | ${AWK} '{ print(toupper($$1)); }'`
 #SAL_MODULE_UPPER=	YACS
 
@@ -37,9 +32,8 @@
 CONFIGURE_ARGS+=	--prefix=${PREFIX}
 CONFIGURE_ARGS+=	--enable-debug
 CONFIGURE_ENV+=		MACHINE=${OPSYS:U}
-#CXXFLAGS+=		-L${LOCALBASE}/lib -I/usr/include -I${LOCALBASE}/include -D__freebsd__ -DFREEBSD -DHAVE_IOSTREAM -DHAVE_LIMITS_H -DHAVE_IOMANIP -DMPICH_IGNORE_CXX_SEEK
 CPPFLAGS+=		-L${LOCALBASE}/lib -I/usr/include -I${LOCALBASE}/include -D__freebsd__ -DFREEBSD -DHAVE_IOSTREAM -DHAVE_LIMITS_H -DHAVE_IOMANIP -DMPICH_IGNORE_CXX_SEEK
-CXXFLAGS+=		-ffriend-injection -fno-inline -fpermissive -L${LOCALBASE}/lib -L${LOCALBASE}/lib/salome
+CXXFLAGS+=		-ffriend-injection -fno-inline -fpermissive -fPIC -L${LOCALBASE}/lib -L${LOCALBASE}/lib/salome
 CONFIGURE_SCRIPT=	../configure
 PATCH_WRKSRC=		${WRKDIR}/${DISTNAME}/${SAL_MODULE_UPPER}_SRC_${RELEASENAME}
 WRKSRC=			${PATCH_WRKSRC}
@@ -53,6 +47,7 @@
 .if !${SAL_MODULE} == "kernel"
 .for D in ${${SAL_MODULE_UPPER}_DEPEND}
     CONFIGURE_ENV+=	${D}_ROOT_DIR=${LOCALBASE}
+    AUTOTOOLS_ENV+=	${D}_ROOT_DIR=${LOCALBASE}
     CPPFLAGS+=		-L${LOCALBASE}/lib/salome
 .endfor
 .endif
@@ -74,6 +69,7 @@
 .if ${SAL_MODULE} == "smesh" || ${SAL_MODULE} == "sierpinsky" || ${SAL_MODULE} == "multipr" || ${SAL_MODULE} == "visu"
 BUILD_DEPENDS+=		${RESOURCEDIR}/med:${PORTSDIR}/cad/salome-med
 RUN_DEPENDS+=		${RESOURCEDIR}/med:${PORTSDIR}/cad/salome-med
+AUTOTOOLS_ENV+= 	MED2HOME=${LOCALBASE}
 .endif
 
 #Depndency from GEOM module
@@ -95,12 +91,29 @@
 #Dependency from other ports
 ###########################################################################
 #Dependency from autotools
-USE_AUTOTOOLS=	autoconf:262 automake:15 libtool:22
+USE_AUTOTOOLS=	autoconf:262 automake:15 libtool:22 aclocal:19
+.if ${SAL_MODULE} == "kernel"
+    ACLOCAL_ARGS=	-I salome_adm/unix/config_files
+.else
+. if ${SAL_MODULE} == "yacs"
+    ACLOCAL_ARGS=	-I adm/unix/config_files
+    USE_AUTOTOOLS+=	autoheader:262
+    AUTOHEADER_ARGS=	-I adm/unix/config_files
+. else
+    ACLOCAL_ARGS=	-I adm_local/unix/config_files -I ${LOCALBASE}/salome_adm/unix/config_files 
+.	if ${SAL_MODULE} != "gui"
+    ACLOCAL_ARGS+= -I ${LOCALBASE}/adm_local/unix/config_files
+.	endif
+. endif
+.endif
+LIBTOOLFLAGS=--force --copy --automake 
+AUTOMAKE_ARGS=--add-missing --copy --gnu
 
 #Dependency from HDF5
 .if !${SAL_MODULE} == "randomizer" &&  !${SAL_MODULE} == "yacs" && !${SAL_MODULE} == "hello" && !${SAL_MODULE} == "pyhello"
 LIB_DEPENDS+=		hdf5.0:${PORTSDIR}/science/hdf5
 CONFIGURE_ARGS+=	--with-hdf5=${LOCALBASE} 
+AUTOTOOLS_ENV+= 	HDF5HOME=${LOCALBASE}
 .endif
 
 #Dependency from Opencascade
@@ -108,6 +121,7 @@
 LIB_DEPENDS+=		TKernel.0:${PORTSDIR}/cad/opencascade
 CASROOT=		${LOCALBASE}/OpenCAS/ros
 CONFIGURE_ENV+=		CASROOT=${CASROOT}
+AUTOTOOLS_ENV+= 	CASROOT=${CASROOT}
 #CXXFLAGS+=		-I${CASROOT}/inc
 .endif
 
@@ -141,6 +155,7 @@
 CONFIGURE_ENV+=		QTDIR=${LOCALBASE}
 QTFLAGS+=		-I${LOCALBASE}/include/qt4 -L${LOCALBASE}/lib/qt4
 QT_COMPONENTS=		gui opengl svg xml qmake_build moc_build rcc_build uic_build linguist
+AUTOTOOLS_ENV+= 	QTDIR=${LOCALBASE}
 .endif
 
 #Dependency from qscintilla2
@@ -153,7 +168,7 @@
 #Dependency from vtk
 .if !${SAL_MODULE} == "kernel" && !${SAL_MODULE} == "randomizer"
 LIB_DEPENDS+=		vtkCommon.5:${PORTSDIR}/math/vtk5
-CONFIGURE_ENV+=		VTKHOME=${LOCALBASE}
+CONFIGURE_ENV+=		VTKHOME=${LOCALBASE} VTKSUFFIX=-5.4
 .endif
 
 #Dependency from qwt5
@@ -162,6 +177,7 @@
 #CONFIGURE_ENV+=		QWTHOME=${LOCALBASE}
 CONFIGURE_ARGS+=	--with-qwt=${LOCALBASE}
 CPPFLAGS+=		-I/${LOCALBASE}/include/qwt/
+AUTOTOOLS_ENV+= 	QWTHOME=${LOCALBASE}
 .endif
 
 #Dependency from omniORB & py-omniorb
@@ -169,6 +185,7 @@
 LIB_DEPENDS+=		omniORB4.1:${PORTSDIR}/devel/omniORB
 RUN_DEPENDS+=		${LOCALBASE}/include/omniORBpy.h:${PORTSDIR}/devel/py-omniorb
 RUN_DEPENDS+=		notifd:${PORTSDIR}/devel/omniNotify
+AUTOTOOLS_ENV+= 	OMNIORBDIR=${LOCALBASE}
 .endif
 
 #Dependency from sip
@@ -209,8 +226,11 @@
 LIB_DEPENDS+=		argp.0:${PORTSDIR}/devel/argp-standalone
 LIB_DEPENDS+=		expat.6:${PORTSDIR}/textproc/expat2
 LDFLAGS+=		-largp 
+BUILD_DEPENDS+=		sphinx-build:${PORTSDIR}/textproc/py-sphinx
 .endif
 
+RUN_DEPENDS+=		bash:${PORTSDIR}/shells/bash
+
 #Don't strip binaries 
 .if ${SAL_MODULE} == "multipr"
 STRIP=		
@@ -228,10 +248,10 @@
 .endif
 .endif
 
+#optionally dependency from mpich2
 .if ${SAL_MODULE} == "kernel" || ${SAL_MODULE} == "med"
 .if defined(WITH_MPI)
-BUILD_DEPENDS+=	${LOCALBASE}/mpich2/bin/mpicc:${PORTSDIR}/net/mpich2
-RUN_DEPENDS+=	${LOCALBASE}/mpich2/lib/libmpich.so:${PORTSDIR}/net/mpich2
+LIB_DEPENDS+=	mpich.1:${PORTSDIR}/net/mpich2
 CONFIGURE_ARGS+=	--with-mpich=${LOCALBASE}/mpich2 --with-mpi=${LOCALBASE}/mpich2
 PLIST_SUB+=     MPI=""
 .		else
@@ -247,10 +267,21 @@
 #MAKE_JOBS_SAFE=	yes
 
 .if ${SAL_MODULE} == "kernel"
-.		if ${PYTHON_REL} > 260
     post-patch:
+.		if ${PYTHON_REL} > 260
 	${REINPLACE_CMD} 's|fromlist=None)|fromlist=None, level=-1)|g' ${WRKSRC}/src/KERNEL_PY/import_hook.py
 .		endif
+	${REINPLACE_CMD} 's|/bin/bash|${LOCALBASE}/bin/bash|g' ${WRKSRC}/bin/appli_clean.sh ${WRKSRC}/bin/runSalome
+.endif
+
+.if ${SAL_MODULE} == "gui"
+    post-patch:
+	${REINPLACE_CMD} 's|/bin/bash|${LOCALBASE}/bin/bash|g' ${WRKSRC}/bin/runLightSalome.sh
+.endif
+
+.if ${SAL_MODULE} == "yacs"
+    post-patch:
+	${CP} ${WRKSRC}/configure.in.base  ${WRKSRC}/configure.in
 .endif
 
 .if ${SAL_MODULE} == "kernel"
@@ -260,32 +291,43 @@
 	${REINPLACE_CMD} 's|__rpc_xdr|XDR|g' ${WRKSRC}/src/Communication/rpc/xdr.h
 .endif
 
+MMDEPENDS=${SAL_MODULE_UPPER}_DEPEND
+AUTOTOOLS_ENV+=	${SAL_MODULE_UPPER}_ROOT_DIR=${PREFIX}
+
+.for D in ${MMDEPENDS}
+    AUTOTOOLS_ENV+=${D}_ROOT_DIR=${LOCALBASE}
+.endfor
+
+run-autotools-aclocal:
+	echo "Start of aclocal"
+	@(cd ${PATCH_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${ACLOCAL} \
+		${ACLOCAL_ARGS})
+	echo "End of aclocal"
+
+run-autotools-autoconf:
+	echo "Start of autoconf"
+	@(cd ${PATCH_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOCONF} \
+		${AUTOCONF_ARGS})
+	echo "End of autotools"
+
+run-autotools-automake:
+	echo "Start of automake"
+	@(cd ${PATCH_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOMAKE} \
+		${AUTOMAKE_ARGS})
+	echo "End of automake"
+
+.if ${SAL_MODULE} == "yacs"
+run-autotools-autoheader:
+	echo "Start of autoheader"
+	@(cd ${PATCH_WRKSRC} && ${SETENV} ${AUTOTOOLS_ENV} ${AUTOHEADER} \
+		${AUTOHEADER_ARGS})
+	echo "End of autoheader"
+.endif
+
+patch-autotools:
+	@(cd ${PATCH_WRKSRC}; ${LIBTOOLIZE} --force;)
 
-    pre-configure:
-#	SAL_MODULE_UPPER=`${ECHO} ${SAL_MODULE} | ${AWK} '{ print(toupper($1)); }'`; \
-	MMDEPENDS="${${SAL_MODULE_UPPER}_DEPEND}"; \
-	for D in $${MMDEPENDS}; do \
-	      export "$$D"_ROOT_DIR=${LOCALBASE}; \
-		if test "$$D"="MED2"; then \
-		    export MED2HOME=${LOCALBASE}; \
-		fi; \
-		if test "$$D"="QWT"; then \
-		    export QWTHOME=${LOCALBASE}; \
-		fi; \
-		if test "$$D"="HDF5HOME"; then \
-		    export HDF5HOME=${LOCALBASE}; \
-		fi; \
-		if test "$$D"="CASROOT"; then \
-		    export CASROOT=${CASROOT}; \
-		fi; \
-		if test "$$D"="QT"; then \
-		    export QTDIR=${LOCALBASE}; \
-		fi; \
-		if test "$$D"="OMNIORB"; then \
-		    export OMNIORBDIR=${LOCALBASE}; \
-		fi; \
-		echo "$$D"_ROOT_DIR; \
-	done; \
-	MACHINE=${OPSYS:U}; export MACHINE;  set ${SAL_MODULE_UPPER}_ROOT_DIR ${PREFIX};  export ${SAL_MODULE_UPPER}_ROOT_DIR; cd ${WRKSRC}; ${MKDIR} ${BUILD_WRKSRC}; ${SH} ./build_configure
+pre-configure:
+	${MKDIR} ${BUILD_WRKSRC}
 
 .include <bsd.port.post.mk>
