--- clean/ros/configure.in	2008-01-18 10:19:13.000000000 -0600
+++ working/ros/configure.in	2008-01-17 16:40:51.000000000 -0600
@@ -1,19 +1,22 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT(config.h.in)
+AC_INIT([OpenCAS], [5.0DVP1])
 AC_CONFIG_AUX_DIR(make)
-AM_INIT_AUTOMAKE(OpenCAS,5.0DVP1)
+AM_INIT_AUTOMAKE([foreign])
 AC_CANONICAL_HOST
 dnl AM_CONFIG_SRCDIR(src/Standard/Standard.cxx)
 
-CFLAGS="$CFLAGS "
-CXXFLAGS="$CXXFLAGS "
-
 AC_PROG_CC
 
 AM_CONFIG_HEADER(config.h)
 
 dnl AM_MAINTAINER_MODE
 
+# OpenCascade doesn't support a proper 'make install'.  
+# 'make install' only installs libraries and executables
+# (not headers, data files, etc.)  To make things work,
+# compiled libraries should be placed in subdirectory 
+# of source tree.  Make that the default.
+AC_PREFIX_DEFAULT([`pwd`/`uname`])
 
 AC_AIX
 AC_ISC_POSIX
@@ -33,95 +36,32 @@
 AC_PROG_YACC
 AC_PROG_MAKE_SET
 
-# AC_ENABLE_PRODUCTION
-AC_DEFUN(AC_ENABLE_PRODUCTION, [dnl
-define([AC_ENABLE_PRODUCTION_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(production,
-changequote(<<, >>)dnl
-<<  --enable-production[=PKGS]  build without debug information [default=>>AC_ENABLE_PRODUCTION_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_production=yes ;;
-no) enable_production=no ;;
-*)
-  enable_production=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_production=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_production=AC_ENABLE_PRODUCTION_DEFAULT)dnl
-
-if test "X$enable_production" = "Xyes"; then
-  CFLAGS="$CFLAGS -O2 "
-  CXXFLAGS="$CXXFLAGS -O2 "
+AC_ARG_ENABLE([debug],
+              [AC_HELP_STRING([--enable-debug],[Debug Symbols])],
+              [enable_debug=${enableval}],[enable_debug=no])
+AC_ARG_ENABLE([production],
+              [AC_HELP_STRING([--enable-production],[Optimized build (default)])],
+              [enable_prod=${enableval}],[enable_prod=])
+
+# Enable production unless enable-default was specified
+if test "x$enable_prod" = "x"; then
+  if test "x$enable_debug" != "xyes"; then
+    enable_prod=yes
+  fi
 fi
-])
 
-# AC_DISABLE_PRODUCTION - set the default flag to --disable-production
-AC_DEFUN(AC_DISABLE_PRODUCTION, [AC_ENABLE_PRODUCTION(no)])
-
-# AC_ENABLE_DEBUG
-AC_DEFUN(AC_ENABLE_DEBUG, [dnl
-define([AC_ENABLE_DEBUG_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE(debug,
-changequote(<<, >>)dnl
-<<  --enable-debug[=PKGS]  build without debug information [default=>>AC_ENABLE_DEBUG_DEFAULT],
-changequote([, ])dnl
-[p=${PACKAGE-default}
-case "$enableval" in
-yes) enable_debug=yes ;;
-no) enable_debug=no ;;
-*)
-  enable_debug=no
-  # Look at the argument we got.  We use all the common list separators.
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
-  for pkg in $enableval; do
-    if test "X$pkg" = "X$p"; then
-      enable_debug=yes
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac],
-enable_debug=AC_ENABLE_DEBUG_DEFAULT)dnl
-
-if test "X$enable_debug" = "Xyes"; then
-  CFLAGS="$CFLAGS -g -DDEB -D_DEBUG "
-  CXXFLAGS="$CXXFLAGS -g -DDEB -D_DEBUG "
+if test "x$enable_prod" = "xyes"; then
+  CFLAGS="$CFLAGS -O2"
+  CXXFLAGS="$CXXFLAGS -O2"
+fi
+if test "x$enable_debug" = "xyes"; then
+  CFLAGS="$CFLAGS -g"
+  CXXFLAGS="$CXXFLAGS -g"
+  CPPFLAGS="$CPPFLAGS -DDEB -D_DEBUG"
 else
-  CFLAGS="$CFLAGS -DNDEBUG  -DNo_Exception "
-  CXXFLAGS="$CXXFLAGS -DNDEBUG  -DNo_Exception "
+  CPPFLAGS="$CPPFLAGS -DNDEBUG  -DNo_Exception"
 fi
-])
-
-# AC_DISABLE_DEBUG - set the default flag to --disable-debug
-AC_DEFUN(AC_DISABLE_DEBUG, [AC_ENABLE_DEBUG(no)])
 
-dnl Replace `main' with a function in -le:
-AC_CHECK_LIB(e, main)
-
-dnl Replace `main' with a function in -links:
-AC_CHECK_LIB(inks, main)
-
-dnl Checks for X window system directories.
-AC_PATH_X
-if test "x$ac_x_includes" = "x"; then
-  X_INCLUDE=""
-else
-  X_INCLUDE="-I$ac_x_includes"
-fi
-if test "x$ac_x_libraries" = "x"; then
-  X_LIBS="-lXt -lX11"
-else
-  X_LIBS="-L$ac_x_libraries -lXt -lX11"
-fi
 
 dnl Checks for header files.
 
@@ -148,45 +88,38 @@
 AC_CHECK_HEADERS(X11/extensions/multibuf.h)
 AC_CHECK_HEADERS(sys/filio.h sys/mman.h libc.h)
 
-# This section of configure.in is snipped from TclX source.
-#------------------------------------------------------------------------------
-# Get location of Tcl source directory and configuration information from
-# tclConfig.sh.
-#------------------------------------------------------------------------------
-
-SC_PATH_TCLCONFIG
-SC_LOAD_TCLCONFIG
 
-LIBS=$TCL_LIBS   # Need for configure tests.
-
-AC_SUBST(TCL_VERSION)
-if test "x${TCL_INCLUDE_SPEC}" = "x" ; then
-     TCL_INCLUDE_FLAG="-I${TCL_PREFIX}/include"
-else
-     TCL_INCLUDE_FLAG="${TCL_INCLUDE_SPEC}"
-fi
+#-----------------------------------------------------------------------------
+# Posix threads library is required
+#-----------------------------------------------------------------------------
+AC_CHECK_HEADER([pthread.h],[],[AC_MSG_ERROR([Posix threads required])])
+AC_CHECK_LIB([pthread],[pthread_create],[],[AC_MSG_ERROR([Posix threads required])])
+CSF_ThreadLibs_LIB=-lpthread
+AC_SUBST(CSF_ThreadLibs_LIB)
 
 #------------------------------------------------------------------------------
-# Get location of Tk source directory and configuration information from
-# tkConfig.sh.
+# Get Tcl and TK configuration information from tclConfig.sh.
 #------------------------------------------------------------------------------
 
-SC_PATH_TKCONFIG
-SC_LOAD_TKCONFIG
-
+SC_TCL_CFG
+SC_TK_CFG
+HAVE_TCLTK=no
+if test "xyes" = "x$HAVE_TCL"; then
+  if test "xyes" = "x$HAVE_TK"; then
+    HAVE_TCLTK=yes
+    CSF_TclLibs_INCLUDES="${TCL_INCLUDE_SPEC}"
+    CSF_TclTkLibs_INCLUDES="${TK_INCLUDE_SPEC}"
+    CSF_TclLibs_LIB="${TCL_LIB_SPEC}"
+    CSF_TclTkLibs_LIB="${TK_LIB_SPEC}"
+  fi
+fi
+AC_SUBST(TCL_VERSION)
 AC_SUBST(TK_VERSION)
-TK_INCLUDE_FLAG="-I${TK_PREFIX}/include"
-
-CSF_TclLibs_INCLUDES=${TCL_INCLUDE_FLAG}
-CSF_TclTkLibs_INCLUDES=${TK_INCLUDE_FLAG}
-CSF_TclLibs_LIB=${TCL_LIB_SPEC}
-CSF_TclTkLibs_LIB=${TK_LIB_SPEC}
 AC_SUBST(CSF_TclLibs_INCLUDES)
 AC_SUBST(CSF_TclTkLibs_INCLUDES)
 AC_SUBST(CSF_TclLibs_LIB)
 AC_SUBST(CSF_TclTkLibs_LIB)
 
-# end configure.in snipped from TclX source
 
 platform=`uname -s`
 
@@ -332,310 +265,419 @@
   AC_DEFINE(HAVE_FINITE,,[Define if we have a function called "finite" in -lm.])
 ])
 
+
 #---------------------------------------------------------------------
 #
-# Define the Following vars : ( for OpenGL Libraries )
+# Check for Java Header Files 
 #  
 #  
 #---------------------------------------------------------------------
 
-AC_MSG_CHECKING([for OpenGL libraries])
-AC_ARG_WITH([gl-include],
-[  --with-gl-include=DIR   The directory where the OpenGL headers are found],
-[echo "with gl-include is " $with_gl_include;
-if test x"${with_gl_include}" != x"" ; then
-   if test -d "${with_gl_include}" ; then 
-     if test -f "${with_gl_include}/GL/gl.h"  ;then
-	if test -f "${with_gl_include}/GL/glu.h"  ;then
-	   GL_INCLUDE=`(cd ${with_gl_include}; pwd)`
-	   GL_INCLUDE="-I${GL_INCLUDE}"
-	else
-	   AC_MSG_ERROR([the ${with_gl_include} directory given by --with-gl-include doesn't contains GL/glu.h])
-	fi
-     else
-	AC_MSG_ERROR([the ${with_gl_include} directory  given by --with-gl-include doesn't contains GL/gl.h])
-     fi
-  else
-     AC_MSG_ERROR([the ${with_gl_include} directory  given by --with-gl-include does not exist ])
-  fi     	
-else
-   echo "Assuming gl headers are in the compiler's search path..."
+AC_ARG_WITH([java-include],
+  [AC_HELP_STRING([--with-java-include=DIR],[Locacation of jni.h])],
+  [java_include="${withval}"],[java_include=])
+if test "xno" = "x$java_include"; then
+  # user specified --without-java-include
+  HAVE_JAVA=no
+else
+  if test "xyes" != "x$java_include" && test "x" != "x$java_include"; then
+    # user specified some path
+    
+    # test user-specified value is a directory
+    if test ! -d "$java_include"; then
+      AC_MSG_ERROR([$java_include: Not a directory])
+    fi
+    
+    # search for jni_md.h (typically in a system-specific subdir)
+    AC_MSG_CHECKING([for jni_md.h in $java_include])
+    extra_java_include=
+    if test -f "$java_include/jni_md.h"; then
+      result="$java_include/jni_md.h"
+    else
+      result=
+      for d in "$java_include"/*; do
+        if test -f "$d/jni_md.h"; then
+          extra_java_include="-I$d"
+          result="$d/jni_md.h"
+          break
+        fi
+      done
+      AC_MSG_RESULT([$result])
+    fi
+    
+    # put user-specified directory and jni_mh.h directory (if found)
+    # into CPPFLAGS
+    CPPFLAGS="$CPPFLAGS -I$java_include $extra_java_include"
+  fi
+  
+  # Now we check for a working jni.h that is version 1.2 or newer.
+  # Note: This check is done unless user specified --without-java-include
+  #       If --with-java-include wasn't specified, it will check the
+  #       default compiler search path and any paths the user specified
+  #       via CPPFLAGS on the command line.
+  AC_CHECK_HEADER( [jni.h], [HAVE_JAVA=yes], [HAVE_JAVA=no
+    AC_MSG_NOTICE("Specify --with-java-include=<DIR> to enalbe Java support")] )
+  if test "xyes" = "x$HAVE_JAVA"; then
+    AC_MSG_CHECKING([java JNI version >= 1.2])
+    AC_TRY_COMPILE( [#include <jni.h>],
+  [#ifndef JNI_VERSION_1_2
+     choke me
+   #endif], [HAVE_JAVA=yes],[HAVE_JAVA=no] )
+    AC_MSG_RESULT([$HAVE_JAVA])
+  fi
+  
+  # If user specified --with-java-include, fail if not found
+  # (If user didn't specify, then we gracefully disable things that
+  # require java.)
+  if test "x" != "x$java_include" && test "xyes" != "x$HAVE_JAVA"; then
+    AC_MSG_ERROR([working jni.h not found])
+  fi
 fi
-],[echo "No --with-gl-include=DIR was specified"])
 
-# check for gl library
-AC_MSG_CHECKING(for Gl library)
-AC_ARG_WITH([gl-library],
-[  --with-gl-library=DIR   The directory where the OpenGL libraries are found],
-[echo "with gl-library is " $with_gl_library;
-if test -d "${with_gl_library}"  ; then
-   CSF_OpenGlLibs_LIB=`(cd  ${with_gl_library}; pwd)`
-   if test -f "$CSF_OpenGlLibs_LIB/libGL.so"  ; then
-      CSF_OpenGlLibs_LIB="-L${CSF_OpenGlLibs_LIB} -lGLU -lGL"
-   else
-      AC_MSG_ERROR([the ${with_gl_library} directory  given by --with-gl-library does not contains libGL.so])
-   fi
-else
-   AC_MSG_ERROR([the ${with_gl_library} directory  given by --with-gl-library does not exist ])
-fi
-],[echo "No --with-gl-library=DIR was specified"
-CSF_OpenGlLibs_LIB="-lGLU -lGL"])
 
+
+#---------------------------------------------------------------------
+#
+# Configure X11 and check for utility library
+#
+#---------------------------------------------------------------------
 AC_LANG([C])
-CFLAGS_save=$CFLAGS
-CFLAGS="$CXXFLAGS $GL_INCLUDE"
-AC_CHECK_TYPE(_GLUfuncptr,[],[CFLAGS_save="-DNOGLUfuncptr=1 $CFLAGS_save"],[#include "GL/glu.h"])
-CFLAGS="$CFLAGS_save"
+AC_PATH_X
+HAVE_X11=no
+if test "xyes" != "x$no_x"; then
+  HAVE_X11=yes
+  if test "x" != "x$x_includes"; then
+    CXXFLAGS="$CXXFLAGS -I$x_includes"
+  fi
+  if test "x" != "x$x_libraries"; then
+    LDFLAGS="$LDFLAGS -L$x_libraries"
+  fi
+  AC_CHECK_LIB( [X11], [XCreateWindow], [], [HAVE_X11=no] )
+  AC_CHECK_HEADER( [X11/Xmu/Xmu.h], [], [HAVE_X11=no] )
+  AC_CHECK_LIB( [Xmu], [XmuLookupStandardColormap], [], [HAVE_X11=no], [-lXt -lX11] )
+fi
+
 
 #---------------------------------------------------------------------
 #
-# Define the Following vars : ( for Java Header Files )
+# Check for OpenGL Libraries
 #  
 #  
 #---------------------------------------------------------------------
 
-AC_MSG_CHECKING(for Java header files)
-AC_ARG_WITH([java-include],
-[  --with-java-include=DIR   The directory where the Java headers are found],
-[echo " java-include is $with_java_include";
-JAVA_INCLUDE=`(cd  ${with_java_include}; pwd)`
-JAVA_INCLUDE_PLAT=`(find ${with_java_include} -name jni_md.h | sed 's/\.\///' | sed 's/\/jni_md.h//')`
-if test x"$JAVA_INCLUDE_PLAT" != x"" ; then
-   JAVA_INCLUDE="-I${JAVA_INCLUDE} -I${JAVA_INCLUDE_PLAT}"
+if test "xno" = "x$HAVE_X11"; then
+  HAVE_GL=no
 else
-   echo "Assuming Java headers are in the compiler's search path..."
-fi
-],[echo "No --with-java-include=DIR was specified"])
+  AC_LANG(C)
+  HAVE_GL=yes
 
-AC_LANG([C])
-CXXFLAGS="$CXXFLAGS $JAVA_INCLUDE"
-CPPFLAGS="$CPPFLAGS $JAVA_INCLUDE"
-AC_CHECK_HEADER([jni_md.h],[build_TKjcas="TKjcas"],[build_TKjcas=""])
-
-if test "x$build_TKjcas" != "x"; then
-  AC_MSG_CHECKING("JAVA_INCLUDE = $JAVA_INCLUDE")
-  AC_MSG_CHECKING(for Java Native Interface version 1.2)
-  AC_TRY_COMPILE([#include <jni.h>],
-  [#ifndef JNI_VERSION_1_2
-    choke me
-  #endif],
-  [AC_MSG_RESULT([version 1.2 or greater])],
-  [AC_MSG_WARN([JNI version is below 1.2, and so will not work with OpenCASCADE.])
-  build_TKjcas=""])
-fi
-
-AC_MSG_CHECKING( for DPS header files )
-AC_ARG_WITH([dps-include],
-[  --with-dps-include=DIR   The directory where the DPS headers are found],
-[echo "with dps-include is " $with_dps_include;
-if test x"${with_dps_include}" != x"" ; then
-   if test -d "${with_dps_include}" ; then
-	dps_inc="${with_dps_include} ${with_dps_include}/X11"
-	CSF_dpsLibs_INCLUDES=""
-	for dps_dir in $dps_inc; do
-	if test -f "${dps_dir}/DPS/dpsXclient.h" ; then
-          CSF_dpsLibs_INCLUDES="-I${dps_dir}"
-	break
-	fi
-	done
-       if test -z $CSF_dpsLibs_INCLUDES ; then
-	  AC_MSG_ERROR([the ${with_dps_include} directory  given by --with-dps-include does not contain DPS/dpsXclient.h])
-       fi
-    else
-       AC_MSG_ERROR([the ${with_dps_include} directory given by --with-dps-include does not exist])
-    fi
-else
-   echo "Assuming DPS headers are in the compiler's search path..."
-fi
-],[echo "No --with-dps-include=DIR was specified"])
-if test x"$dps_includes" != x""; then
-   CSF_dpsLibs_INCLUDES="-I$dps_include"
-fi
-
-AC_ARG_WITH([dps-library],
-[  --with-dps-library=DIR   The directory where the DPS library is found],
-[echo "with dps-library is " $with_dps_library;
-INCLUDE_save=$INCLUDE
-INCLUDE="$X_INCLUDE $CSF_dpsLibs_INCLUDES $INCLUDE"
-CFLAGS_save=$CFLAGS
-CFLAGS="$CFLAGS $INCLUDE"
-CPPFLAGS_save=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $INCLUDE"
-LIBS_save=$LIBS
-if test -d "${with_dps_library}"  ; then
-  LIBS="$LIBS $X_LIBS -L`(cd  ${with_dps_library}; pwd)` -ldps"
-  if test x"$with_dps_library" != x"" ; then
-	CSF_dpsLibs_LIB="-L`(cd  ${with_dps_library}; pwd)` -ldps"
-	AC_CHECK_HEADERS(DPS/dpsXclient.h, 
-	AC_CHECK_LIB(dps, DPSInitialize, 
-	AC_MSG_RESULT([dps library found.])
-	, AC_MSG_ERROR([the ${with_dps_library} directory given by --with-dps-library does not contains DPS library]), -lXt -lX11)
-	)
-   else
-     CSF_dpsLibs_LIB="-ldps"
-     echo "Assuming DPS headers are in the compiler's search path..."
-   fi
-else
-   AC_MSG_ERROR([the ${with_dps_library} directory  given by --with-dps-library does not exist ])
+  HAVE_GL_INC=yes
+  AC_CHECK_HEADER( [GL/gl.h], [AC_CHECK_HEADER([GL/glu.h],[],[HAVE_GL_INC=no])], [HAVE_GL_INC=no] )
+  if test "x$HAVE_GL_INC" = "xyes"; then
+    AC_CHECK_TYPE(_GLUfuncptr,[],[CPPFLAGS="-DNOGLUfuncptr=1 $CPPFLAGS"],[#include "GL/glu.h"])
+  else
+    HAVE_GL=no
+    AC_MSG_NOTICE("Specify CPPFLAGS=-I<opengl_inc_dir> to enable OpenGL support")
+  fi
+
+  HAVE_GL_LIB=yes
+  AC_CHECK_LIB( [GL], [glClear], [AC_CHECK_LIB([GLU],[gluSphere],[],[HAVE_GL_LIB=no],[-lGL])], [HAVE_GL_LIB=no] )
+  if test "xno" = "x$HAVE_GL_LIB"; then
+    HAVE_GL=no
+    AC_MSG_NOTICE("Specify LDFLAGS=-L<opengl_lib_dir> to enable OpenGL support")
+  fi
 fi
+AM_CONDITIONAL( HAVE_GL, [test "xyes" = "x$HAVE_GL"] )
 
-LIBS=$LIBS_save
-CFLAGS=$CFLAGS_save
-CPPFLAGS=$CPPFLAGS_save
-INCLUDE=$INCLUDE_save
-],[AC_MSG_WARN(No --with-dps-library=DIR was specified)])
 
 #---------------------------------------------------------------------
 #
-# Define the Following vars :
-#  CSF_XmuLibs_INCLUDES
-#  CSF_XmuLibs_LIB
+# Check for DPS libraries
+#  
+#  
 #---------------------------------------------------------------------
 
-AC_MSG_CHECKING(for Xmu header files)
-AC_ARG_WITH([xmu-include],
-[  --with-xmu-include=DIR   The directory where the Xmu headers are found],
-[echo "with xmu-include is " $with_xmu_include;
-if test x"${with_xmu_include}" != x"" ; then
-   if test -d "${with_xmu_include}" ; then
-	xmu_inc="${with_xmu_include} ${with_xmu_include}/X11"
-	CSF_XmuLibs_INCLUDES=""
-	for xmu_dir in $xmu_inc; do
-	if test -f "${xmu_dir}/Xmu/Xmu.h" ; then
-          CSF_XmuLibs_INCLUDES="-I${xmu_dir}"
-	break
-	fi
-	done
-       if test -z $CSF_XmuLibs_INCLUDES ; then
-	  AC_MSG_ERROR([the ${with_xmu_include} directory  given by --with-xmu-include does not contain Xmu/StdCmap.h])
-       fi
-    else
-       AC_MSG_ERROR([the ${with_xmu_include} directory given by --with-xmu-include does not exist])
-    fi
-else
-   echo "Assuming Xmu headers are in the compiler's search path..."
-fi
-],[echo "No --with-xmu-include=DIR was specified"])
-if test x"$xmu_includes" != x""; then
-   CSF_XmuLibs_INCLUDES="-I$xmu_include"
-fi
-
-AC_ARG_WITH([xmu-library],
-[  --with-xmu-library=DIR   The directory where the Xmu library is found],
-[echo "with xmu-library is " $with_xmu_library;
-INCLUDE_save=$INCLUDE
-INCLUDE="$X_INCLUDE $CSF_XmuLibs_INCLUDES $INCLUDE"
-CFLAGS_save=$CFLAGS
-CFLAGS="$CFLAGS $INCLUDE"
-CPPFLAGS_save=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $INCLUDE"
-LIBS_save=$LIBS
-if test -d "${with_xmu_library}"  ; then
-  LIBS="$LIBS $X_LIBS -L`(cd  ${with_xmu_library}; pwd)` -lXmu"
-  if test x"$with_xmu_library" != x"" ; then
-	CSF_XmuLibs_LIB="-L`(cd  ${with_xmu_library}; pwd)` -lXmu"
-	AC_CHECK_HEADERS(Xmu/Editres.h, 
-	AC_CHECK_LIB(Xmu, _XEditResCheckMessages, 
-	AC_MSG_RESULT([Xmu library found.]),
-	AC_MSG_ERROR([the ${with_xmu_library} directory given by --with-xmu-library does not contains xmu library]), -lXt -lX11),,[#include <X11/Intrinsic.h>]
-	)
-   else
-     CSF_XmuLibs_LIB="-lXmu"
-     echo "Assuming Xmu headers are in the compiler's search path..."
-   fi
+if test "xno" = "x$HAVE_X11"; then
+  HAVE_DPS=no
 else
-   AC_MSG_ERROR([the ${with_xmu_library} directory  given by --with-xmu-library does not exist ])
+  AC_CHECK_HEADER( [DPS/dpsXclient.h], [HAVE_DPS_INC=yes], [HAVE_DPS_INC=no] )
+  AC_CHECK_LIB( [dps], [DPSInitialize], [HAVE_DPS_LIB=yes], [HAVE_DPS_LIB=no] )
+  HAVE_DPS=yes
+  if test "xno" = "x$HAVE_DPS_INC"; then
+    HAVE_DPS=no
+    AC_MSG_NOTICE("Specify CPPFLAGS=-I<dps_include_dir> to enable DPS support")
+  fi
+  if test "xno" = "x$HAVE_DPS_LIB"; then
+    HAVE_DPS=no
+    AC_MSG_NOTICE("Specify LDFLAGS=-L<dps_lib_dir> to enable DPS support")
+  fi
 fi
 
-LIBS=$LIBS_save
-CFLAGS=$CFLAGS_save
-CPPFLAGS=$CPPFLAGS_save
-INCLUDE=$INCLUDE_save
-],[AC_MSG_WARN(No --with-xmu-library=DIR was specified)])
+
 
 #---------------------------------------------------------------------
 #
-# Define the Following vars :
-#  STLPortInclude
-#  STLPortLib
+# Test for 64-bit platforms
+#  
+#  
 #---------------------------------------------------------------------
+AC_MSG_CHECKING([if platform is 64-bit])
+AC_TRY_COMPILE( [], 
+ [int array[((int)sizeof(void*))-6];],
+ [AC_MSG_RESULT([yes]); CPPFLAGS="$CPPFLAGS -D_OCC64"],
+ [AC_MSG_RESULT([no])] )
 
-AC_LANG([C++])
-AC_MSG_CHECKING(for STLPort header files)
-AC_ARG_WITH([stlport-include],
-[  --with-stlport-include=DIR   The directory where the STLPort headers are found],
-[echo "with stlport-include is " $with_stlport_include;
-if test x"${with_stlport_include}" != x"" ; then
-   if test -d "${with_stlport_include}" ; then
-	STLPort_INCLUDES="${with_stlport_include}"
-	if test -f "${STLPort_INCLUDES}/algorithm" ; then
-          STLPort_INCLUDES="-I${STLPort_INCLUDES}"
-	fi
-	if test -z $STLPort_INCLUDES ; then
-	  AC_MSG_ERROR([the ${STLPort_INCLUDES} directory  given by --with-stlport-include does not contain algorithm])
-	fi
-   else
-	AC_MSG_ERROR([the ${STLPort_INCLUDES} directory given by --with-stlport-include does not exist])
-   fi
+
+
+
+
+#----------------------------------------------------------------------
+#
+# Enalbe/Disable Modules
+#
+#----------------------------------------------------------------------
+
+AC_ARG_ENABLE([model],
+  [AC_HELP_STRING([--disable-model],[Disable model components])],
+  [ENABLE_MODEL=${enableval}],[ENABLE_MODEL=yes])
+AC_ARG_ENABLE([vis],
+  [AC_HELP_STRING([--disable-vis],[Don't build visualization component])],
+  [ENABLE_VIS=${enableval}],[ENABLE_VIS=])
+AC_ARG_ENABLE([ocaf-lite],
+  [AC_HELP_STRING([--disable-ocaf-lite],[Don't build lightweight application framework])],
+  [ENABLE_OCAF_LITE=${enableval}],[ENABLE_OCAF_LITE=])
+AC_ARG_ENABLE([ocaf],
+  [AC_HELP_STRING([--disable-ocaf-lite],[Don't build application framework])],
+  [ENABLE_OCAF=${enableval}],[ENABLE_OCAF=])
+AC_ARG_ENABLE([dxe],
+  [AC_HELP_STRING([--disable-dxe],[Don't build data exchange])],
+  [ENABLE_DXE=${enableval}],[ENABLE_DXE=])
+AC_ARG_ENABLE([draw],
+  [AC_HELP_STRING([--disable-draw],[Don't build test harness])],
+  [ENABLE_DRAW=${enableval}],[ENABLE_DRAW=])
+AC_ARG_ENABLE([wok],
+  [AC_HELP_STRING([--disable-wok],[Don't build development tools (WOK)])],
+  [ENABLE_WOK=${enableval}],[ENABLE_WOK=])
+AC_ARG_ENABLE([wrappers],
+  [AC_HELP_STRING([--disable-wrappers],[Don't build wrapper libraries])],
+  [ENABLE_WRAPPERS=${enableval}],[ENABLE_WRAPPERS=])
+
+# Process options from above.  The behavior we want is:
+#
+# ENABLE_X = yes : User specified --enable-x 
+#                  print informative error and exit if it cannot be built
+#
+# ENABLE_X = no :  User specified --disable-x (or --enable-x=no)
+#                  silently disable building of component
+#
+# ENABLE_X =     : User didn't specify either way
+#                  Build if possible.  Warn if it cannot be build
+#                  because of some missing system requirement.  Inform
+#                  if disabled because some other required component 
+#                  was disabled.
+
+# Visualization Component: requires model component, X11, and optionally OpenGL
+if test "x" = "x$ENABLE_VIS"; then
+  if test "xno" = "x$ENABLE_MODEL"; then
+    AC_MSG_NOTICE( [Disabling visualization component: not building model component] )
+    DISABLE_VIS_REASON="(Model Component Disabled)"
+    ENABLE_VIS=no
+    ENABLE_VIS_GL=no
+  elif test "xyes" != "x$HAVE_X11"; then
+    AC_MSG_WARN( [Disabling visualization component: X not found] )
+    DISABLE_VIS_REASON="(X not found)"
+    ENABLE_VIS=no
+    ENABLE_VIS_GL=no
+  elif test "xyes" != "x$HAVE_GL"; then
+    AC_MSG_WARN( [Disabling OpenGL portion of visualization component: GL not found] )
+    DISABLE_VIS_GL_REASON="(GL not found)"
+    ENABLE_VIS=yes
+    ENABLE_VIS_GL=no
+  else
+    ENABLE_VIS=yes
+    ENABLE_VIS_GL=yes
+  fi
+elif test "xno" = "x$ENABLE_VIS"; then
+  ENABLE_VIS_GL=no
 else
-   echo "Assuming STLPort headers are in the compiler's search path..."
-fi
-],[echo "No --with-stlport-include=DIR was specified"])
-if test x"$stlport_includes" != x""; then
-   STLPort_INCLUDES="-I$stlport_include"
-fi
+  if test "xno" = "x$ENABLE_MODEL"; then
+    AC_MSG_ERROR( [Visualization component requires model component] )
+  elif test "xyes" != "x$HAVE_X11"; then
+    AC_MSG_ERROR( [Visualization component requires X] )
+  elif test "xyes" != "x$HAVE_GL"; then
+    AC_MSG_WARN( [Disabling OpenGL portion of visualization component: GL not found] )
+    ENABLE_VIS_GL=no
+  else
+    ENABLE_VIS_GL=yes
+  fi
+fi  
 
-AC_ARG_WITH([stlport-libname],
-[  --with-stlport-libname=NAME   The name of STLPort library is found],
-[echo "with stlport-libname is " $with_stlport_libname;
-  if test x"$with_stlport_libname" != x"" ; then	
-	STLPort_LIB_CC=$with_stlport_libname
+# Lightwieght Application Framework: requires model component
+if test "x" = "x$ENABLE_OCAF_LITE"; then
+  if test "xno" = "x$ENABLE_MODEL"; then
+    AC_MSG_NOTICE( [Disabling lightweight application framework: not building model component] )
+    ENABLE_OCAF_LITE=no
+    DISABLE_OCAF_LITE_REASON="(Model Component Disabled)"
   else
-	STLPort_LIB_CC="stlport"
-	echo "Assuming STLPort library name is stlport"
+    ENABLE_OCAF_LITE=yes
   fi
-],[STLPort_LIB_CC="stlport"
-   AC_MSG_WARN(No --with-stlport-libname=NAME was specified)])
+elif test "xno" = "x$ENABLE_MODEL"; then
+    AC_MSG_ERROR( [Lightwieght application framework requires model component] )
+fi
 
-AC_ARG_WITH([stlport-library],
-[  --with-stlport-library=DIR   The directory where the STLPort library is found],
-[echo "with stlport-library is " $with_stlport_library;
-INCLUDE_save=$INCLUDE
-INCLUDE="$STLPort_INCLUDES $INCLUDE"
-CPPFLAGS_save=$CPPFLAGS
-CPPFLAGS="$INCLUDE $CPPFLAGS"
-CXXFLAGS_save=$CPPFLAGS
-CXXFLAGS="$INCLUDE $CPPFLAGS"
-LDFLAGS_save=$LDFLAGS
-if test -d "${with_stlport_library}"  ; then
-  STLPort_LIB="-L`(cd  ${with_stlport_library}; pwd)` -l$STLPort_LIB_CC"
-  LDFLAGS="$LDFLAGS $STLPort_LIB"
-#  if test x"$with_stlport_library" != x"" ; then	
-#	AC_CHECK_HEADERS(algorithm, 
-#	AC_CHECK_LIB($STLPort_LIB_CC, main,
-#	AC_MSG_RESULT([STLPort library found.]),
-#	AC_MSG_ERROR([the $STLPort_LIB directory given by --with-stlport-library does not contains $STLPort_LIB_CC library]), -l$STLPort_LIB_CC))
-#   else
-#     STLPort_LIB="-l$STLPort_LIB_CC"
-#     echo "Assuming STLPort libraries are in the compiler's search path..."
-#   fi
+# Application Framework: requires Visualization and OCAF-lite components
+if test "x" = "x$ENABLE_OCAF"; then
+  if test "xno" = "x$ENABLE_OCAF_LITE"; then
+    AC_MSG_NOTICE( [Disabling application framework: not building ocaf-lite] )
+    ENABLE_OCAF=no
+    DISABLE_OCAF_REASON="(OCAF-Lite Disabled)"
+  elif test "xno" = "x$ENABLE_VIS"; then
+    AC_MSG_NOTICE( [Disabling application framework: not building visualization component] )
+    DISABLE_OCAF_REASON="(Visualization Component Disabled)"
+    ENABLE_OCAF=no
+  else
+    ENABLE_OCAF=yes
+  fi
 else
-   AC_MSG_ERROR([the ${with_stlport_library} directory  given by --with-stlport-library does not exist ])
+  if test "xno" = "x$ENABLE_OCAF_LITE"; then
+    AC_MSG_ERROR( [OCAF requires OCAF-Lite] )
+  elif test "xno" = "x$ENABLE_VIS"; then
+    AC_MSG_ERROR( [OCAF requires visualization component] )
+  fi
+fi  
+
+# Data Exchange Component: requires model component and optionally X11 and OCAF
+if test "xno" = "x$ENABLE_DXE"; then
+  ENABLE_DXE_VIS=no
+  ENABLE_DXE_OCAF=no
+else
+  if test "xno" = "x$ENABLE_MODEL"; then
+    if "xno" != "x$ENABLE_DXE"; then
+      AC_MSG_ERROR( [Data exchange component requires model component] )
+    else
+      AC_MSG_NOTICE( [Disabling data exchange component: not building model component] )
+    fi
+    DISABLE_DXE_REASON="(Model Component Disabled)"
+    ENABLE_DXE=no
+    ENABLE_DXE_VIS=no
+    ENABLE_DXE_OCAF=no
+  elif test "xno" = "x$ENABLE_VIS"; then
+    AC_MSG_NOTICE( [Disabling non-core portions data exchange component: not building visualization component] )
+    DISABLE_DXE_VIS_REASON="(Visualization Component Disabled)"
+    DISABLE_DXE_OCAF_REASON="(Application Framework Disabled)"
+    ENABLE_DXE=yes
+    ENABLE_DXE_VIS=no
+    ENABLE_DXE_OCAF=no
+  elif test "xno" = "x$ENABLE_OCAF"; then
+    AC_MSG_NOTICE( [Disabling OCAF portions data exchange component: not building OCAF] )
+    DISABLE_DXE_OCAF_REASON="(Visualization Component Disabled)"
+    ENABLE_DXE=yes
+    ENABLE_DXE_VIS=yes
+    ENABLE_DXE_OCAF=no
+  else
+    ENABLE_DXE=yes
+    ENABLE_DXE_VIS=yes
+    ENABLE_DXE_OCAF=yes  
+  fi
+fi
+
+# Test Harness: requires most components and Tck/TK
+if test "x" = "x$ENABLE_DRAW"; then
+  if test "xno" = "x$ENABLE_VIS"; then
+    AC_MSG_NOTICE([Disabling test harness because visualization component will not be build.])
+    DISABLE_DRAW_REASON="(Visualiziation Component Disabled)"
+    ENABLE_DRAW=no
+  elif test "xno" = "x$ENABLE_OCAF"; then
+    AC_MSG_NOTICE([Disabling test harness because OCAF component will not be build.])
+    DISABLE_DRAW_REASON="(Application Framework Disabled)"
+    ENABLE_DRAW=no
+  elif test "xno" = "x$ENABLE_DXE"; then
+    AC_MSG_NOTICE([Disabling test harness because DXE component will not be build.])
+    DISABLE_DRAW_REASON="(Data Exchange Disabled)"
+    ENABLE_DRAW=no
+  elif test "xyes" != "x$HAVE_TCLTK"; then
+    AC_MSG_WARN([Disabling test harness: Tcl/TK not found.])
+    DISABLE_DRAW_REASON="(Tcl/Tk Not Found)"
+    ENABLE_DRAW=no
+  else
+    ENABLE_DRAW=yes
+  fi
+elif test "xno" != "x$ENABLE_DRAW"; then
+  if test "xno" = "x$ENABLE_VIS"; then
+    AC_MSG_ERROR([Test harness requires visualization component.])
+  elif test "xno" = "x$ENABLE_OCAF"; then
+    AC_MSG_ERROR([Test harness requires OCAF component.])
+  elif test "xno" = "x$ENABLE_DXE"; then
+    AC_MSG_ERROR([Test harness requires DXE component.])
+  elif test "xyes" != "x$HAVE_TCLTK"; then
+    AC_MSG_ERROR([Test harness requires Tcl/Tk.])
+  fi
 fi
 
-LDFLAGS="$LDFLAGS_save"
-CPPFLAGS="$CPPFLAGS_save"
-INCLUDE=$INCLUDE_save
-CXXFLAGS="$CXXFLAGS_save"
-],[AC_MSG_WARN(No --with-stlport-library=DIR was specified)])
-
-AC_ENABLE_DEBUG(yes)
-AC_DISABLE_PRODUCTION
-
-AC_SUBST(STLPort_INCLUDES)
-AC_SUBST(STLPort_LIB)
-#AC_SUBST(JAVA_INCLUDE)
-AC_SUBST(build_TKjcas)
+# Wrappers: requires java
+if test "x" = "x$ENABLE_WRAPPERS"; then
+  if test "xyes" != "x$HAVE_JAVA"; then
+    AC_MSG_WARN( [Disabling wrappers because java was not found.] )
+    ENABLE_WRAPPERS=no
+    DISABLE_WRAPPERS_REASON="(Java Not Found)"
+  else
+    ENABLE_WRAPPERS=yes
+  fi
+elif test "xno" != "x$ENABLE_WRAPPERS"; then
+  if test "xyes" != "x$HAVE_JAVA"; then
+    AC_MSG_ERROR( [Wrappers requires java.] )
+  fi
+fi  
+
+# Developement stuff: requires X and Tcl/Tk
+if test "x" = "x$ENABLE_WOK"; then
+  if test "xyes" != "x$HAVE_TCLTK"; then
+    AC_MSG_WARN( [Disabling WOK because Tcl/Tk was not found.] )
+    DISABLE_WOK_REASON="(Tcl/Tk Not Found)"
+    ENABLE_WOK=no
+  elif test "xyes" != "x$HAVE_X11"; then
+    AC_MSG_WARN( [Disabling WOK because X was not found.] )
+    DISABLE_WOK_REASON="(X Not Found)"
+    ENABLE_WOK=no
+  else
+    ENABLE_WOK=yes
+  fi
+elif test "xno" != "x$ENABLE_WOK"; then
+  if test "xyes" != "x$HAVE_TCLTK"; then
+    AC_MSG_ERROR( [WOK requires Tcl/Tk.] )
+  elif test "xyes" != "x$HAVE_X11"; then
+    AC_MSG_ERROR( [WOK requires X.] )
+  fi
+fi  
+
+# Convert to automake conditional values
+AM_CONDITIONAL(ENABLE_MODEL,[test "xno" != "x$ENABLE_MODEL"])
+AM_CONDITIONAL(ENABLE_VIS,[test "xno" != "x$ENABLE_VIS"])
+AM_CONDITIONAL(ENABLE_VIS_GL,[test "xno" != "x$ENABLE_VIS_GL"])
+AM_CONDITIONAL(ENABLE_OCAF_LITE,[test "xno" != "x$ENABLE_OCAF_LITE"])
+AM_CONDITIONAL(ENABLE_OCAF,[test "xno" != "x$ENABLE_OCAF"])
+AM_CONDITIONAL(ENABLE_DXE,[test "xno" != "x$ENABLE_DXE"])
+AM_CONDITIONAL(ENABLE_DXE_VIS,[test "xno" != "x$ENABLE_DXE_VIS"])
+AM_CONDITIONAL(ENABLE_DXE_OCAF,[test "xno" != "x$ENABLE_DXE_OCAF"])
+AM_CONDITIONAL(ENABLE_DRAW,[test "xno" != "x$ENABLE_DRAW"])
+AM_CONDITIONAL(ENABLE_WRAPPERS,[test "xno" != "x$ENABLE_WRAPPERS"])
+AM_CONDITIONAL(ENABLE_WOK,[test "xno" != "x$ENABLE_WOK"])
+
+
+
+
+#----------------------------------------------------------------------
+#
+# Write Output Files
+#
+#----------------------------------------------------------------------
+
+
+AC_SUBST(CPPFLAGS)
+CXXCPPFLAGS="$CPPFLAGS"
+AC_SUBST(CXXCPPFLAGS)
+AC_SUBST(CFLAGS)
+AC_SUBST(CXXFLAGS)
 AC_SUBST(LIBS)
 AC_SUBST(LDFLAGS)
 
@@ -747,3 +789,33 @@
 adm/make/WOKLibs/Makefile \
 adm/make/TKjcas/Makefile \
 ])
+
+#--------------------------------------------------------------------
+#
+# Print Summary of Options
+#
+#--------------------------------------------------------------------
+
+
+echo
+echo "CC       = $CC"
+echo "CXX      = $CXX"
+echo "CFLAGS   = $CFLAGS"
+echo "CXXFLAGS = $CXXFLAGS"
+echo "CPPFLAGS = $CPPFLAGS"
+echo "LDFLAGS  = $LDFLAGS"
+echo 
+
+echo "Component                   Build"
+echo "--------------------------  -----"
+echo "Model data & algorithms     $ENABLE_MODEL $DISABLE_MODEL_REASON"
+echo "Visualization               $ENABLE_VIS $DISABLE_VIS_REASON"
+echo "Data Exchange (core)        $ENABLE_DXE $DISABLE_DXE_REASON"
+echo "Data Exchange (vis)         $ENABLE_DXE_VIS $DISABLE_DXE_VIS_REASON"
+echo "Data Exchange (OCAF)        $ENABLE_DXE_OCAF $DISABLE_DXE_OCAF_REASON"
+echo "Lightweight App. Framework  $ENABLE_OCAF_LITE $DISABLE_OCAF_LITE_REASON"
+echo "Application Framework       $ENABLE_OCAF $DISABLE_OCAF_REASON"
+echo "Test Harness (DRAW)         $ENABLE_DRAW $DISABLE_DRAW_REASON"
+echo "Development Tools (WOK)     $ENABLE_WOK $DISABLE_WOK_REASON"
+echo "Wrappers                    $ENABLE_WRAPPERS $DISABLE_WRAPPERS_REASON"
+echo
--- clean/ros/acinclude.m4	2008-01-18 10:19:13.000000000 -0600
+++ working/ros/acinclude.m4	2008-01-17 13:53:18.000000000 -0600
@@ -1,265 +1,159 @@
 #------------------------------------------------------------------------
-# SC_PATH_TCLCONFIG --
-#
-#	Locate the tclConfig.sh file and perform a sanity check on
-#	the Tcl compile flags
-#
-# Arguments:
-#	none
-#
-# Results:
-#
-#	Adds the following arguments to configure:
-#		--with-tcl=...
-#
-#	Defines the following vars:
-#		TCL_BIN_DIR	Full path to the directory containing
-#				the tclConfig.sh file
+# Check for TCL
+# Options: --with-tcl=  :    Specify location of tclConfig.sh
+#          --without-tcl=  : Skip check for TCL, assume not installed
+# Defines:
+#          HAVE_TCL : yes/no
+#          Everything from tclConfig.sh
 #------------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_TCLCONFIG, [
-    #
-    # Ok, lets find the tcl configuration
-    # First, look for one uninstalled.
-    # the alternative search directory is invoked by --with-tcl
-    #
-
-    if test x"${no_tcl}" = x ; then
-	# we reset no_tcl in case something fails here
-	no_tcl=true
-	AC_ARG_WITH(tcl, [  --with-tcl              directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
-	AC_MSG_CHECKING([for Tcl configuration])
-	AC_CACHE_VAL(ac_cv_c_tclconfig,[
-
-	    # First check to see if --with-tclconfig was specified.
-	    if test x"${with_tclconfig}" != x ; then
-		if test -f "${with_tclconfig}/tclConfig.sh" ; then
-		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
-		else
-		    AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
-		fi
-	    fi
-
-	    # then check for a private Tcl installation
-	    if test x"${ac_cv_c_tclconfig}" = x ; then
-		for i in \
-			../tcl \
-			`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
-			../../tcl \
-			`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
-			../../../tcl \
-			`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
-		    if test -f "$i/unix/tclConfig.sh" ; then
-			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-			break
-		    fi
-		done
-	    fi
-
-	    # check in a few common install locations
-	    if test x"${ac_cv_c_tclconfig}" = x ; then
-		for i in `ls -d ${prefix}/lib 2>/dev/null` \
-		        `ls -d /usr/tcltk/lib/itcl 2>/dev/null` \
-                        `ls -d /usr/lib 2>/dev/null` \
-                        `ls -d /opt/sfw/lib 2>/dev/null` \
-			`ls -d /usr/local/lib 2>/dev/null` ; do
-		    if test -f "$i/tclConfig.sh" ; then
-			ac_cv_c_tclconfig=`(cd $i; pwd)`
-			break
-		    fi
-		done
-	    fi
-
-	    # check in a few other private locations
-	    if test x"${ac_cv_c_tcliconfig}" = x ; then
-		for i in \
-			${srcdir}/../tcl \
-			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
-		    if test -f "$i/unix/tclConfig.sh" ; then
-		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
-		    break
-		fi
-		done
-	    fi
-	])
-
-	if test x"${ac_cv_c_tclconfig}" = x ; then
-	    TCL_BIN_DIR="# no Tcl configs found"
-	    AC_MSG_WARN(Can't find Tcl configuration definitions)
-	    #exit 0
-	else
-	    no_tcl=
-	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
-	    AC_MSG_RESULT(found $TCL_BIN_DIR/tclConfig.sh)
-	fi
+AC_DEFUN([SC_TCL_CFG], [
+  AC_ARG_WITH(tcl, 
+AC_HELP_STRING([--with-tcl=PATH],[Directory containing tclConfig.sh])
+AC_HELP_STRING([--without-tcl],  [Assume no tcl libraries available]) , 
+              [with_tcl="${withval}";require_tcl=yes],[with_tcl=yes;require_tcl=no])
+  
+  # If user requested disabling of tcl check
+  if test "xno" = "x$with_tcl"; then
+    HAVE_TCL=no
+    require_tcl=no
+  # Otherwise...
+  else
+    HAVE_TCL=no
+    # Search for tclConfig.sh
+    if test "xyes" != "x$with_tcl"; then
+      # If user specified location
+      . "${with_tcl}/tclConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tcl}/tclConfig.sh")
+      HAVE_TCL=yes
+    else
+      # Search for tclConfig.sh in usual spots
+      tcl_cfg_file=
+      AC_MSG_CHECKING([for tclConfig.sh])
+      for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do
+        if test -d $i; then
+          for j in $i/lib $i/lib/tcl $i/lib/tcl[[8-9]].[[0-9]] $i/lib/itcl; do
+            if test -r "$j/tclConfig.sh"; then
+              tcl_cfg_file="$j/tclConfig.sh"
+              break
+            fi
+          done
+        fi
+        if test "x" != "x$tcl_cfg_file"; then
+          break
+        fi
+      done
+      AC_MSG_RESULT("$tcl_cfg_file")
+      
+      if test "x" != "x$tcl_cfg_file"; then
+        . "$tcl_cfg_file" || AC_MSG_ERROR("Cannot read file: $tcl_cfg_file") 
+        HAVE_TCL=yes
+
+        # if TCL_INCLUDE_SPEC wasn't defined, try to define it using TCL_INC_DIR
+        if test "x" = "x$TCL_INCLUDE_SPEC"; then
+          inc_path=`expr "x$TCL_INC_DIR" : "x\(.*\)/tcl-private/generic"`
+          if test "x" != "$inc_path"; then
+            TCL_INCLUDE_SPEC="-I$inc_path"
+          elif test "x" != "x$TCL_INC_DIR"; then
+            TCL_INCLUDE_SPEC="-I$TCL_INC_DIR"
+          fi
+        fi
+      else
+        HAVE_TCL=no
+      fi
     fi
-])
-
-#------------------------------------------------------------------------
-# SC_PATH_TKCONFIG --
-#
-#	Locate the tkConfig.sh file
-#
-# Arguments:
-#	none
-#
-# Results:
-#
-#	Adds the following arguments to configure:
-#		--with-tk=...
-#
-#	Defines the following vars:
-#		TK_BIN_DIR	Full path to the directory containing
-#				the tkConfig.sh file
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_PATH_TKCONFIG, [
-    #
-    # Ok, lets find the tk configuration
-    # First, look for one uninstalled.
-    # the alternative search directory is invoked by --with-tk
-    #
-
-    if test x"${no_tk}" = x ; then
-	# we reset no_tk in case something fails here
-	no_tk=true
-	AC_ARG_WITH(tk, [  --with-tk               directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
-	AC_MSG_CHECKING([for Tk configuration])
-	AC_CACHE_VAL(ac_cv_c_tkconfig,[
-
-	    # First check to see if --with-tkconfig was specified.
-	    if test x"${with_tkconfig}" != x ; then
-		if test -f "${with_tkconfig}/tkConfig.sh" ; then
-		    ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
-		else
-		    AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
-		fi
-	    fi
-
-	    # then check for a private Tk library
-	    if test x"${ac_cv_c_tkconfig}" = x ; then
-		for i in \
-			../tk \
-			`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
-			../../tk \
-			`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
-			../../../tk \
-			`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
-		    if test -f "$i/unix/tkConfig.sh" ; then
-			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
-			break
-		    fi
-		done
-	    fi
-	    # check in a few common install locations
-	    if test x"${ac_cv_c_tkconfig}" = x ; then
-		for i in `ls -d ${prefix}/lib 2>/dev/null` \
-		        `ls -d /usr/tcltk/lib/itcl 2>/dev/null` \
-                        `ls -d /usr/lib 2>/dev/null` \
-                        `ls -d /opt/sfw/lib 2>/dev/null` \
-			`ls -d /usr/local/lib 2>/dev/null` ; do
-		    if test -f "$i/tkConfig.sh" ; then
-			ac_cv_c_tkconfig=`(cd $i; pwd)`
-			break
-		    fi
-		done
-	    fi
-	    # check in a few other private locations
-	    if test x"${ac_cv_c_tkconfig}" = x ; then
-		for i in \
-			${srcdir}/../tk \
-			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
-		    if test -f "$i/unix/tkConfig.sh" ; then
-			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
-			break
-		    fi
-		done
-	    fi
-	])
-	if test x"${ac_cv_c_tkconfig}" = x ; then
-	    TK_BIN_DIR="# no Tk configs found"
-	    AC_MSG_WARN(Can't find Tk configuration definitions)
-	    #exit 0
-	else
-	    no_tk=
-	    TK_BIN_DIR=${ac_cv_c_tkconfig}
-	    AC_MSG_RESULT(found $TK_BIN_DIR/tkConfig.sh)
-	fi
+    
+    # Check for tcl.h
+    AC_LANG_C
+    save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
+    AC_CHECK_HEADER([tcl.h],[],[HAVE_TCL=no])
+    CPPFLAGS="$save_CPPFLAGS"
+    
+    if test "xyes" = "x$require_tcl"; then
+      if test "xno" = "x$HAVE_TCL"; then
+        AC_MSG_ERROR([TCL not found.])
+      fi
     fi
-
+  fi
 ])
 
-#------------------------------------------------------------------------
-# SC_LOAD_TCLCONFIG --
-#
-#	Load the tclConfig.sh file
-#
-# Arguments:
-#	
-#	Requires the following vars to be set:
-#		TCL_BIN_DIR
-#
-# Results:
-#
-#	Subst the following vars:
-#		TCL_BIN_DIR
-#		TCL_SRC_DIR
-#		TCL_LIB_FILE
-#
-#------------------------------------------------------------------------
-
-AC_DEFUN(SC_LOAD_TCLCONFIG, [
-    AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
-
-    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
-        AC_MSG_RESULT([loading])
-	. $TCL_BIN_DIR/tclConfig.sh
-    else
-        AC_MSG_RESULT([file not found])
-    fi
-
-    #
-    # The eval is required to do the TCL_DBGX substitution in the
-    # TCL_LIB_FILE variable
-    #
-
-    eval TCL_LIB_FILE=${TCL_LIB_FILE}
-    eval TCL_LIB_FLAG=${TCL_LIB_FLAG}
-
-    AC_SUBST(TCL_BIN_DIR)
-    AC_SUBST(TCL_SRC_DIR)
-    AC_SUBST(TCL_LIB_FILE)
-])
 
 #------------------------------------------------------------------------
-# SC_LOAD_TKCONFIG --
-#
-#	Load the tkConfig.sh file
-#
-# Arguments:
-#	
-#	Requires the following vars to be set:
-#		TK_BIN_DIR
-#
-# Results:
-#
-#	Sets the following vars that should be in tkConfig.sh:
-#		TK_BIN_DIR
+# Check for Tk
+# Options: --with-tk=  :    Specify location of Tk
+#          --without-tk=  : Skip check for Tk, assume not installed
+# Defines:
+#          HAVE_TK : yes/no
+#          Everything from tkConfig.sh
 #------------------------------------------------------------------------
-
-AC_DEFUN(SC_LOAD_TKCONFIG, [
-    AC_MSG_CHECKING([for existence of $TCLCONFIG])
-
-    if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
-        AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
-	. $TK_BIN_DIR/tkConfig.sh
-    else
-        AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
+AC_DEFUN([SC_TK_CFG], [
+  AC_ARG_WITH(tk, 
+AC_HELP_STRING([--with-tk=PATH],[Directory containing tkConfig.sh])
+AC_HELP_STRING([--without-tk],  [Assume no Tk libraries available]) , 
+              [with_tk="${withval}";require_tk=yes],[with_tk=yes;require_tk=no])
+  
+  # If user requested disabling of Tk check
+  if test "xno" = "x$with_tk"; then
+    HAVE_TK=no
+    require_tk=no
+  # Otherwise...
+  else
+    HAVE_TK=no
+    # Search for tkConfig.sh
+    if test "xyes" != "x$with_tk"; then
+      # If user specified location
+      . "${with_tk}/tkConfig.sh" || AC_MSG_ERROR("Cannot read file: ${with_tk}/tkConfig.sh")
+      HAVE_TK=yes
+    else
+      # Search for tkConfig.sh in usual spots
+      tk_cfg_file=
+      AC_MSG_CHECKING([for tkConfig.sh])
+      for i in /usr /usr/local ${prefix} /opt/sfw /usr/tcltk; do
+        if test -d $i; then
+          for j in $i/lib $i/lib/tk $i/lib/tk[[8-9]].[[0-9]] $i/lib/itcl; do
+            if test -r "$j/tkConfig.sh"; then
+              tk_cfg_file="$j/tkConfig.sh"
+              break
+            fi
+          done
+        fi
+        if test "x" != "x$tk_cfg_file"; then
+          break
+        fi
+      done
+      AC_MSG_RESULT("$tk_cfg_file")
+      
+      if test "x" != "x$tk_cfg_file"; then
+        . "$tk_cfg_file" || AC_MSG_ERROR("Cannot read file: $tk_cfg_file") 
+        HAVE_TK=yes
+
+        # if TK_INCLUDE_SPEC wasn't defined, try to define it using TK_INC_DIR
+        if test "x" = "x$TK_INCLUDE_SPEC"; then
+          inc_path=`expr "x$TK_INC_DIR" : "x\(.*\)/tk-private/generic"`
+          if test "x" != "$inc_path"; then
+            TK_INCLUDE_SPEC="-I$inc_path"
+          elif test "x" != "x$TK_INC_DIR"; then
+            TK_INCLUDE_SPEC="-I$TK_INC_DIR"
+          fi
+        fi
+      else
+        HAVE_TK=no
+      fi
     fi
-
-    AC_SUBST(TK_BIN_DIR)
-    AC_SUBST(TK_SRC_DIR)
-    AC_SUBST(TK_LIB_FILE)
+    
+    # Check for tk.h
+    AC_LANG_C
+    HAVE_TK=yes
+    save_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC $TK_INCLUDE_SPEC"
+    AC_CHECK_HEADER([tk.h],[],[HAVE_TK=no])
+    CPPFLAGS="$save_CPPFLAGS"
+    
+    if test "xyes" = "x$require_tk"; then
+      if test "xno" = "x$HAVE_TK"; then
+        AC_MSG_ERROR([Tk not found.])
+      fi
+    fi
+  fi
 ])
 
 #------------------------------------------------------------------------
--- clean/ros/adm/make/Makefile.am	2008-01-18 10:19:12.000000000 -0600
+++ working/ros/adm/make/Makefile.am	2008-01-17 13:37:33.000000000 -0600
@@ -7,23 +7,171 @@
 # end so that it won't stop the build if Java isn't installed. #
 ################################################################
 
-X_INCLUDE = @X_INCLUDE@
-XMU_INCLUDE = @XMU_INCLUDE@
-TCL_INCLUDE_FLAG = @TCL_INCLUDE_FLAG@
-TK_INCLUDE_FLAG = @TK_INCLUDE_FLAG@
-X_LIBS = @X_LIBS@
-TCL_LIB_SPEC = @TCL_LIB_SPEC@
-TK_LIB_SPEC = @TK_LIB_SPEC@
-
-SUBDIRS = TKernel TKMath TKAdvTools \
-TKG2d TKG3d TKGeomBase TKBRep \
-TKGeomAlgo TKTopAlgo TKPrim TKBO TKHLR TKMesh TKShHealing TKBool TKFillet TKFeat TKOffset \
-TKService TKV2d TKV3d TKOpenGl TKMeshVS \
-TKCDF PTKernel TKLCAF FWOSPlugin TKPShape TKCAF TKBinL TKXmlL TKShapeSchema TKPLCAF TKBin TKXml TKPCAF TKStdLSchema TKStdSchema StdPlugin XmlPlugin BinPlugin StdLPlugin BinLPlugin XmlLPlugin \
-TKVRML TKXCAF TKSTL TKXSBase TKXCAFSchema TKXmlXCAF TKBinXCAF TKSTEPBase TKIGES TKSTEPAttr TKSTEP209 TKXDEIGES TKSTEP TKXDESTEP XCAFPlugin XmlXCAFPlugin BinXCAFPlugin \
-TKDraw TKTopTest TKViewerTest TKXSDRAW TKDCAF TKXDEDRAW DRAWEXE \
-TKWOK TKWOKTcl TKTCPPExt TKCDLFront TKCPPExt TKCPPClient TKIDLFront TKCPPJini TKCPPIntExt TKCSFDBSchema WOKSH WOKLibs \
-$(build_TKjcas) 
+# Foundation Classes Packages
+FOUNDATION_PKGS = TKernel \
+                  TKMath \
+                  TKAdvTools
+# Modeling Data Packages
+MODEL_DATA_PKGS = TKG2d \
+                  TKG3d \
+                  TKGeomBase \
+                  TKBRep
+# Modeling Algorithm Packages
+MODEL_ALGO_PKGS = TKGeomAlgo \
+                  TKTopAlgo \
+                  TKPrim \
+                  TKBO \
+                  TKHLR \
+                  TKMesh \
+                  TKShHealing \
+                  TKBool \
+                  TKFillet \
+                  TKFeat \
+                  TKOffset
+# Visualization Packages
+VISUALIZATION_GL_PKGS = TKOpenGl 
+VISUALIZATION_PKGS = TKService \
+                     TKV2d \
+                     TKV3d \
+                     TKMeshVS
+# Light-Weight Application Framework Packages
+OCAF_LITE_PKGS = TKCDF \
+                 PTKernel \
+                 TKLCAF \
+                 FWOSPlugin \
+                 TKPShape \
+                 TKBinL \
+                 TKXmlL \
+                 TKShapeSchema \
+                 TKPLCAF \
+                 TKStdLSchema \
+                 StdLPlugin \
+                 BinLPlugin \
+                 XmlLPlugin
+# Application Framework Packages
+OCAF_PKGS = TKCAF \
+            TKBin \
+            TKXml \
+            TKPCAF \
+            TKStdSchema \
+            StdPlugin \
+            XmlPlugin \
+            BinPlugin
+# Core Data Exchange Packages
+DXE_CORE_PKGS = TKSTL \
+                TKXSBase \
+                TKSTEPBase \
+                TKIGES \
+                TKSTEPAttr \
+                TKSTEP209 \
+                TKSTEP
+# Visualization Data Exchange Packages
+DXE_VIS_PKGS = TKVRML
+# Application Framework Data Exchange Packages
+DXE_OCAF_PKGS = TKXCAF \
+                TKXCAFSchema \
+                TKXmlXCAF \
+                TKBinXCAF \
+                TKXDEIGES \
+                TKXDESTEP \
+                XCAFPlugin \
+                XmlXCAFPlugin \
+                BinXCAFPlugin
+# Test Harness Packages
+TEST_HARNESS_PKGS = TKDraw \
+                    TKTopTest \
+                    TKViewerTest \
+                    TKXSDRAW \
+                    TKDCAF \
+                    TKXDEDRAW
+TEST_HARNESS_PROGS = DRAWEXE
+# Developement Packages
+WOK_PKGS = TKWOK \
+           TKWOKTcl \
+           TKTCPPExt \
+           TKCDLFront \
+           TKCPPExt \
+           TKCPPExt \
+           TKCPPClient \
+           TKIDLFront \
+           TKCPPJini \
+           TKCPPIntExt \
+           TKCSFDBSchema \
+           WOKSH \
+           WOKLibs
+# Wrapper Packages
+WRAPPER_PKGS = TKjcas
+
+
+if ENABLE_MODEL
+  MODEL_DIRS = $(MODEL_DATA_PKGS) $(MODEL_ALGO_PKGS)
+else 
+  MODEL_DIRS =
+endif
+
+if ENABLE_VIS_GL
+  VIS_GL_DIRS = $(VISUALIZATION_GL_PKGS)
+else 
+  VIS_GL_DIRS =
+endif
+
+if ENABLE_VIS
+  VIS_DIRS = $(VISUALIZATION_PKGS) $(VIS_GL_SUBDIRS)
+else
+  VIS_DIRS =
+endif
+
+if ENABLE_OCAF_LITE
+  OCAF_LITE_DIRS = $(OCAF_LITE_PKGS)
+else
+  OCAF_LITE_DIRS = 
+endif
+
+if ENABLE_OCAF
+  OCAF_DIRS = $(OCAF_PKGS)
+else
+  OCAF_DIRS = 
+endif
+
+if ENABLE_DXE_OCAF
+  DXE_OCAF_DIRS = $(DXE_OCAF_PKGS)
+else
+  DXE_OCAF_DIRS = 
+endif
+
+if ENABLE_DXE_VIS
+  DXE_VIS_DIRS = $(DXE_VIS_PKGS)
+else
+  DXE_VIS_DIRS = 
+endif
+
+if ENABLE_DXE
+  DXE_DIRS = $(DXE_CORE_PKGS) $(DXE_VIS_DIRS) $(DXE_OCAF_DIRS)
+else
+  DXE_DIRS = 
+endif
+
+if ENABLE_DRAW
+  DRAW_DIRS = $(TEST_HARNESS_PKGS) $(TEST_HARNESS_PROGS)
+else
+  DRAW_DIRS =
+endif
+
+if ENABLE_WOK
+  WOK_DIRS = $(WOK_PKGS)
+else
+  WOK_DIRS =
+endif
+
+
+SUBDIRS = $(FOUNDATION_PKGS) \
+          $(MODEL_DIRS) \
+          $(VIS_DIRS) \
+          $(OCAF_LITE_DIRS) \
+          $(OCAF_DIRS) \
+          $(DXE_DIRS) \
+          $(DRAW_DIRS) \
+          $(WOK_DIRS)
 
 VPATH = @srcdir@ @top_srcdir@/adm/make: \
 @top_srcdir@/adm/make/TKernel: @top_srcdir@/adm/make/TKMath: @top_srcdir@/adm/make/TKAdvTools: \
@@ -34,106 +182,53 @@
 @top_srcdir@/adm/make/TKVRML: @top_srcdir@/adm/make/TKXCAF: @top_srcdir@/adm/make/TKSTL: @top_srcdir@/adm/make/TKXSBase: @top_srcdir@/adm/make/TKXCAFSchema: @top_srcdir@/adm/make/TKXmlXCAF: @top_srcdir@/adm/make/TKBinXCAF: @top_srcdir@/adm/make/TKSTEPBase: @top_srcdir@/adm/make/TKIGES: @top_srcdir@/adm/make/TKSTEPAttr: @top_srcdir@/adm/make/TKSTEP209: @top_srcdir@/adm/make/TKXDEIGES: @top_srcdir@/adm/make/TKSTEP: @top_srcdir@/adm/make/TKXDESTEP: @top_srcdir@/adm/make/XCAFPlugin: @top_srcdir@/adm/make/XmlXCAFPlugin: @top_srcdir@/adm/make/BinXCAFPlugin: \
 @top_srcdir@/adm/make/TKDraw: @top_srcdir@/adm/make/TKTopTest: @top_srcdir@/adm/make/TKViewerTest: @top_srcdir@/adm/make/TKXSDRAW: @top_srcdir@/adm/make/TKDCAF: @top_srcdir@/adm/make/TKXDEDRAW: @top_srcdir@/adm/make/DRAWEXE: \
 @top_srcdir@/adm/make/TKWOK: @top_srcdir@/adm/make/TKWOKTcl: @top_srcdir@/adm/make/TKTCPPExt: @top_srcdir@/adm/make/TKCDLFront: @top_srcdir@/adm/make/TKCPPExt: @top_srcdir@/adm/make/TKCPPClient: @top_srcdir@/adm/make/TKIDLFront: @top_srcdir@/adm/make/TKCPPJini: @top_srcdir@/adm/make/TKCPPIntExt: @top_srcdir@/adm/make/TKCSFDBSchema: @top_srcdir@/adm/make/WOKSH: @top_srcdir@/adm/make/WOKLibs: \
-@top_srcdir@/adm/make/$(build_TKjcas): 
+@top_srcdir@/adm/make/TKjcas: 
 
 FoundationClasses:
-	cd TKernel && $(MAKE) $(AM_MAKEFLAGS) libTKernel.la
-	cd TKMath && $(MAKE) $(AM_MAKEFLAGS) libTKMath.la
-	cd TKAdvTools && $(MAKE) $(AM_MAKEFLAGS) libTKAdvTools.la
+	for d in $(FOUNDATION_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 ModelingData:
-	cd TKG2d && $(MAKE) $(AM_MAKEFLAGS) libTKG2d.la
-	cd TKG3d && $(MAKE) $(AM_MAKEFLAGS) libTKG3d.la
-	cd TKGeomBase && $(MAKE) $(AM_MAKEFLAGS) libTKGeomBase.la
-	cd TKBRep && $(MAKE) $(AM_MAKEFLAGS) libTKBRep.la
+	for d in $(MODEL_DATA_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 ModelingAlgorithms:
-	cd TKGeomAlgo && $(MAKE) $(AM_MAKEFLAGS) libTKGeomAlgo.la
-	cd TKTopAlgo && $(MAKE) $(AM_MAKEFLAGS) libTKTopAlgo.la
-	cd TKPrim && $(MAKE) $(AM_MAKEFLAGS) libTKPrim.la
-	cd TKBO && $(MAKE) $(AM_MAKEFLAGS) libTKBO.la
-	cd TKHLR && $(MAKE) $(AM_MAKEFLAGS) libTKHLR.la
-	cd TKMesh && $(MAKE) $(AM_MAKEFLAGS) libTKMesh.la
-	cd TKShHealing && $(MAKE) $(AM_MAKEFLAGS) libTKShHealing.la
-	cd TKBool && $(MAKE) $(AM_MAKEFLAGS) libTKBool.la
-	cd TKFillet && $(MAKE) $(AM_MAKEFLAGS) libTKFillet.la
-	cd TKFeat && $(MAKE) $(AM_MAKEFLAGS) libTKFeat.la
-	cd TKOffset && $(MAKE) $(AM_MAKEFLAGS) libTKOffset.la
+	for d in $(MODEL_ALGO_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 Visualization:
-	cd TKService && $(MAKE) $(AM_MAKEFLAGS) libTKService.la
-	cd TKV2d && $(MAKE) $(AM_MAKEFLAGS) libTKV2d.la
-	cd TKV3d && $(MAKE) $(AM_MAKEFLAGS) libTKV3d.la
-	cd TKOpenGl && $(MAKE) $(AM_MAKEFLAGS) libTKOpenGl.la
-	cd TKMeshVS && $(MAKE) $(AM_MAKEFLAGS) libTKMeshVS.la
+	for d in $(VISUALIZATION_PKGS) $(VISUALIZATION_GL_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 ApplicationFramework:
-	cd TKCDF && $(MAKE) $(AM_MAKEFLAGS) libTKCDF.la
-	cd PTKernel && $(MAKE) $(AM_MAKEFLAGS) libPTKernel.la
-	cd TKLCAF && $(MAKE) $(AM_MAKEFLAGS) libTKLCAF.la
-	cd FWOSPlugin && $(MAKE) $(AM_MAKEFLAGS) libFWOSPlugin.la
-	cd TKPShape && $(MAKE) $(AM_MAKEFLAGS) libTKPShape.la
-	cd TKCAF && $(MAKE) $(AM_MAKEFLAGS) libTKCAF.la
-	cd TKBinL && $(MAKE) $(AM_MAKEFLAGS) libTKBinL.la
-	cd TKXmlL && $(MAKE) $(AM_MAKEFLAGS) libTKXmlL.la
-	cd TKShapeSchema && $(MAKE) $(AM_MAKEFLAGS) libTKShapeSchema.la
-	cd TKPLCAF && $(MAKE) $(AM_MAKEFLAGS) libTKPLCAF.la
-	cd TKBin && $(MAKE) $(AM_MAKEFLAGS) libTKBin.la
-	cd TKXml && $(MAKE) $(AM_MAKEFLAGS) libTKXml.la
-	cd TKPCAF && $(MAKE) $(AM_MAKEFLAGS) libTKPCAF.la
-	cd TKStdLSchema && $(MAKE) $(AM_MAKEFLAGS) libTKStdLSchema.la
-	cd TKStdSchema && $(MAKE) $(AM_MAKEFLAGS) libTKStdSchema.la
-	cd StdPlugin && $(MAKE) $(AM_MAKEFLAGS) libStdPlugin.la
-	cd XmlPlugin && $(MAKE) $(AM_MAKEFLAGS) libXmlPlugin.la
-	cd BinPlugin && $(MAKE) $(AM_MAKEFLAGS) libBinPlugin.la
-	cd StdLPlugin && $(MAKE) $(AM_MAKEFLAGS) libStdLPlugin.la
-	cd BinLPlugin && $(MAKE) $(AM_MAKEFLAGS) libBinLPlugin.la
-	cd XmlLPlugin && $(MAKE) $(AM_MAKEFLAGS) libXmlLPlugin.la
+	for d in $(OCAF_LITE_PKGS) $(OCAF_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 DataExchange:
-	cd TKVRML && $(MAKE) $(AM_MAKEFLAGS) libTKVRML.la
-	cd TKXCAF && $(MAKE) $(AM_MAKEFLAGS) libTKXCAF.la
-	cd TKSTL && $(MAKE) $(AM_MAKEFLAGS) libTKSTL.la
-	cd TKXSBase && $(MAKE) $(AM_MAKEFLAGS) libTKXSBase.la
-	cd TKXCAFSchema && $(MAKE) $(AM_MAKEFLAGS) libTKXCAFSchema.la
-	cd TKXmlXCAF && $(MAKE) $(AM_MAKEFLAGS) libTKXmlXCAF.la
-	cd TKBinXCAF && $(MAKE) $(AM_MAKEFLAGS) libTKBinXCAF.la
-	cd TKSTEPBase && $(MAKE) $(AM_MAKEFLAGS) libTKSTEPBase.la
-	cd TKIGES && $(MAKE) $(AM_MAKEFLAGS) libTKIGES.la
-	cd TKSTEPAttr && $(MAKE) $(AM_MAKEFLAGS) libTKSTEPAttr.la
-	cd TKSTEP209 && $(MAKE) $(AM_MAKEFLAGS) libTKSTEP209.la
-	cd TKXDEIGES && $(MAKE) $(AM_MAKEFLAGS) libTKXDEIGES.la
-	cd TKSTEP && $(MAKE) $(AM_MAKEFLAGS) libTKSTEP.la
-	cd TKXDESTEP && $(MAKE) $(AM_MAKEFLAGS) libTKXDESTEP.la
-	cd XCAFPlugin && $(MAKE) $(AM_MAKEFLAGS) libXCAFPlugin.la
-	cd XmlXCAFPlugin && $(MAKE) $(AM_MAKEFLAGS) libXmlXCAFPlugin.la
-	cd BinXCAFPlugin && $(MAKE) $(AM_MAKEFLAGS) libBinXCAFPlugin.la
+	for d in $(DXE_CORE_PKGS) $(DXE_VIS_PKGS) $(DXE_OCAF_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 Draw:
-	cd TKDraw && $(MAKE) $(AM_MAKEFLAGS) libTKDraw.la
-	cd TKTopTest && $(MAKE) $(AM_MAKEFLAGS) libTKTopTest.la
-	cd TKViewerTest && $(MAKE) $(AM_MAKEFLAGS) libTKViewerTest.la
-	cd TKXSDRAW && $(MAKE) $(AM_MAKEFLAGS) libTKXSDRAW.la
-	cd TKDCAF && $(MAKE) $(AM_MAKEFLAGS) libTKDCAF.la
-	cd TKXDEDRAW && $(MAKE) $(AM_MAKEFLAGS) libTKXDEDRAW.la
-	cd DRAWEXE && $(MAKE) $(AM_MAKEFLAGS) libDRAWEXE.la
+	for d in $(TEST_HARNESS_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
+	cd DRAWEXE && make $(AM_MAKEFLAGS) DRAWEXE
 
 WOK:
-	cd TKWOK && $(MAKE) $(AM_MAKEFLAGS) libTKWOK.la
-	cd TKWOKTcl && $(MAKE) $(AM_MAKEFLAGS) libTKWOKTcl.la
-	cd TKTCPPExt && $(MAKE) $(AM_MAKEFLAGS) libTKTCPPExt.la
-	cd TKCDLFront && $(MAKE) $(AM_MAKEFLAGS) libTKCDLFront.la
-	cd TKCPPExt && $(MAKE) $(AM_MAKEFLAGS) libTKCPPExt.la
-	cd TKCPPClient && $(MAKE) $(AM_MAKEFLAGS) libTKCPPClient.la
-	cd TKIDLFront && $(MAKE) $(AM_MAKEFLAGS) libTKIDLFront.la
-	cd TKCPPJini && $(MAKE) $(AM_MAKEFLAGS) libTKCPPJini.la
-	cd TKCPPIntExt && $(MAKE) $(AM_MAKEFLAGS) libTKCPPIntExt.la
-	cd TKCSFDBSchema && $(MAKE) $(AM_MAKEFLAGS) libTKCSFDBSchema.la
-	cd WOKSH && $(MAKE) $(AM_MAKEFLAGS) libWOKSH.la
-	cd WOKLibs && $(MAKE) $(AM_MAKEFLAGS) libWOKLibs.la
+	for d in $(WOK_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 Wrappers:
-	cd TKjcas && $(MAKE) $(AM_MAKEFLAGS) libTKjcas.la
+	for d in $(WRAPPER_PKGS); do \
+	  (cd $$d && $(MAKE) $(AM_MAKEFLAGS) lib$${d}.la) || exit 1 \
+	done
 
 
 .PHONY: FoundationClasses ModelingData ModelingAlgorithms Visualization ApplicationFramework DataExchange Draw WOK Wrappers
