Index: /trunk/FACT++/Makefile.am
===================================================================
--- /trunk/FACT++/Makefile.am	(revision 10210)
+++ /trunk/FACT++/Makefile.am	(revision 10211)
@@ -9,18 +9,10 @@
 AM_CPPFLAGS = \
    -O3 -Wall -Winit-self -Wpointer-arith -Wcast-align -Wextra -Wformat=2 \
-   -Idim_v19r15/dim $(DIM_FLAGS) $(PTHREAD_CFLAGS) $(MOTIF_CFLAGS)
-   
+   -Idim_v19r15/dim $(DIM_FLAGS)
+
 AM_CXXFLAGS = $(AM_CPPFLAGS) -Woverloaded-virtual -Wshadow -std=c++0x
 
 # -no-undefined
-AM_LDFLAGS = -module -avoid-version \
-	$(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
-   	-lmysqlpp \
-   	-lboost_system \
-   	-lboost_thread \
-   	-lboost_regex \
-   	-lboost_date_time \
-   	-lboost_program_options \
-   	-lboost_filesystem
+AM_LDFLAGS = -module -avoid-version
 
 #$(man3_MANS): doxygen-doc
@@ -60,6 +52,6 @@
 #dns_CPPFLAGS = $(AM_CPPFLAGS) $(DIM_FLAGS)
 
-did_LDADD    = $(MOTIF_LDFLAGS) libDim.la 
-did_CPPFLAGS = $(AM_CPPFLAGS) $(MOTIF_INCL) -Idim_v19r15/src/did 
+did_LDADD    = libDim.la 
+did_CPPFLAGS = $(AM_CPPFLAGS) -Idim_v19r15/src/did 
 did_SOURCES  = dim_v19r15/src/did/did.c dim_v19r15/src/did/dui_util.c
 
Index: /trunk/FACT++/Makefile.in
===================================================================
--- /trunk/FACT++/Makefile.in	(revision 10210)
+++ /trunk/FACT++/Makefile.in	(revision 10211)
@@ -50,5 +50,6 @@
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/.macro_dir/ac_find_motif.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/.macro_dir/ac_check_readline.m4 \
+	$(top_srcdir)/.macro_dir/ac_find_motif.m4 \
 	$(top_srcdir)/.macro_dir/libtool.m4 \
 	$(top_srcdir)/.macro_dir/ltoptions.m4 \
@@ -138,6 +139,5 @@
 	dim_v19r15/src/did/did-dui_util.$(OBJEXT)
 did_OBJECTS = $(am_did_OBJECTS)
-am__DEPENDENCIES_1 =
-did_DEPENDENCIES = $(am__DEPENDENCIES_1) libDim.la
+did_DEPENDENCIES = libDim.la
 am_dns_OBJECTS = dim_v19r15/src/dns.$(OBJEXT)
 dns_OBJECTS = $(am_dns_OBJECTS)
@@ -336,4 +336,6 @@
 PTHREAD_LIBS = @PTHREAD_LIBS@
 RANLIB = @RANLIB@
+READLINE_INCLUDES = @READLINE_INCLUDES@
+READLINE_LIBS = @READLINE_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
@@ -430,19 +432,10 @@
 AM_CPPFLAGS = \
    -O3 -Wall -Winit-self -Wpointer-arith -Wcast-align -Wextra -Wformat=2 \
-   -Idim_v19r15/dim $(DIM_FLAGS) $(PTHREAD_CFLAGS) $(MOTIF_CFLAGS)
+   -Idim_v19r15/dim $(DIM_FLAGS)
 
 AM_CXXFLAGS = $(AM_CPPFLAGS) -Woverloaded-virtual -Wshadow -std=c++0x
 
 # -no-undefined
-AM_LDFLAGS = -module -avoid-version \
-	$(PTHREAD_CFLAGS) $(PTHREAD_LIBS) \
-   	-lmysqlpp \
-   	-lboost_system \
-   	-lboost_thread \
-   	-lboost_regex \
-   	-lboost_date_time \
-   	-lboost_program_options \
-   	-lboost_filesystem
-
+AM_LDFLAGS = -module -avoid-version
 lib_LTLIBRARIES = libDim.la libDim++.la libTime.la libTools.la \
 		  libConfiguration.la libStateMachine.la
@@ -471,6 +464,6 @@
 dns_SOURCES = dim_v19r15/src/dns.c
 #dns_CPPFLAGS = $(AM_CPPFLAGS) $(DIM_FLAGS)
-did_LDADD = $(MOTIF_LDFLAGS) libDim.la 
-did_CPPFLAGS = $(AM_CPPFLAGS) $(MOTIF_INCL) -Idim_v19r15/src/did 
+did_LDADD = libDim.la 
+did_CPPFLAGS = $(AM_CPPFLAGS) -Idim_v19r15/src/did 
 did_SOURCES = dim_v19r15/src/did/did.c dim_v19r15/src/did/dui_util.c
 
Index: /trunk/FACT++/configure
===================================================================
--- /trunk/FACT++/configure	(revision 10210)
+++ /trunk/FACT++/configure	(revision 10211)
@@ -773,4 +773,6 @@
 X_CFLAGS
 XMKMF
+READLINE_INCLUDES
+READLINE_LIBS
 PTHREAD_CFLAGS
 PTHREAD_LIBS
@@ -958,4 +960,5 @@
 enable_doxygen_ps
 enable_doxygen_pdf
+with_readline
 with_x
 with_motif_includes
@@ -1641,4 +1644,5 @@
                           both]
   --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-readline[=dir]   Compile with readline/locate base dir
   --with-x                use the X Window System
   --with-motif-includes=DIR    Motif include files are in DIR
@@ -4245,11 +4249,11 @@
   lt_cv_nm_interface="BSD nm"
   echo "int some_variable = 0;" > conftest.$ac_ext
-  (eval echo "\"\$as_me:4247: $ac_compile\"" >&5)
+  (eval echo "\"\$as_me:4251: $ac_compile\"" >&5)
   (eval "$ac_compile" 2>conftest.err)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4250: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval echo "\"\$as_me:4254: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
   (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
   cat conftest.err >&5
-  (eval echo "\"\$as_me:4253: output\"" >&5)
+  (eval echo "\"\$as_me:4257: output\"" >&5)
   cat conftest.out >&5
   if $GREP 'External.*some_variable' conftest.out > /dev/null; then
@@ -5457,5 +5461,5 @@
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 5459 "configure"' > conftest.$ac_ext
+  echo '#line 5463 "configure"' > conftest.$ac_ext
   if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
@@ -7385,9 +7389,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7387: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7391: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7391: \$? = $ac_status" >&5
+   echo "$as_me:7395: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
@@ -7724,9 +7728,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7726: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7730: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:7730: \$? = $ac_status" >&5
+   echo "$as_me:7734: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
@@ -7829,9 +7833,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7831: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7835: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7835: \$? = $ac_status" >&5
+   echo "$as_me:7839: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
@@ -7884,9 +7888,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7886: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:7890: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:7890: \$? = $ac_status" >&5
+   echo "$as_me:7894: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
@@ -10268,5 +10272,5 @@
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10270 "configure"
+#line 10274 "configure"
 #include "confdefs.h"
 
@@ -10364,5 +10368,5 @@
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 10366 "configure"
+#line 10370 "configure"
 #include "confdefs.h"
 
@@ -12320,9 +12324,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12322: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12326: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:12326: \$? = $ac_status" >&5
+   echo "$as_me:12330: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
@@ -12419,9 +12423,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12421: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12425: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12425: \$? = $ac_status" >&5
+   echo "$as_me:12429: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
@@ -12471,9 +12475,9 @@
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12473: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:12477: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:12477: \$? = $ac_status" >&5
+   echo "$as_me:12481: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
@@ -16341,4 +16345,5 @@
 
 
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -16685,74 +16690,90 @@
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5
-$as_echo_n "checking for readline in -lreadline... " >&6; }
-if test "${ac_cv_lib_readline_readline+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lreadline  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char readline ();
-int
-main ()
-{
-return readline ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_readline_readline=yes
-else
-  ac_cv_lib_readline_readline=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5
-$as_echo "$ac_cv_lib_readline_readline" >&6; }
-if test "x$ac_cv_lib_readline_readline" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBREADLINE 1
-_ACEOF
-
-  LIBS="-lreadline $LIBS"
-
-else
-
-      echo "Error! libreadline not found in default libarary paths."
-      exit -1
-
-
-fi
-
-for ac_header in readline/readline.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
-if test "x$ac_cv_header_readline_readline_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_READLINE_READLINE_H 1
-_ACEOF
-
-else
-
-      echo "Error! readline/readline.h not properly installed in default include path (maybe readline-dev missing)."
-      exit -1
-
-
-fi
-
-done
-
-
+CPPFLAGS+=" "$PTHREAD_CFLAGS" "
+LDFLAGS+=" "$PTHREAD_CFLAGS" "
+
+
+
+
+
+
+
+# Check whether --with-readline was given.
+if test "${with_readline+set}" = set; then :
+  withval=$with_readline; if test "x$withval" = "xno" ; then
+      without_readline=yes
+    elif test "x$withval" != "xyes" ; then
+      with_arg="$withval/include:-L$withval/lib $withval/include/readline:-L$withval/lib"
+    fi
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline.h" >&5
+$as_echo_n "checking for readline.h... " >&6; }
+
+  if test "x$without_readline" != "xyes"; then
+    for i in $with_arg \
+	     /usr/include: \
+	     /usr/local/include:-L/usr/local/lib \
+             /usr/freeware/include:-L/usr/freeware/lib32 \
+	     /usr/pkg/include:-L/usr/pkg/lib \
+	     /sw/include:-L/sw/lib \
+	     /cw/include:-L/cw/lib \
+	     /net/caladium/usr/people/piotr.nba/temp/pkg/include:-L/net/caladium/usr/people/piotr.nba/temp/pkg/lib \
+	     /boot/home/config/include:-L/boot/home/config/lib; do
+
+      incl=`echo "$i" | sed 's/:.*//'`
+      lib=`echo "$i" | sed 's/.*://'`
+
+      if test -f $incl/readline/readline.h ; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $incl/readline/readline.h" >&5
+$as_echo "$incl/readline/readline.h" >&6; }
+        READLINE_LIBS="$lib -lreadline"
+	if test "$incl" != "/usr/include"; then
+	  READLINE_INCLUDES="-I$incl/readline -I$incl"
+	else
+	  READLINE_INCLUDES="-I$incl/readline"
+	fi
+
+$as_echo "#define HAVE_READLINE 1" >>confdefs.h
+
+        have_readline=yes
+        break
+      elif test -f $incl/readline.h -a "x$incl" != "x/usr/include"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $incl/readline.h" >&5
+$as_echo "$incl/readline.h" >&6; }
+        READLINE_LIBS="$lib -lreadline"
+        READLINE_INCLUDES="-I$incl"
+
+$as_echo "#define HAVE_READLINE 1" >>confdefs.h
+
+        have_readline=yes
+        break
+      fi
+    done
+  fi
+
+  if test "x$have_readline" != "xyes"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+  fi
+
+
+CPPFLAGS+=" "$READLINE_INCLUDES" "
+LDFLAGS+=" "$READLINE_LIBS" "
+
+#AC_CHECK_LIB(readline, readline, [],
+#   [
+#      echo "Error! libreadline not found in default libarary paths."
+#      exit -1
+#   ]
+#)
+#AC_CHECK_HEADERS(readline/readline.h, [],
+#   [
+#      echo "Error! readline/readline.h not properly installed in default include path (maybe readline-dev missing)."
+#      exit -1
+#   ]
+#)
+#
 
 for ac_header in panel.h
@@ -16832,24 +16853,4 @@
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-
-######################################################################
-# pthread support
-######################################################################
-
-#AX_PTHREAD
-#
-#AC_CHECK_LIB(pthread,  pthread_create,
-#   [],
-#   [
-#      echo "Error! libpthread not found in default libarary paths."
-#      exit -1
-#   ]
-#)
-#AC_CHECK_HEADERS(pthread.h, [],
-#   [
-#      echo "Error! pthread.h not properly installed in default include paths."
-#      exit -1
-#   ]
-#)
 
 ######################################################################
@@ -17901,4 +17902,14 @@
 
 
+CPPFLAGS+=" "$MOTIF_INCL" "
+LDFLAGS+=" "$MOTIF_LDFLAGS" "
+
+#AC_CHECK_HEADERS([Mrm/MrmAppl.h], [],
+#   [
+#      echo "Error! Mrm/MrmAppl.h not properly installed, needed to compile did (you need most probably lesstif2-dev)."
+#      exit -1
+#   ]
+#)
+
 ######################################################################
 # MySQL(++) SUPPORT
@@ -18062,4 +18073,6 @@
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+
+LDFLAGS+=" -lmysqlpp "
 
 ######################################################################
@@ -19906,4 +19919,11 @@
 #ax_boost_wave
 #ax_boost_wserialization
+
+LDFLAGS+=" -lboost_date_time"
+LDFLAGS+=" -lboost_filesystem"
+LDFLAGS+=" -lboost_program_options"
+LDFLAGS+=" -lboost_regex"
+LDFLAGS+=" -lboost_system"
+LDFLAGS+=" -lboost_thread "
 
 #AC_CHECK_HEADERS(
Index: /trunk/FACT++/configure.ac
===================================================================
--- /trunk/FACT++/configure.ac	(revision 10210)
+++ /trunk/FACT++/configure.ac	(revision 10211)
@@ -50,19 +50,29 @@
 AC_LANG_PUSH(C)
 
+
 ACX_PTHREAD
 
-AC_CHECK_LIB(readline, readline, [], 
-   [
-      echo "Error! libreadline not found in default libarary paths." 
-      exit -1
-   ]
-)
-AC_CHECK_HEADERS(readline/readline.h, [], 
-   [
-      echo "Error! readline/readline.h not properly installed in default include path (maybe readline-dev missing)." 
-      exit -1
-   ]
-)
-
+CPPFLAGS+=" "$PTHREAD_CFLAGS" "
+LDFLAGS+=" "$PTHREAD_CFLAGS" "
+
+
+AC_CHECK_READLINE
+
+CPPFLAGS+=" "$READLINE_INCLUDES" "
+LDFLAGS+=" "$READLINE_LIBS" "
+
+#AC_CHECK_LIB(readline, readline, [], 
+#   [
+#      echo "Error! libreadline not found in default libarary paths." 
+#      exit -1
+#   ]
+#)
+#AC_CHECK_HEADERS(readline/readline.h, [], 
+#   [
+#      echo "Error! readline/readline.h not properly installed in default include path (maybe readline-dev missing)." 
+#      exit -1
+#   ]
+#)
+#
 
 AC_CHECK_HEADERS(panel.h, [], 
@@ -82,28 +92,18 @@
 
 ######################################################################
-# pthread support
-######################################################################
-
-#AX_PTHREAD
-#
-#AC_CHECK_LIB(pthread,  pthread_create, 
-#   [], 
-#   [
-#      echo "Error! libpthread not found in default libarary paths." 
-#      exit -1
-#   ]
-#)
-#AC_CHECK_HEADERS(pthread.h, [], 
-#   [
-#      echo "Error! pthread.h not properly installed in default include paths." 
-#      exit -1
-#   ]
-#)
-
-######################################################################
 # Xm.h (lesstif/motif, needed by did)
 ######################################################################
 
 AC_FIND_MOTIF
+
+CPPFLAGS+=" "$MOTIF_INCL" "
+LDFLAGS+=" "$MOTIF_LDFLAGS" "
+
+#AC_CHECK_HEADERS([Mrm/MrmAppl.h], [], 
+#   [                             
+#      echo "Error! Mrm/MrmAppl.h not properly installed, needed to compile did (you need most probably lesstif2-dev)." 
+#      exit -1
+#   ]
+#)
 
 ######################################################################
@@ -113,4 +113,6 @@
 MYSQL_DEVEL
 MYSQLPP_DEVEL
+
+LDFLAGS+=" -lmysqlpp "
 
 ######################################################################
@@ -140,4 +142,11 @@
 #ax_boost_wave
 #ax_boost_wserialization
+
+LDFLAGS+=" -lboost_date_time"
+LDFLAGS+=" -lboost_filesystem"
+LDFLAGS+=" -lboost_program_options"
+LDFLAGS+=" -lboost_regex"
+LDFLAGS+=" -lboost_system"
+LDFLAGS+=" -lboost_thread "
 
 #AC_CHECK_HEADERS(
