Index: /trunk/FACT++/.aux_dir/compile
===================================================================
--- /trunk/FACT++/.aux_dir/compile	(revision 10183)
+++ /trunk/FACT++/.aux_dir/compile	(revision 10183)
@@ -0,0 +1,143 @@
+#! /bin/sh
+# Wrapper for compilers which do not understand `-c -o'.
+
+scriptversion=2009-10-06.20; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
+# Foundation, Inc.
+# Written by Tom Tromey <tromey@cygnus.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: compile [--help] [--version] PROGRAM [ARGS]
+
+Wrapper for compilers which do not understand `-c -o'.
+Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+arguments, and rename the output as expected.
+
+If you are trying to build a whole package this is not the
+right script to run: please start by reading the file `INSTALL'.
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "compile $scriptversion"
+    exit $?
+    ;;
+esac
+
+ofile=
+cfile=
+eat=
+
+for arg
+do
+  if test -n "$eat"; then
+    eat=
+  else
+    case $1 in
+      -o)
+	# configure might choose to run compile as `compile cc -o foo foo.c'.
+	# So we strip `-o arg' only if arg is an object.
+	eat=1
+	case $2 in
+	  *.o | *.obj)
+	    ofile=$2
+	    ;;
+	  *)
+	    set x "$@" -o "$2"
+	    shift
+	    ;;
+	esac
+	;;
+      *.c)
+	cfile=$1
+	set x "$@" "$1"
+	shift
+	;;
+      *)
+	set x "$@" "$1"
+	shift
+	;;
+    esac
+  fi
+  shift
+done
+
+if test -z "$ofile" || test -z "$cfile"; then
+  # If no `-o' option was seen then we might have been invoked from a
+  # pattern rule where we don't need one.  That is ok -- this is a
+  # normal compilation that the losing compiler can handle.  If no
+  # `.c' file was seen then we are probably linking.  That is also
+  # ok.
+  exec "$@"
+fi
+
+# Name of file we expect compiler to create.
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
+
+# Create the lock directory.
+# Note: use `[/\\:.-]' here to ensure that we don't use the same name
+# that we are using for the .o file.  Also, base the name on the expected
+# object file name, since that is what matters with a parallel build.
+lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
+while true; do
+  if mkdir "$lockdir" >/dev/null 2>&1; then
+    break
+  fi
+  sleep 1
+done
+# FIXME: race condition here if user kills between mkdir and trap.
+trap "rmdir '$lockdir'; exit 1" 1 2 15
+
+# Run the compile.
+"$@"
+ret=$?
+
+if test -f "$cofile"; then
+  test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
+elif test -f "${cofile}bj"; then
+  test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
+fi
+
+rmdir "$lockdir"
+exit $ret
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Index: /trunk/FACT++/.aux_dir/config.guess
===================================================================
--- /trunk/FACT++/.aux_dir/config.guess	(revision 10183)
+++ /trunk/FACT++/.aux_dir/config.guess	(revision 10183)
@@ -0,0 +1,1502 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
+
+timestamp='2009-12-30'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[456])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep -q ld.so.1
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	LIBC=gnu
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+	echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: /trunk/FACT++/.aux_dir/config.sub
===================================================================
--- /trunk/FACT++/.aux_dir/config.sub	(revision 10183)
+++ /trunk/FACT++/.aux_dir/config.sub	(revision 10183)
@@ -0,0 +1,1714 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+#   Free Software Foundation, Inc.
+
+timestamp='2010-01-22'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
+Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze)
+		os=
+		basic_machine=$1
+		;;
+        -bluegene*)
+	        os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| rx \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* | rx-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile-* | tilegx-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+        cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+        microblaze)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+        # This must be matched before tile*.
+        tilegx*)
+		basic_machine=tilegx-unknown
+		os=-linux-gnu
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+        -auroraux)
+	        os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+        -nacl*)
+	        ;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: /trunk/FACT++/.aux_dir/depcomp
===================================================================
--- /trunk/FACT++/.aux_dir/depcomp	(revision 10183)
+++ /trunk/FACT++/.aux_dir/depcomp	(revision 10183)
@@ -0,0 +1,630 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+  '')
+     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     exit 1;
+     ;;
+  -h | --h*)
+    cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+  depmode     Dependency tracking mode.
+  source      Source file read by `PROGRAMS ARGS'.
+  object      Object file output by `PROGRAMS ARGS'.
+  DEPDIR      directory where to store dependencies.
+  depfile     Dependency file to output.
+  tmpdepfile  Temporary file to use when outputing dependencies.
+  libtool     Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "depcomp $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+   # This is just like msvisualcpp but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u="sed s,\\\\\\\\,/,g"
+   depmode=msvisualcpp
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am.  Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+  for arg
+  do
+    case $arg in
+    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+    *)  set fnord "$@" "$arg" ;;
+    esac
+    shift # fnord
+    shift # $arg
+  done
+  "$@"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> "$depfile"
+    echo >> "$depfile"
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  In older versions, this file always lives in the
+  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # start of each line; $object doesn't have directory information.
+  # Version 6 uses the directory in both cases.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$base.u
+    tmpdepfile3=$dir.libs/$base.u
+    "$@" -Wc,-M
+  else
+    tmpdepfile1=$dir$base.u
+    tmpdepfile2=$dir$base.u
+    tmpdepfile3=$dir$base.u
+    "$@" -M
+  fi
+  stat=$?
+
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+    exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+    # That's a tab and a space in the [].
+    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+icc)
+  # Intel's C compiler understands `-MD -MF file'.  However on
+  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+  # ICC 7.0 will fill foo.d with something like
+  #    foo.o: sub/foo.c
+  #    foo.o: sub/foo.h
+  # which is wrong.  We want:
+  #    sub/foo.o: sub/foo.c
+  #    sub/foo.o: sub/foo.h
+  #    sub/foo.c:
+  #    sub/foo.h:
+  # ICC 7.1 will output
+  #    foo.o: sub/foo.c sub/foo.h
+  # and will wrap long lines using \ :
+  #    foo.o: sub/foo.c ... \
+  #     sub/foo.h ... \
+  #     ...
+
+  "$@" -MD -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  # Each line is of the form `foo.o: dependent.h',
+  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Do two passes, one to just change these to
+  # `$object: dependent.h' and one to simply `dependent.h:'.
+  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+  # Some versions of the HPUX 10.20 sed can't process this invocation
+  # correctly.  Breaking it into two sed invocations is a workaround.
+  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+    sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp2)
+  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+  # compilers, which have integrated preprocessors.  The correct option
+  # to use with these is +Maked; it writes dependencies to a file named
+  # 'foo.d', which lands next to the object file, wherever that
+  # happens to be.
+  # Much of this is similar to the tru64 case; see comments there.
+  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+  test "x$dir" = "x$object" && dir=
+  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+  if test "$libtool" = yes; then
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir.libs/$base.d
+    "$@" -Wc,+Maked
+  else
+    tmpdepfile1=$dir$base.d
+    tmpdepfile2=$dir$base.d
+    "$@" +Maked
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+     rm -f "$tmpdepfile1" "$tmpdepfile2"
+     exit $stat
+  fi
+
+  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+  do
+    test -f "$tmpdepfile" && break
+  done
+  if test -f "$tmpdepfile"; then
+    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+    # Add `dependent.h:' lines.
+    sed -ne '2,${
+	       s/^ *//
+	       s/ \\*$//
+	       s/$/:/
+	       p
+	     }' "$tmpdepfile" >> "$depfile"
+  else
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile" "$tmpdepfile2"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+   test "x$dir" = "x$object" && dir=
+   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+   if test "$libtool" = yes; then
+      # With Tru64 cc, shared objects can also be used to make a
+      # static library.  This mechanism is used in libtool 1.4 series to
+      # handle both shared and static libraries in a single compilation.
+      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+      #
+      # With libtool 1.5 this exception was removed, and libtool now
+      # generates 2 separate objects for the 2 libraries.  These two
+      # compilations output dependencies in $dir.libs/$base.o.d and
+      # in $dir$base.o.d.  We have to check for both files, because
+      # one of the two compilations can be disabled.  We should prefer
+      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+      # automatically cleaned when .libs/ is deleted, while ignoring
+      # the former would cause a distcleancheck panic.
+      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
+      tmpdepfile2=$dir$base.o.d          # libtool 1.5
+      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
+      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
+      "$@" -Wc,-MD
+   else
+      tmpdepfile1=$dir$base.o.d
+      tmpdepfile2=$dir$base.d
+      tmpdepfile3=$dir$base.d
+      tmpdepfile4=$dir$base.d
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+      exit $stat
+   fi
+
+   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+   do
+     test -f "$tmpdepfile" && break
+   done
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a tab and a space in the [].
+      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout, regardless of -o.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  test -z "$dashmflag" && dashmflag=-M
+  # Require at least two characters before searching for `:'
+  # in the target name.  This is to cope with DOS-style filenames:
+  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  "$@" $dashmflag |
+    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  "$@" || exit $?
+  # Remove any Libtool call
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+  # X makedepend
+  shift
+  cleared=no eat=no
+  for arg
+  do
+    case $cleared in
+    no)
+      set ""; shift
+      cleared=yes ;;
+    esac
+    if test $eat = yes; then
+      eat=no
+      continue
+    fi
+    case "$arg" in
+    -D*|-I*)
+      set fnord "$@" "$arg"; shift ;;
+    # Strip any option that makedepend may not understand.  Remove
+    # the object too, otherwise makedepend will parse it as a source file.
+    -arch)
+      eat=yes ;;
+    -*|$object)
+      ;;
+    *)
+      set fnord "$@" "$arg"; shift ;;
+    esac
+  done
+  obj_suffix=`echo "$object" | sed 's/^.*\././'`
+  touch "$tmpdepfile"
+  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  # Remove `-o $object'.
+  IFS=" "
+  for arg
+  do
+    case $arg in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    *)
+      set fnord "$@" "$arg"
+      shift # fnord
+      shift # $arg
+      ;;
+    esac
+  done
+
+  "$@" -E |
+    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the preprocessed file to stdout.
+  "$@" || exit $?
+
+  # Remove the call to Libtool.
+  if test "$libtool" = yes; then
+    while test "X$1" != 'X--mode=compile'; do
+      shift
+    done
+    shift
+  fi
+
+  IFS=" "
+  for arg
+  do
+    case "$arg" in
+    -o)
+      shift
+      ;;
+    $object)
+      shift
+      ;;
+    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+    *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+    esac
+  done
+  "$@" -E 2>/dev/null |
+  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvcmsys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Index: /trunk/FACT++/.aux_dir/install-sh
===================================================================
--- /trunk/FACT++/.aux_dir/install-sh	(revision 10183)
+++ /trunk/FACT++/.aux_dir/install-sh	(revision 10183)
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+	shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+	shift;;
+
+    -o) chowncmd="$chownprog $2"
+	shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+	shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      echo "$0: no destination specified." >&2
+      exit 1
+    fi
+
+    dst=$dst_arg
+    # Protect names starting with `-'.
+    case $dst in
+      -*) dst=./$dst;;
+    esac
+
+    # If destination is a directory, append the input filename; won't work
+    # if double slashes aren't ignored.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dst_arg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Index: /trunk/FACT++/.aux_dir/ltmain.sh
===================================================================
--- /trunk/FACT++/.aux_dir/ltmain.sh	(revision 10183)
+++ /trunk/FACT++/.aux_dir/ltmain.sh	(revision 10183)
@@ -0,0 +1,8413 @@
+# Generated from ltmain.m4sh.
+
+# ltmain.sh (GNU libtool) 2.2.6b
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#     --config             show all configuration variables
+#     --debug              enable verbose shell tracing
+# -n, --dry-run            display commands without modifying any files
+#     --features           display basic configuration information and exit
+#     --mode=MODE          use operation mode MODE
+#     --preserve-dup-deps  don't remove duplicate dependency libraries
+#     --quiet, --silent    don't print informational messages
+#     --tag=TAG            use configuration variables from tag TAG
+# -v, --verbose            print informational messages (default)
+#     --version            print version information
+# -h, --help               print short or long help message
+#
+# MODE must be one of the following:
+#
+#       clean              remove files from the build directory
+#       compile            compile a source file into a libtool object
+#       execute            automatically set library path, then run a program
+#       finish             complete the installation of libtool libraries
+#       install            install libraries or executables
+#       link               create a library or an executable
+#       uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#       host-triplet:	$host
+#       shell:		$SHELL
+#       compiler:		$LTCC
+#       compiler flags:		$LTCFLAGS
+#       linker:		$LD (gnu? $with_gnu_ld)
+#       $progname:		(GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
+#       automake:		$automake_version
+#       autoconf:		$autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
+
+PROGRAM=ltmain.sh
+PACKAGE=libtool
+VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
+TIMESTAMP=""
+package_revision=1.3017
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# NLS nuisances: We save the old values to restore during execute mode.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+	  export $lt_var
+	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+	fi"
+done
+
+$lt_unset CDPATH
+
+
+
+
+
+: ${CP="cp -f"}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+# Generated shell functions inserted here.
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+case $progname in
+  -*) progname=./$progname ;;
+esac
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=:
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname${mode+: }$mode: $*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+	# list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+	IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "X$my_tmpdir" | $Xsed
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+	my_arg=`$ECHO "X$1" | $Xsed \
+	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+	    $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+	s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $SED -n '/^# Usage:/,/# -h/ {
+        s/^# //
+	s/^# *$//
+	s/\$progname/'$progname'/
+	p
+    }' < "$progpath"
+    $ECHO
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+        s/^# //
+	s/^# *$//
+	s*\$progname*'$progname'*
+	s*\$host*'"$host"'*
+	s*\$SHELL*'"$SHELL"'*
+	s*\$LTCC*'"$LTCC"'*
+	s*\$LTCFLAGS*'"$LTCFLAGS"'*
+	s*\$LD*'"$LD"'*
+	s/\$with_gnu_ld/'"$with_gnu_ld"'/
+	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	p
+     }' < "$progpath"
+    exit $?
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    func_error "missing argument for $1"
+    exit_cmd=exit
+}
+
+exit_cmd=:
+
+
+
+
+
+# Check that we have a working $ECHO.
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell, and then maybe $ECHO will work.
+  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<EOF
+$*
+EOF
+  exit $EXIT_SUCCESS
+fi
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+# $mode is unset
+nonopt=
+execute_dlfiles=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    $ECHO "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      $ECHO "enable shared libraries"
+    else
+      $ECHO "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      $ECHO "enable static libraries"
+    else
+      $ECHO "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	taglist="$taglist $tagname"
+
+	# Evaluate the configuration.  Be careful to quote the path
+	# and the sed script, to avoid splitting on whitespace, but
+	# also don't use non-portable quotes within backquotes within
+	# quotes we have to do it in 2 steps:
+	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	eval "$extractedcf"
+      else
+	func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# Parse options once, thoroughly.  This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
+
+  # Shorthand for --mode=foo, only valid as the first argument
+  case $1 in
+  clean|clea|cle|cl)
+    shift; set dummy --mode clean ${1+"$@"}; shift
+    ;;
+  compile|compil|compi|comp|com|co|c)
+    shift; set dummy --mode compile ${1+"$@"}; shift
+    ;;
+  execute|execut|execu|exec|exe|ex|e)
+    shift; set dummy --mode execute ${1+"$@"}; shift
+    ;;
+  finish|finis|fini|fin|fi|f)
+    shift; set dummy --mode finish ${1+"$@"}; shift
+    ;;
+  install|instal|insta|inst|ins|in|i)
+    shift; set dummy --mode install ${1+"$@"}; shift
+    ;;
+  link|lin|li|l)
+    shift; set dummy --mode link ${1+"$@"}; shift
+    ;;
+  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+    shift; set dummy --mode uninstall ${1+"$@"}; shift
+    ;;
+  esac
+
+  # Parse non-mode specific arguments:
+  while test "$#" -gt 0; do
+    opt="$1"
+    shift
+
+    case $opt in
+      --config)		func_config					;;
+
+      --debug)		preserve_args="$preserve_args $opt"
+			func_echo "enabling shell trace mode"
+			opt_debug='set -x'
+			$opt_debug
+			;;
+
+      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			execute_dlfiles="$execute_dlfiles $1"
+			shift
+			;;
+
+      --dry-run | -n)	opt_dry_run=:					;;
+      --features)       func_features					;;
+      --finish)		mode="finish"					;;
+
+      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			case $1 in
+			  # Valid mode arguments:
+			  clean)	;;
+			  compile)	;;
+			  execute)	;;
+			  finish)	;;
+			  install)	;;
+			  link)		;;
+			  relink)	;;
+			  uninstall)	;;
+
+			  # Catch anything else as an error
+			  *) func_error "invalid argument for $opt"
+			     exit_cmd=exit
+			     break
+			     ;;
+		        esac
+
+			mode="$1"
+			shift
+			;;
+
+      --preserve-dup-deps)
+			opt_duplicate_deps=:				;;
+
+      --quiet|--silent)	preserve_args="$preserve_args $opt"
+			opt_silent=:
+			;;
+
+      --verbose| -v)	preserve_args="$preserve_args $opt"
+			opt_silent=false
+			;;
+
+      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
+			preserve_args="$preserve_args $opt $1"
+			func_enable_tag "$1"	# tagname is set here
+			shift
+			;;
+
+      # Separate optargs to long options:
+      -dlopen=*|--mode=*|--tag=*)
+			func_opt_split "$opt"
+			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+			shift
+			;;
+
+      -\?|-h)		func_usage					;;
+      --help)		opt_help=:					;;
+      --version)	func_version					;;
+
+      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
+
+      *)		nonopt="$opt"
+			break
+			;;
+    esac
+  done
+
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+      ;;
+  esac
+
+  # Having warned about all mis-specified options, bail out if
+  # anything was wrong.
+  $exit_cmd $EXIT_FAILURE
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+$opt_help || {
+  # Sanity checks first:
+  func_check_version_match
+
+  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+    func_fatal_configuration "not configured to build any kind of library"
+  fi
+
+  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+  # Darwin sucks
+  eval std_shrext=\"$shrext_cmds\"
+
+
+  # Only execute mode is allowed to have -dlopen flags.
+  if test -n "$execute_dlfiles" && test "$mode" != execute; then
+    func_error "unrecognized option \`-dlopen'"
+    $ECHO "$help" 1>&2
+    exit $EXIT_FAILURE
+  fi
+
+  # Change the help message to a mode-specific one.
+  generic_help="$help"
+  help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+	for lalib_p_l in 1 2 3 4
+	do
+	    read lalib_p_line
+	    case "$lalib_p_line" in
+		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+	    esac
+	done
+	exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_ltwrapper_scriptname_result=""
+    if func_ltwrapper_executable_p "$1"; then
+	func_dirname_and_basename "$1" "" "."
+	func_stripname '' '.exe' "$func_basename_result"
+	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+    fi
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)	. "$1" ;;
+    *)		. "./$1" ;;
+    esac
+}
+
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+        func_quote_for_eval "$arg"
+	CC_quoted="$CC_quoted $func_quote_for_eval_result"
+      done
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	      # Double-quote args containing other shell metacharacters.
+	      func_quote_for_eval "$arg"
+	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
+	    done
+	    case "$@ " in
+	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  func_echo "unable to infer tagged configuration"
+	  func_fatal_error "specify a tag with \`--tag'"
+#	else
+#	  func_verbose "using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  test -n "$libobj" && \
+	    func_fatal_error "you cannot specify \`-o' more than once"
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-pie | -fpie | -fPIE)
+          pie_flag="$pie_flag $arg"
+	  continue
+	  ;;
+
+	-shared | -static | -prefer-pic | -prefer-non-pic)
+	  later="$later $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  func_stripname '-Wc,' '' "$arg"
+	  args=$func_stripname_result
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+	  for arg in $args; do
+	    IFS="$save_ifs"
+	    func_quote_for_eval "$arg"
+	    lastarg="$lastarg $func_quote_for_eval_result"
+	  done
+	  IFS="$save_ifs"
+	  func_stripname ' ' '' "$lastarg"
+	  lastarg=$func_stripname_result
+
+	  # Add the arguments to base_compile.
+	  base_compile="$base_compile $lastarg"
+	  continue
+	  ;;
+
+	*)
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_quote_for_eval "$lastarg"
+      base_compile="$base_compile $func_quote_for_eval_result"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+	func_basename "$srcfile"
+	libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	continue
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+      removelist="$removelist $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    removelist="$removelist $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    if test -n "$fix_srcfile_path"; then
+      eval srcfile=\"$fix_srcfile_path\"
+    fi
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	command="$command -o $lobj"
+      fi
+
+      func_show_eval_locale "$command"	\
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	func_show_eval '$MV "$output_obj" "$lobj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+	suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile$pie_flag"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	command="$command -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      command="$command$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	func_show_eval '$MV "$output_obj" "$obj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+	removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+test "$mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to building PIC objects only
+  -prefer-non-pic   try to building non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$mode'"
+        ;;
+    esac
+
+    $ECHO
+    $ECHO "Try \`$progname --help' for more information about other modes."
+
+    exit $?
+}
+
+  # Now that we've collected a possible --mode arg, show help if necessary
+  $opt_help && func_mode_help
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $execute_dlfiles; do
+      test -f "$file" \
+	|| func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+	func_source "$file"
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && \
+	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  dir="$dir/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+	;;
+
+      *)
+	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -*) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if func_ltwrapper_script_p "$file"; then
+	  func_source "$file"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	elif func_ltwrapper_executable_p "$file"; then
+	  func_ltwrapper_scriptname "$file"
+	  func_source "$func_ltwrapper_scriptname_result"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_quote_for_eval "$file"
+      args="$args $func_quote_for_eval_result"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+	      else
+		$lt_unset $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	$ECHO "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libdirs="$nonopt"
+    admincmds=
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for dir
+      do
+	libdirs="$libdirs $dir"
+      done
+
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    $ECHO "Libraries have been installed in:"
+    for libdir in $libdirs; do
+      $ECHO "   $libdir"
+    done
+    $ECHO
+    $ECHO "If you ever happen to want to link against installed libraries"
+    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
+    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
+    $ECHO "flag during linking and do at least one of the following:"
+    if test -n "$shlibpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+      $ECHO "     during execution"
+    fi
+    if test -n "$runpath_var"; then
+      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
+      $ECHO "     during linking"
+    fi
+    if test -n "$hardcode_libdir_flag_spec"; then
+      libdir=LIBDIR
+      eval flag=\"$hardcode_libdir_flag_spec\"
+
+      $ECHO "   - use the \`$flag' linker flag"
+    fi
+    if test -n "$admincmds"; then
+      $ECHO "   - have your system administrator run these commands:$admincmds"
+    fi
+    if test -f /etc/ld.so.conf; then
+      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+    fi
+    $ECHO
+
+    $ECHO "See any operating system documentation about shared libraries for"
+    case $host in
+      solaris2.[6789]|solaris2.1[0-9])
+        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	$ECHO "pages."
+	;;
+      *)
+        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+        ;;
+    esac
+    $ECHO "X----------------------------------------------------------------------" | $Xsed
+    exit $EXIT_SUCCESS
+}
+
+test "$mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    install_prog="$install_prog$func_quote_for_eval_result"
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    for arg
+    do
+      if test -n "$dest"; then
+	files="$files $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+	case " $install_prog " in
+	*[\\\ /]cp\ *) ;;
+	*) prev=$arg ;;
+	esac
+	;;
+      -g | -m | -o)
+	prev=$arg
+	;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      install_prog="$install_prog $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	func_fatal_help "no file or destination specified"
+      else
+	func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+	func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	staticlibs="$staticlibs $file"
+	;;
+
+      *.la)
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$file' is not a valid libtool archive"
+
+	library_names=
+	old_library=
+	relink_command=
+	func_source "$file"
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) current_libdirs="$current_libdirs $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) future_libdirs="$future_libdirs $libdir" ;;
+	  esac
+	fi
+
+	func_dirname "$file" "/" ""
+	dir="$func_dirname_result"
+	dir="$dir$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  test "$inst_prefix_dir" = "$destdir" && \
+	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  func_warning "relinking \`$file'"
+	  func_show_eval "$relink_command" \
+	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names; shift
+	if test -n "$1"; then
+	  realname="$1"
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+	      'exit $?'
+	  tstripme="$stripme"
+	  case $host_os in
+	  cygwin* | mingw* | pw32* | cegcc*)
+	    case $realname in
+	    *.dll.a)
+	      tstripme=""
+	      ;;
+	    esac
+	    ;;
+	  esac
+	  if test -n "$tstripme" && test -n "$striplib"; then
+	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      test "$linkname" != "$realname" \
+		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  func_execute_cmds "$postinstall_cmds" 'exit $?'
+	fi
+
+	# Install the pseudo-library for information purposes.
+	func_basename "$file"
+	name="$func_basename_result"
+	instname="$dir/$name"i
+	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  func_lo2o "$destfile"
+	  staticdest=$func_lo2o_result
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	test -n "$destfile" && \
+	  func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  func_lo2o "$file"
+	  staticobj=$func_lo2o_result
+	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      func_stripname '' '.exe' "$file"
+	      file=$func_stripname_result
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin* | *mingw*)
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      wrapper=$func_ltwrapper_scriptname_result
+	    else
+	      func_stripname '' '.exe' "$file"
+	      wrapper=$func_stripname_result
+	    fi
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if func_ltwrapper_script_p "$wrapper"; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  func_source "$wrapper"
+
+	  # Check the variables that should have been set.
+	  test -z "$generated_by_libtool_version" && \
+	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      func_source "$lib"
+	    fi
+	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      func_warning "\`$lib' has not been installed in \`$libdir'"
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  func_source "$wrapper"
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    $opt_dry_run || {
+	      if test "$finalize" = yes; then
+	        tmpdir=`func_mktempdir`
+		func_basename "$file$stripped_ext"
+		file="$func_basename_result"
+	        outputname="$tmpdir/$file"
+	        # Replace the output file specification.
+	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+	        $opt_silent || {
+	          func_quote_for_expand "$relink_command"
+		  eval "func_echo $func_quote_for_expand_result"
+	        }
+	        if eval "$relink_command"; then :
+	          else
+		  func_error "error: relink \`$file' with the above command before installing it"
+		  $opt_dry_run || ${RM}r "$tmpdir"
+		  continue
+	        fi
+	        file="$outputname"
+	      else
+	        func_warning "cannot relink \`$file'"
+	      fi
+	    }
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    func_stripname '' '.exe' "$destfile"
+	    destfile=$func_stripname_result
+	    ;;
+	  esac
+	  ;;
+	esac
+	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+	$opt_dry_run || if test -n "$outputname"; then
+	  ${RM}r "$tmpdir"
+	fi
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	func_show_eval "$old_striplib $oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	my_dlsyms="${my_outputname}S.c"
+      else
+	func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+	# Discover the nlist of each of the dlfiles.
+	nlist="$output_objdir/${my_outputname}.nm"
+
+	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+	# Parse the name list into a source file.
+	func_verbose "creating $output_objdir/$my_dlsyms"
+
+	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+	if test "$dlself" = yes; then
+	  func_verbose "generating symbol list for \`$output'"
+
+	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+	  # Add our own program objects to the symbol list.
+	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	  for progfile in $progfiles; do
+	    func_verbose "extracting global C symbols from \`$progfile'"
+	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -n "$exclude_expsyms"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  if test -n "$export_symbols_regex"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  # Prepare the list of exported symbols
+	  if test -z "$export_symbols"; then
+	    export_symbols="$output_objdir/$outputname.exp"
+	    $opt_dry_run || {
+	      $RM $export_symbols
+	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	      case $host in
+	      *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+	        ;;
+	      esac
+	    }
+	  else
+	    $opt_dry_run || {
+	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	      case $host in
+	        *cygwin | *mingw* | *cegcc* )
+	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+	          ;;
+	      esac
+	    }
+	  fi
+	fi
+
+	for dlprefile in $dlprefiles; do
+	  func_verbose "extracting global C symbols from \`$dlprefile'"
+	  func_basename "$dlprefile"
+	  name="$func_basename_result"
+	  $opt_dry_run || {
+	    eval '$ECHO ": $name " >> "$nlist"'
+	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	  }
+	done
+
+	$opt_dry_run || {
+	  # Make sure we have at least an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  if test -n "$exclude_expsyms"; then
+	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	    $MV "$nlist"T "$nlist"
+	  fi
+
+	  # Try sorting and uniquifying the output.
+	  if $GREP -v "^: " < "$nlist" |
+	      if sort -k 3 </dev/null >/dev/null 2>&1; then
+		sort -k 3
+	      else
+		sort +2
+	      fi |
+	      uniq > "$nlist"S; then
+	    :
+	  else
+	    $GREP -v "^: " < "$nlist" > "$nlist"S
+	  fi
+
+	  if test -f "$nlist"S; then
+	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+	  else
+	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	  fi
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+"
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc* )
+	    $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+   runtime relocations are performed -- see ld's documentation
+   on pseudo-relocs.  */"
+	    lt_dlsym_const= ;;
+	  *osf5*)
+	    echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+	    lt_dlsym_const= ;;
+	  *)
+	    lt_dlsym_const=const ;;
+	  esac
+
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+$lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+	  case $need_lib_prefix in
+	  no)
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  *)
+	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  esac
+	  $ECHO >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	} # !$opt_dry_run
+
+	pic_flag_for_symtable=
+	case "$compile_command " in
+	*" -static "*) ;;
+	*)
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+	  *-*-hpux*)
+	    pic_flag_for_symtable=" $pic_flag"  ;;
+	  *)
+	    if test "X$my_pic_p" != Xno; then
+	      pic_flag_for_symtable=" $pic_flag"
+	    fi
+	    ;;
+	  esac
+	  ;;
+	esac
+	symtab_cflags=
+	for arg in $LTCFLAGS; do
+	  case $arg in
+	  -pie | -fpie | -fPIE) ;;
+	  *) symtab_cflags="$symtab_cflags $arg" ;;
+	  esac
+	done
+
+	# Now compile the dynamic symbol file.
+	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+	# Clean up the generated files.
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+	# Transform the symbol file into the correct name.
+	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	case $host in
+	*cygwin* | *mingw* | *cegcc* )
+	  if test -f "$output_objdir/$my_outputname.def"; then
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	  else
+	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  fi
+	  ;;
+	*)
+	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+	  ;;
+	esac
+	;;
+      *)
+	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+      win32_nmres=`eval $NM -f posix -A $1 |
+	$SED -n -e '
+	    1,100{
+		/ I /{
+		    s,.*,import,
+		    p
+		    q
+		}
+	    }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  func_arith $extracted_serial + 1
+	  extracted_serial=$func_arith_result
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+	func_verbose "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	$opt_dry_run || {
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename "$darwin_archive"`
+	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+	  if test -n "$darwin_arches"; then
+	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+	      $LIPO -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    $RM -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	} # !$opt_dry_run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+
+# func_emit_wrapper_part1 [arg=no]
+#
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
+{
+	func_emit_wrapper_part1_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_part1_arg1=$1
+	fi
+
+	$ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    ECHO=\"$qecho\"
+    file=\"\$0\"
+    # Make sure echo works.
+    if test \"X\$1\" = X--no-reexec; then
+      # Discard the --no-reexec flag, and continue.
+      shift
+    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
+      # Yippee, \$ECHO works!
+      :
+    else
+      # Restart under the correct shell, and then maybe \$ECHO will work.
+      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+    fi
+  fi\
+"
+	$ECHO "\
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+  done
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+	func_emit_wrapper_part2_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_part2_arg1=$1
+	fi
+
+	$ECHO "\
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+	  $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$ECHO \"\$relink_command_output\" >&2
+	$RM \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+	else
+	  $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	# fixup the dll searchpath if we need to.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	$ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+"
+	case $host in
+	# Backslashes separate directories on plain windows
+	*-*-mingw | *-*-os2* | *-cegcc*)
+	  $ECHO "\
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+	  ;;
+
+	*)
+	  $ECHO "\
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+	  ;;
+	esac
+	$ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=no
+	if test -n "$1" ; then
+	  func_emit_wrapper_arg1=$1
+	fi
+
+	# split this up so that func_emit_cwrapperexe_src
+	# can call each part independently.
+	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin.  Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+  func_to_host_path_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        case $build in
+          *mingw* ) # actually, msys
+            # awkward: cmd appends spaces to result
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_path_tmp1=`cygpath -w "$1"`
+            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # Unfortunately, winepath does not exit with a non-zero
+            # error code, so we are forced to check the contents of
+            # stdout. On the other hand, if the command is not
+            # found, the shell will set an exit code of 127 and print
+            # *an error message* to stdout. So we must check for both
+            # error code of zero AND non-empty stdout, which explains
+            # the odd construction:
+            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+                $SED -e "$lt_sed_naive_backslashify"`
+            else
+              # Allow warning below.
+              func_to_host_path_result=""
+            fi
+            ;;
+        esac
+        if test -z "$func_to_host_path_result" ; then
+          func_error "Could not determine host path corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback:
+          func_to_host_path_result="$1"
+        fi
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+#    $build          $host
+#    mingw (msys)    mingw  [e.g. native]
+#    cygwin          mingw
+#    *nix + wine     mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+  func_to_host_pathlist_result="$1"
+  if test -n "$1" ; then
+    case $host in
+      *mingw* )
+        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+        # Remove leading and trailing path separator characters from
+        # ARG. msys behavior is inconsistent here, cygpath turns them
+        # into '.;' and ';.', and winepath ignores them completely.
+        func_to_host_pathlist_tmp2="$1"
+        # Once set for this call, this variable should not be
+        # reassigned. It is used in tha fallback case.
+        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+          $SED -e 's|^:*||' -e 's|:*$||'`
+        case $build in
+          *mingw* ) # Actually, msys.
+            # Awkward: cmd appends spaces to result.
+            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          *cygwin* )
+            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+              $SED -e "$lt_sed_naive_backslashify"`
+            ;;
+          * )
+            # unfortunately, winepath doesn't convert pathlists
+            func_to_host_pathlist_result=""
+            func_to_host_pathlist_oldIFS=$IFS
+            IFS=:
+            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+              IFS=$func_to_host_pathlist_oldIFS
+              if test -n "$func_to_host_pathlist_f" ; then
+                func_to_host_path "$func_to_host_pathlist_f"
+                if test -n "$func_to_host_path_result" ; then
+                  if test -z "$func_to_host_pathlist_result" ; then
+                    func_to_host_pathlist_result="$func_to_host_path_result"
+                  else
+                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+                  fi
+                fi
+              fi
+              IFS=:
+            done
+            IFS=$func_to_host_pathlist_oldIFS
+            ;;
+        esac
+        if test -z "$func_to_host_pathlist_result" ; then
+          func_error "Could not determine the host path(s) corresponding to"
+          func_error "  '$1'"
+          func_error "Continuing, but uninstalled executables may not work."
+          # Fallback. This may break if $1 contains DOS-style drive
+          # specifications. The fix is not to complicate the expression
+          # below, but for the user to provide a working wine installation
+          # with winepath so that path translation in the cross-to-mingw
+          # case works properly.
+          lt_replace_pathsep_nix_to_dos="s|:|;|g"
+          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+            $SED -e "$lt_replace_pathsep_nix_to_dos"`
+        fi
+        # Now, add the leading and trailing path separators back
+        case "$1" in
+          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+            ;;
+        esac
+        case "$1" in
+          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+            ;;
+        esac
+        ;;
+    esac
+  fi
+}
+# end: func_to_host_pathlist
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+	cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+
+   Currently, it simply execs the wrapper *script* "$SHELL $output",
+   but could eventually absorb all of the scripts functionality and
+   exec $objdir/$outputname directly.
+*/
+EOF
+	    cat <<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+# define setmode _setmode
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+#  define HAVE_SETENV
+#  ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+#  endif
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+    va_list args;
+    va_start (args, fmt);
+    (void) vfprintf (stderr, fmt, args);
+    va_end (args);
+}
+#else
+# define LTWRAPPER_DEBUGPRINTF(args)
+#endif
+
+const char *program_name = NULL;
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+
+static const char *script_text_part1 =
+EOF
+
+	    func_emit_wrapper_part1 yes |
+	        $SED -e 's/\([\\"]\)/\\\1/g' \
+	             -e 's/^/  "/' -e 's/$/\\n"/'
+	    echo ";"
+	    cat <<EOF
+
+static const char *script_text_part2 =
+EOF
+	    func_emit_wrapper_part2 yes |
+	        $SED -e 's/\([\\"]\)/\\\1/g' \
+	             -e 's/^/  "/' -e 's/$/\\n"/'
+	    echo ";"
+
+	    cat <<EOF
+const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_pathlist "$temp_rpath"
+	      cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test -n "$dllsearchpath"; then
+              func_to_host_pathlist "$dllsearchpath:"
+	      cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test "$fast_install" = yes; then
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+	    else
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+	    fi
+
+
+	    cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
+
+static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
+  /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
+  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
+  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  intptr_t rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
+  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+
+  /* very simple arg parsing; don't want to rely on getopt */
+  for (i = 1; i < argc; i++)
+    {
+      if (strcmp (argv[i], dumpscript_opt) == 0)
+	{
+EOF
+	    case "$host" in
+	      *mingw* | *cygwin* )
+		# make stdout use "unix" line endings
+		echo "          setmode(1,_O_BINARY);"
+		;;
+	      esac
+
+	    cat <<"EOF"
+	  printf ("%s", script_text_part1);
+	  printf ("%s", script_text_part2);
+	  return 0;
+	}
+    }
+
+  newargz = XMALLOC (char *, argc + 1);
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal ("Couldn't find %s", argv[0]);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+			  tmp_pathspec));
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+			  actual_cwrapper_path));
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+			  target_name));
+EOF
+
+	    cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+	    cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+	    case $host_os in
+	      mingw*)
+	    cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+	*p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+	*p = '/';
+      }
+  }
+EOF
+	    ;;
+	    esac
+
+	    cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+        {
+          if (argv[i][env_set_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_set_opt_len + 1;
+              lt_opt_process_env_set (p);
+            }
+          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_set (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_set_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+        {
+          if (argv[i][env_prepend_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_prepend_opt_len + 1;
+              lt_opt_process_env_prepend (p);
+            }
+          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_prepend_opt);
+          continue;
+        }
+      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+        {
+          if (argv[i][env_append_opt_len] == '=')
+            {
+              const char *p = argv[i] + env_append_opt_len + 1;
+              lt_opt_process_env_append (p);
+            }
+          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+            {
+              lt_opt_process_env_append (argv[++i]); /* don't copy */
+            }
+          else
+            lt_fatal ("%s missing required argument", env_append_opt);
+          continue;
+        }
+      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal ("Unrecognized option in %s namespace: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+  for (i = 0; i < newargc; i++)
+    {
+      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+    }
+
+EOF
+
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+      return 127;
+    }
+  return rval;
+EOF
+		;;
+	      *)
+		cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+		;;
+	    esac
+
+	    cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal ("Memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+			  string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
+			  path ? (*path ? path : "EMPTY!") : "NULL!"));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
+			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+	return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+	{
+	  concat_name = xstrdup (wrapper);
+	  if (check_executable (concat_name))
+	    return concat_name;
+	  XFREE (concat_name);
+	}
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+	has_slash = 1;
+	break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+	{
+	  for (p = path; *p; p = p_next)
+	    {
+	      const char *q;
+	      size_t p_len;
+	      for (q = p; *q; q++)
+		if (IS_PATH_SEPARATOR (*q))
+		  break;
+	      p_len = q - p;
+	      p_next = (*q == '\0' ? q : q + 1);
+	      if (p_len == 0)
+		{
+		  /* empty path: current directory */
+		  if (getcwd (tmp, LT_PATHMAX) == NULL)
+		    lt_fatal ("getcwd failed");
+		  tmp_len = strlen (tmp);
+		  concat_name =
+		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, tmp, tmp_len);
+		  concat_name[tmp_len] = '/';
+		  strcpy (concat_name + tmp_len + 1, wrapper);
+		}
+	      else
+		{
+		  concat_name =
+		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, p, p_len);
+		  concat_name[p_len] = '/';
+		  strcpy (concat_name + p_len + 1, wrapper);
+		}
+	      if (check_executable (concat_name))
+		return concat_name;
+	      XFREE (concat_name);
+	    }
+	}
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal ("getcwd failed");
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+			      tmp_pathspec));
+      if (lstat (tmp_pathspec, &s) == 0)
+	{
+	  if (S_ISLNK (s.st_mode) != 0)
+	    {
+	      has_symlinks = 1;
+	      break;
+	    }
+
+	  /* search backwards for last DIR_SEPARATOR */
+	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    p--;
+	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    {
+	      /* no more DIR_SEPARATORS left */
+	      break;
+	    }
+	  *p = '\0';
+	}
+      else
+	{
+	  char *errstr = strerror (errno);
+	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+	}
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal ("Could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+	*str = '\0';
+    }
+  return str;
+}
+
+static void
+lt_error_core (int exit_status, const char *mode,
+	       const char *message, va_list ap)
+{
+  fprintf (stderr, "%s: %s: ", program_name, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+  va_end (ap);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+  const char *p;
+  int len;
+  if (!arg || !*arg)
+    return 1;
+
+  p = strchr (arg, (int)'=');
+
+  if (!p)
+    return 1;
+
+  *value = xstrdup (++p);
+
+  len = strlen (arg) - strlen (*value);
+  *name = XMALLOC (char, len);
+  strncpy (*name, arg, len-1);
+  (*name)[len - 1] = '\0';
+
+  return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+    }
+
+  lt_setenv (name, value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 0);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+  char *name = NULL;
+  char *value = NULL;
+  char *new_value = NULL;
+
+  if (lt_split_name_value (arg, &name, &value) != 0)
+    {
+      XFREE (name);
+      XFREE (value);
+      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+    }
+
+  new_value = lt_extend_str (getenv (name), value, 1);
+  lt_setenv (name, new_value);
+  XFREE (new_value);
+  XFREE (name);
+  XFREE (value);
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                          (name ? name : "<NULL>"),
+                          (value ? value : "<NULL>")));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	break
+	;;
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    func_warning "complete static linking is impossible in this configuration"
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  func_append compile_command " @OUTPUT@"
+	  func_append finalize_command " @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    func_append compile_command " @SYMFILE@"
+	    func_append finalize_command " @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      dlfiles="$dlfiles $arg"
+	    else
+	      dlprefiles="$dlprefiles $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  test -f "$arg" \
+	    || func_fatal_error "symbol file \`$arg' does not exist"
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+		*" $qarg.ltframework "*) ;;
+		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+		   ;;
+	      esac
+	      ;;
+	  esac
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat "$save_arg"`
+	    do
+#	      moreargs="$moreargs $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if func_lalib_unsafe_p "$arg"; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		func_source "$arg"
+
+		if test -z "$pic_object" ||
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none &&
+		   test "$non_pic_object" = none; then
+		  func_fatal_error "cannot find name of object for \`$arg'"
+		fi
+
+		# Extract subdirectory from the argument.
+		func_dirname "$arg" "/" ""
+		xdir="$func_dirname_result"
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      dlfiles="$dlfiles $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    dlprefiles="$dlprefiles $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  func_append libobjs " $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  func_append non_pic_objects " $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if $opt_dry_run; then
+		  # Extract subdirectory from the argument.
+		  func_dirname "$arg" "/" ""
+		  xdir="$func_dirname_result"
+
+		  func_lo2o "$arg"
+		  pic_object=$xdir$objdir/$func_lo2o_result
+		  non_pic_object=$xdir$func_lo2o_result
+		  func_append libobjs " $pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+	        else
+		  func_fatal_error "\`$arg' is not a valid libtool object"
+		fi
+	      fi
+	    done
+	  else
+	    func_fatal_error "link input file \`$arg' does not exist"
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    func_fatal_error "only absolute run-paths are allowed"
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) rpath="$rpath $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) xrpath="$xrpath $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	shrext)
+	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	weak)
+	  weak_libs="$weak_libs $arg"
+	  prev=
+	  continue
+	  ;;
+	xcclinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xcompiler)
+	  compiler_flags="$compiler_flags $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  linker_flags="$linker_flags $qarg"
+	  compiler_flags="$compiler_flags $wl$qarg"
+	  prev=
+	  func_append compile_command " $wl$qarg"
+	  func_append finalize_command " $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  # See comment for -static flag below, for more details.
+	  func_append compile_command " $link_static_flag"
+	  func_append finalize_command " $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  func_fatal_error "more than one -exported-symbols argument is not allowed"
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework)
+	prev=framework
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  func_append compile_command " $arg"
+	  func_append finalize_command " $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	func_stripname '-L' '' "$arg"
+	dir=$func_stripname_result
+	if test -z "$dir"; then
+	  if test "$#" -gt 0; then
+	    func_fatal_error "require no space between \`-L' and \`$1'"
+	  else
+	    func_fatal_error "need path for \`-L' option"
+	  fi
+	fi
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  test -z "$absdir" && \
+	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "*) ;;
+	*)
+	  deplibs="$deplibs -L$dir"
+	  lib_search_path="$lib_search_path $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  ::) dllsearchpath=$dir;;
+	  *) dllsearchpath="$dllsearchpath:$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    deplibs="$deplibs System.ltframework"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	deplibs="$deplibs $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot)
+	compiler_flags="$compiler_flags $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	prev=xcompiler
+	continue
+	;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	compiler_flags="$compiler_flags $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	case "$new_inherited_linker_flags " in
+	    *" $arg "*) ;;
+	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+	esac
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  func_warning "\`-no-install' is ignored for $host"
+	  func_warning "assuming \`-no-fast-install' instead"
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	func_stripname '-R' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  func_fatal_error "only absolute run-paths are allowed"
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) xrpath="$xrpath $dir" ;;
+	esac
+	continue
+	;;
+
+      -shared)
+	# The effects of -shared are defined in a previous loop.
+	continue
+	;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -weak)
+        prev=weak
+	continue
+	;;
+
+      -Wc,*)
+	func_stripname '-Wc,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Wl,*)
+	func_stripname '-Wl,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  arg="$arg $wl$func_quote_for_eval_result"
+	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+	  linker_flags="$linker_flags $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # -msg_* for osf cc
+      -msg_*)
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+      # -r[0-9][0-9]* specifies the processor on the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+      # +DA*, +DD* enable 64-bit mode on the HP compiler
+      # -q* pass through compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* pass through architecture-specific
+      # compiler args for GCC
+      # -F/path gives path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+      # @file GCC response files
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        compiler_flags="$compiler_flags $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      *.$objext)
+	# A standard object.
+	objs="$objs $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if func_lalib_unsafe_p "$arg"; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  func_source "$arg"
+
+	  if test -z "$pic_object" ||
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none &&
+	     test "$non_pic_object" = none; then
+	    func_fatal_error "cannot find name of object for \`$arg'"
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  func_dirname "$arg" "/" ""
+	  xdir="$func_dirname_result"
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		dlfiles="$dlfiles $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      dlprefiles="$dlprefiles $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    func_append libobjs " $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    func_append non_pic_objects " $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if $opt_dry_run; then
+	    # Extract subdirectory from the argument.
+	    func_dirname "$arg" "/" ""
+	    xdir="$func_dirname_result"
+
+	    func_lo2o "$arg"
+	    pic_object=$xdir$objdir/$func_lo2o_result
+	    non_pic_object=$xdir$func_lo2o_result
+	    func_append libobjs " $pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  else
+	    func_fatal_error "\`$arg' is not a valid libtool object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	deplibs="$deplibs $arg"
+	old_deplibs="$old_deplibs $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  dlfiles="$dlfiles $arg"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  dlprefiles="$dlprefiles $arg"
+	  prev=
+	else
+	  deplibs="$deplibs $arg"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_duplicate_deps ; then
+	case "$libs " in
+	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	esac
+      fi
+      libs="$libs $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
+	  esac
+	  pre_post_deps="$pre_post_deps $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+	passes="conv dlpreopen link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+	## FIXME: Find the place where the list is rebuilt in the wrong
+	##        order, and fix it there properly
+        tmp_deplibs=
+	for deplib in $deplibs; do
+	  tmp_deplibs="$deplib $tmp_deplibs"
+	done
+	deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link)
+	  libs="$deplibs %DEPLIBS%"
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+	  ;;
+	esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+	# Collect and forward deplibs of preopened libtool libs
+	for lib in $dlprefiles; do
+	  # Ignore non-libtool-libs
+	  dependency_libs=
+	  case $lib in
+	  *.la)	func_source "$lib" ;;
+	  esac
+
+	  # Collect preopened libtool deplibs, except any this library
+	  # has declared as weak libs
+	  for deplib in $dependency_libs; do
+            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+	    case " $weak_libs " in
+	    *" $deplib_base "*) ;;
+	    *) deplibs="$deplibs $deplib" ;;
+	    esac
+	  done
+	done
+	libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    compiler_flags="$compiler_flags $deplib"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    func_warning "\`-l' is ignored for archives/objects"
+	    continue
+	  fi
+	  func_stripname '-l' '' "$deplib"
+	  name=$func_stripname_result
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if func_lalib_p "$lib"; then
+		  library_names=
+		  old_library=
+		  func_source "$lib"
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    func_dirname "$lib" "" "."
+		    ladir="$func_dirname_result"
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+		;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.ltframework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    func_stripname '-L' '' "$deplib"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    func_stripname '-L' '' "$deplib"
+	    newlib_search_path="$newlib_search_path $func_stripname_result"
+	    ;;
+	  *)
+	    func_warning "\`-L' is ignored for archives/objects"
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    func_stripname '-R' '' "$deplib"
+	    dir=$func_stripname_result
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) xrpath="$xrpath $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la) lib="$deplib" ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    # Linking convenience modules into shared libraries is allowed,
+	    # but linking other static libraries is non-portable.
+	    case " $dlpreconveniencelibs " in
+	    *" $deplib "*) ;;
+	    *)
+	      valid_a_lib=no
+	      case $deplibs_check_method in
+		match_pattern*)
+		  set dummy $deplibs_check_method; shift
+		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		    valid_a_lib=yes
+		  fi
+		;;
+		pass_all)
+		  valid_a_lib=yes
+		;;
+	      esac
+	      if test "$valid_a_lib" != yes; then
+		$ECHO
+		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
+		$ECHO "*** that it is just a static archive that I should not use here."
+	      else
+		$ECHO
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      fi
+	      ;;
+	    esac
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      newdlprefiles="$newdlprefiles $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      newdlfiles="$newdlfiles $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+	fi
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$lib" \
+	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+	func_dirname "$lib" "" "."
+	ladir="$func_dirname_result"
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	inherited_linker_flags=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	func_source "$lib"
+
+	# Convert "-framework foo" to "foo.ltframework"
+	if test -n "$inherited_linker_flags"; then
+	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+	    case " $new_inherited_linker_flags " in
+	      *" $tmp_inherited_linker_flag "*) ;;
+	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+	    esac
+	  done
+	fi
+	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      func_fatal_error "cannot find name of link library for \`$lib'"
+	    fi
+	    # It is a libtool convenience library, so add in its objects.
+	    convenience="$convenience $ladir/$objdir/$old_library"
+	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
+	    tmp_libs=
+	    for deplib in $dependency_libs; do
+	      deplibs="$deplib $deplibs"
+	      if $opt_duplicate_deps ; then
+		case "$tmp_libs " in
+		*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+		esac
+	      fi
+	      tmp_libs="$tmp_libs $deplib"
+	    done
+	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
+	    func_fatal_error "\`$lib' is not a convenience library"
+	  fi
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	for l in $old_library $library_names; do
+	  linklib="$l"
+	done
+	if test -z "$linklib"; then
+	  func_fatal_error "cannot find name of link library for \`$lib'"
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    dlprefiles="$dlprefiles $lib $dependency_libs"
+	  else
+	    newdlfiles="$newdlfiles $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "passing it literally to the linker, although it might fail"
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	func_basename "$lib"
+	laname="$func_basename_result"
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    func_warning "library \`$lib' was moved."
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$libdir"
+	    absdir="$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    notinst_path="$notinst_path $abs_ladir"
+	  fi
+	fi # $installed = yes
+	func_stripname 'lib' '.la' "$laname"
+	name=$func_stripname_result
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir" && test "$linkmode" = prog; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	  fi
+	  # Prefer using a static library (so that no silly _DYNAMIC symbols
+	  # are required to link).
+	  if test -n "$old_library"; then
+	    newdlprefiles="$newdlprefiles $dir/$old_library"
+	    # Keep a list of preopened convenience libraries to check
+	    # that they are being used correctly in the link pass.
+	    test -z "$libdir" && \
+		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
+	  # Otherwise, use the dlname, so that lt_dlopen finds it.
+	  elif test -n "$dlname"; then
+	    newdlprefiles="$newdlprefiles $dir/$dlname"
+	  else
+	    newdlprefiles="$newdlprefiles $dir/$linklib"
+	  fi
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  newlib_search_path="$newlib_search_path $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) func_stripname '-L' '' "$deplib"
+	         newlib_search_path="$newlib_search_path $func_stripname_result"
+		 ;;
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath:" in
+	      *"$absdir:"*) ;;
+	      *) temp_rpath="$temp_rpath$absdir:" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc*)
+	      # No point in relinking DLLs because paths are not encoded
+	      notinst_deplibs="$notinst_deplibs $lib"
+	      need_relink=no
+	    ;;
+	  *)
+	    if test "$installed" = no; then
+	      notinst_deplibs="$notinst_deplibs $lib"
+	      need_relink=yes
+	    fi
+	    ;;
+	  esac
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on some
+	  # systems (darwin).  Don't bleat about dlopened modules though!
+	  dlopenmodule=""
+	  for dlpremoduletest in $dlprefiles; do
+	    if test "X$dlpremoduletest" = "X$lib"; then
+	      dlopenmodule="$dlpremoduletest"
+	      break
+	    fi
+	  done
+	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	    $ECHO
+	    if test "$linkmode" = prog; then
+	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $ECHO "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) compile_rpath="$compile_rpath $absdir"
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) finalize_rpath="$finalize_rpath $libdir"
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    shift
+	    realname="$1"
+	    shift
+	    libname=`eval "\\$ECHO \"$libname_spec\""`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw* | *cegcc*)
+	        func_arith $current - $age
+		major=$func_arith_result
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    func_basename "$soroot"
+	    soname="$func_basename_result"
+	    func_stripname 'lib' '.dll' "$soname"
+	    newlib=libimp-$func_stripname_result.a
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      func_verbose "extracting exported symbol list from \`$soname'"
+	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      func_verbose "generating import library for \`$soname'"
+	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a (non-dlopened) module then we can not
+		    # link against it, someone is ignoring the earlier warnings
+		    if /usr/bin/file -L $add 2> /dev/null |
+			 $GREP ": [^:]* bundle" >/dev/null ; then
+		      if test "X$dlopenmodule" != "X$lib"; then
+			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
+			if test -z "$old_library" ; then
+			  $ECHO
+			  $ECHO "*** And there doesn't seem to be a static archive available"
+			  $ECHO "*** The link will probably fail, sorry"
+			else
+			  add="$dir/$old_library"
+			fi
+		      elif test -n "$old_library"; then
+			add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes &&
+	         test "$hardcode_direct_absolute" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      func_fatal_configuration "unsupported hardcode properties"
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes &&
+		 test "$hardcode_minus_L" != yes &&
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes &&
+	       test "$hardcode_direct_absolute" = no; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+		add="$inst_prefix_dir$libdir/$linklib"
+	      else
+		add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    $ECHO
+	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    $ECHO "*** I have the capability to make that library automatically link in when"
+	    $ECHO "*** you link to this library.  But I can only do this if you have a"
+	    $ECHO "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      $ECHO "*** But as you try to build a module library, libtool will still create "
+	      $ECHO "*** a static module, that should work as long as the dlopening application"
+	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		$ECHO
+		$ECHO "*** However, this would only work if libtool was able to extract symbol"
+		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		$ECHO "*** not find such a program.  So, this module is probably useless."
+		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) func_stripname '-R' '' "$libdir"
+	           temp_xrpath=$func_stripname_result
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) xrpath="$xrpath $temp_xrpath";;
+		   esac;;
+	      *) temp_deplibs="$temp_deplibs $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  newlib_search_path="$newlib_search_path $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    if $opt_duplicate_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+	      esac
+	    fi
+	    tmp_libs="$tmp_libs $deplib"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      path=
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+	        func_dirname "$deplib" "" "."
+		dir="$func_dirname_result"
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    func_warning "cannot determine absolute directory name of \`$dir'"
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if $GREP "^installed=no" $deplib > /dev/null; then
+		case $host in
+		*-*-darwin*)
+		  depdepl=
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$absdir/$objdir/$depdepl" ; then
+		      depdepl="$absdir/$objdir/$depdepl"
+		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+		      path=
+		    fi
+		  fi
+		  ;;
+		*)
+		  path="-L$absdir/$objdir"
+		  ;;
+		esac
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  test -z "$libdir" && \
+		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  test "$absdir" != "$libdir" && \
+		    func_warning "\`$deplib' seems to be moved"
+
+		  path="-L$absdir"
+		fi
+		;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+	if test "$linkmode" = "prog"; then
+	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+	else
+	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) lib_search_path="$lib_search_path $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) tmp_libs="$tmp_libs $deplib" ;;
+	      esac
+	      ;;
+	    *) tmp_libs="$tmp_libs $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  tmp_libs="$tmp_libs $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+	func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      objs="$objs$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	func_stripname 'lib' '.la' "$outputname"
+	name=$func_stripname_result
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	test "$module" = no && \
+	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  func_stripname '' '.la' "$outputname"
+	  name=$func_stripname_result
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  func_stripname '' '.la' "$outputname"
+	  libname=$func_stripname_result
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	else
+	  $ECHO
+	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+	  $ECHO "*** objects $objs is not portable!"
+	  libobjs="$libobjs $objs"
+	fi
+      fi
+
+      test "$dlself" != no && \
+	func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+	func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	test -n "$vinfo" && \
+	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+	test -n "$release" && \
+	  func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	shift
+	IFS="$save_ifs"
+
+	test -n "$7" && \
+	  func_fatal_help "too many parameters to \`-version-info'"
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$1"
+	  number_minor="$2"
+	  number_revision="$3"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows|none)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  *)
+	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$1"
+	  revision="$2"
+	  age="$3"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "CURRENT \`$current' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "REVISION \`$revision' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "AGE \`$age' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  func_arith $current + 1
+	  minor_current=$func_arith_result
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    func_arith $current - $age
+	  else
+	    func_arith $current - $age + 1
+	  fi
+	  major=$func_arith_result
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    func_arith $revision - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    func_arith $current - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  verstring="$verstring:${current}.0"
+	  ;;
+
+	qnx)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  func_arith $current - $age
+	  major=$func_arith_result
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    func_warning "undefined symbols not allowed in $host shared libraries"
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      libobjs="$libobjs $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$ECHO "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext | *.gcno)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+		 then
+		   continue
+		 fi
+	       fi
+	       removelist="$removelist $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	test -n "$removelist" && \
+	  func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	oldlibs="$oldlibs $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  temp_xrpath="$temp_xrpath -R$libdir"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) dlfiles="$dlfiles $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) dlprefiles="$dlprefiles $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    deplibs="$deplibs System.ltframework"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      deplibs="$deplibs -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $opt_dry_run || $RM conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $opt_dry_run || $RM conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    newdeplibs="$newdeplibs $i"
+		    i=""
+		    ;;
+		  esac
+		fi
+		if test -n "$i" ; then
+		  libname=`eval "\\$ECHO \"$libname_spec\""`
+		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		  set dummy $deplib_matches; shift
+		  deplib_match=$1
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    newdeplibs="$newdeplibs $i"
+		  else
+		    droppeddeps=yes
+		    $ECHO
+		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		    $ECHO "*** I have the capability to make that library automatically link in when"
+		    $ECHO "*** you link to this library.  But I can only do this if you have a"
+		    $ECHO "*** shared version of the library, which I believe you do not have"
+		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
+		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+		;;
+	      *)
+		newdeplibs="$newdeplibs $i"
+		;;
+	      esac
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		$opt_dry_run || $RM conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      newdeplibs="$newdeplibs $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval "\\$ECHO \"$libname_spec\""`
+		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		    set dummy $deplib_matches; shift
+		    deplib_match=$1
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      newdeplibs="$newdeplibs $i"
+		    else
+		      droppeddeps=yes
+		      $ECHO
+		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		      $ECHO "*** I have the capability to make that library automatically link in when"
+		      $ECHO "*** you link to this library.  But I can only do this if you have a"
+		      $ECHO "*** shared version of the library, which you do not appear to have"
+		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
+		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  $ECHO
+		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+		  $ECHO "*** make it link in!  You will probably need to install it or some"
+		  $ECHO "*** library that it depends on before this library will be fully"
+		  $ECHO "*** functional.  Installing it before continuing would be even better."
+		fi
+		;;
+	      *)
+		newdeplibs="$newdeplibs $i"
+		;;
+	      esac
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method; shift
+	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null |
+			 $GREP " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+			 $SED -e 10q |
+			 $EGREP "$file_magic_regex" > /dev/null; then
+			newdeplibs="$newdeplibs $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$ECHO
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method; shift
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  newdeplibs="$newdeplibs $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+		       $EGREP "$match_pattern_regex" > /dev/null; then
+		      newdeplibs="$newdeplibs $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		$ECHO
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		$ECHO "*** I have the capability to make that library automatically link in when"
+		$ECHO "*** you link to this library.  But I can only do this if you have a"
+		$ECHO "*** shared version of the library, which you do not appear to have"
+		$ECHO "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      newdeplibs="$newdeplibs $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
+	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
+	    done
+	  fi
+	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
+	     $GREP . >/dev/null; then
+	    $ECHO
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    $ECHO "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	  fi
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library with the System framework
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    $ECHO
+	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+	    $ECHO "*** a static module, that should work as long as the dlopening"
+	    $ECHO "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      $ECHO
+	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
+	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      $ECHO "*** not find such a program.  So, this module is probably useless."
+	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
+	    $ECHO "*** automatically added whenever a program is linked with this library"
+	    $ECHO "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      $ECHO
+	      $ECHO "*** Since this library must not contain undefined symbols,"
+	      $ECHO "*** because either the platform does not support them or"
+	      $ECHO "*** it was explicitly requested with -no-undefined,"
+	      $ECHO "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+	*-*-darwin*)
+	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		dep_rpath="$dep_rpath $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) perm_rpath="$perm_rpath $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      rpath="$rpath$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	shift
+	realname="$1"
+	shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  linknames="$linknames $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	test "X$libobjs" = "X " && libobjs=
+
+	delfiles=
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+	  export_symbols="$output_objdir/$libname.uexp"
+	  delfiles="$delfiles $export_symbols"
+	fi
+
+	orig_export_symbols=
+	case $host_os in
+	cygwin* | mingw* | cegcc*)
+	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+	    # exporting using user supplied symfile
+	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	      # and it's NOT already a .def file. Must figure out
+	      # which of the given symbols are data symbols and tag
+	      # them as such. So, trigger use of export_symbols_cmds.
+	      # export_symbols gets reassigned inside the "prepare
+	      # the list of exported symbols" if statement, so the
+	      # include_expsyms logic still works.
+	      orig_export_symbols="$export_symbols"
+	      export_symbols=
+	      always_export_symbols=yes
+	    fi
+	  fi
+	  ;;
+	esac
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    func_verbose "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $opt_dry_run || $RM $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $cmds; do
+	      IFS="$save_ifs"
+	      eval cmd=\"$cmd\"
+	      func_len " $cmd"
+	      len=$func_len_result
+	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      else
+		# The command line is too long to execute in one step.
+		func_verbose "using reloadable object file for export list..."
+		skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  tmp_export_symbols="$export_symbols"
+	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	fi
+
+	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	  # The given exports_symbols file has to be filtered, so filter it.
+	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # though. Also, the filter scales superlinearly with the number of
+	  # global variables. join(1) would be nice here, but unfortunately
+	  # isn't a blessed tool.
+	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	  export_symbols=$output_objdir/$libname.def
+	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+	  case " $convenience " in
+	  *" $test_deplib "*) ;;
+	  *)
+	    tmp_deplibs="$tmp_deplibs $test_deplib"
+	    ;;
+	  esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec" &&
+	    test "$compiler_needs_object" = yes &&
+	    test -z "$libobjs"; then
+	    # extract the archives, so we have objects to list.
+	    # TODO: could optimize this to just extract one archive.
+	    whole_archive_flag_spec=
+	  fi
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    generated="$generated $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    libobjs="$libobjs $func_extract_archives_result"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  linker_flags="$linker_flags $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval test_cmds=\"$archive_expsym_cmds\"
+	    cmds=$archive_expsym_cmds
+	  else
+	    eval test_cmds=\"$archive_cmds\"
+	    cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   func_len " $test_cmds" &&
+	   len=$func_len_result &&
+	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise
+	  # or, if using GNU ld and skipped_export is not :, use a linker
+	  # script.
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  last_robj=
+	  k=1
+
+	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+	    output=${output_objdir}/${output_la}.lnkscript
+	    func_verbose "creating GNU ld script: $output"
+	    $ECHO 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      $ECHO "$obj" >> $output
+	    done
+	    $ECHO ')' >> $output
+	    delfiles="$delfiles $output"
+	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+	    output=${output_objdir}/${output_la}.lnk
+	    func_verbose "creating linker input file list: $output"
+	    : > $output
+	    set x $save_libobjs
+	    shift
+	    firstobj=
+	    if test "$compiler_needs_object" = yes; then
+	      firstobj="$1 "
+	      shift
+	    fi
+	    for obj
+	    do
+	      $ECHO "$obj" >> $output
+	    done
+	    delfiles="$delfiles $output"
+	    output=$firstobj\"$file_list_spec$output\"
+	  else
+	    if test -n "$save_libobjs"; then
+	      func_verbose "creating reloadable object files..."
+	      output=$output_objdir/$output_la-${k}.$objext
+	      eval test_cmds=\"$reload_cmds\"
+	      func_len " $test_cmds"
+	      len0=$func_len_result
+	      len=$len0
+
+	      # Loop over the list of objects to be linked.
+	      for obj in $save_libobjs
+	      do
+		func_len " $obj"
+		func_arith $len + $func_len_result
+		len=$func_arith_result
+		if test "X$objlist" = X ||
+		   test "$len" -lt "$max_cmd_len"; then
+		  func_append objlist " $obj"
+		else
+		  # The command $test_cmds is almost too long, add a
+		  # command to the queue.
+		  if test "$k" -eq 1 ; then
+		    # The first file doesn't have a previous command to add.
+		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+		  else
+		    # All subsequent reloadable object files will link in
+		    # the last one created.
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
+		  fi
+		  last_robj=$output_objdir/$output_la-${k}.$objext
+		  func_arith $k + 1
+		  k=$func_arith_result
+		  output=$output_objdir/$output_la-${k}.$objext
+		  objlist=$obj
+		  func_len " $last_robj"
+		  func_arith $len0 + $func_len_result
+		  len=$func_arith_result
+		fi
+	      done
+	      # Handle the remaining objects by creating one last
+	      # reloadable object file.  All subsequent reloadable object
+	      # files will link in the last one created.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+	      if test -n "$last_robj"; then
+	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+	      fi
+	      delfiles="$delfiles $output"
+
+	    else
+	      output=
+	    fi
+
+	    if ${skipped_export-false}; then
+	      func_verbose "generating symbol list for \`$libname.la'"
+	      export_symbols="$output_objdir/$libname.exp"
+	      $opt_dry_run || $RM $export_symbols
+	      libobjs=$output
+	      # Append the command to create the export file.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+	      if test -n "$last_robj"; then
+		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+	      fi
+	    fi
+
+	    test -n "$save_libobjs" &&
+	      func_verbose "creating a temporary reloadable object file: $output"
+
+	    # Loop through the commands generated above and execute them.
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $concat_cmds; do
+	      IFS="$save_ifs"
+	      $opt_silent || {
+		  func_quote_for_expand "$cmd"
+		  eval "func_echo $func_quote_for_expand_result"
+	      }
+	      $opt_dry_run || eval "$cmd" || {
+		lt_exit=$?
+
+		# Restore the uninstalled library and exit
+		if test "$mode" = relink; then
+		  ( cd "$output_objdir" && \
+		    $RM "${realname}T" && \
+		    $MV "${realname}U" "$realname" )
+		fi
+
+		exit $lt_exit
+	      }
+	    done
+	    IFS="$save_ifs"
+
+	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+
+          if ${skipped_export-false}; then
+	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	      tmp_export_symbols="$export_symbols"
+	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+	    fi
+
+	    if test -n "$orig_export_symbols"; then
+	      # The given exports_symbols file has to be filtered, so filter it.
+	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	      # 's' commands which not all seds can handle. GNU sed should be fine
+	      # though. Also, the filter scales superlinearly with the number of
+	      # global variables. join(1) would be nice here, but unfortunately
+	      # isn't a blessed tool.
+	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+	      export_symbols=$output_objdir/$libname.def
+	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	    fi
+	  fi
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	      cmds=$archive_expsym_cmds
+	    else
+	      cmds=$archive_cmds
+	    fi
+	  fi
+	fi
+
+	if test -n "$delfiles"; then
+	  # Append the command to remove temporary files to $cmds.
+	  eval cmds=\"\$cmds~\$RM $delfiles\"
+	fi
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  libobjs="$libobjs $func_extract_archives_result"
+	  test "X$libobjs" = "X " && libobjs=
+	fi
+
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $opt_silent || {
+	    func_quote_for_expand "$cmd"
+	    eval "func_echo $func_quote_for_expand_result"
+	  }
+	  $opt_dry_run || eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$mode" = relink; then
+	      ( cd "$output_objdir" && \
+	        $RM "${realname}T" && \
+		$MV "${realname}U" "$realname" )
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      func_show_eval '${RM}r "$gentop"'
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+	test -n "$objs$old_deplibs" && \
+	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+	libobj=$output
+	func_lo2o "$libobj"
+	obj=$func_lo2o_result
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+	func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) func_stripname '' '.exe' "$output"
+	          output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+	&& test "$dlopen_self" = unknown \
+	&& test "$dlopen_self_static" = unknown && \
+	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+	# Don't allow lazy linking, it breaks C++ global constructors
+	# But is supposedly fixed on 10.4 or later (yay!).
+	if test "$tagname" = CXX ; then
+	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	    10.[0123])
+	      compile_command="$compile_command ${wl}-bind_at_load"
+	      finalize_command="$finalize_command ${wl}-bind_at_load"
+	    ;;
+	  esac
+	fi
+	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
+	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+	;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    new_libs="$new_libs -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) new_libs="$new_libs $deplib" ;;
+	  esac
+	  ;;
+	*) new_libs="$new_libs $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      compile_command="$compile_command $compile_deplibs"
+      finalize_command="$finalize_command $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_rpath="$finalize_rpath $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) perm_rpath="$perm_rpath $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  ::) dllsearchpath=$libdir;;
+	  *) dllsearchpath="$dllsearchpath:$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) dllsearchpath="$dllsearchpath:$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    rpath="$rpath $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+	func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *cegcc)
+        # Disable wrappers for cegcc, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+	# Replace the output file specification.
+	compile_command=`$ECHO "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	exit_status=0
+	func_show_eval "$link_command" 'exit_status=$?'
+
+	# Delete the generated files.
+	if test -f "$output_objdir/${outputname}S.${objext}"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    rpath="$rpath$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$opt_dry_run || $RM $output
+	# Link the executable and exit
+	func_show_eval "$link_command" 'exit $?'
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	func_warning "this platform does not like uninstalled shared libraries"
+	func_warning "\`$output' will be relinked during installation"
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$ECHO "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    func_quote_for_eval "$var_value"
+	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Quote $ECHO for shipping.
+      if test "X$ECHO" = "X$SHELL $progpath --fallback-echo"; then
+	case $progpath in
+	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+	esac
+	qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
+      else
+	qecho=`$ECHO "X$ECHO" | $Xsed -e "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) func_stripname '' '.exe' "$output"
+	         output=$func_stripname_result ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    func_stripname '' '.exe' "$outputname"
+	    outputname=$func_stripname_result ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    func_dirname_and_basename "$output" "" "."
+	    output_name=$func_basename_result
+	    output_path=$func_dirname_result
+	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
+	    cwrapper="$output_path/$output_name.exe"
+	    $RM $cwrappersource $cwrapper
+	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_cwrapperexe_src > $cwrappersource
+
+	    # The wrapper executable is built using the $host compiler,
+	    # because it contains $host paths and files. If cross-
+	    # compiling, it, like the target executable, must be
+	    # executed on the $host or under an emulation environment.
+	    $opt_dry_run || {
+	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	      $STRIP $cwrapper
+	    }
+
+	    # Now, create the wrapper script for func_source use:
+	    func_ltwrapper_scriptname $cwrapper
+	    $RM $func_ltwrapper_scriptname_result
+	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+	    $opt_dry_run || {
+	      # note: this script will not be executed, so do not chmod.
+	      if test "x$build" = "x$host" ; then
+		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+	      else
+		func_emit_wrapper no > $func_ltwrapper_scriptname_result
+	      fi
+	    }
+	  ;;
+	  * )
+	    $RM $output
+	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_wrapper no > $output
+	    chmod +x $output
+	  ;;
+	esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save $symfileobj"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	  if test "$preload" = yes && test -f "$symfileobj"; then
+	    oldobjs="$oldobjs $symfileobj"
+	  fi
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	generated="$generated $gentop"
+
+	func_extract_archives $gentop $addlibs
+	oldobjs="$oldobjs $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	cmds=$old_archive_from_new_cmds
+      else
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  oldobjs="$oldobjs $func_extract_archives_result"
+	fi
+
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      func_basename "$obj"
+	      $ECHO "$func_basename_result"
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  $ECHO "copying selected object files to avoid basename conflicts..."
+	  gentop="$output_objdir/${outputname}x"
+	  generated="$generated $gentop"
+	  func_mkdir_p "$gentop"
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    func_basename "$obj"
+	    objbase="$func_basename_result"
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		func_arith $counter + 1
+		counter=$func_arith_result
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      oldobjs="$oldobjs $gentop/$newobj"
+	      ;;
+	    *) oldobjs="$oldobjs $obj" ;;
+	    esac
+	  done
+	fi
+	eval cmds=\"$old_archive_cmds\"
+
+	func_len " $cmds"
+	len=$func_len_result
+	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  func_verbose "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  eval test_cmds=\"$old_archive_cmds\"
+	  func_len " $test_cmds"
+	  len0=$func_len_result
+	  len=$len0
+	  for obj in $save_oldobjs
+	  do
+	    func_len " $obj"
+	    func_arith $len + $func_len_result
+	    len=$func_arith_result
+	    func_append objlist " $obj"
+	    if test "$len" -lt "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+		RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	      len=$len0
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  func_quote_for_eval "$var_value"
+	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "X$relink_command" | $Xsed -e "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		func_basename "$deplib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		newdependency_libs="$newdependency_libs $libdir/$name"
+		;;
+	      *) newdependency_libs="$newdependency_libs $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+
+	    for lib in $dlfiles; do
+	      case $lib in
+	      *.la)
+	        func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		newdlfiles="$newdlfiles $libdir/$name"
+		;;
+	      *) newdlfiles="$newdlfiles $lib" ;;
+	      esac
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+	      *.la)
+		# Only pass preopened files to the pseudo-archive (for
+		# eventual linking with the app. that links it) if we
+		# didn't already link the preopened objects directly into
+		# the library:
+		func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		newdlprefiles="$newdlprefiles $libdir/$name"
+		;;
+	      esac
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlfiles="$newdlfiles $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      newdlprefiles="$newdlprefiles $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $RM $output
+	  # place dlname in correct position for cygwin
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
+	  esac
+	  $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $ECHO >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$mode" = link || test "$mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) RM="$RM $arg"; rmforce=yes ;;
+      -*) RM="$RM $arg" ;;
+      *) files="$files $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    origobjdir="$objdir"
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+	objdir="$origobjdir"
+      else
+	objdir="$dir/$origobjdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$mode" = uninstall && objdir="$dir"
+
+      # Remember objdir for removal later, being careful to avoid duplicates
+      if test "$mode" = clean; then
+	case " $rmdirs " in
+	  *" $objdir "*) ;;
+	  *) rmdirs="$rmdirs $objdir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+	 { test -h "$file"; } >/dev/null 2>&1 ||
+	 test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if func_lalib_p "$file"; then
+	  func_source $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    rmfiles="$rmfiles $objdir/$n"
+	  done
+	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
+
+	  case "$mode" in
+	  clean)
+	    case "  $library_names " in
+	    # "  " in the beginning catches empty $dlname
+	    *" $dlname "*) ;;
+	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
+	    esac
+	    test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if func_lalib_p "$file"; then
+
+	  # Read the .lo file
+	  func_source $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" &&
+	     test "$pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" &&
+	     test "$non_pic_object" != none; then
+	    rmfiles="$rmfiles $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    func_stripname '' '.exe' "$file"
+	    file=$func_stripname_result
+	    func_stripname '' '.exe' "$name"
+	    noexename=$func_stripname_result
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    rmfiles="$rmfiles $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if func_ltwrapper_p "$file"; then
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      relink_command=
+	      func_source $func_ltwrapper_scriptname_result
+	      rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+	    else
+	      relink_command=
+	      func_source $dir/$noexename
+	    fi
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      rmfiles="$rmfiles $objdir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+    objdir="$origobjdir"
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
Index: /trunk/FACT++/.aux_dir/missing
===================================================================
--- /trunk/FACT++/.aux_dir/missing	(revision 10183)
+++ /trunk/FACT++/.aux_dir/missing	(revision 10183)
@@ -0,0 +1,376 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake@gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+  lex*|yacc*)
+    # Not GNU programs, they don't have --version.
+    ;;
+
+  tar*)
+    if test -n "$run"; then
+       echo 1>&2 "ERROR: \`tar' requires --run"
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       exit 1
+    fi
+    ;;
+
+  *)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case $f in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te*)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison*|yacc*)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f y.tab.h; then
+	echo >y.tab.h
+    fi
+    if test ! -f y.tab.c; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex*|flex*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f lex.yy.c; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit $?
+    fi
+    ;;
+
+  makeinfo*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    touch $file
+    ;;
+
+  tar*)
+    shift
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar "$@" && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar "$@" && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case $firstarg in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+	case $firstarg in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" "$@" && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
Index: /trunk/FACT++/.macro_dir/libtool.m4
===================================================================
--- /trunk/FACT++/.macro_dir/libtool.m4	(revision 10183)
+++ /trunk/FACT++/.macro_dir/libtool.m4	(revision 10183)
@@ -0,0 +1,7377 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 56 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+  ;;
+esac
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+if test "$no_create" != yes; then
+  lt_cl_success=:
+  test "$silent" = yes &&
+    lt_config_lt_args="$lt_config_lt_args --quiet"
+  exec AS_MESSAGE_LOG_FD>/dev/null
+  $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+  exec AS_MESSAGE_LOG_FD>>config.log
+  $lt_cl_success || AS_EXIT(1)
+fi
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_XSI_SHELLFNS
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=echo
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+	 [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X[$]1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+[$]*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "[$]0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+    [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[[3-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # Some binutils ld are patched to set DT_RUNPATH
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+       LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+    [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+       [shlibpath_overrides_runpath=yes])])
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method == "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+const struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC*)
+	    # IBM XL 8.0 on PPC
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+  ;;
+  cygwin* | mingw* | cegcc*)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+  ;;
+  *)
+    _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+	_LT_TAGVAR(link_all_deplibs, $1)=no
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+      # FIXME: Should let the user specify the lib program.
+      _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        AC_LINK_IFELSE(int foo(void) {},
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+        )
+        LDFLAGS="$save_LDFLAGS"
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+        _LT_TAGVAR(allow_undefined_flag, $1)=
+        if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+        then
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        else
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+        fi
+        _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+    [Fix the shell variable $srcfile for the compiler])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+        # as there is no search path for DLLs.
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+        _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+        _LT_TAGVAR(always_export_symbols, $1)=no
+        _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    cp $export_symbols $output_objdir/$soname.def;
+          else
+	    echo EXPORTS > $output_objdir/$soname.def;
+	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          _LT_TAGVAR(ld_shlibs, $1)=no
+        fi
+        ;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd[[12]]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 will use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	  xl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='echo'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=echo
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='echo'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  CC=${F77-"f77"}
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  CC=${FC-"f95"}
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC="$lt_save_CC"
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $[*] ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
+
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$[@]"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]+=\$[2]"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$[1]=\$$[1]\$[2]"
+}
+
+_LT_EOF
+    ;;
+  esac
+])
Index: /trunk/FACT++/.macro_dir/ltoptions.m4
===================================================================
--- /trunk/FACT++/.macro_dir/ltoptions.m4	(revision 10183)
+++ /trunk/FACT++/.macro_dir/ltoptions.m4	(revision 10183)
@@ -0,0 +1,368 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
Index: /trunk/FACT++/.macro_dir/ltsugar.m4
===================================================================
--- /trunk/FACT++/.macro_dir/ltsugar.m4	(revision 10183)
+++ /trunk/FACT++/.macro_dir/ltsugar.m4	(revision 10183)
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
Index: /trunk/FACT++/.macro_dir/ltversion.m4
===================================================================
--- /trunk/FACT++/.macro_dir/ltversion.m4	(revision 10183)
+++ /trunk/FACT++/.macro_dir/ltversion.m4	(revision 10183)
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
Index: /trunk/FACT++/.macro_dir/lt~obsolete.m4
===================================================================
--- /trunk/FACT++/.macro_dir/lt~obsolete.m4	(revision 10183)
+++ /trunk/FACT++/.macro_dir/lt~obsolete.m4	(revision 10183)
@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# This file is free software; the Free Software Foundation gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC],		[AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
Index: /trunk/FACT++/COPYING
===================================================================
--- /trunk/FACT++/COPYING	(revision 10183)
+++ /trunk/FACT++/COPYING	(revision 10183)
@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
Index: /trunk/FACT++/Doxyfile
===================================================================
--- /trunk/FACT++/Doxyfile	(revision 10183)
+++ /trunk/FACT++/Doxyfile	(revision 10183)
@@ -0,0 +1,1665 @@
+# Doxyfile 1.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING      = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = $(PROJECT)
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         = $(VERSION)
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = $(DOCDIR)
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = YES
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT            = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen to replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penality.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will rougly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = $(EXTRACT_ALL)
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespace are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = YES
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = NO
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do
+# proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function
+# even if there is only one candidate or it is obvious which candidate to
+# choose by doing a simple string match. By disabling
+# STRICT_PROTO_MATCHING doxygen will still accept a match between
+# prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           = doxygen.log
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = $(SRCDIR) MAINPAGE
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
+
+FILE_PATTERNS          = $(FILE_PATTERNS)
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = $(RECURSIVE)
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+#EXCLUDE                = $(EXCLUDE)
+#EXCLUDE                = dim_v19r15/dim/dim.h \
+#			 dim_v19r15/dim/dis.h \
+#			 dim_v19r15/src/dns.c \
+#			 dim_v19r15/src/open_dns.c \
+#			 dim_v19r15/src/dtq.c \
+#			 dim_v19r15/src/dna.c \
+#			 dim_v19r15/src/dic.c \
+#			 dim_v19r15/src/conn_handler.c \
+#			 dim_v19r15/src/feeserver.c \
+#			 dim_v19r15/src/dis.c \
+#			 dim_v19r15/src/dim_jni.c \
+#			 dim_v19r15/src/dis_Markus.c \
+#			 dim_v19r15/src/dis_old.c \
+#			 dim_v19r15/src/util/ \
+#			 dim_v19r15/src/examples/ \
+#			 dim_v19r15/src/benchmark/ \
+#			 examples/ \
+#                         src/dserver2.cc 
+EXCLUDE                = dim_v19r15/ \
+			 examples/ \
+                         src/dserver2.cc src/sched.cc
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           = $(SRCDIR)
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS       =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = YES
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = $(USE_HTAGS)
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = $(GENERATE_HTML)
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+#HTML_STYLESHEET        = Doxygen_monobook.css
+HTML_STYLESHEET        =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = ch.unige.isdc.fact
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = FACT collaboration
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = $(GENERATE_HTMLHELP)
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = $(GENERATE_CHI)
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = YES
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID         = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = YES
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 150
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvances is that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = $(GENERATE_LATEX)
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = YES
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = $(GENERATE_RTF)
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = $(GENERATE_MAN)
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = $(GENERATE_XML)
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+#boost.tag=boost
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = $(PERL_PATH)
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = $(HAVE_DOT)
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called FreeSans.ttf to the output
+# directory and reference it in all dot files that doxygen generates. This
+# font does not include all possible unicode characters however, so when you need
+# these (or just want a differently looking font) you can specify the font name
+# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
+# which can be done by putting it in a standard location or by setting the
+# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
+# containing the font.
+
+DOT_FONTNAME           = FreeSans.ttf
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE           = 10
+
+# By default doxygen will tell dot to use the output directory to look for the
+# FreeSans.ttf font (which doxygen will put there itself). If you specify a
+# different font using DOT_FONTNAME you can set the path where dot
+# can find it using this tag.
+
+DOT_FONTPATH           =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = YES
+#$(ALL_GRAPHS)
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = YES
+#$(ALL_GRAPHS)
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = $(DOT_PATH)
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS           =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
Index: /trunk/FACT++/INSTALL
===================================================================
--- /trunk/FACT++/INSTALL	(revision 10183)
+++ /trunk/FACT++/INSTALL	(revision 10183)
@@ -0,0 +1,365 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+
+   Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.  This file is offered as-is,
+without warranty of any kind.
+
+Basic Installation
+==================
+
+   Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.  Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below.  The lack of an optional feature in a given package is not
+necessarily a bug.  More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+   The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package, generally using the just-built uninstalled binaries.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.  When installing into a prefix owned by root, it is
+     recommended that the package be configured and built as a regular
+     user, and only the `make install' phase executed with root
+     privileges.
+
+  5. Optionally, type `make installcheck' to repeat any self-tests, but
+     this time using the binaries in their final installed location.
+     This target does not install anything.  Running this target as a
+     regular user, particularly if the prior `make install' required
+     root privileges, verifies that the installation completed
+     correctly.
+
+  6. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+  7. Often, you can also type `make uninstall' to remove the installed
+     files again.  In practice, not all packages have tested that
+     uninstallation works correctly, even though it is required by the
+     GNU Coding Standards.
+
+  8. Some packages, particularly those that use Automake, provide `make
+     distcheck', which can by used by developers to test that all other
+     targets like `make install' and `make uninstall' work correctly.
+     This target is generally not run by end users.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.  This
+is known as a "VPATH" build.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+   On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor.  Like
+this:
+
+     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+                 CPP="gcc -E" CXXCPP="g++ -E"
+
+   This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
+Installation Names
+==================
+
+   By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.  In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+   The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+   The first method involves providing an override variable for each
+affected directory.  For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'.  Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated.  The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+   The second method involves providing the `DESTDIR' variable.  For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names.  The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters.  On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+   Some packages offer the ability to configure how verbose the
+execution of `make' will be.  For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
+a workaround.  If GNU CC is not installed, it is therefore recommended
+to try
+
+     ./configure CC="cc"
+
+and if that doesn't work, try
+
+     ./configure CC="cc -nodtk"
+
+   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+   On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'.  It is recommended to use the following options:
+
+     ./configure --prefix=/boot/common
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS
+     KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+     Print a summary of the options unique to this package's
+     `configure', and exit.  The `short' variant lists options used
+     only in the top level, while the `recursive' variant lists options
+     also present in any nested packages.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--prefix=DIR'
+     Use DIR as the installation prefix.  *note Installation Names::
+     for more details, including other options available for fine-tuning
+     the installation locations.
+
+`--no-create'
+`-n'
+     Run the configure checks, but stop before creating any output
+     files.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+
Index: /trunk/FACT++/MAINPAGE
===================================================================
--- /trunk/FACT++/MAINPAGE	(revision 10183)
+++ /trunk/FACT++/MAINPAGE	(revision 10183)
@@ -0,0 +1,119 @@
+// **************************************************************************
+/** @mainpage
+
+@brief FACT++ - The FACT slow control software
+
+@author thomas.bretz@epfl.ch et al.
+@version 1.0
+ 
+@section install_sec Installation
+
+FACT++ can be downloaded from the svn by
+
+\verbatim
+   svn checkout https:://fact.isdc.unige.ch/svn/trunk/FACT
+\endverbatim
+
+it includes a dim version which is automatically compiled.
+
+For comilation use
+
+\verbatim
+   ./configure
+   make
+\endverbatim
+
+In priciple configure also supports
+
+\verbatim
+   make install
+\endverbatim
+
+which would install the packege and the libararies in your system,
+although at the moment this is not recommended
+
+@subsection packages Required packages
+
+If you find a new packege needed for installation please don't
+hesitate to report it, so that it can be added to the list below.
+
+Packegs known to be needed to configure and compile FACT++
+
+<B>Dim:</B>
+- lesstif2, lesstif2-dev (Xm.h)
+
+<B>Libraries:</B>
+- boost-dev (all)
+- mysql++-dev
+
+<B>Documentation:</B>
+- doxygen
+- graphviz
+- [global] optional (if htags should be used in Doxyfile)
+
+<B>Only for maintainers:</B>
+- autoconf (automake, autotools-dev, m4)
+- autoconf-archive
+- libtoolize
+
+@section Demo Current demonstration programs
+
+- \b dserver2: A virtual board (A TCP/IP server). It is sending a "hello" message
+  after accepting a communication and then in 3s intervals the current UTC time.
+  The board can be set to state 1 or back to state 0 (just as a demonstration)
+- \b dclient5: A control program. It accesses two viratual boards (start them
+  with 'dserver2' and 'dserver 4001') If both boards are connected the START
+  command can be issued to get them to state 'Running'. In this state
+  an asynchronous time stamp can be requested sending the TIME command.
+  to get back from Running to Connected use STOP. 
+- \b test3: a dim console which allows to control all dim servers
+  by sending commands via the dim network.
+- Both, \b dclient5 and \b test3 accept the command line options -c0, -c1, -c2
+  to switch between different console types (or no console in the case of
+  \b dclient5). In the console you get help with 'h' and the available
+  command with 'c' You get the avilable command-line options with --help
+
+First start the two dserver2s. Then start a dclient5 (if you want it
+with console use one of the -c options) and a test3 console (with one
+of the console options if you like) you can now control the hardware
+boards with the START, STOP and TIME commands or stop (Ctrl-C) and
+start one of the programs to see what's happening. In the test3 case
+you first have to \e cd to the server to which you want to talk by \b
+DATA_LOGGER. Don't forget to start \b dns if you want to control dclient5
+from test3 via Dim.
+
+
+@section References
+
+@subsection generalref General references
+- <A HREF="http://www.cplusplus.com/reference">The C++ reference</A>
+- <A HREF="http://www.boost.org">boost.org: The boost C++ libraries</A>
+- <A HREF="http://www.highscore.de/cpp/boost/titelseite.html">Boris Sch&auml;ling: Die Boost C++ Bibliotheken</A>
+- <A HREF="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html">GNU Readline</A>
+- <A HREF="http://www.gnu.org/software/ncurses">GNU Ncurses</A>
+
+@subsection boostref Boost references
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/libs/bind/bind.html">boost::bind (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio.html">boost asio (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/doc/html/date_time.html">boost date_time (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/doc/html/program_options.html">boost program_options (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/libs/filesystem/v3/doc/index.htm">boost filesystem (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/libs/regex/doc/html/index.html">boost regex (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/libs/system/doc/index.html">boost system (error codes) (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/doc/html/thread.html">boost thread (V1.45.0)</A>
+- <A HREF="http://www.boost.org/doc/libs/1_45_0/libs/conversion/lexical_cast.htm">boost lexical_cast (V1.45.0)</A>
+
+@section Available programs
+
+- dns: Dim's domain-name-server (needed for any communication between Dim servers and clients)
+- did: A simple graphical interface to analyse everything in a Dim network
+
+@section Examples
+
+There are a few example programs
+- \b ./argv: Example for usage of the class Configure (command line options, configuration file)
+- \b ./time: Example for the usage of the class Time (time input/output, conversion)
+- \b ./log, \b ./logtime: A simple Dim-Service/-Client combination using MessageDimRX/MessageDimTX
+
+**/
+// **************************************************************************
Index: /trunk/FACT++/Makefile.am
===================================================================
--- /trunk/FACT++/Makefile.am	(revision 10183)
+++ /trunk/FACT++/Makefile.am	(revision 10183)
@@ -0,0 +1,167 @@
+include aminclude.am
+
+#-------------------------------------------------------------------------
+
+ACLOCAL_AMFLAGS = -I .macro_dir
+
+DIM_FLAGS = -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux
+
+AM_CPPFLAGS = \
+   -O3 -Wall -Winit-self -Wpointer-arith -Wcast-align -Wextra -Wformat=2 \
+   -Idim_v19r15/dim $(DIM_FLAGS)
+
+AM_CXXFLAGS = $(AM_CPPFLAGS) -Woverloaded-virtual -Wshadow -std=c++0x
+
+# -no-undefined
+AM_LDFLAGS = -module -avoid-version \
+   	-lboost_system \
+   	-lboost_thread \
+   	-lboost_regex \
+   	-lboost_date_time \
+   	-lboost_program_options \
+   	-lboost_filesystem \
+   	-lmysqlpp
+
+#-------------------------------------------------------------------------
+
+bin_PROGRAMS    = dns did log logtime argv time test3 dclient5 dserver2
+
+lib_LTLIBRARIES = libDim.la libDimCpp.la libTime.la libTools.la \
+		  libConfiguration.la libStateMachine.la
+
+#-------------------------------------------------------------------------
+
+dist_noinst_SCRIPTS = autogen.sh
+
+EXTRA_DIST = \
+	dim_v19r15/DIM_Performance.pdf \
+	dim_v19r15/LICENSE.GPL \
+	dim_v19r15/README.txt \
+	dim_v19r15/README_v9.txt \
+	dim_v19r15/README_v10.txt \
+	dim_v19r15/README_v11.txt \
+	dim_v19r15/README_v12.txt \
+	dim_v19r15/README_v13.txt \
+	dim_v19r15/README_v14.txt \
+	dim_v19r15/README_v15.txt \
+	dim_v19r15/README_v16.txt \
+	dim_v19r15/README_v17.txt \
+	dim_v19r15/README_v18.txt \
+	dim_v19r15/README_v19.txt
+
+dns_LDADD    = libDim.la
+dns_SOURCES  = dim_v19r15/src/dns.c
+#dns_CPPFLAGS = $(AM_CPPFLAGS) $(DIM_FLAGS)
+
+did_LDADD    = -lXm 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
+
+
+#libDim_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIM_FLAGS)
+libDim_ladir = 
+libDim_la_HEADERS = \
+	dim_v19r15/dim/dic.h \
+	dim_v19r15/dim/dim_common.h \
+	dim_v19r15/dim/dim.h \
+	dim_v19r15/dim/dim_tcpip.h \
+	dim_v19r15/dim/dis.h 
+
+libDim_la_SOURCES = \
+	dim_v19r15/src/dic.c \
+	dim_v19r15/src/dis.c \
+	dim_v19r15/src/dna.c \
+	dim_v19r15/src/sll.c \
+	dim_v19r15/src/dll.c  \
+	dim_v19r15/src/hash.c \
+	dim_v19r15/src/swap.c \
+	dim_v19r15/src/copy_swap.c \
+	dim_v19r15/src/open_dns.c \
+	dim_v19r15/src/conn_handler.c \
+	dim_v19r15/src/tcpip.c \
+	dim_v19r15/src/dtq.c \
+	dim_v19r15/src/dim_thr.c \
+	dim_v19r15/src/utilities.c
+
+#libDimCpp_la_CXXFLAGS = $(AM_CXXFLAGS) $(DIM_FLAGS)
+libDimCpp_ladir =
+libDimCpp_la_HEADERS = \
+	dim_v19r15/dim/dic.hxx \
+	dim_v19r15/dim/dim_core.hxx \
+	dim_v19r15/dim/dim.hxx \
+	dim_v19r15/dim/dim_tcpip.h \
+	dim_v19r15/dim/dllist.hxx \
+	dim_v19r15/dim/sllist.hxx \
+	dim_v19r15/dim/tokenstring.hxx 
+	
+libDimCpp_la_SOURCES = \
+	dim_v19r15/src/diccpp.cxx \
+	dim_v19r15/src/dimcpp.cxx \
+	dim_v19r15/src/tokenstring.cxx \
+	dim_v19r15/src/discpp.cxx 
+
+# Divide into Tools/StateMachine/Shell/TcpIp
+libStateMachine_la_SOURCES = \
+	src/EventImp.h        src/EventImp.cc \
+	src/Event.h           src/Event.cc \
+	src/MessageImp.h      src/MessageImp.cc \
+	src/MessageDim.h      src/MessageDim.cc \
+	src/Converter.h       src/Converter.cc \
+	src/StateMachineImp.h src/StateMachineImp.cc \
+	src/StateMachineDim.h src/StateMachineDim.cc \
+	src/StateMachine.h    src/StateMachine.cc \
+	src/ServiceList.h     src/ServiceList.cc \
+	src/DimErrorRedirecter.cc \
+	src/WindowLog.h       src/WindowLog.cc \
+	src/Readline.h        src/Readline.cc \
+	src/ReadlineWindow.h  src/ReadlineWindow.cc \
+	src/Console.h         src/Console.cc \
+	src/Shell.h           src/Shell.cc \
+	src/Connection.h      src/Connection.cc \
+	src/EventDim.h
+
+
+libConfiguration_la_SOURCES = src/Configuration.h src/Configuration.cc
+
+libTime_la_SOURCES = src/Time.h src/Time.cc
+
+libTools_la_SOURCES = src/tools.h src/tools.cc
+
+
+dserver2_SOURCES = src/dserver2.cc 
+dserver2_LDADD   = libTime.la libTools.la libStateMachine.la libDim.la libDimCpp.la
+
+
+log_SOURCES = src/log.cc
+log_LDADD   = libTime.la libTools.la libDim.la libDimCpp.la libStateMachine.la 
+
+
+logtime_LDADD = libStateMachine.la libTools.la libTime.la libDim.la libDimCpp.la
+logtime_SOURCES = src/logtime.cc
+
+
+dclient5_SOURCES = src/dclient5.cc src/LocalControl.cc
+dclient5_LDADD   = libDim.la libDimCpp.la libTools.la libTime.la libStateMachine.la \
+    libConfiguration.la
+
+
+argv_SOURCES = src/argv.cc
+argv_LDADD = libConfiguration.la 
+
+
+test3_SOURCES = src/test3.cc src/RemoteControl.cc
+test3_LDADD = libStateMachine.la libTools.la libTime.la libDim.la libDimCpp.la libConfiguration.la
+
+
+time_SOURCES = src/time.cc
+time_LDADD = libTime.la 
+
+
+# Overwrite rules for silent or other verbosity levels
+# pkg_verbose = $(pkg_verbose_$(V))
+#               pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY))
+#               pkg_verbose_0 = @echo GEN $@;
+#               
+#               foo: foo.in
+#                       $(pkg_verbose)cp $(srcdir)/foo.in $@
+
Index: /trunk/FACT++/Makefile.in
===================================================================
--- /trunk/FACT++/Makefile.in	(revision 10183)
+++ /trunk/FACT++/Makefile.in	(revision 10183)
@@ -0,0 +1,1496 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+DIST_COMMON = README $(am__configure_deps) $(dist_noinst_SCRIPTS) \
+	$(libDimCpp_la_HEADERS) $(libDim_la_HEADERS) \
+	$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+	$(srcdir)/aminclude.am $(top_srcdir)/configure \
+	.aux_dir/compile .aux_dir/config.guess .aux_dir/config.sub \
+	.aux_dir/depcomp .aux_dir/install-sh .aux_dir/ltmain.sh \
+	.aux_dir/missing AUTHORS COPYING ChangeLog INSTALL NEWS
+bin_PROGRAMS = dns$(EXEEXT) did$(EXEEXT) log$(EXEEXT) logtime$(EXEEXT) \
+	argv$(EXEEXT) time$(EXEEXT) test3$(EXEEXT) dclient5$(EXEEXT) \
+	dserver2$(EXEEXT)
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/.macro_dir/libtool.m4 \
+	$(top_srcdir)/.macro_dir/ltoptions.m4 \
+	$(top_srcdir)/.macro_dir/ltsugar.m4 \
+	$(top_srcdir)/.macro_dir/ltversion.m4 \
+	$(top_srcdir)/.macro_dir/lt~obsolete.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+    *) f=$$p;; \
+  esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+  srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+  for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+  for p in $$list; do echo "$$p $$p"; done | \
+  sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+  $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+    if (++n[$$2] == $(am__install_max)) \
+      { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+    END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+  sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+  sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+	"$(DESTDIR)$(libDimCpp_ladir)" "$(DESTDIR)$(libDim_ladir)"
+LTLIBRARIES = $(lib_LTLIBRARIES)
+libConfiguration_la_LIBADD =
+am__dirstamp = $(am__leading_dot)dirstamp
+am_libConfiguration_la_OBJECTS = src/Configuration.lo
+libConfiguration_la_OBJECTS = $(am_libConfiguration_la_OBJECTS)
+AM_V_lt = $(am__v_lt_$(V))
+am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
+am__v_lt_0 = --silent
+libDim_la_LIBADD =
+am_libDim_la_OBJECTS = dim_v19r15/src/dic.lo dim_v19r15/src/dis.lo \
+	dim_v19r15/src/dna.lo dim_v19r15/src/sll.lo \
+	dim_v19r15/src/dll.lo dim_v19r15/src/hash.lo \
+	dim_v19r15/src/swap.lo dim_v19r15/src/copy_swap.lo \
+	dim_v19r15/src/open_dns.lo dim_v19r15/src/conn_handler.lo \
+	dim_v19r15/src/tcpip.lo dim_v19r15/src/dtq.lo \
+	dim_v19r15/src/dim_thr.lo dim_v19r15/src/utilities.lo
+libDim_la_OBJECTS = $(am_libDim_la_OBJECTS)
+libDimCpp_la_LIBADD =
+am_libDimCpp_la_OBJECTS = dim_v19r15/src/diccpp.lo \
+	dim_v19r15/src/dimcpp.lo dim_v19r15/src/tokenstring.lo \
+	dim_v19r15/src/discpp.lo
+libDimCpp_la_OBJECTS = $(am_libDimCpp_la_OBJECTS)
+libStateMachine_la_LIBADD =
+am_libStateMachine_la_OBJECTS = src/EventImp.lo src/Event.lo \
+	src/MessageImp.lo src/MessageDim.lo src/Converter.lo \
+	src/StateMachineImp.lo src/StateMachineDim.lo \
+	src/StateMachine.lo src/ServiceList.lo \
+	src/DimErrorRedirecter.lo src/WindowLog.lo src/Readline.lo \
+	src/ReadlineWindow.lo src/Console.lo src/Shell.lo \
+	src/Connection.lo
+libStateMachine_la_OBJECTS = $(am_libStateMachine_la_OBJECTS)
+libTime_la_LIBADD =
+am_libTime_la_OBJECTS = src/Time.lo
+libTime_la_OBJECTS = $(am_libTime_la_OBJECTS)
+libTools_la_LIBADD =
+am_libTools_la_OBJECTS = src/tools.lo
+libTools_la_OBJECTS = $(am_libTools_la_OBJECTS)
+PROGRAMS = $(bin_PROGRAMS)
+am_argv_OBJECTS = src/argv.$(OBJEXT)
+argv_OBJECTS = $(am_argv_OBJECTS)
+argv_DEPENDENCIES = libConfiguration.la
+am_dclient5_OBJECTS = src/dclient5.$(OBJEXT) \
+	src/LocalControl.$(OBJEXT)
+dclient5_OBJECTS = $(am_dclient5_OBJECTS)
+dclient5_DEPENDENCIES = libDim.la libDimCpp.la libTools.la libTime.la \
+	libStateMachine.la libConfiguration.la
+am_did_OBJECTS = dim_v19r15/src/did/did-did.$(OBJEXT) \
+	dim_v19r15/src/did/did-dui_util.$(OBJEXT)
+did_OBJECTS = $(am_did_OBJECTS)
+did_DEPENDENCIES = libDim.la
+am_dns_OBJECTS = dim_v19r15/src/dns.$(OBJEXT)
+dns_OBJECTS = $(am_dns_OBJECTS)
+dns_DEPENDENCIES = libDim.la
+am_dserver2_OBJECTS = src/dserver2.$(OBJEXT)
+dserver2_OBJECTS = $(am_dserver2_OBJECTS)
+dserver2_DEPENDENCIES = libTime.la libTools.la libStateMachine.la \
+	libDim.la libDimCpp.la
+am_log_OBJECTS = src/log.$(OBJEXT)
+log_OBJECTS = $(am_log_OBJECTS)
+log_DEPENDENCIES = libTime.la libTools.la libDim.la libDimCpp.la \
+	libStateMachine.la
+am_logtime_OBJECTS = src/logtime.$(OBJEXT)
+logtime_OBJECTS = $(am_logtime_OBJECTS)
+logtime_DEPENDENCIES = libStateMachine.la libTools.la libTime.la \
+	libDim.la libDimCpp.la
+am_test3_OBJECTS = src/test3.$(OBJEXT) src/RemoteControl.$(OBJEXT)
+test3_OBJECTS = $(am_test3_OBJECTS)
+test3_DEPENDENCIES = libStateMachine.la libTools.la libTime.la \
+	libDim.la libDimCpp.la libConfiguration.la
+am_time_OBJECTS = src/time.$(OBJEXT)
+time_OBJECTS = $(am_time_OBJECTS)
+time_DEPENDENCIES = libTime.la
+SCRIPTS = $(dist_noinst_SCRIPTS)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/.aux_dir/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_$(V))
+am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
+am__v_CC_0 = @echo "  CC    " $@;
+AM_V_at = $(am__v_at_$(V))
+am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
+am__v_at_0 = @
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_$(V))
+am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CCLD_0 = @echo "  CCLD  " $@;
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_$(V))
+am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY))
+am__v_CXX_0 = @echo "  CXX   " $@;
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_$(V))
+am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY))
+am__v_CXXLD_0 = @echo "  CXXLD " $@;
+AM_V_GEN = $(am__v_GEN_$(V))
+am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
+am__v_GEN_0 = @echo "  GEN   " $@;
+SOURCES = $(libConfiguration_la_SOURCES) $(libDim_la_SOURCES) \
+	$(libDimCpp_la_SOURCES) $(libStateMachine_la_SOURCES) \
+	$(libTime_la_SOURCES) $(libTools_la_SOURCES) $(argv_SOURCES) \
+	$(dclient5_SOURCES) $(did_SOURCES) $(dns_SOURCES) \
+	$(dserver2_SOURCES) $(log_SOURCES) $(logtime_SOURCES) \
+	$(test3_SOURCES) $(time_SOURCES)
+DIST_SOURCES = $(libConfiguration_la_SOURCES) $(libDim_la_SOURCES) \
+	$(libDimCpp_la_SOURCES) $(libStateMachine_la_SOURCES) \
+	$(libTime_la_SOURCES) $(libTools_la_SOURCES) $(argv_SOURCES) \
+	$(dclient5_SOURCES) $(did_SOURCES) $(dns_SOURCES) \
+	$(dserver2_SOURCES) $(log_SOURCES) $(logtime_SOURCES) \
+	$(test3_SOURCES) $(time_SOURCES)
+HEADERS = $(libDimCpp_la_HEADERS) $(libDim_la_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+  { test ! -d "$(distdir)" \
+    || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr "$(distdir)"; }; }
+DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.Z
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BOOST_ASIO_LIB = @BOOST_ASIO_LIB@
+BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_DATE_TIME_LIB = @BOOST_DATE_TIME_LIB@
+BOOST_FILESYSTEM_LIB = @BOOST_FILESYSTEM_LIB@
+BOOST_LDFLAGS = @BOOST_LDFLAGS@
+BOOST_PROGRAM_OPTIONS_LIB = @BOOST_PROGRAM_OPTIONS_LIB@
+BOOST_REGEX_LIB = @BOOST_REGEX_LIB@
+BOOST_SYSTEM_LIB = @BOOST_SYSTEM_LIB@
+BOOST_THREAD_LIB = @BOOST_THREAD_LIB@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DOXYGEN_PAPER_SIZE = @DOXYGEN_PAPER_SIZE@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+DX_CONFIG = @DX_CONFIG@
+DX_DOCDIR = @DX_DOCDIR@
+DX_DOT = @DX_DOT@
+DX_DOXYGEN = @DX_DOXYGEN@
+DX_DVIPS = @DX_DVIPS@
+DX_EGREP = @DX_EGREP@
+DX_ENV = @DX_ENV@
+DX_FLAG_chi = @DX_FLAG_chi@
+DX_FLAG_chm = @DX_FLAG_chm@
+DX_FLAG_doc = @DX_FLAG_doc@
+DX_FLAG_dot = @DX_FLAG_dot@
+DX_FLAG_html = @DX_FLAG_html@
+DX_FLAG_man = @DX_FLAG_man@
+DX_FLAG_pdf = @DX_FLAG_pdf@
+DX_FLAG_ps = @DX_FLAG_ps@
+DX_FLAG_rtf = @DX_FLAG_rtf@
+DX_FLAG_xml = @DX_FLAG_xml@
+DX_HHC = @DX_HHC@
+DX_LATEX = @DX_LATEX@
+DX_MAKEINDEX = @DX_MAKEINDEX@
+DX_PDFLATEX = @DX_PDFLATEX@
+DX_PERL = @DX_PERL@
+DX_PROJECT = @DX_PROJECT@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@DX_COND_doc_TRUE@@DX_COND_html_TRUE@DX_CLEAN_HTML = @DX_DOCDIR@/html
+@DX_COND_chm_TRUE@@DX_COND_doc_TRUE@DX_CLEAN_CHM = @DX_DOCDIR@/chm
+@DX_COND_chi_TRUE@@DX_COND_chm_TRUE@@DX_COND_doc_TRUE@DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+@DX_COND_doc_TRUE@@DX_COND_man_TRUE@DX_CLEAN_MAN = @DX_DOCDIR@/man
+@DX_COND_doc_TRUE@@DX_COND_rtf_TRUE@DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+@DX_COND_doc_TRUE@@DX_COND_xml_TRUE@DX_CLEAN_XML = @DX_DOCDIR@/xml
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@DX_PS_GOAL = doxygen-ps
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@DX_PDF_GOAL = doxygen-pdf
+@DX_COND_doc_TRUE@@DX_COND_latex_TRUE@DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+@DX_COND_doc_TRUE@DX_CLEANFILES = \
+@DX_COND_doc_TRUE@	@DX_DOCDIR@/@PACKAGE@.tag \
+@DX_COND_doc_TRUE@	-r \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_HTML) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_CHM) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_CHI) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_MAN) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_RTF) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_XML) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_PS) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_PDF) \
+@DX_COND_doc_TRUE@	$(DX_CLEAN_LATEX)
+
+
+#-------------------------------------------------------------------------
+ACLOCAL_AMFLAGS = -I .macro_dir
+DIM_FLAGS = -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux
+AM_CPPFLAGS = \
+   -O3 -Wall -Winit-self -Wpointer-arith -Wcast-align -Wextra -Wformat=2 \
+   -Idim_v19r15/dim $(DIM_FLAGS)
+
+AM_CXXFLAGS = $(AM_CPPFLAGS) -Woverloaded-virtual -Wshadow -std=c++0x
+
+# -no-undefined
+AM_LDFLAGS = -module -avoid-version \
+   	-lboost_system \
+   	-lboost_thread \
+   	-lboost_regex \
+   	-lboost_date_time \
+   	-lboost_program_options \
+   	-lboost_filesystem \
+   	-lmysqlpp
+
+lib_LTLIBRARIES = libDim.la libDimCpp.la libTime.la libTools.la \
+		  libConfiguration.la libStateMachine.la
+
+
+#-------------------------------------------------------------------------
+dist_noinst_SCRIPTS = autogen.sh
+EXTRA_DIST = \
+	dim_v19r15/DIM_Performance.pdf \
+	dim_v19r15/LICENSE.GPL \
+	dim_v19r15/README.txt \
+	dim_v19r15/README_v9.txt \
+	dim_v19r15/README_v10.txt \
+	dim_v19r15/README_v11.txt \
+	dim_v19r15/README_v12.txt \
+	dim_v19r15/README_v13.txt \
+	dim_v19r15/README_v14.txt \
+	dim_v19r15/README_v15.txt \
+	dim_v19r15/README_v16.txt \
+	dim_v19r15/README_v17.txt \
+	dim_v19r15/README_v18.txt \
+	dim_v19r15/README_v19.txt
+
+dns_LDADD = libDim.la
+dns_SOURCES = dim_v19r15/src/dns.c
+#dns_CPPFLAGS = $(AM_CPPFLAGS) $(DIM_FLAGS)
+did_LDADD = -lXm 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
+
+#libDim_la_CPPFLAGS = $(AM_CPPFLAGS) $(DIM_FLAGS)
+libDim_ladir = 
+libDim_la_HEADERS = \
+	dim_v19r15/dim/dic.h \
+	dim_v19r15/dim/dim_common.h \
+	dim_v19r15/dim/dim.h \
+	dim_v19r15/dim/dim_tcpip.h \
+	dim_v19r15/dim/dis.h 
+
+libDim_la_SOURCES = \
+	dim_v19r15/src/dic.c \
+	dim_v19r15/src/dis.c \
+	dim_v19r15/src/dna.c \
+	dim_v19r15/src/sll.c \
+	dim_v19r15/src/dll.c  \
+	dim_v19r15/src/hash.c \
+	dim_v19r15/src/swap.c \
+	dim_v19r15/src/copy_swap.c \
+	dim_v19r15/src/open_dns.c \
+	dim_v19r15/src/conn_handler.c \
+	dim_v19r15/src/tcpip.c \
+	dim_v19r15/src/dtq.c \
+	dim_v19r15/src/dim_thr.c \
+	dim_v19r15/src/utilities.c
+
+
+#libDimCpp_la_CXXFLAGS = $(AM_CXXFLAGS) $(DIM_FLAGS)
+libDimCpp_ladir = 
+libDimCpp_la_HEADERS = \
+	dim_v19r15/dim/dic.hxx \
+	dim_v19r15/dim/dim_core.hxx \
+	dim_v19r15/dim/dim.hxx \
+	dim_v19r15/dim/dim_tcpip.h \
+	dim_v19r15/dim/dllist.hxx \
+	dim_v19r15/dim/sllist.hxx \
+	dim_v19r15/dim/tokenstring.hxx 
+
+libDimCpp_la_SOURCES = \
+	dim_v19r15/src/diccpp.cxx \
+	dim_v19r15/src/dimcpp.cxx \
+	dim_v19r15/src/tokenstring.cxx \
+	dim_v19r15/src/discpp.cxx 
+
+
+# Divide into Tools/StateMachine/Shell/TcpIp
+libStateMachine_la_SOURCES = \
+	src/EventImp.h        src/EventImp.cc \
+	src/Event.h           src/Event.cc \
+	src/MessageImp.h      src/MessageImp.cc \
+	src/MessageDim.h      src/MessageDim.cc \
+	src/Converter.h       src/Converter.cc \
+	src/StateMachineImp.h src/StateMachineImp.cc \
+	src/StateMachineDim.h src/StateMachineDim.cc \
+	src/StateMachine.h    src/StateMachine.cc \
+	src/ServiceList.h     src/ServiceList.cc \
+	src/DimErrorRedirecter.cc \
+	src/WindowLog.h       src/WindowLog.cc \
+	src/Readline.h        src/Readline.cc \
+	src/ReadlineWindow.h  src/ReadlineWindow.cc \
+	src/Console.h         src/Console.cc \
+	src/Shell.h           src/Shell.cc \
+	src/Connection.h      src/Connection.cc \
+	src/EventDim.h
+
+libConfiguration_la_SOURCES = src/Configuration.h src/Configuration.cc
+libTime_la_SOURCES = src/Time.h src/Time.cc
+libTools_la_SOURCES = src/tools.h src/tools.cc
+dserver2_SOURCES = src/dserver2.cc 
+dserver2_LDADD = libTime.la libTools.la libStateMachine.la libDim.la libDimCpp.la
+log_SOURCES = src/log.cc
+log_LDADD = libTime.la libTools.la libDim.la libDimCpp.la libStateMachine.la 
+logtime_LDADD = libStateMachine.la libTools.la libTime.la libDim.la libDimCpp.la
+logtime_SOURCES = src/logtime.cc
+dclient5_SOURCES = src/dclient5.cc src/LocalControl.cc
+dclient5_LDADD = libDim.la libDimCpp.la libTools.la libTime.la libStateMachine.la \
+    libConfiguration.la
+
+argv_SOURCES = src/argv.cc
+argv_LDADD = libConfiguration.la 
+test3_SOURCES = src/test3.cc src/RemoteControl.cc
+test3_LDADD = libStateMachine.la libTools.la libTime.la libDim.la libDimCpp.la libConfiguration.la
+time_SOURCES = src/time.cc
+time_LDADD = libTime.la 
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .cc .cxx .lo .o .obj
+am--refresh:
+	@:
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(srcdir)/aminclude.am $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+	      $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
+		&& exit 0; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    echo ' $(SHELL) ./config.status'; \
+	    $(SHELL) ./config.status;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure:  $(am__configure_deps)
+	$(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
+	$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+	@$(NORMAL_INSTALL)
+	test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	list2=; for p in $$list; do \
+	  if test -f $$p; then \
+	    list2="$$list2 $$p"; \
+	  else :; fi; \
+	done; \
+	test -z "$$list2" || { \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+	}
+
+uninstall-libLTLIBRARIES:
+	@$(NORMAL_UNINSTALL)
+	@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+	for p in $$list; do \
+	  $(am__strip_dir) \
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+	done
+
+clean-libLTLIBRARIES:
+	-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+	@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+src/$(am__dirstamp):
+	@$(MKDIR_P) src
+	@: > src/$(am__dirstamp)
+src/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) src/$(DEPDIR)
+	@: > src/$(DEPDIR)/$(am__dirstamp)
+src/Configuration.lo: src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+libConfiguration.la: $(libConfiguration_la_OBJECTS) $(libConfiguration_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libConfiguration_la_OBJECTS) $(libConfiguration_la_LIBADD) $(LIBS)
+dim_v19r15/src/$(am__dirstamp):
+	@$(MKDIR_P) dim_v19r15/src
+	@: > dim_v19r15/src/$(am__dirstamp)
+dim_v19r15/src/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) dim_v19r15/src/$(DEPDIR)
+	@: > dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dic.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dis.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dna.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/sll.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dll.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/hash.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/swap.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/copy_swap.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/open_dns.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/conn_handler.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/tcpip.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dtq.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dim_thr.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/utilities.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+libDim.la: $(libDim_la_OBJECTS) $(libDim_la_DEPENDENCIES) 
+	$(AM_V_CCLD)$(LINK) -rpath $(libdir) $(libDim_la_OBJECTS) $(libDim_la_LIBADD) $(LIBS)
+dim_v19r15/src/diccpp.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/dimcpp.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/tokenstring.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/discpp.lo: dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+libDimCpp.la: $(libDimCpp_la_OBJECTS) $(libDimCpp_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libDimCpp_la_OBJECTS) $(libDimCpp_la_LIBADD) $(LIBS)
+src/EventImp.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/Event.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/MessageImp.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/MessageDim.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/Converter.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/StateMachineImp.lo: src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+src/StateMachineDim.lo: src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+src/StateMachine.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/ServiceList.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/DimErrorRedirecter.lo: src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+src/WindowLog.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/Readline.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/ReadlineWindow.lo: src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+src/Console.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/Shell.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/Connection.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+libStateMachine.la: $(libStateMachine_la_OBJECTS) $(libStateMachine_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libStateMachine_la_OBJECTS) $(libStateMachine_la_LIBADD) $(LIBS)
+src/Time.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+libTime.la: $(libTime_la_OBJECTS) $(libTime_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libTime_la_OBJECTS) $(libTime_la_LIBADD) $(LIBS)
+src/tools.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+libTools.la: $(libTools_la_OBJECTS) $(libTools_la_DEPENDENCIES) 
+	$(AM_V_CXXLD)$(CXXLINK) -rpath $(libdir) $(libTools_la_OBJECTS) $(libTools_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+installcheck-binPROGRAMS: $(bin_PROGRAMS)
+	bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
+	  case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
+	   *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
+	  esac; \
+	  f=`echo "$$p" | \
+	     sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  for opt in --help --version; do \
+	    if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \
+	         2>c$${pid}_.err </dev/null \
+		 && test -n "`cat c$${pid}_.out`" \
+		 && test -z "`cat c$${pid}_.err`"; then :; \
+	    else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
+	  done; \
+	done; rm -f c$${pid}_.???; exit $$bad
+src/argv.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+argv$(EXEEXT): $(argv_OBJECTS) $(argv_DEPENDENCIES) 
+	@rm -f argv$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(argv_OBJECTS) $(argv_LDADD) $(LIBS)
+src/dclient5.$(OBJEXT): src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+src/LocalControl.$(OBJEXT): src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+dclient5$(EXEEXT): $(dclient5_OBJECTS) $(dclient5_DEPENDENCIES) 
+	@rm -f dclient5$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(dclient5_OBJECTS) $(dclient5_LDADD) $(LIBS)
+dim_v19r15/src/did/$(am__dirstamp):
+	@$(MKDIR_P) dim_v19r15/src/did
+	@: > dim_v19r15/src/did/$(am__dirstamp)
+dim_v19r15/src/did/$(DEPDIR)/$(am__dirstamp):
+	@$(MKDIR_P) dim_v19r15/src/did/$(DEPDIR)
+	@: > dim_v19r15/src/did/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/did/did-did.$(OBJEXT):  \
+	dim_v19r15/src/did/$(am__dirstamp) \
+	dim_v19r15/src/did/$(DEPDIR)/$(am__dirstamp)
+dim_v19r15/src/did/did-dui_util.$(OBJEXT):  \
+	dim_v19r15/src/did/$(am__dirstamp) \
+	dim_v19r15/src/did/$(DEPDIR)/$(am__dirstamp)
+did$(EXEEXT): $(did_OBJECTS) $(did_DEPENDENCIES) 
+	@rm -f did$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(did_OBJECTS) $(did_LDADD) $(LIBS)
+dim_v19r15/src/dns.$(OBJEXT): dim_v19r15/src/$(am__dirstamp) \
+	dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+dns$(EXEEXT): $(dns_OBJECTS) $(dns_DEPENDENCIES) 
+	@rm -f dns$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(dns_OBJECTS) $(dns_LDADD) $(LIBS)
+src/dserver2.$(OBJEXT): src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+dserver2$(EXEEXT): $(dserver2_OBJECTS) $(dserver2_DEPENDENCIES) 
+	@rm -f dserver2$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(dserver2_OBJECTS) $(dserver2_LDADD) $(LIBS)
+src/log.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+log$(EXEEXT): $(log_OBJECTS) $(log_DEPENDENCIES) 
+	@rm -f log$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(log_OBJECTS) $(log_LDADD) $(LIBS)
+src/logtime.$(OBJEXT): src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+logtime$(EXEEXT): $(logtime_OBJECTS) $(logtime_DEPENDENCIES) 
+	@rm -f logtime$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(logtime_OBJECTS) $(logtime_LDADD) $(LIBS)
+src/test3.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+src/RemoteControl.$(OBJEXT): src/$(am__dirstamp) \
+	src/$(DEPDIR)/$(am__dirstamp)
+test3$(EXEEXT): $(test3_OBJECTS) $(test3_DEPENDENCIES) 
+	@rm -f test3$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(test3_OBJECTS) $(test3_LDADD) $(LIBS)
+src/time.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp)
+time$(EXEEXT): $(time_OBJECTS) $(time_DEPENDENCIES) 
+	@rm -f time$(EXEEXT)
+	$(AM_V_CXXLD)$(CXXLINK) $(time_OBJECTS) $(time_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+	-rm -f dim_v19r15/src/conn_handler.$(OBJEXT)
+	-rm -f dim_v19r15/src/conn_handler.lo
+	-rm -f dim_v19r15/src/copy_swap.$(OBJEXT)
+	-rm -f dim_v19r15/src/copy_swap.lo
+	-rm -f dim_v19r15/src/dic.$(OBJEXT)
+	-rm -f dim_v19r15/src/dic.lo
+	-rm -f dim_v19r15/src/diccpp.$(OBJEXT)
+	-rm -f dim_v19r15/src/diccpp.lo
+	-rm -f dim_v19r15/src/did/did-did.$(OBJEXT)
+	-rm -f dim_v19r15/src/did/did-dui_util.$(OBJEXT)
+	-rm -f dim_v19r15/src/dim_thr.$(OBJEXT)
+	-rm -f dim_v19r15/src/dim_thr.lo
+	-rm -f dim_v19r15/src/dimcpp.$(OBJEXT)
+	-rm -f dim_v19r15/src/dimcpp.lo
+	-rm -f dim_v19r15/src/dis.$(OBJEXT)
+	-rm -f dim_v19r15/src/dis.lo
+	-rm -f dim_v19r15/src/discpp.$(OBJEXT)
+	-rm -f dim_v19r15/src/discpp.lo
+	-rm -f dim_v19r15/src/dll.$(OBJEXT)
+	-rm -f dim_v19r15/src/dll.lo
+	-rm -f dim_v19r15/src/dna.$(OBJEXT)
+	-rm -f dim_v19r15/src/dna.lo
+	-rm -f dim_v19r15/src/dns.$(OBJEXT)
+	-rm -f dim_v19r15/src/dtq.$(OBJEXT)
+	-rm -f dim_v19r15/src/dtq.lo
+	-rm -f dim_v19r15/src/hash.$(OBJEXT)
+	-rm -f dim_v19r15/src/hash.lo
+	-rm -f dim_v19r15/src/open_dns.$(OBJEXT)
+	-rm -f dim_v19r15/src/open_dns.lo
+	-rm -f dim_v19r15/src/sll.$(OBJEXT)
+	-rm -f dim_v19r15/src/sll.lo
+	-rm -f dim_v19r15/src/swap.$(OBJEXT)
+	-rm -f dim_v19r15/src/swap.lo
+	-rm -f dim_v19r15/src/tcpip.$(OBJEXT)
+	-rm -f dim_v19r15/src/tcpip.lo
+	-rm -f dim_v19r15/src/tokenstring.$(OBJEXT)
+	-rm -f dim_v19r15/src/tokenstring.lo
+	-rm -f dim_v19r15/src/utilities.$(OBJEXT)
+	-rm -f dim_v19r15/src/utilities.lo
+	-rm -f src/Configuration.$(OBJEXT)
+	-rm -f src/Configuration.lo
+	-rm -f src/Connection.$(OBJEXT)
+	-rm -f src/Connection.lo
+	-rm -f src/Console.$(OBJEXT)
+	-rm -f src/Console.lo
+	-rm -f src/Converter.$(OBJEXT)
+	-rm -f src/Converter.lo
+	-rm -f src/DimErrorRedirecter.$(OBJEXT)
+	-rm -f src/DimErrorRedirecter.lo
+	-rm -f src/Event.$(OBJEXT)
+	-rm -f src/Event.lo
+	-rm -f src/EventImp.$(OBJEXT)
+	-rm -f src/EventImp.lo
+	-rm -f src/LocalControl.$(OBJEXT)
+	-rm -f src/MessageDim.$(OBJEXT)
+	-rm -f src/MessageDim.lo
+	-rm -f src/MessageImp.$(OBJEXT)
+	-rm -f src/MessageImp.lo
+	-rm -f src/Readline.$(OBJEXT)
+	-rm -f src/Readline.lo
+	-rm -f src/ReadlineWindow.$(OBJEXT)
+	-rm -f src/ReadlineWindow.lo
+	-rm -f src/RemoteControl.$(OBJEXT)
+	-rm -f src/ServiceList.$(OBJEXT)
+	-rm -f src/ServiceList.lo
+	-rm -f src/Shell.$(OBJEXT)
+	-rm -f src/Shell.lo
+	-rm -f src/StateMachine.$(OBJEXT)
+	-rm -f src/StateMachine.lo
+	-rm -f src/StateMachineDim.$(OBJEXT)
+	-rm -f src/StateMachineDim.lo
+	-rm -f src/StateMachineImp.$(OBJEXT)
+	-rm -f src/StateMachineImp.lo
+	-rm -f src/Time.$(OBJEXT)
+	-rm -f src/Time.lo
+	-rm -f src/WindowLog.$(OBJEXT)
+	-rm -f src/WindowLog.lo
+	-rm -f src/argv.$(OBJEXT)
+	-rm -f src/dclient5.$(OBJEXT)
+	-rm -f src/dserver2.$(OBJEXT)
+	-rm -f src/log.$(OBJEXT)
+	-rm -f src/logtime.$(OBJEXT)
+	-rm -f src/test3.$(OBJEXT)
+	-rm -f src/time.$(OBJEXT)
+	-rm -f src/tools.$(OBJEXT)
+	-rm -f src/tools.lo
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/conn_handler.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/copy_swap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/diccpp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dim_thr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dimcpp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dis.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/discpp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dll.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dna.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dns.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/dtq.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/hash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/open_dns.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/sll.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/swap.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/tcpip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/tokenstring.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/$(DEPDIR)/utilities.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/did/$(DEPDIR)/did-did.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Configuration.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Connection.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Console.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Converter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/DimErrorRedirecter.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Event.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/EventImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/LocalControl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/MessageDim.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/MessageImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Readline.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ReadlineWindow.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/RemoteControl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ServiceList.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Shell.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/StateMachine.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/StateMachineDim.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/StateMachineImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/Time.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/WindowLog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/argv.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dclient5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dserver2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/log.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/logtime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/test3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/time.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/tools.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+dim_v19r15/src/did/did-did.o: dim_v19r15/src/did/did.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dim_v19r15/src/did/did-did.o -MD -MP -MF dim_v19r15/src/did/$(DEPDIR)/did-did.Tpo -c -o dim_v19r15/src/did/did-did.o `test -f 'dim_v19r15/src/did/did.c' || echo '$(srcdir)/'`dim_v19r15/src/did/did.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) dim_v19r15/src/did/$(DEPDIR)/did-did.Tpo dim_v19r15/src/did/$(DEPDIR)/did-did.Po
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='dim_v19r15/src/did/did.c' object='dim_v19r15/src/did/did-did.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dim_v19r15/src/did/did-did.o `test -f 'dim_v19r15/src/did/did.c' || echo '$(srcdir)/'`dim_v19r15/src/did/did.c
+
+dim_v19r15/src/did/did-did.obj: dim_v19r15/src/did/did.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dim_v19r15/src/did/did-did.obj -MD -MP -MF dim_v19r15/src/did/$(DEPDIR)/did-did.Tpo -c -o dim_v19r15/src/did/did-did.obj `if test -f 'dim_v19r15/src/did/did.c'; then $(CYGPATH_W) 'dim_v19r15/src/did/did.c'; else $(CYGPATH_W) '$(srcdir)/dim_v19r15/src/did/did.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) dim_v19r15/src/did/$(DEPDIR)/did-did.Tpo dim_v19r15/src/did/$(DEPDIR)/did-did.Po
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='dim_v19r15/src/did/did.c' object='dim_v19r15/src/did/did-did.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dim_v19r15/src/did/did-did.obj `if test -f 'dim_v19r15/src/did/did.c'; then $(CYGPATH_W) 'dim_v19r15/src/did/did.c'; else $(CYGPATH_W) '$(srcdir)/dim_v19r15/src/did/did.c'; fi`
+
+dim_v19r15/src/did/did-dui_util.o: dim_v19r15/src/did/dui_util.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dim_v19r15/src/did/did-dui_util.o -MD -MP -MF dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Tpo -c -o dim_v19r15/src/did/did-dui_util.o `test -f 'dim_v19r15/src/did/dui_util.c' || echo '$(srcdir)/'`dim_v19r15/src/did/dui_util.c
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Tpo dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Po
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='dim_v19r15/src/did/dui_util.c' object='dim_v19r15/src/did/did-dui_util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dim_v19r15/src/did/did-dui_util.o `test -f 'dim_v19r15/src/did/dui_util.c' || echo '$(srcdir)/'`dim_v19r15/src/did/dui_util.c
+
+dim_v19r15/src/did/did-dui_util.obj: dim_v19r15/src/did/dui_util.c
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dim_v19r15/src/did/did-dui_util.obj -MD -MP -MF dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Tpo -c -o dim_v19r15/src/did/did-dui_util.obj `if test -f 'dim_v19r15/src/did/dui_util.c'; then $(CYGPATH_W) 'dim_v19r15/src/did/dui_util.c'; else $(CYGPATH_W) '$(srcdir)/dim_v19r15/src/did/dui_util.c'; fi`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Tpo dim_v19r15/src/did/$(DEPDIR)/did-dui_util.Po
+@am__fastdepCC_FALSE@	$(AM_V_CC) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='dim_v19r15/src/did/dui_util.c' object='dim_v19r15/src/did/did-dui_util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(did_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dim_v19r15/src/did/did-dui_util.obj `if test -f 'dim_v19r15/src/did/dui_util.c'; then $(CYGPATH_W) 'dim_v19r15/src/did/dui_util.c'; else $(CYGPATH_W) '$(srcdir)/dim_v19r15/src/did/dui_util.c'; fi`
+
+.cc.o:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+.cxx.o:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ $<
+
+.cxx.obj:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCXX_TRUE@	$(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cxx.lo:
+@am__fastdepCXX_TRUE@	$(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCXX_TRUE@	$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCXX_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@am__fastdepCXX_FALSE@	$(AM_V_CXX) @AM_BACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@	DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@	$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+	-rm -rf dim_v19r15/src/.libs dim_v19r15/src/_libs
+	-rm -rf src/.libs src/_libs
+
+distclean-libtool:
+	-rm -f libtool config.lt
+install-libDimCpp_laHEADERS: $(libDimCpp_la_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(libDimCpp_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libDimCpp_ladir)"
+	@list='$(libDimCpp_la_HEADERS)'; test -n "$(libDimCpp_ladir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libDimCpp_ladir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libDimCpp_ladir)" || exit $$?; \
+	done
+
+uninstall-libDimCpp_laHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(libDimCpp_la_HEADERS)'; test -n "$(libDimCpp_ladir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(libDimCpp_ladir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(libDimCpp_ladir)" && rm -f $$files
+install-libDim_laHEADERS: $(libDim_la_HEADERS)
+	@$(NORMAL_INSTALL)
+	test -z "$(libDim_ladir)" || $(MKDIR_P) "$(DESTDIR)$(libDim_ladir)"
+	@list='$(libDim_la_HEADERS)'; test -n "$(libDim_ladir)" || list=; \
+	for p in $$list; do \
+	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+	  echo "$$d$$p"; \
+	done | $(am__base_list) | \
+	while read files; do \
+	  echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libDim_ladir)'"; \
+	  $(INSTALL_HEADER) $$files "$(DESTDIR)$(libDim_ladir)" || exit $$?; \
+	done
+
+uninstall-libDim_laHEADERS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(libDim_la_HEADERS)'; test -n "$(libDim_ladir)" || list=; \
+	files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+	test -n "$$files" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(libDim_ladir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(libDim_ladir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	test -d "$(distdir)" || mkdir "$(distdir)"
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+	-test -n "$(am__skip_mode_fix)" \
+	|| find "$(distdir)" -type d ! -perm -755 \
+		-exec chmod u+rwx,go+rx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist-bzip2: distdir
+	tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+	$(am__remove_distdir)
+
+dist-lzma: distdir
+	tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+	$(am__remove_distdir)
+
+dist-xz: distdir
+	tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+	$(am__remove_distdir)
+dist-tarZ: distdir
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+dist-shar: distdir
+	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+	$(am__remove_distdir)
+
+dist-zip: distdir
+	-rm -f $(distdir).zip
+	zip -rq $(distdir).zip $(distdir)
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	case '$(DIST_ARCHIVES)' in \
+	*.tar.gz*) \
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+	*.tar.bz2*) \
+	  bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+	*.tar.lzma*) \
+	  lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+	*.tar.xz*) \
+	  xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+	*.tar.Z*) \
+	  uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+	*.shar.gz*) \
+	  GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+	*.zip*) \
+	  unzip $(distdir).zip ;;\
+	esac
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/_build
+	mkdir $(distdir)/_inst
+	chmod a-w $(distdir)
+	test -d $(distdir)/_build || exit 0; \
+	dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && am__cwd=`pwd` \
+	  && $(am__cd) $(distdir)/_build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({ \
+	       (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist \
+	  && rm -rf $(DIST_ARCHIVES) \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+	  && cd "$$am__cwd" \
+	  || exit 1
+	$(am__remove_distdir)
+	@(echo "$(distdir) archives ready for distribution: "; \
+	  list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+	  sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+	@$(am__cd) '$(distuninstallcheck_dir)' \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	@if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS)
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+	for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libDimCpp_ladir)" "$(DESTDIR)$(libDim_ladir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+	-rm -f dim_v19r15/src/$(DEPDIR)/$(am__dirstamp)
+	-rm -f dim_v19r15/src/$(am__dirstamp)
+	-rm -f dim_v19r15/src/did/$(DEPDIR)/$(am__dirstamp)
+	-rm -f dim_v19r15/src/did/$(am__dirstamp)
+	-rm -f src/$(DEPDIR)/$(am__dirstamp)
+	-rm -f src/$(am__dirstamp)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf dim_v19r15/src/$(DEPDIR) dim_v19r15/src/did/$(DEPDIR) src/$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-libDimCpp_laHEADERS install-libDim_laHEADERS
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am: installcheck-binPROGRAMS
+
+maintainer-clean: maintainer-clean-am
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf $(top_srcdir)/autom4te.cache
+	-rm -rf dim_v19r15/src/$(DEPDIR) dim_v19r15/src/did/$(DEPDIR) src/$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-libDimCpp_laHEADERS \
+	uninstall-libDim_laHEADERS uninstall-libLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
+	clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \
+	clean-libtool ctags dist dist-all dist-bzip2 dist-gzip \
+	dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am html html-am info info-am \
+	install install-am install-binPROGRAMS install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-libDimCpp_laHEADERS \
+	install-libDim_laHEADERS install-libLTLIBRARIES install-man \
+	install-pdf install-pdf-am install-ps install-ps-am \
+	install-strip installcheck installcheck-am \
+	installcheck-binPROGRAMS installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS \
+	uninstall-libDimCpp_laHEADERS uninstall-libDim_laHEADERS \
+	uninstall-libLTLIBRARIES
+
+@DX_COND_doc_TRUE@@DX_CONFIG@:
+@DX_COND_doc_TRUE@	$(DX_DOXYGEN) -g
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	cd @DX_DOCDIR@/latex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	$(DX_LATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	$(MAKEINDEX_PATH) refman.idx; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	$(DX_LATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	countdown=5; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@		refman.log > /dev/null 2>&1 && test $$countdown -gt 0; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	do \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@		$(DX_LATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@		countdown=`expr $$countdown - 1`; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	done; \
+@DX_COND_doc_TRUE@@DX_COND_ps_TRUE@	$(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	cd @DX_DOCDIR@/latex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	$(DX_PDFLATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	$(DX_MAKEINDEX) refman.idx; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	$(DX_PDFLATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	countdown=5; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@		refman.log > /dev/null 2>&1 && test $$countdown -gt 0; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	do \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@		$(DX_PDFLATEX) refman.tex; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@		countdown=`expr $$countdown - 1`; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	done; \
+@DX_COND_doc_TRUE@@DX_COND_pdf_TRUE@	mv refman.pdf ../@PACKAGE@.pdf
+@DX_COND_doc_TRUE@.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_COND_doc_TRUE@.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_COND_doc_TRUE@doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+@DX_COND_doc_TRUE@doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_COND_doc_TRUE@@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+@DX_COND_doc_TRUE@	rm -rf @DX_DOCDIR@
+@DX_COND_doc_TRUE@	$(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+
+# Overwrite rules for silent or other verbosity levels
+# pkg_verbose = $(pkg_verbose_$(V))
+#               pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY))
+#               pkg_verbose_0 = @echo GEN $@;
+#               
+#               foo: foo.in
+#                       $(pkg_verbose)cp $(srcdir)/foo.in $@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Index: /trunk/FACT++/aclocal.m4
===================================================================
--- /trunk/FACT++/aclocal.m4	(revision 10183)
+++ /trunk/FACT++/aclocal.m4	(revision 10183)
@@ -0,0 +1,2555 @@
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
+[m4_warning([this file was generated for autoconf 2.67.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# ===========================================================================
+#             http://autoconf-archive.cryp.to/ax_boost_asio.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_ASIO
+#
+# DESCRIPTION
+#
+#   Test for Asio library from the Boost C++ libraries. The macro requires a
+#   preceding call to AX_BOOST_BASE. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_ASIO_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_ASIO
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
+#   Copyright (c) 2008 Pete Greenwell <pete@mu.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_ASIO],
+[
+	AC_ARG_WITH([boost-asio],
+	AS_HELP_STRING([--with-boost-asio@<:@=special-lib@:>@],
+                   [use the ASIO library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-asio=boost_system-gcc41-mt-1_34 ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_asio_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_asio_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::ASIO library is available,
+					   ax_cv_boost_asio,
+        [AC_LANG_PUSH([C++])
+		 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ @%:@include <boost/asio.hpp>
+											]],
+                                  [[
+
+                                    boost::asio::io_service io;
+                                    boost::system::error_code timer_result;
+                                    boost::asio::deadline_timer t(io);
+                                    t.cancel();
+                                    io.run_one();
+									return 0;
+                                   ]]),
+                             ax_cv_boost_asio=yes, ax_cv_boost_asio=no)
+         AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_asio" = "xyes"; then
+			AC_DEFINE(HAVE_BOOST_ASIO,,[define if the Boost::ASIO library is available])
+			BN=boost_system
+            if test "x$ax_boost_user_asio_lib" = "x"; then
+				for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
+                              lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
+                              $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
+				    AC_CHECK_LIB($ax_lib, main, [BOOST_ASIO_LIB="-l$ax_lib" AC_SUBST(BOOST_ASIO_LIB) link_thread="yes" break],
+                                 [link_thread="no"])
+  				done
+            else
+               for ax_lib in $ax_boost_user_asio_lib $BN-$ax_boost_user_asio_lib; do
+				      AC_CHECK_LIB($ax_lib, main,
+                                   [BOOST_ASIO_LIB="-l$ax_lib" AC_SUBST(BOOST_ASIO_LIB) link_asio="yes" break],
+                                   [link_asio="no"])
+                  done
+
+            fi
+			if test "x$link_asio" = "xno"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#             http://autoconf-archive.cryp.to/ax_boost_base.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_BASE([MINIMUM-VERSION])
+#
+# DESCRIPTION
+#
+#   Test for the Boost C++ libraries of a particular version (or newer)
+#
+#   If no path to the installed boost library is given the macro searchs
+#   under /usr, /usr/local, /opt and /opt/local and evaluates the
+#   $BOOST_ROOT environment variable. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
+#
+#   And sets:
+#
+#     HAVE_BOOST
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_BASE],
+[
+AC_ARG_WITH([boost],
+	AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
+	[
+    if test "$withval" = "no"; then
+		want_boost="no"
+    elif test "$withval" = "yes"; then
+        want_boost="yes"
+        ac_boost_path=""
+    else
+	    want_boost="yes"
+        ac_boost_path="$withval"
+	fi
+    ],
+    [want_boost="yes"])
+
+
+AC_ARG_WITH([boost-libdir],
+        AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
+        [Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
+        [
+        if test -d $withval
+        then
+                ac_boost_lib_path="$withval"
+        else
+                AC_MSG_ERROR(--with-boost-libdir expected directory name)
+        fi
+        ],
+        [ac_boost_lib_path=""]
+)
+
+if test "x$want_boost" = "xyes"; then
+	boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
+	boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
+	boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
+	boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
+	boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
+	if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+		boost_lib_version_req_sub_minor="0"
+    	fi
+	WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+	AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
+	succeeded=no
+
+	dnl first we check the system location for boost libraries
+	dnl this location ist chosen if boost libraries are installed with the --layout=system option
+	dnl or if you install boost with RPM
+	if test "$ac_boost_path" != ""; then
+		BOOST_LDFLAGS="-L$ac_boost_path/lib"
+		BOOST_CPPFLAGS="-I$ac_boost_path/include"
+	else
+		for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+			if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+				BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
+				BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+				break;
+			fi
+		done
+	fi
+
+    dnl overwrite ld flags if we have required special directory with
+    dnl --with-boost-libdir parameter
+    if test "$ac_boost_lib_path" != ""; then
+       BOOST_LDFLAGS="-L$ac_boost_lib_path"
+    fi
+
+	CPPFLAGS_SAVED="$CPPFLAGS"
+	CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+	export CPPFLAGS
+
+	LDFLAGS_SAVED="$LDFLAGS"
+	LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+	export LDFLAGS
+
+	AC_LANG_PUSH(C++)
+     	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+	@%:@include <boost/version.hpp>
+	]], [[
+	#if BOOST_VERSION >= $WANT_BOOST_VERSION
+	// Everything is okay
+	#else
+	#  error Boost version is too old
+	#endif
+	]])],[
+        AC_MSG_RESULT(yes)
+	succeeded=yes
+	found_system=yes
+       	],[
+       	])
+	AC_LANG_POP([C++])
+
+
+
+	dnl if we found no boost with system layout we search for boost libraries
+	dnl built and installed without the --layout=system option or for a staged(not installed) version
+	if test "x$succeeded" != "xyes"; then
+		_version=0
+		if test "$ac_boost_path" != ""; then
+			if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+				for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+					_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+					V_CHECK=`expr $_version_tmp \> $_version`
+					if test "$V_CHECK" = "1" ; then
+						_version=$_version_tmp
+					fi
+					VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+					BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+				done
+			fi
+		else
+			for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+				if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+					for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+						_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+						V_CHECK=`expr $_version_tmp \> $_version`
+						if test "$V_CHECK" = "1" ; then
+							_version=$_version_tmp
+	               					best_path=$ac_boost_path
+						fi
+					done
+				fi
+			done
+
+			VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+			BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+            if test "$ac_boost_lib_path" = ""
+            then
+               BOOST_LDFLAGS="-L$best_path/lib"
+            fi
+
+	    		if test "x$BOOST_ROOT" != "x"; then
+				if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
+					version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+					stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+			        	stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
+					V_CHECK=`expr $stage_version_shorten \>\= $_version`
+                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+						AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
+						BOOST_CPPFLAGS="-I$BOOST_ROOT"
+						BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
+					fi
+				fi
+	    		fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+		AC_LANG_PUSH(C++)
+	     	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+		@%:@include <boost/version.hpp>
+		]], [[
+		#if BOOST_VERSION >= $WANT_BOOST_VERSION
+		// Everything is okay
+		#else
+		#  error Boost version is too old
+		#endif
+		]])],[
+        	AC_MSG_RESULT(yes)
+		succeeded=yes
+		found_system=yes
+       		],[
+	       	])
+		AC_LANG_POP([C++])
+	fi
+
+	if test "$succeeded" != "yes" ; then
+		if test "$_version" = "0" ; then
+			AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
+		else
+			AC_MSG_NOTICE([Your boost libraries seems to old (version $_version).])
+		fi
+	else
+		AC_SUBST(BOOST_CPPFLAGS)
+		AC_SUBST(BOOST_LDFLAGS)
+		AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
+	fi
+
+        CPPFLAGS="$CPPFLAGS_SAVED"
+       	LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+])
+
+# ===========================================================================
+#           http://autoconf-archive.cryp.to/ax_boost_date_time.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_DATE_TIME
+#
+# DESCRIPTION
+#
+#   Test for Date_Time library from the Boost C++ libraries. The macro
+#   requires a preceding call to AX_BOOST_BASE. Further documentation is
+#   available at <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_DATE_TIME_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_DATE_TIME
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
+#   Copyright (c) 2008 Michael Tindal
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_DATE_TIME],
+[
+	AC_ARG_WITH([boost-date-time],
+	AS_HELP_STRING([--with-boost-date-time@<:@=special-lib@:>@],
+                   [use the Date_Time library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1 ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_date_time_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_date_time_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::Date_Time library is available,
+					   ax_cv_boost_date_time,
+        [AC_LANG_PUSH([C++])
+		 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/date_time/gregorian/gregorian_types.hpp>]],
+                                   [[using namespace boost::gregorian; date d(2002,Jan,10);
+                                     return 0;
+                                   ]]),
+         ax_cv_boost_date_time=yes, ax_cv_boost_date_time=no)
+         AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_date_time" = "xyes"; then
+			AC_DEFINE(HAVE_BOOST_DATE_TIME,,[define if the Boost::Date_Time library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+            if test "x$ax_boost_user_date_time_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_date_time*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_date_time.*\)\.so.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
+                                 [link_date_time="no"])
+  				done
+                if test "x$link_date_time" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_date_time*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_date_time.*\)\.dll.*$;\1;' -e 's;^\(boost_date_time.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
+                                 [link_date_time="no"])
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_date_time_lib boost_date_time-$ax_boost_user_date_time_lib; do
+				      AC_CHECK_LIB($ax_lib, main,
+                                   [BOOST_DATE_TIME_LIB="-l$ax_lib"; AC_SUBST(BOOST_DATE_TIME_LIB) link_date_time="yes"; break],
+                                   [link_date_time="no"])
+                  done
+
+            fi
+			if test "x$link_date_time" != "xyes"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#          http://autoconf-archive.cryp.to/ax_boost_filesystem.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_FILESYSTEM
+#
+# DESCRIPTION
+#
+#   Test for Filesystem library from the Boost C++ libraries. The macro
+#   requires a preceding call to AX_BOOST_BASE. Further documentation is
+#   available at <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_FILESYSTEM_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_FILESYSTEM
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
+#   Copyright (c) 2009 Michael Tindal
+#   Copyright (c) 2009 Roman Rybalko <libtorrent@romanr.info>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_FILESYSTEM],
+[
+	AC_ARG_WITH([boost-filesystem],
+	AS_HELP_STRING([--with-boost-filesystem@<:@=special-lib@:>@],
+                   [use the Filesystem library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-filesystem=boost_filesystem-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_filesystem_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_filesystem_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+		LIBS_SAVED=$LIBS
+		LIBS="$LIBS $BOOST_SYSTEM_LIB"
+		export LIBS
+
+        AC_CACHE_CHECK(whether the Boost::Filesystem library is available,
+					   ax_cv_boost_filesystem,
+        [AC_LANG_PUSH([C++])
+         AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/filesystem/path.hpp>]],
+                                   [[using namespace boost::filesystem;
+                                   path my_path( "foo/bar/data.txt" );
+                                   return 0;]]),
+            				       ax_cv_boost_filesystem=yes, ax_cv_boost_filesystem=no)
+         AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_filesystem" = "xyes"; then
+			AC_DEFINE(HAVE_BOOST_FILESYSTEM,,[define if the Boost::Filesystem library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+            if test "x$ax_boost_user_filesystem_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.{so,dylib,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                 [link_filesystem="no"])
+  				done
+                if test "x$link_program_options" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                 [link_filesystem="no"])
+  				done
+	            fi
+            else
+               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
+				      AC_CHECK_LIB($ax_lib, exit,
+                                   [BOOST_FILESYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_FILESYSTEM_LIB) link_filesystem="yes"; break],
+                                   [link_filesystem="no"])
+                  done
+
+            fi
+			if test "x$link_filesystem" != "xyes"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    		LDFLAGS="$LDFLAGS_SAVED"
+		LIBS="$LIBS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#        http://autoconf-archive.cryp.to/ax_boost_program_options.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_PROGRAM_OPTIONS
+#
+# DESCRIPTION
+#
+#   Test for program options library from the Boost C++ libraries. The macro
+#   requires a preceding call to AX_BOOST_BASE. Further documentation is
+#   available at <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_PROGRAM_OPTIONS
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_PROGRAM_OPTIONS],
+[
+	AC_ARG_WITH([boost-program-options],
+		AS_HELP_STRING([--with-boost-program-options@<:@=special-lib@:>@],
+                       [use the program options library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-program-options=boost_program_options-gcc-mt-1_33_1 ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_program_options_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_program_options_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+	    export want_boost
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+		AC_CACHE_CHECK([whether the Boost::Program_Options library is available],
+					   ax_cv_boost_program_options,
+					   [AC_LANG_PUSH(C++)
+ 		                AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/program_options.hpp>
+                                                          ]],
+                                  [[boost::program_options::options_description generic("Generic options");
+                                   return 0;]]),
+                           ax_cv_boost_program_options=yes, ax_cv_boost_program_options=no)
+			               	AC_LANG_POP([C++])
+		])
+		if test "$ax_cv_boost_program_options" = yes; then
+				AC_DEFINE(HAVE_BOOST_PROGRAM_OPTIONS,,[define if the Boost::PROGRAM_OPTIONS library is available])
+                  BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+                if test "x$ax_boost_user_program_options_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break],
+                                 [link_program_options="no"])
+  				done
+                if test "x$link_program_options" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break],
+                                 [link_program_options="no"])
+  				done
+                fi
+                else
+                  for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do
+				      AC_CHECK_LIB($ax_lib, main,
+                                   [BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib"; AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB) link_program_options="yes"; break],
+                                   [link_program_options="no"])
+                  done
+                fi
+				if test "x$link_program_options" != "xyes"; then
+					AC_MSG_ERROR([Could not link against [$ax_lib] !])
+				fi
+		fi
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#             http://autoconf-archive.cryp.to/ax_boost_regex.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_REGEX
+#
+# DESCRIPTION
+#
+#   Test for Regex library from the Boost C++ libraries. The macro requires
+#   a preceding call to AX_BOOST_BASE. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_REGEX_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_REGEX
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
+#   Copyright (c) 2008 Michael Tindal
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_REGEX],
+[
+	AC_ARG_WITH([boost-regex],
+	AS_HELP_STRING([--with-boost-regex@<:@=special-lib@:>@],
+                   [use the Regex library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-regex=boost_regex-gcc-mt-d-1_33_1 ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_regex_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_regex_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::Regex library is available,
+					   ax_cv_boost_regex,
+        [AC_LANG_PUSH([C++])
+			 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/regex.hpp>
+												]],
+                                   [[boost::regex r(); return 0;]]),
+                   ax_cv_boost_regex=yes, ax_cv_boost_regex=no)
+         AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_regex" = "xyes"; then
+			AC_DEFINE(HAVE_BOOST_REGEX,,[define if the Boost::Regex library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+            if test "x$ax_boost_user_regex_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_regex*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
+                                 [link_regex="no"])
+  				done
+                if test "x$link_regex" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_regex*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
+                                 [link_regex="no"])
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_regex_lib boost_regex-$ax_boost_user_regex_lib; do
+				      AC_CHECK_LIB($ax_lib, main,
+                                   [BOOST_REGEX_LIB="-l$ax_lib"; AC_SUBST(BOOST_REGEX_LIB) link_regex="yes"; break],
+                                   [link_regex="no"])
+               done
+            fi
+			if test "x$link_regex" != "xyes"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#            http://autoconf-archive.cryp.to/ax_boost_system.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_SYSTEM
+#
+# DESCRIPTION
+#
+#   Test for System library from the Boost C++ libraries. The macro requires
+#   a preceding call to AX_BOOST_BASE. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_SYSTEM_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_SYSTEM
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
+#   Copyright (c) 2008 Michael Tindal
+#   Copyright (c) 2008 Daniel Casimiro <dan.casimiro@gmail.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_SYSTEM],
+[
+	AC_ARG_WITH([boost-system],
+	AS_HELP_STRING([--with-boost-system@<:@=special-lib@:>@],
+                   [use the System library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-system=boost_system-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_system_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_system_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+        AC_REQUIRE([AC_CANONICAL_BUILD])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::System library is available,
+					   ax_cv_boost_system,
+        [AC_LANG_PUSH([C++])
+			 CXXFLAGS_SAVE=$CXXFLAGS
+
+			 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/system/error_code.hpp>]],
+                                   [[boost::system::system_category]]),
+                   ax_cv_boost_system=yes, ax_cv_boost_system=no)
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_system" = "xyes"; then
+			AC_SUBST(BOOST_CPPFLAGS)
+
+			AC_DEFINE(HAVE_BOOST_SYSTEM,,[define if the Boost::System library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+
+			LDFLAGS_SAVE=$LDFLAGS
+            if test "x$ax_boost_user_system_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_system*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
+                                 [link_system="no"])
+  				done
+                if test "x$link_system" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
+                                 [link_system="no"])
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
+				      AC_CHECK_LIB($ax_lib, exit,
+                                   [BOOST_SYSTEM_LIB="-l$ax_lib"; AC_SUBST(BOOST_SYSTEM_LIB) link_system="yes"; break],
+                                   [link_system="no"])
+                  done
+
+            fi
+			if test "x$link_system" = "xno"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#            http://autoconf-archive.cryp.to/ax_boost_thread.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_BOOST_THREAD
+#
+# DESCRIPTION
+#
+#   Test for Thread library from the Boost C++ libraries. The macro requires
+#   a preceding call to AX_BOOST_BASE. Further documentation is available at
+#   <http://randspringer.de/boost/index.html>.
+#
+#   This macro calls:
+#
+#     AC_SUBST(BOOST_THREAD_LIB)
+#
+#   And sets:
+#
+#     HAVE_BOOST_THREAD
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Thomas Porschberg <thomas@randspringer.de>
+#   Copyright (c) 2009 Michael Tindal
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+AC_DEFUN([AX_BOOST_THREAD],
+[
+	AC_ARG_WITH([boost-thread],
+	AS_HELP_STRING([--with-boost-thread@<:@=special-lib@:>@],
+                   [use the Thread library from boost - it is possible to specify a certain library for the linker
+                        e.g. --with-boost-thread=boost_thread-gcc-mt ]),
+        [
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_thread_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_thread_lib="$withval"
+		fi
+        ],
+        [want_boost="yes"]
+	)
+
+	if test "x$want_boost" = "xyes"; then
+        AC_REQUIRE([AC_PROG_CC])
+        AC_REQUIRE([AC_CANONICAL_BUILD])
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        AC_CACHE_CHECK(whether the Boost::Thread library is available,
+					   ax_cv_boost_thread,
+        [AC_LANG_PUSH([C++])
+			 CXXFLAGS_SAVE=$CXXFLAGS
+
+			 if test "x$build_os" = "xsolaris" ; then
+  				 CXXFLAGS="-pthreads $CXXFLAGS"
+			 elif test "x$build_os" = "xming32" ; then
+				 CXXFLAGS="-mthreads $CXXFLAGS"
+			 else
+				CXXFLAGS="-pthread $CXXFLAGS"
+			 fi
+			 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[@%:@include <boost/thread/thread.hpp>]],
+                                   [[boost::thread_group thrds;
+                                   return 0;]]),
+                   ax_cv_boost_thread=yes, ax_cv_boost_thread=no)
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             AC_LANG_POP([C++])
+		])
+		if test "x$ax_cv_boost_thread" = "xyes"; then
+           if test "x$build_os" = "xsolaris" ; then
+			  BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
+		   elif test "x$build_os" = "xming32" ; then
+			  BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
+		   else
+			  BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
+		   fi
+
+			AC_SUBST(BOOST_CPPFLAGS)
+
+			AC_DEFINE(HAVE_BOOST_THREAD,,[define if the Boost::Thread library is available])
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
+
+			LDFLAGS_SAVE=$LDFLAGS
+                        case "x$build_os" in
+                          *bsd* )
+                               LDFLAGS="-pthread $LDFLAGS"
+                          break;
+                          ;;
+                        esac
+            if test "x$ax_boost_user_thread_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
+                                 [link_thread="no"])
+  				done
+                if test "x$link_thread" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    AC_CHECK_LIB($ax_lib, exit,
+                                 [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
+                                 [link_thread="no"])
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
+				      AC_CHECK_LIB($ax_lib, exit,
+                                   [BOOST_THREAD_LIB="-l$ax_lib"; AC_SUBST(BOOST_THREAD_LIB) link_thread="yes"; break],
+                                   [link_thread="no"])
+                  done
+
+            fi
+			if test "x$link_thread" = "xno"; then
+				AC_MSG_ERROR(Could not link against $ax_lib !)
+                        else
+                           case "x$build_os" in
+                              *bsd* )
+			        BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
+                              break;
+                              ;;
+                           esac
+
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+])
+
+# ===========================================================================
+#            http://autoconf-archive.cryp.to/ax_prog_doxygen.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   DX_INIT_DOXYGEN(PROJECT-NAME, DOXYFILE-PATH, [OUTPUT-DIR])
+#   DX_DOXYGEN_FEATURE(ON|OFF)
+#   DX_DOT_FEATURE(ON|OFF)
+#   DX_HTML_FEATURE(ON|OFF)
+#   DX_CHM_FEATURE(ON|OFF)
+#   DX_CHI_FEATURE(ON|OFF)
+#   DX_MAN_FEATURE(ON|OFF)
+#   DX_RTF_FEATURE(ON|OFF)
+#   DX_XML_FEATURE(ON|OFF)
+#   DX_PDF_FEATURE(ON|OFF)
+#   DX_PS_FEATURE(ON|OFF)
+#
+# DESCRIPTION
+#
+#   The DX_*_FEATURE macros control the default setting for the given
+#   Doxygen feature. Supported features are 'DOXYGEN' itself, 'DOT' for
+#   generating graphics, 'HTML' for plain HTML, 'CHM' for compressed HTML
+#   help (for MS users), 'CHI' for generating a seperate .chi file by the
+#   .chm file, and 'MAN', 'RTF', 'XML', 'PDF' and 'PS' for the appropriate
+#   output formats. The environment variable DOXYGEN_PAPER_SIZE may be
+#   specified to override the default 'a4wide' paper size.
+#
+#   By default, HTML, PDF and PS documentation is generated as this seems to
+#   be the most popular and portable combination. MAN pages created by
+#   Doxygen are usually problematic, though by picking an appropriate subset
+#   and doing some massaging they might be better than nothing. CHM and RTF
+#   are specific for MS (note that you can't generate both HTML and CHM at
+#   the same time). The XML is rather useless unless you apply specialized
+#   post-processing to it.
+#
+#   The macros mainly control the default state of the feature. The use can
+#   override the default by specifying --enable or --disable. The macros
+#   ensure that contradictory flags are not given (e.g.,
+#   --enable-doxygen-html and --enable-doxygen-chm,
+#   --enable-doxygen-anything with --disable-doxygen, etc.) Finally, each
+#   feature will be automatically disabled (with a warning) if the required
+#   programs are missing.
+#
+#   Once all the feature defaults have been specified, call DX_INIT_DOXYGEN
+#   with the following parameters: a one-word name for the project for use
+#   as a filename base etc., an optional configuration file name (the
+#   default is 'Doxyfile', the same as Doxygen's default), and an optional
+#   output directory name (the default is 'doxygen-doc').
+#
+#   Automake Support
+#
+#   The following is a template aminclude.am file for use with Automake.
+#   Make targets and variables values are controlled by the various
+#   DX_COND_* conditionals set by autoconf.
+#
+#   The provided targets are:
+#
+#     doxygen-doc: Generate all doxygen documentation.
+#
+#     doxygen-run: Run doxygen, which will generate some of the
+#                  documentation (HTML, CHM, CHI, MAN, RTF, XML)
+#                  but will not do the post processing required
+#                  for the rest of it (PS, PDF, and some MAN).
+#
+#     doxygen-man: Rename some doxygen generated man pages.
+#
+#     doxygen-ps:  Generate doxygen PostScript documentation.
+#
+#     doxygen-pdf: Generate doxygen PDF documentation.
+#
+#   Note that by default these are not integrated into the automake targets.
+#   If doxygen is used to generate man pages, you can achieve this
+#   integration by setting man3_MANS to the list of man pages generated and
+#   then adding the dependency:
+#
+#     $(man3_MANS): doxygen-doc
+#
+#   This will cause make to run doxygen and generate all the documentation.
+#
+#   The following variable is intended for use in Makefile.am:
+#
+#     DX_CLEANFILES = everything to clean.
+#
+#   Then add this variable to MOSTLYCLEANFILES.
+#
+#     ----- begin aminclude.am -------------------------------------
+#
+#     ## --------------------------------- ##
+#     ## Format-independent Doxygen rules. ##
+#     ## --------------------------------- ##
+#
+#     if DX_COND_doc
+#
+#     ## ------------------------------- ##
+#     ## Rules specific for HTML output. ##
+#     ## ------------------------------- ##
+#
+#     if DX_COND_html
+#
+#     DX_CLEAN_HTML = @DX_DOCDIR@/html
+#
+#     endif DX_COND_html
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for CHM output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_chm
+#
+#     DX_CLEAN_CHM = @DX_DOCDIR@/chm
+#
+#     if DX_COND_chi
+#
+#     DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+#
+#     endif DX_COND_chi
+#
+#     endif DX_COND_chm
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for MAN output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_man
+#
+#     DX_CLEAN_MAN = @DX_DOCDIR@/man
+#
+#     endif DX_COND_man
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for RTF output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_rtf
+#
+#     DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+#
+#     endif DX_COND_rtf
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for XML output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_xml
+#
+#     DX_CLEAN_XML = @DX_DOCDIR@/xml
+#
+#     endif DX_COND_xml
+#
+#     ## ----------------------------- ##
+#     ## Rules specific for PS output. ##
+#     ## ----------------------------- ##
+#
+#     if DX_COND_ps
+#
+#     DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+#
+#     DX_PS_GOAL = doxygen-ps
+#
+#     doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+#
+#     @DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+#   	  cd @DX_DOCDIR@/latex; \
+#   	  rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+#   	  $(DX_LATEX) refman.tex; \
+#   	  $(MAKEINDEX_PATH) refman.idx; \
+#   	  $(DX_LATEX) refman.tex; \
+#   	  countdown=5; \
+#   	  while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+#   			    refman.log > /dev/null 2>&1 \
+#   	     && test $$countdown -gt 0; do \
+#   	      $(DX_LATEX) refman.tex; \
+#   	      countdown=`expr $$countdown - 1`; \
+#   	  done; \
+#   	  $(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+#
+#     endif DX_COND_ps
+#
+#     ## ------------------------------ ##
+#     ## Rules specific for PDF output. ##
+#     ## ------------------------------ ##
+#
+#     if DX_COND_pdf
+#
+#     DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+#
+#     DX_PDF_GOAL = doxygen-pdf
+#
+#     doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+#
+#     @DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+#   	  cd @DX_DOCDIR@/latex; \
+#   	  rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+#   	  $(DX_PDFLATEX) refman.tex; \
+#   	  $(DX_MAKEINDEX) refman.idx; \
+#   	  $(DX_PDFLATEX) refman.tex; \
+#   	  countdown=5; \
+#   	  while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+#   			    refman.log > /dev/null 2>&1 \
+#   	     && test $$countdown -gt 0; do \
+#   	      $(DX_PDFLATEX) refman.tex; \
+#   	      countdown=`expr $$countdown - 1`; \
+#   	  done; \
+#   	  mv refman.pdf ../@PACKAGE@.pdf
+#
+#     endif DX_COND_pdf
+#
+#     ## ------------------------------------------------- ##
+#     ## Rules specific for LaTeX (shared for PS and PDF). ##
+#     ## ------------------------------------------------- ##
+#
+#     if DX_COND_latex
+#
+#     DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+#
+#     endif DX_COND_latex
+#
+#     .PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+#     .INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+#     doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+#
+#     doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+#
+#     @DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+#   	  rm -rf @DX_DOCDIR@
+#   	  $(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+#
+#     DX_CLEANFILES = \
+#         @DX_DOCDIR@/@PACKAGE@.tag \
+#         -r \
+#         $(DX_CLEAN_HTML) \
+#         $(DX_CLEAN_CHM) \
+#         $(DX_CLEAN_CHI) \
+#         $(DX_CLEAN_MAN) \
+#         $(DX_CLEAN_RTF) \
+#         $(DX_CLEAN_XML) \
+#         $(DX_CLEAN_PS) \
+#         $(DX_CLEAN_PDF) \
+#         $(DX_CLEAN_LATEX)
+#
+#     endif DX_COND_doc
+#
+#     ----- end aminclude.am ---------------------------------------
+#
+# LICENSE
+#
+#   Copyright (c) 2009 Oren Ben-Kiki <oren@ben-kiki.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved.
+
+
+DX_ENV=""
+AC_DEFUN([DX_FEATURE_doc],  ON)
+AC_DEFUN([DX_FEATURE_dot],  ON)
+AC_DEFUN([DX_FEATURE_man],  OFF)
+AC_DEFUN([DX_FEATURE_html], ON)
+AC_DEFUN([DX_FEATURE_chm],  OFF)
+AC_DEFUN([DX_FEATURE_chi],  OFF)
+AC_DEFUN([DX_FEATURE_rtf],  OFF)
+AC_DEFUN([DX_FEATURE_xml],  OFF)
+AC_DEFUN([DX_FEATURE_pdf],  ON)
+AC_DEFUN([DX_FEATURE_ps],   ON)
+
+
+# DX_ENV_APPEND(VARIABLE, VALUE)
+# ------------------------------
+# Append VARIABLE="VALUE" to DX_ENV for invoking doxygen.
+AC_DEFUN([DX_ENV_APPEND], [AC_SUBST([DX_ENV], ["$DX_ENV $1='$2'"])])
+
+# DX_DIRNAME_EXPR
+# ---------------
+# Expand into a shell expression prints the directory part of a path.
+AC_DEFUN([DX_DIRNAME_EXPR],
+         [[expr ".$1" : '\(\.\)[^/]*$' \| "x$1" : 'x\(.*\)/[^/]*$']])
+
+# DX_IF_FEATURE(FEATURE, IF-ON, IF-OFF)
+# -------------------------------------
+# Expands according to the M4 (static) status of the feature.
+AC_DEFUN([DX_IF_FEATURE], [ifelse(DX_FEATURE_$1, ON, [$2], [$3])])
+
+# DX_REQUIRE_PROG(VARIABLE, PROGRAM)
+# ----------------------------------
+# Require the specified program to be found for the DX_CURRENT_FEATURE to work.
+AC_DEFUN([DX_REQUIRE_PROG], [
+AC_PATH_TOOL([$1], [$2])
+if test "$DX_FLAG_[]DX_CURRENT_FEATURE$$1" = 1; then
+    AC_MSG_WARN([$2 not found - will not DX_CURRENT_DESCRIPTION])
+    AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+fi
+])
+
+# DX_TEST_FEATURE(FEATURE)
+# ------------------------
+# Expand to a shell expression testing whether the feature is active.
+AC_DEFUN([DX_TEST_FEATURE], [test "$DX_FLAG_$1" = 1])
+
+# DX_CHECK_DEPEND(REQUIRED_FEATURE, REQUIRED_STATE)
+# -------------------------------------------------
+# Verify that a required features has the right state before trying to turn on
+# the DX_CURRENT_FEATURE.
+AC_DEFUN([DX_CHECK_DEPEND], [
+test "$DX_FLAG_$1" = "$2" \
+|| AC_MSG_ERROR([doxygen-DX_CURRENT_FEATURE ifelse([$2], 1,
+                            requires, contradicts) doxygen-DX_CURRENT_FEATURE])
+])
+
+# DX_CLEAR_DEPEND(FEATURE, REQUIRED_FEATURE, REQUIRED_STATE)
+# ----------------------------------------------------------
+# Turn off the DX_CURRENT_FEATURE if the required feature is off.
+AC_DEFUN([DX_CLEAR_DEPEND], [
+test "$DX_FLAG_$1" = "$2" || AC_SUBST(DX_FLAG_[]DX_CURRENT_FEATURE, 0)
+])
+
+# DX_FEATURE_ARG(FEATURE, DESCRIPTION,
+#                CHECK_DEPEND, CLEAR_DEPEND,
+#                REQUIRE, DO-IF-ON, DO-IF-OFF)
+# --------------------------------------------
+# Parse the command-line option controlling a feature. CHECK_DEPEND is called
+# if the user explicitly turns the feature on (and invokes DX_CHECK_DEPEND),
+# otherwise CLEAR_DEPEND is called to turn off the default state if a required
+# feature is disabled (using DX_CLEAR_DEPEND). REQUIRE performs additional
+# requirement tests (DX_REQUIRE_PROG). Finally, an automake flag is set and
+# DO-IF-ON or DO-IF-OFF are called according to the final state of the feature.
+AC_DEFUN([DX_ARG_ABLE], [
+    AC_DEFUN([DX_CURRENT_FEATURE], [$1])
+    AC_DEFUN([DX_CURRENT_DESCRIPTION], [$2])
+    AC_ARG_ENABLE(doxygen-$1,
+                  [AS_HELP_STRING(DX_IF_FEATURE([$1], [--disable-doxygen-$1],
+                                                      [--enable-doxygen-$1]),
+                                  DX_IF_FEATURE([$1], [don't $2], [$2]))],
+                  [
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    AC_SUBST([DX_FLAG_$1], 1)
+    $3
+;; #(
+n|N|no|No|NO)
+    AC_SUBST([DX_FLAG_$1], 0)
+;; #(
+*)
+    AC_MSG_ERROR([invalid value '$enableval' given to doxygen-$1])
+;;
+esac
+], [
+AC_SUBST([DX_FLAG_$1], [DX_IF_FEATURE([$1], 1, 0)])
+$4
+])
+if DX_TEST_FEATURE([$1]); then
+    $5
+    :
+fi
+if DX_TEST_FEATURE([$1]); then
+    AM_CONDITIONAL(DX_COND_$1, :)
+    $6
+    :
+else
+    AM_CONDITIONAL(DX_COND_$1, false)
+    $7
+    :
+fi
+])
+
+
+# DX_XXX_FEATURE(DEFAULT_STATE)
+# -----------------------------
+AC_DEFUN([DX_DOXYGEN_FEATURE], [AC_DEFUN([DX_FEATURE_doc],  [$1])])
+AC_DEFUN([DX_MAN_FEATURE],     [AC_DEFUN([DX_FEATURE_man],  [$1])])
+AC_DEFUN([DX_HTML_FEATURE],    [AC_DEFUN([DX_FEATURE_html], [$1])])
+AC_DEFUN([DX_CHM_FEATURE],     [AC_DEFUN([DX_FEATURE_chm],  [$1])])
+AC_DEFUN([DX_CHI_FEATURE],     [AC_DEFUN([DX_FEATURE_chi],  [$1])])
+AC_DEFUN([DX_RTF_FEATURE],     [AC_DEFUN([DX_FEATURE_rtf],  [$1])])
+AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
+AC_DEFUN([DX_XML_FEATURE],     [AC_DEFUN([DX_FEATURE_xml],  [$1])])
+AC_DEFUN([DX_PDF_FEATURE],     [AC_DEFUN([DX_FEATURE_pdf],  [$1])])
+AC_DEFUN([DX_PS_FEATURE],      [AC_DEFUN([DX_FEATURE_ps],   [$1])])
+
+# DX_INIT_DOXYGEN(PROJECT, [CONFIG-FILE], [OUTPUT-DOC-DIR])
+# ---------------------------------------------------------
+# PROJECT also serves as the base name for the documentation files.
+# The default CONFIG-FILE is "Doxyfile" and OUTPUT-DOC-DIR is "doxygen-doc".
+AC_DEFUN([DX_INIT_DOXYGEN], [
+
+# Files:
+AC_SUBST([DX_PROJECT], [$1])
+AC_SUBST([DX_CONFIG], [ifelse([$2], [], Doxyfile, [$2])])
+AC_SUBST([DX_DOCDIR], [ifelse([$3], [], doxygen-doc, [$3])])
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV_APPEND(SRCDIR, $srcdir)
+DX_ENV_APPEND(PROJECT, $DX_PROJECT)
+DX_ENV_APPEND(DOCDIR, $DX_DOCDIR)
+DX_ENV_APPEND(VERSION, $PACKAGE_VERSION)
+
+# Doxygen itself:
+DX_ARG_ABLE(doc, [generate any doxygen documentation],
+            [],
+            [],
+            [DX_REQUIRE_PROG([DX_DOXYGEN], doxygen)
+             DX_REQUIRE_PROG([DX_PERL], perl)],
+            [DX_ENV_APPEND(PERL_PATH, $DX_PERL)])
+
+# Dot for graphics:
+DX_ARG_ABLE(dot, [generate graphics for doxygen documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_DOT], dot)],
+            [DX_ENV_APPEND(HAVE_DOT, YES)
+             DX_ENV_APPEND(DOT_PATH, [`DX_DIRNAME_EXPR($DX_DOT)`])],
+            [DX_ENV_APPEND(HAVE_DOT, NO)])
+
+# Man pages generation:
+DX_ARG_ABLE(man, [generate doxygen manual pages],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_MAN, YES)],
+            [DX_ENV_APPEND(GENERATE_MAN, NO)])
+
+# RTF file generation:
+DX_ARG_ABLE(rtf, [generate doxygen RTF documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_RTF, YES)],
+            [DX_ENV_APPEND(GENERATE_RTF, NO)])
+
+# XML file generation:
+DX_ARG_ABLE(xml, [generate doxygen XML documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_XML, YES)],
+            [DX_ENV_APPEND(GENERATE_XML, NO)])
+
+# (Compressed) HTML help generation:
+DX_ARG_ABLE(chm, [generate doxygen compressed HTML help documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_HHC], hhc)],
+            [DX_ENV_APPEND(HHC_PATH, $DX_HHC)
+             DX_ENV_APPEND(GENERATE_HTML, YES)
+             DX_ENV_APPEND(GENERATE_HTMLHELP, YES)],
+            [DX_ENV_APPEND(GENERATE_HTMLHELP, NO)])
+
+# Seperate CHI file generation.
+DX_ARG_ABLE(chi, [generate doxygen seperate compressed HTML help index file],
+            [DX_CHECK_DEPEND(chm, 1)],
+            [DX_CLEAR_DEPEND(chm, 1)],
+            [],
+            [DX_ENV_APPEND(GENERATE_CHI, YES)],
+            [DX_ENV_APPEND(GENERATE_CHI, NO)])
+
+# Plain HTML pages generation:
+DX_ARG_ABLE(html, [generate doxygen plain HTML documentation],
+            [DX_CHECK_DEPEND(doc, 1) DX_CHECK_DEPEND(chm, 0)],
+            [DX_CLEAR_DEPEND(doc, 1) DX_CLEAR_DEPEND(chm, 0)],
+            [],
+            [DX_ENV_APPEND(GENERATE_HTML, YES)],
+            [DX_TEST_FEATURE(chm) || DX_ENV_APPEND(GENERATE_HTML, NO)])
+
+# PostScript file generation:
+DX_ARG_ABLE(ps, [generate doxygen PostScript documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_LATEX], latex)
+             DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+             DX_REQUIRE_PROG([DX_DVIPS], dvips)
+             DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# PDF file generation:
+DX_ARG_ABLE(pdf, [generate doxygen PDF documentation],
+            [DX_CHECK_DEPEND(doc, 1)],
+            [DX_CLEAR_DEPEND(doc, 1)],
+            [DX_REQUIRE_PROG([DX_PDFLATEX], pdflatex)
+             DX_REQUIRE_PROG([DX_MAKEINDEX], makeindex)
+             DX_REQUIRE_PROG([DX_EGREP], egrep)])
+
+# LaTeX generation for PS and/or PDF:
+if DX_TEST_FEATURE(ps) || DX_TEST_FEATURE(pdf); then
+    AM_CONDITIONAL(DX_COND_latex, :)
+    DX_ENV_APPEND(GENERATE_LATEX, YES)
+else
+    AM_CONDITIONAL(DX_COND_latex, false)
+    DX_ENV_APPEND(GENERATE_LATEX, NO)
+fi
+
+# Paper size for PS and/or PDF:
+AC_ARG_VAR(DOXYGEN_PAPER_SIZE,
+           [a4wide (default), a4, letter, legal or executive])
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+    AC_SUBST(DOXYGEN_PAPER_SIZE, "")
+;; #(
+a4wide|a4|letter|legal|executive)
+    DX_ENV_APPEND(PAPER_SIZE, $DOXYGEN_PAPER_SIZE)
+;; #(
+*)
+    AC_MSG_ERROR([unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'])
+;;
+esac
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.11'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.11.1], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+	[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 5
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+	      [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+			     [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+		  [_AM_DEPENDENCIES(CC)],
+		  [define([AC_PROG_CC],
+			  defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+		  [_AM_DEPENDENCIES(CXX)],
+		  [define([AC_PROG_CXX],
+			  defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+		  [_AM_DEPENDENCIES(OBJC)],
+		  [define([AC_PROG_OBJC],
+			  defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+  [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion.  Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.	            -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2009  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+          [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[[\\\"\#\$\&\'\`$am_lf]]*)
+    AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+  *[[\\\"\#\$\&\'\`$am_lf\ \	]]*)
+    AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2009  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# (`yes' being less verbose, `no' or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules],
+[  --enable-silent-rules          less verbose build output (undo: `make V=1')
+  --disable-silent-rules         verbose build output (undo: `make V=0')])
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no)  AM_DEFAULT_VERBOSITY=1;;
+*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([.macro_dir/libtool.m4])
+m4_include([.macro_dir/ltoptions.m4])
+m4_include([.macro_dir/ltsugar.m4])
+m4_include([.macro_dir/ltversion.m4])
+m4_include([.macro_dir/lt~obsolete.m4])
Index: /trunk/FACT++/aminclude.am
===================================================================
--- /trunk/FACT++/aminclude.am	(revision 10183)
+++ /trunk/FACT++/aminclude.am	(revision 10183)
@@ -0,0 +1,109 @@
+## --------------------------------- ##
+## Format-independent Doxygen rules. ##
+## --------------------------------- ##
+if DX_COND_doc
+@DX_CONFIG@:
+	$(DX_DOXYGEN) -g
+## ------------------------------- ##
+## Rules specific for HTML output. ##
+## ------------------------------- ##
+if DX_COND_html
+DX_CLEAN_HTML = @DX_DOCDIR@/html
+endif DX_COND_html
+## ------------------------------ ##
+## Rules specific for CHM output. ##
+## ------------------------------ ##
+if DX_COND_chm
+DX_CLEAN_CHM = @DX_DOCDIR@/chm
+if DX_COND_chi
+DX_CLEAN_CHI = @DX_DOCDIR@/@PACKAGE@.chi
+endif DX_COND_chi
+endif DX_COND_chm
+## ------------------------------ ##
+## Rules specific for MAN output. ##
+## ------------------------------ ##
+if DX_COND_man
+DX_CLEAN_MAN = @DX_DOCDIR@/man
+endif DX_COND_man
+## ------------------------------ ##
+## Rules specific for RTF output. ##
+## ------------------------------ ##
+if DX_COND_rtf
+DX_CLEAN_RTF = @DX_DOCDIR@/rtf
+endif DX_COND_rtf
+## ------------------------------ ##
+## Rules specific for XML output. ##
+## ------------------------------ ##
+if DX_COND_xml
+DX_CLEAN_XML = @DX_DOCDIR@/xml
+endif DX_COND_xml
+## ----------------------------- ##
+## Rules specific for PS output. ##
+## ----------------------------- ##
+if DX_COND_ps
+DX_CLEAN_PS = @DX_DOCDIR@/@PACKAGE@.ps
+DX_PS_GOAL = doxygen-ps
+doxygen-ps: @DX_DOCDIR@/@PACKAGE@.ps
+@DX_DOCDIR@/@PACKAGE@.ps: @DX_DOCDIR@/@PACKAGE@.tag
+	cd @DX_DOCDIR@/latex; \
+	rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+	$(DX_LATEX) refman.tex; \
+	$(MAKEINDEX_PATH) refman.idx; \
+	$(DX_LATEX) refman.tex; \
+	countdown=5; \
+	while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+		refman.log > /dev/null 2>&1 && test $$countdown -gt 0; \
+	do \
+		$(DX_LATEX) refman.tex; \
+		countdown=`expr $$countdown - 1`; \
+	done; \
+	$(DX_DVIPS) -o ../@PACKAGE@.ps refman.dvi
+endif DX_COND_ps
+## ------------------------------ ##
+## Rules specific for PDF output. ##
+## ------------------------------ ##
+if DX_COND_pdf
+DX_CLEAN_PDF = @DX_DOCDIR@/@PACKAGE@.pdf
+DX_PDF_GOAL = doxygen-pdf
+doxygen-pdf: @DX_DOCDIR@/@PACKAGE@.pdf
+@DX_DOCDIR@/@PACKAGE@.pdf: @DX_DOCDIR@/@PACKAGE@.tag
+	cd @DX_DOCDIR@/latex; \
+	rm -f *.aux *.toc *.idx *.ind *.ilg *.log *.out; \
+	$(DX_PDFLATEX) refman.tex; \
+	$(DX_MAKEINDEX) refman.idx; \
+	$(DX_PDFLATEX) refman.tex; \
+	countdown=5; \
+	while $(DX_EGREP) 'Rerun (LaTeX|to get cross-references right)' \
+		refman.log > /dev/null 2>&1 && test $$countdown -gt 0; \
+	do \
+		$(DX_PDFLATEX) refman.tex; \
+		countdown=`expr $$countdown - 1`; \
+	done; \
+	mv refman.pdf ../@PACKAGE@.pdf
+endif DX_COND_pdf
+## ------------------------------------------------- ##
+## Rules specific for LaTeX (shared for PS and PDF). ##
+## ------------------------------------------------- ##
+if DX_COND_latex
+DX_CLEAN_LATEX = @DX_DOCDIR@/latex
+endif DX_COND_latex
+.PHONY: doxygen-run doxygen-doc $(DX_PS_GOAL) $(DX_PDF_GOAL)
+.INTERMEDIATE: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+doxygen-run: @DX_DOCDIR@/@PACKAGE@.tag
+doxygen-doc: doxygen-run $(DX_PS_GOAL) $(DX_PDF_GOAL)
+@DX_DOCDIR@/@PACKAGE@.tag: $(DX_CONFIG) $(pkginclude_HEADERS)
+	rm -rf @DX_DOCDIR@
+	$(DX_ENV) $(DX_DOXYGEN) $(srcdir)/$(DX_CONFIG)
+DX_CLEANFILES = \
+	@DX_DOCDIR@/@PACKAGE@.tag \
+	-r \
+	$(DX_CLEAN_HTML) \
+	$(DX_CLEAN_CHM) \
+	$(DX_CLEAN_CHI) \
+	$(DX_CLEAN_MAN) \
+	$(DX_CLEAN_RTF) \
+	$(DX_CLEAN_XML) \
+	$(DX_CLEAN_PS) \
+	$(DX_CLEAN_PDF) \
+	$(DX_CLEAN_LATEX)
+endif DX_COND_doc
Index: /trunk/FACT++/autogen.sh
===================================================================
--- /trunk/FACT++/autogen.sh	(revision 10183)
+++ /trunk/FACT++/autogen.sh	(revision 10183)
@@ -0,0 +1,2 @@
+#!/bin/sh
+autoreconf --force --install -I .macro_dir
Index: /trunk/FACT++/configure
===================================================================
--- /trunk/FACT++/configure	(revision 10183)
+++ /trunk/FACT++/configure	(revision 10183)
@@ -0,0 +1,21081 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.67 for FACT++ 1.0.
+#
+# Report bugs to <thomas.bretz@epfl.ch>.
+#
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test "x$CONFIG_SHELL" = x; then
+  as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+  exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+  as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+  as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+  eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+      if test "x$CONFIG_SHELL" != x; then :
+  # We cannot yet assume a decent shell, so we have to provide a
+	# neutralization value for shells without unset; and this also
+	# works around shells that cannot unset nonexistent variables.
+	BASH_ENV=/dev/null
+	ENV=/dev/null
+	(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+	export CONFIG_SHELL
+	exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+  else
+    $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: thomas.bretz@epfl.ch about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
+  fi
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+  # Remove one level of quotation (which was required for Make).
+  ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+  ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+  # Discard the --no-reexec flag, and continue.
+  shift
+elif test "X$1" = X--fallback-echo; then
+  # Avoid inline document here, it may be left over
+  :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+  # Yippee, $ECHO works!
+  :
+else
+  # Restart under the correct shell.
+  exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+  # used as fallback echo
+  shift
+  cat <<_LT_EOF
+$*
+_LT_EOF
+  exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+  if test "X${echo_test_string+set}" != Xset; then
+    # find a string as large as possible, as long as the shell can cope with it
+    for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+      # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+      if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+	 { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+      then
+        break
+      fi
+    done
+  fi
+
+  if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+     echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+     test "X$echo_testing_string" = "X$echo_test_string"; then
+    :
+  else
+    # The Solaris, AIX, and Digital Unix default echo programs unquote
+    # backslashes.  This makes it impossible to quote backslashes using
+    #   echo "$something" | sed 's/\\/\\\\/g'
+    #
+    # So, first we look for a working echo in the user's PATH.
+
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for dir in $PATH /usr/ucb; do
+      IFS="$lt_save_ifs"
+      if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+         test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        ECHO="$dir/echo"
+        break
+      fi
+    done
+    IFS="$lt_save_ifs"
+
+    if test "X$ECHO" = Xecho; then
+      # We didn't find a better echo, so look for alternatives.
+      if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+         echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+         test "X$echo_testing_string" = "X$echo_test_string"; then
+        # This shell has a builtin print -r that does the trick.
+        ECHO='print -r'
+      elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+	   test "X$CONFIG_SHELL" != X/bin/ksh; then
+        # If we have ksh, try running configure again with it.
+        ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+        export ORIGINAL_CONFIG_SHELL
+        CONFIG_SHELL=/bin/ksh
+        export CONFIG_SHELL
+        exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+      else
+        # Try using printf.
+        ECHO='printf %s\n'
+        if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+	   echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+	   test "X$echo_testing_string" = "X$echo_test_string"; then
+	  # Cool, printf works
+	  :
+        elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+	  export CONFIG_SHELL
+	  SHELL="$CONFIG_SHELL"
+	  export SHELL
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+	     test "X$echo_testing_string" = 'X\t' &&
+	     echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+	     test "X$echo_testing_string" = "X$echo_test_string"; then
+	  ECHO="$CONFIG_SHELL $0 --fallback-echo"
+        else
+	  # maybe with a smaller string...
+	  prev=:
+
+	  for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+	    if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+	    then
+	      break
+	    fi
+	    prev="$cmd"
+	  done
+
+	  if test "$prev" != 'sed 50q "$0"'; then
+	    echo_test_string=`eval $prev`
+	    export echo_test_string
+	    exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+	  else
+	    # Oops.  We lost completely, so just stick with echo.
+	    ECHO=echo
+	  fi
+        fi
+      fi
+    fi
+  fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+   lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='FACT++'
+PACKAGE_TARNAME='FACTpp'
+PACKAGE_VERSION='1.0'
+PACKAGE_STRING='FACT++ 1.0'
+PACKAGE_BUGREPORT='thomas.bretz@epfl.ch'
+PACKAGE_URL='http://hello.example.com/'
+
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+LIBOBJS
+BOOST_THREAD_LIB
+BOOST_SYSTEM_LIB
+BOOST_REGEX_LIB
+BOOST_PROGRAM_OPTIONS_LIB
+BOOST_FILESYSTEM_LIB
+BOOST_DATE_TIME_LIB
+BOOST_ASIO_LIB
+BOOST_LDFLAGS
+BOOST_CPPFLAGS
+DOXYGEN_PAPER_SIZE
+DX_COND_latex_FALSE
+DX_COND_latex_TRUE
+DX_COND_pdf_FALSE
+DX_COND_pdf_TRUE
+DX_PDFLATEX
+DX_FLAG_pdf
+DX_COND_ps_FALSE
+DX_COND_ps_TRUE
+DX_EGREP
+DX_DVIPS
+DX_MAKEINDEX
+DX_LATEX
+DX_FLAG_ps
+DX_COND_html_FALSE
+DX_COND_html_TRUE
+DX_FLAG_html
+DX_COND_chi_FALSE
+DX_COND_chi_TRUE
+DX_FLAG_chi
+DX_COND_chm_FALSE
+DX_COND_chm_TRUE
+DX_HHC
+DX_FLAG_chm
+DX_COND_xml_FALSE
+DX_COND_xml_TRUE
+DX_FLAG_xml
+DX_COND_rtf_FALSE
+DX_COND_rtf_TRUE
+DX_FLAG_rtf
+DX_COND_man_FALSE
+DX_COND_man_TRUE
+DX_FLAG_man
+DX_COND_dot_FALSE
+DX_COND_dot_TRUE
+DX_DOT
+DX_FLAG_dot
+DX_COND_doc_FALSE
+DX_COND_doc_TRUE
+DX_PERL
+DX_DOXYGEN
+DX_FLAG_doc
+DX_ENV
+DX_DOCDIR
+DX_CONFIG
+DX_PROJECT
+AM_BACKSLASH
+AM_DEFAULT_VERBOSITY
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+CXXCPP
+CPP
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+lt_ECHO
+RANLIB
+STRIP
+AR
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+EGREP
+GREP
+SED
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+LIBTOOL
+ac_ct_CXX
+CXXFLAGS
+CXX
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+enable_dependency_tracking
+enable_silent_rules
+enable_doxygen_doc
+enable_doxygen_dot
+enable_doxygen_man
+enable_doxygen_rtf
+enable_doxygen_xml
+enable_doxygen_chm
+enable_doxygen_chi
+enable_doxygen_html
+enable_doxygen_ps
+enable_doxygen_pdf
+with_boost
+with_boost_libdir
+with_boost_asio
+with_boost_date_time
+with_boost_filesystem
+with_boost_program_options
+with_boost_regex
+with_boost_system
+with_boost_thread
+with_mysqlpp_lib_path
+'
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+CXXCPP
+DOXYGEN_PAPER_SIZE'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval $ac_prev=\$ac_option
+    ac_prev=
+    continue
+  fi
+
+  case $ac_option in
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
+  esac
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
+    datadir=$ac_optarg ;;
+
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
+
+  -enable-* | --enable-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst | --locals)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
+
+  -without-* | --without-*)
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
+    eval $ac_envvar=\$ac_optarg
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
+		datadir sysconfdir sharedstatedir localstatedir includedir \
+		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+		libdir localedir mandir
+do
+  eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+  esac
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used" >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r "$srcdir/$ac_unique_file"; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+	pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures FACT++ 1.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/FACTpp]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+_ACEOF
+
+  cat <<\_ACEOF
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of FACT++ 1.0:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-shared[=PKGS]  build shared libraries [default=yes]
+  --enable-static[=PKGS]  build static libraries [default=yes]
+  --enable-fast-install[=PKGS]
+                          optimize for fast installation [default=yes]
+  --disable-libtool-lock  avoid locking (might break parallel builds)
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --enable-silent-rules          less verbose build output (undo: `make V=1')
+  --disable-silent-rules         verbose build output (undo: `make V=0')
+  --disable-doxygen-doc   don't generate any doxygen documentation
+  --disable-doxygen-dot   don't generate graphics for doxygen documentation
+  --enable-doxygen-man    generate doxygen manual pages
+  --enable-doxygen-rtf    generate doxygen RTF documentation
+  --enable-doxygen-xml    generate doxygen XML documentation
+  --enable-doxygen-chm    generate doxygen compressed HTML help documentation
+  --enable-doxygen-chi    generate doxygen seperate compressed HTML help index
+                          file
+  --disable-doxygen-html  don't generate doxygen plain HTML documentation
+  --disable-doxygen-ps    don't generate doxygen PostScript documentation
+  --disable-doxygen-pdf   don't generate doxygen PDF documentation
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-pic              try to use only PIC/non-PIC objects [default=use
+                          both]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-boost[=DIR]      use boost (default is yes) - it is possible to
+                          specify the root directory for boost (optional)
+  --with-boost-libdir=LIB_DIR
+                          Force given directory for boost libraries. Note that
+                          this will overwrite library path detection, so use
+                          this parameter only if default library detection
+                          fails and you know exactly where your boost
+                          libraries are located.
+  --with-boost-asio[=special-lib]
+                          use the ASIO library from boost - it is possible to
+                          specify a certain library for the linker e.g.
+                          --with-boost-asio=boost_system-gcc41-mt-1_34
+  --with-boost-date-time[=special-lib]
+                          use the Date_Time library from boost - it is
+                          possible to specify a certain library for the linker
+                          e.g.
+                          --with-boost-date-time=boost_date_time-gcc-mt-d-1_33_1
+  --with-boost-filesystem[=special-lib]
+                          use the Filesystem library from boost - it is
+                          possible to specify a certain library for the linker
+                          e.g. --with-boost-filesystem=boost_filesystem-gcc-mt
+  --with-boost-program-options[=special-lib]
+                          use the program options library from boost - it is
+                          possible to specify a certain library for the linker
+                          e.g.
+                          --with-boost-program-options=boost_program_options-gcc-mt-1_33_1
+  --with-boost-regex[=special-lib]
+                          use the Regex library from boost - it is possible to
+                          specify a certain library for the linker e.g.
+                          --with-boost-regex=boost_regex-gcc-mt-d-1_33_1
+  --with-boost-system[=special-lib]
+                          use the System library from boost - it is possible
+                          to specify a certain library for the linker e.g.
+                          --with-boost-system=boost_system-gcc-mt
+  --with-boost-thread[=special-lib]
+                          use the Thread library from boost - it is possible
+                          to specify a certain library for the linker e.g.
+                          --with-boost-thread=boost_thread-gcc-mt
+
+       --with-mysqlpp-lib-path location of the MySQL++ library, defaults to
+                          /usr/lib
+
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
+  CPP         C preprocessor
+  CXXCPP      C++ preprocessor
+  DOXYGEN_PAPER_SIZE
+              a4wide (default), a4, letter, legal or executive
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <thomas.bretz@epfl.ch>.
+FACT++ home page: <http://hello.example.com/>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
+    ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
+    else
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
+  done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+  cat <<\_ACEOF
+FACT++ configure 1.0
+generated by GNU Autoconf 2.67
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* 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 $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+    ac_retval=1
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+  as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval "test \"\${$3+set}\"" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ----------------------------------- ##
+## Report this to thomas.bretz@epfl.ch ##
+## ----------------------------------- ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by FACT++ $as_me 1.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
+
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
+else
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+ac_config_files="$ac_config_files Makefile"
+   # causes x/Makefile.in to be created if x/Makefile.am exists
+#AC_CONFIG_HEADERS([config.h])
+
+ac_aux_dir=
+for ac_dir in .aux_dir "$srcdir"/.aux_dir; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in .aux_dir \"$srcdir\"/.aux_dir" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in colorgcc gcc
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in colorgcc gcc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link_default") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	then :; else
+	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	fi
+	# We set ac_cv_exeext here because the later test for it is not
+	# safe: cross compilers may not add the suffix if given an `-o'
+	# argument, so we may need to know it at that point already.
+	# Even if this section looks crufty: it has the advantage of
+	# actually working.
+	break;;
+    * )
+	break;;
+  esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+  ac_file=''
+fi
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+    fi
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
+else
+  GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+else
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in colorgcc g++
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in colorgcc g++
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.6b'
+macro_revision='1.3017'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+  # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+  fi
+else
+  ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in grep ggrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in egrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
+   else
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in fgrep; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+      { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+  # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
+else
+  ac_cv_path_FGREP=$FGREP
+fi
+
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$DUMPBIN" && break
+  done
+fi
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_DUMPBIN" && break
+done
+
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DUMPBIN=$ac_ct_DUMPBIN
+  fi
+fi
+
+
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:4143: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:4146: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:4149: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+    i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+	         = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OBJDUMP="objdump"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OBJDUMP=$ac_ct_OBJDUMP
+  fi
+else
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  if ( file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AR="${ac_tool_prefix}ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+  ac_ct_AR=$AR
+  # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_AR="ar"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    AR=$ac_ct_AR
+  fi
+else
+  AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+const struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_save_LIBS="$LIBS"
+	  lt_save_CFLAGS="$CFLAGS"
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS="$lt_save_LIBS"
+	  CFLAGS="$lt_save_CFLAGS"
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&5
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+    fi
+  else
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line 5355 "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
+  fi
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_NMEDIT="nmedit"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_LIPO="lipo"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
+  fi
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL="otool"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL=$ac_ct_OTOOL
+  fi
+else
+  OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OTOOL64="otool64"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
+  fi
+else
+  OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&5
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
+else
+  lt_cv_ld_exported_symbols_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[012]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    test -n "$CXX" && break
+  done
+fi
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CXX="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CXX" && break
+done
+
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
+fi
+
+  fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
+else
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+else
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
+  else
+    CXXFLAGS="-g"
+  fi
+else
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
+  else
+    CXXFLAGS=
+  fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if test "${ac_cv_prog_CXXCPP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
+
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+_lt_caught_CXX_error=yes; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+  _lt_caught_CXX_error=yes
+fi
+
+
+
+
+
+# Set options
+
+
+
+        enable_dlopen=no
+
+
+  enable_win32_dll=no
+
+
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  else
+    MAGIC_CMD=:
+  fi
+fi
+
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7284: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7288: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
+
+fi
+
+
+
+
+
+
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='--shared'
+	lt_prog_compiler_static='--static'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl*)
+	# IBM XL C 8.0/Fortran 10.1 on PPC
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-qpic'
+	lt_prog_compiler_static='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	*Sun\ F*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
+
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
+
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
+
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7623: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:7627: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
+else
+    lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7728: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:7732: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:7783: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:7787: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs=no
+    ;;
+  esac
+
+  ld_shlibs=yes
+  if test "$with_gnu_ld" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      whole_archive_flag_spec=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]*)			# IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        ld_shlibs=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
+
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
+
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
+	fi
+	link_all_deplibs=no
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  # Exported symbols can be pulled into shared objects from archives
+	  whole_archive_flag_spec='$convenience'
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      allow_undefined_flag=unsupported
+      # Tell ltmain to make .lib files, not .a files.
+      libext=lib
+      # Tell ltmain to make .dll files, not .so files.
+      shrext_cmds=".dll"
+      # FIXME: Setting linknames here is a bad hack.
+      archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+      # The linker will automatically build a .lib file if we build a DLL.
+      old_archive_from_new_cmds='true'
+      # FIXME: Should let the user specify the lib program.
+      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+      fix_srcfile_path='`cygpath -w "$srcfile"`'
+      enable_shared_with_static_runtimes=yes
+      ;;
+
+    darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  whole_archive_flag_spec=''
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=echo
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+  else
+  ld_shlibs=no
+  fi
+
+      ;;
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    freebsd1*)
+      ld_shlibs=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_direct_absolute=yes
+	export_dynamic_flag_spec='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  hardcode_direct_absolute=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+        save_LDFLAGS="$LDFLAGS"
+        LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+        LDFLAGS="$save_LDFLAGS"
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	hardcode_direct_absolute=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
+
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
+
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
+
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl
+	pic_flag=$lt_prog_compiler_pic
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag
+        allow_undefined_flag=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+        then
+	  archive_cmds_need_lc=no
+        else
+	  archive_cmds_need_lc=yes
+        fi
+        allow_undefined_flag=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+  if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+  else
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+  fi
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # Some binutils ld are patched to set DT_RUNPATH
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+
+fi
+
+    ;;
+
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $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 shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=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_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=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_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $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 dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=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_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""yes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $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 dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=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_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 10167 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line 10263 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    fi
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  compiler=$CC
+  compiler_CXX=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      aix[4-9]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_direct_absolute_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[012]|aix4.[012].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    hardcode_direct_CXX=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    hardcode_minus_L_CXX=yes
+	    hardcode_libdir_flag_spec_CXX='-L$libdir'
+	    hardcode_libdir_separator_CXX=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        export_dynamic_flag_spec_CXX='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        always_export_symbols_CXX=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          allow_undefined_flag_CXX='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	    allow_undefined_flag_CXX="-z nodefs"
+	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+lt_aix_libpath_sed='
+    /Import File Strings/,/^$/ {
+	/^0/ {
+	    s/^0  *\(.*\)$/\1/
+	    p
+	}
+    }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    no_undefined_flag_CXX=' ${wl}-bernotok'
+	    allow_undefined_flag_CXX=' ${wl}-berok'
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec_CXX='$convenience'
+	    archive_cmds_need_lc_CXX=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  allow_undefined_flag_CXX=unsupported
+	  # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  ld_shlibs_CXX=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+        # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+        # as there is no search path for DLLs.
+        hardcode_libdir_flag_spec_CXX='-L$libdir'
+        allow_undefined_flag_CXX=unsupported
+        always_export_symbols_CXX=no
+        enable_shared_with_static_runtimes_CXX=yes
+
+        if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+          archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+          # If the export-symbols file already is a .def file (1st line
+          # is EXPORTS), use it as is; otherwise, prepend...
+          archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    cp $export_symbols $output_objdir/$soname.def;
+          else
+	    echo EXPORTS > $output_objdir/$soname.def;
+	    cat $export_symbols >> $output_objdir/$soname.def;
+          fi~
+          $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+        else
+          ld_shlibs_CXX=no
+        fi
+        ;;
+      darwin* | rhapsody*)
+
+
+  archive_cmds_need_lc_CXX=no
+  hardcode_direct_CXX=no
+  hardcode_automatic_CXX=yes
+  hardcode_shlibpath_var_CXX=unsupported
+  whole_archive_flag_spec_CXX=''
+  link_all_deplibs_CXX=yes
+  allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=echo
+    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+
+  else
+  ld_shlibs_CXX=no
+  fi
+
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      freebsd[12]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='${wl}-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      export_dynamic_flag_spec_CXX='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_direct_absolute_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[3-9]*)
+	hardcode_direct_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+	      fi
+	    fi
+	    link_all_deplibs_CXX=yes
+	    ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    archive_cmds_need_lc_CXX=no
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [1-5]* | *pgcpp\ [1-5]*)
+	      prelink_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+	      old_archive_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+		$RANLIB $oldlib'
+	      archive_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 will use weak symbols
+	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	  xl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      no_undefined_flag_CXX=' -zdefs'
+	      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      hardcode_libdir_flag_spec_CXX='-R$libdir'
+	      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+	      compiler_needs_object_CXX=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='echo'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	ld_shlibs_CXX=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	  hardcode_direct_absolute_CXX=yes
+	  archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    export_dynamic_flag_spec_CXX='${wl}-E'
+	    whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=echo
+	else
+	  ld_shlibs_CXX=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        allow_undefined_flag_CXX=' -expect_unresolved \*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+	        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+		;;
+	    esac
+
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	      hardcode_libdir_separator_CXX=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+	    no_undefined_flag_CXX=' -zdefs'
+	    archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    hardcode_libdir_flag_spec_CXX='-R$libdir'
+	    hardcode_shlibpath_var_CXX=no
+	    case $host_os in
+	      solaris2.[0-5] | solaris2.[0-5].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    link_all_deplibs_CXX=yes
+
+	    output_verbose_link_cmd='echo'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+	      fi
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[0-5] | solaris2.[0-5].*) ;;
+		*)
+		  whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='${wl}-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	no_undefined_flag_CXX='${wl}-z,text'
+	allow_undefined_flag_CXX='${wl}-z,nodefs'
+	archive_cmds_need_lc_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+	hardcode_libdir_separator_CXX=':'
+	link_all_deplibs_CXX=yes
+	export_dynamic_flag_spec_CXX='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	  *)
+	    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+    test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+    GCC_CXX="$GXX"
+    LD_CXX="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case $p in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       else
+	 prev=
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 case $p in
+	 -L* | -R*)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       ;;
+
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_CXX='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[4-9]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  xlc* | xlC*)
+	    # IBM XL 8.0 on PPC
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-qpic'
+	    lt_prog_compiler_static_CXX='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        lt_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_prog_compiler_pic_CXX" >&6; }
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12219: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:12223: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12318: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:12322: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:12370: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:12374: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  case $host_os in
+  aix[4-9]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+  ;;
+  cygwin* | mingw* | cegcc*)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  linux* | k*bsd*-gnu)
+    link_all_deplibs_CXX=no
+  ;;
+  *)
+    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  ;;
+  esac
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+with_gnu_ld_CXX=$with_gnu_ld
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+      $RM conftest*
+      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+      if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+        soname=conftest
+        lib=conftest
+        libobjs=conftest.$ac_objext
+        deplibs=
+        wl=$lt_prog_compiler_wl_CXX
+	pic_flag=$lt_prog_compiler_pic_CXX
+        compiler_flags=-v
+        linker_flags=-v
+        verstring=
+        output_objdir=.
+        libname=conftest
+        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+        allow_undefined_flag_CXX=
+        if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+        then
+	  archive_cmds_need_lc_CXX=no
+        else
+	  archive_cmds_need_lc_CXX=yes
+        fi
+        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+      else
+        cat conftest.err 1>&5
+      fi
+      $RM conftest*
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc_CXX" >&5
+$as_echo "$archive_cmds_need_lc_CXX" >&6; }
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[45]*)
+  version_type=linux
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$host_os in
+  yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH printed by
+        # mingw gcc, but we are running on Cygwin. Gcc prints its search
+        # path with ; separators, and with drive letters. We can handle the
+        # drive letters (cygwin fileutils understands them), so leave them,
+        # especially as we might pass files found there to a mingw objdump,
+        # which wouldn't understand a cygwinified path. Ahh.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    ;;
+
+  *)
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    ;;
+  esac
+  dynamic_linker='Win32 ld.exe'
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+gnu*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  postinstall_cmds='chmod 555 $lib'
+  ;;
+
+interix[3-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  # Some binutils ld are patched to set DT_RUNPATH
+  save_LDFLAGS=$LDFLAGS
+  save_libdir=$libdir
+  eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+       LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  LDFLAGS=$save_LDFLAGS
+  libdir=$save_libdir
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
+
+netbsdelf*-gnu)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='NetBSD ld.elf_so'
+  ;;
+
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+   test "$inherit_rpath_CXX" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
+
+
+
+
+
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+        ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+#AC_PATH_XTRA
+
+
+
+
+
+am__api_version='1.11'
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+
+  done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name.  Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+  *[\\\"\#\$\&\'\`$am_lf]*)
+    as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+esac
+case $srcdir in
+  *[\\\"\#\$\&\'\`$am_lf\ \	]*)
+    as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+esac
+
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t "$srcdir/configure" conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+  *)
+    MISSING="\${SHELL} $am_aux_dir/missing" ;;
+  esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+  case $am_aux_dir in
+  *\ * | *\	*)
+    install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+  *)
+    install_sh="\${SHELL} $am_aux_dir/install-sh"
+  esac
+fi
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_prog in mkdir gmkdir; do
+	 for ac_exec_ext in '' $ac_executable_extensions; do
+	   { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+	@echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+  am__include=include
+  am__quote=
+  _am_result=GNU
+  ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   case `$am_make -s -f confmf 2> /dev/null` in #(
+   *the\ am__doit\ target*)
+     am__include=.include
+     am__quote="\""
+     _am_result=BSD
+     ;;
+   esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no)  AM_DEFAULT_VERBOSITY=1;;
+*)   AM_DEFAULT_VERBOSITY=1;;
+esac
+AM_BACKSLASH='\'
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='FACTpp'
+ VERSION='1.0'
+
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+depcc="$CXX"  am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CXX_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  am__universal=false
+  case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac
+
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
+    case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    msvisualcpp | msvcmsys)
+      # This compiler won't grok `-c -o', but also, the minuso test has
+      # not run yet.  These depmodes are late enough in the game, and
+      # so weak that their functioning should not be impacted.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
+    none) break ;;
+    esac
+    if depmode=$depmode \
+       source=sub/conftest.c object=$am__obj \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CXX_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+  am__fastdepCXX_TRUE=
+  am__fastdepCXX_FALSE='#'
+else
+  am__fastdepCXX_TRUE='#'
+  am__fastdepCXX_FALSE=
+fi
+
+
+
+# Check whether --enable-silent-rules was given.
+if test "${enable_silent_rules+set}" = set; then :
+  enableval=$enable_silent_rules;
+fi
+
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no)  AM_DEFAULT_VERBOSITY=1;;
+*)   AM_DEFAULT_VERBOSITY=0;;
+esac
+AM_BACKSLASH='\'
+
+if test "x$CC" != xcc; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+		      sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+   test -f conftest2.$ac_objext && { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
+then
+  eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+  if test "x$CC" != xcc; then
+    # Test first that cc exists at all.
+    if { ac_try='cc -c conftest.$ac_ext >&5'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+      ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+      rm -f conftest2.*
+      if { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } &&
+	 test -f conftest2.$ac_objext && { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; };
+      then
+	# cc works too.
+	:
+      else
+	# cc exists but doesn't like -o.
+	eval ac_cv_prog_cc_${ac_cc}_c_o=no
+      fi
+    fi
+  fi
+else
+  eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+   # Losing compiler, so override with the script.
+   # FIXME: It is wrong to rewrite CC.
+   # But if we don't then we get into trouble of one sort or another.
+   # A longer-term fix would be to have automake use am__CC in this case,
+   # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+   CC="$am_aux_dir/compile $CC"
+fi
+
+
+
+
+
+
+# Files:
+DX_PROJECT=FACT++
+
+DX_CONFIG=Doxyfile
+
+DX_DOCDIR=doxygen-doc
+
+
+# Environment variables used inside doxygen.cfg:
+DX_ENV="$DX_ENV SRCDIR='$srcdir'"
+
+DX_ENV="$DX_ENV PROJECT='$DX_PROJECT'"
+
+DX_ENV="$DX_ENV DOCDIR='$DX_DOCDIR'"
+
+DX_ENV="$DX_ENV VERSION='$PACKAGE_VERSION'"
+
+
+# Doxygen itself:
+
+
+
+    # Check whether --enable-doxygen-doc was given.
+if test "${enable_doxygen_doc+set}" = set; then :
+  enableval=$enable_doxygen_doc;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_doc=1
+
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_doc=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-doc" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_doc=1
+
+
+
+fi
+
+if test "$DX_FLAG_doc" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}doxygen", so it can be a program name with args.
+set dummy ${ac_tool_prefix}doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DOXYGEN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_DOXYGEN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_DOXYGEN="$DX_DOXYGEN" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_DOXYGEN=$ac_cv_path_DX_DOXYGEN
+if test -n "$DX_DOXYGEN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOXYGEN" >&5
+$as_echo "$DX_DOXYGEN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DOXYGEN"; then
+  ac_pt_DX_DOXYGEN=$DX_DOXYGEN
+  # Extract the first word of "doxygen", so it can be a program name with args.
+set dummy doxygen; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DOXYGEN+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_DOXYGEN in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_DOXYGEN="$ac_pt_DX_DOXYGEN" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_DOXYGEN="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_DOXYGEN=$ac_cv_path_ac_pt_DX_DOXYGEN
+if test -n "$ac_pt_DX_DOXYGEN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOXYGEN" >&5
+$as_echo "$ac_pt_DX_DOXYGEN" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_DOXYGEN" = x; then
+    DX_DOXYGEN=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_DOXYGEN=$ac_pt_DX_DOXYGEN
+  fi
+else
+  DX_DOXYGEN="$ac_cv_path_DX_DOXYGEN"
+fi
+
+if test "$DX_FLAG_doc$DX_DOXYGEN" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: doxygen not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: doxygen not found - will not generate any doxygen documentation" >&2;}
+    DX_FLAG_doc=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}perl", so it can be a program name with args.
+set dummy ${ac_tool_prefix}perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_PERL="$DX_PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_PERL=$ac_cv_path_DX_PERL
+if test -n "$DX_PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PERL" >&5
+$as_echo "$DX_PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_PERL"; then
+  ac_pt_DX_PERL=$DX_PERL
+  # Extract the first word of "perl", so it can be a program name with args.
+set dummy perl; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_PERL+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_PERL in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_PERL="$ac_pt_DX_PERL" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_PERL="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_PERL=$ac_cv_path_ac_pt_DX_PERL
+if test -n "$ac_pt_DX_PERL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PERL" >&5
+$as_echo "$ac_pt_DX_PERL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_PERL" = x; then
+    DX_PERL=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_PERL=$ac_pt_DX_PERL
+  fi
+else
+  DX_PERL="$ac_cv_path_DX_PERL"
+fi
+
+if test "$DX_FLAG_doc$DX_PERL" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: perl not found - will not generate any doxygen documentation" >&5
+$as_echo "$as_me: WARNING: perl not found - will not generate any doxygen documentation" >&2;}
+    DX_FLAG_doc=0
+
+fi
+
+    :
+fi
+if test "$DX_FLAG_doc" = 1; then
+     if :; then
+  DX_COND_doc_TRUE=
+  DX_COND_doc_FALSE='#'
+else
+  DX_COND_doc_TRUE='#'
+  DX_COND_doc_FALSE=
+fi
+
+    DX_ENV="$DX_ENV PERL_PATH='$DX_PERL'"
+
+    :
+else
+     if false; then
+  DX_COND_doc_TRUE=
+  DX_COND_doc_FALSE='#'
+else
+  DX_COND_doc_TRUE='#'
+  DX_COND_doc_FALSE=
+fi
+
+
+    :
+fi
+
+
+# Dot for graphics:
+
+
+
+    # Check whether --enable-doxygen-dot was given.
+if test "${enable_doxygen_dot+set}" = set; then :
+  enableval=$enable_doxygen_dot;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_dot=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-dot requires doxygen-dot" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_dot=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-dot" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_dot=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_dot=0
+
+
+
+fi
+
+if test "$DX_FLAG_dot" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dot", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dot; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DOT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_DOT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_DOT="$DX_DOT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_DOT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_DOT=$ac_cv_path_DX_DOT
+if test -n "$DX_DOT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DOT" >&5
+$as_echo "$DX_DOT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DOT"; then
+  ac_pt_DX_DOT=$DX_DOT
+  # Extract the first word of "dot", so it can be a program name with args.
+set dummy dot; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DOT+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_DOT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_DOT="$ac_pt_DX_DOT" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_DOT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_DOT=$ac_cv_path_ac_pt_DX_DOT
+if test -n "$ac_pt_DX_DOT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DOT" >&5
+$as_echo "$ac_pt_DX_DOT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_DOT" = x; then
+    DX_DOT=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_DOT=$ac_pt_DX_DOT
+  fi
+else
+  DX_DOT="$ac_cv_path_DX_DOT"
+fi
+
+if test "$DX_FLAG_dot$DX_DOT" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dot not found - will not generate graphics for doxygen documentation" >&5
+$as_echo "$as_me: WARNING: dot not found - will not generate graphics for doxygen documentation" >&2;}
+    DX_FLAG_dot=0
+
+fi
+
+    :
+fi
+if test "$DX_FLAG_dot" = 1; then
+     if :; then
+  DX_COND_dot_TRUE=
+  DX_COND_dot_FALSE='#'
+else
+  DX_COND_dot_TRUE='#'
+  DX_COND_dot_FALSE=
+fi
+
+    DX_ENV="$DX_ENV HAVE_DOT='YES'"
+
+             DX_ENV="$DX_ENV DOT_PATH='`expr ".$DX_DOT" : '\(\.\)[^/]*$' \| "x$DX_DOT" : 'x\(.*\)/[^/]*$'`'"
+
+    :
+else
+     if false; then
+  DX_COND_dot_TRUE=
+  DX_COND_dot_FALSE='#'
+else
+  DX_COND_dot_TRUE='#'
+  DX_COND_dot_FALSE=
+fi
+
+    DX_ENV="$DX_ENV HAVE_DOT='NO'"
+
+    :
+fi
+
+
+# Man pages generation:
+
+
+
+    # Check whether --enable-doxygen-man was given.
+if test "${enable_doxygen_man+set}" = set; then :
+  enableval=$enable_doxygen_man;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_man=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-man requires doxygen-man" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_man=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-man" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_man=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_man=0
+
+
+
+fi
+
+if test "$DX_FLAG_man" = 1; then
+
+    :
+fi
+if test "$DX_FLAG_man" = 1; then
+     if :; then
+  DX_COND_man_TRUE=
+  DX_COND_man_FALSE='#'
+else
+  DX_COND_man_TRUE='#'
+  DX_COND_man_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_MAN='YES'"
+
+    :
+else
+     if false; then
+  DX_COND_man_TRUE=
+  DX_COND_man_FALSE='#'
+else
+  DX_COND_man_TRUE='#'
+  DX_COND_man_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_MAN='NO'"
+
+    :
+fi
+
+
+# RTF file generation:
+
+
+
+    # Check whether --enable-doxygen-rtf was given.
+if test "${enable_doxygen_rtf+set}" = set; then :
+  enableval=$enable_doxygen_rtf;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_rtf=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-rtf requires doxygen-rtf" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_rtf=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-rtf" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_rtf=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_rtf=0
+
+
+
+fi
+
+if test "$DX_FLAG_rtf" = 1; then
+
+    :
+fi
+if test "$DX_FLAG_rtf" = 1; then
+     if :; then
+  DX_COND_rtf_TRUE=
+  DX_COND_rtf_FALSE='#'
+else
+  DX_COND_rtf_TRUE='#'
+  DX_COND_rtf_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_RTF='YES'"
+
+    :
+else
+     if false; then
+  DX_COND_rtf_TRUE=
+  DX_COND_rtf_FALSE='#'
+else
+  DX_COND_rtf_TRUE='#'
+  DX_COND_rtf_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_RTF='NO'"
+
+    :
+fi
+
+
+# XML file generation:
+
+
+
+    # Check whether --enable-doxygen-xml was given.
+if test "${enable_doxygen_xml+set}" = set; then :
+  enableval=$enable_doxygen_xml;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_xml=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-xml requires doxygen-xml" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_xml=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-xml" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_xml=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_xml=0
+
+
+
+fi
+
+if test "$DX_FLAG_xml" = 1; then
+
+    :
+fi
+if test "$DX_FLAG_xml" = 1; then
+     if :; then
+  DX_COND_xml_TRUE=
+  DX_COND_xml_FALSE='#'
+else
+  DX_COND_xml_TRUE='#'
+  DX_COND_xml_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_XML='YES'"
+
+    :
+else
+     if false; then
+  DX_COND_xml_TRUE=
+  DX_COND_xml_FALSE='#'
+else
+  DX_COND_xml_TRUE='#'
+  DX_COND_xml_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_XML='NO'"
+
+    :
+fi
+
+
+# (Compressed) HTML help generation:
+
+
+
+    # Check whether --enable-doxygen-chm was given.
+if test "${enable_doxygen_chm+set}" = set; then :
+  enableval=$enable_doxygen_chm;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_chm=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-chm requires doxygen-chm" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_chm=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-chm" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_chm=0
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_chm=0
+
+
+
+fi
+
+if test "$DX_FLAG_chm" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}hhc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}hhc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_HHC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_HHC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_HHC="$DX_HHC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_HHC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_HHC=$ac_cv_path_DX_HHC
+if test -n "$DX_HHC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_HHC" >&5
+$as_echo "$DX_HHC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_HHC"; then
+  ac_pt_DX_HHC=$DX_HHC
+  # Extract the first word of "hhc", so it can be a program name with args.
+set dummy hhc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_HHC+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_HHC in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_HHC="$ac_pt_DX_HHC" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_HHC="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_HHC=$ac_cv_path_ac_pt_DX_HHC
+if test -n "$ac_pt_DX_HHC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_HHC" >&5
+$as_echo "$ac_pt_DX_HHC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_HHC" = x; then
+    DX_HHC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_HHC=$ac_pt_DX_HHC
+  fi
+else
+  DX_HHC="$ac_cv_path_DX_HHC"
+fi
+
+if test "$DX_FLAG_chm$DX_HHC" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&5
+$as_echo "$as_me: WARNING: hhc not found - will not generate doxygen compressed HTML help documentation" >&2;}
+    DX_FLAG_chm=0
+
+fi
+
+    :
+fi
+if test "$DX_FLAG_chm" = 1; then
+     if :; then
+  DX_COND_chm_TRUE=
+  DX_COND_chm_FALSE='#'
+else
+  DX_COND_chm_TRUE='#'
+  DX_COND_chm_FALSE=
+fi
+
+    DX_ENV="$DX_ENV HHC_PATH='$DX_HHC'"
+
+             DX_ENV="$DX_ENV GENERATE_HTML='YES'"
+
+             DX_ENV="$DX_ENV GENERATE_HTMLHELP='YES'"
+
+    :
+else
+     if false; then
+  DX_COND_chm_TRUE=
+  DX_COND_chm_FALSE='#'
+else
+  DX_COND_chm_TRUE='#'
+  DX_COND_chm_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_HTMLHELP='NO'"
+
+    :
+fi
+
+
+# Seperate CHI file generation.
+
+
+
+    # Check whether --enable-doxygen-chi was given.
+if test "${enable_doxygen_chi+set}" = set; then :
+  enableval=$enable_doxygen_chi;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_chi=1
+
+
+test "$DX_FLAG_chm" = "1" \
+|| as_fn_error $? "doxygen-chi requires doxygen-chi" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_chi=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-chi" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_chi=0
+
+
+test "$DX_FLAG_chm" = "1" || DX_FLAG_chi=0
+
+
+
+fi
+
+if test "$DX_FLAG_chi" = 1; then
+
+    :
+fi
+if test "$DX_FLAG_chi" = 1; then
+     if :; then
+  DX_COND_chi_TRUE=
+  DX_COND_chi_FALSE='#'
+else
+  DX_COND_chi_TRUE='#'
+  DX_COND_chi_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_CHI='YES'"
+
+    :
+else
+     if false; then
+  DX_COND_chi_TRUE=
+  DX_COND_chi_FALSE='#'
+else
+  DX_COND_chi_TRUE='#'
+  DX_COND_chi_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_CHI='NO'"
+
+    :
+fi
+
+
+# Plain HTML pages generation:
+
+
+
+    # Check whether --enable-doxygen-html was given.
+if test "${enable_doxygen_html+set}" = set; then :
+  enableval=$enable_doxygen_html;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_html=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-html requires doxygen-html" "$LINENO" 5
+
+test "$DX_FLAG_chm" = "0" \
+|| as_fn_error $? "doxygen-html contradicts doxygen-html" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_html=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-html" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_html=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_html=0
+
+
+test "$DX_FLAG_chm" = "0" || DX_FLAG_html=0
+
+
+
+fi
+
+if test "$DX_FLAG_html" = 1; then
+
+    :
+fi
+if test "$DX_FLAG_html" = 1; then
+     if :; then
+  DX_COND_html_TRUE=
+  DX_COND_html_FALSE='#'
+else
+  DX_COND_html_TRUE='#'
+  DX_COND_html_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_HTML='YES'"
+
+    :
+else
+     if false; then
+  DX_COND_html_TRUE=
+  DX_COND_html_FALSE='#'
+else
+  DX_COND_html_TRUE='#'
+  DX_COND_html_FALSE=
+fi
+
+    test "$DX_FLAG_chm" = 1 || DX_ENV="$DX_ENV GENERATE_HTML='NO'"
+
+    :
+fi
+
+
+# PostScript file generation:
+
+
+
+    # Check whether --enable-doxygen-ps was given.
+if test "${enable_doxygen_ps+set}" = set; then :
+  enableval=$enable_doxygen_ps;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_ps=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-ps requires doxygen-ps" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_ps=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-ps" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_ps=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_ps=0
+
+
+
+fi
+
+if test "$DX_FLAG_ps" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}latex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_LATEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_LATEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_LATEX="$DX_LATEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_LATEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_LATEX=$ac_cv_path_DX_LATEX
+if test -n "$DX_LATEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_LATEX" >&5
+$as_echo "$DX_LATEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_LATEX"; then
+  ac_pt_DX_LATEX=$DX_LATEX
+  # Extract the first word of "latex", so it can be a program name with args.
+set dummy latex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_LATEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_LATEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_LATEX="$ac_pt_DX_LATEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_LATEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_LATEX=$ac_cv_path_ac_pt_DX_LATEX
+if test -n "$ac_pt_DX_LATEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_LATEX" >&5
+$as_echo "$ac_pt_DX_LATEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_LATEX" = x; then
+    DX_LATEX=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_LATEX=$ac_pt_DX_LATEX
+  fi
+else
+  DX_LATEX="$ac_cv_path_DX_LATEX"
+fi
+
+if test "$DX_FLAG_ps$DX_LATEX" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: latex not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: latex not found - will not generate doxygen PostScript documentation" >&2;}
+    DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_MAKEINDEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_MAKEINDEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX
+if test -n "$DX_MAKEINDEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5
+$as_echo "$DX_MAKEINDEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_MAKEINDEX"; then
+  ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX
+  # Extract the first word of "makeindex", so it can be a program name with args.
+set dummy makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_MAKEINDEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_MAKEINDEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX
+if test -n "$ac_pt_DX_MAKEINDEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5
+$as_echo "$ac_pt_DX_MAKEINDEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_MAKEINDEX" = x; then
+    DX_MAKEINDEX=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX
+  fi
+else
+  DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX"
+fi
+
+if test "$DX_FLAG_ps$DX_MAKEINDEX" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PostScript documentation" >&2;}
+    DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dvips", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dvips; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_DVIPS+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_DVIPS in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_DVIPS="$DX_DVIPS" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_DVIPS=$ac_cv_path_DX_DVIPS
+if test -n "$DX_DVIPS"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_DVIPS" >&5
+$as_echo "$DX_DVIPS" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_DVIPS"; then
+  ac_pt_DX_DVIPS=$DX_DVIPS
+  # Extract the first word of "dvips", so it can be a program name with args.
+set dummy dvips; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_DVIPS+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_DVIPS in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_DVIPS="$ac_pt_DX_DVIPS" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_DVIPS="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_DVIPS=$ac_cv_path_ac_pt_DX_DVIPS
+if test -n "$ac_pt_DX_DVIPS"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_DVIPS" >&5
+$as_echo "$ac_pt_DX_DVIPS" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_DVIPS" = x; then
+    DX_DVIPS=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_DVIPS=$ac_pt_DX_DVIPS
+  fi
+else
+  DX_DVIPS="$ac_cv_path_DX_DVIPS"
+fi
+
+if test "$DX_FLAG_ps$DX_DVIPS" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: dvips not found - will not generate doxygen PostScript documentation" >&2;}
+    DX_FLAG_ps=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_EGREP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_EGREP=$ac_cv_path_DX_EGREP
+if test -n "$DX_EGREP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5
+$as_echo "$DX_EGREP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_EGREP"; then
+  ac_pt_DX_EGREP=$DX_EGREP
+  # Extract the first word of "egrep", so it can be a program name with args.
+set dummy egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_EGREP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP
+if test -n "$ac_pt_DX_EGREP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5
+$as_echo "$ac_pt_DX_EGREP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_EGREP" = x; then
+    DX_EGREP=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_EGREP=$ac_pt_DX_EGREP
+  fi
+else
+  DX_EGREP="$ac_cv_path_DX_EGREP"
+fi
+
+if test "$DX_FLAG_ps$DX_EGREP" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&5
+$as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PostScript documentation" >&2;}
+    DX_FLAG_ps=0
+
+fi
+
+    :
+fi
+if test "$DX_FLAG_ps" = 1; then
+     if :; then
+  DX_COND_ps_TRUE=
+  DX_COND_ps_FALSE='#'
+else
+  DX_COND_ps_TRUE='#'
+  DX_COND_ps_FALSE=
+fi
+
+
+    :
+else
+     if false; then
+  DX_COND_ps_TRUE=
+  DX_COND_ps_FALSE='#'
+else
+  DX_COND_ps_TRUE='#'
+  DX_COND_ps_FALSE=
+fi
+
+
+    :
+fi
+
+
+# PDF file generation:
+
+
+
+    # Check whether --enable-doxygen-pdf was given.
+if test "${enable_doxygen_pdf+set}" = set; then :
+  enableval=$enable_doxygen_pdf;
+case "$enableval" in
+#(
+y|Y|yes|Yes|YES)
+    DX_FLAG_pdf=1
+
+
+test "$DX_FLAG_doc" = "1" \
+|| as_fn_error $? "doxygen-pdf requires doxygen-pdf" "$LINENO" 5
+
+;; #(
+n|N|no|No|NO)
+    DX_FLAG_pdf=0
+
+;; #(
+*)
+    as_fn_error $? "invalid value '$enableval' given to doxygen-pdf" "$LINENO" 5
+;;
+esac
+
+else
+
+DX_FLAG_pdf=1
+
+
+test "$DX_FLAG_doc" = "1" || DX_FLAG_pdf=0
+
+
+
+fi
+
+if test "$DX_FLAG_pdf" = 1; then
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}pdflatex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}pdflatex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_PDFLATEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_PDFLATEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_PDFLATEX="$DX_PDFLATEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_PDFLATEX=$ac_cv_path_DX_PDFLATEX
+if test -n "$DX_PDFLATEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_PDFLATEX" >&5
+$as_echo "$DX_PDFLATEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_PDFLATEX"; then
+  ac_pt_DX_PDFLATEX=$DX_PDFLATEX
+  # Extract the first word of "pdflatex", so it can be a program name with args.
+set dummy pdflatex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_PDFLATEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_PDFLATEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_PDFLATEX="$ac_pt_DX_PDFLATEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_PDFLATEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_PDFLATEX=$ac_cv_path_ac_pt_DX_PDFLATEX
+if test -n "$ac_pt_DX_PDFLATEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_PDFLATEX" >&5
+$as_echo "$ac_pt_DX_PDFLATEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_PDFLATEX" = x; then
+    DX_PDFLATEX=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_PDFLATEX=$ac_pt_DX_PDFLATEX
+  fi
+else
+  DX_PDFLATEX="$ac_cv_path_DX_PDFLATEX"
+fi
+
+if test "$DX_FLAG_pdf$DX_PDFLATEX" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: pdflatex not found - will not generate doxygen PDF documentation" >&2;}
+    DX_FLAG_pdf=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}makeindex", so it can be a program name with args.
+set dummy ${ac_tool_prefix}makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_MAKEINDEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_MAKEINDEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_MAKEINDEX="$DX_MAKEINDEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_MAKEINDEX=$ac_cv_path_DX_MAKEINDEX
+if test -n "$DX_MAKEINDEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_MAKEINDEX" >&5
+$as_echo "$DX_MAKEINDEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_MAKEINDEX"; then
+  ac_pt_DX_MAKEINDEX=$DX_MAKEINDEX
+  # Extract the first word of "makeindex", so it can be a program name with args.
+set dummy makeindex; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_MAKEINDEX+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_MAKEINDEX in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_MAKEINDEX="$ac_pt_DX_MAKEINDEX" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_MAKEINDEX="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_MAKEINDEX=$ac_cv_path_ac_pt_DX_MAKEINDEX
+if test -n "$ac_pt_DX_MAKEINDEX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_MAKEINDEX" >&5
+$as_echo "$ac_pt_DX_MAKEINDEX" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_MAKEINDEX" = x; then
+    DX_MAKEINDEX=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_MAKEINDEX=$ac_pt_DX_MAKEINDEX
+  fi
+else
+  DX_MAKEINDEX="$ac_cv_path_DX_MAKEINDEX"
+fi
+
+if test "$DX_FLAG_pdf$DX_MAKEINDEX" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: makeindex not found - will not generate doxygen PDF documentation" >&2;}
+    DX_FLAG_pdf=0
+
+fi
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}egrep", so it can be a program name with args.
+set dummy ${ac_tool_prefix}egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_DX_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $DX_EGREP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_DX_EGREP="$DX_EGREP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+DX_EGREP=$ac_cv_path_DX_EGREP
+if test -n "$DX_EGREP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DX_EGREP" >&5
+$as_echo "$DX_EGREP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_path_DX_EGREP"; then
+  ac_pt_DX_EGREP=$DX_EGREP
+  # Extract the first word of "egrep", so it can be a program name with args.
+set dummy egrep; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_DX_EGREP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $ac_pt_DX_EGREP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_ac_pt_DX_EGREP="$ac_pt_DX_EGREP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_ac_pt_DX_EGREP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
+fi
+ac_pt_DX_EGREP=$ac_cv_path_ac_pt_DX_EGREP
+if test -n "$ac_pt_DX_EGREP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_DX_EGREP" >&5
+$as_echo "$ac_pt_DX_EGREP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_pt_DX_EGREP" = x; then
+    DX_EGREP=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DX_EGREP=$ac_pt_DX_EGREP
+  fi
+else
+  DX_EGREP="$ac_cv_path_DX_EGREP"
+fi
+
+if test "$DX_FLAG_pdf$DX_EGREP" = 1; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: egrep not found - will not generate doxygen PDF documentation" >&5
+$as_echo "$as_me: WARNING: egrep not found - will not generate doxygen PDF documentation" >&2;}
+    DX_FLAG_pdf=0
+
+fi
+
+    :
+fi
+if test "$DX_FLAG_pdf" = 1; then
+     if :; then
+  DX_COND_pdf_TRUE=
+  DX_COND_pdf_FALSE='#'
+else
+  DX_COND_pdf_TRUE='#'
+  DX_COND_pdf_FALSE=
+fi
+
+
+    :
+else
+     if false; then
+  DX_COND_pdf_TRUE=
+  DX_COND_pdf_FALSE='#'
+else
+  DX_COND_pdf_TRUE='#'
+  DX_COND_pdf_FALSE=
+fi
+
+
+    :
+fi
+
+
+# LaTeX generation for PS and/or PDF:
+if test "$DX_FLAG_ps" = 1 || test "$DX_FLAG_pdf" = 1; then
+     if :; then
+  DX_COND_latex_TRUE=
+  DX_COND_latex_FALSE='#'
+else
+  DX_COND_latex_TRUE='#'
+  DX_COND_latex_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_LATEX='YES'"
+
+else
+     if false; then
+  DX_COND_latex_TRUE=
+  DX_COND_latex_FALSE='#'
+else
+  DX_COND_latex_TRUE='#'
+  DX_COND_latex_FALSE=
+fi
+
+    DX_ENV="$DX_ENV GENERATE_LATEX='NO'"
+
+fi
+
+# Paper size for PS and/or PDF:
+
+case "$DOXYGEN_PAPER_SIZE" in
+#(
+"")
+    DOXYGEN_PAPER_SIZE=""
+
+;; #(
+a4wide|a4|letter|legal|executive)
+    DX_ENV="$DX_ENV PAPER_SIZE='$DOXYGEN_PAPER_SIZE'"
+
+;; #(
+*)
+    as_fn_error $? "unknown DOXYGEN_PAPER_SIZE='$DOXYGEN_PAPER_SIZE'" "$LINENO" 5
+;;
+esac
+
+#For debugging:
+#echo DX_FLAG_doc=$DX_FLAG_doc
+#echo DX_FLAG_dot=$DX_FLAG_dot
+#echo DX_FLAG_man=$DX_FLAG_man
+#echo DX_FLAG_html=$DX_FLAG_html
+#echo DX_FLAG_chm=$DX_FLAG_chm
+#echo DX_FLAG_chi=$DX_FLAG_chi
+#echo DX_FLAG_rtf=$DX_FLAG_rtf
+#echo DX_FLAG_xml=$DX_FLAG_xml
+#echo DX_FLAG_pdf=$DX_FLAG_pdf
+#echo DX_FLAG_ps=$DX_FLAG_ps
+#echo DX_ENV=$DX_ENV
+#, DOXYFILE-PATH, [OUTPUT-DIR])
+#DX_DOXYGEN_FEATURE(ON)
+#DX_DOT_FEATURE(ON)
+#DX_HTML_FEATURE(ON)
+#DX_CHM_FEATURE(ON|OFF)
+#DX_CHI_FEATURE(ON|OFF)
+
+#DX_RTF_FEATURE(ON|OFF)
+#DX_XML_FEATURE(ON|OFF)
+#DX_PDF_FEATURE(ON|OFF)
+
+DX_ENV="$DX_ENV EXTRACT_ALL='YES'"
+
+DX_ENV="$DX_ENV RECURSIVE='YES'"
+
+DX_ENV="$DX_ENV ALL_GRAPHS='NO'"
+  # change to yet to switch on call(er) graphs
+
+#USE_HTAGS              = $(USE_HTAGS)
+
+
+
+# Check whether --with-boost was given.
+if test "${with_boost+set}" = set; then :
+  withval=$with_boost;
+    if test "$withval" = "no"; then
+		want_boost="no"
+    elif test "$withval" = "yes"; then
+        want_boost="yes"
+        ac_boost_path=""
+    else
+	    want_boost="yes"
+        ac_boost_path="$withval"
+	fi
+
+else
+  want_boost="yes"
+fi
+
+
+
+
+# Check whether --with-boost-libdir was given.
+if test "${with_boost_libdir+set}" = set; then :
+  withval=$with_boost_libdir;
+        if test -d $withval
+        then
+                ac_boost_lib_path="$withval"
+        else
+                as_fn_error $? "--with-boost-libdir expected directory name" "$LINENO" 5
+        fi
+
+else
+  ac_boost_lib_path=""
+
+fi
+
+
+if test "x$want_boost" = "xyes"; then
+	boost_lib_version_req=1.42
+	boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([0-9]*\.[0-9]*\)'`
+	boost_lib_version_req_major=`expr $boost_lib_version_req : '\([0-9]*\)'`
+	boost_lib_version_req_minor=`expr $boost_lib_version_req : '[0-9]*\.\([0-9]*\)'`
+	boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
+	if test "x$boost_lib_version_req_sub_minor" = "x" ; then
+		boost_lib_version_req_sub_minor="0"
+    	fi
+	WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+  $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for boostlib >= $boost_lib_version_req" >&5
+$as_echo_n "checking for boostlib >= $boost_lib_version_req... " >&6; }
+	succeeded=no
+
+				if test "$ac_boost_path" != ""; then
+		BOOST_LDFLAGS="-L$ac_boost_path/lib"
+		BOOST_CPPFLAGS="-I$ac_boost_path/include"
+	else
+		for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
+			if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
+				BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
+				BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
+				break;
+			fi
+		done
+	fi
+
+            if test "$ac_boost_lib_path" != ""; then
+       BOOST_LDFLAGS="-L$ac_boost_lib_path"
+    fi
+
+	CPPFLAGS_SAVED="$CPPFLAGS"
+	CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+	export CPPFLAGS
+
+	LDFLAGS_SAVED="$LDFLAGS"
+	LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+	export LDFLAGS
+
+	ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+     	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+	#include <boost/version.hpp>
+
+int
+main ()
+{
+
+	#if BOOST_VERSION >= $WANT_BOOST_VERSION
+	// Everything is okay
+	#else
+	#  error Boost version is too old
+	#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	succeeded=yes
+	found_system=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+			if test "x$succeeded" != "xyes"; then
+		_version=0
+		if test "$ac_boost_path" != ""; then
+			if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+				for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+					_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+					V_CHECK=`expr $_version_tmp \> $_version`
+					if test "$V_CHECK" = "1" ; then
+						_version=$_version_tmp
+					fi
+					VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+					BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
+				done
+			fi
+		else
+			for ac_boost_path in /usr /usr/local /opt /opt/local ; do
+				if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
+					for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
+						_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
+						V_CHECK=`expr $_version_tmp \> $_version`
+						if test "$V_CHECK" = "1" ; then
+							_version=$_version_tmp
+	               					best_path=$ac_boost_path
+						fi
+					done
+				fi
+			done
+
+			VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
+			BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
+            if test "$ac_boost_lib_path" = ""
+            then
+               BOOST_LDFLAGS="-L$best_path/lib"
+            fi
+
+	    		if test "x$BOOST_ROOT" != "x"; then
+				if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
+					version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
+					stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
+			        	stage_version_shorten=`expr $stage_version : '\([0-9]*\.[0-9]*\)'`
+					V_CHECK=`expr $stage_version_shorten \>\= $_version`
+                    if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
+						{ $as_echo "$as_me:${as_lineno-$LINENO}: We will use a staged boost library from $BOOST_ROOT" >&5
+$as_echo "$as_me: We will use a staged boost library from $BOOST_ROOT" >&6;}
+						BOOST_CPPFLAGS="-I$BOOST_ROOT"
+						BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
+					fi
+				fi
+	    		fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+		ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+	     	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+		#include <boost/version.hpp>
+
+int
+main ()
+{
+
+		#if BOOST_VERSION >= $WANT_BOOST_VERSION
+		// Everything is okay
+		#else
+		#  error Boost version is too old
+		#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+        	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+		succeeded=yes
+		found_system=yes
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+		ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+	fi
+
+	if test "$succeeded" != "yes" ; then
+		if test "$_version" = "0" ; then
+			as_fn_error $? "We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option.  If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation." "$LINENO" 5
+		else
+			{ $as_echo "$as_me:${as_lineno-$LINENO}: Your boost libraries seems to old (version $_version)." >&5
+$as_echo "$as_me: Your boost libraries seems to old (version $_version)." >&6;}
+		fi
+	else
+
+
+
+$as_echo "#define HAVE_BOOST /**/" >>confdefs.h
+
+	fi
+
+        CPPFLAGS="$CPPFLAGS_SAVED"
+       	LDFLAGS="$LDFLAGS_SAVED"
+fi
+
+
+
+
+
+# Check whether --with-boost-asio was given.
+if test "${with_boost_asio+set}" = set; then :
+  withval=$with_boost_asio;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_asio_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_asio_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::ASIO library is available" >&5
+$as_echo_n "checking whether the Boost::ASIO library is available... " >&6; }
+if test "${ax_cv_boost_asio+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+		 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include <boost/asio.hpp>
+
+int
+main ()
+{
+
+
+                                    boost::asio::io_service io;
+                                    boost::system::error_code timer_result;
+                                    boost::asio::deadline_timer t(io);
+                                    t.cancel();
+                                    io.run_one();
+									return 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_asio=yes
+else
+  ax_cv_boost_asio=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_asio" >&5
+$as_echo "$ax_cv_boost_asio" >&6; }
+		if test "x$ax_cv_boost_asio" = "xyes"; then
+
+$as_echo "#define HAVE_BOOST_ASIO /**/" >>confdefs.h
+
+			BN=boost_system
+            if test "x$ax_boost_user_asio_lib" = "x"; then
+				for ax_lib in $BN $BN-$CC $BN-$CC-mt $BN-$CC-mt-s $BN-$CC-s \
+                              lib$BN lib$BN-$CC lib$BN-$CC-mt lib$BN-$CC-mt-s lib$BN-$CC-s \
+                              $BN-mgw $BN-mgw $BN-mgw-mt $BN-mgw-mt-s $BN-mgw-s ; do
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
+$as_echo_n "checking for main in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_ASIO_LIB="-l$ax_lib"  link_thread="yes" break
+else
+  link_thread="no"
+fi
+
+  				done
+            else
+               for ax_lib in $ax_boost_user_asio_lib $BN-$ax_boost_user_asio_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
+$as_echo_n "checking for main in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_ASIO_LIB="-l$ax_lib"  link_asio="yes" break
+else
+  link_asio="no"
+fi
+
+                  done
+
+            fi
+			if test "x$link_asio" = "xno"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
+
+
+# Check whether --with-boost-date-time was given.
+if test "${with_boost_date_time+set}" = set; then :
+  withval=$with_boost_date_time;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_date_time_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_date_time_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Date_Time library is available" >&5
+$as_echo_n "checking whether the Boost::Date_Time library is available... " >&6; }
+if test "${ax_cv_boost_date_time+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+		 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/date_time/gregorian/gregorian_types.hpp>
+int
+main ()
+{
+using namespace boost::gregorian; date d(2002,Jan,10);
+                                     return 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_date_time=yes
+else
+  ax_cv_boost_date_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_date_time" >&5
+$as_echo "$ax_cv_boost_date_time" >&6; }
+		if test "x$ax_cv_boost_date_time" = "xyes"; then
+
+$as_echo "#define HAVE_BOOST_DATE_TIME /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+            if test "x$ax_boost_user_date_time_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_date_time*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_date_time.*\)\.so.*$;\1;' -e 's;^lib\(boost_date_time.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_DATE_TIME_LIB="-l$ax_lib";  link_date_time="yes"; break
+else
+  link_date_time="no"
+fi
+
+  				done
+                if test "x$link_date_time" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_date_time*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_date_time.*\)\.dll.*$;\1;' -e 's;^\(boost_date_time.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_DATE_TIME_LIB="-l$ax_lib";  link_date_time="yes"; break
+else
+  link_date_time="no"
+fi
+
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_date_time_lib boost_date_time-$ax_boost_user_date_time_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
+$as_echo_n "checking for main in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_DATE_TIME_LIB="-l$ax_lib";  link_date_time="yes"; break
+else
+  link_date_time="no"
+fi
+
+                  done
+
+            fi
+			if test "x$link_date_time" != "xyes"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
+
+
+# Check whether --with-boost-filesystem was given.
+if test "${with_boost_filesystem+set}" = set; then :
+  withval=$with_boost_filesystem;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_filesystem_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_filesystem_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+		LIBS_SAVED=$LIBS
+		LIBS="$LIBS $BOOST_SYSTEM_LIB"
+		export LIBS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Filesystem library is available" >&5
+$as_echo_n "checking whether the Boost::Filesystem library is available... " >&6; }
+if test "${ax_cv_boost_filesystem+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/filesystem/path.hpp>
+int
+main ()
+{
+using namespace boost::filesystem;
+                                   path my_path( "foo/bar/data.txt" );
+                                   return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_filesystem=yes
+else
+  ax_cv_boost_filesystem=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_filesystem" >&5
+$as_echo "$ax_cv_boost_filesystem" >&6; }
+		if test "x$ax_cv_boost_filesystem" = "xyes"; then
+
+$as_echo "#define HAVE_BOOST_FILESYSTEM /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+            if test "x$ax_boost_user_filesystem_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_filesystem*.{so,dylib,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_filesystem.*\)\.so.*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.a*$;\1;' -e 's;^lib\(boost_filesystem.*\)\.dylib$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
+else
+  link_filesystem="no"
+fi
+
+  				done
+                if test "x$link_program_options" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_filesystem*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_filesystem.*\)\.dll.*$;\1;' -e 's;^\(boost_filesystem.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
+else
+  link_filesystem="no"
+fi
+
+  				done
+	            fi
+            else
+               for ax_lib in $ax_boost_user_filesystem_lib boost_filesystem-$ax_boost_user_filesystem_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_FILESYSTEM_LIB="-l$ax_lib";  link_filesystem="yes"; break
+else
+  link_filesystem="no"
+fi
+
+                  done
+
+            fi
+			if test "x$link_filesystem" != "xyes"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    		LDFLAGS="$LDFLAGS_SAVED"
+		LIBS="$LIBS_SAVED"
+	fi
+
+
+
+# Check whether --with-boost-program-options was given.
+if test "${with_boost_program_options+set}" = set; then :
+  withval=$with_boost_program_options;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_program_options_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_program_options_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+	    export want_boost
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Program_Options library is available" >&5
+$as_echo_n "checking whether the Boost::Program_Options library is available... " >&6; }
+if test "${ax_cv_boost_program_options+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ 		                cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/program_options.hpp>
+
+int
+main ()
+{
+boost::program_options::options_description generic("Generic options");
+                                   return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_program_options=yes
+else
+  ax_cv_boost_program_options=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+			               	ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_program_options" >&5
+$as_echo "$ax_cv_boost_program_options" >&6; }
+		if test "$ax_cv_boost_program_options" = yes; then
+
+$as_echo "#define HAVE_BOOST_PROGRAM_OPTIONS /**/" >>confdefs.h
+
+                  BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+                if test "x$ax_boost_user_program_options_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_program_options*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_program_options.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib";  link_program_options="yes"; break
+else
+  link_program_options="no"
+fi
+
+  				done
+                if test "x$link_program_options" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_program_options*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_program_options*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_program_options.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib";  link_program_options="yes"; break
+else
+  link_program_options="no"
+fi
+
+  				done
+                fi
+                else
+                  for ax_lib in $ax_boost_user_program_options_lib boost_program_options-$ax_boost_user_program_options_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
+$as_echo_n "checking for main in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_PROGRAM_OPTIONS_LIB="-l$ax_lib";  link_program_options="yes"; break
+else
+  link_program_options="no"
+fi
+
+                  done
+                fi
+				if test "x$link_program_options" != "xyes"; then
+					as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+				fi
+		fi
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
+
+
+# Check whether --with-boost-regex was given.
+if test "${with_boost_regex+set}" = set; then :
+  withval=$with_boost_regex;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_regex_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_regex_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Regex library is available" >&5
+$as_echo_n "checking whether the Boost::Regex library is available... " >&6; }
+if test "${ax_cv_boost_regex+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/regex.hpp>
+
+int
+main ()
+{
+boost::regex r(); return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_regex=yes
+else
+  ax_cv_boost_regex=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_regex" >&5
+$as_echo "$ax_cv_boost_regex" >&6; }
+		if test "x$ax_cv_boost_regex" = "xyes"; then
+
+$as_echo "#define HAVE_BOOST_REGEX /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+            if test "x$ax_boost_user_regex_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_regex*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_regex.*\)\.so.*$;\1;' -e 's;^lib\(boost_regex.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
+else
+  link_regex="no"
+fi
+
+  				done
+                if test "x$link_regex" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_regex*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_regex.*\)\.dll.*$;\1;' -e 's;^\(boost_regex.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
+else
+  link_regex="no"
+fi
+
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_regex_lib boost_regex-$ax_boost_user_regex_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_main" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -l$ax_lib" >&5
+$as_echo_n "checking for main in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+return main ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_REGEX_LIB="-l$ax_lib";  link_regex="yes"; break
+else
+  link_regex="no"
+fi
+
+               done
+            fi
+			if test "x$link_regex" != "xyes"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
+
+
+# Check whether --with-boost-system was given.
+if test "${with_boost_system+set}" = set; then :
+  withval=$with_boost_system;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_system_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_system_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::System library is available" >&5
+$as_echo_n "checking whether the Boost::System library is available... " >&6; }
+if test "${ax_cv_boost_system+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+			 CXXFLAGS_SAVE=$CXXFLAGS
+
+			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/system/error_code.hpp>
+int
+main ()
+{
+boost::system::system_category
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_system=yes
+else
+  ax_cv_boost_system=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_system" >&5
+$as_echo "$ax_cv_boost_system" >&6; }
+		if test "x$ax_cv_boost_system" = "xyes"; then
+
+
+
+$as_echo "#define HAVE_BOOST_SYSTEM /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+
+			LDFLAGS_SAVE=$LDFLAGS
+            if test "x$ax_boost_user_system_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_system*.{so,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_system.*\)\.so.*$;\1;' -e 's;^lib\(boost_system.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+else
+  link_system="no"
+fi
+
+  				done
+                if test "x$link_system" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_system*.{dll,a}* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_system.*\)\.dll.*$;\1;' -e 's;^\(boost_system.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+else
+  link_system="no"
+fi
+
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_system_lib boost_system-$ax_boost_user_system_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_SYSTEM_LIB="-l$ax_lib";  link_system="yes"; break
+else
+  link_system="no"
+fi
+
+                  done
+
+            fi
+			if test "x$link_system" = "xno"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
+
+
+# Check whether --with-boost-thread was given.
+if test "${with_boost_thread+set}" = set; then :
+  withval=$with_boost_thread;
+        if test "$withval" = "no"; then
+			want_boost="no"
+        elif test "$withval" = "yes"; then
+            want_boost="yes"
+            ax_boost_user_thread_lib=""
+        else
+		    want_boost="yes"
+        	ax_boost_user_thread_lib="$withval"
+		fi
+
+else
+  want_boost="yes"
+
+fi
+
+
+	if test "x$want_boost" = "xyes"; then
+
+
+		CPPFLAGS_SAVED="$CPPFLAGS"
+		CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
+		export CPPFLAGS
+
+		LDFLAGS_SAVED="$LDFLAGS"
+		LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
+		export LDFLAGS
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the Boost::Thread library is available" >&5
+$as_echo_n "checking whether the Boost::Thread library is available... " >&6; }
+if test "${ax_cv_boost_thread+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+			 CXXFLAGS_SAVE=$CXXFLAGS
+
+			 if test "x$build_os" = "xsolaris" ; then
+  				 CXXFLAGS="-pthreads $CXXFLAGS"
+			 elif test "x$build_os" = "xming32" ; then
+				 CXXFLAGS="-mthreads $CXXFLAGS"
+			 else
+				CXXFLAGS="-pthread $CXXFLAGS"
+			 fi
+			 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/thread/thread.hpp>
+int
+main ()
+{
+boost::thread_group thrds;
+                                   return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ax_cv_boost_thread=yes
+else
+  ax_cv_boost_thread=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+			 CXXFLAGS=$CXXFLAGS_SAVE
+             ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_boost_thread" >&5
+$as_echo "$ax_cv_boost_thread" >&6; }
+		if test "x$ax_cv_boost_thread" = "xyes"; then
+           if test "x$build_os" = "xsolaris" ; then
+			  BOOST_CPPFLAGS="-pthreads $BOOST_CPPFLAGS"
+		   elif test "x$build_os" = "xming32" ; then
+			  BOOST_CPPFLAGS="-mthreads $BOOST_CPPFLAGS"
+		   else
+			  BOOST_CPPFLAGS="-pthread $BOOST_CPPFLAGS"
+		   fi
+
+
+
+
+$as_echo "#define HAVE_BOOST_THREAD /**/" >>confdefs.h
+
+            BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/[^\/]*//'`
+
+			LDFLAGS_SAVE=$LDFLAGS
+                        case "x$build_os" in
+                          *bsd* )
+                               LDFLAGS="-pthread $LDFLAGS"
+                          break;
+                          ;;
+                        esac
+            if test "x$ax_boost_user_thread_lib" = "x"; then
+                for libextension in `ls $BOOSTLIBDIR/libboost_thread*.so* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.so.*$;\1;'` `ls $BOOSTLIBDIR/libboost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_thread.*\)\.a*$;\1;'`; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
+else
+  link_thread="no"
+fi
+
+  				done
+                if test "x$link_thread" != "xyes"; then
+                for libextension in `ls $BOOSTLIBDIR/boost_thread*.dll* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.dll.*$;\1;'` `ls $BOOSTLIBDIR/boost_thread*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_thread.*\)\.a*$;\1;'` ; do
+                     ax_lib=${libextension}
+				    as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
+else
+  link_thread="no"
+fi
+
+  				done
+                fi
+
+            else
+               for ax_lib in $ax_boost_user_thread_lib boost_thread-$ax_boost_user_thread_lib; do
+				      as_ac_Lib=`$as_echo "ac_cv_lib_$ax_lib''_exit" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for exit in -l$ax_lib" >&5
+$as_echo_n "checking for exit in -l$ax_lib... " >&6; }
+if eval "test \"\${$as_ac_Lib+set}\"" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-l$ax_lib  $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 exit ();
+int
+main ()
+{
+return exit ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  eval "$as_ac_Lib=yes"
+else
+  eval "$as_ac_Lib=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+eval ac_res=\$$as_ac_Lib
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  BOOST_THREAD_LIB="-l$ax_lib";  link_thread="yes"; break
+else
+  link_thread="no"
+fi
+
+                  done
+
+            fi
+			if test "x$link_thread" = "xno"; then
+				as_fn_error $? "Could not link against $ax_lib !" "$LINENO" 5
+                        else
+                           case "x$build_os" in
+                              *bsd* )
+			        BOOST_LDFLAGS="-pthread $BOOST_LDFLAGS"
+                              break;
+                              ;;
+                           esac
+
+			fi
+		fi
+
+		CPPFLAGS="$CPPFLAGS_SAVED"
+    	LDFLAGS="$LDFLAGS_SAVED"
+	fi
+
+#ax_boost_iostreams
+#ax_boost_python
+#ax_boost_serialization
+#ax_boost_signals
+#ax_boost_test_exec_monitor
+#ax_boost_unit_test_framework
+#ax_boost_wave
+#ax_boost_wserialization
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread  $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 pthread_create ();
+int
+main ()
+{
+return pthread_create ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pthread_pthread_create=yes
+else
+  ac_cv_lib_pthread_pthread_create=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_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPTHREAD 1
+_ACEOF
+
+  LIBS="-lpthread $LIBS"
+
+else
+
+      echo "Error! libpthread not found in default libarary paths."
+      exit -1
+
+
+fi
+
+for ac_header in pthread.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
+if test "x$ac_cv_header_pthread_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PTHREAD_H 1
+_ACEOF
+
+else
+
+      echo "Error! pthread.h not properly installed in default include paths."
+      exit -1
+
+
+fi
+
+done
+
+
+
+{ $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
+
+
+
+for ac_header in panel.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "panel.h" "ac_cv_header_panel_h" "$ac_includes_default"
+if test "x$ac_cv_header_panel_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_PANEL_H 1
+_ACEOF
+
+else
+
+      echo "Error! Ncurses panel.h not properly installed in default include paths."
+      exit -1
+
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for update_panels in -lpanel" >&5
+$as_echo_n "checking for update_panels in -lpanel... " >&6; }
+if test "${ac_cv_lib_panel_update_panels+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpanel  $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 update_panels ();
+int
+main ()
+{
+return update_panels ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_panel_update_panels=yes
+else
+  ac_cv_lib_panel_update_panels=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_panel_update_panels" >&5
+$as_echo "$ac_cv_lib_panel_update_panels" >&6; }
+if test "x$ac_cv_lib_panel_update_panels" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPANEL 1
+_ACEOF
+
+  LIBS="-lpanel $LIBS"
+
+else
+
+      echo "Error! Ncurses libpanel not properly installed in the default libarary paths."
+      exit -1
+
+
+fi
+
+
+
+for ac_header in Mrm/MrmAppl.h Xm/Xm.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+
+      echo "Error! Mrm/MrmAppl.h, Xm/Xm.h not properly installed, needed to compile did (you need most probably lesstif2-dev)."
+      exit -1
+
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XtToolkitInitialize in -lXm" >&5
+$as_echo_n "checking for XtToolkitInitialize in -lXm... " >&6; }
+if test "${ac_cv_lib_Xm_XtToolkitInitialize+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXm  $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 XtToolkitInitialize ();
+int
+main ()
+{
+return XtToolkitInitialize ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xm_XtToolkitInitialize=yes
+else
+  ac_cv_lib_Xm_XtToolkitInitialize=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_Xm_XtToolkitInitialize" >&5
+$as_echo "$ac_cv_lib_Xm_XtToolkitInitialize" >&6; }
+if test "x$ac_cv_lib_Xm_XtToolkitInitialize" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXM 1
+_ACEOF
+
+  LIBS="-lXm $LIBS"
+
+else
+
+      echo "Error! libXm (lesstif2) not properly installed in the default library path (needed by dim to link did)."
+      exit -1
+
+
+fi
+
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+#AC_CHECK_HEADERS(
+#   [\
+#      boost/bind.hpp \
+#      boost/lexical_cast.hpp \
+#      boost/filesystem.hpp \
+#      boost/thread.hpp \
+#      boost/function.hpp \
+#      boost/regex.hpp \
+#      boost/asio.hpp \
+#      boost/enable_shared_from_this.hpp \
+#      boost/asio/deadline_timer.hpp \
+#      boost/date_time/posix_time/posix_time.hpp \
+#      boost/date_time/local_time/local_time.hpp \
+#      boost/date_time/gregorian/gregorian.hpp
+#   ], [],
+#   [
+#      echo "Error! At least one needed header of the boost C++ libararies is missing."
+#      exit -1
+#   ]
+#)
+
+#AC_ARG_WITH([dim],
+#   [
+#      AS_HELP_STRING([--with-dim],
+#         [location of the Dim headers, defaults to dim_v19r15])
+#   ],
+#   [DIM_PATH="$withval"],
+#   [DIM_PATH="dim_v19r15"]
+#)
+#
+#AC_SUBST([DIM_PATH])
+#
+#CFLAGS="$CFLAGS -I$DIM_PATH/dim"
+#CPPFLAGS="$CPPFLAGS -I$DIM_PATH/dim"
+#INCLUDEPATH="$INCLUDEPATH -I$DIM_PATH/dim"
+#AC_CHECK_HEADERS([dis.hxx dic.hxx], [],
+#  [
+#      echo "Error! Dim headers (dis.hxx, dic.hxx) not found in $DIM_PATH/dim."
+#      exit -1
+#   ]
+#)
+
+## ============>   boost header and boost libraries
+
+##########################################################################
+#AC_ARG_WITH([dim-include-path],
+#   [
+#      AS_HELP_STRING([--with-dim-include-path],
+#         [location of the Dim headers, defaults to ${HOME}/FACT/dim_v19r11/dim])
+#   ],
+#   [DIM_INCLUDE_PATH="$withval"],
+#   [DIM_INCLUDE_PATH="${HOME}/Software/Dim/dim_v19r11/dim"]
+#)
+#DIM_CFLAGS="-I$DIM_INCLUDE_PATH"
+##AC_SUBST([DIM_CFLAGS])
+#
+#CFLAGS="$CFLAGS $DIM_CFLAGS"
+#CPPFLAGS="$CPPFLAGS $DIM_CFLAGS"
+##INCLUDEPATH="$INCLUDEPATH $DIM_INCLUDE_PATH"
+#AC_CHECK_HEADERS([dis.hxx dic.hxx], [],
+#   [
+#      echo "Error! Dim headers (dis.hxx, dic.hxx) not found in $DIM_INCLUDE_PATH."
+#      exit -1
+#   ]
+#)
+##########################################################################
+
+
+
+###########################################################################
+#AC_ARG_WITH([dim-lib-path],
+#  [
+#     AS_HELP_STRING([--with-dim-lib-path],
+#        [location of the Dim libraries, defaults to ${HOME}/FACT/dim_v19r11/linux])
+#  ],
+#  [DIM_LIB_PATH="$withval"],
+#  [DIM_LIB_PATH="${HOME}/Software/Dim/dim_v19r11/linux"]
+#)
+#DIM_LIBS="-L$DIM_LIB_PATH -ldim"
+##AC_SUBST([DIM_LIBS])
+#
+#LDFLAGS="$LDFLAGS $DIM_LIBS"
+#AC_CHECK_LIB(dim, [get_dns_port_number], [],
+#   [
+#      echo "Error! libdim.so file not found in $DIM_LIB_PATH."
+#      exit -1
+#   ]
+#)
+###########################################################################
+
+
+
+# Get MySQL++ library and include locations
+#AC_ARG_WITH([mysqlpp-include-path],
+#   [
+#      AS_HELP_STRING([--with-mysqlpp-include-path],
+#         [location of the MySQL++ librarary headers, defaults to /usr/include/mysql++])
+#   ],
+#   [MYSQLPP_INCLUDE_PATH="$withval"],
+#   [MYSQLPP_INCLUDE_PATH=""]
+##)
+#MYSQLPP_CFLAGS="-I$MYSQLPP_INCLUDE_PATH"
+##AC_SUBST([DIM_CFLAGS])
+#
+#CFLAGS="$CFLAGS $MYSQLPP_CFLAGS"
+#CPPFLAGS="$CPPFLAGS $MYSQLPP_CFLAGS"
+##INCLUDEPATH="$INCLUDEPATH $DIM_INCLUDE_PATH"
+#AC_CHECK_HEADERS([mysql++/mysql++.h],
+#   [],
+#   [
+#      echo "Error! mysql++/mysql++.h not found in default include path."
+#      exit -1
+#   ]
+#)
+#### LAST ARGUMENT IS "OTHER LIBRARIES"
+
+
+
+#AC_ARG_WITH([mysql-lib-path],
+#  [
+#     AS_HELP_STRING([--with-mysql-lib-path],
+#        [location of the MySQL library, defaults to /usr/lib])
+#  ],
+#  [MYSQL_LIB_PATH="$withval"],
+#  [MYSQL_LIB_PATH="/usr/lib"]
+#)
+#MYSQL_LIBS="-L$MYSQL_LIB_PATH -lmysql"
+##AC_SUBST([DIM_LIBS])
+#
+#LDFLAGS="$LDFLAGS $MYSQL_LIBS"
+#AC_CHECK_LIB(mysql, [mysql_errno],
+#   [],
+#   [
+#      echo "Error! mysql libarary file not found in $MYSQL_LIB_PATH."
+#      exit -1
+#   ]
+#)
+
+
+
+
+
+# Check whether --with-mysqlpp-lib-path was given.
+if test "${with_mysqlpp_lib_path+set}" = set; then :
+  withval=$with_mysqlpp_lib_path; MYSQLPP_LIB_PATH="$withval"
+else
+  MYSQLPP_LIB_PATH="/usr/lib"
+
+fi
+
+MYSQLPP_LIBS="-L$MYSQLPP_LIB_PATH -lmysqlpp"
+#AC_SUBST([DIM_LIBS])
+
+#LDFLAGS="$LDFLAGS $MYSQLPP_LIBS"
+#AC_CHECK_LIB(mysql++, [mysql_errno],
+#   [],
+#   [
+#      echo "Error! mysql++ libarary file not found in $MYSQL_LIB_PATH."
+#      exit -1
+#   ]
+#)
+
+
+
+
+
+#CPPFLAGS="$CPPFLAGS -std=c++0x"
+
+CPPFLAGS="$CPPFLAGS -I/usr/include/mysql"
+
+
+
+
+#AC_CHECK_HEADERS_ONCE(dim.h)
+
+#AC_C_CONST
+#AC_TYPE_PID_T
+#AC_HEADER_STDC
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+ac_script='
+:mline
+/\\$/{
+ N
+ s,\\\n,,
+ b mline
+}
+t clear
+:clear
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+s/^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)/-D\1=\2/g
+t quote
+b any
+:quote
+s/[	 `~#$^&*(){}\\|;'\''"<>?]/\\&/g
+s/\[/\\&/g
+s/\]/\\&/g
+s/\$/$$/g
+H
+:any
+${
+	g
+	s/^\n//
+	s/\n/ /g
+	p
+}
+'
+DEFS=`sed -n "$ac_script" confdefs.h`
+
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+  as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+ if test -n "$EXEEXT"; then
+  am__EXEEXT_TRUE=
+  am__EXEEXT_FALSE='#'
+else
+  am__EXEEXT_TRUE='#'
+  am__EXEEXT_FALSE=
+fi
+
+if test -z "${DX_COND_doc_TRUE}" && test -z "${DX_COND_doc_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_doc\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_doc_TRUE}" && test -z "${DX_COND_doc_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_doc\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_dot_TRUE}" && test -z "${DX_COND_dot_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_dot\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_dot_TRUE}" && test -z "${DX_COND_dot_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_dot\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_man_TRUE}" && test -z "${DX_COND_man_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_man\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_man_TRUE}" && test -z "${DX_COND_man_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_man\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_rtf_TRUE}" && test -z "${DX_COND_rtf_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_rtf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_rtf_TRUE}" && test -z "${DX_COND_rtf_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_rtf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_xml_TRUE}" && test -z "${DX_COND_xml_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_xml\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_xml_TRUE}" && test -z "${DX_COND_xml_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_xml\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chm_TRUE}" && test -z "${DX_COND_chm_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_chm\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chm_TRUE}" && test -z "${DX_COND_chm_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_chm\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chi_TRUE}" && test -z "${DX_COND_chi_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_chi\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_chi_TRUE}" && test -z "${DX_COND_chi_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_chi\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_html_TRUE}" && test -z "${DX_COND_html_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_html\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_html_TRUE}" && test -z "${DX_COND_html_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_html\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_ps_TRUE}" && test -z "${DX_COND_ps_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_ps\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_ps_TRUE}" && test -z "${DX_COND_ps_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_ps\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_pdf_TRUE}" && test -z "${DX_COND_pdf_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_pdf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_pdf_TRUE}" && test -z "${DX_COND_pdf_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_pdf\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_latex_TRUE}" && test -z "${DX_COND_latex_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_latex\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${DX_COND_latex_TRUE}" && test -z "${DX_COND_latex_FALSE}"; then
+  as_fn_error $? "conditional \"DX_COND_latex\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... but there are two gotchas:
+    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+    # In both cases, we have to default to `cp -p'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+	test -d "$1/.";
+      else
+	case $1 in #(
+	-*)set "./$1";;
+	esac;
+	case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
+	???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by FACT++ $as_me 1.0, which was
+generated by GNU Autoconf 2.67.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <thomas.bretz@epfl.ch>.
+FACT++ home page: <http://hello.example.com/>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+FACT++ config.status 1.0
+configured by $0, generated by GNU Autoconf 2.67,
+  with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h |  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "X$compiler_lib_search_dirs" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "X$predep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "X$postdep_objects" | $Xsed -e "$delay_single_quote_subst"`'
+predeps='`$ECHO "X$predeps" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps='`$ECHO "X$postdeps" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "X$compiler_lib_search_path" | $Xsed -e "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "X$LD_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "X$old_archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "X$compiler_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "X$GCC_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "X$lt_prog_compiler_no_builtin_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "X$lt_prog_compiler_wl_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "X$lt_prog_compiler_pic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "X$lt_prog_compiler_static_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "X$lt_cv_prog_compiler_c_o_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "X$archive_cmds_need_lc_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "X$enable_shared_with_static_runtimes_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "X$export_dynamic_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "X$whole_archive_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "X$compiler_needs_object_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "X$old_archive_from_new_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "X$old_archive_from_expsyms_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "X$archive_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "X$archive_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "X$module_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "X$module_expsym_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "X$with_gnu_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "X$allow_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "X$no_undefined_flag_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "X$hardcode_libdir_flag_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "X$hardcode_libdir_flag_spec_ld_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "X$hardcode_libdir_separator_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "X$hardcode_direct_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "X$hardcode_direct_absolute_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "X$hardcode_minus_L_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "X$hardcode_shlibpath_var_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "X$hardcode_automatic_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "X$inherit_rpath_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "X$link_all_deplibs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path_CXX='`$ECHO "X$fix_srcfile_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "X$always_export_symbols_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "X$export_symbols_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "X$exclude_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "X$include_expsyms_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "X$prelink_cmds_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "X$file_list_spec_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "X$hardcode_action_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "X$compiler_lib_search_dirs_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "X$predep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "X$postdep_objects_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "X$predeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "X$postdeps_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "X$compiler_lib_search_path_CXX" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
+hardcode_libdir_separator_CXX \
+fix_srcfile_path_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX; do
+    case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"')  lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+  ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
+
+
+
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
+else
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = ""
+
+}
+{
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
+
+  print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+  cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+
+eval set X "  :F $CONFIG_FILES      :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	`' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5  ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out" && rm -f "$tmp/out";;
+  *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+
+
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "libtool":C)
+
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008 Free Software Foundation, Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags="CXX "
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  case $xsi_shell in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+  case ${1} in
+    */*) func_dirname_result="${1%/*}${2}" ;;
+    *  ) func_dirname_result="${3}" ;;
+  esac
+  func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
+  func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=${1%%=*}
+  func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  case ${1} in
+    *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+    *)    func_lo2o_result=${1} ;;
+  esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=${#1}
+}
+
+_LT_EOF
+    ;;
+  *) # Bourne compatible functions.
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+  # Extract subdirectory from the argument.
+  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+  if test "X$func_dirname_result" = "X${1}"; then
+    func_dirname_result="${3}"
+  else
+    func_dirname_result="$func_dirname_result${2}"
+  fi
+}
+
+# func_basename file
+func_basename ()
+{
+  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+  case ${2} in
+    .*) func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+    *)  func_stripname_result=`$ECHO "X${3}" \
+           | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+  esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+  func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+  func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+  func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+  func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+  func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+  func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+  yes)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1+=\$2"
+}
+_LT_EOF
+    ;;
+  *)
+    cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+  eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+    ;;
+  esac
+
+
+  sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+    || (rm -f "$cfgfile"; exit 1)
+
+  mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+
+
+    cat <<_LT_EOF >> "$ofile"
+
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
+
+# A language specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path_CXX
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
+
+ ;;
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
+}
+ ;;
+
+  esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
Index: /trunk/FACT++/configure.ac
===================================================================
--- /trunk/FACT++/configure.ac	(revision 10183)
+++ /trunk/FACT++/configure.ac	(revision 10183)
@@ -0,0 +1,304 @@
+# autoreconf --force --install
+
+AC_INIT([FACT++], [1.0], [thomas.bretz@epfl.ch], [FACTpp], [http://hello.example.com/])
+AC_PREREQ([2.59])
+AC_CONFIG_FILES([Makefile])   # causes x/Makefile.in to be created if x/Makefile.am exists
+#AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([.macro_dir])
+AC_CONFIG_AUX_DIR([.aux_dir])
+AC_PROG_CC([colorgcc gcc])
+AC_PROG_CXX([colorgcc g++])
+AC_PROG_LIBTOOL
+AC_LANG(C++)
+#AC_PATH_XTRA
+
+
+LT_INIT([disable-static])
+
+
+AM_INIT_AUTOMAKE([1.11 -Wall subdir-objects std-options no-define color-tests dist-tarZ parallel-tests silent-rules])
+AM_SILENT_RULES([yes])
+AM_PROG_CC_C_O
+
+
+DX_INIT_DOXYGEN([FACT++])#, DOXYFILE-PATH, [OUTPUT-DIR])
+#DX_DOXYGEN_FEATURE(ON)
+#DX_DOT_FEATURE(ON)
+#DX_HTML_FEATURE(ON)
+#DX_CHM_FEATURE(ON|OFF)
+#DX_CHI_FEATURE(ON|OFF)
+DX_MAN_FEATURE(ON)
+#DX_RTF_FEATURE(ON|OFF)
+#DX_XML_FEATURE(ON|OFF)
+#DX_PDF_FEATURE(ON|OFF)
+DX_PS_FEATURE(OFF)
+DX_ENV_APPEND(EXTRACT_ALL, YES)
+DX_ENV_APPEND(RECURSIVE,   YES)
+DX_ENV_APPEND(ALL_GRAPHS,  NO)  # change to yet to switch on call(er) graphs
+
+#USE_HTAGS              = $(USE_HTAGS)
+
+AX_BOOST_BASE([1.42], [],
+   [
+      echo "Error! The boost C++ libraries are not properly installed." 
+      exit -1
+   ]
+)
+
+AX_BOOST_ASIO
+AX_BOOST_DATE_TIME
+AX_BOOST_FILESYSTEM
+AX_BOOST_PROGRAM_OPTIONS
+AX_BOOST_REGEX
+AX_BOOST_SYSTEM
+AX_BOOST_THREAD
+#ax_boost_iostreams
+#ax_boost_python
+#ax_boost_serialization
+#ax_boost_signals
+#ax_boost_test_exec_monitor
+#ax_boost_unit_test_framework
+#ax_boost_wave
+#ax_boost_wserialization
+
+
+AC_LANG_PUSH(C)
+
+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
+   ]
+)
+
+
+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, [], 
+   [
+      echo "Error! Ncurses panel.h not properly installed in default include paths." 
+      exit -1
+   ]
+)
+AC_CHECK_LIB(panel, update_panels, [], 
+   [
+      echo "Error! Ncurses libpanel not properly installed in the default libarary paths." 
+      exit -1
+   ]
+)
+
+
+AC_CHECK_HEADERS([Mrm/MrmAppl.h Xm/Xm.h], [], 
+   [
+      echo "Error! Mrm/MrmAppl.h, Xm/Xm.h not properly installed, needed to compile did (you need most probably lesstif2-dev)." 
+      exit -1
+   ]
+)
+
+AC_CHECK_LIB(Xm, XtToolkitInitialize, [],
+   [
+      echo "Error! libXm (lesstif2) not properly installed in the default library path (needed by dim to link did)." 
+      exit -1
+   ]
+)
+
+AC_LANG_POP()
+
+#AC_CHECK_HEADERS(
+#   [\
+#      boost/bind.hpp \
+#      boost/lexical_cast.hpp \
+#      boost/filesystem.hpp \
+#      boost/thread.hpp \
+#      boost/function.hpp \
+#      boost/regex.hpp \
+#      boost/asio.hpp \
+#      boost/enable_shared_from_this.hpp \
+#      boost/asio/deadline_timer.hpp \
+#      boost/date_time/posix_time/posix_time.hpp \
+#      boost/date_time/local_time/local_time.hpp \
+#      boost/date_time/gregorian/gregorian.hpp 
+#   ], [],
+#   [
+#      echo "Error! At least one needed header of the boost C++ libararies is missing." 
+#      exit -1
+#   ]
+#)
+
+#AC_ARG_WITH([dim],
+#   [
+#      AS_HELP_STRING([--with-dim],
+#         [location of the Dim headers, defaults to dim_v19r15])
+#   ],
+#   [DIM_PATH="$withval"],
+#   [DIM_PATH="dim_v19r15"]
+#)
+#
+#AC_SUBST([DIM_PATH])
+#
+#CFLAGS="$CFLAGS -I$DIM_PATH/dim"
+#CPPFLAGS="$CPPFLAGS -I$DIM_PATH/dim"
+#INCLUDEPATH="$INCLUDEPATH -I$DIM_PATH/dim"
+#AC_CHECK_HEADERS([dis.hxx dic.hxx], [], 
+#  [
+#      echo "Error! Dim headers (dis.hxx, dic.hxx) not found in $DIM_PATH/dim." 
+#      exit -1
+#   ]
+#)
+
+## ============>   boost header and boost libraries
+
+##########################################################################
+#AC_ARG_WITH([dim-include-path],
+#   [
+#      AS_HELP_STRING([--with-dim-include-path],
+#         [location of the Dim headers, defaults to ${HOME}/FACT/dim_v19r11/dim])
+#   ],
+#   [DIM_INCLUDE_PATH="$withval"],
+#   [DIM_INCLUDE_PATH="${HOME}/Software/Dim/dim_v19r11/dim"]
+#)
+#DIM_CFLAGS="-I$DIM_INCLUDE_PATH"
+##AC_SUBST([DIM_CFLAGS])
+#
+#CFLAGS="$CFLAGS $DIM_CFLAGS"
+#CPPFLAGS="$CPPFLAGS $DIM_CFLAGS"
+##INCLUDEPATH="$INCLUDEPATH $DIM_INCLUDE_PATH"
+#AC_CHECK_HEADERS([dis.hxx dic.hxx], [], 
+#   [
+#      echo "Error! Dim headers (dis.hxx, dic.hxx) not found in $DIM_INCLUDE_PATH." 
+#      exit -1
+#   ]
+#)
+##########################################################################
+
+
+
+###########################################################################
+#AC_ARG_WITH([dim-lib-path],
+#  [
+#     AS_HELP_STRING([--with-dim-lib-path], 
+#        [location of the Dim libraries, defaults to ${HOME}/FACT/dim_v19r11/linux])
+#  ],
+#  [DIM_LIB_PATH="$withval"],
+#  [DIM_LIB_PATH="${HOME}/Software/Dim/dim_v19r11/linux"]
+#)
+#DIM_LIBS="-L$DIM_LIB_PATH -ldim"
+##AC_SUBST([DIM_LIBS])
+#
+#LDFLAGS="$LDFLAGS $DIM_LIBS"
+#AC_CHECK_LIB(dim, [get_dns_port_number], [], 
+#   [
+#      echo "Error! libdim.so file not found in $DIM_LIB_PATH." 
+#      exit -1
+#   ]
+#)
+###########################################################################
+
+
+
+# Get MySQL++ library and include locations
+#AC_ARG_WITH([mysqlpp-include-path],
+#   [
+#      AS_HELP_STRING([--with-mysqlpp-include-path],
+#         [location of the MySQL++ librarary headers, defaults to /usr/include/mysql++])
+#   ],
+#   [MYSQLPP_INCLUDE_PATH="$withval"],
+#   [MYSQLPP_INCLUDE_PATH=""]
+##)
+#MYSQLPP_CFLAGS="-I$MYSQLPP_INCLUDE_PATH"
+##AC_SUBST([DIM_CFLAGS])
+#
+#CFLAGS="$CFLAGS $MYSQLPP_CFLAGS"
+#CPPFLAGS="$CPPFLAGS $MYSQLPP_CFLAGS"
+##INCLUDEPATH="$INCLUDEPATH $DIM_INCLUDE_PATH"
+#AC_CHECK_HEADERS([mysql++/mysql++.h],
+#   [], 
+#   [
+#      echo "Error! mysql++/mysql++.h not found in default include path." 
+#      exit -1
+#   ]
+#)
+#### LAST ARGUMENT IS "OTHER LIBRARIES"
+
+
+
+#AC_ARG_WITH([mysql-lib-path],
+#  [
+#     AS_HELP_STRING([--with-mysql-lib-path], 
+#        [location of the MySQL library, defaults to /usr/lib])
+#  ],
+#  [MYSQL_LIB_PATH="$withval"],
+#  [MYSQL_LIB_PATH="/usr/lib"]
+#)
+#MYSQL_LIBS="-L$MYSQL_LIB_PATH -lmysql"
+##AC_SUBST([DIM_LIBS])
+#
+#LDFLAGS="$LDFLAGS $MYSQL_LIBS"
+#AC_CHECK_LIB(mysql, [mysql_errno],
+#   [], 
+#   [
+#      echo "Error! mysql libarary file not found in $MYSQL_LIB_PATH." 
+#      exit -1
+#   ]
+#)
+
+
+
+
+AC_ARG_WITH([mysqlpp-lib-path],
+  [
+     AS_HELP_STRING([--with-mysqlpp-lib-path], 
+        [location of the MySQL++ library, defaults to /usr/lib])
+  ],
+  [MYSQLPP_LIB_PATH="$withval"],
+  [MYSQLPP_LIB_PATH="/usr/lib"]
+)
+MYSQLPP_LIBS="-L$MYSQLPP_LIB_PATH -lmysqlpp"
+#AC_SUBST([DIM_LIBS])
+
+#LDFLAGS="$LDFLAGS $MYSQLPP_LIBS"
+#AC_CHECK_LIB(mysql++, [mysql_errno],
+#   [], 
+#   [
+#      echo "Error! mysql++ libarary file not found in $MYSQL_LIB_PATH." 
+#      exit -1
+#   ]
+#)
+
+
+
+
+
+#CPPFLAGS="$CPPFLAGS -std=c++0x"
+
+CPPFLAGS="$CPPFLAGS -I/usr/include/mysql"
+
+
+
+
+#AC_CHECK_HEADERS_ONCE(dim.h)
+
+#AC_C_CONST
+#AC_TYPE_PID_T
+#AC_HEADER_STDC
+
+AC_OUTPUT
Index: /trunk/FACT++/dim_v19r15/.setup
===================================================================
--- /trunk/FACT++/dim_v19r15/.setup	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/.setup	(revision 10183)
@@ -0,0 +1,101 @@
+
+set POSSOSVALUES = HP-UX,AIX,OSF1,SunOS,Solaris,LynxOS,Linux,Darwin,
+if ($?OS) then
+    echo OS is set to $OS
+    set TEMP = $OS,
+    echo $POSSOSVALUES | grep $TEMP>/dev/null
+    if ( ! $status == 0) then
+        echo Unknown OS... setup failed
+        echo Possible values are: $POSSOSVALUES
+        exit 1
+    endif
+else
+   echo Variable OS must be defined... setup failed
+   echo Possible values are: $POSSOSVALUES
+   exit 1
+endif
+
+if ( ${OS} == Solaris ) then
+    set path = (/usr/ccs/bin $path)
+endif
+
+if ($?DIMDIR) then
+	echo DIMDIR is set to $DIMDIR
+else
+	setenv DIMDIR `pwd`
+	echo DIMDIR is set to $DIMDIR
+endif
+
+if ($?ODIR) then
+    echo ODIR is set to $ODIR
+    goto finish
+endif
+
+switch ($OS)
+	case HP-UX:
+		setenv ODIR hp
+		breaksw
+	case AIX:
+		setenv ODIR aix
+		breaksw
+	case OSF1:
+		setenv ODIR osf
+		breaksw
+	case SunOS:
+		setenv ODIR sunos
+		breaksw
+	case Solaris
+		setenv ODIR solaris
+		breaksw
+	case LynxOS:
+		setenv ODIR lynxos
+		breaksw
+	case Linux:
+		setenv machine `uname -m`
+		if ( $machine != x86_64 ) then
+			setenv BITS32 yes
+			echo "default is 32 bits"
+		else
+			echo "default is 64 bits"
+		endif
+		setenv ODIR linux
+		breaksw
+	case Darwin:
+		setenv ODIR darwin
+		breaksw
+	default:
+        	echo Unknown OS... setup failed
+                exit 1
+endsw
+
+echo ODIR is set to $ODIR
+
+finish:
+if ( ${OS} == Linux ) then
+if (! $?LD_LIBRARY_PATH) then
+    setenv LD_LIBRARY_PATH $DIMDIR/$ODIR
+else
+    setenv LD_LIBRARY_PATH $DIMDIR/$ODIR\:$LD_LIBRARY_PATH
+endif
+set path = ($DIMDIR/$ODIR $path)
+rehash
+endif
+
+alias TestServer $DIMDIR/$ODIR/testServer
+alias TestClient $DIMDIR/$ODIR/testClient
+alias Test_server $DIMDIR/$ODIR/test_server
+alias Test_client $DIMDIR/$ODIR/test_client
+alias Dns    $DIMDIR/$ODIR/dns
+alias Dim_get_service $DIMDIR/$ODIR/dim_get_service
+alias Dim_send_command $DIMDIR/$ODIR/dim_send_command
+alias DimBridge    $DIMDIR/$ODIR/DimBridge
+alias Did    $DIMDIR/$ODIR/did
+
+if (! -d $DIMDIR/$ODIR) then
+   mkdir $DIMDIR/$ODIR
+   echo Created Directory: $DIMDIR/$ODIR 
+endif
+exit
+
+
+
Index: /trunk/FACT++/dim_v19r15/LICENSE.GPL
===================================================================
--- /trunk/FACT++/dim_v19r15/LICENSE.GPL	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/LICENSE.GPL	(revision 10183)
@@ -0,0 +1,20 @@
+DIM - Distributed Information Management System
+
+Copyright (C) 1993 CERN
+Author: C. Gaspar (clara.gaspar@cern.ch)
+
+This program is free software; 
+you can redistribute it and/or modify it under the terms of the GNU 
+General Public License as published by the Free Software Foundation; 
+either version 2 of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful, 
+but WITHOUT ANY WARRANTY; without even the implied warranty of 
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
+See the GNU General Public License for more details at:
+http://www.opensource.org/licenses/gpl-license.html
+
+You should have received a copy of the GNU General Public License 
+along with this program; if not, write to the Free Software Foundation, Inc., 
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
Index: /trunk/FACT++/dim_v19r15/README.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README.txt	(revision 10183)
@@ -0,0 +1,112 @@
+
+                    DIM version 9.8 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 908
+	(version 9.8).
+  
+Changes for version 9.0:
+
+   In order to increase the compatibility between Windows and Linux and
+   to respect CVS rules the following modifications have been done:
+
+      - C++ files have been renamed from .cc to .cxx and include files from
+	.hh to .hxx
+
+      - Include files are in "./dim" directory
+        (Source files are now in the "./src" directory)
+
+      - Windows executables and libraries are in "./bin"
+      - Linux executables and libraries are "./linux"
+
+      - Windows developper studio setting are in "./Visual"
+      - Linux Makefiles are in the top directory
+
+Changes for version 9.1:
+
+    Fixed some "Harp" problems:
+      - Fixed a bug causing a loop in the timer handling 
+      - Optimized dns connection handling for many services
+      - Fixed a re-connection bug for clients 
+      
+Changes for version 9.2:
+
+      - Created the static methods:
+		DimServer::autoStartOff();
+		DimServer::autoStartOn();
+	Which prevents/allows DimServices to be declared to the Name Server as
+	soon as they are created. if "autoStart" is set Off the user has to call
+	DimServer::start(char *serverName) when all services have been declared.
+	By default autoStart is On
+
+Changes for version 9.3:
+
+      - Created a new Utility: DimBridge - It forwards DIM Services (and Commands)
+	from one Name Server to another (to bypass firewalls)
+      - Fixed a bug in tcpip.c - which prevents a DIM Server to send test messages to
+	himself (related to the above utility).
+
+Changes for version 9.4:
+
+      - Merged DID and XDID (DID should now work on all UNIX flavours)
+      - Allow users to select the ethernet interface (or to specify a complete 
+        ipname, with the domain, when not available by default):
+		setenv DIM_HOST_NODE <ipname>
+	Before starting up a DIM server 
+ 
+Changes for version 9.5:
+
+      - Added an environment variable DIM_DNS_PORT allowing users to specify a
+	different port number (default is 2505) for the DNS. This allows 
+	starting more than one DIM Name Servers (DNSs) on the same machine.
+      - Accomodated for a Solaris "feature": ioctl FIONREAD which should 
+        return the number of bytes waiting to be read on a socket sometimes 
+	returns '0' when there are bytes to read. This provoked undesired 
+        "disconnections" in BaBar.
+      - Fixed a bug related to the padding of structures (characters following
+        an odd number of shorts)
+      - Fixed a bug in the retry mechanism when writting to a full socket. The
+        problem appeared when the connection was killed while retrying.
+      - Did (Unix/Linux version) now allows sending formatted commands (i.e. 
+        structures) to a server. Also services are now visualised in a 
+	formatted manner.
+
+Changes for version 9.6:
+      - Fixed DID: it crashed when a server name was very big (Motif) and
+        it didn't remove servers that died while being in error (red).
+      - Fixed a bug in the client library: sometimes services where requested
+	from the name server more than once unnecessarily.
+      - Fixed a bug in the server library: Sometimes the server crashed if it 
+	was updating a service when the client was killed or died.
+
+Changes for version 9.7
+      - Fixed a bug introduced in version 9.6 (related to the last point).
+        Sometimes servers would leave some connections open and started using
+        all the CPU (involves dis.c and tcpip.c).
+      - Upgraded DID to support very long server names.
+
+Changes for version 9.8
+      - Fixed a bug in DID: it crashed when a service name to be viewed was
+        typed in by hand
+      - Fixed a bug in dis.c: Servers would not register their services with 
+        the DNS if the number of services was a multiple of 100.
+ 
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
+
+
+
Index: /trunk/FACT++/dim_v19r15/README_v10.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v10.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v10.txt	(revision 10183)
@@ -0,0 +1,88 @@
+
+                    DIM version 10.5 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1005
+	(version 10.05).
+
+25/4/2002
+Changes for version 10.0:
+      - All source files are now common to Windows and Unix flavours 
+	(Linux included). Directories src/win and src/unix no longer 
+	necessary.
+      - Fixed hopefully all compiler warnings (especially on Solaris 8).
+      - In order to avoid potential deadlocks all tcpip writes (dna_write)
+	are done by a separate thread (the timer thread, via a special 
+	"immediate" queue). Except service updates and sending commands
+	(dna_write_nowait) since they are not blocking and to preserve
+	backward behaviour compatibility.
+      - Optimized servers, clients and the name servers for large number
+	of services
+      - Modified error messages to be more explicit
+
+01/5/2002
+Changes/Bug Fixes for Version 10.1:
+      - Fixed the DimRpc class, it would hang sometimes.
+      - Fixed a problem in the "immediate" timer handler (too slow)
+      - Added "const" to service names in DimInfo and DimService methods
+      - changed print_date_time to dim_print_date_time and made it 
+	available to users
+      - Open_dns didn't always return the correct value (DID wouldn't
+	reconnect to Dns on restart)
+      - Did (on Linux) now shows services in alphabetical order
+
+06/5/2002 
+Changes/Bug Fixes for Version 10.2:
+      - Fixed dtq.c and tcpip.c for Linux, dim_wait() would not always
+	return when required
+      - The distribution kit now also contains the shareable version of
+	the DIM library for Linux - libdim.so
+	The makefiles use the shareable version for creating Dns, Did 
+	and the examples (.setup adds dim/linux to LD_LIBRARY_PATH)  
+
+27/5/2002 
+Changes/Bug Fixes for Version 10.3:
+      - Changed dim include files not to include "windows.h" under
+	windows. This was causing a conflict with Gaudi.
+	(Had to change "DIM semaphores" from macros to subroutines)
+  
+18/7/2002 
+Changes/Bug Fixes for Version 10.4:
+      - Two consecutive client requests for the same service would not 
+	implement the "stamped" flag properly (dic.c)
+      - The DimBrowser class would not retreive service names containing
+	the character "@". Fixed.
+      - Re-fixed a bug that would make servers crash when clients exited
+	while servers were updating a service (dis.c).
+      - dtq_start_timer() did not always wait the requested amount of time.
+      - Did (Linux version) now also prints timestamp and quality flag
+	when Viewing service contents.
+  
+19/8/2002
+Changes/Bug Fixes for Version 10.5:
+      - Fixed DID for Solaris (had stopped working, Motif changed?) 
+      - Fixed a nasty bug that must have been there forever:
+	Several DIM processes (clients and Dns) execute at regular 
+	intervals a "test write" on open connections to find out the status
+	of the connection. These test writes where never cancelled when the
+	connection was closed. (noticed on Solaris/BaBar).
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
+
+
+
Index: /trunk/FACT++/dim_v19r15/README_v11.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v11.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v11.txt	(revision 10183)
@@ -0,0 +1,96 @@
+
+                    DIM version 11.7 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1107
+	(version 11.07).
+
+23/8/2002
+Changes for version 11.0:
+      - Made Did (Solaris and Linux) run single threaded (to fix some
+	strange behaviour of Motif) 
+      - Created an "util" directory under "src". To keep DIM utilities.
+	Modified all makefiles and Visual Studio accordingly
+
+08/9/2002
+Changes for version 11.1:
+      - Fixed dnsExists on Solaris. Now dtq.c uses select instead of 
+	usleep (usleep is not thread safe). 
+
+12/9/2002
+Changes for version 11.2:
+      - dim_send_command and dim_get_service utilities where hanging on 
+	windows - fixed.  
+
+22/10/2002
+Changes for version 11.3:
+      - Replaced usleep by select in Did (linux), it was creating a 
+	deadlock with signals. (Did is not multithreaded because of 
+	Motif)
+      - Fixed two bugs in Dns - one is a design flaw, it was creating 
+	too many timer entries unnecessarily and using a lot of CPU 
+	(just to update did).
+	The second happened when a server tried to declare an existing 
+	service. The Dns correctly tried to kill the server, but if the 
+	server didn't die than the Dns would keep the connection busy 
+	instead of disconnecting it.
+      - The feature whereby a server disconnects after a timeout from a 
+	hanging (not consuming the data from the socket) client, in order 
+	to avoid the server hanging himself, had been commented out by
+	mistake. It's now back. 
+
+23/10/2002
+Changes for version 11.4:
+      - Related to the disconnection feature above. Replaced usleep by
+	select (with a timeout) when writing to a client. The default
+	timeout for a server to disconnect from a hanging client is now 
+	5 seconds. But it can be changed (or checked) by using:
+		- void dim_set_write_timeout(int secs)
+		- int dim_get_write_timeout()
+		or
+		- DimServer::setWriteTimeout(int secs);
+		- int DimServer::getWriteTimeout();
+ 
+31/10/2002
+Changes for version 11.5:
+      - Allowed tcpip writes to proceed in parallel with reads (in
+	different threads) in order to avoid deadlocks (this was 
+	previously protected by a semaphore).
+      - Removed old commented out code from all source files
+      (Note: These changes are not included in CVS tag v11r6)
+
+06/11/2002
+Changes for version 11.6:
+      - The Dns "forgot" to stop the test_write timer when a server
+	went into error. Fixed.
+
+25/11/2002
+Changes for version 11.7:
+      - Fixed some bugs in the RPC client implementation
+      - Created (and exported) a dim_usleep() routine based on select
+      - Implemented a dis_get_timeout(int service_id, int client_id) 
+	and a DimService::getTimeout(int client_id) which allows
+	servers to find out the timeout requested by a client
+      - When a server stopped serving a command using dis_remove_service
+	the client was not informed and continued using the "cached"
+	address instead of re-asking the name server. Fixed. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
+
+
+
Index: /trunk/FACT++/dim_v19r15/README_v12.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v12.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v12.txt	(revision 10183)
@@ -0,0 +1,118 @@
+
+                    DIM version 12.11 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1211
+	(version 12.11).
+
+13/2/2003
+Changes for version 12.0:
+      - Included Java support in the same distribution kit and updated
+	the documentation on the WEB.
+	In order to make a dim shareable library to be used from java
+	on linux:
+		setenv JDK_INCLUDE <your jdk include directory>
+		gmake JDIM=yes all
+	The libraries are distributed for windows and linux 7.3
+	The java part is in jdim to run some examples:
+		java -classpath .../jdim/classes dim.test.TestServer
+		java -classpath .../jdim/classes dim.test.TestClient
+20/3/2003
+Changes for version 12.1:
+      - Removed all references to iostream.h in DIM include files and
+	source files in order to support Linux RedHat 8.0 and gcc 3.2
+
+19/6/2003
+Changes for version 12.2:
+      - Fixed a bug in the DimTimer class
+      - Added a missing "destructor" for DimCommand in Java.
+
+23/6/2003
+Changes for version 12.2-1:
+      - Changed the directory structure under jdim to respect the Java 
+	conventions
+
+02/7/2003
+Changes for version 12.3:
+      - Fixed a bug that made clients crash when a server released a 
+	command service.
+	Added the possibility of sending mixed services in the Java
+	implementation.
+
+04/7/2003
+Changes for version 12.3-1:
+      - The Java version was not correct in the previous ZIP 
+	(the loading of jdim.dll was not done properly)
+
+24/7/2003
+Changes for version 12.4:
+      - Fixed a bug in Did related to the size of displayed services
+      - Fixed a memory leak when servers received commands
+
+01/8/2003
+Changes for version 12.5:
+      - Clients would sometimes crash when receiving data for a service 
+	which they had just released, fixed.
+      - Clients could also potencially crash when failing to write to a 
+	server that had just disconnected, fixed.
+
+20/8/2003
+Changes for version 12.6:
+      - Clients would crash when releasing the same service twice, 
+	fixed.
+      - Exported through JNI the possibility of protecting DIM critical 
+	sections, so that dim_lock and dim_unlock can be used from Java.
+
+26/8/2003
+Changes for version 12.7:
+      - A client would sometimes crash when releasing the service inside
+	the service's callback. Fixed.
+      - A client would also sometimes crash if it releasead a service while
+	still connecting to this service. I.e. if a dic_info_service was 
+	immediately followed by a dis_release_service. Fixed.
+      - The server could also crash or hang is still connecting to a client 
+	when the service was removed. Fixed
+      - Found and fixed a small memory lead (allocating ids)
+	
+01/9/2003
+Changes for version 12.8:
+      - Implemented "short" and "longlong" (64 bit integer) in the C++ version
+	of both, servers and clients.
+      - Implemented boolean, byte, short and long in the Java version. 
+	
+03/9/2003
+Changes for version 12.9:
+      - Protected dis_set_quality and dis_set_timestamp against bad service_ids.
+      - Alowed dis_stop_serving() to be called before any dis_start_serving(),
+	before it would crash. 
+
+05/9/2003
+Changes for version 12.10:
+      - dis_stop_serving would sometimes crash when called from dis_remove_service,
+	fixed. 
+
+25/9/2003
+Changes for version 12.11:
+      - dic_command_callback() would sometimes not send the command if the 
+	callback reception immediatelly terminated the program. I.e. 
+	dim_send_command might not actually send the command. Fixed.
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
+
+
+
Index: /trunk/FACT++/dim_v19r15/README_v13.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v13.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v13.txt	(revision 10183)
@@ -0,0 +1,110 @@
+
+                    DIM version 13.10 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1310
+	(version 13.10).
+
+06/10/2003
+Changes for version 13.0:
+      - Fixed all know bugs resulting from:
+	- A modification done since v12 which allowed tcpip writes to 
+	  proceed in parallel with reads (in a different thread). This 
+	  created a few problems with the timming of connections and 
+	  disconnections.
+	- Extensive tests of the Java interface to DIM due to the DIP
+	  implementation tests.
+
+14/10/2003
+Changes for version 13.1:
+      - Fixed an extra bug related to having servers and clients within
+	the same process.
+
+13/11/2003
+Changes for version 13.2:
+      - Fixed a bug in the RPC client - the size of the message was 
+	sometimes wrong.
+      - When the number of DIM services declared by a server was a
+        multiple of 100 the clients would not get updated on server
+	restart - Fixed.
+      - If a client exited immediately after a command with callback
+        The server would sometimes not get the command - hopefully
+	fixed. 
+	Note: This is still the case for a command without callback 
+	(this is a feature of the asynchronous method). 
+
+2/12/2003
+Changes for version 13.3:
+      - Fixed the linux makefile (realclean).
+      - the C++ version of stop timer now returns the number of seconds 
+	left to sleep (used to be void).
+ 
+13/01/2004
+Changes for version 13.4:
+      - The DNS now accepts an environment variable "DIM_DNS_ACCEPTED_DOMAINS".
+	It will refuse connections from servers running outside these domains
+	(actually, at the moment it will kill the servers -> to be modified).
+	Ex.: DIM_DNS_NODE=cern.ch,slac.stanford.edu
+      - the Java version now implements a DimBrowser class, similar to the C++ 
+	one. And the complex data types are better handled.
+ 
+27/01/2004
+Changes for version 13.5:
+      - A socket close modification since v12r8 for Linux was causing problems,
+	put back as it was.
+      - dim_send_command had a limitation to 80 characters for a DIM service
+	name for no reason. DIM service names are limited to 128 characters.
+
+28/01/2004
+Changes for version 13.6:
+      - When sending an EXIT command to a server the client wouldn't behave
+	properly on Linux - fixed 
+
+30/01/2004
+Changes for version 13.7:
+      - Commands would sometimes be remembered by a client and sent later when
+	the server started up - fixed!
+
+06/02/2004
+Changes for version 13.8
+      - The Name server would only remember server names up to 40 characters,
+	so when asked for the list of servers known it would truncate the names.
+	Fixed.
+      - The handling of disconnections/reconnections for very "fast" servers was
+	causing problems to the client: callback not called or reconnection failed.
+	fixed.
+
+27/02/2004
+Changes for version 13.9
+      - Replaced "ctime()" in dim_print_date_time() by its reentrant version ctime_r
+	for the Linux version.
+      - Added selectiveUpdateService() to the methods in the Java class DimService.
+      - The user set server timestamp was being reset (and replaced by the current
+	time) if the service was sent to several clients - Fixed.
+      - Sometimes DIM commands could go out of order if a client was sending the same
+	command (different data) out very fast - fixed.
+
+16/03/2004
+Changes for version 13.10
+      - Fixed the DimBrowser Java class
+      - The timer thread was sometimes not counting time properly when interrupted
+	every second -> fixed.
+      - The Client sometimes forgot to call the command callback when the DNS died
+	while sending a command with callback -> fixed. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v14.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v14.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v14.txt	(revision 10183)
@@ -0,0 +1,290 @@
+
+                    DIM version 14.07 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1407
+	(version 14.07).
+
+07/04/2004
+Changes for version 14.0:
+      - Spring Cleanup
+	Cleaned up inline methods out of include files.
+	Fixed some virtual destructors
+	Removed some unnecessary system include files
+	Fixed ctime_r to work on all platforms (Solaris, LynxOS too)
+
+21/04/2004
+Changes for version 14.1:
+      - Now if a server declares an exit handler (DimServer::addExitHandler
+	or dis_add_exit_handler) the user is responsible for exiting.
+	DIM will not exit by itself anymore.
+      - The windows version now also distributes MSVCRTD.DLL.
+      - Fixed a bug where servers could get confused if similar longish
+	service names were used in different servers.   
+
+18/05/2004
+Changes for version 14.2:
+      - Cleaned up some "C" warnings
+      - Linux Did didn't display RPC formats properly - fixed.
+      - RPC structures were not transfered correctly back to the client,
+	the format of the structure was currupted - fixed.
+      - Added a New constructor and updateService method for the Java class 
+	DimService. These allow the creation and update of a DimService by
+	passing another DimService. The data and format of the DimService
+	will be copied to the new one. Usefull for structured data.
+
+02/06/2004
+Changes for version 14.2-1:
+      - Fixed a bug in the java version that would make DIP crash when 
+	extracting data items (file format.java)
+
+12/06/2004
+Changes for version 14.3:
+
+      - DIM Server Exit_handler: A server can specify an exit handler
+	by using:
+		dis_add_exit_handler(exitHandler) or 
+		DimServer::addExitHandler()/virtual void exitHandler()
+	The exitHandler will be called in the following conditions:
+		- DNS node undefined
+		- Services already declared in DNS
+		- DNS doesn't accept connections from this machine
+		- An EXIT command from a client
+	If the user doesn't declare an exit handler, the DIM server will
+	exit, otherwise it is up to the user.
+
+      - DIM Error_handler: A server or a client can specify an error_handler
+	by using:
+		dis_add_error_handler(errorHandler)
+		dic_add_error_handler(errorHandler) 
+		DimServer::addErrorHandler()/virtual void errorHandler(...)
+		DimClient::addErrorHandler()/virtual void errorHandler(...) 
+	The error_handler will be called whenever DIM wants to report an 
+	error (in this case all stdout/stderr prints will be suppressed).
+	The errorHandler is called with the following parameters:
+		int severity:
+			0: info
+			1: warning
+			2: error
+			3: fatal
+		int error_code
+			possible codes listed in dim_common.h
+		char *msg
+	If the user declared an error handler for a server and an error with
+	severity = fatal is received the exit handler will also be called.
+	For a client if an error with severity = fatal is received and there
+	is no error handler declared the process will exit.
+
+      - Java DIM: the same functionality is available in the form of a 
+	DimErrorHandler class and a DimExitHandler class which can be used as 
+	in the example:
+	public static void main(String[] args) {
+		DimErrorHandler erid = new DimErrorHandler()
+		{
+			public void errorHandler(int severity, int code, String msg)
+			{
+				System.out.println("Error: "+msg+" sev: "+
+					severity);
+			}
+		};
+		DimExitHandler exid = new DimExitHandler()
+		{
+			public void exitHandler(int code)
+			{
+				System.out.println("Exit: "+code);
+			}
+		};
+		...
+
+      - Getting and Setting the DIM_DNS_NODE from a program:
+	The calls:
+		dim_set_dns_node
+		dim_get_dns_node 
+        and the corresponding C++ calls:
+		DimServer::setDnsNode and DimServer::getDnsNode, 
+		DimClient::setDnsNode and DimClient::getDnsNode
+ 	already existed, 
+	they have now been complemented with:
+		dim_set_dns_port
+		dim_get_dns_port
+	and the static C++ calls: 
+		DimServer::setDnsNode(node, port),DimServer::getDnsPort(), 
+		DimClient::setDnsNode(node, port), DimClient::getDnsPort()
+
+      - In Java the folowing methods have been added to the classes DimServer
+	and DimClient:	
+		public static void setDnsNode(String nodes);
+		public static void setDnsNode(String nodes, int port);
+		public static String getDnsNode();
+		public static int getDnsPort();
+
+      - the Java method DimService.getName() has been added.
+
+      - In C++ the creation of a new DimService could fail, for example, if
+	the service already existed in this server, this was not reported, since
+	a constructor can't return a value.
+	With the new error handling mechanisms, a user can declare an error_handler,
+	check if the error code is DIMSVCDUPLC and generate an exception which
+	will be thrown withing the DimService creation.
+      - Dim used to pass timestamps between servers and clients as an integer
+	for seconds since January 1970 and a short for milliseconds.
+	Now it will be one integer also for the milliseconds. By default DIM
+	still uses milliseconds, but if a server passes nanoseconds to 
+	dis_set_timestamp the client will receive nanoseconds when doing 
+	dic_get_timestamp.
+
+08/07/2004
+Changes for version 14.4:
+
+      - Java DIM: In order to allow a different error handler to be called for the
+	server and the client (if both in the same process) The calls:
+		DimServer.addErrorHandler(DimErrorHandler handler) and 
+		DimClient.addErrorHandler(DimErrorHandler handler)
+	Should be called respectively by the server or the client in order to install
+	the Error Handler. For compatibitlity, the call:
+		DimServer.addExitHandler(DimErrorHandler handler)
+	was also added. 
+ 
+	They can now be used as in the example (for a server):
+	public static void main(String[] args) {
+		DimErrorHandler erid = new DimErrorHandler()
+		{
+			public void errorHandler(int severity, int code, String msg)
+			{
+				System.out.println("Error: "+msg+" sev: "+
+					severity);
+			}
+		};
+		DimServer.addErrorHandler(erid);
+		DimExitHandler exid = new DimExitHandler()
+		{
+			public void exitHandler(int code)
+			{
+				System.out.println("Exit: "+code);
+			}
+		};
+		DimServer.addExitHandler(exit);
+		...
+
+      - In a server it was already possible to find out inside a callback (for example
+	when a command was received):
+	    - from which client id the message came:
+		int dis_get_conn_id()
+            - The name of this client in the form <pid>@<node_name>
+		int dis_get_client(char *name)
+	The equivalent C++ calls:
+	    	int DimServer::getClientId();
+		char *DimServer::getClientName();
+	And Java calls:
+	    	int DimServer.getClientId();
+		String DimServer.getClientName();
+	Where also available.
+
+	These calls were now complemented in 3 ways:
+	1 - They can be done also by clients to find out which server is providing a service
+	    inside a callback (for example when a service is received).
+	    For this purpose the following "C" calls where added:
+	    - from which server id the message came:
+		int dic_get_conn_id()
+            - The name of this server in the form <server_name>@<node_name>
+		int dic_get_server(char *name)
+	      And The equivalent C++ calls:
+	    	int DimClient::getServerId();
+		char *DimClient::getServerName();
+	      And Java calls:
+	    	int DimClient.getServerId();
+		String DimClient.getServerName();
+	2 - These calls are also available inside the errorHandler callbacks.
+	    Can be used to find out if the error originated from a specific connection, 
+            in which case conn_id (or clientID or ServerId) != 0. 
+	    Or if it is a generic error, afecting all connections in which case conn_id = 0.
+	3 - A new type of calls has been added which allows to find out:
+	    For a server - which services are being used by the current client (i.e. the
+	    		   client that triggered the execution of this callback)
+	    For a client - Which services are being provided by the current server (i.e
+			   the server that triggered the execution of this callback)
+
+	    This calls are the following in "C":
+		- char *dis_get_client_services(conn_id)
+		- char *dic_get_server_services(conn_id)
+		They return a list of services separated by '\n'
+	    In C++:
+		- char **DimServer::getClientServices();
+		- char **DimClient::getServerServices();
+		They return an array of pointers to service names. The array is terminated by
+		a null pointer.
+	    In Java:
+		- String[] DimServer.getClientServices();
+		- String[] DimClient.getServerServices();
+
+	An example in C++ of the usage of the new calls in an ErrorHandler:
+
+	class ErrorHandler : public DimErrorHandler
+	{
+		void errorHandler(int severity, int code, char *msg)
+		{
+			int index = 0;
+			char **services;
+			cout << severity << " " << msg << endl;
+			services = DimClient::getServerServices();
+			cout<< "from "<< DimClient::getServerName() << " services:" << endl;
+			while(services[index])
+			{
+				cout << services[index] << endl;
+				index++;
+			}
+		}
+	public:
+		ErrorHandler() {DimClient::addErrorHandler(this);}
+	};
+
+	And in Java:
+
+	...
+	DimErrorHandler eid = new DimErrorHandler()
+	{
+		public void errorHandler(int severity, int code, String msg)
+		{
+			System.out.println("Error: "+msg+" sev: "+severity);
+			String[] list = DimClient.getServerServices();
+			System.out.println("Services: ");
+			for(int i = 0; i < list.length; i++)
+				System.out.println(list[i]);
+		}
+	};
+	DimClient.addErrorHandler(eid);
+
+02/08/2004
+Changes for version 14.5:
+    - Fixed a bug in dic.c - related to commands terminating after a connection was closed,
+      affected in particular DimBrowser "RPC" calls. 
+
+02/08/2004
+Changes for version 14.6:
+    - Noticed that since the changes of version v14r4 the Dns was not printing any error
+      messages anymore - Fixed.
+    - In Windows SO_REUSEADDR doesn't work properly, so two DNSs could be running at the 
+      same time using the same port number on the same PC - Fixed, now like in Linux, the
+      second one exits (printing an error message).
+
+10/08/2004
+Changes for version 14.7:
+    - The TCPIP error "Host Unknown" was not treated or reported properly. A client could
+      report DNS found when the DNS node was set to be an unexisting machine - fixed.
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v15.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v15.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v15.txt	(revision 10183)
@@ -0,0 +1,229 @@
+
+                    DIM version 15.23 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1523
+	(version 15.23).
+
+17/09/2004
+Changes for version 15.0:
+    - Changes for 64 bit machine (LP64 architecture) support
+	- All DIM "tags" are now longs instead of ints this affects:
+	    - Client callback parameters
+	    - Server callback parameters
+	    - Timer callback parameters
+	  (The reason is: tags were very often user to pass pointers) 
+	- DIM is now compiled with -fPIC by default on Linux
+	- The byte swapping and structure padding was fixed.
+
+14/10/2004
+Changes for version 15.1:
+    - Big Bug Fixed affecting the DIM_DNS for windows!!!!
+	- Windows has an hidden default limit of the number of sockets
+	  per process set to 64, only partially though, more sockets can
+	  be created with no problem but they are silently masked out
+          by the select call!
+	- Anyway this limit is now set to 1024.
+    - removed a few print statements.
+
+28/10/2004
+Changes for version 15.2:
+    - Removed some C++ style comments which did not compile on Solaris.
+
+02/11/2004
+Changes for version 15.3:
+    - Byte swapping was missing in one place when asking for stampped 
+      services (noticed on Solaris)
+
+11/11/2004
+Changes for version 15.4:
+    - Added two command line options to dim_send_command:
+	dim_send_command <cmnd_name> [<data>] [-dns <dim_dns_node>] [-s]
+        -dns allows setting the dim_dns_node, and -s means silent.      
+
+03/12/2004
+Changes for version 15.5:
+    - Changed the bahaviour of the DNS "KILL_SERVERS" command. Now if the
+      user declares a server exit_handler, the server will not exit (unless
+      the user code explicilty exits) and will continue running fine, 
+      otherwise the server exits as before.
+    - The exit_handler now gets as parameter the error code that caused the
+      exit request (so that the user can decide wether to exit or not) or 
+      the code sent by the client, if the EXIT request came from a client. 
+      As a result clients should not send exit codes lower than 0x100 in order 
+      not to be confused with the internal error codes.
+    - IMPORTANT NOTES:
+      - The behaviour of the user error_handler() changed. Now the
+	error_handler only gets called to report an error. If the user wants
+	to modify the automatic exit behaviour he/she has to also declare an
+	exit_handler. In previous versions if an error_handler was declared,
+	the exit_handler was not necessary.
+      - Also the Java version has changed since the ERROR codes changed.
+   
+07/12/2004
+Changes for version 15.5-1:
+    - Corrected a bug in include file dis.hxx introduced in v15r5
+
+08/12/2004
+Changes for version 15.6:
+    - Included support for Scheduling policies and priorities between DIM
+      threads by creating the calls:
+	- dim_set_scheduler_class(int sched_class)
+	- dim_get_scheduler_calss(int *sched_class)
+	- dim_set_priority(int dim_thread, int priority)
+	- dim_get_priority(int dim_thread, int priority)
+
+      These calls are only implemented on Linux and Windows and they have 
+      different behaviour on the two platforms:
+	- dim_set_scheduler_class(int sched_class)
+	On Windows:
+	  sched_class is the process's priority class:
+		-1 = IDLE_PRIORITY_CLASS
+		 0 = NORMAL_PRIORITY_CLASS
+		 1 = HIGH_PRIORITY_CLASS
+		 2 = REALTIME_PRIORITY_CLASS
+	On Linux:
+	  sched_class is the process's schedule policy:
+		 0 = SCHED_OTHER
+		 1 = SCHED_FIFO
+		 2 = SCHED_RR
+	  All threads in the process will be set to this sched_class
+	
+	- dim_set_priority(int dim_thread, int priority)
+	  where dim_thread : 1 - Main thread, 2 - IO thread, 3 - Timer thread
+	On Windows:
+	  priority is the thread's relative priority:
+		-3 = THREAD_PRIORITY_IDLE
+		-2 = THREAD_PRIORITY_LOWEST
+		-1 = THREAD_PRIORITY_BELOW_NORMAL
+		 0 = THREAD_PRIORITY_NORMAL
+		 1 = THREAD_PRIORITY_ABOVE_NORMAL
+		 2 = THREAD_PRIORITY_HIGHEST
+		 3 = THREAD_PRIORITY_TIME_CRITICAL
+
+	On Linux:
+	  priority is the thread's absolute priority:
+		 0 	for SCHED_OTHER
+		 1 - 99 for SCHED_FIFO or SCHED_RR
+
+03/02/2005
+Changes for version 15.7:
+    - Fixed a bug that made DIM servers crash when unplugging for a short time the
+      network cable.
+    - Linux executables and libraries are now compiled on Linux SLC3 with gcc 3.2.3
+    - Contains a new version of the DIM Tree Browser for WIndows. 
+
+02/03/2005
+Changes for version 15.8:
+    - Contains again a new version of the DIM Tree Browser for WIndows, now allows
+      to display structures correctly (Thanks to Serguei Sergueev). 
+    - DIM used old style predefined macros, for example linux instead of __linux__.
+      So it didn't compile when users used gcc/g++ -ansi -pedantic. Fixed.
+    - A check is now made on the length of a DIM service name. The service is 
+      discarded if the name is longer then 131 characters.
+
+04/04/2005
+Changes for version 15.9:
+    - Ported to MacOSX (Darwin). "OS" has to be defined as "Darwin":
+      	- Replaced ftime() by gettimeofday()
+	- Used sem_open instead of sem_init on Darwin. (sem_init not implemented).
+    - Made some order in the macro definition, so that it works whether for example 
+      unix or __unix__ are defined.
+    - Sometimes when a server received a command, the connection to the client wasn't
+      completely setup yet, so DimServer::getClientName() would not return the correct
+      result - Fixed.
+
+11/04/2005
+Changes for version 15.10:
+    - Fixed a memory leak that happened in clients when sending commands to a 
+      non-existing server.
+
+15/04/2005
+Changes for version 15.11:
+    - Optimized DIM for servers with many services (in particular the server library).
+    - Uses a better Hash function in Dns and servers.
+
+20/04/2005
+Changes for version 15.12:
+    - DIM did not update a service if it contained no data - fixed.
+
+22/04/2005
+Changes for version 15.13:
+    - Fixed a bug introduced in version 15.11, servers did not reconnect anymore
+      when the DNS restarted.
+
+02/05/2005
+Changes for version 15.14:
+    - Fixed several features or bugs related to the optimizations for many services:
+	- Sometimes a server declaring the same services would not exit properly
+	- If a browser was open it would slow down enourmously the start up of the 
+	  server
+	- A server sometimes crashed while declaring the services
+
+24/05/2005
+Changes for version 15.15:
+    - Fixed some warnings reported by "valgrind" mostly related to delete[]
+
+30/05/2005
+Changes for version 15.16:
+    - Fixed a bug related to a server name longer than 40 characters.
+
+16/06/2005
+Changes for version 15.17:
+    - Included the call keepWaiting() in DimRpcInfo. To allow multiple client
+      RPCs to use the same Server RPC (the user still has to provide an id).
+
+20/06/2005
+Changes for version 15.18:
+    - Included support for creating user threads:
+	- From "C":
+		int dim_start_thread(void (*thread_ast)(), long tag)
+	- From C++:
+		class DimThread
+		{
+		public:
+			DimThread();
+			virtual ~DimThread();
+			int start();
+			virtual void threadHandler() { };
+		};
+
+27/06/2005
+Changes for version 15.19:
+    - Added the possibility to decide not to update a service in a server callback
+      by returning a negative size (to be used with care, since the client will
+      timeout if the server stops responding for too long).
+
+15/08/2005
+Changes for version 15.20:
+    - Fixed a bug which could make a DIM server loop forever (happened to tmSrv)
+
+19/08/2005
+Changes for version 15.21:
+    - Fixed a bug in the DNS introduced in version v15r7: would not report and react
+      properly, in some ocasions, to previously declared services.
+
+05/10/2005
+Changes for version 15.22:
+    - Fixed some error messages reported by the DNS, they were not correct.
+
+04/11/2005
+Changes for version 15.23:
+    - Fixed several bugs in the timer handling mechanisms. Could provoke fake timeouts.
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v16.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v16.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v16.txt	(revision 10183)
@@ -0,0 +1,182 @@
+
+                    DIM version 16.14 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1614.
+
+07/12/2007
+Changes for version 16.14:
+    - Now by default All DIM processes are ready to accept up to 8192 connections, both
+      in Linux and Windows. Although in Linux for this to be effective the machine system 
+      limits must allow more than 1024 descriptors/open files per process.
+    - Fixed a little memory leak in tokenstring.cxx
+    - And a little compilation bug for some platforms in tcpip.c 
+
+
+15/05/2007
+Changes for version 16.13:
+    - If DIM_HOST_NODE is defined when starting up a server, a DIM client will now try 
+      two network interfaces in order to talk to that server and only give up if they both 
+      fail. First it will try the ip name or ip address specified by the server using 
+      DIM_HOST_NODE, if that fails it will try the ip address of the default interface
+      retrieved by the server using gethostname (and gethostbyname).
+      The changes basically affect the case in which the DIM_HOST_NODE given to the servers
+      is specified as IP address instad of an IP name. Otherwise this mechanism was already 
+      working.
+
+
+3/05/2007
+Changes for version 16.12:
+    - The Java version did not exit properly when main() terminated - fixed.
+
+
+25/04/2007
+Changes for version 16.11:
+    - On Linux the timeout to detect a lost connections (unplugged ethernet cable
+      or machine reboot) was too long, around 15 minutes - Fixed.
+      On Linux the KEEPALIVE feature is now used instead of a regular socket write,
+      all other platforms should work as before.
+
+
+21/02/2007
+Changes for version 16.10:
+    - Found a bug in dis_stop_serving: one socket connection was not closed - fixed.
+    - Implemented a new environment variable for the DNS: DIM_DNS_ACCEPTED_NODES
+      Can receive a list on nodes or domains separated by commas.
+      If the DNS receives a connection from a node not in this list, it will
+      reject it and kill the server or client requesting it.
+    - Fixed some C++ warnings.
+
+
+19/01/2007
+Changes for version 16.9:
+    - The modifications done in version 16.8 have introduced a bug:
+	- DIM servers would not behave properly (exit) when receiving a kill command
+          from the DNS (for duplicated services, not allowed host names or manual "kill")
+	  This is now fixed.
+
+
+30/10/2006
+Changes for version 16.8:
+    - Modified dis_stop_serving() and DimServer::stop() to completely stop DIM:
+	- Stop also the DIM threads.
+	- Release all allocated memory
+	- Allow a different port number when re-starting.
+
+
+11/07/2006
+Changes for version 16.7:
+    - Prepared for increasing the number of open connections per process
+      (On Linux still requires changing some parameters and recompiling the Dns)
+    - Fixed one error and several warnings for gcc 4.
+
+
+11/05/2006
+Changes for version 16.6:
+    - Sometimes a server or client would crash while exiting if the DNS was not running.
+      Fixed.
+    - Fixed the reporting of some ERROR messages on Windows (used to report error "0")
+    - Allowed dim_send_command to receive instead of -dns <node_name>
+	-dns <node_name>[:<port_number>]
+
+
+01/05/2006
+Changes for version 16.5:
+    - Big Spring Cleanup. Removed most warnings. Can now be compiled on
+      Windows with Warning Level 3 and on Linux with -Wall
+      (still not working for -ansi -pedantic...)
+    - When trying to access a server in a different network (i.e. not reacheable)
+      a client (for example DID) would take very very long to timeout - fixed.
+    - Added two new sets of functions that allow setting the DIM_DNS_NODE separately
+      for a server and a client in the same process:
+	- int dis_set_dns_node(char *node)
+	- int dis_get_dns_node(char *node)
+	- int dis_set_dns_port(int port)
+	- int dis_get_dns_port()
+
+	- int dic_set_dns_node(char *node)
+	- int dic_get_dns_node(char *node)
+	- int dic_set_dns_port(int port)
+	- int dic_get_dns_port()
+      These routines should be used instead of the equivalent ones starting with "dim_"
+      since these set the same DIM_DNS_NODE/port for both Server and client parts of a 
+      process.
+    - Adapted the C++ equivalents (DimClient::setDnsNode, etc. and DimServer::setDnsNode, 
+      etc.) to use the new routines, so they are now independent.
+      Adapted also the Java equivalents.
+    - Fixed DimBridge to use the new routines.
+    - Fixed a bug in DID that made it crash sometimes at startup (and also when the DNS 
+      restarted)!
+    - Found some very interesting features of DIM:
+        - In a node with two ethernet interfaces (so connected to two networks):
+	    - The DNS will answer to servers and client on both networks, only its server
+              part - DIS_DNS (the one that answers to DID and DimBrowser requests) would
+              in principle answer only to one of the networks (in principle the default
+              interface* but can be changed by setting the environment variable "DIM_HOST_NODE").    
+	    - But, in fact, if the DNS or any server is started with the environment variable 
+              DIM_HOST_NODE set to the interface that is not the default* one. Than both the 
+              DNS (including the server part) and the DIM servers will be accessible from both 
+              networks. For example DID will work fine on both networks.
+            * The command "hostname" will return the name of the default network interface.   
+
+    Note: As a result of inserting new functions the DIM shared library entry points have
+          changed, so all DIM Servers/Clients should be relinked (in particular in Linux).
+
+
+20/04/2006
+Changes for version 16.4:
+    - Optimized the DNS for providing the list or running servers dynamically
+      by subscribing to the service "DIS_DNS/SERVER_LIST"
+
+
+07/04/2006
+Changes for version 16.3:
+    - Upgraded to work on LynxOS Version 4. 
+      - Updated makefile for INTEL platform
+      - Updated some ifdefs based on the existence of __Lynx__
+
+
+10/03/2006
+Changes for version 16.2:
+    - Increased the listen queue. To avoid "Connection Refused" messages from servers
+      or from the DNS.
+
+
+28/02/2006
+Changes for version 16.1:
+    - Fixed the NO_THREADS option for LINUX, it had stopped working.
+    - DimInfo::getData() could return an invalid pointer if called before connecting
+      to the server (or discovering the server did not exist). Fixed 
+      (it now returns 0 in this case).
+
+
+09/11/2005
+Changes for version 16.0:
+    - Consolidated the new timer handling mechanism, should be much more precise.
+    - Fixed the RPC handling. Used to be based on timming assumptions.
+      Now uses a safe protocol to make sure the server is connected before sending 
+      an RPC request.
+    - Included in the distribution some performance measurements and a benchmark 
+      server and client. Sources in src/benchmark executables in /bin for windows
+      and /linux for linux.
+      Usage:
+	benchServer <message_size_in_bytes> <number_of_services>
+	benchClient
+      benchClient will run for a while and print the measurement results. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v17.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v17.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v17.txt	(revision 10183)
@@ -0,0 +1,319 @@
+
+                    DIM version 17.12 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux, Darwin}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1712.
+
+06/11/2008
+Changes for version 17.12:
+    - Client functionality:
+    	- Added a new function dic_stop(), to close anything related to DIM 
+          for a client
+    	- Added the function dic_get_server_pid(). Similar to dic_get_server(). 
+          Can be executed in a callback to retrieve the pid of the current server
+    - DimBrowser Class:
+        - DimBrowser::getServices() used to create and destroy the DimRpc connection
+          to the Dns every time it was called. This was heavy if called in a loop.
+          Now the connection is maintained until the DimBrowser itself is destroyed.
+	- A new method DimBrowser::getNextServer(char *&server, char *&node, int *pid)
+          has been created. similar to the previous one but returns also the server pid.
+    - DNS
+	- The DNS was still doing some blocking write calls to servers or clients.
+          Now all write calls have a timeout and can not block forever.
+    - Linux DID
+	- The "Subscribe" button was subscribing to services with update rate of 10 seconds.
+	  This was misleading, the users could think the server was calling update_service
+          when it wasn't.
+          Now there are two Subscribe buttons ("on change" or "Update rate of 10 seconds").
+    - DimDridge
+	- Accepts an extra flag "-copy" which provokes an internal copy of the data.
+
+
+08/09/2008
+Changes for version 17.11:
+    - Some DIM Processes, servers or clients could enter a loop taking 100 % CPU 
+      time in some rare occasions, fixed.
+    - Added some protections when removing services in the DimBridge.
+
+
+30/08/2008
+Changes for version 17.10:
+    - Some DIM Processes, servers or clients would not reconnect when the DNS was
+      restarted. Fixed two cause:
+	- Some processes in Linux were stuck reading from the DNS socket
+	- Some others "forgot" to set a timer under very special conditions
+    - Changed some of the DNS debug messages to be more explicit.
+
+
+21/07/2008
+Changes for version 17.09:
+    - DIM error messages were not being flushed when the output was redirected 
+      to a logfile, fixed.
+
+
+18/07/2008
+Changes for version 17.08:
+    - Sometimes a server or a client could do a read on a sockect that had just
+      been closed which left them hanging forever - fixed.
+
+
+01/07/2008
+Changes for version 17.07:
+    - The DimTimer was sometimes not started when the constructor was called
+      with a time argument.
+    - Clients could not connect to more than 1024 servers - fixed.
+      (if the machine allows more than 1024 connections)
+
+
+30/06/2008
+Changes for version 17.06:
+    - Corrected the makefile for Darwin, now the number of accepted connections is 
+      increased to 8192 only for Linux.
+    - Fixed a bug in the DimTimer, it used to accept to be re-started, but then crashed
+      at destruction time if not stopped the same number of times. Now it can not be
+      re-started.
+    - The Dns used to ask servers to re-register at regular intervals when they were not 
+      sending their watchdog messages (i.e. they were in "ERROR", red in DID). Now the
+      DNS only asks once (unless they answer). This could cause the DNS to hang if
+      servers were in ERROR for a long time.
+    - The Dns now accepts a command line parameter: -d to print debug messages.
+    - The clients were not handling properly the case when they could contact the DNS
+      but then they could not contact the server that the DNS gave them (either because
+      of a firewall or because the server run on an inaccessible network). In this case
+      the clients would timeout trying to contact the server for each service and kept
+      asking the DNS the server coordinates over and over again. Now the clients keep
+      a list on unreacheable servers, so they don't try to contact the server for each 
+      service and only ask the DNS again with an increasing interval that goes from 10 
+      seconds to 2 minutes maximum.
+    - The server now issues an error message if the format string is too long.
+    - Linux DID
+        - Removed the command "Kill ALL Servers", it was too dangerous
+	- Now the list of nodes in "View Servers by Node" is in alphabetical order and
+	  in lowercase.
+
+
+30/04/2008
+Changes for version 17.05:
+    - In Linux in some cases a SIGPIPE was generated. Normally the DIM library sets
+      the behaviour of SIGPIPE to ignored, but if another library or main program
+      changes the SIGPIPE behaviour, then the application could exit when the SIGPIPE
+      was generated. Fixed - on Linux now the function send with flag MSG_NOSIGNAL
+      is used in oder to avoid generating SIGPIPE.
+
+
+
+4/04/2008
+Changes for version 17.04:
+    - Sometimes processes (servers or clients) would hang when the DNS was restarted.
+      This was due to a strange (Windows?) feature, by which a connect could succeed
+      after a connection was closed (and reported) on the other side. Fixed.
+
+
+
+27/03/2008
+Changes for version 17.03:
+    - Can now make DID for 64 bits by making DIM using:
+	gmake X64=yes all
+    - Increased the size of the Hash tables for the servers and the DNS.
+
+
+
+20/02/2008
+Changes for version 17.02:
+    - Fixed the Java DimTimer - stop() didn't work
+      Required changing dim_jni.c as well as the java part
+    - Fixed DIM for Darwin - had stopped working
+
+
+
+20/01/2008
+Changes for version 17.01:
+    - The Java API now works on 64 bit machines, Thanks to Joern Adamczewski.
+      Please use:
+	gmake JDIM=yes all
+    - Linux executables are now compiled/linked on slc4 (32 bits).
+    - Big changes in the DimRpcs both client and server part. Tere were bugs
+      related to the handling of timeouts.
+      Unfortunatelly all applications using RPCs need to be re-linked.
+
+
+
+-----------------------------------------------------------------------------------------
+Previous version history:
+
+07/12/2007
+Changes for version 16.14:
+    - Now by default All DIM processes are ready to accept up to 8192 connections, both
+      in Linux and Windows. Although in Linux for this to be effective the machine system 
+      limits must allow more than 1024 descriptors/open files per process.
+    - Fixed a little memory leak in tokenstring.cxx
+    - And a little compilation bug for some platforms in tcpip.c 
+
+
+15/05/2007
+Changes for version 16.13:
+    - If DIM_HOST_NODE is defined when starting up a server, a DIM client will now try 
+      two network interfaces in order to talk to that server and only give up if they both 
+      fail. First it will try the ip name or ip address specified by the server using 
+      DIM_HOST_NODE, if that fails it will try the ip address of the default interface
+      retrieved by the server using gethostname (and gethostbyname).
+      The changes basically affect the case in which the DIM_HOST_NODE given to the servers
+      is specified as IP address instad of an IP name. Otherwise this mechanism was already 
+      working.
+
+
+3/05/2007
+Changes for version 16.12:
+    - The Java version did not exit properly when main() terminated - fixed.
+
+
+25/04/2007
+Changes for version 16.11:
+    - On Linux the timeout to detect a lost connections (unplugged ethernet cable
+      or machine reboot) was too long, around 15 minutes - Fixed.
+      On Linux the KEEPALIVE feature is now used instead of a regular socket write,
+      all other platforms should work as before.
+
+
+21/02/2007
+Changes for version 16.10:
+    - Found a bug in dis_stop_serving: one socket connection was not closed - fixed.
+    - Implemented a new environment variable for the DNS: DIM_DNS_ACCEPTED_NODES
+      Can receive a list on nodes or domains separated by commas.
+      If the DNS receives a connection from a node not in this list, it will
+      reject it and kill the server or client requesting it.
+    - Fixed some C++ warnings.
+
+
+19/01/2007
+Changes for version 16.9:
+    - The modifications done in version 16.8 have introduced a bug:
+	- DIM servers would not behave properly (exit) when receiving a kill command
+          from the DNS (for duplicated services, not allowed host names or manual "kill")
+	  This is now fixed.
+
+
+30/10/2006
+Changes for version 16.8:
+    - Modified dis_stop_serving() and DimServer::stop() to completely stop DIM:
+	- Stop also the DIM threads.
+	- Release all allocated memory
+	- Allow a different port number when re-starting.
+
+
+11/07/2006
+Changes for version 16.7:
+    - Prepared for increasing the number of open connections per process
+      (On Linux still requires changing some parameters and recompiling the Dns)
+    - Fixed one error and several warnings for gcc 4.
+
+
+11/05/2006
+Changes for version 16.6:
+    - Sometimes a server or client would crash while exiting if the DNS was not running.
+      Fixed.
+    - Fixed the reporting of some ERROR messages on Windows (used to report error "0")
+    - Allowed dim_send_command to receive instead of -dns <node_name>
+	-dns <node_name>[:<port_number>]
+
+
+01/05/2006
+Changes for version 16.5:
+    - Big Spring Cleanup. Removed most warnings. Can now be compiled on
+      Windows with Warning Level 3 and on Linux with -Wall
+      (still not working for -ansi -pedantic...)
+    - When trying to access a server in a different network (i.e. not reacheable)
+      a client (for example DID) would take very very long to timeout - fixed.
+    - Added two new sets of functions that allow setting the DIM_DNS_NODE separately
+      for a server and a client in the same process:
+	- int dis_set_dns_node(char *node)
+	- int dis_get_dns_node(char *node)
+	- int dis_set_dns_port(int port)
+	- int dis_get_dns_port()
+
+	- int dic_set_dns_node(char *node)
+	- int dic_get_dns_node(char *node)
+	- int dic_set_dns_port(int port)
+	- int dic_get_dns_port()
+      These routines should be used instead of the equivalent ones starting with "dim_"
+      since these set the same DIM_DNS_NODE/port for both Server and client parts of a 
+      process.
+    - Adapted the C++ equivalents (DimClient::setDnsNode, etc. and DimServer::setDnsNode, 
+      etc.) to use the new routines, so they are now independent.
+      Adapted also the Java equivalents.
+    - Fixed DimBridge to use the new routines.
+    - Fixed a bug in DID that made it crash sometimes at startup (and also when the DNS 
+      restarted)!
+    - Found some very interesting features of DIM:
+        - In a node with two ethernet interfaces (so connected to two networks):
+	    - The DNS will answer to servers and client on both networks, only its server
+              part - DIS_DNS (the one that answers to DID and DimBrowser requests) would
+              in principle answer only to one of the networks (in principle the default
+              interface* but can be changed by setting the environment variable "DIM_HOST_NODE").    
+	    - But, in fact, if the DNS or any server is started with the environment variable 
+              DIM_HOST_NODE set to the interface that is not the default* one. Than both the 
+              DNS (including the server part) and the DIM servers will be accessible from both 
+              networks. For example DID will work fine on both networks.
+            * The command "hostname" will return the name of the default network interface.   
+
+    Note: As a result of inserting new functions the DIM shared library entry points have
+          changed, so all DIM Servers/Clients should be relinked (in particular in Linux).
+
+
+20/04/2006
+Changes for version 16.4:
+    - Optimized the DNS for providing the list or running servers dynamically
+      by subscribing to the service "DIS_DNS/SERVER_LIST"
+
+
+07/04/2006
+Changes for version 16.3:
+    - Upgraded to work on LynxOS Version 4. 
+      - Updated makefile for INTEL platform
+      - Updated some ifdefs based on the existence of __Lynx__
+
+
+10/03/2006
+Changes for version 16.2:
+    - Increased the listen queue. To avoid "Connection Refused" messages from servers
+      or from the DNS.
+
+
+28/02/2006
+Changes for version 16.1:
+    - Fixed the NO_THREADS option for LINUX, it had stopped working.
+    - DimInfo::getData() could return an invalid pointer if called before connecting
+      to the server (or discovering the server did not exist). Fixed 
+      (it now returns 0 in this case).
+
+
+09/11/2005
+Changes for version 16.0:
+    - Consolidated the new timer handling mechanism, should be much more precise.
+    - Fixed the RPC handling. Used to be based on timming assumptions.
+      Now uses a safe protocol to make sure the server is connected before sending 
+      an RPC request.
+    - Included in the distribution some performance measurements and a benchmark 
+      server and client. Sources in src/benchmark executables in /bin for windows
+      and /linux for linux.
+      Usage:
+	benchServer <message_size_in_bytes> <number_of_services>
+	benchClient
+      benchClient will run for a while and print the measurement results. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v18.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v18.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v18.txt	(revision 10183)
@@ -0,0 +1,376 @@
+
+                    DIM version 18.05 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux, Darwin}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1805.
+
+26/02/2009
+Changes for version 18.05:
+    - Made the callback for "DIS_DNS/SERVER_LIST" uninterruptible, so that two clients subscribing
+      would not get mixed up answers.
+    - The same for "<server>/SERVICE_LIST"
+    - Tryied to fix a DNS crash, introduced in v18r4 by releasing the connection when "informing clients".
+    - removed some "//" comments in "C"
+
+
+20/02/2009
+Changes for version 18.04:
+    - Changed the dim_wait() mechanism, so that it works for several threads in parallel:
+	- On Linux it was based on POSIX semaphores now it is based on POSIX "condition 
+          variables"
+	- On Windows it was based on "Auto Reset Events" now it uses "Manual Resel "Events"
+    - The DNS should now correctly update the "DIS_DNS/SERVER_LIST" service. It used to report
+      a new server, even when the services already existed and the server was killed by the DNS.
+      (And never report it killed). It also didn't report correctly when a server went out of "ERROR"
+      (this is reported as a "+" as for a new server). 
+
+
+05/02/2009
+Changes for version 18.03:
+    - The list of registered services in a server could get corrupted in some rare cases
+      making the server crash - fixed.
+    - If the DNS couldn't talk to a client it could sometimes hang - fixed.
+    - Java client modifications:
+	- DimUpdatedInfo was not working correctly - fixed in dim_jni.c.
+	- Implemented DimRpcInfo
+	- Changed the DimBroser class to use DimRpcInfo.
+	- Added a jdim.jar file in the jdim/classes directory of the DIM distribution 
+
+
+15/01/2009
+Changes for version 18.02:
+    - Added the following functions:
+	- C++ Client
+		- int DimClient.getServerPid()
+	- Java Client
+		- int DimClient.getServerPid()
+		- String[] DimBrowser.getServers()
+		- String DimBrowser.getServerNode(String server)
+		- int DimBrowser.getServerPid(String server)
+
+
+09/01/2009
+Changes for version 18.01:
+    - Added in the distribution the Visual Studio 8 dlls and manifest. Otherwise
+      it would not work on most PCs.
+
+
+03/12/2008
+Changes for version 18.00:
+    - The Windows execulables and libraries are now built using Visual Studio 8
+    - Some changes added by GSI mainly in the Java Native Interface
+
+
+06/11/2008
+Changes for version 17.12:
+    - Client functionality:
+    	- Added a new function dic_stop(), to close anything related to DIM 
+          for a client
+    	- Added the function dic_get_server_pid(). Similar to dic_get_server(). 
+          Can be executed in a callback to retrieve the pid of the current server
+    - DimBrowser Class:
+        - DimBrowser::getServices() used to create and destroy the DimRpc connection
+          to the Dns every time it was called. This was heavy if called in a loop.
+          Now the connection is maintained until the DimBrowser itself is destroyed.
+	- A new method DimBrowser::getNextServer(char *&server, char *&node, int *pid)
+          has been created. similar to the previous one but returns also the server pid.
+    - DNS
+	- The DNS was still doing some blocking write calls to servers or clients.
+          Now all write calls have a timeout and can not block forever.
+    - Linux DID
+	- The "Subscribe" button was subscribing to services with update rate of 10 seconds.
+	  This was misleading, the users could think the server was calling update_service
+          when it wasn't.
+          Now there are two Subscribe buttons ("on change" or "Update rate of 10 seconds").
+    - DimDridge
+	- Accepts an extra flag "-copy" which provokes an internal copy of the data.
+
+
+08/09/2008
+Changes for version 17.11:
+    - Some DIM Processes, servers or clients could enter a loop taking 100 % CPU 
+      time in some rare occasions, fixed.
+    - Added some protections when removing services in the DimBridge.
+
+
+30/08/2008
+Changes for version 17.10:
+    - Some DIM Processes, servers or clients would not reconnect when the DNS was
+      restarted. Fixed two cause:
+	- Some processes in Linux were stuck reading from the DNS socket
+	- Some others "forgot" to set a timer under very special conditions
+    - Changed some of the DNS debug messages to be more explicit.
+
+
+21/07/2008
+Changes for version 17.09:
+    - DIM error messages were not being flushed when the output was redirected 
+      to a logfile, fixed.
+
+
+18/07/2008
+Changes for version 17.08:
+    - Sometimes a server or a client could do a read on a sockect that had just
+      been closed which left them hanging forever - fixed.
+
+
+01/07/2008
+Changes for version 17.07:
+    - The DimTimer was sometimes not started when the constructor was called
+      with a time argument.
+    - Clients could not connect to more than 1024 servers - fixed.
+      (if the machine allows more than 1024 connections)
+
+
+30/06/2008
+Changes for version 17.06:
+    - Corrected the makefile for Darwin, now the number of accepted connections is 
+      increased to 8192 only for Linux.
+    - Fixed a bug in the DimTimer, it used to accept to be re-started, but then crashed
+      at destruction time if not stopped the same number of times. Now it can not be
+      re-started.
+    - The Dns used to ask servers to re-register at regular intervals when they were not 
+      sending their watchdog messages (i.e. they were in "ERROR", red in DID). Now the
+      DNS only asks once (unless they answer). This could cause the DNS to hang if
+      servers were in ERROR for a long time.
+    - The Dns now accepts a command line parameter: -d to print debug messages.
+    - The clients were not handling properly the case when they could contact the DNS
+      but then they could not contact the server that the DNS gave them (either because
+      of a firewall or because the server run on an inaccessible network). In this case
+      the clients would timeout trying to contact the server for each service and kept
+      asking the DNS the server coordinates over and over again. Now the clients keep
+      a list on unreacheable servers, so they don't try to contact the server for each 
+      service and only ask the DNS again with an increasing interval that goes from 10 
+      seconds to 2 minutes maximum.
+    - The server now issues an error message if the format string is too long.
+    - Linux DID
+        - Removed the command "Kill ALL Servers", it was too dangerous
+	- Now the list of nodes in "View Servers by Node" is in alphabetical order and
+	  in lowercase.
+
+
+30/04/2008
+Changes for version 17.05:
+    - In Linux in some cases a SIGPIPE was generated. Normally the DIM library sets
+      the behaviour of SIGPIPE to ignored, but if another library or main program
+      changes the SIGPIPE behaviour, then the application could exit when the SIGPIPE
+      was generated. Fixed - on Linux now the function send with flag MSG_NOSIGNAL
+      is used in oder to avoid generating SIGPIPE.
+
+
+
+4/04/2008
+Changes for version 17.04:
+    - Sometimes processes (servers or clients) would hang when the DNS was restarted.
+      This was due to a strange (Windows?) feature, by which a connect could succeed
+      after a connection was closed (and reported) on the other side. Fixed.
+
+
+
+27/03/2008
+Changes for version 17.03:
+    - Can now make DID for 64 bits by making DIM using:
+	gmake X64=yes all
+    - Increased the size of the Hash tables for the servers and the DNS.
+
+
+
+20/02/2008
+Changes for version 17.02:
+    - Fixed the Java DimTimer - stop() didn't work
+      Required changing dim_jni.c as well as the java part
+    - Fixed DIM for Darwin - had stopped working
+
+
+
+20/01/2008
+Changes for version 17.01:
+    - The Java API now works on 64 bit machines, Thanks to Joern Adamczewski.
+      Please use:
+	gmake JDIM=yes all
+    - Linux executables are now compiled/linked on slc4 (32 bits).
+    - Big changes in the DimRpcs both client and server part. Tere were bugs
+      related to the handling of timeouts.
+      Unfortunatelly all applications using RPCs need to be re-linked.
+
+
+
+-----------------------------------------------------------------------------------------
+Previous version history:
+
+07/12/2007
+Changes for version 16.14:
+    - Now by default All DIM processes are ready to accept up to 8192 connections, both
+      in Linux and Windows. Although in Linux for this to be effective the machine system 
+      limits must allow more than 1024 descriptors/open files per process.
+    - Fixed a little memory leak in tokenstring.cxx
+    - And a little compilation bug for some platforms in tcpip.c 
+
+
+15/05/2007
+Changes for version 16.13:
+    - If DIM_HOST_NODE is defined when starting up a server, a DIM client will now try 
+      two network interfaces in order to talk to that server and only give up if they both 
+      fail. First it will try the ip name or ip address specified by the server using 
+      DIM_HOST_NODE, if that fails it will try the ip address of the default interface
+      retrieved by the server using gethostname (and gethostbyname).
+      The changes basically affect the case in which the DIM_HOST_NODE given to the servers
+      is specified as IP address instad of an IP name. Otherwise this mechanism was already 
+      working.
+
+
+3/05/2007
+Changes for version 16.12:
+    - The Java version did not exit properly when main() terminated - fixed.
+
+
+25/04/2007
+Changes for version 16.11:
+    - On Linux the timeout to detect a lost connections (unplugged ethernet cable
+      or machine reboot) was too long, around 15 minutes - Fixed.
+      On Linux the KEEPALIVE feature is now used instead of a regular socket write,
+      all other platforms should work as before.
+
+
+21/02/2007
+Changes for version 16.10:
+    - Found a bug in dis_stop_serving: one socket connection was not closed - fixed.
+    - Implemented a new environment variable for the DNS: DIM_DNS_ACCEPTED_NODES
+      Can receive a list on nodes or domains separated by commas.
+      If the DNS receives a connection from a node not in this list, it will
+      reject it and kill the server or client requesting it.
+    - Fixed some C++ warnings.
+
+
+19/01/2007
+Changes for version 16.9:
+    - The modifications done in version 16.8 have introduced a bug:
+	- DIM servers would not behave properly (exit) when receiving a kill command
+          from the DNS (for duplicated services, not allowed host names or manual "kill")
+	  This is now fixed.
+
+
+30/10/2006
+Changes for version 16.8:
+    - Modified dis_stop_serving() and DimServer::stop() to completely stop DIM:
+	- Stop also the DIM threads.
+	- Release all allocated memory
+	- Allow a different port number when re-starting.
+
+
+11/07/2006
+Changes for version 16.7:
+    - Prepared for increasing the number of open connections per process
+      (On Linux still requires changing some parameters and recompiling the Dns)
+    - Fixed one error and several warnings for gcc 4.
+
+
+11/05/2006
+Changes for version 16.6:
+    - Sometimes a server or client would crash while exiting if the DNS was not running.
+      Fixed.
+    - Fixed the reporting of some ERROR messages on Windows (used to report error "0")
+    - Allowed dim_send_command to receive instead of -dns <node_name>
+	-dns <node_name>[:<port_number>]
+
+
+01/05/2006
+Changes for version 16.5:
+    - Big Spring Cleanup. Removed most warnings. Can now be compiled on
+      Windows with Warning Level 3 and on Linux with -Wall
+      (still not working for -ansi -pedantic...)
+    - When trying to access a server in a different network (i.e. not reacheable)
+      a client (for example DID) would take very very long to timeout - fixed.
+    - Added two new sets of functions that allow setting the DIM_DNS_NODE separately
+      for a server and a client in the same process:
+	- int dis_set_dns_node(char *node)
+	- int dis_get_dns_node(char *node)
+	- int dis_set_dns_port(int port)
+	- int dis_get_dns_port()
+
+	- int dic_set_dns_node(char *node)
+	- int dic_get_dns_node(char *node)
+	- int dic_set_dns_port(int port)
+	- int dic_get_dns_port()
+      These routines should be used instead of the equivalent ones starting with "dim_"
+      since these set the same DIM_DNS_NODE/port for both Server and client parts of a 
+      process.
+    - Adapted the C++ equivalents (DimClient::setDnsNode, etc. and DimServer::setDnsNode, 
+      etc.) to use the new routines, so they are now independent.
+      Adapted also the Java equivalents.
+    - Fixed DimBridge to use the new routines.
+    - Fixed a bug in DID that made it crash sometimes at startup (and also when the DNS 
+      restarted)!
+    - Found some very interesting features of DIM:
+        - In a node with two ethernet interfaces (so connected to two networks):
+	    - The DNS will answer to servers and client on both networks, only its server
+              part - DIS_DNS (the one that answers to DID and DimBrowser requests) would
+              in principle answer only to one of the networks (in principle the default
+              interface* but can be changed by setting the environment variable "DIM_HOST_NODE").    
+	    - But, in fact, if the DNS or any server is started with the environment variable 
+              DIM_HOST_NODE set to the interface that is not the default* one. Than both the 
+              DNS (including the server part) and the DIM servers will be accessible from both 
+              networks. For example DID will work fine on both networks.
+            * The command "hostname" will return the name of the default network interface.   
+
+    Note: As a result of inserting new functions the DIM shared library entry points have
+          changed, so all DIM Servers/Clients should be relinked (in particular in Linux).
+
+
+20/04/2006
+Changes for version 16.4:
+    - Optimized the DNS for providing the list or running servers dynamically
+      by subscribing to the service "DIS_DNS/SERVER_LIST"
+
+
+07/04/2006
+Changes for version 16.3:
+    - Upgraded to work on LynxOS Version 4. 
+      - Updated makefile for INTEL platform
+      - Updated some ifdefs based on the existence of __Lynx__
+
+
+10/03/2006
+Changes for version 16.2:
+    - Increased the listen queue. To avoid "Connection Refused" messages from servers
+      or from the DNS.
+
+
+28/02/2006
+Changes for version 16.1:
+    - Fixed the NO_THREADS option for LINUX, it had stopped working.
+    - DimInfo::getData() could return an invalid pointer if called before connecting
+      to the server (or discovering the server did not exist). Fixed 
+      (it now returns 0 in this case).
+
+
+09/11/2005
+Changes for version 16.0:
+    - Consolidated the new timer handling mechanism, should be much more precise.
+    - Fixed the RPC handling. Used to be based on timming assumptions.
+      Now uses a safe protocol to make sure the server is connected before sending 
+      an RPC request.
+    - Included in the distribution some performance measurements and a benchmark 
+      server and client. Sources in src/benchmark executables in /bin for windows
+      and /linux for linux.
+      Usage:
+	benchServer <message_size_in_bytes> <number_of_services>
+	benchClient
+      benchClient will run for a while and print the measurement results. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v19.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v19.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v19.txt	(revision 10183)
@@ -0,0 +1,540 @@
+
+                    DIM version 19.15 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux, Darwin}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 1915.
+
+20/12/2010
+Changes for version 19.15:
+    - Still fixing dis_stop_serving():
+        - The DNS sometimes gets a remove service message from a server, after the server has
+          closed the connection, this was not handled properly - fixed.
+        - Fixed yet another detail (variable not cleared) in the thread handling at dis_stop_serving().
+	- dtq.c now clears all timer_queues at dis_stop_serving()
+	- Added some protections in case of closed connections.
+
+
+10/12/2010
+Changes for version 19.14:
+    - Still fixing dis_stop_serving():
+	- Adedd pthread_join in linux to wait for threads to die
+	- the following dis_start_serving() would not reconnect to the DNS if the DNS connection
+          was pending (i.e. the DNS was stopped or restarted)
+
+
+06/12/2010
+Changes for version 19.13:
+    - Fixed a few compiler warnings in dis.c
+    - Added #ifndef PXI around some Windows setPriority calls
+    - dis_stop_serving() did not completely clean-up DIM so that another dis_start_serving()
+      could be done properly after for example a "fork()". Fixed.
+
+
+20/09/2010
+Changes for version 19.12:
+    - Fixed a bug added when removing warnings in v19r10 (dis.c and dns.c).
+
+
+07/06/2010
+Changes for version 19.11:
+    - Added some protections in update_service() in order to try to solve a DIP issue.
+      (related to very frequent updates of the same service in different threads) 
+    - Added the possibility of defining timeouts for:
+	- DimBrowser::getServices 
+	- DimBrowser::getServers 
+	- DimBrowser::getServerServices 
+	- DimBrowser::getServerClients
+    - Added the possibility of retrieving the time a command arrived:
+	- int dis_get_timestamp(int service_id, int *secs, int *millisecs) in C
+	- int DimCommand::getTimestamp() and int DimCommand::getTimestampMillisecs() in C++
+    - Added a "const" keyword to the "char *format" parameter in the constructors of
+	- DimService and DimCommand
+    - Added a call DimCommand::hasNext(), can be used when commands are queued.
+    - Fixed a memory leak when using DimService::setData and then dynamically deleting the
+      DimService 
+
+
+17/02/2010
+Changes for version 19.10:
+    - Fixed a bug in the DNS related to the latest change (browsing for a single service name)
+      The DNS could crash when killing a server.
+    - Removed some compilation warnings 
+
+
+04/01/2010
+Changes for version 19.09:
+    - Created two new functions: dis_set_debug_on() and dis_set_debug_off(), these
+      enable or disable printing a message per service update
+    - Tried to protect against:
+	- a service being deleted from the server while it is being updated
+        - a client unsubscribing from a service while it is being updated.
+    - Optimized the DNS when browsing for a service search pattern without wildcards
+      (i.e. browsing for a single service name) 
+
+
+13/11/2009
+Changes for version 19.08:
+    - Since version v18r4 where dim_wait() was modified, dim_wait could hang in windows if
+      the wake_up event was triggered before dim_wait was called. Could affect smi++.
+      Fixed.
+    - Fixed a compilation bug in dis.c that affected some platforms.
+
+
+30/10/2009
+Changes for version 19.07:
+    - Some more bugs related to being able to publish to more that one DNS fixed.
+
+
+28/10/2009
+Changes for version 19.06:
+    - When opening DNS connections, when the DNS is not there, from a process that is at the 
+      same time a client and a server only one pending connection was used now two separate 
+      ones are created.
+    - Tried to fix a few more problems related to dis_stop_serving...
+
+
+26/10/2009
+Changes for version 19.05:
+    - dis_stop_serving had stopped working in version 19.4. So all servers that undeclared
+      all services and then tried to re-declare new ones would fail (corrupted server name).
+      Affected in particular the DimBridge
+
+
+27/08/2009
+Changes for version 19.04:
+    - Added the following functions:
+	Server part:
+		C - dis_get_n_clients(int service_id)
+		C++ - int DimService::getNClients()
+	Client part (C++ only):
+		DimClient::setNoDataCopy()
+		This will prevent any data copy in the client and the user should make 
+                sure that the data received from DIM is not used outside the callback
+                in order to benefir from this feature.
+    - Fixed the Java DIM Jar file, it was wrong in the previous version.
+
+
+31/07/2009
+Changes for version 19.03:
+    - Removed some more compilation warnings.
+    - Fixed a bug in the DNS. The mechanism for retrieving the "SERVER_LIST" when 
+      some server names were longer that 35 characters was very slow.
+
+
+06/07/2009
+Changes for version 19.02:
+    - Fixed a bug in the server part handling of RPCs, it created a memory leak.
+      It was using a separate thread to handle timeouts and there is no safe way to 
+      kill a thread from outside. Fixed.
+    	- the function dim_stop_thread() is now obsolete.
+    - Added the possibility to change the send and receive buffer sizes:
+	- int dim_set_write_buffer_size(int size)
+	- int dim_get_write_buffer_size()
+	- int dim_set_read_buffer_size(int size)
+	- int dim_get_read_buffer_size()
+      The default (and minimum) is 16384 bytes.
+      These calls should be done before any other DIM calls.
+    - Fixed a bug in the Java DimBrowser class (the format was not returned correctly)
+
+04/05/2009
+Changes for version 19.01:
+    - A server can now publish to more than one DNS.
+      To use an extra DNS:
+	- in "C":
+		long dnsid;
+		char extra_dns[128];
+		...
+		dim_get_env_var("EXTRA_DNS_NODE", extra_dns, sizeof(extra_dns));
+		dnsid = dis_add_dns(extra_dns,0);
+		sprintf(name1,"NewService%d",i);
+		dis_add_service_dns(dnsid, name1, "I", &NewData, sizeof(NewData), 
+					(void *)0, 0 );
+		dis_start_serving_dns(dnsid, "xx_new");
+
+	- in C++:
+		DimServerDns *newDns;
+		char *extraDns = 0;
+		DimService *new_servint;
+		...
+		extraDns = DimUtil::getEnvVar("EXTRA_DNS_NODE");
+		if(extraDns)
+			newDns = new DimServerDns(extraDns, 0, "new_TEST");
+		...
+		if(extraDns)
+			new_servint = new DimService(newDns, "new_TEST/INTVAL",ival);
+
+    - Removed all warnings from DIM sources so that it can be compiled with -Wall -Wextra on Linux
+    - Changed the makefiles so that the default on Linux is now 64 bits.
+	- The flag 32BITS=yes can be added in order to generate 32 bit code
+
+
+26/02/2009
+Changes for version 18.05:
+    - Made the callback for "DIS_DNS/SERVER_LIST" uninterruptible, so that two clients subscribing
+      would not get mixed up answers.
+    - The same for "<server>/SERVICE_LIST"
+    - Tryied to fix a DNS crash, introduced in v18r4 by releasing the connection when "informing clients".
+    - removed some "//" comments in "C"
+
+
+20/02/2009
+Changes for version 18.04:
+    - Changed the dim_wait() mechanism, so that it works for several threads in parallel:
+	- On Linux it was based on POSIX semaphores now it is based on POSIX "condition 
+          variables"
+	- On Windows it was based on "Auto Reset Events" now it uses "Manual Resel "Events"
+    - The DNS should now correctly update the "DIS_DNS/SERVER_LIST" service. It used to report
+      a new server, even when the services already existed and the server was killed by the DNS.
+      (And never report it killed). It also didn't report correctly when a server went out of "ERROR"
+      (this is reported as a "+" as for a new server). 
+
+
+05/02/2009
+Changes for version 18.03:
+    - The list of registered services in a server could get corrupted in some rare cases
+      making the server crash - fixed.
+    - If the DNS couldn't talk to a client it could sometimes hang - fixed.
+    - Java client modifications:
+	- DimUpdatedInfo was not working correctly - fixed in dim_jni.c.
+	- Implemented DimRpcInfo
+	- Changed the DimBroser class to use DimRpcInfo.
+	- Added a jdim.jar file in the jdim/classes directory of the DIM distribution 
+
+
+15/01/2009
+Changes for version 18.02:
+    - Added the following functions:
+	- C++ Client
+		- int DimClient.getServerPid()
+	- Java Client
+		- int DimClient.getServerPid()
+		- String[] DimBrowser.getServers()
+		- String DimBrowser.getServerNode(String server)
+		- int DimBrowser.getServerPid(String server)
+
+
+09/01/2009
+Changes for version 18.01:
+    - Added in the distribution the Visual Studio 8 dlls and manifest. Otherwise
+      it would not work on most PCs.
+
+
+03/12/2008
+Changes for version 18.00:
+    - The Windows execulables and libraries are now built using Visual Studio 8
+    - Some changes added by GSI mainly in the Java Native Interface
+
+
+06/11/2008
+Changes for version 17.12:
+    - Client functionality:
+    	- Added a new function dic_stop(), to close anything related to DIM 
+          for a client
+    	- Added the function dic_get_server_pid(). Similar to dic_get_server(). 
+          Can be executed in a callback to retrieve the pid of the current server
+    - DimBrowser Class:
+        - DimBrowser::getServices() used to create and destroy the DimRpc connection
+          to the Dns every time it was called. This was heavy if called in a loop.
+          Now the connection is maintained until the DimBrowser itself is destroyed.
+	- A new method DimBrowser::getNextServer(char *&server, char *&node, int *pid)
+          has been created. similar to the previous one but returns also the server pid.
+    - DNS
+	- The DNS was still doing some blocking write calls to servers or clients.
+          Now all write calls have a timeout and can not block forever.
+    - Linux DID
+	- The "Subscribe" button was subscribing to services with update rate of 10 seconds.
+	  This was misleading, the users could think the server was calling update_service
+          when it wasn't.
+          Now there are two Subscribe buttons ("on change" or "Update rate of 10 seconds").
+    - DimDridge
+	- Accepts an extra flag "-copy" which provokes an internal copy of the data.
+
+
+08/09/2008
+Changes for version 17.11:
+    - Some DIM Processes, servers or clients could enter a loop taking 100 % CPU 
+      time in some rare occasions, fixed.
+    - Added some protections when removing services in the DimBridge.
+
+
+30/08/2008
+Changes for version 17.10:
+    - Some DIM Processes, servers or clients would not reconnect when the DNS was
+      restarted. Fixed two cause:
+	- Some processes in Linux were stuck reading from the DNS socket
+	- Some others "forgot" to set a timer under very special conditions
+    - Changed some of the DNS debug messages to be more explicit.
+
+
+21/07/2008
+Changes for version 17.09:
+    - DIM error messages were not being flushed when the output was redirected 
+      to a logfile, fixed.
+
+
+18/07/2008
+Changes for version 17.08:
+    - Sometimes a server or a client could do a read on a sockect that had just
+      been closed which left them hanging forever - fixed.
+
+
+01/07/2008
+Changes for version 17.07:
+    - The DimTimer was sometimes not started when the constructor was called
+      with a time argument.
+    - Clients could not connect to more than 1024 servers - fixed.
+      (if the machine allows more than 1024 connections)
+
+
+30/06/2008
+Changes for version 17.06:
+    - Corrected the makefile for Darwin, now the number of accepted connections is 
+      increased to 8192 only for Linux.
+    - Fixed a bug in the DimTimer, it used to accept to be re-started, but then crashed
+      at destruction time if not stopped the same number of times. Now it can not be
+      re-started.
+    - The Dns used to ask servers to re-register at regular intervals when they were not 
+      sending their watchdog messages (i.e. they were in "ERROR", red in DID). Now the
+      DNS only asks once (unless they answer). This could cause the DNS to hang if
+      servers were in ERROR for a long time.
+    - The Dns now accepts a command line parameter: -d to print debug messages.
+    - The clients were not handling properly the case when they could contact the DNS
+      but then they could not contact the server that the DNS gave them (either because
+      of a firewall or because the server run on an inaccessible network). In this case
+      the clients would timeout trying to contact the server for each service and kept
+      asking the DNS the server coordinates over and over again. Now the clients keep
+      a list on unreacheable servers, so they don't try to contact the server for each 
+      service and only ask the DNS again with an increasing interval that goes from 10 
+      seconds to 2 minutes maximum.
+    - The server now issues an error message if the format string is too long.
+    - Linux DID
+        - Removed the command "Kill ALL Servers", it was too dangerous
+	- Now the list of nodes in "View Servers by Node" is in alphabetical order and
+	  in lowercase.
+
+
+30/04/2008
+Changes for version 17.05:
+    - In Linux in some cases a SIGPIPE was generated. Normally the DIM library sets
+      the behaviour of SIGPIPE to ignored, but if another library or main program
+      changes the SIGPIPE behaviour, then the application could exit when the SIGPIPE
+      was generated. Fixed - on Linux now the function send with flag MSG_NOSIGNAL
+      is used in oder to avoid generating SIGPIPE.
+
+
+
+4/04/2008
+Changes for version 17.04:
+    - Sometimes processes (servers or clients) would hang when the DNS was restarted.
+      This was due to a strange (Windows?) feature, by which a connect could succeed
+      after a connection was closed (and reported) on the other side. Fixed.
+
+
+
+27/03/2008
+Changes for version 17.03:
+    - Can now make DID for 64 bits by making DIM using:
+	gmake X64=yes all
+    - Increased the size of the Hash tables for the servers and the DNS.
+
+
+
+20/02/2008
+Changes for version 17.02:
+    - Fixed the Java DimTimer - stop() didn't work
+      Required changing dim_jni.c as well as the java part
+    - Fixed DIM for Darwin - had stopped working
+
+
+
+20/01/2008
+Changes for version 17.01:
+    - The Java API now works on 64 bit machines, Thanks to Joern Adamczewski.
+      Please use:
+	gmake JDIM=yes all
+    - Linux executables are now compiled/linked on slc4 (32 bits).
+    - Big changes in the DimRpcs both client and server part. Tere were bugs
+      related to the handling of timeouts.
+      Unfortunatelly all applications using RPCs need to be re-linked.
+
+
+
+-----------------------------------------------------------------------------------------
+Previous version history:
+
+07/12/2007
+Changes for version 16.14:
+    - Now by default All DIM processes are ready to accept up to 8192 connections, both
+      in Linux and Windows. Although in Linux for this to be effective the machine system 
+      limits must allow more than 1024 descriptors/open files per process.
+    - Fixed a little memory leak in tokenstring.cxx
+    - And a little compilation bug for some platforms in tcpip.c 
+
+
+15/05/2007
+Changes for version 16.13:
+    - If DIM_HOST_NODE is defined when starting up a server, a DIM client will now try 
+      two network interfaces in order to talk to that server and only give up if they both 
+      fail. First it will try the ip name or ip address specified by the server using 
+      DIM_HOST_NODE, if that fails it will try the ip address of the default interface
+      retrieved by the server using gethostname (and gethostbyname).
+      The changes basically affect the case in which the DIM_HOST_NODE given to the servers
+      is specified as IP address instad of an IP name. Otherwise this mechanism was already 
+      working.
+
+
+3/05/2007
+Changes for version 16.12:
+    - The Java version did not exit properly when main() terminated - fixed.
+
+
+25/04/2007
+Changes for version 16.11:
+    - On Linux the timeout to detect a lost connections (unplugged ethernet cable
+      or machine reboot) was too long, around 15 minutes - Fixed.
+      On Linux the KEEPALIVE feature is now used instead of a regular socket write,
+      all other platforms should work as before.
+
+
+21/02/2007
+Changes for version 16.10:
+    - Found a bug in dis_stop_serving: one socket connection was not closed - fixed.
+    - Implemented a new environment variable for the DNS: DIM_DNS_ACCEPTED_NODES
+      Can receive a list on nodes or domains separated by commas.
+      If the DNS receives a connection from a node not in this list, it will
+      reject it and kill the server or client requesting it.
+    - Fixed some C++ warnings.
+
+
+19/01/2007
+Changes for version 16.9:
+    - The modifications done in version 16.8 have introduced a bug:
+	- DIM servers would not behave properly (exit) when receiving a kill command
+          from the DNS (for duplicated services, not allowed host names or manual "kill")
+	  This is now fixed.
+
+
+30/10/2006
+Changes for version 16.8:
+    - Modified dis_stop_serving() and DimServer::stop() to completely stop DIM:
+	- Stop also the DIM threads.
+	- Release all allocated memory
+	- Allow a different port number when re-starting.
+
+
+11/07/2006
+Changes for version 16.7:
+    - Prepared for increasing the number of open connections per process
+      (On Linux still requires changing some parameters and recompiling the Dns)
+    - Fixed one error and several warnings for gcc 4.
+
+
+11/05/2006
+Changes for version 16.6:
+    - Sometimes a server or client would crash while exiting if the DNS was not running.
+      Fixed.
+    - Fixed the reporting of some ERROR messages on Windows (used to report error "0")
+    - Allowed dim_send_command to receive instead of -dns <node_name>
+	-dns <node_name>[:<port_number>]
+
+
+01/05/2006
+Changes for version 16.5:
+    - Big Spring Cleanup. Removed most warnings. Can now be compiled on
+      Windows with Warning Level 3 and on Linux with -Wall
+      (still not working for -ansi -pedantic...)
+    - When trying to access a server in a different network (i.e. not reacheable)
+      a client (for example DID) would take very very long to timeout - fixed.
+    - Added two new sets of functions that allow setting the DIM_DNS_NODE separately
+      for a server and a client in the same process:
+	- int dis_set_dns_node(char *node)
+	- int dis_get_dns_node(char *node)
+	- int dis_set_dns_port(int port)
+	- int dis_get_dns_port()
+
+	- int dic_set_dns_node(char *node)
+	- int dic_get_dns_node(char *node)
+	- int dic_set_dns_port(int port)
+	- int dic_get_dns_port()
+      These routines should be used instead of the equivalent ones starting with "dim_"
+      since these set the same DIM_DNS_NODE/port for both Server and client parts of a 
+      process.
+    - Adapted the C++ equivalents (DimClient::setDnsNode, etc. and DimServer::setDnsNode, 
+      etc.) to use the new routines, so they are now independent.
+      Adapted also the Java equivalents.
+    - Fixed DimBridge to use the new routines.
+    - Fixed a bug in DID that made it crash sometimes at startup (and also when the DNS 
+      restarted)!
+    - Found some very interesting features of DIM:
+        - In a node with two ethernet interfaces (so connected to two networks):
+	    - The DNS will answer to servers and client on both networks, only its server
+              part - DIS_DNS (the one that answers to DID and DimBrowser requests) would
+              in principle answer only to one of the networks (in principle the default
+              interface* but can be changed by setting the environment variable "DIM_HOST_NODE").    
+	    - But, in fact, if the DNS or any server is started with the environment variable 
+              DIM_HOST_NODE set to the interface that is not the default* one. Than both the 
+              DNS (including the server part) and the DIM servers will be accessible from both 
+              networks. For example DID will work fine on both networks.
+            * The command "hostname" will return the name of the default network interface.   
+
+    Note: As a result of inserting new functions the DIM shared library entry points have
+          changed, so all DIM Servers/Clients should be relinked (in particular in Linux).
+
+
+20/04/2006
+Changes for version 16.4:
+    - Optimized the DNS for providing the list or running servers dynamically
+      by subscribing to the service "DIS_DNS/SERVER_LIST"
+
+
+07/04/2006
+Changes for version 16.3:
+    - Upgraded to work on LynxOS Version 4. 
+      - Updated makefile for INTEL platform
+      - Updated some ifdefs based on the existence of __Lynx__
+
+
+10/03/2006
+Changes for version 16.2:
+    - Increased the listen queue. To avoid "Connection Refused" messages from servers
+      or from the DNS.
+
+
+28/02/2006
+Changes for version 16.1:
+    - Fixed the NO_THREADS option for LINUX, it had stopped working.
+    - DimInfo::getData() could return an invalid pointer if called before connecting
+      to the server (or discovering the server did not exist). Fixed 
+      (it now returns 0 in this case).
+
+
+09/11/2005
+Changes for version 16.0:
+    - Consolidated the new timer handling mechanism, should be much more precise.
+    - Fixed the RPC handling. Used to be based on timming assumptions.
+      Now uses a safe protocol to make sure the server is connected before sending 
+      an RPC request.
+    - Included in the distribution some performance measurements and a benchmark 
+      server and client. Sources in src/benchmark executables in /bin for windows
+      and /linux for linux.
+      Usage:
+	benchServer <message_size_in_bytes> <number_of_services>
+	benchClient
+      benchClient will run for a while and print the measurement results. 
+
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
Index: /trunk/FACT++/dim_v19r15/README_v9.txt
===================================================================
--- /trunk/FACT++/dim_v19r15/README_v9.txt	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/README_v9.txt	(revision 10183)
@@ -0,0 +1,112 @@
+
+                    DIM version 9.8 Release Notes
+
+Notes 1 and 2 for Unix Users only
+NOTE 1: In order to "make" DIM two environment variables should be set:
+	OS = one of {HP-UX, AIX, OSF1, Solaris, SunOS, LynxOS, Linux}
+	DIMDIR = the path name of DIM's top level directory
+	The user should then go to DIM's top level directory and do:
+	> source .setup
+	> gmake all
+	Or, if there is no support for C++ on the machine:
+	> gmake CPP=no all
+
+NOTE 2: The Name Server (Dns), DID, servers and clients (if running in 
+	background) should be started whith the output redirected to a 
+	logfile ex:
+		Dns </dev/null >& dns.log &
+
+NOTE 3: The Version Number service provided by servers is now set to 908
+	(version 9.8).
+  
+Changes for version 9.0:
+
+   In order to increase the compatibility between Windows and Linux and
+   to respect CVS rules the following modifications have been done:
+
+      - C++ files have been renamed from .cc to .cxx and include files from
+	.hh to .hxx
+
+      - Include files are in "./dim" directory
+        (Source files are now in the "./src" directory)
+
+      - Windows executables and libraries are in "./bin"
+      - Linux executables and libraries are "./linux"
+
+      - Windows developper studio setting are in "./Visual"
+      - Linux Makefiles are in the top directory
+
+Changes for version 9.1:
+
+    Fixed some "Harp" problems:
+      - Fixed a bug causing a loop in the timer handling 
+      - Optimized dns connection handling for many services
+      - Fixed a re-connection bug for clients 
+      
+Changes for version 9.2:
+
+      - Created the static methods:
+		DimServer::autoStartOff();
+		DimServer::autoStartOn();
+	Which prevents/allows DimServices to be declared to the Name Server as
+	soon as they are created. if "autoStart" is set Off the user has to call
+	DimServer::start(char *serverName) when all services have been declared.
+	By default autoStart is On
+
+Changes for version 9.3:
+
+      - Created a new Utility: DimBridge - It forwards DIM Services (and Commands)
+	from one Name Server to another (to bypass firewalls)
+      - Fixed a bug in tcpip.c - which prevents a DIM Server to send test messages to
+	himself (related to the above utility).
+
+Changes for version 9.4:
+
+      - Merged DID and XDID (DID should now work on all UNIX flavours)
+      - Allow users to select the ethernet interface (or to specify a complete 
+        ipname, with the domain, when not available by default):
+		setenv DIM_HOST_NODE <ipname>
+	Before starting up a DIM server 
+ 
+Changes for version 9.5:
+
+      - Added an environment variable DIM_DNS_PORT allowing users to specify a
+	different port number (default is 2505) for the DNS. This allows 
+	starting more than one DIM Name Servers (DNSs) on the same machine.
+      - Accomodated for a Solaris "feature": ioctl FIONREAD which should 
+        return the number of bytes waiting to be read on a socket sometimes 
+	returns '0' when there are bytes to read. This provoked undesired 
+        "disconnections" in BaBar.
+      - Fixed a bug related to the padding of structures (characters following
+        an odd number of shorts)
+      - Fixed a bug in the retry mechanism when writting to a full socket. The
+        problem appeared when the connection was killed while retrying.
+      - Did (Unix/Linux version) now allows sending formatted commands (i.e. 
+        structures) to a server. Also services are now visualised in a 
+	formatted manner.
+
+Changes for version 9.6:
+      - Fixed DID: it crashed when a server name was very big (Motif) and
+        it didn't remove servers that died while being in error (red).
+      - Fixed a bug in the client library: sometimes services where requested
+	from the name server more than once unnecessarily.
+      - Fixed a bug in the server library: Sometimes the server crashed if it 
+	was updating a service when the client was killed or died.
+
+Changes for version 9.7
+      - Fixed a bug introduced in version 9.6 (related to the last point).
+        Sometimes servers would leave some connections open and started using
+        all the CPU (involves dis.c and tcpip.c).
+      - Upgraded DID to support very long server names.
+
+Changes for version 9.8
+      - Fixed a bug in DID: it crashed when a service name to be viewed was
+        typed in by hand
+      - Fixed a bug in dis.c: Servers would not register their services with 
+        the DNS if the number of services was a multiple of 100.
+ 
+Please check the Manual for more information at:
+    http://www.cern.ch/dim
+
+
+
Index: /trunk/FACT++/dim_v19r15/dim/dic.h
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dic.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dic.h	(revision 10183)
@@ -0,0 +1,64 @@
+#ifndef __DICDEFS
+#define __DICDEFS
+
+#include "dim_common.h"
+
+/* part for CFORTRAN */
+
+#define dic_info_service dic_info_service_
+#define dic_info_service_stamped dic_info_service_stamped_
+#define dic_cmnd_service dic_cmnd_service_
+#define dic_cmnd_callback dic_cmnd_callback_
+#define dic_cmnd_service_stamped dic_cmnd_service_stamped_
+#define dic_cmnd_callback_stamped dic_cmnd_callback_stamped_
+#define dic_change_address dic_change_address_
+#define dic_release_service dic_release_service_
+#define dic_find_service dic_find_service_
+#define dic_get_id dic_get_id_
+#define dic_get_quality dic_get_quality_
+#define dic_get_timestamp dic_get_timestamp_
+#define dic_get_format dic_get_format_
+
+/* Routine definition */
+
+_DIM_PROTOE( unsigned dic_info_service, (char *service_name, int req_type,
+				    int req_timeout, void *service_address,
+				    int service_size, void (*usr_routine)(void*, void*, int*),
+				    long tag, void *fill_addr, int fill_size) );
+_DIM_PROTOE( unsigned dic_info_service_stamped, (char *service_name, int req_type,
+				    int req_timeout, void *service_address,
+				    int service_size, void (*usr_routine)(void*, void*, int*),
+				    long tag, void *fill_addr, int fill_size) );
+_DIM_PROTOE( int dic_cmnd_callback,      (char *service_name, void *service_address,
+				    int service_size, void (*usr_routine)(void*, int*),
+				    long tag) );
+_DIM_PROTOE( int dic_cmnd_service,      (char *service_name, void *service_address,
+				    int service_size) );
+_DIM_PROTOE( void dic_change_address,  (unsigned service_id, void *service_address,
+				    int service_size) );
+_DIM_PROTOE( void dic_release_service,  (unsigned service_id) );
+_DIM_PROTOE( int dic_find_service,      (char *service_name) );
+_DIM_PROTOE( int dic_get_id,      		(char *name) );
+_DIM_PROTOE( int dic_get_quality,  		(unsigned service_id) );
+_DIM_PROTOE( int dic_get_timestamp,  (unsigned service_id, int *secs, int *milisecs) );
+_DIM_PROTOE( char *dic_get_format,      		(unsigned service_id) );
+_DIM_PROTOE( void dic_disable_padding,      		() );
+_DIM_PROTOE( void dic_close_dns,      		() );
+_DIM_PROTOE( void dic_add_error_handler,(void (*usr_routine)(int, int, char*)) );
+_DIM_PROTOE( char *dic_get_error_services,	() );
+_DIM_PROTOE( char *dic_get_server_services,	(int conn_id) );
+_DIM_PROTOE( int dic_get_server,       (char *name ) );
+_DIM_PROTOE( int dic_get_conn_id,      () );
+_DIM_PROTOE( void dic_stop,      () );
+_DIM_PROTOE( int dic_get_server_pid,       (int *pid ) );
+
+#endif
+
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/dim/dic.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dic.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dic.hxx	(revision 10183)
@@ -0,0 +1,497 @@
+#ifndef __DICHHDEFS
+#define __DICHHDEFS
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#ifdef __VMS
+#include <starlet.h>
+#endif
+#include "dim_core.hxx"
+#include "dim.hxx"
+#include "tokenstring.hxx"
+
+enum DimServiceType {DimSERVICE=1, DimCOMMAND, DimRPC};
+
+class DimClient;
+class DimInfo;
+class DimCurrentInfo;
+class DimRpcInfo;
+
+class DllExp DimInfoHandler{
+public:
+	DimInfo *itsService;
+    DimInfo *getInfo() { return itsService; }; 
+	virtual void infoHandler() = 0;
+	virtual ~DimInfoHandler() {};
+};
+
+class DllExp DimInfo : public DimInfoHandler, public DimTimer{
+
+public :
+	DimInfoHandler *itsHandler;
+
+	DimInfo(){};
+	DimInfo(const char *name, int nolink) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(int), 0); };
+	DimInfo(const char *name, int time, int nolink) 
+		{ subscribe((char *)name, time, &nolink, sizeof(int), 0); };
+	DimInfo(const char *name, float nolink) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(float), 0); };
+	DimInfo(const char *name, int time, float nolink) 
+		{ subscribe((char *)name, time, &nolink, sizeof(float), 0); };
+	DimInfo(const char *name, double nolink) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(double), 0); };
+	DimInfo(const char *name, int time, double nolink) 
+		{ subscribe((char *)name, time, &nolink, sizeof(double), 0); };
+	DimInfo(const char *name, longlong nolink) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(longlong), 0); };
+	DimInfo(const char *name, int time, longlong nolink) 
+		{ subscribe((char *)name, time, &nolink, sizeof(longlong), 0); };
+	DimInfo(const char *name, short nolink) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(short), 0); };
+	DimInfo(const char *name, int time, short nolink) 
+		{ subscribe((char *)name, time, &nolink, sizeof(short), 0); };
+	DimInfo(const char *name, char *nolink) 
+		{ subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };
+	DimInfo(const char *name, int time, char *nolink) 
+		{ subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };
+	DimInfo(const char *name, void *nolink, int nolinksize) 
+		{ subscribe((char *)name, 0, nolink, nolinksize, 0); };
+	DimInfo(const char *name, int time, void *nolink, int nolinksize) 
+		{ subscribe((char *)name, time, nolink, nolinksize, 0); };
+
+	DimInfo(const char *name, int nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(int), handler); };
+	DimInfo(const char *name, int time, int nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, &nolink, sizeof(int), handler); };
+	DimInfo(const char *name, float nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(float), handler); };
+	DimInfo(const char *name, int time, float nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, &nolink, sizeof(float), handler); };
+	DimInfo(const char *name, double nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(double), handler); };
+	DimInfo(const char *name, int time, double nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, &nolink, sizeof(double), handler); };
+	DimInfo(const char *name, longlong nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(longlong), handler); };
+	DimInfo(const char *name, int time, longlong nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, &nolink, sizeof(longlong), handler); };
+	DimInfo(const char *name, short nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, &nolink, sizeof(short), handler); };
+	DimInfo(const char *name, int time, short nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, &nolink, sizeof(short), handler); };
+	DimInfo(const char *name, char *nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };
+	DimInfo(const char *name, int time, char *nolink, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };
+	DimInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler) 
+		{ subscribe((char *)name, 0, nolink, nolinksize, handler); };
+	DimInfo(const char *name, int time, void *nolink, int nolinksize, DimInfoHandler *handler) 
+		{ subscribe((char *)name, time, nolink, nolinksize, handler); };
+
+	virtual ~DimInfo();
+	void *itsData;
+	int itsDataSize;
+	int itsSize;
+	int getSize() {return itsSize; };
+	char *getName()  { return itsName; } ;
+	void *getData();
+	int getInt() { return *(int *)getData(); } ;
+	float getFloat() { return *(float *)getData(); } ;
+	double getDouble() { return *(double *)getData(); } ;
+	longlong getLonglong() { return *(longlong *)getData(); } ;
+	short getShort() { return *(short *)getData(); } ;
+	char *getString()  { return (char *)getData(); } ;
+
+	virtual void infoHandler();
+	void timerHandler();
+	virtual void subscribe(char *name, int time, void *nolink, int nolinksize,
+		DimInfoHandler *handler);
+	virtual void doIt();
+	int getQuality();
+	int getTimestamp();
+	int getTimestampMillisecs();
+	char *getFormat();
+
+protected :
+	char *itsName;
+	int itsId;
+	int itsTime;
+	int itsType;
+	int itsTagId;
+	char *itsFormat;
+	void *itsNolinkBuf;
+	int itsNolinkSize;
+	int secs, millisecs;
+};
+
+class DllExp DimStampedInfo : public DimInfo{
+
+public :
+	DimStampedInfo(){};
+	DimStampedInfo(const char *name, int nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(int), 0); };
+	DimStampedInfo(const char *name, int time, int nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(int), 0); };
+	DimStampedInfo(const char *name, float nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(float), 0); };
+	DimStampedInfo(const char *name, int time, float nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(float), 0); };
+	DimStampedInfo(const char *name, double nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(double), 0); };
+	DimStampedInfo(const char *name, int time, double nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(double), 0); };
+	DimStampedInfo(const char *name, longlong nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(longlong), 0); };
+	DimStampedInfo(const char *name, int time, longlong nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(longlong), 0); };
+	DimStampedInfo(const char *name, short nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(short), 0); };
+	DimStampedInfo(const char *name, int time, short nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(short), 0); };
+	DimStampedInfo(const char *name, char *nolink) 
+	{ subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };
+	DimStampedInfo(const char *name, int time, char *nolink) 
+	{ subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };
+	DimStampedInfo(const char *name, void *nolink, int nolinksize) 
+	{ subscribe((char *)name, 0, nolink, nolinksize, 0); };
+	DimStampedInfo(const char *name, int time, void *nolink, int nolinksize) 
+	{ subscribe((char *)name, time, nolink, nolinksize, 0); };
+
+	DimStampedInfo(const char *name, int nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(int), handler); };
+	DimStampedInfo(const char *name, int time, int nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(int), handler); };
+	DimStampedInfo(const char *name, float nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(float), handler); };
+	DimStampedInfo(const char *name, int time, float nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(float), handler); };
+	DimStampedInfo(const char *name, double nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(double), handler); };
+	DimStampedInfo(const char *name, int time, double nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(double), handler); };
+	DimStampedInfo(const char *name, longlong nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(longlong), handler); };
+	DimStampedInfo(const char *name, int time, longlong nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(longlong), handler); };
+	DimStampedInfo(const char *name, short nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(short), handler); };
+	DimStampedInfo(const char *name, int time, short nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(short), handler); };
+		DimStampedInfo(const char *name, char *nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };
+	DimStampedInfo(const char *name, int time, char *nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };
+	DimStampedInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, nolink, nolinksize, handler); };
+	DimStampedInfo(const char *name, int time, void *nolink, int nolinksize, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, nolink, nolinksize, handler); };
+
+	virtual ~DimStampedInfo();
+private :
+	void doIt();
+	void subscribe(char *name, int time, void *nolink, int nolinksize,
+		DimInfoHandler *handler);
+};
+
+class DllExp DimUpdatedInfo : public DimInfo{
+
+public :
+	DimUpdatedInfo(){};
+	DimUpdatedInfo(const char *name, int nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(int), 0); };
+	DimUpdatedInfo(const char *name, int time, int nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(int), 0); };
+	DimUpdatedInfo(const char *name, float nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(float), 0); };
+	DimUpdatedInfo(const char *name, int time, float nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(float), 0); };
+	DimUpdatedInfo(const char *name, double nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(double), 0); };
+	DimUpdatedInfo(const char *name, int time, double nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(double), 0); };
+	DimUpdatedInfo(const char *name, longlong nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(longlong), 0); };
+	DimUpdatedInfo(const char *name, int time, longlong nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(longlong), 0); };
+	DimUpdatedInfo(const char *name, short nolink) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(short), 0); };
+	DimUpdatedInfo(const char *name, int time, short nolink) 
+	{ subscribe((char *)name, time, &nolink, sizeof(short), 0); };
+	DimUpdatedInfo(const char *name, char *nolink) 
+	{ subscribe((char *)name, 0, nolink, strlen(nolink)+1, 0); };
+	DimUpdatedInfo(const char *name, int time, char *nolink) 
+	{ subscribe((char *)name, time, nolink, strlen(nolink)+1, 0); };
+	DimUpdatedInfo(const char *name, void *nolink, int nolinksize) 
+	{ subscribe((char *)name, 0, nolink, nolinksize, 0); };
+	DimUpdatedInfo(const char *name, int time, void *nolink, int nolinksize) 
+	{ subscribe((char *)name, time, nolink, nolinksize, 0); };
+
+	DimUpdatedInfo(const char *name, int nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(int), handler); };
+	DimUpdatedInfo(const char *name, int time, int nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(int), handler); };
+	DimUpdatedInfo(const char *name, float nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(float), handler); };
+	DimUpdatedInfo(const char *name, int time, float nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(float), handler); };
+	DimUpdatedInfo(const char *name, double nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(double), handler); };
+	DimUpdatedInfo(const char *name, int time, double nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(double), handler); };
+	DimUpdatedInfo(const char *name, longlong nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(longlong), handler); };
+	DimUpdatedInfo(const char *name, int time, longlong nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(longlong), handler); };
+	DimUpdatedInfo(const char *name, short nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, &nolink, sizeof(short), handler); };
+	DimUpdatedInfo(const char *name, int time, short nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, &nolink, sizeof(short), handler); };
+	DimUpdatedInfo(const char *name, char *nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, nolink, strlen(nolink)+1, handler); };
+	DimUpdatedInfo(const char *name, int time, char *nolink, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, nolink, strlen(nolink)+1, handler); };
+	DimUpdatedInfo(const char *name, void *nolink, int nolinksize, DimInfoHandler *handler) 
+	{ subscribe((char *)name, 0, nolink, nolinksize, handler); };
+	DimUpdatedInfo(const char *name, int time, void *nolink, int nolinksize, DimInfoHandler *handler) 
+	{ subscribe((char *)name, time, nolink, nolinksize, handler); };
+
+	virtual ~DimUpdatedInfo();
+private :
+	void doIt();
+	void subscribe(char *name, int time, void *nolink, int nolinksize,
+		DimInfoHandler *handler);
+};
+
+class DllExp DimCmnd {
+public :
+
+	int wakeUp;
+	int result;
+	int send(char *name, void *data, int datasize);
+	void sendNB(char *name, void *data, int datasize);
+  DimCmnd(){};
+};
+
+class DllExp DimCurrentInfo {
+
+public :
+	void *itsData;
+	int itsDataSize;
+	int itsSize;
+	int itsTagId;
+	int wakeUp;
+
+	DimCurrentInfo(const char *name, int nolink) { 
+		subscribe((char *)name, 0, &nolink, sizeof(int)); };
+	DimCurrentInfo(const char *name, float nolink) { 
+		subscribe((char *)name, 0, &nolink, sizeof(float)); };
+	DimCurrentInfo(const char *name, double nolink) { 
+		subscribe((char *)name, 0, &nolink, sizeof(double)); };
+	DimCurrentInfo(const char *name, longlong nolink) { 
+		subscribe((char *)name, 0, &nolink, sizeof(longlong)); };
+	DimCurrentInfo(const char *name, short nolink) { 
+		subscribe((char *)name, 0, &nolink, sizeof(short)); };
+	DimCurrentInfo(const char *name, char *nolink) { 
+		subscribe((char *)name, 0, nolink, strlen(nolink)+1); };
+	DimCurrentInfo(const char *name, void *nolink, int nolinksize) { 
+		subscribe((char *)name, 0, nolink, nolinksize); };
+	DimCurrentInfo(const char *name, int time, int nolink) { 
+		subscribe((char *)name, time, &nolink, sizeof(int)); };
+	DimCurrentInfo(const char *name, int time, float nolink) { 
+		subscribe((char *)name, time, &nolink, sizeof(float)); };
+	DimCurrentInfo(const char *name, int time, double nolink) { 
+		subscribe((char *)name, time, &nolink, sizeof(double)); };
+	DimCurrentInfo(const char *name, int time, longlong nolink) { 
+		subscribe((char *)name, time, &nolink, sizeof(longlong)); };
+	DimCurrentInfo(const char *name, int time, short nolink) { 
+		subscribe((char *)name, time, &nolink, sizeof(short)); };
+	DimCurrentInfo(const char *name, int time, char *nolink) { 
+		subscribe((char *)name, time, nolink, strlen(nolink)+1); };
+	DimCurrentInfo(const char *name, int time, void *nolink, int nolinksize) { 
+		subscribe((char *)name, time, nolink, nolinksize); };
+
+
+	virtual ~DimCurrentInfo();
+	char *getName()  { return itsName; } ;
+	void *getData();
+	int getInt() { return *(int *)getData(); } ;
+	float getFloat() { return *(float *)getData(); } ;
+	double getDouble() { return *(double *)getData(); } ;
+	longlong getLonglong() { return *(longlong *)getData(); } ;
+	short getShort() { return *(short *)getData(); } ;
+	char *getString()  { return (char *)getData(); } ;
+	int getSize()  { getData(); return itsSize; } ;
+
+private :
+	char *itsName;
+	void *itsNolinkBuf;
+	int itsNolinkSize;
+	void subscribe(char *name, int time, void *nolink, int nolinksize);
+};
+
+class DllExp DimRpcInfo : public DimTimer {
+public :
+	int itsId;
+	int itsTagId;
+	int itsInit;
+	void *itsData;
+	int itsDataSize;
+	void *itsDataOut;
+	int itsDataOutSize;
+	int itsSize;
+	int wakeUp;
+	int itsWaiting;
+	int itsConnected;
+	void *itsNolinkBuf;
+	int itsNolinkSize;
+	DimRpcInfo *itsHandler;
+
+	DimRpcInfo(const char *name, int nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(int), 0); };
+	DimRpcInfo(const char *name, float nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(float), 0); };
+	DimRpcInfo(const char *name, double nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(double), 0); };
+	DimRpcInfo(const char *name, longlong nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(longlong), 0); };
+	DimRpcInfo(const char *name, short nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(short), 0); };
+	DimRpcInfo(const char *name, char *nolink) { 
+		subscribe((char *)name, 0, 0, nolink, strlen(nolink)+1, 0); };
+	DimRpcInfo(const char *name, void *nolink, int nolinksize) { 
+		subscribe((char *)name, 0, 0, nolink, nolinksize, 0); };
+
+	DimRpcInfo(const char *name, int time, int nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(int), time); };
+	DimRpcInfo(const char *name, int time, float nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(float), time); };
+	DimRpcInfo(const char *name, int time, double nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(double), time); };
+	DimRpcInfo(const char *name, int time, longlong nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(longlong), time); };
+	DimRpcInfo(const char *name, int time, short nolink) { 
+		subscribe((char *)name, 0, 0, &nolink, sizeof(short), time); };
+	DimRpcInfo(const char *name, int time, char *nolink) { 
+		subscribe((char *)name, 0, 0, nolink, strlen(nolink)+1, time); };
+	DimRpcInfo(const char *name, int time, void *nolink, int nolinksize) { 
+		subscribe((char *)name, 0, 0, nolink, nolinksize, time); };
+	
+	virtual void rpcInfoHandler();
+
+	virtual ~DimRpcInfo();
+	int getId() {return itsId;};
+	void keepWaiting() {itsWaiting = 2;};
+	char *getName()  { return itsName; } ;
+	void *getData();
+	int getInt() { return *(int *)getData(); } ;
+	float getFloat() { return *(float *)getData(); } ;
+	double getDouble() { return *(double *)getData(); } ;
+	longlong getLonglong() { return *(longlong *)getData(); } ;
+	short getShort() { return *(short *)getData(); } ;
+	char *getString()  { return (char *)getData(); } ;
+	int getSize()  { getData(); return itsSize; } ;
+
+	void setData(void *data, int size) { doIt(data, size); };
+	void setData(int &data) { doIt(&data, sizeof(int)); } ;
+	void setData(float &data) { doIt(&data, sizeof(float)); } ;
+	void setData(double &data) { doIt(&data, sizeof(double)); } ;
+	void setData(longlong &data) { doIt(&data, sizeof(longlong)); } ;
+	void setData(short &data) { doIt(&data, sizeof(short)); } ;
+	void setData(char *data)  { doIt(data, strlen(data)+1); } ;
+
+private :
+	char *itsName;
+	char *itsNameIn;
+	char *itsNameOut;
+	int itsTimeout;
+	void subscribe(char *name, void *data, int size, 
+		void *nolink, int nolinksize, int timeout);
+	void doIt(void *data, int size);
+	void timerHandler();
+};
+
+class DllExp DimClient : public DimInfoHandler, public DimErrorHandler
+{
+public:
+
+	static char *dimDnsNode;
+	static DimErrorHandler *itsCltError;
+
+	DimClient();
+	virtual ~DimClient();
+	static int sendCommand(const char *name, int data);
+	static int sendCommand(const char *name, float data);
+	static int sendCommand(const char *name, double data);
+	static int sendCommand(const char *name, longlong data);
+	static int sendCommand(const char *name, short data);
+	static int sendCommand(const char *name, const char *data);
+	static int sendCommand(const char *name, void *data, int datasize);
+	static void sendCommandNB(const char *name, int data);
+	static void sendCommandNB(const char *name, float data);
+	static void sendCommandNB(const char *name, double data);
+	static void sendCommandNB(const char *name, longlong data);
+	static void sendCommandNB(const char *name, short data);
+	static void sendCommandNB(const char *name, char *data);
+	static void sendCommandNB(const char *name, void *data, int datasize);
+	static int setExitHandler(const char *serverName);
+	static int killServer(const char *serverName);
+	static int setDnsNode(const char *node);
+	static int setDnsNode(const char *node, int port);
+	static char *getDnsNode();
+	static int getDnsPort();
+	static void addErrorHandler(DimErrorHandler *handler);
+	void addErrorHandler();
+	virtual void errorHandler(int /* severity */, int /* code */, char* /* msg */) {};
+	static char *serverName;
+	// Get Current Server Identifier	
+	static int getServerId();
+	// Get Current Server Process Identifier	
+	static int getServerPid();
+	// Get Current Server Name	
+	static char *getServerName();
+	static char **getServerServices();
+//	static char *getServerServices(int serverId);
+
+	virtual void infoHandler() {};
+
+	static int dicNoCopy;
+	static void setNoDataCopy();
+	static int getNoDataCopy();
+};
+
+class DllExp DimBrowser
+{
+public :
+
+	DimBrowser();
+
+	~DimBrowser();
+
+	int getServices(const char *serviceName);
+	int getServers();
+	int getServerServices(const char *serverName);
+	int getServerClients(const char *serverName);
+	int getServices(const char *serviceName, int timeout);
+	int getServers(int timeout);
+	int getServerServices(const char *serverName, int timeout);
+	int getServerClients(const char *serverName, int timeout);
+	int getNextService(char *&service, char *&format);
+	int getNextServer(char *&server, char *&node);
+	int getNextServer(char *&server, char *&node, int &pid);
+	int getNextServerService(char *&service, char *&format);
+	int getNextServerClient(char *&client, char *&node);
+
+private:
+
+	TokenString *itsData[5];
+	int currIndex; 
+	char *currToken;
+	char none;
+	DimRpcInfo *browserRpc;
+};
+
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dim.h
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dim.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dim.h	(revision 10183)
@@ -0,0 +1,591 @@
+#ifndef __DIMDEFS
+#define __DIMDEFS
+/*
+ * DNA (Delphi Network Access) implements the network layer for the DIM
+ * (Delphi Information Managment) System.
+ *
+ * Started           : 10-11-91
+ * Last modification : 03-08-94
+ * Written by        : C. Gaspar
+ * Adjusted by       : G.C. Ballintijn
+ *
+ */
+
+#include "dim_common.h"
+
+#define DIM_VERSION_NUMBER 1915
+
+#define MY_LITTLE_ENDIAN	0x1
+#define MY_BIG_ENDIAN 		0x2
+
+#define VAX_FLOAT		0x10
+#define IEEE_FLOAT 		0x20
+#define AXP_FLOAT		0x30
+
+#define MY_OS9			0x100
+#define IT_IS_FLOAT		0x1000
+
+#ifdef VMS
+#include <ssdef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <starlet.h>
+#include <time.h>
+#define DIM_NOSHARE noshare
+#define RE_ENABLE_AST   long int ast_enable = sys$setast(1);
+#define RE_DISABLE_AST  if (ast_enable != SS$_WASSET) sys$setast(0);
+#define	vtohl(l)	(l)
+#define	htovl(l)	(l)
+#ifdef __alpha
+#define MY_FORMAT MY_LITTLE_ENDIAN+AXP_FLOAT
+#else
+#define MY_FORMAT MY_LITTLE_ENDIAN+VAX_FLOAT
+#endif
+#endif
+
+#ifdef __unix__
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#ifdef VxWorks
+#include <sigLib.h>
+#endif
+#define DIM_NOSHARE 
+#define RE_ENABLE_AST   sigset_t set, oset;sigemptyset(&set);sigaddset(&set,SIGIO);sigaddset(&set,SIGALRM);sigprocmask(SIG_UNBLOCK,&set,&oset);
+#define RE_DISABLE_AST  sigprocmask(SIG_SETMASK,&oset,0);
+#ifdef MIPSEL
+#define	vtohl(l)	(l)
+#define	htovl(l)	(l)
+#define MY_FORMAT MY_LITTLE_ENDIAN+IEEE_FLOAT
+#endif
+#ifdef MIPSEB
+#define	vtohl(l)	_swapl(l)
+#define	htovl(l)	_swapl(l)
+#define	vtohs(s)	_swaps(s)
+#define	htovs(s)	_swaps(s)
+#define MY_FORMAT MY_BIG_ENDIAN+IEEE_FLOAT
+#endif
+_DIM_PROTO( int _swapl,  (int l) );
+_DIM_PROTO( short _swaps,   (short s) );
+
+#endif
+
+#ifdef WIN32
+#include <windows.h>
+#include <process.h>
+#include <io.h>
+#include <fcntl.h>
+#include <Winsock.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#define DIM_NOSHARE 
+#define RE_ENABLE_AST     
+#define RE_DISABLE_AST    
+#ifdef MIPSEL
+#define	vtohl(l)	(l)
+#define	htovl(l)	(l)
+#define MY_FORMAT MY_LITTLE_ENDIAN+IEEE_FLOAT
+#endif
+#ifdef MIPSEB
+#define	vtohl(l)	_swapl(l)
+#define	htovl(l)	_swapl(l)
+#define	vtohs(s)	_swaps(s)
+#define	htovs(s)	_swaps(s)
+#define MY_FORMAT MY_BIG_ENDIAN+IEEE_FLOAT
+#endif
+_DIM_PROTO( int _swapl,  (int l) );
+_DIM_PROTO( short _swaps,   (short s) );
+#endif
+
+#ifdef OSK
+#include <types.h>
+#ifndef _UCC
+#include <machine/types.h>
+#else
+#define register
+#endif
+#include <inet/in.h>
+#include <time.h>
+#include <stdio.h>
+#include <string.h>
+#define DIM_NOSHARE 
+#define RE_ENABLE_AST      sigmask(DEC_LEVEL);
+#define RE_DISABLE_AST     sigmask(INC_LEVEL);
+#define	vtohl(l)	_swapl(l)
+#define	htovl(l)	_swapl(l)
+#define	vtohs(s)	_swaps(s)
+#define	htovs(s)	_swaps(s)
+#define MY_FORMAT MY_BIG_ENDIAN+IEEE_FLOAT+MY_OS9
+typedef unsigned short	ushort;
+_DIM_PROTO( char *getenv,  (char *name) );
+_DIM_PROTO( void *malloc,  (unsigned size) );
+_DIM_PROTO( void *realloc, (void *ptr, unsigned size) );
+_DIM_PROTO( int _swapl,   (int l) );
+_DIM_PROTO( short _swaps,   (short s) );
+#endif
+
+#define	TRUE	1
+#define	FALSE	0
+
+#define DNS_TASK	"DIM_DNS"
+#define DNS_PORT	2505			/* Name server port          */
+#define SEEK_PORT	0			/* server should seek a port */
+
+#define MIN_BIOCNT	 	50
+#ifdef OSK
+#define DIS_DNS_TMOUT_MIN	5
+#define DIS_DNS_TMOUT_MAX	10
+#define DIC_DNS_TMOUT_MIN	5
+#define DIC_DNS_TMOUT_MAX	10
+#define MAX_SERVICE_UNIT 	32
+#define MAX_REGISTRATION_UNIT 100
+#define CONN_BLOCK		32
+#define MAX_CONNS		32
+#define ID_BLOCK		64
+#define TCP_RCV_BUF_SIZE	4096
+#define TCP_SND_BUF_SIZE	4096
+#else
+#define DIS_DNS_TMOUT_MIN	5
+#define DIS_DNS_TMOUT_MAX	10
+#define DIC_DNS_TMOUT_MIN	5
+#define DIC_DNS_TMOUT_MAX	10
+#define MAX_SERVICE_UNIT 	100
+#define MAX_REGISTRATION_UNIT 100
+#define CONN_BLOCK		256
+#define MAX_CONNS		1024
+#define ID_BLOCK		512
+#define TCP_RCV_BUF_SIZE	16384/*32768*//*65536*/
+#define TCP_SND_BUF_SIZE	16384/*32768*//*65536*/
+#endif
+#define DID_DNS_TMOUT_MIN	5
+#define DID_DNS_TMOUT_MAX	10
+/*
+#define WATCHDOG_TMOUT_MIN	120
+#define WATCHDOG_TMOUT_MAX	180
+*/
+#define WATCHDOG_TMOUT_MIN	60
+#define WATCHDOG_TMOUT_MAX	90
+/*
+#define WATCHDOG_TMOUT_MIN	15
+#define WATCHDOG_TMOUT_MAX	25
+*/
+#define MAX_NODE_NAME		40
+#define MAX_TASK_NAME		40
+#define MAX_NAME 		132
+/*
+#define MAX_CMND 		16384
+#define MAX_IO_DATA 	65535
+#define MAX_IO_DATA		(TCP_SND_BUF_SIZE - 16)
+*/
+typedef enum { DNS_DIS_REGISTER, DNS_DIS_KILL, DNS_DIS_STOP, 
+			   DNS_DIS_EXIT } DNS_DIS_TYPES;
+typedef enum { RD_HDR, RD_DATA, RD_DUMMY } CONN_STATE;
+typedef enum { NOSWAP, SWAPS, SWAPL, SWAPD} SWAP_TYPE;
+
+#define DECNET			0		/* Decnet as transport layer */
+#define TCPIP			1		/* Tcpip as transport layer  */
+#define BOTH			2		/* Both protocols allowed    */
+
+#define	STA_DISC		(-1)		/* Connection lost           */
+#define	STA_DATA		0		/* Data received             */
+#define	STA_CONN		1		/* Connection made           */
+
+#define	START_PORT_RANGE	5100		/* Lowest port to use        */
+#define	STOP_PORT_RANGE		10000		/* Highest port to use       */
+#define	TEST_TIME_OSK		15		/* Interval to test conn.    */
+#define	TEST_TIME_VMS		30		/* Interval to test conn.    */
+#define	TEST_WRITE_TAG		25		/* DTQ tag for test writes   */
+
+#define	OPN_MAGIC		0xc0dec0de	/* Magic value 1st packet    */
+#define	HDR_MAGIC		0xfeadfead	/* Magic value in header     */
+#define	LONG_HDR_MAGIC	0xfeadc0de	/* Magic value in long header*/
+#define	TST_MAGIC		0x11131517	/* Magic value, test write   */
+#define	TRP_MAGIC		0x71513111	/* Magic value, test reply   */
+
+/* String Format */
+
+typedef struct{
+	int par_num;
+	short par_bytes;
+	short flags;     /* bits 0-1 is type of swap, bit 4 id float conversion */
+}FORMAT_STR;
+
+/* Packet sent by the client to the server inside DNA */
+typedef struct{
+	int code;
+	char node[MAX_NODE_NAME];
+	char task[MAX_TASK_NAME];
+} DNA_NET;
+
+/* Packet sent by the client to the server */
+typedef struct{
+	int size;
+	char service_name[MAX_NAME];
+	int service_id;
+	int type;
+	int timeout;
+	int format;
+	int buffer[1];
+} DIC_PACKET;
+
+#define DIC_HEADER		(MAX_NAME + 20)
+
+/* Packets sent by the server to the client */
+typedef struct{
+	int size;
+	int service_id;
+	int buffer[1];
+} DIS_PACKET;
+
+#define DIS_HEADER		8
+
+typedef struct{
+	int size;
+	int service_id;
+	int time_stamp[2];
+	int quality;
+	int reserved[3];
+	int buffer[1];
+} DIS_STAMPED_PACKET;
+
+#define DIS_STAMPED_HEADER		32
+
+/* Packet sent by the server to the name_server */
+typedef struct{
+	char service_name[MAX_NAME];
+	int service_id;
+	char service_def[MAX_NAME];
+} SERVICE_REG;
+	
+typedef struct{
+	int size;
+	SRC_TYPES src_type;
+	char node_name[MAX_NODE_NAME];
+	char task_name[MAX_TASK_NAME-4];
+	char node_addr[4];
+	int pid;
+	int port;
+	int protocol;
+	int format;
+	int n_services;
+	SERVICE_REG services[MAX_SERVICE_UNIT];
+} DIS_DNS_PACKET;
+
+#define DIS_DNS_HEADER		(MAX_NODE_NAME + MAX_TASK_NAME + 28) 
+
+/* Packet sent by the name_server to the server */
+typedef struct {
+	int size;
+	int type;
+} DNS_DIS_PACKET;
+
+#define DNS_DIS_HEADER		8
+
+/* Packet sent by the client to the name_server */
+typedef struct{
+	char service_name[MAX_NAME];
+	int service_id;
+} SERVICE_REQ;
+	
+typedef struct{
+	int size;
+	SRC_TYPES src_type;
+	SERVICE_REQ service;
+} DIC_DNS_PACKET;
+
+/* Packet sent by the name_server to the client */
+typedef struct {
+	int size;
+	int service_id;
+	char service_def[MAX_NAME];
+	char node_name[MAX_NODE_NAME];
+	char task_name[MAX_TASK_NAME-4];
+	char node_addr[4];
+	int pid;
+	int port;
+	int protocol;
+	int format;
+} DNS_DIC_PACKET;
+
+#define DNS_DIC_HEADER		(MAX_NODE_NAME + MAX_TASK_NAME + MAX_NAME + 24) 
+
+typedef struct {
+	char name[MAX_NAME];
+	char node[MAX_NODE_NAME];
+	char task[MAX_TASK_NAME];
+	int type;
+	int status;
+	int n_clients;
+} DNS_SERV_INFO;
+
+typedef struct {
+	char name[MAX_NAME];
+	int type;
+	int status;
+	int n_clients;
+} DNS_SERVICE_INFO;
+
+typedef struct {
+	char node[MAX_NODE_NAME];
+	char task[MAX_TASK_NAME];
+	int pid;
+	int n_services;
+} DNS_SERVER_INFO;
+
+typedef struct {
+	DNS_SERVER_INFO server;
+	DNS_SERVICE_INFO services[1];
+} DNS_DID;
+
+typedef struct {
+	char node[MAX_NODE_NAME];
+	char task[MAX_TASK_NAME];
+} DNS_CLIENT_INFO;
+
+typedef struct {
+	int header_size;
+	int data_size;
+	int header_magic;
+} DNA_HEADER;
+
+typedef struct {
+	int header_size;
+	int data_size;
+	int header_magic;
+	int time_stamp[2];
+	int quality;
+} DNA_LONG_HEADER;
+
+/* Connection handling */
+
+typedef struct timer_entry{
+	struct timer_entry *next;
+	struct timer_entry *prev;
+	struct timer_entry *next_done;
+	int time;
+	int time_left;
+	void (*user_routine)();
+	long tag;
+} TIMR_ENT;
+
+typedef struct {
+	int busy;
+	void (*read_ast)();
+	void (*error_ast)();
+	int *buffer;
+	int buffer_size;
+	char *curr_buffer;
+	int curr_size;
+	int full_size;
+	int protocol;
+	CONN_STATE state;
+	int writing;
+	int saw_init;
+} DNA_CONNECTION;
+
+extern DllExp DIM_NOSHARE DNA_CONNECTION *Dna_conns;
+
+typedef struct {
+	int channel;
+	int mbx_channel;
+	void (*read_rout)();
+	char *buffer;
+	int size;
+	unsigned short *iosb_r;
+	unsigned short *iosb_w;
+	char node[MAX_NODE_NAME];
+	char task[MAX_TASK_NAME];
+	int port;
+	int reading;
+	int timeout;
+	TIMR_ENT *timr_ent;
+	time_t last_used;
+} NET_CONNECTION;
+ 
+extern DllExp DIM_NOSHARE NET_CONNECTION *Net_conns;
+
+typedef struct {
+	char node_name[MAX_NODE_NAME];
+	char task_name[MAX_TASK_NAME];
+	int port;
+	int pid;
+	char *service_head;
+} DIC_CONNECTION;
+
+extern DIM_NOSHARE DIC_CONNECTION *Dic_conns;
+
+typedef struct {
+	SRC_TYPES src_type;
+	char node_name[MAX_NODE_NAME];
+	char task_name[MAX_TASK_NAME-4];
+	char node_addr[4];
+	int pid;
+	int port;
+	char *service_head;
+	char *node_head;
+	int protocol;
+	int validity;
+	int n_services;
+	int old_n_services;
+	TIMR_ENT *timr_ent;
+	int already;
+	char long_task_name[MAX_TASK_NAME*2];
+} DNS_CONNECTION;
+
+extern DllExp DIM_NOSHARE DNS_CONNECTION *Dns_conns;
+
+extern DllExp DIM_NOSHARE int Curr_N_Conns;
+
+/* Client definitions needed by dim_jni.c (from H.Essel GSI) */
+typedef enum {
+	NOT_PENDING, WAITING_DNS_UP, WAITING_DNS_ANSWER, WAITING_SERVER_UP,
+	WAITING_CMND_ANSWER, DELETED
+} PENDING_STATES;
+
+typedef struct dic_serv {
+	struct dic_serv *next;
+	struct dic_serv *prev;
+	char serv_name[MAX_NAME];
+	int serv_id;
+	FORMAT_STR format_data[MAX_NAME/4];
+	char def[MAX_NAME];
+	int format;
+	int type;
+	int timeout;
+	int curr_timeout;
+	int *serv_address;
+	int serv_size;
+	int *fill_address;
+	int fill_size;
+	void (*user_routine)();
+	long tag;
+	TIMR_ENT *timer_ent;
+	int conn_id;
+	PENDING_STATES pending;
+	int tmout_done;
+	int stamped;
+	int time_stamp[2];
+	int quality;
+    int tid;
+} DIC_SERVICE;
+
+/* PROTOTYPES */
+
+/* DNA */
+_DIM_PROTOE( int dna_start_read,    (int conn_id, int size) );
+_DIM_PROTOE( void dna_test_write,   (int conn_id) );
+_DIM_PROTOE( int dna_write,         (int conn_id, void *buffer, int size) );
+_DIM_PROTOE( int dna_write_nowait,  (int conn_id, void *buffer, int size) );
+_DIM_PROTOE( int dna_open_server,   (char *task, void (*read_ast)(), int *protocol,
+				int *port, void (*error_ast)()) );
+_DIM_PROTOE( int dna_get_node_task, (int conn_id, char *node, char *task) );
+_DIM_PROTOE( int dna_open_client,   (char *server_node, char *server_task, int port,
+                                int server_protocol, void (*read_ast)(), void (*error_ast)(), SRC_TYPES src_type ));
+_DIM_PROTOE( int dna_close,         (int conn_id) );
+_DIM_PROTOE( void dna_report_error, (int conn_id, int code, char *routine_name) );
+
+
+/* TCPIP */
+_DIM_PROTOE( int tcpip_open_client,     (int conn_id, char *node, char *task,
+                                    int port) );
+_DIM_PROTOE( int tcpip_open_server,     (int conn_id, char *task, int *port) );
+_DIM_PROTOE( int tcpip_open_connection, (int conn_id, int channel) );
+_DIM_PROTOE( int tcpip_start_read,      (int conn_id, char *buffer, int size,
+                                    void (*ast_routine)()) );
+_DIM_PROTOE( int tcpip_start_listen,    (int conn_id, void (*ast_routine)()) );
+_DIM_PROTOE( int tcpip_write,           (int conn_id, char *buffer, int size) );
+_DIM_PROTOE( void tcpip_get_node_task,  (int conn_id, char *node, char *task) );
+_DIM_PROTOE( int tcpip_close,           (int conn_id) );
+_DIM_PROTOE( int tcpip_failure,         (int code) );
+_DIM_PROTOE( void tcpip_report_error,   (int code) );
+
+
+/* DTQ */
+_DIM_PROTOE( int dtq_create,          (void) );
+_DIM_PROTOE( int dtq_delete,          (int queue_id) );
+_DIM_PROTOE( TIMR_ENT *dtq_add_entry, (int queue_id, int time,
+                                  void (*user_routine)(), long tag) );
+_DIM_PROTOE( int dtq_clear_entry,     (TIMR_ENT *entry) );
+_DIM_PROTOE( int dtq_rem_entry,       (int queue_id, TIMR_ENT *entry) );
+
+/* UTIL */
+typedef struct dll {
+	struct dll *next;
+	struct dll *prev;
+	char user_info[1];
+} DLL;
+
+typedef struct sll {
+	struct sll *next;
+	char user_info[1];
+} SLL;
+
+_DIM_PROTO( void DimDummy,        () );     
+_DIM_PROTOE( void conn_arr_create, (SRC_TYPES type) );
+_DIM_PROTOE( int conn_get,         (void) );
+_DIM_PROTOE( void conn_free,       (int conn_id) );
+_DIM_PROTOE( void *arr_increase,   (void *conn_ptr, int conn_size, int n_conns) );
+_DIM_PROTOE( void id_arr_create,   () );
+_DIM_PROTOE( void *id_arr_increase,(void *id_ptr, int id_size, int n_ids) );
+
+_DIM_PROTOE( void dll_init,         ( DLL *head ) );
+_DIM_PROTOE( void dll_insert_queue, ( DLL *head, DLL *item ) );
+_DIM_PROTOE( void dll_insert_after, ( DLL *after, DLL *item ) );
+_DIM_PROTOE( DLL *dll_search,       ( DLL *head, char *data, int size ) );
+_DIM_PROTOE( DLL *dll_get_next,     ( DLL *head, DLL *item ) );
+_DIM_PROTOE( DLL *dll_get_prev,     ( DLL *head, DLL *item ) );
+_DIM_PROTOE( int dll_empty,         ( DLL *head ) );
+_DIM_PROTOE( void dll_remove,       ( DLL *item ) );
+
+_DIM_PROTOE( void sll_init,               ( SLL *head ) );
+_DIM_PROTOE( int sll_insert_queue,        ( SLL *head, SLL *item ) );
+_DIM_PROTOE( SLL *sll_search,             ( SLL *head, char *data, int size ) );
+_DIM_PROTOE( SLL *sll_get_next,           ( SLL *item ) );
+_DIM_PROTOE( int sll_empty,               ( SLL *head ) );
+_DIM_PROTOE( int sll_remove,              ( SLL *head, SLL *item ) );
+_DIM_PROTOE( SLL *sll_remove_head,        ( SLL *head ) );
+_DIM_PROTOE( SLL *sll_search_next_remove, ( SLL *item, int offset, char *data, int size ) );
+_DIM_PROTOE( SLL *sll_get_head, 		  ( SLL *head ) );
+
+_DIM_PROTOE( int HashFunction,         ( char *name, int max ) );
+
+_DIM_PROTOE( int copy_swap_buffer_out, (int format, FORMAT_STR *format_data, 
+					void *buff_out, void *buff_in, int size) );
+_DIM_PROTOE( int copy_swap_buffer_in, (FORMAT_STR *format_data, void *buff_out, 
+					void *buff_in, int size) );
+_DIM_PROTOE( int get_node_name, (char *node_name) );
+
+_DIM_PROTOE( int get_dns_port_number, () );
+
+_DIM_PROTOE( int get_dns_node_name, ( char *node_name ) );
+
+_DIM_PROTOE( int get_dns_accepted_domains, ( char *domains ) );
+_DIM_PROTOE( int get_dns_accepted_nodes, ( char *nodes ) );
+
+_DIM_PROTO( double _swapd_by_addr, (double *d) );
+_DIM_PROTO( int _swapl_by_addr, (int *l) );
+_DIM_PROTO( short _swaps_by_addr, (short *s) );
+_DIM_PROTO( void _swapd_buffer, (double *dout, double *din, int n) );
+_DIM_PROTO( void _swapl_buffer, (int *lout, int *lin, int n) );
+_DIM_PROTO( void _swaps_buffer, (short *sout, short *sin, int n) );
+
+#define SIZEOF_CHAR 1
+#define SIZEOF_SHORT 2
+#define SIZEOF_LONG 4
+#define SIZEOF_FLOAT 4
+#define SIZEOF_DOUBLE 8
+
+#if defined(OSK) && !defined(_UCC)
+#	define inc_pter(p,i) (char *)p += (i)
+#else
+#	define inc_pter(p,i) p = (void *)((char *)p + (i))
+#endif
+
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dim.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dim.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dim.hxx	(revision 10183)
@@ -0,0 +1,60 @@
+#ifndef DIM_HH
+#define DIM_HH
+
+#include "dim_common.h"
+#include "sllist.hxx"
+#include "dllist.hxx"
+
+class DimCore
+{
+public:
+	static int inCallback;
+};
+
+class DllExp DimErrorHandler{
+public:
+	virtual void errorHandler(int severity, int code, char *msg) = 0;
+	virtual ~DimErrorHandler() {};
+};
+
+class DllExp DimTimer
+{
+public:
+	int firedFlag;
+	int runningFlag;
+	DimTimer();
+	DimTimer(int time);
+	virtual ~DimTimer();
+	int start(int time);
+	int stop();
+	int fired() { return firedFlag;}; 
+	void clear() { firedFlag = 0;};
+	virtual void timerHandler() { };
+};
+
+class DllExp DimThread
+{
+public:
+	long itsId;
+	DimThread();
+	virtual ~DimThread();
+	int start();
+//	int stop();
+//	void start(int time);
+//	int stop();
+//	int fired() { return firedFlag;}; 
+//	void clear() { firedFlag = 0;};
+	virtual void threadHandler() { };
+};
+
+class DllExp DimUtil
+{
+public:
+	static char *getEnvVar(char *varName);
+	DimUtil();
+	~DimUtil();
+	static char *itsBuffer;
+	static int itsBufferSize;
+};
+
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dim_common.h
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dim_common.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dim_common.h	(revision 10183)
@@ -0,0 +1,268 @@
+#ifndef __COMMONDEFS
+#define __COMMONDEFS
+
+/* Service type definition */
+
+#ifndef ONCE_ONLY
+#define ONCE_ONLY	0x01
+#define TIMED		0x02
+#define MONITORED	0x04
+#define COMMAND		0x08
+#define DIM_DELETE	0x10
+#define MONIT_ONLY	0x20
+#define UPDATE 		0x40
+#define TIMED_ONLY	0x80
+#define MONIT_FIRST 0x100
+#define MAX_TYPE_DEF    0x100
+#define STAMPED       0x1000
+
+typedef enum { SRC_NONE, SRC_DIS, SRC_DIC, SRC_DNS, SRC_DNA, SRC_USR }SRC_TYPES;
+
+#ifdef __APPLE__
+#ifndef unix
+#define unix
+#endif
+#endif
+
+#ifdef __Lynx__
+#ifndef unix
+#define unix
+#endif
+#endif
+
+#ifdef unix
+#ifndef __unix__
+#define __unix__
+#endif
+#endif
+
+#ifdef linux
+#ifndef __linux__
+#define __linux__
+#endif
+#endif
+
+#ifdef WIN32
+typedef __int64		longlong;
+#elif defined(__linux__)
+typedef long long int longlong;
+#else
+#include <sys/types.h> 
+typedef int64_t	longlong;
+#endif
+
+#endif
+
+#ifndef OSK
+#	ifdef _OSK
+#		define OSK
+#	endif
+#endif
+
+
+#ifdef __VMS
+#define VMS
+#endif
+
+#ifndef _DIM_PROTO
+#ifndef OSK		/* Temorary hack */
+#	if defined(__cplusplus) /* || (__STDC__ == 1) || defined(_ANSI_EXT) || defined(ultrix) */
+#		define	_DIM_PROTO(func,param)	func param
+#	else
+#		define _DIM_PROTO(func,param)	func ()
+#	endif
+#else
+#	define _DIM_PROTO(func,param)	func ()
+#endif
+#ifdef WIN32
+#ifdef DIMLIB
+#	define _DIM_PROTOE(func,param) __declspec(dllexport) _DIM_PROTO(func,param)
+#	define DllExp __declspec(dllexport)
+#else
+#	define _DIM_PROTOE(func,param) __declspec(dllimport) _DIM_PROTO(func,param)
+#	define DllExp __declspec(dllimport)
+#endif
+#else
+#	define _DIM_PROTOE(func,param) _DIM_PROTO(func,param)
+#	define DllExp
+#endif
+#endif
+
+#if defined (hpux) || defined (__osf__) || defined(_AIX)  || defined(WIN32)
+#ifndef NOTHREADS
+#define NOTHREADS
+#endif
+#endif
+
+#ifndef VMS
+#ifndef WIN32
+#ifdef NOTHREADS
+#ifndef DIMLIB
+#ifndef sleep
+#define sleep(t) dtq_sleep(t)
+#endif
+#endif
+#endif
+#endif
+#endif
+
+#ifdef VMS
+#include <ssdef.h>
+#define DISABLE_AST     long int ast_enable = sys$setast(0);
+#define ENABLE_AST      if (ast_enable == SS$_WASSET) sys$setast(1);
+#define dim_enable()    sys$setast(1);
+#endif
+
+#ifdef __unix__
+#include <signal.h>
+#include <unistd.h>
+
+#define DISABLE_AST     sigset_t set, oset; sigemptyset(&set);\
+						sigaddset(&set,SIGIO);\
+						sigaddset(&set,SIGALRM);\
+						sigprocmask(SIG_BLOCK,&set,&oset);\
+						DIM_LOCK
+#define ENABLE_AST      DIM_UNLOCK sigprocmask(SIG_SETMASK,&oset,0);
+
+#ifdef VxWorks
+#define DIM_LOCK taskLock();
+#define DIM_UNLOCK taskUnlock();
+#else
+
+#ifndef NOTHREADS
+#include <pthread.h>
+
+_DIM_PROTOE( void dim_lock,		() );
+_DIM_PROTOE( void dim_unlock,	() );
+_DIM_PROTOE( void dim_wait_cond,		() );
+_DIM_PROTOE( void dim_signal_cond,	() );
+
+#define DIM_LOCK 	dim_lock();
+#define DIM_UNLOCK	dim_unlock();
+
+#else
+#define DIM_LOCK
+#define DIM_UNLOCK
+#endif
+#endif
+#endif
+#ifdef OSK
+#define INC_LEVEL               1
+#define DEC_LEVEL               (-1)
+#define DISABLE_AST     sigmask(INC_LEVEL);
+#define ENABLE_AST      sigmask(DEC_LEVEL);
+#endif
+
+
+_DIM_PROTOE( int id_get,           (void *ptr, int type) );
+_DIM_PROTOE( void id_free,         (int id, int type) );
+_DIM_PROTOE( void *id_get_ptr,     (int id, int type) );
+
+_DIM_PROTOE( unsigned int dtq_sleep,	(unsigned int secs) );
+_DIM_PROTOE( void dtq_start_timer,      (int secs, void(*rout)(void*), void *tag) );
+_DIM_PROTOE( int dtq_stop_timer,		(void *tag) );
+_DIM_PROTOE( void dim_init,				() );
+_DIM_PROTOE( void dim_no_threads,		() );
+_DIM_PROTOE( void dna_set_test_write,	(int conn_id, int time) );
+_DIM_PROTOE( void dna_rem_test_write,	(int conn_id) );
+_DIM_PROTOE( int dim_set_dns_node,		(char *node) );
+_DIM_PROTOE( int dim_get_dns_node,		(char *node) );
+_DIM_PROTOE( int dim_set_dns_port,		(int port) );
+_DIM_PROTOE( int dim_get_dns_port,		() );
+_DIM_PROTOE( void dic_set_debug_on,		() );
+_DIM_PROTOE( void dic_set_debug_off,	() );
+_DIM_PROTOE( void dim_print_msg,		(char *msg, int severity) );
+_DIM_PROTOE( void dim_print_date_time,		() );
+_DIM_PROTOE( void dim_set_write_timeout,		(int secs) );
+_DIM_PROTOE( int dim_get_write_timeout,		() );
+_DIM_PROTOE( void dim_usleep,	(unsigned int t) );
+_DIM_PROTOE( int dim_wait,		(void) );
+_DIM_PROTOE( int dim_get_priority,		(int dim_thread, int prio) );
+_DIM_PROTOE( int dim_set_priority,		(int dim_thread, int *prio) );
+_DIM_PROTOE( int dim_set_scheduler_class,		(int sched_class) );
+_DIM_PROTOE( int dim_get_scheduler_class,		(int *sched_class) );
+_DIM_PROTOE( long dim_start_thread,    (void(*rout)(void*), void *tag) );
+_DIM_PROTOE( int dic_set_dns_node,		(char *node) );
+_DIM_PROTOE( int dic_get_dns_node,		(char *node) );
+_DIM_PROTOE( int dic_set_dns_port,		(int port) );
+_DIM_PROTOE( int dic_get_dns_port,		() );
+_DIM_PROTOE( int dis_set_dns_node,		(char *node) );
+_DIM_PROTOE( int dis_get_dns_node,		(char *node) );
+_DIM_PROTOE( int dis_set_dns_port,		(int port) );
+_DIM_PROTOE( int dis_get_dns_port,		() );
+_DIM_PROTOE( void dim_stop,				() );
+_DIM_PROTOE( int dim_stop_thread,		(long tid) );
+_DIM_PROTOE( long dis_add_dns,		(char *node, int port) );
+_DIM_PROTOE( long dic_add_dns,		(char *node, int port) );
+_DIM_PROTOE( int dim_get_env_var,		(char *env_var, char *value, int value_size) );
+_DIM_PROTOE( int dim_set_write_buffer_size,		(int bytes) );
+_DIM_PROTOE( int dim_get_write_buffer_size,		() );
+_DIM_PROTOE( int dim_set_read_buffer_size,		(int bytes) );
+_DIM_PROTOE( int dim_get_read_buffer_size,		() );
+_DIM_PROTOE( void dis_set_debug_on,		() );
+_DIM_PROTOE( void dis_set_debug_off,	() );
+
+#ifdef WIN32
+#define getpid _getpid
+_DIM_PROTOE( void dim_pause,		() );
+_DIM_PROTOE( void dim_wake_up,	() );
+_DIM_PROTOE( void dim_lock,		() );
+_DIM_PROTOE( void dim_unlock,	() );
+_DIM_PROTOE( void dim_sleep,	(unsigned int t) );
+_DIM_PROTOE( void dim_win_usleep,	(unsigned int t) );
+#define sleep(t)	dim_sleep(t);
+#define usleep(t)	dim_win_usleep(t);
+#define pause() 	dim_pause();
+#define wake_up()	dim_wake_up();
+#define DIM_LOCK 	dim_lock();
+#define DIM_UNLOCK	dim_unlock();
+#define DISABLE_AST	DIM_LOCK
+#define ENABLE_AST  DIM_UNLOCK
+#endif
+
+_DIM_PROTOE( void dim_print_date_time_millis,		() );
+
+/* ctime usage */
+#if defined (solaris) || (defined (LYNXOS) && !defined (__Lynx__) )
+#define my_ctime(t,str,size) ctime_r(t,str,size)
+#else 
+#if defined (__linux__) || defined (__Lynx__)
+#define my_ctime(t,str,size) ctime_r(t,str)
+#else
+#define my_ctime(t,str,size) strcpy(str,(const char *)ctime(t))
+#endif
+#endif
+
+/* DIM Error Severities*/
+typedef enum { DIM_INFO, DIM_WARNING, DIM_ERROR, DIM_FATAL }DIM_SEVERITIES;
+/* DIM Error codes */
+#define DIMDNSUNDEF 0x1		/* DIM_DNS_NODE undefined			FATAL */
+#define DIMDNSREFUS 0x2		/* DIM_DNS refuses connection		FATAL */
+#define DIMDNSDUPLC 0x3		/* Service already exists in DNS	FATAL */
+#define DIMDNSEXIT  0x4		/* DNS requests server to EXIT		FATAL */
+#define DIMDNSTMOUT 0x5		/* Server failed sending Watchdog	WARNING */
+
+#define DIMSVCDUPLC 0x10	/* Service already exists in Server	ERROR */
+#define DIMSVCFORMT 0x11	/* Bat format string for service	ERROR */
+#define DIMSVCINVAL 0x12	/* Service ID invalid				ERROR */
+#define DIMSVCTOOLG 0x13	/* Service name too long			ERROR */
+
+#define DIMTCPRDERR	0x20	/* TCP/IP read error				ERROR */
+#define DIMTCPWRRTY	0x21	/* TCP/IP write	error - Retrying	WARNING */
+#define DIMTCPWRTMO	0x22	/* TCP/IP write error - Disconnect	ERROR */
+#define DIMTCPLNERR	0x23	/* TCP/IP listen error				ERROR */
+#define DIMTCPOPERR	0x24	/* TCP/IP open server error			ERROR */
+#define DIMTCPCNERR	0x25	/* TCP/IP connection error			ERROR */
+#define DIMTCPCNEST	0x26	/* TCP/IP connection established	INFO */
+
+#define DIMDNSCNERR	0x30	/* Connection to DNS failed			ERROR */
+#define DIMDNSCNEST	0x31	/* Connection to DNS established	INFO */
+		
+#endif                         
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/dim/dim_core.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dim_core.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dim_core.hxx	(revision 10183)
@@ -0,0 +1,34 @@
+#ifndef DIM_CORE
+#define DIM_CORE
+
+   #if defined __cplusplus
+         /* If the functions in this header have C linkage, this
+           * will specify linkage for all C++ language compilers.
+           */
+         extern "C" {
+   #endif
+
+   # if defined __DECC || defined __DECCXX
+         /* If you are using pragmas that are only defined
+           * with DEC C and DEC C++, this line is necessary
+           * for both C and C++ compilers.   A common error
+           * is to only have #ifdef __DECC, which causes
+           * the compiler to skip the conditionalized
+           * code.
+           */
+   #    pragma __extern_model __save
+   #    pragma __extern_model __strict_refdef
+         extern const char some_definition [];
+   #    pragma __extern_model __restore
+   # endif
+
+    /* ...some data and function definitions go here... */
+
+#include "dis.h"
+#include "dic.h"
+
+   #if defined __cplusplus
+         }    /* matches the linkage specification at the beginning. */
+   #endif
+
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dim_jni.h
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dim_jni.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dim_jni.h	(revision 10183)
@@ -0,0 +1,70 @@
+#include <jni.h>
+/* Header for class dim_Native */
+
+#ifndef _Included_dim_Native
+#define _Included_dim_Native
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef dim_Native_ONCE_ONLY
+#define dim_Native_ONCE_ONLY 0x1L
+#undef dim_Native_TIMED
+#define dim_Native_TIMED 0x2L
+#undef dim_Native_MONITORED
+#define dim_Native_MONITORED 0x4L
+#undef dim_Native_MONIT_ONLY
+#define dim_Native_MONIT_ONLY 0x20L
+#undef dim_Native_UPDATE
+#define dim_Native_UPDATE 0x40L
+#undef dim_Native_TIMED_ONLY
+#define dim_Native_TIMED_ONLY	0x80L
+#undef dim_Native_MONIT_FIRST
+#define dim_Native_MONIT_FIRST 0x100L
+#undef dim_Native_F_STAMPED
+#define dim_Native_F_STAMPED /*4096L*/ 0x1000L
+#undef dim_Native_F_WAIT
+#define dim_Native_F_WAIT /*-2147483648L*/ 0x10000000L
+
+
+#undef dim_Dbg_MODULE
+#define dim_Dbg_MODULE 1L
+#undef dim_Dbg_TRANSACTIONS
+#define dim_Dbg_TRANSACTIONS 2L
+#undef dim_Dbg_SEND_CALLBACK
+#define dim_Dbg_SEND_CALLBACK 4L
+#undef dim_Dbg_SEND_NATIVE
+#define dim_Dbg_SEND_NATIVE 8L
+#undef dim_Dbg_INFO_CALLBACK
+#define dim_Dbg_INFO_CALLBACK 16L
+#undef dim_Dbg_INFO_SERVICE
+#define dim_Dbg_INFO_SERVICE 32L
+#undef dim_Dbg_SERVER
+#define dim_Dbg_SERVER 256L
+#undef dim_Dbg_SERVICE_CALLBACK
+#define dim_Dbg_SERVICE_CALLBACK 512L
+#undef dim_Dbg_ADD_SERVICE
+#define dim_Dbg_ADD_SERVICE 1024L
+#undef dim_Dbg_RELEASE_SERVICE
+#define dim_Dbg_RELEASE_SERVICE 2048L
+#undef dim_Dbg_CMND_CALLBACK
+#define dim_Dbg_CMND_CALLBACK 4096L
+#undef dim_Dbg_ADD_CMND
+#define dim_Dbg_ADD_CMND 8192L
+#undef dim_Dbg_UPDATE_SERVICE
+#define dim_Dbg_UPDATE_SERVICE 16384L
+#undef dim_Dbg_GETCLIENT
+#define dim_Dbg_GETCLIENT 32768L
+#undef dim_Dbg_SERIALIZER
+#define dim_Dbg_SERIALIZER 65536L
+#undef dim_Dbg_DESCRIPTORS
+#define dim_Dbg_DESCRIPTORS 131072L
+#undef dim_Dbg_FULL
+#define dim_Dbg_FULL -1L
+
+/* Inaccessible static: dim_version */
+/* Inaccessible static: dll_locations */
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dim_tcpip.h
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dim_tcpip.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dim_tcpip.h	(revision 10183)
@@ -0,0 +1,94 @@
+/* 
+ * DIM Include file for changing the number of open connections
+ * Date: 06-12-2007
+ * Author: C. Gaspar
+ */
+
+#ifdef WIN32
+#define FD_SETSIZE      8192
+#else
+#ifdef linux
+#ifndef NOMORECONNS
+/* CG: Copied here bits/typesizes.h */
+#ifndef	_BITS_TYPESIZES_H
+#define	_BITS_TYPESIZES_H	1
+
+/* See <bits/types.h> for the meaning of these macros.  This file exists so
+   that <bits/types.h> need not vary across different GNU platforms.  */
+
+#define __DEV_T_TYPE		__UQUAD_TYPE
+#define __UID_T_TYPE		__U32_TYPE
+#define __GID_T_TYPE		__U32_TYPE
+#define __INO_T_TYPE		__ULONGWORD_TYPE
+#define __INO64_T_TYPE		__UQUAD_TYPE
+#define __MODE_T_TYPE		__U32_TYPE
+#define __NLINK_T_TYPE		__UWORD_TYPE
+#define __OFF_T_TYPE		__SLONGWORD_TYPE
+#define __OFF64_T_TYPE		__SQUAD_TYPE
+#define __PID_T_TYPE		__S32_TYPE
+#define __RLIM_T_TYPE		__ULONGWORD_TYPE
+#define __RLIM64_T_TYPE		__UQUAD_TYPE
+#define	__BLKCNT_T_TYPE		__SLONGWORD_TYPE
+#define	__BLKCNT64_T_TYPE	__SQUAD_TYPE
+#define	__FSBLKCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSBLKCNT64_T_TYPE	__UQUAD_TYPE
+#define	__FSFILCNT_T_TYPE	__ULONGWORD_TYPE
+#define	__FSFILCNT64_T_TYPE	__UQUAD_TYPE
+#define	__ID_T_TYPE		__U32_TYPE
+#define __CLOCK_T_TYPE		__SLONGWORD_TYPE
+#define __TIME_T_TYPE		__SLONGWORD_TYPE
+#define __USECONDS_T_TYPE	__U32_TYPE
+#define __SUSECONDS_T_TYPE	__SLONGWORD_TYPE
+#define __DADDR_T_TYPE		__S32_TYPE
+#define __SWBLK_T_TYPE		__SLONGWORD_TYPE
+#define __KEY_T_TYPE		__S32_TYPE
+#define __CLOCKID_T_TYPE	__S32_TYPE
+#define __TIMER_T_TYPE		__S32_TYPE
+#define __BLKSIZE_T_TYPE	__SLONGWORD_TYPE
+#define __FSID_T_TYPE		struct { int __val[2]; }
+#define __SSIZE_T_TYPE		__SWORD_TYPE
+
+/* Number of descriptors that can fit in an `fd_set'.  */
+#define	__FD_SETSIZE		8192
+
+#endif /* bits/typesizes.h */
+
+/* CG: Copied here linux/posix_types.h */
+#ifndef _LINUX_POSIX_TYPES_H
+#define _LINUX_POSIX_TYPES_H
+
+#include <linux/stddef.h>
+
+#undef __NFDBITS
+#define __NFDBITS	(8 * sizeof(unsigned long))
+
+#undef __FD_SETSIZE
+#define __FD_SETSIZE	8192
+
+#undef __FDSET_LONGS
+#define __FDSET_LONGS	(__FD_SETSIZE/__NFDBITS)
+
+#undef __FDELT
+#define	__FDELT(d)	((d) / __NFDBITS)
+
+#undef __FDMASK
+#define	__FDMASK(d)	(1UL << ((d) % __NFDBITS))
+
+typedef struct {
+	unsigned long fds_bits [__FDSET_LONGS];
+} __kernel_fd_set;
+
+/* Type of a signal handler.  */
+typedef void (*__kernel_sighandler_t)(int);
+
+/* Type of a SYSV IPC key.  */
+typedef int __kernel_key_t;
+
+#include <asm/posix_types.h>
+
+#endif /* _LINUX_POSIX_TYPES_H */
+
+#endif /* NOMORECONNS */
+#endif /* linux */
+
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dis.h
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dis.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dis.h	(revision 10183)
@@ -0,0 +1,67 @@
+#ifndef __DISDEFS
+#define __DISDEFS
+
+#include "dim_common.h"
+
+/* CFORTRAN interface */
+
+#define dis_start_serving dis_start_serving_
+#define dis_stop_serving dis_stop_serving_
+#define dis_get_next_cmnd dis_get_next_cmnd_
+#define dis_get_client dis_get_client_
+#define dis_add_service dis_add_service_
+#define dis_add_cmnd dis_add_cmnd_
+#define dis_add_client_exit_handler dis_add_client_exit_handler_
+#define dis_add_exit_handler dis_add_exit_handler_
+#define dis_set_client_exit_handler dis_set_client_exit_handler_
+#define dis_report_service dis_report_service_
+#define dis_update_service dis_update_service_
+#define dis_remove_service dis_remove_service_
+#define dis_send_service dis_send_service_
+#define dis_convert_str dis_convert_str_
+#define dis_set_quality dis_set_quality_
+#define dis_set_timestamp dis_set_timestamp_
+#define dis_selective_update_service dis_selective_update_service_
+#define dis_get_timestamp dis_get_timestamp_
+
+_DIM_PROTOE( int dis_start_serving,    (char *task_name) );
+_DIM_PROTOE( void dis_stop_serving,    () );
+_DIM_PROTOE( int dis_get_next_cmnd,    (long *tag, int *buffer, int *size ) );
+_DIM_PROTOE( int dis_get_client,       (char *name ) );
+_DIM_PROTOE( int dis_get_conn_id,      () );
+_DIM_PROTOE( unsigned dis_add_service, (char *service_name, char *service_type,
+				   void *service_address, int service_size,
+				   void (*usr_routine)(void*,void**,int*,int*), long tag) );
+_DIM_PROTOE( unsigned dis_add_cmnd,        (char *service_name, char *service_type,
+			           void (*usr_routine)(void*,void*,int*), long tag) );
+_DIM_PROTOE( void dis_add_client_exit_handler,(void (*usr_routine)(int*)) );
+_DIM_PROTOE( void dis_set_client_exit_handler,(int conn_id, int tag) );
+_DIM_PROTOE( void dis_add_exit_handler,(void (*usr_routine)(int*)) );
+_DIM_PROTOE( void dis_add_error_handler,(void (*usr_routine)(int, int, char*)) );
+_DIM_PROTOE( void dis_report_service,  (char *service_name) );
+_DIM_PROTOE( int dis_update_service,   (unsigned service_id) );
+_DIM_PROTOE( int dis_remove_service,   (unsigned service_id) );
+_DIM_PROTOE( void dis_send_service,    (unsigned service_id, int *buffer,
+				   int size) );
+_DIM_PROTOE( int dis_set_buffer_size,  (int size) );
+_DIM_PROTOE( void dis_set_quality,     (unsigned service_id, int quality) );
+_DIM_PROTOE( int dis_set_timestamp,     (unsigned service_id, 
+					int secs, int millisecs) );
+_DIM_PROTOE( int dis_selective_update_service,   (unsigned service_id, 
+					int *client_id_list) );
+_DIM_PROTOE( void dis_disable_padding,      		() );
+_DIM_PROTOE( int dis_get_timeout,      		(unsigned service_id, int client_id) );
+_DIM_PROTOE( char *dis_get_error_services,	() );
+_DIM_PROTOE( char *dis_get_client_services,	(int conn_id) );
+_DIM_PROTOE( int dis_start_serving_dns,		(long dns_id, char *task_name/*, int *id_list*/) );
+_DIM_PROTOE( void dis_stop_serving_dns,		(long dns_id) );
+_DIM_PROTOE( unsigned dis_add_service_dns,	(long dns_id, char *service_name, char *service_type,
+				   void *service_address, int service_size,
+				   void (*usr_routine)(void*,void**,int*,int*), long tag) );
+_DIM_PROTOE( unsigned dis_add_cmnd_dns,		(long dns_id, char *service_name, char *service_type,
+			       void (*usr_routine)(void*,void*,int*), long tag) );
+_DIM_PROTOE( int dis_get_n_clients,	(unsigned service_id) );
+_DIM_PROTOE( int dis_get_timestamp,     (unsigned service_id, 
+					int *secs, int *millisecs) );
+
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/dis.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dis.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dis.hxx	(revision 10183)
@@ -0,0 +1,357 @@
+#ifndef __DISHHDEFS
+#define __DISHHDEFS
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+#ifdef __VMS
+#include <starlet.h>
+#endif
+#include "dim_core.hxx"
+#include "dim.hxx"
+/*
+#define DimSHORT	"S"
+#define DimINT		"I"
+#define DimLONG		"L"
+#define DimFLOAT	"F"
+#define DimDOUBLE	"D"
+#define DimSTRING	"C"
+#define DimXLONG	"X"
+*/
+enum DisTYPE {
+	DisPOINTER, DisSHORT, DisINT, DisFLOAT, DisDOUBLE, DisSTRING, DisXLONG, DisCOMMAND
+};
+
+class DimService;
+class DimCommand;
+
+class DllExp DimServiceHandler{
+public:
+	DimService *itsService;
+	DimService *getService() { return itsService; } ;
+	virtual void serviceHandler() = 0;
+	virtual ~DimServiceHandler() {};
+};
+
+class DllExp DimCommandHandler{
+public:
+	DimCommand *itsCommand;
+	DimCommand *getCommand() { return itsCommand; } ;
+	virtual void commandHandler() = 0;
+	virtual ~DimCommandHandler() {};
+};
+
+class DllExp DimClientExitHandler{
+public:
+	virtual void clientExitHandler() = 0;
+	virtual ~DimClientExitHandler() {};
+};
+
+class DllExp DimExitHandler{
+public:
+	virtual void exitHandler(int code) = 0;
+	virtual ~DimExitHandler() {};
+};
+
+class DllExp DimServerDns
+{
+public:
+	DimServerDns(const char *node);
+	DimServerDns(const char *node, int port);
+	DimServerDns(const char *node, int port, char *name);
+	~DimServerDns();
+	void init(const char *node, int port);
+	long getDnsId();
+	void setName(const char *name);
+	char *getName();
+	void autoStartOn();
+	void autoStartOff();
+	int isAutoStart();
+	void addServiceId(int id);
+	int *getServiceIdList();
+private:
+	char *itsNode;
+	int itsPort;
+	long itsDnsId;
+	char *itsName;
+	int autoStart;
+	int *itsServiceIdList;
+	int itsServiceIdListSize;
+	int itsNServiceIds;
+//	int itsNServices;
+};
+
+class DllExp DimServer : public DimServiceHandler, public DimCommandHandler,
+	public DimClientExitHandler, public DimExitHandler, public DimErrorHandler
+{
+public:
+	static char *clientName;
+	static char *itsName;
+	static char *dimDnsNode;
+	static int autoStart;
+	static DimClientExitHandler *itsClientExit;
+	static DimExitHandler *itsExit;
+	static DimErrorHandler *itsSrvError;
+//	static int itsNServices;
+	DimServer();
+	virtual ~DimServer();
+	static void start(const char *name);
+	static void start(DimServerDns *dns, const char *name);
+	static void start();
+	static void start(DimServerDns *dns);
+	static void stop();
+	static void stop(DimServerDns *dns);
+	static void autoStartOn();
+	static void autoStartOff();
+	// Get Current Client Identifier	
+	static int getClientId();
+	// Get Current Client Name	
+	static char *getClientName();
+	static void setClientExitHandler(int clientId);
+	static void clearClientExitHandler(int clientId);
+	static void addClientExitHandler(DimClientExitHandler *handler);
+	void addClientExitHandler();
+	static void addExitHandler(DimExitHandler *handler);
+	static void addErrorHandler(DimErrorHandler *handler);
+	static int setDnsNode(const char *node);
+	static int setDnsNode(const char *node, int port);
+	static long addDns(const char *node, int port);
+	static void stopDns(long dnsid);
+	static char *getDnsNode();
+	static int getDnsPort();
+	static void setWriteTimeout(int secs);
+	static int getWriteTimeout();
+	void addExitHandler();
+	void addErrorHandler();
+	virtual void clientExitHandler() {};
+	virtual void exitHandler(int /* code */) {};
+	virtual void errorHandler(int /* severity */, int /* code */, char* /* msg */) {};
+//	static char *getClientServices();
+//	static char *getClientServices(int clientId);
+	static char **getClientServices();
+
+	virtual void serviceHandler() {};
+	virtual void commandHandler() {};
+};
+
+class DllExp DimService : public DimServiceHandler {
+
+public :
+	DimServiceHandler *itsServiceHandler;
+
+	// The object contains the value to be published. Service to be updated with an argument of same type;
+	DimService();
+
+	DimService(const char *name, int &value);
+	DimService(const char *name, float &value);
+	DimService(const char *name, double &value);
+	DimService(const char *name, longlong &value);
+	DimService(const char *name, short &value);
+	DimService(const char *name, char *string);
+
+	DimService(const char *name, char *format, void *structure, int size);
+
+	DimService(const char *name, char *format, DimServiceHandler *handler);
+
+	DimService(const char *name, const char *format, void *structure, int size);
+
+	DimService(const char *name, const char *format, DimServiceHandler *handler);
+
+	DimService(DimServerDns *dns, const char *name, int &value);
+	DimService(DimServerDns *dns, const char *name, float &value);
+	DimService(DimServerDns *dns, const char *name, double &value);
+	DimService(DimServerDns *dns, const char *name, longlong &value);
+	DimService(DimServerDns *dns, const char *name, short &value);
+	DimService(DimServerDns *dns, const char *name, char *string);
+
+	DimService(DimServerDns *dns, const char *name, char *format, void *structure, int size);
+
+	DimService(DimServerDns *dns, const char *name, char *format, DimServiceHandler *handler);
+
+	DimService(DimServerDns *dns, const char *name, const char *format, void *structure, int size);
+
+	DimService(DimServerDns *dns, const char *name, const char *format, DimServiceHandler *handler);
+
+	virtual ~DimService();
+
+	// Update methods
+	int updateService();
+	// Update the value as well...
+	int updateService( int &value );
+	int updateService( float &value );
+	int updateService( double &value ) ;
+	int updateService( longlong &value );
+	int updateService( short &value );
+	int updateService( char *string );
+	
+	int updateService( void *structure, int size );
+	
+	// Selective Update methods
+	int selectiveUpdateService(int *cids);
+	// Update the value as well...
+	int selectiveUpdateService( int &value, int *cids);
+	int selectiveUpdateService( float &value, int *cids );
+	int selectiveUpdateService( double &value, int *cids );
+	int selectiveUpdateService( longlong &value, int *cids );
+	int selectiveUpdateService( short &value, int *cids );
+	int selectiveUpdateService( char *string, int *cids );
+	
+	int selectiveUpdateService( void *structure, int size, int *cids );
+	
+	void setQuality(int quality);
+	void setTimestamp(int secs, int millisecs);
+
+	void *itsData;
+	int itsDataSize;
+	int itsSize;
+	DisTYPE itsType;
+	void setData(void *data, int size);
+	void setData(int &data);
+	void setData(float &data);
+	void setData(double &data);
+	void setData(longlong &data);
+	void setData(short &data);
+	void setData(char *data);
+
+	virtual void serviceHandler() {};
+	// Accessors
+	char *getName();
+	int getTimeout(int clientId);
+	int getNClients();
+
+private :
+	char *itsName;
+	int itsId;
+	int itsTagId;
+	void declareIt(char *name, char *format, DimServiceHandler *handler, DimServerDns *dns);
+	void storeIt(void *data, int size);
+	DimServerDns *itsDns;
+};
+
+class DllExp CmndInfo : public SLLItem {
+	friend class DimCommand;
+	void *itsData;
+	int itsDataSize;
+	int secs, millisecs;
+public:
+	CmndInfo(void *data, int datasize, int tsecs, int tmillisecs);
+	~CmndInfo();
+};
+
+class DllExp DimCommand : public DimCommandHandler {
+
+public :
+	DimCommandHandler *itsCommandHandler;
+
+	DimCommand(const char *name, char *format);
+
+	DimCommand(const char *name, char *format, DimCommandHandler *handler);
+
+	DimCommand(DimServerDns *dns, const char *name, char *format);
+
+	DimCommand(DimServerDns *dns, const char *name, char *format, DimCommandHandler *handler);
+
+	DimCommand(const char *name, const char *format);
+
+	DimCommand(const char *name, const char *format, DimCommandHandler *handler);
+
+	DimCommand(DimServerDns *dns, const char *name, const char *format);
+
+	DimCommand(DimServerDns *dns, const char *name, const char *format, DimCommandHandler *handler);
+
+	int getNext();
+	int hasNext();
+	void *itsData;
+	int itsSize;
+	void *getData();
+	int getInt();
+	float getFloat();
+	double getDouble();
+	longlong getLonglong();
+	short getShort();
+	char *getString();
+	int getSize();
+	char *getFormat();
+	int getTimestamp();
+	int getTimestampMillisecs();
+
+	virtual void commandHandler();
+
+	// Accessors
+	char *getName();
+	virtual ~DimCommand();
+
+private :
+	char *itsName;
+	int itsId;
+	int itsTagId;
+	char *itsFormat;
+	void declareIt(char *name, char *format, DimCommandHandler *handler, DimServerDns *dns);
+	CmndInfo *currCmnd;
+	SLList itsCmndList;
+	DimServerDns *itsDns;
+public:
+	int secs, millisecs;
+};
+
+class DllExp DimRpc
+{
+public :
+
+	// The object contains the value to be published. Service to be updated with an argument of same type;
+	DimRpc();
+
+	DimRpc(const char *name, const char *formatin, const char *formatout);
+
+	DimRpc(DimServerDns *dns, const char *name, const char *formatin, const char *formatout);
+
+	// Desctructor
+	virtual ~DimRpc();
+
+	void *itsDataIn;
+	int itsSizeIn;
+	void *getData();
+	int getInt();
+	float getFloat();
+	double getDouble();
+	longlong getLonglong();
+	short getShort();
+	char *getString();
+	int getSize();
+
+	void *itsDataOut;
+	int itsDataOutSize;
+	int itsSizeOut;
+
+	void setData(void *data, int size);
+	void setData(int &data);
+	void setData(float &data);
+	void setData(double &data);
+	void setData(longlong &data);
+	void setData(short &data);
+	void setData(char *data);
+
+	virtual void rpcHandler() = 0;
+	// Accessors
+	char *getName();
+	int itsIdIn;
+	int itsIdOut;
+private :
+	int itsTagId;
+	char *itsName;
+	char *itsNameIn;
+	char *itsNameOut;
+	void declareIt(char *name, char *formatin, char *formatout, DimServerDns *dns);
+	void storeIt(void *data, int size);
+	void timerHandler();
+	DimServerDns *itsDns;
+public:
+	int itsKilled;
+	int itsTimeout;
+};
+
+
+#endif
+
Index: /trunk/FACT++/dim_v19r15/dim/dllist.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/dllist.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/dllist.hxx	(revision 10183)
@@ -0,0 +1,105 @@
+#ifndef __DLLHHDEFS
+#define __DLLHHDEFS
+
+class DllExp DLLItem {
+	friend class DLList ;
+	DLLItem *next;
+	DLLItem *prev;
+public:
+	DLLItem(){
+		next = 0;
+		prev = 0;
+	};
+};
+
+class DllExp DLList {
+	DLLItem *head;
+	DLLItem *curr;
+public:
+	DLList (){
+		DISABLE_AST
+		head = new DLLItem();
+		head->next = head;
+		head->prev = head;
+		curr = head;
+		ENABLE_AST
+	}
+	~DLList()
+	{
+		DISABLE_AST
+		delete head;
+		ENABLE_AST
+	}
+    void add(DLLItem *item)
+	{
+		DLLItem *prevp;
+		DISABLE_AST
+		item->next = head;
+		prevp = head->prev;
+		item->prev = prevp;
+		prevp->next = item;
+		head->prev = item;
+		ENABLE_AST
+	}
+	DLLItem *getHead()
+	{
+		DISABLE_AST
+		if(head->next == head)
+		{
+			ENABLE_AST
+			return((DLLItem *)0);
+		}
+		curr = head->next;
+		ENABLE_AST
+		return( head->next );
+	}
+	DLLItem *getLast()
+	{
+		DISABLE_AST
+		if(head->prev == head)
+		{
+			ENABLE_AST
+			return((DLLItem *)0);
+		}
+		curr = head->prev;
+		ENABLE_AST
+		return( head->prev );
+	}
+	DLLItem *getNext()
+	{
+		DISABLE_AST
+		curr = curr->next;
+		if(curr == head)
+		{
+			ENABLE_AST
+			return((DLLItem *)0);
+		}
+		ENABLE_AST
+		return( curr );
+	}
+	DLLItem *removeHead()
+	{
+		DLLItem *item;
+		DISABLE_AST
+		item = head->next;
+		if(item == head)
+		{
+			ENABLE_AST
+			return((DLLItem *)0);
+		}
+		remove(item);
+		ENABLE_AST
+		return(item);
+	}
+	void remove(DLLItem *item)
+	{
+		DLLItem *prevp, *nextp;
+		DISABLE_AST
+		prevp = item->prev;
+		nextp = item->next;
+		prevp->next = item->next;
+		nextp->prev = prevp;
+		ENABLE_AST
+	}
+};
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/sllist.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/sllist.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/sllist.hxx	(revision 10183)
@@ -0,0 +1,84 @@
+#ifndef __SLLHHDEFS
+#define __SLLHHDEFS
+
+class DllExp SLLItem {
+	friend class SLList ;
+	SLLItem *next;
+public:
+	SLLItem(){
+		next = 0;
+	};
+};
+
+class DllExp SLList {
+	SLLItem *head;
+	SLLItem *curr;
+public:
+	SLList (){
+		DISABLE_AST
+		head = new SLLItem();
+		curr = head;
+		ENABLE_AST
+	}
+	~SLList()
+	{
+		DISABLE_AST
+		delete head;
+		ENABLE_AST
+	}
+    void add(SLLItem *itemptr)
+	{
+		DISABLE_AST
+		SLLItem *ptr = head;
+		while(ptr->next)
+		{
+			ptr = ptr->next;
+		}
+		ptr->next = itemptr;
+		ENABLE_AST
+	}
+	SLLItem *getHead()
+	{
+		curr = head->next;
+		return( head->next );
+	}
+	SLLItem *getNext()
+	{
+		DISABLE_AST
+		if(!curr)
+			curr = head;
+		curr = curr->next;
+		ENABLE_AST
+		return( curr );
+	}
+	SLLItem *removeHead()
+	{
+		SLLItem *ptr;
+
+		DISABLE_AST
+		ptr = head->next;
+		if(ptr)
+		{
+			head->next = ptr->next;
+			curr = head->next;
+		}
+		ENABLE_AST
+		return( ptr);
+	}
+	void remove(SLLItem *itemptr)
+	{
+		SLLItem *ptr = head, *prev;
+		DISABLE_AST
+		while(ptr->next)
+		{
+			prev = ptr;
+			ptr = ptr->next;
+			if( itemptr == ptr )
+			{
+				prev->next = ptr->next;
+			}
+		}
+		ENABLE_AST
+	}
+};
+#endif
Index: /trunk/FACT++/dim_v19r15/dim/tokenstring.hxx
===================================================================
--- /trunk/FACT++/dim_v19r15/dim/tokenstring.hxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/dim/tokenstring.hxx	(revision 10183)
@@ -0,0 +1,31 @@
+#ifndef __TOKENSTRINGDEFS
+#define __TOKENSTRINGDEFS
+#include <string.h>
+#include "dim_core.hxx"
+
+class DllExp TokenString
+{
+public:
+
+	TokenString(char *str);
+	TokenString(char *str, char *seps);
+	~TokenString();
+	int getToken(char *&token);
+	void pushToken();
+	void popToken();
+	int cmpToken(char *str);
+	int firstToken();
+	int getNTokens();
+	int getNTokens(char *str);
+
+private:
+	void store_str(char *str);
+	char *token_buff;
+	char *token_ptr;
+	char *curr_token_ptr;
+	char *push_token_ptr;
+	char *token_seps;
+	int n_tokens;
+};
+
+#endif
Index: /trunk/FACT++/dim_v19r15/makefile
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile	(revision 10183)
@@ -0,0 +1,26 @@
+#
+# global makefile
+#
+
+GUI = yes
+
+all:
+	echo " "; echo " " ; echo ==dim==; $(MAKE) -f makefile_dim all
+	echo " "; echo " " ; echo ==utilities==; $(MAKE) -f makefile_util all
+	echo " "; echo " " ; echo ==examples==; $(MAKE) -f makefile_examples all
+ifneq ($(GUI),no)
+	echo " "; echo " " ; echo ==did==; $(MAKE) THREADS=no -f makefile_did all
+endif
+
+# Test, if ODIR is set before trying to clean up.
+ifneq ($(ODIR),)
+clean:
+	/bin/rm -f $(ODIR)/*.o core *~
+	cd src; /bin/rm -f core *~
+	cd src/did; /bin/rm -f core *~
+	cd src/examples; /bin/rm -f core *~
+	cd src/util; /bin/rm -f core *~
+
+realclean:	clean
+		/bin/rm -f $(ODIR)/*
+endif
Index: /trunk/FACT++/dim_v19r15/makefile_benchmark
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile_benchmark	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile_benchmark	(revision 10183)
@@ -0,0 +1,24 @@
+#
+# benchmark makefile
+#
+
+include makefile_common
+
+SDIR = ./src/benchmark
+
+LIBS = $(EXTRALIBS)
+
+all:	$(ODIR)/benchServer $(ODIR)/benchClient
+$(ODIR)/benchServer:	$(SDIR)/benchServer.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(CFLAGS) $(LDFLAGS) $(SDIR)/benchServer.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/benchServer $(LIBS)
+	
+$(ODIR)/benchClient:	$(SDIR)/benchClient.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(CFLAGS) $(LDFLAGS) $(SDIR)/benchClient.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/benchClient $(LIBS)
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/makefile_common
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile_common	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile_common	(revision 10183)
@@ -0,0 +1,115 @@
+CC = cc
+CXX = CC
+
+CPP = yes
+THREADS=yes
+MORECONNS=yes
+SHAREABLE=
+32BITS=no
+
+IDIR = ./dim
+
+EXTRALIBS = 
+FLAGS = 
+
+CFLAGS = $(FLAGS) -g -I$(IDIR)
+EXCFLAGS = $(FLAGS) -g -I$(IDIR) 
+LIBFLAGS =
+X64 = no
+
+ifeq ($(BITS32),yes)
+	32BITS = yes
+endif
+
+ifeq ($(32BITS),yes)
+	CFLAGS += -m32
+	LIBFLAGS += -m32
+	EXCFLAGS += -m32
+	X64 = no
+else
+	X64 = yes
+endif
+
+ifeq ($(OS),SunOS)
+	CFLAGS += -DMIPSEB -DPROTOCOL=1 -Dsunos
+endif
+ifeq ($(OS),Solaris)
+ifeq ($(THREADS),yes)
+	CFLAGS += -mt
+	EXCFLAGS += -mt
+	EXTRALIBS += -lposix4
+endif
+	SHAREABLE = no
+	LIBFLAGS += -G 
+	EXTRALIBS += -lsocket -lnsl
+	CFLAGS += -DMIPSEB -DPROTOCOL=1 -Dsolaris 
+	RANLIB = echo
+endif
+ifeq ($(OS),HP-UX)
+	THREADS = no
+	SHAREABLE = no
+	CFLAGS += -DMIPSEB -DPROTOCOL=1 -Dhpux
+endif
+ifeq ($(OS),OSF1)
+	THREADS = no
+	SHAREABLE = no
+	CFLAGS += -DMIPSEL -DPROTOCOL=1 -Dosf
+endif
+ifeq ($(OS),AIX)
+	THREADS = no
+	SHAREABLE = no
+	CFLAGS += -DMIPSEB -DPROTOCOL=1 -Dunix -D_BSD -Daix
+endif
+ifeq ($(OS),LynxOS)
+	SHAREABLE = no
+ifeq ($(ARCH),RAID)
+	CFLAGS += -I/usr/include/bsd -I/usr/include/posix -DMIPSEB -DPROTOCOL=1 -Dunix -DLYNXOS -DRAID
+	EXTRALIBS += -L/usr/posix/usr/lib -lbsd
+else
+ifeq ($(ARCH),INTEL)
+	CC = gcc
+	CXX = g++
+	CFLAGS += -DMIPSEL -DPROTOCOL=1 -Dunix -DLYNXOS -mthreads
+	EXCFLAGS += -mthreads
+	EXTRALIBS += -lbsd
+else
+	CC = gcc
+	CXX = g++
+# May need to add -U__Lynx__ flag for LynxOS 2.5.1 (M68040)
+	CFLAGS += -DMIPSEB -DPROTOCOL=1 -Dunix -DLYNXOS -mthreads
+	EXCFLAGS += -mthreads
+	EXTRALIBS += -lbsd
+endif
+endif
+endif
+ifeq ($(OS),Linux)
+	CC = gcc
+	CXX = g++
+ifeq ($(ARCH),PPC)
+	CFLAGS +=  -Wall -DMIPSEB -DPROTOCOL=1 -Dunix -Dlinux -DNOMORECONNS -fPIC
+else
+	CFLAGS +=  -Wall -Wextra -DMIPSEL -DPROTOCOL=1 -Dunix -Dlinux -fPIC
+	EXCFLAGS +=  -Wall -Wextra
+endif
+ifeq ($(MORECONNS),no)
+	CFLAGS += -DNOMORECONNS
+endif
+ifneq ($(SHAREABLE),no)
+	SHAREABLE = yes
+	LIBFLAGS += -shared
+endif
+endif
+ifeq ($(OS),Darwin)
+	CC = gcc
+	CXX = g++
+	SHAREABLE = no
+	CFLAGS += -DMIPSEB -DPROTOCOL=1 -Dunix -Dlinux -Ddarwin -DNOMORECONNS -fPIC
+endif
+
+ifneq ($(THREADS),yes)
+	CFLAGS += -DNOTHREADS
+else
+ifneq ($(OS), LynxOS)
+	EXTRALIBS += -lpthread
+endif
+endif
Index: /trunk/FACT++/dim_v19r15/makefile_did
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile_did	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile_did	(revision 10183)
@@ -0,0 +1,87 @@
+
+#
+# did makefile
+#
+
+include makefile_common
+
+SDIR = ./src/did
+
+CFLAGS += -I$(SDIR) -I$(MOTIFINC) -I$(X11INC) -L$(MOTIFLIB) -L$(X11LIB) $(EXTRAMOTIFFLAGS)
+
+EXTRAMOTIFFLAGS =
+LIBS = $(EXTRALIBS)
+MORE_FLAGS = $(EXTRALIBS) -lMrm
+
+ifeq ($(OS),SunOS)
+	MOTIFINC = /usr/motif/include
+	MOTIFLIB = /usr/motif/lib
+	X11INC = /usr/X11R5/include/X11
+	X11LIB = /usr/X11R5/lib
+	UILC = /usr/motif/bin/uil
+endif
+ifeq ($(OS),Solaris)
+	MOTIFINC = /usr/dt/include
+	MOTIFLIB = /usr/dt/lib
+	X11INC = /usr/openwin/include
+	X11LIB = /usr/openwin/lib
+	MORE_FLAGS += -lposix4
+#	MORE_FLAGS += -R$(MOTIFLIB):$(X11LIB) -lMrm
+#	UILC = /usr/local/motif/bin/uil
+#	UILC = /usr/dt/bin/uil
+endif
+ifeq ($(OS),HP-UX)
+	MOTIFINC = /usr/include/Motif1.2
+	MOTIFLIB = /usr/lib/Motif1.2
+	X11INC = /usr/include/X11R5
+	X11LIB = /usr/lib/X11R5
+	MORE_FLAGS += -l:libMrm.a
+endif
+ifeq ($(OS),OSF1)
+	MOTIFINC = .
+	MOTIFLIB = .
+	X11INC = .
+	X11LIB = .
+endif
+ifeq ($(OS),AIX)
+	MOTIFINC = /usr/include/Motif1.2
+	MOTIFLIB = /usr/lib/Motif1.2
+	X11INC = /usr/include/X11R5
+	X11LIB = /usr/lib/X11R5
+endif
+ifeq ($(OS),Linux)
+	MOTIFINC = /usr/local/include
+	MOTIFLIB = /usr/local/lib
+	X11INC = /usr/X11R6/include
+ifeq ($(X64),yes)
+	X11LIB = /usr/X11R6/lib64
+else
+	X11LIB = /usr/X11R6/lib
+endif
+	MORE_FLAGS += -lpthread
+endif
+ifeq ($(OS),Darwin)
+	MOTIFINC = /sw/include
+	MOTIFLIB = /sw/lib
+	X11INC = /usr/X11R6/include
+	X11LIB = /usr/X11R6/lib
+endif
+
+all:	$(ODIR)/did
+
+$(ODIR)/dui_util.o:	$(SDIR)/dui_util.c $(SDIR)/dui_util.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dui_util.o -c $(SDIR)/dui_util.c
+
+$(ODIR)/did.o:	$(SDIR)/did.c $(SDIR)/did.h
+	$(CC) $(CFLAGS) -o $(ODIR)/did.o -c $(SDIR)/did.c
+
+$(ODIR)/did: $(ODIR)/did.o $(ODIR)/dui_util.o $(ODIR)/libdim.a
+	$(CC) $(CFLAGS) $(ODIR)/did.o $(ODIR)/dui_util.o $(MORE_FLAGS) -lXm -lXt -lX11 -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/did
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/makefile_dim
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile_dim	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile_dim	(revision 10183)
@@ -0,0 +1,106 @@
+#
+# dim makefile
+#
+
+include makefile_common
+
+JDIM = no
+
+ARCH = 
+SDIR = ./src
+
+ifeq ($(CPP),yes)
+OBJS = $(ODIR)/diccpp.o $(ODIR)/discpp.o $(ODIR)/dimcpp.o $(ODIR)/tokenstring.o $(ODIR)/dic.o $(ODIR)/dis.o $(ODIR)/dna.o
+else
+OBJS = $(ODIR)/dic.o $(ODIR)/dis.o $(ODIR)/dna.o
+endif
+
+UTILOBJS = $(ODIR)/sll.o $(ODIR)/dll.o $(ODIR)/hash.o $(ODIR)/swap.o $(ODIR)/copy_swap.o $(ODIR)/open_dns.o $(ODIR)/conn_handler.o
+
+UNIXOBJS = $(ODIR)/tcpip.o $(ODIR)/dtq.o $(ODIR)/dim_thr.o $(ODIR)/utilities.o
+
+JOBJS =  $(ODIR)/dim_jni.o
+
+RANLIB = ranlib
+
+ifeq ($(SHAREABLE),no)
+all:	$(ODIR)/libdim.a $(ODIR)/dns
+else
+ifeq ($(JDIM),yes)
+ifdef JDK_INCLUDE
+all:	$(ODIR)/libdim.a $(ODIR)/libdim.so $(ODIR)/libjdim.so $(ODIR)/dns
+else
+all:
+	echo "Please define JDK_INCLUDE";
+endif
+else
+all:	$(ODIR)/libdim.a $(ODIR)/libdim.so $(ODIR)/dns
+endif
+endif
+
+$(ODIR)/libdim.a:	$(OBJS) $(UTILOBJS) $(UNIXOBJS)
+	ar crv $(ODIR)/libdim.a $(OBJS) $(UTILOBJS) $(UNIXOBJS)
+	$(RANLIB) $(ODIR)/libdim.a
+
+$(ODIR)/libdim.so:	$(OBJS) $(UTILOBJS) $(UNIXOBJS)
+	$(CXX) $(LIBFLAGS) $(OBJS) $(UTILOBJS) $(UNIXOBJS) -o $(ODIR)/libdim.so
+
+$(ODIR)/libjdim.so:	$(OBJS) $(UTILOBJS) $(UNIXOBJS) $(JOBJS)
+	$(CXX) $(LIBFLAGS) $(OBJS) $(UTILOBJS) $(UNIXOBJS) $(JOBJS) -lgcc -o $(ODIR)/libjdim.so
+
+$(ODIR)/dns:	$(ODIR)/dns.o $(ODIR)/libdim.a
+	$(CC) $(CFLAGS) -L$(ODIR) $(ODIR)/dns.o -ldim -o $(ODIR)/dns $(EXTRALIBS)
+
+clean:
+	/bin/rm -f $(OBJS) $(UTILOBJS) $(UNIXOBJS) $(ODIR)/dns.o core *~
+	cd $(SDIR); /bin/rm -f core *~
+
+realclean:	clean
+		/bin/rm -f $(ODIR)/libdim.a $(ODIR)/dns
+
+$(ODIR)/dns.o:		$(SDIR)/dns.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dns.o -c $(SDIR)/dns.c
+$(ODIR)/dis.o:		$(SDIR)/dis.c $(IDIR)/dim.h $(IDIR)/dis.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dis.o -c $(SDIR)/dis.c
+$(ODIR)/dic.o:		$(SDIR)/dic.c $(IDIR)/dim.h $(IDIR)/dic.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dic.o -c $(SDIR)/dic.c
+$(ODIR)/dna.o:		$(SDIR)/dna.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dna.o -c $(SDIR)/dna.c
+$(ODIR)/diccpp.o:	$(SDIR)/diccpp.cxx
+	$(CXX) $(CFLAGS) -o $(ODIR)/diccpp.o -c $(SDIR)/diccpp.cxx
+$(ODIR)/discpp.o:	$(SDIR)/discpp.cxx
+	$(CXX) $(CFLAGS) -o $(ODIR)/discpp.o -c $(SDIR)/discpp.cxx
+$(ODIR)/dimcpp.o:	$(SDIR)/dimcpp.cxx
+	$(CXX) $(CFLAGS) -o $(ODIR)/dimcpp.o -c $(SDIR)/dimcpp.cxx
+$(ODIR)/tokenstring.o:	$(SDIR)/tokenstring.cxx
+	$(CXX) $(CFLAGS) -o $(ODIR)/tokenstring.o -c $(SDIR)/tokenstring.cxx
+
+
+$(ODIR)/sll.o:		$(SDIR)/sll.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/sll.o -c $(SDIR)/sll.c
+$(ODIR)/dll.o:		$(SDIR)/dll.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dll.o -c $(SDIR)/dll.c
+$(ODIR)/hash.o:		$(SDIR)/hash.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/hash.o -c $(SDIR)/hash.c
+$(ODIR)/swap.o:		$(SDIR)/swap.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/swap.o -c $(SDIR)/swap.c
+$(ODIR)/copy_swap.o:	$(SDIR)/copy_swap.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/copy_swap.o -c $(SDIR)/copy_swap.c
+$(ODIR)/open_dns.o:	$(SDIR)/open_dns.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/open_dns.o -c $(SDIR)/open_dns.c
+$(ODIR)/conn_handler.o:	$(SDIR)/conn_handler.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/conn_handler.o -c $(SDIR)/conn_handler.c
+$(ODIR)/dim_jni.o:	$(SDIR)/dim_jni.c $(IDIR)/dim_jni.h
+	$(CC) $(CFLAGS) -I $(JDK_INCLUDE) -I $(JDK_INCLUDE)/$(ODIR) -o $(ODIR)/dim_jni.o -c $(SDIR)/dim_jni.c
+
+
+$(ODIR)/tcpip.o:	$(SDIR)/tcpip.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/tcpip.o -c $(SDIR)/tcpip.c
+$(ODIR)/dtq.o:		$(SDIR)/dtq.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dtq.o -c $(SDIR)/dtq.c
+$(ODIR)/dim_thr.o:	$(SDIR)/dim_thr.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/dim_thr.o -c $(SDIR)/dim_thr.c
+$(ODIR)/utilities.o:	$(SDIR)/utilities.c $(IDIR)/dim.h
+	$(CC) $(CFLAGS) -o $(ODIR)/utilities.o -c $(SDIR)/utilities.c
+
+
Index: /trunk/FACT++/dim_v19r15/makefile_examples
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile_examples	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile_examples	(revision 10183)
@@ -0,0 +1,43 @@
+#
+# test makefile
+#
+
+include makefile_common
+
+SDIR = ./src/examples
+
+LIBS = $(EXTRALIBS)
+
+ifeq ($(CPP),yes)
+all:	$(ODIR)/test_server $(ODIR)/test_client $(ODIR)/testServer $(ODIR)/testClient
+else
+all:	$(ODIR)/test_server $(ODIR)/test_client
+endif
+
+$(ODIR)/test_server:	$(SDIR)/test_server.c $(DIMDIR)/$(ODIR)/libdim.a
+	$(CC) $(EXCFLAGS) $(LDFLAGS) $(SDIR)/test_server.c -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/test_server $(LIBS)
+	
+$(ODIR)/test_client:	$(SDIR)/test_client.c $(DIMDIR)/$(ODIR)/libdim.a
+	$(CC) $(EXCFLAGS) $(LDFLAGS) $(SDIR)/test_client.c -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/test_client $(LIBS)
+	
+$(ODIR)/testServer:	$(SDIR)/test_server.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(EXCFLAGS) $(LDFLAGS) $(SDIR)/test_server.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/testServer $(LIBS)
+	
+$(ODIR)/testClient:	$(SDIR)/test_client.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(EXCFLAGS) $(LDFLAGS) $(SDIR)/test_client.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/testClient $(LIBS)
+
+$(ODIR)/demo_server:	$(SDIR)/demo_server.c $(DIMDIR)/$(ODIR)/libdim.a
+	$(CC) $(EXCFLAGS) $(LDFLAGS) $(SDIR)/demo_server.c -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/demo_server $(LIBS)
+	
+$(ODIR)/demo_client:	$(SDIR)/demo_client.c $(DIMDIR)/$(ODIR)/libdim.a
+	$(CC) $(EXCFLAGS) $(LDFLAGS) $(SDIR)/demo_client.c -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/demo_client $(LIBS)
+	
+
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/makefile_util
===================================================================
--- /trunk/FACT++/dim_v19r15/makefile_util	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/makefile_util	(revision 10183)
@@ -0,0 +1,38 @@
+#
+# utilities makefile
+#
+
+include makefile_common
+
+SDIR = ./src/util
+
+LIBS = $(EXTRALIBS)
+
+ifeq ($(CPP),yes)
+all:	$(ODIR)/dim_send_command $(ODIR)/dim_get_service $(ODIR)/DimBridge $(ODIR)/checkDns $(ODIR)/checkDimServers
+else
+all:	$(ODIR)/dim_send_command $(ODIR)/dim_get_service
+endif
+
+$(ODIR)/dim_get_service: $(SDIR)/dim_get_service.c $(DIMDIR)/$(ODIR)/libdim.a
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SDIR)/dim_get_service.c -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/dim_get_service $(LIBS)
+
+$(ODIR)/dim_send_command: $(SDIR)/dim_send_command.c $(DIMDIR)/$(ODIR)/libdim.a
+	$(CC) $(CFLAGS) $(LDFLAGS) $(SDIR)/dim_send_command.c -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/dim_send_command $(LIBS)
+
+$(ODIR)/DimBridge:	$(SDIR)/dimbridge.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(CFLAGS) $(LDFLAGS) $(SDIR)/dimbridge.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/DimBridge $(LIBS)
+
+$(ODIR)/checkDns:	$(SDIR)/check_dns.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(CFLAGS) $(LDFLAGS) $(SDIR)/check_dns.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/checkDns $(LIBS)
+
+$(ODIR)/checkDimServers:	$(SDIR)/check_dim_servers.cxx $(DIMDIR)/$(ODIR)/libdim.a
+	$(CXX) $(CFLAGS) $(LDFLAGS) $(SDIR)/check_dim_servers.cxx -L$(DIMDIR)/$(ODIR) -ldim -o $(ODIR)/checkDimServers $(LIBS)
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/setup.sh
===================================================================
--- /trunk/FACT++/dim_v19r15/setup.sh	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/setup.sh	(revision 10183)
@@ -0,0 +1,74 @@
+#
+# bash version of .setup file coming with dim distribution
+# Tested on Linux 7.3 by A.Formica
+#
+POSSOSVALUES=HP-UX,AIX,OSF1,SunOS,Solaris,LynxOS,Linux,Darwin
+echo $POSSOSVALUES
+if [ ! -z $OS ]; then
+    echo OS is set to $OS
+    TEMP=$OS
+    echo $POSSOSVALUES | grep $TEMP > /dev/null
+    if [ $? != 0 ]; then
+        echo "Unknown OS... setup failed"
+        echo "Possible values are: $POSSOSVALUES"
+		return 1
+    fi
+else
+   echo "Variable OS must be defined... setup failed"
+   echo "Possible values are: $POSSOSVALUES"
+   return 1
+fi
+
+if [ "${OS}" == "Solaris" ]; then
+    path=(/usr/ccs/bin:$path)
+	echo "Update path " $path
+fi
+
+if [ ! -z $DIMDIR ]; then
+	echo DIMDIR is set to $DIMDIR
+else
+	export DIMDIR=`pwd`
+	echo DIMDIR is set to $DIMDIR
+fi
+
+if [ ! -z $ODIR ]; then
+    echo ODIR is set to $ODIR
+else
+	echo "ODIR not defined"
+	case $OS in 
+	   HP)      export ODIR=hp;; 
+	   AIX) 	export ODIR=aix;;
+	   OSF1)	export ODIR=osf;;
+	   SunOS)	export ODIR=sunos;;
+	   Solaris) export ODIR=solaris;;
+	   LynxOS)  export ODIR=lynxos;;
+	   Linux)	export ODIR=linux;;
+	   Darwin)	export ODIR=darwin;;
+	   *)  echo "Unknown OS... setup failed"; return 1;;
+	esac
+	echo "...setting ODIR to $ODIR"
+fi
+
+if [ "${OS}" == "Linux" ]; then
+if [ -z $LD_LIBRARY_PATH ]; then
+    export LD_LIBRARY_PATH=${DIMDIR}/${ODIR}
+else
+    export LD_LIBRARY_PATH=${DIMDIR}/${ODIR}:$LD_LIBRARY_PATH
+fi
+fi
+
+alias TestServer=$DIMDIR/$ODIR/testServer
+alias TestClient=$DIMDIR/$ODIR/testClient
+alias Test_server=$DIMDIR/$ODIR/test_server
+alias Test_client=$DIMDIR/$ODIR/test_client
+alias Dns=$DIMDIR/$ODIR/dns
+alias Dim_get_service=$DIMDIR/$ODIR/dim_get_service
+alias Dim_send_command=$DIMDIR/$ODIR/dim_send_command
+alias DimBridge=$DIMDIR/$ODIR/DimBridge
+alias Did=$DIMDIR/$ODIR/did
+
+if [ ! -d $DIMDIR/$ODIR ]; then
+   mkdir $DIMDIR/$ODIR
+   echo Created Directory: $DIMDIR/$ODIR 
+fi
+
Index: /trunk/FACT++/dim_v19r15/src/benchmark/benchClient.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/benchmark/benchClient.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/benchmark/benchClient.cxx	(revision 10183)
@@ -0,0 +1,67 @@
+#include <iostream>
+using namespace std;
+#include <dic.hxx>
+
+#define TEST_TIME 10
+
+char ServerName[128];
+int MsgSize;
+int Done = 0;
+int NReceived;
+
+class Service : public DimInfo
+{
+	void infoHandler()
+	{
+	  if(!Done)
+	  {
+		MsgSize = getSize();
+		strcpy(ServerName, DimClient::getServerName());
+		Done = 1;
+	  }
+	  NReceived++;
+	}
+public :
+	Service(char *name) : DimInfo(name,"--") {/*nReceived = 0;*/}
+};
+
+int main(int argc, char *argv[])
+{
+	int i, nServices = 0;
+	Service **services;
+	float mps,tpm;
+	DimBrowser br;
+	char *name, *format, *cltptr, *srvptr, clientName[128];
+
+	br.getServices("BENCH_SERVICE_*");
+
+	while(br.getNextService(name, format)!= 0)
+	{
+		nServices++;
+	}
+	services = new Service*[nServices];
+	i = 0;
+	while(br.getNextService(name, format)!= 0)
+	{
+	  services[i++] = new Service(name);
+	}
+	dic_get_id(clientName);
+	if(cltptr = strchr(clientName,'@'))
+		cltptr++;
+	sleep(5);
+	NReceived = 0;
+
+	sleep(TEST_TIME);
+
+	mps = NReceived/TEST_TIME;
+	if(srvptr = strchr(ServerName,'@'))
+		srvptr++;
+	cout << "Benchmark from "<< srvptr << " to " << cltptr << " :" << endl;
+	cout << "Server publishes " << nServices << " services of " << MsgSize << " bytes each"<< endl;
+	cout << "Result :" << endl;
+	cout << "\tMessages/s = " << mps << endl;
+	tpm = 1/(float)mps*1000;
+	cout << "\tTime(ms)/message = " << tpm << endl;
+	cout << "\tThroughput (Kb/s) = " << mps*MsgSize/1024 << endl;
+	return 1;
+}
Index: /trunk/FACT++/dim_v19r15/src/benchmark/benchServer.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/benchmark/benchServer.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/benchmark/benchServer.cxx	(revision 10183)
@@ -0,0 +1,34 @@
+#include <iostream>
+#include <dis.hxx>
+#ifdef WIN32
+#include <process.h>
+#endif
+
+int main(int argc, char *argv[])
+{
+	int i, msgSize, nServices, pid;
+	char *msg, servName[64];
+	DimService **services;
+
+	sscanf(argv[1],"%d",&msgSize);
+	sscanf(argv[2],"%d",&nServices);
+	msg = new char[msgSize];
+	services = new DimService*[nServices];
+	
+	pid = getpid();
+	for(i = 0; i < nServices; i++)
+	{
+	  sprintf(servName,"BENCH_SERVICE_%d_%03d",pid, i);
+	  services[i] = new DimService(servName, "C", msg, msgSize);
+	}
+	sprintf(servName,"BENCH_%d",pid);
+	DimServer::start(servName);
+	while(1)
+	{
+	  for(i = 0; i < nServices; i++)
+	  {
+	    services[i]->updateService();
+	  }
+	}
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/benchmark/bigClient.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/benchmark/bigClient.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/benchmark/bigClient.cxx	(revision 10183)
@@ -0,0 +1,69 @@
+#include <dic.hxx>
+
+class Service : public DimInfo
+{
+  int n_bad;
+  int n_good;
+
+	void infoHandler()
+	{
+	  char *ptr;
+	  ptr = (char *)getData();
+	  //	  cout << getName() << " received " << ptr << endl;
+	  if(ptr[0] == '-')
+	    {
+	      n_bad = 1;
+	      n_good = 0;
+	    }
+	  if(ptr[0] == 'h')
+	    {
+	      n_good = 1;
+	      n_bad = 0;
+	    }
+	}
+public :
+	Service(char *name) : DimInfo(name,"--") 
+		{n_bad = 0; n_good = 0;}
+	int getNgood() {return n_good;}
+	int getNbad() {return n_bad;}
+};
+
+
+int main(int argc, char *argv[])
+{
+	int i, n, msgSize, nServices = 0;
+	Service **services;
+	float mps,tpm;
+	DimBrowser br;
+	char name[132], *format;
+
+	sscanf(argv[1],"%d",&nServices);
+	services = new Service*[nServices];
+	for(i = 0; i < nServices; i++)
+	{
+	  services[i] = 0;
+	}
+	for(i = 0; i < nServices; i++)
+	{
+	  sprintf(name,"BENCH_SERVICE_%03d",i);
+	  services[i] = new Service(name);
+	}
+	while(1)
+	  {
+	    sleep(10);
+	    n = 0;
+	    for(i = 0; i < nServices; i++)
+	      {
+		if(services[i])
+		  n += services[i]->getNgood();
+	      }
+	    cout << "N Good = "<< n << endl;
+	    n = 0;
+	    for(i = 0; i < nServices; i++)
+	      {
+		if(services[i])
+		  n += services[i]->getNbad();
+	      }
+	    cout << "N bad = "<< n << endl;
+	}
+}
Index: /trunk/FACT++/dim_v19r15/src/benchmark/bigServer.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/benchmark/bigServer.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/benchmark/bigServer.cxx	(revision 10183)
@@ -0,0 +1,35 @@
+#include <dis.hxx>
+#ifdef WIN32
+#include <process.h>
+#endif
+
+int main(int argc, char *argv[])
+{
+	int i, msgSize, nServices, pid;
+	char *msg, servName[64];
+	DimService **services;
+
+	sscanf(argv[1],"%d",&msgSize);
+	sscanf(argv[2],"%d",&nServices);
+	msg = new char[msgSize];
+	strcpy(msg,"hello");
+	services = new DimService*[nServices];
+	
+	pid = getpid();
+	for(i = 0; i < nServices; i++)
+	{
+	  //	  sprintf(servName,"BENCH_SERVICE_%d_%03d",pid, i);
+	  sprintf(servName,"BENCH_SERVICE_%03d",i);
+	  services[i] = new DimService(servName, "C", msg, msgSize);
+	}
+	sprintf(servName,"BENCH_%d",pid);
+	DimServer::start(servName);
+	while(1)
+	{
+	  for(i = 0; i < nServices; i++)
+	  {
+	    services[i]->updateService();
+	  }
+	}
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/conn_handler.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/conn_handler.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/conn_handler.c	(revision 10183)
@@ -0,0 +1,219 @@
+/*
+ * DNA (Delphi Network Access) implements the network layer for the DIM
+ * (Delphi Information Managment) System.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+/* This module can only handle one type of array, and DIC or DNS.
+ * It cannot handle both simultaniously. It handles at same time
+ * the NET and DNA array's. Although these have to be explicitly
+ * created.
+ */
+
+#define DIMLIB
+#include <dim.h>
+
+static SRC_TYPES My_type;		/* Var. indicating type DIC or DIS */
+
+#ifdef VMS
+DIM_NOSHARE DNS_CONNECTION *Dns_conns;
+DIM_NOSHARE DIC_CONNECTION *Dic_conns;
+DIM_NOSHARE DNA_CONNECTION *Dna_conns;
+DIM_NOSHARE NET_CONNECTION *Net_conns;
+DIM_NOSHARE int Curr_N_Conns;
+#else
+DllExp DIM_NOSHARE DNS_CONNECTION *Dns_conns = 0;
+DIM_NOSHARE DIC_CONNECTION *Dic_conns = 0;
+DllExp DIM_NOSHARE DNA_CONNECTION *Dna_conns = 0;
+DllExp DIM_NOSHARE NET_CONNECTION *Net_conns = 0;
+DllExp DIM_NOSHARE int Curr_N_Conns = 0;
+#endif
+
+typedef struct id_item
+{
+	void *ptr;
+	SRC_TYPES type;
+}ID_ITEM;
+
+static ID_ITEM *Id_arr;
+/*
+static void **Id_arr;
+*/
+static int Curr_N_Ids = 0;
+static int Curr_id = 1;
+
+void conn_arr_create(SRC_TYPES type)
+{
+
+	if( Curr_N_Conns == 0 )
+		Curr_N_Conns = CONN_BLOCK;
+
+	switch(type)
+	{
+	case SRC_DIC :
+		Dic_conns = (DIC_CONNECTION *)
+				calloc( Curr_N_Conns, sizeof(DIC_CONNECTION) );
+		My_type = type;
+		break;
+	case SRC_DNS :
+		Dns_conns = (DNS_CONNECTION *)
+				calloc( Curr_N_Conns, sizeof(DNS_CONNECTION) );
+		My_type = type;
+		break;
+	case SRC_DNA :
+		Dna_conns = (DNA_CONNECTION *)
+				calloc( Curr_N_Conns, sizeof(DNA_CONNECTION) );
+		Net_conns = (NET_CONNECTION *)
+				calloc( Curr_N_Conns, sizeof(NET_CONNECTION) );
+		break;
+	default:
+		break;
+	}
+}
+
+
+int conn_get()
+{
+	register DNA_CONNECTION *dna_connp;
+	int i, n_conns, conn_id;
+
+	DISABLE_AST
+	for( i = 1, dna_connp = &Dna_conns[1]; i < Curr_N_Conns; i++, dna_connp++ )
+	{
+		if( !dna_connp->busy )
+		{
+			dna_connp->busy = TRUE;
+			ENABLE_AST
+			return(i);
+		}
+	}
+	n_conns = Curr_N_Conns + CONN_BLOCK;
+	Dna_conns = arr_increase( Dna_conns, sizeof(DNA_CONNECTION), n_conns );
+	Net_conns = arr_increase( Net_conns, sizeof(NET_CONNECTION), n_conns );
+	switch(My_type)
+	{
+	case SRC_DIC :
+		Dic_conns = arr_increase( Dic_conns, sizeof(DIC_CONNECTION),
+					  n_conns );
+		break;
+	case SRC_DNS :
+		Dns_conns = arr_increase( Dns_conns, sizeof(DNS_CONNECTION),
+					  n_conns );
+		break;
+	default:
+		break;
+	}
+	conn_id = Curr_N_Conns;
+	Curr_N_Conns = n_conns;
+	Dna_conns[conn_id].busy = TRUE;
+	ENABLE_AST
+	return(conn_id);
+}
+
+
+void conn_free(int conn_id)
+{
+	DISABLE_AST
+	Dna_conns[conn_id].busy = FALSE;
+	ENABLE_AST
+}
+
+
+void *arr_increase(void *conn_ptr, int conn_size, int n_conns)
+{
+	register char *new_ptr;
+
+	new_ptr = realloc( conn_ptr, conn_size * n_conns );
+	memset( new_ptr + conn_size * Curr_N_Conns, 0, conn_size * CONN_BLOCK );
+	return(new_ptr);
+}
+
+void id_arr_create()
+{
+
+	Curr_N_Ids = ID_BLOCK;
+	Id_arr = (void *) calloc( Curr_N_Ids, sizeof(ID_ITEM));
+}
+
+
+void *id_arr_increase(void *id_ptr, int id_size, int n_ids)
+{
+	register char *new_ptr;
+
+	new_ptr = realloc( id_ptr, id_size * n_ids );
+	memset( new_ptr + id_size * Curr_N_Ids, 0, id_size * ID_BLOCK );
+	return(new_ptr);
+}
+
+int id_get(void *ptr, SRC_TYPES type)
+{
+	register int i, id;
+	register ID_ITEM *idp;
+
+	DISABLE_AST
+	if(!Curr_N_Ids)
+	{
+		id_arr_create();
+	}
+	for( i = Curr_id, idp = &Id_arr[Curr_id]; i < Curr_N_Ids; i++, idp++ )
+	{
+		if( !idp->type )
+		{
+			idp->ptr = ptr;
+			idp->type = type;
+			Curr_id = i;
+			ENABLE_AST
+			return(i);
+		}
+	}
+	Id_arr = id_arr_increase( Id_arr, sizeof(ID_ITEM), Curr_N_Ids + ID_BLOCK );
+	id = Curr_N_Ids;
+	idp = &Id_arr[id];
+	idp->ptr = ptr;
+	idp->type = type;
+	Curr_N_Ids += ID_BLOCK;
+	Curr_id = id;
+	ENABLE_AST
+	return(id);
+}
+
+void *id_get_ptr(int id, SRC_TYPES type)
+{
+	ID_ITEM *idp;
+	void *ptr;
+	DISABLE_AST
+
+	if(id >= Curr_N_Ids)
+	{
+		ENABLE_AST
+		return(0);
+	}
+	idp = &Id_arr[id];
+	if(idp->type == type)
+	{
+		ptr = idp->ptr;
+		ENABLE_AST
+		return(ptr);
+	}
+	ENABLE_AST
+	return(0);
+}
+
+void id_free(int id, SRC_TYPES type)
+{
+	ID_ITEM *idp;
+	DISABLE_AST
+
+	idp = &Id_arr[id];
+	if(idp->type == type)
+	{
+		idp->type = 0;
+		idp->ptr = 0;
+	}
+	Curr_id = 1;
+	ENABLE_AST
+}
Index: /trunk/FACT++/dim_v19r15/src/copy_swap.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/copy_swap.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/copy_swap.c	(revision 10183)
@@ -0,0 +1,410 @@
+#define DIMLIB
+#include <dim.h>
+#include <dic.h>
+#include <dis.h>
+
+#ifdef VMS
+#	include <cvtdef.h>
+#endif
+
+#if defined(WIN32) || defined(__unix__)
+#define PADD64
+#endif
+
+#if defined(aix) || defined (LYNXOS)
+#undef PADD64
+#endif
+
+#if defined(__linux__) && !defined (__LP64__)
+#undef PADD64
+#endif
+
+static int Dic_padding = 1;
+static int Dis_padding = 1;
+
+void dic_disable_padding()
+{
+	Dic_padding = 0;
+}
+
+void dis_disable_padding()
+{
+	Dis_padding = 0;
+}
+
+static int get_curr_bytes(int items, int bytes_left, int item_size)
+{
+	int num;
+
+	if(!(num = items))
+	{
+		num = bytes_left;
+	} 
+	else 
+	{
+		num *= item_size;
+	}
+	return num;
+}
+
+#ifdef vms
+		
+static int check_vms_out(flags, format, curr_par_num, buff_out)
+short flags;
+int format, curr_par_num;
+void *buff_out;
+{
+	unsigned int input_code;
+	int i;
+	int num;
+	
+	if(	(flags & IT_IS_FLOAT) && ((format & 0xF0) == IEEE_FLOAT) )
+	{
+		switch(flags & 0x3)
+		{
+			case SWAPL :
+				num = curr_par_num;
+				(int *)buff_out -= num;
+				for( i = 0; i < num; i++) 
+				{
+					cvt$convert_float((void *)buff_out, CVT$K_VAX_F, 
+									(void *)buff_out, CVT$K_IEEE_S,
+									0 );
+					((int *)buff_out)++;
+				}
+				break;
+			case SWAPD :
+#ifdef __alpha
+				input_code = CVT$K_VAX_G;
+#else
+				input_code = CVT$K_VAX_D;
+#endif
+				num = curr_par_num;
+				(double *)buff_out -= num;
+				for( i = 0; i < num; i++ )
+				{
+					cvt$convert_float((void *)buff_out, input_code,
+									(void *)buff_out, CVT$K_IEEE_T,
+									0 );
+					((double *)buff_out)++;
+				}
+				break;
+		}
+	}
+}
+
+
+
+static int check_vms_in(flags, curr_par_num, curr_par_bytes, buff_out)
+short flags;
+int curr_par_num, curr_par_bytes;
+void *buff_out;
+{
+	unsigned int input_code, output_code;
+	int i;
+	int num;
+	
+	if(flags & 0xF0)
+	{
+		switch(curr_par_bytes) 
+		{
+			case SIZEOF_FLOAT :
+				if((flags & 0xF0) == IEEE_FLOAT)
+				{
+					num = curr_par_num;
+					(int *)buff_out -= num;
+					for( i = 0; i<num; i++)
+					{
+						cvt$convert_float((void *)buff_out, CVT$K_IEEE_S,
+										  (void *)buff_out, CVT$K_VAX_F,
+										  0 );
+						((int *)buff_out)++;
+					}
+				}
+				break;
+			case SIZEOF_DOUBLE :
+#ifdef __alpha
+				output_code = CVT$K_VAX_G;
+#else
+				output_code = CVT$K_VAX_D;
+#endif
+				switch(flags & 0xF0)
+				{
+					case VAX_FLOAT:
+						input_code = CVT$K_VAX_D;
+						break;	
+					case AXP_FLOAT:
+						input_code = CVT$K_VAX_G;
+						break;	
+					case IEEE_FLOAT:
+						input_code = CVT$K_IEEE_T;
+						break;	
+				}							
+				num = curr_par_num;
+				(double *)buff_out -= num;
+				for( i = 0; i<num; i++)
+				{
+					cvt$convert_float((void *)buff_out, input_code,
+									  (void *)buff_out, output_code,
+									  0 );
+					((double *)buff_out)++;
+				}
+				break;
+		}
+	}
+}
+
+#endif
+
+static int check_padding(int curr_bytes, int item_size)
+{
+	int num;
+
+	if( (num = curr_bytes % item_size))
+	{
+		num = item_size - num;
+	}
+	return num;
+}
+
+int copy_swap_buffer_out(int format, FORMAT_STR *format_data, void *buff_out, void *buff_in, int size)
+{
+	int num = 0, pad_num = 0, curr_size = 0, curr_out = 0;
+	int next_par_bytes, curr_par_num;
+	
+	if(format){}
+	if(!format_data->par_bytes) {
+		if(buff_in != buff_out)
+			memcpy( buff_out, buff_in, size );
+		return(size);
+	}
+	next_par_bytes = format_data->par_bytes;
+	while(next_par_bytes)
+	{
+		curr_par_num = format_data->par_num;
+		if((curr_size+(curr_par_num * format_data->par_bytes))
+		   > size)
+		{
+			curr_par_num = (size - curr_size)/format_data->par_bytes;
+			next_par_bytes = 0;
+		}
+		switch(format_data->flags & 0x3) 
+		{
+			case NOSWAP :
+
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_CHAR);
+
+				memcpy( buff_out, buff_in, num);
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+			case SWAPS :
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_SHORT);
+
+				if(Dis_padding)
+				{
+					if( (pad_num = check_padding(curr_size, SIZEOF_SHORT)) )
+					{
+						inc_pter( buff_in, pad_num);
+						curr_size += pad_num;
+					}
+				}
+				memcpy( buff_out, buff_in, num);
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+			case SWAPL :
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_LONG);
+
+				if(Dis_padding)
+				{
+					if( (pad_num = check_padding(curr_size, SIZEOF_LONG)) )
+					{
+						inc_pter( buff_in, pad_num);
+						curr_size += pad_num;
+					}
+				}
+				memcpy( buff_out, buff_in, num);
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+			case SWAPD :
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_DOUBLE);
+
+				if(Dis_padding)
+				{
+#ifdef PADD64
+					if( (pad_num = check_padding(curr_size, SIZEOF_DOUBLE)) )
+#else
+					if( (pad_num = check_padding(curr_size, SIZEOF_LONG)) )
+#endif
+					{
+						inc_pter( buff_in, pad_num);
+						curr_size += pad_num;
+					}
+				}
+				memcpy( buff_out, buff_in, num);
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+		}
+#ifdef vms
+		check_vms_out(format_data->flags, format, curr_par_num, buff_out);
+#endif
+		curr_size += num;
+		format_data++;
+		if(next_par_bytes)
+			next_par_bytes = format_data->par_bytes;
+	}
+	return(curr_out);
+}
+
+int copy_swap_buffer_in(FORMAT_STR *format_data, void *buff_out, void *buff_in, int size)
+{
+	int num, pad_num, curr_size = 0, curr_out = 0;
+	int next_par_bytes, curr_par_num, curr_par_bytes;
+	
+	num = 0;
+	if(!format_data->par_bytes) {
+		if(buff_in != buff_out)
+			memcpy( buff_out, buff_in, size );
+		return(size);
+	}
+	next_par_bytes = format_data->par_bytes;
+	while(next_par_bytes)
+	{
+		curr_par_num = format_data->par_num;
+		curr_par_bytes = format_data->par_bytes;
+		if((curr_size+(curr_par_num * curr_par_bytes))
+		   > size)
+		{
+			curr_par_num = (size - curr_size)/curr_par_bytes;
+			next_par_bytes = 0;
+		}
+		switch(format_data->flags & 0x3) 
+		{
+			case NOSWAP :
+
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, curr_par_bytes);
+
+				if(Dic_padding)
+				{
+					if(curr_par_bytes == SIZEOF_DOUBLE)
+					{
+#ifdef PADD64
+						if( (pad_num = check_padding(curr_out, SIZEOF_DOUBLE)) )
+#else
+						if( (pad_num = check_padding(curr_out, SIZEOF_LONG)) )
+#endif
+						{
+							inc_pter( buff_out, pad_num);
+							curr_out += pad_num;
+						}
+					}
+					else
+					{
+						if( (pad_num = check_padding(curr_out, curr_par_bytes)) )
+						{
+							inc_pter( buff_out, pad_num);
+							curr_out += pad_num;
+						}
+					}
+				}
+
+				if(buff_in != buff_out)
+					memcpy( buff_out, buff_in, num);
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+			case SWAPS :
+
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_SHORT);
+
+				if(Dic_padding)
+				{
+					if( (pad_num = check_padding(curr_out, SIZEOF_SHORT)) )
+					{
+						inc_pter( buff_out, pad_num);
+						curr_out += pad_num;
+					}
+				}
+				_swaps_buffer( (short *)buff_out, (short *)buff_in, num/SIZEOF_SHORT) ;
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+			case SWAPL :
+
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_LONG);
+
+				if(Dic_padding)
+				{
+					if( (pad_num = check_padding(curr_out, SIZEOF_LONG)) )
+					{
+						inc_pter( buff_out, pad_num);
+						curr_out += pad_num;
+					}
+				}
+				_swapl_buffer( (short *)buff_out, (short *)buff_in, num/SIZEOF_LONG) ;
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+			case SWAPD :
+
+				num = get_curr_bytes(curr_par_num,
+					size - curr_size, SIZEOF_DOUBLE);
+
+				if(Dic_padding)
+				{
+#ifdef PADD64
+					if( (pad_num = check_padding(curr_out, SIZEOF_DOUBLE)) )
+#else
+					if( (pad_num = check_padding(curr_out, SIZEOF_LONG)) )
+#endif
+					{
+						inc_pter( buff_out, pad_num);
+						curr_out += pad_num;
+					}
+				}
+				_swapd_buffer( (short *)buff_out, (short *)buff_in, num/SIZEOF_DOUBLE) ;
+				inc_pter( buff_in, num);
+				inc_pter( buff_out, num);
+				curr_out += num;
+				break;
+		}
+#ifdef vms
+		check_vms_in(format_data->flags, curr_par_num, curr_par_bytes, buff_out);
+#endif
+		curr_size += num;
+		format_data++;
+		if(next_par_bytes)
+			next_par_bytes = format_data->par_bytes;
+	}
+	return(curr_out);
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/src/dic.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dic.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dic.c	(revision 10183)
@@ -0,0 +1,2264 @@
+
+/*
+ * DIC (Delphi Information Client) Package implements a library of
+ * routines to be used by clients.
+ *
+ * Started on        : 10-11-91
+ * Last modification : 10-08-94
+ * Written by        : C. Gaspar
+ * Adjusted by       : G.C. Ballintijn
+ *
+ */
+
+#ifdef VMS
+#	include <cfortran.h>
+#	include <assert.h>
+#endif
+
+#define DIMLIB
+#include <dim.h>
+#include <dic.h>
+
+/*
+#define DEBUG
+*/
+
+#ifdef VMS
+#define TMP_ENABLE_AST      long int ast_enable = sys$setast(1);
+#define TMP_DISABLE_AST     if (ast_enable != SS$_WASSET) sys$setast(0);
+#endif
+
+#define BAD_CONN_TIMEOUT 10
+
+
+typedef struct bad_conn {
+	struct bad_conn *next;
+	struct bad_conn *prev;
+	DIC_CONNECTION conn;
+	int n_retries;
+	int retrying;
+} DIC_BAD_CONNECTION;
+
+static DIC_SERVICE *Service_pend_head = 0;
+static DIC_SERVICE *Cmnd_head = 0;
+static DIC_SERVICE *Current_server = 0;
+static DIC_BAD_CONNECTION *Bad_connection_head = 0;
+static int Dic_timer_q = 0;
+static int Dns_dic_conn_id = 0;
+static TIMR_ENT *Dns_dic_timr = NULL;
+static int Tmout_max = 0;
+static int Tmout_min = 0;
+static int Threads_off = 0;
+
+static void (*Error_user_routine)() = 0;
+static int Error_conn_id = 0;
+static int Curr_conn_id = 0;
+
+#ifdef DEBUG
+static int Debug_on = 1;
+#else
+static int Debug_on = 0;
+#endif
+
+_DIM_PROTO( unsigned request_service, (char *service_name, int req_type,
+				    int req_timeout, void *service_address,
+				    int service_size, void (*usr_routine)(void*,void*,int*),
+				    long tag, void *fill_addr, int fill_size, int stamped) );
+_DIM_PROTO( int request_command,      (char *service_name, void *service_address,
+				    int service_size, void (*usr_routine)(void*,int*),
+				    long tag, int stamped) );
+_DIM_PROTO( DIC_SERVICE *insert_service, (int type, int timeout, char *name,
+				  int *address, int size, void (*routine)(),
+				  long tag, int *fill_addr, int fill_size,
+				  int pending, int stamped ) );
+_DIM_PROTO( void modify_service, (DIC_SERVICE *servp, int timeout,
+				  int *address, int size, void (*routine)(),
+				  long tag, int *fill_addr, int fill_size, int stamped) );
+_DIM_PROTO( DIC_SERVICE *locate_command, (char *serv_name) );
+_DIM_PROTO( DIC_SERVICE *locate_pending, (char *serv_name) );
+_DIM_PROTO( DIC_BAD_CONNECTION *locate_bad, (char *node, char *task, int port) );
+_DIM_PROTO( void service_tmout,      (int serv_id) );
+_DIM_PROTO( static void request_dns_info,      (int retry) );
+_DIM_PROTO( static int handle_dns_info,      (DNS_DIC_PACKET *) );
+_DIM_PROTO( void close_dns_conn,     (void) );
+_DIM_PROTO( static void release_conn, (int conn_id) );
+_DIM_PROTO( static void get_format_data, (int format, FORMAT_STR *format_data, 
+					char *def) );
+_DIM_PROTO( static void execute_service,      (DIS_PACKET *packet, 
+					DIC_SERVICE *servp, int size) );
+
+void print_packet(DIS_PACKET *packet)
+{
+	dim_print_date_time();
+	printf(" - Bad ID received from server -> Packet received:\n");
+	printf("\tpacket->size = %d\n",vtohl(packet->size));
+	printf("\tpacket->service_id = %d\n",vtohl(packet->service_id));
+}
+
+void dic_set_debug_on()
+{
+	Debug_on = 1;
+}
+
+void dic_set_debug_off()
+{
+	Debug_on = 0;
+}
+
+void dic_no_threads()
+{
+	Threads_off = 1;
+}
+
+void dic_add_error_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Error_user_routine = user_routine;
+	ENABLE_AST
+}
+
+static void error_handler(int conn_id, int severity, int errcode, char *reason)
+{
+	int last_conn_id;
+
+	if(Error_user_routine)
+	{
+			Error_conn_id = conn_id;
+			last_conn_id = Curr_conn_id;
+			(Error_user_routine)(severity, errcode, reason);
+			Error_conn_id = 0;
+			Curr_conn_id = last_conn_id;
+	}
+	else
+	{
+		dim_print_msg(reason, severity);
+		if(severity == 3)
+		{
+			printf("Exiting!\n");
+			exit(2);
+		}
+	}
+}
+
+static void recv_rout( int conn_id, DIS_PACKET *packet, int size, int status )
+{
+	register DIC_SERVICE *servp, *auxp;
+	register DIC_CONNECTION *dic_connp;
+	int service_id, once_only, found = 0;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+	void move_to_notok_service();
+	void do_cmnd_callback();
+	void dim_panic(char *);
+
+	dic_connp = &Dic_conns[conn_id] ;
+	switch( status )
+	{
+	case STA_DISC:
+		if(Debug_on)
+		{
+			dna_get_node_task(conn_id, node, task);
+			dim_print_date_time();
+			printf(" - Conn %d: Server %s on node %s Disconnected\n",
+				conn_id, task, node);
+			fflush(stdout);
+		}
+		if( !(servp = (DIC_SERVICE *) dic_connp->service_head) )
+		{
+			release_conn( conn_id );
+			break;
+		}
+		while( (servp = (DIC_SERVICE *) dll_get_next(
+					(DLL *) dic_connp->service_head,
+				 	(DLL *) servp)) )
+		{
+#ifdef DEBUG
+			printf("\t %s was in the service list\n",servp->serv_name);
+			fflush(stdout);
+#endif
+/*
+	Will be done later by the DNS answer
+			service_tmout( servp->serv_id );
+*/
+			if(!strcmp(dic_connp->task_name,"DIS_DNS"))
+			{
+				service_tmout( servp->serv_id );
+			}
+			else if(Dns_dic_conn_id <= 0)
+			{
+				service_tmout( servp->serv_id );
+			}
+			servp->pending = WAITING_DNS_UP;
+			servp->conn_id = 0;
+			auxp = servp->prev;
+			move_to_notok_service( servp );
+			servp = auxp;
+		}		
+		if( (servp = (DIC_SERVICE *) Cmnd_head) ) 
+		{
+			while( (servp = (DIC_SERVICE *) dll_get_next(
+							(DLL *) Cmnd_head,
+							(DLL *) servp)) )
+			{
+				if( servp->conn_id == conn_id )
+				{
+#ifdef DEBUG
+					printf("\t%s was in the Command list\n", servp->serv_name);
+					printf("servp = %x, type = %d, pending = %d\n",servp, servp->type, servp->pending);
+					fflush(stdout);
+#endif
+					auxp = servp->prev;
+					if( (servp->type == ONCE_ONLY ) &&
+						(servp->pending == WAITING_SERVER_UP))
+					{
+						service_tmout( servp->serv_id );
+					}
+					else if( (servp->type == COMMAND ) &&
+						(servp->pending == WAITING_CMND_ANSWER))
+					{
+						service_tmout( servp->serv_id );
+					}
+					else 
+					{
+						servp->pending = WAITING_DNS_UP;
+						dic_release_service( servp->serv_id );
+					}
+					servp = auxp;
+				}
+			}
+		}
+		release_conn( conn_id );
+		request_dns_info(0);
+		break;
+	case STA_DATA:
+		if( !(DIC_SERVICE *) dic_connp->service_head )
+			break;
+		service_id = vtohl(packet->service_id);
+		if(service_id & 0x80000000)  /* Service removed by server */
+		{
+			service_id &= 0x7fffffff;
+			if( (servp = (DIC_SERVICE *) id_get_ptr(service_id, SRC_DIC))) 
+			{
+				if( servp->type != COMMAND )
+				{
+					service_tmout( servp->serv_id );
+					servp->pending = WAITING_DNS_UP;
+					servp->conn_id = 0;
+					move_to_notok_service( servp );
+				}
+				else
+				{
+					service_tmout( servp->serv_id );
+					break;
+				}
+			}
+			else
+			{
+/*
+				print_packet(packet);
+*/
+				if( (servp = (DIC_SERVICE *) Cmnd_head) ) 
+				{
+					while( (servp = (DIC_SERVICE *) dll_get_next(
+							(DLL *) Cmnd_head,
+							(DLL *) servp)) )
+					{
+						if( servp->conn_id == conn_id )
+						{
+#ifdef DEBUG
+							printf("\t%s was in the Command list\n", servp->serv_name);
+							fflush(stdout);
+#endif
+							auxp = servp->prev;
+							if( (servp->type == ONCE_ONLY ) &&
+								(servp->pending == WAITING_SERVER_UP))
+							{
+								service_tmout( servp->serv_id );
+							}
+							else if( (servp->type == COMMAND ) &&
+								(servp->pending == WAITING_CMND_ANSWER))
+							{
+								service_tmout( servp->serv_id );
+							}
+							else 
+							{
+								servp->pending = WAITING_DNS_UP;
+								dic_release_service( servp->serv_id );
+							}
+							servp = auxp;
+						}
+					}
+				}
+			}			
+			if( dll_empty((DLL *)dic_connp->service_head) ) {
+				if( (servp = (DIC_SERVICE *) Cmnd_head) ) {
+					while( (servp = (DIC_SERVICE *) dll_get_next(
+							(DLL *) Cmnd_head,
+							(DLL *) servp)) )
+					{
+						if( servp->conn_id == conn_id)
+							found = 1;
+					}
+				}
+				if( !found)
+				{
+					release_conn( conn_id );
+				}
+			}
+			request_dns_info(0);
+			break;
+		}
+		if( (servp = (DIC_SERVICE *) id_get_ptr(service_id, SRC_DIC)))
+		{
+			if(servp->serv_id == service_id)
+			{
+				once_only = 0;
+				if(servp->type == ONCE_ONLY)
+					once_only = 1;
+				else 
+				{
+					if( servp->timeout > 0 ) 
+					{
+						if(servp->timer_ent)
+							dtq_clear_entry( servp->timer_ent );
+					}
+				}
+				Curr_conn_id = conn_id;
+				execute_service(packet, servp, size);
+				Curr_conn_id = 0;
+				if( once_only )
+				{
+					auxp = locate_command(servp->serv_name);
+					if((auxp) && (auxp != servp))
+					{
+						servp->pending = WAITING_DNS_UP;
+						dic_release_service( servp->serv_id );
+					}
+					else
+					{
+						servp->pending = NOT_PENDING;
+						servp->tmout_done = 0;
+						if( servp->timer_ent )
+						{
+							dtq_rem_entry( Dic_timer_q, servp->timer_ent );
+							servp->timer_ent = 0;
+						}
+					}
+				}
+			}
+		}
+/*
+		else
+		{
+			print_packet(packet);
+			if(Error_user_routine)
+				(Error_user_routine)( packet->buffer );
+		}
+*/
+		break;
+	case STA_CONN:
+		if(Debug_on)
+		{
+			dna_get_node_task(conn_id, node, task);
+			dim_print_date_time();
+			printf(" - Conn %d: Server %s on node %s Connected\n",
+				conn_id, task, node);
+			fflush(stdout);
+		}
+		break;
+	default:	dim_panic( "recv_rout(): Bad switch" );
+	}
+}
+
+static void execute_service(DIS_PACKET *packet, DIC_SERVICE *servp, int size)
+{
+	int format;
+	FORMAT_STR format_data_cp[MAX_NAME/4], *formatp;
+	static int *buffer;
+	static int buffer_size = 0;
+	int add_size;
+	int *pkt_buffer, header_size;
+
+	Current_server = servp;
+	format = servp->format;
+	memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+	if((format & 0xF) == ((MY_FORMAT) & 0xF)) 
+	{
+		for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			formatp->flags &= 0xFFF0;    /* NOSWAP */
+	}
+	if( servp->stamped)
+	{
+		pkt_buffer = ((DIS_STAMPED_PACKET *)packet)->buffer;
+		header_size = DIS_STAMPED_HEADER;
+		servp->time_stamp[0] = vtohl(((DIS_STAMPED_PACKET *)packet)->time_stamp[0]);
+		if((servp->time_stamp[0] & 0xFFFF0000) == 0xc0de0000)
+		{
+/*
+			servp->time_stamp[0] &= 0x0000FFFF;
+*/
+			servp->time_stamp[1] = vtohl(((DIS_STAMPED_PACKET *)packet)->time_stamp[1]);
+			servp->quality = vtohl(((DIS_STAMPED_PACKET *)packet)->quality);
+		}
+		else if((vtohl(((DIS_STAMPED_PACKET *)packet)->reserved[0])) == (int)0xc0dec0de)
+		{
+/*
+			servp->time_stamp[0] &= 0x0000FFFF;
+*/
+			servp->time_stamp[1] = vtohl(((DIS_STAMPED_PACKET *)packet)->time_stamp[1]);
+			servp->quality = vtohl(((DIS_STAMPED_PACKET *)packet)->quality);
+		}
+		else
+		{
+			pkt_buffer = ((DIS_PACKET *)packet)->buffer;
+			header_size = DIS_HEADER;
+		}
+	}
+	else
+	{
+		pkt_buffer = ((DIS_PACKET *)packet)->buffer;
+		header_size = DIS_HEADER;
+	}
+	size -= header_size;
+	if( servp->serv_address ) 
+	{
+		if( size > servp->serv_size ) 
+			size = servp->serv_size; 
+		add_size = copy_swap_buffer_in(format_data_cp, 
+						 servp->serv_address, 
+						 pkt_buffer, size);
+		if( servp->user_routine )
+			(servp->user_routine)(&servp->tag, servp->serv_address, &add_size );
+	} 
+	else 
+	{
+		if( servp->user_routine )
+		{
+			add_size = size + (size/2);
+			if(!buffer_size)
+			{
+				buffer = (int *)malloc(add_size);
+				buffer_size = add_size;
+			} 
+			else 
+			{
+				if( add_size > buffer_size ) 
+				{
+					free(buffer);
+					buffer = (int *)malloc(add_size);
+					buffer_size = add_size;
+				}
+			}
+			add_size = copy_swap_buffer_in(format_data_cp, 
+						 buffer, 
+						 pkt_buffer, size);
+			(servp->user_routine)( &servp->tag, buffer, &add_size );
+		}
+	}
+	Current_server = 0;
+}
+
+static void recv_dns_dic_rout( int conn_id, DNS_DIC_PACKET *packet, int size, int status )
+{
+	register DIC_SERVICE *servp, *auxp;
+	void dim_panic(char *);
+
+	if(size){}
+	switch( status )
+	{
+	case STA_DISC:       /* connection broken */
+		servp = Service_pend_head;
+		while( (servp = (DIC_SERVICE *) dll_get_next(
+						(DLL *) Service_pend_head,
+						(DLL *) servp)) )
+		{
+			if( (servp->pending == WAITING_DNS_ANSWER) ||
+			    (servp->pending == WAITING_SERVER_UP))
+			{
+				if(( servp->type == COMMAND )||( servp->type == ONCE_ONLY ))
+				{
+					auxp = servp->prev;
+					servp->pending = WAITING_DNS_UP;
+					service_tmout( servp->serv_id );
+					servp = auxp;
+				}
+				else
+				{
+					servp->pending = WAITING_DNS_UP;
+				}
+			}
+		}
+		dna_close( Dns_dic_conn_id );
+		Dns_dic_conn_id = 0;
+		request_dns_info(0);
+		break;
+	case STA_CONN:        /* connection received */
+		if(Dns_dic_conn_id < 0)
+		{
+			Dns_dic_conn_id = conn_id;
+			request_dns_info(0);
+
+		}
+		break;
+	case STA_DATA:       /* normal packet */
+		if( vtohl(packet->size) == DNS_DIC_HEADER )
+		{
+			handle_dns_info( packet );
+		}
+		break;
+	default:	dim_panic( "recv_dns_dic_rout(): Bad switch" );
+	}
+}
+
+
+void service_tmout( int serv_id )
+{
+	int once_only, size = 0;
+	register DIC_SERVICE *servp;
+	
+	servp=(DIC_SERVICE *)id_get_ptr(serv_id, SRC_DIC);
+	if(!servp)
+		return;
+	if(servp->tmout_done)
+		return;
+	servp->tmout_done = 1;
+	Curr_conn_id = servp->conn_id;
+/*
+	if( servp->type == UPDATE )
+		return;
+*/
+	if( servp->type == COMMAND )
+	{
+		if( servp->user_routine )
+		{
+			if(servp->pending == WAITING_CMND_ANSWER)
+				size = 1;
+			else
+				size = 0;
+			(servp->user_routine)( &servp->tag, &size );
+		}
+		dic_release_service( servp->serv_id );
+		Curr_conn_id = 0;
+		return;
+	}
+	once_only = 0;
+	if(servp->type == ONCE_ONLY)
+		once_only = 1;
+	if( servp->fill_address )
+	{
+		size = servp->fill_size;
+		if( servp->serv_address )
+		{
+			if( size > servp->serv_size ) 
+				size = servp->serv_size; 
+			memcpy(servp->serv_address, servp->fill_address, size);
+			if( servp->user_routine )
+				(servp->user_routine)( &servp->tag, servp->serv_address, &size);
+		}
+		else
+		{
+			if( servp->user_routine )
+				(servp->user_routine)( &servp->tag, servp->fill_address, &size);
+		}
+	}
+	if( once_only )
+	{
+		dic_release_service( servp->serv_id );
+	}
+	Curr_conn_id = 0;
+}
+
+
+unsigned dic_info_service( char *serv_name, int req_type, int req_timeout, void *serv_address,
+			   int serv_size, void (*usr_routine)(), long tag, void *fill_addr, int fill_size )
+{
+	unsigned ret;
+
+	ret = request_service( serv_name, req_type, req_timeout, 
+		serv_address, serv_size, usr_routine, tag, 
+		fill_addr, fill_size, 0 ); 
+
+	return(ret);
+}
+
+unsigned dic_info_service_stamped( char *serv_name, int req_type, int req_timeout, void *serv_address,
+			   int serv_size, void (*usr_routine)(), long tag, void *fill_addr, int fill_size )
+{
+	unsigned ret;
+
+	ret = request_service( serv_name, req_type, req_timeout, 
+		serv_address, serv_size, usr_routine, tag, 
+		fill_addr, fill_size, 1 ); 
+
+	return(ret);
+}
+
+unsigned request_service( char *serv_name, int req_type, int req_timeout, void *serv_address,
+			   int serv_size, void (*usr_routine)(), long tag, void *fill_addr, int fill_size, int stamped )
+{
+	register DIC_SERVICE *servp;
+	int conn_id;
+	int send_service();
+	int locate_service();
+	void dim_init_threads(void);
+
+	if(!Threads_off)
+	{
+		dim_init_threads();
+	}
+	{
+	DISABLE_AST
+	/* create a timer queue for timeouts if not yet done */
+	if( !Dic_timer_q ) {
+		conn_arr_create( SRC_DIC );
+		Dic_timer_q = dtq_create();
+	}
+
+	/* store_service */
+	if(req_timeout < 0)
+		req_timeout = 0;
+	if(req_type == ONCE_ONLY)
+	{
+		if( !Cmnd_head ) {
+			Cmnd_head = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE) );
+			dll_init( (DLL *) Cmnd_head );
+			Cmnd_head->serv_id = 0;
+		}
+		if( (servp = locate_command(serv_name)) ) 
+		{
+			if( (conn_id = servp->conn_id) ) 
+			{
+				if(servp->pending == NOT_PENDING)
+				{
+					modify_service( servp, req_timeout,
+						(int *)serv_address, serv_size, usr_routine, tag,
+						(int *)fill_addr, fill_size, stamped);
+					servp->pending = WAITING_SERVER_UP;
+					if(send_service(conn_id, servp))
+					{
+						ENABLE_AST
+						return(1);
+					}
+				}
+			}	
+		}
+	}
+	servp = insert_service( req_type, req_timeout,
+			serv_name, (int *)serv_address, serv_size, usr_routine, tag,
+			(int *)fill_addr, fill_size, WAITING_DNS_UP, stamped );
+            
+	/* get_address of server from name_server */
+   
+	if( locate_service(servp) <= 0)
+	{
+/*
+		service_tmout( servp->serv_id );
+*/
+		dtq_start_timer( 0, service_tmout, servp->serv_id);
+	}
+	ENABLE_AST
+	}
+	return((unsigned) servp->serv_id);
+}
+
+
+int dic_cmnd_service( char *serv_name, void *serv_address, int serv_size )
+{
+	int ret;
+
+	ret = request_command( serv_name, serv_address, serv_size, 
+		0, 0, 0 ); 
+
+	return(ret ? 1 : 0);
+
+}
+
+int dic_cmnd_service_stamped( char *serv_name, void *serv_address, int serv_size )
+{
+	int ret;
+
+	ret = request_command( serv_name, serv_address, serv_size, 
+		0, 0, 1 ); 
+
+	return(ret ? 1 : 0);
+
+}
+
+int dic_cmnd_callback( char *serv_name, void *serv_address, int serv_size, 
+					  void (*usr_routine)(), long tag )
+{
+	int ret;
+
+	ret = request_command( serv_name, serv_address, serv_size, 
+		usr_routine, tag, 0 ); 
+	return(ret ? 1 : 0);
+}
+
+int dic_cmnd_callback_stamped( char *serv_name, void *serv_address, int serv_size, 
+					  void (*usr_routine)(), long tag )
+{
+	int ret;
+
+	ret = request_command( serv_name, serv_address, serv_size, 
+		usr_routine, tag, 1 ); 
+	return(ret ? 1 : 0);
+}
+
+int request_command(char *serv_name, void *serv_address, int serv_size, 
+					  void (*usr_routine)(), long tag, int stamped)
+{
+	int conn_id, ret;
+	register DIC_SERVICE *servp, *testp;
+	int *fillp;
+	int send_command();
+	int end_command();
+	void dim_init_threads(void);
+	int locate_service();
+
+	if(!Threads_off)
+	{
+		dim_init_threads();
+	}
+	{
+	DISABLE_AST
+	/* create a timer queue for timeouts if not yet done */
+	if( !Dic_timer_q ) {
+		conn_arr_create( SRC_DIC );
+		Dic_timer_q = dtq_create();
+	}
+
+	/* store_service */
+	if( !Cmnd_head ) {
+		Cmnd_head = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE) );
+		dll_init( (DLL *) Cmnd_head );
+		Cmnd_head->serv_id = 0;
+	}
+	if( (servp = locate_command(serv_name)) ) 
+	{
+		if(!(testp = locate_pending(serv_name)))
+		{
+			if( (conn_id = servp->conn_id) ) 
+			{
+				free( servp->fill_address );
+				fillp = (int *)malloc(serv_size);
+				memcpy( (char *)fillp, (char *)serv_address, serv_size );
+				servp->fill_address = fillp;
+				servp->fill_size = serv_size;
+/*
+				servp->fill_address = (int *)serv_address;
+				servp->fill_size = serv_size;
+*/
+				servp->user_routine = usr_routine;
+				servp->tag = tag;
+				ret = send_command(conn_id, servp);
+				end_command(servp, ret);
+				ENABLE_AST
+				return(1);
+			}
+		}	
+	}
+	servp = insert_service( COMMAND, 0,
+				serv_name, 0, 0, usr_routine, tag, 
+				(int *)serv_address, serv_size,
+				WAITING_DNS_UP, stamped );	
+	if( locate_service(servp) <= 0)
+	{
+/*
+		service_tmout( servp->serv_id );
+*/
+		dtq_start_timer( 0, service_tmout, servp->serv_id);
+	}
+	ENABLE_AST
+	}
+	return(-1);
+}
+
+DIC_SERVICE *insert_service( int type, int timeout, char *name, int *address, int size, 
+							void (*routine)(), long tag, int *fill_addr, int fill_size, 
+							int pending, int stamped)
+{
+	register DIC_SERVICE *newp;
+	int *fillp;
+	int service_id;
+	int tout;
+	float ftout;
+
+	DISABLE_AST
+	newp = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE));
+	newp->pending = 0;
+	strncpy( newp->serv_name, name, MAX_NAME );
+	newp->type = type;
+	newp->timeout = timeout;
+	newp->serv_address = address;
+	newp->serv_size = size;
+	newp->user_routine = routine;
+	newp->tag = tag;
+	fillp = (int *)malloc(fill_size);
+	memcpy( (char *) fillp, (char *) fill_addr, fill_size );
+	newp->fill_address = fillp;
+	newp->fill_size = fill_size;
+	newp->conn_id = 0;
+	newp->format_data[0].par_bytes = 0;
+	newp->next = (DIC_SERVICE *)0;
+	service_id = id_get((void *)newp, SRC_DIC);
+	newp->serv_id = service_id;
+	if( !Service_pend_head )
+	{
+		Service_pend_head = (DIC_SERVICE *) malloc(sizeof(DIC_SERVICE));
+		dll_init( (DLL *) Service_pend_head );
+		Service_pend_head->serv_id = 0;
+	}
+	dll_insert_queue( (DLL *) Service_pend_head, (DLL *)newp );
+	newp->timer_ent = NULL;
+	if(type != MONIT_FIRST)
+	{
+		if( timeout ) 
+		{
+			tout = timeout;
+			if(type != ONCE_ONLY)
+			{
+				if(tout < 10) 
+					tout = 10;
+				ftout = (float)tout * (float)1.5;
+				tout = (int)ftout;
+			}
+			newp->curr_timeout = tout;
+			newp->timer_ent = dtq_add_entry( Dic_timer_q,
+						newp->curr_timeout,
+						service_tmout, newp->serv_id );
+		}
+	}
+	newp->pending = pending;
+	newp->tmout_done = 0;
+	newp->stamped = stamped;
+	newp->time_stamp[0] = 0;
+	newp->time_stamp[1] = 0;
+	newp->quality = 0;
+	newp->def[0] = '\0';
+#ifdef VxWorks
+	newp->tid = taskIdSelf();
+#endif
+	ENABLE_AST
+	return(newp);
+}
+
+
+void modify_service( DIC_SERVICE *servp, int timeout, int *address, int size, void (*routine)(), 
+			 long tag, int *fill_addr, int fill_size, int stamped)
+{
+	int *fillp;
+
+	if( servp->timer_ent )
+	{
+		dtq_rem_entry( Dic_timer_q, servp->timer_ent );
+		servp->timer_ent = 0;
+	}
+	servp->timeout = timeout;
+	servp->serv_address = address;
+	servp->serv_size = size;
+	servp->user_routine = routine;
+	servp->tag = tag;
+	free( servp->fill_address );
+	fillp = (int *)malloc(fill_size);
+	memcpy( (char *) fillp, (char *) fill_addr, fill_size );
+	servp->fill_address = fillp;
+	servp->fill_size = fill_size;
+	servp->stamped = stamped;
+	if(timeout)
+	{
+		servp->curr_timeout = timeout;
+		servp->timer_ent = dtq_add_entry( Dic_timer_q,
+						servp->curr_timeout,
+						service_tmout, servp->serv_id );
+	}
+	else
+		servp->timer_ent = NULL;
+}
+
+void dic_change_address( unsigned serv_id, void *serv_address, int serv_size)
+{
+	register DIC_SERVICE *servp;
+
+	DISABLE_AST
+	if( serv_id == 0 )
+	  {
+	        ENABLE_AST
+		return;
+	  }
+	servp = (DIC_SERVICE *)id_get_ptr(serv_id, SRC_DIC);
+	servp->serv_address = (int *)serv_address;
+	servp->serv_size = serv_size;
+	ENABLE_AST
+}
+
+int dic_get_quality( unsigned serv_id )
+{
+	register DIC_SERVICE *servp;
+
+	DISABLE_AST
+	if( serv_id == 0 )
+	{
+		if(Current_server)
+			servp = Current_server;
+		else
+		{
+
+	    	ENABLE_AST
+			return(-1);
+		}
+	}
+	else
+	{
+		servp = (DIC_SERVICE *)id_get_ptr(serv_id, SRC_DIC);
+	}
+	ENABLE_AST
+	return(servp->quality);
+}
+
+char *dic_get_format( unsigned serv_id )
+{
+	register DIC_SERVICE *servp;
+
+	DISABLE_AST
+	if( serv_id == 0 )
+	{
+		if(Current_server)
+			servp = Current_server;
+		else
+		{
+	    	ENABLE_AST
+			return((char *) 0);
+		}
+	}
+	else
+	{
+		servp = (DIC_SERVICE *)id_get_ptr(serv_id, SRC_DIC);
+	}
+	ENABLE_AST
+	return(servp->def);
+}
+
+int dic_get_timestamp( unsigned serv_id, int *secs, int *milisecs )
+{
+	register DIC_SERVICE *servp;
+
+	DISABLE_AST
+	if( serv_id == 0 )
+	{
+		if(Current_server)
+			servp = Current_server;
+		else
+		{
+	    	ENABLE_AST
+			return(-1);
+		}
+	}
+	else
+	{
+		servp = (DIC_SERVICE *)id_get_ptr(serv_id, SRC_DIC);
+	}
+	ENABLE_AST
+	if(servp->time_stamp[1])
+	{
+		*secs = servp->time_stamp[1];
+		if((servp->time_stamp[0] & 0xFFFF0000) == 0xc0de0000)
+			*milisecs = servp->time_stamp[0] & 0x0000FFFF;
+		else
+			*milisecs = servp->time_stamp[0];
+		return(1);
+	}
+	else
+	{
+		*secs = 0;
+		*milisecs = 0;
+		return(0);
+	}
+}
+
+void dic_release_service( unsigned service_id )
+{
+	register DIC_SERVICE *servp;
+	register int conn_id, pending;
+	static DIC_PACKET *dic_packet;
+	static int packet_size = 0;
+	DIC_DNS_PACKET dic_dns_packet;
+	register DIC_DNS_PACKET *dic_dns_p = &dic_dns_packet;
+	SERVICE_REQ *serv_reqp;
+	int release_service();
+
+	DISABLE_AST
+	if( !packet_size ) {
+		dic_packet = (DIC_PACKET *)malloc(DIC_HEADER);
+		packet_size = DIC_HEADER;
+	}
+	if( service_id == 0 )
+	{
+	    ENABLE_AST
+		return;
+	}
+	servp = (DIC_SERVICE *)id_get_ptr(service_id, SRC_DIC);
+	if( servp == 0 )
+	{
+	    ENABLE_AST
+		return;
+	}
+	if(servp->serv_id != (int)service_id)
+	{
+	    ENABLE_AST
+		return;
+	}
+	pending = servp->pending;
+	switch( pending )
+	{
+	case NOT_PENDING :
+		conn_id = servp->conn_id;
+		strncpy(dic_packet->service_name, servp->serv_name, MAX_NAME); 
+		dic_packet->type = htovl(DIM_DELETE);
+		dic_packet->service_id = htovl(service_id);
+		dic_packet->size = htovl(DIC_HEADER);
+		dna_write( conn_id, dic_packet, DIC_HEADER );
+		release_service( servp );
+		break;
+	case WAITING_SERVER_UP :
+		if( ( servp->type == COMMAND )||( servp->type == ONCE_ONLY ) )
+		{
+			servp->pending = DELETED;
+			break;
+		}
+		if( Dns_dic_conn_id > 0) {
+			dic_dns_p->size = htovl(sizeof(DIC_DNS_PACKET));
+			dic_dns_p->src_type = htovl(SRC_DIC);
+			serv_reqp = &dic_dns_p->service;
+			strcpy( serv_reqp->service_name, servp->serv_name );
+			serv_reqp->service_id = htovl(servp->serv_id | 0x80000000);
+			dna_write( Dns_dic_conn_id, dic_dns_p,
+				  sizeof(DIC_DNS_PACKET) );
+		}
+		release_service( servp );
+		break;
+	case WAITING_CMND_ANSWER :
+	case WAITING_DNS_UP :
+		release_service( servp );
+		break;
+	case WAITING_DNS_ANSWER :
+		servp->pending = DELETED;
+		break;
+	}
+	ENABLE_AST
+}
+
+
+int release_service( DIC_SERVICE *servicep )
+{
+	register DIC_SERVICE *servp;
+	register int conn_id = 0;
+	register int found = 0;
+	register DIC_CONNECTION *dic_connp;
+	char name[MAX_NAME], *ptr;
+	int id;
+
+	id = servicep->serv_id;
+	servicep->serv_id = 0;
+	conn_id = servicep->conn_id;
+	dic_connp = &Dic_conns[conn_id] ;
+	dll_remove( (DLL *) servicep );
+	if( servicep->timer_ent )
+	{
+		dtq_rem_entry( Dic_timer_q, servicep->timer_ent );
+	}
+/*
+	if(servicep->type != COMMAND)
+*/
+	free( servicep->fill_address );
+	if(strstr(servicep->serv_name,"/RpcOut"))
+	{
+		strcpy(name, servicep->serv_name);
+	}
+	else
+		name[0] = '\0';
+	free( servicep );
+	if( conn_id && dic_connp->service_head )
+	{
+		if( dll_empty((DLL *)dic_connp->service_head) ) 
+		{
+			if( (servp = (DIC_SERVICE *) Cmnd_head) ) 
+			{
+				while( (servp = (DIC_SERVICE *) dll_get_next(
+						(DLL *) Cmnd_head,
+						(DLL *) servp)) )
+				{
+					if( servp->conn_id == conn_id)
+						found = 1;
+				}
+			}
+			if( !found)
+			{
+				if(Debug_on)
+				{
+					dim_print_date_time();
+					printf("Conn %d, Server %s on node %s released\n",
+						conn_id, dic_connp->task_name, dic_connp->node_name);
+					fflush(stdout);
+				}
+				release_conn( conn_id );
+			}
+		}
+	}
+	if(name[0])
+	{
+		ptr = strstr(name,"/RpcOut");
+		strcpy(ptr + 4, "In"); 
+		if( (servp = locate_command(name)) )
+			release_service(servp); 
+	}
+	id_free(id, SRC_DIC);
+	return(1);
+}
+
+
+int locate_service( DIC_SERVICE *servp )
+{
+	extern int open_dns(long, void (*)(), void (*)(), int, int, int);
+
+	if(!strcmp(servp->serv_name,"DIS_DNS/SERVER_INFO"))
+	{
+		Tmout_min = DID_DNS_TMOUT_MIN;
+		Tmout_max = DID_DNS_TMOUT_MAX;
+	}
+	if(Tmout_min == 0)
+	{
+		Tmout_min = DIC_DNS_TMOUT_MIN;
+		Tmout_max = DIC_DNS_TMOUT_MAX;
+	}
+	if( !Dns_dic_conn_id )
+	  {
+	    DISABLE_AST;
+		Dns_dic_conn_id = open_dns( 0, recv_dns_dic_rout, error_handler,
+					Tmout_min,
+					Tmout_max,
+					SRC_DIC);
+		if(Dns_dic_conn_id == -2)
+			error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		ENABLE_AST;
+	  }
+	if( Dns_dic_conn_id > 0)
+	{
+	    DISABLE_AST;
+		request_dns_info(servp->prev->serv_id);
+		ENABLE_AST;
+	}
+
+	return(Dns_dic_conn_id);
+}
+
+DIC_SERVICE *locate_command( char *serv_name )
+{
+	register DIC_SERVICE *servp;
+
+	if(!Cmnd_head)
+		return((DIC_SERVICE *)0);
+	if( (servp = (DIC_SERVICE *) dll_search( (DLL *) Cmnd_head, serv_name,
+					    strlen(serv_name)+1)) )
+		return(servp);
+	return((DIC_SERVICE *)0);
+}
+
+DIC_SERVICE *locate_pending( char *serv_name )
+{
+	register DIC_SERVICE *servp;
+
+	if(!Service_pend_head)
+		return((DIC_SERVICE *)0);
+	if( (servp = (DIC_SERVICE *) dll_search( (DLL *) Service_pend_head, serv_name,
+					    strlen(serv_name)+1)) )
+		return(servp);
+	return((DIC_SERVICE *)0);
+}
+
+DIC_BAD_CONNECTION *locate_bad(char *node, char *task, int port)
+{
+	DIC_BAD_CONNECTION *bad_connp;
+
+	if(!Bad_connection_head)
+		return((DIC_BAD_CONNECTION *)0);
+	bad_connp = Bad_connection_head;
+	while( (bad_connp = (DIC_BAD_CONNECTION *) dll_get_next(
+						(DLL *) Bad_connection_head,
+						(DLL *) bad_connp)) )
+	{
+		if((!strcmp(bad_connp->conn.node_name, node)) &&
+			(!strcmp(bad_connp->conn.task_name, task)) &&
+			(bad_connp->conn.port == port) )
+		return(bad_connp);
+	}
+	return((DIC_BAD_CONNECTION *)0);
+}
+
+static void request_dns_info(int id)
+{
+	DIC_SERVICE *servp, *ptr;
+	int n_pend = 0;
+	int request_dns_single_info();
+	extern int open_dns();
+
+	DISABLE_AST
+    if( Dns_dic_conn_id <= 0)
+	{
+		Dns_dic_conn_id = open_dns( 0, recv_dns_dic_rout, error_handler,
+					   Tmout_min,
+					   Tmout_max,
+					   SRC_DIC);
+		if(Dns_dic_conn_id == -2)
+			error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+	}
+	if( Dns_dic_conn_id > 0)
+	{
+		servp = Service_pend_head;
+		if(id > 0)
+		{
+			ptr = (DIC_SERVICE *)id_get_ptr(id, SRC_DIC);
+			if(ptr)
+			{
+				if((ptr->serv_id == id) && (ptr->pending != NOT_PENDING))
+					servp = ptr;
+			}
+		}
+
+		while( (servp = (DIC_SERVICE *) dll_get_next(
+						(DLL *) Service_pend_head,
+						(DLL *) servp)) )
+		{
+			if( servp->pending == WAITING_DNS_UP)
+			{
+				if(!request_dns_single_info( servp ))
+				{
+					ENABLE_AST
+					return;
+			    }
+				n_pend++;
+			}
+			if(n_pend == 1000)
+			{
+				dtq_start_timer( 0, request_dns_info, servp->serv_id);
+				ENABLE_AST
+				return;
+			}
+		}
+	}
+	else
+	{
+		servp = Service_pend_head;
+		while( (servp = (DIC_SERVICE *) dll_get_next(
+						(DLL *) Service_pend_head,
+						(DLL *) servp)) )
+		{
+			if( servp->pending == WAITING_DNS_UP)
+			{
+				if(( servp->type != COMMAND )&&( servp->type != ONCE_ONLY ))
+					service_tmout( servp->serv_id );
+			}
+		}
+	}
+	ENABLE_AST
+}
+
+
+int request_dns_single_info( DIC_SERVICE *servp )
+{
+	static DIC_DNS_PACKET Dic_dns_packet;
+	static SERVICE_REQ *serv_reqp;
+	int ret = 1;
+
+	if( Dns_dic_conn_id > 0)
+	{
+	        if(Debug_on)
+			{
+				dim_print_date_time();
+				printf("Requesting DNS Info for %s, id %d\n",
+					servp->serv_name, servp->serv_id);
+			}
+	  
+		Dic_dns_packet.src_type = htovl(SRC_DIC);
+		serv_reqp = &Dic_dns_packet.service;
+		strcpy( serv_reqp->service_name, servp->serv_name );
+		serv_reqp->service_id = htovl(servp->serv_id);
+		servp->pending = WAITING_DNS_ANSWER;
+		Dic_dns_packet.size = htovl(sizeof(DIC_DNS_PACKET));
+		if(!dna_write( Dns_dic_conn_id, &Dic_dns_packet,
+				      sizeof(DIC_DNS_PACKET) ) )
+		  {
+		    ret = 0;
+		  }
+
+	}
+	return ret;
+}
+
+
+static int handle_dns_info( DNS_DIC_PACKET *packet )
+{
+	int conn_id, service_id;
+	DIC_SERVICE *servp;
+	char *node_name, *task_name;
+	char node_info[MAX_NODE_NAME+4];
+	int i, port, protocol, format, ret, pid;
+	register DIC_CONNECTION *dic_connp ;
+	DIC_DNS_PACKET dic_dns_packet;
+	register DIC_DNS_PACKET *dic_dns_p = &dic_dns_packet;
+	SERVICE_REQ *serv_reqp;
+	DIC_BAD_CONNECTION *bad_connp;
+	int retrying = 0;
+	int tmout;
+	int send_service_command();
+	int find_connection();
+	void move_to_bad_service();
+	void retry_bad_connection();
+
+	service_id = vtohl(packet->service_id);
+
+	servp = (DIC_SERVICE *)id_get_ptr(service_id, SRC_DIC);
+	if(!servp)
+		return(0);
+	if(servp->serv_id != service_id)
+		return(0);
+	if(Debug_on)
+	{
+		dim_print_date_time();
+		printf("Receiving DNS Info for service %s, id %d\n",servp->serv_name,
+			vtohl(packet->service_id));
+	}
+	node_name = packet->node_name; 
+	if(node_name[0] == -1)
+	{
+		error_handler(0, DIM_FATAL, DIMDNSREFUS, "DIM_DNS refuses connection");
+		return(0);
+	}
+	
+	task_name =  packet->task_name;
+	strcpy(node_info,node_name);
+	for(i = 0; i < 4; i ++)
+		node_info[strlen(node_name)+i+1] = packet->node_addr[i];
+	port = vtohl(packet->port); 
+	pid = vtohl(packet->pid); 
+	protocol = vtohl(packet->protocol);
+	format = vtohl(packet->format);
+
+	if( Dns_dic_timr )
+		dtq_clear_entry( Dns_dic_timr );
+	if( servp->pending == DELETED ) {
+		if( Dns_dic_conn_id > 0) {
+			dic_dns_p->size = htovl(sizeof(DIC_DNS_PACKET));
+			dic_dns_p->src_type = htovl(SRC_DIC);
+			serv_reqp = &dic_dns_p->service;
+			strcpy( serv_reqp->service_name, servp->serv_name );
+			serv_reqp->service_id = htovl(servp->serv_id | 0x80000000);
+			dna_write( Dns_dic_conn_id, dic_dns_p,
+				  sizeof(DIC_DNS_PACKET) );
+		}
+		release_service( servp );	
+		return(0);
+	}
+	if( !node_name[0] ) 
+	{
+		servp->pending = WAITING_SERVER_UP;
+		service_tmout( servp->serv_id ); 
+		if( servp->pending == DELETED ) 
+		{
+			if( Dns_dic_conn_id > 0) 
+			{
+				dic_dns_p->size = htovl(sizeof(DIC_DNS_PACKET));
+				dic_dns_p->src_type = htovl(SRC_DIC);
+				serv_reqp = &dic_dns_p->service;
+				strcpy( serv_reqp->service_name, servp->serv_name );
+				serv_reqp->service_id = htovl(servp->serv_id | 0x80000000);
+				dna_write( Dns_dic_conn_id, dic_dns_p,
+					sizeof(DIC_DNS_PACKET) );
+			}
+			release_service( servp );
+		}
+		return(0);
+	}
+#ifdef OSK
+	{
+		register char *ptr;
+
+		if(strncmp(node_name,"fidel",5))
+		{
+			for(ptr = node_name; *ptr; ptr++)
+			{
+				if(*ptr == '.')
+				{
+					*ptr = '\0';
+					break;
+				}
+			}
+		}
+	}
+#endif
+	if( !(conn_id = find_connection(node_name, task_name, port)) ) 
+	{
+	  bad_connp = locate_bad(node_name, task_name, port);
+	  if(bad_connp)
+		  retrying = bad_connp->retrying;
+	  if((!bad_connp) || (retrying))
+	  {	
+		if( (conn_id = dna_open_client(node_info, task_name, port,
+					      protocol, recv_rout, error_handler, SRC_DIC)) )
+		{
+/*
+#ifndef VxWorks
+			if(format & MY_OS9)
+			{
+				dna_set_test_write(conn_id, TEST_TIME_OSK);
+				format &= 0xfffff7ff;
+			}
+			else
+			{
+				dna_set_test_write(conn_id, TEST_TIME_VMS);
+			}
+#endif
+*/
+			dna_set_test_write(conn_id, TEST_TIME_OSK);
+			dic_connp = &Dic_conns[conn_id];
+			strncpy( dic_connp->node_name, node_name,
+				 MAX_NODE_NAME); 
+			strncpy( dic_connp->task_name, task_name,
+				 MAX_TASK_NAME);
+			dic_connp->port = port;
+			dic_connp->pid = pid;
+			if(Debug_on)
+			{
+				dim_print_date_time();
+				printf(" - Conn %d, Server %s on node %s Connecting\n",
+					conn_id, dic_connp->task_name, dic_connp->node_name);
+				fflush(stdout);
+			}
+
+			dic_connp->service_head = 
+						malloc(sizeof(DIC_SERVICE));
+			dll_init( (DLL *) dic_connp->service_head);
+			((DIC_SERVICE *)(dic_connp->service_head))->serv_id = 0;
+			if(retrying)
+			{
+				dll_remove((DLL *)bad_connp->conn.service_head);
+				free(bad_connp->conn.service_head);
+				dll_remove((DLL *)bad_connp);
+				free(bad_connp);
+			}
+		} 
+		else 
+		{
+			if(!retrying)
+			{
+				if( !Bad_connection_head )
+				{
+					Bad_connection_head = (DIC_BAD_CONNECTION *) malloc(sizeof(DIC_BAD_CONNECTION));
+					dll_init( (DLL *) Bad_connection_head );
+					Bad_connection_head->conn.service_head = 0;
+				}
+				bad_connp = (DIC_BAD_CONNECTION *) malloc(sizeof(DIC_BAD_CONNECTION));
+				bad_connp->n_retries = 0;
+				bad_connp->conn.service_head = malloc(sizeof(DIC_SERVICE));
+				dll_init( (DLL *) bad_connp->conn.service_head);
+
+				dll_insert_queue( (DLL *) Bad_connection_head, (DLL *) bad_connp );
+				if(Debug_on)
+				{
+					dim_print_date_time();
+					printf(" - Failed connecting to Server %s on node %s port %d\n",
+						task_name, node_name, port);
+					fflush(stdout);
+				}
+				service_tmout( servp->serv_id );
+			}
+			bad_connp->n_retries++;
+			bad_connp->retrying = 0;
+			strncpy( bad_connp->conn.node_name, node_name, MAX_NODE_NAME); 
+			strncpy( bad_connp->conn.task_name, task_name, MAX_TASK_NAME);
+			bad_connp->conn.port = port;
+			tmout = BAD_CONN_TIMEOUT * bad_connp->n_retries;
+			if(tmout > 120)
+				tmout = 120;
+			dtq_start_timer(tmout, retry_bad_connection, (long)bad_connp);
+			if(( servp->type == COMMAND )||( servp->type == ONCE_ONLY ))
+				return(0);
+			move_to_bad_service(servp, bad_connp);
+/*			
+			((DIC_SERVICE *)(dic_connp->service_head))->serv_id = 0;
+
+			servp = Service_pend_head;
+			while( (servp = (DIC_SERVICE *) dll_get_next(
+						(DLL *) Service_pend_head,
+						(DLL *) servp)) )
+			{
+				if( (servp->pending == WAITING_DNS_ANSWER) ||
+					(servp->pending == WAITING_SERVER_UP))
+						servp->pending = WAITING_DNS_UP;
+			}
+			dna_close( Dns_dic_conn_id );
+			Dns_dic_conn_id = 0;
+			request_dns_info(0);
+*/
+			return(0);
+		}
+	  }
+	  else
+	  {
+			if(!retrying)
+				service_tmout( servp->serv_id );
+			if(( servp->type == COMMAND )||( servp->type == ONCE_ONLY ))
+				return(0);
+			move_to_bad_service(servp, bad_connp);
+			return(0);
+	  }
+	}
+	strcpy(servp->def, packet->service_def);
+	get_format_data(format, servp->format_data, servp->def);
+	servp->format = format;
+	servp->conn_id = conn_id;
+
+	ret = send_service_command( servp );
+/*
+	if( ret == 1)
+	{
+		if(servp->pending != WAITING_CMND_ANSWER)
+			servp->pending = NOT_PENDING;
+		servp->tmout_done = 0;
+	}
+*/
+	return(1);
+}
+
+void retry_bad_connection(DIC_BAD_CONNECTION *bad_connp)
+{
+DIC_SERVICE *servp, *auxp;
+int found = 0;
+void move_to_notok_service();
+
+	if(!bad_connp)
+		return;
+	servp = (DIC_SERVICE *)bad_connp->conn.service_head;
+	while( (servp = (DIC_SERVICE *) dll_get_next(
+					(DLL *) bad_connp->conn.service_head,
+				 	(DLL *) servp)) )
+	{
+		servp->pending = WAITING_DNS_UP;
+		servp->conn_id = 0;
+		auxp = servp->prev;
+		move_to_notok_service( servp );
+		servp = auxp;
+		found = 1;
+	}
+	bad_connp->retrying = 1;
+	if(found)
+		request_dns_info(0);
+}
+
+void move_to_ok_service( DIC_SERVICE *servp, int conn_id )
+{
+	if(Dic_conns[conn_id].service_head)
+	{
+		servp->pending = NOT_PENDING;
+		servp->tmout_done = 0;
+		dll_remove( (DLL *) servp );
+		dll_insert_queue( (DLL *) Dic_conns[conn_id].service_head,
+			  (DLL *) servp );
+	}
+}
+
+void move_to_bad_service( DIC_SERVICE *servp, DIC_BAD_CONNECTION *bad_connp)
+{
+	servp->pending = WAITING_DNS_UP;
+	dll_remove( (DLL *) servp );
+	dll_insert_queue( (DLL *) bad_connp->conn.service_head, (DLL *) servp );
+}
+
+void move_to_cmnd_service( DIC_SERVICE *servp )
+{
+/*
+	if(servp->pending != WAITING_CMND_ANSWER)
+*/
+	servp->pending = NOT_PENDING;
+	servp->tmout_done = 0;
+	dll_remove( (DLL *) servp );
+	dll_insert_queue( (DLL *) Cmnd_head, (DLL *) servp );
+}
+
+void move_to_notok_service(DIC_SERVICE *servp )
+{
+
+	dll_remove( (DLL *) servp );
+	dll_insert_queue( (DLL *) Service_pend_head, (DLL *) servp );
+}
+
+static void get_format_data(int format, FORMAT_STR *format_data, char *def)
+{
+	register FORMAT_STR *formatp = format_data;
+	register char code, last_code = 0;
+	int num;
+	char *ptr = def;
+
+	if(format){}
+	while(*ptr)
+	{
+		switch(*ptr)
+		{
+			case 'i':
+			case 'I':
+			case 'l':
+			case 'L':
+				*ptr = 'I';
+				break;
+			case 'x':
+			case 'X':
+				*ptr = 'X';
+				break;
+			case 's':
+			case 'S':
+				*ptr = 'S';
+				break;
+			case 'f':
+			case 'F':
+				*ptr = 'F';
+				break;
+			case 'd':
+			case 'D':
+				*ptr = 'D';
+				break;
+			case 'c':
+			case 'C':
+				*ptr = 'C';
+				break;
+		}
+		ptr++;
+	}
+	code = *def;
+	while(*def)
+	{
+		if(code != last_code)
+		{
+			formatp->par_num = 0;
+			formatp->flags = 0;
+			switch(code)
+			{
+				case 'i':
+				case 'I':
+				case 'l':
+				case 'L':
+					formatp->par_bytes = SIZEOF_LONG;
+					formatp->flags |= SWAPL;
+					break;
+				case 'x':
+				case 'X':
+					formatp->par_bytes = SIZEOF_DOUBLE;
+					formatp->flags |= SWAPD;
+					break;
+				case 's':
+				case 'S':
+					formatp->par_bytes = SIZEOF_SHORT;
+					formatp->flags |= SWAPS;
+					break;
+				case 'f':
+				case 'F':
+					formatp->par_bytes = SIZEOF_LONG;
+					formatp->flags |= SWAPL;
+#ifdef vms
+/*
+					if((format & 0xF0) != (MY_FORMAT & 0xF0))
+*/
+					formatp->flags |= (format & 0xF0);
+					formatp->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'd':
+				case 'D':
+					formatp->par_bytes = SIZEOF_DOUBLE;
+					formatp->flags |= SWAPD;
+#ifdef vms
+/*             	
+			  		if((format & 0xF0) != (MY_FORMAT & 0xF0))
+*/
+					formatp->flags |= (format & 0xF0);
+					formatp->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'c':
+				case 'C':
+					formatp->par_bytes = SIZEOF_CHAR;
+					formatp->flags |= NOSWAP;
+					break;
+			}
+		}
+		def++;
+		if(*def != ':')
+		{
+/* tested by the server
+			if(*def)
+			{
+				printf("Bad service definition parsing\n");
+				fflush(stdout);
+   	    	}
+			else
+*/
+				formatp->par_num = 0;
+		}
+		else
+		{
+			def++;
+			sscanf(def,"%d",&num);
+			formatp->par_num += num;
+			while((*def != ';') && (*def != '\0'))
+				def++;
+			if(*def)
+	       	    def++;
+		}
+		last_code = code;
+		code = *def;
+		if(code != last_code)
+			formatp++;
+	}
+	formatp->par_bytes = 0;
+/*
+	if((format & 0xF) == (MY_FORMAT & 0xF)) 
+	{
+		for(i = 0, formatp = format_data; i<index;i++, formatp++)
+			formatp->flags &= 0xF0;  
+	}
+*/
+}
+
+int end_command(DIC_SERVICE *servp, int ret)
+{
+	DIC_SERVICE *aux_servp;
+	DIC_CONNECTION *dic_connp;
+
+	DISABLE_AST
+	dic_connp = &Dic_conns[servp->conn_id];
+	if(servp->pending != WAITING_CMND_ANSWER)
+	{
+		if((!ret) || (!dic_connp->service_head))
+		{
+			servp->pending = WAITING_DNS_UP;
+			dic_release_service( servp->serv_id );
+		}
+		else
+		{
+			aux_servp = locate_command(servp->serv_name);
+			if( !aux_servp ) 
+			{
+				move_to_cmnd_service( servp );
+			}
+			else
+			{
+				if(aux_servp != servp)
+				{
+					servp->pending = WAITING_DNS_UP;
+					dic_release_service( servp->serv_id );
+				}
+			}
+		}
+	}
+	ENABLE_AST
+	return(ret);
+}
+
+int send_service_command(DIC_SERVICE *servp)
+{
+    int ret = 1;
+	int conn_id;
+	int send_command();
+	int send_service();
+
+	conn_id = servp->conn_id;
+	if( servp->type == COMMAND ) 
+	{
+		ret = send_command(conn_id, servp);
+		end_command(servp, ret);
+	} 
+	else 
+	{
+		if( send_service(conn_id, servp))
+		{
+			if( servp->type == ONCE_ONLY ) 
+			{
+				if( !locate_command(servp->serv_name) ) 
+				{
+					move_to_cmnd_service( servp );	
+				}
+			}
+			else
+				move_to_ok_service( servp, conn_id );
+		}
+	}
+	return(ret);
+}	
+
+int send_service(int conn_id, DIC_SERVICE *servp)
+{
+	static DIC_PACKET *dic_packet;
+	static int serv_packet_size = 0;
+    int type, ret;
+
+	if( !serv_packet_size ) {
+		dic_packet = (DIC_PACKET *)malloc(DIC_HEADER);
+		serv_packet_size = DIC_HEADER;
+	}
+
+	strncpy( dic_packet->service_name, servp->serv_name, MAX_NAME ); 
+	type = servp->type;
+	if(servp->stamped)
+		type |= STAMPED;
+	dic_packet->type = htovl(type);
+	dic_packet->timeout = htovl(servp->timeout);
+	dic_packet->service_id = htovl(servp->serv_id);
+	dic_packet->format = htovl(MY_FORMAT);
+	dic_packet->size = htovl(DIC_HEADER);
+	ret = dna_write(conn_id, dic_packet, DIC_HEADER);
+	return(ret);
+}
+
+typedef struct
+{
+	int ret_code;
+	int serv_id;
+} CMNDCB_ITEM;
+
+void do_cmnd_callback(CMNDCB_ITEM *itemp)
+{
+
+	DIC_SERVICE *servp;
+	int ret, serv_id;
+/*
+	itemp = (CMNDCB_ITEM *)id_get_ptr(id, SRC_DIC);
+*/
+	serv_id = itemp->serv_id;
+	ret = itemp->ret_code;
+	servp = (DIC_SERVICE *)id_get_ptr(serv_id, SRC_DIC);
+	if(servp)
+	{
+		if(servp->serv_id == serv_id)
+		{
+			Curr_conn_id = servp->conn_id;
+			(servp->user_routine)( &servp->tag, &ret );
+			servp->pending = NOT_PENDING;
+			end_command(servp, ret);
+			Curr_conn_id = 0;
+		}
+	}
+/*
+	id_free(id, SRC_DIC);
+*/
+	free(itemp);
+}
+
+int send_command(int conn_id, DIC_SERVICE *servp)
+{
+	static DIC_PACKET *dic_packet;
+	static int cmnd_packet_size = 0;
+	register int size;
+	int ret;
+	CMNDCB_ITEM *itemp;
+
+	size = servp->fill_size;
+
+	if( !cmnd_packet_size ) {
+		dic_packet = (DIC_PACKET *)malloc(DIC_HEADER + size);
+		cmnd_packet_size = DIC_HEADER + size;
+	}
+	else
+	{
+		if( DIC_HEADER + size > cmnd_packet_size ) {
+			free( dic_packet );
+			dic_packet = (DIC_PACKET *)malloc(DIC_HEADER + size);
+			cmnd_packet_size = DIC_HEADER + size;
+		}
+	}
+
+	strncpy(dic_packet->service_name, servp->serv_name, MAX_NAME); 
+	dic_packet->type = htovl(COMMAND);
+	dic_packet->timeout = htovl(0);
+	dic_packet->format = htovl(MY_FORMAT);
+
+	dic_packet->service_id = /*id_get((void *)servp)*/servp->serv_id;
+
+	size = copy_swap_buffer_out(servp->format, servp->format_data, 
+					 dic_packet->buffer, servp->fill_address, 
+					 size);
+	dic_packet->size = htovl( size + DIC_HEADER);
+	if( servp->user_routine )
+	{
+		servp->pending = WAITING_CMND_ANSWER;
+		ret = dna_write_nowait(conn_id, dic_packet, DIC_HEADER + size);
+		itemp = (CMNDCB_ITEM *)malloc(sizeof(CMNDCB_ITEM));
+		itemp->serv_id = servp->serv_id;
+		itemp->ret_code = ret;
+/*
+		id = id_get((void *)itemp, SRC_DIC);
+*/
+		dtq_start_timer(0, do_cmnd_callback, (long)itemp);
+/*
+		(servp->user_routine)( &servp->tag, &ret );
+*/
+	}
+	else
+	{
+		ret = dna_write_nowait(conn_id, dic_packet, DIC_HEADER + size);
+	}
+/*
+	if(!ret)
+	{
+		servp->pending = WAITING_DNS_UP;
+		dic_release_service( servp->serv_id );
+	}
+*/
+	/*
+	ret = dna_write_nowait(conn_id, dic_packet, DIC_HEADER + size);
+	if(!ret)
+	{
+		servp->pending = WAITING_DNS_UP;
+		dic_release_service( servp->serv_id );
+	}
+	else
+	{
+		dim_usleep(5000);
+		if( servp->user_routine )
+			(servp->user_routine)( &servp->tag, &ret );
+	}
+*/
+	return(ret);
+}
+
+int find_connection(char *node, char *task, int port)
+{
+	register int i;
+	register DIC_CONNECTION *dic_connp;
+
+	if(task){}
+	for( i=0, dic_connp = Dic_conns; i<Curr_N_Conns; i++, dic_connp++ )
+	{
+/*
+		if((!strcmp(dic_connp->task_name, task))
+			&&(!strcmp(dic_connp->node_name, node)))
+*/
+		if((!strcmp(dic_connp->node_name, node)) 
+			&& (dic_connp->port == port))
+		return(i);
+	}
+	return(0);
+}
+
+int dic_get_id(char *name)
+{
+	extern int get_proc_name(char *name);
+
+	get_proc_name(name);
+	strcat(name,"@");
+	get_node_name(&name[strlen(name)]);
+	return(1);
+}
+	
+#ifdef VxWorks
+void dic_destroy(int tid)
+{
+	register int i;
+	register DIC_CONNECTION *dic_connp;
+	register DIC_SERVICE *servp, *auxp;
+	int found = 0;
+
+	if(!Dic_conns)
+	  return;
+	for( i=0, dic_connp = Dic_conns; i<Curr_N_Conns; i++, dic_connp++ )
+	{
+	        if(servp = (DIC_SERVICE *) dic_connp->service_head)
+		  {
+		    while( servp = (DIC_SERVICE *) dll_get_next(
+					(DLL *) dic_connp->service_head,
+				 	(DLL *) servp) )
+		      {
+			if( servp->tid == tid )
+			  {
+			    auxp = servp->prev;
+			    dic_release_service( servp->serv_id );
+			    servp = auxp;
+			    if(!dic_connp->service_head)
+			      break; 
+			  }
+			else
+			  found = 1;
+		    }
+		}
+	}
+	if(!found)
+	  {
+	    if(Dns_dic_conn_id > 0)
+	      {
+		dna_close( Dns_dic_conn_id );
+		Dns_dic_conn_id = 0;
+	      }
+	  }
+}
+
+void DIMDestroy(int tid)
+{
+  dis_destroy(tid);
+  dic_destroy(tid);
+}
+
+#endif
+
+static void release_conn(int conn_id)
+{
+	register DIC_CONNECTION *dic_connp = &Dic_conns[conn_id];
+
+	if(Debug_on)
+	{
+		dim_print_date_time();
+		printf("Conn %d, Server %s on node %s completely released\n",
+			conn_id, dic_connp->task_name, dic_connp->node_name);
+		fflush(stdout);
+	}
+	dic_connp->task_name[0] = '\0';
+	dic_connp->port = 0;
+	if(dic_connp->service_head)
+	{
+		free((DIC_SERVICE *)dic_connp->service_head);
+		dic_connp->service_head = (char *)0;
+	}
+	dna_close(conn_id);
+}	
+
+void dic_close_dns()
+{
+	register DIC_SERVICE *servp, *auxp;
+		
+	if(Dns_dic_conn_id > 0)
+	{
+		if( (servp = (DIC_SERVICE *) Cmnd_head) ) 
+		{
+			while( (servp = (DIC_SERVICE *) dll_get_next(
+							(DLL *) Cmnd_head,
+							(DLL *) servp)) )
+			{
+#ifdef DEBUG
+					printf("\t%s was in the Command list\n", servp->serv_name);
+					printf("type = %d, pending = %d\n",servp->type, servp->pending);
+					fflush(stdout);
+#endif
+				auxp = servp->prev;
+				if( (servp->type == ONCE_ONLY ) &&
+					(servp->pending == WAITING_SERVER_UP))
+				{
+					service_tmout( servp->serv_id );
+				}
+				else if( (servp->type == COMMAND ) &&
+					(servp->pending == WAITING_CMND_ANSWER))
+				{
+					service_tmout( servp->serv_id );
+				}
+				else 
+				{
+					servp->pending = WAITING_DNS_UP;
+					dic_release_service( servp->serv_id );
+				}
+				servp = auxp;
+			}
+		}
+		dna_close( Dns_dic_conn_id );
+		Dns_dic_conn_id = 0;
+	}
+}
+/*
+append_service(service_info_buffer, servp)		
+char *service_info_buffer;
+SERVICE *servp;
+{
+	char name[MAX_NAME], *ptr;
+
+	if(strstr(servp->name,"/RpcIn"))
+	{
+		strcpy(name,servp->name);
+		ptr = (char *)strstr(name,"/RpcIn");
+		*ptr = 0;
+		strcat(service_info_buffer, name);
+		strcat(service_info_buffer, "|");
+		if(servp->def[0])
+		{
+			strcat(service_info_buffer, servp->def);
+		}
+		strcat(name,"/RpcOut");
+		if(servp = find_service(name))
+		{
+			strcat(service_info_buffer, ",");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+		}
+		strcat(service_info_buffer, "|RPC");
+		strcat(service_info_buffer, "\n");
+	}
+	else if(strstr(servp->name,"/RpcOut"))
+	{
+	}
+	else
+	{
+		strcat(service_info_buffer, servp->name);
+		strcat(service_info_buffer, "|");
+		if(servp->def[0])
+		{
+			strcat(service_info_buffer, servp->def);
+		}
+		strcat(service_info_buffer, "|");
+		if(servp->type == COMMAND)
+		{
+			strcat(service_info_buffer, "CMD");
+		}
+		strcat(service_info_buffer, "\n");
+	}
+}
+*/
+
+char *dic_get_error_services()
+{
+	return(dic_get_server_services(Error_conn_id));
+}
+
+char *dic_get_server_services(int conn_id)
+{
+	DIC_SERVICE *servp;
+	DIC_CONNECTION *dic_connp;
+	int n_services = 0;
+	int max_size;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+
+
+	if(!conn_id)
+		return((char *)0);			
+	dic_connp = &Dic_conns[conn_id];
+	if( (servp = (DIC_SERVICE *) dic_connp->service_head) )
+	{
+		while( (servp = (DIC_SERVICE *) dll_get_next(
+					(DLL *) dic_connp->service_head,
+				 	(DLL *) servp)) )
+		{
+			n_services++;
+		}
+		if(!n_services)
+			return((char *)0);			
+		max_size = n_services * MAX_NAME;
+		if(!curr_allocated_size)
+		{
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		else if (max_size > curr_allocated_size)
+		{
+			free(service_info_buffer);
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		service_info_buffer[0] = '\0';
+		buff_ptr = service_info_buffer;
+
+		servp = (DIC_SERVICE *) dic_connp->service_head;
+		while( (servp = (DIC_SERVICE *) dll_get_next(
+					(DLL *) dic_connp->service_head,
+				 	(DLL *) servp)) )
+		{
+			strcat(buff_ptr, servp->serv_name);
+			strcat(buff_ptr, "\n");
+			buff_ptr += strlen(buff_ptr);
+		}
+	}
+	else
+	{
+		return((char *)0);			
+	}
+/*
+	dim_print_date_time();
+	printf("Server %s@%s provides services:\n",
+			dic_connp->task_name, dic_connp->node_name);
+	printf("%s\n",service_info_buffer);
+*/
+	return(service_info_buffer);
+}
+
+int dic_get_conn_id()
+{
+	return(Curr_conn_id);
+}
+
+int dic_get_server(char *name)
+{
+	int ret = 0;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+
+	DISABLE_AST
+
+	if(Curr_conn_id)
+	{
+		dna_get_node_task(Curr_conn_id, node, task);
+		strcpy(name,task);
+		strcat(name,"@");
+		strcat(name,node);
+		ret = Curr_conn_id;
+	}
+	ENABLE_AST
+	return(ret);
+}
+
+int dic_get_server_pid(int *pid)
+{
+	int ret = 0;
+
+	DISABLE_AST
+
+	*pid = 0;
+	if(Curr_conn_id)
+	{
+		*pid = Dic_conns[Curr_conn_id].pid;
+		ret = Curr_conn_id;
+	}
+	ENABLE_AST
+	return(ret);
+}
+
+void dic_stop()
+{
+	dtq_delete(Dic_timer_q);
+	dic_close_dns();
+	dim_stop();
+}
+
+#ifdef VMS
+/* CFORTRAN WRAPPERS */
+FCALLSCFUN9(INT, dic_info_service, DIC_INFO_SERVICE, dic_info_service,
+                 STRING, INT, INT, PVOID, INT, PVOID, INT, PVOID, INT)
+FCALLSCFUN9(INT, dic_info_service_stamped, DIC_INFO_SERVICE_STAMPED, 
+				 dic_info_service_stamped,
+                 STRING, INT, INT, PVOID, INT, PVOID, INT, PVOID, INT)
+FCALLSCFUN3(INT, dic_cmnd_service, DIC_CMND_SERVICE, dic_cmnd_service,
+                 STRING, PVOID, INT)
+FCALLSCFUN5(INT, dic_cmnd_callback, DIC_CMND_CALLBACK, dic_cmnd_callback,
+                 STRING, PVOID, INT, PVOID, INT)
+FCALLSCFUN3(INT, dic_cmnd_service_stamped, DIC_CMND_SERVICE_STAMPED, 
+				 dic_cmnd_service_stamped,
+                 STRING, PVOID, INT)
+FCALLSCFUN5(INT, dic_cmnd_callback_stamped, DIC_CMND_CALLBACK_STAMPED, 
+				 dic_cmnd_callback_stamped,
+                 STRING, PVOID, INT, PVOID, INT)
+FCALLSCSUB3(     dic_change_address, DIC_CHANGE_ADDRESS, dic_change_address,
+                 INT, PVOID, INT)
+FCALLSCSUB1(     dic_release_service, DIC_RELEASE_SERVICE, dic_release_service,
+                 INT)
+FCALLSCFUN1(INT, dic_get_quality, DIC_GET_QUALITY, dic_get_quality,
+                 INT)
+FCALLSCFUN3(INT, dic_get_timestamp, DIC_GET_TIMESTAMP, dic_get_timestamp,
+                 INT,PINT,PINT)
+FCALLSCFUN1(INT, dic_get_id, DIC_GET_ID, dic_get_id,
+                 PSTRING)
+FCALLSCFUN1(STRING, dic_get_format, DIC_GET_FORMAT, dic_get_format,
+                 INT)
+#endif
Index: /trunk/FACT++/dim_v19r15/src/diccpp.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/diccpp.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/diccpp.cxx	(revision 10183)
@@ -0,0 +1,1192 @@
+#define DIMLIB
+#include <dic.hxx>
+#include <stdio.h>
+
+char *DimClient::dimDnsNode = 0;
+DimErrorHandler *DimClient::itsCltError = 0;
+char *DimClient::serverName = 0;
+int DimClient::dicNoCopy = 0;
+
+extern "C" {
+static void user_routine(void *tagp, void *bufp, int *size)
+{
+//	int *tag = (int *)tagp;
+	char *buf = (char *)bufp;
+//	int id = *tag;
+	DimInfo *t;
+
+//	t = (DimInfo *)id_get_ptr(id, SRC_DIC);
+	t = * (DimInfo **)tagp;
+	if(DimClient::getNoDataCopy() == 0)
+	{
+		if(!t->itsDataSize)
+		{
+			t->itsData = new char[*size];
+			t->itsDataSize = *size;
+		}
+		else if(t->itsDataSize < *size)
+		{
+			delete[] (char *)(t->itsData);
+			t->itsData = new char[*size];
+			t->itsDataSize = *size;
+		}
+		memcpy(t->itsData, buf, *size);
+	}
+	else
+	{
+		t->itsData = buf;
+	}
+	t->itsSize = *size;
+	if(t->itsHandler)
+	{
+		t->itsHandler->itsService = t;
+		DimCore::inCallback = 1;
+		t->itsHandler->infoHandler();
+		DimCore::inCallback = 0;
+	}
+	else
+	{
+		DimCore::inCallback = 1;
+		t->infoHandler();
+		DimCore::inCallback = 0;
+	}
+}
+}
+
+void DimInfo::infoHandler()
+{
+	char *data;
+	if(DimClient::getNoDataCopy() == 1)
+	{
+		data = (char *)itsData;
+		if(!itsDataSize)
+		{
+			itsData = new char[itsSize];
+			itsDataSize = itsSize;
+		}
+		else if(itsDataSize < itsSize)
+		{
+			delete[] (char *)(itsData);
+			itsData = new char[itsSize];
+			itsDataSize = itsSize;
+		}
+		memcpy(itsData, data, itsSize);
+	}
+}
+
+void DimInfo::doIt()
+{
+	dim_init();
+	DISABLE_AST
+
+//	itsTagId = id_get((void *)this, SRC_DIC);
+	itsId = dic_info_service(itsName,itsType,itsTime, 0, 0,
+//		user_routine, itsTagId, 
+		user_routine, (long)this, 
+		itsNolinkBuf, itsNolinkSize);
+	ENABLE_AST
+}
+
+int DimInfo::getQuality()
+{
+	return dic_get_quality(itsId);
+}
+
+int DimInfo::getTimestamp()
+{
+	int ret;
+
+	ret = dic_get_timestamp(itsId, &secs, &millisecs);
+	return(secs);
+}
+
+int DimInfo::getTimestampMillisecs()
+{
+	return(millisecs);
+}
+
+
+char *DimInfo::getFormat()
+{
+	char *def;
+
+	if(itsFormat)
+	{
+		return itsFormat;
+	}
+	def = dic_get_format(itsId);
+
+	itsFormat = new char[strlen(def)+1];
+	strcpy(itsFormat, def);
+	return itsFormat;
+}
+
+void DimInfo::timerHandler()
+{
+//	itsTagId = id_get((void *)this, SRC_DIC);
+	itsId = dic_info_service(itsName,itsType,itsTime, 0, 0,
+//		user_routine, itsTagId, 
+		user_routine, (long)this, 
+		itsNolinkBuf, itsNolinkSize);
+}
+
+void DimInfo::subscribe(char *name, int time, void *nolink, int nolinksize,
+	DimInfoHandler *handler)
+{
+	itsId = 0;
+//	itsTagId = 0;
+	itsData = 0;
+	itsFormat = 0;
+	itsHandler = handler;
+	itsName = new char[strlen(name)+1];
+	strcpy(itsName,name);
+	itsDataSize = 0;
+	itsSize = 0;
+	itsNolinkBuf = new char[nolinksize];
+	itsNolinkSize = nolinksize;
+	memcpy(itsNolinkBuf, nolink, nolinksize);
+	if(!time)
+	{
+		itsType = MONITORED;
+		itsTime = 0;
+	}	
+	else if(time > 0)
+	{
+		itsType = MONITORED;
+		itsTime = time;
+	}
+	else
+	{
+		itsType = ONCE_ONLY;
+		itsTime = 30;
+	}
+	doIt();
+}
+
+
+DimInfo::~DimInfo()
+{
+//	if(itsTagId)
+//		id_free(itsTagId, SRC_DIC);
+	dic_release_service(itsId);
+	delete[] (char *)itsNolinkBuf;
+	if(itsDataSize)
+		delete[] (char *)itsData;
+	delete[] itsName;
+	if(itsFormat)
+		delete[] itsFormat;
+}
+
+void *DimInfo::getData()
+{
+//	if(!this->itsSize)
+//		return itsNolinkBuf;
+/*
+	if(DimClient::getNoDataCopy() == 1)
+	{
+		if(!DimCore::inCallback)
+			return (void *)0;
+	}
+*/
+	return this->itsData;
+}
+
+void DimStampedInfo::doIt()
+{
+	dim_init();
+	DISABLE_AST
+//	itsTagId = id_get((void *)this, SRC_DIC);
+	itsId = dic_info_service_stamped(itsName,itsType,itsTime, 0, 0,
+//		user_routine, itsTagId, 
+		user_routine, (long)this, 
+		itsNolinkBuf, itsNolinkSize);
+	ENABLE_AST
+}
+
+void DimStampedInfo::subscribe(char *name, int time, void *nolink, int nolinksize,
+	DimInfoHandler *handler)
+{
+	itsId = 0;
+	itsFormat = 0;
+	itsHandler = handler;
+	itsName = new char[strlen(name)+1];
+	strcpy(itsName,name);
+	itsDataSize = 0;
+	itsNolinkBuf = new char[nolinksize];
+	itsNolinkSize = nolinksize;
+	memcpy(itsNolinkBuf, nolink, nolinksize);
+	if(!time)
+	{
+		itsType = MONITORED;
+		itsTime = 0;
+	}	
+	else if(time > 0)
+	{
+		itsType = MONITORED;
+		itsTime = time;
+	}
+	else
+	{
+		itsType = ONCE_ONLY;
+		itsTime = 30;
+	}
+	doIt();
+}
+
+DimStampedInfo::~DimStampedInfo()
+{
+}
+
+void DimUpdatedInfo::doIt()
+{
+	dim_init();
+	DISABLE_AST
+//	itsTagId = id_get((void *)this, SRC_DIC);
+	itsId = dic_info_service_stamped(itsName,itsType,itsTime, 0, 0,
+//		user_routine, itsTagId, 
+		user_routine, (long)this, 
+		itsNolinkBuf, itsNolinkSize);
+	ENABLE_AST
+}
+
+void DimUpdatedInfo::subscribe(char *name, int time, void *nolink, int nolinksize,
+	DimInfoHandler *handler)
+{
+	itsId = 0;
+	itsFormat = 0;
+	itsHandler = handler;
+	itsName = new char[strlen(name)+1];
+	strcpy(itsName,name);
+	itsDataSize = 0;
+	itsNolinkBuf = new char[nolinksize];
+	itsNolinkSize = nolinksize;
+	memcpy(itsNolinkBuf, nolink, nolinksize);
+	if(!time)
+	{
+		itsType = MONIT_ONLY;
+		itsTime = 0;
+	}	
+	else if(time > 0)
+	{
+		itsType = UPDATE;
+		itsTime = time;
+	}
+	doIt();
+}
+
+DimUpdatedInfo::~DimUpdatedInfo()
+{
+}
+
+extern "C" {
+static void data_user_routine(void *tagp, void *bufp, int *size)
+{
+//	int *tag = (int *)tagp;
+	char *buf = (char *)bufp;
+//	int id = *tag;
+	DimCurrentInfo *t;
+
+//	t = (DimCurrentInfo *)id_get_ptr(id, SRC_DIC);
+	t = * (DimCurrentInfo **)tagp;
+	if(!t->itsDataSize)
+	{
+		t->itsData = new char[*size];
+		t->itsDataSize = *size;
+	}
+	else if(t->itsDataSize < *size)
+	{
+		delete[] (char *)(t->itsData);
+		t->itsData = new char[*size];
+		t->itsDataSize = *size;
+	}
+	memcpy(t->itsData, buf, *size);
+	t->itsSize = *size;
+	t->wakeUp = 1;
+#ifdef __VMS
+	sys$wake(0,0);
+#endif
+#ifdef WIN32
+	wake_up();
+#endif
+}
+}
+
+void DimCurrentInfo::subscribe(char *name, int time, void *nolink, int nolinksize)
+{
+
+	int timeout;
+
+//	itsTagId = 0;
+	if(!time)
+		timeout = 10;
+	else
+		timeout = time;
+	itsName = new char[strlen(name)+1];
+	strcpy(itsName,name);
+	itsDataSize = 0;
+	itsNolinkBuf = new char[nolinksize];
+	itsNolinkSize = nolinksize;
+	memcpy(itsNolinkBuf, nolink, nolinksize);
+	wakeUp = 0;
+//	itsTagId = id_get((void *)this, SRC_DIC);
+	dic_info_service(itsName,ONCE_ONLY,timeout, 0, 0,
+//		data_user_routine, itsTagId, 
+		data_user_routine, (long)this, 
+		itsNolinkBuf, itsNolinkSize);
+}
+
+DimCurrentInfo::~DimCurrentInfo()
+{
+	delete[] (char *)itsNolinkBuf;
+
+//	if(itsTagId)
+//		id_free(itsTagId, SRC_DIC);
+	if(itsDataSize)
+		delete[] (char *)itsData;
+	delete[] itsName;
+}
+
+void *DimCurrentInfo::getData()
+{
+	while(!wakeUp)
+	{
+#ifdef __VMS
+		sys$hiber();
+#else
+		dim_wait();
+#endif
+	}
+	return this->itsData;
+}
+
+extern "C" {
+static void cmnd_done(void *tagp, int *result)
+{
+//	int *tag = (int *)tagp;
+//	int id = *tag;
+	DimCmnd *t;
+
+//	t = (DimCmnd *)id_get_ptr(id, SRC_DIC);
+	t = *(DimCmnd **)tagp;
+	t->result = *result;
+	t->wakeUp = 1;
+#ifdef __VMS
+	sys$wake(0,0);
+#endif
+#ifdef WIN32
+	wake_up();
+#endif
+}
+}
+
+int DimCmnd::send(char *name, void *data, int datasize) 
+{
+//	int id;
+	if(DimCore::inCallback) 
+	{
+		dic_cmnd_service(name, data, datasize);
+		return(1);
+	}
+	else
+	{
+		wakeUp = 0;
+//		id = id_get((void *)this, SRC_DIC);
+		dic_cmnd_callback(name, data, datasize, 
+//			cmnd_done, id);
+			cmnd_done, (long)this);
+		while(!wakeUp)
+		{
+#ifdef __VMS
+			sys$hiber();
+#else
+			dim_wait();
+#endif
+		}
+//		id_free(id, SRC_DIC);
+		return(result);
+	}
+}
+
+void DimCmnd::sendNB(char *name, void *data, int datasize) 
+{
+	dic_cmnd_service(name, data, datasize);
+}
+
+extern "C" {
+static void rpc_user_routine(void *tagp, void *bufp, int *sizep)
+{
+//	int *tag = (int *)tagp;
+	char *buf = (char *)bufp;
+	int size = *sizep;
+//	int id = *tag;
+	DimRpcInfo *t;
+	int quality;
+
+//	t = (DimRpcInfo *)id_get_ptr(id, SRC_DIC);
+	t = *(DimRpcInfo **)tagp;
+	quality = dic_get_quality(0);
+	if(quality == -1)
+	{
+		buf = (char *)t->itsNolinkBuf;
+		size = t->itsNolinkSize;
+	}
+	if(DimClient::getNoDataCopy() == 0)
+	{
+		if(!t->itsDataSize)
+		{
+			t->itsData = new char[size];
+			t->itsDataSize = size;
+		}
+		else if(t->itsDataSize < size)
+		{
+			delete[] (char *)(t->itsData);
+			t->itsData = new char[size];
+			t->itsDataSize = size;
+		}
+	}
+	if(!t->itsConnected)
+	{
+		t->itsConnected = 1;
+	}
+	if(t->itsWaiting)
+	{
+		t->stop();
+		if(DimClient::getNoDataCopy() == 0)
+			memcpy(t->itsData, buf, size);
+		else
+			t->itsData = buf;
+		t->itsSize = size;
+		t->wakeUp = 1;
+		if(t->itsInit)
+		{
+			t->itsWaiting = 1;
+			t->itsHandler->rpcInfoHandler();
+		}
+		if(t->itsWaiting != 2)
+			t->itsWaiting = 0;
+	}
+#ifdef __VMS
+	sys$wake(0,0);
+#endif
+#ifdef WIN32
+	wake_up();
+#endif
+}
+}
+
+void DimRpcInfo::timerHandler()
+{
+	char *buf;
+	int size;
+		
+	buf = (char *)itsNolinkBuf;
+	size = itsNolinkSize;
+
+	if(DimClient::getNoDataCopy() == 0)
+	{
+		if(!itsDataSize)
+		{
+			itsData = new char[size];
+			itsDataSize = size;
+		}
+		else if(itsDataSize < size)
+		{
+			delete[] (char *)(itsData);
+			itsData = new char[size];
+			itsDataSize = size;
+		}
+	}
+	if(itsWaiting)
+	{
+		if(DimClient::getNoDataCopy() == 0)
+			memcpy(itsData, buf, size);
+		else
+			itsData = buf;
+		itsSize = size;
+		wakeUp = 1;
+		if(itsInit)
+		{
+			itsWaiting = 1;
+			itsHandler->rpcInfoHandler();
+		}
+		if(itsWaiting != 2)
+			itsWaiting = 0;
+	}
+#ifdef __VMS
+	sys$wake(0,0);
+#endif
+#ifdef WIN32
+	wake_up();
+#endif
+}
+
+void DimRpcInfo::rpcInfoHandler()
+{
+	char *data;
+	if(DimClient::getNoDataCopy() == 1)
+	{
+		data = (char *)itsData;
+		if(!itsDataSize)
+		{
+			itsData = new char[itsSize];
+			itsDataSize = itsSize;
+		}
+		else if(itsDataSize < itsSize)
+		{
+			delete[] (char *)(itsData);
+			itsData = new char[itsSize];
+			itsDataSize = itsSize;
+		}
+		memcpy(itsData, data, itsSize);
+	}
+}
+
+void DimRpcInfo::subscribe(char *name, void *data, int size,
+	void *nolink, int nolinksize, int timeout)
+{
+
+	itsId = 0;
+//	itsTagId = 0;
+	itsInit = 0;
+	itsWaiting = 0;
+	itsName = new char[strlen(name)+1];
+	strcpy(itsName,name);
+	itsHandler = this;
+	itsDataSize = 0;
+	itsData = 0;
+	itsDataOutSize = 0;
+	itsDataOut = 0;
+	itsNolinkBuf = new char[nolinksize];
+	itsNolinkSize = nolinksize;
+	memcpy(itsNolinkBuf, nolink, nolinksize);
+	itsNameOut = new char[strlen(name)+1+10];
+	strcpy(itsNameOut,name);
+	strcat(itsNameOut,(char *)"/RpcIn");
+	itsNameIn = new char[strlen(name)+1+10];
+	strcpy(itsNameIn,name);
+	strcat(itsNameIn,(char *)"/RpcOut");
+	itsTimeout = timeout;
+	dim_init();
+	{
+		if(!itsId)
+		{
+//			itsTagId = id_get((void *)itsHandler, SRC_DIC);
+
+//			itsId = dic_info_service_stamped(itsNameIn,MONIT_ONLY,itsTimeout, 
+			itsConnected = 0;
+//			itsId = dic_info_service_stamped(itsNameIn,MONITORED,itsTimeout, 
+			itsId = dic_info_service_stamped(itsNameIn,MONIT_FIRST,itsTimeout, 
+				0, 0,
+//				rpc_user_routine, itsTagId, 
+				rpc_user_routine, (long)itsHandler, 
+				itsNolinkBuf, itsNolinkSize);
+//			dim_usleep(200000);
+			itsInit = 1;
+		}
+	}
+	if(size)
+	{
+		doIt(data, size);
+	}
+}
+	
+void DimRpcInfo::doIt(void *data, int size)
+{
+	int ret;
+
+	wakeUp = 0;
+	if(DimClient::getNoDataCopy() == 0)
+	{
+		if(!itsDataOut)
+		{
+			itsDataOut = new char[size];
+			itsDataOutSize = size;
+		}
+		else if(itsDataOutSize < size)
+		{
+			delete[] (char *)itsDataOut;
+			itsDataOut = new char[size];
+			itsDataOutSize = size;
+		}
+		memcpy(itsDataOut, data, size);
+	}
+	else
+	{
+		itsDataOut = data;
+	}
+	while(!itsConnected)
+		dim_wait();
+	itsWaiting = 1;
+	ret = DimClient::sendCommand(itsNameOut, itsDataOut, size); 
+	if(!ret)
+	{
+//		rpc_user_routine((int *)&itsTagId, itsNolinkBuf, &itsNolinkSize);
+		rpc_user_routine((long *)&itsHandler, itsNolinkBuf, &itsNolinkSize);
+	}
+	else
+	{
+		if(itsTimeout)
+			start(itsTimeout);
+	}
+}
+
+void *DimRpcInfo::getData()
+{
+	while(!wakeUp)
+	{
+#ifdef __VMS
+		sys$hiber();
+#else
+		dim_wait();
+#endif
+	}
+/*
+	if(DimClient::getNoDataCopy() == 1)
+	{
+		if(!DimCore::inCallback)
+			return (void *)0;
+	}
+*/
+	return this->itsData;
+}
+
+DimRpcInfo::~DimRpcInfo() 
+{
+//	if(itsTagId)
+//		id_free(itsTagId, SRC_DIC);
+	if(itsId)
+		dic_release_service(itsId);
+	delete[] (char *)itsNolinkBuf;
+	if(itsDataSize)
+		delete[] (char *)itsData;
+	if(itsDataOutSize)
+		delete[] (char *)itsDataOut;
+	delete[] itsName;
+	delete[] itsNameIn;
+	delete[] itsNameOut;
+}
+
+DimBrowser::DimBrowser()
+{
+	int i;
+	for(i = 0; i<5; i++)
+	{
+		itsData[i] = 0;
+		itsData[i] = 0;
+	}
+	currIndex = -1;
+	none = 0;
+	browserRpc = 0;
+}
+
+DimBrowser::~DimBrowser()
+{
+	int i;
+	for(i = 0; i<5; i++)
+	{
+		if(itsData[i])
+			delete itsData[i];
+	}
+	if(browserRpc)
+		delete browserRpc;
+}
+
+int DimBrowser::getServices(const char * serviceName) 
+{
+	return getServices(serviceName, 0);
+}
+
+int DimBrowser::getServices(const char * serviceName, int timeout) 
+{
+	char *str;
+
+//	DimRpcInfo rpc((char *)"DIS_DNS/SERVICE_INFO",(char *)"\0");
+//	rpc.setData((char *)serviceName);
+//	str = rpc.getString();
+	if(!browserRpc)
+		browserRpc = new DimRpcInfo((char *)"DIS_DNS/SERVICE_INFO",timeout,(char *)"\0");
+	browserRpc->setData((char *)serviceName);
+	str = browserRpc->getString();	
+	if(itsData[0])
+		delete itsData[0];
+	itsData[0] = new TokenString(str,(char *)"|\n"); 
+	currIndex = 0;
+	if(!itsData[0]->getNTokens())
+		return(0);
+	return( itsData[0]->getNTokens((char *)"\n") + 1); 
+}
+
+int DimBrowser::getServers() 
+{
+	return getServers(0);
+}
+
+int DimBrowser::getServers(int timeout) 
+{
+	char *str, *pid_str;
+	int size, totsize;
+	DimCurrentInfo srv((char *)"DIS_DNS/SERVER_LIST", timeout, (char *)"\0");
+	str = srv.getString();
+	size = strlen(str)+1;
+	totsize = srv.getSize();
+
+	if(itsData[1])
+		delete itsData[1];
+	itsData[1] = new TokenString(str,(char *)"|@\n"); 
+	currIndex = 1;
+	if(!str[0])
+		return(0);
+	if(totsize > size)
+	{
+		pid_str = str + strlen(str) + 1;
+		if(itsData[4])
+			delete itsData[4];
+		itsData[4] = new TokenString(pid_str,(char *)"|"); 
+	}
+	return(itsData[1]->getNTokens((char *)"|") +1); 
+}
+
+int DimBrowser::getServerServices(const char *serverName) 
+{
+	return getServerServices(serverName, 0);
+}
+
+int DimBrowser::getServerServices(const char *serverName, int timeout) 
+{
+	char *str;
+	char *name = new char[strlen(serverName) + 20];
+	strcpy(name,(char *)serverName);
+	strcat(name,(char *)"/SERVICE_LIST");
+	DimCurrentInfo srv(name, timeout, (char *)"\0");
+	delete[] name;
+	str = srv.getString();	
+	if(itsData[2])
+		delete itsData[2];
+	itsData[2] = new TokenString(str,(char *)"|\n"); 
+	currIndex = 2;
+	if(!itsData[2]->getNTokens())
+		return(0);
+	return(itsData[2]->getNTokens((char *)"\n") + 1); 
+}
+
+int DimBrowser::getServerClients(const char *serverName)
+{
+	return getServerClients(serverName, 0);
+}
+
+int DimBrowser::getServerClients(const char *serverName, int timeout) 
+{
+	char *str;
+	char *name = new char[strlen(serverName) + 20];
+	strcpy(name,(char *)serverName);
+	strcat(name,(char *)"/CLIENT_LIST");
+	DimCurrentInfo srv(name, timeout, (char *)"\0");
+	delete[] name;
+	str = srv.getString();	
+	if(itsData[3])
+		delete itsData[3];
+	itsData[3] = new TokenString(str,(char *)"|@\n"); 
+	currIndex = 3;
+	return(itsData[3]->getNTokens((char *)"@") ); 
+}
+	
+int DimBrowser::getNextService(char *&service, char *&format)
+{
+	int ret, type;
+
+	service = format = &none;
+	ret = itsData[0]->getToken(currToken);
+	if(!ret) return 0;
+	service = currToken;
+	ret = itsData[0]->getToken(currToken);
+	if(!itsData[0]->cmpToken((char *)"|"))
+		return 0;
+	ret = itsData[0]->getToken(currToken);
+	if(!itsData[0]->cmpToken((char *)"|"))
+	{
+		format = currToken;
+		ret = itsData[0]->getToken(currToken);
+		if(!itsData[0]->cmpToken((char *)"|"))      
+			return 0;
+	}
+	ret = itsData[0]->getToken(currToken);
+	type = DimSERVICE;
+	if(!itsData[0]->cmpToken((char *)"\n"))
+	{
+		if(itsData[0]->cmpToken((char *)"CMD"))
+			type = DimCOMMAND;
+		if(itsData[0]->cmpToken((char *)"RPC"))
+			type = DimRPC;
+		ret = itsData[0]->getToken(currToken);
+		if(!itsData[0]->cmpToken((char *)"\n"))
+			return 0;
+	}
+	return type;
+}
+	
+int DimBrowser::getNextServer(char *&server, char *&node)
+{
+	int ret;
+
+	server = node = &none;
+	ret = itsData[1]->getToken(currToken);
+	if(!ret) return 0;
+	server = currToken;
+	ret = itsData[1]->getToken(currToken);
+	if(!itsData[1]->cmpToken((char *)"@"))
+		return 0;
+	while(1)
+	{
+		ret = itsData[1]->getToken(currToken);
+		node = currToken;
+		itsData[1]->pushToken();
+		ret = itsData[1]->getToken(currToken);
+		if(itsData[1]->cmpToken((char *)"@"))
+		{
+			strcat(server,"@");
+			strcat(server,node);
+		}
+		else
+			break;
+	}
+	if(!itsData[1]->cmpToken((char *)"|"))
+		itsData[1]->popToken();
+	return 1;
+}
+
+int DimBrowser::getNextServer(char *&server, char *&node, int &pid)
+{
+	int ret, lpid = 0;
+	char *tok;
+
+	ret = getNextServer(server, node);
+	if(ret && itsData[4])
+	{
+		ret = itsData[4]->getToken(tok);
+		if(ret)
+		{
+			sscanf(tok,"%d",&lpid);
+			pid = lpid;
+		}
+	}
+	if(!ret) 
+		return 0;
+	ret = itsData[4]->getToken(tok);
+	return 1;
+}
+	
+int DimBrowser::getNextServerService(char *&service, char *&format)
+{
+	int ret, type;
+
+	service = format = &none;
+	ret = itsData[2]->getToken(currToken);
+	if(!ret) return 0;
+	service = currToken;
+	ret = itsData[2]->getToken(currToken);
+	if(!itsData[2]->cmpToken((char *)"|"))
+		return 0;
+	ret = itsData[2]->getToken(currToken);
+	if(!itsData[2]->cmpToken((char *)"|"))
+	{
+		format = currToken;
+		ret = itsData[2]->getToken(currToken);
+		if(!itsData[2]->cmpToken((char *)"|"))
+			return 0;
+	}
+	ret = itsData[2]->getToken(currToken);
+	type = DimSERVICE;
+	if(!itsData[2]->cmpToken((char *)"\n"))
+	{
+		if(itsData[2]->cmpToken((char *)"CMD"))
+			type = DimCOMMAND;
+		if(itsData[2]->cmpToken((char *)"RPC"))
+			type = DimRPC;
+		ret = itsData[2]->getToken(currToken);
+		if(!itsData[2]->cmpToken((char *)"\n"))
+			return 0;
+	}
+	return type;
+}
+	
+int DimBrowser::getNextServerClient(char *&client, char *&node)
+{
+	int ret;
+
+	client = node = &none;
+	ret = itsData[3]->getToken(currToken);
+	if(!ret) return 0;
+	client = currToken;
+	ret = itsData[3]->getToken(currToken);
+	if(!itsData[3]->cmpToken((char *)"@"))
+		return 0;
+	ret = itsData[3]->getToken(currToken);
+	node = currToken;
+	itsData[3]->pushToken();
+	ret = itsData[3]->getToken(currToken);
+	if(!itsData[3]->cmpToken((char *)"|"))
+		itsData[3]->popToken();
+	return 1;
+}
+
+DimClient::DimClient()
+{
+	itsCltError = this;
+}
+
+DimClient::~DimClient() 
+{
+	if(dimDnsNode)
+		delete[] dimDnsNode;
+}
+
+int DimClient::sendCommand(const char *name, int data)
+{ 
+	DimCmnd a;
+	return a.send((char *)name, &data, sizeof(int));
+}
+
+int DimClient::sendCommand(const char *name, float data)
+{ 
+	DimCmnd a;
+	return a.send((char *)name, &data, sizeof(float));
+}
+
+int DimClient::sendCommand(const char *name, double data)
+{ 
+	DimCmnd a;
+	return a.send((char *)name, &data, sizeof(double));
+}
+
+int DimClient::sendCommand(const char *name, longlong data)
+{ 
+	DimCmnd a;
+	return a.send((char *)name, &data, sizeof(longlong));
+}
+
+int DimClient::sendCommand(const char *name, short data)
+{ 
+	DimCmnd a;
+	return a.send((char *)name, &data, sizeof(short));
+}
+
+int DimClient::sendCommand(const char *name, const char *data)
+{ 
+	DimCmnd a;
+	return a.send((char *)name, (char *)data, strlen(data)+1);
+}
+
+int DimClient::sendCommand(const char *name, void *data, int datasize)
+{
+	DimCmnd a;
+	return a.send((char *)name, data, datasize);
+}
+
+void DimClient::sendCommandNB(const char *name, int data)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, &data, sizeof(int));
+}
+
+void DimClient::sendCommandNB(const char *name, float data)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, &data, sizeof(float));
+}
+
+void DimClient::sendCommandNB(const char *name, double data)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, &data, sizeof(double));
+}
+
+void DimClient::sendCommandNB(const char *name, longlong data)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, &data, sizeof(longlong));
+}
+
+void DimClient::sendCommandNB(const char *name, short data)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, &data, sizeof(short));
+}
+
+void DimClient::sendCommandNB(const char *name, char *data)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, data, strlen(data)+1);
+}
+
+void DimClient::sendCommandNB(const char *name, void *data, int datasize)
+{
+	DimCmnd a;
+	a.sendNB((char *)name, data, datasize);
+}
+
+int DimClient::setExitHandler(const char *srvName)
+{
+	DimCmnd a;
+	int ret, tag = 1;
+	char *name = new char[strlen(srvName) + 20];
+	strcpy(name,(char *)srvName);
+	strcat(name,"/SET_EXIT_HANDLER");
+	ret =  a.send(name, &tag, sizeof(int));
+	delete[] name;
+	return ret;
+}
+
+int DimClient::killServer(const char *srvName)
+{
+	DimCmnd a;
+	int ret, tag = 1;
+	char *name = new char[strlen(srvName) + 20];
+	strcpy(name,(char *)srvName);
+	strcat(name,"/EXIT");
+	ret = a.send(name, &tag, sizeof(int));
+	delete[] name;
+	return ret;
+}
+
+int DimClient::setDnsNode(const char *node)
+{
+	dic_set_dns_node((char *)node);
+	dic_close_dns();
+	return 1;
+}
+
+int DimClient::setDnsNode(const char *node, int port)
+{
+	dic_set_dns_port(port);
+	dic_set_dns_node((char *)node);
+	dic_close_dns();
+	return 1;
+}
+
+char *DimClient::getDnsNode()
+{
+	if(!dimDnsNode)
+		dimDnsNode = new char[256];
+	if(dic_get_dns_node(dimDnsNode))
+		return dimDnsNode;
+	else
+		return 0;
+}
+
+int DimClient::getDnsPort() 
+{
+	return dic_get_dns_port();
+}
+
+void DimClient::setNoDataCopy()
+{
+	dicNoCopy = 1;
+}
+
+int DimClient::getNoDataCopy()
+{
+	return dicNoCopy;
+}
+
+extern "C" {
+//static void clt_error_user_routine(char*, int);
+static void clt_error_user_routine(int severity, int code, char *msg)
+{
+
+	DimCore::inCallback = 2;
+	DimClient::itsCltError->errorHandler(severity, code, msg);
+	DimCore::inCallback = 0;
+}
+}
+
+void DimClient::addErrorHandler(DimErrorHandler *handler)
+{
+	DimClient::itsCltError = handler;
+	dic_add_error_handler(clt_error_user_routine);
+}
+
+void DimClient::addErrorHandler()
+{
+	DimClient::itsCltError = this;
+	dic_add_error_handler(clt_error_user_routine);
+}
+
+int DimClient::getServerId()
+{
+	if(!serverName)
+		serverName = new char[128];
+	serverName[0] = '\0';
+	return dic_get_server(serverName);
+}
+
+int DimClient::getServerPid()
+{
+	int pid, ret;
+
+	ret = dic_get_server_pid(&pid);
+	if(!ret)
+		return 0;
+	return pid;
+}
+
+char *DimClient::getServerName()
+{
+	if(!serverName)
+		serverName = new char[128];
+	serverName[0] = '\0';
+	dic_get_server(serverName);
+	return(serverName);
+}
+
+/*
+char *DimClient::getServerServices(int serverId)
+{
+	return dic_get_server_services(serverId);
+}
+
+char *DimClient::getServerServices()
+{
+	int id;
+	if((id = dic_get_conn_id()))
+		return dic_get_server_services(id);
+	return (char *)0;
+}
+*/
+char **DimClient::getServerServices()
+{
+	static TokenString *data = 0;
+	int id, len = 0, index = 0;
+	char *services;
+	static char** list = 0;
+	char *sep;
+
+	if(data)
+	{
+		delete data;
+		data = 0;
+	}
+	if(list)
+	{
+		delete[] list;
+		list = 0;
+	}
+	if((id = dic_get_conn_id()))
+	{
+		services = dic_get_server_services(id);
+		if(services)
+		{
+			data = new TokenString(services,(char *)"\n");
+			len = data->getNTokens();
+			list = new char*[len];
+			while(data->getToken(list[index]))
+			{
+				data->getToken(sep);
+				index++;
+			}
+		}
+	}
+	if(!len)
+		list = new char*[1];
+	list[index] = 0;
+	return list;
+}
Index: /trunk/FACT++/dim_v19r15/src/did/did.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/did/did.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/did/did.c	(revision 10183)
@@ -0,0 +1,3461 @@
+#include <stdio.h>                   
+#include <ctype.h>
+#include <time.h>
+#include <dim.h>
+#include <dic.h>
+#include <dis.h>
+#include "did.h"
+
+int First_time = 1;
+int Curr_view_opt = -1;	
+char Curr_view_opt_par[80];	
+char Curr_service_name[132];
+char Curr_service_format[256];
+int Curr_service_print_type = 0;	
+int N_servers = 0;	
+int N_services = 0;	
+int no_link_int = -1;
+FILE	*fptr;
+
+char *Service_content_str;
+char *Service_buffer;
+int Service_size;
+char *Curr_service_list = 0;
+char *Curr_client_list = 0;
+int Curr_service_id = 0;
+Widget Curr_client_id;
+Widget Curr_service_list_id;
+SERVER *Got_Service_List = 0;
+SERVER *Got_Client_List = 0;
+
+Widget SubscribeButton;
+Widget Subscribe10Button;
+
+int Timer_q;
+
+int Force_update = 0;
+/*
+ * Global data
+ */
+static XmFontList did_default_font, did_small_font, 
+  did_label_font, did_server_font;
+
+/*static MrmType class_id;*/		/* Place to keep class ID*/
+/*static MrmType *dummy_class;*/            /* and class variable. */
+
+/*static char *db_filename_vec[1];*/        /* Mrm.hierachy file list. */
+/*static int db_filename_num;*/
+
+/*
+ * Forward declarations
+ */
+void did_exit();
+void create_main();
+void create_label();
+void create_matrix();
+void view_opts();
+void dns_control();
+void ok_pop_up();                                                            
+void cancel_pop_up();
+
+extern void set_something();
+extern void get_something();
+extern void set_color();
+
+/*
+ * Names and addresses of callback routines to register with Mrm
+ */
+/*
+static MrmRegisterArg reglist [] = {
+{"did_exit", (caddr_t)did_exit},
+{"create_main", (caddr_t)create_main},
+{"create_label", (caddr_t)create_label},
+{"create_matrix", (caddr_t)create_matrix},
+{"view_opts", (caddr_t)view_opts},
+{"dns_control", (caddr_t)dns_control},
+{"ok_pop_up", (caddr_t)ok_pop_up},
+{"cancel_pop_up", (caddr_t)cancel_pop_up},
+};
+
+static int reglist_num = (sizeof reglist / sizeof reglist[0]);
+*/
+/*
+ * OS transfer point.  The main routine does all the one-time setup and
+ * then calls XtAppMainLoop.
+ */
+
+SERVER *Curr_servp;
+
+XmFontList util_get_font( char *fontname, Widget top )
+{
+XFontStruct * mf;
+XmFontList font;
+/*
+char * fontname;
+
+  if ( size == 'm' ) {
+    fontname = MENU_FONT;
+  }
+  else if ( size == 'b' ) {
+    fontname = LABEL_FONT;
+  }
+  else {
+    fontname = DEFAULT_FONT;
+  }
+*/
+  if ( (mf = XLoadQueryFont(XtDisplay(top),fontname))==NULL) {
+        printf("Couldn't open the following fonts:\n\t%s\n",
+	    fontname);
+        XtVaGetValues ( top, XmNdefaultFontList, &font, NULL );
+  }
+  else  {
+     font = XmFontListCreate (mf, XmSTRING_DEFAULT_CHARSET);
+  }
+  return font;
+}
+
+void create_matrix_widget()
+{
+Widget row_col_id, top_id;
+Arg arglist[10];
+int n = 0;
+char w_name[MAX_NAME];
+
+	top_id = Window_id;
+	XtSetArg(arglist[n], XmNborderWidth, 0); n++;
+	XtSetArg(arglist[n], XmNorientation, XmVERTICAL);  n++;
+        XtSetArg(arglist[n], XmNnumColumns, 4);  n++;
+	XtSetArg(arglist[n], XmNpacking, XmPACK_COLUMN);  n++;
+        XtSetArg(arglist[n], XmNadjustLast, False); n++;
+	sprintf(w_name,"matrix_row");
+	row_col_id = XmCreateRowColumn(top_id,w_name,arglist,n);
+	XtManageChild(row_col_id);
+	Matrix_id[Curr_matrix] = row_col_id;
+	/*
+	XmScrolledWindowSetAreas(Window_id,NULL, NULL, Matrix_id); 
+	*/
+}
+
+void gui_create_main_window(Widget parent)
+{
+
+Widget mw;
+Widget mb;
+Widget mf;
+Widget tl;
+Widget sl;
+Widget f;
+XmString xms;
+int par;
+int reason;
+Arg ar[20];
+int n;
+
+    mw = XmCreateMainWindow ( parent, "DidMainWindow", NULL, 0 );
+    XtVaSetValues( mw,
+        XmNresizePolicy, XmRESIZE_ANY,
+		  
+        XmNfontList,            did_default_font,
+        NULL);
+    XtManageChild( mw );
+    /* create menu bar */
+    mb = XmCreateMenuBar ( mw, "DidMenuBar", NULL, 0 );
+    XtVaSetValues( mb,
+        XmNmarginHeight,2,
+        XmNborderWidth, 0,
+        XmNfontList,            did_default_font,
+        NULL);
+        
+    gui_create_main_menu( mb );
+    XtManageChild ( mb );
+
+    /* create main form */
+    mf = XmCreateForm ( mw, "DidMainForm", NULL, 0 );
+    XtVaSetValues ( mf, 
+		    XmNresizePolicy, XmRESIZE_NONE, 
+		    		   
+		    NULL );
+    XtManageChild ( mf );
+
+    /* create top label */
+    xms = create_str(" \n  ");
+    
+    tl = XmCreateLabel ( mf, "DidTitle", NULL, 0 );
+    XtVaSetValues( tl,
+        XmNtopAttachment,           XmATTACH_FORM,
+        XmNbottomAttachment,        XmATTACH_NONE,
+        XmNleftAttachment,          XmATTACH_FORM,
+        XmNrightAttachment,         XmATTACH_FORM,
+        XmNleftOffset,              0,
+        XmNtopOffset,               0,
+        XmNbottomOffset,            0,
+        XmNrightOffset,             0,
+        XmNborderWidth,             0,
+        XmNlabelString,             xms,          
+        XmNshadowThickness,         0,
+        XmNhighlightThickness,      0,
+		XmNheight,					32,
+        XmNalignment,               XmALIGNMENT_CENTER,
+        XmNfontList,            did_label_font,
+        NULL);
+    XtManageChild( tl );
+/*
+    tl = XtVaCreateManagedWidget( "SmiTitle",
+        xmPushButtonWidgetClass,    mw,
+        XmNborderWidth,             0,
+        XmNlabelString,             xms,          
+        XmNshadowThickness,         0,
+        XmNhighlightThickness,      0,
+        XmNalignment,               XmALIGNMENT_CENTER,
+        XmNfontList,            smid_label_font,
+        NULL);
+*/
+    XmStringFree ( xms );
+    /*
+	XtAddCallback(tl, MrmNcreateCallback, 
+		(XtCallbackProc)create_label, 0);
+    */
+    par = 0;
+    reason = 0;
+    create_label(tl, &par, &reason);
+
+    /* create main form */
+    /*
+    mf = (Widget)XmCreateForm ( mw, "DidMainForm", NULL, 0 );
+    XtVaSetValues ( mf,
+        XmNborderWidth,1,
+        XmNshadowThickness, 2,
+		    XmNwidth,806,
+		    XmNheight,300, 
+		    
+       XmNresizePolicy, XmRESIZE_NONE, NULL );
+    XtManageChild ( mf );
+    */
+    /*
+	XtAddCallback(mf, MrmNcreateCallback, 
+			(XtCallbackProc)create_main, 0);
+    */
+    
+    create_main(mf, &par, &reason);
+    
+    f = XmCreateForm( mf, "ScrollForm", NULL, 0 );
+    XtVaSetValues ( f, 
+		    XmNwidth, 806,
+		    XmNheight,300,		    		  
+        XmNtopAttachment,           XmATTACH_WIDGET,
+        XmNbottomAttachment,        XmATTACH_FORM,
+        XmNleftAttachment,          XmATTACH_FORM,
+        XmNrightAttachment,         XmATTACH_FORM,
+        XmNrightOffset,             0,
+        XmNleftOffset,              0,
+        XmNbottomOffset,            0,
+        XmNtopWidget, tl,
+        XmNtopOffset, 0,
+        XmNshadowThickness, 2,
+        XmNbottomOffset, 0,
+		    /*
+        XmNshadowType, XmSHADOW_OUT,
+		    */
+        XmNborderWidth,0,
+        NULL);
+
+    /*
+    f = XtVaCreateManagedWidget ( "XDScrolledForm",
+        xmFormWidgetClass,          mf,
+        XmNtopAttachment,           XmATTACH_WIDGET,
+        XmNbottomAttachment,        XmATTACH_FORM,
+        XmNleftAttachment,          XmATTACH_FORM,
+        XmNrightAttachment,         XmATTACH_FORM,
+        XmNrightOffset,             0,
+        XmNleftOffset,              0,
+        XmNbottomOffset,            0,
+        XmNtopWidget, tl,
+        XmNtopOffset, 0,
+        XmNshadowThickness, 2,
+        XmNbottomOffset, 0,
+        XmNshadowType, XmSHADOW_OUT,
+        XmNborderWidth,1,
+        NULL);
+*/
+    /*
+	XtAddCallback(f, MrmNcreateCallback, 
+		(XtCallbackProc)create_window, 0);
+    */
+
+    XtManageChild ( f );
+    /* create scrolled list */
+    
+    n = 0;
+    XtSetArg ( ar[n], XmNtopAttachment, XmATTACH_FORM); n++;
+    XtSetArg ( ar[n], XmNbottomAttachment, XmATTACH_FORM); n++;
+    XtSetArg ( ar[n], XmNleftAttachment, XmATTACH_FORM); n++;
+    XtSetArg ( ar[n], XmNrightAttachment, XmATTACH_FORM); n++;
+    XtSetArg ( ar[n], XmNrightOffset, 0); n++;
+    XtSetArg ( ar[n], XmNleftOffset, 0); n++;
+    XtSetArg ( ar[n], XmNbottomOffset, 0); n++;
+    XtSetArg ( ar[n], XmNtopOffset, 0); n++;
+    /*
+    XtSetArg ( ar[n], XmNvisualPolicy, XmCONSTANT); n++;
+    */	    
+    XtSetArg ( ar[n], XmNscrollBarDisplayPolicy, XmAS_NEEDED); n++;
+		   
+    XtSetArg ( ar[n], XmNscrollingPolicy, XmAUTOMATIC); n++;
+
+    sl = XmCreateScrolledWindow ( f, "ScrollWin", ar, n );
+    /*
+    XtVaSetValues ( sl, 
+        XmNtopAttachment,           XmATTACH_FORM,
+        XmNbottomAttachment,        XmATTACH_FORM,
+        XmNleftAttachment,          XmATTACH_FORM,
+        XmNrightAttachment,         XmATTACH_FORM,
+        XmNrightOffset,             0,
+        XmNleftOffset,              0,
+        XmNbottomOffset,            0,
+	XmNtopOffset,               0,
+		    		   
+        XmNvisualPolicy,        XmCONSTANT,
+		    
+	XmNscrollBarDisplayPolicy, XmSTATIC,
+		   
+        XmNscrollingPolicy, XmAUTOMATIC,
+
+        NULL);
+    */
+    XtManageChild ( sl );
+    /*
+    create_window(sl, &par, &reason);
+    */
+    Window_id = sl;
+    
+    create_matrix_widget();
+    
+/* 
+    sl = XtVaCreateWidget ( "DidServersScrl",
+        xmScrolledWindowWidgetClass, f,
+        XmNscrollingPolicy,     XmAUTOMATIC,
+        XmNscrollBarDisplayPolicy, XmSTATIC,
+        XmNtopAttachment,       XmATTACH_FORM,
+        XmNleftAttachment,      XmATTACH_FORM,
+        XmNrightAttachment,     XmATTACH_FORM,
+        XmNbottomAttachment,    XmATTACH_FORM,
+        XmNvisualPolicy,        XmCONSTANT,
+        XmNtopOffset,           4,
+        XmNleftOffset,          4,
+        XmNbottomOffset,        4,
+        XmNrightOffset,         4,
+        NULL );
+    XtManageChild ( sl );
+*/
+    /*
+    XtVaSetValues( mw,
+        XmNworkWindow,mf,
+        XmNcommandWindow, tl,
+        NULL);
+    */
+    
+}
+
+Widget create_separator(Widget parent_id)
+{
+	Widget w;
+	Arg arglist[10];
+	int n = 0;
+
+	w = XmCreateSeparator(parent_id, "separator",
+		arglist,n);
+	XtManageChild(w);
+	return(w);
+}
+
+void gui_create_main_menu( Widget mb )
+{
+Widget cb;
+Widget mn;
+Widget bt;
+XmString xms;
+    /* File */
+    mn = XmCreatePulldownMenu ( mb, "FileMB", NULL, 0 );
+    cb = XmCreateCascadeButton(mb, "File", NULL, 0);
+    XtVaSetValues ( cb, 
+        XmNsubMenuId,       mn,
+        NULL);
+    XtManageChild ( cb );
+    /*
+    cb = XtVaCreateManagedWidget ( "File",
+        xmCascadeButtonWidgetClass, mb,
+        XtVaTypedArg,       XmNmnemonic, XmRString, "F", 2,
+        XmNsubMenuId,       mn,
+        NULL);
+    */
+        XtVaSetValues ( mn,
+            XmNradioAlwaysOne, True,
+            XmNradioBehavior, True,
+            NULL);
+        XtVaSetValues ( cb,
+	    XmNfontList,            did_default_font,
+            NULL);
+        /* buttons */
+        xms = create_str ("Exit DID");
+	/*
+        bt = XtVaCreateManagedWidget ( "MenuExitButton",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>C",
+            XmNacceleratorText, xma,
+            NULL);
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)did_exit, 0 );
+	/*
+    util_recolor ( XtParent(mn) );
+	*/
+    /* View */
+    mn = XmCreatePulldownMenu ( mb, "ViewMB", NULL, 0 );
+    cb = XmCreateCascadeButton(mb, "View", NULL, 0);
+    XtVaSetValues ( cb, 
+        XmNsubMenuId,       mn,
+        NULL);
+    XtVaSetValues ( cb,
+        XmNfontList,            did_default_font,
+        NULL);
+    XtManageChild ( cb );
+    /*
+    cb = XtVaCreateManagedWidget ( "View",
+        xmCascadeButtonWidgetClass, mb,
+        XtVaTypedArg,       XmNmnemonic, XmRString, "V", 2,
+        XmNsubMenuId,       mn,
+        NULL);
+    */
+        XtVaSetValues ( mn,
+            XmNradioAlwaysOne, True,
+            XmNradioBehavior, True,
+            NULL);
+        /* buttons */
+
+        xms = create_str ("All Servers");
+	/*
+        bt = XtVaCreateManagedWidget ( "V_MenuAllButton",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>A",
+            XmNacceleratorText, xma,
+            NULL);
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)view_opts, 
+			(XtPointer)1 );
+
+        xms = create_str ("Servers by Node");
+	/*
+        bt = XtVaCreateManagedWidget ( "V_MenuNodeButton",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>N",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)view_opts, 
+			(XtPointer)0 );
+
+        xms = create_str ("Servers by Service");
+	/*
+        bt = XtVaCreateManagedWidget ( "V_MenuServiceButton",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>S",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)view_opts, 
+			(XtPointer)2 );
+
+	create_separator(mn);
+	/*
+        bt = XtVaCreateManagedWidget ( "W_MenuSep",
+            xmSeparatorGadgetClass, mn,
+            NULL);
+	*/
+        xms = create_str ("Servers in Error");
+	/*
+        bt = XtVaCreateManagedWidget ( "V_MenuErrorButton",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>E",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)view_opts, 
+			(XtPointer)3 );
+	/*
+    util_recolor ( XtParent(mn) );
+	*/
+    /* Commands */
+    mn = XmCreatePulldownMenu ( mb, "CommandMB", NULL, 0 );
+    cb = XmCreateCascadeButton(mb, "Commands", NULL, 0);
+    XtVaSetValues ( cb, 
+        XmNsubMenuId,       mn,
+        NULL);
+    XtVaSetValues ( cb,
+	XmNfontList,            did_default_font,
+        NULL);
+    XtManageChild ( cb );
+    /*
+    cb = XtVaCreateManagedWidget ( "Commands",
+        xmCascadeButtonWidgetClass, mb,
+        XtVaTypedArg,       XmNmnemonic, XmRString, "C", 2,
+        XmNsubMenuId,       mn,
+        XmNsensitive, commands_enable,
+        NULL);
+    */
+        /* buttons */
+        /* Utils */
+    /*
+        xms = util_create_str ("Show Command Buttons");
+        xma = util_create_str ("Ctrl+B");
+        bt = XtVaCreateManagedWidget ( "C_ShowCmndButt",
+            xmToggleButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>B",
+            XmNacceleratorText, xma,
+            XmNset, False,
+            XmNindicatorSize,12,
+            XmNvisibleWhenOff, True,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+        XtAddCallback ( bt, XmNvalueChangedCallback, (XtCallbackProc)show_command_buttons_callback, NULL );
+
+        bt = XtVaCreateManagedWidget ( "W_MenuSep",
+            xmSeparatorGadgetClass, mn,
+            NULL);
+    */
+        
+        xms = create_str ("LOG Connections");
+	/*
+        bt = XtVaCreateManagedWidget ( "C_MenuButtonLOG",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>G",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control_callback, "log" );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control, 
+			(XtPointer)0 );
+
+        create_separator(mn);
+	/*
+        bt = XtVaCreateManagedWidget ( "W_MenuSep",
+            xmSeparatorGadgetClass, mn,
+            NULL);
+	*/
+        xms = create_str ("Set Debug ON");
+	/*
+        bt = XtVaCreateManagedWidget ( "C_MenuButtonDON",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "<Key>F2:",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control_callback, "on" );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control, 
+			(XtPointer)1 );
+
+        xms = create_str ("Set Debug OFF");
+	/*
+        bt = XtVaCreateManagedWidget ( "C_MenuButtonDOFF",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "<Key>F3:",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control_callback, "off" );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control, 
+			(XtPointer)2 );
+
+	create_separator(mn);
+	/*
+        bt = XtVaCreateManagedWidget ( "W_MenuSep",
+            xmSeparatorGadgetClass, mn,
+            NULL);
+	*/
+        xms = create_str ("Print Hash Table");
+	/*
+        bt = XtVaCreateManagedWidget ( "C_MenuButtonPrint",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>T",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control_callback, "hash" );
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control, 
+			(XtPointer)4 );
+	/* kill
+	create_separator(mn);
+	*/
+	/*
+        bt = XtVaCreateManagedWidget ( "W_MenuSep",
+            xmSeparatorGadgetClass, mn,
+            NULL);
+	*/
+	/* kill
+        xms = create_str ("Kill DIM Servers");
+	*/
+	/*
+        bt = XtVaCreateManagedWidget ( "C_MenuButtonKill",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>K",
+            XmNacceleratorText, xma,
+            NULL);
+        XmStringFree ( xms );
+        XmStringFree ( xma );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control_callback, "kill" );
+	*/
+	/* kill
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)dns_control, 
+			(XtPointer)3 );
+	*/
+	/*
+    util_recolor ( XtParent(mn) );
+	*/
+    /* Help */
+    mn = XmCreatePulldownMenu ( mb, "HelpMB", NULL, 0 );
+    /*
+    cb = XtVaCreateManagedWidget ( "Help",
+        xmCascadeButtonWidgetClass, mb,
+        XtVaTypedArg,       XmNmnemonic, XmRString, "H", 2,
+        XmNsubMenuId,       mn,
+        NULL);
+    */
+    cb = XmCreateCascadeButton ( mb, "Help", NULL, 0 );
+    XtVaSetValues( cb,
+	XmNsubMenuId,       mn,
+	XmNfontList,            did_default_font,
+        NULL);
+    XtManageChild( cb );
+
+        xms = create_str ("Help");
+	/*
+        bt = XtVaCreateManagedWidget ( "C_XDAbout",
+            xmPushButtonWidgetClass, mn,
+            XmNlabelString, xms,
+            XmNaccelerator, "Ctrl<Key>H",
+            XmNacceleratorText, xma,
+            NULL);
+	*/
+        bt = XmCreatePushButton ( mn, "button", NULL, 0 );
+        XtVaSetValues( bt,
+            XmNlabelString, xms,
+	    XmNfontList,            did_default_font,
+            NULL);
+        XtManageChild( bt );
+        XmStringFree ( xms );
+	/*
+        XtAddCallback ( bt, XmNactivateCallback, (XtCallbackProc)about_xd_callback, NULL );
+	*/
+    /* set help menu */
+    XtVaSetValues ( mb, XmNmenuHelpWidget, cb, NULL );
+    /*
+    util_recolor ( XtParent(mn) );
+    */
+}
+
+
+Widget gui_toplevel(char **argv)
+{
+int n;
+Arg arglist[6];
+
+    n = 0;
+    XtSetArg ( arglist[n], XmNallowShellResize, True); n++;
+    XtSetArg ( arglist[n], XmNiconName, "DID"); n++;
+    XtSetArg ( arglist[n], XmNtitle, "xDid");  n++;
+    XtSetArg ( arglist[n], XmNtraversalOn,True); n++;
+    return XtAppCreateShell(argv[0], NULL, applicationShellWidgetClass,
+                            display, arglist, n);
+     
+}
+
+Widget gui_initialize (int argc, char **argv)
+{
+Widget toplevel;
+void gui_create_main_window();
+
+    XtToolkitInitialize();
+    app_context = XtCreateApplicationContext();
+    display = XtOpenDisplay(app_context, NULL, argv[0], "DID",
+                            NULL, 0, &argc, argv);
+    if (display == NULL) 
+	{
+        printf("%s:  Can't open display\n", argv[0]);
+        exit(1);
+	}
+    toplevel = gui_toplevel(argv);
+   
+    did_default_font = (XmFontList)util_get_font(DEFAULT_FONT, toplevel);
+    did_small_font = (XmFontList)util_get_font(MENU_FONT, toplevel);
+    did_label_font = (XmFontList)util_get_font(LABEL_FONT, toplevel);
+    did_server_font = (XmFontList)util_get_font(SERVER_FONT, toplevel);
+
+    gui_create_main_window(toplevel);
+
+    XtRealizeWidget ( toplevel );
+    return toplevel;
+}
+
+int main(int argc, char *argv[])
+{
+    int i;
+	char opt_str[20], *ptr;
+	XtInputMask mask;
+	void do_got_service_list();
+	void do_show_clients();
+	void app_initialize();
+       
+	dim_no_threads();
+	dic_disable_padding();
+	dis_disable_padding();
+	
+	if(argc > 1)
+	{
+		if(argv[1][0] == '-')
+		{
+			sprintf(opt_str,"%s",&argv[1][1]);
+			if((!strncmp(opt_str,"node",4)) || 
+			   (!strncmp(opt_str,"NODE",4)))
+				Curr_view_opt = 0;
+			else if((!strncmp(opt_str,"all",3)) || 
+				(!strncmp(opt_str,"ALL",3)))
+				Curr_view_opt = 1;
+			else if((!strncmp(opt_str,"service",7)) || 
+					(!strncmp(opt_str,"SERVICE",7)))
+				Curr_view_opt = 2;
+			else if((!strncmp(opt_str,"error",5)) ||
+					(!strncmp(opt_str,"ERROR",5)))
+				Curr_view_opt = 3;
+			else if((!strncmp(opt_str,"help",4)) || 
+				(!strncmp(opt_str,"HELP",4)))
+			  {
+    printf("Did - DIM Information Display\n");
+    printf("\t-all             Show ALL Servers\n");
+    printf("\t-service=<str>   Show Servers providing Service <str>\n");
+    printf("\t-node=<nodename> Show Servers on Node <nodename>\n");
+    printf("\t-error           Show Servers in Error\n");
+    printf("\t-help            Show this message\n\n");
+    exit(0);
+			  }
+			else
+				Curr_view_opt = -1;
+			if((Curr_view_opt == 0) || (Curr_view_opt == 2))
+			{
+  				if(!(ptr = strchr(argv[1],'=')))
+				{
+					if( (ptr = strchr(argv[2],'=')) )
+					{
+						ptr++;
+						if(!(*ptr))
+							ptr = argv[3];
+					}
+					else
+						ptr++;
+				}
+				else
+				{			
+					ptr++;
+					if(!(*ptr))
+						ptr = argv[2];
+				}
+				for(i = 0;*ptr; ptr++, i++)
+					Curr_view_opt_par[i] = toupper(*ptr);
+				Curr_view_opt_par[i] = '\0';
+			}
+		}
+	}
+
+    toplevel_widget = (Widget)gui_initialize(argc, argv);
+    app_initialize();
+    /* 
+     * Sit around forever waiting to process X-events.  We never leave
+     * XtAppMainLoop. From here on, we only execute our callback routines. 
+     */
+
+    while(1)
+    {
+		{
+			DISABLE_AST
+			mask = XtAppPending(app_context);	
+			ENABLE_AST
+		}
+		if(mask)
+		{
+			DISABLE_AST
+			XtAppProcessEvent(app_context, mask);
+			if(Got_Service_List)
+			{
+				do_got_service_list(Got_Service_List);
+				Got_Service_List = 0;
+			}
+			if(Got_Client_List)
+			{
+				do_show_clients(Got_Client_List);
+				Got_Client_List = 0;
+			}
+			ENABLE_AST
+		}		
+		else
+		{
+			dim_usleep(100000);
+			/*
+			usleep(100000);	
+			*/
+		}
+    }
+
+}
+
+static char no_link = -1;
+
+void app_initialize(int tag)
+{
+void check_put_label();
+
+void update_servers();
+void update_servers_new();
+void update_show_servers();
+extern void get_all_colors();
+extern void set_title();
+extern void set_icon_title();
+
+	if(tag){}
+	get_all_colors(display,Matrix_id[Curr_matrix]);
+	set_title(toplevel_widget,"DID - DIM Information Display");
+	set_icon_title(toplevel_widget,"DID");
+	Timer_q = dtq_create();
+	dic_info_service("DIS_DNS/SERVER_INFO",MONITORED,0,0,0,update_servers,0,
+						&no_link,1);
+	/*
+      	dic_info_service("DIS_DNS/SERVER_LIST",MONITORED,0,0,0,
+			 update_servers_new,0, &no_link,1);
+	*/
+	/*	
+	dtq_add_entry(Timer_q, 2, check_put_label, 0);
+	*/
+	XtAppAddTimeOut(app_context, 1000, update_show_servers, 0); 
+}
+
+/*
+ * All errors are fatal.
+ */
+void s_error(char *problem_string)
+{
+    printf("%s\n", problem_string);
+    exit(0);
+}
+
+void did_exit(Widget w, int *tag, unsigned long *reason)
+{
+	if(w){}
+	if(tag){}
+	if(reason){}
+	exit(0);
+}
+
+extern Pixel rgb_colors[MAX_COLORS];
+
+void create_main (Widget w, int *tag, unsigned long *reason)
+{
+	if(tag){}
+	if(reason){}
+	Window_id = w;
+/*
+	dtq_start_timer(5, app_initialize, 0);
+*/
+}
+
+void view_opts(Widget w, int tag, unsigned long *reason)
+{
+	void get_server_node(), get_server_service(), show_servers();
+
+	if(w){}
+	if(reason){}
+	Curr_view_opt = tag;
+	switch(tag)
+	{
+		case 0 :
+			get_server_node();
+			break;
+		case 1 :
+			show_servers();
+			break;
+		case 2 :
+			get_server_service();
+			break;
+		case 3 :
+			show_servers();
+			break;
+	}
+}
+
+void dns_control(Widget w, int tag, unsigned long *reason)
+{
+
+	if(w){}
+	if(reason){}
+	switch(tag)
+	{
+		case 0 :
+			dic_cmnd_service("DIS_DNS/PRINT_STATS",0,0);
+			break;
+		case 1 :
+			dic_cmnd_service("DIS_DNS/DEBUG_ON",0,0);
+			break;
+		case 2 :
+			dic_cmnd_service("DIS_DNS/DEBUG_OFF",0,0);
+			break;
+		case 3 :
+			put_selection(DID_KILL_ALL,"Confirmation");
+			break;
+		case 4 :
+			dic_cmnd_service("DIS_DNS/PRINT_HASH_TABLE",0,0);
+			break;
+	}
+}
+
+void get_server_node()
+{
+Widget id,sel_id;
+int i, j, n_nodes, curr_index = 0;
+char nodes_str[MAX_NODE_NAME*MAX_CONNS], max_str[MAX_NODE_NAME];
+char *ptr, *nodeptrs[MAX_CONNS], *curr_str, *sptr;
+int get_nodes();
+
+	sel_id = put_selection(DID_SEL_NODE,"Node Selection");
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_HELP_BUTTON);
+	XtUnmanageChild(id);
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_APPLY_BUTTON);
+	XtUnmanageChild(id);
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST);
+	XmListDeleteAllItems(id);
+	n_nodes = get_nodes(nodes_str);
+	ptr = nodes_str;
+
+	for(i=0;i<n_nodes;i++)
+	{
+		nodeptrs[i] = ptr;
+		sptr = ptr;
+		ptr = strchr(ptr,'\n');
+		for(j = 0; j < (int)strlen(sptr); j++)
+		  sptr[j] = tolower(sptr[j]);
+		*ptr++ = '\0';
+	}
+	strcpy(max_str,"zzzzzzzzzzzzzzzzzzzzzzzzzzzz");
+	for(i=0;i<n_nodes; i++)
+	{
+	  curr_str = max_str;
+	  for(j=0;j<n_nodes; j++)
+	  {
+	    sptr = nodeptrs[j];
+	    if(!sptr)
+	      continue;
+	    
+	    if(strcmp(sptr,curr_str) < 0)
+	    {
+	      curr_str = sptr;
+	      curr_index = j;
+	    }
+	  }
+	  nodeptrs[curr_index] = 0;
+	  XmListAddItem(id,create_str(curr_str),i+1);
+	}
+	/*
+	for(i=0;i<n_nodes;i++)
+	{
+		node = ptr;
+		ptr = strchr(ptr,'\n');
+		*ptr++ = '\0';
+		XmListAddItem(id,create_str(node),i+1);
+	}
+	*/
+	set_something(id,XmNlistItemCount,i);
+	set_something(id,XmNlistVisibleItemCount,(i < 8) ? i : 8);
+}	
+
+void get_server_service()
+{
+Widget id,sel_id;
+
+	sel_id = put_selection(DID_SEL_SERVICE,"Service Selection");
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_HELP_BUTTON);
+	XtUnmanageChild(id);
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_APPLY_BUTTON);
+	XtUnmanageChild(id);
+	
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST);
+	/*
+	XtUnmanageChild(id);
+	*/
+	XtUnmapWidget(id);
+	
+	/*
+	id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST_LABEL);
+	XtUnmanageChild(id);
+	*/
+}	
+
+int get_nodes(char *node_ptr)
+{
+DNS_SERVER_INFO *ptr;
+int n_nodes = 0;
+SERVER *servp;
+
+	node_ptr[0] = '\0';
+	servp = Server_head;
+	while( (servp = (SERVER *)sll_get_next((SLL *)servp)) )
+	{
+		ptr = &servp->server;
+		if(strstr(node_ptr,ptr->node) <= (char *)0)
+		{
+			strcat(node_ptr,ptr->node);
+			strcat(node_ptr,"\n");
+			n_nodes++;
+		}
+	}
+	return(n_nodes);
+}
+
+void get_service_format()
+{
+
+	char str[256], *ptr, *ptr1;
+	int rpc_flag;
+
+	strcpy(str,Curr_service_name);
+	rpc_flag = 0;
+	if( (ptr = strstr(str,"/RpcIn")) )
+	{
+		*ptr = '\0';
+		rpc_flag = 1;
+	}
+	if( (ptr = strstr(str,"/RpcOut")) )
+	{
+		*ptr = '\0';
+		rpc_flag = 2;
+	}
+	strcat(str,"|");
+	if( (ptr = strstr(Curr_service_list,str)) )
+	{
+		if(!rpc_flag)
+		{
+		    ptr += strlen(str);
+		    ptr1 = strchr(ptr,'|');
+		}
+		else if(rpc_flag == 1)
+		{
+		    ptr += strlen(str);
+		    ptr1 = strchr(ptr,',');
+		}
+		else
+		{
+		    ptr += strlen(str);
+		    ptr = strchr(ptr,',');
+		    ptr++;
+		    ptr1 = strchr(ptr,'|');
+		}
+	    strncpy(Curr_service_format,ptr,(int)(ptr1 - ptr));
+	    Curr_service_format[(int)(ptr1-ptr)] = '\0';
+	}
+}
+
+void recv_service_info(int *tag, int *buffer, int *size)
+{
+/*
+	char str[256], *ptr, *ptr1;
+	int rpc_flag;
+*/
+	void print_service_formatted();
+
+	if(tag){}
+	Service_content_str = malloc(1024 + (*size)*16);
+	Service_buffer = malloc(*size);
+	memcpy(Service_buffer, (char *)buffer, *size);
+	Service_size = *size;
+	get_service_format();
+	if((*size == 4 ) && (*buffer == -1))
+	{
+		sprintf(Service_content_str,
+			"Service %s Not Available\n", Curr_service_name);
+	}
+	else
+	{
+	  switch(Curr_service_print_type)
+	  {
+	  case 0:
+		print_service_formatted(buffer,*size);
+		break;
+		/*
+	  case 1:
+		print_service_float(buffer, ((*size - 1) / 4) + 1);
+		break;
+	  case 2:
+		print_service_double(buffer, ((*size - 1) / 4) + 1);
+		break;
+		*/
+	  }
+	}
+	set_something(Content_label_id,XmNlabelString, Service_content_str);
+	/*
+	if(Matrix_id[Curr_matrix])
+	  XFlush(XtDisplay(Matrix_id[Curr_matrix]));
+	*/
+}
+	
+void print_service_formatted(void *buff, int size)
+{
+char type;
+int num, ret;
+char str[128];
+char *ptr;
+void *buffer_ptr;
+char timestr[128], aux[10];
+int quality = 0, secs = 0, mili = 0; 
+int did_write_string(char, int, void **, int);
+time_t tsecs;
+
+  sprintf(Service_content_str,
+	  "Service %s (%s) Contents :\n  \n", Curr_service_name,
+	  Curr_service_format);
+  /*
+  if(Curr_service_id)
+  {
+  */
+    dic_get_timestamp(0, &secs, &mili);
+    quality = dic_get_quality(0);
+/*
+#ifdef LYNXOS
+	ctime_r((time_t *)&secs, timestr, 128);
+#else
+	ctime_r((time_t *)&secs, timestr);
+#endif
+*/
+	tsecs = secs;
+	my_ctime(&tsecs, timestr, 128);
+    ptr = strrchr(timestr,' ');
+    strcpy(aux, ptr);
+    sprintf(ptr,".%03d",mili);
+    strcat(timestr, aux);
+    timestr[strlen(timestr)-1] = '\0';
+   
+    sprintf(str," Timestamp: %s               Quality: %d\n\n",
+	  timestr, quality);
+
+    strcat(Service_content_str,str);
+    /*
+  }
+    */
+   ptr = Curr_service_format;
+   buffer_ptr = buff;
+   while(*ptr)
+   { 
+     type = *ptr++;
+     if(*ptr == ':')
+       {
+	 ptr++;
+	 sscanf(ptr, "%d", &num);
+	 ret = did_write_string(type, num, &buffer_ptr, size);
+	 size -= ret;
+	 if( (ptr = strchr(ptr,';')) )
+	   ptr++;
+	 else
+	   break;
+       }
+       else
+       {
+	 ret = did_write_string(type, 0, &buffer_ptr, size);
+	 size -= ret;
+	 break;
+       }
+   }
+}
+
+int did_write_string(char type, int num, void **buffer_ptr, int ssize)
+{
+void *ptr;
+int size, psize;
+
+  void print_service_standard();
+  void print_service_char();
+  void print_service_short();
+  void print_service_float();
+  void print_service_double();
+
+  ptr = *buffer_ptr;
+  switch(type)
+    {
+    case 'L':
+    case 'l':
+      strcat(Service_content_str," L");
+      if(!num)
+	size = ssize/sizeof(int);
+      else
+	size = num;
+      psize = size * sizeof(int);
+      print_service_standard(ptr, size);
+      break;
+    case 'I':
+    case 'i':
+      strcat(Service_content_str," I");
+      if(!num)
+	size = ssize/sizeof(int);
+      else
+	size = num;
+      psize = size * sizeof(int);
+      print_service_standard(ptr, size);
+      break;
+    case 'S':
+    case 's':
+      strcat(Service_content_str," S");
+      if(!num)
+	size = ssize/sizeof(short);
+      else
+	size = num;
+      psize = size * sizeof(short);
+      print_service_short(ptr, size);
+      break;
+    case 'F':
+    case 'f':
+      strcat(Service_content_str," F");
+      if(!num)
+	size = ssize/sizeof(float);
+      else
+	size = num;
+      psize = size * sizeof(float);
+      print_service_float(ptr, size);
+      break;
+    case 'D':
+    case 'd':
+      strcat(Service_content_str," D");
+      if(!num)
+	size = ssize/sizeof(double);
+      else
+	size = num;
+      psize = size * sizeof(double);
+      print_service_double(ptr, size);
+      break;
+    case 'X':
+    case 'x':
+      strcat(Service_content_str," X");
+      if(!num)
+	size = ssize/sizeof(longlong);
+      else
+	size = num;
+      psize = size * sizeof(longlong);
+      print_service_standard(ptr, size*2);
+      break;
+    case 'C':
+    case 'c':
+    default:
+      strcat(Service_content_str," C");
+      if(!num)
+	size = ssize;
+      else
+	size = num;
+      psize = size;
+      print_service_char(ptr, size);
+    }
+  ptr = (char *)ptr + psize;
+  *buffer_ptr = ptr;
+  return psize;
+}
+/*
+print_service(buff, size)
+int *buff, size;
+{
+int i,j, str_flag = 0;
+char *asc, *ptr, str[80];
+int last[4];
+
+	sprintf(Service_content_str,
+		"Service %s (%s) Contents :\n  \n", Curr_service_name,
+		Curr_service_format);
+	asc = (char *)buff;
+	for( i = 0; i < size; i++)
+	{
+		if(i%4 == 0)
+		{
+			sprintf(str,"%4d: ",i);
+			strcat(Service_content_str,str);
+		}
+		if(!(i%4))
+			strcat(Service_content_str,"H");
+		sprintf(str,"   %08X ",buff[i]);
+		strcat(Service_content_str,str);
+		last[i%4] = buff[i];
+		if(i%4 == 3)
+		{
+			strcat(Service_content_str,"   '");
+			for(j = 0; j <16; j++)
+			{
+				if(isprint(asc[j]))
+				{
+					sprintf(str,"%c",asc[j]);
+					strcat(Service_content_str,str);
+				}
+				else
+				{
+					sprintf(str,".");
+					strcat(Service_content_str,str);
+				}
+			}
+			strcat(Service_content_str,"'\n");
+			for(j = 0; j <4; j++)
+			{
+				if(j == 0)
+					strcat(Service_content_str,"      D");
+				sprintf(str,"%11d ",last[j]);
+				strcat(Service_content_str,str);
+			}
+			strcat(Service_content_str,"\n");
+			asc = (char *)&buff[i+1];
+		}
+	}
+	if(i%4)
+	{
+			for(j = 0; j < 4 - (i%4); j++)
+				strcat(Service_content_str,"            ");
+			strcat(Service_content_str,"   '");
+			for(j = 0; j < (i%4) * 4; j++)
+			{
+				if(isprint(asc[j]))
+				{
+					sprintf(str,"%c",asc[j]);
+					strcat(Service_content_str,str);
+				}
+				else
+					strcat(Service_content_str,".");
+			}
+			strcat(Service_content_str,"'\n");
+			for(j = 0; j < (i%4); j++)
+			{
+				if(j == 0)
+					strcat(Service_content_str,"      D");
+				sprintf(str,"%11d ",last[j]);
+				strcat(Service_content_str,str);
+			}
+			strcat(Service_content_str,"\n");
+	}
+}
+*/
+
+void print_service_standard(int *buff, int size)
+{
+int i,j;
+char *asc, *ptr, str[80], tmp[256];
+int last[4];
+
+	asc = (char *)buff;
+	ptr = Service_content_str;
+	ptr += strlen(Service_content_str);
+	for( i = 0; i < size; i++)
+	{
+	  strcpy(tmp,"");
+		if(i%4 == 0)
+		{
+		  if(i != 0)
+		    {
+			strcat(tmp,"  ");
+		    }
+			sprintf(str,"%5d ",i);
+			strcat(tmp,str);
+		}
+		if(!(i%4))
+			strcat(tmp,"H: ");
+		sprintf(str,"    %08X",buff[i]);
+		strcat(tmp,str);
+		last[i%4] = buff[i];
+		if((i%4 == 3) || (i == (size-1)))
+		{
+		  /*
+			if(i%4 != 3)
+			{
+			    for(j = 1; j < 4 - (i%4); j++)
+				strcat(tmp,"            ");
+			}
+			strcat(tmp,"  '");
+			for(j = 0; j < ((i%4)*4)+4 ; j++)
+			{
+				if(isprint(asc[j]))
+				{
+					sprintf(str,"%c",asc[j]);
+					strcat(tmp,str);
+				}
+				else
+				{
+					sprintf(str,".");
+					strcat(tmp,str);
+				}
+			}
+		  */
+			strcat(tmp,"\n");
+			for(j = 0; j <= (i%4); j++)
+			{
+				if(j == 0)
+					strcat(tmp,"        D: ");
+				sprintf(str,"%12d",last[j]);
+				strcat(tmp,str);
+			}
+			strcat(tmp,"\n");
+			asc = (char *)&buff[i+1];
+		}
+		strcpy(ptr, tmp);
+		ptr += strlen(tmp);
+	}
+	strcpy(tmp,"\n");
+	strcpy(ptr, tmp);
+}
+
+void print_service_longlong(longlong *buff, int size)
+{
+int i,j;
+char *asc, *ptr, str[80], tmp[256];
+longlong last[4];
+
+	asc = (char *)buff;
+	ptr = Service_content_str;
+	ptr += strlen(Service_content_str);
+	for( i = 0; i < size; i++)
+	{
+	  strcpy(tmp,"");
+		if(i%4 == 0)
+		{
+		  if(i != 0)
+		    {
+			strcat(tmp,"  ");
+		    }
+			sprintf(str,"%5d ",i);
+			strcat(tmp,str);
+		}
+		if(!(i%4))
+			strcat(tmp,"H: ");
+		sprintf(str,"    %08X",(unsigned)buff[i]);
+		strcat(tmp,str);
+		last[i%4] = buff[i];
+		if((i%4 == 3) || (i == (size-1)))
+		{
+			strcat(tmp,"\n");
+			for(j = 0; j <= (i%4); j++)
+			{
+				if(j == 0)
+					strcat(tmp,"        D: ");
+				sprintf(str,"%12d",(int)last[j]);
+				strcat(tmp,str);
+			}
+			strcat(tmp,"\n");
+			asc = (char *)&buff[i+1];
+		}
+		strcpy(ptr, tmp);
+		ptr += strlen(tmp);
+	}
+	strcpy(tmp,"\n");
+	strcpy(ptr, tmp);
+}
+
+void print_service_short(short *buff, int size)
+{
+int i,j;
+char *asc, *ptr, str[80], tmp[256];
+short last[8];
+
+	asc = (char *)buff;
+	ptr = Service_content_str;
+	ptr += strlen(Service_content_str);
+	for( i = 0; i < size; i++)
+	{
+	  strcpy(tmp,"");
+		if(i%8 == 0)
+		{
+		  if(i != 0)
+		    {
+			strcat(tmp,"  ");
+		    }
+			sprintf(str,"%5d ",i);
+			strcat(tmp,str);
+		}
+		if(!(i%8))
+			strcat(tmp,"H: ");
+		sprintf(str,"  %04X",buff[i]);
+		strcat(tmp,str);
+		last[i%8] = buff[i];
+		if((i%8 == 7) || (i == (size-1)))
+		{
+		  /*
+			if(i%7 != 7)
+			{
+			    for(j = 1; j < 8 - (i%8); j++)
+				strcat(tmp,"      ");
+			}
+			strcat(tmp,"  '");
+			for(j = 0; j < ((i%8)*2)+2 ; j++)
+			{
+				if(isprint(asc[j]))
+				{
+					sprintf(str,"%c",asc[j]);
+					strcat(tmp,str);
+				}
+				else
+				{
+					sprintf(str,".");
+					strcat(tmp,str);
+				}
+			}
+		  */
+			strcat(tmp,"\n");
+			for(j = 0; j <= (i%8); j++)
+			{
+				if(j == 0)
+					strcat(tmp,"        D: ");
+				sprintf(str," %5d",last[j]);
+				strcat(tmp,str);
+			}
+			strcat(tmp,"\n");
+			asc = (char *)&buff[i+1];
+		}
+		strcpy(ptr, tmp);
+		ptr += strlen(tmp);
+	}
+	strcpy(tmp,"\n");
+	strcpy(ptr, tmp);
+}
+
+void print_service_char(char *buff, int size)
+{
+int i,j;
+char *asc, *ptr, str[80], tmp[256];
+char last[16];
+
+	asc = (char *)buff;
+	ptr = Service_content_str;
+	ptr += strlen(Service_content_str);
+	for( i = 0; i < size; i++)
+	{
+	  strcpy(tmp,"");
+		if(i%16 == 0)
+		{
+		  if(i != 0)
+		    {
+			strcat(tmp,"  ");
+		    }
+			sprintf(str,"%5d ",i);
+			strcat(tmp,str);
+		}
+		if(!(i%16))
+			strcat(tmp,"H: ");
+		sprintf(str,"%02X",buff[i]);
+/*		strcat(tmp,str);
+*/
+		strcat(tmp," ");
+		strcat(tmp,&str[strlen(str)-2]);
+		last[i%16] = buff[i];
+		/*
+		if(i%4 == 3)
+		  strcat(tmp," ");
+		*/
+		if((i%16 == 15) || (i == (size-1)))
+		{
+			if(i%16 != 15)
+			{
+			    for(j = 1; j < 16 - (i%16); j++)
+				strcat(tmp,"   ");
+			}
+			strcat(tmp,"    '");
+			for(j = 0; j <= (i%16) ; j++)
+			{
+				if(isprint(asc[j]))
+				{
+					sprintf(str,"%c",asc[j]);
+					strcat(tmp,str);
+				}
+				else
+				{
+					sprintf(str,".");
+					strcat(tmp,str);
+				}
+			}
+			strcat(tmp,"'\n");
+			asc = (char *)&buff[i+1];
+		}
+		strcpy(ptr, tmp);
+		ptr += strlen(tmp);
+	}
+	strcpy(tmp,"\n");
+	strcpy(ptr, tmp);
+}
+
+void print_service_float(float *buff, int size)
+{
+int i;
+char *ptr, str[80], tmp[256];
+
+	ptr = Service_content_str;
+	ptr += strlen(Service_content_str);
+	for( i = 0; i < size; i++)
+	{
+	  strcpy(tmp,"");
+		if(i%4 == 0)
+		{
+		  if(i != 0)
+		    {
+			strcat(tmp,"  ");
+		    }
+			sprintf(str,"  %5d: ",i);
+			strcat(tmp,str);
+		}
+		sprintf(str,"%12.3G",*(buff++));
+		strcat(tmp,str);
+		if((i%4 == 3) || (i == size-1))
+		{
+			strcat(tmp,"\n");
+		}
+		strcpy(ptr, tmp);
+		ptr += strlen(tmp);
+	}
+	strcpy(tmp,"\n");
+	strcpy(ptr, tmp);
+	ptr += strlen(tmp);
+}
+
+void print_service_double(double *buff, int size)
+{
+int i;
+char *ptr, str[80], tmp[256];
+
+       	ptr = Service_content_str;
+	ptr += strlen(Service_content_str);
+	for( i = 0; i < size; i++)
+	{
+	  strcpy(tmp,"");
+		if(i%4 == 0)
+		{
+		  if(i != 0)
+		    {
+			strcat(tmp,"  ");
+		    }
+			sprintf(str,"  %5d: ",i);
+			strcat(tmp,str);
+		}
+		sprintf(str,"%12.3G",*(buff++));
+		strcat(tmp,str);
+		if((i%4 == 3) || (i == size-1))
+		{
+			strcat(tmp,"\n");
+		}
+		strcpy(ptr, tmp);
+		ptr += strlen(tmp);
+	}
+	strcpy(tmp,"\n");
+	strcpy(ptr, tmp);
+	ptr += strlen(tmp);
+}
+
+void ok_pop_up (Widget w, long tag, unsigned long *reason)
+{
+Widget id, sel_id;
+char *str, *pstr;
+void recv_service_info();
+void did_prepare_command();
+void show_servers();
+
+/*
+	if(tag == 5)
+	{
+		id = (Widget)XmSelectionBoxGetChild(w,XmDIALOG_TEXT);
+		str = (char *)XmTextGetString(id);
+		if(!str[0])
+		{
+			XtFree(str);
+			return;
+		}
+		if( ( fptr = fopen( str, "w" ) ) == (FILE *)0 )
+		{
+    		printf("Cannot open: %s for writing\n",str);
+			return;
+		}                   
+		ptr = &Curr_servp->server;
+		if (ptr->pid > 0x1000000)
+			fprintf(fptr,"Server %s (pid = %X) on node %s\n    provides %d services :\n",
+			Curr_servp->name, ptr->pid, ptr->node, ptr->n_services);
+		else
+			fprintf(fptr,"Server %s (pid = %d) on node %s\n    provides %d services :\n",
+				Curr_servp->name, ptr->pid, ptr->node, ptr->n_services);
+		service_ptr = Curr_servp->service_ptr;
+		for(i=0;i<ptr->n_services; i++)
+		{
+			sprintf(str,service_ptr->name);
+			fprintf(fptr,"        %s\n",service_ptr->name);
+			service_ptr++;
+		}		
+		fclose(fptr);
+		XtFree(str);
+		return;
+	}
+	if(tag == 4)
+	{
+		sel_id = put_selection(4, "Printing...");
+		id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_HELP_BUTTON);
+		XtUnmanageChild(id);
+
+		id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_APPLY_BUTTON);
+		XtUnmanageChild(id);
+		id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_TEXT);
+		str = (char *)XmTextGetString(id);
+		if(!str[0])
+		{
+			XtFree(str);
+			return;
+		}
+		ptr = &Curr_servp->server;
+		if(pstr = strrchr(str,']'))
+			*(++pstr) = '\0';
+		if(pstr = strrchr(str,'/'))
+			*(++pstr) = '\0';
+		sprintf(txt_str,"%s%s.TXT",str,Curr_servp->name);
+		XtFree(str);
+		XmTextSetString(id, txt_str);
+		return;
+	}
+*/
+	if(reason){}
+	if(tag == DID_KILL_ALL)
+	{
+		dic_cmnd_service("DIS_DNS/KILL_SERVERS",0,0);
+		return;
+	}
+	id = XmSelectionBoxGetChild(w,XmDIALOG_TEXT);
+	str = XmTextGetString(id);
+	if(!str[0])
+	{
+		XtFree(str);
+		return;
+	}
+        if ((tag == DID_SEL_NODE) || (tag == DID_SEL_SERVICE)) 
+	{
+		strcpy(Curr_view_opt_par, str);
+		show_servers();
+		XtFree(str);
+	}
+        if(tag == DID_SERVICES)
+	{
+	  pstr = strchr(str,' ');
+	  if(!pstr)
+	    {
+	      strcpy(Curr_service_name, str);
+	      strcpy(str,"SVC");
+	    }
+	  else
+	    {
+	      pstr++;
+	      strcpy(Curr_service_name, pstr);
+	    }
+	  if(Curr_service_id)
+	    {
+	      dic_release_service(Curr_service_id);
+	      Curr_service_id = 0;
+	    }
+	  if(str[0] == 'S')
+	    {
+	      /*
+	      if((!strstr(pstr,"/SERVICE_LIST")) && 
+		 (!strstr(pstr,"/CLIENT_LIST")) &&
+		 (!strstr(pstr,"/SERVER_LIST")))
+		{
+		  Curr_service_id = dic_info_service(Curr_service_name,
+		                             MONITORED,5,0,0,
+					     recv_service_info,0,
+						     &no_link_int,4);
+		}
+	      else
+		{
+	      */
+	      dic_info_service_stamped(Curr_service_name,
+							 ONCE_ONLY,10,0,0,
+					     recv_service_info,0,
+						     &no_link_int,4);
+		  /*
+		}
+		  */
+	      put_selection(DID_SERVICE,"Service Contents");
+	    }
+	  else
+	    {
+	      get_service_format();
+	      sel_id = put_selection(DID_COMMAND,"Send Command");
+	      id = XmSelectionBoxGetChild(sel_id,XmDIALOG_HELP_BUTTON);
+	      XtUnmanageChild(id);
+	      id = XmSelectionBoxGetChild(sel_id,XmDIALOG_APPLY_BUTTON);
+	      XtUnmanageChild(id);
+	      id = XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST);
+	      /*
+	      XtUnmanageChild(id);
+	      */
+	      XtUnmapWidget(id);
+	    }
+	  XtFree(str);
+	}
+        if(tag == DID_COMMAND)
+	{
+	  did_prepare_command(str);
+	  XtFree(str);
+	}
+}
+
+int get_type_size(char type)
+{
+  int size;
+
+  switch(type)
+    {
+    case 'L':
+    case 'l':
+      size = sizeof(long);
+      break;
+    case 'I':
+    case 'i':
+      size = sizeof(int);
+      break;
+    case 'S':
+    case 's':
+      size = sizeof(short);
+      break;
+    case 'F':
+    case 'f':
+      size = sizeof(float);
+      break;
+    case 'D':
+    case 'd':
+      size = sizeof(double);
+      break;
+    case 'C':
+    case 'c':
+    default:
+      size = 1;
+    }
+  return(size);
+}
+
+void did_prepare_command(char *str)
+{
+char type;
+int num;
+int size, full_size = 0;
+char *ptr;
+static int last_size = 0;
+static void *last_buffer = 0;
+void *buffer_ptr;
+char *str_ptr;
+void did_read_string(char, int, void **, char **);
+
+   str_ptr = str; 
+   ptr = Curr_service_format; 
+   while(*ptr)
+   { 
+     type = *ptr++;
+     if(*ptr == ':')
+       {
+	 ptr++;
+	 size = get_type_size(type);
+	 sscanf(ptr, "%d", &num);
+	 full_size += size * num;
+	 if( (ptr = strchr(ptr,';')) )
+	   ptr++;
+	 else
+	   break;
+       }
+   }
+
+   full_size += 256;
+   if(full_size > last_size)
+   {
+      if(last_size)
+	free(last_buffer);
+      last_buffer = malloc(full_size);
+      last_size = full_size;
+   }
+   buffer_ptr = last_buffer;
+   ptr = Curr_service_format; 
+   while(*ptr)
+   { 
+     type = *ptr++;
+     if(*ptr == ':')
+       {
+	 ptr++;
+	 sscanf(ptr, "%d", &num);
+	 did_read_string(type, num, &buffer_ptr, &str_ptr);  
+	 if(!str_ptr)
+	     break;
+	 if( (ptr = strchr(ptr,';')) )
+	   ptr++;
+	 else
+	   break;
+       }
+       else
+       {
+	 did_read_string(type, 0, &buffer_ptr, &str_ptr);
+	 break;
+       }
+   }
+   full_size = (int) ((char *)buffer_ptr - (char *)last_buffer);
+   dic_cmnd_service(Curr_service_name,last_buffer,full_size);
+}
+
+int read_str_int(char *str)
+{
+  int i;
+  if((str[0] == '0') && (str[1] == 'x'))
+    sscanf(str+2,"%x",&i);
+  else
+    sscanf(str,"%d",&i);
+  return(i);
+}
+
+int read_str_char(char *str, char *cc)
+{
+
+  if(str[0] == '\'')
+    *cc = str[1];
+  else if(str[0] == '\"')
+    return(0);
+  else if((str[0] == '0') && (str[1] == 'x'))
+    sscanf(str+2,"%x",(int *)cc);
+  else if(isalpha(str[0]))
+    return(-1);
+  else
+    sscanf(str,"%d",(int *)cc);
+  return(1);
+}
+
+void did_read_string(char type, int num, void **buffer_ptr, char **str_ptr)
+{
+int i, ret = 0;
+float ff;
+double dd;
+void *ptr;
+char *strp, *ptr1;
+char cc;
+ short s;
+
+  strp = *str_ptr; 
+  ptr = *buffer_ptr;
+  if(!num)
+    num = 1000000;
+  switch(type)
+    {
+    case 'L':
+    case 'l':
+    case 'I':
+    case 'i':
+      for(i = 0; i<num; i++)
+      {
+	*(int *)ptr = read_str_int(strp);
+	ptr = (int *)ptr +1;
+	if( (strp = strchr(strp,' ')) )
+	  strp++;
+	else
+	  break;
+      }
+      break;
+    case 'S':
+    case 's':
+      for(i = 0; i<num; i++)
+      {
+	s = (short)read_str_int(strp);
+	*((short *)ptr) = s;
+	ptr = (short *)ptr +1;
+	if( (strp = strchr(strp,' ')) )
+	  strp++;
+	else
+	  break;
+      }
+      break;
+    case 'F':
+    case 'f':
+      for(i = 0; i<num; i++)
+      {
+	sscanf(strp,"%f",&ff);
+	*(float *)ptr = ff;
+	ptr = (float *)ptr +1;
+	if( (strp = strchr(strp,' ')) )
+	  strp++;
+	else
+	  break;
+      }
+      break;
+    case 'D':
+    case 'd':
+      for(i = 0; i<num; i++)
+      {
+	sscanf(strp,"%f",&ff);
+	dd = (double)ff;
+	*(double *)ptr = dd;
+	ptr = (double *)ptr +1;
+	if( (strp = strchr(strp,' ')) )
+	  strp++;
+	else
+	  break;
+      }
+      break;
+    case 'C':
+    case 'c':
+    default:
+      for(i = 0; i<num; i++)
+      {
+	if((ret = read_str_char(strp, &cc)) <= 0)
+	  break;
+	*(char *)ptr = cc;
+	ptr = (char *)ptr +1;
+	if( (strp = strchr(strp,' ')) )
+	  strp++;
+	else
+	  break;
+      }
+      if(ret <= 0)
+      {
+	if(!ret)
+	{
+	  strp++;
+	}
+	num = strlen(strp)+1;
+	strncpy((char *)ptr,strp,num);
+	if( (ptr1 = (char *)strchr((char *)ptr,'\"')) )
+	{
+	  num--;
+	  *ptr1 = '\0';
+	}
+	ptr = (char *)ptr + num;
+	if( (strp = strchr(strp,' ')) )
+	  strp++;
+	else
+	  break;
+      }
+    }
+  *buffer_ptr = ptr;
+  *str_ptr = strp;
+}
+
+void cancel_pop_up (Widget w, int tag, unsigned long *reason)
+{
+	void print_service_formatted();
+
+	if(reason){}
+	if(tag == MAX_POP_UPS+1)
+	{
+	  print_service_formatted(Service_buffer,Service_size);
+		set_something(Content_label_id,XmNlabelString, Service_content_str);
+		Curr_service_print_type = 0;
+	}
+	/*
+	else if(tag == MAX_POP_UPS+2)
+	{
+		print_service_float(Service_buffer, ((Service_size - 1) / 4) + 1);
+		set_something(Content_label_id,XmNlabelString, Service_content_str);
+		Curr_service_print_type = 1;
+	}
+	else if(tag == MAX_POP_UPS+3)
+	{
+		print_service_double(Service_buffer, ((Service_size - 1) / 4) + 1);
+		set_something(Content_label_id,XmNlabelString, Service_content_str);
+		Curr_service_print_type = 2;
+	}
+	*/
+	else if(tag == MAX_POP_UPS+4)
+	{
+
+	      if((!strstr(Curr_service_name,"/SERVICE_LIST")) && 
+		 (!strstr(Curr_service_name,"/CLIENT_LIST")) &&
+		 (!strstr(Curr_service_name,"/SERVER_LIST")))
+		{
+		  if(Curr_service_id)
+		  {
+		      dic_release_service(Curr_service_id);
+		      Curr_service_id = 0;
+		  }
+		  Curr_service_id = dic_info_service_stamped(Curr_service_name,
+						     MONITORED,10,0,0,
+						     recv_service_info,0,
+						     &no_link_int,4);
+		}
+		XtSetSensitive(w, False);
+		XtSetSensitive(SubscribeButton, True);
+	}
+	else if(tag == MAX_POP_UPS+5)
+	{
+
+	      if((!strstr(Curr_service_name,"/SERVICE_LIST")) && 
+		 (!strstr(Curr_service_name,"/CLIENT_LIST")) &&
+		 (!strstr(Curr_service_name,"/SERVER_LIST")))
+		{
+		  if(Curr_service_id)
+		  {
+		      dic_release_service(Curr_service_id);
+		      Curr_service_id = 0;
+		  }
+		  Curr_service_id = dic_info_service_stamped(Curr_service_name,
+						     MONITORED,0,0,0,
+						     recv_service_info,0,
+						     &no_link_int,4);
+		}
+		XtSetSensitive(w, False);
+		XtSetSensitive(Subscribe10Button, True);
+	}
+/*
+	else if(tag == 5)
+	{
+	  *
+		XtUnmapWidget(XtParent(pop_widget_id[4]));
+	  *
+	}
+*/
+	else if(tag == DID_SERVICE)
+	{
+	  if(Curr_service_id)
+	    {
+	      dic_release_service(Curr_service_id);
+	      Curr_service_id = 0;
+	    }
+            XtUnmanageChild(pop_widget_id[DID_SERVICE]);
+	    free(Service_content_str);
+	    free(Service_buffer);
+	}
+}
+
+void create_matrix(Widget w, int *tag, unsigned long *reason)
+{
+
+	if(reason){}
+	Matrix_id[*tag] = w;
+	if(*tag)
+		XtUnmanageChild(w);
+	else
+		Curr_matrix = 0;
+}
+
+void create_label(Widget w, int *tag, unsigned long *reason)
+{
+	if(reason){}
+	if(!*tag)
+		Label_id = w;
+	else
+		Content_label_id = w;
+}
+
+void switch_matrix()
+{
+	/*
+	XtUnmanageChild(Matrix_id[Curr_matrix]);
+	Curr_matrix = (Curr_matrix) ? 0 : 1;
+	XtManageChild(Matrix_id[Curr_matrix]);
+	*/
+	XmScrolledWindowSetAreas(Window_id,NULL, NULL, Matrix_id[Curr_matrix]); 
+}
+
+/*
+static int curr_allocated_size = 0;
+static DNS_SERVER_INFO *dns_info_buffer;
+*/
+
+void update_servers_new(int *tag, char *buffer, int *size)
+{
+	if(tag){}
+	if(size){}
+	printf("Server_list:\n%s\n",buffer);
+}
+
+SERVER *find_server(char *node, int pid)
+{
+  SERVER *servp;
+  DNS_SERVER_INFO *ptr;
+
+  servp = Server_head;
+  while( (servp = (SERVER *)sll_get_next((SLL *)servp)) )
+    {
+      ptr = &servp->server;
+      if((ptr->pid == pid) && (!strcmp(ptr->node,node)))
+	{
+	  return(servp);
+	}
+    }
+  return ((SERVER *)0);
+}
+	  /*
+	if(!(servp = (SERVER *)sll_search((SLL *)Server_head, 
+		(char *)&buffer->server, MAX_NODE_NAME+MAX_TASK_NAME-4)))
+	  */
+
+
+void update_servers(int *tag, DNS_DID *buffer, int *size)
+{
+int n_services, service_size;
+SERVER *servp;
+int j;
+char str[MAX_NAME], sname[MAX_NAME], *ptr;
+
+	if(tag){}
+	if(!Server_head)
+	{
+		Server_head = (SERVER *)malloc(sizeof(SERVER));
+		sll_init((SLL *)Server_head);
+	}
+	if(First_time)
+	{
+		switch_matrix();
+		First_time = 0;
+	}
+
+	if(!*size)
+		return;
+	if(*(char *)buffer == -1)
+	{
+		N_servers = 0;
+		N_services = 0;
+		return;
+	}
+	buffer->server.n_services = vtohl(buffer->server.n_services);
+	buffer->server.pid = vtohl(buffer->server.pid);
+	n_services = buffer->server.n_services;
+
+	if(n_services == 1)
+	  return;
+	strcpy(sname, buffer->server.task);
+	if(n_services > 1)
+	{
+		for(j = 0; j < n_services; j++)
+		{
+			buffer->services[j].type = vtohl(
+				buffer->services[j].type);
+			buffer->services[j].status = vtohl(
+				buffer->services[j].status);
+			buffer->services[j].n_clients = vtohl(
+				buffer->services[j].n_clients);
+			if(strlen(sname) == MAX_TASK_NAME-4-1)
+			{
+				strcpy(str,buffer->services[j].name);
+				if( (ptr = strstr(str,"/CLIENT_LIST")) )
+				{
+					*ptr = '\0';
+					strcpy(sname,str);
+				}
+			}
+		}
+	}
+	if (!(servp = find_server(buffer->server.node,buffer->server.pid)))
+	  /*
+	if(!(servp = (SERVER *)sll_search((SLL *)Server_head, 
+		(char *)&buffer->server, MAX_NODE_NAME+MAX_TASK_NAME-4)))
+	  */
+	{
+		if(n_services)
+		{
+			servp = (SERVER *)malloc(sizeof(SERVER));
+			strcpy(servp->name,sname);
+			servp->next = 0;
+			servp->button_id = 0;
+			servp->pop_widget_id[0] = 0;
+			servp->pop_widget_id[1] = 0;
+			servp->busy = 0;
+			servp->server.n_services = 0;
+			servp->service_ptr = 0;
+			sll_insert_queue((SLL *)Server_head,(SLL *)servp);
+		}
+	}
+	if(n_services != 0)
+	{
+		if(n_services == servp->server.n_services)
+		{
+			return;
+		}
+		if(servp->server.n_services == 0)
+			N_servers++;
+		if(servp->server.n_services != -1)
+			N_services -= servp->server.n_services;
+		memcpy(&servp->server,&buffer->server,sizeof(DNS_SERVER_INFO));
+		if(servp->service_ptr)
+		{
+			free(servp->service_ptr);
+			servp->service_ptr = 0;
+		}
+		if(n_services != -1)
+		{
+			service_size = n_services*sizeof(DNS_SERVICE_INFO);
+			servp->service_ptr = (DNS_SERVICE_INFO *)malloc(service_size);
+			memcpy(servp->service_ptr, buffer->services, service_size);
+			N_services += n_services;
+		}
+		servp->busy = 1;
+	}
+	else
+	{
+	  if(servp)
+	    {
+		N_servers--;
+		if(servp->server.n_services != -1)
+		  {
+			N_services -= servp->server.n_services;
+		  }
+		else
+		  Force_update = 1;
+		servp->server.n_services = 0;
+		servp->busy = -1;
+	    }
+	}
+}
+
+void show_servers()
+{
+SERVER *servp;
+void update_show_servers();
+void remove_all_buttons();
+void put_label();
+
+	if(!Matrix_id[Curr_matrix])
+		return;
+	remove_all_buttons();
+	
+#ifndef linux	
+	switch_matrix();
+#endif
+	put_label();
+	servp = Server_head;
+	while( (servp = (SERVER *)sll_get_next((SLL *)servp)) )
+	{
+	  servp->busy = 1;
+	}
+	Force_update = 1;                
+}
+
+void update_show_servers(void *tag, unsigned long *reason)
+{
+DNS_SERVER_INFO *server_ptr;
+DNS_SERVICE_INFO *service_ptr;
+int i, j, found, n_done = 0;
+Widget w, create_button();
+SERVER *servp, *prevp;
+static int old_n_services = 0;
+char node[MAX_NODE_NAME], par[MAX_NODE_NAME], *ptr;
+void remove_button();
+void remove_all_buttons();
+void put_label();
+
+    DISABLE_AST
+	if(tag){}
+	if(reason){}
+    if((N_services != old_n_services) || (Force_update))
+    {
+        if(!Matrix_id[Curr_matrix])
+	{
+	    XtAppAddTimeOut(app_context, 1000, update_show_servers, 0);
+	    ENABLE_AST
+	    return;
+	}
+	if(!N_servers)
+	{
+		remove_all_buttons();
+		if(! No_link_button_id)
+		{
+			No_link_button_id = create_button("DNS is down", 0);
+			set_color(No_link_button_id, XmNbackground, RED);
+		        get_something(No_link_button_id,XmNuserData,&w);
+			set_color(w, XmNbackground, RED);
+			XtSetSensitive(No_link_button_id, False);
+		}
+		while(!sll_empty((SLL *)Server_head))
+		{
+			servp = (SERVER *)sll_remove_head((SLL *)Server_head);
+			if(servp->service_ptr)
+				free(servp->service_ptr);
+			free(servp);
+		}
+		put_label();
+		old_n_services = N_services;
+		Force_update = 0;
+		XtAppAddTimeOut(app_context, 1000, update_show_servers, 0); 
+		ENABLE_AST
+		return;
+	}
+	if(No_link_button_id)
+	{
+		XtDestroyWidget(No_link_button_id);
+		/*
+		XFlush(XtDisplay(No_link_button_id));
+		*/
+		No_link_button_id = 0;
+        }
+	servp = Server_head;
+	prevp = 0;
+	while( (servp = (SERVER *)sll_get_next((SLL *)servp)) )
+	{
+		if(prevp)
+		{
+			free(prevp);
+			prevp = 0;
+		}
+		if(n_done == 10)
+		{
+		    if(!Force_update)
+		        put_label();
+		    XtAppAddTimeOut(app_context, 100, update_show_servers, 0);
+		    ENABLE_AST
+		    return;
+		}
+		server_ptr = &servp->server;
+		if(servp->busy == 1)
+		{
+			if(!servp->button_id)
+			{
+			switch(Curr_view_opt)
+			{
+				case 1 :
+				  servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
+					n_done++;
+					break;
+				case 0 :
+				  strcpy(node, server_ptr->node);
+				  strcpy(par, Curr_view_opt_par);
+				  ptr = strchr(node, '.');
+				  if(ptr)
+				    *ptr = '\0';
+				  ptr = strchr(par,'.');
+				  if(ptr)
+				    *ptr = '\0';
+				  ptr = node;
+				  for(i = 0; i < (int)strlen(ptr); i++)
+				    ptr[i] = tolower(ptr[i]);
+				  ptr = par;
+				  for(i = 0; i < (int)strlen(ptr); i++)
+				    ptr[i] = tolower(ptr[i]);
+					 if(!strcmp(/*server_ptr->*/node, /*Curr_view_opt_*/par))
+					{
+						servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
+						n_done++;
+					}
+					break;
+				case 2 :
+					found = 0;
+					if(!(service_ptr = servp->service_ptr))
+						break;
+					for(j = 0; j < server_ptr->n_services; j++)
+					{
+						if(strstr(service_ptr->name, Curr_view_opt_par) > (char *)0)
+						{
+							found = 1;
+							break;
+						}
+						service_ptr++;
+					}
+					if (found)
+					  {
+						servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
+						n_done++;
+					  }
+					break;
+				case 3 :
+					if(server_ptr->n_services == -1)
+					{
+						servp->button_id = create_button(/*server_ptr->task*/servp->name, servp);
+						n_done++;
+					}
+					else
+					{
+						if(servp->button_id)
+							remove_button(servp);
+					}
+					n_done++;
+					break;
+			}
+			}
+			servp->busy = 2;
+			if(servp->button_id)
+			{
+				if(Curr_view_opt != -1)
+				{
+					if (server_ptr->n_services == -1)
+					{
+						set_color(servp->button_id, XmNbackground, RED);
+						get_something(servp->button_id,XmNuserData,&w);
+						set_color(w, XmNbackground, RED);
+					}
+					else
+					{
+						set_color(servp->button_id, XmNbackground, GREEN);
+						get_something(servp->button_id,XmNuserData,&w);
+						set_color(w, XmNbackground, GREEN);					 
+					}
+				}
+			}
+		}
+		else if (servp->busy == -1)
+		{
+			remove_button(servp);
+			sll_remove((SLL *)Server_head, (SLL *)servp);
+			if(servp->service_ptr)
+			{
+				free(servp->service_ptr);
+				servp->service_ptr = 0;
+			}
+			prevp = servp;
+			n_done++;
+		}
+	}
+	if(prevp)
+	{
+		free(prevp);
+		prevp = 0;
+	}
+	put_label();
+	old_n_services = N_services;
+	Force_update = 0;
+    }
+    XtAppAddTimeOut(app_context, 1000, update_show_servers, 0);
+    ENABLE_AST
+}
+
+Widget create_button(char *name, SERVER *servp)
+{
+Arg arglist[10];
+int n, n_services = -1;
+Widget w, ww, w_id;
+void activate_services(), activate_clients();
+char w_name[MAX_NAME];
+	
+	w_name[0] = 0;
+	if(servp)
+		n_services = servp->server.n_services;
+    strcpy(w_name,name);
+	if(strlen(w_name) >= MAX_TASK_NAME - 4)
+	  w_name[16] = '\0';
+	n = 0;
+    XtSetArg(arglist[n], XmNorientation, XmVERTICAL);  n++;
+    XtSetArg(arglist[n], XmNentryAlignment, XmALIGNMENT_CENTER);  n++;
+	w_id = w = XmCreateMenuBar(Matrix_id[Curr_matrix],
+				(String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET),
+				arglist,n);
+/*				
+	if(n_services == -1)
+		set_color(w, XmNbackground, RED);
+	else
+		set_color(w, XmNbackground, GREEN);
+*/
+	XtManageChild(w);
+	strcat(w_name,"1"); 
+	n = 0;
+    XtSetArg(arglist[n], XmNalignment, XmALIGNMENT_CENTER);  n++;
+	XtSetArg(arglist[n], XmNfontList, did_server_font);  n++;
+	w = XmCreateCascadeButton(w,
+				(String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET),
+				arglist,n);
+	set_something(w,XmNlabelString,name);
+	set_something(w,XmNalignment,XmALIGNMENT_CENTER);
+/*
+	if(n_services == -1)
+		set_color(w, XmNbackground, RED);
+	else
+		set_color(w, XmNbackground, GREEN);
+*/
+	set_something(w_id,XmNuserData,w);
+	strcat(w_name,"1"); 
+		n = 0;
+		ww = XmCreatePulldownMenu(w_id,
+				(String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET),
+				arglist,n);
+		set_something(w,XmNsubMenuId,ww);
+		XtManageChild(w);
+		strcat(w_name,"1"); 
+		n = 0;
+		XtSetArg(arglist[n], XmNfontList, did_default_font);  n++;
+		w = XmCreatePushButton(ww,
+				(String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET),
+				arglist,n);
+
+		set_something(w,XmNlabelString,"Services");
+	if(servp)
+	{
+		XtAddCallback(w,XmNactivateCallback, activate_services, servp);
+		XtManageChild(w);
+		strcat(w_name,"1"); 
+		n = 0;
+		XtSetArg(arglist[n], XmNfontList, did_default_font);  n++;
+		w = XmCreatePushButton(ww,
+				(String)XmStringCreateLtoR ( w_name,XmSTRING_DEFAULT_CHARSET),
+				arglist,n);
+
+		set_something(w,XmNlabelString,"Clients");
+		XtAddCallback(w,XmNactivateCallback, activate_clients, servp);
+		XtManageChild(w);
+		/*
+		servp->popping = 0;
+		create_client_popup(servp);
+		*/
+	}
+	return(w_id);
+}
+
+void remove_all_buttons()
+{
+SERVER *servp;
+
+	servp = Server_head;
+	while( (servp = (SERVER *)sll_get_next((SLL *)servp)) )
+	{
+		if(servp->button_id)
+		{
+			XtDestroyWidget(servp->button_id);
+			servp->button_id = 0;
+			servp->busy = 0;
+		}
+	}
+}
+
+void remove_button(SERVER *servp)
+{
+
+	if(servp->button_id)
+	{
+		XtDestroyWidget(servp->button_id);
+		servp->button_id = 0;
+		servp->busy = 0;
+	}
+}
+
+void activate_services(Widget w, SERVER *servp, unsigned long *reason)
+{
+DNS_SERVER_INFO *ptr;
+char str[MAX_NAME];
+Widget id,sel_id;
+void got_service_list();
+void kick_it();
+
+	if(w){}
+	if(reason){}
+	if(servp->pop_widget_id[0])
+	{
+		XtDestroyWidget(servp->pop_widget_id[0]);
+		servp->pop_widget_id[0] = 0;
+		/*
+		return;
+		*/
+	}
+	Curr_servp = servp;
+	ptr = &servp->server;
+
+	sel_id = put_popup(servp, 0,"Service Info");
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_OK_BUTTON);
+	XtUnmanageChild(id);
+	
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST_LABEL);
+	if (ptr->pid > 0x1000000)
+		sprintf(str,"Server %s (pid = %X) on node %s\n\nprovides %d services :\n",
+			servp->name, ptr->pid, ptr->node, ptr->n_services);
+	else
+		sprintf(str,"Server %s (pid = %d) on node %s\n\nprovides %d services :\n",
+			servp->name, ptr->pid, ptr->node, ptr->n_services);
+	set_something(sel_id,XmNlistLabelString,str);
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST);
+	Curr_service_list_id = id;
+
+	XmListAddItem(id,create_str(
+          "Ordering services alphabeticaly, please be patient..."),1);
+
+	set_something(id,XmNlistItemCount,1);
+	set_something(id,XmNlistVisibleItemCount,1);
+	
+	sprintf(str,"%s/SERVICE_LIST",/*ptr->task*/servp->name);
+	dic_info_service(str,ONCE_ONLY,20,0,0,
+			 got_service_list,(long)servp,"None",5);
+	/*
+#ifdef solaris
+	*/
+	/*
+	XtAppAddTimeOut(app_context, 1000, kick_it, 0);
+	*/
+	/*
+#endif
+	*/
+}
+
+void kick_it()
+{
+  printf("kick_it\n");
+}
+
+typedef char DID_SLOT[MAX_NAME];
+
+void got_service_list(SERVER **servp_ptr, char *buffer, int *size)
+{
+SERVER *servp;
+void do_got_service_list();
+
+	if(size){}
+	servp = *servp_ptr;
+	if(Curr_service_list)
+	  free(Curr_service_list);
+	Curr_service_list = malloc(strlen(buffer)+1);
+	strcpy(Curr_service_list, buffer);
+	/*
+#ifdef solaris
+	*/
+	Got_Service_List = servp;
+	/*
+#else
+	do_got_service_list(servp);
+#endif
+	*/
+}
+
+void do_got_service_list(SERVER *servp)
+{
+char cmd_str[256], svc_str[256];
+DNS_SERVER_INFO *ptr;
+DNS_SERVICE_INFO *service_ptr;
+Widget id;
+char *curr_str, max_str[MAX_NAME], *sptr;
+DID_SLOT *service_list;
+int i, j, curr_index = 0, n_services;
+XmString xstr;
+void delete_str();
+
+	ptr = &servp->server;
+	id = Curr_service_list_id;
+	
+	XmListDeleteAllItems(id);
+	
+	strcpy(cmd_str,"CMD: ");
+	strcpy(svc_str,"SVC: ");
+
+	service_ptr = servp->service_ptr;
+	service_list = (DID_SLOT *)malloc(ptr->n_services * MAX_NAME);
+	n_services = ptr->n_services;
+
+	for(i=0;i<n_services; i++)
+	{
+	  strcpy(service_list[i],service_ptr->name);
+	  service_ptr++;
+	}
+	strcpy(max_str,"zzzzzzzzzzzzzzzzzzzzzzzzzzzz");
+	for(i=0;i<n_services; i++)
+	{
+	  curr_str = max_str;
+	  for(j=0;j<n_services; j++)
+	  {
+	    sptr = service_list[j];
+	    if(!*sptr)
+	      continue;
+	    
+	    if(strcmp(sptr,curr_str) < 0)
+	    {
+	      curr_str = sptr;
+	      curr_index = j;
+	    }
+	  }
+	  service_list[curr_index][0] = '\0';
+	  service_ptr = &(servp->service_ptr[curr_index]);
+	  if(service_ptr->type)
+	  {
+	    strcpy(&cmd_str[5],service_ptr->name);
+	    xstr = create_str(cmd_str);
+	    XmListAddItem(id,xstr,i+1);
+	    delete_str(xstr);
+	  }
+	  else
+	  {
+	    strcpy(&svc_str[5],service_ptr->name);
+	    xstr = create_str(svc_str);
+	    XmListAddItem(id,xstr,i+1);
+	    delete_str(xstr);
+	  }
+	}
+	free(service_list);
+	
+	set_something(id,XmNlistItemCount,i);
+	set_something(id,XmNlistVisibleItemCount,(i < 20) ? i : 20);
+}
+
+void show_clients(SERVER **servp_ptr, char *buffer, int *size)
+{
+SERVER *servp;
+void do_show_clients();
+
+	if(size){}
+	servp = *servp_ptr;
+	if(Curr_client_list)
+	  free(Curr_client_list);
+	Curr_client_list = malloc(strlen(buffer)+1);
+	strcpy(Curr_client_list, buffer);
+	/*
+#ifdef solaris
+	*/
+	Got_Client_List = servp;
+	/*
+#else
+	do_show_clients(servp);
+#endif
+	*/
+}
+
+void do_show_clients(SERVER *servp)
+{
+int i = 0;
+char str[2048], *strp, *strp1;
+DNS_SERVER_INFO *ptr;
+XmString xstr;
+void delete_str();
+
+	ptr = &servp->server;
+	/*
+	sel_id = servp->pop_widget_id[1];
+	id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST_LABEL);
+	*/
+	if(Curr_client_list[0] == -1) 
+	{
+		sprintf(str,"Information not available\n");
+		XmListAddItem(Curr_client_id,create_str(str),i+1);
+		/*
+		set_something(sel_id,XmNlistLabelString,str);
+		*/
+		return;
+	}
+	/*
+	sprintf(str,"Clients of %s are :                                  \n",
+	ptr->task);
+	set_something(sel_id,XmNlistLabelString,str);
+	
+	id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST);
+	XmListDeleteAllItems(id);
+	*/
+	strp1 = Curr_client_list;
+	while(strp1) 
+	{
+		if(!*strp1)
+			break;
+		sprintf(str,"Process ");
+		strp = strp1;
+		strp1 = strchr(strp,'@');
+		*strp1 = '\0';
+		strp1++;
+		strcat(str,strp);
+		strcat(str," on node ");
+		strp = strp1;
+		if( (strp1 = strchr(strp,'|')) )
+		{
+			*strp1 = '\0';
+			strp1++;
+		}
+		strcat(str,strp);	
+		xstr = create_str(str);
+		XmListAddItem(Curr_client_id,xstr,i+1);
+		delete_str(xstr);
+       		i++;
+	}
+	if(!i)
+	{
+		sprintf(str,"NONE");
+		xstr = create_str(str);
+		XmListAddItem(Curr_client_id,xstr,i+1);
+		delete_str(xstr);
+	}
+	/*
+	set_something(id,XmNlistItemCount,i);
+	*/
+	/*
+	if(Matrix_id[Curr_matrix])
+	  XFlush(XtDisplay(Matrix_id[Curr_matrix]));
+	*/
+}
+
+void activate_clients(Widget w, SERVER *servp, unsigned long *reason)
+{
+DNS_SERVER_INFO *ptr;
+char str[100];
+void show_clients();
+void kick_it_again();
+Widget id,sel_id;
+
+	if(w) {}
+	if(reason){}
+	Curr_servp = servp;
+	ptr = &servp->server;
+	if(servp->pop_widget_id[1])
+	  {
+		XtDestroyWidget(servp->pop_widget_id[1]);
+		servp->pop_widget_id[1] = 0;
+	  }
+	sel_id = put_popup(servp,1,"Client Info");
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_HELP_BUTTON);
+	XtUnmanageChild(id);
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_APPLY_BUTTON);
+	XtUnmanageChild(id);
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_CANCEL_BUTTON);
+	XtUnmanageChild(id);
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_TEXT);
+	XtUnmanageChild(id);
+
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_SELECTION_LABEL);
+	XtUnmanageChild(id);
+	/*
+	id = (Widget)XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST_LABEL);
+	*/
+	id = XmSelectionBoxGetChild(sel_id,XmDIALOG_LIST);
+	XmListDeleteAllItems(id);
+
+	Curr_client_id = id;
+	sprintf(str,"Clients of %s are :                                   \n",
+		servp->name);
+	set_something(sel_id,XmNlistLabelString,str);
+
+	sprintf(str,"%s/CLIENT_LIST",/*ptr->task*/servp->name);
+	dic_info_service(str,ONCE_ONLY,10,0,0,
+			 show_clients,(long)servp,&no_link,1);
+	/*
+#ifdef solaris
+	*/
+	/*
+	XtAppAddTimeOut(app_context, 1000, kick_it_again, 0); 
+	*/
+	/*
+#endif
+	*/
+}
+
+void kick_it_again()
+{
+  printf("kick_it_again\n");
+}
+
+Widget put_popup(SERVER *servp, int type, char *title)
+{
+    Widget id;
+    void activate_services(), activate_clients();
+	extern void set_title();
+
+		if(type)
+		{
+		    id = create_client_dialog();
+		    /*
+		    XtAddCallback(id,XmNokCallback, activate_clients, servp);
+		    XtAddCallback(id,XmNcancelCallback, activate_clients, servp);
+		    */
+		}
+		else
+		{
+		    id = create_server_dialog();
+		    /*
+		    XtAddCallback(id,XmNcancelCallback, activate_services, servp);
+		    */
+		}
+		servp->pop_widget_id[type] = id;
+		/*
+	}
+		*/
+	XtManageChild(id);
+	set_title(XtParent(id),title);
+	return(id);
+}	
+
+Widget put_selection(int tag, char *title)
+{
+    Widget id = 0;
+	extern void set_title();
+
+    if(pop_widget_id[tag])
+    {
+		XtDestroyWidget(pop_widget_id[tag]);
+    }
+	  switch(tag)
+	  {
+	    case DID_SEL_NODE:
+	      id = create_node_selection();
+	      break;
+	    case DID_SEL_SERVICE:
+	      id = create_service_selection();
+	      break;
+	    case DID_KILL_ALL:
+	      id = create_kill_confirmation();
+	      break;
+	    case DID_SERVICE:
+	      id = create_service_dialog();
+	      break;
+	    case DID_COMMAND:
+	      id = create_send_command();
+	      break;
+	  }
+	  
+	   pop_widget_id[tag] = id;
+	XtManageChild(id);
+	set_title(XtParent(id),title);
+	return(id);
+}	
+
+void check_put_label(int tag)
+{
+	static int old_n_services = 0;
+	static int changing = 0;
+	void put_label();
+
+	if(tag){}
+	if(N_services != old_n_services)
+	{
+		put_label();
+		if(N_services > old_n_services)
+		  changing = 1;
+		old_n_services = N_services;
+	
+#ifdef linux
+		show_servers();
+#endif
+	}
+/*
+	else
+	{
+	  if(changing)
+	  {
+	    show_servers();
+	    changing = 0;
+	  }
+	}
+*/
+}
+
+void put_label()
+{
+	char str[MAX_NAME], str1[MAX_NAME];
+			
+	DISABLE_AST
+	sprintf(str,"%d Servers known - %d Services Available\n",
+		N_servers,N_services);
+	switch(Curr_view_opt)
+	{
+		case 1 :
+			strcat(str,"Displaying ALL Servers");
+			break;
+		case 0 :
+			sprintf(str1,"Displaying Servers on node %s",Curr_view_opt_par);
+			strcat(str,str1);
+			break;
+		case 2 :
+			sprintf(str1,"Displaying Servers providing Service *%s*",
+				Curr_view_opt_par);
+			strcat(str,str1);
+			break;
+		case 3 :
+			strcat(str,"Displaying Servers in ERROR");
+			break;
+		case -1 :
+			strcat(str,"Please Select Viewing Option");
+			break;
+	}
+	set_something(Label_id,XmNlabelString,str);
+	XFlush(XtDisplay(Label_id));
+	ENABLE_AST
+}
+
+Widget create_client_dialog()
+{
+  Widget id;
+  id = create_selection_dialog("Dismiss","","","","",DID_CLIENTS, 3);
+  return(id);
+  
+}
+
+Widget create_server_dialog()
+{
+  Widget id;
+  id = create_selection_dialog("","View / Send","Dismiss","",
+			       "Service / Command :",
+			       DID_SERVICES, 20);
+  return(id);
+}
+
+Widget create_node_selection()
+{
+  Widget id;
+  id = create_selection_dialog("","","","Nodes :","Selected Node :",DID_SEL_NODE, 8);
+  return(id);
+  
+}
+
+Widget create_service_selection()
+{
+  Widget id;
+  /*
+  id = create_prompt_dialog("Enter Service Name :",DID_SEL_SERVICE);
+  */
+  id = create_selection_dialog("","","","","Enter Service Name (or search string):",DID_SEL_SERVICE, 0);
+  return(id);
+  
+}
+
+Widget create_send_command()
+{
+  Widget id;
+  char str[256], str1[256];
+
+  sprintf(str,"Command to %s (%s)\n\n",
+	  Curr_service_name, Curr_service_format);
+
+  id = create_selection_dialog("","","",str,"Command:",DID_COMMAND, 1);
+
+  strcpy(str1,"Please enter items separated by spaces:\n(for example: 2 0x123 'A' 23.4 \"a text\")");
+
+  set_something(id,XmNselectionLabelString,str1);
+
+  return(id);
+  
+}
+
+Widget create_kill_confirmation()
+{
+  Widget id;
+  id = create_question_dialog("Do you really want to kill ALL DIM servers ?",
+			      DID_KILL_ALL);
+  return(id);
+  
+}
+
+Widget create_selection_dialog(char *ok, char *apply, char *cancel, char *list, char *sel, 
+							   long tag, int items)
+{
+Widget sd;
+XmString xmOk, xmApply, xmCancel, xmList, xmSelection;
+Arg ar[20];
+int n;
+        
+    xmList = create_str(list);
+    xmOk = create_str(ok);
+    xmApply = create_str(apply);
+    xmCancel = create_str (cancel);
+    xmSelection = create_str (sel);
+
+    n = 0;
+    /*
+    XtSetArg(ar[n],XmNdialogStyle,XmDIALOG_FULL_APPLICATION_MODAL); n++;
+    XtSetArg(ar[n],XmNmwmFunctions,MWM_FUNC_MOVE); n++;
+    */
+    XtSetArg(ar[n],XmNtitle,"Selection"); n++;
+    XtSetArg(ar[n],XmNlabelFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNbuttonFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNtextFontList, did_small_font); n++;
+    XtSetArg(ar[n],XmNborderWidth, 1); n++;
+    XtSetArg(ar[n],XmNlistLabelString, xmList); n++;
+    XtSetArg(ar[n],XmNlistVisibleItemCount,items); n++;
+    if(ok[0])
+      {
+      XtSetArg(ar[n],XmNokLabelString, xmOk); n++;
+      }
+    if(apply[0])
+      {
+      XtSetArg(ar[n],XmNapplyLabelString, xmApply); n++; 
+      }
+    if(cancel[0])
+      {
+      XtSetArg(ar[n],XmNcancelLabelString, xmCancel); n++;
+      }
+    if(sel[0])
+      {
+      XtSetArg(ar[n],XmNselectionLabelString, xmSelection); n++;
+      }
+    sd = XmCreateSelectionDialog ( toplevel_widget, "Selection", ar, n );
+    XmStringFree(xmList);
+    XmStringFree(xmOk);
+    XmStringFree(xmApply);
+    XmStringFree(xmCancel);
+    XmStringFree(xmSelection);
+    if(tag >= 0)
+      {
+	  XtAddCallback ( sd, XmNcancelCallback, 
+		(XtCallbackProc)cancel_pop_up, (XtPointer)tag );
+	  XtAddCallback ( sd, XmNapplyCallback, 
+		(XtCallbackProc)ok_pop_up, (XtPointer)tag );
+	  XtAddCallback ( sd, XmNokCallback, 
+		(XtCallbackProc)ok_pop_up, (XtPointer)tag );
+      }
+    return(sd);
+}
+
+Widget create_file_selection_dialog(long type)
+{
+Widget sd;
+XmString xm1;
+Arg ar[20];
+int n;
+        
+    xm1 = create_str ("");
+    n = 0;
+    /*
+    XtSetArg(ar[n],XmNdialogStyle,XmDIALOG_FULL_APPLICATION_MODAL); n++;
+    XtSetArg(ar[n],XmNmwmFunctions,MWM_FUNC_MOVE); n++;
+    */
+    XtSetArg(ar[n],XmNtitle,"FileSelection"); n++;
+    XtSetArg(ar[n],XmNlabelFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNbuttonFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNtextFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNborderWidth, 1); n++;
+    XtSetArg(ar[n],XmNwidth, 500); n++;
+    XtSetArg(ar[n],XmNdirMask, xm1); n++;
+    sd = XmCreateFileSelectionDialog ( toplevel_widget, "FileSelection", ar, n );
+    
+    XmStringFree(xm1);
+
+    XtAddCallback ( sd, XmNcancelCallback, 
+		(XtCallbackProc)cancel_pop_up, (XtPointer)type );
+    XtAddCallback ( sd, XmNokCallback, 
+		(XtCallbackProc)ok_pop_up, (XtPointer)type );
+
+	return(sd);
+}
+
+Widget create_prompt_dialog(char *label, long tag)
+{
+Widget sd;
+XmString xm1;
+Arg ar[20];
+int n;
+        
+    xm1 = create_str (label);
+    n = 0;
+    XtSetArg(ar[n],XmNlabelFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNbuttonFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNborderWidth, 1); n++;
+    /*
+    XtSetArg(ar[n],XmNwidth, 450); n++;
+    XtSetArg(ar[n],XmNresizePolicy, XmRESIZE_NONE); n++;
+    */
+    XtSetArg(ar[n],XmNselectionLabelString, xm1); n++;
+    sd = XmCreatePromptDialog ( toplevel_widget, "Prompt", ar, n );
+    
+    XmStringFree(xm1);
+
+    XtAddCallback ( sd, XmNcancelCallback, 
+		(XtCallbackProc)cancel_pop_up, (XtPointer)tag );
+    XtAddCallback ( sd, XmNokCallback, 
+		(XtCallbackProc)ok_pop_up, (XtPointer)tag );
+
+	return(sd);
+}
+
+Widget create_question_dialog(char *label, long tag)
+{
+Widget sd;
+XmString xm1;
+Arg ar[20];
+int n;
+        
+    xm1 = create_str (label);
+    n = 0;
+    XtSetArg(ar[n],XmNlabelFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNbuttonFontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNborderWidth, 1); n++;
+    /*
+    XtSetArg(ar[n],XmNwidth, 450); n++;
+    XtSetArg(ar[n],XmNresizePolicy, XmRESIZE_NONE); n++;
+    */
+    XtSetArg(ar[n],XmNmessageString, xm1); n++;
+    sd = XmCreateQuestionDialog ( toplevel_widget, "Question", ar, n );
+    
+    XmStringFree(xm1);
+
+    XtAddCallback ( sd, XmNcancelCallback, 
+		(XtCallbackProc)cancel_pop_up, (XtPointer)tag );
+    XtAddCallback ( sd, XmNokCallback, 
+		(XtCallbackProc)ok_pop_up, (XtPointer)tag );
+
+	return(sd);
+}
+
+Widget create_service_dialog()
+{
+Widget fd, rc, sw, lb, rc1;
+XmString xm1;
+Arg ar[20];
+int n, par;
+unsigned long reason;
+        
+    n = 0; 
+    XtSetArg(ar[n],XmNborderWidth, 1); n++;
+    XtSetArg(ar[n],XmNresizePolicy, XmRESIZE_ANY); n++;
+    fd = XmCreateFormDialog ( toplevel_widget, "Form", ar, n );
+    XtManageChild(fd);
+
+    /* create rowcolumn */
+    n = 0; 
+    XtSetArg(ar[n],XmNborderWidth, 1); n++;
+    XtSetArg(ar[n],XmNentryAlignment, XmALIGNMENT_CENTER); n++;
+    XtSetArg(ar[n],XmNbottomAttachment, XmATTACH_FORM); n++;
+    XtSetArg(ar[n],XmNbottomOffset, 0); n++;
+    XtSetArg(ar[n],XmNrightAttachment, XmATTACH_FORM); n++;
+    XtSetArg(ar[n],XmNrightOffset, 0); n++;
+    XtSetArg(ar[n],XmNtopAttachment, XmATTACH_FORM); n++;
+    XtSetArg(ar[n],XmNtopOffset, 0); n++;
+    XtSetArg(ar[n],XmNleftAttachment, XmATTACH_FORM); n++;
+    XtSetArg(ar[n],XmNleftOffset, 0); n++;
+    rc = XmCreateRowColumn ( fd, "rowcol", ar, n );
+    XtManageChild(rc);
+
+    /* create scrolled window */
+    n = 0;	    
+    XtSetArg ( ar[n], XmNwidth, 770); n++;
+    XtSetArg ( ar[n], XmNheight, 350); n++;
+    XtSetArg ( ar[n], XmNscrollBarDisplayPolicy, XmAS_NEEDED); n++;
+    XtSetArg ( ar[n], XmNscrollingPolicy, XmAUTOMATIC); n++;
+
+    sw = XmCreateScrolledWindow ( rc, "ScrollWin", ar, n );
+    XtManageChild ( sw );
+
+    /* create label */
+    n = 0; 
+    xm1 = create_str(" ");
+    XtSetArg(ar[n],XmNfontList, did_small_font); n++;
+    XtSetArg(ar[n],XmNlabelString, xm1); n++;
+    XtSetArg(ar[n],XmNalignment, XmALIGNMENT_BEGINNING); n++;
+    lb = XmCreateLabel ( sw, "label", ar, n );
+    XtManageChild(lb);
+    XmStringFree(xm1);
+    par = 1;
+    reason = 0;
+    create_label(lb, &par, &reason);
+
+    /* create button rowcolumn */
+    n = 0; 
+    XtSetArg(ar[n],XmNborderWidth, 0); n++;
+    XtSetArg(ar[n],XmNentryAlignment, XmALIGNMENT_CENTER); n++;
+    XtSetArg(ar[n],XmNorientation, XmVERTICAL); n++;
+    XtSetArg(ar[n],XmNnumColumns, 3); n++;
+    XtSetArg(ar[n],XmNpacking, XmPACK_COLUMN); n++;
+    rc1 = XmCreateRowColumn ( rc, "buttons", ar, n );
+    XtManageChild(rc1);
+    /*    
+    create_push_button(rc1,"View Standard",MAX_POP_UPS+1); 
+    create_push_button(rc1,"View Float",MAX_POP_UPS+2); 
+    create_push_button(rc1,"View Double",MAX_POP_UPS+3); 
+    */
+    SubscribeButton = create_push_button(rc1,"            Subscribe (On Change)            ",
+		       MAX_POP_UPS+5); 
+  Subscribe10Button = create_push_button(rc1,"      Subscribe (Update Rate 10 seconds)     ",
+		       MAX_POP_UPS+4); 
+    create_push_button(rc1,"Dismiss",DID_SERVICE);
+    Curr_service_print_type = 0;
+
+    return(fd);
+}
+
+Widget create_push_button(Widget parent, char *str, long tag)
+{
+Widget b;
+XmString xm1;
+Arg ar[20];
+int n;
+        
+    n = 0; 
+    xm1 = create_str(str);
+    XtSetArg(ar[n],XmNalignment, XmALIGNMENT_CENTER); n++;
+    XtSetArg(ar[n],XmNfontList, did_default_font); n++;
+    XtSetArg(ar[n],XmNlabelString, xm1); n++;
+    b = XmCreatePushButton ( parent, "button", ar, n );
+ 
+    XtManageChild(b);
+    XmStringFree(xm1);
+
+    XtAddCallback ( b, XmNactivateCallback, 
+		(XtCallbackProc)cancel_pop_up, (XtPointer)tag ); 
+    return(b);
+}
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/src/did/did.h
===================================================================
--- /trunk/FACT++/dim_v19r15/src/did/did.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/did/did.h	(revision 10183)
@@ -0,0 +1,95 @@
+#include <Mrm/MrmAppl.h>                /* Motif Toolkit and MRM */
+#include <Xm/Xm.h>
+#include <Xm/RowColumn.h>
+#include <Xm/MainW.h>
+#include <Xm/Form.h>
+#include <Xm/Label.h>
+#include <Xm/ScrolledW.h>
+#include <Xm/Separator.h>
+#include <Xm/CascadeB.h>
+#include <Xm/PushB.h>
+#include <Xm/SelectioB.h>
+#include <Xm/FileSB.h>
+#include <Xm/MessageB.h>
+#include <Xm/Text.h>
+#include <Xm/List.h>
+#include <dui_colors.h>
+/* VUIT routines for the user to call */
+void s_error();
+/*
+#define LABEL_FONT "-*-NEW CENTURY SCHOOLBOOK-BOLD-R-*--*-140-*-*-*-*-ISO8859-1"
+#define DEFAULT_FONT "-*-TIMES-BOLD-R-*--*-120-*-*-*-*-ISO8859-1"
+
+#define MENU_FONT "-*-TIMES-BOLD-R-*--*-120-*-*-*-*-ISO8859-1"
+*/
+#define LABEL_FONT "-*-HELVETICA-BOLD-R-*--*-120-*-*-*-*-ISO8859-1"
+
+#define DEFAULT_FONT "-*-HELVETICA-BOLD-R-*--*-100-*-*-*-*-ISO8859-1"
+
+#define MENU_FONT "-*-COURIER-BOLD-R-*--*-100-*-*-*-*-ISO8859-1"
+
+#define SERVER_FONT "-*-TIMES-BOLD-R-*--*-100-*-*-*-*-ISO8859-1"
+
+typedef enum { DID_SERVICES, DID_CLIENTS, DID_SEL_NODE, DID_SEL_SERVICE, 
+    DID_KILL_ALL, DID_SERVICE, DID_COMMAND, MAX_POP_UPS } POPUPS; 
+
+/* Motif Global variables */
+Display         *display;			/* Display variable */
+XtAppContext    app_context;		/* application context */
+Widget			toplevel_widget;	/* Root widget ID of application */
+MrmHierarchy	s_MrmHierarchy;		/* MRM database hierarchy ID */
+
+typedef struct item{
+    struct item *next;
+	DNS_SERVER_INFO server;
+	DNS_SERVICE_INFO *service_ptr;
+        char name[132];
+	Widget button_id;
+	Widget pop_widget_id[2];
+  /*
+	int popping;
+  */
+	int busy;
+}SERVER;
+
+SERVER *Server_head = (SERVER *)0;
+
+Widget Matrix_id[2] = {0, 0};
+int Curr_matrix;
+Widget Label_id = 0;
+Widget Content_label_id = 0;
+Widget Window_id = 0;
+Widget pop_widget_id[MAX_POP_UPS] = {0,0,0,0,0,0,0};
+Widget No_link_button_id;
+
+XmString create_str();
+XmFontList util_get_font();
+
+Widget create_selection_dialog();
+Widget create_file_selection_dialog();
+Widget create_prompt_dialog();
+Widget create_question_dialog();
+Widget create_service_dialog();
+Widget create_server_dialog();
+Widget create_client_dialog();
+Widget create_node_selection();
+Widget create_service_selection();
+Widget create_kill_confirmation();
+Widget create_send_command();
+Widget create_push_button();
+Widget put_popup();
+Widget put_selection();
+
+Widget gui_toplevel();
+Widget gui_initialize();
+void gui_create_main_menu();
+void gui_create_main_window();
+
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/dim_v19r15/src/did/dui_colors.h
===================================================================
--- /trunk/FACT++/dim_v19r15/src/did/dui_colors.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/did/dui_colors.h	(revision 10183)
@@ -0,0 +1,6 @@
+#ifndef DUI_COLORS_H
+#define DUI_COLORS_H
+typedef enum {
+GREEN, BLUE, YELLOW, ORANGE, RED, BLACK, WHITE, NONE, GRAY, LIGHTGRAY, MAX_COLORS }TRG_COLORS;
+
+#endif
Index: /trunk/FACT++/dim_v19r15/src/did/dui_util.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/did/dui_util.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/did/dui_util.c	(revision 10183)
@@ -0,0 +1,308 @@
+/*
+**++
+**  FACILITY:  DUI
+**
+**  MODULE DESCRIPTION:
+**
+**      Implements MOTIF utility functions
+**
+**  AUTHORS:
+**
+**      C. Gaspar
+**
+**  CREATION DATE:  24-01-1993
+**
+**--
+*/
+#include <stdio.h>
+#include <Mrm/MrmAppl.h>                   /* Motif Toolkit */
+#include <Xm/Xm.h>
+
+#include <dim.h>
+#include "dui_util.h"
+
+/* compound strings */
+
+
+static XmString Active_str;
+
+XmString get_str(text)
+char *text;
+{
+
+	Active_str = XmStringCreateLtoR ( text, XmSTRING_DEFAULT_CHARSET); 
+	return(Active_str);
+}
+
+
+void free_str()
+{
+
+	XmStringFree(Active_str);
+}
+
+
+XmString create_str(text)
+char *text;
+{
+XmString str;
+
+
+	str = XmStringCreate ( text, XmSTRING_DEFAULT_CHARSET); 
+	return(str);
+}
+
+void delete_str(str)
+XmString str;
+{
+
+	XmStringFree(str);
+}
+
+void set_something(w, resource, value)
+    Widget w;
+    char *resource, *value;
+{
+    Arg al[1];
+	int free = 0;
+DISABLE_AST
+	if( (!strcmp(resource,XmNlabelString)) ||
+		(!strcmp(resource,XmNmessageString)) ||
+		(!strcmp(resource,XmNtextString)) ||
+		(!strcmp(resource,XmNlistLabelString)) ||
+		(!strcmp(resource,XmNselectionLabelString)) )
+	{
+		free = 1;
+		value = (char *)get_str(value);
+	}
+    XtSetArg(al[0], resource, value);
+    XtSetValues(w, al, 1);
+	if(free)
+		free_str();
+	/*
+	printf("Flushing %s for widget %s...\n",resource,w->core.name);
+	*/
+	/*
+	XFlush(XtDisplay(w));
+	*/
+	/*
+	printf("Flushed!\n");
+	*/
+ENABLE_AST
+}
+
+void get_something(w, resource, value)
+    Widget w;
+    char *resource, *value;
+{
+
+    Arg al[1];
+	int free = 0;
+	XmString str;
+	char *cstr;
+
+	if( (!strcmp(resource,XmNlabelString)) ||
+		(!strcmp(resource,XmNmessageString)) ||
+		(!strcmp(resource,XmNtextString)) ||
+		(!strcmp(resource,XmNlistLabelString)) ||
+		(!strcmp(resource,XmNselectionLabelString)) )
+	{
+		free = 1;
+	    XtSetArg(al[0], resource, &str);
+	}
+	else
+		XtSetArg(al[0], resource, value);
+    XtGetValues(w, al, 1);
+	if(free)
+	{
+		XmStringGetLtoR(str, XmSTRING_DEFAULT_CHARSET, &cstr);
+		strcpy(value,cstr);
+		XtFree(cstr);
+	}
+}
+/*
+void set_something_uid(hid, w, resource, value)
+    MrmHierarchy hid;
+    Widget w;                          
+    char *resource, *value;
+{
+    Arg al[1];
+
+	XtSetArg(al[0], resource, value);
+
+    MrmFetchSetValues(hid, w, al, 1);
+}
+*/
+
+static XmString str_table[50];
+
+XmStringTable create_str_table(strs)
+char strs[50][256];
+{
+int i;
+
+	for(i=0;strs[i][0];i++)
+	{
+		str_table[i] = XmStringCreate ( strs[i], XmSTRING_DEFAULT_CHARSET);
+	}
+	str_table[i] = (XmString)0;
+	return((XmStringTable)str_table);
+}
+
+void del_str_table()
+{
+int i;
+
+	for(i=0;str_table[i];i++)
+		XmStringFree(str_table[i]);
+
+}
+
+Pixel rgb_colors[MAX_COLORS];
+static Pixmap pixmap_colors[MAX_COLORS];
+static Pixmap watch_colors[MAX_COLORS];
+static Pixmap locks[MAX_COLORS];
+static Pixmap unlock;
+static Pixmap faces[MAX_COLORS];
+
+Pixel get_named_color(color)
+int color;
+{
+	return(rgb_colors[color]);
+}
+
+void set_color(w, resource, color) 
+Widget w;
+char *resource;
+int color;
+{
+
+DISABLE_AST
+/*
+	if(resource == XmNbackgroundPixmap)
+*/
+	if(!strcmp(resource,XmNbackgroundPixmap))
+		set_something(w,resource,pixmap_colors[color]);
+	else
+		set_something(w,resource,rgb_colors[color]);
+ENABLE_AST
+}
+	
+void set_watch(w, color) 
+Widget w;
+int color;
+{
+	set_something(w,XmNbackgroundPixmap,watch_colors[color]);
+}
+	
+void set_lock(w, color) 
+Widget w;
+int color;
+{
+	set_something(w,XmNbackgroundPixmap,locks[color]);
+}
+	
+void set_unlock(w) 
+Widget w;
+{
+	set_something(w,XmNbackgroundPixmap,unlock);
+}
+	
+void set_face(w, color) 
+Widget w;
+int color;
+{
+	set_something(w,XmNbackgroundPixmap,faces[color]);
+}
+	
+void get_all_colors(display, w)
+	Display *display;
+	Widget w;
+{
+    XColor a,b;
+    Colormap cm;
+    cm = DefaultColormap ( display, DefaultScreen(display));
+
+    XAllocNamedColor ( display, cm, "Medium Aquamarine", &a,&b );
+    rgb_colors[GREEN] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Turquoise", &a,&b );
+    rgb_colors[BLUE] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Yellow", &a,&b );
+    rgb_colors[YELLOW] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Orange", &a,&b );
+    rgb_colors[ORANGE] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Red", &a,&b );
+    rgb_colors[RED] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Black", &a,&b );
+    rgb_colors[BLACK] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "White", &a,&b );
+    rgb_colors[WHITE] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Light Gray", &a,&b );
+    rgb_colors[GRAY] = b.pixel;
+
+    XAllocNamedColor ( display, cm, "Gainsboro", &a,&b );
+    rgb_colors[LIGHTGRAY] = b.pixel;
+/*
+    MrmFetchColorLiteral(hid, "green", display, 0, &rgb_colors[GREEN]);
+    MrmFetchColorLiteral(hid, "blue", display, 0, &rgb_colors[BLUE]);
+    MrmFetchColorLiteral(hid, "yellow", display, 0, &rgb_colors[YELLOW]);
+    MrmFetchColorLiteral(hid, "orange", display, 0, &rgb_colors[ORANGE]);
+    MrmFetchColorLiteral(hid, "red", display, 0, &rgb_colors[RED]);
+    MrmFetchColorLiteral(hid, "black", display, 0, &rgb_colors[BLACK]);
+    MrmFetchColorLiteral(hid, "white", display, 0, &rgb_colors[WHITE]);
+*/
+     get_something(w,XmNbackground,&rgb_colors[NONE]);
+}
+
+
+static int was_sensitive = 0;
+
+void set_sensitive(widget_id)
+Widget widget_id;
+{
+
+	if(was_sensitive)
+		XtSetSensitive(widget_id,True);
+}
+
+void set_insensitive(widget_id)
+Widget widget_id;
+{
+
+	if( (was_sensitive = XtIsSensitive(widget_id)) )
+		XtSetSensitive(widget_id,False);
+}
+	
+void set_title(w, title)
+    Widget w;
+    char *title;
+{
+    Arg al[1];
+
+    XtSetArg(al[0], XmNtitle, title);
+    XtSetValues(w, al, 1);
+    /*
+	XFlush(XtDisplay(w));
+	*/
+}
+
+void set_icon_title(w, title)
+    Widget w;
+    char *title;
+{
+    Arg al[1];
+
+    XtSetArg(al[0], XmNiconName, title);
+    XtSetValues(w, al, 1);
+    /*
+	XFlush(XtDisplay(w));
+	*/
+}
+
Index: /trunk/FACT++/dim_v19r15/src/did/dui_util.h
===================================================================
--- /trunk/FACT++/dim_v19r15/src/did/dui_util.h	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/did/dui_util.h	(revision 10183)
@@ -0,0 +1,7 @@
+#ifndef DUI_UTIL_H
+#define DUI_UTIL_H
+
+#include "dui_colors.h"
+
+
+#endif
Index: /trunk/FACT++/dim_v19r15/src/dim_jni.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dim_jni.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dim_jni.c	(revision 10183)
@@ -0,0 +1,2737 @@
+/*
+ * dim_JNI_Native.c : JNI native code for dim
+ * routines to be used by Java.
+ *
+ * Started on        : 2000-08-16
+ * Written by        : M.Jonker
+ *
+ * Version history:
+ * 20000911MJJ       First Released Version (Not 100% complete yet)
+ * 31-Oct-2007 Adjustments for 64bit platforms Joern Adamczewski, gsi
+ * 03-Dec-2008 Fix in dim_Client releaseService Hans Essel, gsi
+ *
+ */
+/* TODO Remove these kludges */
+#define dim_Dbg_MEMORY          dim_Dbg_SERIALIZER
+#define dim_Dbg_MUTABLE_MEMORY  dim_Dbg_SERIALIZER
+#define dim_Dbg_MEMORY_ALLOCATE dim_Dbg_SERIALIZER
+
+/* TODO Split the Native and the serialization into two source files */
+/* TODO Release global references when they are not anymore used */
+
+#define DIMLIB
+#include <stdio.h>
+#include "dim.h"
+#include "dic.h"
+#include "dis.h"
+#include "dim_jni.h"
+
+
+#ifdef  JNI_VERSION_1_4
+#define JNI_VERSION JNI_VERSION_1_4
+#else
+#ifdef  JNI_VERSION_1_3
+#define JNI_VERSION JNI_VERSION_1_3
+#else
+#ifdef  JNI_VERSION_1_2
+#define JNI_VERSION JNI_VERSION_1_2
+#else
+#define JNI_VERSION 0x00010001
+#endif
+#endif
+#endif
+#define dim_JNI_version DIM_VERSION_NUMBER
+
+
+// Debug/tracing support ===============================================================================
+// The DBGe (Entry) DBGx (exit) DBGm (middle) DBG (Message only) macros allow for tracing and trapping
+// of native method calls.
+// DBGe, DBGx and DBGm have corresponding trap mask to active entry exits and middle traps
+// By setting DBG_filter to something restrictive, we suppress the code generation of the conditional
+// printouts for all dbg conditions except the conditions specified in the DBG_filter. (Provided the
+// optimiser does its job.)
+#ifndef DBG_filter
+  #ifdef _DEBUG
+    // no filter
+    #define DBG_filter 0xFFFFFFFF
+  #else
+    // filter all but module loading and unloading
+    #define DBG_filter dim_Dbg_MODULE
+  #endif
+#endif
+
+#define DBG(test)  if(((test&DBG_filter) & DBG_mask  ) !=0) /* etc . */
+#define DBGe(test) if(((test&DBG_filter) & DBGe_trap ) !=0) DBG_Trap(test); DBG(test) /* etc ; */
+#define DBGm(test) if(((test&DBG_filter) & DBGm_trap ) !=0) DBG_Trap(test); DBG(test) /* etc ; */
+#define DBGx(test) if(((test&DBG_filter) & DBGx_trap ) !=0) DBG_Trap(test); DBG(test) /* etc ; */
+
+static int DBG_mask = dim_Dbg_MODULE;
+static int DBGe_trap = 0;
+static int DBGm_trap = 0;
+static int DBGx_trap = 0;
+
+static void DBG_Trap(int code)
+{
+  /* if you set a break point here you can trap all */
+  /* native calls that are activated by the mask DBG_trap */
+// TODO DBG_Trap should invoke the debugger
+	if(code){}
+  return;
+}
+// ===============================================================================Debug/tracing support=
+
+
+// Static module variables
+JavaVM*		theJavaVM;
+
+jclass		NativeDataMemory;
+jmethodID NativeDataMemory_new;
+jmethodID NativeDataMemory_decodeData;
+jfieldID	NativeDataMemory_dataAddress;
+jfieldID	NativeDataMemory_dataSize;
+
+jclass		ObjectDescriptor;
+
+jclass		SendSynchronizer;
+jmethodID	SendSynchronizer_new;
+jmethodID	SendSynchronizer_setCompletionCode;
+jmethodID	SendSynchronizer_getCompletionCode;
+
+jclass		ReceiveSynchronizer;
+jmethodID	ReceiveSynchronizer_new;
+jmethodID	ReceiveSynchronizer_decodeNativeData;
+jmethodID	ReceiveSynchronizer_getCompletionCode;
+
+jclass		CompletionHandler;
+jmethodID	CompletionHandler_setCompletionCode;
+
+jclass		NativeDataDecoder;
+jmethodID	NativeDataDecoder_decodeNativeData;
+
+jclass		NativeDataEncoder;
+jmethodID	NativeDataEncoder_encodeNativeData;
+
+jclass		NativeDimTimer;
+jmethodID   NativeDimTimer_timerHandler;
+
+jclass		NativeDimSrvError;
+jmethodID   NativeDimSrvError_errorHandler;
+jmethodID	NativeDimSrvError_new;
+jobject		ourNativeDimSrvError;
+
+jclass		NativeDimCltError;
+jmethodID   NativeDimCltError_errorHandler;
+jmethodID	NativeDimCltError_new;
+jobject		ourNativeDimCltError;
+
+jclass		NativeDimExit;
+jmethodID   NativeDimExit_exitHandler;
+jmethodID	NativeDimExit_new;
+jobject		ourNativeDimExit;
+
+jobject   ourNativeMemoryObject;
+
+#ifdef WIN32
+	DWORD MainThreadId = 0;
+#else
+#ifdef __linux__
+	pthread_t MainThreadId = 0;
+#else
+	int MainThreadId = 0;
+#endif
+#endif
+JNIEnv* TheEnv;
+
+#define NOT_STAMPED 0
+
+// TODO need to get a hook into dim release services so that I can release global references
+// Note: I can test on the user library beeing one of the four DIM_JNI specific callbacks to
+// decide whether the tag was a global reference.
+// I also have to control the copying of the tags by DIM libraries:
+// There may be actually some complications because in certain cases the release service is
+// not invoked but the service is kept on a 'hot-spare' list.
+// In case of DIS, information from the servep structure maybe copied to a dtq structure.
+
+// Forward defintions =====================================================================
+
+void info_service_callback(             jobject* _aDataDecoder, void* data, int* _size);
+void info_service_callback_with_cleanup(jobject* _aDataDecoder, void* data, int* _size);
+void send_callback(jobject* _aCompletionHandler, int* _status);
+
+void server_getInfo_callback(jobject* _aDataEncoder, void* *address, int *size);
+void server_setCmnd_callback(jobject* _aDataDecoder, void  *address, int *size);
+void timer_callback(             jobject* _aDimTimer);
+void server_error_callback(int severity, int code, char *msg);
+void client_error_callback(int severity, int code, char *msg);
+void server_exit_callback(int *code);
+
+
+// DLL load, unload and init ==============================================================
+
+int dim_jni_attachThread(JNIEnv **env)
+{
+#ifdef WIN32
+	DWORD tid;
+	tid = GetCurrentThreadId();
+#else
+#ifdef __linux__
+	pthread_t tid;
+	tid = pthread_self();
+#else
+	int tid = 0;
+#endif
+#endif 
+
+	if(tid == MainThreadId)
+	{
+		*env = TheEnv;
+		return 0;
+	}
+	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)env, NULL);
+	if(MainThreadId == 0)
+	{
+		MainThreadId = tid;
+	}
+	return 1;
+}
+
+JNIEXPORT jint JNICALL
+JNI_OnLoad(JavaVM* jvm, void* reserved)
+{
+  int    bugs =0;
+  JNIEnv *env;
+
+//  DBGe(dim_Dbg_MODULE) ; /* trap only, report on exit */
+
+  if(reserved){}
+  theJavaVM = jvm;
+
+  dim_jni_attachThread(&env);
+  TheEnv = env;
+//  (*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+
+#ifdef develop_a_better_understanding_of_java
+  {
+    jclass		test_cid;
+    jmethodID	test_mid;
+
+    test_cid  = (*env)->FindClass(env,"dim/test/Ntest$static_class");
+    test_mid  = (*env)->GetMethodID(env,test_cid, "instance_method", "()V");
+    test_mid  = (*env)->GetMethodID(env,test_cid, "<init>", "()V");
+    test_mid  = (*env)->GetStaticMethodID(env,test_cid, "static_method",   "()V");
+    if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env);
+
+    test_cid  = (*env)->FindClass(env,"dim/test/Ntest$instance_class");
+    test_mid  = (*env)->GetMethodID(env,test_cid, "instance_method", "()V");
+    test_mid  = (*env)->GetMethodID(env,test_cid, "<init>", "()V");
+    if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env);
+
+    test_cid  = (*env)->FindClass(env,"dim/test/Ntest$method_class");
+    test_mid  = (*env)->GetMethodID(env,test_cid, "instance_method", "()V");
+    test_mid  = (*env)->GetMethodID(env,test_cid, "<init>", "()V");
+    if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env);
+  }
+#endif
+
+  NativeDataMemory                    = (*env)->FindClass(env, "dim/Memory");
+  NativeDataMemory_new                = (*env)->GetMethodID (env, NativeDataMemory, "<init>", "()V");
+  NativeDataMemory_decodeData         = (*env)->GetMethodID (env, NativeDataMemory, "decodeData", "(JILdim/DataDecoder;)V");
+  NativeDataMemory_dataAddress        = (*env)->GetFieldID  (env, NativeDataMemory, "dataAddress", "J");
+  NativeDataMemory_dataSize           = (*env)->GetFieldID  (env, NativeDataMemory, "highWaterMark",    "I");
+  NativeDataMemory                    = (*env)->NewGlobalRef(env, NativeDataMemory);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  ourNativeMemoryObject = (*env)->NewObject(env, NativeDataMemory, NativeDataMemory_new);
+  ourNativeMemoryObject = (*env)->NewGlobalRef(env, ourNativeMemoryObject);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  SendSynchronizer                    = (*env)->FindClass(env, "dim/Client$SendSynchronizer");
+  SendSynchronizer_new                = (*env)->GetMethodID (env, SendSynchronizer, "<init>", "(Ldim/CompletionHandler;)V");
+  SendSynchronizer_setCompletionCode  = (*env)->GetMethodID (env, SendSynchronizer, "setCompletionCode", "(I)I");
+  SendSynchronizer_getCompletionCode  = (*env)->GetMethodID (env, SendSynchronizer, "getCompletionCode", "(I)I");
+  SendSynchronizer                    = (*env)->NewGlobalRef(env, SendSynchronizer);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  ReceiveSynchronizer                    = (*env)->FindClass(env, "dim/Client$ReceiveSynchronizer");
+  ReceiveSynchronizer_new                = (*env)->GetMethodID (env, ReceiveSynchronizer, "<init>", "(Ldim/DataDecoder;)V");
+  ReceiveSynchronizer_decodeNativeData   = (*env)->GetMethodID (env, ReceiveSynchronizer, "decodeData", "(Ldim/Memory;)V");
+  ReceiveSynchronizer_getCompletionCode  = (*env)->GetMethodID (env, ReceiveSynchronizer, "getCompletionCode","(I)I" );
+  ReceiveSynchronizer                    = (*env)->NewGlobalRef(env, ReceiveSynchronizer);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  CompletionHandler                   = (*env)->FindClass(env, "dim/CompletionHandler");
+  CompletionHandler_setCompletionCode = (*env)->GetMethodID(env, CompletionHandler, "setCompletionCode", "(I)I");
+  CompletionHandler                   = (*env)->NewGlobalRef(env, CompletionHandler);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  NativeDataDecoder                   = (*env)->FindClass(env, "dim/DataDecoder");
+  NativeDataDecoder_decodeNativeData  = (*env)->GetMethodID(env,  NativeDataDecoder, "decodeData",   "(Ldim/Memory;)V");
+  NativeDataDecoder                   = (*env)->NewGlobalRef(env, NativeDataDecoder);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  NativeDataEncoder                      = (*env)->FindClass(env, "dim/DataEncoder");
+  NativeDataEncoder_encodeNativeData     = (*env)->GetMethodID(env,  NativeDataEncoder, "encodeData",   "()Ldim/Memory;");
+  NativeDataEncoder                      = (*env)->NewGlobalRef(env, NativeDataEncoder);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  NativeDimTimer					  = (*env)->FindClass(env, "dim/DimTimer");
+  NativeDimTimer_timerHandler         = (*env)->GetMethodID (env, NativeDimTimer,   "timerHandler", "()V");
+  NativeDimTimer                      = (*env)->NewGlobalRef(env, NativeDimTimer);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+
+  NativeDimSrvError					= (*env)->FindClass(env, "dim/DimErrorHandler$DimSrvError");
+  NativeDimSrvError_new                  = (*env)->GetMethodID (env, NativeDimSrvError, "<init>", "()V");
+  NativeDimSrvError_errorHandler         = (*env)->GetMethodID (env, NativeDimSrvError, "errorHandler", "(IILjava/lang/String;)V");
+  NativeDimSrvError                      = (*env)->NewGlobalRef(env, NativeDimSrvError);
+  ourNativeDimSrvError = (*env)->NewObject(env, NativeDimSrvError, NativeDimSrvError_new);
+  ourNativeDimSrvError = (*env)->NewGlobalRef(env, ourNativeDimSrvError);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+  
+  NativeDimCltError					= (*env)->FindClass(env, "dim/DimErrorHandler$DimCltError");
+  NativeDimCltError_new                  = (*env)->GetMethodID (env, NativeDimCltError, "<init>", "()V");
+  NativeDimCltError_errorHandler         = (*env)->GetMethodID (env, NativeDimCltError, "errorHandler", "(IILjava/lang/String;)V");
+  NativeDimCltError                      = (*env)->NewGlobalRef(env, NativeDimCltError);
+  ourNativeDimCltError = (*env)->NewObject(env, NativeDimCltError, NativeDimCltError_new);
+  ourNativeDimCltError = (*env)->NewGlobalRef(env, ourNativeDimCltError);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+  
+  NativeDimExit						= (*env)->FindClass(env, "dim/DimExitHandler$DimExit");
+  NativeDimExit_new                 = (*env)->GetMethodID (env, NativeDimExit, "<init>", "()V");
+  NativeDimExit_exitHandler         = (*env)->GetMethodID (env, NativeDimExit, "exitHandler", "(I)V");
+  NativeDimExit                     = (*env)->NewGlobalRef(env, NativeDimExit);
+  ourNativeDimExit = (*env)->NewObject(env, NativeDimExit, NativeDimExit_new);
+  ourNativeDimExit = (*env)->NewGlobalRef(env, ourNativeDimExit);
+  if ((*env)->ExceptionOccurred(env)) {bugs++; (*env)->ExceptionDescribe(env);}
+  
+  DBGx(dim_Dbg_MODULE) printf("DimJNI: loaded DLL with dim version %d and JNI %d.%d\n", dim_JNI_version,JNI_VERSION>>16,JNI_VERSION&0xFFFF);
+
+  return(JNI_VERSION);
+}
+
+JNIEXPORT jint JNICALL
+JNI_OnUnLoad(JNIEnv* env, void* reserved)
+{
+//  static JNIEnv* env;
+
+//  DBGe(dim_Dbg_MODULE) ; /* trap only, report on exit */
+
+  if(reserved){}
+//  (*jvm)->AttachCurrentThread(jvm, (void *)&env, NULL);
+  (*env)->DeleteGlobalRef(env, NativeDataMemory);
+  (*env)->DeleteGlobalRef(env, SendSynchronizer);
+  (*env)->DeleteGlobalRef(env, ReceiveSynchronizer);
+  (*env)->DeleteGlobalRef(env, CompletionHandler);
+  (*env)->DeleteGlobalRef(env, NativeDataDecoder);
+  (*env)->DeleteGlobalRef(env, NativeDataEncoder);
+  (*env)->DeleteGlobalRef(env, ourNativeMemoryObject);
+
+  (*env)->DeleteGlobalRef(env, NativeDimTimer);
+  (*env)->DeleteGlobalRef(env, NativeDimSrvError);
+  (*env)->DeleteGlobalRef(env, ourNativeDimSrvError);
+  (*env)->DeleteGlobalRef(env, NativeDimCltError);
+  (*env)->DeleteGlobalRef(env, ourNativeDimCltError);
+  (*env)->DeleteGlobalRef(env, NativeDimExit);
+  (*env)->DeleteGlobalRef(env, ourNativeDimExit);
+
+  DBGx(dim_Dbg_MODULE) printf("DimJNI: DLL unloaded\n");
+  return(0);
+}
+
+
+
+
+/* implementation of dim_native.h =============================================================== */
+
+/*
+ * Class:     dim_Native
+ * Method:    init
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_dim_Native_init
+  (JNIEnv* env, jclass nativeClass)
+{
+  JavaVM* jvm;
+
+  if(nativeClass){}
+  if(theJavaVM!=NULL) return JNI_VERSION;
+  (*env)->GetJavaVM(env, &jvm);
+  return JNI_OnLoad(jvm, 0);
+}
+
+/*
+ * Class:     dim_Native
+ * Method:    stop
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_dim_Native_stop
+  (JNIEnv* env, jclass nativeClass)
+{
+
+  if(nativeClass){}
+  return JNI_OnUnLoad(env, 0);
+}
+
+
+/* implementation of dim_dbg.h ================================================================== */
+
+/*
+ * Class:     dim_Dbg
+ * Method:    setMask
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_dim_Dbg_setMask
+  (JNIEnv *env, jclass nativeClass, jint dbg_mask)
+{
+	if(env){}
+	if(nativeClass){}
+  if(dim_Dbg_TRANSACTIONS & (DBG_mask|dbg_mask))
+    printf("DimJNI: debug mask changed from %08x to %08x\n", DBG_mask, dbg_mask);
+  DBG_mask = dbg_mask;
+}
+
+/*
+ * Class:     dim_Dbg
+ * Method:    getMask
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_dim_Dbg_getMask
+  (JNIEnv *env, jclass nativeClass)
+{
+	if(env){}
+	if(nativeClass){}
+  return DBG_mask;
+}
+
+
+
+
+/* implementation of dim_client.h =============================================================== */
+
+
+/* the send callback */
+
+void send_callback(jobject* _theCompletionHandler, int* _status)
+{
+  jobject theCompletionHandler = *_theCompletionHandler;
+  JNIEnv* env;
+  int doit;
+
+  DBGe(dim_Dbg_SEND_CALLBACK) printf("DimJNI: client SEND_CALLBACK status %08lx:%d\n", (unsigned long)_status, *_status);
+
+  doit = dim_jni_attachThread(&env);
+//  (*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+
+  (*env)->CallIntMethod(env, theCompletionHandler, CompletionHandler_setCompletionCode, *_status);
+  (*env)->DeleteGlobalRef(env, theCompletionHandler);
+
+  if(doit)
+	  (*theJavaVM)->DetachCurrentThread(theJavaVM);
+  return;
+}
+
+/* for debuging messages only, so I do not care about reentrance (which could potentially happen) */
+static char* send_data_format;
+
+/* general send service */
+jint send_data
+  (JNIEnv *env, jstring name, jobject theCompletionHandler, jint mode, jint timeout, void* data_address, int data_size)
+{
+  jint    ret;
+  int     stamped = 0;
+  void    (*callback_funct)();
+  jobject callback_param;
+  jobject theSendSynchronizer;
+  
+  extern int request_command(char *, void *, int , void (*)(), long, int);
+
+  const char* cmnd = (*env)->GetStringUTFChars(env, name, 0);
+
+//  DBGe(dim_Dbg_SEND_NATIVE) ; /* trap only, report later */
+
+  if(timeout){}
+  if(mode & dim_Native_F_STAMPED) stamped = 1;
+  if(mode & dim_Native_F_WAIT)  // note: dim_Native_F_WAIT defined as -2147483648L //(0x80000000)
+  {
+    // Create a SendSynchronizer object using theCompletionHandler
+    theSendSynchronizer = (*env)->NewObject(env, SendSynchronizer, SendSynchronizer_new, theCompletionHandler);
+    callback_param = (*env)->NewGlobalRef(env, theSendSynchronizer);
+    callback_funct = &send_callback;
+  }
+  else if(theCompletionHandler)
+  {
+    // create a global reference of the CompletionHandler if present
+    callback_param = (*env)->NewGlobalRef(env, theCompletionHandler);
+    callback_funct = &send_callback;
+  }
+  else
+  {
+    callback_param = 0;
+    callback_funct = 0;
+  }
+
+  // Send the request
+  ret = request_command((char *)cmnd, data_address, data_size, callback_funct, (long)callback_param, stamped);
+  DBGx(dim_Dbg_SEND_NATIVE) printf("DimJNI: Client.Send(%s,(%s) 0x%x) returns %d \n", cmnd, send_data_format, * (int*) data_address, ret);
+
+  // release the String
+  (*env)->ReleaseStringUTFChars(env, name, cmnd);
+
+//if the send request was not queued and there is a CompletionHandler, we call the send_callback
+  if(!ret && callback_param)
+  {
+    DBGm(dim_Dbg_SEND_NATIVE) printf("DimJNI: Native.send calls callback as bug fix.\n");
+//  TODO we do not have to call send_callback(&callback_param, &ret); when not queued? //Apparently we do not need this.
+  }
+
+  if(mode & dim_Native_F_WAIT)
+  {
+    ret=(*env)->CallIntMethod(env, theSendSynchronizer, SendSynchronizer_getCompletionCode, 0);
+    DBGx(dim_Dbg_SEND_NATIVE) printf("DimJNI:        SEND returns (after wait) %08x\n",ret);
+  }
+
+  return ret;
+}
+
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIZ)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIZ
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jboolean data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jboolean";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIC)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIC
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jchar data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jchar";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIB)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIB
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jbyte data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jbyte";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIS)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIS
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jshort data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jshort";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;III)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2III
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jint data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jint";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIJ)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIJ
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jlong data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jlong";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIF)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIF
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jfloat data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jfloat";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IID)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IID
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jdouble data)
+{
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jdouble";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, &data, sizeof(data));
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IILjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IILjava_lang_String_2
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jstring sdata)
+{
+	jint ret;
+	const char* data = (*env)->GetStringUTFChars(env, sdata, 0);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "String";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, (void*) data, strlen(data)+1);
+
+	(*env)->ReleaseStringUTFChars(env,sdata, data);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[Z)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3Z
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jbooleanArray dataArray)
+{
+	jboolean*	nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetBooleanArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "boolean[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseBooleanArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[C)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3C
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jcharArray dataArray)
+{
+	jchar*	  nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetCharArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jchar[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseCharArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[B)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3B
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jbyteArray dataArray)
+{
+	jbyte*	  nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetByteArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jbyte[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseByteArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[S)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3S
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jshortArray dataArray)
+{
+	jshort*	  nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetShortArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jshort[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseShortArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[I)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3I
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jintArray dataArray)
+{
+	jint*	    nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetIntArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jint[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseIntArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[J)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3J
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jlongArray dataArray)
+{
+	jlong*	  nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetLongArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jlong[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseLongArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[F)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3F
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jfloatArray dataArray)
+{
+	jfloat*	  nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetFloatArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jfloat[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseFloatArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;II[D)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2II_3D
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jdoubleArray dataArray)
+{
+	jdouble*	nativeDataArray;
+	jint		  length;
+	jint		  ret;
+
+	nativeDataArray = (*env)->GetDoubleArrayElements(env,dataArray,0);
+	length          = (*env)->GetArrayLength(env,dataArray) * sizeof(*nativeDataArray);
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "jdouble[]";
+  if(This){}
+  ret = send_data(env, name, theCompletionHandler, mode, timeout, nativeDataArray, length);
+
+	(*env)->ReleaseDoubleArrayElements(env,dataArray,nativeDataArray,JNI_ABORT);
+	return ret;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    send
+ * Signature: (Ljava/lang/String;Ldim/CompletionHandler;IIJI)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_send__Ljava_lang_String_2Ldim_CompletionHandler_2IIJI
+  (JNIEnv *env, jclass This, jstring name, jobject theCompletionHandler, jint mode, jint timeout, jlong nativeDataBlock, jint nativeDataSize)
+{
+
+  DBG(dim_Dbg_SEND_NATIVE) send_data_format = "nativeDataBlock";
+  if(This){}
+  return send_data(env, name, theCompletionHandler, mode, timeout, (void*) nativeDataBlock, nativeDataSize);
+}
+
+
+
+/* This function is called by callback there is new data to be decoded */
+void decodeData(jobject* _theDataDecoder, void* dataAddress, int* _dataSize, int cleanup)
+{
+	jobject theDataDecoder = *_theDataDecoder;
+	int		  dataSize		   = *_dataSize;
+	JNIEnv* env;
+	int doit;
+
+  doit = dim_jni_attachThread(&env);
+//	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+  if(dataAddress == NULL)
+  {
+  	(*env)->CallVoidMethod(env, theDataDecoder, NativeDataDecoder_decodeNativeData, NULL);
+  }
+  else
+  {
+    /* the decode method will further complete the Memory object and call the decodeData method of the DataDecoder object */
+    (*env)->CallVoidMethod(env, ourNativeMemoryObject, NativeDataMemory_decodeData, (jlong) dataAddress, (jint) dataSize, theDataDecoder);
+  }
+
+  /* and cleanup */
+  if(cleanup) (*env)->DeleteGlobalRef(env, theDataDecoder);
+  if(doit)
+	(*theJavaVM)->DetachCurrentThread(theJavaVM);
+
+  return;
+}
+
+
+
+/* This call back is called when there is new data for a client subscription */
+void info_service_callback(jobject* _theDataDecoder, void* dataAddress, int* _dataSize)
+{
+	DBGe(dim_Dbg_INFO_CALLBACK) printf("DimJNI: INFO_CALLBACK(data: %08lx(%08x))\n", (unsigned long) dataAddress, *_dataSize);
+
+  decodeData(_theDataDecoder, dataAddress, _dataSize, 0);
+}
+
+
+/* This call back is called when a client once_only subscription completes (so we clean up) */
+void info_service_callback_with_cleanup(jobject* _theDataDecoder, void* dataAddress, int* _dataSize)
+{
+	DBGe(dim_Dbg_INFO_CALLBACK) printf("DimJNI: INFO_CALLBACK/ONCE_ONLY(data: %08lx(%08x))\n", (unsigned long)dataAddress, *_dataSize);
+
+  decodeData(_theDataDecoder, dataAddress, _dataSize, 1);
+
+}
+
+/* This function is called by callback when timer fires */
+void callTimerHandler(jobject* _aDimTimer)
+{
+//	jobject aDimTimer = *_aDimTimer;
+	JNIEnv* env;
+	int doit;
+
+	doit = dim_jni_attachThread(&env);
+//	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+//printf("Got callback %08x\n", _aDimTimer);
+  	(*env)->CallVoidMethod(env, (jobject)_aDimTimer, NativeDimTimer_timerHandler, NULL);
+	if(doit)
+		(*theJavaVM)->DetachCurrentThread(theJavaVM);
+ 
+  return;
+}
+
+/* This call back is called when the timer expires */
+void timer_callback(jobject* _aDimTimer)
+{
+	callTimerHandler(_aDimTimer);
+}
+
+/* This function is called by callback when Server Error detected */
+void callServerErrorHandler(int severity, int code, char *msg)
+{
+	JNIEnv* env;
+	int doit;
+
+	doit = dim_jni_attachThread(&env);
+//	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+  	(*env)->CallVoidMethod(env, ourNativeDimSrvError, NativeDimSrvError_errorHandler,
+		(jint)severity, (jint)code, (jstring)(*env)->NewStringUTF(env, msg));
+	if(doit)
+		(*theJavaVM)->DetachCurrentThread(theJavaVM);
+	return;
+}
+
+/* This callback is called when the server gets an error*/
+void server_error_callback(int severity, int code, char *msg)
+{
+	callServerErrorHandler(severity, code, msg);
+}
+
+/* This function is called by callback when Client Error detected */
+void callClientErrorHandler(int severity, int code, char *msg)
+{
+	JNIEnv* env;
+	int doit;
+
+	doit = dim_jni_attachThread(&env);
+//	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+  	(*env)->CallVoidMethod(env, ourNativeDimCltError, NativeDimCltError_errorHandler,
+		(jint)severity, (jint)code, (jstring)(*env)->NewStringUTF(env, msg));
+	if(doit)
+		(*theJavaVM)->DetachCurrentThread(theJavaVM);
+	return;
+}
+
+/* This callback is called when the client gets an error*/
+void client_error_callback(int severity, int code, char *msg)
+{
+	callClientErrorHandler(severity, code, msg);
+}
+
+void callServerExitHandler(int code)
+{
+//	jobject aDimTimer = *_aDimTimer;
+	JNIEnv* env;
+	int doit;
+
+	doit = dim_jni_attachThread(&env);
+//	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+  	(*env)->CallVoidMethod(env, ourNativeDimExit, NativeDimExit_exitHandler,
+		(jint)code);
+	if(doit)
+		(*theJavaVM)->DetachCurrentThread(theJavaVM);
+	return;
+}
+
+/* This call back is called when the timer expires */
+void server_exit_callback(int *code)
+{
+	callServerExitHandler(*code);
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    infoService
+ * Signature: (Ljava/lang/String;Ldim/DataDecoder;II)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_infoService
+  (JNIEnv *env, jclass This, jstring name, jobject theNativeDataDecoder, jint mode, jint timeout)
+{
+	jint  ret;
+	int   no_link;
+	int   stamped = 0;
+	int   service_type = mode & 0x0FFF;
+  void  (*callback_function)();
+  jobject callback_param;
+  jobject theReceiveSynchronizer;
+  const char* info = (*env)->GetStringUTFChars(env, name, 0);
+  extern unsigned request_service(char *, int, int , void *, int , void (*)(),
+				    long, void *, int, int);
+
+//  DBGe(dim_Dbg_INFO_SERVICE); /* trap only, we report on exit */
+
+  if(This){}
+  if(mode & dim_Native_F_STAMPED) stamped = 1;
+	if(mode & dim_Native_F_WAIT)
+  {
+    // Create a ReceiveSynchronizer object using the dataDecoder
+    theReceiveSynchronizer = (*env)->NewObject(env, ReceiveSynchronizer, ReceiveSynchronizer_new, theNativeDataDecoder);
+    callback_param = (*env)->NewGlobalRef(env, theReceiveSynchronizer);
+  }
+  else
+  {
+    callback_param = (*env)->NewGlobalRef(env, theNativeDataDecoder);
+  }
+
+  if(service_type == dim_Native_ONCE_ONLY) 
+	  callback_function = &info_service_callback_with_cleanup;
+  else                                     
+	  callback_function = &info_service_callback; //TODO who should do the cleanup?
+
+
+  ret = request_service((char *)info, service_type, timeout, 0, 0, callback_function, (long)callback_param, &no_link, 0, stamped);
+  DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: client infoService(%s, DataDecoder@0x%08lx, mode=%d, timeout=%d ) returns %d\n", info, (unsigned long)theNativeDataDecoder, mode, timeout, ret);
+  (*env)->ReleaseStringUTFChars(env, name, info);
+
+  if(mode & dim_Native_F_WAIT)
+  {
+    /* we synchronize by calling the getCompletionCode method of the ReceiveSynchronizer */ 
+    (*env)->CallIntMethod(env, theReceiveSynchronizer, ReceiveSynchronizer_getCompletionCode, 0);
+    DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI:         infoService(%s) completed with %08x\n",info, ret);
+  }
+
+  return ret;
+}
+
+/*
+ * Class:     dim_DimTimer
+ * Method:    start
+ * Signature: (Ldim/DimTimer;I)V
+ */
+JNIEXPORT jlong JNICALL Java_dim_DimTimer_start
+  (JNIEnv *env, jclass This, jobject aDimTimer, jint secs)
+{
+   jobject callback_param;
+   void  (*callback_function)();
+ 
+  if(This){}
+  callback_param = (*env)->NewGlobalRef(env, aDimTimer);
+  callback_function = &timer_callback; //TODO who should do the cleanup?
+
+//printf("Starting timer %d, %08x %08x\n", secs, (long)callback_param, aDimTimer);
+  dtq_start_timer(secs, callback_function, callback_param); 
+
+  return (jlong)callback_param;
+}
+
+/*
+ * Class:     dim_DimTimer
+ * Method:    stop
+ * Signature: (Ldim/DimTimer)V
+ */
+JNIEXPORT void JNICALL Java_dim_DimTimer_stop
+//  (JNIEnv *env, jclass This, jobject aDimTimer)
+  (JNIEnv *env, jclass This, jlong aDimTimer)
+{
+   jobject callback_param;
+   int ret;
+ 
+   if(env){}
+   if(This){}
+//  callback_param = (*env)->NewGlobalRef(env, aDimTimer);
+   callback_param = (jobject) aDimTimer;
+
+//printf("Stopping timer %08x %08X\n", callback_param, aDimTimer);
+  ret = dtq_stop_timer((long)callback_param);
+ //printf("ret = %d\n", ret);
+
+  return;
+}
+
+
+/*
+ * Class:     dim_Client
+ * Method:    releaseService
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_dim_Client_releaseService
+  (JNIEnv* env, jclass This, jint sid)
+{
+
+  DIC_SERVICE *servp;
+
+//  DBGe(dim_Dbg_INFO_SERVICE) ; /* Trap only, report later */
+
+  if(This){}
+  servp = (DIC_SERVICE *)id_get_ptr(sid, SRC_DIC);
+
+/*
+Hans Essel, 3.12.08
+Without deleting the global reference, the Java GC could not free the object!
+Any DimInfo object would stay forever. This is a memory leak.
+*/
+  if(servp != NULL)
+  {
+	  //  DBGx(dim_Dbg_INFO_SERVICE) printf("DimJNI: Client.releaseService(%d (%s))\n", sid, servp->serv_name);
+	  servp->user_routine = NULL; // make sure this is not called anymore
+	  (*env)->DeleteGlobalRef(env, (jobject) servp->tag);
+	  servp->tag = 0;
+  }
+
+  dic_release_service(sid);
+	return;
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    noPadding
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_Client_noPadding
+  (JNIEnv* env, jclass This)
+{
+
+  if(env){}
+  if(This){}
+  dic_disable_padding();
+	return;
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    getFormat
+ * Signature: (I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_Client_getFormat
+  (JNIEnv* env, jclass This, jint sid)
+{
+
+  if(This){}
+	return (*env)->NewStringUTF(env, (char*)dic_get_format(sid));
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    stop
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_Client_stop
+  (JNIEnv* env, jclass This)
+{
+	extern void dim_stop();
+
+	if(env){}
+	if(This){}
+	dim_stop();
+	return;
+}
+
+/*
+ * Class:     dim_DimInfo
+ * Method:    getQuality
+ * Signature: (I)I;
+ */
+JNIEXPORT jint JNICALL Java_dim_DimInfo_getQuality
+  (JNIEnv* env, jclass This, jint sid)
+{
+	int ret;
+	
+	if(env){}
+	if(This){}
+	ret = dic_get_quality(sid);
+	return ret;
+}
+
+/*
+ * Class:     dim_DimInfo
+ * Method:    getTimestamp
+ * Signature: (I)I;
+ */
+JNIEXPORT jint JNICALL Java_dim_DimInfo_getTimestamp
+  (JNIEnv* env, jclass This, jint sid)
+{
+	int mysecs, mymilli;
+  if(env){}
+  if(This){}
+	dic_get_timestamp(sid, &mysecs, &mymilli);
+	return mysecs;
+}
+
+/*
+ * Class:     dim_DimInfo
+ * Method:    getTimestampMillisecs
+ * Signature: (I)I;
+ */
+JNIEXPORT jint JNICALL Java_dim_DimInfo_getTimestampMillisecs
+  (JNIEnv* env, jclass This, jint sid)
+{
+	int mysecs, mymilli;
+  if(env){}
+  if(This){}
+	dic_get_timestamp(sid, &mysecs, &mymilli);
+	return mymilli;
+}
+
+/* implementation of dim_server.h =============================================================== */
+
+
+/*
+ * Class:     dim_Server
+ * Method:    startServing
+ * Signature: (Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Server_startServing
+  (JNIEnv* env, jclass This, jstring serverName)
+{
+	const char* serverNameUTF = (*env)->GetStringUTFChars(env, serverName, 0);
+
+	if(This){}
+
+	dis_start_serving(serverNameUTF);
+
+	DBGe(dim_Dbg_SERVER) printf("DimJNI: Start serving\n");
+
+	(*env)->ReleaseStringUTFChars(env, serverName, serverNameUTF);
+	return 0;
+}
+
+/*
+ * Class:     dim_Server
+ * Method:    stopServing
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_Server_stopServing
+  (JNIEnv* env, jclass This)
+{
+	DBGe(dim_Dbg_SERVER) printf("DimJNI: Stop serving\n");
+	if(env){}
+	if(This){}
+	dis_stop_serving();
+	return;
+}
+
+void server_getInfo_callback(jobject* _dataEncoder, void* *address, int *size)
+{
+  /* server_getInfo_callback is invoked when dim needs the data for a service.
+   * The data is obtained by calling the encodeData method of the DataEncoder
+   * interface which returns us a Memory object. Next we extract the data address
+   * and size from the returned Memory object.
+   */
+  /* Note, the DataEncoder can obtain the identity of the client by calling
+   * getClient or getClientConnID */
+
+  /* thou shall not not use volatile storage to return info to dim */
+	jobject dataEncoder = *_dataEncoder;
+	jobject theMemory;
+	JNIEnv* env;
+	int doit;
+
+//	DBGe(dim_Dbg_SERVICE_CALLBACK) ; /* no report, only trap */
+
+	doit = dim_jni_attachThread(&env);
+//	(*theJavaVM)->AttachCurrentThread(theJavaVM, (void *)&env, NULL);
+
+	theMemory = (*env)->CallObjectMethod(env, dataEncoder, NativeDataEncoder_encodeNativeData);
+	if(theMemory == NULL)
+	{
+		*address  = 0;
+		*size     = 0;
+	}
+	else
+	{
+		*address  = (void*) (*env)->GetLongField(env, theMemory, NativeDataMemory_dataAddress);
+		*size     = (*env)->GetIntField(env, theMemory, NativeDataMemory_dataSize);
+//		printf("data address = %x, data size = %d\n",*address, *size);
+	}
+	DBGx(dim_Dbg_SERVICE_CALLBACK) printf("DimJNI: server_SERVICE_CALLBACK(dataEncoder=%08lx)\n        ==>    data: %08lx size %08x\n", (unsigned long)dataEncoder, (unsigned long) *address, *size); 
+
+	if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
+	if(doit)
+		(*theJavaVM)->DetachCurrentThread(theJavaVM);
+
+	return;
+}
+
+
+/*
+ * Class:     dim_Server
+ * Method:    getClientConnID
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_dim_Server_getClientConnID
+  (JNIEnv* env, jclass This)
+{
+	DBGe(dim_Dbg_GETCLIENT) printf("DimJNI: Server.getClientConnID\n");
+
+	if(env){}
+	if(This){}
+	return dis_get_conn_id();
+}
+
+/*
+ * Class:     dim_Server
+ * Method:    getClient
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_Server_getClient
+  (JNIEnv* env, jclass This)
+{
+	char name[MAX_NODE_NAME+MAX_TASK_NAME+4];
+
+	DBGe(dim_Dbg_GETCLIENT) printf("DimJNI: Server.getClient\n");
+
+	if(This){}
+	if(dis_get_client(name)) 
+		return (*env)->NewStringUTF(env, name);
+	else					 
+		return NULL;
+}
+
+/*
+ * Class:     dim_Server
+ * Method:    getServices
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_Server_getServices
+  (JNIEnv* env, jclass This)
+{
+	int id;
+
+	DBGe(dim_Dbg_GETCLIENT) printf("DimJNI: Server.getClientServices\n");
+
+	if(This){}
+	if( (id = dis_get_conn_id()) ) 
+		return (*env)->NewStringUTF(env, dis_get_client_services(id));
+	else
+		return NULL;
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    getServerPID
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_getServerPID
+  (JNIEnv* env, jclass This)
+{
+	int pid, ret;
+
+	if(env){}
+	if(This){}
+	ret = dic_get_server_pid(&pid);
+	if(!ret)
+		return 0;
+	return pid;
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    getServerConnID
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_dim_Client_getServerConnID
+  (JNIEnv* env, jclass This)
+{
+	if(env){}
+	if(This){}
+	return dic_get_conn_id();
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    getServer
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_Client_getServer
+  (JNIEnv* env, jclass This)
+{
+	char name[MAX_NODE_NAME+MAX_TASK_NAME+4];
+
+	if(This){}
+	if(dic_get_server(name)) 
+		return (*env)->NewStringUTF(env, name);
+	else					 
+		return NULL;
+}
+
+/*
+ * Class:     dim_Client
+ * Method:    getServices
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_Client_getServices
+  (JNIEnv* env, jclass This)
+{
+	int id;
+
+	if(This){}
+	if( (id = dic_get_conn_id()) ) 
+		return (*env)->NewStringUTF(env, dic_get_server_services(id));
+	else
+		return NULL;
+}
+
+/*
+ * Class:     dim_Server
+ * Method:    addService
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ldim/DataEncoder;)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Server_addService
+  (JNIEnv* env, jclass This, jstring serviceName, jstring serviceType, jobject dataEncoder)
+{
+	const char* serviceNameUTF = (*env)->GetStringUTFChars(env, serviceName, 0);
+	const char* serviceTypeUTF = (*env)->GetStringUTFChars(env, serviceType, 0);
+	jint sid;
+
+//  DBGe(dim_Dbg_ADD_SERVICE) ; /* no reporting, for trap only */
+
+	if(This){}
+ 	dataEncoder = (*env)->NewGlobalRef(env, dataEncoder);
+	sid = dis_add_service(serviceNameUTF, serviceTypeUTF, 0, 0, server_getInfo_callback, dataEncoder);
+
+	DBGx(dim_Dbg_ADD_SERVICE) printf("DimJNI: Server.addService(%s,%s, @%08lx)=%d\n",serviceNameUTF, serviceTypeUTF, (unsigned long)dataEncoder, sid);
+
+	(*env)->ReleaseStringUTFChars(env, serviceName, serviceNameUTF);
+	(*env)->ReleaseStringUTFChars(env, serviceType, serviceTypeUTF);
+	return sid;
+}
+
+
+void server_cmnd_callback(jobject* _theDataDecoder, void* dataAddress, int* _dataSize)
+{
+
+	DBGe(dim_Dbg_CMND_CALLBACK) printf("DimJNI: server CMND_CALLBACK(data: %08lx(%08x))\n", (unsigned long) dataAddress, *_dataSize);
+
+  decodeData(_theDataDecoder, dataAddress, _dataSize, 0);
+}
+
+
+/*
+ * Class:     dim_Server
+ * Method:    addCommand
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ldim/DataDecoder;)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Server_addCommand
+  (JNIEnv* env, jclass This, jstring serviceName, jstring serviceType, jobject dataDecoder)
+{
+	const char* serviceNameUTF = (*env)->GetStringUTFChars(env, serviceName, 0);
+	const char* serviceTypeUTF = (*env)->GetStringUTFChars(env, serviceType, 0);
+	jint sid;
+
+//	DBGe(dim_Dbg_ADD_CMND) ; /* trap only, repot later */
+	if(This){}
+ 	dataDecoder = (*env)->NewGlobalRef(env, dataDecoder);
+	sid = dis_add_cmnd(serviceNameUTF, serviceTypeUTF, server_cmnd_callback, dataDecoder);
+
+	DBGx(dim_Dbg_ADD_CMND) printf("DimJNI: Server.addCmnd(%s,%s, @%08lx) = %d\n",serviceNameUTF, serviceTypeUTF, (unsigned long) dataDecoder, sid);
+
+	(*env)->ReleaseStringUTFChars(env, serviceName, serviceNameUTF);
+	(*env)->ReleaseStringUTFChars(env, serviceType, serviceTypeUTF);
+	return sid;
+}
+
+
+/*
+ * Class:     dim_Server
+ * Method:    selectiveUpdateService
+ * Signature: (I[I)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Server_selectiveUpdateService
+  (JNIEnv* env, jclass This, jint sid, jintArray clients)
+{
+	jint* clientArray;
+	extern void do_update_service(unsigned, int *);
+
+	if(This){}
+	if(clients==NULL) clientArray = NULL;
+	else			  clientArray = (*env)->GetIntArrayElements(env,clients,0);
+
+	DBGe(dim_Dbg_UPDATE_SERVICE) printf("DimJNI: Server.updateService %d\n", sid);
+	do_update_service(sid, clientArray);
+
+	if(clientArray!=NULL) (*env)->ReleaseIntArrayElements(env,clients,clientArray,JNI_ABORT);
+
+
+	return 0;
+}
+
+/*
+ * Class:     dim_Server
+ * Method:    removeService
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Server_removeService
+  (JNIEnv* env, jclass This, jint sid)
+{
+	DBGe(dim_Dbg_RELEASE_SERVICE) printf("DimJNI: Server.removedService %d\n", sid);
+	if(env){}
+	if(This){}
+	dis_remove_service(sid);
+	return 0;
+}
+
+/*
+ * Class:     dim_Server
+ * Method:    noPadding
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_Server_noPadding
+  (JNIEnv* env, jclass This)
+{
+
+  if(env){}
+  if(This){}
+  dis_disable_padding();
+	return;
+}
+
+/*
+ * Class:     dim_DimErrorHandler
+ * Method:    addSrvErrorHandler
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_DimErrorHandler_addSrvErrorHandler
+  (JNIEnv* env, jclass This)
+{
+
+	void  (*callback_function)();
+
+	if(env){}
+	if(This){}
+	callback_function = &server_error_callback;
+
+	dis_add_error_handler( callback_function );
+
+  return;
+}
+
+/*
+ * Class:     dim_DimErrorHandler
+ * Method:    addCltErrorHandler
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_DimErrorHandler_addCltErrorHandler
+  (JNIEnv* env, jclass This)
+{
+
+	void  (*callback_function)();
+
+	if(env){}
+	if(This){}
+	callback_function = &client_error_callback;
+ 
+	dic_add_error_handler( callback_function ); 
+
+  return;
+}
+
+/*
+ * Class:     dim_DimExitHandler
+ * Method:    addExitHandler
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_dim_DimExitHandler_addExitHandler
+  (JNIEnv* env, jclass This)
+{
+
+	void  (*callback_function)();
+
+	if(env){}
+	if(This){}
+	callback_function = &server_exit_callback;
+
+	dis_add_exit_handler( callback_function ); 
+
+  return;
+}
+
+/*
+ * Class:     dim_DimServer
+ * Method:    disableAST
+ * Signature: ()V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimServer_disableAST
+  (JNIEnv* env, jclass This)
+{
+	
+	DIM_LOCK
+	if(env){}
+	if(This){}
+	return;
+}
+
+/*
+ * Class:     dim_DimServer
+ * Method:    enableAST
+ * Signature: ()V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimServer_enableAST
+  (JNIEnv* env, jclass This)
+{
+	
+	if(env){}
+	if(This){}
+	DIM_UNLOCK
+	return;
+}
+
+/*
+ * Class:     dim_DimClient
+ * Method:    disableAST
+ * Signature: ()V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimClient_disableAST
+  (JNIEnv* env, jclass This)
+{
+	
+	DIM_LOCK
+	if(env){}
+	if(This){}
+	return;
+}
+
+/*
+ * Class:     dim_DimClient
+ * Method:    enableAST
+ * Signature: ()V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimClient_enableAST
+  (JNIEnv* env, jclass This)
+{
+	
+	if(env){}
+	if(This){}
+	DIM_UNLOCK
+	return;
+}
+
+/*
+ * Class:     dim_DimServer
+ * Method:    setDnsNode
+ * Signature: (Ljava/lang/String)V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimServer_setDnsNode
+  (JNIEnv* env, jclass This, jstring nodes)
+{
+	const char* nodesUTF = (*env)->GetStringUTFChars(env, nodes, 0);
+	
+	if(env){}
+	if(This){}
+	dis_set_dns_node(nodesUTF);
+	return;
+}
+
+/*
+ * Class:     dim_DimServer
+ * Method:    setDnsPort
+ * Signature: (I)V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimServer_setDnsPort
+  (JNIEnv* env, jclass This, jint port)
+{
+	if(env){}
+	if(This){}
+	dis_set_dns_port(port);
+	return;
+}
+
+/*
+ * Class:     dim_DimClient
+ * Method:    setDnsNode
+ * Signature: (Ljava/lang/String)V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimClient_setDnsNode
+  (JNIEnv* env, jclass This, jstring nodes)
+{
+	const char* nodesUTF = (*env)->GetStringUTFChars(env, nodes, 0);
+	
+	if(env){}
+	if(This){}
+	dic_set_dns_node(nodesUTF);
+	dic_close_dns();
+	return;
+}
+
+/*
+ * Class:     dim_DimClient
+ * Method:    setDnsPort
+ * Signature: (I)V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimClient_setDnsPort
+  (JNIEnv* env, jclass This, jint port)
+{
+	if(env){}
+	if(This){}
+	dic_set_dns_port(port);
+	return;
+}
+
+/*
+ * Class:     dim_DimServer
+ * Method:    getDnsNode
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_DimServer_getDnsNode
+  (JNIEnv* env, jclass This)
+{
+	char nodes[255];
+	
+	if(This){}
+	dis_get_dns_node(nodes);
+	return (*env)->NewStringUTF(env, (char*)nodes);
+}
+
+/*
+ * Class:     dim_DimClient
+ * Method:    getDnsNode
+ * Signature: ()Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_DimClient_getDnsNode
+  (JNIEnv* env, jclass This)
+{
+	char nodes[255];
+	
+	if(This){}
+	dic_get_dns_node(nodes);
+	return (*env)->NewStringUTF(env, (char*)nodes);
+}
+
+/*
+ * Class:     dim_DimServer
+ * Method:    getDnsPort
+ * Signature: ()I;
+ */
+JNIEXPORT jint JNICALL Java_dim_DimServer_getDnsPort
+  (JNIEnv* env, jclass This)
+{
+	
+	if(env){}
+	if(This){}
+	return dis_get_dns_port();
+}
+
+/*
+ * Class:     dim_DimClient
+ * Method:    getDnsPort
+ * Signature: ()I;
+ */
+JNIEXPORT jint JNICALL Java_dim_DimClient_getDnsPort
+  (JNIEnv* env, jclass This)
+{
+
+	if(env){}
+	if(This){}
+	return dic_get_dns_port();
+}
+
+/*
+ * Class:     dim_DimService
+ * Method:    setQuality
+ * Signature: (II)V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimService_setQuality
+  (JNIEnv* env, jclass This, jint sid, jint qual)
+{
+	
+	if(env){}
+	if(This){}
+	dis_set_quality(sid, qual);
+	return;
+}
+
+
+/*
+ * Class:     dim_DimService
+ * Method:    setTimestamp
+ * Signature: (III)V;
+ */
+JNIEXPORT void JNICALL Java_dim_DimService_setTimestamp
+  (JNIEnv* env, jclass This, jint sid, jint secs, jint millisecs)
+{
+
+	if(env){}
+	if(This){}
+	dis_set_timestamp(sid, secs, millisecs);
+	return;
+}
+
+/* implementation of dim_memory,h =============================================================== */
+
+/*
+ * Class:     dim_Memory
+ * Method:    dumpInternalData
+ * Signature: (III)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_dumpInternalData
+  (JNIEnv *env, jclass nativeClass, jlong internalDataAddress, jint internalDataSize, jint dumpOptions)
+{
+  {
+    int* data = (int*) internalDataAddress;
+    int leng = internalDataSize/sizeof(int);
+    int  i;
+
+	if(env){}
+	if(dumpOptions){}
+	if(nativeClass){}
+    for (i=0;i<leng;i++)
+    {
+      if((i%8)==0) printf("%04x:",i);
+      printf(" %08x", *(data++));
+      if((i%8)==7) printf("\n");
+    }
+    if((leng%8)!=0) printf("\n");
+  }
+  return;
+}
+
+
+/*
+ * Class:     dim_Memory
+ * Method:    getBoolean
+ * Signature: (I)Z
+ */
+JNIEXPORT jboolean JNICALL Java_dim_Memory_getBoolean
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getBoolean\n");
+	return *(jboolean*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getChar
+ * Signature: (I)C
+ */
+JNIEXPORT jchar JNICALL Java_dim_Memory_getChar
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getChar\n");
+	return *(jchar*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getByte
+ * Signature: (I)B
+ */
+JNIEXPORT jbyte JNICALL Java_dim_Memory_getByte
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getByte\n");
+	return *(jbyte*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getShort
+ * Signature: (I)S
+ */
+JNIEXPORT jshort JNICALL Java_dim_Memory_getShort
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getShort\n");
+	return *(jshort*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getInt
+ * Signature: (I)I
+ */
+JNIEXPORT jint JNICALL Java_dim_Memory_getInt
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getInt\n");
+	return *(jint*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getLong
+ * Signature: (I)J
+ */
+JNIEXPORT jlong JNICALL Java_dim_Memory_getLong
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getLong\n");
+	return *(jlong*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getFloat
+ * Signature: (I)F
+ */
+JNIEXPORT jfloat JNICALL Java_dim_Memory_getFloat
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getFloat\n");
+	return *(jfloat*)nativeDataAddress;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    getDouble
+ * Signature: (I)D
+ */
+JNIEXPORT jdouble JNICALL Java_dim_Memory_getDouble
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getDouble\n");
+	return *(jdouble*)nativeDataAddress;
+}
+
+
+/*
+ * Class:     dim_Memory
+ * Method:    getString
+ * Signature: (I,I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_dim_Memory_getString
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jint maxSize)
+{
+	if(env){}
+	if(nativeClass){}
+	if(maxSize){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.getString\n");
+	return (*env)->NewStringUTF(env, (char*)nativeDataAddress);
+}
+
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoBooleanArray
+ * Signature: (I[ZII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoBooleanArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jbooleanArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoBooleanArray\n");
+	(*env)->SetBooleanArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoCharArray
+ * Signature: (I[CII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoCharArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jcharArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoCharArray\n");
+	(*env)->SetCharArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoByteArray
+ * Signature: (I[BII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoByteArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jbyteArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoByteArray\n");
+	(*env)->SetByteArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoShortArray
+ * Signature: (I[SII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoShortArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jshortArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoShortArray\n");
+	(*env)->SetShortArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoIntArray
+ * Signature: (I[III)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoIntArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jintArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoIntArray\n");
+	(*env)->SetIntArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoLongArray
+ * Signature: (I[JII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoLongArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jlongArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoLongArray\n");
+	(*env)->SetLongArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoFloatArray
+ * Signature: (I[FII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoFloatArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jfloatArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoFloatArray\n");
+	(*env)->SetFloatArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_Memory
+ * Method:    copyIntoDoubleArray
+ * Signature: (I[DII)V
+ */
+JNIEXPORT void JNICALL Java_dim_Memory_copyIntoDoubleArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jdoubleArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY) printf("DimJNI: Memory.copyIntoDoubleArray\n");
+	(*env)->SetDoubleArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+
+
+
+/* implementation of dim_mutablememory.h ======================================================== */
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    allocateNativeDataBlock
+ * Signature: (I)I
+ */
+JNIEXPORT jlong JNICALL Java_dim_MutableMemory_allocateNativeDataBlock
+  (JNIEnv* env, jclass nativeClass, jint size)
+{
+  jlong address;
+	if(env){}
+	if(nativeClass){}
+//	DBGe(dim_Dbg_MEMORY_ALLOCATE) ; /* report only */
+  address = (jlong) malloc(size);
+	DBGx(dim_Dbg_MEMORY_ALLOCATE) printf("DimJNI: MutableMemory.allocateNativeDataBlock of %d bytes at 0x%08lx\n", size, address);
+  return address;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    releaseNativeDataBlock
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_releaseNativeDataBlock
+  (JNIEnv* env, jclass nativeClass, jlong desc)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MEMORY_ALLOCATE) printf("DimJNI: MutableMemory.releaseNativeDataBlock 0x%08lx\n", desc);
+ //printf("free %08X\n", desc);
+ 	free((void*)desc);
+	return;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setBoolean
+ * Signature: (IZ)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setBoolean
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jboolean data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setBoolean(0x%08lx, %02x)\n", nativeDataAddress, data);
+	*(jboolean*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setChar
+ * Signature: (IC)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setChar
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jchar data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setChar(0x%08lx, %02x)\n", nativeDataAddress, data);
+	*(jchar*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setByte
+ * Signature: (IB)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setByte
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jbyte data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setByte(0x%08lx, %02x)\n", nativeDataAddress, data);
+	*(jbyte*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setShort
+ * Signature: (IS)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setShort
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jshort data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setShort(0x%08lx, %04x)\n", nativeDataAddress, data);
+	*(jshort*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setInt
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setInt
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jint data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setInt(0x%08lx, %0x)\n", nativeDataAddress, data);
+	*(jint*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setLong
+ * Signature: (IJ)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setLong
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jlong data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setLong(0x%08lx, %08x)\n", nativeDataAddress, (unsigned)data);
+	*(jlong*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setFloat
+ * Signature: (IF)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setFloat
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jfloat data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setFloat(0x%08lx, %f)\n", nativeDataAddress, data);
+	*(jfloat*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setDouble
+ * Signature: (ID)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setDouble
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jdouble data)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setDouble(0x%08lx, %08x)\n", nativeDataAddress, (unsigned)data);
+	*(jdouble*)nativeDataAddress = data;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    setString
+ * Signature: (ILjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_setString
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jstring data)
+{
+	const char* charData = (*env)->GetStringUTFChars(env, data, 0);
+
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.setString(0x%08lx, %s)\n", nativeDataAddress, charData);
+
+	if(nativeClass){}
+	strcpy((char*)nativeDataAddress, charData);
+	(*env)->ReleaseStringUTFChars(env, data, charData);
+}
+
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromBooleanArray
+ * Signature: (I[ZII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromBooleanArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jbooleanArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromBooleanArray\n");
+	(*env)->GetBooleanArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromCharArray
+ * Signature: (I[CII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromCharArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jcharArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromCharArray\n");
+	(*env)->GetCharArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromByteArray
+ * Signature: (I[BII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromByteArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jbyteArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromByteArray\n");
+	(*env)->GetByteArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromShortArray
+ * Signature: (I[SII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromShortArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jshortArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromShortArray\n");
+	(*env)->GetShortArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromIntArray
+ * Signature: (I[III)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromIntArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jintArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromIntArray\n");
+	(*env)->GetIntArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromLongArray
+ * Signature: (I[JII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromLongArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jlongArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromLongArray\n");
+	(*env)->GetLongArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromFloatArray
+ * Signature: (I[FII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromFloatArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jfloatArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromFloatArray\n");
+	(*env)->GetFloatArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyFromDoubleArray
+ * Signature: (I[DII)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyFromDoubleArray
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jdoubleArray array, jint arrayOffset, jint length)
+{
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyFromDoubleArray\n");
+	(*env)->GetDoubleArrayRegion(env, array, arrayOffset, length, (void*) nativeDataAddress);
+	return ;
+}
+
+/*
+ * Class:     dim_MutableMemory
+ * Method:    copyNativeDataBlock
+ * Signature: (II)V
+ */
+JNIEXPORT void JNICALL Java_dim_MutableMemory_copyNativeDataBlock
+  (JNIEnv* env, jclass nativeClass, jlong destinationDataAddress, jlong sourceDataAddress, jint length)
+{
+	if(env){}
+	if(nativeClass){}
+	DBGe(dim_Dbg_MUTABLE_MEMORY) printf("DimJNI: MutableMemory.copyNativeDataBlock\n");
+  memcpy((void *)destinationDataAddress, (void *)sourceDataAddress, length);
+	return ;
+}
+
+
+
+
+/* implementation of dim_objectdescriptor.h ===================================================== */
+
+/* fancy packing methods */
+
+typedef enum {f_skip,
+              f_boolean, f_byte, f_char, f_short, f_int, f_long, f_float, f_double, f_string, f_object,
+              a_boolean, a_byte, a_char, a_short, a_int, a_long, a_float, a_double,	a_string, a_object,
+              c_boolean, c_byte, c_char, c_short, c_int, c_long, c_float, c_double, c_string, c_object
+			} FieldType;
+typedef struct objectDescriptorEntry_struct objectDescriptorEntry_type;
+struct objectDescriptorEntry_struct
+{
+	FieldType type;
+	int       length;
+	int       offset;
+	jfieldID  fieldID;
+	jarray    array;
+	int       arrayOffset;
+};
+
+typedef struct objectDescriptor_struct objectDescriptor_type;
+struct objectDescriptor_struct
+{
+	jclass objectClass;
+	int	entries;
+	int	maxEntries;
+	objectDescriptorEntry_type* entry;
+};
+
+
+/*
+ * Class:     dim_ObjectDescriptor
+ * Method:    newObjectDescriptor
+ * Signature: (Ljava/lang/Class;I)I
+ */
+JNIEXPORT jlong JNICALL Java_dim_ObjectDescriptor_newObjectDescriptor
+  (JNIEnv* env, jclass nativeClass, jclass objectClass, jint maxEntries)
+{
+	objectDescriptor_type* descriptor;
+
+//  DBGe(dim_Dbg_DESCRIPTORS) ; /* trap only, report on exit */
+  // todo put object descriptor and entry array in the same malloc (for dump purposes)
+//printf("malloc descriptor\n");
+	if(env){}
+	if(nativeClass){}
+	if(maxEntries==0) maxEntries = 10;
+	descriptor = (objectDescriptor_type*) malloc(sizeof(objectDescriptor_type));
+	descriptor->entry = (objectDescriptorEntry_type*) malloc(maxEntries * sizeof(objectDescriptorEntry_type));
+	descriptor->objectClass = (*env)->NewGlobalRef(env, objectClass);
+	descriptor->entries = 0;
+	descriptor->maxEntries = maxEntries;
+
+	DBGx(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.newObjectDescriptor %08lx\n", (long)descriptor);
+	return (long) descriptor;
+}
+
+objectDescriptorEntry_type* getNextDescriptorEntry(objectDescriptor_type* descriptor)
+{
+	if(descriptor->entries == descriptor->maxEntries)
+	{
+		objectDescriptorEntry_type* entry = realloc(descriptor->entry, descriptor->maxEntries+10);
+//printf("realloc descriptor\n");
+		if(entry==NULL) return NULL;
+
+		descriptor->entry = entry;
+		descriptor->maxEntries = descriptor->maxEntries+10;
+	}
+	return descriptor->entry + descriptor->entries++;
+}
+
+
+
+/*
+ * Class:     dim_ObjectDescriptor
+ * Method:    addFieldToObjectDescriptor
+ * Signature: (ILjava/lang/String;Ljava/lang/String;I)I
+ */
+JNIEXPORT jint JNICALL Java_dim_ObjectDescriptor_addFieldToObjectDescriptor
+  (JNIEnv* env, jclass nativeClass, jlong desc, jstring fieldName, jstring fieldType, jint offset)
+{
+//	FieldType field_type = f_int;
+	objectDescriptorEntry_type* entry = getNextDescriptorEntry((objectDescriptor_type*) desc);
+	const char*                 name  = (*env)->GetStringUTFChars(env, fieldName, 0);
+	const char*                 type  = (*env)->GetStringUTFChars(env, fieldType, 0);
+	jfieldID fieldID  = (*env)->GetFieldID(env, ((objectDescriptor_type*) desc)->objectClass, name, type);
+
+	// TODO throw an error if there is no such FieldID
+
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.addFieldToObjectDescriptor %08lx Field %s Type %s\n", (long) desc, name, type);
+	// TODO: if(entry==NULL) throw out-of-memory exception, set length to 0
+
+	// TODO: if(fieldType == "I") field_type = f_int; etc
+
+	if(nativeClass){}
+	entry->type         =f_skip;
+	entry->length       =0;
+	entry->offset       =offset;
+	entry->fieldID      =fieldID;
+	entry->array        =0;
+	entry->arrayOffset  =0;
+
+	switch (*type)
+	{
+	case 'Z':
+	{
+		entry->type	  =f_boolean;
+		entry->length =sizeof(jboolean);
+		break;
+	}
+	case 'B':
+	{
+		entry->type	  =f_byte;
+		entry->length =sizeof(jbyte);
+		break;
+	}
+
+	case 'C':
+	{
+		entry->type	  =f_char;
+		entry->length =sizeof(jchar);
+		break;
+	}
+
+	case 'S':
+	{
+		entry->type	  =f_short;
+		entry->length =sizeof(jshort);
+		break;
+	}
+
+	case 'I':
+	{
+		entry->type	  =f_int;
+		entry->length =sizeof(jint);
+		break;
+	}
+
+	case 'J':
+	{
+		entry->type	  =f_long;
+		entry->length =sizeof(jlong);
+		break;
+	}
+
+	case 'F':
+	{
+		entry->type	  =f_float;
+		entry->length =sizeof(jfloat);
+		break;
+	}
+
+	case 'D':
+	{
+		entry->type	  =f_double;
+		entry->length =sizeof(jdouble);
+		break;
+	}
+
+	//case '[':
+	//{
+	//	// TODO deal with array types
+	//}
+	default :
+	{
+		printf("DimJNI: addFieldToObjectDescriptor - type %s not yet supported. (field %s)\n", name, type);
+	}
+	}
+
+
+	(*env)->ReleaseStringUTFChars(env, fieldName, name);
+	(*env)->ReleaseStringUTFChars(env, fieldType, type);
+	return entry->length;
+}
+
+
+/*
+ * Class:     dim_ObjectDescriptor
+ * Method:    deleteObjectDescriptor
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_dim_ObjectDescriptor_deleteObjectDescriptor
+   (JNIEnv* env, jclass nativeClass, jlong desc)
+{
+	objectDescriptor_type* descriptor = (objectDescriptor_type*) desc;
+ 
+	if(nativeClass){}
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.deleteObjectDescriptor %08lx\n", (long)desc);
+	(*env)->DeleteGlobalRef(env, descriptor->objectClass);
+//printf("free descriptor\n");
+	free(descriptor->entry);
+	free(descriptor);
+	return;
+}
+
+
+/*
+ * Class:     dim_ObjectDescriptor
+ * Method:    copyIntoObject
+ * Signature: (ILjava/lang/Object;I)V
+ */
+ 
+JNIEXPORT void JNICALL Java_dim_ObjectDescriptor_copyIntoObject
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jobject theObject, jlong desc)
+{
+	int i;
+	objectDescriptorEntry_type* entry;
+
+	objectDescriptor_type* descriptor = (objectDescriptor_type*) desc;
+	jclass objectClass = descriptor->objectClass;
+
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.copyIntoObject %08lx\n", (long)desc);
+
+	if(nativeClass){}
+	// test if object can be cast to object class
+	if((*env)->IsInstanceOf(env, theObject, objectClass) != JNI_TRUE)
+	{
+		// throw exception
+		jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
+		(*env)->ThrowNew(env, exceptionClass, " (Sorry...)");
+		return;
+	}
+
+	// loop over descriptor entries
+	entry = descriptor->entry;
+	for (i=0; i<descriptor->entries; i++)
+	{
+		switch (entry->type)
+		{
+		case f_boolean:
+			(*env)->SetBooleanField(env, theObject, entry->fieldID, *(jboolean*) (nativeDataAddress+entry->offset));
+			break;
+		case f_byte:
+			(*env)->SetByteField(   env, theObject, entry->fieldID, *(jbyte*)    (nativeDataAddress+entry->offset));
+			break;
+		case f_char:
+			(*env)->SetCharField(   env, theObject, entry->fieldID, *(jchar*)    (nativeDataAddress+entry->offset));
+			break;
+		case f_short:
+			(*env)->SetShortField(  env, theObject, entry->fieldID, *(jshort*)   (nativeDataAddress+entry->offset));
+			break;
+		case f_int:
+			(*env)->SetIntField(    env, theObject, entry->fieldID, *(jint*)     (nativeDataAddress+entry->offset));
+			break;
+		case f_long:
+			(*env)->SetLongField(   env, theObject, entry->fieldID, *(jlong*)    (nativeDataAddress+entry->offset));
+			break;
+		case f_float:
+			(*env)->SetFloatField(  env, theObject, entry->fieldID, *(jfloat*)   (nativeDataAddress+entry->offset));
+			break;
+		case f_double:
+			(*env)->SetDoubleField( env, theObject, entry->fieldID, *(jdouble*)  (nativeDataAddress+entry->offset));
+			break;
+		case a_boolean:
+			(*env)->SetBooleanArrayRegion(env, entry->array, entry->arrayOffset, entry->length, (void*) (nativeDataAddress+entry->offset));
+			break;
+		case c_boolean:
+			(*env)->SetBooleanArrayRegion(env, entry->array, entry->arrayOffset, entry->length, (void*) (nativeDataAddress+entry->offset));
+		//TODO :: complete this list, including recursive call to this function for objects
+			break;
+		default:
+			break;
+		}
+		//TODO :: ?? if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
+		entry++;
+	}
+	return;
+}
+
+/*
+ * Class:     dim_ObjectDescriptor
+ * Method:    copyFromObject
+ * Signature: (ILjava/lang/Object;I)V
+ */
+JNIEXPORT void JNICALL Java_dim_ObjectDescriptor_copyFromObject
+  (JNIEnv* env, jclass nativeClass, jlong nativeDataAddress, jobject theObject, jlong desc)
+{
+	int i;
+	objectDescriptorEntry_type* entry;
+
+	objectDescriptor_type* descriptor = (objectDescriptor_type*) desc;
+	jclass objectClass = descriptor->objectClass;
+
+	DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.copyFromObject %08x\n", (int)desc);
+
+	if(nativeClass){}
+	// test if object can be cast to object class
+	if((*env)->IsInstanceOf(env, theObject, objectClass) != JNI_TRUE)
+	{
+		// throw exception
+		jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
+		(*env)->ThrowNew(env, exceptionClass, " (Sorry...)");
+		return;
+	}
+
+	// loop over descriptor entries
+	entry = descriptor->entry;
+	for (i=0; i<descriptor->entries; i++)
+	{
+		switch (entry->type)
+		{
+		case f_boolean:
+			*(jboolean*) (nativeDataAddress+entry->offset) = (*env)->GetBooleanField(env, theObject, entry->fieldID);
+			break;
+		case f_byte:
+			*(jbyte*) (nativeDataAddress+entry->offset)    = (*env)->GetByteField(env, theObject, entry->fieldID);
+			break;
+		case f_char:
+			*(jchar*) (nativeDataAddress+entry->offset)    = (*env)->GetCharField(env, theObject, entry->fieldID);
+			break;
+		case f_short:
+			*(jshort*) (nativeDataAddress+entry->offset)   = (*env)->GetShortField(env, theObject, entry->fieldID);
+			break;
+		case f_int:
+			*(jint*) (nativeDataAddress+entry->offset)     = (*env)->GetIntField(env, theObject, entry->fieldID);
+			break;
+		case f_long:
+			*(jlong*) (nativeDataAddress+entry->offset)    = (*env)->GetLongField(env, theObject, entry->fieldID);
+			break;
+		case f_float:
+			*(jfloat*) (nativeDataAddress+entry->offset)   = (*env)->GetFloatField(env, theObject, entry->fieldID);
+			break;
+		case f_double:
+			*(jdouble*) (nativeDataAddress+entry->offset)  = (*env)->GetDoubleField(env, theObject, entry->fieldID);
+			break;
+//		case a_boolean:
+//      (*env)->GetBooleanArrayRegion(env, array, 0, length, (void*) nativeDataAddress);
+//			break;
+//		case c_boolean:
+//			*(jbyte*) (nativeDataAddress+entry->offset)  = (*env)->GetField(env, theObject, entry->fieldID);
+//			(*env)->SetBooleanArrayRegion(env, entry->array, entry->arrayOffset, entry->length, (void*) (nativeDataAddress+entry->offset));
+//		//TODO :: complete this list, including recursive call to this function for objects
+//			break;
+		default:
+			break;
+		}
+		//TODO :: ?? if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
+		entry++;
+	}
+	return;
+}
+
+
+#ifdef zombies
+
+
+//	jstring	  myFormat;
+//	myFormat = (*env)->NewStringUTF(env, "x");
+//	(*env)->CallVoidMethod(env, dataObject, setDimFormatMID, myFormat);		// JUST TO TRY
+
+//	jintArray dataArray;
+//	int data[10]={1,2,3,4,5,6,7,8,9,-1};
+//	dataArray = (*env)->NewIntArray(env,10);
+//	(*env)->SetIntArrayRegion(env, dataArray,0,10,data);
+//	(*env)->CallVoidMethod(env, dataObject, NativeDataDecoder_decodeNativeData,   dataArray);	// JUST TO TRY
+
+//	jclass     dataClass     = (*env)->GetObjectClass(env, dataObject);
+
+//	(*env)->CallIntMethod(env,dataObject,dimOIlengthMID);
+//	(*env)->CallNonvirtualIntMethod(env,dataObject, dataItemInterface, dimOIlengthMID);//	formatString = (jstring) (*env)->CallNonvirtualObjectMethod(env, dataObject, dataItemInterface, getDimFormatMID);
+
+	// Print the current thread ID in the Debug Window
+	// TRACE("Current Thread ID = 0x%X\n", AfxGetThread()->m_nThreadID);
+            _RPT1(_CRT_ERROR, "Invalid allocation size: %u bytes.\n", nSize);
+
+
+//	formatString = (jstring) (*env)->CallObjectMethod(env,dataObject,getDimFormatMID);
+//	format = (*env)->GetStringUTFChars(env, formatString, 0);
+//	printf("Format string in native: %s\n",format);
+//	(*env)->ReleaseStringUTFChars(env, formatString, format);
+
+  /* server_getInfo_callback is invoked when dim needs the data for a service.
+   * The data is obtained by calling the encodeData method of the DataEncoder
+   * interface which returns us a Memory object. Next we extract the data address
+   * and size from the returned Memory object.
+   *
+   * Alternative:
+   * I call the following class method: Server.sendMeTheData(theDataEncoder)
+   * This method is implemented as
+   * sendMeTheData(DataEncoder theDataEncoder)
+   * {
+   *   Memory theData = theDataEncoder.encodeData();
+   *   Server.setDataReference(Memory.dataAddress, Memory.DataSize);
+   * }
+   * The method setDataReference(int dataAddress, int dataSize) is implemented
+   * as a native method and receives directly the data which one can store in
+   * a global variable.
+   * More complicated, not convinced that it would be more efficient.
+   */
+
+
+
+#endif
Index: /trunk/FACT++/dim_v19r15/src/dim_thr.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dim_thr.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dim_thr.c	(revision 10183)
@@ -0,0 +1,899 @@
+#include <signal.h>
+#define DIMLIB
+#include "dim.h"
+
+#ifndef WIN32
+
+#ifndef NOTHREADS
+#include <pthread.h>
+#include <semaphore.h>
+#ifdef solaris
+#include <synch.h>
+#endif
+#ifdef darwin
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+pthread_t IO_thread = 0;
+pthread_t ALRM_thread = 0;
+pthread_t INIT_thread = 0;
+pthread_t MAIN_thread = 0;
+#ifndef darwin
+sem_t DIM_INIT_Sema;
+/*
+sem_t DIM_WAIT_Sema;
+*/
+#else
+sem_t *DIM_INIT_Semap;
+/*
+sem_t *DIM_WAIT_Semap;
+*/
+#endif
+int INIT_count = 0;
+/*
+int WAIT_count = 0;
+*/
+int DIM_THR_init_done = 0;
+
+void *dim_tcpip_thread(void *tag)
+{
+	extern int dim_tcpip_init();
+	extern void tcpip_task();
+	/*	
+	int prio;
+		
+	thr_getprio(thr_self(),&prio);
+	thr_setprio(thr_self(),prio+10);
+	*/
+	if(tag){}
+	IO_thread = pthread_self();
+
+	dim_tcpip_init(1);
+	while(1)
+    {
+		if(INIT_thread)
+#ifndef darwin
+			sem_post(&DIM_INIT_Sema);
+#else
+			sem_post(DIM_INIT_Semap);
+#endif
+		tcpip_task();
+		/*
+#ifndef darwin
+		sem_post(&DIM_WAIT_Sema);
+#else
+		sem_post(DIM_WAIT_Semap);
+#endif
+		*/
+		dim_signal_cond();
+    }
+}
+
+void *dim_dtq_thread(void *tag)
+{
+	extern int dim_dtq_init();
+	extern int dtq_task();
+	/*
+	int prio;
+
+	thr_getprio(thr_self(),&prio);
+	thr_setprio(thr_self(),prio+5);
+	*/
+	if(tag){}
+	ALRM_thread = pthread_self();
+
+	dim_dtq_init(1);
+	while(1)
+	  {
+		if(INIT_thread)
+		  {
+#ifndef darwin
+			sem_post(&DIM_INIT_Sema);
+#else
+			sem_post(DIM_INIT_Semap);
+#endif
+		  }
+		dtq_task();
+		/*
+#ifndef darwin
+		sem_post(&DIM_WAIT_Sema);
+#else
+		sem_post(DIM_WAIT_Semap);
+#endif
+		*/
+		dim_signal_cond();
+    }
+}
+
+void dim_init()
+{
+	pthread_t t_id;
+	void ignore_sigpipe();
+	int ret;
+	extern int dna_init();
+/*
+#ifdef LYNXOS
+*/
+    pthread_attr_t attr;
+/*
+#endif
+*/
+	if(!DIM_THR_init_done)
+	{
+	  /*
+		int prio;
+	  */
+		DIM_THR_init_done = 1;
+		dna_init();
+		/*
+		thr_getprio(thr_self(),&prio);
+		thr_setprio(thr_self(),prio+3);
+		*/
+		INIT_thread = pthread_self();
+		MAIN_thread = INIT_thread;
+		
+#ifndef darwin 	
+		sem_init(&DIM_INIT_Sema, 0, INIT_count);
+		/*
+		sem_init(&DIM_WAIT_Sema, 0, WAIT_count);
+		*/
+#else
+		DIM_INIT_Semap = sem_open("/Dim_INIT_Sem", O_CREAT, S_IRUSR | S_IWUSR, INIT_count);
+		/*
+		DIM_WAIT_Semap = sem_open("/Dim_WAIT_Sem", O_CREAT, S_IRUSR | S_IWUSR, WAIT_count);
+		*/
+#endif
+		
+		ignore_sigpipe();
+
+#if defined (LYNXOS) && !defined (__Lynx__)
+		pthread_attr_create(&attr);
+		pthread_create(&t_id, attr, dim_dtq_thread, 0);
+#else
+/*
+		pthread_create(&t_id, NULL, dim_dtq_thread, 0);
+*/
+		pthread_attr_init(&attr);
+		pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
+		pthread_create(&t_id, &attr, dim_dtq_thread, 0);
+#endif
+#ifndef darwin
+		ret = sem_wait(&DIM_INIT_Sema);
+#else
+		ret = sem_wait(DIM_INIT_Semap);
+#endif
+#if defined (LYNXOS) && !defined (__Lynx__)
+		pthread_create(&t_id, attr, dim_tcpip_thread, 0);
+#else
+		pthread_create(&t_id, &attr, dim_tcpip_thread, 0);
+#endif
+#ifndef darwin
+		ret = sem_wait(&DIM_INIT_Sema);
+#else
+		ret = sem_wait(DIM_INIT_Semap);
+#endif
+		INIT_thread = 0;
+	}
+}
+
+void dim_stop()
+{
+	int i;
+	int n = 0;
+	void dim_tcpip_stop(), dim_dtq_stop();
+
+	for( i = 0; i< Curr_N_Conns; i++ )
+	{
+		if(Net_conns[i].channel != 0)
+			n++;
+	}
+	if(n)
+		return;
+	if(IO_thread)
+		pthread_cancel(IO_thread);
+	if(ALRM_thread)
+		pthread_cancel(ALRM_thread);
+#ifndef darwin 		
+	sem_destroy(&DIM_INIT_Sema);
+	/*
+	sem_destroy(&DIM_WAIT_Sema);
+	*/
+#else
+	sem_unlink("/Dim_INIT_Sem");
+	/*
+	sem_unlink("/Dim_WAIT_Sem");
+	*/
+	sem_close(DIM_INIT_Semap);
+	/*
+	sem_close(DIM_WAIT_Semap);
+	*/
+#endif
+	if(IO_thread) 
+		pthread_join(IO_thread,0);
+	if(ALRM_thread) 
+		pthread_join(ALRM_thread,0);
+	dim_tcpip_stop();
+	dim_dtq_stop();	
+	IO_thread = 0;
+	ALRM_thread = 0;
+	DIM_THR_init_done = 0;
+}
+
+long dim_start_thread(void *(*thread_ast)(void *), long tag)
+{
+	pthread_t t_id;
+    pthread_attr_t attr;
+	
+#if defined (LYNXOS) && !defined (__Lynx__)
+	pthread_attr_create(&attr);
+	pthread_create(&t_id, attr, (void *)thread_ast, (void *)tag);
+#else
+	pthread_attr_init(&attr);
+	pthread_create(&t_id, &attr, thread_ast, (void *)tag);
+#endif
+	return((long)t_id);
+}	
+
+int dim_stop_thread(long t_id)
+{
+	int ret;
+	ret = pthread_cancel((pthread_t)t_id);
+	dim_print_date_time();
+	printf("dim_stop_thread: this function is obsolete, it creates memory leaks\n");
+	return ret;
+}
+
+int dim_set_scheduler_class(int pclass)
+{
+#ifdef __linux__
+	int ret, prio, p;
+	struct sched_param param;
+
+	if(pclass == 0)
+	{
+		pclass = SCHED_OTHER;
+	}
+	else if(pclass == 1)
+	{
+		pclass = SCHED_FIFO;
+	}
+	else if(pclass == 2)
+	{
+		pclass = SCHED_RR;
+	}
+	prio = sched_get_priority_min(pclass);
+	ret = pthread_getschedparam(MAIN_thread, &p, &param);
+	if( (p == SCHED_OTHER) || (pclass == SCHED_OTHER) )
+		param.sched_priority = prio;
+	ret = pthread_setschedparam(MAIN_thread, pclass, &param);   
+	if(ret)
+	  return 0;
+	ret = pthread_getschedparam(IO_thread, &p, &param);   
+	if( (p == SCHED_OTHER) || (pclass == SCHED_OTHER) )
+		param.sched_priority = prio;
+	ret = pthread_setschedparam(IO_thread, pclass, &param);   
+	if(ret)
+	  return 0;
+	ret = pthread_getschedparam(ALRM_thread, &p, &param);   
+	if( (p == SCHED_OTHER) || (pclass == SCHED_OTHER) )
+		param.sched_priority = prio;
+	ret = pthread_setschedparam(ALRM_thread, pclass, &param);   
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+int dim_get_scheduler_class(int *pclass)
+{
+#ifdef __linux__
+	int ret;
+	struct sched_param param;
+
+	ret = pthread_getschedparam(MAIN_thread, pclass, &param);   
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+int dim_set_priority(int threadId, int prio)
+{
+#ifdef __linux__
+	pthread_t id = MAIN_thread;
+	int ret;
+	int pclass;
+	struct sched_param param;
+
+	if(threadId == 1)
+		id = MAIN_thread;
+	else if(threadId == 2)
+		id = IO_thread;
+	else if(threadId == 3)
+		id = ALRM_thread;
+
+	ret = pthread_getschedparam(id, &pclass, &param);   
+	param.sched_priority = prio;
+	ret = pthread_setschedparam(id, pclass, &param);
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+int dim_get_priority(int threadId, int *prio)
+{
+#ifdef __linux__
+	pthread_t id=MAIN_thread;
+	int ret;
+	int pclass;
+	struct sched_param param;
+
+	if(threadId == 1)
+		id = MAIN_thread;
+	else if(threadId == 2)
+		id = IO_thread;
+	else if(threadId == 3)
+		id = ALRM_thread;
+
+	ret = pthread_getschedparam(id, &pclass, &param);   
+	*prio = param.sched_priority;
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+void ignore_sigpipe()
+{
+
+  struct sigaction sig_info;
+  sigset_t set;
+  void pipe_sig_handler();
+	    
+  if( sigaction(SIGPIPE, 0, &sig_info) < 0 ) 
+  {
+    perror( "sigaction(SIGPIPE)" );
+    exit(1);
+  }
+  if(sig_info.sa_handler)
+  {
+/*
+	printf("DIM ignore_sigpipe() - Handler already defined %08X\n", sig_info.sa_handler);
+*/
+    return;
+  }
+  sigemptyset(&set);
+  sig_info.sa_handler = pipe_sig_handler;
+  sig_info.sa_mask = set;
+#ifndef LYNXOS 
+  sig_info.sa_flags = SA_RESTART;
+#else
+  sig_info.sa_flags = 0;
+#endif
+
+  if( sigaction(SIGPIPE, &sig_info, 0) < 0 ) 
+  {
+    perror( "sigaction(SIGPIPE)" );
+    exit(1);
+  }
+}
+
+void pipe_sig_handler( int num )
+{
+	if(num){} 
+/*
+	printf( "*** pipe_sig_handler called ***\n" );
+*/  
+}
+
+void dim_init_threads()
+{
+    dim_init();
+}
+
+void dim_stop_threads()
+{
+	dim_stop();
+}
+
+int dim_wait(void)
+{
+	pthread_t id;
+	
+	id = pthread_self();
+
+	if((id == ALRM_thread) || (id == IO_thread))
+	  {
+		return(-1);
+	  }
+	/*
+#ifndef darwin
+	sem_wait(&DIM_WAIT_Sema);
+#else
+	sem_wait(DIM_WAIT_Semap);
+#endif
+	*/
+	dim_wait_cond();
+	return(-1);
+}
+
+/*
+static void show_ast()
+{
+sigset_t oset;
+
+	sigprocmask(SIG_SETMASK,0,&oset);
+	printf("---THREAD id = %d, mask = %x %x\n",
+       pthread_self(), oset.__sigbits[1], oset.__sigbits[0]);
+}
+*/
+
+pthread_t Dim_thr_locker = 0;
+int Dim_thr_counter = 0;
+#ifdef LYNXOS
+pthread_mutex_t Global_DIM_mutex;
+pthread_mutex_t Global_cond_mutex;
+pthread_cond_t Global_cond;
+#else
+pthread_mutex_t Global_DIM_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t Global_cond_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t Global_cond = PTHREAD_COND_INITIALIZER;
+#endif
+
+void dim_lock()
+{
+	/*printf("Locking %d ", pthread_self());*/
+    if(Dim_thr_locker != pthread_self())
+    {
+/*
+#ifdef __linux__
+		pthread_testcancel();
+#endif
+*/
+		pthread_mutex_lock(&Global_DIM_mutex);
+		Dim_thr_locker=pthread_self();
+		/*printf(": Locked ");*/
+	}
+    /*printf("Counter = %d\n",Dim_thr_counter);*/
+    Dim_thr_counter++;
+}
+void dim_unlock()	
+{
+	/*printf("Un-Locking %d ", pthread_self());*/
+    Dim_thr_counter--;
+    /*printf("Counter = %d ",Dim_thr_counter);*/
+    if(!Dim_thr_counter)
+    {
+		Dim_thr_locker=0;
+		pthread_mutex_unlock(&Global_DIM_mutex);
+		/*printf(": Un-Locked ");*/
+	}
+	/*     printf("\n");*/
+}
+
+void dim_wait_cond()
+{
+  pthread_mutex_lock(&Global_cond_mutex);
+  pthread_cond_wait(&Global_cond, &Global_cond_mutex);
+  pthread_mutex_unlock(&Global_cond_mutex);
+}
+
+void dim_signal_cond()
+{
+  pthread_mutex_lock(&Global_cond_mutex);
+  pthread_cond_broadcast(&Global_cond);
+  pthread_mutex_unlock(&Global_cond_mutex);
+}
+
+#else
+
+void dim_init()
+{
+}
+
+void dim_init_threads()
+{
+}
+
+void dim_stop_threads()
+{
+}
+
+void dim_stop()
+{
+}
+
+int dim_wait()
+{
+  pause();
+  return(-1);
+}
+
+long dim_start_thread(void (*thread_ast)(), long tag)
+
+{
+	printf("dim_start_thread: not available\n");
+	return (long)0;
+}
+
+int dim_stop_thread(long t_id)
+{
+	printf("dim_stop_thread: not available\n");
+	return 0;
+}
+#endif
+
+#else
+#include <windows.h>
+
+DWORD IO_thread = 0;
+DWORD ALRM_thread = 0;
+DWORD MAIN_thread = 0;
+HANDLE hIO_thread;
+HANDLE hALRM_thread;
+HANDLE hMAIN_thread;
+DllExp HANDLE Global_DIM_event_auto = 0;
+DllExp HANDLE Global_DIM_mutex = 0;
+DllExp HANDLE Global_DIM_event_manual = 0;
+void dim_tcpip_stop(), dim_dtq_stop();
+
+typedef struct{
+	void (*thread_ast)();
+	long tag;
+	
+}THREAD_PARAMS;
+
+#ifndef STDCALL
+long dim_start_thread(void (*thread_ast)(), long tag)
+#else
+long dim_start_thread(unsigned long (*thread_ast)(void *), void *tag)
+#endif
+{
+DWORD threadid = 0;
+HANDLE hthread;
+
+#ifndef STDCALL
+    hthread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+        (void *)thread_ast,          /* thread function					*/
+        (void *)tag,			             /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &threadid);				     /* returns the thread identifier	*/
+#else
+    hthread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+		thread_ast,					 /* thread function					*/
+        tag,			             /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &threadid);					 /* returns the thread identifier	*/
+#endif
+	return (long)hthread;
+}
+
+
+int dim_stop_thread(long thread_id)
+{
+	int ret;
+
+	ret = TerminateThread((HANDLE)thread_id, 0);
+	CloseHandle((HANDLE)thread_id);
+	printf("dim_stop_thread: this function is obsolete, it creates memory leaks\n");
+	return ret;
+}
+
+
+void create_io_thread()
+{
+	int tcpip_task(void *);
+
+#ifndef STDCALL
+    hIO_thread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+        (void *)tcpip_task,          /* thread function					*/
+        0,			                 /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &IO_thread);                 /* returns the thread identifier	*/
+#else
+    hIO_thread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+        tcpip_task,					 /* thread function					*/
+        0,			                 /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &IO_thread);                 /* returns the thread identifier	*/
+#endif
+}
+
+void create_alrm_thread()
+{
+
+	int dtq_task(void *);
+
+#ifndef STDCALL
+    hALRM_thread = CreateThread(
+        NULL,
+        0,
+        (void *)dtq_task,
+        0,
+        0,
+        &ALRM_thread);
+#else
+    hALRM_thread = CreateThread(
+        NULL,
+        0,
+        dtq_task,
+        0,
+        0,
+        &ALRM_thread);
+#endif
+}
+
+void dim_init_threads()
+{
+	static int done = 0;
+
+	if(!done)
+	{
+		hMAIN_thread = GetCurrentThread();
+		done = 1;
+	}
+}
+
+void dim_stop_threads()
+{
+	int i;
+	int n = 0;
+
+	for( i = 0; i< Curr_N_Conns; i++ )
+	{
+		if(Net_conns[i].channel != 0)
+			n++;
+	}
+	if(n)
+		return;
+	if(hIO_thread)
+		TerminateThread(hIO_thread, 0);
+	if(hALRM_thread)
+		TerminateThread(hALRM_thread, 0);
+	if(Global_DIM_mutex) 
+		CloseHandle(Global_DIM_mutex);
+	if(Global_DIM_event_auto) 
+		CloseHandle(Global_DIM_event_auto);
+	if(Global_DIM_event_manual) 
+		CloseHandle(Global_DIM_event_manual);
+	hIO_thread = 0;
+	hALRM_thread = 0;
+	Global_DIM_mutex = 0;
+	Global_DIM_event_auto = 0;
+	Global_DIM_event_manual = 0;
+	dim_tcpip_stop();
+	dim_dtq_stop();
+}
+
+void dim_stop()
+{
+	dim_stop_threads();
+}
+
+int dim_set_scheduler_class(int pclass)
+{
+	HANDLE hProc;
+	int ret;
+	DWORD p;
+
+#ifndef PXI
+	hProc = GetCurrentProcess();
+
+	if(pclass == -1)
+		p = IDLE_PRIORITY_CLASS;
+/*
+	else if(pclass == -1)
+		p = BELOW_NORMAL_PRIORITY_CLASS;
+*/
+	else if(pclass == 0)
+		p = NORMAL_PRIORITY_CLASS;
+/*
+	else if(pclass == 1)
+		p == ABOVE_NORMAL_PRIORITY_CLASS;
+*/
+	else if(pclass == 1)
+		p = HIGH_PRIORITY_CLASS;
+	else if(pclass == 2)
+		p = REALTIME_PRIORITY_CLASS;
+	ret = SetPriorityClass(hProc, p);
+	if(ret)
+	  return 1;
+	ret = GetLastError();
+	printf("ret = %x %d\n",ret, ret);
+	return 0;
+#else
+	return 0;
+#endif
+}
+
+int dim_get_scheduler_class(int *pclass)
+{
+	HANDLE hProc;
+	DWORD ret;
+
+#ifndef PXI
+	hProc = GetCurrentProcess();
+
+	ret = GetPriorityClass(hProc);
+	if(ret == 0)
+	  return 0;
+	if(ret == IDLE_PRIORITY_CLASS)
+		*pclass = -1;
+/*
+	else if(ret == BELOW_NORMAL_PRIORITY_CLASS)
+		*pclass = -1;
+*/
+	else if(ret == NORMAL_PRIORITY_CLASS)
+		*pclass = 0;
+/*
+	else if(ret == ABOVE_NORMAL_PRIORITY_CLASS)
+		*pclass = 1;
+*/
+	else if(ret == HIGH_PRIORITY_CLASS)
+		*pclass = 1;
+	else if(ret == REALTIME_PRIORITY_CLASS)
+		*pclass = 2;
+	return 1;
+#else
+	*pclass = 0;
+	return 0;
+#endif
+}
+
+int dim_set_priority(int threadId, int prio)
+{
+	HANDLE id;
+	int ret, p;
+
+#ifndef PXI
+	if(threadId == 1)
+		id = hMAIN_thread;
+	else if(threadId == 2)
+		id = hIO_thread;
+	else if(threadId == 3)
+		id = hALRM_thread;
+
+	if(prio == -3)
+		p = THREAD_PRIORITY_IDLE;
+	if(prio == -2)
+		p = THREAD_PRIORITY_LOWEST;
+	if(prio == -1)
+		p = THREAD_PRIORITY_BELOW_NORMAL;
+	if(prio == 0)
+		p = THREAD_PRIORITY_NORMAL;
+	if(prio == 1)
+		p = THREAD_PRIORITY_ABOVE_NORMAL;
+	if(prio == 2)
+		p = THREAD_PRIORITY_HIGHEST;
+	if(prio == 3)
+		p = THREAD_PRIORITY_TIME_CRITICAL;
+
+	ret = SetThreadPriority(id, p); 
+	if(ret)
+	  return 1;
+	return 0;
+#else
+	return 0;
+#endif
+}
+
+int dim_get_priority(int threadId, int *prio)
+{
+	HANDLE id;
+	int ret, p;
+
+#ifndef PXI
+	if(threadId == 1)
+		id = hMAIN_thread;
+	else if(threadId == 2)
+		id = hIO_thread;
+	else if(threadId == 3)
+		id = hALRM_thread;
+
+	ret = GetThreadPriority(id); 
+	if(ret == THREAD_PRIORITY_ERROR_RETURN)
+	  return 0;
+	if(ret == THREAD_PRIORITY_IDLE)
+		p = -3;
+	if(ret == THREAD_PRIORITY_LOWEST)
+		p = -2;
+	if(ret == THREAD_PRIORITY_BELOW_NORMAL)
+		p = -1;
+	if(ret == THREAD_PRIORITY_NORMAL)
+		p = 0;
+	if(ret == THREAD_PRIORITY_ABOVE_NORMAL)
+		p = 1;
+	if(ret == THREAD_PRIORITY_HIGHEST)
+		p = 2;
+	if(ret == THREAD_PRIORITY_TIME_CRITICAL)
+		p = 3;
+	*prio = p;
+	return 1;
+#else
+	*prio = 0;
+	return 0;
+#endif
+}
+
+void dim_init()
+{
+}
+
+void dim_no_threads()
+{
+}
+
+int dim_wait()
+{
+	pause();
+	return(1);
+}
+
+void dim_lock()
+{
+	if(!Global_DIM_mutex)
+	{ 
+		Global_DIM_mutex = CreateMutex(NULL,FALSE,NULL);
+	}
+	WaitForSingleObject(Global_DIM_mutex, INFINITE);
+}
+
+void dim_unlock()
+{
+	ReleaseMutex(Global_DIM_mutex);
+}
+
+void dim_pause()
+{
+HANDLE handles[2];
+
+	if(!Global_DIM_event_auto)
+	{ 
+		Global_DIM_event_auto = CreateEvent(NULL,FALSE,FALSE,NULL);
+		Global_DIM_event_manual = CreateEvent(NULL,TRUE,FALSE,NULL);
+	}
+	else 
+	{
+/*
+		WaitForSingleObject(Global_DIM_event, INFINITE);
+*/
+		handles[0] = Global_DIM_event_auto;
+		handles[1] = Global_DIM_event_manual;
+		WaitForMultipleObjects(2, handles, FALSE, INFINITE);
+	}
+}
+
+void dim_wake_up()
+{
+	if(Global_DIM_event_auto)
+	{
+		SetEvent(Global_DIM_event_auto);
+	}
+	if(Global_DIM_event_manual)
+	{
+		SetEvent(Global_DIM_event_manual);
+		ResetEvent(Global_DIM_event_manual);
+	}
+}
+
+void dim_sleep(unsigned int t)
+{
+	Sleep(t*1000);
+}
+
+void dim_win_usleep(unsigned int t)
+{
+	Sleep(t/1000);
+}
+
+#endif
Index: /trunk/FACT++/dim_v19r15/src/dim_thr_old.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dim_thr_old.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dim_thr_old.c	(revision 10183)
@@ -0,0 +1,894 @@
+#include <signal.h>
+#define DIMLIB
+#include "dim.h"
+
+#ifndef WIN32
+
+#ifndef NOTHREADS
+#include <pthread.h>
+#include <semaphore.h>
+#ifdef solaris
+#include <synch.h>
+#endif
+#ifdef darwin
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
+pthread_t IO_thread = 0;
+pthread_t ALRM_thread = 0;
+pthread_t INIT_thread = 0;
+pthread_t MAIN_thread = 0;
+#ifndef darwin
+sem_t DIM_INIT_Sema;
+/*
+sem_t DIM_WAIT_Sema;
+*/
+#else
+sem_t *DIM_INIT_Semap;
+/*
+sem_t *DIM_WAIT_Semap;
+*/
+#endif
+int INIT_count = 0;
+/*
+int WAIT_count = 0;
+*/
+int DIM_THR_init_done = 0;
+
+void *dim_tcpip_thread(void *tag)
+{
+	extern int dim_tcpip_init();
+	extern void tcpip_task();
+	/*	
+	int prio;
+		
+	thr_getprio(thr_self(),&prio);
+	thr_setprio(thr_self(),prio+10);
+	*/
+	if(tag){}
+	IO_thread = pthread_self();
+
+	dim_tcpip_init(1);
+	while(1)
+    {
+		if(INIT_thread)
+#ifndef darwin
+			sem_post(&DIM_INIT_Sema);
+#else
+			sem_post(DIM_INIT_Semap);
+#endif
+		tcpip_task();
+		/*
+#ifndef darwin
+		sem_post(&DIM_WAIT_Sema);
+#else
+		sem_post(DIM_WAIT_Semap);
+#endif
+		*/
+		dim_signal_cond();
+    }
+}
+
+void *dim_dtq_thread(void *tag)
+{
+	extern int dim_dtq_init();
+	extern int dtq_task();
+	/*
+	int prio;
+
+	thr_getprio(thr_self(),&prio);
+	thr_setprio(thr_self(),prio+5);
+	*/
+	if(tag){}
+	ALRM_thread = pthread_self();
+
+	dim_dtq_init(1);
+	while(1)
+	  {
+		if(INIT_thread)
+		  {
+#ifndef darwin
+			sem_post(&DIM_INIT_Sema);
+#else
+			sem_post(DIM_INIT_Semap);
+#endif
+		  }
+		dtq_task();
+		/*
+#ifndef darwin
+		sem_post(&DIM_WAIT_Sema);
+#else
+		sem_post(DIM_WAIT_Semap);
+#endif
+		*/
+		dim_signal_cond();
+    }
+}
+
+void dim_init()
+{
+	pthread_t t_id;
+	void ignore_sigpipe();
+	int ret;
+	extern int dna_init();
+/*
+#ifdef LYNXOS
+*/
+    pthread_attr_t attr;
+/*
+#endif
+*/
+	if(!DIM_THR_init_done)
+	{
+	  /*
+		int prio;
+	  */
+		DIM_THR_init_done = 1;
+		dna_init();
+		/*
+		thr_getprio(thr_self(),&prio);
+		thr_setprio(thr_self(),prio+3);
+		*/
+		INIT_thread = pthread_self();
+		MAIN_thread = INIT_thread;
+		
+#ifndef darwin 	
+		sem_init(&DIM_INIT_Sema, 0, INIT_count);
+		/*
+		sem_init(&DIM_WAIT_Sema, 0, WAIT_count);
+		*/
+#else
+		DIM_INIT_Semap = sem_open("/Dim_INIT_Sem", O_CREAT, S_IRUSR | S_IWUSR, INIT_count);
+		/*
+		DIM_WAIT_Semap = sem_open("/Dim_WAIT_Sem", O_CREAT, S_IRUSR | S_IWUSR, WAIT_count);
+		*/
+#endif
+		
+		ignore_sigpipe();
+
+#if defined (LYNXOS) && !defined (__Lynx__)
+		pthread_attr_create(&attr);
+		pthread_create(&t_id, attr, dim_dtq_thread, 0);
+#else
+/*
+		pthread_create(&t_id, NULL, dim_dtq_thread, 0);
+*/
+		pthread_attr_init(&attr);
+		pthread_attr_setinheritsched(&attr, PTHREAD_INHERIT_SCHED);
+		pthread_create(&t_id, &attr, dim_dtq_thread, 0);
+#endif
+#ifndef darwin
+		ret = sem_wait(&DIM_INIT_Sema);
+#else
+		ret = sem_wait(DIM_INIT_Semap);
+#endif
+#if defined (LYNXOS) && !defined (__Lynx__)
+		pthread_create(&t_id, attr, dim_tcpip_thread, 0);
+#else
+		pthread_create(&t_id, &attr, dim_tcpip_thread, 0);
+#endif
+#ifndef darwin
+		ret = sem_wait(&DIM_INIT_Sema);
+#else
+		ret = sem_wait(DIM_INIT_Semap);
+#endif
+		INIT_thread = 0;
+	}
+}
+
+void dim_stop()
+{
+	int i;
+	int n = 0;
+	void dim_tcpip_stop(), dim_dtq_stop();
+
+	for( i = 0; i< Curr_N_Conns; i++ )
+	{
+		if(Net_conns[i].channel != 0)
+			n++;
+	}
+	if(n)
+		return;
+	if(IO_thread)
+		pthread_cancel(IO_thread);
+	if(ALRM_thread)
+		pthread_cancel(ALRM_thread);
+#ifndef darwin 		
+	sem_destroy(&DIM_INIT_Sema);
+	/*
+	sem_destroy(&DIM_WAIT_Sema);
+	*/
+#else
+	sem_unlink("/Dim_INIT_Sem");
+	/*
+	sem_unlink("/Dim_WAIT_Sem");
+	*/
+	sem_close(DIM_INIT_Semap);
+	/*
+	sem_close(DIM_WAIT_Semap);
+	*/
+#endif
+	dim_tcpip_stop();
+	dim_dtq_stop();	
+	if(IO_thread) 
+		pthread_join(IO_thread,0);
+	if(ALRM_thread) 
+		pthread_join(ALRM_thread,0);
+	IO_thread = 0;
+	ALRM_thread = 0;
+	DIM_THR_init_done = 0;
+}
+
+long dim_start_thread(void *(*thread_ast)(void *), long tag)
+{
+	pthread_t t_id;
+    pthread_attr_t attr;
+	
+#if defined (LYNXOS) && !defined (__Lynx__)
+	pthread_attr_create(&attr);
+	pthread_create(&t_id, attr, (void *)thread_ast, (void *)tag);
+#else
+	pthread_attr_init(&attr);
+	pthread_create(&t_id, &attr, thread_ast, (void *)tag);
+#endif
+	return((long)t_id);
+}	
+
+int dim_stop_thread(long t_id)
+{
+	int ret;
+	ret = pthread_cancel((pthread_t)t_id);
+	dim_print_date_time();
+	printf("dim_stop_thread: this function is obsolete, it creates memory leaks\n");
+	return ret;
+}
+
+int dim_set_scheduler_class(int pclass)
+{
+#ifdef __linux__
+	int ret, prio, p;
+	struct sched_param param;
+
+	if(pclass == 0)
+	{
+		pclass = SCHED_OTHER;
+	}
+	else if(pclass == 1)
+	{
+		pclass = SCHED_FIFO;
+	}
+	else if(pclass == 2)
+	{
+		pclass = SCHED_RR;
+	}
+	prio = sched_get_priority_min(pclass);
+	ret = pthread_getschedparam(MAIN_thread, &p, &param);
+	if( (p == SCHED_OTHER) || (pclass == SCHED_OTHER) )
+		param.sched_priority = prio;
+	ret = pthread_setschedparam(MAIN_thread, pclass, &param);   
+	if(ret)
+	  return 0;
+	ret = pthread_getschedparam(IO_thread, &p, &param);   
+	if( (p == SCHED_OTHER) || (pclass == SCHED_OTHER) )
+		param.sched_priority = prio;
+	ret = pthread_setschedparam(IO_thread, pclass, &param);   
+	if(ret)
+	  return 0;
+	ret = pthread_getschedparam(ALRM_thread, &p, &param);   
+	if( (p == SCHED_OTHER) || (pclass == SCHED_OTHER) )
+		param.sched_priority = prio;
+	ret = pthread_setschedparam(ALRM_thread, pclass, &param);   
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+int dim_get_scheduler_class(int *pclass)
+{
+#ifdef __linux__
+	int ret;
+	struct sched_param param;
+
+	ret = pthread_getschedparam(MAIN_thread, pclass, &param);   
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+int dim_set_priority(int threadId, int prio)
+{
+#ifdef __linux__
+	pthread_t id = MAIN_thread;
+	int ret;
+	int pclass;
+	struct sched_param param;
+
+	if(threadId == 1)
+		id = MAIN_thread;
+	else if(threadId == 2)
+		id = IO_thread;
+	else if(threadId == 3)
+		id = ALRM_thread;
+
+	ret = pthread_getschedparam(id, &pclass, &param);   
+	param.sched_priority = prio;
+	ret = pthread_setschedparam(id, pclass, &param);
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+int dim_get_priority(int threadId, int *prio)
+{
+#ifdef __linux__
+	pthread_t id=MAIN_thread;
+	int ret;
+	int pclass;
+	struct sched_param param;
+
+	if(threadId == 1)
+		id = MAIN_thread;
+	else if(threadId == 2)
+		id = IO_thread;
+	else if(threadId == 3)
+		id = ALRM_thread;
+
+	ret = pthread_getschedparam(id, &pclass, &param);   
+	*prio = param.sched_priority;
+	if(!ret)
+	  return 1;
+#endif
+	return 0;
+}
+
+void ignore_sigpipe()
+{
+
+  struct sigaction sig_info;
+  sigset_t set;
+  void pipe_sig_handler();
+	    
+  if( sigaction(SIGPIPE, 0, &sig_info) < 0 ) 
+  {
+    perror( "sigaction(SIGPIPE)" );
+    exit(1);
+  }
+  if(sig_info.sa_handler)
+  {
+/*
+	printf("DIM ignore_sigpipe() - Handler already defined %08X\n", sig_info.sa_handler);
+*/
+    return;
+  }
+  sigemptyset(&set);
+  sig_info.sa_handler = pipe_sig_handler;
+  sig_info.sa_mask = set;
+#ifndef LYNXOS 
+  sig_info.sa_flags = SA_RESTART;
+#else
+  sig_info.sa_flags = 0;
+#endif
+
+  if( sigaction(SIGPIPE, &sig_info, 0) < 0 ) 
+  {
+    perror( "sigaction(SIGPIPE)" );
+    exit(1);
+  }
+}
+
+void pipe_sig_handler( int num )
+{
+	if(num){} 
+/*
+	printf( "*** pipe_sig_handler called ***\n" );
+*/  
+}
+
+void dim_init_threads()
+{
+    dim_init();
+}
+
+void dim_stop_threads()
+{
+	dim_stop();
+}
+
+int dim_wait(void)
+{
+	pthread_t id;
+	
+	id = pthread_self();
+
+	if((id == ALRM_thread) || (id == IO_thread))
+	  {
+		return(-1);
+	  }
+	/*
+#ifndef darwin
+	sem_wait(&DIM_WAIT_Sema);
+#else
+	sem_wait(DIM_WAIT_Semap);
+#endif
+	*/
+	dim_wait_cond();
+	return(-1);
+}
+
+/*
+static void show_ast()
+{
+sigset_t oset;
+
+	sigprocmask(SIG_SETMASK,0,&oset);
+	printf("---THREAD id = %d, mask = %x %x\n",
+       pthread_self(), oset.__sigbits[1], oset.__sigbits[0]);
+}
+*/
+
+pthread_t Dim_thr_locker = 0;
+int Dim_thr_counter = 0;
+#ifdef LYNXOS
+pthread_mutex_t Global_DIM_mutex;
+pthread_mutex_t Global_cond_mutex;
+pthread_cond_t Global_cond;
+#else
+pthread_mutex_t Global_DIM_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t Global_cond_mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_cond_t Global_cond = PTHREAD_COND_INITIALIZER;
+#endif
+
+void dim_lock()
+{
+	/*printf("Locking %d ", pthread_self());*/
+    if(Dim_thr_locker != pthread_self())
+    {
+		pthread_mutex_lock(&Global_DIM_mutex);
+		Dim_thr_locker=pthread_self();
+		/*printf(": Locked ");*/
+	}
+    /*printf("Counter = %d\n",Dim_thr_counter);*/
+    Dim_thr_counter++;
+}
+void dim_unlock()	
+{
+	/*printf("Un-Locking %d ", pthread_self());*/
+    Dim_thr_counter--;
+    /*printf("Counter = %d ",Dim_thr_counter);*/
+    if(!Dim_thr_counter)
+    {
+		Dim_thr_locker=0;
+		pthread_mutex_unlock(&Global_DIM_mutex);
+		/*printf(": Un-Locked ");*/
+	}
+	/*     printf("\n");*/
+}
+
+void dim_wait_cond()
+{
+  pthread_mutex_lock(&Global_cond_mutex);
+  pthread_cond_wait(&Global_cond, &Global_cond_mutex);
+  pthread_mutex_unlock(&Global_cond_mutex);
+}
+
+void dim_signal_cond()
+{
+  pthread_mutex_lock(&Global_cond_mutex);
+  pthread_cond_broadcast(&Global_cond);
+  pthread_mutex_unlock(&Global_cond_mutex);
+}
+
+#else
+
+void dim_init()
+{
+}
+
+void dim_init_threads()
+{
+}
+
+void dim_stop_threads()
+{
+}
+
+void dim_stop()
+{
+}
+
+int dim_wait()
+{
+  pause();
+  return(-1);
+}
+
+long dim_start_thread(void (*thread_ast)(), long tag)
+
+{
+	printf("dim_start_thread: not available\n");
+	return (long)0;
+}
+
+int dim_stop_thread(long t_id)
+{
+	printf("dim_stop_thread: not available\n");
+	return 0;
+}
+#endif
+
+#else
+#include <windows.h>
+
+DWORD IO_thread = 0;
+DWORD ALRM_thread = 0;
+DWORD MAIN_thread = 0;
+HANDLE hIO_thread;
+HANDLE hALRM_thread;
+HANDLE hMAIN_thread;
+DllExp HANDLE Global_DIM_event_auto = 0;
+DllExp HANDLE Global_DIM_mutex = 0;
+DllExp HANDLE Global_DIM_event_manual = 0;
+void dim_tcpip_stop(), dim_dtq_stop();
+
+typedef struct{
+	void (*thread_ast)();
+	long tag;
+	
+}THREAD_PARAMS;
+
+#ifndef STDCALL
+long dim_start_thread(void (*thread_ast)(), long tag)
+#else
+long dim_start_thread(unsigned long (*thread_ast)(void *), void *tag)
+#endif
+{
+DWORD threadid = 0;
+HANDLE hthread;
+
+#ifndef STDCALL
+    hthread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+        (void *)thread_ast,          /* thread function					*/
+        (void *)tag,			             /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &threadid);				     /* returns the thread identifier	*/
+#else
+    hthread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+		thread_ast,					 /* thread function					*/
+        tag,			             /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &threadid);					 /* returns the thread identifier	*/
+#endif
+	return (long)hthread;
+}
+
+
+int dim_stop_thread(long thread_id)
+{
+	int ret;
+
+	ret = TerminateThread((HANDLE)thread_id, 0);
+	CloseHandle((HANDLE)thread_id);
+	printf("dim_stop_thread: this function is obsolete, it creates memory leaks\n");
+	return ret;
+}
+
+
+void create_io_thread()
+{
+	int tcpip_task(void *);
+
+#ifndef STDCALL
+    hIO_thread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+        (void *)tcpip_task,          /* thread function					*/
+        0,			                 /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &IO_thread);                 /* returns the thread identifier	*/
+#else
+    hIO_thread = CreateThread( 
+        NULL,                        /* no security attributes			*/
+        0,                           /* use default stack size			*/
+        tcpip_task,					 /* thread function					*/
+        0,			                 /* argument to thread function		*/
+        0,                           /* use default creation flags		*/
+        &IO_thread);                 /* returns the thread identifier	*/
+#endif
+}
+
+void create_alrm_thread()
+{
+
+	int dtq_task(void *);
+
+#ifndef STDCALL
+    hALRM_thread = CreateThread(
+        NULL,
+        0,
+        (void *)dtq_task,
+        0,
+        0,
+        &ALRM_thread);
+#else
+    hALRM_thread = CreateThread(
+        NULL,
+        0,
+        dtq_task,
+        0,
+        0,
+        &ALRM_thread);
+#endif
+}
+
+void dim_init_threads()
+{
+	static int done = 0;
+
+	if(!done)
+	{
+		hMAIN_thread = GetCurrentThread();
+		done = 1;
+	}
+}
+
+void dim_stop_threads()
+{
+	int i;
+	int n = 0;
+
+	for( i = 0; i< Curr_N_Conns; i++ )
+	{
+		if(Net_conns[i].channel != 0)
+			n++;
+	}
+	if(n)
+		return;
+	if(hIO_thread)
+		TerminateThread(hIO_thread, 0);
+	if(hALRM_thread)
+		TerminateThread(hALRM_thread, 0);
+	if(Global_DIM_mutex) 
+		CloseHandle(Global_DIM_mutex);
+	if(Global_DIM_event_auto) 
+		CloseHandle(Global_DIM_event_auto);
+	if(Global_DIM_event_manual) 
+		CloseHandle(Global_DIM_event_manual);
+	hIO_thread = 0;
+	hALRM_thread = 0;
+	Global_DIM_mutex = 0;
+	Global_DIM_event_auto = 0;
+	Global_DIM_event_manual = 0;
+	dim_tcpip_stop();
+	dim_dtq_stop();
+}
+
+void dim_stop()
+{
+	dim_stop_threads();
+}
+
+int dim_set_scheduler_class(int pclass)
+{
+	HANDLE hProc;
+	int ret;
+	DWORD p;
+
+#ifndef PXI
+	hProc = GetCurrentProcess();
+
+	if(pclass == -1)
+		p = IDLE_PRIORITY_CLASS;
+/*
+	else if(pclass == -1)
+		p = BELOW_NORMAL_PRIORITY_CLASS;
+*/
+	else if(pclass == 0)
+		p = NORMAL_PRIORITY_CLASS;
+/*
+	else if(pclass == 1)
+		p == ABOVE_NORMAL_PRIORITY_CLASS;
+*/
+	else if(pclass == 1)
+		p = HIGH_PRIORITY_CLASS;
+	else if(pclass == 2)
+		p = REALTIME_PRIORITY_CLASS;
+	ret = SetPriorityClass(hProc, p);
+	if(ret)
+	  return 1;
+	ret = GetLastError();
+	printf("ret = %x %d\n",ret, ret);
+	return 0;
+#else
+	return 0;
+#endif
+}
+
+int dim_get_scheduler_class(int *pclass)
+{
+	HANDLE hProc;
+	DWORD ret;
+
+#ifndef PXI
+	hProc = GetCurrentProcess();
+
+	ret = GetPriorityClass(hProc);
+	if(ret == 0)
+	  return 0;
+	if(ret == IDLE_PRIORITY_CLASS)
+		*pclass = -1;
+/*
+	else if(ret == BELOW_NORMAL_PRIORITY_CLASS)
+		*pclass = -1;
+*/
+	else if(ret == NORMAL_PRIORITY_CLASS)
+		*pclass = 0;
+/*
+	else if(ret == ABOVE_NORMAL_PRIORITY_CLASS)
+		*pclass = 1;
+*/
+	else if(ret == HIGH_PRIORITY_CLASS)
+		*pclass = 1;
+	else if(ret == REALTIME_PRIORITY_CLASS)
+		*pclass = 2;
+	return 1;
+#else
+	*pclass = 0;
+	return 0;
+#endif
+}
+
+int dim_set_priority(int threadId, int prio)
+{
+	HANDLE id;
+	int ret, p;
+
+#ifndef PXI
+	if(threadId == 1)
+		id = hMAIN_thread;
+	else if(threadId == 2)
+		id = hIO_thread;
+	else if(threadId == 3)
+		id = hALRM_thread;
+
+	if(prio == -3)
+		p = THREAD_PRIORITY_IDLE;
+	if(prio == -2)
+		p = THREAD_PRIORITY_LOWEST;
+	if(prio == -1)
+		p = THREAD_PRIORITY_BELOW_NORMAL;
+	if(prio == 0)
+		p = THREAD_PRIORITY_NORMAL;
+	if(prio == 1)
+		p = THREAD_PRIORITY_ABOVE_NORMAL;
+	if(prio == 2)
+		p = THREAD_PRIORITY_HIGHEST;
+	if(prio == 3)
+		p = THREAD_PRIORITY_TIME_CRITICAL;
+
+	ret = SetThreadPriority(id, p); 
+	if(ret)
+	  return 1;
+	return 0;
+#else
+	return 0;
+#endif
+}
+
+int dim_get_priority(int threadId, int *prio)
+{
+	HANDLE id;
+	int ret, p;
+
+#ifndef PXI
+	if(threadId == 1)
+		id = hMAIN_thread;
+	else if(threadId == 2)
+		id = hIO_thread;
+	else if(threadId == 3)
+		id = hALRM_thread;
+
+	ret = GetThreadPriority(id); 
+	if(ret == THREAD_PRIORITY_ERROR_RETURN)
+	  return 0;
+	if(ret == THREAD_PRIORITY_IDLE)
+		p = -3;
+	if(ret == THREAD_PRIORITY_LOWEST)
+		p = -2;
+	if(ret == THREAD_PRIORITY_BELOW_NORMAL)
+		p = -1;
+	if(ret == THREAD_PRIORITY_NORMAL)
+		p = 0;
+	if(ret == THREAD_PRIORITY_ABOVE_NORMAL)
+		p = 1;
+	if(ret == THREAD_PRIORITY_HIGHEST)
+		p = 2;
+	if(ret == THREAD_PRIORITY_TIME_CRITICAL)
+		p = 3;
+	*prio = p;
+	return 1;
+#else
+	*prio = 0;
+	return 0;
+#endif
+}
+
+void dim_init()
+{
+}
+
+void dim_no_threads()
+{
+}
+
+int dim_wait()
+{
+	pause();
+	return(1);
+}
+
+void dim_lock()
+{
+	if(!Global_DIM_mutex)
+	{ 
+		Global_DIM_mutex = CreateMutex(NULL,FALSE,NULL);
+	}
+	WaitForSingleObject(Global_DIM_mutex, INFINITE);
+}
+
+void dim_unlock()
+{
+	ReleaseMutex(Global_DIM_mutex);
+}
+
+void dim_pause()
+{
+HANDLE handles[2];
+
+	if(!Global_DIM_event_auto)
+	{ 
+		Global_DIM_event_auto = CreateEvent(NULL,FALSE,FALSE,NULL);
+		Global_DIM_event_manual = CreateEvent(NULL,TRUE,FALSE,NULL);
+	}
+	else 
+	{
+/*
+		WaitForSingleObject(Global_DIM_event, INFINITE);
+*/
+		handles[0] = Global_DIM_event_auto;
+		handles[1] = Global_DIM_event_manual;
+		WaitForMultipleObjects(2, handles, FALSE, INFINITE);
+	}
+}
+
+void dim_wake_up()
+{
+	if(Global_DIM_event_auto)
+	{
+		SetEvent(Global_DIM_event_auto);
+	}
+	if(Global_DIM_event_manual)
+	{
+		SetEvent(Global_DIM_event_manual);
+		ResetEvent(Global_DIM_event_manual);
+	}
+}
+
+void dim_sleep(unsigned int t)
+{
+	Sleep(t*1000);
+}
+
+void dim_win_usleep(unsigned int t)
+{
+	Sleep(t/1000);
+}
+
+#endif
Index: /trunk/FACT++/dim_v19r15/src/dimcpp.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dimcpp.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dimcpp.cxx	(revision 10183)
@@ -0,0 +1,137 @@
+#include <assert.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef __VMS
+#include <starlet.h>
+#endif
+
+#define DIMLIB
+#include <dim_core.hxx>
+#include <dim.hxx>
+
+int DimCore::inCallback = 0;
+int DimUtil::itsBufferSize = 0;
+char *DimUtil::itsBuffer = (char *)0;
+
+extern "C" {
+static void timer_user_routine(void *tp)
+{
+	DimTimer *t = (DimTimer *)tp;
+	DimCore::inCallback = 1;
+	t->firedFlag = 1;
+	t->runningFlag = 0;
+	t->timerHandler();
+	DimCore::inCallback = 0;
+}
+}
+
+int DimTimer::start(int time)
+{
+	if(runningFlag)
+		return 0;
+	runningFlag = 1;
+	firedFlag = 0;
+	dtq_start_timer(time, timer_user_routine, this);
+	return 1;
+}
+
+int DimTimer::stop() 
+{
+	firedFlag = 0;
+	runningFlag = 0;
+	return dtq_stop_timer(this);
+}
+
+DimTimer::DimTimer() 
+{ 
+	firedFlag = 0;
+	runningFlag = 0; 
+}
+	
+DimTimer::DimTimer(int time)
+{ 
+	firedFlag = 0;
+	runningFlag = 0; 
+	start(time);
+}
+
+DimTimer::~DimTimer()
+{
+	if(runningFlag)
+		stop();
+}
+
+// Threads
+
+extern "C" {
+static void thread_user_routine(void *tp)
+{
+	DimThread *t = (DimThread *)tp;
+//	DimCore::inCallback = 1;
+//	t->firedFlag = 1;
+//	t->runningFlag = 0;
+	t->threadHandler();
+	t->itsId = 0;
+//	DimCore::inCallback = 0;
+}
+}
+
+DimThread::DimThread() 
+{
+//	start();
+	itsId = 0;
+}
+	
+DimThread::~DimThread()
+{
+//	if(itsId)
+//		stop();
+}
+
+int DimThread::start()
+{
+	if(!itsId)
+	{
+		itsId = dim_start_thread(thread_user_routine, this);
+		return 1;
+	}
+	return 0;
+}
+/*
+int DimThread::stop()
+{
+	int ret = dim_stop_thread(itsId);
+	itsId = 0;
+	return ret;
+}
+*/
+
+DimUtil::DimUtil() 
+{
+}
+	
+DimUtil::~DimUtil()
+{
+}
+
+char *DimUtil::getEnvVar(char *name)
+{
+	int size;
+
+	size = dim_get_env_var(name, 0, 0);
+	if(!size)
+		return (char *)0;
+	if((itsBufferSize < size ) && (itsBufferSize != 0))
+	{
+		delete[] itsBuffer;
+		itsBufferSize = 0;
+	}
+	if(!itsBufferSize)
+	{
+		itsBuffer = new char[size];
+		itsBufferSize = size;
+	}
+	dim_get_env_var(name, itsBuffer, itsBufferSize);
+	return itsBuffer;
+}
Index: /trunk/FACT++/dim_v19r15/src/dis.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dis.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dis.c	(revision 10183)
@@ -0,0 +1,3241 @@
+/*
+ * DIS (Delphi Information Server) Package implements a library of
+ * routines to be used by servers.
+ *
+ * Started on		 : 10-11-91
+ * Last modification : 28-07-94
+ * Written by		 : C. Gaspar
+ * Adjusted by	     : G.C. Ballintijn
+ *
+ */
+
+#ifdef VMS
+#	include <lnmdef.h>
+#	include <ssdef.h>
+#	include <descrip.h>
+#	include <cfortran.h>
+#endif
+/*
+#define DEBUG
+*/
+#include <time.h>
+#ifdef VAX
+#include <timeb.h>
+#else
+#include <sys/timeb.h>
+#endif
+
+#define DIMLIB
+#include <dim.h>
+#include <dis.h>
+
+#define ALL 0
+#define MORE 1
+#define NONE 2
+
+typedef struct dis_dns_ent {
+	struct dis_dns_ent *next;
+	struct dis_dns_ent *prev;
+	long dnsid;
+	char task_name[MAX_NAME];
+	TIMR_ENT *dns_timr_ent;
+	DIS_DNS_PACKET dis_dns_packet;
+	int dis_n_services;
+	int dns_dis_conn_id;
+	int dis_first_time;
+	int serving;
+	unsigned int dis_service_id;
+	unsigned int dis_client_id;
+	int updating_service_list;
+} DIS_DNS_CONN;
+
+typedef struct req_ent {
+	struct req_ent *next;
+	struct req_ent *prev;
+	int conn_id;
+	int service_id;
+	int req_id;
+	int type;
+	struct serv *service_ptr;
+	int timeout;
+	int format;
+	int first_time;
+	int delay_delete;
+	int to_delete;
+	TIMR_ENT *timr_ent;
+	struct reqp_ent *reqpp;
+} REQUEST;
+
+typedef struct serv {
+	struct serv *next;
+	struct serv *prev;
+	char name[MAX_NAME];
+	int id;
+	int type;
+	char def[MAX_NAME];
+	FORMAT_STR format_data[MAX_NAME/4];
+	int *address;
+	int size;
+	void (*user_routine)();
+	long tag;
+	int registered;
+	int quality;
+	int user_secs;
+	int user_millisecs;
+	int tid;
+	REQUEST *request_head;
+	DIS_DNS_CONN *dnsp;
+	int delay_delete;
+	int to_delete;
+} SERVICE;
+
+typedef struct reqp_ent {
+	struct reqp_ent *next;
+	struct reqp_ent *prev;
+	REQUEST *reqp;
+} REQUEST_PTR;
+
+typedef struct cli_ent {
+	struct cli_ent *next;
+	struct cli_ent *prev;
+	int conn_id;
+	REQUEST_PTR *requestp_head; 
+	DIS_DNS_CONN *dnsp;
+} CLIENT;
+
+static CLIENT *Client_head = (CLIENT *)0;	
+
+static DIS_DNS_CONN *DNS_head = (DIS_DNS_CONN *)0;	
+
+/*
+static char Task_name[MAX_NAME];
+static TIMR_ENT *Dns_timr_ent = (TIMR_ENT *)0;
+static DIS_DNS_PACKET Dis_dns_packet = {0, 0, {0}};
+static int Dis_n_services = 0;
+*/
+static int Dis_first_time = 1;
+/*
+static int Dns_dis_conn_id = 0;
+*/
+static int Protocol;
+static int Port_number;
+static int Dis_conn_id = 0;
+static int Curr_conn_id = 0;
+static int Serving = 0;
+static void (*Client_exit_user_routine)() = 0;
+static void (*Exit_user_routine)() = 0;
+static void (*Error_user_routine)() = 0;
+static int Error_conn_id = 0;
+DIS_DNS_CONN *Default_DNS = 0;
+
+typedef struct exit_ent {
+	struct exit_ent *next;
+	int conn_id;
+	int exit_id;
+} EXIT_H;
+
+static EXIT_H *Exit_h_head = (EXIT_H *)0;
+
+/* Do not forget to increase when this file is modified */
+static int Version_number = DIM_VERSION_NUMBER;
+static int Dis_timer_q = 0;
+static int Threads_off = 0;
+/*
+static unsigned int Dis_service_id, Dis_client_id;
+static int Updating_service_list = 0;
+*/
+static int Last_client;
+
+#ifdef DEBUG
+static int Debug_on = 1;
+#else
+static int Debug_on = 0;
+#endif
+
+_DIM_PROTO( static void dis_insert_request, (int conn_id, DIC_PACKET *dic_packet,
+				  int size, int status ) );
+_DIM_PROTO( int execute_service,	(int req_id) );
+_DIM_PROTO( void execute_command,	(SERVICE *servp, DIC_PACKET *packet) );
+_DIM_PROTO( void register_dns_services,  (int flag) );
+_DIM_PROTO( void register_services,  (DIS_DNS_CONN *dnsp, int flag, int dns_flag) );
+_DIM_PROTO( void std_cmnd_handler,   (long *tag, int *cmnd_buff, int *size) );
+_DIM_PROTO( void client_info,		(long *tag, int **bufp, int *size) );
+_DIM_PROTO( void service_info,	   (long *tag, int **bufp, int *size) );
+_DIM_PROTO( void add_exit_handler,   (int *tag, int *bufp, int *size) );
+_DIM_PROTO( static void exit_handler,	   (int *tag, int *bufp, int *size) );
+_DIM_PROTO( static void error_handler,	   (int conn_id, int severity, int errcode, char *reason) );
+_DIM_PROTO( SERVICE *find_service,   (char *name) );
+_DIM_PROTO( CLIENT *find_client,   (int conn_id) );
+_DIM_PROTO( static int get_format_data, (FORMAT_STR *format_data, char *def) );
+_DIM_PROTO( static int release_conn, (int conn_id, int print_flag, int dns_flag) );
+_DIM_PROTO( SERVICE *dis_hash_service_exists, (char *name) );
+_DIM_PROTO( SERVICE *dis_hash_service_get_next, (int *start, SERVICE *prev, int flag) );
+_DIM_PROTO( static unsigned do_dis_add_service_dns, (char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag, long dnsid ) );
+_DIM_PROTO( static DIS_DNS_CONN *create_dns, (long dnsid) );
+
+void dis_set_debug_on()
+{
+	Debug_on = 1;
+}
+
+void dis_set_debug_off()
+{
+	Debug_on = 0;
+}
+
+void dis_no_threads()
+{
+	Threads_off = 1;
+}
+
+static DIS_STAMPED_PACKET *Dis_packet = 0;
+static int Dis_packet_size = 0;
+
+int dis_set_buffer_size(int size)
+{
+	if(Dis_packet_size)
+		free(Dis_packet);
+	Dis_packet = (DIS_STAMPED_PACKET *)malloc(DIS_STAMPED_HEADER + size);
+	if(Dis_packet)
+	{
+		Dis_packet_size = DIS_STAMPED_HEADER + size;
+		return(1);
+	}
+	else
+		return(0);
+}
+
+static int check_service_name(char *name)
+{
+	if(strlen(name) > (MAX_NAME - 1))
+		return(0);
+	return(1);
+}
+
+static void dis_init()
+{
+	int dis_hash_service_init();
+	void dis_dns_init();
+
+	dis_dns_init();
+	{
+	DISABLE_AST
+	dis_hash_service_init();
+	ENABLE_AST
+	}
+}
+
+static unsigned do_dis_add_service_dns( char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag, long dnsid )
+{
+	register SERVICE *new_serv;
+	register int service_id;
+	char str[512];
+	int dis_hash_service_insert();
+	DIS_DNS_CONN *dnsp;
+	extern DIS_DNS_CONN *dis_find_dns(long);
+
+	dis_init();
+	{
+	DISABLE_AST
+	if(!check_service_name(name))
+	{
+		strcpy(str,"Service name too long: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCTOOLG, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	if( find_service(name) )
+	{
+		strcpy(str,"Duplicate Service: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCDUPLC, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	new_serv = (SERVICE *)malloc( sizeof(SERVICE) );
+	strncpy( new_serv->name, name, MAX_NAME );
+	if(type != (char *)0)
+	{
+		if (strlen(type) >= MAX_NAME)
+		{
+			strcpy(str,"Format String Too Long: ");
+			strcat(str,name);
+			error_handler(0, DIM_ERROR, DIMSVCFORMT, str);
+			free(new_serv);
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		if (! get_format_data(new_serv->format_data, type))
+		{
+			strcpy(str,"Bad Format String: ");
+			strcat(str,name);
+			error_handler(0, DIM_ERROR, DIMSVCFORMT, str);
+			free(new_serv);
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		strcpy(new_serv->def,type); 
+	}
+	else
+	{
+		new_serv->format_data[0].par_bytes = 0;
+		new_serv->def[0] = '\0';
+	}
+	new_serv->type = 0;
+	new_serv->address = (int *)address;
+	new_serv->size = size;
+	new_serv->user_routine = user_routine;
+	new_serv->tag = tag;
+	new_serv->registered = 0;
+	new_serv->quality = 0;
+	new_serv->user_secs = 0;
+	new_serv->tid = 0;
+	new_serv->delay_delete = 0;
+	new_serv->to_delete = 0;
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = create_dns(dnsid);
+	new_serv->dnsp = dnsp;
+	service_id = id_get((void *)new_serv, SRC_DIS);
+	new_serv->id = service_id;
+	new_serv->request_head = (REQUEST *)malloc(sizeof(REQUEST));
+	dll_init( (DLL *) (new_serv->request_head) );
+	dis_hash_service_insert(new_serv);
+/*
+	Dis_n_services++;
+*/
+	dnsp->dis_n_services++;
+	ENABLE_AST
+	}
+	return((unsigned)service_id);
+}
+
+static unsigned do_dis_add_service( char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag )
+{
+	return do_dis_add_service_dns( name, type, address, size, 
+								   user_routine, tag, 0 );
+}
+
+#ifdef VxWorks
+void dis_destroy(int tid)
+{
+register SERVICE *servp, *prevp;
+int n_left = 0;
+
+	prevp = 0;
+	while( servp = dis_hash_service_get_next(prevp))
+	{
+		if(servp->tid == tid)
+		{
+			dis_remove_service(servp->id);
+		}
+		else
+		{
+			prevp = servp;
+			n_left++;
+		}
+	}
+	if(n_left == 5)
+	{
+		prevp = 0;
+		while( servp = dis_hash_service_get_next(prevp))
+		{
+			dis_remove_service(servp->id);
+		}
+		dna_close(Dis_conn_id);
+		dna_close(Dns_dis_conn_id);
+		Dns_dis_conn_id = 0;
+		Dis_first_time = 1;
+		dtq_rem_entry(Dis_timer_q, Dns_timr_ent);
+		Dns_timr_ent = NULL;
+	}
+}
+
+
+#endif
+
+unsigned dis_add_service( char *name, char *type, void *address, int size, 
+						 void (*user_routine)(), long tag)
+{
+	unsigned ret;
+#ifdef VxWorks
+	register SERVICE *servp;
+#endif
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_service( name, type, address, size, user_routine, tag);
+#ifdef VxWorks
+	servp = (SERVICE *)id_get_ptr(ret, SRC_DIS);
+	servp->tid = taskIdSelf();
+#endif
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+unsigned dis_add_service_dns( long dnsid, char *name, char *type, void *address, int size, 
+							 void (*user_routine)(), long tag)
+{
+	unsigned ret;
+#ifdef VxWorks
+	register SERVICE *servp;
+#endif
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_service_dns( name, type, address, size, user_routine, tag, dnsid);
+#ifdef VxWorks
+	servp = (SERVICE *)id_get_ptr(ret, SRC_DIS);
+	servp->tid = taskIdSelf();
+#endif
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+static unsigned do_dis_add_cmnd_dns( char *name, char *type, void (*user_routine)(), long tag, long dnsid )
+{
+	register SERVICE *new_serv;
+	register int service_id;
+	char str[512];
+	int dis_hash_service_insert();
+	DIS_DNS_CONN *dnsp;
+	extern DIS_DNS_CONN *dis_find_dns(long);
+
+	dis_init();
+	{
+	DISABLE_AST
+	if(!check_service_name(name))
+	{
+		strcpy(str,"Command name too long: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCTOOLG, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	if( find_service(name) )
+	{
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	new_serv = (SERVICE *)malloc(sizeof(SERVICE));
+	strncpy(new_serv->name, name, MAX_NAME);
+	if(type != (char *)0)
+	{
+		if( !get_format_data(new_serv->format_data, type))
+		{
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		strcpy(new_serv->def,type); 
+	}
+	else
+	{
+		new_serv->format_data[0].par_bytes = 0;
+		new_serv->def[0] = '\0';
+	}
+	new_serv->type = COMMAND;
+	new_serv->address = 0;
+	new_serv->size = 0;
+	if(user_routine)
+		new_serv->user_routine = user_routine;
+	else
+		new_serv->user_routine = std_cmnd_handler;
+	new_serv->tag = tag;
+	new_serv->tid = 0;
+	new_serv->registered = 0;
+	new_serv->quality = 0;
+	new_serv->user_secs = 0;
+	new_serv->delay_delete = 0;
+	new_serv->to_delete = 0;
+	service_id = id_get((void *)new_serv, SRC_DIS);
+	new_serv->id = service_id;
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = create_dns(dnsid);
+	new_serv->dnsp = dnsp;
+	new_serv->request_head = (REQUEST *)malloc(sizeof(REQUEST));
+	dll_init( (DLL *) (new_serv->request_head) );
+	dis_hash_service_insert(new_serv);
+/*
+	Dis_n_services++;
+*/
+	dnsp->dis_n_services++;
+	ENABLE_AST
+	}
+	return((unsigned) service_id);
+}
+
+static unsigned do_dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag)
+{
+	return do_dis_add_cmnd_dns(name, type, user_routine, tag, 0);
+}
+
+unsigned dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag ) 
+{
+	unsigned ret;
+
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_cmnd( name, type, user_routine, tag );
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+unsigned dis_add_cmnd_dns( long dnsid, char *name, char *type, void (*user_routine)(), long tag ) 
+{
+	unsigned ret;
+
+	/*
+	DISABLE_AST
+	*/
+	ret = do_dis_add_cmnd_dns( name, type, user_routine, tag, dnsid );
+	/*
+	ENABLE_AST
+	*/
+	return(ret);
+}
+
+void dis_add_client_exit_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Client_exit_user_routine = user_routine;
+	ENABLE_AST
+}
+
+void dis_add_exit_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Exit_user_routine = user_routine;
+	ENABLE_AST
+}
+
+void dis_add_error_handler( void (*user_routine)())
+{
+
+	DISABLE_AST
+	Error_user_routine = user_routine;
+	ENABLE_AST
+}
+
+static int get_format_data(FORMAT_STR *format_data, char *def)
+{
+	register char code, last_code = 0;
+	int num;
+
+	code = *def;
+	while(*def)
+	{
+		if(code != last_code)
+		{
+			format_data->par_num = 0;
+			format_data->flags = 0;
+			switch(code)
+			{
+				case 'i':
+				case 'I':
+				case 'l':
+				case 'L':
+					format_data->par_bytes = SIZEOF_LONG;
+					format_data->flags |= SWAPL;
+					break;
+				case 'x':
+				case 'X':
+					format_data->par_bytes = SIZEOF_DOUBLE;
+					format_data->flags |= SWAPD;
+					break;
+				case 's':
+				case 'S':
+					format_data->par_bytes = SIZEOF_SHORT;
+					format_data->flags |= SWAPS;
+					break;
+				case 'f':
+				case 'F':
+					format_data->par_bytes = SIZEOF_FLOAT;
+					format_data->flags |= SWAPL;
+#ifdef vms      	
+					format_data->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'd':
+				case 'D':
+					format_data->par_bytes = SIZEOF_DOUBLE;
+					format_data->flags |= SWAPD;
+#ifdef vms
+					format_data->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'c':
+				case 'C':
+					format_data->par_bytes = SIZEOF_CHAR;
+					format_data->flags |= NOSWAP;
+					break;
+			}
+		}
+		def++;
+		if(*def != ':')
+		{
+			if(*def)
+			{
+/*
+				printf("Bad service definition parsing\n");
+				fflush(stdout);
+
+				error_handler("Bad service definition parsing",2);
+*/
+				return(0);
+			}
+			else
+				format_data->par_num = 0;
+		}
+		else
+		{
+			def++;
+			sscanf(def,"%d",&num);
+			format_data->par_num += num;
+			while((*def != ';') && (*def != '\0'))
+				def++;
+			if(*def)
+				def++;
+		}
+		last_code = code;
+		code = *def;
+		if(code != last_code)
+			format_data++;
+	}
+	format_data->par_bytes = 0;
+	return(1);
+}
+
+void recv_dns_dis_rout( int conn_id, DNS_DIS_PACKET *packet, int size, int status )
+{
+	char str[128];
+	int dns_timr_time;
+	extern int rand_tmout(int, int);
+	extern int open_dns(long, void (*)(), void (*)(), int, int, int);
+	extern DIS_DNS_CONN *find_dns_by_conn_id(int);
+	extern void do_register_services(DIS_DNS_CONN *);
+	extern void do_dis_stop_serving_dns(DIS_DNS_CONN *);
+	DIS_DNS_CONN *dnsp;
+
+	if(size){}
+	dnsp = find_dns_by_conn_id(conn_id);
+	if(!dnsp)
+	{
+		return;
+	}
+	switch(status)
+	{
+	case STA_DISC:	   /* connection broken */
+		if( dnsp->dns_timr_ent ) {
+			dtq_rem_entry( Dis_timer_q, dnsp->dns_timr_ent );
+			dnsp->dns_timr_ent = NULL;
+		}
+
+		if(dnsp->dns_dis_conn_id > 0)
+			dna_close(dnsp->dns_dis_conn_id);
+		if(dnsp->serving)
+		{
+			dnsp->dns_dis_conn_id = open_dns(dnsp->dnsid, recv_dns_dis_rout, error_handler,
+					DIS_DNS_TMOUT_MIN, DIS_DNS_TMOUT_MAX, SRC_DIS );
+			if(dnsp->dns_dis_conn_id == -2)
+				error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		}
+		break;
+	case STA_CONN:		/* connection received */
+		if(dnsp->serving)
+		{
+			dnsp->dns_dis_conn_id = conn_id;
+			register_services(dnsp, ALL, 0);
+			dns_timr_time = rand_tmout(WATCHDOG_TMOUT_MIN, 
+							 WATCHDOG_TMOUT_MAX);
+			dnsp->dns_timr_ent = dtq_add_entry( Dis_timer_q,
+						  dns_timr_time,
+						  do_register_services, dnsp ); 
+		}
+		else
+		{
+			dna_close(conn_id);
+		}
+		break;
+	default :	   /* normal packet */
+		if(vtohl(packet->size) != DNS_DIS_HEADER)
+			break;
+		switch( vtohl(packet->type) )
+		{
+		case DNS_DIS_REGISTER :
+			sprintf(str, 
+				"%s: Watchdog Timeout, DNS requests registration",
+				dnsp->task_name);
+			error_handler(0, DIM_WARNING, DIMDNSTMOUT, str);
+			register_services(dnsp, ALL, 0);
+			break;
+		case DNS_DIS_KILL :
+			sprintf(str,
+				"%s: Some Services already known to DNS",
+				dnsp->task_name);
+			/*
+			exit(2);
+			*/
+			error_handler(0, DIM_FATAL, DIMDNSDUPLC, str);
+			do_dis_stop_serving_dns(dnsp);
+			dis_stop_serving();
+/*
+			exit_tag = 0;
+			exit_code = 2;
+			exit_size = sizeof(int);
+			exit_handler(&exit_tag, &exit_code, &exit_size);
+*/
+			break;
+		case DNS_DIS_STOP :
+			sprintf(str, 
+				"%s: DNS refuses connection",dnsp->task_name);
+/*
+			exit(2);
+*/
+			error_handler(0, DIM_FATAL, DIMDNSREFUS, str);
+			do_dis_stop_serving_dns(dnsp);
+			dis_stop_serving();
+/*
+			exit_tag = 0;
+			exit_code = 2;
+			exit_size = sizeof(int);
+			exit_handler(&exit_tag, &exit_code, &exit_size);
+*/
+			break;
+		case DNS_DIS_EXIT :
+			sprintf(str, 
+				"%s: DNS requests Exit",dnsp->task_name);
+			error_handler(0, DIM_FATAL, DIMDNSEXIT, str);
+			break;
+		}
+		break;
+	}
+}
+
+
+/* register services within the name server
+ *
+ * Send services uses the DNA package. services is a linked list of services
+ * stored by add_service.
+ */
+
+int send_dns_update_packet(DIS_DNS_CONN *dnsp)
+{
+  DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+  int n_services;
+  SERVICE_REG *serv_regp;
+
+  n_services = 1;
+  dis_dns_p->n_services = htovl(n_services);
+  dis_dns_p->size = htovl(DIS_DNS_HEADER +
+					n_services * sizeof(SERVICE_REG));
+  serv_regp = dis_dns_p->services;
+  strcpy( serv_regp->service_name, "DUMMY_UPDATE_PACKET" );
+  if(dnsp->dns_dis_conn_id > 0)
+  {
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Sending UpdatePacket to dns %d as %s@%s, %d services\n",
+	dnsp->dns_dis_conn_id,
+	(&(dnsp->dis_dns_packet))->task_name, (&(dnsp->dis_dns_packet))->node_name, n_services);
+}
+      if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
+		     DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))
+	  {
+		release_conn(dnsp->dns_dis_conn_id, 0, 1);
+	  }
+  }
+  return(1);
+}
+
+void do_register_services(DIS_DNS_CONN *dnsp)
+{
+	register_services(dnsp, NONE, 0);
+}
+
+void register_services(DIS_DNS_CONN *dnsp, int flag, int dns_flag)
+{
+	register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+	register int n_services, tot_n_services;
+	register SERVICE *servp;
+	register SERVICE_REG *serv_regp;
+	int hash_index, new_entries;
+	extern int get_node_addr();
+	int dis_hash_service_registered();
+
+	if(!dis_dns_p->src_type)
+	{
+		get_node_name( dis_dns_p->node_name );
+/*
+		strcpy( dis_dns_p->task_name, Task_name );
+*/
+		strncpy( dis_dns_p->task_name, dnsp->task_name,
+			MAX_TASK_NAME-4 );
+		dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
+		get_node_addr( dis_dns_p->node_addr );
+/*
+		dis_dns_p->port = htovl(Port_number);
+*/
+		dis_dns_p->pid = htovl(getpid());
+		dis_dns_p->protocol = htovl(Protocol);
+		dis_dns_p->src_type = htovl(SRC_DIS);
+		dis_dns_p->format = htovl(MY_FORMAT);
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Registering as %d %s@%s\n",
+	dis_dns_p->pid, dis_dns_p->task_name, dis_dns_p->node_name);
+}
+	
+	}
+
+	dis_dns_p->port = htovl(Port_number);
+	serv_regp = dis_dns_p->services;
+	n_services = 0;
+	tot_n_services = 0;
+	if( flag == NONE ) {
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl( DIS_DNS_HEADER + 
+			(n_services*sizeof(SERVICE_REG)));
+		if(dnsp->dns_dis_conn_id > 0)
+		{
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Sending NONE to dns %d as %s@%s, %d services\n",
+	dnsp->dns_dis_conn_id,
+	(&(dnsp->dis_dns_packet))->task_name, (&(dnsp->dis_dns_packet))->node_name, n_services);
+}
+			if(!dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 
+				DIS_DNS_HEADER + n_services*sizeof(SERVICE_REG)))
+			{
+				release_conn(dnsp->dns_dis_conn_id, 0, 1);
+			}
+		}
+		return;
+	}
+	if(flag == ALL)
+	{
+		servp = 0;
+		hash_index = -1;
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)))
+		{
+			if(servp->dnsp == dnsp)
+				servp->registered  = 0;
+		}
+	}
+	servp = 0;
+	hash_index = -1;
+	new_entries = 0;
+	if(flag == MORE)
+		new_entries = 1;
+	while( (servp = dis_hash_service_get_next(&hash_index, servp, new_entries)))
+	{
+		if( flag == MORE ) 
+		{
+			if( servp->registered )
+			{
+				continue;
+			}
+		}
+
+		if(servp->dnsp != dnsp)
+			continue;
+
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Registering %s\n",
+	servp->name);
+}
+		strcpy( serv_regp->service_name, servp->name );
+		strcpy( serv_regp->service_def, servp->def );
+		if(servp->type == COMMAND)
+			serv_regp->service_id = htovl( servp->id | 0x10000000);
+		else
+			serv_regp->service_id = htovl( servp->id );
+
+		serv_regp++;
+		n_services++;
+		dis_hash_service_registered(hash_index, servp);
+		if( n_services == MAX_SERVICE_UNIT )
+		{
+			dis_dns_p->n_services = htovl(n_services);
+			dis_dns_p->size = htovl(DIS_DNS_HEADER +
+				n_services * sizeof(SERVICE_REG));
+			if(dnsp->dns_dis_conn_id > 0)
+			{
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Sending MAX_SERVICE_UNIT to dns %d as %s@%s, %d services\n",
+	dnsp->dns_dis_conn_id,
+	(&(dnsp->dis_dns_packet))->task_name, (&(dnsp->dis_dns_packet))->node_name, n_services);
+}
+				if( !dna_write(dnsp->dns_dis_conn_id,
+					   &(dnsp->dis_dns_packet), 
+					   DIS_DNS_HEADER + n_services *
+						sizeof(SERVICE_REG)) )
+				{
+					release_conn(dnsp->dns_dis_conn_id, 0, 1);
+				}
+			}
+			serv_regp = dis_dns_p->services;
+			tot_n_services += MAX_SERVICE_UNIT;
+			n_services = 0;
+			continue;
+		}
+	}
+	if( n_services ) 
+	{
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl(DIS_DNS_HEADER +
+					n_services * sizeof(SERVICE_REG));
+		if(dnsp->dns_dis_conn_id > 0)
+		{
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Sending to dns %d as %s@%s, %d services\n",
+	dnsp->dns_dis_conn_id,
+	(&(dnsp->dis_dns_packet))->task_name, (&(dnsp->dis_dns_packet))->node_name, n_services);
+}
+			if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
+				DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))
+			{
+				release_conn(dnsp->dns_dis_conn_id, 0, 1);
+			}
+
+		}
+		tot_n_services += n_services;
+	}
+	if(!dns_flag)
+	{
+		if(tot_n_services >= MAX_REGISTRATION_UNIT)
+		{
+			send_dns_update_packet(dnsp);
+		}
+	}
+}
+
+void unregister_service(DIS_DNS_CONN *dnsp, SERVICE *servp)
+{
+	register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+	register int n_services;
+	register SERVICE_REG *serv_regp;
+	extern int get_node_addr();
+
+	if(dnsp->dns_dis_conn_id > 0)
+	{
+		if(!dis_dns_p->src_type)
+		{
+			get_node_name( dis_dns_p->node_name );
+/*
+			strcpy( dis_dns_p->task_name, Task_name );
+*/
+			strncpy( dis_dns_p->task_name, dnsp->task_name,
+				MAX_TASK_NAME-4 );
+			dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
+			get_node_addr( dis_dns_p->node_addr );
+			dis_dns_p->port = htovl(Port_number);
+			dis_dns_p->protocol = htovl(Protocol);
+			dis_dns_p->src_type = htovl(SRC_DIS);
+			dis_dns_p->format = htovl(MY_FORMAT);
+		}
+		serv_regp = dis_dns_p->services;
+		strcpy( serv_regp->service_name, servp->name );
+		strcpy( serv_regp->service_def, servp->def );
+		serv_regp->service_id = htovl( servp->id | 0x80000000);
+		serv_regp++;
+		n_services = 1;
+		servp->registered = 0;
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl(DIS_DNS_HEADER +
+				n_services * sizeof(SERVICE_REG));
+
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Sending UNREGISTER to dns %d as %s@%s, %d services\n",
+	dnsp->dns_dis_conn_id,
+	(&(dnsp->dis_dns_packet))->task_name, (&(dnsp->dis_dns_packet))->node_name, n_services);
+}
+		if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 
+			DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)) )
+		{
+			release_conn(dnsp->dns_dis_conn_id, 0, 1);
+		}
+		if(dnsp->dis_service_id)
+			dis_update_service(dnsp->dis_service_id);
+	}
+}
+
+void do_update_service_list(DIS_DNS_CONN *dnsp)
+{
+	dnsp->updating_service_list = 0;
+	dis_update_service(dnsp->dis_service_id);
+}
+
+/* start serving client requests
+ *
+ * Using the DNA package start accepting requests from clients.
+ * When a request arrives the routine "dis_insert_request" will be executed.
+ */
+
+int dis_start_serving(char *task)
+{
+	return dis_start_serving_dns(0, task);
+}
+
+static DIS_DNS_CONN *create_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = malloc(sizeof(DIS_DNS_CONN));
+	dnsp->dns_timr_ent = (TIMR_ENT *)0;
+	dnsp->dis_n_services = 0;
+	dnsp->dns_dis_conn_id = 0;
+	dnsp->dis_first_time = 1;
+	dnsp->serving = 0;
+	dnsp->dis_dns_packet.size = 0;
+	dnsp->dis_dns_packet.src_type = 0;
+	dnsp->dis_dns_packet.node_name[0] = 0;
+	dnsp->updating_service_list = 0;
+	dnsp->dnsid = dnsid;
+	dll_insert_queue( (DLL *) DNS_head, (DLL *) dnsp );
+	return dnsp;
+}
+
+void dis_dns_init()
+{
+	static int done = 0;
+	DIS_DNS_CONN *dnsp;
+	void dim_init_threads(void);
+
+	if(!done)
+	{
+		if(!Threads_off)
+		{
+			dim_init_threads();
+		}
+		{
+		DISABLE_AST
+		if(!DNS_head) 
+		{
+			DNS_head = (DIS_DNS_CONN *)malloc(sizeof(DIS_DNS_CONN));
+			dll_init( (DLL *) DNS_head );
+		}
+		dnsp = create_dns(0);
+		Default_DNS = dnsp;
+		done = 1;
+		ENABLE_AST
+		}
+	}
+}
+
+int dis_start_serving_dns(long dnsid, char *task/*, int *idlist*/)
+{
+	char str0[MAX_NAME], str1[MAX_NAME],str2[MAX_NAME],
+	  str3[MAX_NAME],str4[MAX_NAME];
+	char task_name_aux[MAX_TASK_NAME];
+	extern int open_dns();
+	extern DIS_DNS_CONN *dis_find_dns(long);
+	DIS_DNS_CONN *dnsp;
+	int more_ids[10] = {0};
+
+	dis_init();
+	{
+	DISABLE_AST
+	  /*
+#ifdef VxWorks
+	taskDeleteHookAdd(remove_all_services);
+	printf("Adding delete hook\n");
+#endif
+*/
+
+	if(!Client_head) 
+	{
+		Client_head = (CLIENT *)malloc(sizeof(CLIENT));
+		dll_init( (DLL *) Client_head );
+	}
+	if(dnsid == 0)
+	{
+		dnsp = Default_DNS;
+	}
+	else if(!(dnsp = dis_find_dns(dnsid)))
+	{
+		dnsp = create_dns(dnsid);
+	}
+	dnsp->serving = 1;
+	Serving = 1;
+	if(Dis_first_time)
+	{
+		strncpy( task_name_aux, task, MAX_TASK_NAME );
+		task_name_aux[MAX_TASK_NAME-1] = '\0';
+		Port_number = SEEK_PORT;
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Opening Server Connection %s\n",task_name_aux);
+}
+		if( !(Dis_conn_id = dna_open_server( task_name_aux, dis_insert_request, 
+			&Protocol, &Port_number, error_handler) ))
+		{
+			ENABLE_AST
+			return(0);
+		}
+		Dis_first_time = 0;
+	}
+	if(dnsp->dis_first_time)
+	{
+		dnsp->dis_first_time = 0;
+
+		sprintf(str0, "%s/VERSION_NUMBER", task);
+		sprintf(str1, "%s/CLIENT_LIST", task);
+		sprintf(str2, "%s/SERVICE_LIST", task);
+		sprintf(str3, "%s/SET_EXIT_HANDLER", task);
+		sprintf(str4, "%s/EXIT", task);
+
+		more_ids[0] = do_dis_add_service_dns( str0, "L", &Version_number,
+				 sizeof(Version_number), 0, 0, dnsid );
+
+		more_ids[1] = do_dis_add_service_dns( str1, "C", 0, 0, client_info, (long)dnsp, dnsid );
+		dnsp->dis_client_id = more_ids[1];
+		more_ids[2] = do_dis_add_service_dns( str2, "C", 0, 0, service_info, (long)dnsp, dnsid );
+		dnsp->dis_service_id = more_ids[2];
+		more_ids[3] = do_dis_add_cmnd_dns( str3, "L:1", add_exit_handler, 0, dnsid );
+		more_ids[4] = do_dis_add_cmnd_dns( str4, "L:1", exit_handler, 0, dnsid );
+		more_ids[5] = 0;
+		strcpy( dnsp->task_name, task );
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("start serving %s\n",task);
+}
+	}
+/*
+	if(idlist)
+	{
+		for(i = 0; idlist[i]; i++)
+		{
+			servp = (SERVICE *)id_get_ptr(idlist[i], SRC_DIS);
+			if(servp)
+			{
+				servp->dnsp = dnsp;
+				n_services++;
+			}
+		}
+	}
+	if(dnsp != Default_DNS)
+	{
+		for(i = 0; more_ids[i]; i++)
+		{
+			servp = (SERVICE *)id_get_ptr(more_ids[i], SRC_DIS);
+			if(servp)
+			{
+				servp->dnsp = dnsp;
+				n_services++;
+			}
+		}
+		dnsp->dis_n_services += n_services;
+		Dis_n_services -= n_services;
+	}
+*/
+	if(!Dis_timer_q)
+		Dis_timer_q = dtq_create();
+	if( !dnsp->dns_dis_conn_id )
+	{
+		if(!strcmp(task,"DIS_DNS"))
+		{
+			register_services(dnsp, ALL, 1);
+			ENABLE_AST
+			return(id_get(&(dnsp->dis_dns_packet), SRC_DIS));
+		}
+		else
+		{
+		
+			dnsp->dns_dis_conn_id = open_dns(dnsid, recv_dns_dis_rout, error_handler,
+					DIS_DNS_TMOUT_MIN, DIS_DNS_TMOUT_MAX, SRC_DIS );
+			if(dnsp->dns_dis_conn_id == -2)
+				error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		}
+	}
+	else
+	{
+		register_services(dnsp, MORE, 0);
+		if(dnsp->dis_service_id)
+		{
+/*
+			dis_update_service(Dis_service_id);
+*/
+			if(!dnsp->updating_service_list)
+			{
+				dtq_start_timer(1, do_update_service_list, dnsp);
+				dnsp->updating_service_list = 1;
+			}
+		}
+	}
+	ENABLE_AST
+	}
+	return(1);
+}
+
+
+/* asynchrounous reception of requests */
+/*
+	Called by DNA package.
+	A request has arrived, queue it to process later - dis_ins_request
+*/
+static void dis_insert_request(int conn_id, DIC_PACKET *dic_packet, int size, int status)
+{
+	register SERVICE *servp;
+	register REQUEST *newp, *reqp;
+	CLIENT *clip, *create_client();
+	REQUEST_PTR *reqpp;
+	int type, new_client = 0, found = 0;
+	int find_release_request();
+	DIS_DNS_CONN *dnsp;
+
+	if(size){}
+	/* status = 1 => new connection, status = -1 => conn. lost */
+	if(!Client_head) 
+	{
+		Client_head = (CLIENT *)malloc(sizeof(CLIENT));
+		dll_init( (DLL *) Client_head );
+	}
+	if(status != 0)
+	{
+		if(status == -1) /* release all requests from conn_id */
+		{
+if(Debug_on)
+{
+dim_print_date_time();
+printf("Received Disconnection %d, from %s@%s\n",
+	   conn_id, 
+	   Net_conns[conn_id].task, Net_conns[conn_id].node);
+}
+			release_conn(conn_id, 0, 0);
+		}
+		else
+		{
+if(Debug_on)
+{
+dim_print_date_time();
+printf("Received Connection %d, from %s@%s\n",
+	   conn_id, 
+	   Net_conns[conn_id].task, Net_conns[conn_id].node);
+}
+		}  
+	} 
+	else 
+	{
+if(Debug_on)
+{
+dim_print_date_time();
+printf("Received Request for %s, from %d  %s@%s\n",
+	   dic_packet->service_name, conn_id, 
+	   Net_conns[conn_id].task, Net_conns[conn_id].node);
+}
+		if(!(servp = find_service(dic_packet->service_name)))
+		{
+			release_conn(conn_id, 0, 0);
+			return;
+		}
+		dic_packet->type = vtohl(dic_packet->type);
+		type = dic_packet->type & 0xFFF;
+		/*
+		if(type == COMMAND) 
+		{
+			Curr_conn_id = conn_id;
+			execute_command(servp, dic_packet);
+			Curr_conn_id = 0;
+			return;
+		}
+		*/
+		if(type == DIM_DELETE) 
+		{
+			find_release_request(conn_id, vtohl(dic_packet->service_id));
+			return;
+		}
+		newp = (REQUEST *)/*my_*/malloc(sizeof(REQUEST));
+		newp->service_ptr = servp;
+		newp->service_id = vtohl(dic_packet->service_id);
+		newp->type = dic_packet->type;
+		newp->timeout = vtohl(dic_packet->timeout);
+		newp->format = vtohl(dic_packet->format);
+		newp->conn_id = conn_id;
+		newp->first_time = 1;
+		newp->delay_delete = 0;
+		newp->to_delete = 0;
+		newp->timr_ent = 0;
+		newp->req_id = id_get((void *)newp, SRC_DIS);
+		newp->reqpp = 0;
+		if(type == ONCE_ONLY) 
+		{
+			execute_service(newp->req_id);
+			id_free(newp->req_id, SRC_DIS);
+			free(newp);
+			clip = create_client(conn_id, servp, &new_client);
+			return;
+		}
+		if(type == COMMAND) 
+		{
+			Curr_conn_id = conn_id;
+			execute_command(servp, dic_packet);
+			Curr_conn_id = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) ) 
+			{
+				if(reqp->conn_id == conn_id)
+				{
+					id_free(newp->req_id, SRC_DIS);
+					free(newp);
+					found = 1;
+					break;
+				}
+			}
+			if(!found)
+				dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
+			clip = create_client(conn_id, servp, &new_client);
+			return;
+		}
+		dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
+		clip = create_client(conn_id, servp, &new_client);
+		reqpp = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
+		reqpp->reqp = newp;
+		dll_insert_queue( (DLL *) clip->requestp_head, (DLL *) reqpp );
+		newp->reqpp = reqpp;
+		if((type != MONIT_ONLY) && (type != UPDATE))
+		{
+			execute_service(newp->req_id);
+		}
+		if((type != MONIT_ONLY) && (type != MONIT_FIRST))
+		{
+			if(newp->timeout != 0)
+			{
+				newp->timr_ent = dtq_add_entry( Dis_timer_q,
+							newp->timeout, 
+							execute_service,
+							newp->req_id );
+			}
+		}
+		if(new_client)
+		{
+			Last_client = conn_id;
+			dnsp = clip->dnsp;
+			if(dnsp->dis_client_id)
+			  dis_update_service(dnsp->dis_client_id);
+		}
+	}
+}
+
+/* A timeout for a timed or monitored service occured, serve it. */
+
+int execute_service( int req_id )
+{
+	int *buffp, size;
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	char str[80], def[MAX_NAME];
+	register char *ptr;
+	int last_conn_id;
+	int *pkt_buffer, header_size, aux;
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+	FORMAT_STR format_data_cp[MAX_NAME/4];
+
+	reqp = (REQUEST *)id_get_ptr(req_id, SRC_DIS);
+	if(!reqp)
+		return(0);
+	if(reqp->to_delete)
+		return(0);
+	reqp->delay_delete++;
+	servp = reqp->service_ptr;
+	last_conn_id = Curr_conn_id;
+	Curr_conn_id = reqp->conn_id;
+	ptr = servp->def;
+	if(servp->type == COMMAND)
+	{
+		sprintf(str,"This is a COMMAND Service");
+		buffp = (int *)str;
+		size = 26;
+		sprintf(def,"c:26");
+		ptr = def;
+	}
+	else if( servp->user_routine != 0 ) 
+	{
+		(servp->user_routine)( &servp->tag, &buffp, &size,
+					&reqp->first_time );
+		reqp->first_time = 0;
+		
+	} 
+	else 
+	{
+		buffp = servp->address;
+		size = servp->size;
+	}
+	Curr_conn_id = last_conn_id;
+/* send even if no data but not if negative */
+	if( size  < 0)
+	{
+		reqp->delay_delete--;
+		return(0);
+	}
+	if( DIS_STAMPED_HEADER + size > Dis_packet_size ) 
+	{
+		if( Dis_packet_size )
+			free( Dis_packet );
+		Dis_packet = (DIS_STAMPED_PACKET *)malloc(DIS_STAMPED_HEADER + size);
+		if(!Dis_packet)
+		{
+			reqp->delay_delete--;
+			return(0);
+		}
+		Dis_packet_size = DIS_STAMPED_HEADER + size;
+	}
+	Dis_packet->service_id = htovl(reqp->service_id);
+	if((reqp->type & 0xFF000) == STAMPED)
+	{
+		pkt_buffer = ((DIS_STAMPED_PACKET *)Dis_packet)->buffer;
+		header_size = DIS_STAMPED_HEADER;
+		if(!servp->user_secs)
+		{
+#ifdef WIN32
+			ftime(&timebuf);
+			aux = timebuf.millitm;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl((int)timebuf.time);
+#else
+			tz = 0;
+		        gettimeofday(&tv, tz);
+			aux = tv.tv_usec / 1000;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl(tv.tv_sec);
+#endif
+		}
+		else
+		{
+			aux = /*0xc0de0000 |*/ servp->user_millisecs;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl(servp->user_secs);
+		}
+		Dis_packet->reserved[0] = htovl(0xc0dec0de);
+		Dis_packet->quality = htovl(servp->quality);
+	}
+	else
+	{
+		pkt_buffer = ((DIS_PACKET *)Dis_packet)->buffer;
+		header_size = DIS_HEADER;
+	}
+	memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+	size = copy_swap_buffer_out(reqp->format, format_data_cp, 
+		pkt_buffer,
+		buffp, size);
+	Dis_packet->size = htovl(header_size + size);
+	if( !dna_write_nowait(reqp->conn_id, Dis_packet, header_size + size) ) 
+	{
+		reqp->to_delete = 1;
+	}
+/*
+	else
+	{
+		if((reqp->type & 0xFFF) == MONITORED)
+		{
+			if(reqp->timr_ent)
+				dtq_clear_entry(reqp->timr_ent);
+		}
+	}
+*/
+	reqp->delay_delete--;
+	return(1);
+}
+
+void remove_service( int req_id )
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	static DIS_PACKET *dis_packet;
+	static int packet_size = 0;
+	int service_id;
+
+	reqp = (REQUEST *)id_get_ptr(req_id, SRC_DIS);
+	if(!reqp)
+		return;
+	servp = reqp->service_ptr;
+	if( !packet_size ) {
+		dis_packet = (DIS_PACKET *)malloc(DIS_HEADER);
+		packet_size = DIS_HEADER;
+	}
+	service_id = (reqp->service_id | 0x80000000);
+	dis_packet->service_id = htovl(service_id);
+	dis_packet->size = htovl(DIS_HEADER);
+	if( !dna_write(reqp->conn_id, dis_packet, DIS_HEADER) ) 
+	{
+		release_conn(reqp->conn_id, 0, 0);
+	}
+}
+
+void execute_command(SERVICE *servp, DIC_PACKET *packet)
+{
+	int size;
+	int format;
+	FORMAT_STR format_data_cp[MAX_NAME/4], *formatp;
+	static int *buffer;
+	static int buffer_size = 0;
+	int add_size;
+
+	size = vtohl(packet->size) - DIC_HEADER;
+	add_size = size + (size/2);
+	if(!buffer_size)
+	{
+		buffer = (int *)malloc(add_size);
+		buffer_size = add_size;
+	} 
+	else 
+	{
+		if( add_size > buffer_size ) 
+		{
+			free(buffer);
+			buffer = (int *)malloc(add_size);
+			buffer_size = add_size;
+		}
+	}
+
+	dis_set_timestamp(servp->id, 0, 0);
+	if(servp->user_routine != 0)
+	{
+		format = vtohl(packet->format);
+		memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+		if((format & 0xF) == ((MY_FORMAT) & 0xF)) 
+		{
+			for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			{
+				if(formatp->flags & IT_IS_FLOAT)
+					formatp->flags |= (format & 0xf0);
+				formatp->flags &= 0xFFF0;	/* NOSWAP */
+			}
+		}
+		else
+		{
+			for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			{
+				if(formatp->flags & IT_IS_FLOAT)
+					formatp->flags |= (format & 0xf0);
+			}
+		}
+		size = copy_swap_buffer_in(format_data_cp, 
+						 buffer, 
+						 packet->buffer, size);
+		(servp->user_routine)(&servp->tag, buffer, &size);
+	}
+}
+
+void dis_report_service(char *serv_name)
+{
+	register SERVICE *servp;
+	register REQUEST *reqp;
+	int to_delete = 0, more;
+
+	
+	DISABLE_AST
+	servp = find_service(serv_name);
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) )
+	{
+		if((reqp->type & 0xFFF) != TIMED_ONLY)
+		{
+			execute_service(reqp->req_id);
+			if(reqp->to_delete)
+				to_delete = 1;
+		}
+	}
+	if(to_delete)
+	{
+		do
+		{
+			more = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) )
+			{
+				if(reqp->to_delete)
+				{
+					more = 1;
+					release_conn(reqp->conn_id, 1, 0);
+					break;
+				}
+			}
+		}while(more);
+	}
+	ENABLE_AST
+}
+
+int dis_update_service(unsigned service_id)
+{
+int do_update_service();
+
+	return(do_update_service(service_id,0));
+}
+
+int dis_selective_update_service(unsigned service_id, int *client_ids)
+{
+int do_update_service();
+
+	return(do_update_service(service_id, client_ids));
+}
+
+int check_client(REQUEST *reqp, int *client_ids)
+{
+	if(!client_ids)
+		return(1);
+	while(*client_ids)
+	{
+		if(reqp->conn_id == *client_ids)
+		{
+			return(1);
+		}
+		client_ids++;
+	}
+	return(0);
+}
+
+int do_update_service(unsigned service_id, int *client_ids)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	REQUEST_PTR *reqpp;
+	CLIENT *clip;
+	register int found = 0;
+	int to_delete = 0, more, conn_id;
+	char str[128];
+	int release_request();
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str, "Update Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	servp->delay_delete = 1;
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+if(Debug_on)
+{
+dim_print_date_time();
+printf("Updating %s (id = %d, ptr = %08lX) for %s@%s (req_id = %d, req_ptr = %08lX)\n",
+	   servp->name, (int)service_id, (unsigned long)servp, 
+	   Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned long)reqp);
+}
+		if(check_client(reqp, client_ids))
+			reqp->delay_delete = 1;
+	}
+	ENABLE_AST
+	{
+	DISABLE_AST
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(reqp->delay_delete && ((reqp->type & 0xFFF) != COMMAND))
+		{
+		if(check_client(reqp, client_ids))
+		{
+			if( (reqp->type & 0xFFF) != TIMED_ONLY ) 
+			{
+/*
+				DISABLE_AST
+*/
+				execute_service(reqp->req_id);
+				found++;
+				ENABLE_AST
+				{
+				DISABLE_AST
+				}
+			}
+		}
+		}
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(check_client(reqp, client_ids))
+		{
+			reqp->delay_delete = 0;
+			if(reqp->to_delete)
+				to_delete = 1;
+		}
+	}
+	ENABLE_AST
+	}
+	if(to_delete)
+	{
+		DISABLE_AST
+		do
+		{
+			more = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) ) 
+			{
+				if(reqp->to_delete & 0x1)
+				{
+					more = 1;
+					reqp->to_delete = 0;
+					release_conn(reqp->conn_id, 1, 0);
+					break;
+				}
+				else if(reqp->to_delete & 0x2)
+				{
+					more = 1;
+					reqp->to_delete = 0;
+					reqpp = reqp->reqpp;
+					conn_id = reqp->conn_id;
+					release_request(reqp, reqpp, 1);
+					clip = find_client(conn_id);
+					if(clip)
+					{
+						if( dll_empty((DLL *)clip->requestp_head) ) 
+						{
+							release_conn( conn_id, 0, 0);
+						}
+					}
+					break;
+				}
+			}
+		}while(more);
+		ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	servp->delay_delete = 0;
+	if(servp->to_delete)
+	{
+		dis_remove_service(servp->id);
+	}
+	ENABLE_AST
+	}
+
+	return(found);
+}
+
+int dis_get_n_clients(unsigned service_id)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	register int found = 0;
+	char str[128];
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str, "Service Has Clients- Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		found++;
+	}
+	ENABLE_AST
+	return found;
+}
+
+int dis_get_timeout(unsigned service_id, int client_id)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	char str[128];
+
+	if(!service_id)
+	{
+		sprintf(str,"Get Timeout - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		return(-1);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		return(-1);
+	}
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(reqp->conn_id == client_id)
+			return(reqp->timeout);
+	}
+	return(-1);
+}
+
+void dis_set_quality( unsigned serv_id, int quality )
+{
+	register SERVICE *servp;
+	char str[128];
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Set Quality - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return;
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return;
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return;
+	}
+	servp->quality = quality;
+	ENABLE_AST
+}
+
+int dis_set_timestamp( unsigned serv_id, int secs, int millisecs )
+{
+	register SERVICE *servp;
+	char str[128];
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Set Timestamp - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return(0);
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(secs == 0)
+	{
+#ifdef WIN32
+			ftime(&timebuf);
+			servp->user_secs = (int)timebuf.time;
+			servp->user_millisecs = timebuf.millitm;
+#else
+			tz = 0;
+		    gettimeofday(&tv, tz);
+			servp->user_secs = tv.tv_sec;
+			servp->user_millisecs = tv.tv_usec / 1000;
+#endif
+	}
+	else
+	{
+		servp->user_secs = secs;
+/*
+		servp->user_millisecs = (millisecs & 0xffff);
+*/
+		servp->user_millisecs = millisecs;
+	}
+	ENABLE_AST
+	return(1);
+}
+
+int dis_get_timestamp( unsigned serv_id, int *secs, int *millisecs )
+{
+	register SERVICE *servp;
+	char str[128];
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Get Timestamp - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return(0);
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->user_secs)
+	{
+		*secs = servp->user_secs;
+		*millisecs = servp->user_millisecs;
+	}
+	else
+	{
+		*secs = 0;
+		*millisecs = 0;
+	}
+	ENABLE_AST
+	return(1);
+}
+
+void dis_send_service(unsigned service_id, int *buffer, int size)
+{
+	register REQUEST *reqp, *prevp;
+	register SERVICE *servp;
+	static DIS_PACKET *dis_packet;
+	static int packet_size = 0;
+	int conn_id;
+	char str[128];
+
+	DISABLE_AST
+	if( !service_id ) {
+		sprintf(str,"Send Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return;
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return;
+	}
+	if(!packet_size)
+	{
+		dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
+		packet_size = DIS_HEADER + size;
+	} 
+	else 
+	{
+		if( DIS_HEADER+size > packet_size ) 
+		{
+			free(dis_packet);
+			dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
+			packet_size = DIS_HEADER+size;
+		}
+	}
+	prevp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) prevp)) ) 
+	{
+		dis_packet->service_id = htovl(reqp->service_id);
+		memcpy(dis_packet->buffer, buffer, size);
+		dis_packet->size = htovl(DIS_HEADER + size);
+
+		conn_id = reqp->conn_id;
+		if( !dna_write_nowait(conn_id, dis_packet, size + DIS_HEADER) )
+		{
+			release_conn(conn_id, 1, 0);
+		}
+		else
+			prevp = reqp;
+	}
+	ENABLE_AST
+}
+
+int dis_remove_service(unsigned service_id)
+{
+	register REQUEST *reqp, *auxp;
+	register SERVICE *servp;
+	REQUEST_PTR *reqpp;
+	int found = 0;
+	char str[128];
+	int release_request();
+	int dis_hash_service_remove();
+	DIS_DNS_CONN *dnsp;
+	int n_services;
+	void do_dis_stop_serving_dns(DIS_DNS_CONN *);
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str,"Remove Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+if(Debug_on)
+{
+dim_print_date_time();
+ printf("Removing service %s, delay_delete = %d\n",
+	servp->name, servp->delay_delete);
+}
+	if(servp->delay_delete)
+	{
+		servp->to_delete = 1;
+		ENABLE_AST
+		return(found);
+	}
+	/* remove from name server */
+	
+	dnsp = servp->dnsp;
+	unregister_service(dnsp, servp);
+	/* Release client requests and remove from actual clients */
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) )
+	{
+		remove_service(reqp->req_id);
+		auxp = reqp->prev;
+		reqpp = (REQUEST_PTR *) reqp->reqpp;
+		release_request(reqp, reqpp, 1);
+		found = 1;
+		reqp = auxp;
+	}
+	if(servp->id == (int)dnsp->dis_service_id)
+	  dnsp->dis_service_id = 0;
+	if(servp->id == (int)dnsp->dis_client_id)
+	  dnsp->dis_client_id = 0;
+	dis_hash_service_remove(servp);
+	id_free(servp->id, SRC_DIS);
+	free(servp->request_head);
+	free(servp);
+/*
+	if(dnsp != Default_DNS)
+	{
+		dnsp->dis_n_services--;
+		n_services = dnsp->dis_n_services;
+	}
+	else
+	{
+		Dis_n_services--;
+		n_services = Dis_n_services;
+	}
+*/
+	dnsp->dis_n_services--;
+	n_services = dnsp->dis_n_services;
+
+	ENABLE_AST
+	if(dnsp->serving)
+	{
+		if(n_services == 5)
+		{
+/*
+			dis_stop_serving();
+*/
+			do_dis_stop_serving_dns(dnsp);
+		}
+	}
+	return(found);
+}
+
+void do_dis_stop_serving_dns(DIS_DNS_CONN *dnsp)
+{
+register SERVICE *servp, *prevp;
+void dim_stop_threads(void);
+int dis_no_dns();
+int hash_index, old_index;
+extern int close_dns(long, int);
+CLIENT *clip, *cprevp;
+
+	dnsp->serving = 0;
+	dis_init();
+/*
+	dis_hash_service_init();
+	prevp = 0;
+	if(Dis_conn_id)
+	{
+		dna_close(Dis_conn_id);
+		Dis_conn_id = 0;
+	}
+*/
+	{
+	DISABLE_AST
+	if(dnsp->dns_timr_ent)
+	{
+		dtq_rem_entry(Dis_timer_q, dnsp->dns_timr_ent);
+		dnsp->dns_timr_ent = NULL;
+	}
+	if(dnsp->dns_dis_conn_id)
+	{
+		dna_close(dnsp->dns_dis_conn_id);
+		dnsp->dns_dis_conn_id = 0;
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	prevp = 0;
+	hash_index = -1;
+	old_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, prevp, 0)) )
+	{
+		if(servp->dnsp == dnsp)
+		{
+			ENABLE_AST
+			dis_remove_service(servp->id);
+			{
+			DISABLE_AST
+			if(old_index != hash_index)
+				prevp = 0;
+			}
+		}
+		else
+		{
+			prevp = servp;
+			old_index = hash_index;
+		}
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	cprevp = Client_head;
+	while( (clip = (CLIENT *)dll_get_next( (DLL *) Client_head, 
+			(DLL*) cprevp)) )
+	{
+		if(clip->dnsp != dnsp)
+		{
+			cprevp = clip;
+			continue;
+		}
+		if( dll_empty((DLL *)clip->requestp_head) ) 
+		{
+if(Debug_on)
+{
+dim_print_date_time();
+printf("Releasing conn %d, to %s@%s\n",
+	   clip->conn_id, 
+	   Net_conns[clip->conn_id].task, Net_conns[clip->conn_id].node);
+}
+			release_conn( clip->conn_id, 0, 0);
+		}
+		else
+		{
+			cprevp = clip;
+		}
+	}
+	ENABLE_AST
+	}
+if(Debug_on)
+{
+dim_print_date_time();
+printf("Cleaning dnsp variables\n");
+}
+
+	dnsp->dis_first_time = 1;
+	dnsp->dis_n_services = 0;
+	dnsp->dis_dns_packet.size = 0;
+	dnsp->dis_dns_packet.src_type = 0;
+	close_dns(dnsp->dnsid, SRC_DIS);
+/*
+	if(dnsp != Default_DNS)
+	{
+		dll_remove(dnsp);
+		free(dnsp);
+	}
+*/
+/*
+	if(dll_empty(DNS_head))
+*/
+	if(dis_no_dns())
+		dis_stop_serving();
+}
+
+void dis_stop_serving_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp, *dis_find_dns();
+
+	dnsp = dis_find_dns(dnsid);
+	do_dis_stop_serving_dns(dnsp);
+}
+
+void dis_stop_serving()
+{
+register SERVICE *servp, *prevp;
+void dim_stop_threads(void);
+int hash_index;
+
+	Serving = 0;
+	dis_init();
+	if(Dis_conn_id)
+	{
+		dna_close(Dis_conn_id);
+		Dis_conn_id = 0;
+	}
+/*
+	if(Dns_dis_conn_id)
+	{
+		dna_close(Dns_dis_conn_id);
+		Dns_dis_conn_id = 0;
+	}
+*/
+	{
+	DISABLE_AST
+	prevp = 0;
+	hash_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, prevp, 0)) )
+	{
+		ENABLE_AST
+		dis_remove_service(servp->id);
+		{
+		DISABLE_AST
+		prevp = 0;
+		}
+	}
+	ENABLE_AST
+	}
+/*
+	if(Dis_conn_id)
+		dna_close(Dis_conn_id);
+	if(Dns_dis_conn_id)
+		dna_close(Dns_dis_conn_id);
+	Dns_dis_conn_id = 0;
+*/
+	Dis_first_time = 1;
+/*
+	if(Dns_timr_ent)
+	{
+		dtq_rem_entry(Dis_timer_q, Dns_timr_ent);
+		Dns_timr_ent = NULL;
+	}
+*/
+	dtq_delete(Dis_timer_q);
+	Dis_timer_q = 0;
+	dim_stop_threads();
+}
+
+/* find service by name */
+SERVICE *find_service(char *name)
+{
+	return(dis_hash_service_exists(name));
+}
+
+CLIENT *create_client(int conn_id, SERVICE *servp, int *new_client)
+{
+	CLIENT *clip;
+
+	*new_client = 0;
+	if(!(clip = find_client(conn_id)))
+	{
+		clip = (CLIENT *)malloc(sizeof(CLIENT));
+		clip->conn_id = conn_id;
+		clip->dnsp = servp->dnsp;
+		clip->requestp_head = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
+		dll_init( (DLL *) clip->requestp_head );
+		dll_insert_queue( (DLL *) Client_head, (DLL *) clip );
+		*new_client = 1;
+	}
+	return clip;
+}
+
+CLIENT *find_client(int conn_id)
+{
+	register CLIENT *clip;
+
+	clip = (CLIENT *)
+			dll_search( (DLL *) Client_head, &conn_id, sizeof(conn_id));
+	return(clip);
+}
+
+void release_all_requests(int conn_id, CLIENT *clip)
+{
+	register REQUEST_PTR *reqpp, *auxp;
+	register REQUEST *reqp;
+    int found = 0;
+	int release_request();
+	DIS_DNS_CONN *dnsp;
+
+	DISABLE_AST;
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			auxp = reqpp->prev;
+			reqp = (REQUEST *) reqpp->reqp;
+			release_request(reqp, reqpp, 0);
+			found = 1;
+			reqpp = auxp;
+		}
+		dnsp = clip->dnsp;
+		dll_remove(clip);
+		free(clip->requestp_head);
+		free(clip);
+	}
+	if(found)
+	{
+		Last_client = -conn_id;
+		if(dnsp->dis_client_id)
+		  dis_update_service(dnsp->dis_client_id);
+	}
+	dna_close(conn_id);
+	ENABLE_AST;
+}
+
+CLIENT *check_delay_delete(int conn_id)
+{
+	register REQUEST_PTR *reqpp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	int found = 0;
+
+	DISABLE_AST;
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			if(reqp->delay_delete)
+			{
+				reqp->to_delete = 1;
+				found = 1;
+			}
+		}
+	}
+	ENABLE_AST;
+	if(found)
+	{
+		return((CLIENT *)-1);
+	}
+	return(clip);
+}
+
+char *dis_get_error_services()
+{
+	return(dis_get_client_services(Error_conn_id));
+}
+
+char *dis_get_client_services(int conn_id)
+{
+	register REQUEST_PTR *reqpp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	register SERVICE *servp;
+
+	int n_services = 0;
+	int max_size;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+
+
+	if(!conn_id)
+		return((char *)0);
+	{
+	DISABLE_AST;
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)))
+		{
+			n_services++;
+		}
+		if(!n_services)
+		{
+			ENABLE_AST
+			return((char *)0);
+		}
+		max_size = n_services * MAX_NAME;
+		if(!curr_allocated_size)
+		{
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		else if (max_size > curr_allocated_size)
+		{
+			free(service_info_buffer);
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		service_info_buffer[0] = '\0';
+		buff_ptr = service_info_buffer;
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			servp = reqp->service_ptr;
+			strcat(buff_ptr, servp->name);
+			strcat(buff_ptr, "\n");
+			buff_ptr += strlen(buff_ptr);
+		}
+	}
+	else
+	{
+		ENABLE_AST
+		return((char *)0);
+	}
+	ENABLE_AST;
+	}
+/*
+	dim_print_date_time();
+	dna_get_node_task(conn_id, node, task);
+	printf("Client %s@%s uses services: \n", task, node);
+	printf("%s\n",service_info_buffer);
+*/
+	return(service_info_buffer);
+}
+
+int find_release_request(int conn_id, int service_id)
+{
+	register REQUEST_PTR *reqpp, *auxp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	int release_request();
+
+	DISABLE_AST
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			if(reqp->service_id == service_id)
+			{
+				if(reqp->delay_delete)
+				{
+					reqp->to_delete += 0x2;
+				}
+				else
+				{
+					auxp = reqpp->prev;
+					release_request(reqp, reqpp, 0);
+					reqpp = auxp;
+				}
+			}
+		}
+		if( dll_empty((DLL *)clip->requestp_head) ) 
+		{
+			release_conn( conn_id, 0, 0 );
+		}
+	}
+	ENABLE_AST
+	return(1);
+}
+
+int release_request(REQUEST *reqp, REQUEST_PTR *reqpp, int remove)
+{
+	int conn_id;
+	CLIENT *clip;
+
+	DISABLE_AST
+	conn_id = reqp->conn_id;
+	if(reqpp)
+		dll_remove((DLL *)reqpp);
+	dll_remove((DLL *)reqp);
+	if(reqp->timr_ent)
+		dtq_rem_entry(Dis_timer_q, reqp->timr_ent);
+	id_free(reqp->req_id, SRC_DIS);
+	free(reqp);
+	if(reqpp)
+		free(reqpp);
+/* Would do it too early, the client will disconnect anyway
+*/
+	if((remove) && (!Serving))
+	{
+		clip = find_client(conn_id);
+		if(clip)
+		{
+			if( dll_empty((DLL *)clip->requestp_head) ) 
+			{
+				release_conn( conn_id, 0, 0);
+			}
+		}
+	}
+
+	ENABLE_AST
+	return(1);
+}
+
+static int release_conn(int conn_id, int print_flg, int dns_flag)
+{
+	static int releasing = 0;
+	CLIENT *clip;
+	int do_exit_handler();
+
+	DISABLE_AST
+	if(print_flg){}
+	if(dns_flag)
+	{
+		recv_dns_dis_rout( conn_id, 0, 0, STA_DISC );
+		ENABLE_AST
+		return(0);
+	}
+#ifdef VMS
+	if(print_flg)
+	{
+		dim_print_date_time();
+		dna_get_node_task(conn_id, node, task);
+		printf(" Couldn't write to client %s@%s, releasing connection %d\n",
+			task, node, conn_id);
+		fflush(stdout);
+	}
+#endif
+	clip = check_delay_delete(conn_id);
+	if(clip != (CLIENT *)-1)
+	{
+		if( Client_exit_user_routine != 0 ) 
+		{
+			releasing++;
+			Curr_conn_id = conn_id;
+			do_exit_handler(conn_id);
+			releasing--;
+		}
+		if(!releasing)
+		{
+			release_all_requests(conn_id, clip);
+		}
+	}
+	ENABLE_AST
+	return(1);
+}
+
+typedef struct cmnds{
+	struct cmnds *next;
+	long tag;
+	int size;
+	int buffer[1];
+} DIS_CMND;
+
+static DIS_CMND *Cmnds_head = (DIS_CMND *)0;
+
+void std_cmnd_handler(long *tag, int *cmnd_buff, int *size)
+{
+	register DIS_CMND *new_cmnd;
+/* queue the command */
+
+	if(!Cmnds_head)
+	{
+		Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
+		sll_init((SLL *) Cmnds_head);
+	}
+	new_cmnd = (DIS_CMND *)malloc((*size)+12);
+	new_cmnd->next = 0;
+	new_cmnd->tag = *tag;
+	new_cmnd->size = *size;
+	memcpy(new_cmnd->buffer, cmnd_buff, *size);
+	sll_insert_queue((SLL *) Cmnds_head, (SLL *) new_cmnd);
+}
+
+int dis_get_next_cmnd(long *tag, int *buffer, int *size)
+{
+	register DIS_CMND *cmndp;
+	register int ret_val = -1;
+
+	DISABLE_AST
+	if(!Cmnds_head)
+	{
+		Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
+		sll_init((SLL *) Cmnds_head);
+	}
+	if(*size == 0)
+	{
+		if( (cmndp = (DIS_CMND *) sll_get_head((SLL *) Cmnds_head)))
+		{
+			if(cmndp->size > 0)
+			{
+				*size = cmndp->size;
+				*tag = cmndp->tag;
+				ENABLE_AST
+				return(-1);
+			}
+		}
+	}
+	if( (cmndp = (DIS_CMND *) sll_remove_head((SLL *) Cmnds_head)) )
+	{
+		if (*size >= cmndp->size)
+		{
+			*size = cmndp->size;
+			ret_val = 1;
+		}
+		memcpy(buffer, cmndp->buffer, *size);
+		*tag = cmndp->tag;
+		free(cmndp);
+		ENABLE_AST
+		return(ret_val);
+	}
+	ENABLE_AST
+	return(0);
+}
+
+int dis_get_conn_id()
+{
+	return(Curr_conn_id);
+}
+
+int dis_get_client(char *name)
+{
+	int ret = 0;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+
+	DISABLE_AST
+
+	if(Curr_conn_id)
+	{
+		dna_get_node_task(Curr_conn_id, node, task);
+		strcpy(name,task);
+		strcat(name,"@");
+		strcat(name,node);
+		ret = Curr_conn_id;
+	}
+	ENABLE_AST
+	return(ret);
+}
+
+#ifdef VMS
+dis_convert_str(c_str, for_str)
+char *c_str;
+struct dsc$descriptor_s *for_str;
+{
+	int i;
+
+	strcpy(for_str->dsc$a_pointer, c_str);
+	for(i = strlen(c_str); i< for_str->dsc$w_length; i++)
+		for_str->dsc$a_pointer[i] = ' ';
+}
+#endif
+
+void client_info(long *tag, int **bufp, int *size, int *first_time)
+{
+	register CLIENT *clip;
+	int curr_conns[MAX_CONNS];
+	int i, index, max_size;
+	static int curr_allocated_size = 0;
+	static char *dns_info_buffer;
+	register char *dns_client_info;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+	DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
+
+	max_size = sizeof(DNS_CLIENT_INFO);
+	if(!curr_allocated_size)
+	{
+		dns_info_buffer = malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	dns_client_info = dns_info_buffer;
+	dns_client_info[0] = '\0';
+	index = 0;
+	if(*first_time)
+	{
+		clip = Client_head;
+		while( (clip = (CLIENT *)dll_get_next( (DLL *) Client_head, 
+			(DLL*) clip)) )
+		{
+			if(clip->dnsp != dnsp)
+				continue;
+			curr_conns[index++] = clip->conn_id;
+		}
+		max_size = (index+1)*sizeof(DNS_CLIENT_INFO);
+		if (max_size > curr_allocated_size)
+		{
+			free(dns_info_buffer);
+			dns_info_buffer = malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		dns_client_info = dns_info_buffer;
+		dns_client_info[0] = '\0';
+	}
+	else
+	{
+		if(Last_client > 0)
+		{
+			strcat(dns_client_info,"+");
+			curr_conns[index++] = Last_client;
+		}
+		else
+		{
+			strcat(dns_client_info,"-");
+			curr_conns[index++] = -Last_client;
+		}
+	}
+	
+	for(i=0; i<index;i++)
+	{
+		dna_get_node_task(curr_conns[i], node, task);
+		strcat(dns_client_info,task);
+		strcat(dns_client_info,"@");
+		strcat(dns_client_info,node);
+		strcat(dns_client_info,"|");
+	}
+	if(index)
+		dns_client_info[strlen(dns_client_info)-1] = '\0';
+	*bufp = (int *)dns_info_buffer;
+	*size = strlen(dns_info_buffer)+1;
+}
+
+void append_service(char *service_info_buffer, SERVICE *servp)		
+{
+	char name[MAX_NAME], *ptr;
+
+		if(strstr(servp->name,"/RpcIn"))
+		{
+			strcpy(name,servp->name);
+			ptr = (char *)strstr(name,"/RpcIn");
+			*ptr = 0;
+			strcat(service_info_buffer, name);
+			strcat(service_info_buffer, "|");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(name,"/RpcOut");
+			if( (servp = find_service(name)) )
+			{
+				strcat(service_info_buffer, ",");
+				if(servp->def[0])
+				{
+					strcat(service_info_buffer, servp->def);
+				}
+			}
+			strcat(service_info_buffer, "|RPC");
+			strcat(service_info_buffer, "\n");
+		}
+		else if(strstr(servp->name,"/RpcOut"))
+		{
+/*
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(service_info_buffer, "|RPC");
+			strcat(service_info_buffer, "\n");
+
+*/
+		}
+		else
+		{
+			strcat(service_info_buffer, servp->name);
+			strcat(service_info_buffer, "|");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(service_info_buffer, "|");
+			if(servp->type == COMMAND)
+			{
+				strcat(service_info_buffer, "CMD");
+			}
+			strcat(service_info_buffer, "\n");
+		}
+}
+
+void service_info(long *tag, int **bufp, int *size, int *first_time)
+{
+	register SERVICE *servp;
+	int max_size, done = 0;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+	DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
+	int hash_index;
+
+	DISABLE_AST
+	max_size = (dnsp->dis_n_services+10) * (MAX_NAME*2 + 4);
+	if(!curr_allocated_size)
+	{
+		service_info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	else if (max_size > curr_allocated_size)
+	{
+		free(service_info_buffer);
+		service_info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	service_info_buffer[0] = '\0';
+	buff_ptr = service_info_buffer;
+	servp = 0;
+	hash_index = -1;
+	if(*first_time)
+	{
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+		{
+			if(servp->dnsp != dnsp)
+				continue;
+			if(servp->registered)
+			{
+				servp->registered = 2;
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+			}
+		}
+	}
+	else
+	{
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+		{
+			if(servp->dnsp != dnsp)
+				continue;
+			if(servp->registered == 1)
+			{
+				if(!done)
+				{
+					strcat(buff_ptr, "+");
+					buff_ptr += strlen(buff_ptr);
+					done = 1;
+				}
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+				servp->registered = 2;
+			}
+			else if(servp->registered == 0)
+			{
+				strcat(buff_ptr, "-");
+				buff_ptr += strlen(buff_ptr);
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+			}
+		}
+	}
+	*bufp = (int *)service_info_buffer;
+	*size = buff_ptr - service_info_buffer+1;
+	ENABLE_AST
+}
+		
+void add_exit_handler(int *tag, int *bufp, int *size)
+{
+	EXIT_H *newp;
+
+	if(size){}
+	if(tag){}
+	if(*bufp)
+	{
+		if(!Exit_h_head) 
+		{
+			Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H));
+			sll_init( (SLL *) Exit_h_head );
+		}
+		newp = (EXIT_H *)malloc(sizeof(EXIT_H));
+		newp->conn_id = Curr_conn_id;
+		newp->exit_id = *bufp;
+		sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp );
+	}
+	else
+	{
+		if(!Exit_h_head) 
+			return;
+		if((newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&Curr_conn_id, 4)) )
+		{
+			sll_remove( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+}
+
+void dis_set_client_exit_handler(int conn_id, int tag)
+{
+	EXIT_H *newp;
+
+	DISABLE_AST
+	if(tag)
+	{
+		if(!Exit_h_head) 
+		{
+			Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H));
+			sll_init( (SLL *) Exit_h_head );
+		}
+		if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&conn_id, 4)) )
+		{
+			newp->conn_id = conn_id;
+			newp->exit_id = tag;
+		}
+		else
+		{
+			newp = (EXIT_H *)malloc(sizeof(EXIT_H));
+			newp->conn_id = conn_id;
+			newp->exit_id = tag;
+			sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+	else
+	{
+		if(!Exit_h_head) 
+		{
+			ENABLE_AST
+			return;
+		}
+		if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&conn_id, 4)) )
+		{
+			sll_remove( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+	ENABLE_AST
+}
+
+int do_exit_handler(int conn_id)
+{
+	register EXIT_H *exitp;
+
+	DISABLE_AST;
+	if(!Exit_h_head)
+	{
+		ENABLE_AST;
+		return(0);
+	}
+	while( (exitp = (EXIT_H *) sll_search_next_remove((SLL *) Exit_h_head,
+							 0, (char *) &conn_id, 4)) )
+	{
+		(Client_exit_user_routine)( &exitp->exit_id );
+		free(exitp);
+	}
+	ENABLE_AST
+	return(1);
+}
+
+static void exit_handler(int *tag, int *bufp, int *size)
+{
+
+	if(size){}
+	if(tag){}
+	if(Exit_user_routine)
+		(Exit_user_routine)( bufp );
+	else
+	{
+/*
+		printf("%s PID %d Exiting!\n", Task_name, getpid());
+*/
+		exit(*bufp);
+	}
+}
+
+static void error_handler(int conn_id, int severity, int errcode, char *reason)
+{
+	int exit_tag, exit_code, exit_size;
+	int last_conn_id;
+
+	if(Error_user_routine)
+	{
+			Error_conn_id = conn_id;
+			last_conn_id = Curr_conn_id;
+			Curr_conn_id = conn_id;
+			(Error_user_routine)( severity, errcode, reason);
+			Error_conn_id = 0;
+			Curr_conn_id = last_conn_id;
+	}
+	else
+	{
+		dim_print_msg(reason, severity);
+	}
+	if(severity == DIM_FATAL)
+	{
+		exit_tag = 0;
+		exit_code = errcode;
+		exit_size = sizeof(int);
+		exit_handler(&exit_tag, &exit_code, &exit_size);
+	}
+}
+/*
+#define MAX_HASH_ENTRIES 2000
+*/
+#define MAX_HASH_ENTRIES 5000
+
+static SERVICE *Service_hash_table[MAX_HASH_ENTRIES];
+static int Service_new_entries[MAX_HASH_ENTRIES];
+
+int dis_hash_service_init()
+{
+  int i;
+  static int done = 0;
+
+  if(!done)
+  {
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		Service_hash_table[i] = (SERVICE *) malloc(8);
+		dll_init((DLL *) Service_hash_table[i]);
+		Service_new_entries[i] = 0;
+	}
+	done = 1;
+  }
+  return(1);
+}
+
+int dis_hash_service_insert(SERVICE *servp)
+{
+	int index;
+	index = HashFunction(servp->name, MAX_HASH_ENTRIES);
+	Service_new_entries[index]++;
+	dll_insert_queue((DLL *) Service_hash_table[index], 
+			 (DLL *) servp);
+	return(1);
+}
+
+int dis_hash_service_registered(int index, SERVICE *servp)
+{
+	servp->registered = 1;
+	Service_new_entries[index]--;
+	if(Service_new_entries[index] < 0)
+		Service_new_entries[index] = 0;
+	return 1;
+}
+
+int dis_hash_service_remove(SERVICE *servp)
+{
+	dll_remove( (DLL *) servp );
+	return(1);
+}
+
+
+SERVICE *dis_hash_service_exists(char *name)
+{
+	int index;
+	SERVICE *servp;
+
+	index = HashFunction(name, MAX_HASH_ENTRIES);
+	if( (servp = (SERVICE *) dll_search(
+					(DLL *) Service_hash_table[index],
+			      		name, strlen(name)+1)) )
+	{
+		return(servp);
+	}
+	return((SERVICE *)0);
+}			
+
+SERVICE *dis_hash_service_get_next(int *curr_index, SERVICE *prevp, int new_entries)
+{
+	int index;
+	SERVICE *servp = 0;
+/*
+	if(!prevp)
+	{
+		index = -1;
+	}
+*/
+	index = *curr_index;
+	if(index == -1)
+	{
+		index++;
+		prevp = Service_hash_table[index];
+	}
+	if(!prevp)
+	{
+		prevp = Service_hash_table[index];
+	}
+	do
+	{
+		if((!new_entries) || (Service_new_entries[index] > 0))
+		{
+			servp = (SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[index],
+						(DLL *) prevp);
+			if(servp)
+				break;
+		}
+		index++;
+		if(index == MAX_HASH_ENTRIES)
+		{
+			*curr_index = -1;
+			return((SERVICE *) 0);
+		}
+		prevp = Service_hash_table[index];
+	} while(!servp);
+	*curr_index = index;
+	return(servp);
+}
+
+DIS_DNS_CONN *dis_find_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = (DIS_DNS_CONN *)
+			dll_search( (DLL *) DNS_head, &dnsid, sizeof(dnsid));
+/*
+	if(!dnsp)
+	{
+		dnsp = create_dns(dnsid);
+	}
+*/
+	return dnsp;
+}
+
+int dis_no_dns()
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = (DIS_DNS_CONN *) DNS_head;
+	while ( (dnsp = (DIS_DNS_CONN *) dll_get_next( (DLL *) DNS_head, (DLL *) dnsp)))
+	{
+/*
+		if(dnsp != Default_DNS)
+			return 0;
+*/
+		if(dnsp->serving)
+			return 0;
+	}
+	return 1;
+}
+
+DIS_DNS_CONN *find_dns_by_conn_id(int conn_id)
+{
+	DIS_DNS_CONN *dnsp;
+	extern long dns_get_dnsid();
+	long dnsid;
+
+	dnsid = dns_get_dnsid(conn_id, SRC_DIS);
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = Default_DNS;
+	return (DIS_DNS_CONN *)dnsp;
+}
+
+void dis_print_hash_table()
+{
+	SERVICE *servp;
+	int i;
+	int n_entries, max_entry_index = 0;
+	int max_entries = 0;
+
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		n_entries = 0;
+		servp = Service_hash_table[i];
+		while( (servp = (SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[i],
+						(DLL *) servp)) )
+		{
+			n_entries++;
+			if(n_entries == 1)
+				printf("    Name = %s\n",servp->name);
+		}
+		if(n_entries != 0)
+			printf("HASH[%d] - %d entries\n", i, n_entries);
+		if(n_entries > max_entries)
+		{
+			max_entries = n_entries;
+			max_entry_index = i;
+		}
+	}
+	printf("Maximum : HASH[%d] - %d entries\n", max_entry_index, max_entries);  
+	fflush(stdout);
+}
+
+void dis_hash_print()
+{
+	SERVICE *servp;
+	int hash_index;
+
+	servp = 0;
+	hash_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+	{
+		printf("Name = %s\n",servp->name);
+	}
+}
+
+#ifdef VMS
+/* CFORTRAN WRAPPERS */
+FCALLSCFUN1(INT, dis_start_serving, DIS_START_SERVING, dis_start_serving,
+				 STRING)
+FCALLSCFUN3(INT, dis_get_next_cmnd, DIS_GET_NEXT_CMND, dis_get_next_cmnd,
+				 PINT, PVOID, PINT)
+FCALLSCFUN1(INT, dis_get_client, DIS_GET_CLIENT, dis_get_client,
+				 PSTRING)
+FCALLSCFUN6(INT, dis_add_service, DIS_ADD_SERVICE, dis_add_service,
+				 STRING, PVOID, PVOID, INT, PVOID, INT)
+FCALLSCSUB4(	 dis_add_cmnd, DIS_ADD_CMND, dis_add_cmnd,
+				 STRING, PVOID, PVOID, INT)
+FCALLSCSUB1(	 dis_add_client_exit_handler, DIS_ADD_CLIENT_EXIT_HANDLER, 
+				 dis_add_client_exit_handler,
+				 PVOID)
+FCALLSCSUB2(	 dis_set_client_exit_handler, DIS_SET_CLIENT_EXIT_HANDLER, 
+				 dis_set_client_exit_handler,
+				 INT, INT)
+FCALLSCSUB1(	 dis_add_exit_handler, DIS_ADD_EXIT_HANDLER, 
+				 dis_add_exit_handler,
+				 PVOID)
+FCALLSCSUB1(	 dis_report_service, DIS_REPORT_SERVICE, dis_report_service,
+				 STRING)
+FCALLSCSUB2(	 dis_convert_str, DIS_CONVERT_STR, dis_convert_str,
+				 PVOID, PVOID)
+FCALLSCFUN1(INT, dis_update_service, DIS_UPDATE_SERVICE, dis_update_service,
+				 INT)
+FCALLSCFUN1(INT, dis_remove_service, DIS_REMOVE_SERVICE, dis_remove_service,
+				 INT)
+FCALLSCSUB3(	 dis_send_service, DIS_SEND_SERVICE, dis_send_service,
+				 INT, PVOID, INT)
+FCALLSCSUB2(	 dis_set_quality, DIS_SET_QUALITY, dis_set_quality,
+                 INT, INT)
+FCALLSCSUB3(INT, dis_set_timestamp, DIS_SET_TIMESTAMP, dis_set_timestamp,
+                 INT, INT, INT)
+FCALLSCFUN2(INT, dis_selective_update_service, DIS_SELECTIVE_UPDATE_SERVICE, 
+				 dis_selective_update_service,
+				 INT, PINT)
+FCALLSCSUB3(INT, dis_get_timestamp, DIS_GET_TIMESTAMP, dis_get_timestamp,
+                 INT, PINT, PINT)
+#endif
Index: /trunk/FACT++/dim_v19r15/src/dis_Markus.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dis_Markus.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dis_Markus.c	(revision 10183)
@@ -0,0 +1,3084 @@
+/*
+ * DIS (Delphi Information Server) Package implements a library of
+ * routines to be used by servers.
+ *
+ * Started on		 : 10-11-91
+ * Last modification : 28-07-94
+ * Written by		 : C. Gaspar
+ * Adjusted by	     : G.C. Ballintijn
+ *
+ */
+
+#ifdef VMS
+#	include <lnmdef.h>
+#	include <ssdef.h>
+#	include <descrip.h>
+#	include <cfortran.h>
+#endif
+/*
+#define DEBUG
+*/
+#include <time.h>
+#ifdef VAX
+#include <timeb.h>
+#else
+#include <sys/timeb.h>
+#endif
+
+#define DIMLIB
+#include <dim.h>
+#include <dis.h>
+
+#define ALL 0
+#define MORE 1
+#define NONE 2
+
+typedef struct dis_dns_ent {
+	struct dis_dns_ent *next;
+	struct dis_dns_ent *prev;
+	long dnsid;
+	char task_name[MAX_NAME];
+	TIMR_ENT *dns_timr_ent;
+	DIS_DNS_PACKET dis_dns_packet;
+	int dis_n_services;
+	int dns_dis_conn_id;
+	int dis_first_time;
+	int serving;
+	unsigned int dis_service_id;
+	unsigned int dis_client_id;
+	int updating_service_list;
+} DIS_DNS_CONN;
+
+typedef struct req_ent {
+	struct req_ent *next;
+	struct req_ent *prev;
+	int conn_id;
+	int service_id;
+	int req_id;
+	int type;
+	struct serv *service_ptr;
+	int timeout;
+	int format;
+	int first_time;
+	int delay_delete;
+	int to_delete;
+	TIMR_ENT *timr_ent;
+	struct reqp_ent *reqpp;
+} REQUEST;
+
+typedef struct serv {
+	struct serv *next;
+	struct serv *prev;
+	char name[MAX_NAME];
+	int id;
+	int type;
+	char def[MAX_NAME];
+	FORMAT_STR format_data[MAX_NAME/4];
+	int *address;
+	int size;
+	void (*user_routine)();
+	long tag;
+	int registered;
+	int quality;
+	int user_secs;
+	int user_millisecs;
+	int tid;
+	REQUEST *request_head;
+	DIS_DNS_CONN *dnsp;
+	int delay_delete;
+	int to_delete;
+} SERVICE;
+
+typedef struct reqp_ent {
+	struct reqp_ent *next;
+	struct reqp_ent *prev;
+	REQUEST *reqp;
+} REQUEST_PTR;
+
+typedef struct cli_ent {
+	struct cli_ent *next;
+	struct cli_ent *prev;
+	int conn_id;
+	REQUEST_PTR *requestp_head; 
+	DIS_DNS_CONN *dnsp;
+} CLIENT;
+
+static CLIENT *Client_head = (CLIENT *)0;	
+
+static DIS_DNS_CONN *DNS_head = (DIS_DNS_CONN *)0;	
+
+/*
+static char Task_name[MAX_NAME];
+static TIMR_ENT *Dns_timr_ent = (TIMR_ENT *)0;
+static DIS_DNS_PACKET Dis_dns_packet = {0, 0, {0}};
+static int Dis_n_services = 0;
+*/
+static int Dis_first_time = 1;
+/*
+static int Dns_dis_conn_id = 0;
+*/
+static int Protocol;
+static int Port_number;
+static int Dis_conn_id = 0;
+static int Curr_conn_id = 0;
+static int Serving = 0;
+static void (*Client_exit_user_routine)() = 0;
+static void (*Exit_user_routine)() = 0;
+static void (*Error_user_routine)() = 0;
+static int Error_conn_id = 0;
+DIS_DNS_CONN *Default_DNS = 0;
+
+typedef struct exit_ent {
+	struct exit_ent *next;
+	int conn_id;
+	int exit_id;
+} EXIT_H;
+
+static EXIT_H *Exit_h_head = (EXIT_H *)0;
+
+/* Do not forget to increase when this file is modified */
+static int Version_number = DIM_VERSION_NUMBER;
+static int Dis_timer_q = 0;
+static int Threads_off = 0;
+/*
+static unsigned int Dis_service_id, Dis_client_id;
+static int Updating_service_list = 0;
+*/
+static int Last_client;
+
+#ifdef DEBUG
+static int Debug_on = 1;
+#else
+static int Debug_on = 0;
+#endif
+
+_DIM_PROTO( static void dis_insert_request, (int conn_id, DIC_PACKET *dic_packet,
+				  int size, int status ) );
+_DIM_PROTO( int execute_service,	(int req_id) );
+_DIM_PROTO( void execute_command,	(SERVICE *servp, DIC_PACKET *packet) );
+_DIM_PROTO( void register_dns_services,  (int flag) );
+_DIM_PROTO( void register_services,  (DIS_DNS_CONN *dnsp, int flag, int dns_flag) );
+_DIM_PROTO( void std_cmnd_handler,   (long *tag, int *cmnd_buff, int *size) );
+_DIM_PROTO( void client_info,		(long *tag, int **bufp, int *size) );
+_DIM_PROTO( void service_info,	   (long *tag, int **bufp, int *size) );
+_DIM_PROTO( void add_exit_handler,   (int *tag, int *bufp, int *size) );
+_DIM_PROTO( static void exit_handler,	   (int *tag, int *bufp, int *size) );
+_DIM_PROTO( static void error_handler,	   (int conn_id, int severity, int errcode, char *reason) );
+_DIM_PROTO( SERVICE *find_service,   (char *name) );
+_DIM_PROTO( CLIENT *find_client,   (int conn_id) );
+_DIM_PROTO( static int get_format_data, (FORMAT_STR *format_data, char *def) );
+_DIM_PROTO( static int release_conn, (int conn_id, int print_flag, int dns_flag) );
+_DIM_PROTO( SERVICE *dis_hash_service_exists, (char *name) );
+_DIM_PROTO( SERVICE *dis_hash_service_get_next, (int *start, SERVICE *prev, int flag) );
+_DIM_PROTO( static unsigned do_dis_add_service_dns, (char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag, long dnsid ) );
+_DIM_PROTO( static DIS_DNS_CONN *create_dns, (long dnsid) );
+
+void dis_set_debug_on()
+{
+	Debug_on = 1;
+}
+
+void dis_set_debug_off()
+{
+	Debug_on = 0;
+}
+
+void dis_no_threads()
+{
+	Threads_off = 1;
+}
+
+static DIS_STAMPED_PACKET *Dis_packet = 0;
+static int Dis_packet_size = 0;
+
+int dis_set_buffer_size(int size)
+{
+	if(Dis_packet_size)
+		free(Dis_packet);
+	Dis_packet = (DIS_STAMPED_PACKET *)malloc(DIS_STAMPED_HEADER + size);
+	if(Dis_packet)
+	{
+		Dis_packet_size = DIS_STAMPED_HEADER + size;
+		return(1);
+	}
+	else
+		return(0);
+}
+
+static int check_service_name(char *name)
+{
+	if(strlen(name) > (MAX_NAME - 1))
+		return(0);
+	return(1);
+}
+
+static void dis_init()
+{
+	int dis_hash_service_init();
+	void dis_dns_init();
+
+	dis_dns_init();
+	{
+	DISABLE_AST
+	dis_hash_service_init();
+	ENABLE_AST
+	}
+}
+
+static unsigned do_dis_add_service_dns( char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag, long dnsid )
+{
+	register SERVICE *new_serv;
+	register int service_id;
+	char str[512];
+	int dis_hash_service_insert();
+	DIS_DNS_CONN *dnsp;
+	extern DIS_DNS_CONN *dis_find_dns(long);
+
+	dis_init();
+	{
+	DISABLE_AST
+	if(!check_service_name(name))
+	{
+		strcpy(str,"Service name too long: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCTOOLG, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	if( find_service(name) )
+	{
+		strcpy(str,"Duplicate Service: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCDUPLC, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	new_serv = (SERVICE *)malloc( sizeof(SERVICE) );
+	strncpy( new_serv->name, name, MAX_NAME );
+	if(type != (char *)0)
+	{
+		if (strlen(type) >= MAX_NAME)
+		{
+			strcpy(str,"Format String Too Long: ");
+			strcat(str,name);
+			error_handler(0, DIM_ERROR, DIMSVCFORMT, str);
+			free(new_serv);
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		if (! get_format_data(new_serv->format_data, type))
+		{
+			strcpy(str,"Bad Format String: ");
+			strcat(str,name);
+			error_handler(0, DIM_ERROR, DIMSVCFORMT, str);
+			free(new_serv);
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		strcpy(new_serv->def,type); 
+	}
+	else
+	{
+		new_serv->format_data[0].par_bytes = 0;
+		new_serv->def[0] = '\0';
+	}
+	new_serv->type = 0;
+	new_serv->address = (int *)address;
+	new_serv->size = size;
+	new_serv->user_routine = user_routine;
+	new_serv->tag = tag;
+	new_serv->registered = 0;
+	new_serv->quality = 0;
+	new_serv->user_secs = 0;
+	new_serv->tid = 0;
+	new_serv->delay_delete = 0;
+	new_serv->to_delete = 0;
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = create_dns(dnsid);
+	new_serv->dnsp = dnsp;
+	service_id = id_get((void *)new_serv, SRC_DIS);
+	new_serv->id = service_id;
+	new_serv->request_head = (REQUEST *)malloc(sizeof(REQUEST));
+	dll_init( (DLL *) (new_serv->request_head) );
+	dis_hash_service_insert(new_serv);
+/*
+	Dis_n_services++;
+*/
+	dnsp->dis_n_services++;
+	ENABLE_AST
+	}
+	return((unsigned)service_id);
+}
+
+static unsigned do_dis_add_service( char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag )
+{
+	return do_dis_add_service_dns( name, type, address, size, 
+								   user_routine, tag, 0 );
+}
+
+#ifdef VxWorks
+void dis_destroy(int tid)
+{
+register SERVICE *servp, *prevp;
+int n_left = 0;
+
+	prevp = 0;
+	while( servp = dis_hash_service_get_next(prevp))
+	{
+		if(servp->tid == tid)
+		{
+			dis_remove_service(servp->id);
+		}
+		else
+		{
+			prevp = servp;
+			n_left++;
+		}
+	}
+	if(n_left == 5)
+	{
+		prevp = 0;
+		while( servp = dis_hash_service_get_next(prevp))
+		{
+			dis_remove_service(servp->id);
+		}
+		dna_close(Dis_conn_id);
+		dna_close(Dns_dis_conn_id);
+		Dns_dis_conn_id = 0;
+		Dis_first_time = 1;
+		dtq_rem_entry(Dis_timer_q, Dns_timr_ent);
+		Dns_timr_ent = NULL;
+	}
+}
+
+
+#endif
+
+unsigned dis_add_service( char *name, char *type, void *address, int size, 
+						 void (*user_routine)(), long tag)
+{
+	unsigned ret;
+#ifdef VxWorks
+	register SERVICE *servp;
+#endif
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_service( name, type, address, size, user_routine, tag);
+#ifdef VxWorks
+	servp = (SERVICE *)id_get_ptr(ret, SRC_DIS);
+	servp->tid = taskIdSelf();
+#endif
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+unsigned dis_add_service_dns( long dnsid, char *name, char *type, void *address, int size, 
+							 void (*user_routine)(), long tag)
+{
+	unsigned ret;
+#ifdef VxWorks
+	register SERVICE *servp;
+#endif
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_service_dns( name, type, address, size, user_routine, tag, dnsid);
+#ifdef VxWorks
+	servp = (SERVICE *)id_get_ptr(ret, SRC_DIS);
+	servp->tid = taskIdSelf();
+#endif
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+static unsigned do_dis_add_cmnd_dns( char *name, char *type, void (*user_routine)(), long tag, long dnsid )
+{
+	register SERVICE *new_serv;
+	register int service_id;
+	char str[512];
+	int dis_hash_service_insert();
+	DIS_DNS_CONN *dnsp;
+	extern DIS_DNS_CONN *dis_find_dns(long);
+
+	dis_init();
+	{
+	DISABLE_AST
+	if(!check_service_name(name))
+	{
+		strcpy(str,"Command name too long: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCTOOLG, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	if( find_service(name) )
+	{
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	new_serv = (SERVICE *)malloc(sizeof(SERVICE));
+	strncpy(new_serv->name, name, MAX_NAME);
+	if(type != (char *)0)
+	{
+		if( !get_format_data(new_serv->format_data, type))
+		{
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		strcpy(new_serv->def,type); 
+	}
+	else
+	{
+		new_serv->format_data[0].par_bytes = 0;
+		new_serv->def[0] = '\0';
+	}
+	new_serv->type = COMMAND;
+	new_serv->address = 0;
+	new_serv->size = 0;
+	if(user_routine)
+		new_serv->user_routine = user_routine;
+	else
+		new_serv->user_routine = std_cmnd_handler;
+	new_serv->tag = tag;
+	new_serv->tid = 0;
+	new_serv->registered = 0;
+	new_serv->quality = 0;
+	new_serv->user_secs = 0;
+	new_serv->delay_delete = 0;
+	new_serv->to_delete = 0;
+	service_id = id_get((void *)new_serv, SRC_DIS);
+	new_serv->id = service_id;
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = create_dns(dnsid);
+	new_serv->dnsp = dnsp;
+	new_serv->request_head = (REQUEST *)malloc(sizeof(REQUEST));
+	dll_init( (DLL *) (new_serv->request_head) );
+	dis_hash_service_insert(new_serv);
+/*
+	Dis_n_services++;
+*/
+	dnsp->dis_n_services++;
+	ENABLE_AST
+	}
+	return((unsigned) service_id);
+}
+
+static unsigned do_dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag)
+{
+	return do_dis_add_cmnd_dns(name, type, user_routine, tag, 0);
+}
+
+unsigned dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag ) 
+{
+	unsigned ret;
+
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_cmnd( name, type, user_routine, tag );
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+unsigned dis_add_cmnd_dns( long dnsid, char *name, char *type, void (*user_routine)(), long tag ) 
+{
+	unsigned ret;
+
+	/*
+	DISABLE_AST
+	*/
+	ret = do_dis_add_cmnd_dns( name, type, user_routine, tag, dnsid );
+	/*
+	ENABLE_AST
+	*/
+	return(ret);
+}
+
+void dis_add_client_exit_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Client_exit_user_routine = user_routine;
+	ENABLE_AST
+}
+
+void dis_add_exit_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Exit_user_routine = user_routine;
+	ENABLE_AST
+}
+
+void dis_add_error_handler( void (*user_routine)())
+{
+
+	DISABLE_AST
+	Error_user_routine = user_routine;
+	ENABLE_AST
+}
+
+static int get_format_data(FORMAT_STR *format_data, char *def)
+{
+	register char code, last_code = 0;
+	int num;
+
+	code = *def;
+	while(*def)
+	{
+		if(code != last_code)
+		{
+			format_data->par_num = 0;
+			format_data->flags = 0;
+			switch(code)
+			{
+				case 'i':
+				case 'I':
+				case 'l':
+				case 'L':
+					format_data->par_bytes = SIZEOF_LONG;
+					format_data->flags |= SWAPL;
+					break;
+				case 'x':
+				case 'X':
+					format_data->par_bytes = SIZEOF_DOUBLE;
+					format_data->flags |= SWAPD;
+					break;
+				case 's':
+				case 'S':
+					format_data->par_bytes = SIZEOF_SHORT;
+					format_data->flags |= SWAPS;
+					break;
+				case 'f':
+				case 'F':
+					format_data->par_bytes = SIZEOF_FLOAT;
+					format_data->flags |= SWAPL;
+#ifdef vms      	
+					format_data->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'd':
+				case 'D':
+					format_data->par_bytes = SIZEOF_DOUBLE;
+					format_data->flags |= SWAPD;
+#ifdef vms
+					format_data->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'c':
+				case 'C':
+					format_data->par_bytes = SIZEOF_CHAR;
+					format_data->flags |= NOSWAP;
+					break;
+			}
+		}
+		def++;
+		if(*def != ':')
+		{
+			if(*def)
+			{
+/*
+				printf("Bad service definition parsing\n");
+				fflush(stdout);
+
+				error_handler("Bad service definition parsing",2);
+*/
+				return(0);
+			}
+			else
+				format_data->par_num = 0;
+		}
+		else
+		{
+			def++;
+			sscanf(def,"%d",&num);
+			format_data->par_num += num;
+			while((*def != ';') && (*def != '\0'))
+				def++;
+			if(*def)
+				def++;
+		}
+		last_code = code;
+		code = *def;
+		if(code != last_code)
+			format_data++;
+	}
+	format_data->par_bytes = 0;
+	return(1);
+}
+
+void recv_dns_dis_rout( int conn_id, DNS_DIS_PACKET *packet, int size, int status )
+{
+	char str[128];
+	int dns_timr_time;
+	extern int rand_tmout(int, int);
+	extern int open_dns(long, void (*)(), void (*)(), int, int, int);
+	extern DIS_DNS_CONN *find_dns_by_conn_id(int);
+	extern void do_register_services(DIS_DNS_CONN *);
+	extern void do_dis_stop_serving_dns(DIS_DNS_CONN *);
+	DIS_DNS_CONN *dnsp;
+
+	if(size){}
+	dnsp = find_dns_by_conn_id(conn_id);
+	if(!dnsp)
+	{
+		return;
+	}
+	switch(status)
+	{
+	case STA_DISC:	   /* connection broken */
+		if( dnsp->dns_timr_ent ) {
+			dtq_rem_entry( Dis_timer_q, dnsp->dns_timr_ent );
+			dnsp->dns_timr_ent = NULL;
+		}
+
+		if(dnsp->dns_dis_conn_id > 0)
+			dna_close(dnsp->dns_dis_conn_id);
+		if(dnsp->serving)
+		{
+			dnsp->dns_dis_conn_id = open_dns(dnsp->dnsid, recv_dns_dis_rout, error_handler,
+					DIS_DNS_TMOUT_MIN, DIS_DNS_TMOUT_MAX, SRC_DIS );
+			if(dnsp->dns_dis_conn_id == -2)
+				error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		}
+		break;
+	case STA_CONN:		/* connection received */
+		if(dnsp->serving)
+		{
+			dnsp->dns_dis_conn_id = conn_id;
+			register_services(dnsp, ALL, 0);
+			dns_timr_time = rand_tmout(WATCHDOG_TMOUT_MIN, 
+							 WATCHDOG_TMOUT_MAX);
+			dnsp->dns_timr_ent = dtq_add_entry( Dis_timer_q,
+						  dns_timr_time,
+						  do_register_services, dnsp ); 
+		}
+		else
+		{
+			dna_close(conn_id);
+		}
+		break;
+	default :	   /* normal packet */
+		if(vtohl(packet->size) != DNS_DIS_HEADER)
+			break;
+		switch( vtohl(packet->type) )
+		{
+		case DNS_DIS_REGISTER :
+			sprintf(str, 
+				"%s: Watchdog Timeout, DNS requests registration",
+				dnsp->task_name);
+			error_handler(0, DIM_WARNING, DIMDNSTMOUT, str);
+			register_services(dnsp, ALL, 0);
+			break;
+		case DNS_DIS_KILL :
+			sprintf(str,
+				"%s: Some Services already known to DNS",
+				dnsp->task_name);
+			/*
+			exit(2);
+			*/
+			error_handler(0, DIM_FATAL, DIMDNSDUPLC, str);
+			do_dis_stop_serving_dns(dnsp);
+			dis_stop_serving();
+/*
+			exit_tag = 0;
+			exit_code = 2;
+			exit_size = sizeof(int);
+			exit_handler(&exit_tag, &exit_code, &exit_size);
+*/
+			break;
+		case DNS_DIS_STOP :
+			sprintf(str, 
+				"%s: DNS refuses connection",dnsp->task_name);
+/*
+			exit(2);
+*/
+			error_handler(0, DIM_FATAL, DIMDNSREFUS, str);
+			do_dis_stop_serving_dns(dnsp);
+			dis_stop_serving();
+/*
+			exit_tag = 0;
+			exit_code = 2;
+			exit_size = sizeof(int);
+			exit_handler(&exit_tag, &exit_code, &exit_size);
+*/
+			break;
+		case DNS_DIS_EXIT :
+			sprintf(str, 
+				"%s: DNS requests Exit",dnsp->task_name);
+			error_handler(0, DIM_FATAL, DIMDNSEXIT, str);
+			break;
+		}
+		break;
+	}
+}
+
+
+/* register services within the name server
+ *
+ * Send services uses the DNA package. services is a linked list of services
+ * stored by add_service.
+ */
+
+int send_dns_update_packet(DIS_DNS_CONN *dnsp)
+{
+  DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+  int n_services;
+  SERVICE_REG *serv_regp;
+
+  n_services = 1;
+  dis_dns_p->n_services = htovl(n_services);
+  dis_dns_p->size = htovl(DIS_DNS_HEADER +
+					n_services * sizeof(SERVICE_REG));
+  serv_regp = dis_dns_p->services;
+  strcpy( serv_regp->service_name, "DUMMY_UPDATE_PACKET" );
+  if(dnsp->dns_dis_conn_id > 0)
+  {
+      if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
+		     DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))
+	  {
+		release_conn(dnsp->dns_dis_conn_id, 0, 1);
+	  }
+  }
+  return(1);
+}
+
+void do_register_services(DIS_DNS_CONN *dnsp)
+{
+	register_services(dnsp, NONE, 0);
+}
+
+void register_services(DIS_DNS_CONN *dnsp, int flag, int dns_flag)
+{
+	register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+	register int n_services, tot_n_services;
+	register SERVICE *servp;
+	register SERVICE_REG *serv_regp;
+	int hash_index, new_entries;
+	extern int get_node_addr();
+	int dis_hash_service_registered();
+
+	if(!dis_dns_p->src_type)
+	{
+		get_node_name( dis_dns_p->node_name );
+/*
+		strcpy( dis_dns_p->task_name, Task_name );
+*/
+		strncpy( dis_dns_p->task_name, dnsp->task_name,
+			MAX_TASK_NAME-4 );
+		dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
+		get_node_addr( dis_dns_p->node_addr );
+/*
+		dis_dns_p->port = htovl(Port_number);
+*/
+		dis_dns_p->pid = htovl(getpid());
+		dis_dns_p->protocol = htovl(Protocol);
+		dis_dns_p->src_type = htovl(SRC_DIS);
+		dis_dns_p->format = htovl(MY_FORMAT);
+	}
+
+	dis_dns_p->port = htovl(Port_number);
+	serv_regp = dis_dns_p->services;
+	n_services = 0;
+	tot_n_services = 0;
+	if( flag == NONE ) {
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl( DIS_DNS_HEADER + 
+			(n_services*sizeof(SERVICE_REG)));
+		if(dnsp->dns_dis_conn_id > 0)
+		{
+			if(!dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 
+				DIS_DNS_HEADER + n_services*sizeof(SERVICE_REG)))
+			{
+				release_conn(dnsp->dns_dis_conn_id, 0, 1);
+			}
+		}
+		return;
+	}
+	if(flag == ALL)
+	{
+		servp = 0;
+		hash_index = -1;
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)))
+		{
+			if(servp->dnsp == dnsp)
+				servp->registered  = 0;
+		}
+	}
+	servp = 0;
+	hash_index = -1;
+	new_entries = 0;
+	if(flag == MORE)
+		new_entries = 1;
+	while( (servp = dis_hash_service_get_next(&hash_index, servp, new_entries)))
+	{
+		if( flag == MORE ) 
+		{
+			if( servp->registered )
+			{
+				continue;
+			}
+		}
+
+		if(servp->dnsp != dnsp)
+			continue;
+
+		strcpy( serv_regp->service_name, servp->name );
+		strcpy( serv_regp->service_def, servp->def );
+		if(servp->type == COMMAND)
+			serv_regp->service_id = htovl( servp->id | 0x10000000);
+		else
+			serv_regp->service_id = htovl( servp->id );
+
+		serv_regp++;
+		n_services++;
+		dis_hash_service_registered(hash_index, servp);
+		if( n_services == MAX_SERVICE_UNIT )
+		{
+			dis_dns_p->n_services = htovl(n_services);
+			dis_dns_p->size = htovl(DIS_DNS_HEADER +
+				n_services * sizeof(SERVICE_REG));
+			if(dnsp->dns_dis_conn_id > 0)
+			{
+				if( !dna_write(dnsp->dns_dis_conn_id,
+					   &(dnsp->dis_dns_packet), 
+					   DIS_DNS_HEADER + n_services *
+						sizeof(SERVICE_REG)) )
+				{
+					release_conn(dnsp->dns_dis_conn_id, 0, 1);
+				}
+			}
+			serv_regp = dis_dns_p->services;
+			tot_n_services += MAX_SERVICE_UNIT;
+			n_services = 0;
+			continue;
+		}
+	}
+	if( n_services ) 
+	{
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl(DIS_DNS_HEADER +
+					n_services * sizeof(SERVICE_REG));
+		if(dnsp->dns_dis_conn_id > 0)
+		{
+			if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
+				DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))
+			{
+				release_conn(dnsp->dns_dis_conn_id, 0, 1);
+			}
+
+		}
+		tot_n_services += n_services;
+	}
+	if(!dns_flag)
+	{
+		if(tot_n_services >= MAX_REGISTRATION_UNIT)
+		{
+			send_dns_update_packet(dnsp);
+		}
+	}
+}
+
+void unregister_service(DIS_DNS_CONN *dnsp, SERVICE *servp)
+{
+	register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+	register int n_services;
+	register SERVICE_REG *serv_regp;
+	extern int get_node_addr();
+
+	if(dnsp->dns_dis_conn_id > 0)
+	{
+		if(!dis_dns_p->src_type)
+		{
+			get_node_name( dis_dns_p->node_name );
+/*
+			strcpy( dis_dns_p->task_name, Task_name );
+*/
+			strncpy( dis_dns_p->task_name, dnsp->task_name,
+				MAX_TASK_NAME-4 );
+			dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
+			get_node_addr( dis_dns_p->node_addr );
+			dis_dns_p->port = htovl(Port_number);
+			dis_dns_p->protocol = htovl(Protocol);
+			dis_dns_p->src_type = htovl(SRC_DIS);
+			dis_dns_p->format = htovl(MY_FORMAT);
+		}
+		serv_regp = dis_dns_p->services;
+		strcpy( serv_regp->service_name, servp->name );
+		strcpy( serv_regp->service_def, servp->def );
+		serv_regp->service_id = htovl( servp->id | 0x80000000);
+		serv_regp++;
+		n_services = 1;
+		servp->registered = 0;
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl(DIS_DNS_HEADER +
+				n_services * sizeof(SERVICE_REG));
+
+		if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 
+			DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)) )
+		{
+			release_conn(dnsp->dns_dis_conn_id, 0, 1);
+		}
+		if(dnsp->dis_service_id)
+			dis_update_service(dnsp->dis_service_id);
+	}
+}
+
+void do_update_service_list(DIS_DNS_CONN *dnsp)
+{
+	dnsp->updating_service_list = 0;
+	dis_update_service(dnsp->dis_service_id);
+}
+
+/* start serving client requests
+ *
+ * Using the DNA package start accepting requests from clients.
+ * When a request arrives the routine "dis_insert_request" will be executed.
+ */
+
+int dis_start_serving(char *task)
+{
+	return dis_start_serving_dns(0, task);
+}
+
+static DIS_DNS_CONN *create_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = malloc(sizeof(DIS_DNS_CONN));
+	dnsp->dns_timr_ent = (TIMR_ENT *)0;
+	dnsp->dis_n_services = 0;
+	dnsp->dns_dis_conn_id = 0;
+	dnsp->dis_first_time = 1;
+	dnsp->serving = 0;
+	dnsp->dis_dns_packet.size = 0;
+	dnsp->dis_dns_packet.src_type = 0;
+	dnsp->dis_dns_packet.node_name[0] = 0;
+	dnsp->updating_service_list = 0;
+	dnsp->dnsid = dnsid;
+	dll_insert_queue( (DLL *) DNS_head, (DLL *) dnsp );
+	return dnsp;
+}
+
+void dis_dns_init()
+{
+	static int done = 0;
+	DIS_DNS_CONN *dnsp;
+	void dim_init_threads(void);
+
+	if(!done)
+	{
+		if(!Threads_off)
+		{
+			dim_init_threads();
+		}
+		{
+		DISABLE_AST
+		if(!DNS_head) 
+		{
+			DNS_head = (DIS_DNS_CONN *)malloc(sizeof(DIS_DNS_CONN));
+			dll_init( (DLL *) DNS_head );
+		}
+		dnsp = create_dns(0);
+		Default_DNS = dnsp;
+		done = 1;
+		ENABLE_AST
+		}
+	}
+}
+
+int dis_start_serving_dns(long dnsid, char *task/*, int *idlist*/)
+{
+	char str0[MAX_NAME], str1[MAX_NAME],str2[MAX_NAME],
+	  str3[MAX_NAME],str4[MAX_NAME];
+	char task_name_aux[MAX_TASK_NAME];
+	extern int open_dns();
+	extern DIS_DNS_CONN *dis_find_dns(long);
+	DIS_DNS_CONN *dnsp;
+	int more_ids[10] = {0};
+
+	dis_init();
+	{
+	DISABLE_AST
+	  /*
+#ifdef VxWorks
+	taskDeleteHookAdd(remove_all_services);
+	printf("Adding delete hook\n");
+#endif
+*/
+
+	if(!Client_head) 
+	{
+		Client_head = (CLIENT *)malloc(sizeof(CLIENT));
+		dll_init( (DLL *) Client_head );
+	}
+	if(dnsid == 0)
+	{
+		dnsp = Default_DNS;
+	}
+	else if(!(dnsp = dis_find_dns(dnsid)))
+	{
+		dnsp = create_dns(dnsid);
+	}
+	dnsp->serving = 1;
+	Serving = 1;
+	if(Dis_first_time)
+	{
+		strncpy( task_name_aux, task, MAX_TASK_NAME );
+		task_name_aux[MAX_TASK_NAME-1] = '\0';
+		Port_number = SEEK_PORT;
+		if( !(Dis_conn_id = dna_open_server( task_name_aux, dis_insert_request, 
+			&Protocol, &Port_number, error_handler) ))
+		{
+			ENABLE_AST
+			return(0);
+		}
+		Dis_first_time = 0;
+	}
+	if(dnsp->dis_first_time)
+	{
+		dnsp->dis_first_time = 0;
+
+		sprintf(str0, "%s/VERSION_NUMBER", task);
+		sprintf(str1, "%s/CLIENT_LIST", task);
+		sprintf(str2, "%s/SERVICE_LIST", task);
+		sprintf(str3, "%s/SET_EXIT_HANDLER", task);
+		sprintf(str4, "%s/EXIT", task);
+
+		more_ids[0] = do_dis_add_service_dns( str0, "L", &Version_number,
+				 sizeof(Version_number), 0, 0, dnsid );
+
+		more_ids[1] = do_dis_add_service_dns( str1, "C", 0, 0, client_info, (long)dnsp, dnsid );
+		dnsp->dis_client_id = more_ids[1];
+		more_ids[2] = do_dis_add_service_dns( str2, "C", 0, 0, service_info, (long)dnsp, dnsid );
+		dnsp->dis_service_id = more_ids[2];
+		more_ids[3] = do_dis_add_cmnd_dns( str3, "L:1", add_exit_handler, 0, dnsid );
+		more_ids[4] = do_dis_add_cmnd_dns( str4, "L:1", exit_handler, 0, dnsid );
+		more_ids[5] = 0;
+		strcpy( dnsp->task_name, task );
+	}
+/*
+	if(idlist)
+	{
+		for(i = 0; idlist[i]; i++)
+		{
+			servp = (SERVICE *)id_get_ptr(idlist[i], SRC_DIS);
+			if(servp)
+			{
+				servp->dnsp = dnsp;
+				n_services++;
+			}
+		}
+	}
+	if(dnsp != Default_DNS)
+	{
+		for(i = 0; more_ids[i]; i++)
+		{
+			servp = (SERVICE *)id_get_ptr(more_ids[i], SRC_DIS);
+			if(servp)
+			{
+				servp->dnsp = dnsp;
+				n_services++;
+			}
+		}
+		dnsp->dis_n_services += n_services;
+		Dis_n_services -= n_services;
+	}
+*/
+	if(!Dis_timer_q)
+		Dis_timer_q = dtq_create();
+	if( !dnsp->dns_dis_conn_id )
+	{
+		if(!strcmp(task,"DIS_DNS"))
+		{
+			register_services(dnsp, ALL, 1);
+			ENABLE_AST
+			return(id_get(&(dnsp->dis_dns_packet), SRC_DIS));
+		}
+		else
+		{
+		
+			dnsp->dns_dis_conn_id = open_dns(dnsid, recv_dns_dis_rout, error_handler,
+					DIS_DNS_TMOUT_MIN, DIS_DNS_TMOUT_MAX, SRC_DIS );
+			if(dnsp->dns_dis_conn_id == -2)
+				error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		}
+	}
+	else
+	{
+		register_services(dnsp, MORE, 0);
+		if(dnsp->dis_service_id)
+		{
+/*
+			dis_update_service(Dis_service_id);
+*/
+			if(!dnsp->updating_service_list)
+			{
+				dtq_start_timer(1, do_update_service_list, dnsp);
+				dnsp->updating_service_list = 1;
+			}
+		}
+	}
+	ENABLE_AST
+	}
+	return(1);
+}
+
+
+/* asynchrounous reception of requests */
+/*
+	Called by DNA package.
+	A request has arrived, queue it to process later - dis_ins_request
+*/
+static void dis_insert_request(int conn_id, DIC_PACKET *dic_packet, int size, int status)
+{
+	register SERVICE *servp;
+	register REQUEST *newp, *reqp;
+	CLIENT *clip;
+	REQUEST_PTR *reqpp;
+	int type, new_client = 0, found = 0;
+	int find_release_request();
+	DIS_DNS_CONN *dnsp;
+
+	if(size){}
+	/* status = 1 => new connection, status = -1 => conn. lost */
+	if(!Client_head) 
+	{
+		Client_head = (CLIENT *)malloc(sizeof(CLIENT));
+		dll_init( (DLL *) Client_head );
+	}
+	if(status != 0)
+	{
+		if(status == -1) /* release all requests from conn_id */
+		{
+			release_conn(conn_id, 0, 0);
+		}
+	} 
+	else 
+	{
+		if(!(servp = find_service(dic_packet->service_name)))
+		{
+			release_conn(conn_id, 0, 0);
+			return;
+		}
+		dic_packet->type = vtohl(dic_packet->type);
+		type = dic_packet->type & 0xFFF;
+		/*
+		if(type == COMMAND) 
+		{
+			Curr_conn_id = conn_id;
+			execute_command(servp, dic_packet);
+			Curr_conn_id = 0;
+			return;
+		}
+		*/
+		if(type == DIM_DELETE) 
+		{
+			find_release_request(conn_id, vtohl(dic_packet->service_id));
+			return;
+		}
+		newp = (REQUEST *)/*my_*/malloc(sizeof(REQUEST));
+		newp->service_ptr = servp;
+		newp->service_id = vtohl(dic_packet->service_id);
+		newp->type = dic_packet->type;
+		newp->timeout = vtohl(dic_packet->timeout);
+		newp->format = vtohl(dic_packet->format);
+		newp->conn_id = conn_id;
+		newp->first_time = 1;
+		newp->delay_delete = 0;
+		newp->to_delete = 0;
+		newp->timr_ent = 0;
+		newp->req_id = id_get((void *)newp, SRC_DIS);
+		newp->reqpp = 0;
+		if(type == ONCE_ONLY) 
+		{
+			execute_service(newp->req_id);
+			id_free(newp->req_id, SRC_DIS);
+			free(newp);
+			return;
+		}
+		if(type == COMMAND) 
+		{
+			Curr_conn_id = conn_id;
+			execute_command(servp, dic_packet);
+			Curr_conn_id = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) ) 
+			{
+				if(reqp->conn_id == conn_id)
+				{
+					id_free(newp->req_id, SRC_DIS);
+					free(newp);
+					found = 1;
+					break;
+				}
+			}
+			if(!found)
+				dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
+			return;
+		}
+		dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
+		if(!(clip = find_client(conn_id)))
+		{
+			clip = (CLIENT *)malloc(sizeof(CLIENT));
+			clip->conn_id = conn_id;
+			clip->dnsp = servp->dnsp;
+			clip->requestp_head = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
+			dll_init( (DLL *) clip->requestp_head );
+			dll_insert_queue( (DLL *) Client_head, (DLL *) clip );
+			new_client = 1;
+		}
+		reqpp = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
+		reqpp->reqp = newp;
+		dll_insert_queue( (DLL *) clip->requestp_head, (DLL *) reqpp );
+		newp->reqpp = reqpp;
+		if((type != MONIT_ONLY) && (type != UPDATE))
+		{
+			execute_service(newp->req_id);
+		}
+		if((type != MONIT_ONLY) && (type != MONIT_FIRST))
+		{
+			if(newp->timeout != 0)
+			{
+				newp->timr_ent = dtq_add_entry( Dis_timer_q,
+							newp->timeout, 
+							execute_service,
+							newp->req_id );
+			}
+		}
+		if(new_client)
+		{
+			Last_client = conn_id;
+			dnsp = clip->dnsp;
+			if(dnsp->dis_client_id)
+			  dis_update_service(dnsp->dis_client_id);
+		}
+	}
+}
+
+/* A timeout for a timed or monitored service occured, serve it. */
+
+int execute_service( int req_id )
+{
+	int *buffp, size;
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	char str[80], def[MAX_NAME];
+	register char *ptr;
+	int last_conn_id;
+	int *pkt_buffer, header_size, aux;
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+	FORMAT_STR format_data_cp[MAX_NAME/4];
+
+	reqp = (REQUEST *)id_get_ptr(req_id, SRC_DIS);
+	if(!reqp)
+		return(0);
+	if(reqp->to_delete)
+		return(0);
+	reqp->delay_delete++;
+	servp = reqp->service_ptr;
+	last_conn_id = Curr_conn_id;
+	Curr_conn_id = reqp->conn_id;
+	ptr = servp->def;
+	if(servp->type == COMMAND)
+	{
+		sprintf(str,"This is a COMMAND Service");
+		buffp = (int *)str;
+		size = 26;
+		sprintf(def,"c:26");
+		ptr = def;
+	}
+	else if( servp->user_routine != 0 ) 
+	{
+		(servp->user_routine)( &servp->tag, &buffp, &size,
+					&reqp->first_time );
+		reqp->first_time = 0;
+		
+	} 
+	else 
+	{
+		buffp = servp->address;
+		size = servp->size;
+	}
+	Curr_conn_id = last_conn_id;
+/* send even if no data but not if negative */
+	if( size  < 0)
+	{
+		reqp->delay_delete--;
+		return(0);
+	}
+	if( DIS_STAMPED_HEADER + size > Dis_packet_size ) 
+	{
+		if( Dis_packet_size )
+			free( Dis_packet );
+		Dis_packet = (DIS_STAMPED_PACKET *)malloc(DIS_STAMPED_HEADER + size);
+		if(!Dis_packet)
+		{
+			reqp->delay_delete--;
+			return(0);
+		}
+		Dis_packet_size = DIS_STAMPED_HEADER + size;
+	}
+	Dis_packet->service_id = htovl(reqp->service_id);
+	if((reqp->type & 0xFF000) == STAMPED)
+	{
+		pkt_buffer = ((DIS_STAMPED_PACKET *)Dis_packet)->buffer;
+		header_size = DIS_STAMPED_HEADER;
+		if(!servp->user_secs)
+		{
+#ifdef WIN32
+			ftime(&timebuf);
+			aux = timebuf.millitm;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl((int)timebuf.time);
+#else
+			tz = 0;
+		        gettimeofday(&tv, tz);
+			aux = tv.tv_usec / 1000;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl(tv.tv_sec);
+#endif
+		}
+		else
+		{
+			aux = /*0xc0de0000 |*/ servp->user_millisecs;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl(servp->user_secs);
+		}
+		Dis_packet->reserved[0] = htovl(0xc0dec0de);
+		Dis_packet->quality = htovl(servp->quality);
+	}
+	else
+	{
+		pkt_buffer = ((DIS_PACKET *)Dis_packet)->buffer;
+		header_size = DIS_HEADER;
+	}
+	memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+	size = copy_swap_buffer_out(reqp->format, format_data_cp, 
+		pkt_buffer,
+		buffp, size);
+	Dis_packet->size = htovl(header_size + size);
+	if( !dna_write_nowait(reqp->conn_id, Dis_packet, header_size + size) ) 
+	{
+		reqp->to_delete = 1;
+	}
+/*
+	else
+	{
+		if((reqp->type & 0xFFF) == MONITORED)
+		{
+			if(reqp->timr_ent)
+				dtq_clear_entry(reqp->timr_ent);
+		}
+	}
+*/
+	reqp->delay_delete--;
+	return(1);
+}
+
+void remove_service( int req_id )
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	static DIS_PACKET *dis_packet;
+	static int packet_size = 0;
+	int service_id;
+
+	reqp = (REQUEST *)id_get_ptr(req_id, SRC_DIS);
+	servp = reqp->service_ptr;
+	if( !packet_size ) {
+		dis_packet = (DIS_PACKET *)malloc(DIS_HEADER);
+		packet_size = DIS_HEADER;
+	}
+	service_id = (reqp->service_id | 0x80000000);
+	dis_packet->service_id = htovl(service_id);
+	dis_packet->size = htovl(DIS_HEADER);
+	if( !dna_write(reqp->conn_id, dis_packet, DIS_HEADER) ) 
+	{
+		release_conn(reqp->conn_id, 0, 0);
+	}
+}
+
+void execute_command(SERVICE *servp, DIC_PACKET *packet)
+{
+	int size;
+	int format;
+	FORMAT_STR format_data_cp[MAX_NAME/4], *formatp;
+	static int *buffer;
+	static int buffer_size = 0;
+	int add_size;
+
+	size = vtohl(packet->size) - DIC_HEADER;
+	add_size = size + (size/2);
+	if(!buffer_size)
+	{
+		buffer = (int *)malloc(add_size);
+		buffer_size = add_size;
+	} 
+	else 
+	{
+		if( add_size > buffer_size ) 
+		{
+			free(buffer);
+			buffer = (int *)malloc(add_size);
+			buffer_size = add_size;
+		}
+	}
+
+	dis_set_timestamp(servp->id, 0, 0);
+	if(servp->user_routine != 0)
+	{
+		format = vtohl(packet->format);
+		memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+		if((format & 0xF) == ((MY_FORMAT) & 0xF)) 
+		{
+			for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			{
+				if(formatp->flags & IT_IS_FLOAT)
+					formatp->flags |= (format & 0xf0);
+				formatp->flags &= 0xFFF0;	/* NOSWAP */
+			}
+		}
+		else
+		{
+			for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			{
+				if(formatp->flags & IT_IS_FLOAT)
+					formatp->flags |= (format & 0xf0);
+			}
+		}
+		size = copy_swap_buffer_in(format_data_cp, 
+						 buffer, 
+						 packet->buffer, size);
+		(servp->user_routine)(&servp->tag, buffer, &size);
+	}
+}
+
+void dis_report_service(char *serv_name)
+{
+	register SERVICE *servp;
+	register REQUEST *reqp;
+	int to_delete = 0, more;
+
+	
+	DISABLE_AST
+	servp = find_service(serv_name);
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) )
+	{
+		if((reqp->type & 0xFFF) != TIMED_ONLY)
+		{
+			execute_service(reqp->req_id);
+			if(reqp->to_delete)
+				to_delete = 1;
+		}
+	}
+	if(to_delete)
+	{
+		do
+		{
+			more = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) )
+			{
+				if(reqp->to_delete)
+				{
+					more = 1;
+					release_conn(reqp->conn_id, 1, 0);
+					break;
+				}
+			}
+		}while(more);
+	}
+	ENABLE_AST
+}
+
+int dis_update_service(unsigned service_id)
+{
+int do_update_service();
+
+	return(do_update_service(service_id,0));
+}
+
+int dis_selective_update_service(unsigned service_id, int *client_ids)
+{
+int do_update_service();
+
+	return(do_update_service(service_id, client_ids));
+}
+
+int check_client(REQUEST *reqp, int *client_ids)
+{
+	if(!client_ids)
+		return(1);
+	while(*client_ids)
+	{
+		if(reqp->conn_id == *client_ids)
+		{
+			return(1);
+		}
+		client_ids++;
+	}
+	return(0);
+}
+
+int do_update_service(unsigned service_id, int *client_ids)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	REQUEST_PTR *reqpp;
+	CLIENT *clip;
+	register int found = 0;
+	int to_delete = 0, more, conn_id;
+	char str[128];
+	int release_request();
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str, "Update Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	servp->delay_delete = 1;
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+if(Debug_on)
+{
+dim_print_date_time_millis();
+printf("Updating %s (id = %ld, ptr = %08lX) for %s@%s (req_id = %d, req_ptr = %08lX)\n",
+	   servp->name, (long)service_id, (long)servp, 
+	   Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (long)reqp);
+}
+		if(check_client(reqp, client_ids))
+			reqp->delay_delete = 1;
+	}
+	ENABLE_AST
+	{
+	DISABLE_AST
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(reqp->delay_delete && ((reqp->type & 0xFFF) != COMMAND))
+		{
+		if(check_client(reqp, client_ids))
+		{
+			if( (reqp->type & 0xFFF) != TIMED_ONLY ) 
+			{
+			  /*				DISABLE_AST
+			   */
+				execute_service(reqp->req_id);
+				found++;
+				ENABLE_AST
+				{
+				DISABLE_AST
+				}
+			}
+		}
+		}
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(check_client(reqp, client_ids))
+		{
+			reqp->delay_delete = 0;
+			if(reqp->to_delete)
+				to_delete = 1;
+		}
+	}
+	ENABLE_AST
+	}
+	if(to_delete)
+	{
+		DISABLE_AST
+		do
+		{
+			more = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) ) 
+			{
+				if(reqp->to_delete & 0x1)
+				{
+					more = 1;
+					reqp->to_delete = 0;
+					release_conn(reqp->conn_id, 1, 0);
+					break;
+				}
+				else if(reqp->to_delete & 0x2)
+				{
+					more = 1;
+					reqp->to_delete = 0;
+					reqpp = reqp->reqpp;
+					conn_id = reqp->conn_id;
+					release_request(reqp, reqpp, 1);
+					clip = find_client(conn_id);
+					if(clip)
+					{
+						if( dll_empty((DLL *)clip->requestp_head) ) 
+						{
+							release_conn( conn_id, 0, 0);
+						}
+					}
+					break;
+				}
+			}
+		}while(more);
+		ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	servp->delay_delete = 0;
+	if(servp->to_delete)
+	{
+		dis_remove_service(servp->id);
+	}
+	ENABLE_AST
+	}
+
+	return(found);
+}
+
+int dis_get_n_clients(unsigned service_id)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	register int found = 0;
+	char str[128];
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str, "Service Has Clients- Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		found++;
+	}
+	ENABLE_AST
+	return found;
+}
+
+int dis_get_timeout(unsigned service_id, int client_id)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	char str[128];
+
+	if(!service_id)
+	{
+		sprintf(str,"Get Timeout - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		return(-1);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		return(-1);
+	}
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(reqp->conn_id == client_id)
+			return(reqp->timeout);
+	}
+	return(-1);
+}
+
+void dis_set_quality( unsigned serv_id, int quality )
+{
+	register SERVICE *servp;
+	char str[128];
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Set Quality - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return;
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return;
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return;
+	}
+	servp->quality = quality;
+	ENABLE_AST
+}
+
+int dis_set_timestamp( unsigned serv_id, int secs, int millisecs )
+{
+	register SERVICE *servp;
+	char str[128];
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Set Timestamp - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return(0);
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(secs == 0)
+	{
+#ifdef WIN32
+			ftime(&timebuf);
+			servp->user_secs = (int)timebuf.time;
+			servp->user_millisecs = timebuf.millitm;
+#else
+			tz = 0;
+		    gettimeofday(&tv, tz);
+			servp->user_secs = tv.tv_sec;
+			servp->user_millisecs = tv.tv_usec / 1000;
+#endif
+	}
+	else
+	{
+		servp->user_secs = secs;
+/*
+		servp->user_millisecs = (millisecs & 0xffff);
+*/
+		servp->user_millisecs = millisecs;
+	}
+	ENABLE_AST
+	return(1);
+}
+
+int dis_get_timestamp( unsigned serv_id, int *secs, int *millisecs )
+{
+	register SERVICE *servp;
+	char str[128];
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Get Timestamp - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return(0);
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->user_secs)
+	{
+		*secs = servp->user_secs;
+		*millisecs = servp->user_millisecs;
+	}
+	else
+	{
+		*secs = 0;
+		*millisecs = 0;
+	}
+	ENABLE_AST
+	return(1);
+}
+
+void dis_send_service(unsigned service_id, int *buffer, int size)
+{
+	register REQUEST *reqp, *prevp;
+	register SERVICE *servp;
+	static DIS_PACKET *dis_packet;
+	static int packet_size = 0;
+	int conn_id;
+	char str[128];
+
+	DISABLE_AST
+	if( !service_id ) {
+		sprintf(str,"Send Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return;
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!packet_size)
+	{
+		dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
+		packet_size = DIS_HEADER + size;
+	} 
+	else 
+	{
+		if( DIS_HEADER+size > packet_size ) 
+		{
+			free(dis_packet);
+			dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
+			packet_size = DIS_HEADER+size;
+		}
+	}
+	prevp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) prevp)) ) 
+	{
+		dis_packet->service_id = htovl(reqp->service_id);
+		memcpy(dis_packet->buffer, buffer, size);
+		dis_packet->size = htovl(DIS_HEADER + size);
+
+		conn_id = reqp->conn_id;
+		if( !dna_write_nowait(conn_id, dis_packet, size + DIS_HEADER) )
+		{
+			release_conn(conn_id, 1, 0);
+		}
+		else
+			prevp = reqp;
+	}
+	ENABLE_AST
+}
+
+int dis_remove_service(unsigned service_id)
+{
+	register REQUEST *reqp, *auxp;
+	register SERVICE *servp;
+	REQUEST_PTR *reqpp;
+	int found = 0;
+	char str[128];
+	int release_request();
+	int dis_hash_service_remove();
+	DIS_DNS_CONN *dnsp;
+	int n_services;
+	void do_dis_stop_serving_dns(DIS_DNS_CONN *);
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str,"Remove Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->delay_delete)
+	{
+		servp->to_delete = 1;
+		ENABLE_AST
+		return(found);
+	}
+	/* remove from name server */
+	
+	dnsp = servp->dnsp;
+	unregister_service(dnsp, servp);
+	/* Release client requests and remove from actual clients */
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) )
+	{
+		remove_service(reqp->req_id);
+		auxp = reqp->prev;
+		reqpp = (REQUEST_PTR *) reqp->reqpp;
+		release_request(reqp, reqpp, 1);
+		found = 1;
+		reqp = auxp;
+	}
+	if(servp->id == (int)dnsp->dis_service_id)
+	  dnsp->dis_service_id = 0;
+	if(servp->id == (int)dnsp->dis_client_id)
+	  dnsp->dis_client_id = 0;
+	dis_hash_service_remove(servp);
+	id_free(servp->id, SRC_DIS);
+	free(servp->request_head);
+	free(servp);
+/*
+	if(dnsp != Default_DNS)
+	{
+		dnsp->dis_n_services--;
+		n_services = dnsp->dis_n_services;
+	}
+	else
+	{
+		Dis_n_services--;
+		n_services = Dis_n_services;
+	}
+*/
+	dnsp->dis_n_services--;
+	n_services = dnsp->dis_n_services;
+
+	ENABLE_AST
+	if(dnsp->serving)
+	{
+		if(n_services == 5)
+		{
+/*
+			dis_stop_serving();
+*/
+			do_dis_stop_serving_dns(dnsp);
+		}
+	}
+	return(found);
+}
+
+void do_dis_stop_serving_dns(DIS_DNS_CONN *dnsp)
+{
+register SERVICE *servp, *prevp;
+void dim_stop_threads(void);
+int dis_no_dns();
+int hash_index, old_index;
+
+	dnsp->serving = 0;
+	dis_init();
+/*
+	dis_hash_service_init();
+	prevp = 0;
+	if(Dis_conn_id)
+	{
+		dna_close(Dis_conn_id);
+		Dis_conn_id = 0;
+	}
+*/
+	{
+	DISABLE_AST
+	if(dnsp->dns_timr_ent)
+	{
+		dtq_rem_entry(Dis_timer_q, dnsp->dns_timr_ent);
+		dnsp->dns_timr_ent = NULL;
+	}
+	if(dnsp->dns_dis_conn_id)
+	{
+		dna_close(dnsp->dns_dis_conn_id);
+		dnsp->dns_dis_conn_id = 0;
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	prevp = 0;
+	hash_index = -1;
+	old_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, prevp, 0)) )
+	{
+		if(servp->dnsp == dnsp)
+		{
+			dis_remove_service(servp->id);
+			if(old_index != hash_index)
+				prevp = 0;
+		}
+		else
+		{
+			prevp = servp;
+			old_index = hash_index;
+		}
+	}
+	ENABLE_AST
+	}
+	dnsp->dis_first_time = 1;
+/*
+	if(dnsp != Default_DNS)
+	{
+		dll_remove(dnsp);
+		free(dnsp);
+	}
+*/
+/*
+	if(dll_empty(DNS_head))
+*/
+	if(dis_no_dns())
+		dis_stop_serving();
+}
+
+void dis_stop_serving_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp, *dis_find_dns();
+
+	dnsp = dis_find_dns(dnsid);
+	do_dis_stop_serving_dns(dnsp);
+}
+
+void dis_stop_serving()
+{
+register SERVICE *servp, *prevp;
+void dim_stop_threads(void);
+int hash_index;
+
+	Serving = 0;
+	dis_init();
+	if(Dis_conn_id)
+	{
+		dna_close(Dis_conn_id);
+		Dis_conn_id = 0;
+	}
+/*
+	if(Dns_dis_conn_id)
+	{
+		dna_close(Dns_dis_conn_id);
+		Dns_dis_conn_id = 0;
+	}
+*/
+	{
+		DISABLE_AST
+	prevp = 0;
+	hash_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, prevp, 0)) )
+	{
+		dis_remove_service(servp->id);
+		prevp = 0;
+	}
+	ENABLE_AST
+	}
+/*
+	if(Dis_conn_id)
+		dna_close(Dis_conn_id);
+	if(Dns_dis_conn_id)
+		dna_close(Dns_dis_conn_id);
+	Dns_dis_conn_id = 0;
+*/
+	Dis_first_time = 1;
+/*
+	if(Dns_timr_ent)
+	{
+		dtq_rem_entry(Dis_timer_q, Dns_timr_ent);
+		Dns_timr_ent = NULL;
+	}
+*/
+	dtq_delete(Dis_timer_q);
+	Dis_timer_q = 0;
+	dim_stop_threads();
+}
+
+/* find service by name */
+SERVICE *find_service(char *name)
+{
+	return(dis_hash_service_exists(name));
+}
+
+CLIENT *find_client(int conn_id)
+{
+	register CLIENT *clip;
+
+	clip = (CLIENT *)
+			dll_search( (DLL *) Client_head, &conn_id, sizeof(conn_id));
+	return(clip);
+}
+
+void release_all_requests(int conn_id, CLIENT *clip)
+{
+	register REQUEST_PTR *reqpp, *auxp;
+	register REQUEST *reqp;
+    int found = 0;
+	int release_request();
+	DIS_DNS_CONN *dnsp;
+
+	DISABLE_AST;
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			auxp = reqpp->prev;
+			reqp = (REQUEST *) reqpp->reqp;
+			release_request(reqp, reqpp, 0);
+			found = 1;
+			reqpp = auxp;
+		}
+		dnsp = clip->dnsp;
+		dll_remove(clip);
+		free(clip->requestp_head);
+		free(clip);
+	}
+	if(found)
+	{
+		Last_client = -conn_id;
+		if(dnsp->dis_client_id)
+		  dis_update_service(dnsp->dis_client_id);
+	}
+	dna_close(conn_id);
+	ENABLE_AST;
+}
+
+CLIENT *check_delay_delete(int conn_id)
+{
+	register REQUEST_PTR *reqpp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	int found = 0;
+
+	DISABLE_AST;
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			if(reqp->delay_delete)
+			{
+				reqp->to_delete = 1;
+				found = 1;
+			}
+		}
+	}
+	ENABLE_AST;
+	if(found)
+	{
+		return((CLIENT *)-1);
+	}
+	return(clip);
+}
+
+char *dis_get_error_services()
+{
+	return(dis_get_client_services(Error_conn_id));
+}
+
+char *dis_get_client_services(int conn_id)
+{
+	register REQUEST_PTR *reqpp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	register SERVICE *servp;
+
+	int n_services = 0;
+	int max_size;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+
+
+	if(!conn_id)
+		return((char *)0);
+	{
+	DISABLE_AST;
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)))
+		{
+			n_services++;
+		}
+		if(!n_services)
+		{
+			ENABLE_AST
+			return((char *)0);
+		}
+		max_size = n_services * MAX_NAME;
+		if(!curr_allocated_size)
+		{
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		else if (max_size > curr_allocated_size)
+		{
+			free(service_info_buffer);
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		service_info_buffer[0] = '\0';
+		buff_ptr = service_info_buffer;
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			servp = reqp->service_ptr;
+			strcat(buff_ptr, servp->name);
+			strcat(buff_ptr, "\n");
+			buff_ptr += strlen(buff_ptr);
+		}
+	}
+	else
+	{
+		ENABLE_AST
+		return((char *)0);
+	}
+	ENABLE_AST;
+	}
+/*
+	dim_print_date_time();
+	dna_get_node_task(conn_id, node, task);
+	printf("Client %s@%s uses services: \n", task, node);
+	printf("%s\n",service_info_buffer);
+*/
+	return(service_info_buffer);
+}
+
+int find_release_request(int conn_id, int service_id)
+{
+	register REQUEST_PTR *reqpp, *auxp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	int release_request();
+
+	DISABLE_AST
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			if(reqp->service_id == service_id)
+			{
+				if(reqp->delay_delete)
+				{
+					reqp->to_delete += 0x2;
+				}
+				else
+				{
+					auxp = reqpp->prev;
+					release_request(reqp, reqpp, 0);
+					reqpp = auxp;
+				}
+			}
+		}
+		if( dll_empty((DLL *)clip->requestp_head) ) 
+		{
+			release_conn( conn_id, 0, 0 );
+		}
+	}
+	ENABLE_AST
+	return(1);
+}
+
+int release_request(REQUEST *reqp, REQUEST_PTR *reqpp, int remove)
+{
+	int conn_id;
+	CLIENT *clip;
+
+	DISABLE_AST
+	conn_id = reqp->conn_id;
+	if(reqpp)
+		dll_remove((DLL *)reqpp);
+	dll_remove((DLL *)reqp);
+	if(reqp->timr_ent)
+		dtq_rem_entry(Dis_timer_q, reqp->timr_ent);
+	id_free(reqp->req_id, SRC_DIS);
+	free(reqp);
+	free(reqpp);
+/* Would do it too early, the client will disconnect anyway
+*/
+	if((remove) && (!Serving))
+	{
+		clip = find_client(conn_id);
+		if(clip)
+		{
+			if( dll_empty((DLL *)clip->requestp_head) ) 
+			{
+				release_conn( conn_id, 0, 0);
+			}
+		}
+	}
+
+	ENABLE_AST
+	return(1);
+}
+
+static int release_conn(int conn_id, int print_flg, int dns_flag)
+{
+	static int releasing = 0;
+	CLIENT *clip;
+	int do_exit_handler();
+
+	DISABLE_AST
+	if(print_flg){}
+	if(dns_flag)
+	{
+		recv_dns_dis_rout( conn_id, 0, 0, STA_DISC );
+		ENABLE_AST
+		return(0);
+	}
+#ifdef VMS
+	if(print_flg)
+	{
+		dim_print_date_time();
+		dna_get_node_task(conn_id, node, task);
+		printf(" Couldn't write to client %s@%s, releasing connection %d\n",
+			task, node, conn_id);
+		fflush(stdout);
+	}
+#endif
+	clip = check_delay_delete(conn_id);
+	if(clip != (CLIENT *)-1)
+	{
+		if( Client_exit_user_routine != 0 ) 
+		{
+			releasing++;
+			Curr_conn_id = conn_id;
+			do_exit_handler(conn_id);
+			releasing--;
+		}
+		if(!releasing)
+		{
+			release_all_requests(conn_id, clip);
+		}
+	}
+	ENABLE_AST
+	return(1);
+}
+
+typedef struct cmnds{
+	struct cmnds *next;
+	long tag;
+	int size;
+	int buffer[1];
+} DIS_CMND;
+
+static DIS_CMND *Cmnds_head = (DIS_CMND *)0;
+
+void std_cmnd_handler(long *tag, int *cmnd_buff, int *size)
+{
+	register DIS_CMND *new_cmnd;
+/* queue the command */
+
+	if(!Cmnds_head)
+	{
+		Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
+		sll_init((SLL *) Cmnds_head);
+	}
+	new_cmnd = (DIS_CMND *)malloc((*size)+12);
+	new_cmnd->next = 0;
+	new_cmnd->tag = *tag;
+	new_cmnd->size = *size;
+	memcpy(new_cmnd->buffer, cmnd_buff, *size);
+	sll_insert_queue((SLL *) Cmnds_head, (SLL *) new_cmnd);
+}
+
+int dis_get_next_cmnd(long *tag, int *buffer, int *size)
+{
+	register DIS_CMND *cmndp;
+	register int ret_val = -1;
+
+	DISABLE_AST
+	if(!Cmnds_head)
+	{
+		Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
+		sll_init((SLL *) Cmnds_head);
+	}
+	if(*size == 0)
+	{
+		if( (cmndp = (DIS_CMND *) sll_get_head((SLL *) Cmnds_head)))
+		{
+			if(cmndp->size > 0)
+			{
+				*size = cmndp->size;
+				*tag = cmndp->tag;
+				ENABLE_AST
+				return(-1);
+			}
+		}
+	}
+	if( (cmndp = (DIS_CMND *) sll_remove_head((SLL *) Cmnds_head)) )
+	{
+		if (*size >= cmndp->size)
+		{
+			*size = cmndp->size;
+			ret_val = 1;
+		}
+		memcpy(buffer, cmndp->buffer, *size);
+		*tag = cmndp->tag;
+		free(cmndp);
+		ENABLE_AST
+		return(ret_val);
+	}
+	ENABLE_AST
+	return(0);
+}
+
+int dis_get_conn_id()
+{
+	return(Curr_conn_id);
+}
+
+int dis_get_client(char *name)
+{
+	int ret = 0;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+
+	DISABLE_AST
+
+	if(Curr_conn_id)
+	{
+		dna_get_node_task(Curr_conn_id, node, task);
+		strcpy(name,task);
+		strcat(name,"@");
+		strcat(name,node);
+		ret = Curr_conn_id;
+	}
+	ENABLE_AST
+	return(ret);
+}
+
+#ifdef VMS
+dis_convert_str(c_str, for_str)
+char *c_str;
+struct dsc$descriptor_s *for_str;
+{
+	int i;
+
+	strcpy(for_str->dsc$a_pointer, c_str);
+	for(i = strlen(c_str); i< for_str->dsc$w_length; i++)
+		for_str->dsc$a_pointer[i] = ' ';
+}
+#endif
+
+void client_info(long *tag, int **bufp, int *size, int *first_time)
+{
+	register CLIENT *clip;
+	int curr_conns[MAX_CONNS];
+	int i, index, max_size;
+	static int curr_allocated_size = 0;
+	static char *dns_info_buffer;
+	register char *dns_client_info;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+	DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
+
+	max_size = sizeof(DNS_CLIENT_INFO);
+	if(!curr_allocated_size)
+	{
+		dns_info_buffer = malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	dns_client_info = dns_info_buffer;
+	dns_client_info[0] = '\0';
+	index = 0;
+	if(*first_time)
+	{
+		clip = Client_head;
+		while( (clip = (CLIENT *)dll_get_next( (DLL *) Client_head, 
+			(DLL*) clip)) )
+		{
+			if(clip->dnsp != dnsp)
+				continue;
+			curr_conns[index++] = clip->conn_id;
+		}
+		max_size = (index+1)*sizeof(DNS_CLIENT_INFO);
+		if (max_size > curr_allocated_size)
+		{
+			free(dns_info_buffer);
+			dns_info_buffer = malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		dns_client_info = dns_info_buffer;
+		dns_client_info[0] = '\0';
+	}
+	else
+	{
+		if(Last_client > 0)
+		{
+			strcat(dns_client_info,"+");
+			curr_conns[index++] = Last_client;
+		}
+		else
+		{
+			strcat(dns_client_info,"-");
+			curr_conns[index++] = -Last_client;
+		}
+	}
+	
+	for(i=0; i<index;i++)
+	{
+		dna_get_node_task(curr_conns[i], node, task);
+		strcat(dns_client_info,task);
+		strcat(dns_client_info,"@");
+		strcat(dns_client_info,node);
+		strcat(dns_client_info,"|");
+	}
+	if(index)
+		dns_client_info[strlen(dns_client_info)-1] = '\0';
+	*bufp = (int *)dns_info_buffer;
+	*size = strlen(dns_info_buffer)+1;
+}
+
+void append_service(char *service_info_buffer, SERVICE *servp)		
+{
+	char name[MAX_NAME], *ptr;
+
+		if(strstr(servp->name,"/RpcIn"))
+		{
+			strcpy(name,servp->name);
+			ptr = (char *)strstr(name,"/RpcIn");
+			*ptr = 0;
+			strcat(service_info_buffer, name);
+			strcat(service_info_buffer, "|");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(name,"/RpcOut");
+			if( (servp = find_service(name)) )
+			{
+				strcat(service_info_buffer, ",");
+				if(servp->def[0])
+				{
+					strcat(service_info_buffer, servp->def);
+				}
+			}
+			strcat(service_info_buffer, "|RPC");
+			strcat(service_info_buffer, "\n");
+		}
+		else if(strstr(servp->name,"/RpcOut"))
+		{
+/*
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(service_info_buffer, "|RPC");
+			strcat(service_info_buffer, "\n");
+
+*/
+		}
+		else
+		{
+			strcat(service_info_buffer, servp->name);
+			strcat(service_info_buffer, "|");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(service_info_buffer, "|");
+			if(servp->type == COMMAND)
+			{
+				strcat(service_info_buffer, "CMD");
+			}
+			strcat(service_info_buffer, "\n");
+		}
+}
+
+void service_info(long *tag, int **bufp, int *size, int *first_time)
+{
+	register SERVICE *servp;
+	int max_size, done = 0;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+	DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
+	int hash_index;
+
+	DISABLE_AST
+	max_size = (dnsp->dis_n_services+10) * (MAX_NAME*2 + 4);
+	if(!curr_allocated_size)
+	{
+		service_info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	else if (max_size > curr_allocated_size)
+	{
+		free(service_info_buffer);
+		service_info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	service_info_buffer[0] = '\0';
+	buff_ptr = service_info_buffer;
+	servp = 0;
+	hash_index = -1;
+	if(*first_time)
+	{
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+		{
+			if(servp->dnsp != dnsp)
+				continue;
+			if(servp->registered)
+			{
+				servp->registered = 2;
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+			}
+		}
+	}
+	else
+	{
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+		{
+			if(servp->dnsp != dnsp)
+				continue;
+			if(servp->registered == 1)
+			{
+				if(!done)
+				{
+					strcat(buff_ptr, "+");
+					buff_ptr += strlen(buff_ptr);
+					done = 1;
+				}
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+				servp->registered = 2;
+			}
+			else if(servp->registered == 0)
+			{
+				strcat(buff_ptr, "-");
+				buff_ptr += strlen(buff_ptr);
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+			}
+		}
+	}
+	*bufp = (int *)service_info_buffer;
+	*size = buff_ptr - service_info_buffer+1;
+	ENABLE_AST
+}
+		
+void add_exit_handler(int *tag, int *bufp, int *size)
+{
+	EXIT_H *newp;
+
+	if(size){}
+	if(tag){}
+	if(*bufp)
+	{
+		if(!Exit_h_head) 
+		{
+			Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H));
+			sll_init( (SLL *) Exit_h_head );
+		}
+		newp = (EXIT_H *)malloc(sizeof(EXIT_H));
+		newp->conn_id = Curr_conn_id;
+		newp->exit_id = *bufp;
+		sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp );
+	}
+	else
+	{
+		if(!Exit_h_head) 
+			return;
+		if((newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&Curr_conn_id, 4)) )
+		{
+			sll_remove( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+}
+
+void dis_set_client_exit_handler(int conn_id, int tag)
+{
+	EXIT_H *newp;
+
+	DISABLE_AST
+	if(tag)
+	{
+		if(!Exit_h_head) 
+		{
+			Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H));
+			sll_init( (SLL *) Exit_h_head );
+		}
+		if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&conn_id, 4)) )
+		{
+			newp->conn_id = conn_id;
+			newp->exit_id = tag;
+		}
+		else
+		{
+			newp = (EXIT_H *)malloc(sizeof(EXIT_H));
+			newp->conn_id = conn_id;
+			newp->exit_id = tag;
+			sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+	else
+	{
+		if(!Exit_h_head) 
+		{
+			ENABLE_AST
+			return;
+		}
+		if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&conn_id, 4)) )
+		{
+			sll_remove( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+	ENABLE_AST
+}
+
+int do_exit_handler(int conn_id)
+{
+	register EXIT_H *exitp;
+
+	DISABLE_AST;
+	if(!Exit_h_head)
+	{
+		ENABLE_AST;
+		return(0);
+	}
+	while( (exitp = (EXIT_H *) sll_search_next_remove((SLL *) Exit_h_head,
+							 0, (char *) &conn_id, 4)) )
+	{
+		(Client_exit_user_routine)( &exitp->exit_id );
+		free(exitp);
+	}
+	ENABLE_AST
+	return(1);
+}
+
+static void exit_handler(int *tag, int *bufp, int *size)
+{
+
+	if(size){}
+	if(tag){}
+	if(Exit_user_routine)
+		(Exit_user_routine)( bufp );
+	else
+	{
+/*
+		printf("%s PID %d Exiting!\n", Task_name, getpid());
+*/
+		exit(*bufp);
+	}
+}
+
+static void error_handler(int conn_id, int severity, int errcode, char *reason)
+{
+	int exit_tag, exit_code, exit_size;
+	int last_conn_id;
+
+	if(Error_user_routine)
+	{
+			Error_conn_id = conn_id;
+			last_conn_id = Curr_conn_id;
+			Curr_conn_id = conn_id;
+			(Error_user_routine)( severity, errcode, reason);
+			Error_conn_id = 0;
+			Curr_conn_id = last_conn_id;
+	}
+	else
+	{
+		dim_print_msg(reason, severity);
+	}
+	if(severity == DIM_FATAL)
+	{
+		exit_tag = 0;
+		exit_code = errcode;
+		exit_size = sizeof(int);
+		exit_handler(&exit_tag, &exit_code, &exit_size);
+	}
+}
+/*
+#define MAX_HASH_ENTRIES 2000
+*/
+#define MAX_HASH_ENTRIES 5000
+
+static SERVICE *Service_hash_table[MAX_HASH_ENTRIES];
+static int Service_new_entries[MAX_HASH_ENTRIES];
+
+int dis_hash_service_init()
+{
+  int i;
+  static int done = 0;
+
+  if(!done)
+  {
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		Service_hash_table[i] = (SERVICE *) malloc(8);
+		dll_init((DLL *) Service_hash_table[i]);
+		Service_new_entries[i] = 0;
+	}
+	done = 1;
+  }
+  return(1);
+}
+
+int dis_hash_service_insert(SERVICE *servp)
+{
+	int index;
+	index = HashFunction(servp->name, MAX_HASH_ENTRIES);
+	Service_new_entries[index]++;
+	dll_insert_queue((DLL *) Service_hash_table[index], 
+			 (DLL *) servp);
+	return(1);
+}
+
+int dis_hash_service_registered(int index, SERVICE *servp)
+{
+	servp->registered = 1;
+	Service_new_entries[index]--;
+	if(Service_new_entries[index] < 0)
+		Service_new_entries[index] = 0;
+	return 1;
+}
+
+int dis_hash_service_remove(SERVICE *servp)
+{
+	dll_remove( (DLL *) servp );
+	return(1);
+}
+
+
+SERVICE *dis_hash_service_exists(char *name)
+{
+	int index;
+	SERVICE *servp;
+
+	index = HashFunction(name, MAX_HASH_ENTRIES);
+	if( (servp = (SERVICE *) dll_search(
+					(DLL *) Service_hash_table[index],
+			      		name, strlen(name)+1)) )
+	{
+		return(servp);
+	}
+	return((SERVICE *)0);
+}			
+
+SERVICE *dis_hash_service_get_next(int *curr_index, SERVICE *prevp, int new_entries)
+{
+	int index;
+	SERVICE *servp = 0;
+/*
+	if(!prevp)
+	{
+		index = -1;
+	}
+*/
+	index = *curr_index;
+	if(index == -1)
+	{
+		index++;
+		prevp = Service_hash_table[index];
+	}
+	if(!prevp)
+	{
+		prevp = Service_hash_table[index];
+	}
+	do
+	{
+		if((!new_entries) || (Service_new_entries[index] > 0))
+		{
+			servp = (SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[index],
+						(DLL *) prevp);
+			if(servp)
+				break;
+		}
+		index++;
+		if(index == MAX_HASH_ENTRIES)
+		{
+			*curr_index = -1;
+			return((SERVICE *) 0);
+		}
+		prevp = Service_hash_table[index];
+	} while(!servp);
+	*curr_index = index;
+	return(servp);
+}
+
+DIS_DNS_CONN *dis_find_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = (DIS_DNS_CONN *)
+			dll_search( (DLL *) DNS_head, &dnsid, sizeof(dnsid));
+/*
+	if(!dnsp)
+	{
+		dnsp = create_dns(dnsid);
+	}
+*/
+	return dnsp;
+}
+
+int dis_no_dns()
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = (DIS_DNS_CONN *) DNS_head;
+	while ( (dnsp = (DIS_DNS_CONN *) dll_get_next( (DLL *) DNS_head, (DLL *) dnsp)))
+	{
+/*
+		if(dnsp != Default_DNS)
+			return 0;
+*/
+		if(dnsp->serving)
+			return 0;
+	}
+	return 1;
+}
+
+DIS_DNS_CONN *find_dns_by_conn_id(int conn_id)
+{
+	DIS_DNS_CONN *dnsp;
+	extern long dns_get_dnsid();
+	long dnsid;
+
+	dnsid = dns_get_dnsid(conn_id, SRC_DIS);
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = Default_DNS;
+	return (DIS_DNS_CONN *)dnsp;
+}
+
+void dis_print_hash_table()
+{
+	SERVICE *servp;
+	int i;
+	int n_entries, max_entry_index = 0;
+	int max_entries = 0;
+
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		n_entries = 0;
+		servp = Service_hash_table[i];
+		while( (servp = (SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[i],
+						(DLL *) servp)) )
+		{
+			n_entries++;
+			if(n_entries == 1)
+				printf("    Name = %s\n",servp->name);
+		}
+		if(n_entries != 0)
+			printf("HASH[%d] - %d entries\n", i, n_entries);
+		if(n_entries > max_entries)
+		{
+			max_entries = n_entries;
+			max_entry_index = i;
+		}
+	}
+	printf("Maximum : HASH[%d] - %d entries\n", max_entry_index, max_entries);  
+	fflush(stdout);
+}
+
+void dis_hash_print()
+{
+	SERVICE *servp;
+	int hash_index;
+
+	servp = 0;
+	hash_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+	{
+		printf("Name = %s\n",servp->name);
+	}
+}
+
+#ifdef VMS
+/* CFORTRAN WRAPPERS */
+FCALLSCFUN1(INT, dis_start_serving, DIS_START_SERVING, dis_start_serving,
+				 STRING)
+FCALLSCFUN3(INT, dis_get_next_cmnd, DIS_GET_NEXT_CMND, dis_get_next_cmnd,
+				 PINT, PVOID, PINT)
+FCALLSCFUN1(INT, dis_get_client, DIS_GET_CLIENT, dis_get_client,
+				 PSTRING)
+FCALLSCFUN6(INT, dis_add_service, DIS_ADD_SERVICE, dis_add_service,
+				 STRING, PVOID, PVOID, INT, PVOID, INT)
+FCALLSCSUB4(	 dis_add_cmnd, DIS_ADD_CMND, dis_add_cmnd,
+				 STRING, PVOID, PVOID, INT)
+FCALLSCSUB1(	 dis_add_client_exit_handler, DIS_ADD_CLIENT_EXIT_HANDLER, 
+				 dis_add_client_exit_handler,
+				 PVOID)
+FCALLSCSUB2(	 dis_set_client_exit_handler, DIS_SET_CLIENT_EXIT_HANDLER, 
+				 dis_set_client_exit_handler,
+				 INT, INT)
+FCALLSCSUB1(	 dis_add_exit_handler, DIS_ADD_EXIT_HANDLER, 
+				 dis_add_exit_handler,
+				 PVOID)
+FCALLSCSUB1(	 dis_report_service, DIS_REPORT_SERVICE, dis_report_service,
+				 STRING)
+FCALLSCSUB2(	 dis_convert_str, DIS_CONVERT_STR, dis_convert_str,
+				 PVOID, PVOID)
+FCALLSCFUN1(INT, dis_update_service, DIS_UPDATE_SERVICE, dis_update_service,
+				 INT)
+FCALLSCFUN1(INT, dis_remove_service, DIS_REMOVE_SERVICE, dis_remove_service,
+				 INT)
+FCALLSCSUB3(	 dis_send_service, DIS_SEND_SERVICE, dis_send_service,
+				 INT, PVOID, INT)
+FCALLSCSUB2(	 dis_set_quality, DIS_SET_QUALITY, dis_set_quality,
+                 INT, INT)
+FCALLSCSUB3(INT, dis_set_timestamp, DIS_SET_TIMESTAMP, dis_set_timestamp,
+                 INT, INT, INT)
+FCALLSCFUN2(INT, dis_selective_update_service, DIS_SELECTIVE_UPDATE_SERVICE, 
+				 dis_selective_update_service,
+				 INT, PINT)
+FCALLSCSUB3(INT, dis_get_timestamp, DIS_GET_TIMESTAMP, dis_get_timestamp,
+                 INT, PINT, PINT)
+#endif
Index: /trunk/FACT++/dim_v19r15/src/dis_old.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dis_old.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dis_old.c	(revision 10183)
@@ -0,0 +1,3091 @@
+/*
+ * DIS (Delphi Information Server) Package implements a library of
+ * routines to be used by servers.
+ *
+ * Started on		 : 10-11-91
+ * Last modification : 28-07-94
+ * Written by		 : C. Gaspar
+ * Adjusted by	     : G.C. Ballintijn
+ *
+ */
+
+#ifdef VMS
+#	include <lnmdef.h>
+#	include <ssdef.h>
+#	include <descrip.h>
+#	include <cfortran.h>
+#endif
+/*
+#define DEBUG
+*/
+#include <time.h>
+#ifdef VAX
+#include <timeb.h>
+#else
+#include <sys/timeb.h>
+#endif
+
+#define DIMLIB
+#include <dim.h>
+#include <dis.h>
+
+#define ALL 0
+#define MORE 1
+#define NONE 2
+
+typedef struct dis_dns_ent {
+	struct dis_dns_ent *next;
+	struct dis_dns_ent *prev;
+	long dnsid;
+	char task_name[MAX_NAME];
+	TIMR_ENT *dns_timr_ent;
+	DIS_DNS_PACKET dis_dns_packet;
+	int dis_n_services;
+	int dns_dis_conn_id;
+	int dis_first_time;
+	int serving;
+	unsigned int dis_service_id;
+	unsigned int dis_client_id;
+	int updating_service_list;
+} DIS_DNS_CONN;
+
+typedef struct req_ent {
+	struct req_ent *next;
+	struct req_ent *prev;
+	int conn_id;
+	int service_id;
+	int req_id;
+	int type;
+	struct serv *service_ptr;
+	int timeout;
+	int format;
+	int first_time;
+	int delay_delete;
+	int to_delete;
+	TIMR_ENT *timr_ent;
+	struct reqp_ent *reqpp;
+} REQUEST;
+
+typedef struct serv {
+	struct serv *next;
+	struct serv *prev;
+	char name[MAX_NAME];
+	int id;
+	int type;
+	char def[MAX_NAME];
+	FORMAT_STR format_data[MAX_NAME/4];
+	int *address;
+	int size;
+	void (*user_routine)();
+	long tag;
+	int registered;
+	int quality;
+	int user_secs;
+	int user_millisecs;
+	int tid;
+	REQUEST *request_head;
+	DIS_DNS_CONN *dnsp;
+	int delay_delete;
+	int to_delete;
+} SERVICE;
+
+typedef struct reqp_ent {
+	struct reqp_ent *next;
+	struct reqp_ent *prev;
+	REQUEST *reqp;
+} REQUEST_PTR;
+
+typedef struct cli_ent {
+	struct cli_ent *next;
+	struct cli_ent *prev;
+	int conn_id;
+	REQUEST_PTR *requestp_head; 
+	DIS_DNS_CONN *dnsp;
+} CLIENT;
+
+static CLIENT *Client_head = (CLIENT *)0;	
+
+static DIS_DNS_CONN *DNS_head = (DIS_DNS_CONN *)0;	
+
+/*
+static char Task_name[MAX_NAME];
+static TIMR_ENT *Dns_timr_ent = (TIMR_ENT *)0;
+static DIS_DNS_PACKET Dis_dns_packet = {0, 0, {0}};
+static int Dis_n_services = 0;
+*/
+static int Dis_first_time = 1;
+/*
+static int Dns_dis_conn_id = 0;
+*/
+static int Protocol;
+static int Port_number;
+static int Dis_conn_id = 0;
+static int Curr_conn_id = 0;
+static int Serving = 0;
+static void (*Client_exit_user_routine)() = 0;
+static void (*Exit_user_routine)() = 0;
+static void (*Error_user_routine)() = 0;
+static int Error_conn_id = 0;
+DIS_DNS_CONN *Default_DNS = 0;
+
+typedef struct exit_ent {
+	struct exit_ent *next;
+	int conn_id;
+	int exit_id;
+} EXIT_H;
+
+static EXIT_H *Exit_h_head = (EXIT_H *)0;
+
+/* Do not forget to increase when this file is modified */
+static int Version_number = DIM_VERSION_NUMBER;
+static int Dis_timer_q = 0;
+static int Threads_off = 0;
+/*
+static unsigned int Dis_service_id, Dis_client_id;
+static int Updating_service_list = 0;
+*/
+static int Last_client;
+
+#ifdef DEBUG
+static int Debug_on = 1;
+#else
+static int Debug_on = 0;
+#endif
+
+_DIM_PROTO( static void dis_insert_request, (int conn_id, DIC_PACKET *dic_packet,
+				  int size, int status ) );
+_DIM_PROTO( int execute_service,	(int req_id) );
+_DIM_PROTO( void execute_command,	(SERVICE *servp, DIC_PACKET *packet) );
+_DIM_PROTO( void register_dns_services,  (int flag) );
+_DIM_PROTO( void register_services,  (DIS_DNS_CONN *dnsp, int flag, int dns_flag) );
+_DIM_PROTO( void std_cmnd_handler,   (long *tag, int *cmnd_buff, int *size) );
+_DIM_PROTO( void client_info,		(long *tag, int **bufp, int *size) );
+_DIM_PROTO( void service_info,	   (long *tag, int **bufp, int *size) );
+_DIM_PROTO( void add_exit_handler,   (int *tag, int *bufp, int *size) );
+_DIM_PROTO( static void exit_handler,	   (int *tag, int *bufp, int *size) );
+_DIM_PROTO( static void error_handler,	   (int conn_id, int severity, int errcode, char *reason) );
+_DIM_PROTO( SERVICE *find_service,   (char *name) );
+_DIM_PROTO( CLIENT *find_client,   (int conn_id) );
+_DIM_PROTO( static int get_format_data, (FORMAT_STR *format_data, char *def) );
+_DIM_PROTO( static int release_conn, (int conn_id, int print_flag, int dns_flag) );
+_DIM_PROTO( SERVICE *dis_hash_service_exists, (char *name) );
+_DIM_PROTO( SERVICE *dis_hash_service_get_next, (int *start, SERVICE *prev, int flag) );
+_DIM_PROTO( static unsigned do_dis_add_service_dns, (char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag, long dnsid ) );
+_DIM_PROTO( static DIS_DNS_CONN *create_dns, (long dnsid) );
+
+void dis_set_debug_on()
+{
+	Debug_on = 1;
+}
+
+void dis_set_debug_off()
+{
+	Debug_on = 0;
+}
+
+void dis_no_threads()
+{
+	Threads_off = 1;
+}
+
+static DIS_STAMPED_PACKET *Dis_packet = 0;
+static int Dis_packet_size = 0;
+
+int dis_set_buffer_size(int size)
+{
+	if(Dis_packet_size)
+		free(Dis_packet);
+	Dis_packet = (DIS_STAMPED_PACKET *)malloc(DIS_STAMPED_HEADER + size);
+	if(Dis_packet)
+	{
+		Dis_packet_size = DIS_STAMPED_HEADER + size;
+		return(1);
+	}
+	else
+		return(0);
+}
+
+static int check_service_name(char *name)
+{
+	if(strlen(name) > (MAX_NAME - 1))
+		return(0);
+	return(1);
+}
+
+static void dis_init()
+{
+	int dis_hash_service_init();
+	void dis_dns_init();
+
+	dis_dns_init();
+	{
+	DISABLE_AST
+	dis_hash_service_init();
+	ENABLE_AST
+	}
+}
+
+static unsigned do_dis_add_service_dns( char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag, long dnsid )
+{
+	register SERVICE *new_serv;
+	register int service_id;
+	char str[512];
+	int dis_hash_service_insert();
+	DIS_DNS_CONN *dnsp;
+	extern DIS_DNS_CONN *dis_find_dns(long);
+
+	dis_init();
+	{
+	DISABLE_AST
+	if(!check_service_name(name))
+	{
+		strcpy(str,"Service name too long: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCTOOLG, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	if( find_service(name) )
+	{
+		strcpy(str,"Duplicate Service: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCDUPLC, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	new_serv = (SERVICE *)malloc( sizeof(SERVICE) );
+	strncpy( new_serv->name, name, MAX_NAME );
+	if(type != (char *)0)
+	{
+		if (strlen(type) >= MAX_NAME)
+		{
+			strcpy(str,"Format String Too Long: ");
+			strcat(str,name);
+			error_handler(0, DIM_ERROR, DIMSVCFORMT, str);
+			free(new_serv);
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		if (! get_format_data(new_serv->format_data, type))
+		{
+			strcpy(str,"Bad Format String: ");
+			strcat(str,name);
+			error_handler(0, DIM_ERROR, DIMSVCFORMT, str);
+			free(new_serv);
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		strcpy(new_serv->def,type); 
+	}
+	else
+	{
+		new_serv->format_data[0].par_bytes = 0;
+		new_serv->def[0] = '\0';
+	}
+	new_serv->type = 0;
+	new_serv->address = (int *)address;
+	new_serv->size = size;
+	new_serv->user_routine = user_routine;
+	new_serv->tag = tag;
+	new_serv->registered = 0;
+	new_serv->quality = 0;
+	new_serv->user_secs = 0;
+	new_serv->tid = 0;
+	new_serv->delay_delete = 0;
+	new_serv->to_delete = 0;
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = create_dns(dnsid);
+	new_serv->dnsp = dnsp;
+	service_id = id_get((void *)new_serv, SRC_DIS);
+	new_serv->id = service_id;
+	new_serv->request_head = (REQUEST *)malloc(sizeof(REQUEST));
+	dll_init( (DLL *) (new_serv->request_head) );
+	dis_hash_service_insert(new_serv);
+/*
+	Dis_n_services++;
+*/
+	dnsp->dis_n_services++;
+	ENABLE_AST
+	}
+	return((unsigned)service_id);
+}
+
+static unsigned do_dis_add_service( char *name, char *type, void *address, int size, 
+								   void (*user_routine)(), long tag )
+{
+	return do_dis_add_service_dns( name, type, address, size, 
+								   user_routine, tag, 0 );
+}
+
+#ifdef VxWorks
+void dis_destroy(int tid)
+{
+register SERVICE *servp, *prevp;
+int n_left = 0;
+
+	prevp = 0;
+	while( servp = dis_hash_service_get_next(prevp))
+	{
+		if(servp->tid == tid)
+		{
+			dis_remove_service(servp->id);
+		}
+		else
+		{
+			prevp = servp;
+			n_left++;
+		}
+	}
+	if(n_left == 5)
+	{
+		prevp = 0;
+		while( servp = dis_hash_service_get_next(prevp))
+		{
+			dis_remove_service(servp->id);
+		}
+		dna_close(Dis_conn_id);
+		dna_close(Dns_dis_conn_id);
+		Dns_dis_conn_id = 0;
+		Dis_first_time = 1;
+		dtq_rem_entry(Dis_timer_q, Dns_timr_ent);
+		Dns_timr_ent = NULL;
+	}
+}
+
+
+#endif
+
+unsigned dis_add_service( char *name, char *type, void *address, int size, 
+						 void (*user_routine)(), long tag)
+{
+	unsigned ret;
+#ifdef VxWorks
+	register SERVICE *servp;
+#endif
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_service( name, type, address, size, user_routine, tag);
+#ifdef VxWorks
+	servp = (SERVICE *)id_get_ptr(ret, SRC_DIS);
+	servp->tid = taskIdSelf();
+#endif
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+unsigned dis_add_service_dns( long dnsid, char *name, char *type, void *address, int size, 
+							 void (*user_routine)(), long tag)
+{
+	unsigned ret;
+#ifdef VxWorks
+	register SERVICE *servp;
+#endif
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_service_dns( name, type, address, size, user_routine, tag, dnsid);
+#ifdef VxWorks
+	servp = (SERVICE *)id_get_ptr(ret, SRC_DIS);
+	servp->tid = taskIdSelf();
+#endif
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+static unsigned do_dis_add_cmnd_dns( char *name, char *type, void (*user_routine)(), long tag, long dnsid )
+{
+	register SERVICE *new_serv;
+	register int service_id;
+	char str[512];
+	int dis_hash_service_insert();
+	DIS_DNS_CONN *dnsp;
+	extern DIS_DNS_CONN *dis_find_dns(long);
+
+	dis_init();
+	{
+	DISABLE_AST
+	if(!check_service_name(name))
+	{
+		strcpy(str,"Command name too long: ");
+		strcat(str,name);
+		error_handler(0, DIM_ERROR, DIMSVCTOOLG, str);
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	if( find_service(name) )
+	{
+		ENABLE_AST
+		return((unsigned) 0);
+	}
+	new_serv = (SERVICE *)malloc(sizeof(SERVICE));
+	strncpy(new_serv->name, name, MAX_NAME);
+	if(type != (char *)0)
+	{
+		if( !get_format_data(new_serv->format_data, type))
+		{
+			ENABLE_AST
+			return((unsigned) 0);
+		}
+		strcpy(new_serv->def,type); 
+	}
+	else
+	{
+		new_serv->format_data[0].par_bytes = 0;
+		new_serv->def[0] = '\0';
+	}
+	new_serv->type = COMMAND;
+	new_serv->address = 0;
+	new_serv->size = 0;
+	if(user_routine)
+		new_serv->user_routine = user_routine;
+	else
+		new_serv->user_routine = std_cmnd_handler;
+	new_serv->tag = tag;
+	new_serv->tid = 0;
+	new_serv->registered = 0;
+	new_serv->quality = 0;
+	new_serv->user_secs = 0;
+	new_serv->delay_delete = 0;
+	new_serv->to_delete = 0;
+	service_id = id_get((void *)new_serv, SRC_DIS);
+	new_serv->id = service_id;
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = create_dns(dnsid);
+	new_serv->dnsp = dnsp;
+	new_serv->request_head = (REQUEST *)malloc(sizeof(REQUEST));
+	dll_init( (DLL *) (new_serv->request_head) );
+	dis_hash_service_insert(new_serv);
+/*
+	Dis_n_services++;
+*/
+	dnsp->dis_n_services++;
+	ENABLE_AST
+	}
+	return((unsigned) service_id);
+}
+
+static unsigned do_dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag)
+{
+	return do_dis_add_cmnd_dns(name, type, user_routine, tag, 0);
+}
+
+unsigned dis_add_cmnd( char *name, char *type, void (*user_routine)(), long tag ) 
+{
+	unsigned ret;
+
+/*
+	DISABLE_AST
+*/
+	ret = do_dis_add_cmnd( name, type, user_routine, tag );
+/*
+	ENABLE_AST
+*/
+	return(ret);
+}
+
+unsigned dis_add_cmnd_dns( long dnsid, char *name, char *type, void (*user_routine)(), long tag ) 
+{
+	unsigned ret;
+
+	/*
+	DISABLE_AST
+	*/
+	ret = do_dis_add_cmnd_dns( name, type, user_routine, tag, dnsid );
+	/*
+	ENABLE_AST
+	*/
+	return(ret);
+}
+
+void dis_add_client_exit_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Client_exit_user_routine = user_routine;
+	ENABLE_AST
+}
+
+void dis_add_exit_handler( void (*user_routine)()) 
+{
+
+	DISABLE_AST
+	Exit_user_routine = user_routine;
+	ENABLE_AST
+}
+
+void dis_add_error_handler( void (*user_routine)())
+{
+
+	DISABLE_AST
+	Error_user_routine = user_routine;
+	ENABLE_AST
+}
+
+static int get_format_data(FORMAT_STR *format_data, char *def)
+{
+	register char code, last_code = 0;
+	int num;
+
+	code = *def;
+	while(*def)
+	{
+		if(code != last_code)
+		{
+			format_data->par_num = 0;
+			format_data->flags = 0;
+			switch(code)
+			{
+				case 'i':
+				case 'I':
+				case 'l':
+				case 'L':
+					format_data->par_bytes = SIZEOF_LONG;
+					format_data->flags |= SWAPL;
+					break;
+				case 'x':
+				case 'X':
+					format_data->par_bytes = SIZEOF_DOUBLE;
+					format_data->flags |= SWAPD;
+					break;
+				case 's':
+				case 'S':
+					format_data->par_bytes = SIZEOF_SHORT;
+					format_data->flags |= SWAPS;
+					break;
+				case 'f':
+				case 'F':
+					format_data->par_bytes = SIZEOF_FLOAT;
+					format_data->flags |= SWAPL;
+#ifdef vms      	
+					format_data->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'd':
+				case 'D':
+					format_data->par_bytes = SIZEOF_DOUBLE;
+					format_data->flags |= SWAPD;
+#ifdef vms
+					format_data->flags |= IT_IS_FLOAT;
+#endif
+					break;
+				case 'c':
+				case 'C':
+					format_data->par_bytes = SIZEOF_CHAR;
+					format_data->flags |= NOSWAP;
+					break;
+			}
+		}
+		def++;
+		if(*def != ':')
+		{
+			if(*def)
+			{
+/*
+				printf("Bad service definition parsing\n");
+				fflush(stdout);
+
+				error_handler("Bad service definition parsing",2);
+*/
+				return(0);
+			}
+			else
+				format_data->par_num = 0;
+		}
+		else
+		{
+			def++;
+			sscanf(def,"%d",&num);
+			format_data->par_num += num;
+			while((*def != ';') && (*def != '\0'))
+				def++;
+			if(*def)
+				def++;
+		}
+		last_code = code;
+		code = *def;
+		if(code != last_code)
+			format_data++;
+	}
+	format_data->par_bytes = 0;
+	return(1);
+}
+
+void recv_dns_dis_rout( int conn_id, DNS_DIS_PACKET *packet, int size, int status )
+{
+	char str[128];
+	int dns_timr_time;
+	extern int rand_tmout(int, int);
+	extern int open_dns(long, void (*)(), void (*)(), int, int, int);
+	extern DIS_DNS_CONN *find_dns_by_conn_id(int);
+	extern void do_register_services(DIS_DNS_CONN *);
+	extern void do_dis_stop_serving_dns(DIS_DNS_CONN *);
+	DIS_DNS_CONN *dnsp;
+
+	if(size){}
+	dnsp = find_dns_by_conn_id(conn_id);
+	if(!dnsp)
+	{
+		return;
+	}
+	switch(status)
+	{
+	case STA_DISC:	   /* connection broken */
+		if( dnsp->dns_timr_ent ) {
+			dtq_rem_entry( Dis_timer_q, dnsp->dns_timr_ent );
+			dnsp->dns_timr_ent = NULL;
+		}
+
+		if(dnsp->dns_dis_conn_id > 0)
+			dna_close(dnsp->dns_dis_conn_id);
+		if(dnsp->serving)
+		{
+			dnsp->dns_dis_conn_id = open_dns(dnsp->dnsid, recv_dns_dis_rout, error_handler,
+					DIS_DNS_TMOUT_MIN, DIS_DNS_TMOUT_MAX, SRC_DIS );
+			if(dnsp->dns_dis_conn_id == -2)
+				error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		}
+		break;
+	case STA_CONN:		/* connection received */
+		if(dnsp->serving)
+		{
+			dnsp->dns_dis_conn_id = conn_id;
+			register_services(dnsp, ALL, 0);
+			dns_timr_time = rand_tmout(WATCHDOG_TMOUT_MIN, 
+							 WATCHDOG_TMOUT_MAX);
+			dnsp->dns_timr_ent = dtq_add_entry( Dis_timer_q,
+						  dns_timr_time,
+						  do_register_services, dnsp ); 
+		}
+		else
+		{
+			dna_close(conn_id);
+		}
+		break;
+	default :	   /* normal packet */
+		if(vtohl(packet->size) != DNS_DIS_HEADER)
+			break;
+		switch( vtohl(packet->type) )
+		{
+		case DNS_DIS_REGISTER :
+			sprintf(str, 
+				"%s: Watchdog Timeout, DNS requests registration",
+				dnsp->task_name);
+			error_handler(0, DIM_WARNING, DIMDNSTMOUT, str);
+			register_services(dnsp, ALL, 0);
+			break;
+		case DNS_DIS_KILL :
+			sprintf(str,
+				"%s: Some Services already known to DNS",
+				dnsp->task_name);
+			/*
+			exit(2);
+			*/
+			error_handler(0, DIM_FATAL, DIMDNSDUPLC, str);
+			do_dis_stop_serving_dns(dnsp);
+			dis_stop_serving();
+/*
+			exit_tag = 0;
+			exit_code = 2;
+			exit_size = sizeof(int);
+			exit_handler(&exit_tag, &exit_code, &exit_size);
+*/
+			break;
+		case DNS_DIS_STOP :
+			sprintf(str, 
+				"%s: DNS refuses connection",dnsp->task_name);
+/*
+			exit(2);
+*/
+			error_handler(0, DIM_FATAL, DIMDNSREFUS, str);
+			do_dis_stop_serving_dns(dnsp);
+			dis_stop_serving();
+/*
+			exit_tag = 0;
+			exit_code = 2;
+			exit_size = sizeof(int);
+			exit_handler(&exit_tag, &exit_code, &exit_size);
+*/
+			break;
+		case DNS_DIS_EXIT :
+			sprintf(str, 
+				"%s: DNS requests Exit",dnsp->task_name);
+			error_handler(0, DIM_FATAL, DIMDNSEXIT, str);
+			break;
+		}
+		break;
+	}
+}
+
+
+/* register services within the name server
+ *
+ * Send services uses the DNA package. services is a linked list of services
+ * stored by add_service.
+ */
+
+int send_dns_update_packet(DIS_DNS_CONN *dnsp)
+{
+  DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+  int n_services;
+  SERVICE_REG *serv_regp;
+
+  n_services = 1;
+  dis_dns_p->n_services = htovl(n_services);
+  dis_dns_p->size = htovl(DIS_DNS_HEADER +
+					n_services * sizeof(SERVICE_REG));
+  serv_regp = dis_dns_p->services;
+  strcpy( serv_regp->service_name, "DUMMY_UPDATE_PACKET" );
+  if(dnsp->dns_dis_conn_id > 0)
+  {
+      if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
+		     DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))
+	  {
+		release_conn(dnsp->dns_dis_conn_id, 0, 1);
+	  }
+  }
+  return(1);
+}
+
+void do_register_services(DIS_DNS_CONN *dnsp)
+{
+	register_services(dnsp, NONE, 0);
+}
+
+void register_services(DIS_DNS_CONN *dnsp, int flag, int dns_flag)
+{
+	register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+	register int n_services, tot_n_services;
+	register SERVICE *servp;
+	register SERVICE_REG *serv_regp;
+	int hash_index, new_entries;
+	extern int get_node_addr();
+	int dis_hash_service_registered();
+
+	if(!dis_dns_p->src_type)
+	{
+		get_node_name( dis_dns_p->node_name );
+/*
+		strcpy( dis_dns_p->task_name, Task_name );
+*/
+		strncpy( dis_dns_p->task_name, dnsp->task_name,
+			MAX_TASK_NAME-4 );
+		dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
+		get_node_addr( dis_dns_p->node_addr );
+/*
+		dis_dns_p->port = htovl(Port_number);
+*/
+		dis_dns_p->pid = htovl(getpid());
+		dis_dns_p->protocol = htovl(Protocol);
+		dis_dns_p->src_type = htovl(SRC_DIS);
+		dis_dns_p->format = htovl(MY_FORMAT);
+	
+	}
+
+	dis_dns_p->port = htovl(Port_number);
+	serv_regp = dis_dns_p->services;
+	n_services = 0;
+	tot_n_services = 0;
+	if( flag == NONE ) {
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl( DIS_DNS_HEADER + 
+			(n_services*sizeof(SERVICE_REG)));
+		if(dnsp->dns_dis_conn_id > 0)
+		{
+			if(!dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 
+				DIS_DNS_HEADER + n_services*sizeof(SERVICE_REG)))
+			{
+				release_conn(dnsp->dns_dis_conn_id, 0, 1);
+			}
+		}
+		return;
+	}
+	if(flag == ALL)
+	{
+		servp = 0;
+		hash_index = -1;
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)))
+		{
+			if(servp->dnsp == dnsp)
+				servp->registered  = 0;
+		}
+	}
+	servp = 0;
+	hash_index = -1;
+	new_entries = 0;
+	if(flag == MORE)
+		new_entries = 1;
+	while( (servp = dis_hash_service_get_next(&hash_index, servp, new_entries)))
+	{
+		if( flag == MORE ) 
+		{
+			if( servp->registered )
+			{
+				continue;
+			}
+		}
+
+		if(servp->dnsp != dnsp)
+			continue;
+
+		strcpy( serv_regp->service_name, servp->name );
+		strcpy( serv_regp->service_def, servp->def );
+		if(servp->type == COMMAND)
+			serv_regp->service_id = htovl( servp->id | 0x10000000);
+		else
+			serv_regp->service_id = htovl( servp->id );
+
+		serv_regp++;
+		n_services++;
+		dis_hash_service_registered(hash_index, servp);
+		if( n_services == MAX_SERVICE_UNIT )
+		{
+			dis_dns_p->n_services = htovl(n_services);
+			dis_dns_p->size = htovl(DIS_DNS_HEADER +
+				n_services * sizeof(SERVICE_REG));
+			if(dnsp->dns_dis_conn_id > 0)
+			{
+				if( !dna_write(dnsp->dns_dis_conn_id,
+					   &(dnsp->dis_dns_packet), 
+					   DIS_DNS_HEADER + n_services *
+						sizeof(SERVICE_REG)) )
+				{
+					release_conn(dnsp->dns_dis_conn_id, 0, 1);
+				}
+			}
+			serv_regp = dis_dns_p->services;
+			tot_n_services += MAX_SERVICE_UNIT;
+			n_services = 0;
+			continue;
+		}
+	}
+	if( n_services ) 
+	{
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl(DIS_DNS_HEADER +
+					n_services * sizeof(SERVICE_REG));
+		if(dnsp->dns_dis_conn_id > 0)
+		{
+			if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet),
+				DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)))
+			{
+				release_conn(dnsp->dns_dis_conn_id, 0, 1);
+			}
+
+		}
+		tot_n_services += n_services;
+	}
+	if(!dns_flag)
+	{
+		if(tot_n_services >= MAX_REGISTRATION_UNIT)
+		{
+			send_dns_update_packet(dnsp);
+		}
+	}
+}
+
+void unregister_service(DIS_DNS_CONN *dnsp, SERVICE *servp)
+{
+	register DIS_DNS_PACKET *dis_dns_p = &(dnsp->dis_dns_packet);
+	register int n_services;
+	register SERVICE_REG *serv_regp;
+	extern int get_node_addr();
+
+	if(dnsp->dns_dis_conn_id > 0)
+	{
+		if(!dis_dns_p->src_type)
+		{
+			get_node_name( dis_dns_p->node_name );
+/*
+			strcpy( dis_dns_p->task_name, Task_name );
+*/
+			strncpy( dis_dns_p->task_name, dnsp->task_name,
+				MAX_TASK_NAME-4 );
+			dis_dns_p->task_name[MAX_TASK_NAME-4-1] = '\0';
+			get_node_addr( dis_dns_p->node_addr );
+			dis_dns_p->port = htovl(Port_number);
+			dis_dns_p->protocol = htovl(Protocol);
+			dis_dns_p->src_type = htovl(SRC_DIS);
+			dis_dns_p->format = htovl(MY_FORMAT);
+		}
+		serv_regp = dis_dns_p->services;
+		strcpy( serv_regp->service_name, servp->name );
+		strcpy( serv_regp->service_def, servp->def );
+		serv_regp->service_id = htovl( servp->id | 0x80000000);
+		serv_regp++;
+		n_services = 1;
+		servp->registered = 0;
+		dis_dns_p->n_services = htovl(n_services);
+		dis_dns_p->size = htovl(DIS_DNS_HEADER +
+				n_services * sizeof(SERVICE_REG));
+
+		if( !dna_write(dnsp->dns_dis_conn_id, &(dnsp->dis_dns_packet), 
+			DIS_DNS_HEADER + n_services * sizeof(SERVICE_REG)) )
+		{
+			release_conn(dnsp->dns_dis_conn_id, 0, 1);
+		}
+		if(dnsp->dis_service_id)
+			dis_update_service(dnsp->dis_service_id);
+	}
+}
+
+void do_update_service_list(DIS_DNS_CONN *dnsp)
+{
+	dnsp->updating_service_list = 0;
+	dis_update_service(dnsp->dis_service_id);
+}
+
+/* start serving client requests
+ *
+ * Using the DNA package start accepting requests from clients.
+ * When a request arrives the routine "dis_insert_request" will be executed.
+ */
+
+int dis_start_serving(char *task)
+{
+	return dis_start_serving_dns(0, task);
+}
+
+static DIS_DNS_CONN *create_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = malloc(sizeof(DIS_DNS_CONN));
+	dnsp->dns_timr_ent = (TIMR_ENT *)0;
+	dnsp->dis_n_services = 0;
+	dnsp->dns_dis_conn_id = 0;
+	dnsp->dis_first_time = 1;
+	dnsp->serving = 0;
+	dnsp->dis_dns_packet.size = 0;
+	dnsp->dis_dns_packet.src_type = 0;
+	dnsp->dis_dns_packet.node_name[0] = 0;
+	dnsp->updating_service_list = 0;
+	dnsp->dnsid = dnsid;
+	dll_insert_queue( (DLL *) DNS_head, (DLL *) dnsp );
+	return dnsp;
+}
+
+void dis_dns_init()
+{
+	static int done = 0;
+	DIS_DNS_CONN *dnsp;
+	void dim_init_threads(void);
+
+	if(!done)
+	{
+		if(!Threads_off)
+		{
+			dim_init_threads();
+		}
+		{
+		DISABLE_AST
+		if(!DNS_head) 
+		{
+			DNS_head = (DIS_DNS_CONN *)malloc(sizeof(DIS_DNS_CONN));
+			dll_init( (DLL *) DNS_head );
+		}
+		dnsp = create_dns(0);
+		Default_DNS = dnsp;
+		done = 1;
+		ENABLE_AST
+		}
+	}
+}
+
+int dis_start_serving_dns(long dnsid, char *task/*, int *idlist*/)
+{
+	char str0[MAX_NAME], str1[MAX_NAME],str2[MAX_NAME],
+	  str3[MAX_NAME],str4[MAX_NAME];
+	char task_name_aux[MAX_TASK_NAME];
+	extern int open_dns();
+	extern DIS_DNS_CONN *dis_find_dns(long);
+	DIS_DNS_CONN *dnsp;
+	int more_ids[10] = {0};
+
+	dis_init();
+	{
+	DISABLE_AST
+	  /*
+#ifdef VxWorks
+	taskDeleteHookAdd(remove_all_services);
+	printf("Adding delete hook\n");
+#endif
+*/
+
+	if(!Client_head) 
+	{
+		Client_head = (CLIENT *)malloc(sizeof(CLIENT));
+		dll_init( (DLL *) Client_head );
+	}
+	if(dnsid == 0)
+	{
+		dnsp = Default_DNS;
+	}
+	else if(!(dnsp = dis_find_dns(dnsid)))
+	{
+		dnsp = create_dns(dnsid);
+	}
+	dnsp->serving = 1;
+	Serving = 1;
+	if(Dis_first_time)
+	{
+		strncpy( task_name_aux, task, MAX_TASK_NAME );
+		task_name_aux[MAX_TASK_NAME-1] = '\0';
+		Port_number = SEEK_PORT;
+		if( !(Dis_conn_id = dna_open_server( task_name_aux, dis_insert_request, 
+			&Protocol, &Port_number, error_handler) ))
+		{
+			ENABLE_AST
+			return(0);
+		}
+		Dis_first_time = 0;
+	}
+	if(dnsp->dis_first_time)
+	{
+		dnsp->dis_first_time = 0;
+
+		sprintf(str0, "%s/VERSION_NUMBER", task);
+		sprintf(str1, "%s/CLIENT_LIST", task);
+		sprintf(str2, "%s/SERVICE_LIST", task);
+		sprintf(str3, "%s/SET_EXIT_HANDLER", task);
+		sprintf(str4, "%s/EXIT", task);
+
+		more_ids[0] = do_dis_add_service_dns( str0, "L", &Version_number,
+				 sizeof(Version_number), 0, 0, dnsid );
+
+		more_ids[1] = do_dis_add_service_dns( str1, "C", 0, 0, client_info, (long)dnsp, dnsid );
+		dnsp->dis_client_id = more_ids[1];
+		more_ids[2] = do_dis_add_service_dns( str2, "C", 0, 0, service_info, (long)dnsp, dnsid );
+		dnsp->dis_service_id = more_ids[2];
+		more_ids[3] = do_dis_add_cmnd_dns( str3, "L:1", add_exit_handler, 0, dnsid );
+		more_ids[4] = do_dis_add_cmnd_dns( str4, "L:1", exit_handler, 0, dnsid );
+		more_ids[5] = 0;
+		strcpy( dnsp->task_name, task );
+	}
+/*
+	if(idlist)
+	{
+		for(i = 0; idlist[i]; i++)
+		{
+			servp = (SERVICE *)id_get_ptr(idlist[i], SRC_DIS);
+			if(servp)
+			{
+				servp->dnsp = dnsp;
+				n_services++;
+			}
+		}
+	}
+	if(dnsp != Default_DNS)
+	{
+		for(i = 0; more_ids[i]; i++)
+		{
+			servp = (SERVICE *)id_get_ptr(more_ids[i], SRC_DIS);
+			if(servp)
+			{
+				servp->dnsp = dnsp;
+				n_services++;
+			}
+		}
+		dnsp->dis_n_services += n_services;
+		Dis_n_services -= n_services;
+	}
+*/
+	if(!Dis_timer_q)
+		Dis_timer_q = dtq_create();
+	if( !dnsp->dns_dis_conn_id )
+	{
+		if(!strcmp(task,"DIS_DNS"))
+		{
+			register_services(dnsp, ALL, 1);
+			ENABLE_AST
+			return(id_get(&(dnsp->dis_dns_packet), SRC_DIS));
+		}
+		else
+		{
+		
+			dnsp->dns_dis_conn_id = open_dns(dnsid, recv_dns_dis_rout, error_handler,
+					DIS_DNS_TMOUT_MIN, DIS_DNS_TMOUT_MAX, SRC_DIS );
+			if(dnsp->dns_dis_conn_id == -2)
+				error_handler(0, DIM_FATAL, DIMDNSUNDEF, "DIM_DNS_NODE undefined");
+		}
+	}
+	else
+	{
+		register_services(dnsp, MORE, 0);
+		if(dnsp->dis_service_id)
+		{
+/*
+			dis_update_service(Dis_service_id);
+*/
+			if(!dnsp->updating_service_list)
+			{
+				dtq_start_timer(1, do_update_service_list, dnsp);
+				dnsp->updating_service_list = 1;
+			}
+		}
+	}
+	ENABLE_AST
+	}
+	return(1);
+}
+
+
+/* asynchrounous reception of requests */
+/*
+	Called by DNA package.
+	A request has arrived, queue it to process later - dis_ins_request
+*/
+static void dis_insert_request(int conn_id, DIC_PACKET *dic_packet, int size, int status)
+{
+	register SERVICE *servp;
+	register REQUEST *newp, *reqp;
+	CLIENT *clip;
+	REQUEST_PTR *reqpp;
+	int type, new_client = 0, found = 0;
+	int find_release_request();
+	DIS_DNS_CONN *dnsp;
+
+	if(size){}
+	/* status = 1 => new connection, status = -1 => conn. lost */
+	if(!Client_head) 
+	{
+		Client_head = (CLIENT *)malloc(sizeof(CLIENT));
+		dll_init( (DLL *) Client_head );
+	}
+	if(status != 0)
+	{
+		if(status == -1) /* release all requests from conn_id */
+		{
+			release_conn(conn_id, 0, 0);
+		}
+	} 
+	else 
+	{
+		if(!(servp = find_service(dic_packet->service_name)))
+		{
+			release_conn(conn_id, 0, 0);
+			return;
+		}
+		dic_packet->type = vtohl(dic_packet->type);
+		type = dic_packet->type & 0xFFF;
+		/*
+		if(type == COMMAND) 
+		{
+			Curr_conn_id = conn_id;
+			execute_command(servp, dic_packet);
+			Curr_conn_id = 0;
+			return;
+		}
+		*/
+		if(type == DIM_DELETE) 
+		{
+			find_release_request(conn_id, vtohl(dic_packet->service_id));
+			return;
+		}
+		newp = (REQUEST *)/*my_*/malloc(sizeof(REQUEST));
+		newp->service_ptr = servp;
+		newp->service_id = vtohl(dic_packet->service_id);
+		newp->type = dic_packet->type;
+		newp->timeout = vtohl(dic_packet->timeout);
+		newp->format = vtohl(dic_packet->format);
+		newp->conn_id = conn_id;
+		newp->first_time = 1;
+		newp->delay_delete = 0;
+		newp->to_delete = 0;
+		newp->timr_ent = 0;
+		newp->req_id = id_get((void *)newp, SRC_DIS);
+		newp->reqpp = 0;
+		if(type == ONCE_ONLY) 
+		{
+			execute_service(newp->req_id);
+			id_free(newp->req_id, SRC_DIS);
+			free(newp);
+			return;
+		}
+		if(type == COMMAND) 
+		{
+			Curr_conn_id = conn_id;
+			execute_command(servp, dic_packet);
+			Curr_conn_id = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) ) 
+			{
+				if(reqp->conn_id == conn_id)
+				{
+					id_free(newp->req_id, SRC_DIS);
+					free(newp);
+					found = 1;
+					break;
+				}
+			}
+			if(!found)
+				dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
+			return;
+		}
+		dll_insert_queue( (DLL *) servp->request_head, (DLL *) newp );
+		if(!(clip = find_client(conn_id)))
+		{
+			clip = (CLIENT *)malloc(sizeof(CLIENT));
+			clip->conn_id = conn_id;
+			clip->dnsp = servp->dnsp;
+			clip->requestp_head = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
+			dll_init( (DLL *) clip->requestp_head );
+			dll_insert_queue( (DLL *) Client_head, (DLL *) clip );
+			new_client = 1;
+		}
+		reqpp = (REQUEST_PTR *)malloc(sizeof(REQUEST_PTR));
+		reqpp->reqp = newp;
+		dll_insert_queue( (DLL *) clip->requestp_head, (DLL *) reqpp );
+		newp->reqpp = reqpp;
+		if((type != MONIT_ONLY) && (type != UPDATE))
+		{
+			execute_service(newp->req_id);
+		}
+		if((type != MONIT_ONLY) && (type != MONIT_FIRST))
+		{
+			if(newp->timeout != 0)
+			{
+				newp->timr_ent = dtq_add_entry( Dis_timer_q,
+							newp->timeout, 
+							execute_service,
+							newp->req_id );
+			}
+		}
+		if(new_client)
+		{
+			Last_client = conn_id;
+			dnsp = clip->dnsp;
+			if(dnsp->dis_client_id)
+			  dis_update_service(dnsp->dis_client_id);
+		}
+	}
+}
+
+/* A timeout for a timed or monitored service occured, serve it. */
+
+int execute_service( int req_id )
+{
+	int *buffp, size;
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	char str[80], def[MAX_NAME];
+	register char *ptr;
+	int last_conn_id;
+	int *pkt_buffer, header_size, aux;
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+	FORMAT_STR format_data_cp[MAX_NAME/4];
+
+	reqp = (REQUEST *)id_get_ptr(req_id, SRC_DIS);
+	if(!reqp)
+		return(0);
+	if(reqp->to_delete)
+		return(0);
+	reqp->delay_delete++;
+	servp = reqp->service_ptr;
+	last_conn_id = Curr_conn_id;
+	Curr_conn_id = reqp->conn_id;
+	ptr = servp->def;
+	if(servp->type == COMMAND)
+	{
+		sprintf(str,"This is a COMMAND Service");
+		buffp = (int *)str;
+		size = 26;
+		sprintf(def,"c:26");
+		ptr = def;
+	}
+	else if( servp->user_routine != 0 ) 
+	{
+		(servp->user_routine)( &servp->tag, &buffp, &size,
+					&reqp->first_time );
+		reqp->first_time = 0;
+		
+	} 
+	else 
+	{
+		buffp = servp->address;
+		size = servp->size;
+	}
+	Curr_conn_id = last_conn_id;
+/* send even if no data but not if negative */
+	if( size  < 0)
+	{
+		reqp->delay_delete--;
+		return(0);
+	}
+	if( DIS_STAMPED_HEADER + size > Dis_packet_size ) 
+	{
+		if( Dis_packet_size )
+			free( Dis_packet );
+		Dis_packet = (DIS_STAMPED_PACKET *)malloc(DIS_STAMPED_HEADER + size);
+		if(!Dis_packet)
+		{
+			reqp->delay_delete--;
+			return(0);
+		}
+		Dis_packet_size = DIS_STAMPED_HEADER + size;
+	}
+	Dis_packet->service_id = htovl(reqp->service_id);
+	if((reqp->type & 0xFF000) == STAMPED)
+	{
+		pkt_buffer = ((DIS_STAMPED_PACKET *)Dis_packet)->buffer;
+		header_size = DIS_STAMPED_HEADER;
+		if(!servp->user_secs)
+		{
+#ifdef WIN32
+			ftime(&timebuf);
+			aux = timebuf.millitm;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl((int)timebuf.time);
+#else
+			tz = 0;
+		        gettimeofday(&tv, tz);
+			aux = tv.tv_usec / 1000;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl(tv.tv_sec);
+#endif
+		}
+		else
+		{
+			aux = /*0xc0de0000 |*/ servp->user_millisecs;
+			Dis_packet->time_stamp[0] = htovl(aux);
+			Dis_packet->time_stamp[1] = htovl(servp->user_secs);
+		}
+		Dis_packet->reserved[0] = htovl(0xc0dec0de);
+		Dis_packet->quality = htovl(servp->quality);
+	}
+	else
+	{
+		pkt_buffer = ((DIS_PACKET *)Dis_packet)->buffer;
+		header_size = DIS_HEADER;
+	}
+	memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+	size = copy_swap_buffer_out(reqp->format, format_data_cp, 
+		pkt_buffer,
+		buffp, size);
+	Dis_packet->size = htovl(header_size + size);
+	if( !dna_write_nowait(reqp->conn_id, Dis_packet, header_size + size) ) 
+	{
+		reqp->to_delete = 1;
+	}
+/*
+	else
+	{
+		if((reqp->type & 0xFFF) == MONITORED)
+		{
+			if(reqp->timr_ent)
+				dtq_clear_entry(reqp->timr_ent);
+		}
+	}
+*/
+	reqp->delay_delete--;
+	return(1);
+}
+
+void remove_service( int req_id )
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	static DIS_PACKET *dis_packet;
+	static int packet_size = 0;
+	int service_id;
+
+	reqp = (REQUEST *)id_get_ptr(req_id, SRC_DIS);
+	servp = reqp->service_ptr;
+	if( !packet_size ) {
+		dis_packet = (DIS_PACKET *)malloc(DIS_HEADER);
+		packet_size = DIS_HEADER;
+	}
+	service_id = (reqp->service_id | 0x80000000);
+	dis_packet->service_id = htovl(service_id);
+	dis_packet->size = htovl(DIS_HEADER);
+	if( !dna_write(reqp->conn_id, dis_packet, DIS_HEADER) ) 
+	{
+		release_conn(reqp->conn_id, 0, 0);
+	}
+}
+
+void execute_command(SERVICE *servp, DIC_PACKET *packet)
+{
+	int size;
+	int format;
+	FORMAT_STR format_data_cp[MAX_NAME/4], *formatp;
+	static int *buffer;
+	static int buffer_size = 0;
+	int add_size;
+
+	size = vtohl(packet->size) - DIC_HEADER;
+	add_size = size + (size/2);
+	if(!buffer_size)
+	{
+		buffer = (int *)malloc(add_size);
+		buffer_size = add_size;
+	} 
+	else 
+	{
+		if( add_size > buffer_size ) 
+		{
+			free(buffer);
+			buffer = (int *)malloc(add_size);
+			buffer_size = add_size;
+		}
+	}
+
+	dis_set_timestamp(servp->id, 0, 0);
+	if(servp->user_routine != 0)
+	{
+		format = vtohl(packet->format);
+		memcpy(format_data_cp, servp->format_data, sizeof(format_data_cp));
+		if((format & 0xF) == ((MY_FORMAT) & 0xF)) 
+		{
+			for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			{
+				if(formatp->flags & IT_IS_FLOAT)
+					formatp->flags |= (format & 0xf0);
+				formatp->flags &= 0xFFF0;	/* NOSWAP */
+			}
+		}
+		else
+		{
+			for(formatp = format_data_cp; formatp->par_bytes; formatp++)
+			{
+				if(formatp->flags & IT_IS_FLOAT)
+					formatp->flags |= (format & 0xf0);
+			}
+		}
+		size = copy_swap_buffer_in(format_data_cp, 
+						 buffer, 
+						 packet->buffer, size);
+		(servp->user_routine)(&servp->tag, buffer, &size);
+	}
+}
+
+void dis_report_service(char *serv_name)
+{
+	register SERVICE *servp;
+	register REQUEST *reqp;
+	int to_delete = 0, more;
+
+	
+	DISABLE_AST
+	servp = find_service(serv_name);
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) )
+	{
+		if((reqp->type & 0xFFF) != TIMED_ONLY)
+		{
+			execute_service(reqp->req_id);
+			if(reqp->to_delete)
+				to_delete = 1;
+		}
+	}
+	if(to_delete)
+	{
+		do
+		{
+			more = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) )
+			{
+				if(reqp->to_delete)
+				{
+					more = 1;
+					release_conn(reqp->conn_id, 1, 0);
+					break;
+				}
+			}
+		}while(more);
+	}
+	ENABLE_AST
+}
+
+int dis_update_service(unsigned service_id)
+{
+int do_update_service();
+
+	return(do_update_service(service_id,0));
+}
+
+int dis_selective_update_service(unsigned service_id, int *client_ids)
+{
+int do_update_service();
+
+	return(do_update_service(service_id, client_ids));
+}
+
+int check_client(REQUEST *reqp, int *client_ids)
+{
+	if(!client_ids)
+		return(1);
+	while(*client_ids)
+	{
+		if(reqp->conn_id == *client_ids)
+		{
+			return(1);
+		}
+		client_ids++;
+	}
+	return(0);
+}
+
+int do_update_service(unsigned service_id, int *client_ids)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	REQUEST_PTR *reqpp;
+	CLIENT *clip;
+	register int found = 0;
+	int to_delete = 0, more, conn_id;
+	char str[128];
+	int release_request();
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str, "Update Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	servp->delay_delete = 1;
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+if(Debug_on)
+{
+dim_print_date_time_millis();
+printf("Updating %s (id = %d, ptr = %08lX) for %s@%s (req_id = %d, req_ptr = %08lX)\n",
+	   servp->name, (int)service_id, (unsigned long)servp, 
+	   Net_conns[reqp->conn_id].task, Net_conns[reqp->conn_id].node, reqp->req_id, (unsigned long)reqp);
+}
+		if(check_client(reqp, client_ids))
+			reqp->delay_delete = 1;
+	}
+	ENABLE_AST
+	{
+	DISABLE_AST
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(reqp->delay_delete && ((reqp->type & 0xFFF) != COMMAND))
+		{
+		if(check_client(reqp, client_ids))
+		{
+			if( (reqp->type & 0xFFF) != TIMED_ONLY ) 
+			{
+/*
+				DISABLE_AST
+*/
+				execute_service(reqp->req_id);
+				found++;
+				ENABLE_AST
+				{
+				DISABLE_AST
+				}
+			}
+		}
+		}
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(check_client(reqp, client_ids))
+		{
+			reqp->delay_delete = 0;
+			if(reqp->to_delete)
+				to_delete = 1;
+		}
+	}
+	ENABLE_AST
+	}
+	if(to_delete)
+	{
+		DISABLE_AST
+		do
+		{
+			more = 0;
+			reqp = servp->request_head;
+			while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+				(DLL *) reqp)) ) 
+			{
+				if(reqp->to_delete & 0x1)
+				{
+					more = 1;
+					reqp->to_delete = 0;
+					release_conn(reqp->conn_id, 1, 0);
+					break;
+				}
+				else if(reqp->to_delete & 0x2)
+				{
+					more = 1;
+					reqp->to_delete = 0;
+					reqpp = reqp->reqpp;
+					conn_id = reqp->conn_id;
+					release_request(reqp, reqpp, 1);
+					clip = find_client(conn_id);
+					if(clip)
+					{
+						if( dll_empty((DLL *)clip->requestp_head) ) 
+						{
+							release_conn( conn_id, 0, 0);
+						}
+					}
+					break;
+				}
+			}
+		}while(more);
+		ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	servp->delay_delete = 0;
+	if(servp->to_delete)
+	{
+		dis_remove_service(servp->id);
+	}
+	ENABLE_AST
+	}
+
+	return(found);
+}
+
+int dis_get_n_clients(unsigned service_id)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	register int found = 0;
+	char str[128];
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str, "Service Has Clients- Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		found++;
+	}
+	ENABLE_AST
+	return found;
+}
+
+int dis_get_timeout(unsigned service_id, int client_id)
+{
+	register REQUEST *reqp;
+	register SERVICE *servp;
+	char str[128];
+
+	if(!service_id)
+	{
+		sprintf(str,"Get Timeout - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		return(-1);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		return(-1);
+	}
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) ) 
+	{
+		if(reqp->conn_id == client_id)
+			return(reqp->timeout);
+	}
+	return(-1);
+}
+
+void dis_set_quality( unsigned serv_id, int quality )
+{
+	register SERVICE *servp;
+	char str[128];
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Set Quality - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return;
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return;
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return;
+	}
+	servp->quality = quality;
+	ENABLE_AST
+}
+
+int dis_set_timestamp( unsigned serv_id, int secs, int millisecs )
+{
+	register SERVICE *servp;
+	char str[128];
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Set Timestamp - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return(0);
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(secs == 0)
+	{
+#ifdef WIN32
+			ftime(&timebuf);
+			servp->user_secs = (int)timebuf.time;
+			servp->user_millisecs = timebuf.millitm;
+#else
+			tz = 0;
+		    gettimeofday(&tv, tz);
+			servp->user_secs = tv.tv_sec;
+			servp->user_millisecs = tv.tv_usec / 1000;
+#endif
+	}
+	else
+	{
+		servp->user_secs = secs;
+/*
+		servp->user_millisecs = (millisecs & 0xffff);
+*/
+		servp->user_millisecs = millisecs;
+	}
+	ENABLE_AST
+	return(1);
+}
+
+int dis_get_timestamp( unsigned serv_id, int *secs, int *millisecs )
+{
+	register SERVICE *servp;
+	char str[128];
+
+	DISABLE_AST
+	if(!serv_id)
+	{
+		sprintf(str,"Get Timestamp - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+	    ENABLE_AST
+		return(0);
+	}
+	servp = (SERVICE *)id_get_ptr(serv_id, SRC_DIS);
+	if(!servp)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->id != (int)serv_id)
+	{
+	    ENABLE_AST
+		return(0);
+	}
+	if(servp->user_secs)
+	{
+		*secs = servp->user_secs;
+		*millisecs = servp->user_millisecs;
+	}
+	else
+	{
+		*secs = 0;
+		*millisecs = 0;
+	}
+	ENABLE_AST
+	return(1);
+}
+
+void dis_send_service(unsigned service_id, int *buffer, int size)
+{
+	register REQUEST *reqp, *prevp;
+	register SERVICE *servp;
+	static DIS_PACKET *dis_packet;
+	static int packet_size = 0;
+	int conn_id;
+	char str[128];
+
+	DISABLE_AST
+	if( !service_id ) {
+		sprintf(str,"Send Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return;
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!packet_size)
+	{
+		dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
+		packet_size = DIS_HEADER + size;
+	} 
+	else 
+	{
+		if( DIS_HEADER+size > packet_size ) 
+		{
+			free(dis_packet);
+			dis_packet = (DIS_PACKET *)malloc(DIS_HEADER+size);
+			packet_size = DIS_HEADER+size;
+		}
+	}
+	prevp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) prevp)) ) 
+	{
+		dis_packet->service_id = htovl(reqp->service_id);
+		memcpy(dis_packet->buffer, buffer, size);
+		dis_packet->size = htovl(DIS_HEADER + size);
+
+		conn_id = reqp->conn_id;
+		if( !dna_write_nowait(conn_id, dis_packet, size + DIS_HEADER) )
+		{
+			release_conn(conn_id, 1, 0);
+		}
+		else
+			prevp = reqp;
+	}
+	ENABLE_AST
+}
+
+int dis_remove_service(unsigned service_id)
+{
+	register REQUEST *reqp, *auxp;
+	register SERVICE *servp;
+	REQUEST_PTR *reqpp;
+	int found = 0;
+	char str[128];
+	int release_request();
+	int dis_hash_service_remove();
+	DIS_DNS_CONN *dnsp;
+	int n_services;
+	void do_dis_stop_serving_dns(DIS_DNS_CONN *);
+
+	DISABLE_AST
+	if(!service_id)
+	{
+		sprintf(str,"Remove Service - Invalid service id");
+		error_handler(0, DIM_ERROR, DIMSVCINVAL, str);
+		ENABLE_AST
+		return(found);
+	}
+	servp = (SERVICE *)id_get_ptr(service_id, SRC_DIS);
+	if(!servp)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->id != (int)service_id)
+	{
+		ENABLE_AST
+		return(found);
+	}
+	if(servp->delay_delete)
+	{
+		servp->to_delete = 1;
+		ENABLE_AST
+		return(found);
+	}
+	/* remove from name server */
+	
+	dnsp = servp->dnsp;
+	unregister_service(dnsp, servp);
+	/* Release client requests and remove from actual clients */
+	reqp = servp->request_head;
+	while( (reqp = (REQUEST *) dll_get_next((DLL *)servp->request_head,
+		(DLL *) reqp)) )
+	{
+		remove_service(reqp->req_id);
+		auxp = reqp->prev;
+		reqpp = (REQUEST_PTR *) reqp->reqpp;
+		release_request(reqp, reqpp, 1);
+		found = 1;
+		reqp = auxp;
+	}
+	if(servp->id == (int)dnsp->dis_service_id)
+	  dnsp->dis_service_id = 0;
+	if(servp->id == (int)dnsp->dis_client_id)
+	  dnsp->dis_client_id = 0;
+	dis_hash_service_remove(servp);
+	id_free(servp->id, SRC_DIS);
+	free(servp->request_head);
+	free(servp);
+/*
+	if(dnsp != Default_DNS)
+	{
+		dnsp->dis_n_services--;
+		n_services = dnsp->dis_n_services;
+	}
+	else
+	{
+		Dis_n_services--;
+		n_services = Dis_n_services;
+	}
+*/
+	dnsp->dis_n_services--;
+	n_services = dnsp->dis_n_services;
+
+	ENABLE_AST
+	if(dnsp->serving)
+	{
+		if(n_services == 5)
+		{
+/*
+			dis_stop_serving();
+*/
+			do_dis_stop_serving_dns(dnsp);
+		}
+	}
+	return(found);
+}
+
+void do_dis_stop_serving_dns(DIS_DNS_CONN *dnsp)
+{
+register SERVICE *servp, *prevp;
+void dim_stop_threads(void);
+int dis_no_dns();
+int hash_index, old_index;
+extern int close_dns(long, int);
+
+	dnsp->serving = 0;
+	dis_init();
+/*
+	dis_hash_service_init();
+	prevp = 0;
+	if(Dis_conn_id)
+	{
+		dna_close(Dis_conn_id);
+		Dis_conn_id = 0;
+	}
+*/
+	{
+	DISABLE_AST
+	if(dnsp->dns_timr_ent)
+	{
+		dtq_rem_entry(Dis_timer_q, dnsp->dns_timr_ent);
+		dnsp->dns_timr_ent = NULL;
+	}
+	if(dnsp->dns_dis_conn_id)
+	{
+		dna_close(dnsp->dns_dis_conn_id);
+		dnsp->dns_dis_conn_id = 0;
+	}
+	ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	prevp = 0;
+	hash_index = -1;
+	old_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, prevp, 0)) )
+	{
+		if(servp->dnsp == dnsp)
+		{
+			dis_remove_service(servp->id);
+			if(old_index != hash_index)
+				prevp = 0;
+		}
+		else
+		{
+			prevp = servp;
+			old_index = hash_index;
+		}
+	}
+	ENABLE_AST
+	}
+	dnsp->dis_first_time = 1;
+	dnsp->dis_n_services = 0;
+	dnsp->dis_dns_packet.size = 0;
+	dnsp->dis_dns_packet.src_type = 0;
+	close_dns(dnsp->dnsid, SRC_DIS);
+/*
+	if(dnsp != Default_DNS)
+	{
+		dll_remove(dnsp);
+		free(dnsp);
+	}
+*/
+/*
+	if(dll_empty(DNS_head))
+*/
+	if(dis_no_dns())
+		dis_stop_serving();
+}
+
+void dis_stop_serving_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp, *dis_find_dns();
+
+	dnsp = dis_find_dns(dnsid);
+	do_dis_stop_serving_dns(dnsp);
+}
+
+void dis_stop_serving()
+{
+register SERVICE *servp, *prevp;
+void dim_stop_threads(void);
+int hash_index;
+
+	Serving = 0;
+	dis_init();
+	if(Dis_conn_id)
+	{
+		dna_close(Dis_conn_id);
+		Dis_conn_id = 0;
+	}
+/*
+	if(Dns_dis_conn_id)
+	{
+		dna_close(Dns_dis_conn_id);
+		Dns_dis_conn_id = 0;
+	}
+*/
+	{
+		DISABLE_AST
+	prevp = 0;
+	hash_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, prevp, 0)) )
+	{
+		dis_remove_service(servp->id);
+		prevp = 0;
+	}
+	ENABLE_AST
+	}
+/*
+	if(Dis_conn_id)
+		dna_close(Dis_conn_id);
+	if(Dns_dis_conn_id)
+		dna_close(Dns_dis_conn_id);
+	Dns_dis_conn_id = 0;
+*/
+	Dis_first_time = 1;
+/*
+	if(Dns_timr_ent)
+	{
+		dtq_rem_entry(Dis_timer_q, Dns_timr_ent);
+		Dns_timr_ent = NULL;
+	}
+*/
+	dtq_delete(Dis_timer_q);
+	Dis_timer_q = 0;
+	dim_stop_threads();
+}
+
+/* find service by name */
+SERVICE *find_service(char *name)
+{
+	return(dis_hash_service_exists(name));
+}
+
+CLIENT *find_client(int conn_id)
+{
+	register CLIENT *clip;
+
+	clip = (CLIENT *)
+			dll_search( (DLL *) Client_head, &conn_id, sizeof(conn_id));
+	return(clip);
+}
+
+void release_all_requests(int conn_id, CLIENT *clip)
+{
+	register REQUEST_PTR *reqpp, *auxp;
+	register REQUEST *reqp;
+    int found = 0;
+	int release_request();
+	DIS_DNS_CONN *dnsp;
+
+	DISABLE_AST;
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			auxp = reqpp->prev;
+			reqp = (REQUEST *) reqpp->reqp;
+			release_request(reqp, reqpp, 0);
+			found = 1;
+			reqpp = auxp;
+		}
+		dnsp = clip->dnsp;
+		dll_remove(clip);
+		free(clip->requestp_head);
+		free(clip);
+	}
+	if(found)
+	{
+		Last_client = -conn_id;
+		if(dnsp->dis_client_id)
+		  dis_update_service(dnsp->dis_client_id);
+	}
+	dna_close(conn_id);
+	ENABLE_AST;
+}
+
+CLIENT *check_delay_delete(int conn_id)
+{
+	register REQUEST_PTR *reqpp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	int found = 0;
+
+	DISABLE_AST;
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			if(reqp->delay_delete)
+			{
+				reqp->to_delete = 1;
+				found = 1;
+			}
+		}
+	}
+	ENABLE_AST;
+	if(found)
+	{
+		return((CLIENT *)-1);
+	}
+	return(clip);
+}
+
+char *dis_get_error_services()
+{
+	return(dis_get_client_services(Error_conn_id));
+}
+
+char *dis_get_client_services(int conn_id)
+{
+	register REQUEST_PTR *reqpp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	register SERVICE *servp;
+
+	int n_services = 0;
+	int max_size;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+
+
+	if(!conn_id)
+		return((char *)0);
+	{
+	DISABLE_AST;
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)))
+		{
+			n_services++;
+		}
+		if(!n_services)
+		{
+			ENABLE_AST
+			return((char *)0);
+		}
+		max_size = n_services * MAX_NAME;
+		if(!curr_allocated_size)
+		{
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		else if (max_size > curr_allocated_size)
+		{
+			free(service_info_buffer);
+			service_info_buffer = (char *)malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		service_info_buffer[0] = '\0';
+		buff_ptr = service_info_buffer;
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			servp = reqp->service_ptr;
+			strcat(buff_ptr, servp->name);
+			strcat(buff_ptr, "\n");
+			buff_ptr += strlen(buff_ptr);
+		}
+	}
+	else
+	{
+		ENABLE_AST
+		return((char *)0);
+	}
+	ENABLE_AST;
+	}
+/*
+	dim_print_date_time();
+	dna_get_node_task(conn_id, node, task);
+	printf("Client %s@%s uses services: \n", task, node);
+	printf("%s\n",service_info_buffer);
+*/
+	return(service_info_buffer);
+}
+
+int find_release_request(int conn_id, int service_id)
+{
+	register REQUEST_PTR *reqpp, *auxp;
+	register CLIENT *clip;
+	register REQUEST *reqp;
+	int release_request();
+
+	DISABLE_AST
+	clip = find_client(conn_id);
+	if(clip)
+	{
+		reqpp = clip->requestp_head;
+		while( (reqpp = (REQUEST_PTR *) dll_get_next((DLL *)clip->requestp_head,
+			(DLL *) reqpp)) )
+		{
+			reqp = (REQUEST *) reqpp->reqp;
+			if(reqp->service_id == service_id)
+			{
+				if(reqp->delay_delete)
+				{
+					reqp->to_delete += 0x2;
+				}
+				else
+				{
+					auxp = reqpp->prev;
+					release_request(reqp, reqpp, 0);
+					reqpp = auxp;
+				}
+			}
+		}
+		if( dll_empty((DLL *)clip->requestp_head) ) 
+		{
+			release_conn( conn_id, 0, 0 );
+		}
+	}
+	ENABLE_AST
+	return(1);
+}
+
+int release_request(REQUEST *reqp, REQUEST_PTR *reqpp, int remove)
+{
+	int conn_id;
+	CLIENT *clip;
+
+	DISABLE_AST
+	conn_id = reqp->conn_id;
+	if(reqpp)
+		dll_remove((DLL *)reqpp);
+	dll_remove((DLL *)reqp);
+	if(reqp->timr_ent)
+		dtq_rem_entry(Dis_timer_q, reqp->timr_ent);
+	id_free(reqp->req_id, SRC_DIS);
+	free(reqp);
+	free(reqpp);
+/* Would do it too early, the client will disconnect anyway
+*/
+	if((remove) && (!Serving))
+	{
+		clip = find_client(conn_id);
+		if(clip)
+		{
+			if( dll_empty((DLL *)clip->requestp_head) ) 
+			{
+				release_conn( conn_id, 0, 0);
+			}
+		}
+	}
+
+	ENABLE_AST
+	return(1);
+}
+
+static int release_conn(int conn_id, int print_flg, int dns_flag)
+{
+	static int releasing = 0;
+	CLIENT *clip;
+	int do_exit_handler();
+
+	DISABLE_AST
+	if(print_flg){}
+	if(dns_flag)
+	{
+		recv_dns_dis_rout( conn_id, 0, 0, STA_DISC );
+		ENABLE_AST
+		return(0);
+	}
+#ifdef VMS
+	if(print_flg)
+	{
+		dim_print_date_time();
+		dna_get_node_task(conn_id, node, task);
+		printf(" Couldn't write to client %s@%s, releasing connection %d\n",
+			task, node, conn_id);
+		fflush(stdout);
+	}
+#endif
+	clip = check_delay_delete(conn_id);
+	if(clip != (CLIENT *)-1)
+	{
+		if( Client_exit_user_routine != 0 ) 
+		{
+			releasing++;
+			Curr_conn_id = conn_id;
+			do_exit_handler(conn_id);
+			releasing--;
+		}
+		if(!releasing)
+		{
+			release_all_requests(conn_id, clip);
+		}
+	}
+	ENABLE_AST
+	return(1);
+}
+
+typedef struct cmnds{
+	struct cmnds *next;
+	long tag;
+	int size;
+	int buffer[1];
+} DIS_CMND;
+
+static DIS_CMND *Cmnds_head = (DIS_CMND *)0;
+
+void std_cmnd_handler(long *tag, int *cmnd_buff, int *size)
+{
+	register DIS_CMND *new_cmnd;
+/* queue the command */
+
+	if(!Cmnds_head)
+	{
+		Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
+		sll_init((SLL *) Cmnds_head);
+	}
+	new_cmnd = (DIS_CMND *)malloc((*size)+12);
+	new_cmnd->next = 0;
+	new_cmnd->tag = *tag;
+	new_cmnd->size = *size;
+	memcpy(new_cmnd->buffer, cmnd_buff, *size);
+	sll_insert_queue((SLL *) Cmnds_head, (SLL *) new_cmnd);
+}
+
+int dis_get_next_cmnd(long *tag, int *buffer, int *size)
+{
+	register DIS_CMND *cmndp;
+	register int ret_val = -1;
+
+	DISABLE_AST
+	if(!Cmnds_head)
+	{
+		Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
+		sll_init((SLL *) Cmnds_head);
+	}
+	if(*size == 0)
+	{
+		if( (cmndp = (DIS_CMND *) sll_get_head((SLL *) Cmnds_head)))
+		{
+			if(cmndp->size > 0)
+			{
+				*size = cmndp->size;
+				*tag = cmndp->tag;
+				ENABLE_AST
+				return(-1);
+			}
+		}
+	}
+	if( (cmndp = (DIS_CMND *) sll_remove_head((SLL *) Cmnds_head)) )
+	{
+		if (*size >= cmndp->size)
+		{
+			*size = cmndp->size;
+			ret_val = 1;
+		}
+		memcpy(buffer, cmndp->buffer, *size);
+		*tag = cmndp->tag;
+		free(cmndp);
+		ENABLE_AST
+		return(ret_val);
+	}
+	ENABLE_AST
+	return(0);
+}
+
+int dis_get_conn_id()
+{
+	return(Curr_conn_id);
+}
+
+int dis_get_client(char *name)
+{
+	int ret = 0;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+
+	DISABLE_AST
+
+	if(Curr_conn_id)
+	{
+		dna_get_node_task(Curr_conn_id, node, task);
+		strcpy(name,task);
+		strcat(name,"@");
+		strcat(name,node);
+		ret = Curr_conn_id;
+	}
+	ENABLE_AST
+	return(ret);
+}
+
+#ifdef VMS
+dis_convert_str(c_str, for_str)
+char *c_str;
+struct dsc$descriptor_s *for_str;
+{
+	int i;
+
+	strcpy(for_str->dsc$a_pointer, c_str);
+	for(i = strlen(c_str); i< for_str->dsc$w_length; i++)
+		for_str->dsc$a_pointer[i] = ' ';
+}
+#endif
+
+void client_info(long *tag, int **bufp, int *size, int *first_time)
+{
+	register CLIENT *clip;
+	int curr_conns[MAX_CONNS];
+	int i, index, max_size;
+	static int curr_allocated_size = 0;
+	static char *dns_info_buffer;
+	register char *dns_client_info;
+	char node[MAX_NODE_NAME], task[MAX_TASK_NAME];
+	DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
+
+	max_size = sizeof(DNS_CLIENT_INFO);
+	if(!curr_allocated_size)
+	{
+		dns_info_buffer = malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	dns_client_info = dns_info_buffer;
+	dns_client_info[0] = '\0';
+	index = 0;
+	if(*first_time)
+	{
+		clip = Client_head;
+		while( (clip = (CLIENT *)dll_get_next( (DLL *) Client_head, 
+			(DLL*) clip)) )
+		{
+			if(clip->dnsp != dnsp)
+				continue;
+			curr_conns[index++] = clip->conn_id;
+		}
+		max_size = (index+1)*sizeof(DNS_CLIENT_INFO);
+		if (max_size > curr_allocated_size)
+		{
+			free(dns_info_buffer);
+			dns_info_buffer = malloc(max_size);
+			curr_allocated_size = max_size;
+		}
+		dns_client_info = dns_info_buffer;
+		dns_client_info[0] = '\0';
+	}
+	else
+	{
+		if(Last_client > 0)
+		{
+			strcat(dns_client_info,"+");
+			curr_conns[index++] = Last_client;
+		}
+		else
+		{
+			strcat(dns_client_info,"-");
+			curr_conns[index++] = -Last_client;
+		}
+	}
+	
+	for(i=0; i<index;i++)
+	{
+		dna_get_node_task(curr_conns[i], node, task);
+		strcat(dns_client_info,task);
+		strcat(dns_client_info,"@");
+		strcat(dns_client_info,node);
+		strcat(dns_client_info,"|");
+	}
+	if(index)
+		dns_client_info[strlen(dns_client_info)-1] = '\0';
+	*bufp = (int *)dns_info_buffer;
+	*size = strlen(dns_info_buffer)+1;
+}
+
+void append_service(char *service_info_buffer, SERVICE *servp)		
+{
+	char name[MAX_NAME], *ptr;
+
+		if(strstr(servp->name,"/RpcIn"))
+		{
+			strcpy(name,servp->name);
+			ptr = (char *)strstr(name,"/RpcIn");
+			*ptr = 0;
+			strcat(service_info_buffer, name);
+			strcat(service_info_buffer, "|");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(name,"/RpcOut");
+			if( (servp = find_service(name)) )
+			{
+				strcat(service_info_buffer, ",");
+				if(servp->def[0])
+				{
+					strcat(service_info_buffer, servp->def);
+				}
+			}
+			strcat(service_info_buffer, "|RPC");
+			strcat(service_info_buffer, "\n");
+		}
+		else if(strstr(servp->name,"/RpcOut"))
+		{
+/*
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(service_info_buffer, "|RPC");
+			strcat(service_info_buffer, "\n");
+
+*/
+		}
+		else
+		{
+			strcat(service_info_buffer, servp->name);
+			strcat(service_info_buffer, "|");
+			if(servp->def[0])
+			{
+				strcat(service_info_buffer, servp->def);
+			}
+			strcat(service_info_buffer, "|");
+			if(servp->type == COMMAND)
+			{
+				strcat(service_info_buffer, "CMD");
+			}
+			strcat(service_info_buffer, "\n");
+		}
+}
+
+void service_info(long *tag, int **bufp, int *size, int *first_time)
+{
+	register SERVICE *servp;
+	int max_size, done = 0;
+	static int curr_allocated_size = 0;
+	static char *service_info_buffer;
+	char *buff_ptr;
+	DIS_DNS_CONN *dnsp = (DIS_DNS_CONN *)*tag;
+	int hash_index;
+
+	DISABLE_AST
+	max_size = (dnsp->dis_n_services+10) * (MAX_NAME*2 + 4);
+	if(!curr_allocated_size)
+	{
+		service_info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	else if (max_size > curr_allocated_size)
+	{
+		free(service_info_buffer);
+		service_info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	service_info_buffer[0] = '\0';
+	buff_ptr = service_info_buffer;
+	servp = 0;
+	hash_index = -1;
+	if(*first_time)
+	{
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+		{
+			if(servp->dnsp != dnsp)
+				continue;
+			if(servp->registered)
+			{
+				servp->registered = 2;
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+			}
+		}
+	}
+	else
+	{
+		while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+		{
+			if(servp->dnsp != dnsp)
+				continue;
+			if(servp->registered == 1)
+			{
+				if(!done)
+				{
+					strcat(buff_ptr, "+");
+					buff_ptr += strlen(buff_ptr);
+					done = 1;
+				}
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+				servp->registered = 2;
+			}
+			else if(servp->registered == 0)
+			{
+				strcat(buff_ptr, "-");
+				buff_ptr += strlen(buff_ptr);
+				append_service(buff_ptr, servp);
+				buff_ptr += strlen(buff_ptr);
+			}
+		}
+	}
+	*bufp = (int *)service_info_buffer;
+	*size = buff_ptr - service_info_buffer+1;
+	ENABLE_AST
+}
+		
+void add_exit_handler(int *tag, int *bufp, int *size)
+{
+	EXIT_H *newp;
+
+	if(size){}
+	if(tag){}
+	if(*bufp)
+	{
+		if(!Exit_h_head) 
+		{
+			Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H));
+			sll_init( (SLL *) Exit_h_head );
+		}
+		newp = (EXIT_H *)malloc(sizeof(EXIT_H));
+		newp->conn_id = Curr_conn_id;
+		newp->exit_id = *bufp;
+		sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp );
+	}
+	else
+	{
+		if(!Exit_h_head) 
+			return;
+		if((newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&Curr_conn_id, 4)) )
+		{
+			sll_remove( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+}
+
+void dis_set_client_exit_handler(int conn_id, int tag)
+{
+	EXIT_H *newp;
+
+	DISABLE_AST
+	if(tag)
+	{
+		if(!Exit_h_head) 
+		{
+			Exit_h_head = (EXIT_H *)malloc(sizeof(EXIT_H));
+			sll_init( (SLL *) Exit_h_head );
+		}
+		if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&conn_id, 4)) )
+		{
+			newp->conn_id = conn_id;
+			newp->exit_id = tag;
+		}
+		else
+		{
+			newp = (EXIT_H *)malloc(sizeof(EXIT_H));
+			newp->conn_id = conn_id;
+			newp->exit_id = tag;
+			sll_insert_queue( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+	else
+	{
+		if(!Exit_h_head) 
+		{
+			ENABLE_AST
+			return;
+		}
+		if( (newp = (EXIT_H *)sll_search((SLL *) Exit_h_head, 
+			(char *)&conn_id, 4)) )
+		{
+			sll_remove( (SLL *) Exit_h_head, (SLL *) newp );
+		}
+	}
+	ENABLE_AST
+}
+
+int do_exit_handler(int conn_id)
+{
+	register EXIT_H *exitp;
+
+	DISABLE_AST;
+	if(!Exit_h_head)
+	{
+		ENABLE_AST;
+		return(0);
+	}
+	while( (exitp = (EXIT_H *) sll_search_next_remove((SLL *) Exit_h_head,
+							 0, (char *) &conn_id, 4)) )
+	{
+		(Client_exit_user_routine)( &exitp->exit_id );
+		free(exitp);
+	}
+	ENABLE_AST
+	return(1);
+}
+
+static void exit_handler(int *tag, int *bufp, int *size)
+{
+
+	if(size){}
+	if(tag){}
+	if(Exit_user_routine)
+		(Exit_user_routine)( bufp );
+	else
+	{
+/*
+		printf("%s PID %d Exiting!\n", Task_name, getpid());
+*/
+		exit(*bufp);
+	}
+}
+
+static void error_handler(int conn_id, int severity, int errcode, char *reason)
+{
+	int exit_tag, exit_code, exit_size;
+	int last_conn_id;
+
+	if(Error_user_routine)
+	{
+			Error_conn_id = conn_id;
+			last_conn_id = Curr_conn_id;
+			Curr_conn_id = conn_id;
+			(Error_user_routine)( severity, errcode, reason);
+			Error_conn_id = 0;
+			Curr_conn_id = last_conn_id;
+	}
+	else
+	{
+		dim_print_msg(reason, severity);
+	}
+	if(severity == DIM_FATAL)
+	{
+		exit_tag = 0;
+		exit_code = errcode;
+		exit_size = sizeof(int);
+		exit_handler(&exit_tag, &exit_code, &exit_size);
+	}
+}
+/*
+#define MAX_HASH_ENTRIES 2000
+*/
+#define MAX_HASH_ENTRIES 5000
+
+static SERVICE *Service_hash_table[MAX_HASH_ENTRIES];
+static int Service_new_entries[MAX_HASH_ENTRIES];
+
+int dis_hash_service_init()
+{
+  int i;
+  static int done = 0;
+
+  if(!done)
+  {
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		Service_hash_table[i] = (SERVICE *) malloc(8);
+		dll_init((DLL *) Service_hash_table[i]);
+		Service_new_entries[i] = 0;
+	}
+	done = 1;
+  }
+  return(1);
+}
+
+int dis_hash_service_insert(SERVICE *servp)
+{
+	int index;
+	index = HashFunction(servp->name, MAX_HASH_ENTRIES);
+	Service_new_entries[index]++;
+	dll_insert_queue((DLL *) Service_hash_table[index], 
+			 (DLL *) servp);
+	return(1);
+}
+
+int dis_hash_service_registered(int index, SERVICE *servp)
+{
+	servp->registered = 1;
+	Service_new_entries[index]--;
+	if(Service_new_entries[index] < 0)
+		Service_new_entries[index] = 0;
+	return 1;
+}
+
+int dis_hash_service_remove(SERVICE *servp)
+{
+	dll_remove( (DLL *) servp );
+	return(1);
+}
+
+
+SERVICE *dis_hash_service_exists(char *name)
+{
+	int index;
+	SERVICE *servp;
+
+	index = HashFunction(name, MAX_HASH_ENTRIES);
+	if( (servp = (SERVICE *) dll_search(
+					(DLL *) Service_hash_table[index],
+			      		name, strlen(name)+1)) )
+	{
+		return(servp);
+	}
+	return((SERVICE *)0);
+}			
+
+SERVICE *dis_hash_service_get_next(int *curr_index, SERVICE *prevp, int new_entries)
+{
+	int index;
+	SERVICE *servp = 0;
+/*
+	if(!prevp)
+	{
+		index = -1;
+	}
+*/
+	index = *curr_index;
+	if(index == -1)
+	{
+		index++;
+		prevp = Service_hash_table[index];
+	}
+	if(!prevp)
+	{
+		prevp = Service_hash_table[index];
+	}
+	do
+	{
+		if((!new_entries) || (Service_new_entries[index] > 0))
+		{
+			servp = (SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[index],
+						(DLL *) prevp);
+			if(servp)
+				break;
+		}
+		index++;
+		if(index == MAX_HASH_ENTRIES)
+		{
+			*curr_index = -1;
+			return((SERVICE *) 0);
+		}
+		prevp = Service_hash_table[index];
+	} while(!servp);
+	*curr_index = index;
+	return(servp);
+}
+
+DIS_DNS_CONN *dis_find_dns(long dnsid)
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = (DIS_DNS_CONN *)
+			dll_search( (DLL *) DNS_head, &dnsid, sizeof(dnsid));
+/*
+	if(!dnsp)
+	{
+		dnsp = create_dns(dnsid);
+	}
+*/
+	return dnsp;
+}
+
+int dis_no_dns()
+{
+	DIS_DNS_CONN *dnsp;
+
+	dnsp = (DIS_DNS_CONN *) DNS_head;
+	while ( (dnsp = (DIS_DNS_CONN *) dll_get_next( (DLL *) DNS_head, (DLL *) dnsp)))
+	{
+/*
+		if(dnsp != Default_DNS)
+			return 0;
+*/
+		if(dnsp->serving)
+			return 0;
+	}
+	return 1;
+}
+
+DIS_DNS_CONN *find_dns_by_conn_id(int conn_id)
+{
+	DIS_DNS_CONN *dnsp;
+	extern long dns_get_dnsid();
+	long dnsid;
+
+	dnsid = dns_get_dnsid(conn_id, SRC_DIS);
+	dnsp = dis_find_dns(dnsid);
+	if(!dnsp)
+		dnsp = Default_DNS;
+	return (DIS_DNS_CONN *)dnsp;
+}
+
+void dis_print_hash_table()
+{
+	SERVICE *servp;
+	int i;
+	int n_entries, max_entry_index = 0;
+	int max_entries = 0;
+
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		n_entries = 0;
+		servp = Service_hash_table[i];
+		while( (servp = (SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[i],
+						(DLL *) servp)) )
+		{
+			n_entries++;
+			if(n_entries == 1)
+				printf("    Name = %s\n",servp->name);
+		}
+		if(n_entries != 0)
+			printf("HASH[%d] - %d entries\n", i, n_entries);
+		if(n_entries > max_entries)
+		{
+			max_entries = n_entries;
+			max_entry_index = i;
+		}
+	}
+	printf("Maximum : HASH[%d] - %d entries\n", max_entry_index, max_entries);  
+	fflush(stdout);
+}
+
+void dis_hash_print()
+{
+	SERVICE *servp;
+	int hash_index;
+
+	servp = 0;
+	hash_index = -1;
+	while( (servp = dis_hash_service_get_next(&hash_index, servp, 0)) )
+	{
+		printf("Name = %s\n",servp->name);
+	}
+}
+
+#ifdef VMS
+/* CFORTRAN WRAPPERS */
+FCALLSCFUN1(INT, dis_start_serving, DIS_START_SERVING, dis_start_serving,
+				 STRING)
+FCALLSCFUN3(INT, dis_get_next_cmnd, DIS_GET_NEXT_CMND, dis_get_next_cmnd,
+				 PINT, PVOID, PINT)
+FCALLSCFUN1(INT, dis_get_client, DIS_GET_CLIENT, dis_get_client,
+				 PSTRING)
+FCALLSCFUN6(INT, dis_add_service, DIS_ADD_SERVICE, dis_add_service,
+				 STRING, PVOID, PVOID, INT, PVOID, INT)
+FCALLSCSUB4(	 dis_add_cmnd, DIS_ADD_CMND, dis_add_cmnd,
+				 STRING, PVOID, PVOID, INT)
+FCALLSCSUB1(	 dis_add_client_exit_handler, DIS_ADD_CLIENT_EXIT_HANDLER, 
+				 dis_add_client_exit_handler,
+				 PVOID)
+FCALLSCSUB2(	 dis_set_client_exit_handler, DIS_SET_CLIENT_EXIT_HANDLER, 
+				 dis_set_client_exit_handler,
+				 INT, INT)
+FCALLSCSUB1(	 dis_add_exit_handler, DIS_ADD_EXIT_HANDLER, 
+				 dis_add_exit_handler,
+				 PVOID)
+FCALLSCSUB1(	 dis_report_service, DIS_REPORT_SERVICE, dis_report_service,
+				 STRING)
+FCALLSCSUB2(	 dis_convert_str, DIS_CONVERT_STR, dis_convert_str,
+				 PVOID, PVOID)
+FCALLSCFUN1(INT, dis_update_service, DIS_UPDATE_SERVICE, dis_update_service,
+				 INT)
+FCALLSCFUN1(INT, dis_remove_service, DIS_REMOVE_SERVICE, dis_remove_service,
+				 INT)
+FCALLSCSUB3(	 dis_send_service, DIS_SEND_SERVICE, dis_send_service,
+				 INT, PVOID, INT)
+FCALLSCSUB2(	 dis_set_quality, DIS_SET_QUALITY, dis_set_quality,
+                 INT, INT)
+FCALLSCSUB3(INT, dis_set_timestamp, DIS_SET_TIMESTAMP, dis_set_timestamp,
+                 INT, INT, INT)
+FCALLSCFUN2(INT, dis_selective_update_service, DIS_SELECTIVE_UPDATE_SERVICE, 
+				 dis_selective_update_service,
+				 INT, PINT)
+FCALLSCSUB3(INT, dis_get_timestamp, DIS_GET_TIMESTAMP, dis_get_timestamp,
+                 INT, PINT, PINT)
+#endif
Index: /trunk/FACT++/dim_v19r15/src/discpp.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/discpp.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/discpp.cxx	(revision 10183)
@@ -0,0 +1,1426 @@
+#define DIMLIB
+#include <dis.hxx>
+#include "tokenstring.hxx"
+//#include <iostream>
+//using namespace std;
+#include <time.h>
+//#include <sys/timeb.h>
+
+DimClientExitHandler *DimServer::itsClientExit = 0;
+DimExitHandler *DimServer::itsExit = 0;
+DimErrorHandler *DimServer::itsSrvError = 0;
+char *DimServer::itsName = 0;
+char *DimServer::clientName = 0;
+char *DimServer::dimDnsNode = 0;
+int DimServer::autoStart = 1;
+//int DimServer::itsNServices = 0;
+
+extern "C" {
+static void user_routine( void *tagp, void **buf, int *size, int *first_time)
+{
+//	int *tag = (int *)tagp;
+//	int id = *tag;
+	DimService *t;
+
+	if(first_time){}
+//	t = (DimService *)id_get_ptr(id, SRC_DIS);
+	t = *(DimService **)tagp;
+	if( t->itsServiceHandler ) {
+		t->itsServiceHandler->itsService = t;
+		DimCore::inCallback = 2;
+		t->itsServiceHandler->serviceHandler();
+		DimCore::inCallback = 0;
+	}
+	else
+	{
+		DimCore::inCallback = 2;
+		t->serviceHandler();
+		DimCore::inCallback = 0;
+	}
+	if( t->itsType == DisSTRING)
+			t->itsSize = strlen((char *)t->itsData)+1;
+	*buf = t->itsData;
+	*size = t->itsSize;
+}
+}
+
+void DimService::declareIt(char *name, char *format, DimServiceHandler *handler, DimServerDns *dns)
+{
+//	itsTagId = 0;
+	itsDns = dns;
+	itsName = new char[strlen(name)+1];
+	itsDataSize = 0;
+	strcpy( itsName, name);
+	if(handler)
+		itsServiceHandler = handler;
+	else
+		itsServiceHandler = 0;
+//	itsTagId = id_get((void *)this, SRC_DIS);
+	if(itsDns == 0)
+	{
+		itsId = dis_add_service( name, format, NULL, 0, 
+//				user_routine, itsTagId);
+				user_routine, (long)this);
+		DimServer::start();
+	}
+	else
+	{
+		itsId = dis_add_service_dns( itsDns->getDnsId(), name, format, NULL, 0, 
+//				user_routine, itsTagId);
+				user_routine, (long)this);
+//		itsDns->addServiceId(itsId);
+		DimServer::start(itsDns);
+	}
+}
+
+void DimService::storeIt(void *data, int size)
+{
+
+	if(!itsDataSize)
+	{
+		itsData = new char[size];
+		itsDataSize = size;
+	}
+	else if(itsDataSize < size)
+	{
+		delete[] (char *)itsData;
+		itsData = new char[size];
+		itsDataSize = size;
+	}
+	memcpy(itsData, data, size);
+	itsSize = size;
+}
+
+extern "C" {
+static void command_routine( void *tagp, void *buf, int *size)
+{
+//	int *tag = (int *)tagp;
+//	int id = *tag;
+	DimCommand *t;
+
+//	t = (DimCommand *)id_get_ptr(id, SRC_DIS);
+	t = *(DimCommand **)tagp;
+	t->itsData = buf;
+	t->itsSize = *size;
+	t->secs = 0;
+	if( t->itsCommandHandler ) {
+		t->itsCommandHandler->itsCommand = t;
+		DimCore::inCallback = 2;
+		t->itsCommandHandler->commandHandler();
+		DimCore::inCallback = 0;
+	}
+	else
+	{
+		DimCore::inCallback = 2;
+		t->commandHandler();
+		DimCore::inCallback = 0;
+	}
+	t->itsData = 0;
+	t->itsSize = 0;
+}
+}
+
+void DimCommand::declareIt(char *name, char *format, DimCommandHandler *handler, DimServerDns *dns)
+{
+//	itsTagId = 0;
+	itsDns = dns;
+	itsName = new char[strlen(name)+1];
+	strcpy( itsName, name);
+	itsFormat = new char[strlen(format)+1];
+	strcpy( itsFormat, format);
+	currCmnd = 0;
+	if(handler)
+		itsCommandHandler = handler;
+	else
+		itsCommandHandler = 0;
+//	itsTagId = id_get((void *)this, SRC_DIS);
+	if(!itsDns)
+	{
+		itsId = dis_add_cmnd( name, format, command_routine,
+//				itsTagId);
+				(long)this);
+		DimServer::start();
+	}
+	else
+	{
+		itsId = dis_add_cmnd_dns( itsDns->getDnsId(), name, format, command_routine,
+//			itsTagId);
+			(long)this);
+//		itsDns->addServiceId(itsId);
+		DimServer::start(itsDns);
+	}
+}
+
+extern "C" {
+/*
+static void timeout_rout(DimRpc *t)
+{
+	sleep(t->itsTimeout);
+	t->itsKilled = 1;
+}
+*/
+static void rpcin_routine( void *tagp, void *buf, int *size)
+{
+	time_t tt1 = 0, tt2 = 0;
+
+//	int *tag = (int *)tagp;
+//	int id = *tag;
+	DimRpc *t;
+	int tout, clientId, ids[2];
+//	long tid;
+
+//	t = (DimRpc *)id_get_ptr(id, SRC_DIS);
+	t = *(DimRpc **)tagp;
+	t->itsDataIn = buf;
+	t->itsSizeIn = *size;
+	clientId = dis_get_conn_id();
+	tout = dis_get_timeout(t->itsIdOut, clientId);
+	t->itsTimeout = tout;
+//	tid = 0;
+	if(tout > 0)
+	{
+		tt1 = time((time_t *)0);
+		t->itsKilled = 0;
+//		dtq_start_timer(t->itsTimeout,(void(*)(void *))timeout_rout,(void *)t);
+//		tid = dim_start_thread((void(*)(void *))timeout_rout,(void *)t);
+	}
+	DimCore::inCallback = 2;
+	t->rpcHandler();
+	DimCore::inCallback = 0;
+	t->itsDataIn = 0;
+	t->itsSizeIn = 0;
+	if(tout > 0)
+	{
+		tt2 = time((time_t *)0);
+		if((tt2 - tt1) > tout)
+			t->itsKilled = 1;
+	}
+	if(!t->itsKilled)
+	{
+//		if(tid)
+//		{
+//			dtq_stop_timer((void *)t);
+//			dim_stop_thread(tid);
+//		}
+		ids[0] = clientId;
+		ids[1] = 0;
+		dis_selective_update_service(t->itsIdOut, ids);
+	}
+}
+
+}
+
+extern "C" {
+static void rpcout_routine( void *tagp, void **buf, int *size, int *first_time)
+{
+//	int *tag = (int *)tagp;
+//	int id = *tag;
+	DimRpc *t;
+
+	if(first_time){}
+//	t = (DimRpc *)id_get_ptr(id, SRC_DIS);
+	t = *(DimRpc**)tagp;
+	*buf = t->itsDataOut;
+	*size = t->itsSizeOut;
+}
+}
+
+void DimRpc::declareIt(char *name, char *formatin, char *formatout, DimServerDns *dns)
+{
+//	itsTagId = 0;
+	itsDns = dns;
+	itsName = new char[strlen(name)+1];
+	strcpy( itsName, name);
+	itsNameIn = new char[strlen(name)+1+10];
+	strcpy( itsNameIn, name);
+	strcat(itsNameIn,(char *)"/RpcIn");
+	itsNameOut = new char[strlen(name)+1+10];
+	strcpy( itsNameOut, name);
+	strcat(itsNameOut,(char *)"/RpcOut");
+	itsDataOut = new char[1];
+	itsDataOutSize = itsSizeOut = 1;
+	itsKilled = 0;
+	itsTimeout = 0;
+	
+//	itsTagId = id_get((void *)this, SRC_DIS);
+	if(!itsDns)
+	{
+		itsIdIn = dis_add_cmnd( itsNameIn, formatin, 
+//			rpcin_routine, itsTagId);
+			rpcin_routine, (long)this);
+		itsIdOut = dis_add_service( itsNameOut, formatout, 0,0, 
+//			rpcout_routine, itsTagId);
+			rpcout_routine, (long)this);
+		DimServer::start();
+	}
+	else
+	{
+		itsIdIn = dis_add_cmnd_dns( itsDns->getDnsId(), itsNameIn, formatin, 
+//			rpcin_routine, itsTagId);
+			rpcin_routine, (long)this);
+		itsIdOut = dis_add_service_dns( itsDns->getDnsId(), itsNameOut, formatout, 0,0, 
+//			rpcout_routine, itsTagId);
+			rpcout_routine, (long)this);
+//		itsDns->addServiceId(itsIdIn);
+//		itsDns->addServiceId(itsIdOut);
+		DimServer::start(itsDns);
+	}
+}
+
+void DimRpc::storeIt(void *data, int size)
+{
+
+	if(!itsDataOutSize)
+	{
+		itsDataOut = new char[size];
+		itsDataOutSize = size;
+	}
+	else if(itsDataOutSize < size)
+	{
+		delete[] (char *)itsDataOut;
+		itsDataOut = new char[size];
+		itsDataOutSize = size;
+	}
+	memcpy(itsDataOut, data, size);
+	itsSizeOut = size;
+}
+
+extern "C" {
+static void client_exit_user_routine(int*);
+static void exit_user_routine(int*);
+static void srv_error_user_routine(int, int, char*);
+}
+
+DimServerDns::DimServerDns(const char *node)
+{
+	init(node, 0);
+}
+	
+DimServerDns::DimServerDns(const char *node, int port)
+{
+	init(node, port);
+}
+
+DimServerDns::DimServerDns(const char *node, int port, char *name)
+{
+	init(node, port);
+	DimServer::start(this, name);
+}
+	
+#define DisDnsIdBlock 100
+
+void DimServerDns::init(const char *node, int port)
+{
+	if(!itsNode)
+	{
+		itsNode = new char[strlen(node)+1];
+		strcpy(itsNode,node);
+	}
+	itsPort = port;
+	autoStart = 1;
+	itsName = 0;
+	itsServiceIdList = new int[DisDnsIdBlock];
+	itsServiceIdListSize = DisDnsIdBlock;
+	itsNServiceIds = 0;
+//	itsNServices = 0;
+	itsDnsId = DimServer::addDns(node, port);
+}
+
+void DimServerDns::addServiceId(int id)
+{
+	int *tmp;
+
+	DISABLE_AST
+	if((itsNServiceIds + 2) > itsServiceIdListSize)
+	{
+		tmp = new int[itsServiceIdListSize + DisDnsIdBlock];
+		memcpy(tmp, itsServiceIdList, itsServiceIdListSize*sizeof(int));
+		delete itsServiceIdList;
+		itsServiceIdList = tmp;
+		itsServiceIdListSize += DisDnsIdBlock;
+	}
+	itsServiceIdList[itsNServiceIds] = id;
+	itsServiceIdList[itsNServiceIds+1] = 0;
+	itsNServiceIds++;
+	ENABLE_AST
+}
+
+int *DimServerDns::getServiceIdList()
+{
+	int *list;
+	if(itsNServiceIds)
+		list = itsServiceIdList;
+	else
+		list = 0;
+	itsNServiceIds = 0;
+	return list;
+}
+
+DimServerDns::~DimServerDns()
+{
+	if(itsName)
+	{
+		DimServer::stop(this);
+		delete[] itsName;
+	}
+	if(itsNode)
+		delete[] itsNode;
+}
+
+long DimServerDns::getDnsId()
+{
+	return itsDnsId;
+}
+
+void DimServerDns::setName(const char *name)
+{
+	if(!itsName)
+	{
+		itsName = new char[strlen(name)+1];
+		strcpy(itsName,name);
+	}
+}
+
+char *DimServerDns::getName()
+{
+	return itsName;
+}
+
+void DimServerDns::autoStartOn()
+{
+	autoStart = 1;
+}
+
+void DimServerDns::autoStartOff()
+{
+	autoStart = 0;
+}
+
+int DimServerDns::isAutoStart()
+{
+	return autoStart;
+}
+
+DimServer::DimServer()
+{
+	itsClientExit = this; 
+	itsExit = this;
+	itsSrvError = this;
+//	itsNServices = 0;
+}
+
+DimServer::~DimServer() 
+{
+	if(itsName)
+	{
+		dis_stop_serving();
+		delete[] itsName;
+	}
+	if(clientName)
+		delete[] clientName;
+	if(dimDnsNode)
+		delete[] dimDnsNode;
+}
+
+void DimServer::start(const char *name)
+{
+	if(!itsName)
+	{
+		itsName = new char[strlen(name)+1];
+		strcpy(itsName,name);
+	}
+	dis_start_serving(itsName);
+}
+
+void DimServer::start(DimServerDns *dns, const char *name)
+{
+	long dnsid;
+
+	DISABLE_AST
+	dns->setName(name);
+	dnsid = dns->getDnsId();
+	dis_start_serving_dns(dnsid, (char *)name /*, dns->getServiceIdList()*/);
+	ENABLE_AST
+}
+/*
+void DimServer::threadHandler()
+{
+	int oldNServices;
+
+	while(1)
+	{
+		oldNServices = itsNServices;
+		usleep(100000);
+		if(oldNServices == itsNServices)
+			break;
+	}
+cout << "Starting " << itsNServices << endl;
+	{
+		DISABLE_AST
+		dis_start_serving(itsName);
+		itsNServices = 0;
+		ENABLE_AST
+	}
+
+}
+*/
+void DimServer::start()
+{
+//	itsNServices++;
+	if((itsName) && (autoStart))
+	{
+//		DimThread::start();
+		dis_start_serving(itsName);
+	}
+}
+
+void DimServer::start(DimServerDns *dns)
+{
+	long dnsid;
+	char *name;
+	int isAuto;
+
+	DISABLE_AST
+//	dns->itsNServices++;
+
+	name = dns->getName();
+	dnsid = dns->getDnsId();
+	isAuto = dns->isAutoStart();
+	if((name) && (isAuto))
+	{
+//		DimThread::start();
+		dis_start_serving_dns(dnsid, (char *)name /*, dns->getServiceIdList()*/);
+	}
+	ENABLE_AST
+}
+
+void DimServer::stop()
+{
+	dis_stop_serving();
+}
+
+void DimServer::stop(DimServerDns *dns)
+{
+	dis_stop_serving_dns(dns->getDnsId());
+}
+
+void DimServer::autoStartOn()
+{
+	autoStart = 1;
+}
+
+void DimServer::autoStartOff()
+{
+	autoStart = 0;
+}
+	
+int DimServer::getClientId()
+{
+	if(!clientName)
+		clientName = new char[128];
+	clientName[0] = '\0';
+	return dis_get_client(clientName);
+}
+	
+char *DimServer::getClientName()
+{
+	if(!clientName)
+		clientName = new char[128];
+	clientName[0] = '\0';
+	dis_get_client(clientName);
+	return(clientName);
+}
+/*
+char *DimServer::getClientServices()
+{
+	int id;
+	if((id = dis_get_conn_id()))
+		return dis_get_client_services(id);
+	return (char *)0;
+}
+
+char *DimServer::getClientServices(int clientId)
+{
+	return dis_get_client_services(clientId);
+}
+*/
+char **DimServer::getClientServices()
+{
+	static TokenString *data = 0;
+	int id, len = 0, index = 0;
+	char *services;
+	static char** list = 0;
+	char *sep;
+
+	if(data)
+	{
+		delete data;
+		data = 0;
+	}
+	if(list)
+	{
+		delete[] list;
+		list = 0;
+	}
+	if((id = dis_get_conn_id()))
+	{
+		services = dis_get_client_services(id);
+		if(services)
+		{
+			data = new TokenString(services,(char *)"\n");
+			len = data->getNTokens();
+			list = new char*[len];
+			while(data->getToken(list[index]))
+			{
+				data->getToken(sep);
+				index++;
+			}
+		}
+	}
+	if(!len)
+		list = new char*[1];
+	list[index] = 0;
+	return list;
+}
+
+void DimServer::setClientExitHandler(int clientId)
+{
+	dis_set_client_exit_handler(clientId, 1);
+}
+
+void DimServer::clearClientExitHandler(int clientId)
+{
+	dis_set_client_exit_handler(clientId, 0);
+}
+
+void DimServer::addClientExitHandler(DimClientExitHandler *handler)
+{
+	DimServer::itsClientExit = handler;
+	dis_add_client_exit_handler(client_exit_user_routine);
+}
+
+void DimServer::addClientExitHandler()
+{
+	DimServer::itsClientExit = this;
+	dis_add_client_exit_handler(client_exit_user_routine);
+}
+
+void DimServer::addExitHandler(DimExitHandler *handler)
+{
+	DimServer::itsExit = handler;
+	dis_add_exit_handler(exit_user_routine);
+}
+
+void DimServer::addErrorHandler(DimErrorHandler *handler)
+{
+	DimServer::itsSrvError = handler;
+	dis_add_error_handler(srv_error_user_routine);
+}
+
+int DimServer::setDnsNode(const char *node) 
+{
+	return dis_set_dns_node((char *)node); 
+}
+
+int DimServer::setDnsNode(const char *node, int port) 
+{
+	dis_set_dns_port(port);
+	return dis_set_dns_node((char *)node); 
+}
+
+long DimServer::addDns(const char *node, int port) 
+{
+	return dis_add_dns((char *)node, port); 
+}
+char *DimServer::getDnsNode() 
+{
+	if(!dimDnsNode)
+		dimDnsNode = new char[256];
+	if(dis_get_dns_node(dimDnsNode))
+		return dimDnsNode;
+	else
+		return 0; 
+}
+
+int DimServer::getDnsPort() 
+{
+	return dis_get_dns_port();
+}
+
+void DimServer::setWriteTimeout(int secs)
+{
+	dim_set_write_timeout(secs); 
+}
+
+int DimServer::getWriteTimeout() 
+{
+	return dim_get_write_timeout();
+}
+
+void DimServer::addExitHandler()
+{
+	DimServer::itsExit = this;
+	dis_add_exit_handler(exit_user_routine);
+}
+
+void DimServer::addErrorHandler()
+{
+	DimServer::itsSrvError = this;
+	dis_add_error_handler(srv_error_user_routine);
+}
+
+extern "C" {
+static void client_exit_user_routine(int *idp)
+{
+	int id = *idp;
+
+	id++;
+	DimCore::inCallback = 2;
+	DimServer::itsClientExit->clientExitHandler();
+	DimCore::inCallback = 0;
+}
+
+static void exit_user_routine(int *idp)
+{
+//	int id = *idp;
+
+//	id++;
+	DimCore::inCallback = 2;
+	DimServer::itsExit->exitHandler(*idp);
+	DimCore::inCallback = 0;
+}
+
+static void srv_error_user_routine(int severity, int code, char *msg)
+{
+
+	DimCore::inCallback = 2;
+	DimServer::itsSrvError->errorHandler(severity, code, msg);
+	DimCore::inCallback = 0;
+}
+
+}
+
+
+DimService::DimService()
+{
+//	itsTagId = 0;
+}
+
+DimService::DimService(const char *name, int &value) 
+{
+	itsData = &value;
+	itsSize = sizeof(int);
+	itsType = DisINT;
+	declareIt((char *)name, (char *)"L", 0, 0);
+}
+
+DimService::DimService(const char *name, float &value)
+{
+	itsData = &value;
+	itsSize = sizeof(float);
+	itsType = DisFLOAT;
+	declareIt((char *)name, (char *)"F", 0, 0);
+}
+
+DimService::DimService(const char *name, double &value)
+{
+	itsData = &value;
+	itsSize = sizeof(double);
+	itsType = DisDOUBLE;
+	declareIt((char *)name, (char *)"D", 0, 0);
+}
+
+DimService::DimService(const char *name, longlong &value)
+{
+	itsData = &value;
+	itsSize = sizeof(longlong);
+	itsType = DisXLONG;
+	declareIt((char *)name, (char *)"X", 0, 0);
+}
+
+DimService::DimService(const char *name, short &value)
+{
+	itsData = &value;
+	itsSize = sizeof(short);
+	itsType = DisSHORT;
+	declareIt((char *)name, (char *)"S", 0, 0);
+}
+
+DimService::DimService(const char *name, char *string)
+{
+	itsData = string;
+	itsSize = strlen(string)+1;
+	itsType = DisSTRING;
+	declareIt((char *)name, (char *)"C", 0, 0);
+}
+
+DimService::DimService(const char *name, char *format, void *structure, int size)
+{
+	itsData = structure;
+	itsSize = size;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, 0, 0);
+}
+
+DimService::DimService(const char *name, char *format, DimServiceHandler *handler)
+{
+	itsData = 0;
+	itsSize = 0;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, handler, 0);
+}
+
+DimService::DimService(const char *name, const char *format, void *structure, int size)
+{
+	itsData = structure;
+	itsSize = size;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, 0, 0);
+}
+
+DimService::DimService(const char *name, const char *format, DimServiceHandler *handler)
+{
+	itsData = 0;
+	itsSize = 0;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, handler, 0);
+}
+
+// with Dns
+
+DimService::DimService(DimServerDns *dns, const char *name, int &value) 
+{
+	itsData = &value;
+	itsSize = sizeof(int);
+	itsType = DisINT;
+	declareIt((char *)name, (char *)"L", 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, float &value)
+{
+	itsData = &value;
+	itsSize = sizeof(float);
+	itsType = DisFLOAT;
+	declareIt((char *)name, (char *)"F", 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, double &value)
+{
+	itsData = &value;
+	itsSize = sizeof(double);
+	itsType = DisDOUBLE;
+	declareIt((char *)name, (char *)"D", 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, longlong &value)
+{
+	itsData = &value;
+	itsSize = sizeof(longlong);
+	itsType = DisXLONG;
+	declareIt((char *)name, (char *)"X", 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, short &value)
+{
+	itsData = &value;
+	itsSize = sizeof(short);
+	itsType = DisSHORT;
+	declareIt((char *)name, (char *)"S", 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, char *string)
+{
+	itsData = string;
+	itsSize = strlen(string)+1;
+	itsType = DisSTRING;
+	declareIt((char *)name, (char *)"C", 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, char *format, void *structure, int size)
+{
+	itsData = structure;
+	itsSize = size;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, char *format, DimServiceHandler *handler)
+{
+	itsData = 0;
+	itsSize = 0;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, handler, dns);
+}
+
+
+DimService::DimService(DimServerDns *dns, const char *name, const char *format, void *structure, int size)
+{
+	itsData = structure;
+	itsSize = size;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, 0, dns);
+}
+
+DimService::DimService(DimServerDns *dns, const char *name, const char *format, DimServiceHandler *handler)
+{
+	itsData = 0;
+	itsSize = 0;
+	itsType = DisPOINTER;
+	declareIt((char *)name, (char *)format, handler, dns);
+}
+
+
+DimService::~DimService()
+{
+	delete[] itsName;
+	if(itsDataSize)
+		delete[] (char *)itsData;
+//	if(itsTagId)
+//		id_free(itsTagId, SRC_DIS);
+	dis_remove_service( itsId );
+}
+
+int DimService::updateService()
+{
+	return dis_update_service( itsId );
+}
+
+int DimService::updateService( int &value )
+{
+	if( itsType == DisINT)
+	{
+		itsData = &value;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+
+int DimService::updateService( float &value )
+{
+	if( itsType == DisFLOAT) {
+		itsData = &value;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+
+int DimService::updateService( double &value )
+{
+	if( itsType == DisDOUBLE) {
+		itsData = &value;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+
+int DimService::updateService( longlong &value )
+{
+	if( itsType == DisXLONG)
+	{
+		itsData = &value;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+
+int DimService::updateService( short &value )
+{
+	if( itsType == DisSHORT)
+	{
+		itsData = &value;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+
+int DimService::updateService( char *string )
+{
+	if( itsType == DisSTRING)
+	{
+		itsData = string;
+		itsSize = strlen(string)+1;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+	
+int DimService::updateService( void *structure, int size )
+{
+	if( itsType == DisPOINTER)
+	{
+		itsData = structure;
+		itsSize = size;
+		return dis_update_service( itsId );
+	}
+	return -1;
+}
+	
+int DimService::selectiveUpdateService(int *cids)
+{
+	if( cids == 0)
+	{
+		int ids[2];
+		ids[0] = DimServer::getClientId();
+		ids[1] = 0;
+		return dis_selective_update_service( itsId, ids );
+	} 
+	return dis_selective_update_service( itsId, cids );
+}
+
+int DimService::selectiveUpdateService( int &value, int *cids)
+{
+	if( itsType == DisINT)
+	{
+		itsData = &value;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+
+int DimService::selectiveUpdateService( float &value, int *cids )
+{
+	if( itsType == DisFLOAT)
+	{
+		itsData = &value;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+
+int DimService::selectiveUpdateService( double &value, int *cids )
+{
+	if( itsType == DisDOUBLE)
+	{
+		itsData = &value;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+
+int DimService::selectiveUpdateService( longlong &value, int *cids )
+{
+	if( itsType == DisXLONG) 
+	{
+		itsData = &value;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+
+int DimService::selectiveUpdateService( short &value, int *cids )
+{
+	if( itsType == DisSHORT) 
+	{
+		itsData = &value;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+
+int DimService::selectiveUpdateService( char *string, int *cids )
+{
+	if( itsType == DisSTRING)
+	{
+		itsData = string;
+		itsSize = strlen(string)+1;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+	
+int DimService::selectiveUpdateService( void *structure, int size, int *cids )
+{
+	if( itsType == DisPOINTER)
+	{
+		itsData = structure;
+		itsSize = size;
+		if( cids == 0)
+		{
+			int ids[2];
+			ids[0] = DimServer::getClientId();
+			ids[1] = 0;
+			return dis_selective_update_service( itsId, ids );
+		} 
+		return dis_selective_update_service( itsId, cids );
+	}
+	return -1;
+}
+	
+void DimService::setQuality(int quality)
+{
+	dis_set_quality( itsId, quality );
+}
+
+void DimService::setTimestamp(int secs, int millisecs)
+{ 
+	dis_set_timestamp( itsId, secs, millisecs );
+}
+
+void DimService::setData(void *data, int size)
+{
+	storeIt(data, size);
+}
+
+void DimService::setData(int &data)
+{
+	storeIt(&data, sizeof(int));
+}
+
+void DimService::setData(float &data)
+{
+	storeIt(&data, sizeof(float));
+}
+
+void DimService::setData(double &data)
+{
+	storeIt(&data, sizeof(double));
+}
+
+void DimService::setData(longlong &data)
+{
+	storeIt(&data, sizeof(longlong));
+}
+
+void DimService::setData(short &data)
+{
+	storeIt(&data, sizeof(short));
+}
+
+void DimService::setData(char *data)
+{
+	storeIt(data, strlen(data)+1);
+}
+
+char *DimService::getName()
+{
+	return itsName;
+}
+
+int DimService::getTimeout(int clientId)
+{
+	return dis_get_timeout(itsId, clientId);
+}
+
+int DimService::getNClients()
+{
+	return dis_get_n_clients( itsId );
+}
+
+
+CmndInfo::CmndInfo(void *data, int datasize, int tsecs, int tmillisecs)
+{
+	itsData = new char[datasize];
+	itsDataSize = datasize;
+	secs = tsecs;
+	millisecs = tmillisecs;
+	memcpy(itsData, data, datasize);
+}
+
+CmndInfo::~CmndInfo()
+{
+	delete[] (char *)itsData;
+}
+
+
+DimCommand::DimCommand(const char *name, char *format)
+{
+	declareIt( (char *)name, (char *)format, 0, 0);
+}
+
+DimCommand::DimCommand(const char *name, char *format, DimCommandHandler *handler)
+{
+	declareIt( (char *)name, (char *)format, handler, 0);
+}
+
+DimCommand::DimCommand(DimServerDns *dns, const char *name, char *format)
+{
+	declareIt( (char *)name, (char *)format, 0, dns);
+}
+
+DimCommand::DimCommand(DimServerDns *dns, const char *name, char *format, DimCommandHandler *handler)
+{
+	declareIt( (char *)name, (char *)format, handler, dns);
+}
+
+
+DimCommand::DimCommand(const char *name, const char *format)
+{
+	declareIt( (char *)name, (char *)format, 0, 0);
+}
+
+DimCommand::DimCommand(const char *name, const char *format, DimCommandHandler *handler)
+{
+	declareIt( (char *)name, (char *)format, handler, 0);
+}
+
+DimCommand::DimCommand(DimServerDns *dns, const char *name, const char *format)
+{
+	declareIt( (char *)name, (char *)format, 0, dns);
+}
+
+DimCommand::DimCommand(DimServerDns *dns, const char *name, const char *format, DimCommandHandler *handler)
+{
+	declareIt( (char *)name, (char *)format, handler, dns);
+}
+
+int DimCommand::getNext()
+{
+	CmndInfo *cmndptr;
+	if(currCmnd)
+	{
+		delete currCmnd;
+		currCmnd = 0;
+		itsData = 0;
+		itsSize = 0;
+	}
+	if ((cmndptr = (CmndInfo *)itsCmndList.removeHead()))
+	{
+		currCmnd = cmndptr;
+		itsData = currCmnd->itsData;
+		itsSize = currCmnd->itsDataSize;
+		secs = currCmnd->secs;
+		millisecs = currCmnd->millisecs;
+		return(1);
+	}
+	return(0);
+}
+
+int DimCommand::hasNext()
+{
+	if ((CmndInfo *)itsCmndList.getHead())
+	{
+		return(1);
+	}
+	return(0);
+}
+
+void *DimCommand::getData()
+{
+	return itsData;
+}
+
+int DimCommand::getInt()
+{
+	return *(int *)itsData;
+}
+
+float DimCommand::getFloat()
+{
+	return *(float *)itsData;
+}
+
+double DimCommand::getDouble()
+{
+	return *(double *)itsData;
+}
+
+longlong DimCommand::getLonglong()
+{
+	return *(longlong *)itsData;
+}
+
+short DimCommand::getShort()
+{
+	return *(short *)itsData;
+}
+
+char *DimCommand::getString()
+{
+	return (char *)itsData;
+}
+
+int DimCommand::getSize()
+{
+	return itsSize;
+}
+
+char *DimCommand::getFormat()
+{
+	return itsFormat;
+}
+
+int DimCommand::getTimestamp()
+{
+	int ret;
+
+	if(secs == 0)
+		ret = dis_get_timestamp(itsId, &secs, &millisecs);
+	return(secs);
+}
+
+int DimCommand::getTimestampMillisecs()
+{
+	return(millisecs);
+}
+
+void DimCommand::commandHandler() 
+{
+	CmndInfo *cmndptr;
+	int tsecs, tmillisecs;
+
+	tsecs = getTimestamp();
+	tmillisecs = getTimestampMillisecs();
+	cmndptr = new CmndInfo(getData(), getSize(), tsecs, tmillisecs);
+	itsCmndList.add(cmndptr);
+}
+
+char *DimCommand::getName()
+{
+	return itsName;
+}
+
+DimCommand::~DimCommand()
+{
+	delete[] itsName;
+	delete[] itsFormat;
+//	if(itsTagId)
+//		id_free(itsTagId, SRC_DIS);
+	dis_remove_service( itsId );
+}
+
+DimRpc::DimRpc()
+{
+}
+
+DimRpc::DimRpc(const char *name, const char *formatin, const char *formatout)
+{
+	declareIt( (char *)name, (char *)formatin, (char *)formatout, 0);
+}
+
+DimRpc::DimRpc(DimServerDns *dns, const char *name, const char *formatin, const char *formatout)
+{
+	declareIt( (char *)name, (char *)formatin, (char *)formatout, dns);
+}
+
+DimRpc::~DimRpc()
+{
+	delete[] itsName;
+	delete[] itsNameIn;
+	delete[] itsNameOut;
+//	if(itsTagId)
+//		id_free(itsTagId, SRC_DIS);
+	dis_remove_service( itsIdIn );
+	dis_remove_service( itsIdOut );
+}
+
+void *DimRpc::getData()
+{
+	return itsDataIn;
+}
+
+int DimRpc::getInt()
+{
+	return *(int *)itsDataIn;
+}
+
+float DimRpc::getFloat()
+{
+	return *(float *)itsDataIn;
+}
+
+double DimRpc::getDouble()
+{
+	return *(double *)itsDataIn;
+}
+
+longlong DimRpc::getLonglong()
+{
+	return *(longlong *)itsDataIn;
+}
+
+short DimRpc::getShort()
+{
+	return *(short *)itsDataIn;
+}
+
+char *DimRpc::getString()
+{
+	return (char *)itsDataIn;
+}
+
+int DimRpc::getSize()
+{
+	return itsSizeIn;
+}
+
+void DimRpc::setData(void *data, int size)
+{
+	storeIt(data,size);
+}
+
+void DimRpc::setData(int &data)
+{
+	storeIt(&data,sizeof(int));
+}
+
+void DimRpc::setData(float &data)
+{
+	storeIt(&data,sizeof(float));
+}
+
+void DimRpc::setData(double &data)
+{
+	storeIt(&data,sizeof(double));
+}
+
+void DimRpc::setData(longlong &data)
+{
+	storeIt(&data,sizeof(longlong));
+}
+
+void DimRpc::setData(short &data)
+{
+	storeIt(&data,sizeof(short));
+}
+
+void DimRpc::setData(char *data)
+{
+	storeIt(data,strlen(data)+1);
+}
+
+char *DimRpc::getName()
+{
+	return itsName;
+}
Index: /trunk/FACT++/dim_v19r15/src/dll.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dll.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dll.c	(revision 10183)
@@ -0,0 +1,133 @@
+/*
+ * A utility file. A double linked list.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+#define DIMLIB
+#include <dim.h>
+
+
+void dll_init( DLL* head )
+{
+	DISABLE_AST
+	head->next = head;
+	head->prev = head;
+	ENABLE_AST
+}
+
+
+void dll_insert_queue( DLL* head, DLL* item )
+{
+	register DLL *prevp;
+
+	DISABLE_AST
+	item->next = head;
+	prevp = head->prev;
+	item->prev = prevp;
+	prevp->next = item;
+	head->prev = item;
+	ENABLE_AST
+}	
+
+void dll_insert_after( DLL* atitem, DLL* item )
+{
+	register DLL *auxp;
+
+	DISABLE_AST
+	auxp = atitem->next;
+	item->next = auxp;
+	item->prev = atitem;
+	atitem->next = item;
+	auxp->prev = item;
+	ENABLE_AST
+}	
+
+DLL *dll_search( DLL* head, char *data, int size )
+{
+	register DLL *auxp= head->next;
+ 
+	DISABLE_AST
+	while( auxp!= head ) {
+		if( !memcmp(auxp->user_info, data, size) ) {
+			ENABLE_AST
+			return(auxp);
+		}
+		auxp = auxp->next;
+	}
+	ENABLE_AST
+	return((DLL *)0);
+}
+
+
+DLL *dll_get_next( DLL* head, DLL* item )
+{
+	DISABLE_AST
+	if( item->next != head ) {
+		ENABLE_AST
+		return(item->next);
+	}
+	ENABLE_AST
+	return((DLL *) 0);
+}
+
+DLL *dll_get_prev( DLL* head, DLL* item )
+{
+	DISABLE_AST
+	if( item->prev != head ) {
+		ENABLE_AST
+		return(item->prev);
+	}
+	ENABLE_AST
+	return((DLL *) 0);
+}
+
+int dll_empty( DLL* head )
+{
+	DISABLE_AST
+	if( head->next != head ) {
+		ENABLE_AST
+		return(0);
+	}
+	ENABLE_AST
+	return(1);
+}
+
+
+void dll_remove( DLL* item ) 
+{
+	register DLL *prevp, *nextp;
+
+	DISABLE_AST
+	prevp = item->prev;
+	nextp = item->next;
+	prevp->next = item->next;
+	nextp->prev = prevp;
+	ENABLE_AST
+}	
+
+DLL *dll_search_next_remove( DLL* head, int offset, char *data, int size )
+{
+	register DLL *auxp= head->next;
+	DLL *retp = 0;
+ 
+	DISABLE_AST
+	while( auxp!= head ) {
+		if( !memcmp(&(auxp->user_info[offset]), data, size) ) {
+			retp = auxp;
+		}
+		auxp = auxp->next;
+	}
+	if( retp)
+	{
+		dll_remove(retp);
+		ENABLE_AST
+		return(retp);
+	}
+	ENABLE_AST
+	return((DLL *)0);
+}
+
Index: /trunk/FACT++/dim_v19r15/src/dna.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dna.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dna.c	(revision 10183)
@@ -0,0 +1,834 @@
+
+/*
+ * DNA (Delphi Network Access) implements the network layer for the DIM
+ * (Delphi Information Managment) System.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+/* include files */
+
+#include <errno.h>
+#define DIMLIB
+#define DNA
+#include <dim.h>
+
+/* global definitions */
+
+#define READ_HEADER_SIZE	12
+
+/*
+#define TO_DBG		1 
+*/
+
+/* global variables */
+typedef struct {
+	char node_name[MAX_NODE_NAME];
+	char task_name[MAX_TASK_NAME];
+	int port;
+	SRC_TYPES src_type;
+} PENDING_OPEN;
+
+static PENDING_OPEN Pending_conns[MAX_CONNS];
+
+static int DNA_Initialized = FALSE;
+
+extern int Tcpip_max_io_data_write;
+extern int Tcpip_max_io_data_read;
+
+_DIM_PROTO( static void ast_read_h,     (int conn_id, int status, int size) );
+_DIM_PROTO( static void ast_conn_h,     (int handle, int svr_conn_id,
+                                     int protocol) );
+_DIM_PROTO( static int dna_write_bytes, (int conn_id, void *buffer, int size,
+									 int nowait) );
+_DIM_PROTO( static void release_conn,   (int conn_id) );
+_DIM_PROTO( static void save_node_task, (int conn_id, DNA_NET *buffer) );
+
+/*
+ * Routines common to Server and Client
+ */
+/*
+static int Prev_packet[3];
+static int Prev_buffer[3];
+static int Prev_conn_id = 0;
+*/
+static int is_header( int conn_id )
+{
+	register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
+	register int ret;
+
+	ret = 0;
+	if( (vtohl(dna_connp->buffer[2]) == TRP_MAGIC) &&
+	    (vtohl(dna_connp->buffer[1]) == 0) &&
+	    (vtohl(dna_connp->buffer[0]) == READ_HEADER_SIZE) )
+	{
+		dna_connp->state = RD_HDR;
+		ret = 1;
+	} 
+	else if( (vtohl(dna_connp->buffer[2]) == TST_MAGIC) &&
+		   (vtohl(dna_connp->buffer[1]) == 0) &&
+		   (vtohl(dna_connp->buffer[0]) == READ_HEADER_SIZE) )
+	{
+		dna_connp->state = RD_HDR;
+		ret = 1;
+	} 
+	else if( (vtohl(dna_connp->buffer[2]) == (int)HDR_MAGIC ) &&
+		   (vtohl(dna_connp->buffer[0]) == (int)READ_HEADER_SIZE ) )
+	{
+		dna_connp->state = RD_DATA;
+		ret = 1;
+	} 
+	else 
+	{
+/*
+		dim_print_date_time();
+		printf( " conn: %d to %s@%s, expecting header\n", conn_id,
+			Net_conns[conn_id].task, Net_conns[conn_id].node );
+		printf( "buffer[0]=%d\n", vtohl(dna_connp->buffer[0]));
+		printf( "buffer[1]=%d\n", vtohl(dna_connp->buffer[1]));
+		printf( "buffer[2]=%x\n", vtohl(dna_connp->buffer[2]));
+		printf( "closing the connection.\n" );
+		printf( " Previous conn: %d, Previous Packet\n", Prev_conn_id);
+		printf( "buffer[0]=%d\n", vtohl(Prev_packet[0]));
+		printf( "buffer[1]=%d\n", vtohl(Prev_packet[1]));
+		printf( "buffer[2]=%x\n", vtohl(Prev_packet[2]));
+		printf( " Previous Buffer\n");
+		printf( "buffer[0]=%d\n", vtohl(Prev_buffer[0]));
+		printf( "buffer[1]=%d\n", vtohl(Prev_buffer[1]));
+		printf( "buffer[2]=%x\n", vtohl(Prev_buffer[2]));
+		fflush(stdout);
+*/
+		dna_connp->read_ast(conn_id, NULL, 0, STA_DISC);
+		ret = 0;
+	}			
+	return(ret);
+}
+
+static void read_data( int conn_id)
+{
+	register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
+
+	if( !dna_connp->saw_init &&
+	    vtohl(dna_connp->buffer[0]) == (int)OPN_MAGIC)
+	{
+		save_node_task(conn_id, (DNA_NET *) dna_connp->buffer);
+		dna_connp->saw_init = TRUE;
+	} 
+	else
+	{
+/*
+printf("passing up %d bytes, conn_id %d\n",dna_connp->full_size, conn_id); 
+*/
+		dna_connp->read_ast(conn_id, dna_connp->buffer,
+			dna_connp->full_size, STA_DATA);
+	}
+}
+
+static void ast_read_h( int conn_id, int status, int size )
+{
+	register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
+	int tcpip_code;
+	register int read_size, next_size;
+	register char *buff;
+	int max_io_data;
+
+	if(!dna_connp->buffer) /* The connection has already been closed */
+	{
+		return;
+	}
+	if(status == 1)
+	{
+		next_size = dna_connp->curr_size;
+		buff = (char *) dna_connp->curr_buffer;
+  		if(size < next_size) 
+		{
+/*
+			Prev_conn_id = conn_id;
+	  		Prev_packet[0] = ((int *)dna_connp->curr_buffer)[0];
+			Prev_packet[1] = ((int *)dna_connp->curr_buffer)[1];
+			Prev_packet[2] = ((int *)dna_connp->curr_buffer)[2];
+			Prev_buffer[0] = dna_connp->buffer[0];
+			Prev_buffer[1] = dna_connp->buffer[1];
+			Prev_buffer[2] = dna_connp->buffer[2];
+*/
+			max_io_data = Tcpip_max_io_data_read;
+			read_size = ((next_size - size) > max_io_data) ?
+				max_io_data : next_size - size;
+			dna_connp->curr_size -= size;
+			dna_connp->curr_buffer += size;
+			tcpip_code = tcpip_start_read(conn_id, buff + size, 
+				read_size, ast_read_h);
+			if(tcpip_failure(tcpip_code)) 
+			{
+#ifndef WIN32
+			  if(errno == ENOTSOCK)
+			  {
+				  if(dna_connp->read_ast)
+					dna_connp->read_ast(conn_id, NULL, 0, STA_DISC);
+			  }
+			  else
+#endif
+			  {
+				dna_report_error(conn_id, tcpip_code,
+					"Reading from", DIM_ERROR, DIMTCPRDERR);
+			  }
+			}
+			return;
+		}
+		switch(dna_connp->state)
+		{
+			case RD_HDR :
+				if(is_header(conn_id))
+				{
+					if( dna_connp->state == RD_DATA )
+					{
+						next_size = vtohl(dna_connp->buffer[1]);
+						dna_start_read(conn_id, next_size);
+					}
+					else
+					{
+						dna_connp->state = RD_HDR;
+						dna_start_read(conn_id, READ_HEADER_SIZE);
+					}
+				}
+				break;
+			case RD_DATA :
+				read_data(conn_id);
+				dna_connp->state = RD_HDR;
+				dna_start_read(conn_id, READ_HEADER_SIZE);
+				break;
+			default:
+				break;
+		}
+/*
+		if(dna_connp->buffer)
+		{
+			Prev_conn_id = conn_id;
+			Prev_packet[0] = ((int *)dna_connp->curr_buffer)[0];
+			Prev_packet[1] = ((int *)dna_connp->curr_buffer)[1];
+			Prev_packet[2] = ((int *)dna_connp->curr_buffer)[2];
+			Prev_buffer[0] = dna_connp->buffer[0];
+			Prev_buffer[1] = dna_connp->buffer[1];
+			Prev_buffer[2] = dna_connp->buffer[2];
+		}
+*/
+	} 
+	else 
+	{
+	  /*
+	  printf("Connection lost. Signal upper layer\n");
+	  */
+		if(dna_connp->read_ast)
+			dna_connp->read_ast(conn_id, NULL, 0, STA_DISC);
+	}
+}
+
+
+int dna_start_read(int conn_id, int size)
+{
+	register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
+	register int tcpip_code, read_size;
+	int max_io_data;
+	
+	if(!dna_connp->busy)
+	{
+		return(0);
+	}
+
+	dna_connp->curr_size = size;
+	dna_connp->full_size = size;
+	if(size > dna_connp->buffer_size) 
+	{
+		dna_connp->buffer =
+				(int *) realloc(dna_connp->buffer, size);
+		dna_connp->buffer_size = size;
+	}
+	dna_connp->curr_buffer = (char *) dna_connp->buffer;
+	max_io_data = Tcpip_max_io_data_read;
+	read_size = (size > max_io_data) ? max_io_data : size ;
+
+	tcpip_code = tcpip_start_read(conn_id, dna_connp->curr_buffer,
+				  read_size, ast_read_h);
+	if(tcpip_failure(tcpip_code)) {
+		dna_report_error(conn_id, tcpip_code,
+			"Reading from", DIM_ERROR, DIMTCPRDERR);
+
+		return(0);
+	}
+
+	return(1);
+}								
+
+
+static int dna_write_bytes( int conn_id, void *buffer, int size, int nowait )
+{
+	register int size_left, wrote;
+	register char *p;
+	int max_io_data;
+#ifdef VMS
+	int retries = WRITE_RETRIES, retrying = 0;
+	float wait_time = 0.01;
+#endif
+	extern int tcpip_write_nowait(int, char *, int);
+
+	max_io_data = Tcpip_max_io_data_write;
+	p = (char *) buffer;
+	size_left = size;
+	do {
+		size = (size_left > max_io_data) ? max_io_data : size_left ;
+#ifdef VMS
+		if(nowait)
+		{
+			while(--retries)
+			{
+				if((wrote = tcpip_write_nowait(conn_id, p, size)) > 0)
+					break;
+				if(!tcpip_would_block(wrote))
+					return(0);
+				if(retries == WRITE_RETRIES_WNG)
+				{
+					dna_report_error(conn_id, tcpip_code,
+						"Writing to (retrying)", DIM_WARNING, DIMTCPWRRTY);
+					retrying = 1;
+				}
+				lib$wait(&wait_time);
+			}
+			if(!retries)
+			{
+				return(0);
+			}
+		}
+		else
+			wrote = tcpip_write(conn_id, p, size);
+#else
+		if(nowait)
+		{
+		  wrote = tcpip_write_nowait(conn_id, p, size);
+		  if(wrote == -1)
+		  {
+		    dna_report_error(conn_id, -1,
+				     "Write timeout, disconnecting from", DIM_ERROR, DIMTCPWRTMO);
+		    wrote = 0;
+		  }
+		}
+		else
+		{
+			wrote = tcpip_write(conn_id, p, size);
+		}
+#endif
+		
+		if( tcpip_failure(wrote) )
+			return(0);
+		p += wrote;
+		size_left -= wrote;
+	} while(size_left > 0);
+	return(1);
+}
+
+void dna_test_write(int conn_id)
+{
+	register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id];
+	register int tcpip_code;
+	DNA_HEADER test_pkt;
+	register DNA_HEADER *test_p = &test_pkt;
+
+	if(!dna_connp->busy)
+	{
+		return;
+    }
+	if(dna_connp->writing)
+	{
+		return;
+    }
+	test_p->header_size = htovl(READ_HEADER_SIZE);
+	test_p->data_size = 0;
+	test_p->header_magic = htovl(TST_MAGIC);
+	tcpip_code = dna_write_bytes(conn_id, &test_pkt, READ_HEADER_SIZE,0);
+	if(tcpip_failure(tcpip_code)) {
+		 /* Connection lost. Signal upper layer ? */
+		if(dna_connp->read_ast)
+			dna_connp->read_ast(conn_id, NULL, 0, STA_DISC);
+		return;
+	}
+}
+
+typedef struct
+{
+	int conn_id;
+	void *buffer;
+	int size;
+	char dummy[MAX_NAME];
+} WRITE_ITEM;
+
+static int do_dna_write(int id)
+{
+	register DNA_CONNECTION *dna_connp;
+	int tcpip_code;
+	WRITE_ITEM *ptr;
+	int conn_id, size;
+	void *buffer;
+
+	ptr = (WRITE_ITEM *)id_get_ptr(id, SRC_DNA);
+	if(!ptr)
+		return(2);
+	conn_id = ptr->conn_id;
+	buffer = ptr->buffer;
+	size = ptr->size;
+
+	dna_connp = &Dna_conns[conn_id];
+	if(!dna_connp->busy)
+	{
+		id_free(id, SRC_DNA);
+		free(buffer);
+		free(ptr);
+		return(2);
+    }
+	dna_connp->writing = TRUE;
+	tcpip_code = dna_write_bytes(conn_id, buffer, size,0);
+	if(tcpip_failure(tcpip_code)) 
+	{
+		dna_connp->writing = FALSE;
+		id_free(id, SRC_DNA);
+		free(buffer);
+		free(ptr);
+		return(0);
+	}
+
+	id_free(id, SRC_DNA);
+	free(buffer);
+	free(ptr);
+
+	dna_connp->writing = FALSE;
+	return(1);
+}	
+
+int dna_write_nowait(int conn_id, void *buffer, int size)
+{
+	register DNA_CONNECTION *dna_connp;
+	DNA_HEADER header_pkt;
+	register DNA_HEADER *header_p = &header_pkt;
+	int tcpip_code, ret = 1;
+
+	DISABLE_AST
+	dna_connp = &Dna_conns[conn_id];
+	if(!dna_connp->busy)
+	{
+		ENABLE_AST
+		return(2);
+    }
+	dna_connp->writing = TRUE;
+
+	header_p->header_size = htovl(READ_HEADER_SIZE);
+	header_p->data_size = htovl(size);
+	header_p->header_magic = htovl(HDR_MAGIC);
+	tcpip_code = dna_write_bytes(conn_id, &header_pkt, READ_HEADER_SIZE, 1);
+	if(tcpip_failure(tcpip_code)) 
+	{
+		dna_connp->writing = FALSE;
+		ENABLE_AST
+		return(0);
+	}
+	tcpip_code = dna_write_bytes(conn_id, buffer, size, 1);
+	if(tcpip_failure(tcpip_code)) 
+	{
+		ret = 0;
+	}
+	dna_connp->writing = FALSE;
+	ENABLE_AST
+	return(ret);
+}	
+
+typedef struct
+{
+	DNA_HEADER header;
+	char data[1];
+
+}WRITE_DATA;
+
+int dna_write(int conn_id, void *buffer, int size)
+{
+	WRITE_ITEM *newp;
+	int id;
+	WRITE_DATA *pktp;
+	DNA_HEADER *headerp;
+
+	DISABLE_AST
+
+	pktp = malloc(READ_HEADER_SIZE+size);
+	headerp = &(pktp->header);
+	headerp->header_size = htovl(READ_HEADER_SIZE);
+	headerp->data_size = htovl(size);
+	headerp->header_magic = htovl(HDR_MAGIC);
+
+	memcpy(pktp->data, (char *)buffer, size);
+
+	newp = malloc(sizeof(WRITE_ITEM));
+	newp->conn_id = conn_id;
+	newp->buffer = pktp;
+	newp->size = size+READ_HEADER_SIZE;
+	id = id_get((void *)newp, SRC_DNA);
+	dtq_start_timer(0, do_dna_write, id);
+	ENABLE_AST
+	return(1);
+}
+
+/* Server Routines */
+
+static void ast_conn_h(int handle, int svr_conn_id, int protocol)
+{
+	register DNA_CONNECTION *dna_connp;
+	register int tcpip_code;
+	register int conn_id;
+
+	if(protocol){}
+	conn_id = conn_get();
+/*
+	if(!conn_id)
+		dim_panic("In ast_conn_h: No more connections\n");
+*/
+	dna_connp = &Dna_conns[conn_id] ;
+	dna_connp->error_ast = Dna_conns[svr_conn_id].error_ast;
+	tcpip_code = tcpip_open_connection( conn_id, handle );
+
+	if(tcpip_failure(tcpip_code))
+	{
+		dna_report_error(conn_id, tcpip_code,
+			"Connecting to", DIM_ERROR, DIMTCPCNERR);
+		conn_free(conn_id);
+	} else {
+		dna_connp->state = RD_HDR;
+		dna_connp->buffer = (int *)malloc(TCP_RCV_BUF_SIZE);
+/*
+		if(!dna_connp->buffer)
+		{
+			printf("Error in DNA - handle_connection malloc returned 0\n");
+			fflush(stdout);
+		}
+*/
+		dna_connp->buffer_size = TCP_RCV_BUF_SIZE;
+		dna_connp->read_ast = Dna_conns[svr_conn_id].read_ast;
+		dna_connp->saw_init = FALSE;
+		dna_start_read(conn_id, READ_HEADER_SIZE); /* sizeof(DNA_NET) */
+		/* Connection arrived. Signal upper layer ? */
+		dna_connp->read_ast(conn_id, NULL, 0, STA_CONN);
+	}
+	tcpip_code = tcpip_start_listen(svr_conn_id, ast_conn_h);
+	if(tcpip_failure(tcpip_code))
+	{
+		dna_report_error(svr_conn_id, tcpip_code,
+			"Listening at", DIM_ERROR, DIMTCPLNERR);
+	}
+}
+
+int dna_init()
+{
+	if(!DNA_Initialized)
+	{
+		conn_arr_create(SRC_DNA);
+		DNA_Initialized = TRUE;
+	}
+	return(1);
+}
+
+int dna_open_server(char *task, void (*read_ast)(), int *protocol, int *port, void (*error_ast)())
+{
+	register DNA_CONNECTION *dna_connp;
+	register int tcpip_code;
+	register int conn_id;
+
+	if(!DNA_Initialized)
+	{
+		conn_arr_create(SRC_DNA);
+		DNA_Initialized = TRUE;
+	}
+	*protocol = PROTOCOL;
+	conn_id = conn_get();
+	dna_connp = &Dna_conns[conn_id];
+/*
+	if(!conn_id)
+		dim_panic("In dna_open_server: No more connections\n");
+*/
+	dna_connp->protocol = TCPIP;
+	dna_connp->error_ast = error_ast;
+	tcpip_code = tcpip_open_server(conn_id, task, port);
+	if(tcpip_failure(tcpip_code))
+	{
+		dna_report_error(conn_id, tcpip_code,
+			"Opening server port", DIM_ERROR, DIMTCPOPERR);
+		conn_free(conn_id);
+		return(0);
+	}
+	dna_connp->writing = FALSE;
+	dna_connp->read_ast = read_ast;
+	tcpip_code = tcpip_start_listen(conn_id, ast_conn_h);
+	if(tcpip_failure(tcpip_code))
+	{
+		dna_report_error(conn_id, tcpip_code, "Listening at", DIM_ERROR, DIMTCPLNERR);
+		return(0);
+	}
+	return(conn_id);
+}
+
+
+int dna_get_node_task(int conn_id, char *node, char *task)
+{
+	if(Dna_conns[conn_id].busy)
+		tcpip_get_node_task(conn_id, node, task);
+	else
+		node[0] = '\0';
+	return(1);
+}
+
+
+/* Client Routines */
+
+void dna_set_test_write(int conn_id, int time)
+{
+	extern void tcpip_set_test_write(int, int);
+
+	tcpip_set_test_write(conn_id, time);
+}
+
+void dna_rem_test_write(int conn_id)
+{
+	extern void tcpip_rem_test_write(int);
+
+	tcpip_rem_test_write(conn_id);
+}
+
+static int ins_pend_conn( char *node, char *task, int port, SRC_TYPES src_type )
+{
+	register PENDING_OPEN *pending_connp;
+	register int i;
+
+	for( i = 1, pending_connp = &Pending_conns[1]; i < MAX_CONNS; 
+		i++, pending_connp++ )
+	{
+		if( pending_connp->task_name[0] == '\0' )
+		{
+			strcpy(pending_connp->node_name, node);
+			strcpy(pending_connp->task_name, task);
+			pending_connp->port = port;
+			pending_connp->src_type = src_type;
+			return(i);
+		}
+	}
+	return(0);
+}
+
+static int find_pend_conn( char *node, char *task, int port, SRC_TYPES src_type )
+{
+	register PENDING_OPEN *pending_connp;
+	register int i;
+
+	for( i = 1, pending_connp = &Pending_conns[1]; i < MAX_CONNS; 
+		i++, pending_connp++ )
+	{
+		if( (!strcmp(pending_connp->node_name, node)) &&
+			(!strcmp(pending_connp->task_name, task)) &&
+			(pending_connp->port == port) &&
+			(pending_connp->src_type == src_type))
+		{
+			return(i);
+		}
+	}
+	return(0);
+}
+
+
+static void rel_pend_conn( int conn_id )
+{
+	Pending_conns[conn_id].task_name[0] = '\0';
+}	
+
+
+int dna_open_client(char *server_node, char *server_task, int port, int server_protocol, 
+					void (*read_ast)(), void (*error_ast)(), SRC_TYPES src_type)
+{
+	register DNA_CONNECTION *dna_connp;
+	char str[256];
+	register int tcpip_code, conn_id, id;
+	DNA_NET local_buffer;
+	extern int get_proc_name(char *);
+	char src_type_str[64];
+
+	if(server_protocol){}
+	if(!DNA_Initialized) {
+		conn_arr_create(SRC_DNA);
+		DNA_Initialized = TRUE;
+	}
+	conn_id = conn_get();
+	dna_connp = &Dna_conns[conn_id] ;
+/*
+	if( !(conn_id = conn_get()) )
+		dim_panic("In dna_open_client: No more connections\n");
+*/
+	dna_connp->protocol = TCPIP;
+	dna_connp->error_ast = error_ast;
+	tcpip_code = tcpip_open_client(conn_id, server_node, server_task, port);
+	if( tcpip_failure(tcpip_code) )
+	{
+#ifdef VMS
+		if(!strstr(server_node,"fidel"))
+		{
+#endif
+		if(!find_pend_conn(server_node, server_task, port, src_type))
+		{
+			if(src_type == SRC_DIS)
+				strcpy(src_type_str,"Server");
+			else if(src_type == SRC_DIC)
+				strcpy(src_type_str,"Client");
+			else
+				strcpy(src_type_str,"Unknown type");
+			sprintf( str,"%s Connecting to %s on %s", 
+				src_type_str, server_task, server_node );
+			if(!strcmp(server_task,"DIM_DNS"))
+				dna_report_error( conn_id, tcpip_code, str, DIM_ERROR, DIMDNSCNERR );
+			else
+				dna_report_error( conn_id, tcpip_code, str, DIM_ERROR, DIMTCPCNERR );
+			ins_pend_conn(server_node, server_task, port, src_type);
+		}
+#ifdef VMS
+		}
+#endif
+		tcpip_close(conn_id);
+		conn_free( conn_id );
+		return(0);
+	}
+	if( (id = find_pend_conn(server_node, server_task, port, src_type)) )
+	{
+		if(src_type == SRC_DIS)
+			strcpy(src_type_str,"Server");
+		else if(src_type == SRC_DIC)
+			strcpy(src_type_str,"Client");
+		else
+			strcpy(src_type_str,"Unknown type");
+		sprintf( str,"%s Connection established to", src_type_str);
+		if(!strcmp(server_task,"DIM_DNS"))
+			dna_report_error( conn_id, -1, str, DIM_INFO, DIMDNSCNEST );
+		else
+			dna_report_error( conn_id, -1, str, DIM_INFO, DIMTCPCNEST );
+		rel_pend_conn(id);
+	}
+	dna_connp->state = RD_HDR;
+	dna_connp->writing = FALSE;
+	dna_connp->buffer = (int *)malloc(TCP_RCV_BUF_SIZE);
+/*
+	if(!dna_connp->buffer)
+	{
+		printf("Error in DNA - open_client malloc returned 0\n");
+		fflush(stdout);
+	}
+*/
+	dna_connp->buffer_size = TCP_RCV_BUF_SIZE;
+	dna_connp->read_ast = read_ast;
+	dna_connp->saw_init = TRUE;	/* we send it! */
+	dna_start_read(conn_id, READ_HEADER_SIZE);
+	local_buffer.code = htovl(OPN_MAGIC);
+	get_node_name(local_buffer.node);
+	get_proc_name(local_buffer.task);
+	tcpip_code = dna_write_nowait(conn_id, &local_buffer, sizeof(local_buffer));
+	if (tcpip_failure(tcpip_code))
+	{
+		dna_close(conn_id);
+		return(0);
+	}
+	read_ast(conn_id, NULL, 0, STA_CONN);
+	return(conn_id);
+}
+	
+int dna_close(int conn_id)
+{
+	if(conn_id > 0)
+		release_conn(conn_id);
+	return(1);
+}
+
+/* connection managment routines */
+
+static void release_conn(int conn_id)
+{
+	register DNA_CONNECTION *dna_connp = &Dna_conns[conn_id] ;
+
+	DISABLE_AST
+	if(dna_connp->busy)
+	{ 
+		tcpip_close(conn_id);
+		if(dna_connp->buffer)
+		{
+			free(dna_connp->buffer);
+			dna_connp->buffer = 0;
+			dna_connp->buffer_size = 0;
+		}
+		dna_connp->read_ast = NULL;
+		dna_connp->error_ast = NULL;
+		conn_free(conn_id);
+	}
+	ENABLE_AST
+}
+
+
+void dna_report_error_old(int conn_id, int code, char *routine_name)
+{
+	char str[128];
+	extern void tcpip_get_error(char *, int);
+	dim_print_date_time();
+	printf("%s", routine_name);
+	if(conn_id)
+	{
+		if(Net_conns[conn_id].node[0])
+			printf(" %s on node %s",
+		       Net_conns[conn_id].task, Net_conns[conn_id].node);
+/*
+		else
+			printf("\tConn %d :\n", conn_id);
+*/
+	}
+	if(code != -1)
+	{
+/*
+		printf("\t");
+		tcpip_report_error(code);
+*/
+		tcpip_get_error(str, code);
+		printf(": %s\n",str);
+	}
+	fflush(stdout);
+}
+
+void dna_report_error(int conn_id, int code, char *routine_name, int severity, int errcode)
+{
+	char str[128], msg[1024];
+	extern void tcpip_get_error();
+
+	sprintf(msg, "%s", routine_name);
+	if(conn_id)
+	{
+		if(Net_conns[conn_id].node[0])
+		{
+			sprintf(str," %s on node %s",
+		       Net_conns[conn_id].task, Net_conns[conn_id].node);
+			strcat(msg, str);
+		}
+	}
+	if(code != -1)
+	{
+		tcpip_get_error(str, code);
+		strcat(msg,": ");
+		strcat(msg, str);
+	}
+	if(Dna_conns[conn_id].error_ast)
+	{
+		Dna_conns[conn_id].error_ast(conn_id, severity, errcode, msg);
+	}
+}
+
+static void save_node_task(int conn_id, DNA_NET *buffer)
+{
+	strcpy(Net_conns[conn_id].node, buffer->node);
+	strcpy(Net_conns[conn_id].task, buffer->task);
+}
+
Index: /trunk/FACT++/dim_v19r15/src/dns.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dns.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dns.c	(revision 10183)
@@ -0,0 +1,1903 @@
+/*
+ * DNS (Delphi Name Server) Package implements the name server for the DIM
+ * (Delphi Information Management) system
+ *
+ * Started date      : 26-10-92
+ * Last modification : 02-08-94
+ * Written by        : C. Gaspar
+ * Adjusted by       : G.C. Ballintijn
+ *
+ */
+
+#define DNS
+#include <stdio.h>
+#include <dim.h>
+#include <dis.h>
+
+#ifndef WIN32
+#include <netdb.h>
+#endif
+/*
+#define MAX_HASH_ENTRIES 5000
+*/
+#define MAX_HASH_ENTRIES 20000
+FILE	*foutptr;
+
+typedef struct node {
+	struct node *client_next;
+	struct node *client_prev;
+	struct node *next;
+	struct node *prev;
+	int conn_id;
+	int service_id;
+	struct serv *servp;
+} NODE;
+
+typedef struct red_node {
+	struct red_node *next;
+	struct red_node *prev;
+	int conn_id;
+	int service_id;
+	struct serv *servp;
+} RED_NODE;
+
+typedef struct serv {
+	struct serv *server_next;
+	struct serv *server_prev;
+	struct serv *next;
+	struct serv *prev;
+	char serv_name[MAX_NAME];
+	char serv_def[MAX_NAME];
+	int state;
+	int conn_id;
+	int server_format;
+	int serv_id;
+	RED_NODE *node_head;
+} DNS_SERVICE;
+
+typedef struct red_serv {
+	struct red_serv *next;
+	struct red_serv *prev;
+	char serv_name[MAX_NAME];
+	char serv_def[MAX_NAME];
+	int state;
+	int conn_id;
+	int server_format;
+	int serv_id;
+	RED_NODE *node_head;
+} RED_DNS_SERVICE;
+
+static DNS_SERVICE **Service_info_list;
+static RED_DNS_SERVICE *Service_hash_table[MAX_HASH_ENTRIES];
+static int Curr_n_services = 0;
+static int Curr_n_servers = 0;
+static int Last_conn_id;
+/*
+static int Debug = TRUE;
+*/
+static int Debug = FALSE;
+
+static int Timer_q;
+static int Server_info_id, Server_new_info_id, 
+		   Rpc_id, wake_up;
+
+static char RPC_dummy = 0;
+static char *Rpc_info = &RPC_dummy;
+static int Rpc_info_size = 0;
+
+static char DNS_accepted_domains[1024] = {0};
+static char DNS_accepted_nodes[1024] = {0};
+
+_DIM_PROTO( DNS_SERVICE *service_exists, (char *name) );
+_DIM_PROTO( void check_validity,         (int conn_id) );
+_DIM_PROTO( void send_dns_server_info,   (int conn_id, int **bufp, int *size) );
+_DIM_PROTO( void print_stats,            (void) );
+_DIM_PROTO( void set_debug_on,           (void) );
+_DIM_PROTO( void set_debug_off,          (void) );
+_DIM_PROTO( void kill_servers,           (void) );
+_DIM_PROTO( void print_hash_table,       (void) );
+_DIM_PROTO( void get_rpc_info,       	 (int *tag, char **info, int *size) );
+_DIM_PROTO( void set_rpc_info,       	 (int *tag, char *name, int *size) );
+_DIM_PROTO( void print_hash_table,       (void) );
+_DIM_PROTO( static void release_conn,    (int conn_id) );
+
+
+static void recv_rout( int conn_id, DIC_DNS_PACKET *packet, int size, int status )
+{
+	int handle_registration();
+	int handle_client_request();
+
+	if(size){}
+	switch(status)
+	{
+	case STA_DISC:     /* connection broken */
+
+		if(Debug)
+		{
+			dim_print_date_time();
+			printf(" Disconnect received - conn: %d to %s@%s\n", conn_id,
+				Net_conns[conn_id].task,Net_conns[conn_id].node );
+		}
+
+		release_conn( conn_id );
+		break;
+	case STA_CONN:     /* connection received */
+		if(Debug)
+		{
+			dim_print_date_time();
+			printf(" Connection request received - conn: %d\n", conn_id);
+		}
+		/* handle_conn( conn_id ); */
+		break;
+	case STA_DATA:     /* normal packet */
+		switch( vtohl(packet->src_type) )
+		{
+		case SRC_DIS :
+			handle_registration(conn_id, (DIS_DNS_PACKET *)packet, 1);
+			break;
+		case SRC_DIC :
+			handle_client_request(conn_id,(DIC_DNS_PACKET *)packet);
+			break;
+		default:
+			dim_print_date_time();
+			printf(" conn: %d to %s@%s, Bad packet\n", conn_id,
+				Net_conns[conn_id].task,Net_conns[conn_id].node );
+			printf("packet->size = %d\n", vtohl(packet->size));
+			printf("packet->src_type = %d\n", vtohl(packet->src_type));
+			printf( "closing the connection.\n" );
+			fflush(stdout);
+			release_conn( conn_id );
+/*
+			panic( "recv_rout(): Bad switch(1)" );
+*/
+		}
+		break;
+	default:	
+		dim_print_date_time();
+		printf( " - DIM panic: recv_rout(): Bad switch, exiting...\n");
+		abort();
+	}
+}
+
+static void error_handler(int conn_id, int severity, int errcode, char *reason)
+{
+	if(conn_id){}
+	if(errcode){}
+	dim_print_msg(reason, severity);
+/*
+	if(severity == 3)
+	{
+			printf("Exiting!\n");
+			exit(2);
+	}
+*/
+}
+
+int handle_registration( int conn_id, DIS_DNS_PACKET *packet, int tmout_flag )
+{
+	DNS_SERVICE *servp;
+	DNS_DIS_PACKET dis_packet;
+	int i, service_id;
+	int format;
+	DNS_CONNECTION *connp;
+	int n_services;
+	char *ptr, *ptr1, *ptrt;
+	int found;
+	void do_update_did();
+	void do_inform_clients();
+	void inform_clients();
+	void service_init();
+	void service_insert();
+	void service_remove();
+#ifdef WIN32
+	extern int time();
+#endif
+	int update_did = 0;
+	int name_too_long = 0;
+	int rem_only = 0;
+
+	Dns_conns[conn_id].validity = time(NULL);
+	if( !Dns_conns[conn_id].service_head ) 
+	{
+
+		if(vtohl(packet->n_services) > 0)
+		{
+			service_id = vtohl(packet->services[0].service_id);
+			if(service_id & 0x80000000)
+				rem_only = 1;
+		}
+    if( Debug )
+	{
+			dim_print_date_time();
+			printf( " !!!! New Conn %3d : Server %s@%s (PID %d) registering %d services, to delete %d\n",
+				conn_id, packet->task_name,
+				packet->node_name, 
+				vtohl(packet->pid),
+				vtohl(packet->n_services), rem_only );
+			fflush(stdout);
+	}
+		if(rem_only)
+			return 0;
+
+		Dns_conns[conn_id].already = 0;
+		Dns_conns[conn_id].service_head =
+			(char *) malloc(sizeof(DNS_SERVICE));
+		dll_init( (DLL *) Dns_conns[conn_id].service_head );
+		Dns_conns[conn_id].n_services = 0;
+		Dns_conns[conn_id].timr_ent = NULL;
+		Curr_n_servers++;
+		Dns_conns[conn_id].src_type = SRC_DIS;
+		Dns_conns[conn_id].protocol = vtohl(packet->protocol);
+		strncpy( Dns_conns[conn_id].node_name, packet->node_name,
+			MAX_NODE_NAME ); 
+		strncpy( Dns_conns[conn_id].task_name, packet->task_name,
+			MAX_TASK_NAME-4 );
+		strcpy(Dns_conns[conn_id].long_task_name, packet->task_name);
+		Dns_conns[conn_id].task_name[MAX_TASK_NAME-4-1] = '\0';
+		for(i = 0; i < 4; i++)
+			Dns_conns[conn_id].node_addr[i] =  packet->node_addr[i];
+		Dns_conns[conn_id].pid = vtohl(packet->pid);
+		Dns_conns[conn_id].port = vtohl(packet->port);
+/*
+    if( Debug )
+	{
+			dim_print_date_time();
+			printf( " !!!! New Conn %3d : Server %s@%s (PID %d) registered %d services\n",
+				conn_id, Dns_conns[conn_id].task_name,
+				Dns_conns[conn_id].node_name, 
+				Dns_conns[conn_id].pid,
+				vtohl(packet->n_services) );
+			fflush(stdout);
+	}
+*/
+
+
+		if(strcmp(Dns_conns[conn_id].task_name,"DIS_DNS"))
+		if(DNS_accepted_domains[0] == 0)
+		{
+			if(!get_dns_accepted_domains(DNS_accepted_domains))
+				DNS_accepted_domains[0] = -1;
+		}
+		if((DNS_accepted_domains[0] != -1) && (strcmp(Dns_conns[conn_id].task_name,"DIS_DNS")))
+		{
+			ptr = DNS_accepted_domains;
+			found = 0;
+			while(*ptr)
+			{
+				ptr1 = strchr(ptr,',');
+				if(ptr1)
+				{
+					*ptr1 = '\0';
+					ptr1++;
+				}
+				else
+				{
+					ptr1 = ptr;
+					ptr1 += strlen(ptr);
+				}
+				if(strstr(Dns_conns[conn_id].node_name,ptr))
+				{
+					found = 1;
+					break;
+				}
+				ptr = ptr1;
+			}
+			if(!found)
+			{
+				dis_packet.type = htovl(DNS_DIS_STOP);
+				dis_packet.size = htovl(DNS_DIS_HEADER);
+				if( !dna_write_nowait(conn_id, &dis_packet, DNS_DIS_HEADER) )
+				{
+					dim_print_date_time();
+					printf(" Stop Server: Couldn't write, releasing %d\n",conn_id);
+					fflush(stdout);
+				}
+				dim_print_date_time();
+				printf(" Connection from %s refused, stopping server %s\n",
+						Dns_conns[conn_id].node_name, 
+						Dns_conns[conn_id].task_name);
+				fflush(stdout);
+				release_conn(conn_id);
+
+				return 0;
+			}
+		}
+		if(tmout_flag)
+			Dns_conns[conn_id].timr_ent = dtq_add_entry( Timer_q,
+				(int)(WATCHDOG_TMOUT_MAX * 1.3), check_validity, conn_id);
+		if(strcmp(Dns_conns[conn_id].task_name,"DIS_DNS"))
+		{
+			dna_set_test_write(conn_id, 10);
+		}
+		Dns_conns[conn_id].old_n_services = 0;
+/*
+		Dns_conns[conn_id].n_services = 1;
+		do_update_did(conn_id);
+*/
+		update_did = 1;
+/*
+		Dns_conns[conn_id].old_n_services = 0;
+*/
+		Dns_conns[conn_id].n_services = 0;
+	} 
+	else 
+	{
+		if( (Dns_conns[conn_id].n_services == -1) &&
+		    vtohl(packet->n_services) )
+		{
+			if(strcmp(Dns_conns[conn_id].task_name,"DIS_DNS"))
+				dna_set_test_write(conn_id, 10);
+			dim_print_date_time();
+			printf( " Server %s out of error\n",
+				Dns_conns[conn_id].task_name );
+			fflush(stdout);
+			Dns_conns[conn_id].n_services = 0;
+		}
+	}
+	n_services = vtohl(packet->n_services);
+	if(strlen(Dns_conns[conn_id].task_name) == MAX_TASK_NAME-4-1)
+		name_too_long = 1;
+	for( i = 0; i < n_services; i++ ) 
+	{
+/*
+    if( Debug )
+	{
+			dim_print_date_time();
+			printf( " Conn %3d : Server %s@%s (PID %d) registered %s\n",
+				conn_id, Dns_conns[conn_id].task_name,
+				Dns_conns[conn_id].node_name, 
+				Dns_conns[conn_id].pid,
+				packet->services[i].service_name );
+			fflush(stdout);
+	}
+*/
+		if(n_services == 1)
+		{
+			if(!strcmp(packet->services[i].service_name, "DUMMY_UPDATE_PACKET"))
+			{
+				do_inform_clients(conn_id);
+				break;
+			}
+		}
+		if( (servp = service_exists(packet->services[i].service_name)) )
+		{
+			/* if service available on another server send kill signal */
+			if((servp->conn_id) && (servp->conn_id != conn_id))
+			{
+				dis_packet.type = htovl(DNS_DIS_KILL);
+				dis_packet.size = htovl(DNS_DIS_HEADER);
+				format = vtohl(packet->format);
+#ifdef VMS
+				if((format & MY_OS9) || (servp->state == -1))
+				{
+                Dns_conns[servp->conn_id].already = 1;
+					if( !dna_write(servp->conn_id, &dis_packet, DNS_DIS_HEADER) )
+					{
+						dim_print_date_time();
+						printf(" Couldn't write, releasing %d\n",servp->conn_id);
+						fflush(stdout);
+					}
+					dim_print_date_time();
+					printf(" Service %s already declared, killing server %s\n",
+						servp->serv_name, Dns_conns[servp->conn_id].task_name);
+					fflush(stdout);
+					release_client(servp->conn_id);
+					release_conn(servp->conn_id);
+				}
+				else
+				{
+#endif
+					if((Dns_conns[servp->conn_id].port == Dns_conns[conn_id].port) &&
+					  (!strcmp(Dns_conns[servp->conn_id].node_name, Dns_conns[conn_id].node_name)))
+					{
+						dim_print_date_time();
+printf(" Service %s already declared by conn %d - %s@%s:%d (PID %d), Redeclared by conn %d - %s@%s:%d (PID %d)(same server) - Closing old conn %d\n",
+							servp->serv_name, servp->conn_id, 
+							Dns_conns[servp->conn_id].task_name,
+							Dns_conns[servp->conn_id].node_name,
+							Dns_conns[servp->conn_id].port,
+							Dns_conns[servp->conn_id].pid,
+							conn_id,
+							Dns_conns[conn_id].task_name,
+							Dns_conns[conn_id].node_name,
+							Dns_conns[conn_id].port,
+							Dns_conns[conn_id].pid,
+							servp->conn_id);
+						fflush(stdout);
+						release_conn(servp->conn_id);
+						update_did = 0;
+/*
+						return(0);
+*/
+					}
+					else
+					{
+						Dns_conns[conn_id].already = 1;
+
+						if( !dna_write_nowait(conn_id, &dis_packet, DNS_DIS_HEADER) )
+						{
+							dim_print_date_time();
+							printf(" Kill Server: Couldn't write, releasing %d\n",conn_id);
+							fflush(stdout);
+						}
+						dim_print_date_time();
+printf(" Service %s already declared by conn %d - %s@%s:%d (PID %d), killing server conn %d - %s@%s:%d (PID %d) \n",
+							servp->serv_name, servp->conn_id, 
+							Dns_conns[servp->conn_id].task_name,
+							Dns_conns[servp->conn_id].node_name,
+							Dns_conns[servp->conn_id].port,
+							Dns_conns[servp->conn_id].pid,
+							conn_id,
+							Dns_conns[conn_id].task_name,
+							Dns_conns[conn_id].node_name,
+							Dns_conns[conn_id].port,
+							Dns_conns[conn_id].pid);
+						fflush(stdout);
+
+						release_conn(conn_id);
+
+						return(0);
+					}
+#ifdef VMS
+				}
+#endif
+			}
+			else if( servp->state != -1 ) 
+			{
+				if( !dll_empty((DLL *) servp->node_head)) 
+				{
+					/*there are interested clients waiting*/
+					strncpy( servp->serv_def,
+						packet->services[i].service_def,MAX_NAME );
+					servp->conn_id = conn_id;
+					servp->state = 1;
+					servp->server_format = vtohl(packet->format);
+					servp->serv_id = vtohl(packet->services[i].service_id);
+					dll_insert_queue((DLL *)
+						Dns_conns[conn_id].service_head,
+						(DLL *) servp);
+					Dns_conns[conn_id].n_services++;
+
+/*
+					if(n_services == 1)
+*/
+					if(n_services < MAX_REGISTRATION_UNIT)
+					{
+						inform_clients(servp);
+					}
+					continue;
+				} 
+				else 
+				{
+					/* test if Service is to be removed */
+					service_id = vtohl(packet->services[i].service_id);
+					if(service_id & 0x80000000)
+					{
+						dll_remove((DLL *) servp);
+						service_remove(&(servp->next));
+						Curr_n_services--;
+						free(servp);
+						connp = &Dns_conns[conn_id];
+						Dns_conns[conn_id].n_services--;
+						if( dll_empty((DLL *) Dns_conns[conn_id].service_head))
+						{ 
+						    if( Debug )
+							{
+								dim_print_date_time();
+								printf( " Conn %3d : Server %s@%s unregistered All services, releasing it.\n",
+									conn_id, Dns_conns[conn_id].task_name,
+									Dns_conns[conn_id].node_name );
+								fflush(stdout);
+							}
+							release_conn(conn_id);
+							return(0);
+						}
+						continue;
+                    }
+				}
+			} 
+			else 
+			{
+				servp->state = 1;
+				Dns_conns[conn_id].n_services++;
+/*
+				if(n_services == 1)
+*/
+				if(n_services < MAX_REGISTRATION_UNIT)
+				{
+					if( !dll_empty((DLL *) servp->node_head) )
+					{
+						inform_clients( servp );
+					}
+				}
+				continue;
+			}
+
+		}
+		if(!(servp = service_exists(packet->services[i].service_name)))
+		{
+			servp = (DNS_SERVICE *)malloc(sizeof(DNS_SERVICE));
+			if(name_too_long)
+			{
+				if(strstr(packet->services[i].service_name,"/CLIENT_LIST"))
+				{
+					strncpy(Dns_conns[conn_id].long_task_name, packet->services[i].service_name,
+						MAX_TASK_NAME*2);
+					ptrt = strstr(Dns_conns[conn_id].long_task_name,"/CLIENT_LIST");
+					*ptrt = '\0';
+				}
+			}
+			strncpy( servp->serv_name,
+				packet->services[i].service_name,
+				MAX_NAME );
+			strncpy( servp->serv_def,
+				packet->services[i].service_def,
+				MAX_NAME );
+			servp->state = 1;
+			servp->conn_id = conn_id;
+			servp->server_format = vtohl(packet->format);
+			servp->serv_id = vtohl(packet->services[i].service_id);
+			dll_insert_queue( (DLL *)
+					  Dns_conns[conn_id].service_head, 
+					  (DLL *) servp );
+			Dns_conns[conn_id].n_services++;
+			service_insert( &(servp->next) );
+			servp->node_head = (RED_NODE *) malloc(sizeof(NODE));
+			dll_init( (DLL *) servp->node_head );
+			Curr_n_services++;
+		} 
+	}
+	if(update_did)
+		do_update_did(conn_id);
+    if( Debug )
+	{
+		if(vtohl(packet->n_services) != 0)
+		{
+			dim_print_date_time();
+			printf( " Conn %3d : Server %s@%s (PID %d) registered %d services\n",
+				conn_id, Dns_conns[conn_id].task_name,
+				Dns_conns[conn_id].node_name, 
+				Dns_conns[conn_id].pid,
+				vtohl(packet->n_services) );
+			fflush(stdout);
+		}
+	}
+
+	return(1);
+}	
+
+void update_did()
+{
+	int i;
+	void do_update_did();
+
+	for(i = 0; i< Curr_N_Conns; i++)
+	{
+		if(Dns_conns[i].src_type == SRC_DIS)
+		{
+			do_update_did(i);
+		}
+	}
+}
+
+void do_update_did(int conn_id)
+{
+	int n_services, old_n_services;
+
+	n_services = Dns_conns[conn_id].n_services;
+/*
+	if(Dns_conns[conn_id].n_services)
+	{
+*/
+	old_n_services = Dns_conns[conn_id].old_n_services;
+	if(old_n_services != n_services)
+	{
+		Last_conn_id = conn_id;
+		if((old_n_services <= 0) || (n_services == 0) || (n_services == -1))
+			dis_update_service(Server_new_info_id);
+		dis_update_service(Server_info_id);
+		Dns_conns[conn_id].old_n_services = Dns_conns[conn_id].n_services;
+	}
+/*
+	}
+*/
+}
+
+void check_validity(int conn_id)
+{
+	int time_diff;
+	DNS_DIS_PACKET dis_packet;
+	void set_in_error();
+
+	if(Dns_conns[conn_id].validity < 0)
+	{
+		/* timeout reached kill all services and connection */
+		if(Dns_conns[conn_id].n_services != -1)
+		{
+			dim_print_date_time();
+			printf(" Server %s (%s@%s) has been set in error\n",
+				Dns_conns[conn_id].task_name, Net_conns[conn_id].task, Net_conns[conn_id].node);
+			fflush(stdout);
+			set_in_error(conn_id);
+			return;
+		}
+/*
+		Dns_conns[conn_id].validity = -Dns_conns[conn_id].validity;
+*/
+	}
+	time_diff = time(NULL) - Dns_conns[conn_id].validity;
+	if(time_diff > (int)(WATCHDOG_TMOUT_MAX*1.2))
+	{
+		/* send register signal */
+		dis_packet.type = htovl(DNS_DIS_REGISTER);
+		dis_packet.size = htovl(DNS_DIS_HEADER);
+		if(Debug)
+		{
+			dim_print_date_time();
+			printf(" Conn %3d : Server %s@%s Registration Requested\n",
+				conn_id, Net_conns[conn_id].task, Net_conns[conn_id].node);
+			fflush(stdout);
+		}
+/* moved from dna_write to dna_write_nowait in 14/10/2008 */
+		if( !dna_write_nowait(conn_id, &dis_packet, DNS_DIS_HEADER) )
+		{
+			dim_print_date_time();
+			printf(" Server Validity: Couldn't write, releasing Conn %3d : Server %s@%s\n",conn_id,
+				Net_conns[conn_id].task, Net_conns[conn_id].node);
+			fflush(stdout);
+			release_conn(conn_id);
+		}
+		Dns_conns[conn_id].validity = -Dns_conns[conn_id].validity;
+	}
+}		
+
+
+int handle_client_request( int conn_id, DIC_DNS_PACKET *packet )
+{
+	DNS_SERVICE *servp;
+	NODE *nodep;
+	RED_NODE *red_nodep; 
+	int i, service_id;
+	DNS_DIC_PACKET dic_packet;
+	SERVICE_REG *serv_regp; 
+	void service_insert();
+	void service_remove();
+	void tcpip_get_addresses();
+	char *ptr, *ptr1;
+	int found;
+
+	serv_regp = (SERVICE_REG *)(&(packet->service));
+	if(Debug)
+	{
+		dim_print_date_time();
+		printf(" Conn %3d : Client %s@%s requested %s\n",
+			conn_id, Net_conns[conn_id].task, Net_conns[conn_id].node,
+			serv_regp->service_name);
+		fflush(stdout);
+	}
+
+	if(DNS_accepted_nodes[0] == 0)
+	{
+		if(!get_dns_accepted_nodes(DNS_accepted_nodes))
+			DNS_accepted_nodes[0] = -1;
+	}
+	if(DNS_accepted_nodes[0] != -1)
+	{
+		ptr = DNS_accepted_nodes;
+		found = 0;
+		while(*ptr)
+		{
+			ptr1 = strchr(ptr,',');
+			if(ptr1)
+			{
+				*ptr1 = '\0';
+				ptr1++;
+			}
+			else
+			{
+				ptr1 = ptr;
+				ptr1 += strlen(ptr);
+			}
+			if(strstr(Net_conns[conn_id].node,ptr))
+			{
+				found = 1;
+				break;
+			}
+			ptr = ptr1;
+		}
+		if(!found)
+		{
+			dic_packet.service_id = serv_regp->service_id;
+			dic_packet.node_name[0] = -1; 
+			dic_packet.task_name[0] = 0;
+			dic_packet.node_addr[0] = 0;
+			dic_packet.pid = 0;
+			dic_packet.size = htovl(DNS_DIC_HEADER);
+			if( !dna_write_nowait(conn_id, &dic_packet, DNS_DIC_HEADER) )
+			{
+				dim_print_date_time();
+				printf(" Stop Client: Couldn't write, releasing Conn %3d : Client %s@%s\n",conn_id,
+					Net_conns[conn_id].task,
+					Net_conns[conn_id].node);
+				fflush(stdout);
+				release_conn(conn_id);
+			}
+			dim_print_date_time();
+			printf(" Connection from %s refused, stopping client pid=%s\n",
+					Net_conns[conn_id].node,
+					Net_conns[conn_id].task);
+			fflush(stdout);
+			release_conn(conn_id);
+
+			return 0;
+		}
+	}
+	
+	service_id = vtohl(serv_regp->service_id);
+	if( service_id == -1 )  /* remove service */
+	{
+		if(Debug)
+		{
+			printf("\tRemoving Request\n");
+			fflush(stdout);
+		}
+		if( (servp = service_exists(serv_regp->service_name))  ) 
+		{
+			red_nodep = servp->node_head;
+			while( (red_nodep =
+				(RED_NODE *) dll_get_next(
+						(DLL *) servp->node_head,
+						(DLL *) red_nodep)) )
+			{
+				if( red_nodep->conn_id == conn_id ) 
+				{
+					dll_remove((DLL *) red_nodep);
+					ptr = (char *)red_nodep - (2 * sizeof(void *));
+					nodep = (NODE *)ptr;
+					dll_remove((DLL *) nodep);
+					red_nodep = red_nodep->prev;
+					free(nodep);
+					break;
+				}
+			}
+			if(( dll_empty((DLL *) servp->node_head) ) && (servp->state == 0))
+			{
+				if(Debug)
+				{
+					printf("\tand Removing Service\n");
+					fflush(stdout);
+				}
+				service_remove(&(servp->next));
+				Curr_n_services--;
+				free(servp);
+			}
+		}
+		return(0);
+	}
+	if( service_id & 0x80000000 )  /* remove service */
+	{
+		service_id &= 0x7fffffff;
+		if(Debug)
+		{
+			printf("\tRemoving Request\n");
+			fflush(stdout);
+		}
+		if( (servp = service_exists(serv_regp->service_name)) ) 
+		{
+			red_nodep = servp->node_head;
+			while( (red_nodep =
+				(RED_NODE *) dll_get_next(
+						(DLL *) servp->node_head,
+						(DLL *) red_nodep)) )
+			{
+				if(( red_nodep->conn_id == conn_id ) &&
+				   ( red_nodep->service_id == service_id ) )
+				{
+					dll_remove((DLL *) red_nodep);
+					ptr = (char *)red_nodep - (2 * sizeof(void *));
+					nodep = (NODE *)ptr;
+					dll_remove((DLL *) nodep);
+					red_nodep = red_nodep->prev;
+					free(nodep);
+					break;
+				}
+			}
+			if(( dll_empty((DLL *) servp->node_head) ) && (servp->state == 0))
+			{
+				if(Debug)
+				{
+					printf("\tand Removing Service\n");
+					fflush(stdout);
+				}
+				service_remove(&(servp->next));
+				Curr_n_services--;
+				free(servp);
+			}
+		}
+		return(0);
+	}
+	/* Is already in v.format */
+	dic_packet.service_id = serv_regp->service_id;
+	dic_packet.node_name[0] = 0; 
+	dic_packet.task_name[0] = 0;
+	dic_packet.node_addr[0] = 0;
+	dic_packet.pid = 0;
+	dic_packet.size = htovl(DNS_DIC_HEADER);
+	if( !(servp = service_exists(serv_regp->service_name)) ) 
+	{
+		if(Debug)
+		{
+			printf("\tService does not exist, queueing request\n");
+			fflush(stdout);
+		}
+		if( !Dns_conns[conn_id].node_head ) 
+		{
+			Dns_conns[conn_id].src_type = SRC_DIC;
+			Dns_conns[conn_id].node_head =
+					malloc(sizeof(NODE));
+			dll_init( (DLL *) Dns_conns[conn_id].node_head );
+		}
+		servp = (DNS_SERVICE *) malloc(sizeof(DNS_SERVICE));
+		strncpy( servp->serv_name, serv_regp->service_name, MAX_NAME );
+		servp->serv_def[0] = '\0';
+		servp->state = 0;
+		servp->conn_id = 0;
+		service_insert(&(servp->next));
+		Curr_n_services++;
+		servp->node_head = (RED_NODE *)malloc(sizeof(NODE));
+		dll_init( (DLL *) servp->node_head );
+		nodep = (NODE *)malloc(sizeof(NODE));
+		nodep->conn_id = conn_id;
+		nodep->service_id = service_id;
+		nodep->servp = servp;
+		dll_insert_queue((DLL *) Dns_conns[conn_id].node_head,
+				 (DLL *) nodep);
+		dll_insert_queue((DLL *) servp->node_head,
+				 (DLL *) &(nodep->next));
+	} 
+	else 
+	{
+		if( servp->state == 1 ) 
+		{
+#ifdef VMS
+			if(servp->server_format & MY_OS9)
+			{
+				dna_test_write(servp->conn_id);
+			}
+#endif
+			Dns_conns[conn_id].src_type = SRC_DIC;
+			strcpy( dic_packet.node_name,
+				Dns_conns[servp->conn_id].node_name );
+			strcpy( dic_packet.task_name,
+				Dns_conns[servp->conn_id].task_name );
+			for(i = 0; i < 4; i++)
+				dic_packet.node_addr[i] =
+					Dns_conns[servp->conn_id].node_addr[i];
+			dic_packet.port = htovl(Dns_conns[servp->conn_id].port);
+			dic_packet.pid = htovl(Dns_conns[servp->conn_id].pid);
+			dic_packet.protocol = htovl(Dns_conns[servp->conn_id].protocol);
+			dic_packet.format = htovl(servp->server_format);
+			strcpy( dic_packet.service_def, servp->serv_def );
+			if(Debug)
+			{
+				printf("\tService exists in %s@%s, port = %d\n",
+					dic_packet.task_name, dic_packet.node_name, 
+					dic_packet.port);
+				fflush(stdout);
+			}
+		} 
+		else 
+		{
+			if(Debug)
+			{
+				if(servp->state == -1)
+				{
+					printf("\tService exists in BAD state, queueing request\n");
+					fflush(stdout);
+				}
+				else
+				{
+					printf("\tService does not exist (other client(s) waiting), queueing request\n");
+					fflush(stdout);
+				}
+			}
+			if(!(NODE *)Dns_conns[conn_id].node_head ) 
+			{
+				Dns_conns[conn_id].src_type = SRC_DIC;
+				Dns_conns[conn_id].node_head = 
+					(char *) malloc(sizeof(NODE));
+				dll_init((DLL *)Dns_conns[conn_id].node_head);
+			}
+			nodep = (NODE *)malloc(sizeof(NODE));
+			nodep->conn_id = conn_id;
+			nodep->service_id = service_id;
+			nodep->servp = servp;
+			dll_insert_queue((DLL *) Dns_conns[conn_id].node_head,
+					 (DLL *) nodep);
+			dll_insert_queue((DLL *) servp->node_head,
+					 (DLL *) &(nodep->next));
+		}
+	}
+/* Should it be dna_write_nowait? 16/9/2008 */
+/* moved from dna_write to dna_write_nowait in 14/10/2008 */
+	if( !dna_write_nowait(conn_id, &dic_packet, DNS_DIC_HEADER) )
+	{
+		dim_print_date_time();
+		printf(" Client Request: Couldn't write, releasing Conn %3d : Client %s@%s\n",conn_id,
+					Net_conns[conn_id].task,
+					Net_conns[conn_id].node);
+		fflush(stdout);
+		release_conn(conn_id);
+	}
+
+	return(1);
+}
+
+void do_inform_clients(int conn_id)
+{
+	DNS_SERVICE *servp;
+	int n_informed = 0;
+	static DNS_SERVICE *prev_servp = (DNS_SERVICE *)0;
+	static int n_times = 0;
+	void inform_clients();
+
+	DISABLE_AST
+	if(!Dns_conns[conn_id].service_head)
+	{
+		prev_servp = (DNS_SERVICE *)0;
+		ENABLE_AST
+		return;
+	}
+	if(prev_servp)
+		servp = prev_servp;
+	else
+		servp = (DNS_SERVICE *)Dns_conns[conn_id].service_head;
+	while( (servp = (DNS_SERVICE *) dll_get_next(
+				(DLL *) Dns_conns[conn_id].service_head,
+				(DLL *) servp)) )
+	{
+		if( servp->state != -1 ) 
+		{
+			if( !dll_empty((DLL *) servp->node_head)) 
+			{
+				inform_clients(servp);
+				n_informed++;
+				if(n_informed == 1000)
+				{
+					dtq_start_timer(0, do_inform_clients, conn_id);
+					ENABLE_AST
+					return;
+				}
+			}
+		}
+	}
+	n_times = 0;
+	prev_servp = (DNS_SERVICE *)0;
+	ENABLE_AST
+}
+
+
+void inform_clients(DNS_SERVICE *servp)
+{
+	RED_NODE *nodep, *prevp; 
+	NODE *full_nodep; 
+	DNS_DIC_PACKET packet;
+	char *ptr;
+	int i;
+
+	nodep = servp->node_head;
+	prevp = nodep;
+	while( (nodep = (RED_NODE *) dll_get_next((DLL *) servp->node_head,
+						 (DLL *) prevp)) )
+	{
+		packet.service_id = htovl(nodep->service_id);
+		strcpy(packet.node_name, Dns_conns[servp->conn_id].node_name);
+		strcpy(packet.task_name, Dns_conns[servp->conn_id].task_name);
+		for(i = 0; i < 4; i++)
+			packet.node_addr[i] = Dns_conns[servp->conn_id].node_addr[i];
+		packet.port = htovl(Dns_conns[servp->conn_id].port);
+		packet.pid = htovl(Dns_conns[servp->conn_id].pid);
+		packet.protocol = htovl(Dns_conns[servp->conn_id].protocol);
+		packet.size = htovl(DNS_DIC_HEADER);
+		packet.format = htovl(servp->server_format);
+		strcpy( packet.service_def, servp->serv_def );
+/* Should it be dna_write_nowait? 16/9/2008 */
+/* moved from dna_write to dna_write_nowait in 14/10/2008 */
+/*
+		dna_write_nowait(nodep->conn_id, &packet, DNS_DIC_HEADER);
+*/
+		if( !dna_write_nowait(nodep->conn_id, &packet, DNS_DIC_HEADER) )
+		{
+			dim_print_date_time();
+			printf(" Inform Client: Couldn't write, releasing Conn %3d : Client %s@%s\n",nodep->conn_id,
+					Net_conns[nodep->conn_id].task,
+					Net_conns[nodep->conn_id].node);
+			fflush(stdout);
+/*
+release_conn(nodep->conn_id);
+*/
+		}
+/*
+		if(dna_write_nowait(nodep->conn_id, &packet, DNS_DIC_HEADER))
+		{
+*/
+			dll_remove( (DLL *) nodep );
+			ptr = (char *)nodep - (2 * sizeof(void *));
+			full_nodep = (NODE *)ptr;
+			dll_remove( (DLL *) full_nodep );
+			nodep = nodep->prev;
+			free( full_nodep );
+			prevp = nodep;
+/*
+		}
+*/
+	}
+}
+
+#ifdef VMS
+static release_client(int conn_id)
+{
+char *ptr_task;
+char *ptr_node;
+int i;
+
+	ptr_task = Net_conns[conn_id].task;
+	ptr_node = Net_conns[conn_id].node;
+	for( i = 0; i< Curr_N_Conns; i++ )
+	{
+		if( (!strcmp(Net_conns[i].task,ptr_task)) &&
+		    (!strcmp(Net_conns[i].node,ptr_node)) )
+		{
+			if(i != conn_id)
+			{
+				if( Dns_conns[i].src_type == SRC_DIC ) 
+				{
+					if(Debug)
+					{
+						dim_print_date_time();
+						printf(" Releasing client on conn %d - %s@%s\n",
+							i, Net_conns[i].task, Net_conns[i].node);
+						fflush(stdout);
+					}
+					release_conn(i);
+				}
+			}
+		}
+	}
+}
+#endif
+
+static void release_conn(int conn_id)
+{
+	DNS_SERVICE *servp, *old_servp;
+	NODE *nodep, *old_nodep;
+	DNS_CONNECTION *connp;
+	void service_remove();
+
+	connp = &Dns_conns[conn_id];
+	if( Dns_conns[conn_id].src_type == SRC_DIS ) 
+	{
+		if( Debug )
+		{
+			dim_print_date_time();
+			printf( " Conn %3d : Server %s@%s died\n",
+				conn_id, Dns_conns[conn_id].task_name,
+				Dns_conns[conn_id].node_name);
+			fflush(stdout);
+		}
+		else
+		{
+			if(Dns_conns[conn_id].n_services == -1)
+			{
+				dim_print_date_time();
+				printf( " Conn %3d : Server %s@%s died\n",
+					conn_id, Dns_conns[conn_id].task_name,
+					Dns_conns[conn_id].node_name);
+				fflush(stdout);
+			}
+		}
+		Curr_n_servers--;
+		if( Dns_conns[conn_id].timr_ent ) 
+		{
+			dtq_rem_entry( Timer_q, Dns_conns[conn_id].timr_ent );
+			Dns_conns[conn_id].timr_ent = NULL;
+		}
+		servp = (DNS_SERVICE *)Dns_conns[conn_id].service_head;
+		while( (servp = (DNS_SERVICE *) dll_get_next(
+				(DLL *) Dns_conns[conn_id].service_head,
+				(DLL *) servp)) )
+		{
+			dll_remove((DLL *) servp);
+			if(dll_empty((DLL *) servp->node_head)) 
+			{
+				service_remove(&(servp->next));
+				Curr_n_services--;
+				old_servp = servp;
+				servp = servp->server_prev;
+				free(old_servp);
+			} 
+			else 
+			{
+				servp->state = 0;
+				servp->conn_id = 0;
+				servp = servp->server_prev;
+			}
+		}
+		if(Dns_conns[conn_id].n_services)
+		{
+			Dns_conns[conn_id].n_services = 0;
+			
+			do_update_did(conn_id);
+/*
+			Last_conn_id = conn_id;
+			dis_update_service(Server_new_info_id);
+		    dis_update_service(Server_info_id);
+*/			
+		}
+		free((DNS_SERVICE *)Dns_conns[conn_id].service_head);
+		Dns_conns[conn_id].service_head = 0;
+		Dns_conns[conn_id].src_type = SRC_NONE;
+		dna_close(conn_id);
+	}
+	else if(Dns_conns[conn_id].src_type == SRC_DIC)
+	{
+		if(Debug)
+		{
+			dim_print_date_time();
+			printf(" Conn %3d : Client %s@%s died\n",
+				conn_id, Net_conns[conn_id].task, Net_conns[conn_id].node);
+			fflush(stdout);
+		}
+		if( (nodep = (NODE *)Dns_conns[conn_id].node_head) ) 
+		{
+			while( (nodep = (NODE *) dll_get_next(
+					(DLL *) Dns_conns[conn_id].node_head,
+					(DLL *) nodep)) )
+			{
+				servp = nodep->servp;
+				dll_remove( (DLL *) nodep );
+				dll_remove( (DLL *) &(nodep->next) );
+				old_nodep = nodep;
+				nodep = nodep->client_prev;
+				free(old_nodep);
+				if( (dll_empty((DLL *) servp->node_head)) &&
+				    (!servp->conn_id) )
+				{
+					service_remove(&(servp->next));
+					Curr_n_services--;
+					free( servp );
+				}
+			}
+			free(Dns_conns[conn_id].node_head);
+			Dns_conns[conn_id].node_head = 0;
+		}
+		Dns_conns[conn_id].src_type = SRC_NONE;
+		dna_close(conn_id);
+	} 
+	else 
+	{
+		if(Debug)
+		{
+			dim_print_date_time();
+			printf(" Conn %3d : Undefined Type %s@%s died\n",
+				conn_id, Net_conns[conn_id].task,
+				Net_conns[conn_id].node);
+			fflush(stdout);
+		}
+		dna_close(conn_id);
+	}
+}
+
+
+void set_in_error(int conn_id)
+{
+	DNS_SERVICE *servp;
+
+	if(Dns_conns[conn_id].src_type == SRC_DIS)
+	{
+		if(strcmp(Dns_conns[conn_id].task_name,"DIS_DNS"))
+			dna_rem_test_write(conn_id);
+		servp = (DNS_SERVICE *)Dns_conns[conn_id].service_head;
+		while( (servp = (DNS_SERVICE *) dll_get_next(
+				(DLL *) Dns_conns[conn_id].service_head,
+				(DLL *) servp)) )
+			servp->state = -1;
+		Dns_conns[conn_id].n_services = -1;
+	}
+}
+
+void get_dns_server_info(int *tag, int **bufp, int *size, int *first_time)
+{
+	if(tag){}
+	if(*first_time)
+	{
+
+#ifdef VMS
+		 sys$wake(0, 0);
+#else
+		wake_up = TRUE;
+#ifdef WIN32
+		wake_up();
+#endif
+#endif
+		*size = 0;
+	}
+	else
+	{
+		send_dns_server_info(Last_conn_id, bufp, size);
+	}
+}
+
+
+void send_dns_server_info(int conn_id, int **bufp, int *size)
+{
+	static int curr_allocated_size = 0;
+	static DNS_DID *dns_info_buffer;
+	DNS_SERVICE *servp;
+	DNS_SERVER_INFO *dns_server_info;
+	DNS_SERVICE_INFO *dns_service_info;
+	DNS_CONNECTION *connp;
+	int max_size;
+	int n_services;
+
+	DISABLE_AST
+	connp = &Dns_conns[conn_id];
+	if(connp->src_type != SRC_DIS)
+	{
+		ENABLE_AST
+		return;
+	}
+	n_services = connp->n_services;
+	if(n_services == -1)
+		n_services = 0;
+	max_size = sizeof(DNS_SERVER_INFO) + 
+				n_services * sizeof(DNS_SERVICE_INFO);
+	if(!curr_allocated_size)
+	{
+		dns_info_buffer = (DNS_DID *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	else if (max_size > curr_allocated_size)
+	{
+		free(dns_info_buffer);
+		dns_info_buffer = (DNS_DID *)malloc(max_size);
+		curr_allocated_size = max_size;
+	}
+	dns_server_info = &dns_info_buffer->server;
+	dns_service_info = dns_info_buffer->services;
+	strncpy(dns_server_info->task, connp->task_name, MAX_TASK_NAME-4);
+	strncpy(dns_server_info->node, connp->node_name, MAX_NODE_NAME);
+	dns_server_info->pid = htovl(connp->pid);
+	dns_server_info->n_services = htovl(connp->n_services);
+	servp = (DNS_SERVICE *)connp->service_head;
+	while( (servp = (DNS_SERVICE *) dll_get_next((DLL *) connp->service_head,
+						    (DLL *) servp)) )
+	{
+		strncpy(dns_service_info->name, servp->serv_name, MAX_NAME); 
+		dns_service_info->status = htovl(1);
+		if(servp->serv_id & 0x10000000)
+			dns_service_info->type = htovl(1);
+		else
+			dns_service_info->type = htovl(0);
+		dns_service_info++;
+	}
+	*bufp = (int *)dns_info_buffer;
+	*size = max_size;
+	ENABLE_AST
+}
+
+void get_new_dns_server_info(int *tag, int **bufp, int *size, int *first_time)
+{
+	static int curr_allocated_size = 0;
+	static char *info_buffer;
+	static int *pid_buffer, pid_size;
+	int pid_index = 0;
+	DNS_CONNECTION *connp;
+	int i, max_size, max_pid_size/*, j, n*/;
+	int n_server = 0;
+	char /*aux[MAX_NAME], *ptr, */ server[MAX_NAME], *info_buffer_ptr;
+/*
+	DNS_SERVICE *servp;
+	int find_services();
+*/
+
+	DISABLE_AST
+	if(tag){}
+ 	for( i = 0; i< Curr_N_Conns; i++ )
+	{
+		if( Dns_conns[i].src_type == SRC_DIS )
+		{
+			n_server++;
+		}
+	}
+	max_size = (sizeof(DNS_SERVER_INFO) + MAX_TASK_NAME) * n_server;
+	max_pid_size = sizeof(int) * n_server;
+	if(!curr_allocated_size)
+	{
+		info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+		pid_buffer = (int *)malloc(max_pid_size);
+	}
+	else if (max_size > curr_allocated_size)
+	{
+		free(info_buffer);
+		info_buffer = (char *)malloc(max_size);
+		curr_allocated_size = max_size;
+		free(pid_buffer);
+		pid_buffer = (int *)malloc(max_pid_size);
+	}
+	info_buffer[0] = '\0';
+	pid_buffer[0] = 0;
+
+	info_buffer_ptr = info_buffer;
+	if(*first_time)
+	{
+	 	for( i = 0; i< Curr_N_Conns; i++ )
+		{
+			if( Dns_conns[i].src_type == SRC_DIS )
+			{
+				connp = &Dns_conns[i];
+/*
+				if(strlen(connp->task_name) == MAX_TASK_NAME-4-1)
+				{
+					strcpy(aux,connp->task_name);
+					strcat(aux,"--CLIENT_LIST");
+					n = find_services(aux);
+					for(j = 0; j < n; j++)
+					{
+						servp = Service_info_list[j];
+						if(i == servp->conn_id)
+						{
+							strcpy(aux,servp->serv_name);
+							ptr = strstr(aux,"/CLIENT_LIST");
+							if(ptr)
+								*ptr = '\0';
+							break;
+						}
+					}
+					free(Service_info_list);
+					strcpy(server, aux);
+				}
+				else
+				{
+*/
+					strcpy(server, connp->long_task_name);
+/*
+				}
+*/
+				strcat(server,"@");
+				strcat(server, connp->node_name);
+				strcat(server,"|");
+				strcpy(info_buffer_ptr, server);
+				info_buffer_ptr += strlen(server);
+				pid_buffer[pid_index] = connp->pid;
+				pid_index++;
+			}
+		}
+	}
+	else
+	{
+		connp = &Dns_conns[Last_conn_id];
+		if(connp->n_services > 0)
+			strcat(info_buffer, "+");
+		else if(connp->n_services == -1)
+			strcat(info_buffer, "!");
+		else
+			strcat(info_buffer, "-");
+		strcat(info_buffer, connp->long_task_name);
+		strcat(info_buffer,"@");
+		strcat(info_buffer, connp->node_name);
+		strcat(info_buffer,"|");
+		pid_buffer[pid_index] = connp->pid;
+		pid_index++;
+	}
+	info_buffer[strlen(info_buffer) - 1] = '\0';
+	info_buffer_ptr = &info_buffer[strlen(info_buffer)+1];
+	pid_size = 0;
+	for(i = 0; i < pid_index; i++)
+	{
+		if(i != (pid_index -1))
+			sprintf(server, "%d|",pid_buffer[i]);
+		else
+			sprintf(server, "%d",pid_buffer[i]);
+		strcpy(info_buffer_ptr, server);
+		info_buffer_ptr += strlen(server);
+		pid_size += strlen(server);
+	}
+	*bufp = (int *)info_buffer;
+	*size = strlen(info_buffer)+1+pid_size+1;
+	ENABLE_AST
+}
+
+int main(int argc, char **argv)
+{
+	int i, protocol, dns_port;
+	int *bufp;
+	int size;
+	int conn_id, id;
+	DIS_DNS_PACKET *dis_dns_packet;
+	char node[MAX_NAME];
+	void service_init();
+	
+	if(argc > 1)
+	{
+		if(!strcmp(argv[1],"-d"))
+			set_debug_on();
+		else
+		{
+			printf("Parameters: -d	Debug On\n");
+			exit(0);
+		}
+	}
+	dim_set_write_timeout(10);
+	dim_init();
+	conn_arr_create( SRC_DNS );
+	service_init();
+	Timer_q = dtq_create();
+	get_node_name(node);
+	dim_print_date_time();
+	printf(" DNS version %d starting up on %s\n",DIM_VERSION_NUMBER, node); 
+	fflush(stdout);
+
+	Server_new_info_id = dis_add_service( "DIS_DNS/SERVER_LIST", "C", 0, 0, 
+						get_new_dns_server_info, 0 );
+	Server_info_id = dis_add_service( "DIS_DNS/SERVER_INFO", 0, 0, 0, 
+						get_dns_server_info, 0 );
+	dis_add_cmnd( "DIS_DNS/PRINT_STATS", 0, print_stats, 0 );
+	dis_add_cmnd( "DIS_DNS/DEBUG_ON", 0, set_debug_on, 0 );
+	dis_add_cmnd( "DIS_DNS/DEBUG_OFF", 0, set_debug_off, 0 );
+	dis_add_cmnd( "DIS_DNS/KILL_SERVERS", 0, kill_servers, 0 );
+	dis_add_cmnd( "DIS_DNS/PRINT_HASH_TABLE", 0, print_hash_table, 0 );
+	dis_add_cmnd( "DIS_DNS/SERVICE_INFO/RpcIn", "C", set_rpc_info, 0 );
+	Rpc_id = dis_add_service( "DIS_DNS/SERVICE_INFO/RpcOut", "C", 0, 0, 
+						get_rpc_info, 0 );
+	dns_port = get_dns_port_number();
+	if( !dna_open_server(DNS_TASK, recv_rout, &protocol, &dns_port, error_handler) )
+		return(0);
+
+	id = dis_start_serving("DIS_DNS");
+	dis_dns_packet = (DIS_DNS_PACKET *) id_get_ptr(id, SRC_DIS);
+	id_free(id, SRC_DIS);
+	conn_id = conn_get();
+	handle_registration(conn_id, dis_dns_packet, 0);
+	dtq_add_entry(Timer_q, 5, update_did, 0xded0000);
+	while(1)
+	{
+#ifdef VMS
+		sys$hiber(); 
+#else
+		wake_up = FALSE;
+		while( !wake_up )
+        {
+			dim_wait();
+        }
+#endif
+ 		for( i = 0; i< Curr_N_Conns; i++ )
+		{
+			if( Dns_conns[i].src_type == SRC_DIS )
+			{
+				send_dns_server_info( i, &bufp, &size );
+				dis_send_service( Server_info_id, bufp, size );
+			}
+		}
+	}
+	return(1);
+}
+
+
+void print_stats()
+{
+	int i;
+	int n_conns = 0;
+	int n_services = 0;
+	int n_servers = 0;
+	int n_clients = 0;
+
+	dim_print_date_time();
+	printf(" Connection Statistics :\n");
+	for(i = 0; i< Curr_N_Conns; i++)
+	{
+		switch(Dns_conns[i].src_type)
+		{
+		case SRC_DIS :
+			printf("%d - Server %s@%s (PID %d) %d services\n",
+				i, Dns_conns[i].task_name,
+				Dns_conns[i].node_name,
+				Dns_conns[i].pid, Dns_conns[i].n_services);
+			fflush(stdout);
+			n_services +=  Dns_conns[i].n_services;
+			n_servers++;
+			n_conns++;
+			break;
+		case SRC_DIC :
+			printf("%d - Client %s@%s\n",
+				i, Net_conns[i].task, Net_conns[i].node); 
+			fflush(stdout);
+			n_conns++;
+			n_clients++;
+			break;
+		default :
+			if(Dna_conns[i].busy)
+			{
+				if(Net_conns[i].task[0] && Net_conns[i].node[0])
+					printf("%d - Undefined %s@%s\n",
+						i, Net_conns[i].task,
+						Net_conns[i].node);
+				else 
+					printf("%d - Undefined\n", i);
+				fflush(stdout);
+				n_conns++;
+			}
+			else
+			{
+				printf("%d - Empty\n", i);
+				fflush(stdout);
+			}
+		}
+	}
+	printf("Number of Connections = %d : %d servers, %d clients\n", n_conns,
+		n_servers, n_clients);
+	printf("Number of Services = %d\n", n_services);
+	fflush(stdout);
+}
+
+
+void set_debug_on()
+{
+	Debug = 1;
+}
+
+
+void set_debug_off()
+{
+	Debug = 0;
+}
+
+
+void kill_servers()
+{
+	int i;
+	DNS_DIS_PACKET dis_packet;
+
+	for(i = 0; i< Curr_N_Conns; i++)
+	{
+		if(Dns_conns[i].src_type == SRC_DIS)
+		{
+			if(!strcmp(Dns_conns[i].task_name,"DIS_DNS"))
+				continue;
+			dim_print_date_time();
+			printf(" Killing server %s@%s\n",
+				Dns_conns[i].task_name, Dns_conns[i].node_name);
+			fflush(stdout);
+			dis_packet.type = htovl(DNS_DIS_EXIT);
+			dis_packet.size = htovl(DNS_DIS_HEADER);
+			if( !dna_write_nowait(i, &dis_packet, DNS_DIS_HEADER) )
+			{
+				dim_print_date_time();
+				printf(" Kill Server: Couldn't write, releasing %d\n",i);
+				fflush(stdout);
+				release_conn(i);
+			}
+		}
+	}
+}
+
+
+void service_init()
+{
+  int i;
+
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) {
+		Service_hash_table[i] = (RED_DNS_SERVICE *) malloc(8);
+		dll_init((DLL *) Service_hash_table[i]);
+	}
+}
+
+
+void service_insert(RED_DNS_SERVICE *servp)
+{
+	int index;
+
+	index = HashFunction(servp->serv_name, MAX_HASH_ENTRIES);
+	dll_insert_queue((DLL *) Service_hash_table[index], 
+			 (DLL *) servp);
+}
+
+
+void service_remove(RED_DNS_SERVICE *servp)
+{
+	if( servp->node_head )
+		free( servp->node_head );
+	dll_remove( (DLL *) servp );
+}
+
+
+DNS_SERVICE *service_exists(char *name)
+{
+	int index;
+	RED_DNS_SERVICE *servp;
+	char *ptr;
+
+	index = HashFunction(name, MAX_HASH_ENTRIES);
+	if( (servp = (RED_DNS_SERVICE *) dll_search(
+					(DLL *) Service_hash_table[index],
+			      		name, strlen(name)+1)) )
+	{
+		ptr = (char *)servp - (2 * sizeof(void *));
+		return((DNS_SERVICE *)ptr);
+	}
+
+	return((DNS_SERVICE *)0);
+}			
+
+void print_hash_table()
+{
+	int i;
+	RED_DNS_SERVICE *servp;
+	int n_entries, max_entry_index = 0;
+	int max_entries = 0;
+
+#ifdef VMS
+	if( ( foutptr = fopen( "scratch$week:[cp_operator]dim_dns.log", "w" ) 
+		) == (FILE *)0 )
+	{
+		printf("Cannot open: scratch$week:[cp_operator]dim_dns.log for writing\n");
+		fflush(stdout);
+		return;
+	}	
+#endif								 
+	
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		n_entries = 0;
+#ifdef VMS
+		fprintf(foutptr,"HASH[%d] : \n",i);
+#endif								 
+		servp = Service_hash_table[i];
+		while( (servp = (RED_DNS_SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[i],
+						(DLL *) servp)) )
+		{
+#ifdef VMS
+			fprintf(foutptr,"%s\n",servp->serv_name);
+#endif								 
+			n_entries++;
+		}
+#ifdef VMS
+		fprintf(foutptr,"\n\n");
+#endif								 
+		if(n_entries != 0)
+			printf("HASH[%d] - %d entries\n", i, n_entries);  
+		if(n_entries > max_entries)
+		{
+			max_entries = n_entries;
+			max_entry_index = i;
+		}
+	}
+#ifdef VMS
+	fclose(foutptr);
+#endif								 
+	printf("Maximum : HASH[%d] - %d entries\n", max_entry_index, max_entries);  
+	fflush(stdout);
+}
+
+int find_services(char *wild_name)
+{
+
+	int i;
+	RED_DNS_SERVICE *servp;
+	DNS_SERVICE *servp1;
+	char tmp[MAX_NAME], *ptr, *ptr1, *dptr, *dptr1;
+	int match, count = 0;
+
+	Service_info_list = (DNS_SERVICE **)
+		malloc(Curr_n_services*sizeof(DNS_SERVICE *));
+
+	if(!strchr(wild_name, '*'))
+	{
+		servp1 = service_exists(wild_name);
+		if(servp1)
+		{
+			if(servp1->state == 1)
+			{
+				Service_info_list[count] = (DNS_SERVICE *)servp1;
+				count++;
+				return 1;
+			}
+		}
+		return 0;
+	}
+	for( i = 0; i < MAX_HASH_ENTRIES; i++ ) 
+	{
+		servp = Service_hash_table[i];
+		while( (servp = (RED_DNS_SERVICE *) dll_get_next(
+						(DLL *) Service_hash_table[i],
+						(DLL *) servp)) )
+		{
+			ptr = wild_name;
+			dptr = servp->serv_name;
+			match = 1;
+
+            while( (ptr1 = strchr(ptr,'*')) )
+			{
+				if(ptr1 == ptr)
+				{
+					ptr++;
+					if(!*ptr)
+					{
+						dptr = ptr; 
+						break;
+					}
+					strcpy(tmp,ptr);
+					if( (ptr1 = strchr(ptr,'*')) )
+					{
+						tmp[ptr1-ptr] = '\0';
+					}
+					if( (dptr1 = strstr(dptr, tmp)) )
+					{
+						if(!ptr1)
+						{
+							dptr = dptr1;
+							break;
+						}
+						dptr1 += strlen(tmp);
+						ptr = ptr1;
+						dptr = dptr1;
+					}
+					else
+					{
+						match = 0;
+						break;
+					}
+				}
+				else
+				{
+					strcpy(tmp,ptr);
+					tmp[ptr1-ptr] = '\0';
+					if(!strncmp(dptr, tmp, strlen(tmp)))
+					{
+						dptr += strlen(tmp);
+						ptr = ptr1;
+					}
+					else
+					{
+						match = 0;
+						break;
+					}
+				}
+			}			
+			if(strcmp(dptr, ptr))
+			{
+				strcpy(tmp,ptr);
+				strcat(tmp,"/RpcIn");
+				if(strcmp(dptr, tmp))
+					match = 0;
+			}
+		    if(match)
+			{
+				if(servp->state == 1)
+				{
+					ptr = (char *)servp - (2 * sizeof(void *));
+					Service_info_list[count] = (DNS_SERVICE *)ptr;
+					count++;
+				}
+			}
+		}
+	}
+	return(count);
+}
+
+void set_rpc_info(int *tag, char *buffer, int *size)
+{
+	char aux[MAX_NAME], rpcaux[MAX_NAME+32], *ptr, *rpcptr;
+    int i, n, rpc, id[2], conn_id;
+	DNS_SERVICE *servp, *aux_servp;
+
+	if(size){}
+	if(tag){}
+	if(Debug)
+	{
+		dim_print_date_time();
+		conn_id = dis_get_conn_id();
+		printf(" Got Browse Request <%s> from conn: %d %s@%s\n", buffer, conn_id,
+			Net_conns[conn_id].task,Net_conns[conn_id].node);
+	}
+	n = find_services(buffer);
+	if(Debug)
+	{
+		dim_print_date_time();
+		conn_id = dis_get_conn_id();
+		printf(" Browse Request <%s> found %d services\n", buffer, n);
+	}
+	if(!Rpc_info_size)
+	{
+		Rpc_info = malloc(MAX_NAME*(n+1)*2);
+		Rpc_info_size = MAX_NAME*(n+1)*2;
+	}
+	else if(Rpc_info_size < MAX_NAME*n*2)
+	{
+		free(Rpc_info);
+		Rpc_info = malloc(MAX_NAME*(n+1)*2);
+		Rpc_info_size = MAX_NAME*(n+1)*2;
+	}
+	Rpc_info[0] = '\0';
+	rpcptr = Rpc_info;
+	for(i = 0; i < n; i++)
+	{		
+		rpc = 0;
+		servp = Service_info_list[i];
+		if(strstr(servp->serv_name,"/Rpc"))
+		{
+			strcpy(aux,servp->serv_name);
+			if( (ptr = strstr(aux,"/RpcIn")) )
+			{
+				*ptr = '\0';
+				rpc = 1;
+				if( (ptr = strstr(Rpc_info, aux)) )
+				{
+					ptr += strlen(aux);
+					if(*ptr == '|')
+						rpc = 2;
+				}
+			}
+			if( (ptr = strstr(aux,"/RpcOut")) )
+			{
+				*ptr = '\0';
+				rpc = 1;
+				if( (ptr = strstr(Rpc_info, aux)) )
+				{
+					ptr += strlen(aux);
+					if(*ptr == '|')
+						rpc = 2;
+				}
+			}
+			if(rpc == 1)
+			{
+				strcpy(rpcaux, aux);
+				strcat(rpcaux,"|");
+				strcat(aux,"/RpcIn");
+				if( (aux_servp = service_exists(aux)) )
+				{
+					strcat(rpcaux, aux_servp->serv_def);
+					strcat(rpcaux,",");
+					ptr = strstr(aux,"/RpcIn");
+					*ptr = '\0';
+					strcat(aux,"/RpcOut");
+					if( (aux_servp = service_exists(aux)) )
+					{
+						strcat(rpcaux,aux_servp->serv_def);
+						strcat(rpcaux,"|RPC\n");
+						strcpy(rpcptr, rpcaux);
+						rpcptr += strlen(rpcaux);
+					}
+				}
+			}
+		}
+		else
+		{
+			strcpy(rpcaux, servp->serv_name);
+			strcat(rpcaux,"|");
+			strcat(rpcaux,servp->serv_def);
+			if(servp->serv_id & 0x10000000)
+				strcat(rpcaux,"|CMD\n");
+			else
+				strcat(rpcaux,"|\n");
+			strcpy(rpcptr, rpcaux);
+			rpcptr += strlen(rpcaux);
+		}
+	}
+	*rpcptr = '\0';
+	id[0] = dis_get_conn_id();
+	id[1] = 0;
+	dis_selective_update_service(Rpc_id, id); 
+	free(Service_info_list);
+}
+
+void get_rpc_info(int *tag, char **buffer, int *size)
+{
+
+	if(tag){}
+	*buffer = Rpc_info;
+	*size = strlen(Rpc_info)+1;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/dtq.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/dtq.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/dtq.c	(revision 10183)
@@ -0,0 +1,866 @@
+/*
+ * DTQ (Delphi Timer Queue) implements the action scheduling for the DIM
+ * (Delphi Information Managment) System.
+ * It will be used by servers clients and the Name Server.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ */
+
+/* include files */
+#include <signal.h>
+#include <stdio.h>
+#define DIMLIB
+#include <dim.h>
+
+#ifdef VxWorks
+#include <time.h>
+#endif
+
+#include <sys/timeb.h>
+
+/* global definitions */
+#define MAX_TIMER_QUEUES	16	/* Number of normal queue's     */
+#define SPECIAL_QUEUE		16	/* The queue for the queue-less */
+#define WRITE_QUEUE			17 
+
+_DIM_PROTO( static void alrm_sig_handler,  (int num) );
+_DIM_PROTO( static void Std_timer_handler, () );
+_DIM_PROTO( static int stop_it,			   (int new_time) );
+_DIM_PROTO( static int start_it,		   (int new_time) );
+_DIM_PROTO( static int scan_it,			   () );
+_DIM_PROTO( static int get_minimum,		   (int deltat) );
+_DIM_PROTO( int dtq_task, (void *dummy) );
+_DIM_PROTO( static int my_alarm, (int secs) );
+_DIM_PROTO( int dim_dtq_init,	   (int thr_flag) );
+#ifndef WIN32
+_DIM_PROTO( static void dummy_alrm_sig_handler, (int num) );
+#endif
+
+typedef struct {
+	TIMR_ENT *queue_head;
+	int remove_entries;
+} QUEUE_ENT;
+
+
+static QUEUE_ENT timer_queues[MAX_TIMER_QUEUES + 2] = { 
+	{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
+	{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}
+};
+
+static int Inside_ast = 0;
+static int Alarm_runs = 0;
+static int sigvec_done = 0;
+
+#ifdef VxWorks
+static timer_t Timer_id;
+#endif
+
+static time_t DIM_last_time = 0;
+static int DIM_last_time_millies = 0;
+static int DIM_next_time = 0;
+static int DIM_time_left = 0;
+static int Threads_off = 0;
+
+/*
+ * DTQ routines
+ */
+
+
+#ifndef WIN32
+
+void dim_no_threads()
+{
+	extern void dic_no_threads();
+	extern void dis_no_threads();
+	
+	Threads_off = 1;
+	dic_no_threads();
+	dis_no_threads();
+}
+
+int dim_dtq_init(int thr_flag)
+{
+struct sigaction sig_info;
+sigset_t set;
+int pid, ret = 0;
+
+	pid = getpid();
+	if( !sigvec_done) 
+	{
+	    Inside_ast = 0;
+	    Alarm_runs = 0;
+	    DIM_last_time = 0;
+/*
+	    for(i = 0; i < MAX_TIMER_QUEUES + 2; i++)
+	    {
+	        timer_queues[i].queue_head = 0;
+			timer_queues[i].remove_entries = 0;
+	    }
+*/
+		if( timer_queues[SPECIAL_QUEUE].queue_head == NULL ) {
+			timer_queues[SPECIAL_QUEUE].queue_head = (TIMR_ENT *)malloc(sizeof(TIMR_ENT));
+			memset(timer_queues[SPECIAL_QUEUE].queue_head, 0, sizeof(TIMR_ENT));
+			dll_init( (DLL *)timer_queues[SPECIAL_QUEUE].queue_head);
+		}
+		if( timer_queues[WRITE_QUEUE].queue_head == NULL ) {
+			timer_queues[WRITE_QUEUE].queue_head = (TIMR_ENT *)malloc(sizeof(TIMR_ENT));
+			memset(timer_queues[WRITE_QUEUE].queue_head, 0, sizeof(TIMR_ENT));
+			dll_init( (DLL *)timer_queues[WRITE_QUEUE].queue_head);
+		}
+	    if(!thr_flag)
+	    {
+	        Threads_off = 1;
+	    }
+		sigemptyset(&set);
+	  
+		sigaddset(&set,SIGIO);
+		
+		if(thr_flag)
+			sig_info.sa_handler = dummy_alrm_sig_handler;
+		else
+			sig_info.sa_handler = alrm_sig_handler;
+		sig_info.sa_mask = set;
+#ifndef LYNXOS
+		sig_info.sa_flags = SA_RESTART;
+#else
+		sig_info.sa_flags = 0;
+#endif
+		if( sigaction(SIGALRM, &sig_info, 0) < 0 ) {
+			perror( "sigaction(SIGALRM)" );
+			exit(1);
+		}
+	    
+	    sigvec_done = 1;
+	    ret = 1;
+	}
+	return(ret);
+}
+
+void dummy_alrm_sig_handler( int num )
+{
+	if(num){}
+}
+
+#else
+
+int dim_dtq_init(int thr_flag)
+{
+	int tid = 1;
+	void create_alrm_thread(void);
+
+	if( !sigvec_done ) {
+		Inside_ast = 0;
+	    Alarm_runs = 0;
+	    DIM_last_time = 0;
+/*
+	    for(i = 0; i < MAX_TIMER_QUEUES + 2; i++)
+	    {
+	        timer_queues[i].queue_head = 0;
+			timer_queues[i].remove_entries = 0;
+	    }
+*/
+		if( timer_queues[SPECIAL_QUEUE].queue_head == NULL ) {
+			timer_queues[SPECIAL_QUEUE].queue_head = (TIMR_ENT *)malloc(sizeof(TIMR_ENT));
+			memset(timer_queues[SPECIAL_QUEUE].queue_head, 0, sizeof(TIMR_ENT));
+			dll_init( (DLL *)timer_queues[SPECIAL_QUEUE].queue_head);
+		}
+		if( timer_queues[WRITE_QUEUE].queue_head == NULL ) {
+			timer_queues[WRITE_QUEUE].queue_head = (TIMR_ENT *)malloc(sizeof(TIMR_ENT));
+			memset(timer_queues[WRITE_QUEUE].queue_head, 0, sizeof(TIMR_ENT));
+			dll_init( (DLL *)timer_queues[WRITE_QUEUE].queue_head);
+		}
+/*
+#ifndef STDCALL
+		tid = _beginthread((void *)(void *)dtq_task,0,NULL);
+#else
+		tid = _beginthreadex(NULL, NULL,
+			dtq_task,0,0,NULL);
+#endif
+*/
+		create_alrm_thread();
+		sigvec_done = 1;
+	}
+	return(tid);
+}
+
+#endif
+
+void dim_dtq_stop()
+{
+/*
+	int i;
+	for(i = 0; i < MAX_TIMER_QUEUES + 2; i++)
+	{
+		if( timer_queues[i].queue_head != NULL)
+		{
+			dtq_delete(i);
+			free((TIMR_ENT *)timer_queues[i].queue_head);
+			timer_queues[i].queue_head = 0;
+		}
+	}
+*/
+	scan_it();
+	if( timer_queues[WRITE_QUEUE].queue_head != NULL)
+	{
+		dtq_delete(WRITE_QUEUE);
+		free((TIMR_ENT *)timer_queues[WRITE_QUEUE].queue_head);
+		timer_queues[WRITE_QUEUE].queue_head = 0;
+	}
+	sigvec_done = 0;
+}
+
+static int get_current_time(int *millies)
+{
+	int secs;
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+
+#ifdef WIN32
+	ftime(&timebuf);
+	secs = (int)timebuf.time;
+	*millies = timebuf.millitm;
+#else
+	tz = 0;
+	gettimeofday(&tv, tz);
+	secs = tv.tv_sec;
+	*millies = tv.tv_usec / 1000;
+#endif
+	return secs;
+}
+
+static int get_elapsed_time()
+{
+	int millies, deltat;
+	int now;
+
+	now = get_current_time(&millies);
+	deltat = now - (int)DIM_last_time;
+	if((millies + 50) < DIM_last_time_millies)
+	{
+		deltat --;
+	}
+	return deltat;
+}
+
+static int my_alarm(int secs)
+{
+	int ret;
+
+	DIM_next_time = secs;
+#ifndef WIN32
+	if(Threads_off)
+	{
+		if( secs < 0)
+		{
+			kill(getpid(),SIGALRM);
+			return(0);
+		}
+		else
+		{
+			return(alarm(secs));
+		}
+	}
+	else
+	{
+#endif
+
+		ret = DIM_time_left;
+
+		if(secs == 0)
+			DIM_next_time = -1;
+		return(ret);
+#ifndef WIN32
+	}
+#endif
+}
+
+void dim_usleep(int usecs)
+{
+
+#ifndef WIN32
+	struct timeval timeout;
+
+	timeout.tv_sec = 0;
+	timeout.tv_usec = usecs;
+	select(FD_SETSIZE, NULL, NULL, NULL, &timeout);
+#else
+	usleep(usecs);
+#endif
+}
+
+int dtq_task(void *dummy)
+{
+int deltat;
+static int to_go;
+
+	if(dummy){}
+	while(1)
+	{
+		if(DIM_next_time)
+		{
+			DISABLE_AST
+			DIM_time_left = DIM_next_time;
+			if(DIM_time_left == -1)
+				DIM_time_left = 0;
+			to_go = DIM_next_time;
+			DIM_next_time = 0;
+			ENABLE_AST
+		}
+		if(DIM_time_left < 0)
+		{
+			DIM_time_left = 0;
+			alrm_sig_handler(2);
+#ifndef WIN32
+			return(1);
+#endif
+		}
+		else if(DIM_time_left > 0)
+		{
+			dim_usleep(100000);
+			deltat = get_elapsed_time();
+			DIM_time_left = to_go - deltat;
+			if(DIM_time_left <= 0)
+			{
+				alrm_sig_handler(2);
+#ifndef WIN32
+				return(1);
+#endif
+			}
+		}
+		else
+		{
+			dim_usleep(1000);
+		}
+	}
+}
+
+int dtq_create()
+{
+	int i;
+	extern void dim_init_threads(void);
+
+	if(!Threads_off)
+	{
+		dim_init_threads();
+	}
+	dim_dtq_init(0);
+	for( i = 1; i < MAX_TIMER_QUEUES; i++ )
+		if( timer_queues[i].queue_head == 0 )
+			break;
+
+	if( i == MAX_TIMER_QUEUES )
+		return(0);
+
+	timer_queues[i].queue_head = (TIMR_ENT *)malloc( sizeof(TIMR_ENT) );
+	memset( timer_queues[i].queue_head, 0, sizeof(TIMR_ENT) );
+	dll_init( (DLL *)timer_queues[i].queue_head);
+
+	return(i);
+}
+
+
+int dtq_delete(int queue_id)
+{
+	TIMR_ENT *queue_head, *entry;
+
+	DISABLE_AST
+	queue_head = timer_queues[queue_id].queue_head;
+	if(queue_head)
+	{
+		while(!dll_empty((DLL *)queue_head))
+		{
+			entry = queue_head->next;
+			dll_remove(entry);
+			free(entry);
+		}
+		free(queue_head);
+		timer_queues[queue_id].queue_head = 0;
+	}
+	ENABLE_AST
+	return(1);			
+}
+	
+TIMR_ENT *dtq_add_entry(int queue_id, int time, void (*user_routine)(), long tag)
+{
+	TIMR_ENT *new_entry, *queue_head, *auxp, *prevp;
+	int next_time, min_time = 100000;
+	int time_left, deltat = 0;
+
+	DISABLE_AST 
+
+	next_time = time;
+	if(!next_time)
+		next_time = -10;
+	if(Alarm_runs)
+	{
+		time_left = DIM_time_left;
+		if(!time_left)
+			time_left = DIM_next_time;
+		if((time_left > next_time) || (queue_id == SPECIAL_QUEUE))
+	    {
+			if(next_time != -10)
+			{
+				min_time = stop_it();
+				if((next_time > min_time) && (min_time != 0))
+					next_time = min_time;
+			}
+			else
+				my_alarm(next_time);
+	    }
+		else
+		{
+		    deltat = get_elapsed_time();
+		}
+	}
+	new_entry = (TIMR_ENT *)malloc( sizeof(TIMR_ENT) );
+	new_entry->time = time;
+    if( user_routine )
+   	   	new_entry->user_routine = user_routine;
+	else
+       	new_entry->user_routine = Std_timer_handler;
+	new_entry->tag = tag;
+	new_entry->time_left = time + deltat;
+
+	queue_head = timer_queues[queue_id].queue_head;
+	if(!time)
+	{
+		dll_insert_after((DLL *)queue_head->prev, (DLL *)new_entry);
+	}
+	else
+	{
+		if(queue_head)
+		{
+			auxp = queue_head;
+			prevp = auxp;
+			while((auxp = (TIMR_ENT *)dll_get_prev((DLL *)queue_head, (DLL *)auxp)))
+			{
+				if(time >= auxp->time)
+				{
+					break;
+				}
+				prevp = auxp;
+			}
+/*
+			if(auxp)
+			{
+				if(queue_id != SPECIAL_QUEUE)
+				{
+					if(auxp->time_left > 0)
+					{
+						if(auxp->time == time)
+							new_entry->time_left = auxp->time_left;
+					}
+				}
+				prevp = auxp;
+			}
+*/
+			dll_insert_after((DLL *)prevp, (DLL *)new_entry);
+		}
+	}
+	if(!Alarm_runs)
+	{
+		if((next_time != -10) && (min_time == 100000))
+		{
+			min_time = get_minimum(0);
+			if(next_time > min_time)
+				next_time = min_time;
+		}
+		start_it(next_time);
+	}
+	ENABLE_AST
+	return(new_entry); 
+}
+
+int dtq_clear_entry(TIMR_ENT *entry)
+{
+	int time_left, deltat = 0;
+
+	DISABLE_AST
+	deltat = get_elapsed_time();
+	time_left = entry->time_left - deltat;
+	entry->time_left = entry->time + deltat;
+	ENABLE_AST
+	return(time_left);
+}
+
+
+int dtq_rem_entry(int queue_id, TIMR_ENT *entry)
+{
+	int time_left, deltat = 0;
+
+	DISABLE_AST
+	deltat = get_elapsed_time();
+	time_left = entry->time_left - deltat;
+	if( Inside_ast ) 
+	{
+		timer_queues[queue_id].remove_entries++;
+		entry->time = -1;
+		ENABLE_AST
+		return(time_left);
+	}
+	dll_remove(entry);
+	free(entry);
+
+	ENABLE_AST
+	return(time_left);
+}
+
+static int rem_deleted_entries(int queue_id)
+{
+	TIMR_ENT *auxp, *prevp, *queue_head;
+	int n;
+
+	DISABLE_AST
+	queue_head = timer_queues[queue_id].queue_head;
+	n = timer_queues[queue_id].remove_entries;
+	if(queue_head)
+	{
+		auxp = queue_head;
+		prevp = auxp;
+		while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head, (DLL *)auxp)) )
+		{
+			if(auxp->time == -1)
+			{
+				dll_remove(auxp);
+				free(auxp);
+				auxp = prevp;
+				n--;
+				if(!n)
+					break;
+			}
+			else
+				prevp = auxp;
+		}
+	}
+	ENABLE_AST;
+	return(1);
+}
+
+static int get_minimum(int deltat)
+{
+	TIMR_ENT *auxp, *queue_head;
+	int queue_id;
+	int min_time = 100000;
+
+	queue_head = timer_queues[WRITE_QUEUE].queue_head;
+	if( dll_get_next((DLL *)queue_head,(DLL *)queue_head))
+		min_time = -10;
+	if((min_time != -10) || deltat)
+	{
+		if( (queue_head = timer_queues[SPECIAL_QUEUE].queue_head) != NULL)
+		{
+			auxp = queue_head;
+			while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
+			{
+				auxp->time_left -= deltat;
+				if(auxp->time_left > 0)
+				{
+					if(auxp->time_left < min_time)
+					{
+						min_time = auxp->time_left;
+					}
+				}
+			}
+		}
+		for( queue_id = 0; queue_id < MAX_TIMER_QUEUES; queue_id++ ) 
+		{
+			if( (queue_head = timer_queues[queue_id].queue_head) == NULL )
+				continue;
+			auxp = queue_head;
+			while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
+			{
+				auxp->time_left -= deltat;
+				if(auxp->time_left > 0)
+				{
+					if(auxp->time_left < min_time)
+					{
+						min_time = auxp->time_left;
+					}
+				}
+				else
+				{
+					if(auxp->time < min_time)
+					{
+						min_time = auxp->time;
+					}
+				}
+				if((!deltat) && (min_time <= 1))
+					break;
+			}
+		}
+	}
+	if(min_time == 100000)
+		min_time = 0;
+	return min_time;
+}
+
+static int stop_it()
+{
+	int min_time;
+    int deltat = 0;
+
+	DISABLE_AST
+	if(Alarm_runs)
+	{
+		my_alarm(0);
+        deltat = get_elapsed_time();
+		if(deltat != 0)
+			DIM_last_time = get_current_time(&DIM_last_time_millies);
+		Alarm_runs = 0;
+	}
+	min_time = get_minimum(deltat);
+	ENABLE_AST
+	return(min_time);
+}
+
+static int start_it(int new_time)
+{
+	int next_time;
+	TIMR_ENT *queue_head;
+
+	DISABLE_AST
+	next_time = new_time;
+	if(next_time > 0)
+	{
+		queue_head = timer_queues[WRITE_QUEUE].queue_head;
+		if( dll_get_next((DLL *)queue_head,(DLL *)queue_head))
+		{
+			next_time = -10;
+		}
+	}
+	if(next_time)
+	{
+		my_alarm(next_time);
+		Alarm_runs = 1;
+		if(!DIM_last_time)
+			DIM_last_time = get_current_time(&DIM_last_time_millies);
+	}
+	else
+		DIM_last_time = 0;
+
+	ENABLE_AST
+	return(1);
+}
+
+static int scan_it()
+{
+	int queue_id, i, n = 0;
+	static int curr_queue_id = 0;
+	static TIMR_ENT *curr_entry = 0;
+	TIMR_ENT *auxp, *prevp, *queue_head;
+	TIMR_ENT *done[1024];
+
+	DISABLE_AST
+	queue_head = timer_queues[WRITE_QUEUE].queue_head;
+	if(!queue_head)
+	{
+		ENABLE_AST
+		return(0);
+	}
+	auxp = queue_head;
+	while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
+	{	
+		done[n++] = auxp;
+		if(n == 1000)
+			break;
+	}
+	ENABLE_AST
+	for(i = 0; i < n; i++)
+	{
+		auxp = done[i];
+		auxp->user_routine( auxp->tag );
+	}
+	{
+		DISABLE_AST
+		for(i = 0; i < n; i++)
+		{
+			auxp = done[i];
+			dll_remove(auxp);
+			free(auxp);
+		}
+		if(n == 1000)
+		{
+			ENABLE_AST
+			return(1);
+		}
+		ENABLE_AST
+	}
+	{
+	DISABLE_AST
+	queue_head = timer_queues[SPECIAL_QUEUE].queue_head;
+	auxp = queue_head;
+	prevp = auxp;
+	while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
+	{	
+		if(auxp->time_left <= 0)
+		{
+			dll_remove(auxp);
+			auxp->user_routine( auxp->tag );
+			free(auxp);
+			auxp = prevp;
+			n++;
+			if(n == 100)
+			{
+				ENABLE_AST
+				return(1);
+			}
+		}
+		else
+			prevp = auxp;
+	}
+	for( queue_id = curr_queue_id; queue_id < MAX_TIMER_QUEUES; queue_id++ ) 
+	{
+		if( (queue_head = timer_queues[queue_id].queue_head) == NULL )
+			continue;
+		Inside_ast = 1;
+		if((curr_entry) && (queue_id == curr_queue_id))
+			auxp = curr_entry;
+		else
+			auxp = queue_head;
+		while( (auxp = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)auxp)) )
+		{	
+			if(auxp->time_left <= 0)
+			{
+				auxp->user_routine( auxp->tag );
+				auxp->time_left = auxp->time; /*restart clock*/
+				n++;
+				if(n == 100)
+				{
+					curr_queue_id = queue_id;
+					curr_entry = auxp;
+					ENABLE_AST
+					return(1);
+				}
+			}
+		}
+		Inside_ast = 0;
+		if( timer_queues[queue_id].remove_entries ) {
+			rem_deleted_entries( queue_id );
+			timer_queues[queue_id].remove_entries = 0;
+		}
+	}
+	curr_queue_id = 0;
+	curr_entry = 0;
+	ENABLE_AST
+	}
+	return(0);
+}
+
+static void alrm_sig_handler( int num)
+{
+	int next_time;
+
+	if(num){}
+	next_time = stop_it();
+	if(Threads_off)
+	{
+		if(scan_it())
+			next_time = -10;
+	}
+	else
+	{
+		while(scan_it());
+	}
+	if(!Alarm_runs)
+	{
+		start_it(next_time);
+	}
+}
+
+static void Std_timer_handler()
+{
+}
+
+void dtq_start_timer(int time, void (*user_routine)(), long tag)
+{
+	extern void dim_init_threads();
+
+	if(!Threads_off)
+	{
+		dim_init_threads();
+	}
+	dim_dtq_init(0);
+	if(time != 0)
+		dtq_add_entry(SPECIAL_QUEUE, time, user_routine, tag);
+	else
+		dtq_add_entry(WRITE_QUEUE, time, user_routine, tag);
+}
+
+
+int dtq_stop_timer(long tag)
+{
+	TIMR_ENT *entry, *queue_head, *prevp;
+	int time_left = -1;
+
+	queue_head = timer_queues[SPECIAL_QUEUE].queue_head;
+	entry = queue_head;
+	prevp = entry;
+	while( (entry = (TIMR_ENT *)dll_get_next((DLL *)queue_head,(DLL *)entry)) )
+	{
+		if( entry->tag == tag ) 
+		{
+			time_left = dtq_rem_entry( SPECIAL_QUEUE, entry );
+			break;
+		}
+	}
+	return(time_left);
+}
+
+static int Dtq_sleeping = 0;
+
+void dtq_sleep_rout(long tag)
+{
+	if(tag){}
+	Dtq_sleeping = 0;
+#ifdef WIN32
+	wake_up();
+#endif
+}
+
+#ifndef WIN32
+
+unsigned int dtq_sleep(int secs)
+{
+
+#ifndef NOTHREADS
+	int i;
+	for(i = 0; i < secs*2; i++)
+    {
+		dim_usleep(500000);
+    }
+	return(0);
+#else
+	sigset_t set, oset;
+
+	sigemptyset(&set);
+	sigaddset(&set,SIGALRM);
+	sigprocmask(SIG_UNBLOCK, &set, &oset);
+	Dtq_sleeping = 1;
+	dtq_start_timer(secs, dtq_sleep_rout, (void *)123);
+    do{
+		pause();
+	}while(Dtq_sleeping);
+    sigprocmask(SIG_SETMASK,&oset,0);
+	return(0);
+#endif
+}
+
+#else
+
+unsigned int dtq_sleep(int secs)
+{
+	Dtq_sleeping = 1;
+	dtq_start_timer(secs, dtq_sleep_rout, 1);
+	do{
+		dim_wait();
+	}while(Dtq_sleeping);
+	return(0);
+}
+
+#endif
Index: /trunk/FACT++/dim_v19r15/src/examples/Copy of test_server.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/Copy of test_server.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/Copy of test_server.cxx	(revision 10183)
@@ -0,0 +1,177 @@
+#include <iostream>
+#include <dis.hxx>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+using namespace std;
+#include <string>
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		cout << severity << " " << msg << endl;
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimServer::addErrorHandler(this);}
+};
+
+class ExitHandler : public DimExitHandler
+{
+	void exitHandler(int code)
+	{
+		cout << "exit code " << code << endl;
+	}
+public:
+	ExitHandler() {DimServer::addExitHandler(this);}
+};
+
+class CmndServ : public DimCommand, public DimTimer
+{
+	DimService servstr;
+	void commandHandler()
+	{
+		int index = 0;
+		char **services;
+		cout << "Command " << getString() << " received" << endl;
+		servstr.updateService(getString()); 
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public :
+	CmndServ() : DimCommand("TEST/CMND","C"), 
+				 servstr("TEST/STRVAL","empty") {};
+};
+
+/*
+class CmndServMany : public DimCommand
+{
+	void commandHandler()
+	{
+		cout << "Command " << getString() << " received" << endl;
+	}
+public :
+	CmndServMany(char *name) : DimCommand(name,"C") {};
+};
+*/
+
+void add_serv(const int & ival)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/INTVAL_CONST",(int &)ival);
+}
+
+void add_serv_str(const string & s1)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/STRINGVAL_CONST",(char *)s1.c_str());
+}
+
+void add_serv_bool(const bool & boolval)
+{
+	DimService *serv;
+
+//	serv = new DimService("TEST/BOOLVAL_CONST",(short &)boolval);
+	serv = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1);
+}
+
+class ServWithHandler : public DimService
+{
+	int value;
+
+	void serviceHandler()
+	{
+		value++;
+//		setData(value);
+	}
+public :
+	ServWithHandler(char *name) : DimService(name, value) { value = 0;};
+};
+
+int main()
+{
+	int ival = 0;
+//	ErrorHandler errHandler;
+//	ExitHandler exHandler;
+//	DimServer::setDnsNode("axdes2.cern.ch");
+	string s1;
+	bool boolval;
+	ServWithHandler *testServ;
+	DimServerDns *newDns;
+
+	newDns = new DimServerDns("lxplus237.cern.ch", 0, "new_TEST");
+
+/*
+	int i, arr[15000];
+	DimService *servp;
+	DimCommand *cmndp;
+	char str[132];
+*/
+//	float farr[4];
+//	DimService *farrp;
+
+	s1 = "hello";
+	add_serv(ival);
+	DimService servint("TEST/INTVAL",ival);
+	DimService new_servint(newDns, "new_TEST/INTVAL",ival);
+	add_serv_str(s1);
+	boolval = 0;
+	add_serv_bool(boolval);
+	CmndServ cmdsvr;
+
+	testServ = new ServWithHandler("MY_NEW_TEST_SERVICE_WITH_HANDLER");
+
+//	farr[0] = 1.2;
+//	farr[1] = 2.3;
+//	farrp = new DimService("/PCITCO147/sensors/fan/input","F", farr, sizeof(farr));
+
+	DimServer::start("TEST");
+
+/*
+//	DimServer::autoStartOff();
+	DimServer::start("TEST");
+
+	for(i = 0; i < 15000; i++)
+	{
+		arr[i] = i;
+		sprintf(str,"ServiceManyTest/%05d",i);
+		servp = new DimService(str,arr[i]);
+		servp->setQuality(1);
+		servp->updateService(arr[i]);
+//	DimServer::start("TEST");
+		sprintf(str,"CommandManyTest/%05d",i);
+		cmndp = new CmndServMany(str);
+//	DimServer::start("TEST");
+	}
+*/
+
+	while(1)
+	{
+		sleep(5);
+		s1 = "hello1";
+		if(!boolval)
+			boolval = 1;
+		else
+			boolval = 0;
+		ival++;
+		servint.updateService();
+	}
+	return 0;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/Markus.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/Markus.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/Markus.cxx	(revision 10183)
@@ -0,0 +1,82 @@
+#include <iostream>
+#include <dic.hxx>
+using namespace std;
+
+class DnsInfo;
+
+class FloatInfo : public virtual DimInfoHandler
+{
+	DimInfo *fInfo;
+	float no_link, *data;
+	DnsInfo *m_dns;
+
+protected:
+    friend class DnsInfo;
+	void addHandler()
+	{
+		if(!fInfo)
+			fInfo = new DimInfo("SIMPLE_SERVICE", (void *)&no_link,
+				sizeof(no_link), this);
+	}
+	void removeHandler()
+	{
+		if(fInfo)
+		{
+			delete fInfo;
+			fInfo = 0;
+		}
+	}
+public :
+	FloatInfo()
+	{
+		fInfo = 0; 
+		no_link = -1;
+	};
+	void initialize();
+	void infoHandler()
+	{
+		data = (float *)getInfo()->getData();
+		cout << "Received : " << *data << endl;
+	}
+};
+
+class DnsInfo : public DimInfo
+{
+
+	char *data;
+	FloatInfo &fInfo;
+
+	void infoHandler()
+	{
+		data = getString();
+		cout << "Received : " << data << endl;
+		if(data[0] == '+')
+		{
+			fInfo.addHandler();
+		}
+		else if (data[0] == '-')
+		{
+			fInfo.removeHandler();
+		}
+	}
+public :
+	DnsInfo(FloatInfo &f) : DimInfo("DIS_DNS/SERVER_LIST","DEAD"),
+		fInfo(f) {}
+    virtual ~DnsInfo()  {}
+};
+
+void FloatInfo::initialize()
+{
+	m_dns = new DnsInfo(*this);
+}
+
+main()
+{
+	FloatInfo *fInfo;
+
+	fInfo = new FloatInfo();
+	fInfo->initialize();
+
+	while(1)
+		pause();
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/cpp_server.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/cpp_server.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/cpp_server.cxx	(revision 10183)
@@ -0,0 +1,184 @@
+#include <iostream>
+#include <dis.hxx>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+using namespace std;
+#include <string>
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		if(code){}
+		cout << severity << " " << msg << endl;
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimServer::addErrorHandler(this);}
+};
+
+class ExitHandler : public DimExitHandler
+{
+	void exitHandler(int code)
+	{
+		cout << "exit code " << code << endl;
+	}
+public:
+	ExitHandler() {DimServer::addExitHandler(this);}
+};
+
+class CmndServ : public DimCommand, public DimTimer
+{
+	DimService servstr;
+	void commandHandler()
+	{
+		int index = 0;
+		char **services;
+		cout << "Command " << getString() << " received" << endl;
+		servstr.updateService(getString()); 
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public :
+	CmndServ() : DimCommand("TEST/CMND","C"), 
+				 servstr("TEST/STRVAL","empty") {};
+};
+
+/*
+class CmndServMany : public DimCommand
+{
+	void commandHandler()
+	{
+		cout << "Command " << getString() << " received" << endl;
+	}
+public :
+	CmndServMany(char *name) : DimCommand(name,"C") {};
+};
+*/
+
+void add_serv(const int & ival)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/INTVAL_CONST",(int &)ival);
+}
+
+void add_serv_str(const string & s1)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/STRINGVAL_CONST",(char *)s1.c_str());
+}
+
+void add_serv_bool(const bool & boolval)
+{
+	DimService *serv;
+
+//	serv = new DimService("TEST/BOOLVAL_CONST",(short &)boolval);
+	serv = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1);
+}
+
+class ServWithHandler : public DimService
+{
+	int value;
+
+	void serviceHandler()
+	{
+		value++;
+//		setData(value);
+	}
+public :
+	ServWithHandler(char *name) : DimService(name, value) { value = 0;};
+};
+
+int main()
+{
+	int ival = 0;
+//	ErrorHandler errHandler;
+//	ExitHandler exHandler;
+//	DimServer::setDnsNode("axdes2.cern.ch");
+	string s1;
+	bool boolval;
+	ServWithHandler *testServ;
+	DimServerDns *newDns;
+	char *extraDns;
+
+	DimServer::start("TEST");
+	extraDns = DimUtil::getEnvVar("EXTRA_DNS_NODE");
+//	newDns = new DimServerDns(extraDns, 0, "new_TEST");
+	newDns = new DimServerDns(extraDns);
+
+/*
+	int i, arr[15000];
+	DimService *servp;
+	DimCommand *cmndp;
+	char str[132];
+*/
+//	float farr[4];
+//	DimService *farrp;
+
+	s1 = "hello";
+	add_serv(ival);
+	DimService servint("TEST/INTVAL",ival);
+	DimService new_servint(newDns, "new_TEST/INTVAL",ival);
+	DimServer::start(newDns, "new_TEST");
+
+	add_serv_str(s1);
+	boolval = 0;
+	add_serv_bool(boolval);
+	CmndServ cmdsvr;
+
+	testServ = new ServWithHandler("MY_NEW_TEST_SERVICE_WITH_HANDLER");
+
+//	farr[0] = 1.2;
+//	farr[1] = 2.3;
+//	farrp = new DimService("/PCITCO147/sensors/fan/input","F", farr, sizeof(farr));
+
+
+/*
+//	DimServer::autoStartOff();
+	DimServer::start("TEST");
+
+	for(i = 0; i < 15000; i++)
+	{
+		arr[i] = i;
+		sprintf(str,"ServiceManyTest/%05d",i);
+		servp = new DimService(str,arr[i]);
+		servp->setQuality(1);
+		servp->updateService(arr[i]);
+//	DimServer::start("TEST");
+		sprintf(str,"CommandManyTest/%05d",i);
+		cmndp = new CmndServMany(str);
+//	DimServer::start("TEST");
+	}
+*/
+
+	while(1)
+	{
+		sleep(5);
+		s1 = "hello1";
+		if(!boolval)
+			boolval = 1;
+		else
+			boolval = 0;
+		ival++;
+		servint.updateService();
+		new_servint.updateService();
+	}
+	return 0;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/db_dim_client.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/db_dim_client.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/db_dim_client.c	(revision 10183)
@@ -0,0 +1,55 @@
+// db_dim_client.c : Defines the entry point for the console application.
+//
+// Dietrich Beck
+// 
+// This is a very simple DIM service. It listens to a DIM service
+// "SERV_BY_BUFFER" via a callback routine. Each time THIS client
+// receives a service, it sends a new command to the DIM server.
+
+#include <stdio.h>
+#include <dic.h>
+
+#define BUFFSIZE 10000000
+
+int buffer[BUFFSIZE];
+int buff[BUFFSIZE];
+char message[1024];
+int no_link = -1;
+int version;
+int counter;
+int lastValue;
+int i;
+unsigned service_id;
+
+serv_received(tag,address,size)
+int *tag;
+char *address;
+int *size;
+{
+    for (i=0;i<BUFFSIZE;i++) buff[i] = buffer[i]; //copy data to do something useful
+	counter++;
+	sprintf(message, "service received %d\n", counter);
+	printf(message);
+}
+
+void main(int argc, char* argv[])
+{
+	
+	//service_id =  dic_info_service("testBuffer",MONITORED,0,0,0,serv_received,0,&no_link,4);
+//		printf("registering to service\n");
+//		counter = 0;
+//		service_id =  dic_info_service("testBuffer",MONITORED,0,0,0,serv_received,0,&no_link,4);
+	while(1)
+	{
+		printf("registering to service\n");
+		counter = 0;
+		service_id =  dic_info_service("testBuffer",MONITORED,0,0,0,serv_received,0,&no_link,4);
+		sleep(1);
+		printf("releasing service\n");
+		dic_release_service(service_id);
+		printf("released service\n");
+		sleep(1);
+		//sprintf(message, "%s", dic_get_error_services());
+	}
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/db_dim_server.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/db_dim_server.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/db_dim_server.c	(revision 10183)
@@ -0,0 +1,31 @@
+// db_dim_server.c : Defines the entry point for the console application.
+//
+// Dietrich Beck
+//
+// This is a DIM test server. It just publishes a servivce and updates
+// that service very fast.
+
+#include <stdio.h>
+#include <sys/timeb.h>
+#include <time.h>
+#include <dis.h>
+
+#define BUFFSIZE 10000000
+
+char buffer[BUFFSIZE];
+int service_id;
+int size=10000;
+int count;
+
+void main()
+{
+	service_id = dis_add_service("testBuffer","C",buffer,size,0,0);
+    dis_start_serving("DIS_TEST");
+	count = 0;
+	while(1)
+	{
+		sprintf(buffer,"%d", count);
+		dis_update_service(service_id);
+		count++;
+	}
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/demo_client.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/demo_client.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/demo_client.c	(revision 10183)
@@ -0,0 +1,34 @@
+#include <dic.h>
+
+int no_link = -1;
+
+void got_data( tag, data, size )
+int *data;
+int *tag, *size;
+{
+
+	if(*data == -1)
+		printf("Server is dead\n");
+	else
+		printf("got data: %d\n",*data);
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	char aux[80], cmnd[16];
+
+
+	sprintf(aux,"DEVICE/%s/DATA",argv[1]);
+	dic_info_service( aux, MONITORED, 0, 0, 0, got_data, 0,
+			  &no_link, 4 );
+
+	sprintf(aux,"DEVICE/%s/CMD",argv[1]);
+	while(1)
+	{
+		scanf("%s",cmnd);
+		printf("Sending Command: %s\n",cmnd);
+		dic_cmnd_service(aux,cmnd,strlen(cmnd)+1);
+	}
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/demo_server.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/demo_server.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/demo_server.c	(revision 10183)
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <dis.h>
+
+int dev_data;
+int serv_id;
+
+void do_cmnd(tag, cmnd, size)
+int *tag, *size;
+char *cmnd;
+{
+	printf("Got Command: %s\n",cmnd);
+	if(!strcmp(cmnd,"RESET"))
+		dev_data = 0;
+	if(!strcmp(cmnd,"CONFIGURE"))
+		dev_data = 1;
+	if(!strcmp(cmnd,"START"))
+		dev_data = 2;
+	if(!strcmp(cmnd,"STOP"))
+		dev_data = 1;
+	dis_update_service(serv_id);
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	char aux[80];
+
+	dev_data = 0;
+	sprintf(aux,"DEVICE/%s/DATA",argv[1]);
+	serv_id = dis_add_service(aux, "I", &dev_data, sizeof(int), 0, 0);
+
+	sprintf(aux,"DEVICE/%s/CMD",argv[1]);
+	dis_add_cmnd(aux, "C", do_cmnd, 0);
+
+	dis_start_serving( argv[1] );
+	while(1)
+		pause();
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/dim_fork.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/dim_fork.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/dim_fork.cxx	(revision 10183)
@@ -0,0 +1,93 @@
+#include <cerrno>
+#include <cstdio>
+#include <unistd.h>
+#include <sys/wait.h>
+extern "C" {
+#include "dis.hxx"
+}
+
+static int id, id_cmd, run = 0;
+static int doForkNow = 0;
+
+void handle_cmd(void *tag, void *data, int *size)
+{
+  doForkNow = 1;
+}
+
+static pid_t fork_em() {
+  //  ::dis_remove_service(id);
+  ::dis_stop_serving();
+  ::printf("Sleep a bit to see task disappear in did\n");
+  //::sleep(3);
+  pid_t pid = ::fork();
+  if ( pid == 0 ) {
+    ::dim_init();
+    ::printf("PID:%d Register Child service Child/run to DNS....\n",::getpid());
+    id = ::dis_add_service((char*)"Child/run",(char*)"I",&run,sizeof(run),0,0);
+    ::dis_start_serving((char*)"Child");
+  }
+  else if ( pid > 0 ) {
+    ::dim_init();
+    //::sleep(3);
+    ::printf("PID:%d RE-Register Parent to DNS....\n",::getpid());
+    id = ::dis_add_service((char*)"Parent/run",(char*)"I",&run,sizeof(run),0,0);
+    //    id_cmd = :: dis_add_cmnd((char *)"Parent/cmd",(char*)"C",handle_cmd,0);
+    ::dis_start_serving((char*)"Parent");
+  }      
+  else {
+    ::printf("ERROR in fork!!!!  %s\n",strerror(errno));
+    ::exit(0);
+  }
+  return pid;
+}
+
+int main(int /* argc */, char** /* argv */) {
+  id = ::dis_add_service((char*)"Parent/run",(char*)"I",&run,sizeof(run),0,0);
+  //  id_cmd = :: dis_add_cmnd((char *)"Parent/cmd",(char*)"C",handle_cmd,0);
+  ::dis_start_serving((char*)"Parent");
+  ::sleep(5);
+  pid_t child = 0;
+
+ Again:
+  child = fork_em();
+  if ( child > 0 ) {
+    int status;
+    sleep(5);
+    kill(child,SIGTERM);
+    wait(&status);
+    sleep(1);
+    goto Again;
+  }
+ 
+  while(1)
+  {
+    /*
+    if(doForkNow)
+    {
+      int status;
+      doForkNow = 0;
+      if(child > 0)
+      {
+	kill(child,SIGTERM);
+	wait(&status);
+	sleep(1);
+      }
+      child = fork_em();
+    }
+    */
+    ::sleep(1);
+  }
+  return 1;
+}
+
+
+/*
+
+g++ -o dim_fork -I../../DIM/dim -ldim -lrt -pthread ../test/dim_fork.cpp
+
+[frankm@plus04 cmt]$ ./dim_fork
+PID:20407 Register Child to DNS....
+PID 20407 - Fri Dec  3 22:01:57 2010 - (FATAL) Child: Some Services already known to DNS
+PID:20404 RE-Register Parent to DNS....
+
+*/
Index: /trunk/FACT++/dim_v19r15/src/examples/pvss_dim_client.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/pvss_dim_client.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/pvss_dim_client.cxx	(revision 10183)
@@ -0,0 +1,112 @@
+#include <dic.hxx>
+#include <iostream>
+#include <stdio.h>
+using namespace std;
+
+typedef struct{
+	int bitset;
+	char boolval;
+	int intval;
+	float floatval;
+	char stringval[128];
+}COMPLEXDATA;
+
+class SimpleService : public DimInfo
+{
+	void infoHandler()
+	{
+		cout << "SimpleService : " << getFloat() << "\n" << endl;
+	}
+public :
+	SimpleService(char *name) : DimInfo(name, -1.0) {};
+};
+
+double no_link_darray[8] = {-1.0,0,0,0,0,0,0,0};
+
+class DimDoubleArray : public DimInfo
+{
+	void infoHandler()
+	{
+		double *data;
+		int i, len;
+
+		data = (double *)getData();
+		len = getSize()/sizeof(double);
+		for(i = 0; i < len; i++)
+		{
+			cout << data[i] << endl;
+		}
+	}
+public :
+	DimDoubleArray(char *name) : DimInfo(name, no_link_darray, 8*sizeof(double)) {};
+};
+
+
+class ComplexService : public DimInfo
+{
+	void infoHandler()
+	{
+		COMPLEXDATA *data;
+		int i;
+		unsigned mask = 0x80000000;
+
+		data = (COMPLEXDATA *)getData();
+
+		cout << "ComplexService : \n";
+		cout << "\tbitset : ";
+		for(i = 0; i < 32; i++)
+		{
+			if (data->bitset & mask)
+				cout << "1";
+			else 
+				cout << "0";
+			mask >>= 1;
+		}
+		cout << "\n";
+		cout << "\tboolval : ";
+		if(data->boolval)
+				cout << "TRUE\n";
+			else 
+				cout << "FALSE\n";
+		cout << "\tintval : "<< data->intval << "\n";
+		cout << "\tfloatval : " << data->floatval << "\n";
+		cout << "\tstringval : "<< data->stringval << "\n\n";
+		cout << "Sending PVSS_SIMPLE_COMMAND : " << data->stringval << "\n" << endl;
+		DimClient::sendCommand("PVSS_SIMPLE_COMMAND",data->stringval);
+	}
+public :
+	ComplexService(char *name) : DimInfo(name, -1.0) {};
+};
+
+class RpcService : public DimRpcInfo
+{
+public:
+	void rpcInfoHandler() {
+		int value;
+		value = getInt();
+		dim_print_date_time();
+		cout << "RPC Service received: " << value << "\n" << endl;
+	}
+	RpcService(char *name, int timeout) :	DimRpcInfo(name, timeout, -1) {};
+};
+
+
+int main()
+{
+	int value = 0;
+	SimpleService simple("PVSS_SIMPLE_SERVICE");
+	ComplexService complex("PVSS_COMPLEX_SERVICE");
+	RpcService rpc("TESTRPC/INT", 25);
+	DimDoubleArray dda("TEST_SRVC");
+
+	while(1)
+	{
+		dim_print_date_time();
+		value++;
+		cout << "RPC Service sent: " << value << "\n" << endl;
+		rpc.setData(value);
+		value++;
+		sleep(30);
+	}
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/pvss_dim_server.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/pvss_dim_server.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/pvss_dim_server.cxx	(revision 10183)
@@ -0,0 +1,234 @@
+#include <dis.hxx>
+#include <iostream>
+#include <stdio.h>
+#include <time.h>
+using namespace std;
+
+typedef struct{
+	int bitset;
+	char boolval;
+	int intval;
+	float floatval;
+	char stringval[128];
+}COMPLEXDATA;
+
+typedef struct{
+	float farr[10];
+	int intval;
+	int iarr[3];
+	char str[20];
+	int intval1;
+}COMPLEXDATA1;
+
+class RecvCommand : public DimCommand
+{
+	int reset_flag;
+	void commandHandler()
+	{
+		cout << "Size: " << getSize() << endl;
+		cout << "Command " << getString() << " received" << endl;
+		reset_flag = 1;
+	}
+public :
+	RecvCommand(char *name) : DimCommand(name,"C") {reset_flag = 0;};
+	int isReset() {return reset_flag;};
+	void clearReset() {reset_flag = 0;};
+};
+
+class RecvCommandComplex : public DimCommand
+{
+	void commandHandler()
+	{
+		COMPLEXDATA *complexData;
+
+		complexData = (COMPLEXDATA *)getData();
+		cout << "Command " << complexData->intval 
+			 << " received " << complexData->stringval << endl;
+	}
+public :
+	RecvCommandComplex(char *name) : DimCommand(name,"I:1;C:1;I:1;F:1;C") {};
+};
+/*
+typedef struct{
+	char oper;
+	char data[128];
+}MEMCMND;
+
+typedef struct{
+	int code;
+	float data[128];
+}MEMDATA;
+
+DimService *TestMem[1010];
+MEMDATA TestMemData;
+
+class RecvCommandMem : public DimCommand
+{
+	int itsIndex;
+	void commandHandler()
+	{
+		MEMCMND *complexData;
+
+		complexData = (MEMCMND *)getData();
+		cout << "Command " << complexData->oper
+			 << " received " << complexData->data[0] << endl;
+		TestMemData.code = 1;
+		TestMemData.data[0] = 123;
+		TestMemData.data[1] = 456;
+		TestMem[itsIndex]->updateService();
+	}
+public :
+	RecvCommandMem(char *name, int index) : DimCommand(name,"C:1;C"),itsIndex(index) {};
+};
+*/
+
+class RpcService : public DimRpc
+{
+	int val;
+
+	void rpcHandler()
+	{
+		val = getInt();
+		val++;
+cout << "Received " << val -1 << " Answering " << val << endl;
+		setData(val);
+	}
+public:
+	RpcService(char *name): DimRpc(name,"I","I") {val = 0;};
+};
+
+int main()
+{
+	COMPLEXDATA complexData;
+	COMPLEXDATA1 cData;
+	float simpleData;
+
+	int index = 0;
+	complexData.bitset = 0x1;
+	complexData.boolval = 1;
+	complexData.intval = index;
+	complexData.floatval = (float)3.4;
+	strcpy(complexData.stringval,"IDLE");
+
+
+	cData.farr[0] = (float)1.2; 
+	cData.farr[1] = (float)2.2; 
+	cData.farr[2] = (float)3.2;
+	cData.farr[3] = 0;
+	cData.farr[4] = 0;
+	cData.farr[5] = 0;
+	cData.farr[6] = 0;
+	cData.farr[7] = 0;
+	cData.farr[8] = 0;
+	cData.farr[9] = 0;
+	cData.intval = 123;
+	cData.iarr[0] = 12; 
+	cData.iarr[1] = 13; 
+	cData.iarr[2] = 14;
+	cData.intval1 = 456;
+	strcpy(cData.str,"hello");
+
+	DimService cTestService("COMPLEX_SERVICE_TEST","F:10;I:1;I:3;C:20;I:1",
+		(void *)&cData, sizeof(cData));
+
+	DimService complexService("COMPLEX_SERVICE","I:1;C:1;I:1;F:1;C",
+		(void *)&complexData, sizeof(complexData));
+
+	simpleData = (float)1.23;
+
+	DimService simpleService("SIMPLE_SERVICE", simpleData);
+	simpleService.setQuality(1);
+
+	RecvCommand recvCommand("SIMPLE_COMMAND");
+	RecvCommandComplex recvCommandComplex("COMPLEX_COMMAND");
+/*
+	{
+	char tstr[128];
+	int i;
+	RecvCommandMem *rmem;
+//	TestMem = new DimService("TEST_MEM", "I:1;F", (void *)&TestMemData, sizeof(TestMemData)); 
+//	RecvCommandMem recvCommandMem("TEST_MEM_CMND");
+
+	for(i = 1; i <= 1000; i++)
+	{
+		sprintf(tstr,"TEST_MEM%04d",i);
+		TestMem[i] = new DimService(tstr, "I:1;F", (void *)&TestMemData, sizeof(TestMemData)); 
+		sprintf(tstr,"TEST_MEM_CMND%04d",i);
+		rmem = new RecvCommandMem(tstr, i);
+	}
+	}
+*/
+	RpcService rpc("RPC");
+
+	DimServer::start("PVSS_DIM_TEST");
+
+	while(1)
+	{
+		sleep(5);
+		
+		if( recvCommand.isReset() )
+		{
+			
+			index = 0;
+			complexData.bitset = 0x1;
+			complexData.boolval = 1;
+			complexData.intval = index;
+			complexData.floatval = (float)3.4;
+			strcpy(complexData.stringval,"IDLE");
+			simpleData = (float)1.23;
+			recvCommand.clearReset();
+		}
+		else
+		{
+			index++;
+			complexData.bitset <<= 1;
+			complexData.boolval = index;
+			complexData.intval = index;
+			complexData.floatval = index * (float)1.1;
+			sprintf(complexData.stringval,"State %d", index);
+			simpleData += (float)1.1;
+		}
+		
+		complexService.updateService();
+
+//		simpleService.setQuality(complexData.bitset);
+/*
+		{
+			int secs;
+			time_t tsecs;
+
+			tsecs = time((time_t)NULL);
+			secs = (int)tsecs;
+			secs -=60;
+			simpleService.setTimestamp(secs, 123);
+			simpleService.setQuality(index);
+			tsecs = (time_t)secs;
+			cout << "quality "<< index << " time "<< ctime(&tsecs) << endl;
+		}
+*/
+		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+//		simpleData += (float)1;
+//		simpleService.updateService();
+
+		if(strlen(cData.str) < 16)
+			strcat(cData.str," abc");
+		cTestService.updateService();
+	}
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/rpc_client.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/rpc_client.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/rpc_client.cxx	(revision 10183)
@@ -0,0 +1,124 @@
+#include <dic.hxx>
+#include <iostream>
+using namespace std;
+
+class Rpc : public DimRpcInfo
+{
+public:
+	void rpcInfoHandler() {
+		dim_print_date_time();
+		cout << "Callback RPC Received : " << getInt() << endl;
+	}
+	Rpc(char *name) :	DimRpcInfo(name, 1, -1) {};
+};
+
+typedef struct tst{
+	char str1[16];
+	int ints[5];
+	char str2[18];
+	float floats[4];
+	int int1;
+	float floats1[16];
+} MyStruct;
+
+class RpcStruct : public DimRpcInfo
+{
+public:
+	void rpcInfoHandler() {
+		MyStruct *val;
+		val = (MyStruct *)getData();
+		cout << "Callback RPC Received : " << endl;
+		cout << val->str1 << " " << val->str2 << " " << val->int1 << endl;
+	}
+	RpcStruct(char *name) :	DimRpcInfo(name, "dead") {};
+};
+
+void do_work(void *tag)
+{
+	DimRpcInfo *myRpc;
+//	Rpc *myRpc;
+	char name[64];
+	int out, in;
+	
+	sprintf(name,"TESTRPC%d/INT",(long)tag);
+	myRpc = new DimRpcInfo(name, 10, -1);
+//	myRpc = new Rpc(name);
+
+	out = 1;
+	while(1)
+	{
+		sleep(5);
+//		cout << "RPC Sent : " << out << endl;
+		myRpc->setData(out);
+		in = myRpc->getInt();
+dim_lock();
+dim_print_date_time();
+cout << "Instance "<<(long)tag<<" sent "<<out<< " got "<<in <<endl;
+dim_unlock();
+		out++;
+	}
+}
+
+void do_workCB()
+{
+//	DimRpcInfo *myRpc;
+	Rpc *myRpc;
+	char name[64];
+	int out, in;
+	
+	sprintf(name,"TESTRPC/INT");
+	myRpc = new Rpc(name);
+//	myRpc = new Rpc(name);
+
+	out = 1;
+	while(1)
+	{
+		dim_print_date_time();
+		cout << "RPC Sent : " << out << endl;
+		myRpc->setData(out);
+		out++;
+		sleep(5);
+	}
+}
+
+int main()
+{
+	int i;
+
+	dim_init();
+	DimClient::setNoDataCopy();
+
+	for(i = 0; i < 10; i++)
+	{
+		dim_start_thread(do_work,(void *)i);
+	}
+//	do_workCB();
+	while(1)
+		pause();
+	/*
+	int rpcValue = 0;
+//	DimRpcInfo rpc("TESTRPC/INT",-1);
+	Rpc rpcCB("TESTRPC/INT");
+	RpcStruct rpcStruct("TESTRPC/STRUCT");
+	MyStruct myStruct;
+
+	strcpy(myStruct.str1,"hello");
+	strcpy(myStruct.str2,"world");
+	myStruct.int1 = 1;
+	while(1)
+	{
+		dim_print_date_time();
+		cout << "Sending " << rpcValue << endl; 
+		rpcCB.setData(rpcValue);
+		rpcValue++;
+//		sleep(5);
+		rpcStruct.setData(&myStruct, sizeof(myStruct));
+		myStruct.int1++;
+//		rpc.setData(rpcValue);
+//		rpcValue = rpc.getInt();
+//		cout << "RPC Received : " << rpcValue << endl;
+		sleep(10);
+	}
+	return 0;
+	*/
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/rpc_server.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/rpc_server.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/rpc_server.cxx	(revision 10183)
@@ -0,0 +1,99 @@
+#include <dis.hxx>
+#include <dic.hxx>
+#include <iostream>
+using namespace std;
+
+class RpcInt : public DimRpc
+{
+	int val;
+
+	void rpcHandler()
+	{
+		val = getInt();
+		dim_print_date_time();
+		printf("Got RPC %d\n", val);
+		val++;
+//		usleep(700000);
+		dim_print_date_time();
+		printf("Answering RPC %d\n", val);
+		setData(val);
+	}
+public:
+	RpcInt(char *name): DimRpc(name,"I","I") {val = 0;};
+};
+
+typedef struct tst{
+	char str1[16];
+	int ints[5];
+	char str2[18];
+	float floats[4];
+	int int1;
+	float floats1[16];
+} MyStruct;
+
+typedef struct jeffIn{
+	char c1;
+	char c2;
+	char c3;
+	char str[3000];
+}JeffIn;
+
+typedef struct jeffOut{
+	int i1;
+	char c1;
+	char str[3000];
+}JeffOut;
+
+class RpcStruct : public DimRpc
+{
+	MyStruct *val;
+
+	void rpcHandler()
+	{
+		val = (MyStruct *)getData();
+		val->int1++;
+		setData(val, sizeof(MyStruct));
+	}
+public:
+	RpcStruct(char *name): DimRpc(name,"C:16;I:5;C:18;F:4;I:1;F:16",
+		"C:16;I:5;C:18;F:4;I:1;F:16") {val = 0;};
+};
+
+class JeffRpcStruct : public DimRpc
+{
+	JeffIn *pin;
+	JeffOut pout;
+	int counter;
+
+	void rpcHandler()
+	{
+		pin = (JeffIn *)getData();
+		pout.i1 = counter++;
+		pout.c1 = pin->c1;
+		strcpy(pout.str,pin->str);
+		setData(&pout, strlen(pout.str)+1+5);
+	}
+public:
+	JeffRpcStruct(char *name): DimRpc(name,"C:1;C:1;C:1;C",
+		"I:1;C:1;C") {counter = 0;};
+};
+
+int main()
+{
+	RpcInt myRpcInt("TESTRPC/INT");
+	RpcInt *myRpcP;
+	RpcStruct myRpcStruct("TESTRPC/STRUCT");
+	JeffRpcStruct jeffRpcStruct("TESTJEFF");
+	int i;
+	char name[64];
+
+	for(i = 0; i < 10; i++)
+	{
+		sprintf(name,"TESTRPC%d/INT",i);
+		myRpcP = new RpcInt(name);
+	}
+	DimServer::start("TESTRPC");
+	while(1)
+		pause();
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/rshServer.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/rshServer.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/rshServer.cxx	(revision 10183)
@@ -0,0 +1,176 @@
+#include <dis.hxx>
+#include <sys/stat.h>
+#include <sys/types.h>
+#ifndef WIN32
+#include <sys/wait.h>
+#include <unistd.h>
+#else
+#include <process.h>
+#endif
+#include <ctype.h>
+
+#ifndef WIN32
+char outfile[] = "/tmp/dim_rsh_server.dat";
+#else
+char outfile[] = "c:\\dim_rch_server.dat";
+#endif
+
+int my_system(char *);
+
+class Cmd: public DimCommand
+{
+	char *result;
+	DimService *resultSrvc;
+
+	void commandHandler();
+public:
+	Cmd(char *cmdName, char *resultName): DimCommand(cmdName, "C") 
+	{
+		result = new char[10];
+		strcpy(result,"empty");
+		resultSrvc = new DimService(resultName, "C", result, strlen(result)+1);
+	};
+};
+
+void Cmd::commandHandler()
+{
+	char *str, *client;
+	char commandString[256];
+	struct stat buf;
+	FILE *fd;
+	int ret, size, index, sz;
+
+	str = getString();
+
+	client = DimServer::getClientName();
+
+	cout << "Received " << str << " from " << client << endl;
+	unlink(outfile);
+	strcpy(commandString,str);
+#ifndef WIN32
+	strcat(commandString," >& ");
+	strcat(commandString,outfile);
+	strcat(commandString,"< /dev/null");
+#else
+	strcat(commandString," > ");
+	strcat(commandString,outfile);
+	strcat(commandString," 2>&1 ");
+#endif
+	my_system(commandString);
+
+	delete result;
+	ret = stat(outfile, &buf);
+	if(ret == -1)
+    {
+		result = new char[20];
+		strcpy(result,"File does not exist");
+    }
+	else
+    {
+		size = buf.st_size;
+		result = new char[size +1];
+		fd = fopen(outfile, "r");
+		index = 0;
+		while(!feof(fd) && size)
+		{
+			sz = fread(&result[index], 1, 512, fd);
+			size -= sz;
+			index += sz;
+			if(!sz)
+			break;
+		}
+		fclose(fd);
+		result[index] = '\0';
+	}
+	resultSrvc->updateService(result, strlen(result)+1);
+}
+
+#ifndef WIN32
+
+extern char **environ;
+
+int my_system (char *command)
+{
+    int pid, status, ret, n = 0;
+
+    if (command == 0)
+        return 1;
+    pid = fork();
+    if (pid == -1)
+        return -1;
+    if (pid == 0) {
+        char *argv[4];
+        argv[0] = "sh";
+        argv[1] = "-c";
+        argv[2] = command;
+        argv[3] = 0;
+        execve("/bin/sh", argv, environ);
+        exit(127);
+    }
+    do {
+      ret = waitpid(pid, &status,WNOHANG);
+      if(ret == -1)
+	break;
+      usleep(100000);
+      n++;
+    } while(n < 1200);
+    return status;
+}
+
+#else
+int my_system (char *command)
+{
+	return system(command);
+}
+
+#endif
+
+#ifdef WIN32
+int init_sock()
+{
+	WORD wVersionRequested;
+	WSADATA wsaData;
+	int err;
+	static int sock_init_done = 0;
+
+	if(sock_init_done) return(1);
+ 	wVersionRequested = MAKEWORD( 2, 0 );
+	err = WSAStartup( wVersionRequested, &wsaData );
+
+	if ( err != 0 ) {
+    	return(0);
+	}
+
+	if ( LOBYTE( wsaData.wVersion ) != 2 ||
+        HIBYTE( wsaData.wVersion ) != 0 ) {
+
+	    WSACleanup( );
+    	return(0); 
+	}
+	sock_init_done = 1;
+	return(1);
+}
+#endif
+
+void main(int argc, char **argv)
+{
+	char host[64], cmd_name[128], result_name[128];
+	Cmd *cmd;
+
+#ifdef WIN32
+	init_sock();
+#endif
+	gethostname(host, 64);
+
+//Setup command reception and result publishing
+	sprintf(cmd_name,"%s/ExecuteCmd",host);
+	sprintf(result_name,"%s/CmdResult", host);
+	cmd = new Cmd(cmd_name, result_name);
+
+	sprintf(cmd_name,"%s_server",host);
+	DimServer::start(cmd_name);
+	while(1)
+    {
+		pause();
+    }
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_Browser.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_Browser.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_Browser.cxx	(revision 10183)
@@ -0,0 +1,193 @@
+#include <iostream>
+#include <dic.hxx>
+using namespace std;
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		cout << severity << " " << msg << endl;
+		services = DimClient::getServerServices();
+		cout<< "from "<< DimClient::getServerName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimClient::addErrorHandler(this);}
+};
+
+class StrService : public DimInfo
+{
+
+	void infoHandler()
+	{
+		int index = 0;
+		char **services;
+//		cout << "Dns Node = " << DimClient::getDnsNode() << endl;
+		cout << "Received STRVAL : " << getString() << endl;
+		services = DimClient::getServerServices();
+		cout<< "from "<< DimClient::getServerName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public :
+	StrService() : DimInfo("TEST/STRVAL","not available") {};
+};
+
+
+void **AllServices;
+int *AllServiceStates;
+int NServices;
+int NBytes;
+
+class MyTimer: public DimTimer
+{
+  void timerHandler()
+    {
+      int i;
+      int missing = 0;
+      for(i = 0; i < NServices; i++)
+      {
+	if(AllServiceStates[i] == -2)
+	  {
+	    missing++;
+	  }
+      }
+      dim_print_date_time();
+      printf("Missing %d, NBytes = %d\n", missing, NBytes);
+      if(missing)
+	start(1);
+    }
+ public:
+  MyTimer(): DimTimer(2){};
+};
+
+class TestGetService: public DimInfo
+{
+  void infoHandler()
+  {
+    int i, index, size, done = 1;
+    char *dataptr;
+    
+    size = getSize();
+    NBytes += size;
+    dataptr = new char[size];
+    memcpy(dataptr, getData(), size);
+    for(i = 0; i < NServices; i++)
+      {
+	if(AllServices[i] == this)
+	  {
+	    index = i;
+	    break;
+	  }
+      }
+    AllServiceStates[index] = getInt();
+    //    printf("Got %s, %d, %d\n", getName(), index, AllServiceStates[index]);
+    for(i = 0; i < NServices; i++)
+      {
+	if(AllServiceStates[i] == -2)
+	  {
+	    done = 0;
+	    break;
+	  }
+      }
+    if(done)
+      {
+	dim_print_date_time();
+	printf("All Services Received\n");
+      }
+  }
+public :
+  TestGetService(char *name): DimInfo(name, -1){};
+};
+
+
+int main(int argc, char **argv)
+{
+		
+	ErrorHandler errHandler;
+//	StrService servstr;
+	char *server, *ptr, *ptr1;
+	DimBrowser br;
+	int type, n, index, i, ret;
+	MyTimer *myTimer;
+	char findStr[132];
+
+	ret = 0;
+	strcpy(findStr,"*");
+	if(argc > 1)
+	{
+		if(!strcmp(argv[1],"-f"))
+		{
+		  if(argc > 2)
+		    strcpy(findStr,argv[2]);
+		  else 
+		    ret = 1;
+		}
+		else
+		  ret = 1;
+		if(ret)
+		{
+			printf("Parameters: [-f <search string>]\n");
+			exit(0);
+		}
+	}
+//	DimClient::addErrorHandler(errHandler);
+dim_print_date_time();
+printf("Asking %s\n", findStr);
+        n = br.getServices(findStr);
+dim_print_date_time();
+	cout << "found " << n << " services" << endl; 
+	
+	AllServices = (void **) new TestGetService*[n];
+	AllServiceStates = new int[n];
+	NServices = n;
+	NBytes = 0;
+	index = 0;
+	for(i = 0; i < n; i++)
+	  AllServiceStates[i] = 0;
+	while((type = br.getNextService(ptr, ptr1))!= 0)
+	{
+	  
+	  //		cout << "type = " << type << " - " << ptr << " " << ptr1 << endl;
+	  AllServiceStates[index] = -2;
+	  AllServices[index] = new TestGetService(ptr);
+	  index++;
+	  //	  if(index >= 1000)
+	  //	    break;
+	}
+	myTimer = new MyTimer();
+	dim_print_date_time();
+	printf("Got Service Names\n");
+	/*
+	br.getServers();
+	while(br.getNextServer(server, ptr1))
+	{
+		cout << server << " @ " << ptr1 << endl;
+	}
+
+	br.getServerClients("DIS_DNS");
+	while(br.getNextServerClient(ptr, ptr1))
+	{
+		cout << ptr << " @ " << ptr1 << endl;
+	}
+	DimInfo servint("TEST/INTVAL",-1); 
+	*/
+	while(1)
+	{
+		sleep(10);
+		/*
+		cout << "Current INTVAL : " << servint.getInt() << endl;
+		DimClient::sendCommand("TEST/CMND","UPDATE_STRVAL");
+		*/
+	}
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_big_client.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_big_client.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_big_client.c	(revision 10183)
@@ -0,0 +1,91 @@
+#include <dic.h>
+
+#define MAX_SERVICES 40000
+/*
+int Data[MAX_SERVICES];
+int Recvd[MAX_SERVICES];
+*/
+int no_link = -1;
+
+void rout(tag, buff, size)
+int *tag, *size;
+int *buff;     
+{
+static int bad = 0;
+int i;
+static int n_recvd = 0;
+
+	if(!bad)
+	{
+		if (*buff == no_link)
+		{
+/*
+			for(i = 0; i < MAX_SERVICES; i++)
+				Recvd[i] = 0;
+*/
+			bad = 1;
+			n_recvd = 0;
+		}
+	}
+	if(bad)
+	{
+		if (*buff != no_link)
+		{
+/*
+			for(i = 0; i < MAX_SERVICES; i++)
+				Recvd[i] = 0;
+*/
+			bad = 0;
+			n_recvd = 0;
+		}
+	}
+/*
+	if(bad)
+	{
+		Recvd[*tag] = *buff;
+	}
+	else
+	{
+		Recvd[*tag] = (*buff)+1;
+	}
+*/
+	n_recvd++;
+/*
+	for(i = 0; i <= MAX_SERVICES; i++)
+	{
+		if(Recvd[i] != 0)
+			n_recvd++;
+	}
+*/
+/*
+  if(!((*tag) % 1000))
+*/
+
+	if(!(n_recvd % 1000))
+		printf("Received n = %d, %d = %d\n",n_recvd, *tag, *buff);
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i;
+	char name[64];
+	int id = 123;
+
+	dic_set_dns_node("lxplus050.cern.ch");
+
+/*	
+	dic_set_debug_on();
+*/	
+	for(i = 0; i< MAX_SERVICES; i++)
+	{
+		sprintf(name,"%s/Service_%d",argv[2],i);
+		dic_info_service( name, TIMED, 0, 0, 0,
+				  rout, i,&no_link, sizeof(no_link) );
+	}
+	while(1)
+	  {
+	    pause();
+	  }
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_big_server.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_big_server.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_big_server.c	(revision 10183)
@@ -0,0 +1,29 @@
+#include <dis.h>
+
+#define MAX_SERVICES 40000
+int Data[MAX_SERVICES];
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i;
+	char name[64];
+	int ids[MAX_SERVICES];
+/*
+	dic_set_dns_node("lxplus059.cern.ch");
+*/
+  for(i = 0; i< MAX_SERVICES; i++)
+	{
+	  Data[i] = i;
+	  sprintf(name,"%s/Service_%d",argv[1],i);
+	  ids[i] = dis_add_service( name, "I", &Data[i], 
+			sizeof(Data[i]), (void *)0, 0 );
+	}
+	dis_start_serving( argv[1] );
+	while(1)
+	  pause();
+}
+
+
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_client.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_client.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_client.c	(revision 10183)
@@ -0,0 +1,142 @@
+
+#include <dic.h>
+#include <time.h>
+#include <string.h>
+#include <stdio.h>
+
+char str[80];
+char str_res[10][80];
+char client_str[80];
+int no_link = -1;
+float no_link_float = -1.0;
+char buff[80];
+
+typedef struct {
+	int i;
+	int j;
+	int k;
+	double d;
+	short s;
+    char c;
+	short t;
+	float f;
+	char str[20];
+}TT;
+
+TT t;
+/*
+void big_rout( tag, buf, size )
+int *buf;
+int *tag, *size;
+{
+
+	printf("Received %d for TestMem\n", *buf);
+}
+*/
+
+void got_servers( int *tag, char *list, int *size)
+{
+	if(tag){}
+	if(size){}
+	printf("%s",list);
+}
+
+void got_services( int *tag, char *list, int *size)
+{
+	if(tag){}
+	if(size){}
+	printf("%s",list);
+}
+
+void rout( tag, buf, size )
+char *buf;
+int *tag, *size;
+{
+
+	if(*tag == 1100)
+	{
+		printf("Received ONCE_ONLY : %s\n",buff);
+		return;
+	}
+	if(*tag == 1200)
+	{
+		char node[128], str[256];
+		int secs, millis;
+		time_t tsecs;
+
+		dic_get_dns_node(node);
+		printf("DNS node = %s\n",node);
+		printf("size = %d\n",*size);
+		memcpy(&t, buf, *size);
+		printf("t.i = %d, t.d = %2.2f, t.s = %d, t.c = %c, t.f = %2.2f, t.str = %s\n",
+			t.i,t.d,t.s,t.c,t.f,t.str);
+		dic_get_timestamp(0, &secs, &millis);
+		tsecs = secs;
+		my_ctime(&tsecs, str, 128);
+		str[strlen(str)-1] = '\0';
+		printf("timestamp = %s.%d\n",str,millis);
+
+		return;
+	}
+	else
+		printf("%s Received %s for Service%03d\n",client_str,buf, *tag);
+
+/*
+	if(conn_id = dic_get_server(server))
+		printf("received from %d, %s\n",conn_id, server);
+*/
+
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+	char aux[80];
+	int id = 123;
+
+/*
+	dic_set_debug_on();
+*/
+/*
+	dic_set_dns_node("pclhcb99.cern.ch");
+*/
+	if(argc){}
+	sprintf(str,"%s/SET_EXIT_HANDLER",argv[2]);
+	dic_cmnd_service(str, &id, 4);
+	dic_get_id(aux);
+	printf("%s\n",aux);
+	strcpy(client_str,argv[1]);
+
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(str,"%s/Service_%03d",argv[2],i);
+		dic_info_service( str, TIMED, 10, 0, 0, rout, i,
+			  "No Link", 8 );
+	}
+	
+	sprintf(aux,"%s/TEST_SWAP",argv[2]);
+	dic_info_service_stamped( aux, TIMED, 5, 0, 0, rout, 1200,
+			  &no_link, 4 );
+
+/*	
+	sprintf(aux,"%s/TestMem",argv[2]);
+	dic_info_service( aux, MONITORED, 0, 0, 0, big_rout, 0,
+			  &no_link, 4 );
+*/
+
+	sprintf(aux,"%s/TEST_CMD",argv[2]);
+/*
+	dic_info_service("DIS_DNS/SERVER_LIST",MONITORED, 0, 0, 0, got_servers, 0,
+		"not there", 10);
+	dic_info_service("xx/SERVICE_LIST",MONITORED, 0, 0, 0, got_services, 0,
+		"not there", 10);
+*/
+	while(1)
+	{
+		sleep(10);
+
+		printf("Sending Command, size = %d, i = %d\n",(int)sizeof(t), t.i);
+		dic_cmnd_service(aux,&t,(int)sizeof(t));
+	}
+	return 1;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_client.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_client.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_client.cxx	(revision 10183)
@@ -0,0 +1,87 @@
+#include <iostream>
+#include <dic.hxx>
+using namespace std;
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		if(code){}
+		cout << severity << " " << msg << endl;
+		services = DimClient::getServerServices();
+		cout<< "from "<< DimClient::getServerName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimClient::addErrorHandler(this);}
+};
+
+class StrService : public DimInfo
+{
+
+	void infoHandler()
+	{
+		int index = 0;
+		char **services;
+//		cout << "Dns Node = " << DimClient::getDnsNode() << endl;
+		cout << "Received STRVAL : " << getString() << endl;
+		services = DimClient::getServerServices();
+		cout<< "from "<< DimClient::getServerName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public :
+	StrService() : DimInfo("TEST/STRVAL","not available") {};
+};
+
+int main()
+{
+		
+	ErrorHandler errHandler;
+	StrService servstr;
+	char *server, *ptr, *ptr1;
+	DimBrowser br;
+	int type, n, pid;
+
+//	DimClient::addErrorHandler(errHandler);
+	
+	n = br.getServices("*");
+	cout << "found " << n << " services" << endl; 
+	
+	while((type = br.getNextService(ptr, ptr1))!= 0)
+	{
+		cout << "type = " << type << " - " << ptr << " " << ptr1 << endl;
+	}
+	
+	br.getServers();
+	while(br.getNextServer(server, ptr1, pid))
+	{
+		cout << server << " @ " << ptr1 << ", pid = " << pid << endl;
+	}
+
+	br.getServerClients("DIS_DNS");
+	while(br.getNextServerClient(ptr, ptr1))
+	{
+		cout << ptr << " @ " << ptr1 << endl;
+	}
+
+	DimInfo servint("TEST/INTVAL",-1); 
+	
+	while(1)
+	{
+		sleep(10);
+		
+		cout << "Current INTVAL : " << servint.getInt() << endl;
+		DimClient::sendCommand("TEST/CMND","UPDATE_STRVAL");
+	}
+	return 0;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_client1.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_client1.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_client1.c	(revision 10183)
@@ -0,0 +1,43 @@
+#include <dic.h>
+#include <time.h>
+#include <string.h>
+#include <stdio.h>
+
+int Data[4000];
+int no_link = -1;
+
+void rout( tag, buf, size )
+int *buf;
+int *tag, *size;
+{
+
+	printf("Received beam%d Data : %d\n",*tag, buf[0]);
+}
+
+int main(int argc, char **argv)
+{
+	int i;
+	char aux[80];
+	int id = 123;
+
+	dic_info_service( "Beam1/Data", MONITORED, 0, 0, 0, rout, 1,
+			  &no_link, 4 );
+	dic_info_service( "Beam1/Data", MONITORED, 0, 0, 0, rout, 1,
+			  &no_link, 4 );
+	dic_info_service( "Beam1/Data", MONITORED, 0, 0, 0, rout, 1,
+			  &no_link, 4 );
+	dic_info_service( "Beam2/Data", MONITORED, 0, 0, 0, rout, 2,
+			  &no_link, 4 );
+	dic_info_service( "Beam2/Data", MONITORED, 0, 0, 0, rout, 2,
+			  &no_link, 4 );
+	dic_info_service( "Beam2/Data", MONITORED, 0, 0, 0, rout, 2,
+			  &no_link, 4 );
+	
+	while(1)
+	{
+		usleep(1000);
+		dic_cmnd_service("Beam1/Cmd","Update",7);
+		dic_cmnd_service("Beam2/Cmd","Update",7);
+	}
+	return 1;
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_client_ccpc.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_client_ccpc.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_client_ccpc.c	(revision 10183)
@@ -0,0 +1,58 @@
+#include <dic.h>
+
+int no_link = -1;
+int RegisterSet;
+int RegisterValue;
+
+void register_callback( tag, data, size )
+int *tag, *data, *size;
+{
+	RegisterValue = *data;
+	RegisterSet = *tag;
+/* In linux this is not necessary */
+#ifdef WIN32
+	dim_wake_up();
+#endif
+}
+
+int set_register_wait(index, value)
+int index, value;
+{
+	int pars[2];
+		
+	pars[0] = index;
+	pars[1] = value;
+	RegisterSet = -1;
+	dic_cmnd_service("SET_REGISTER",pars,sizeof(pars));
+	while(RegisterSet == -1)
+	{
+		dim_wait();
+	}
+	if(RegisterSet == index)
+		return(RegisterValue);
+	return(-1);
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i, index = 0, value;
+	char aux[80];
+
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(aux,"Register%03d",i);
+		dic_info_service( aux, MONIT_ONLY, 0, 0, 0, 
+			register_callback, i, &no_link, sizeof(int) );
+	}
+
+	while(1)
+	{
+		value = set_register_wait(index%10, index);
+		printf("Register %d: wrote %d, readback = %d\n", 
+			index%10, index, value);
+		index ++;
+		sleep(1);
+	}
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_client_many.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_client_many.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_client_many.c	(revision 10183)
@@ -0,0 +1,142 @@
+
+#include <dic.h>
+#include <time.h>
+
+char str[80];
+char str_res[10][80];
+char client_str[80];
+int no_link = -1;
+float no_link_float = -1.0;
+char buff[80];
+
+typedef struct {
+	int i;
+	int j;
+	int k;
+	double d;
+	short s;
+    char c;
+	short t;
+	float f;
+	char str[20];
+}TT;
+
+TT t;
+/*
+void big_rout( tag, buf, size )
+int *buf;
+int *tag, *size;
+{
+
+	printf("Received %d for TestMem\n", *buf);
+}
+*/
+void rout_many( tag, buf, size )
+float *buf;
+int *tag, *size;
+{
+	if(*tag == 50000)
+	{
+		dim_print_date_time();
+		printf("Received %f for service %d\n", *buf, *tag);
+	}
+}
+
+void rout( tag, buf, size )
+char *buf;
+int *tag, *size;
+{
+	int conn_id;
+	char server[128];
+
+	if(*tag == 1100)
+	{
+		printf("Received ONCE_ONLY : %s\n",buff);
+		return;
+	}
+	if(*tag == 1200)
+	{
+		char node[128], str[256];
+		int secs, millis;
+		time_t tsecs;
+
+		dic_get_dns_node(node);
+		printf("DNS node = %s\n",node);
+		printf("size = %d\n",*size);
+		memcpy(&t, buf, *size);
+		printf("t.i = %d, t.d = %2.2f, t.s = %d, t.c = %c, t.f = %2.2f, t.str = %s\n",
+			t.i,t.d,t.s,t.c,t.f,t.str);
+		dic_get_timestamp(0, &secs, &millis);
+		tsecs = secs;
+		my_ctime(&tsecs, str, 128);
+		str[strlen(str)-1] = '\0';
+		printf("timestamp = %s.%d\n",str,millis);
+
+		return;
+	}
+	else
+		printf("%s Received %s for Service%03d\n",client_str,buf, *tag);
+
+/*
+	if(conn_id = dic_get_server(server))
+		printf("received from %d, %s\n",conn_id, server);
+*/
+
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i, *ptr;
+	char aux[80];
+	int id = 123;
+
+/*
+	dic_set_debug_on();
+*/
+/*
+	dic_set_dns_node("pclhcb99.cern.ch");
+*/
+
+	sprintf(str,"%s/SET_EXIT_HANDLER",argv[2]);
+	dic_cmnd_service(str, &id, 4);
+	dic_get_id(aux);
+	printf("%s\n",aux);
+	strcpy(client_str,argv[1]);
+/*
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(str,"%s/Service_%03d",argv[2],i);
+		dic_info_service( str, TIMED, 10, 0, 0, rout, i,
+			  "No Link", 8 );
+	}
+	
+	sprintf(aux,"%s/TEST_SWAP",argv[2]);
+	dic_info_service_stamped( aux, TIMED, 5, 0, 0, rout, 1200,
+			  &no_link, 4 );
+*/
+/*	
+	sprintf(aux,"%s/TestMem",argv[2]);
+	dic_info_service( aux, MONITORED, 0, 0, 0, big_rout, 0,
+			  &no_link, 4 );
+*/
+
+	for(i = 0; i< 100000; i++)
+	{
+		sprintf(aux,"%s/ServiceMany%05d",argv[2],i);
+		dic_info_service( aux, MONITORED, 60, 0, 0, rout_many, i,
+			  &no_link_float, 4 );
+	}
+
+	sprintf(aux,"%s/TEST_CMD",argv[2]);
+	while(1)
+	{
+		int index = 0;
+		sleep(10);
+/*
+		printf("Sending Command, size = %d, i = %d\n",sizeof(t), t.i);
+		dic_cmnd_service(aux,&t,sizeof(t));
+*/
+	}
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_client_slac.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_client_slac.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_client_slac.c	(revision 10183)
@@ -0,0 +1,32 @@
+#include <dic.h>
+#include <dis.h>
+#include <time.h>
+
+void rout( tag, buf, size )
+char *buf;
+int *tag, *size;
+{
+	printf("%s Received for Server %d\n", buf, *tag);
+}
+
+main()
+{
+	char str[80], aux[80];
+	int i;
+
+	for(i = 0; i< 20; i++)
+	{
+		sprintf(str,"TEST_SLAC/SRV%d",i);
+		dic_info_service( str, TIMED, 60, 0, 0, rout, i,
+			  "No Link", 8 );
+	}
+	for(i = 0; i< 20; i++)
+	{
+		sprintf(aux,"TEST_SLAC/CLT%d",i);
+		dis_add_service(aux, "C", aux, strlen(aux)+1, (void *)0, 0);
+	}
+	sprintf(aux,"TEST_SLAC/CLT");
+	dis_start_serving(aux);
+	while(1)
+		pause();
+}
Index: /trunk/FACT++/dim_v19r15/src/examples/test_serve.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_serve.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_serve.cxx	(revision 10183)
@@ -0,0 +1,172 @@
+#include <iostream>
+#include <dis.hxx>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+using namespace std;
+#include <string>
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		cout << severity << " " << msg << endl;
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimServer::addErrorHandler(this);}
+};
+
+class ExitHandler : public DimExitHandler
+{
+	void exitHandler(int code)
+	{
+		cout << "exit code " << code << endl;
+	}
+public:
+	ExitHandler() {DimServer::addExitHandler(this);}
+};
+
+class CmndServ : public DimCommand, public DimTimer
+{
+	DimService servstr;
+	void commandHandler()
+	{
+		int index = 0;
+		char **services;
+		cout << "Command " << getString() << " received" << endl;
+		servstr.updateService(getString()); 
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public :
+	CmndServ() : DimCommand("TEST/CMND","C"), 
+				 servstr("TEST/STRVAL","empty") {};
+};
+
+/*
+class CmndServMany : public DimCommand
+{
+	void commandHandler()
+	{
+		cout << "Command " << getString() << " received" << endl;
+	}
+public :
+	CmndServMany(char *name) : DimCommand(name,"C") {};
+};
+*/
+
+void add_serv(const int & ival)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/INTVAL_CONST",(int &)ival);
+}
+
+void add_serv_str(const string & s1)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/STRINGVAL_CONST",(char *)s1.c_str());
+}
+
+void add_serv_bool(const bool & boolval)
+{
+	DimService *serv;
+
+//	serv = new DimService("TEST/BOOLVAL_CONST",(short &)boolval);
+	serv = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1);
+}
+
+class ServWithHandler : public DimService
+{
+	int value;
+
+	void serviceHandler()
+	{
+		value++;
+//		setData(value);
+	}
+public :
+	ServWithHandler(char *name) : DimService(name, value) { value = 0;};
+};
+
+int main()
+{
+	int ival = 0;
+//	ErrorHandler errHandler;
+//	ExitHandler exHandler;
+//	DimServer::setDnsNode("axdes2.cern.ch");
+	string s1;
+	bool boolval;
+	ServWithHandler *testServ;
+
+/*
+	int i, arr[15000];
+	DimService *servp;
+	DimCommand *cmndp;
+	char str[132];
+*/
+	float farr[4];
+	DimService *farrp;
+
+	s1 = "hello";
+	add_serv(ival);
+	DimService servint("TEST/INTVAL",ival);
+	add_serv_str(s1);
+	boolval = 0;
+	add_serv_bool(boolval);
+	CmndServ cmdsvr;
+
+	testServ = new ServWithHandler("MY_NEW_TEST_SERVICE_WITH_HANDLER");
+
+	farr[0] = 1.2;
+	farr[1] = 2.3;
+	farrp = new DimService("/PCITCO147/sensors/fan/input","F", farr, sizeof(farr));
+	DimServer::start("TEST");
+
+/*
+//	DimServer::autoStartOff();
+	DimServer::start("TEST");
+
+	for(i = 0; i < 15000; i++)
+	{
+		arr[i] = i;
+		sprintf(str,"ServiceManyTest/%05d",i);
+		servp = new DimService(str,arr[i]);
+		servp->setQuality(1);
+		servp->updateService(arr[i]);
+//	DimServer::start("TEST");
+		sprintf(str,"CommandManyTest/%05d",i);
+		cmndp = new CmndServMany(str);
+//	DimServer::start("TEST");
+	}
+*/
+
+	while(1)
+	{
+		sleep(5);
+		s1 = "hello1";
+		if(!boolval)
+			boolval = 1;
+		else
+			boolval = 0;
+		ival++;
+		servint.updateService();
+	}
+	return 0;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server.c	(revision 10183)
@@ -0,0 +1,169 @@
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dis.h>
+
+char str[10][80];
+
+typedef struct {
+	int i;
+	int j;
+	int k;
+	double d;
+	short s;
+	char c;
+	short t;
+	float f;
+	char str[20];
+}TT;
+
+TT t;
+
+/*
+int big_buff[1024];
+*/
+
+void cmnd_rout(int *tag, TT *buf, int *size)
+{
+
+	if(tag){}
+	printf("Command received, size = %d, TT size = %d:\n", *size,
+	       (int)sizeof(TT));
+	printf("buf->i = %d, buf->d = %2.2f, buf->s = %d, buf->c = %c, buf->f = %2.2f, buf->str = %s\n",
+			buf->i,buf->d,buf->s,buf->c,buf->f,buf->str);
+}
+
+void client_exited(int *tag)
+{
+	char name[84];
+
+	if(dis_get_client(name))
+		printf("Client %s (%d) exited\n", name, *tag);
+	else
+		printf("Client %d exited\n", *tag);
+}
+
+void exit_cmnd(int *code)
+{
+	printf("Exit_cmnd %d\n", *code);
+	exit(*code);
+}
+
+int NewData;
+int NewIds[11];
+
+int main(int argc, char **argv)
+{
+	int i, id, *ptr;
+	char aux[80];
+	char name[84], name1[132];
+	int on = 0;
+	long dnsid = 0;
+	char extra_dns[128];
+	int new_dns = 0;
+/*
+	int buf_sz, buf_sz1;
+*/
+/*
+dis_set_debug_on();
+*/
+	if(argc){}
+	new_dns = dim_get_env_var("EXTRA_DNS_NODE", extra_dns, sizeof(extra_dns));
+	if(new_dns)
+		dnsid = dis_add_dns(extra_dns,0);
+/*
+	buf_sz = dim_get_write_buffer_size();
+	dim_set_write_buffer_size(10000000);
+	buf_sz1 = dim_get_write_buffer_size();
+printf("socket buffer size = %d, after = %d\n",buf_sz, buf_sz1);
+*/
+	dis_add_exit_handler(exit_cmnd);
+	dis_add_client_exit_handler(client_exited);
+
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(str[i],"%s/Service_%03d",argv[1],i);
+		dis_add_service( str[i], "C", str[i], strlen(str[i])+1, 
+			(void *)0, 0 );
+	}
+	t.i = 123;
+	t.j = 456;
+	t.k = 789;
+	t.d = 56.78;
+	t.s = 12;
+	t.t = 12;
+	t.c = 'a';
+	t.f = (float)4.56;
+	ptr = (int *)&t;
+	strcpy(t.str,"hello world");
+
+	sprintf(aux,"%s/TEST_SWAP",argv[1]);
+	id = dis_add_service( aux, "l:3;d:1;s:1;c:1;s:1;f:1;c:20", &t, sizeof(t), 
+		(void *)0, 0 );
+	sprintf(aux,"%s/TEST_CMD",argv[1]);
+	dis_add_cmnd(aux,"l:3;d:1;s:1;c:1;s:1;f:1;c:20",cmnd_rout, 0);
+
+/*
+	big_buff[0] = 1;
+	for(i = 0; i < 20; i++)
+	{
+		sprintf(aux,"%s/TestMem_%d",argv[1], i);
+		big_ids[i] = dis_add_service( aux, "I", big_buff, 1024*sizeof(int), 
+			(void *)0, 0 );
+	}
+*/
+	dis_start_serving( argv[1] );
+
+	if(dis_get_client(name))
+	{
+		printf("client %s\n",name);
+	}
+	
+	while(1)
+	{
+/*
+		for(i = 0; i < 20; i++)
+		{
+			index++;
+			big_buff[0] = index;
+			dis_update_service(big_ids[i]);
+		}
+		sleep(1);
+*/
+/*
+		pause();
+		*/
+		sleep(10);
+
+		dis_update_service(id);
+
+		if(new_dns)
+		{
+			if(!on)
+			{
+printf("Connecting New DNS \n");
+				for(i = 0; i < 10; i++)
+				{
+					sprintf(name1,"NewService%d",i);
+					NewIds[i] = dis_add_service_dns(dnsid, name1, "i", &NewData, sizeof(NewData), 
+						(void *)0, 0 );
+				}
+				NewIds[10] = 0;
+				dis_start_serving_dns(dnsid, "xx_new"/*, NewIds*/);
+				on = 1;
+			}
+			else
+			{
+printf("DisConnecting New DNS \n");
+				for(i = 0; i < 10; i++)
+				{
+					dis_remove_service(NewIds[i]);
+				}
+				on = 0;
+			}
+		}
+
+	}
+	return 1;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server.cxx	(revision 10183)
@@ -0,0 +1,208 @@
+#include <iostream>
+#include <dis.hxx>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+using namespace std;
+#include <string>
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		if(code){}
+		cout << severity << " " << msg << endl;
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimServer::addErrorHandler(this);}
+};
+
+class ExitHandler : public DimExitHandler
+{
+	void exitHandler(int code)
+	{
+		cout << "exit code " << code << endl;
+	}
+public:
+	ExitHandler() {DimServer::addExitHandler(this);}
+};
+
+class CmndServ : public DimCommand, public DimTimer
+{
+	DimService servstr;
+	void commandHandler()
+	{
+		int index = 0;
+		char **services;
+		cout << "Command " << getString() << " received" << endl;
+		servstr.updateService(getString()); 
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+
+public :
+	CmndServ() : DimCommand("TEST/CMND","C"), 
+				 servstr("TEST/STRVAL","empty") {};
+/*
+	void handleIt()
+	{
+		int index = 0;
+		char **services;
+		dim_print_date_time();
+		cout << "Command " << getString() << " received" << endl;
+		cout << "time: "<<getTimestamp()<<" millies: "<<getTimestampMillisecs()<<endl;
+		servstr.updateService(getString()); 
+	}
+*/
+};
+
+/*
+class CmndServMany : public DimCommand
+{
+	void commandHandler()
+	{
+		cout << "Command " << getString() << " received" << endl;
+	}
+public :
+	CmndServMany(char *name) : DimCommand(name,"C") {};
+};
+*/
+
+void add_serv(const int & ival)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/INTVAL_CONST",(int &)ival);
+}
+
+void add_serv_str(const string & s1)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/STRINGVAL_CONST",(char *)s1.c_str());
+}
+
+void add_serv_bool(const bool & boolval)
+{
+	DimService *serv;
+
+//	serv = new DimService("TEST/BOOLVAL_CONST",(short &)boolval);
+	serv = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1);
+}
+
+class ServWithHandler : public DimService
+{
+	int value;
+
+	void serviceHandler()
+	{
+		value++;
+//		setData(value);
+	}
+public :
+	ServWithHandler(char *name) : DimService(name, value) { value = 0;};
+};
+
+int main()
+{
+	int ival = 0;
+//	ErrorHandler errHandler;
+//	ExitHandler exHandler;
+//	DimServer::setDnsNode("axdes2.cern.ch");
+	string s1;
+	bool boolval;
+	ServWithHandler *testServ;
+	DimServerDns *newDns;
+	char *extraDns = 0;
+	DimService *new_servint;
+
+	DimServer::start("TEST");
+	extraDns = DimUtil::getEnvVar("EXTRA_DNS_NODE");
+	if(extraDns)
+		newDns = new DimServerDns(extraDns, 0, "new_TEST");
+
+/*
+	int i, arr[15000];
+	DimService *servp;
+	DimCommand *cmndp;
+	char str[132];
+*/
+//	float farr[4];
+//	DimService *farrp;
+
+	s1 = "hello";
+	add_serv(ival);
+	DimService servint("TEST/INTVAL",ival);
+
+	if(extraDns)
+	{
+		new_servint = new DimService(newDns, "new_TEST/INTVAL",ival);
+	}
+
+	add_serv_str(s1);
+	boolval = 0;
+	add_serv_bool(boolval);
+	CmndServ cmdsvr;
+
+	testServ = new ServWithHandler("MY_NEW_TEST_SERVICE_WITH_HANDLER");
+
+//	farr[0] = 1.2;
+//	farr[1] = 2.3;
+//	farrp = new DimService("/PCITCO147/sensors/fan/input","F", farr, sizeof(farr));
+
+
+/*
+//	DimServer::autoStartOff();
+	DimServer::start("TEST");
+
+	for(i = 0; i < 15000; i++)
+	{
+		arr[i] = i;
+		sprintf(str,"ServiceManyTest/%05d",i);
+		servp = new DimService(str,arr[i]);
+		servp->setQuality(1);
+		servp->updateService(arr[i]);
+//	DimServer::start("TEST");
+		sprintf(str,"CommandManyTest/%05d",i);
+		cmndp = new CmndServMany(str);
+//	DimServer::start("TEST");
+	}
+*/
+
+	while(1)
+	{
+		sleep(5);
+/*
+		while(cmdsvr.hasNext())
+		{
+			cmdsvr.getNext();
+			cmdsvr.handleIt();
+		}
+*/
+		s1 = "hello1";
+		if(!boolval)
+			boolval = 1;
+		else
+			boolval = 0;
+		ival++;
+		servint.updateService();
+		if(extraDns)
+			new_servint->updateService();
+	}
+	return 0;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server1.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server1.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server1.c	(revision 10183)
@@ -0,0 +1,58 @@
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <dis.h>
+
+int Data1[4000];
+int Data2[4000];
+int Id1, Id2;
+
+void cmnd_rout(int *tag, char *buf, int *size)
+{
+	int cid[2];
+	
+	cid[0] = dis_get_conn_id();
+	cid[1] = 0;
+	if(*tag == 1)
+		dis_selective_update_service(Id1, cid);
+	else if(*tag == 2)
+		dis_selective_update_service(Id2, cid);
+}
+
+int main(int argc, char **argv)
+{
+	int i, id, *ptr;
+	char aux[80];
+	char name[84], name1[132];
+	int on = 0;
+	long dnsid = 0;
+	char extra_dns[128];
+	int new_dns = 0;
+/*
+	int buf_sz, buf_sz1;
+*/
+
+dis_set_debug_on();
+
+	i = 0;
+	Data1[0] = i;	
+	Id1 = dis_add_service( "Beam1/Data", "C", Data1, 4000, (void *)0, 0 );
+	dis_add_cmnd("Beam1/Cmd","C",cmnd_rout, 1);
+	Data2[0] = i;	
+	Id2 = dis_add_service( "Beam2/Data", "C", Data2, 4000, (void *)0, 0 );
+	dis_add_cmnd("Beam2/Cmd","C",cmnd_rout, 2);
+
+	dis_start_serving( argv[1] );
+
+	while(1)
+	{
+		usleep(1000);
+		i++;
+		Data1[0] = i;	
+		dis_update_service(Id1);
+		Data2[0] = i;	
+		dis_update_service(Id2);
+	}
+	return 1;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_serverFernando.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_serverFernando.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_serverFernando.cxx	(revision 10183)
@@ -0,0 +1,172 @@
+#include <iostream>
+#include <dis.hxx>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+using namespace std;
+#include <string>
+
+class ErrorHandler : public DimErrorHandler
+{
+	void errorHandler(int severity, int code, char *msg)
+	{
+		int index = 0;
+		char **services;
+		cout << severity << " " << msg << endl;
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public:
+	ErrorHandler() {DimServer::addErrorHandler(this);}
+};
+
+class ExitHandler : public DimExitHandler
+{
+	void exitHandler(int code)
+	{
+		cout << "exit code " << code << endl;
+	}
+public:
+	ExitHandler() {DimServer::addExitHandler(this);}
+};
+
+class CmndServ : public DimCommand, public DimTimer
+{
+	DimService servstr;
+	void commandHandler()
+	{
+		int index = 0;
+		char **services;
+		cout << "Command " << getString() << " received" << endl;
+		servstr.updateService(getString()); 
+		services = DimServer::getClientServices();
+		cout<< "from "<< DimServer::getClientName() << " services:" << endl;
+		while(services[index])
+		{
+			cout << services[index] << endl;
+			index++;
+		}
+	}
+public :
+	CmndServ() : DimCommand("TEST/CMND","C"), 
+				 servstr("TEST/STRVAL","empty") {};
+};
+
+/*
+class CmndServMany : public DimCommand
+{
+	void commandHandler()
+	{
+		cout << "Command " << getString() << " received" << endl;
+	}
+public :
+	CmndServMany(char *name) : DimCommand(name,"C") {};
+};
+*/
+
+void add_serv(const int & ival)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/INTVAL_CONST",(int &)ival);
+}
+
+void add_serv_str(const string & s1)
+{
+	DimService *abc;
+
+	abc = new DimService("TEST/STRINGVAL_CONST",(char *)s1.c_str());
+}
+
+void add_serv_bool(const bool & boolval)
+{
+	DimService *serv;
+
+//	serv = new DimService("TEST/BOOLVAL_CONST",(short &)boolval);
+	serv = new DimService("TEST/BOOLVAL_CONST","C:1", (void *)&boolval, 1);
+}
+
+class ServWithHandler : public DimService
+{
+	int value;
+
+	void serviceHandler()
+	{
+		value++;
+//		setData(value);
+	}
+public :
+	ServWithHandler(char *name) : DimService(name, value) { value = 0;};
+};
+
+int main()
+{
+	int ival = 0;
+//	ErrorHandler errHandler;
+//	ExitHandler exHandler;
+//	DimServer::setDnsNode("axdes2.cern.ch");
+	string s1;
+	bool boolval;
+	ServWithHandler *testServ;
+
+/*
+	int i, arr[15000];
+	DimService *servp;
+	DimCommand *cmndp;
+	char str[132];
+*/
+	float farr[4];
+	DimService *farrp;
+
+	s1 = "hello";
+	add_serv(ival);
+	DimService servint("TEST/INTVAL",ival);
+	add_serv_str(s1);
+	boolval = 0;
+	add_serv_bool(boolval);
+	CmndServ cmdsvr;
+
+	testServ = new ServWithHandler("MY_NEW_TEST_SERVICE_WITH_HANDLER");
+
+	farr[0] = 1.2;
+	farr[1] = 2.3;
+	farrp = new DimService("/PCITCO147/sensors/fan/input","F", farr, sizeof(farr));
+	DimServer::start("TEST");
+
+/*
+//	DimServer::autoStartOff();
+	DimServer::start("TEST");
+
+	for(i = 0; i < 15000; i++)
+	{
+		arr[i] = i;
+		sprintf(str,"ServiceManyTest/%05d",i);
+		servp = new DimService(str,arr[i]);
+		servp->setQuality(1);
+		servp->updateService(arr[i]);
+//	DimServer::start("TEST");
+		sprintf(str,"CommandManyTest/%05d",i);
+		cmndp = new CmndServMany(str);
+//	DimServer::start("TEST");
+	}
+*/
+
+	while(1)
+	{
+		sleep(5);
+		s1 = "hello1";
+		if(!boolval)
+			boolval = 1;
+		else
+			boolval = 0;
+		ival++;
+		servint.updateService();
+	}
+	return 0;
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server_ccpc.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server_ccpc.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server_ccpc.c	(revision 10183)
@@ -0,0 +1,44 @@
+#include <stdio.h>
+#include <dis.h>
+
+int registers[10];
+int ids[10];
+
+void set_register(tag, data, size)
+int *tag, *data, *size;
+{
+int index, value;
+
+	index = data[0];
+	value = data[1];
+	printf("Setting register %d to value %d\n", index, value);
+/* here we set the register, read it back and update the service*/
+	registers[index] = value;
+	dis_update_service(ids[index]);
+	
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i;
+	char aux[80];
+
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(aux,"Register%03d",i);
+		ids[i] = dis_add_service( aux, "I", &registers[i], sizeof(int), 
+			(void *)0, 0 );
+	}
+
+	dis_add_cmnd("SET_REGISTER","I:2",set_register, 0);
+
+	dis_start_serving( "TEST_REGISTERS" );
+
+	while(1) 
+	{
+		pause();
+	}
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server_many.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server_many.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server_many.c	(revision 10183)
@@ -0,0 +1,161 @@
+#include <stdio.h>
+#include <dis.h>
+
+char str[10][80];
+
+typedef struct {
+	int i;
+	int j;
+	int k;
+	double d;
+	short s;
+	char c;
+	short t;
+	float f;
+	char str[20];
+}TT;
+
+double ServMany[100000];
+int ServManyIds[100000];
+
+TT t;
+/*
+int big_buff[1024];
+*/
+void cmnd_rout(tag, buf, size)
+int *tag, *size;
+TT *buf;
+{
+int i,*ptr;
+
+	printf("Command received, size = %d, TT size = %d:\n", *size,
+	       sizeof(TT));
+	printf("buf->i = %d, buf->d = %2.2f, buf->s = %d, buf->c = %c, buf->f = %2.2f, buf->str = %s\n",
+			buf->i,buf->d,buf->s,buf->c,buf->f,buf->str);
+}
+
+void client_exited(tag)
+int *tag;
+{
+	char name[84];
+	char *ptr;
+
+	if(dis_get_client(name))
+		printf("Client %s (%d) exited\n", name, *tag);
+	else
+		printf("Client %d exited\n", *tag);
+}
+
+void exit_cmnd(code)
+int *code;
+{
+	printf("Exit_cmnd %d\n", *code);
+	exit(*code);
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i, j, id, *ptr;
+	char aux[80];
+	char name[84], *ptrc;
+	int big_ids[20];
+	int index = 0;
+	char straux[128];
+	void update_services();
+
+	dis_add_exit_handler(exit_cmnd);
+	dis_add_client_exit_handler(client_exited);
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(str[i],"%s/Service_%03d",argv[1],i);
+		dis_add_service( str[i], "C", str[i], strlen(str[i])+1, 
+			(void *)0, 0 );
+	}
+	t.i = 123;
+	t.j = 123;
+	t.k = 123;
+	t.d = 56.78;
+	t.s = 12;
+	t.t = 12;
+	t.c = 'a';
+	t.f = 4.56;
+	ptr = (int *)&t;
+	strcpy(t.str,"hello world");
+/*
+	sprintf(aux,"%s/TEST_SWAP",argv[1]);
+	id = dis_add_service( aux, "l:3;d:1;s:1;c:1;s:1;f:1;c:20", &t, sizeof(t), 
+		(void *)0, 0 );
+
+	sprintf(aux,"%s/TEST_CMD",argv[1]);
+	dis_add_cmnd(aux,"l:3;d:1;s:1;c:1;s:1;f:1;c:20",cmnd_rout, 0);
+*/
+/*
+	big_buff[0] = 1;
+	for(i = 0; i < 20; i++)
+	{
+		sprintf(aux,"%s/TestMem_%d",argv[1], i);
+		big_ids[i] = dis_add_service( aux, "I", big_buff, 1024*sizeof(int), 
+			(void *)0, 0 );
+	}
+*/
+	for(i = 0; i< 100000; i++)
+	{
+		ServMany[i] = i;
+		sprintf(straux,"%s/ServiceMany%05d",argv[1],i);
+		ServManyIds[i] = dis_add_service( straux, "D", &ServMany[i], sizeof(double), 
+			(void *)0, 0 );
+	}
+	dis_start_serving( argv[1] );
+	if(dis_get_client(name))
+	{
+		printf("client %s\n",name);
+	}
+	
+	dtq_start_timer(30, update_services, 0);
+	
+	while(1)
+	{
+/*
+		for(i = 0; i < 20; i++)
+		{
+			index++;
+			big_buff[0] = index;
+			dis_update_service(big_ids[i]);
+		}
+		sleep(1);
+*/
+		pause();
+/*
+		sleep(30);
+		update_services();
+*/
+	}
+}
+
+void update_services()
+{
+	int i;
+
+	dtq_start_timer(20, update_services, 0);
+	
+	dim_print_date_time();
+printf("Start updating\n");
+		for(i = 0; i< 100000; i++)
+		{
+			ServMany[i] = ServMany[i]+1;
+			dis_update_service(ServManyIds[i]);
+			if(i == 10000)
+			{
+				int aux;
+				aux = ServMany[i];
+				ServMany[i] = 123;
+				dis_update_service(ServManyIds[i]);
+				ServMany[i] = aux;
+			}
+		}
+dim_print_date_time();
+printf("Stop updating\n");
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server_priorities.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server_priorities.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server_priorities.c	(revision 10183)
@@ -0,0 +1,189 @@
+#include <stdio.h>
+#include <dis.h>
+
+char str[10][80];
+
+typedef struct {
+	int i;
+	int j;
+	int k;
+	double d;
+	short s;
+	char c;
+	short t;
+	float f;
+	char str[20];
+}TT;
+
+TT t;
+
+void cmnd_rout(tag, buf, size)
+int *tag, *size;
+TT *buf;
+{
+int i,*ptr;
+
+	printf("Command received, size = %d, TT size = %d:\n", *size,
+	       sizeof(TT));
+	printf("buf->i = %d, buf->d = %2.2f, buf->s = %d, buf->c = %c, buf->f = %2.2f, buf->str = %s\n",
+			buf->i,buf->d,buf->s,buf->c,buf->f,buf->str);
+}
+
+void client_exited(tag)
+int *tag;
+{
+	char name[84];
+	char *ptr;
+
+	if(dis_get_client(name))
+		printf("Client %s (%d) exited\n", name, *tag);
+	else
+		printf("Client %d exited\n", *tag);
+}
+
+/*
+#ifdef WIN32
+#include <windows.h>
+#else
+#include <pthread.h>
+#endif
+
+#include <dic.h>
+
+void timr_rout(int tag)
+{
+	int code = 2004;
+#ifdef WIN32
+	DWORD id;
+	id = GetCurrentThreadId();
+#else
+	pthread_t id;
+	id = pthread_self();
+#endif
+	printf("in timr_rout, thread id = %d\n", id);
+	dic_cmnd_service("taskManager/sendKill", &code, sizeof(int));
+}
+
+void kill_rout(tag, buf, size)
+int *tag, *size;
+int *buf;
+{
+#ifdef WIN32
+	DWORD id;
+	id = GetCurrentThreadId();
+#else
+	pthread_t id;
+	id = pthread_self();
+#endif
+	printf("Command Kill received = %d\n", *buf);
+	printf("thread id = %d\n", id);
+	dim_set_priority(3, 1);
+}
+*/
+
+void exit_cmnd(code)
+int *code;
+{
+/*
+#ifdef WIN32
+	DWORD id;
+	id = GetCurrentThreadId();
+#else
+	pthread_t id;
+	id = pthread_self();
+#endif
+*/
+	printf("Exit_cmnd %d\n", *code);
+	exit(*code);
+/*
+	sleep(5);
+	printf("after_sleep, thread id = %d\n", id);
+	dim_set_priority(3, 60);
+	dtq_start_timer(5, timr_rout, 0);
+*/
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	int i, j, id, *ptr;
+	char aux[80];
+	char name[84], *ptrc;
+
+	dis_add_exit_handler(exit_cmnd);
+	dis_add_client_exit_handler(client_exited);
+	for(i = 0; i< 10; i++)
+	{
+		sprintf(str[i],"%s/Service_%03d",argv[1],i);
+		dis_add_service( str[i], "C", str[i], strlen(str[i])+1, 
+			(void *)0, 0 );
+	}
+	t.i = 123;
+	t.j = 123;
+	t.k = 123;
+	t.d = 56.78;
+	t.s = 12;
+	t.t = 12;
+	t.c = 'a';
+	t.f = 4.56;
+	ptr = (int *)&t;
+	strcpy(t.str,"hello world");
+	
+	sprintf(aux,"%s/TEST_SWAP",argv[1]);
+	id = dis_add_service( aux, "l:3;d:1;s:1;c:1;s:1;f:1;c:20", &t, sizeof(t), 
+		(void *)0, 0 );
+
+	sprintf(aux,"%s/TEST_CMD",argv[1]);
+	dis_add_cmnd(aux,"l:3;d:1;s:1;c:1;s:1;f:1;c:20",cmnd_rout, 0);
+
+	dis_add_cmnd("taskManager/sendKill","I",kill_rout, 0);
+	dis_start_serving( argv[1] );
+/*
+	{	  
+	int prio = -1, ret, pclass = -1;
+	dim_get_scheduler_class(&pclass);
+	printf("Process class: %d\n",pclass);
+	dim_get_priority(1, &prio);
+	printf("Main Thread: %d\n",prio);
+	dim_get_priority(2, &prio);
+	printf("IO Thread: %d\n",prio);
+	dim_get_priority(3, &prio);
+	printf("Timer Thread: %d\n",prio);
+#ifndef WIN32
+	ret = dim_set_scheduler_class(2);
+	printf("ret = %d\n",ret);
+	ret = dim_set_priority(1, 20);
+	printf("ret = %d\n",ret);
+	ret = dim_set_priority(2, 50);
+	printf("ret = %d\n",ret);
+#endif
+	dim_get_scheduler_class(&pclass);
+	printf("Process class: %d\n",pclass);
+	dim_get_priority(1, &prio);
+	printf("Main Thread: %d\n",prio);
+	dim_get_priority(2, &prio);
+	printf("IO Thread: %d\n",prio);
+	dim_get_priority(3, &prio);
+	printf("Timer Thread: %d\n",prio);
+	}
+*/
+	if(dis_get_client(name))
+	{
+		printf("client %s\n",name);
+	}
+	
+	while(1)
+	{
+		pause();
+	}
+/*
+	sleep(5);
+	{
+	  int i;
+	  for(i = 0; i <= 999999999; i++);
+	}
+	printf("Normal Exit\n");
+*/
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_server_slac.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_server_slac.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_server_slac.c	(revision 10183)
@@ -0,0 +1,35 @@
+#include <stdio.h>
+#include <dis.h>
+#include <dic.h>
+
+char str[10][80];
+
+void rout( tag, buf, size )
+char *buf;
+int *tag, *size;
+{
+	printf("%s Received for Server %d\n", buf, *tag);
+}
+
+main(argc,argv)
+int argc;
+char **argv;
+{
+	char aux[80];
+	int n;
+
+	sscanf(argv[1], "%d", &n);
+	sprintf(aux,"TEST_SLAC/SRV%d",n);
+	sprintf(str[0], aux);
+	dis_add_service(aux, "C", str[0], strlen(str[0])+1, (void *)0, 0);
+	sprintf(aux,"TEST_SLAC/%d",n);
+	dis_start_serving(aux);
+	sprintf(aux,"TEST_SLAC/CLT%d",n);
+	dic_info_service( aux, TIMED, 60, 0, 0, rout, n,
+			  "No Link", 8 );
+	while(1)
+	{
+		pause();
+	}
+}
+
Index: /trunk/FACT++/dim_v19r15/src/examples/test_tcp.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/examples/test_tcp.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/examples/test_tcp.c	(revision 10183)
@@ -0,0 +1,191 @@
+#ifdef WIN32
+#define ioctl ioctlsocket
+
+#define closesock myclosesocket
+#define readsock recv
+#define writesock send
+
+#define EINTR WSAEINTR
+#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define ECONNREFUSED WSAECONNREFUSED
+#define HOST_NOT_FOUND	WSAHOST_NOT_FOUND
+#define NO_DATA	WSANO_DATA
+
+#include <windows.h>
+#include <process.h>
+#include <io.h>
+#include <fcntl.h>
+#include <Winsock.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <stdio.h>
+#else
+#define closesock close
+#define readsock(a,b,c,d) read(a,b,c)
+
+#if defined(__linux__) && !defined (darwin)
+#define writesock(a,b,c,d) send(a,b,c,MSG_NOSIGNAL)
+#else
+#define writesock(a,b,c,d) write(a,b,c)
+#endif
+#include <ctype.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <netdb.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#endif
+
+#define ushort unsigned short
+#define TCP_RCV_BUF_SIZE	16384/*32768*//*65536*/
+#define TCP_SND_BUF_SIZE	16384/*32768*//*65536*/
+
+
+#ifdef WIN32
+int init_sock()
+{
+	WORD wVersionRequested;
+	WSADATA wsaData;
+	int err;
+	static int sock_init_done = 0;
+
+	if(sock_init_done) return(1);
+ 	wVersionRequested = MAKEWORD( 2, 0 );
+	err = WSAStartup( wVersionRequested, &wsaData );
+
+	if ( err != 0 ) 
+	{
+    	return(0);
+	}
+
+	/* Confirm that the WinSock DLL supports 2.0.*/
+	/* Note that if the DLL supports versions greater    */
+	/* than 2.0 in addition to 2.0, it will still return */
+	/* 2.0 in wVersion since that is the version we      */
+	/* requested.                                        */
+
+	if ( LOBYTE( wsaData.wVersion ) != 2 ||
+        HIBYTE( wsaData.wVersion ) != 0 ) 
+	{
+	    WSACleanup( );
+    	return(0); 
+	}
+	sock_init_done = 1;
+	return(1);
+}
+
+int myclosesocket(int path)
+{
+	int code, ret;
+	code = WSAGetLastError();
+	ret = closesocket(path);
+	WSASetLastError(code);
+	return ret;
+}
+#endif
+
+int tcp_open_client( char *node, int port )
+{
+	/* Create connection: create and initialize socket stuff. Try
+	 * and make a connection with the server.
+	 */
+	struct sockaddr_in sockname;
+	struct hostent *host;
+	int path, val, ret_code, ret;
+
+#ifdef WIN32
+	init_sock();
+#endif
+	if( (host = gethostbyname(node)) == (struct hostent *)0 ) 
+	{
+		return(0);
+	}
+
+	if( (path = socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 
+	{
+		perror("socket");
+		return(0);
+	}
+
+	val = 1;
+      
+	if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_NODELAY, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set TCP_NODELAY\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	val = TCP_SND_BUF_SIZE;      
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_SNDBUF, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_SNDBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	val = TCP_RCV_BUF_SIZE;
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_RCVBUF, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_RCVBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+#if defined(__linux__) && !defined (darwin)
+	val = 2;
+	if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_SYNCNT, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set TCP_SYNCNT\n");
+#endif
+	}
+#endif
+
+	sockname.sin_family = PF_INET;
+	sockname.sin_addr = *((struct in_addr *) host->h_addr);
+	sockname.sin_port = htons((ushort) port); /* port number to send to */
+	while((ret = connect(path, (struct sockaddr*)&sockname, sizeof(sockname))) == -1 )
+	{
+		if(errno != EINTR)
+		{
+			closesock(path);
+			return(0);
+		}
+	}
+	return(path);
+}
+
+int tcp_write( int path, char *buffer, int size )
+{
+	/* Do a (synchronous) write to conn_id.
+	 */
+	int	wrote;
+
+	wrote = writesock( path, buffer, size, 0 );
+	if( wrote == -1 ) {
+		return(0);
+	}
+	return(wrote);
+}
Index: /trunk/FACT++/dim_v19r15/src/feeserver.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/feeserver.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/feeserver.c	(revision 10183)
@@ -0,0 +1,4443 @@
+ Return to feeserver.c CVS log    Up to [MAIN] / dcscvs / FeeServer / feeserver / src  
+
+--------------------------------------------------------------------------------
+File: [MAIN] / dcscvs / FeeServer / feeserver / src / feeserver.c (download) 
+Revision: 1.26, Wed May 7 14:08:13 2008 UTC (22 months ago) by dominik 
+Branch: MAIN 
+CVS Tags: d, HEAD, FeeServer_v0-9-4_RCU-v0-9-9-dev, FeeServer_v0-9-4_RCU-v0-9-8-dev, FeeServer_v0-9-4_RCU-v0-9-7-dev, FeeServer_v0-9-4_RCU-v0-9-6-dev, FeeServer_v0-9-4_RCU-v0-9-5-dev, FeeServer_v0-9-4_RCU-v0-9-4, FeeServer_v0-9-4_RCU-v0-9-14-dev, FeeServer_v0-9-4_RCU-v0-9-13-dev, FeeServer_v0-9-4_RCU-v0-9-12-dev, FeeServer_v0-9-4_RCU-v0-9-11-dev, FeeServer_v0-9-4_RCU-v0-9-10-dev 
+Changes since 1.25: +32 -16 lines 
+updated to core version 0.9.4
+
+ 
+
+--------------------------------------------------------------------------------
+
+/************************************************************************
+ **
+ **
+ ** This file is property of and copyright by the Department of Physics
+ ** Institute for Physic and Technology, University of Bergen,
+ ** Bergen, Norway.
+ ** In cooperation with Center for Technology Transfer and 
+ ** Telecommunication (ZTT), University of Applied Sciences Worms
+ ** Worms, Germany.
+ **
+ ** This file has been written by Sebastian Bablok,
+ ** Sebastian.Bablok@uib.no
+ **
+ ** Important: This file is provided without any warranty, including
+ ** fitness for any particular purpose. Further distribution of this file,
+ ** even with changes in the code, is only allowed, when this copyright
+ ** and warranty paragraph is kept unchanged and included to the sources. 
+ **
+ **
+ *************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>				// for pause() necessary
+#include <string.h>
+#include <dim/dis.h>				// dimserver library
+#include <math.h>				// for fabsf
+
+#include <time.h>				// time for threads
+#include <sys/time.h>			// for gettimeofday()
+#include <pthread.h>
+//#include <stdbool.h>			// included by fee_types.h
+#include <errno.h>      		// for the error numbers
+#include <signal.h>
+
+#include "fee_types.h"			// declaration of own datatypes
+#include "fee_functions.h"		// declaration of feeServer functions
+#include "fee_defines.h"		// declaration of all globaly used constants
+#include "feepacket_flags.h"	// declaration of flag bits in a feepacket
+#include "fee_errors.h"			// defines of error codes
+#include "ce_command.h"			//control engine header file
+
+#ifdef __UTEST
+#include "fee_utest.h"
+#endif
+
+/**
+ * @defgroup feesrv_core The FeeServer core
+ */
+
+//-- global variables --
+
+/**
+ * state of the server, possible states are: COLLECTING, RUNNING and ERROR_STATE.
+ * @ingroup feesrv_core
+ */
+static int state = COLLECTING;
+
+/**
+ * indicates, if CEReady has been signaled (used in backup solution of init watch dog).
+ * @ingroup feesrv_core
+ */
+static bool ceReadySignaled = false;
+
+/**
+ * Variable provides the init state of the CE.
+ * @ingroup feesrv_core
+ */
+static int ceInitState = CE_NOT_INIT; // CE_OK; this has changed in version 0.9.4
+
+/**
+ * pointer to the first ItemNode of the doubly linked list (float)
+ * @ingroup feesrv_core
+ */
+static ItemNode* firstNode = 0;
+
+/**
+ * pointer to the last ItemNode of the doubly linked list (float)
+ * @ingroup feesrv_core
+ */
+static ItemNode* lastNode = 0;
+
+/**
+ * The message struct providing the data for an event message.
+ * @ingroup feesrv_core
+ */
+static MessageStruct message;
+
+/**
+ * Stores the last send message over the message channel to compare it with
+ * a newly triggered messages.
+ * @ingroup feesrv_core
+ */
+static MessageStruct lastMessage;
+
+/**
+ * Counter for replication of log messages.
+ * @ingroup feesrv_core
+ */
+static unsigned short replicatedMsgCount = 0;
+
+/**
+ * Indicates if the watchdog for replicated log messages is running
+ * (true = running).
+ *
+ * @ingroup feesrv_core
+ */
+static bool logWatchDogRunning = false;
+
+/**
+ * Timeout for the watchdog of replicated log messages. After this time the
+ * hold back message will be sent for sure, if no other type of message has
+ * triggered its sending before (replicated messages are collected until
+ * either this timeout occurs or a different message is triggered. In the later
+ * case the hold back message is sent first).
+ *
+ * @ingroup feesrv_core
+ */
+static unsigned int logWatchDogTimeout = DEFAULT_LOG_WATCHDOG_TIMEOUT;
+
+/**
+ * Stores the number of added nodes to the item list (float).
+ * @ingroup feesrv_core
+ */
+static unsigned int nodesAmount = 0;
+
+/**
+ * Indicates if the float monitor thread for published items has been started
+ * (true = started).
+ *
+ * @ingroup feesrv_core
+ */
+static bool monitorThreadStarted = false;
+
+/**
+ * DIM-serviceID for the dedicated acknowledge-service
+ * @ingroup feesrv_core
+ */
+static unsigned int serviceACKID;
+
+/**
+ * DIM-serviceID for the dedicated message - service
+ * @ingroup feesrv_core
+ */
+static unsigned int messageServiceID;
+
+/**
+ * DIM-commandID
+ * @ingroup feesrv_core
+ */
+static unsigned int commandID;
+
+/**
+ * Pointer to acknowledge Data (used by the DIM-framework)
+ * @ingroup feesrv_core
+ */
+static char* cmndACK = 0;
+
+/**
+ * size of the acknowledge Data
+ * @ingroup feesrv_core
+ */
+static int cmndACKSize = 0;
+
+/**
+ * Name of the FeeServer
+ * @ingroup feesrv_core
+ */
+static char* serverName = 0;
+
+/**
+ * length of FeeServer name
+ * @ingroup feesrv_core
+ */
+static int serverNameLength = 0;
+
+/**
+ * Update rate, in which the whole Item-list should be checked for changes.
+ * This value is given in milliseconds.
+ * @ingroup feesrv_core
+ */
+static unsigned short updateRate = DEFAULT_UPDATE_RATE;
+
+/**
+ * Timeout for call of issue - the longest time a command can be executed by the CE,
+ * before the watch dog kills this thread. This value is given in milliseconds.
+ * @ingroup feesrv_core
+ */
+static unsigned long issueTimeout = DEFAULT_ISSUE_TIMEOUT;
+
+/**
+ * Stores the current log level for this FeeServer.
+ * In case that an environmental variable (FEE_LOG_LEVEL) tells the desired
+ * loglevel, the DEFAULT_LOGLEVEL is overwritten during init process.
+ * @ingroup feesrv_core
+ */
+static unsigned int logLevel = DEFAULT_LOGLEVEL;
+
+/**
+ * thread handle for the initialize thread
+ * @ingroup feesrv_core
+ */
+static pthread_t thread_init;
+
+/**
+ * thread handle for the monitoring thread (float list)
+ * @ingroup feesrv_core
+ */
+static pthread_t thread_mon;
+
+/**
+ * thread handle for the watchdog of replicated log messages.
+ * This watchdog checks, if there have been replicated log messages during a
+ * time period given by "replicatedLogMessageTimeout", which have been hold
+ * back. The content of these messages is then send including the number of
+ * how often this has been triggered and hold back.
+ * Afterwards the counter is set back to zero again and backup of the last
+ * send log message is cleared.
+ *
+ * @ingroup feesrv_core
+ */
+static pthread_t thread_logWatchdog;
+
+/**
+ * thread condition variable for the "watchdog" timer
+ * @ingroup feesrv_core
+ */
+static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
+
+/**
+ * thread condition variable for the "initialisation complete" - signal
+ * @ingroup feesrv_core
+ */
+static pthread_cond_t init_cond = PTHREAD_COND_INITIALIZER;
+
+/**
+ * thread mutex variable for the "watchdog" in command handler
+ * @ingroup feesrv_core
+ */
+static pthread_mutex_t wait_mut = PTHREAD_MUTEX_INITIALIZER;
+
+/**
+ * thread mutex variable for the initialize CE thread
+ * @ingroup feesrv_core
+ */
+static pthread_mutex_t wait_init_mut = PTHREAD_MUTEX_INITIALIZER;
+
+/**
+ * thread mutex variable for the commandAck data
+ * @ingroup feesrv_core
+ */
+static pthread_mutex_t command_mut = PTHREAD_MUTEX_INITIALIZER;
+
+/**
+ * mutex to lock access to the logging function ( createLogMessage() )
+ * @ingroup feesrv_core
+ */
+static pthread_mutex_t log_mut = PTHREAD_MUTEX_INITIALIZER;
+
+
+////   --------- NEW FEATURE SINCE VERSION 0.8.1 (2007-06-12) ---------- /////
+
+/**
+ * pointer to the first IntItemNode of the doubly linked list (int)
+ * @ingroup feesrv_core
+ */
+static IntItemNode* firstIntNode = 0;
+
+/**
+ * pointer to the last IntItemNode of the doubly linked list (int)
+ * @ingroup feesrv_core
+ */
+static IntItemNode* lastIntNode = 0;
+
+/**
+ * Stores the number of added integer nodes to the IntItem list.
+ * @ingroup feesrv_core
+ */
+static unsigned int intNodesAmount = 0;
+
+/**
+ * thread handle for the monitoring thread (int - list)
+ * @ingroup feesrv_core
+ */
+static pthread_t thread_mon_int;
+
+/**
+ * Indicates if the int monitor thread for published IntItems has been started
+ * (true = started).
+ *
+ * @ingroup feesrv_core
+ */
+static bool intMonitorThreadStarted = false;
+
+
+////    ------------- NEW Memory Management (2007-07-25) ----------------- ////
+
+/**
+ * pointer to the first MemoryNode of the doubly linked list (memory management)
+ * @ingroup feesrv_core
+ */
+static MemoryNode* firstMemoryNode = 0;
+
+/**
+ * pointer to the last MemoryNode of the doubly linked list (memory management)
+ * @ingroup feesrv_core
+ */
+static MemoryNode* lastMemoryNode = 0;
+
+
+/// ---- NEW FEATURE SINCE VERSION 0.8.2b [Char Channel] (2007-07-28) ----- ///
+
+/**
+ * Stores the number of added Character item nodes to the CharItem list.
+ * @ingroup feesrv_core
+ */
+static unsigned int charNodesAmount = 0;
+
+/**
+ * pointer to the first CharItemNode of the doubly linked list (char)
+ * @ingroup feesrv_core
+ */
+static CharItemNode* firstCharNode = 0;
+
+/**
+ * pointer to the last CharItemNode of the doubly linked list (char)
+ * @ingroup feesrv_core
+ */
+static CharItemNode* lastCharNode = 0;
+
+
+
+//-- Main --
+
+/**
+ * Main of FeeServer.
+ * This programm represents the DIM-Server running on the DCS-boards.
+ * It uses the DIM-Server-Library implemented by C. Gaspar from Cern.
+ *
+ * @author Christian Kofler, Sebastian Bablok
+ *
+ * @date 2003-04-24
+ *
+ * @update 2004-11-22 (and many more dates ...)
+ *
+ * @version 0.8.1
+ * @ingroup feesrv_core
+ */
+int main(int argc, char** arg) {
+	//-- only for unit tests
+#	ifdef __UTEST
+	// insert here the testfunction-calls
+	testFrameWork();
+	return 0;
+#	endif
+
+	// now here starts the real stuff
+	initialize();
+	// test server (functional test)
+	while (1) {
+		// maybe do some checks here, like:
+		// - monitoring thread is still in good state
+		// - CE is still in good state
+		// - everything within the FeeServer is OK (assertions?)
+		pause();
+	}
+	return 0;
+}
+
+
+void initialize() {
+	//-- Declaring variables --
+	struct timeval now;
+	struct timespec timeout;
+	pthread_attr_t attr;
+	int nRet;
+	int status;
+	int initState  = FEE_CE_NOTINIT;
+	char* name = 0;
+	char* dns = 0;
+	bool initOk = true;
+	unsigned int envVal = 0;
+	char msg[250];
+	int restartCount = 0;
+
+	//-- register interrupt handler (CTRL-C)
+	// not used yet, causes problems
+//	if (signal(SIGINT, interrupt_handler) == SIG_ERR) {
+//#		ifdef __DEBUG
+//		printf("Unable to register interrupt handler.\n");
+//		printf("This is not fatal -> continuing.\n");
+//#		endif
+//	}
+
+	//-- get name of the server --
+	name = getenv("FEE_SERVER_NAME");
+	if (name == 0) {
+#		ifdef __DEBUG
+		printf("No FEE_SERVER_NAME \n");
+#		endif
+		exit(202);
+	}
+
+	serverName = (char*) malloc(strlen(name) + 1);
+	if (serverName == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available while trying to create server name!\n");
+#		endif
+		exit(201);
+	}
+	strcpy(serverName, name);
+	serverNameLength = strlen(serverName);
+
+	//-- test, if DIM_DNS_NODE is specified
+	dns = getenv("DIM_DNS_NODE");
+	if (dns == 0) {
+#		ifdef __DEBUG
+		printf("No DIM_DNS_NODE specified. \n");
+#		endif
+		exit(203);
+	}
+
+	// set the desired log level, if provided
+	if (getenv("FEE_LOG_LEVEL")) {
+		sscanf(getenv("FEE_LOG_LEVEL"), "%d", &envVal);
+		if ((envVal < 0) || (envVal > MSG_MAX_VAL)) {
+#		    ifdef __DEBUG
+			printf("Environmental variable has invalid Log Level, using default instead.\n");
+		   	fflush(stdout);
+#			endif
+		} else {
+			logLevel = envVal | MSG_ALARM;
+		}
+	}
+
+	// set logWatchDogTimeout, if env variable "FEE_LOGWATCHDOG_TIMEOUT" is set
+    if (getenv("FEE_LOGWATCHDOG_TIMEOUT")) {
+        sscanf(getenv("FEE_LOGWATCHDOG_TIMEOUT"), "%d", &envVal);
+        if ((envVal <= 0) || (envVal > MAX_TIMEOUT)) {
+#           ifdef __DEBUG
+            printf("Environmental variable has invalid LogWatchDog Timeout, using default instead.\n");
+            fflush(stdout);
+#           endif
+        } else {
+            logWatchDogTimeout = envVal;
+        }
+    }
+
+	// get restart counter
+	if (getenv("FEESERVER_RESTART_COUNT")) {
+		restartCount = atoi(getenv("FEESERVER_RESTART_COUNT"));
+	}
+
+	// Initial printout
+# 	ifdef __DEBUG
+	printf("\n  **  FeeServer version %s  ** \n\n", FEESERVER_VERSION);
+	printf("FeeServer name: %s\n", serverName);
+	printf("Using DIM_DNS_NODE: %s\n", dns);
+#   ifdef __BENCHMARK
+    printf(" -> Benchmark version of FeeServer <- \n");
+#	endif
+	printf("Current log level is: %d (MSG_ALARM (%d) is always on)\n", logLevel, MSG_ALARM);
+	printf("Restart Count is: %d; Restart-Env is: %s\n", restartCount, 
+			getenv("FEESERVER_RESTART_COUNT"));
+#	endif
+
+	//set dummy exit_handler to disable framework exit command, returns void
+	dis_add_exit_handler(&dim_dummy_exit_handler);
+
+	//set error handler to catch DIM framework messages
+	dis_add_error_handler(&dim_error_msg_handler);
+
+	// to ensure that signal is in correct state before init procedure
+	ceReadySignaled = false;
+
+	// lock mutex
+	status = pthread_mutex_lock(&wait_init_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Lock init mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		initOk = false;
+	} else {
+		// initiailisation of thread attribute only if mutex has been locked
+		status = pthread_attr_init(&attr);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Init attribute error: %d\n", status);
+			fflush(stdout);
+#			endif
+			initOk = false;
+		} else {
+			status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+			if (status != 0) {
+#				ifdef __DEBUG
+				printf("Set attribute error: %d\n", status);
+				fflush(stdout);
+#				endif
+				initOk = false;
+			}
+		}
+	}
+
+	if (initOk == true) {
+		// call only if initOk == true,
+		status = pthread_create(&thread_init, &attr, (void*) &threadInitializeCE, 0);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Create thread error: %d\n", status);
+			fflush(stdout);
+#			endif
+			initState = FEE_CE_NOTINIT;
+		} else {
+#			ifdef __DEBUG // for debugging the time amount the watchdog really waits (START)
+			time_t initStartTime = time(NULL);
+#			endif //__DEBUG
+
+			// timeout set in ms, should be enough for initialisation; see fee_defines.h for current value
+			status = gettimeofday(&now, 0);
+			if ((status != 0) || (restartCount <= 0)) {
+				// backup solution for detetcting end of init process
+#				ifdef __DEBUG
+				printf("Get time of day error: %d or restartCount <= 0 (%d), using backup solution\n",
+						status, restartCount);
+				fflush(stdout);
+#				endif
+				// unlock mutex to enable functionality of signalCEReady
+				status = pthread_mutex_unlock(&wait_init_mut);
+#				ifdef __DEBUG
+				if (status != 0) {
+					printf("Unlock mutex error: %d\n", status);
+					fflush(stdout);
+				}
+#				endif
+				// sleep init-timeout length
+				usleep((TIMEOUT_INIT_CE_MSEC * 1000)); // sleep the microsec fraction
+
+				const int sleepFraction = 1; // to check ready signal each second
+				int sleepLoops = TIMEOUT_INIT_CE_SEC / sleepFraction;
+				int cycles = 0;
+				do {
+					dtq_sleep(sleepFraction);
+					if (ceReadySignaled) {
+						break;
+					}
+				} while ( cycles++ < sleepLoops);
+//				dtq_sleep(TIMEOUT_INIT_CE_SEC);  // old style without check each second
+
+				if (ceReadySignaled == false) {
+					status = pthread_cancel(thread_init);
+#					ifdef __DEBUG
+					if (status != 0) {
+						printf("No thread to cancel: %d\n", status);
+						fflush(stdout);
+					}
+#					endif
+					// start with "the CE is not initialized!"
+					initState = FEE_CE_NOTINIT;
+#					ifdef __DEBUG
+					printf("Timeout in init [sleep]: %d\n", initState);
+					fflush(stdout);
+#					endif
+				} else {
+					if (ceInitState != CE_OK) {
+						// init failed, but no timeout occured
+						// (insufficient memory, etc. ... or something else)
+#						ifdef __DEBUG
+						printf("Init of CE failed, error: %d\n", ceInitState);
+						fflush(stdout);
+#						endif
+						initState = FEE_CE_NOTINIT;
+					} else {
+						// start with "everything is fine"
+						initState = FEE_OK;
+#						ifdef __DEBUG
+						printf("Init OK\n");
+						fflush(stdout);
+#						endif
+					}
+				}
+			} else {
+				timeout.tv_sec = now.tv_sec + TIMEOUT_INIT_CE_SEC;
+				timeout.tv_nsec = (now.tv_usec * 1000) +
+						(TIMEOUT_INIT_CE_MSEC * 1000000);
+
+				// wait for finishing "issue" or timeout after the mutex is unlocked
+				// a retcode of 0 means, that pthread_cond_timedwait has returned
+				// with the cond_init signaled
+				status = pthread_cond_timedwait(&init_cond, &wait_init_mut, &timeout);
+				// -- start FeeServer depending on the state of the CE --
+				if (status != 0) {
+					status = pthread_cancel(thread_init);
+#					ifdef __DEBUG
+					if (status != 0) {
+						printf("No thread to cancel: %d\n", status);
+						fflush(stdout);
+					}
+#					endif
+					// start with "the CE is not initialized!"
+					initState = FEE_CE_NOTINIT;
+#					ifdef __DEBUG
+					printf("Timeout in init [timed_wait]: %d\n", initState);
+					fflush(stdout);
+#					endif
+				} else {
+					if (ceInitState != CE_OK) {
+						// init failed, but no timeout occured
+						// (insufficient memory, etc. ... or something else)
+#						ifdef __DEBUG
+						printf("Init of CE failed, error: %d\n", ceInitState);
+						fflush(stdout);
+#						endif
+						initState = FEE_CE_NOTINIT;
+					} else {
+						// start with "everything is fine"
+						initState = FEE_OK;
+#						ifdef __DEBUG
+						printf("Init OK\n");
+						fflush(stdout);
+#						endif
+					}
+				}
+			}
+#			ifdef __DEBUG  // for debugging the time amout the watchdog waits (STOP)
+			time_t initStopTime = time(NULL);
+			if (initState != FEE_OK) {
+				printf("Watchdog: CE init tread\n   started %s",
+						ctime(&initStartTime));
+				printf("   killed  %s\n", ctime(&initStopTime));
+				// don't put this into one printf line -
+				// ctime or printf doe not work correct then, why?
+				fflush(stdout);
+			} else {
+				printf("Watchdog: CE init tread\n   started  %s", 
+						ctime(&initStartTime));
+				printf("   finished %s\n", ctime(&initStopTime)); 
+				// don't put this into one printf line - 
+				// ctime or printf doe not work correct then, why?
+				fflush(stdout);
+			}
+#			endif //__DEBUG
+		}
+		// destroy thread attribute
+		status = pthread_attr_destroy(&attr);
+#		ifdef __DEBUG
+		if (status != 0) {
+			printf("Destroy attribute error: %d\n", status);
+			fflush(stdout);
+		}
+#		endif
+	}
+
+	// init message struct -> FeeServer name, version and DNS are also provided
+	initMessageStruct();
+
+	if (initState != FEE_OK) {
+		// remove all services of Items of ItemList
+#		ifdef __DEBUG
+		printf("Init failed, unpublishing item list\n");
+		fflush(stdout);
+#		endif
+		unpublishItemList();
+		// new since version 0.8.1 -> int channels
+		unpublishIntItemList();
+        // new since version 0.8.2b -> char channels
+        unpublishCharItemList();
+	}
+
+	// add div. services and the command channel and then start DIM server
+	nRet = start(initState);
+
+	// unlock mutex
+	status = pthread_mutex_unlock(&wait_init_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Unlock mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		if (nRet == FEE_OK) {
+			createLogMessage(MSG_WARNING, "Unable to unlock init mutex.", 0);
+		}
+	}
+
+	if (nRet != FEE_OK) {
+#		ifdef __DEBUG
+		printf("unable to start DIM server, exiting.\n");
+		fflush(stdout);
+#		endif
+		fee_exit_handler(205);
+	} else {
+#		ifdef __DEBUG
+		printf("DIM Server successfully started, ready to accept commands.\n");
+		fflush(stdout);
+#		endif
+	}
+
+#	ifdef __DEBUG
+	printf("DEBUG - Init-State: %d, CE-State: %d, Restart-Env: %s, RestartCount: %d.\n",
+				initState, ceInitState, getenv("FEESERVER_RESTART_COUNT"), restartCount);
+	fflush(stdout);
+#	endif
+
+	// test for failed init of CE and init restart counter,
+	// counter counts backwards: only if counter > 0 restart is triggerd
+	if ((initState != FEE_OK) && (getenv("FEESERVER_RESTART_COUNT")) &&
+			(restartCount > 0)) {
+		msg[sprintf(msg,
+				"Triggering a FeeServer restart to give CE init another try. Restart count (backward counter): %d ",
+				restartCount)] = 0;
+		createLogMessage(MSG_WARNING, msg, 0);
+#		ifdef __DEBUG
+		printf("Triggering a FeeServer restart for another CE init try (backward count: %d).\n",
+				restartCount);
+		fflush(stdout);
+#		endif
+		// small sleep, that DIM is able to send log messages before restart
+		dtq_sleep(1);
+		// trigger restart to give it another try for the CE to init
+		triggerRestart(FEE_EXITVAL_TRY_INIT_RESTART);
+		// NOTE this function won't return ...
+	}
+	// look through watchdog and backup solution about ceInitState and check it again !!!
+	// afterwards the following line won't be necessary !!!
+	// needed later in information about properties !!!
+//	ceInitState = initState;
+
+	return;
+}
+
+
+void threadInitializeCE() {
+	int status = -1;
+	status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+	// if cancelation is not able, it won't hurt ?!
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Set cancel state (init) error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+
+	status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+	// if cancelation is not able, it won't hurt ?!
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Set cancel type (init) error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+
+	// Here starts the actual CE
+	initializeCE();
+
+	// not necessary, return 0 is better
+//	pthread_exit(0);
+	return;
+
+}
+
+
+void signalCEready(int ceState) {
+	int status = -1;
+
+	// set cancel type to deferred
+	status = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0);
+#   ifdef __DEBUG
+	if (status != 0) {
+		printf("Set cancel type error: %d\n", status);
+	    fflush(stdout);
+	}
+#   endif
+
+	//lock the mutex before broadcast
+	status = pthread_mutex_lock(&wait_init_mut);
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Lock mutex error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+
+	// provide init state of CE
+	ceInitState = ceState;
+
+	//signal that CE has completed initialisation
+	// maybe try the call pthread_cond_signal instead for performance
+	pthread_cond_broadcast(&init_cond);
+
+	// set variable for backup solution
+	ceReadySignaled = true;
+
+	// unlock mutex
+	status = pthread_mutex_unlock(&wait_init_mut);
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Unlock mutex error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+
+    // set cancel type to asyncroneous
+    status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+#   ifdef __DEBUG
+    if (status != 0) {
+        printf("Set cancel type error: %d\n", status);
+		fflush(stdout);
+    }
+#   endif
+}
+
+
+// -- Command handler routine --
+void command_handler(int* tag, char* address, int* size) {
+	struct timeval now;
+	struct timespec timeout;
+	int retcode  = -1;
+	int status = -1;
+	pthread_t thread_handle;
+	pthread_attr_t attr;
+	IssueStruct issueParam;
+	CommandHeader header;
+	char* pHeaderStream = 0;
+	MemoryNode* memNode = 0;
+	bool useMM = false;
+
+#ifdef __BENCHMARK
+	char benchmsg[200];
+	// make benchmark entry
+	if ((size != 0 ) && (*size >= 4)) {
+		benchmsg[sprintf(benchmsg,
+				"FeeServer CommandHandler (Received command) - Packet-ID: %d",
+				*address)] = 0;
+		createBenchmark(benchmsg);
+	} else {
+		createBenchmark("FeeServer CommandHandler (Received command)");
+	}
+#endif
+
+	// init struct
+	initIssueStruct(&issueParam);
+
+	issueParam.nRet = FEE_UNKNOWN_RETVAL;
+
+	// check state (ERROR state is allowed for FeeServer commands, not CE)
+	if ((state != RUNNING) && (state != ERROR_STATE)) {
+		return;
+	}
+
+	// lock command mutex to save command &ACK data until it is send
+	// and only one CE-Thread exists at one time
+	status = pthread_mutex_lock(&command_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Lock command mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING, "Unable to lock command mutex.", 0);
+	}
+
+	if ((tag == 0) || (address == 0) || (size == 0)) {
+		leaveCommandHandler(0, FEE_NULLPOINTER, MSG_WARNING,
+ 				"Received null pointer of DIM framework in command handler.");
+		return;
+	}
+
+	if (*size < HEADER_SIZE) {
+		leaveCommandHandler(0, FEE_INVALID_PARAM, MSG_WARNING,
+ 				"FeeServer received corrupted command.");
+		return;
+	}
+
+#	ifdef __DEBUG
+	printf(" Cmnd - Size: %d\n", *size);
+	fflush(stdout);
+#	endif
+
+	//-- storing the header information in struct --
+	memcpy(&header.id, address, HEADER_SIZE_ID);
+	memcpy(&header.errorCode, address + HEADER_OFFSET_ID, HEADER_SIZE_ERROR_CODE);
+	memcpy(&header.flags, address + HEADER_OFFSET_ERROR_CODE, HEADER_SIZE_FLAGS);
+	memcpy(&header.checksum, address + HEADER_OFFSET_FLAGS, HEADER_SIZE_CHECKSUM);
+
+	// --------------------- Check Flags --------------------------
+	if ((header.flags & HUFFMAN_FLAG) != 0) {
+		//-- do Huffmann decoding if flag is set --
+		// not implemented yet !!!
+	}
+
+	issueParam.size = *size - HEADER_SIZE;
+	issueParam.command = (address + HEADER_SIZE);
+	// !!! if Huffman decoding necessary, think about memory management ???
+
+	if ((header.flags & CHECKSUM_FLAG) != 0) {
+		//-- do checksum test if flag is set --
+		if (!checkCommand(issueParam.command, issueParam.size, header.checksum)) {
+			// -- checksum failed - notification
+			leaveCommandHandler(header.id, FEE_CHECKSUM_FAILED, MSG_WARNING,
+ 					"FeeServer received corrupted command data (checksum failed).");
+			return;
+		}
+	}
+
+	// -- here start the Commands for the FeeServer itself --
+	if ((header.flags & FEESERVER_UPDATE_FLAG) != 0) {
+#ifdef ENABLE_MASTERMODE
+		updateFeeServer(&issueParam);
+#else
+		createLogMessage(MSG_WARNING, "FeeServer is not authorized to execute shell programs, skip ...", 0);
+#endif //ENABLE_MASTERMODE
+		// this is only reached, if update has not been sucessful
+		issueParam.nRet = FEE_FAILED;
+		issueParam.size = 0;
+	} else if ((header.flags & FEESERVER_RESTART_FLAG) != 0) {
+		restartFeeServer();
+	} else if ((header.flags & FEESERVER_REBOOT_FLAG) != 0) {
+		createLogMessage(MSG_INFO, "Rebooting DCS board.", 0);
+		system("reboot");
+		exit(0);
+	} else if ((header.flags & FEESERVER_SHUTDOWN_FLAG) != 0) {
+		createLogMessage(MSG_INFO, "Shuting down DCS board.", 0);
+		system("poweroff");
+		exit(0);
+	} else if ((header.flags & FEESERVER_EXIT_FLAG) != 0) {
+		fee_exit_handler(0);
+	} else if ((header.flags & FEESERVER_SET_DEADBAND_FLAG) != 0) {
+		issueParam.nRet = setDeadband(&issueParam);
+	} else if ((header.flags & FEESERVER_GET_DEADBAND_FLAG) != 0) {
+		issueParam.nRet = getDeadband(&issueParam);
+	} else if ((header.flags & FEESERVER_SET_ISSUE_TIMEOUT_FLAG) != 0) {
+		issueParam.nRet = setIssueTimeout(&issueParam);
+	} else if ((header.flags & FEESERVER_GET_ISSUE_TIMEOUT_FLAG) != 0) {
+		issueParam.nRet = getIssueTimeout(&issueParam);
+	} else if ((header.flags & FEESERVER_SET_UPDATERATE_FLAG) != 0) {
+		issueParam.nRet = setUpdateRate(&issueParam);
+	} else if ((header.flags & FEESERVER_GET_UPDATERATE_FLAG) != 0) {
+		issueParam.nRet = getUpdateRate(&issueParam);
+	} else if ((header.flags & FEESERVER_SET_LOGLEVEL_FLAG) != 0) {
+		issueParam.nRet = setLogLevel(&issueParam);
+	} else if ((header.flags & FEESERVER_GET_LOGLEVEL_FLAG) != 0) {
+		issueParam.nRet = getLogLevel(&issueParam);
+	} else {
+		// commands for CE are not allowed in ERROR state
+		if (state == ERROR_STATE) {
+			leaveCommandHandler(header.id, FEE_WRONG_STATE, MSG_ERROR,
+ 					"FeeServer is in ERROR_STATE, ignoring command for CE!");
+			return;
+		}
+
+		// packet with no flags in header and no payload makes no sense
+		if (issueParam.size == 0) {
+			leaveCommandHandler(header.id, FEE_INVALID_PARAM, MSG_WARNING,
+ 					"FeeServer received empty command.");
+			return;
+		}
+
+		// lock mutex
+		status = pthread_mutex_lock(&wait_mut);
+		if (status != 0) {
+			leaveCommandHandler(header.id, FEE_THREAD_ERROR, MSG_ERROR,
+ 					"Unable to lock condition mutex for watchdog.");
+			return;
+		}
+
+		status = pthread_attr_init(&attr);
+		if (status != 0) {
+			unlockIssueMutex();
+			leaveCommandHandler(header.id, FEE_THREAD_ERROR, MSG_ERROR,
+ 					"Unable to initialize issue thread.");
+			return;
+		}
+
+		status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+		if (status != 0) {
+			unlockIssueMutex();
+			leaveCommandHandler(header.id, FEE_THREAD_ERROR, MSG_ERROR,
+ 					"Unable to initialize issue thread.");
+			return;
+		}
+
+		status = pthread_create(&thread_handle, &attr, &threadIssue, (void*) &issueParam);
+		if (status != 0) {
+			unlockIssueMutex();
+			leaveCommandHandler(header.id, FEE_THREAD_ERROR, MSG_ERROR,
+ 					"Unable to create issue thread.");
+			return;
+		}
+
+		status = pthread_attr_destroy(&attr);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Destroy attribute error: %d\n", status);
+			fflush(stdout);
+#			endif
+			createLogMessage(MSG_WARNING,
+					"Unable to destroy thread attribute.", 0);
+		}
+
+		// timeout set in ms, see fee_defines.h for current value
+		status = gettimeofday(&now, 0);
+		if (status == 0) {
+			// issueTimeout is in milliseconds:
+			// get second-part with dividing by 1000
+			timeout.tv_sec = now.tv_sec + (int) (issueTimeout / 1000);
+			// get rest of division by 1000 (which is milliseconds)
+			// and make it nanoseconds
+			timeout.tv_nsec = (now.tv_usec * 1000) +
+										((issueTimeout % 1000) * 1000000);
+
+			// wait for finishing "issue" or timeout, if signal has been sent
+			// retcode is 0 !
+			// this is the main logic of the watchdog for the CE of the FeeServer
+			retcode = pthread_cond_timedwait(&cond, &wait_mut, &timeout);
+#			ifdef __DEBUG
+			printf("Retcode of CMND timedwait: %d\n", retcode);
+			fflush(stdout);
+#			endif
+
+			// check retcode to detect and handle Timeout
+			if (retcode == ETIMEDOUT) {
+#				ifdef __DEBUG
+				printf("ControlEngine watchdog detected TimeOut.\n");
+				fflush(stdout);
+#				endif
+				createLogMessage(MSG_WARNING,
+						"ControlEngine watch dog noticed a time out for last command.", 0);
+
+				// kill not finished thread. no problem if this returns an error
+				pthread_cancel(thread_handle);
+				// setting errorCode to "a timout occured"
+				issueParam.nRet = FEE_TIMEOUT;
+				issueParam.size = 0;
+			} else if (retcode != 0) {
+				// "handling" of other error than timeout
+#				ifdef __DEBUG
+				printf("ControlEngine watchdog detected unknown error.\n");
+				fflush(stdout);
+#				endif
+				createLogMessage(MSG_WARNING,
+						"ControlEngine watch dog received an unknown for last command.", 0);
+
+				// kill not finished thread. no problem if this returns an error
+				pthread_cancel(thread_handle);
+				// setting errorCode to "a thread error occured"
+				issueParam.nRet = FEE_THREAD_ERROR;
+				issueParam.size = 0;
+			}
+
+		} else {
+#			ifdef __DEBUG
+			printf("Get time of day error: %d\n", status);
+			fflush(stdout);
+#			endif
+			createLogMessage(MSG_WARNING,
+				"Watchdog timer could not be initialized. Using non-reliable sleep instead.",
+				0);
+			// release mutex to avoid hang up in issueThread before signaling condition
+			unlockIssueMutex();
+			// watchdog with condition signal could not be used, because gettimeofday failed.
+			// sleeping instead for usual amount of time and trying to cancel thread aftterwards.
+			usleep(issueTimeout * 1000);
+			status = pthread_cancel(thread_handle);
+			// if thread did still exist something went wrong -> "timeout" (== 0)
+			if (status == 0) {
+#				ifdef __DEBUG
+				printf("TimeOut occured.\n");
+#				endif
+				createLogMessage(MSG_WARNING,
+						"ControlEngine issue did not return in time.", 0);
+				issueParam.nRet = FEE_TIMEOUT;
+				issueParam.size = 0;
+			}
+		}
+
+		unlockIssueMutex();
+	}
+	//--- end of CE call area --------------------
+
+	// ---------- start to compose result -----------------
+#	ifdef __DEBUG
+	printf("Issue-nRet: %d\n", issueParam.nRet);
+	fflush(stdout);
+#	endif
+	// check return value of issue
+	if ((issueParam.nRet < FEE_UNKNOWN_RETVAL) ||
+			(issueParam.nRet > FEE_MAX_RETVAL)) {
+		issueParam.nRet = FEE_UNKNOWN_RETVAL;
+		createLogMessage(MSG_DEBUG,
+				"ControlEngine [command] returned unkown RetVal.", 0);
+	}
+
+// start here with new memory management check for ACK
+	// check if old ACK data is in MemoryNode list and free it
+	if ((cmndACKSize > HEADER_SIZE) && (findMemoryNode(cmndACK + HEADER_SIZE) != 0)) {
+		memNode = findMemoryNode(cmndACK + HEADER_SIZE);
+		freeMemoryNode(memNode);
+	} else { // free cmndACK in original way
+		if (cmndACK != 0) {
+			free(cmndACK);
+			cmndACK = 0;
+		}
+	}
+
+	// check if new result data is in MemoryNode list
+	memNode = findMemoryNode(issueParam.result);
+	if (memNode != 0) {
+		cmndACK = memNode->ptr;
+		useMM = true;
+	} else {
+		// create Acknowledge as return value of command
+		// HEADER_SIZE bytes are added before result to insert the command
+		// header before the result -> see CommandHeader in Client for details
+		cmndACK = (char*) malloc(issueParam.size + HEADER_SIZE);
+	}
+
+	if (cmndACK == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available!\n");
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_ERROR, "Insufficient memory for ACK.", 0);
+
+		// no ACK because no memory!
+		cmndACKSize = 0;
+		status = pthread_mutex_unlock(&command_mut);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Lock command mutex error: %d\n", status);
+			fflush(stdout);
+#			endif
+			createLogMessage(MSG_WARNING,
+					"Error while trying to unlock command mutex.", 0);
+		}
+		return;
+	}
+
+#	ifdef __DEBUG
+	if (issueParam.size > 0) {
+//		printf("in cmnd-Handler -> issue result: ");
+//		printData(issueParam.result, 0, issueParam.size);
+//		fflush(stdout);
+	}
+#	endif
+
+	// checks checksumflag and calculates it if necessary
+	if ((header.flags & CHECKSUM_FLAG) != 0) {
+		header.checksum = calculateChecksum((unsigned char*) issueParam.result,
+					issueParam.size);
+		// !!! Do (Huffman- ) encoding, if wished afterwards.
+	} else {
+		header.checksum = CHECKSUM_ZERO;
+	}
+
+	// keep the whole flags also for the result packet
+	header.errorCode = (short) issueParam.nRet;
+#	ifdef __DEBUG
+	printf("ErrorCode in Header: %d\n", header.errorCode);
+	fflush(stdout);
+#	endif
+
+	pHeaderStream = marshallHeader(&header);
+	memcpy((void*) cmndACK, (void*) pHeaderStream, HEADER_SIZE);
+	if (pHeaderStream != 0) {
+		free(pHeaderStream);
+	}
+
+	if (useMM) {
+	  /*
+#		ifdef __DEBUG
+		printf("ACK channel used with MemoryManagement in FeeServer.\n");
+		fflush(stdout);
+		createLogMessage(MSG_DEBUG,
+				"ACK channel used with MemoryManagement in FeeServer.", 0);
+#		endif
+	  */
+	} else {
+		memcpy(((void*) cmndACK + HEADER_SIZE), (void*) issueParam.result,
+				issueParam.size);
+	}
+
+	//store the size of the result globally
+	cmndACKSize = issueParam.size + HEADER_SIZE;
+	// propagate change of ACK(nowledge channel) to upper Layers
+	dis_update_service(serviceACKID);
+
+#	ifdef __DEBUG
+	// -- see the cmndACK as a char - string
+	printf("ACK \n");
+//	printData(cmndACK, HEADER_SIZE, cmndACKSize);
+	// -- see the cmndACK in a HEX view for the ALTRO
+	//print_package(cmndACK + HEADER_SIZE);
+#	endif
+
+	if ((!useMM) && (issueParam.result != 0)) {
+		free(issueParam.result);
+	}
+// end of new stuff for memory managment.
+
+/*
+	if (cmndACK != 0) {
+		free(cmndACK);
+		cmndACK = 0;
+	}
+	// create Acknowledge as return value of command
+	// HEADER_SIZE bytes are added before result to insert the command
+	// header before the result -> see CommandHeader in Client for details
+	cmndACK = (char*) malloc(issueParam.size + HEADER_SIZE);
+	if (cmndACK == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available!\n");
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_ERROR, "Insufficient memory for ACK.", 0);
+
+		// no ACK because no memory!
+		cmndACKSize = 0;
+		status = pthread_mutex_unlock(&command_mut);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Lock command mutex error: %d\n", status);
+			fflush(stdout);
+#			endif
+			createLogMessage(MSG_WARNING,
+					"Error while trying to unlock command mutex.", 0);
+		}
+		return;
+	}
+
+#	ifdef __DEBUG
+	if (issueParam.size > 0) {
+//		printf("in cmnd-Handler -> issue result: ");
+//		printData(issueParam.result, 0, issueParam.size);
+//		fflush(stdout);
+	}
+#	endif
+
+	// checks checksumflag and calculates it if necessary
+	if ((header.flags & CHECKSUM_FLAG) != 0) {
+		header.checksum = calculateChecksum((unsigned char*) issueParam.result,
+					issueParam.size);
+		// !!! Do (Huffman- ) encoding, if wished afterwards.
+	} else {
+		header.checksum = CHECKSUM_ZERO;
+	}
+
+	// keep the whole flags also for the result packet
+	header.errorCode = (short) issueParam.nRet;
+#	ifdef __DEBUG
+	printf("ErrorCode in Header: %d\n", header.errorCode);
+	fflush(stdout);
+#	endif
+
+	pHeaderStream = marshallHeader(&header);
+	memcpy((void*) cmndACK, (void*) pHeaderStream, HEADER_SIZE);
+	if (pHeaderStream != 0) {
+		free(pHeaderStream);
+	}
+	memcpy(((void*) cmndACK + HEADER_SIZE), (void*) issueParam.result,
+				issueParam.size);
+
+	//store the size of the result globally
+	cmndACKSize = issueParam.size + HEADER_SIZE;
+	// propagate change of ACK(nowledge channel) to upper Layers
+	dis_update_service(serviceACKID);
+
+#	ifdef __DEBUG
+	// -- see the cmndACK as a char - string
+	printf("ACK \n");
+//	printData(cmndACK, HEADER_SIZE, cmndACKSize);
+	// -- see the cmndACK in a HEX view for the ALTRO
+	//print_package(cmndACK + HEADER_SIZE);
+#	endif
+
+	if (issueParam.result != 0) {
+		free(issueParam.result);
+	}
+
+*/
+
+
+	// unlock command mutex, data has been sent
+	status = pthread_mutex_unlock(&command_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Lock command mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+				"Error while trying to unlock command mutex.", 0);
+	}
+}
+
+
+//-- user_routine to provide the ACK-data
+void ack_service(int* tag, char** address, int* size) {
+#ifdef __BENCHMARK
+	char benchmsg[200];
+#endif
+
+	if ((tag == 0) || (*tag != ACK_SERVICE_TAG)) {
+#		ifdef __DEBUG
+		printf("invalid ACK Service\n");
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING, "DIM Framework called wrong ACK channel.",
+				0);
+		return;
+	}
+// use the line below for checking flags of an outgoing feePacket!
+//        printf("\nack_service was called flags are:%x%x\n", *(cmndACK+6), *(cmndACK+7));
+	if ((cmndACKSize > 0) && (cmndACK != 0)) {
+		*address = cmndACK;
+		*size = cmndACKSize;
+	} else {
+		*size = 0;
+	}
+#ifdef __BENCHMARK
+    // make benchmark entry
+	benchmsg[sprintf(benchmsg,
+			"FeeServer AckHandler (sending ACK) - Packet-ID: %d", *cmndACK)] = 0;
+    createBenchmark(benchmsg);
+#endif
+
+}
+
+
+void leaveCommandHandler(unsigned int id, short errorCode,
+			unsigned int msgType, char* message) {
+	int status = -1;
+
+#	ifdef __DEBUG
+	printf("%s\n", message);
+	fflush(stdout);
+#	endif
+
+	createLogMessage(msgType, message, 0);
+
+	// tell client that command is ignored
+	if (cmndACK != 0) {
+		free(cmndACK);
+		cmndACK = 0;
+	}
+	// send error code
+	cmndACK = createHeader(id, errorCode, false, false, 0);
+	cmndACKSize = HEADER_SIZE;
+	dis_update_service(serviceACKID);
+
+	// unlock command mutex to "free" commandHandler
+	status = pthread_mutex_unlock(&command_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Lock command mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+				"Error while trying to unlock command mutex.", 0);
+	}
+}
+
+
+void unlockIssueMutex() {
+	int status = -1;
+
+	status = pthread_mutex_unlock(&wait_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Unlock condition mutex error: %d. Going in ERROR state!\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_ALARM,
+			"Unable to unlock watchdog mutex. No more commands will be possible for CE. Going in ERROR state!",
+			0);
+		state = ERROR_STATE;
+	}
+}
+
+
+//-- publish-function called by CE (Control Engine) to declare Float - Items
+int publish(Item* item) {
+	unsigned int id;
+	char* serviceName = 0;
+
+	// check for right state
+	if (state != COLLECTING) {
+		return FEE_WRONG_STATE;
+	}
+
+	// Testing for NULL - Pointer
+	// !! Attention: if pointer is not initialized and also NOT set to NULL, this won't help !!
+	if (item == 0) {
+#		ifdef __DEBUG
+		printf("Bad item, not published\n");
+		fflush(stdout);
+#		endif
+		return FEE_NULLPOINTER;
+	}
+	if (item->name == 0 || item->location == 0) {
+#		ifdef __DEBUG
+		printf("Bad item, not published\n");
+		fflush(stdout);
+#		endif
+		return FEE_NULLPOINTER;
+	}
+
+	// Check name for duplicate here (float)
+	if (findItem(item->name) != 0) {
+#		ifdef __DEBUG
+		printf("Item name already published (float), new float item discarded.\n");
+		fflush(stdout);
+#		endif
+		return FEE_ITEM_NAME_EXISTS;
+	}
+	// Check in INT list
+	if (findIntItem(item->name) != 0) {
+#		ifdef __DEBUG
+		printf("Item name already published (int), float item discarded.\n");
+		fflush(stdout);
+#		endif
+		return FEE_ITEM_NAME_EXISTS;
+	}
+    // Check in Char service list
+    if (findCharItem(item->name) != 0) {
+#       ifdef __DEBUG
+        printf("Item name already published in char list, float item discarded.\n");
+        fflush(stdout);
+#       endif
+        return FEE_ITEM_NAME_EXISTS;
+    }
+
+	// -- add item as service --
+	serviceName = (char*) malloc(serverNameLength + strlen(item->name) + 2);
+	if (serviceName == 0) {
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+	// terminate string with '\0'
+	serviceName[sprintf(serviceName, "%s_%s", serverName, item->name)] = 0;
+	id = dis_add_service(serviceName, "F", (int*) item->location,
+			sizeof(float), 0, 0);
+	free(serviceName);
+	add_item_node(id, item);
+
+	return FEE_OK;
+}
+
+
+//-- function to add service to our servicelist
+void add_item_node(unsigned int _id, Item* _item) {
+	//create new node with enough memory
+	ItemNode* newNode = 0;
+
+	newNode = (ItemNode*) malloc(sizeof(ItemNode));
+	if (newNode == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available while adding itemNode!\n");
+#		endif
+		// !!! unable to run FeeServer, write msg in kernel logger !!! (->Tobias)
+		cleanUp();
+		exit(201);
+	}
+	//initialize "members" of node
+	newNode->prev = 0;
+	newNode->next = 0;
+	newNode->id = _id;
+	newNode->item = _item;
+	newNode->lastTransmittedValue = *(_item->location);
+	//if default deadband is negative -> set threshold 0, otherwise set half of defaultDeadband
+	newNode->threshold = (_item->defaultDeadband < 0) ? 0.0 : (_item->defaultDeadband / 2);
+ /*
+		if(_item->defaultDeadband < 0) {
+		newNode->threshold = 0.0;
+        } else {
+		newNode->threshold = _item->defaultDeadband / 2;
+	}
+*/
+	newNode->locBackup = _item->location;
+	newNode->checksum = calculateChecksum((unsigned char*) &(_item->location),
+			sizeof(volatile float*));
+	newNode->checksumBackup = newNode->checksum;
+
+#ifdef __DEBUG
+	// complete debug display of added Item
+/*
+	printf("Item: %d\n", _id);
+	printf("location: %f, locBackup %f\n", *(_item->location), *(newNode->locBackup));
+	printf("location addr: %p, locBackup addr %p\n", _item->location, newNode->locBackup);
+	printf("checksum1: %d, checksum2: %d\n\n", newNode->checksum,
+			newNode->checksumBackup);
+*/
+#endif
+
+#	ifdef __DEBUG
+	// short debug display of added Item
+	printf("init of %s with ID %d: %f\n", newNode->item->name, newNode->id,
+				newNode->lastTransmittedValue);
+	fflush(stdout);
+#	endif
+
+	++nodesAmount;
+	//redirect pointers of doubly linked list
+	if (firstNode != 0) {
+		lastNode->next = newNode;
+		newNode->prev = lastNode;
+		lastNode = newNode;
+	} else {
+		firstNode = newNode;
+		lastNode = newNode;
+	}
+}
+
+
+//-- Logging function -----
+void createLogMessage(unsigned int type, char* description, char* origin) {
+	int status = -1; // for mutex
+	int descLength = 0;
+	int originLength = 0;
+	time_t timeVal;
+	struct tm* now = 0;
+
+	// check if not in COLLECTING state
+	if (state == COLLECTING) {
+		return; // no log channel available at that time
+	}
+
+	//lock access with mutex due to the fact that FeeServer & CE can use it
+	status = pthread_mutex_lock(&log_mut);
+	// discard eventual error, this would cause more problems
+	// in each case, do NOT call createLogMessage ;) !
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Lock log mutex error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+
+	if (!checkLogLevel(type)) {   //if not -> unlock mutex -> return
+		//unlock mutex
+		status = pthread_mutex_unlock(&log_mut);
+		// discard eventual error, this would cause more problems
+		// in each case, do NOT call createLogMessage ;)
+#		ifdef __DEBUG
+		if (status != 0) {
+			printf("Unlock log mutex error: %d\n", status);
+			fflush(stdout);
+		}
+#		endif
+		return;
+	}
+
+	// check if message is a replicate of the last log message
+	if ((logWatchDogRunning) && (strncmp(description, lastMessage.description,
+				(MSG_DESCRIPTION_SIZE - 1)) == 0)) {
+		replicatedMsgCount++;
+
+		//unlock mutex
+        status = pthread_mutex_unlock(&log_mut);
+        // discard eventual error, this would cause more problems
+        // in each case, do NOT call createLogMessage ;)
+#       ifdef __DEBUG
+        if (status != 0) {
+            printf("Unlock log mutex error: %d\n", status);
+            fflush(stdout);
+        }
+#       endif
+		// message is a replicate of last message, leave Messenger
+        return;
+	} else {
+		// message is not a replicate of last one send,
+		// check if replicated log messages are pending
+		if (checkReplicatedLogMessage()) {
+			// sleep a small amount to let Dim update channel
+//			usleep(1000);
+		}
+	}
+
+	// prepare data (cut off overlength)
+	if (description != 0) {
+		// limit description to maximum of field in message struct if longer
+		descLength = ((strlen(description) >= MSG_DESCRIPTION_SIZE)
+				? (MSG_DESCRIPTION_SIZE - 1) : strlen(description));
+	}
+	if (origin != 0) {
+		// limit origin to maximum of field in message struct if longer
+		// be aware that "source" also contains server name and a slash
+		originLength = ((strlen(origin) >= MSG_SOURCE_SIZE - serverNameLength - 1)
+				? (MSG_SOURCE_SIZE - serverNameLength - 2) : strlen(origin));
+	}
+
+	//set type
+	message.eventType = type;
+	//set detector
+	memcpy(message.detector, LOCAL_DETECTOR, MSG_DETECTOR_SIZE);
+	//set origin
+	strcpy(message.source, serverName);
+	if (origin != 0) {
+		// append slash
+		strcpy(message.source + serverNameLength, "/");
+		// append origin maximum til end of source field in message struct
+		strncpy(message.source + serverNameLength + 1, origin, originLength);
+		// terminate with '\0'
+		message.source[serverNameLength + 1 + originLength] = 0;
+	}
+	//set description
+	if (description != 0) {
+		// fill description field of message struct maximum til end
+		strncpy(message.description, description, descLength);
+		// terminate with '\0'
+		message.description[descLength] = 0;
+	} else {
+		strcpy(message.description, "No description specified.");
+	}
+	//set current date and time
+	time(&timeVal);
+	now = localtime(&timeVal);
+	message.date[strftime(message.date, MSG_DATE_SIZE, "%Y-%m-%d %H:%M:%S",
+				now)] = 0;
+
+	//updateService
+	dis_update_service(messageServiceID);
+
+	// copy send message to storage of last message
+	lastMessage = message;
+
+	//unlock mutex
+	status = pthread_mutex_unlock(&log_mut);
+	// discard eventual error, this would cause more problems
+	// in each case, do NOT call createLogMessage ;)
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Unlock log mutex error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+}
+
+bool checkLogLevel(int event) {
+	// Comparision with binary AND, if result has 1 as any digit, event is
+	// included in current logLevel
+	if ((logLevel & event) != 0) {
+		return true;
+	}
+	return false;
+}
+
+void dim_error_msg_handler(int severity, int error_code, char* msg) {
+	char type[8];
+	int eventType = 0;
+	char message[MSG_DESCRIPTION_SIZE];
+	int length = 0;
+
+	// map severity to own log levels
+	switch (severity) {
+		case 0:
+			type[sprintf(type, "INFO")] = 0;
+			eventType = MSG_INFO;
+			break;
+		case 1:
+			type[sprintf(type, "WARNING")] = 0;
+			eventType = MSG_WARNING;
+			break;
+		case 2:
+			type[sprintf(type, "ERROR")] = 0;
+			eventType = MSG_ERROR;
+			break;
+		case 3:
+			type[sprintf(type, "FATAL")] = 0;
+			eventType = MSG_ERROR;
+			break;
+		default :
+			type[sprintf(type, "UNKNOWN")] = 0;
+			eventType = MSG_WARNING;
+			break;
+	}
+
+#   ifdef __DEBUG
+	// print to command line if wanted
+	printf("DIM: [%s - %d] - %d: %s.\n", type, severity, error_code, msg);
+	fflush(stdout);
+#	endif
+
+	// send message only if FeeServer is in serving or error state
+	if ((state == RUNNING) || (state == ERROR_STATE)) {
+		// put DIM error code in front of message
+		message[sprintf(message, "%s: ", mapDimErrorCodes(error_code))] = 0;
+		length = strlen(message);
+		strncpy((message + length), msg, (MSG_DESCRIPTION_SIZE - length - 1));
+		message[MSG_DESCRIPTION_SIZE - 1] = 0;
+		// deliver message to FeeServer message system
+		createLogMessage(eventType, message, "DIM\0");
+	}
+}
+
+char* mapDimErrorCodes(int errorCode) {
+	switch (errorCode) {
+		case (0x1): return "DIMDNSUNDEF";
+		case (0x2): return "DIMDNSREFUS";
+		case (0x3): return "DIMDNSDUPLC";
+		case (0x4): return "DIMDNSEXIT ";
+		case (0x5): return "DIMDNSTMOUT";
+
+		case (0x10): return "DIMSVCDUPLC";
+		case (0x11): return "DIMSVCFORMT";
+		case (0x12): return "DIMSVCINVAL";
+		case (0x13): return "DIMSVCTOOLG";
+
+		case (0x20): return "DIMTCPRDERR";
+		case (0x21): return "DIMTCPWRRTY";
+		case (0x22): return "DIMTCPWRTMO";
+		case (0x23): return "DIMTCPLNERR";
+		case (0x24): return "DIMTCPOPERR";
+		case (0x25): return "DIMTCPCNERR";
+		case (0x26): return "DIMTCPCNEST";
+
+		case (0x30): return "DIMDNSCNERR";
+		case (0x31): return "DIMDNSCNEST";
+
+		default: return "DIMUNKWNERR";
+	}
+}
+
+//-- tells the server, that he can start serving;
+//-- no services can be added when server is in state RUNNING
+int start(int initState) {
+	int nRet = FEE_UNKNOWN_RETVAL;
+	char* serviceName = 0;
+	char* messageName = 0;
+	char* commandName = 0;
+	char msgStructure[50];
+
+	if (state == COLLECTING) {
+		//----- add service for acknowledge -----
+		serviceName = (char*) malloc(serverNameLength + 13);
+		if (serviceName == 0) {
+			//no memory available!
+#			ifdef __DEBUG
+			printf("no memory available while trying to create ACK channel!\n");
+			fflush(stdout);
+#			endif
+			// !!! unable to run FeeServer, write msg in kernel logger !!! (-> Tobias)
+			cleanUp();
+			exit(201);
+		}
+		// compose ACK channel name and terminate with '\0'
+		serviceName[sprintf(serviceName, "%s_Acknowledge", serverName)] = 0;
+		if (cmndACK != 0) {
+			free(cmndACK);
+			cmndACK = 0;
+		}
+		// take created header
+		cmndACK = createHeader(0, initState, false, false, 0);
+		cmndACKSize = HEADER_SIZE;
+		// add ACK channel as service to DIM
+		serviceACKID = dis_add_service(serviceName, "C", 0, 0, &ack_service,
+				ACK_SERVICE_TAG);
+		free(serviceName);
+
+		//----- add message service -----
+		messageName = (char*) malloc(serverNameLength + 9);
+		if (messageName == 0) {
+			//no memory available!
+#			ifdef __DEBUG
+			printf("no memory available while trying to create message channel!\n");
+			fflush(stdout);
+#			endif
+			// !!! unable to run FeeServer, write msg in kernel logger !!! (->Tobias)
+			cleanUp();
+			exit(201);
+		}
+		// compose message channel name and terminate with '\0'
+		messageName[sprintf(messageName, "%s_Message", serverName)] = 0;
+		// compose message structure
+		msgStructure[sprintf(msgStructure, "I:1;C:%d;C:%d;C:%d;C:%d",
+				MSG_DETECTOR_SIZE, MSG_SOURCE_SIZE, MSG_DESCRIPTION_SIZE,
+				MSG_DATE_SIZE)] = 0;
+		// add message channel as service to DIM
+		messageServiceID = dis_add_service(messageName, msgStructure, (int*) &message,
+				sizeof(unsigned int) + MSG_DETECTOR_SIZE + MSG_SOURCE_SIZE +
+				MSG_DESCRIPTION_SIZE + MSG_DATE_SIZE, 0, 0);
+		free(messageName);
+
+		//----- before start serving we add the only command handled by the server -----
+		commandName = (char*) malloc(serverNameLength + 9);
+		if (commandName == 0) {
+			//no memory available!
+#			ifdef __DEBUG
+			printf("no memory available while trying to create CMD channel!\n");
+			fflush(stdout);
+#			endif
+			// !!! unable to run FeeServer, write msg in kernel logger !!! (->Tobias)
+			cleanUp();
+			exit(201);
+		}
+		// compose Command channel name and terminate with '\0'
+		commandName[sprintf(commandName, "%s_Command", serverName)] = 0;
+		// add CMD channel as command to DIM, no tag needed,
+		// only one command possible
+		commandID = dis_add_cmnd(commandName, "C", &command_handler, 0);
+		free(commandName);
+
+		//-- now start serving --
+		if (dis_start_serving(serverName) == 1) {
+			// if start server was successful
+			if (initState == FEE_OK) {
+				state = RUNNING;
+				// start monitoring thread now
+				nRet = startMonitorThread();
+				if (nRet != FEE_OK) {
+#					ifdef __DEBUG
+					printf("Could NOT start monitor thread, error: %d\n", nRet);
+					fflush(stdout);
+#					endif
+					createLogMessage(MSG_ERROR,
+							"Unable to start monitor thread on FeeServer.", 0);
+					return nRet;
+				}
+				// inform CE about update rate
+				provideUpdateRate();
+				createLogMessage(MSG_INFO,
+						"FeeServer started correctly, including monitor thread.", 0);
+				nRet = FEE_OK;
+			} else {
+				state = ERROR_STATE;
+				createLogMessage(MSG_ERROR,
+						"Initialisation of ControlEngine failed. FeeServer is running in ERROR state (without CE).",
+						0);
+				// starting itself worked, so nRet is OK
+				nRet = FEE_OK;
+			}
+			// start "relicated log messages" watchdog now
+			nRet = startLogWatchDogThread();
+            if (nRet != FEE_OK) {
+#               ifdef __DEBUG
+                printf("Could NOT start log watch dog thread, error: %d; FeeServer will run without it.\n",
+						nRet);
+                fflush(stdout);
+#               endif
+                createLogMessage(MSG_WARNING,
+                        "Can not start LogWatchDog thread (filters replicated MSGs). Uncritical error - running without it.",
+						 0);
+            }
+		} else {
+			// starting server was not successful, so remove added core - services
+			// so they can be added again by next start() - call
+			dis_remove_service(serviceACKID);
+			free(cmndACK);
+			cmndACK = 0;
+			cmndACKSize = 0;
+			dis_remove_service(messageServiceID);
+			dis_remove_service(commandID);
+			nRet = FEE_FAILED;
+		}
+		return nRet;
+	}
+	//server is already running
+	return FEE_OK;
+}
+
+// ****************************************
+// ---- starts the monitoring thread ----
+// ****************************************
+int startMonitorThread() {
+	int status = -1;
+	pthread_attr_t attr;
+
+	// when item lists are empty, no monitor threads are needed
+	if ((nodesAmount == 0) && (intNodesAmount == 0)) {
+		createLogMessage(MSG_INFO,
+				"No Items (float and int) for monitoring are available.", 0);
+		return FEE_OK;
+	}
+
+	// init thread attribut and set it
+	status = pthread_attr_init(&attr);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Init attribute error [mon]: %d\n", status);
+		fflush(stdout);
+#		endif
+		return FEE_MONITORING_FAILED;
+	}
+	status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set attribute error [mon]: %d\n", status);
+		fflush(stdout);
+#		endif
+		return FEE_MONITORING_FAILED;
+	}
+
+	// start the monitor thread for float values
+	if (nodesAmount > 0) {
+		status = pthread_create(&thread_mon, &attr, (void*)&monitorValues, 0);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Create thread error [mon - float]: %d\n", status);
+			fflush(stdout);
+#			endif
+			return FEE_MONITORING_FAILED;
+		}
+	}
+
+	//start the monitor thread for int values --> NEW v.0.8.1
+	if (intNodesAmount > 0) {
+		status = pthread_create(&thread_mon_int, &attr, (void*)&monitorIntValues, 0);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Create thread error [mon - int]: %d\n", status);
+			fflush(stdout);
+#			endif
+			return FEE_MONITORING_FAILED;
+		}
+	}
+
+	// cleanup attribut
+	status = pthread_attr_destroy(&attr);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Destroy attribute error [mon]: %d\n", status);
+		fflush(stdout);
+#		endif
+		// no error return value necessary !
+	}
+	return FEE_OK;
+}
+
+// --- this is the monitoring thread ---
+void monitorValues() {
+	int status = -1;
+	int nRet;
+	unsigned long sleepTime = 0;
+	ItemNode* current = 0;
+	char msg[120];
+    unsigned long innerCounter = 0; // used for update check after time interval
+    unsigned long outerCounter = 0; // used for update check after time interval
+
+	// set flag, that monitor thread has been started
+	monitorThreadStarted = true;
+
+	// set cancelation type
+	status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel state error [mon - float]: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure monitor thread (float) properly. Monitoring is not affected.", 0);
+	}
+	status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel type error [mon - float]: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure monitor thread (float) properly. Monitoring is not affected.", 0);
+	}
+
+	createLogMessage(MSG_DEBUG, "Started monitor thread for FLOAT values successfully.", 0);
+
+	while (1) {
+		current = firstNode;
+		sleepTime = (unsigned long) (updateRate / nodesAmount);
+		while (current != 0) { // is lastNode->next (end of list)
+ 			if (!checkLocation(current)) {
+				msg[sprintf(msg, "Value of item %s (float) is corrupt, reconstruction failed. Ignoring!",
+						current->item->name)] = 0;
+				createLogMessage(MSG_ERROR, msg, 0);
+				// message and do some stuff (like invalidate value)
+				// (test, what happens if pointer is redirected ???)
+			} else {
+				if ((fabsf((*(current->item->location)) - current->lastTransmittedValue)
+						>= current->threshold) || (outerCounter ==
+						(innerCounter * TIME_INTERVAL_MULTIPLIER))) {
+					nRet = dis_update_service(current->id);
+					current->lastTransmittedValue = *(current->item->location);
+#					ifdef __DEBUG
+					//printf("Updated %d clients for service %s [float]: %f\n", nRet,
+					//		current->item->name, *(current->item->location));
+					//fflush(stdout);
+#					endif
+				}
+			}
+
+			++innerCounter;
+			current = current->next;
+			usleep(sleepTime * 1000);
+			// sleeps xy microseconds, needed milliseconds-> "* 1000"
+		}
+		// with the check of both counter, each service is at least updated after
+		// every (deadband updateRate * nodesAmount) seconds
+		innerCounter = 0;
+		++outerCounter;
+		// after every service in list is updated set counter back to 0
+		// the TIME_INTERVAL_MULTIPLIER is used to enlarge the time interval of
+		// the request of services without touching the deadband checker updateRate
+		if (outerCounter >= (nodesAmount * TIME_INTERVAL_MULTIPLIER)) {
+			outerCounter = 0;
+		}
+	}
+	// should never be reached !
+	pthread_exit(0);
+}
+
+// checks against bitflips in location
+bool checkLocation(ItemNode* node) {
+	if (node->item->location == node->locBackup) {
+		// locations are identical, so no bitflip
+		return true;
+	}
+	// locations are not identical, check further
+
+	if (node->checksum == calculateChecksum((unsigned char*)
+			&(node->item->location), sizeof(volatile float*))) {
+		// checksum tells, that first location should be valid, repair backup
+		node->locBackup = node->item->location;
+		return true;
+	}
+	// original location or first checksum is wrong, continue checking
+
+	if (node->checksum == calculateChecksum((unsigned char*)
+			&(node->locBackup), sizeof(volatile float*))) {
+		// checksum tells, that location backup should be valid, repair original
+		node->item->location = node->locBackup;
+		return true;
+	}
+	// location backup or first checksum is wrong, continue checking
+
+	if (node->checksum == node->checksumBackup) {
+		// it seems that location and location backup are wrong
+		// or checksum value runs banana, not repairable
+		return false;
+	}
+	// it seems that first checksum is wrong
+	// try to fix with second checksum
+
+	if (node->checksumBackup == calculateChecksum((unsigned char*)
+			&(node->item->location), sizeof(volatile float*))) {
+		// checksum backup tells, that first location should be valid, repair backup
+		node->locBackup = node->item->location;
+		// repair first checksum
+		node->checksum = node->checksumBackup;
+		return true;
+	}
+	// original location or second checksum is wrong, continue checking
+
+	if (node->checksumBackup == calculateChecksum((unsigned char*)
+			&(node->locBackup), sizeof(volatile float*))) {
+		// checksum backup tells, that location backup should be valid, repair original
+		node->item->location = node->locBackup;
+		// repair checksum
+		node->checksum = node->checksumBackup;
+		return true;
+	}
+	// value is totally banana, no chance to fix
+	return false;
+}
+
+// ****************************************
+// ---- starts the LogWatchdog Thread  ----
+// ****************************************
+int startLogWatchDogThread() {
+    int status = -1;
+    pthread_attr_t attr;
+
+    // init thread attribut and set it
+    status = pthread_attr_init(&attr);
+    if (status != 0) {
+#       ifdef __DEBUG
+        printf("Init attribute error [LogWatchDog]: %d\n", status);
+        fflush(stdout);
+#       endif
+        return FEE_THREAD_ERROR;
+    }
+    status = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+    if (status != 0) {
+#       ifdef __DEBUG
+        printf("Set attribute error [LogWatchDog]: %d\n", status);
+        fflush(stdout);
+#       endif
+        return FEE_THREAD_ERROR;
+    }
+
+    // start the LogWatchDog thread
+    status = pthread_create(&thread_logWatchdog, &attr, (void*) &runLogWatchDog,
+		0);
+    if (status != 0) {
+#       ifdef __DEBUG
+        printf("Create thread error [LogWatchDog]: %d\n", status);
+        fflush(stdout);
+#       endif
+        return FEE_THREAD_ERROR;
+    }
+
+    // cleanup attribut
+    status = pthread_attr_destroy(&attr);
+    if (status != 0) {
+#       ifdef __DEBUG
+        printf("Destroy attribute error [LogWatchDog]: %d\n", status);
+        fflush(stdout);
+#       endif
+        // no error return value necessary !
+    }
+
+	return FEE_OK;
+}
+
+void runLogWatchDog() {
+	int status = -1;
+	unsigned int sleepSec = 0;
+	unsigned int sleepMilliSec = 0;
+
+    // set cancelation type
+    status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+    if (status != 0) {
+#       ifdef __DEBUG
+        printf("Set cancel state error [LogWatchDog]: %d\n", status);
+        fflush(stdout);
+#       endif
+        createLogMessage(MSG_WARNING,
+            "Can not set cancel state for LogWatchDog thread. WatchDog should not not be affected.",
+			0);
+    }
+    status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+    if (status != 0) {
+#       ifdef __DEBUG
+        printf("Set cancel type error [LogWatchDog]: %d\n", status);
+        fflush(stdout);
+#       endif
+        createLogMessage(MSG_WARNING,
+            "Can not set cancel type for LogWatchDog thread. WatchDog should not not be affected.",
+			0);
+    }
+
+    // thread started successfully, set flag accordingly
+    logWatchDogRunning = true;
+    createLogMessage(MSG_DEBUG,
+            "LogWatchDog thread for filtering replicated log messages successfully started.",
+            0);
+#   ifdef __DEBUG
+    printf("LogWatchDog thread for filtering replicated log messages successfully started.\n");
+    fflush(stdout);
+#   endif
+
+	while (1) {
+		// before test for replicated messages lock mutex,
+		// DON'T call createLogMessage() inside mutex lock
+    	status = pthread_mutex_lock(&log_mut);
+    	// discard eventual error, this would cause more problems
+#   	ifdef __DEBUG
+    	if (status != 0) {
+        	printf("Lock log mutex error: %d\n", status);
+        	fflush(stdout);
+    	}
+#   	endif
+
+		// perform check here
+		checkReplicatedLogMessage();
+
+		// release mutex
+        status = pthread_mutex_unlock(&log_mut);
+        // discard eventual error, this would cause more problems
+#       ifdef __DEBUG
+        if (status != 0) {
+            printf("Unlock log mutex error: %d\n", status);
+            fflush(stdout);
+        }
+#       endif
+
+		// set cancelation point
+		pthread_testcancel();
+		// prepare sleep time (timeout)
+		sleepSec = logWatchDogTimeout / 1000;
+		sleepMilliSec = logWatchDogTimeout % 1000;
+		usleep(sleepMilliSec * 1000);
+		dtq_sleep(sleepSec);
+		// set cancelation point
+		pthread_testcancel();
+	}
+
+	// should never be reached !
+	pthread_exit(0);
+}
+
+bool checkReplicatedLogMessage() {
+	int tempLength = 0;
+	time_t timeVal;
+	struct tm* now = 0;
+
+	// check if replicated messages are pending
+	if (replicatedMsgCount > 0) {
+        // replicated messages occured in between, informing upper layer ...
+        message.description[sprintf(message.description,
+                "Log message repeated %d times: ", replicatedMsgCount)] = 0;
+        // append original message as far as possible
+        tempLength = strlen(message.description);
+		if ((strlen(lastMessage.description) + tempLength) >=
+				MSG_DESCRIPTION_SIZE) {
+            // copy only a part of the original message that fits in the
+            // description field
+            strncpy((message.description + tempLength), lastMessage.description,
+                    (MSG_DESCRIPTION_SIZE - tempLength));
+            message.description[MSG_DESCRIPTION_SIZE - 1] = 0;
+        } else {
+            // enough space free, copy the whole original message
+            strcpy((message.description + tempLength),
+                    lastMessage.description);
+            message.description[strlen(lastMessage.description) +
+                    tempLength - 1] = 0;
+        }
+		// set correct timestamp
+        time(&timeVal);
+		now = localtime(&timeVal);
+		message.date[strftime(message.date, MSG_DATE_SIZE, "%Y-%m-%d %H:%M:%S",
+				now)] = 0;
+
+        //update MsgService with notification of repeated messages
+        dis_update_service(messageServiceID);
+        // clearing counter
+        replicatedMsgCount = 0;
+		return true;
+    }
+	return false;
+}
+
+void* threadIssue(void* threadParam) {
+	IssueStruct* issueParam = (IssueStruct*) threadParam;
+	int status;
+
+	status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel state error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure issue thread properly. Execution might eventually be affected.", 0);
+	}
+
+	status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel type error error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure issue thread properly. Execution might eventually be affected.", 0);
+	}
+
+	// executing command inside CE
+	issueParam->nRet = issue(issueParam->command, &(issueParam->result), &(issueParam->size));
+
+    //set cancel type to deferred
+    status = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel type error: %d\n", status);
+		fflush(stdout);
+#	   endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure issue thread properly. Execution might eventually be affected.", 0);
+    }
+
+	//lock the mutex before broadcast
+	status = pthread_mutex_lock(&wait_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Lock cond mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to lock condition mutex for watchdog in issue thread. Execution might eventually be affected.",
+			0);
+	}
+
+	//signal that issue has returned from ControlEngine
+	// maybe try the call pthread_cond_signal instead for performance
+	pthread_cond_broadcast(&cond);
+
+	// unlock mutex
+	status = pthread_mutex_unlock(&wait_mut);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Unlock cond mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to unlock condition mutex for watchdog in issue thread. Execution might eventually be affected.",
+			0);
+	}
+
+//	not needed, return 0 is better solution
+//	pthread_exit(0);
+	return 0;
+}
+
+
+char* createHeader(unsigned int id, short errorCode, bool huffmanFlag,
+					bool checksumFlag, int checksum) {
+	char* pHeader = 0;
+	FlagBits flags = NO_FLAGS;
+
+	if (huffmanFlag) {
+		//set huffman flag via binary OR
+		flags |= HUFFMAN_FLAG;
+	}
+	if (checksumFlag) {
+		//set checksum flag via binary OR
+		flags |= CHECKSUM_FLAG;
+	}
+
+	pHeader = (char*) malloc(HEADER_SIZE);
+	if (pHeader == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available while trying to create header!\n");
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_ALARM,
+				"No more memory available, unable to continue serving - exiting.",
+				0);
+		cleanUp();
+		exit(201);
+	}
+
+	memcpy(pHeader, &id, HEADER_SIZE_ID);
+	memcpy(pHeader + HEADER_OFFSET_ID, &errorCode, HEADER_SIZE_ERROR_CODE);
+	memcpy(pHeader + HEADER_OFFSET_ERROR_CODE, &flags, HEADER_SIZE_FLAGS);
+	memcpy(pHeader + HEADER_OFFSET_FLAGS, &checksum, HEADER_SIZE_CHECKSUM);
+
+	return pHeader;
+}
+
+
+bool checkCommand(char* payload, int size, unsigned int checksum) {
+	unsigned int payloadChecksum = 0;
+
+	// payload has to contain data, if size is greater than 0,
+	// and size must not be negative
+	if (((payload == 0) && (size > 0)) || (size < 0)) {
+		return false;
+	}
+
+	payloadChecksum = calculateChecksum((unsigned char*) payload, size);
+#	ifdef __DEBUG
+	printf("\nReceived Checksum: \t%x ,  \nCalculated Checksum: \t%x .\n\n",
+		checksum, payloadChecksum);
+	fflush(stdout);
+#	endif
+	return (payloadChecksum == checksum) ? true : false;
+}
+
+// ! Problems with signed and unsigned char, make differences in checksum
+// -> so USE "unsigned char*" !
+unsigned int calculateChecksum(unsigned char* buffer, int size) {
+	int n;
+	unsigned int checks = 0;
+	unsigned long adler = 1L;
+	unsigned long part1 = adler & 0xffff;
+	unsigned long part2 = (adler >> 16) & 0xffff;
+
+	// calculates the checksum with the Adler32 algorithm
+	for (n = 0; n < size; n++) {
+		part1 = (part1 + buffer[n]) % ADLER_BASE;
+		part2 = (part2 + part1) % ADLER_BASE;
+	}
+	checks = (unsigned int) ((part2 << 16) + part1);
+
+	return checks;
+}
+
+char* marshallHeader(CommandHeader* pHeader) {
+	char* tempHeader = 0;
+
+	tempHeader = (char*) malloc(HEADER_SIZE);
+	if (tempHeader == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available!\n");
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_ALARM,
+				"No more memory available, unable to continue serving - exiting.",
+				0);
+		cleanUp();
+		exit(201);
+	}
+
+	memcpy(tempHeader, &(pHeader->id), HEADER_SIZE_ID);
+	memcpy(tempHeader + HEADER_OFFSET_ID, &(pHeader->errorCode), HEADER_SIZE_ERROR_CODE);
+	memcpy(tempHeader + HEADER_OFFSET_ERROR_CODE, &(pHeader->flags), HEADER_SIZE_FLAGS);
+	memcpy(tempHeader + HEADER_OFFSET_FLAGS, &(pHeader->checksum), HEADER_SIZE_CHECKSUM);
+
+	return tempHeader;
+}
+
+// *********************************************************************************************
+// ---------------- here come all the FeeServer commands ----------------------------------------
+// *********************************************************************************************
+void updateFeeServer(IssueStruct* issueParam) {
+#ifdef ENABLE_MASTERMODE
+	int status = 0;
+	int i = 0;
+	FILE* fp = 0;
+
+	if ((*issueParam).size == 0) {
+		createLogMessage(MSG_ERROR, "Received new FeeServer with size 0.", 0);
+		return;
+	}
+#	ifdef __DEBUG
+	printf("Received update command, updating FeeServer now!\n");
+	fflush(stdout);
+#	endif
+	// execute instruction self and release mutex before return
+	fp = fopen("newFeeserver", "w+b");
+	if (fp == 0) {
+		createLogMessage(MSG_ERROR, "Unable to save new FeeServer binary.", 0);
+		return;
+	}
+
+	for ( i = 0; i < (*issueParam).size; ++i) {
+		fputc((*issueParam).command[i], fp);
+	}
+	fclose(fp);
+	createLogMessage(MSG_INFO, "FeeServer updated.", 0);
+
+	// should we call cleanUp() before restart
+	// better not: another possibility to hang ???
+	// -> cleanUp is in restart implicit ! except opened drivers
+	// could only be necessary, if some driver conns have to be closed.
+	cleanUp();
+	status = pthread_mutex_unlock(&command_mut);
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Unlock FeeCommand mutex error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+
+	// Exit status "3" tells the starting script to finalise update and restart
+	// FeeServer after termination.
+	exit(3);
+#endif //ENABLE_MASTERMODE
+}
+
+void restartFeeServer() {
+	triggerRestart(FEE_EXITVAL_RESTART);
+}
+
+void triggerRestart(int exitVal) {
+	int status = 0;
+	char msg[80];
+
+#	ifdef __DEBUG
+	printf("Triggering restart with exit value: %d\n", exitVal);
+	fflush(stdout);
+#	endif
+    msg[sprintf(msg, "Restarting FeeServer - exit value: %d ", exitVal)] = 0;
+    createLogMessage(MSG_INFO, msg, 0);
+
+	// should we call cleanUp() before restart
+	// better not: another possibility to hang ???
+	// -> cleanUp is in restart implicit ! except opened drivers
+	// could only be necessary, if some driver cons has to be closed.
+	cleanUp();
+	status = pthread_mutex_unlock(&command_mut);
+#	ifdef __DEBUG
+	if (status != 0) {
+		printf("Unlock FeeCommand mutex error: %d\n", status);
+		fflush(stdout);
+	}
+#	endif
+	// Exit status tells the startScript which type of restart is performed
+	exit(exitVal);
+}
+
+int setDeadband(IssueStruct* issueParam) {
+	char* itemName = 0;
+	float newDeadband = 0;
+	int nameLength = 0;
+	ItemNode* node = 0;
+	IntItemNode* intNode = 0;
+	char msg[100];
+	unsigned int count = 0;
+
+	if ((*issueParam).size <= sizeof(newDeadband)) {
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for setting dead band contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+
+	nameLength = (*issueParam).size - sizeof(newDeadband);
+
+	if (nameLength <= 0) {
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for setting dead band contained no service name.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+
+	itemName = (char*) malloc(nameLength + 1);
+	if (itemName == 0) {
+		(*issueParam).size = 0;
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+
+	memcpy(&newDeadband, (*issueParam).command, sizeof(newDeadband));
+	memcpy(itemName, (*issueParam).command + sizeof(newDeadband), nameLength);
+	itemName[nameLength] = 0;
+
+	if (itemName[0] != '*') {
+		// search wanted itemNode
+		node = findItem(itemName);
+		if (node == 0) {
+			//check in IntItemList
+			intNode = findIntItem(itemName);
+		}
+		if ((node == 0) && (intNode == 0)) {
+			// message is NOT sent in findItem() or findIntItem()
+			msg[sprintf(msg, "Item %s not found in list.", itemName)] = 0;
+			createLogMessage(MSG_WARNING, msg, 0);
+#			ifdef __DEBUG
+			printf("Item %s not found in list.\n", itemName);
+			fflush(stdout);
+#			endif
+
+			free(itemName);
+			(*issueParam).size = 0;
+			createLogMessage(MSG_DEBUG,
+					"FeeServer command for setting dead band contained invalid parameter.",
+					0);
+			return FEE_INVALID_PARAM;
+		} else {
+			// set new threshold ( = dead  band / 2)
+			if (node != 0) {
+				node->threshold = newDeadband / 2;
+			} else {
+				intNode->threshold = newDeadband / 2;
+			}
+#			ifdef __DEBUG
+			printf("Set deadband on item %s to %f.\n", itemName, newDeadband);
+			fflush(stdout);
+#			endif
+			msg[sprintf(msg, "New dead band (%f) is set for item %s.",
+					newDeadband, itemName)] = 0;
+			createLogMessage(MSG_INFO, msg, 0);
+		}
+	} else {
+		// set now for all wanted value the new deadband
+		count = setDeadbandBroadcast(itemName, newDeadband);
+
+#		ifdef __DEBUG
+		printf("Set deadband for %d items (%s) to %f.\n", count, itemName, newDeadband);
+		fflush(stdout);
+#		endif
+		msg[sprintf(msg, "New dead band (%f) is set for %d items (%s).",
+				newDeadband, count, itemName)] = 0;
+		createLogMessage(MSG_INFO, msg, 0);
+	}
+
+	free(itemName);
+	(*issueParam).size = 0;
+	return FEE_OK;
+}
+
+int getDeadband(IssueStruct* issueParam) {
+	char* itemName = 0;
+	int nameLength = 0;
+	ItemNode* node = 0;
+	IntItemNode* intNode = 0;
+	float currentDeadband = 0;
+	char msg[120];
+
+	if ((*issueParam).size <= 0) {
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for getting dead band contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+
+	nameLength = (*issueParam).size;
+	itemName = (char*) malloc(nameLength + 1);
+	if (itemName == 0) {
+		(*issueParam).size = 0;
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+
+	memcpy(itemName, (*issueParam).command, nameLength);
+	itemName[nameLength] = 0;
+
+	// search wanted itemNode
+	node = findItem(itemName);
+	if (node == 0) {
+		//check in IntItemList
+		intNode = findIntItem(itemName);
+	}
+	if ((node == 0) && (intNode == 0)) {
+		// message is NOT sent in findItem() or findIntItem()
+		msg[sprintf(msg, "Item %s not found in list.", itemName)] = 0;
+		createLogMessage(MSG_WARNING, msg, 0);
+#		ifdef __DEBUG
+		printf("Item %s not found in list.\n", itemName);
+		fflush(stdout);
+#		endif
+
+		free(itemName);
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for getting dead band contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	} else {
+		(*issueParam).result = (char*) malloc(sizeof(float) + nameLength);
+		if ((*issueParam).result == 0) {
+			(*issueParam).size = 0;
+			return FEE_INSUFFICIENT_MEMORY;
+		}
+
+		// copy current deadband value to ACK result
+		if (node != 0) {
+			currentDeadband = node->threshold * 2.0; // compute deadband
+		} else {
+			currentDeadband = intNode->threshold * 2.0; // compute deadband
+		}
+
+		memcpy((*issueParam).result, &currentDeadband, sizeof(float));
+		memcpy((*issueParam).result + sizeof(float), itemName, nameLength);
+		(*issueParam).size = sizeof(float) + nameLength;
+#		ifdef __DEBUG
+		printf("Current deadband on item %s is %f.\n", itemName, currentDeadband);
+		fflush(stdout);
+#		endif
+		msg[sprintf(msg, "Current deadband for item %s is %f.", itemName,
+				currentDeadband)] = 0;
+		createLogMessage(MSG_DEBUG, msg, 0);
+	}
+	free(itemName);
+	return FEE_OK;
+}
+
+int setIssueTimeout(IssueStruct* issueParam) {
+	char msg[70];
+	unsigned long newTimeout;
+
+	if ((*issueParam).size < sizeof(unsigned long)) {
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for setting issue timeout contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+	memcpy(&newTimeout, (*issueParam).command, sizeof(unsigned long));
+
+	// check new timeout for possible buffer overflow (value will be multiplied
+	// with 1000 later -> has to lower than 4294967 )
+	if (newTimeout > MAX_ISSUE_TIMEOUT) {
+        (*issueParam).size = 0;
+        createLogMessage(MSG_WARNING,
+                "New timeout for issue watchdog exceeded value limit (4294967).",
+                0);
+        return FEE_INVALID_PARAM;
+    }
+
+	issueTimeout = newTimeout;
+#	ifdef __DEBUG
+	printf("set new Issue timeout to %lu\n", issueTimeout);
+	fflush(stdout);
+#	endif
+	msg[sprintf(msg, "Watch dog time out is set to %lu.", issueTimeout)] = 0;
+	createLogMessage(MSG_INFO, msg, 0);
+
+	(*issueParam).size = 0;
+	return FEE_OK;
+}
+
+int getIssueTimeout(IssueStruct* issueParam) {
+	char msg[50];
+
+	(*issueParam).result = (char*) malloc(sizeof(unsigned long));
+	if ((*issueParam).result == 0) {
+		(*issueParam).size = 0;
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+
+	// copy current timeout for issue to ACK result
+	memcpy((*issueParam).result, &issueTimeout, sizeof(unsigned long));
+	(*issueParam).size = sizeof(unsigned long);
+#	ifdef __DEBUG
+	printf("issue timeout is %lu\n", issueTimeout);
+	fflush(stdout);
+#	endif
+	msg[sprintf(msg, "Issue timeout is %lu.", issueTimeout)] = 0;
+	createLogMessage(MSG_DEBUG, msg, 0);
+
+	return FEE_OK;
+}
+
+int setUpdateRate(IssueStruct* issueParam) {
+	char msg[70];
+	unsigned short newRate;
+
+	if ((*issueParam).size < sizeof(unsigned short)) {
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for setting update rate contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+	memcpy(&newRate, (*issueParam).command, sizeof(unsigned short));
+	updateRate = newRate;
+	// inform CE about update rate change
+	provideUpdateRate();
+#	ifdef __DEBUG
+	printf("set new update rate to %d\n", updateRate);
+	fflush(stdout);
+#	endif
+	msg[sprintf(msg, "New update rate for monitoring items: %d.", updateRate)] = 0;
+	createLogMessage(MSG_INFO, msg, 0);
+
+	(*issueParam).size = 0;
+	return FEE_OK;
+}
+
+int getUpdateRate(IssueStruct* issueParam) {
+	char msg[50];
+
+	(*issueParam).result = (char*) malloc(sizeof(unsigned short));
+	if ((*issueParam).result == 0) {
+		(*issueParam).size = 0;
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+
+	// copy current update rate to ACK result
+	memcpy((*issueParam).result, &updateRate, sizeof(unsigned short));
+	(*issueParam).size = sizeof(unsigned short);
+#	ifdef __DEBUG
+	printf("update rate is %d\n", updateRate);
+	fflush(stdout);
+#	endif
+	msg[sprintf(msg, "Monitoring update rate is %d.", updateRate)] = 0;
+	createLogMessage(MSG_DEBUG, msg, 0);
+
+	return FEE_OK;
+}
+
+// be aware of different size of unsigned int in heterogen systems !!
+int setLogLevel(IssueStruct* issueParam) {
+	int status = -1;
+	char msg[70];
+	unsigned int testLogLevel = 0;
+
+	if ((*issueParam).size < sizeof(unsigned int)) {
+		(*issueParam).size = 0;
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for setting log level contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+	memcpy(&testLogLevel, (*issueParam).command, sizeof(unsigned int));
+	// check loglevel for valid data
+	if (testLogLevel > MSG_MAX_VAL) {
+#		ifdef __DEBUG
+		printf("received invalid log level %d\n", testLogLevel);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_DEBUG,
+				"FeeServer command for setting log level contained invalid parameter.",
+				0);
+		return FEE_INVALID_PARAM;
+	}
+
+	status = pthread_mutex_lock(&log_mut);
+	// discard eventual error
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Lock log mutex error: %d\n", status);
+		fflush(stdout);
+#		endif
+		(*issueParam).size = 0;
+		return FEE_FAILED;
+	} else {
+		logLevel = testLogLevel | MSG_ALARM;
+
+		status = pthread_mutex_unlock(&log_mut);
+		if (status != 0) {
+#			ifdef __DEBUG
+			printf("Unlock log mutex error: %d\n", status);
+			fflush(stdout);
+#			endif
+			createLogMessage(MSG_WARNING, "Unable to unlock logger mutex.", 0);
+		}
+
+#		ifdef __DEBUG
+		printf("set new logLevel to %d\n", logLevel);
+		fflush(stdout);
+#		endif
+		msg[sprintf(msg, "New log level on FeeServer: %d.", logLevel)] = 0;
+		createLogMessage(MSG_INFO, msg, 0);
+
+		(*issueParam).size = 0;
+		return FEE_OK;
+	}
+}
+
+int getLogLevel(IssueStruct* issueParam) {
+	char msg[50];
+
+	(*issueParam).result = (char*) malloc(sizeof(unsigned int));
+	if ((*issueParam).result == 0) {
+		(*issueParam).size = 0;
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+
+	// copy current update rate to ACK result
+	memcpy((*issueParam).result, &logLevel, sizeof(unsigned int));
+	(*issueParam).size = sizeof(unsigned int);
+#	ifdef __DEBUG
+	printf("Requested loglevel is %d\n", logLevel);
+	fflush(stdout);
+#	endif
+	msg[sprintf(msg, "Requested LogLevel is %d.", logLevel)] = 0;
+	createLogMessage(MSG_DEBUG, msg, 0);
+
+	return FEE_OK;
+}
+
+void provideUpdateRate() {
+	FeeProperty feeProp;
+	if ((ceInitState == CE_OK) && ((nodesAmount > 0) || (intNodesAmount > 0))) {
+		feeProp.flag = PROPERTY_UPDATE_RATE;
+		feeProp.uShortVal = updateRate;
+		signalFeePropertyChanged(&feeProp);
+	}
+}
+
+
+unsigned int setDeadbandBroadcast(char* name, float newDeadbandBC) {
+	unsigned int count = 0;
+	ItemNode* current = 0;
+	IntItemNode* intCurrent = 0;
+	char* namePart = 0;
+	char* itemNamePart = 0;
+
+	if (name == 0) {
+		return count;
+	}
+
+	// pointer at first occurance of "_"
+	namePart = strpbrk(name, "_");
+	if (namePart == 0) {
+		return count;
+	}
+
+	// go through list of float values
+	current = firstNode;
+	while (current != 0) {  // is end of list
+		// pointer at first occurance of "_"
+		itemNamePart = strpbrk(current->item->name, "_");
+		// check if "_" not first character in name and is existing
+		if ((itemNamePart == 0) || (itemNamePart == current->item->name)) {
+			current = current->next;
+			continue;
+		}
+		if (strcmp(namePart, itemNamePart) == 0) {
+			// success, set threshold (= deadband / 2)
+			current->threshold = newDeadbandBC / 2;
+			++count;
+		}
+		current = current->next;
+	}
+
+	// go through list of integer values
+	intCurrent = firstIntNode;
+	while (intCurrent != 0) {  // is end of list
+		// pointer at first occurance of "_"
+		itemNamePart = strpbrk(intCurrent->intItem->name, "_");
+		// check if "_" not first character in name and is existing
+		if ((itemNamePart == 0) || (itemNamePart == intCurrent->intItem->name)) {
+			intCurrent = intCurrent->next;
+			continue;
+		}
+		if (strcmp(namePart, itemNamePart) == 0) {
+			// success, set threshold (= deadband / 2)
+			intCurrent->threshold = newDeadbandBC / 2;
+			++count;
+		}
+		intCurrent = intCurrent->next;
+	}
+
+	return count;
+}
+
+int updateFeeService(char* serviceName) {
+	char msg[80];
+	ItemNode* node = 0;
+	IntItemNode* intNode = 0;
+	CharItemNode* charNode = 0;
+	int nRet = 0;
+#	ifdef __DEBUG
+	char* addr = 0;
+	char* data = 0;
+	int size = 0;
+#	endif
+
+	if (state != RUNNING) {
+		return FEE_WRONG_STATE;
+	}
+	if (serviceName == 0) {
+		return FEE_NULLPOINTER;
+	}
+
+	// find desired service
+	node = findItem(serviceName);
+	if (node == 0) {
+		//check in IntItemList
+		intNode = findIntItem(serviceName);
+	}
+	if ((node == 0) || (intNode == 0)) {
+		//check in CharItemList
+        charNode = findCharItem(serviceName);
+	}
+
+	// check node
+	if ((node == 0) && (intNode == 0) && (charNode == 0)) {
+		// message is NOT sent in findItem(), findIntItem() or findCharItem()
+		msg[sprintf(msg, "Item %s not found in list.", serviceName)] = 0;
+		createLogMessage(MSG_WARNING, msg, 0);
+#		ifdef __DEBUG
+		printf("Item %s not found in list.\n", serviceName);
+		fflush(stdout);
+#		endif
+		return FEE_INVALID_PARAM;
+	} else {
+		if (node != 0) {
+			nRet = dis_update_service(node->id);
+#			ifdef __DEBUG
+/* 			printf("CE triggered an updated on %d clients for service %s [float]: %f\n", */
+/* 					nRet, node->item->name, *(node->item->location)); */
+/* 			fflush(stdout); */
+#			endif
+		} else if (intNode != 0) {
+			nRet = dis_update_service(intNode->id);
+#           ifdef __DEBUG
+/*             printf("CE triggered an updated on %d clients for service %s [int]: %d\n", */
+/*                     nRet, intNode->intItem->name, *(intNode->intItem->location)); */
+/*             fflush(stdout); */
+#           endif
+		} else {
+            nRet = dis_update_service(charNode->id);
+#           ifdef __DEBUG
+			(charNode->charItem->user_routine)(&(charNode->charItem->tag),
+					(int**) &addr, &size);
+			data = (char*) malloc(size +1);
+			strncpy(data, addr, size);
+			data[size] = 0;
+/*             printf("CE triggered an updated on %d clients for service %s [char]: %s\n", */
+/*                     nRet, charNode->charItem->name, data); */
+/*             fflush(stdout); */
+			free(data);
+#           endif
+		}
+	}
+
+	// return number of updated clients
+	return nRet;
+}
+
+
+// *********************************************************************************************
+// ---------- here comes all the initialisation of selfdefined datatypes -----------------------
+// *********************************************************************************************
+void initIssueStruct(IssueStruct* issueStr) {
+	issueStr->nRet = 0;
+	issueStr->command = 0;
+	issueStr->result = 0;
+	issueStr->size = 0;
+}
+
+void initMessageStruct() {
+	time_t timeVal;
+	struct tm* now;
+
+	// fill the original message struct
+	message.eventType = MSG_INFO;
+	memcpy(message.detector, LOCAL_DETECTOR, MSG_DETECTOR_SIZE);
+	memcpy(message.source, "FeeServer\0", 10);
+	message.description[sprintf(message.description,
+			"FeeServer %s (Version: %s) has been initialized (DNS: %s) ...",
+			serverName, FEESERVER_VERSION, getenv("DIM_DNS_NODE"))] = 0;
+	//set current date and time
+	time(&timeVal);
+	now = localtime(&timeVal);
+	message.date[strftime(message.date, MSG_DATE_SIZE, "%Y-%m-%d %H:%M:%S",
+			now)] = 0;
+
+	// the the storage of the "last Message" struct - must be different in
+	// the description compared to the original message struct above in init
+	lastMessage.eventType = MSG_DEBUG;
+    memcpy(lastMessage.detector, LOCAL_DETECTOR, MSG_DETECTOR_SIZE);
+    memcpy(lastMessage.source, "FeeServer\0", 10);
+    // now use a different description:
+	lastMessage.description[sprintf(lastMessage.description,
+			"Init of Backup Message Struct!")] = 0;
+    //set current date and time
+    time(&timeVal);
+    now = localtime(&timeVal);
+    lastMessage.date[strftime(lastMessage.date, MSG_DATE_SIZE,
+			"%Y-%m-%d %H:%M:%S", now)] = 0;
+}
+
+
+void initItemNode(ItemNode* iNode) {
+	iNode->prev = 0;
+	iNode->next = 0;
+	iNode->id = 0;
+	iNode->item = 0;
+	iNode->lastTransmittedValue = 0.0;
+	iNode->threshold = 0.0;
+	iNode->locBackup = 0;
+	iNode->checksum = 0;
+	iNode->checksumBackup = 0;
+}
+
+ItemNode* findItem(char* name) {
+//	char msg[70];
+	ItemNode* current = 0;
+
+	if (name == 0) {
+		return 0;
+	}
+	current = firstNode;
+	while (current != 0) {  // is end of list
+		if (strcmp(name, current->item->name) == 0) {
+			// success, give back itemNode
+			return current;
+		}
+		current = current->next;
+	}
+// since two lists, which are searched seperately don't make log output in
+// findItem()-function -> move to where called to combine with other 
+// findXYItem calls
+/*
+	if (state == RUNNING) {
+		msg[sprintf(msg, "Item %s not found in list.", name)] = 0;
+		createLogMessage(MSG_WARNING, msg, 0);
+#		ifdef __DEBUG
+		printf("Item %s not found in list.\n", name);
+		fflush(stdout);
+#		endif
+	}
+*/
+	return 0;
+}
+
+void unpublishItemList() {
+	ItemNode* current = 0;
+
+	current = firstNode;
+	while (current != 0) {
+		dis_remove_service(current->id);
+		current = current->next;
+	}
+	// pretending ItemList is completely empty to avoid access
+	// to not existing elements
+	nodesAmount = 0;
+	firstNode = 0;
+	lastNode = 0;
+}
+
+// ****************************************************************************
+// ------------------ here come all the closing and cleanup functions ---------
+// ****************************************************************************
+void interrupt_handler(int sig) {
+// *** causes props on DCS board -> not used yet ***
+#	ifdef __DEBUG
+	printf("Received interrupt: %d, exiting now.\n", sig);
+	fflush(stdout);
+#	endif
+
+	if ((state == RUNNING) || (state == ERROR_STATE)) {
+		fee_exit_handler(0);
+	} else {
+		cleanUp();
+		exit(0);
+	}
+}
+
+void fee_exit_handler(unsigned int state) {
+	char msg[70];
+
+#	ifdef __DEBUG
+	printf("Exit state: %d\n\n", state);
+	fflush(stdout);
+#	endif
+	msg[sprintf(msg, "Exiting FeeServer (exit state: %d).", state)] = 0;
+	createLogMessage(MSG_INFO, msg, 0);
+
+	cleanUp();
+	exit(state);
+}
+
+void dim_dummy_exit_handler(int* bufp) {
+	char msg[200];
+	char clientName[50];
+	int dummy = 0;
+
+	// if bufp null pointer, redirect to valid value
+	if (bufp == 0) {
+		bufp = &dummy;
+	}
+
+	// DO almost nothing, just to disable the build-in exit command of the DIM framework
+	// just notifying about intrusion, except for framework exit
+	clientName[0] = 0;
+	dis_get_client(clientName);
+	// let's asume exit from ambitious user has clientName (pid@host).
+	if (clientName[0] == 0) {
+#		ifdef __DEBUG
+		printf("Framework tries to exit FeeServer (%d)\n", *bufp);
+		printf("Most likely FeeServer name already exists.\n");
+		fflush(stdout);
+#		endif
+		// IMPORTANT don't use the bufp - state of framework, it could interfere
+		// with own specified exit states !! (e.g. for restarting in case of "2")
+		// the same state is signaled by kill all servers of dns !?
+		fee_exit_handler(204);
+	} else {
+		msg[sprintf(msg, "Ambitious user (%s) tried to kill FeeServer, ignoring command!",
+				clientName)] = 0;
+		createLogMessage(MSG_WARNING, msg, 0);
+#		ifdef __DEBUG
+		printf("Ambitious user (%s) tried to kill FeeServer (%d)\n", clientName, *bufp);
+		fflush(stdout);
+#		endif
+	}
+}
+
+void cleanUp() {
+	// the order of the clean up sequence here is important to evade seg faults
+#	ifdef __DEBUG
+	printf("Cleaning up FeeServer before finishing:\n");
+	fflush(stdout);
+#	endif
+	if (ceInitState == CE_OK) {
+		cleanUpCE();
+#		ifdef __DEBUG
+		printf(" - Clean up of CE finished\n");
+		fflush(stdout);
+#		endif
+	}
+
+	if (monitorThreadStarted) {
+		pthread_cancel(thread_mon);
+	}
+	if (intMonitorThreadStarted) {
+		pthread_cancel(thread_mon_int);
+	}
+	if (state == RUNNING) {
+		pthread_cancel(thread_init);
+	}
+	if (logWatchDogRunning) {
+		pthread_cancel(thread_logWatchdog);
+	}
+#	ifdef __DEBUG
+	printf(" - All threads except for main thread killed\n");
+	fflush(stdout);
+#	endif
+
+	dis_stop_serving();
+#	ifdef __DEBUG
+	printf(" - DIM server stopped\n");
+	fflush(stdout);
+#	endif
+
+	deleteItemList();
+	// new since version 0.8.1 -> int channels
+	deleteIntItemList();
+    // new since version 0.8.2b -> char channels
+    deleteCharItemList();
+
+	if (cmndACK != 0) {
+		free(cmndACK);
+	}
+	if (serverName != 0) {
+		free(serverName);
+	}
+
+	// new since 0.8.3 -> memory list
+	//cleanupMemoryList();
+#   ifdef __DEBUG
+    printf(" - Memory freed (lists and globaly allocated)\n");
+    fflush(stdout);
+#   endif
+}
+
+int deleteItemList() {
+	ItemNode* tmp = 0;
+
+	while (firstNode != 0) {
+		if (firstNode->item != 0) {
+			if (firstNode->item->name != 0) {
+				free(firstNode->item->name);
+			}
+			free(firstNode->item);
+		}
+
+		tmp = firstNode->next;
+		free(firstNode);
+		firstNode = tmp;
+	}
+	return FEE_OK;
+}
+
+/*
+MessageStruct copyMessage(const MessageStruct* const orgMsg) {
+    MessageStruct msg;
+    msg.eventType = orgMsg->eventType;
+    memcpy(msg.detector, orgMsg->detector, MSG_DETECTOR_SIZE);
+    memcpy(msg.source, orgMsg->source, MSG_SOURCE_SIZE);
+    memcpy(msg.description, orgMsg->description, MSG_DESCRIPTION_SIZE);
+    memcpy(msg.date, orgMsg->date, MSG_DATE_SIZE);
+    return msg;
+}
+*/
+
+////   --------- NEW FEATURE SINCE VERSION 0.8.1 (2007-06-12) ---------- /////
+
+int publishInt(IntItem* intItem) {
+	unsigned int id;
+	char* serviceName = 0;
+
+	// check for right state
+	if (state != COLLECTING) {
+		return FEE_WRONG_STATE;
+	}
+
+	// Testing for NULL - Pointer
+	// !! Attention: if pointer is not initialized and also NOT set to NULL, this won't help !!
+	if (intItem == 0) {
+#		ifdef __DEBUG
+		printf("Bad intItem, not published\n");
+		fflush(stdout);
+#		endif
+		return FEE_NULLPOINTER;
+	}
+	if (intItem->name == 0 || intItem->location == 0) {
+#		ifdef __DEBUG
+		printf("Bad intItem, not published\n");
+		fflush(stdout);
+#		endif
+		return FEE_NULLPOINTER;
+	}
+
+	// Check name for duplicate here
+	// Check in Float list
+	if (findItem(intItem->name) != 0) {
+#		ifdef __DEBUG
+		printf("Item name already published in float list, int item discarded.\n");
+		fflush(stdout);
+#		endif
+		return FEE_ITEM_NAME_EXISTS;
+	}
+	// Check in INT list
+	if (findIntItem(intItem->name) != 0) {
+#		ifdef __DEBUG
+		printf("Item name already published in int list, new int item discarded.\n");
+		fflush(stdout);
+#		endif
+		return FEE_ITEM_NAME_EXISTS;
+	}
+	// Check in Char service list
+    if (findCharItem(intItem->name) != 0) {
+#       ifdef __DEBUG
+        printf("Item name already published in char list, int item discarded.\n");
+        fflush(stdout);
+#       endif
+        return FEE_ITEM_NAME_EXISTS;
+    }
+
+
+	// -- add intItem as service --
+	serviceName = (char*) malloc(serverNameLength + strlen(intItem->name) + 2);
+	if (serviceName == 0) {
+		return FEE_INSUFFICIENT_MEMORY;
+	}
+	// terminate string with '\0'
+	serviceName[sprintf(serviceName, "%s_%s", serverName, intItem->name)] = 0;
+	id = dis_add_service(serviceName, "I", (int*) intItem->location,
+			sizeof(int), 0, 0);
+	free(serviceName);
+	add_int_item_node(id, intItem);
+
+	return FEE_OK;
+}
+
+void add_int_item_node(unsigned int _id, IntItem* _int_item) {
+	//create new node with enough memory
+	IntItemNode* newNode = 0;
+
+	newNode = (IntItemNode*) malloc(sizeof(IntItemNode));
+	if (newNode == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available while adding IntItemNode!\n");
+		fflush(stdout);
+#		endif
+		cleanUp();
+		exit(201);
+	}
+	//initialize "members" of node
+	newNode->prev = 0;
+	newNode->next = 0;
+	newNode->id = _id;
+	newNode->intItem = _int_item;
+	newNode->lastTransmittedIntValue = *(_int_item->location);
+	//if default deadband is negative -> set threshold 0, otherwise set half of defaultDeadband
+	newNode->threshold = (_int_item->defaultDeadband < 0) ? 0.0 : (_int_item->defaultDeadband / 2);
+
+	newNode->locBackup = _int_item->location;
+
+	// Check if these feature have to be ported as well ??? !!!
+//	newNode->checksum = calculateChecksum((unsigned char*) &(_item->location),
+//			sizeof(volatile float*));
+//	newNode->checksumBackup = newNode->checksum;
+
+#ifdef __DEBUG
+	// complete debug display of added IntItem
+/*
+	printf("IntItem: %d\n", _id);
+	printf("location: %f, locBackup %f\n", *(_int_item->location), *(newNode->locBackup));
+	printf("location addr: %p, locBackup addr %p\n", _int_item->location, newNode->locBackup);
+	printf("checksum1: %d, checksum2: %d\n\n", newNode->checksum,
+			newNode->checksumBackup);
+*/
+#endif
+
+#	ifdef __DEBUG
+	// short debug display of added Item
+	printf("init of %s (int) with ID %d: %d\n", newNode->intItem->name,
+				newNode->id, newNode->lastTransmittedIntValue);
+	fflush(stdout);
+#	endif
+
+	++intNodesAmount;
+	//redirect pointers of doubly linked list (int)
+	if (firstIntNode != 0) {
+		lastIntNode->next = newNode;
+		newNode->prev = lastIntNode;
+		lastIntNode = newNode;
+	} else {
+		firstIntNode = newNode;
+		lastIntNode = newNode;
+	}
+}
+
+
+IntItemNode* findIntItem(char* name) {
+//	char msg[70];
+	IntItemNode* current = 0;
+
+	if (name == 0) {
+		return 0;
+	}
+	current = firstIntNode;
+	while (current != 0) {  // is end of list
+		if (strcmp(name, current->intItem->name) == 0) {
+			// success, give back IntItemNode
+			return current;
+		}
+		current = current->next;
+	}
+// since two lists, which are searched seperately don't make log output in
+// findIntItem()-function -> move to where called to combine with other
+// findXYItem calls
+/*
+	if (state == RUNNING) {
+		msg[sprintf(msg, "Item %s not found in IntItem list.", name)] = 0;
+		createLogMessage(MSG_WARNING, msg, 0);
+#		ifdef __DEBUG
+		printf("Item %s not found in IntItem list.\n", name);
+		fflush(stdout);
+#		endif
+	}
+*/
+	return 0;
+}
+
+int deleteIntItemList() {
+	IntItemNode* tmp = 0;
+
+	while (firstIntNode != 0) {
+		if (firstIntNode->intItem != 0) {
+			if (firstIntNode->intItem->name != 0) {
+				free(firstIntNode->intItem->name);
+			}
+			free(firstIntNode->intItem);
+		}
+
+		tmp = firstIntNode->next;
+		free(firstIntNode);
+		firstIntNode = tmp;
+	}
+	return FEE_OK;
+}
+
+void initIntItemNode(IntItemNode* intItemNode) {
+	intItemNode->prev = 0;
+	intItemNode->next = 0;
+	intItemNode->id = 0;
+	intItemNode->intItem = 0;
+	intItemNode->lastTransmittedIntValue = 0;
+	intItemNode->threshold = 0.0;
+	intItemNode->locBackup = 0;
+	intItemNode->checksum = 0;
+	intItemNode->checksumBackup = 0;
+}
+
+void unpublishIntItemList() {
+	IntItemNode* current = 0;
+
+	current = firstIntNode;
+	while (current != 0) {
+		dis_remove_service(current->id);
+		current = current->next;
+	}
+	// pretending ItemList is completely empty to avoid access
+	// to not existing elements
+	intNodesAmount = 0;
+	firstIntNode = 0;
+	lastIntNode = 0;
+}
+
+Item* createItem() {
+    Item* item = 0;
+
+    item = (Item*) malloc(sizeof(Item));
+    if (item == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available!\n");
+#       endif
+        return 0;
+    }
+    item->location = 0;
+    item->name = 0;
+    item->defaultDeadband = 0;
+    return item;
+}
+
+IntItem* createIntItem() {
+	IntItem* intItem = 0;
+
+	intItem = (IntItem*) malloc(sizeof(IntItem));
+	if (intItem == 0) {
+		//no memory available!
+#		ifdef __DEBUG
+		printf("no memory available!\n");
+#		endif
+		return 0;
+	}
+	intItem->location = 0;
+	intItem->name = 0;
+	intItem->defaultDeadband = 0;
+	return intItem;
+}
+
+Item* fillItem(float* floatLocation, char* itemName, float defDeadband) {
+	Item* item = 0;
+
+    item = createItem();
+    if (item == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available!\n");
+#       endif
+        return 0;
+    }
+    item->location = floatLocation;
+    item->name = (char*) malloc(strlen(itemName) + 1);
+    if (item->name == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available!\n");
+#       endif
+		free(item);
+        return 0;
+    }
+	strcpy(item->name, itemName);
+    item->defaultDeadband = defDeadband;
+    return item;
+}
+
+IntItem* fillIntItem(int* intLocation, char* itemName, int defDeadband) {
+    IntItem* intItem = 0;
+
+    intItem = createIntItem();
+    if (intItem == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available!\n");
+#       endif
+        return 0;
+    }
+    intItem->location = intLocation;
+    intItem->name = (char*) malloc(strlen(itemName) + 1);
+    if (intItem->name == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available!\n");
+#       endif
+        free(intItem);
+        return 0;
+    }
+    strcpy(intItem->name, itemName);
+    intItem->defaultDeadband = defDeadband;
+    return intItem;
+}
+
+void monitorIntValues() {
+	int status = -1;
+	int nRet;
+	unsigned long sleepTime = 0;
+	IntItemNode* current = 0;
+	char msg[120];
+    unsigned long innerCounter = 0; // used for update check after time interval
+    unsigned long outerCounter = 0; // used for update check after time interval
+
+	// set flag, that monitor thread has been started
+	intMonitorThreadStarted = true;
+
+	// set cancelation type
+	status = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel state error [mon - int]: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure monitor thread (int) properly. Monitoring is not affected.", 0);
+	}
+	status = pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
+	if (status != 0) {
+#		ifdef __DEBUG
+		printf("Set cancel type error [mon - int]: %d\n", status);
+		fflush(stdout);
+#		endif
+		createLogMessage(MSG_WARNING,
+			"Unable to configure monitor thread (int) properly. Monitoring is not affected.", 0);
+	}
+
+	createLogMessage(MSG_DEBUG, "Started monitor thread for INT values successfully.", 0);
+
+	while (1) {
+		current = firstIntNode;
+		sleepTime = (unsigned long) (updateRate / intNodesAmount);
+		while (current != 0) { // is lastIntNode->next (end of list)
+ 			if (!checkIntLocation(current)) {
+				msg[sprintf(msg, "Value of item %s (int) is corrupt, reconstruction failed. Ignoring!",
+						current->intItem->name)] = 0;
+				createLogMessage(MSG_ERROR, msg, 0);
+				// message and do some stuff (like invalidate value)
+				// (test, what happens if pointer is redirected ???)
+			} else {
+				if ((abs((*(current->intItem->location)) - current->lastTransmittedIntValue)
+						>= current->threshold) || (outerCounter ==
+						(innerCounter * TIME_INTERVAL_MULTIPLIER))) {
+					nRet = dis_update_service(current->id);
+					current->lastTransmittedIntValue = *(current->intItem->location);
+#					ifdef __DEBUG
+					printf("CE triggered an updated on %d clients for service %s [int]: %d\n",
+							nRet, current->intItem->name, *(current->intItem->location));
+					fflush(stdout);
+#					endif
+				}
+			}
+
+			++innerCounter;
+			current = current->next;
+			usleep(sleepTime * 1000);
+			// sleeps xy microseconds, needed milliseconds-> "* 1000"
+		}
+		// with the check of both counter, each service is at least updated after
+		// every (deadband updateRate * nodesAmount) seconds
+		innerCounter = 0;
+		++outerCounter;
+		// after every service in list is updated set counter back to 0
+		// the TIME_INTERVAL_MULTIPLIER is used to enlarge the time interval of
+		// the request of services without touching the deadband checker updateRate
+		if (outerCounter >= (intNodesAmount * TIME_INTERVAL_MULTIPLIER)) {
+			outerCounter = 0;
+		}
+	}
+	// should never be reached !
+	pthread_exit(0);
+}
+
+// checks against bitflips in location (integer Item)
+bool checkIntLocation(IntItemNode* node) {
+	if (node->intItem->location == node->locBackup) {
+		// locations are identical, so no bitflip
+		return true;
+	}
+	// locations are not identical, check further
+
+	if (node->checksum == calculateChecksum((unsigned char*)
+			&(node->intItem->location), sizeof(volatile int*))) {
+		// checksum tells, that first location should be valid, repair backup
+		node->locBackup = node->intItem->location;
+		return true;
+	}
+	// original location or first checksum is wrong, continue checking
+
+	if (node->checksum == calculateChecksum((unsigned char*)
+			&(node->locBackup), sizeof(volatile int*))) {
+		// checksum tells, that location backup should be valid, repair original
+		node->intItem->location = node->locBackup;
+		return true;
+	}
+	// location backup or first checksum is wrong, continue checking
+
+	if (node->checksum == node->checksumBackup) {
+		// it seems that location and location backup are wrong
+		// or checksum value runs banana, not repairable
+		return false;
+	}
+	// it seems that first checksum is wrong
+	// try to fix with second checksum
+
+	if (node->checksumBackup == calculateChecksum((unsigned char*)
+			&(node->intItem->location), sizeof(volatile int*))) {
+		// checksum backup tells, that first location should be valid, repair backup
+		node->locBackup = node->intItem->location;
+		// repair first checksum
+		node->checksum = node->checksumBackup;
+		return true;
+	}
+	// original location or second checksum is wrong, continue checking
+
+	if (node->checksumBackup == calculateChecksum((unsigned char*)
+			&(node->locBackup), sizeof(volatile int*))) {
+		// checksum backup tells, that location backup should be valid, repair original
+		node->intItem->location = node->locBackup;
+		// repair checksum
+		node->checksum = node->checksumBackup;
+		return true;
+	}
+	// value is totally banana, no chance to fix
+	return false;
+}
+
+// --- Wrapper for the Float Items --- //
+
+int publishFloat(FloatItem* floatItem) {
+	return publish(floatItem);
+}
+
+
+FloatItem* createFloatItem() {
+	return createItem();
+}
+
+
+FloatItem* fillFloatItem(float* floatLocation, char* itemName, float defDeadband) {
+	return fillItem(floatLocation, itemName, defDeadband);
+}
+
+
+////    ------------- NEW Memory Management (2007-07-25) ----------------- ////
+
+MemoryNode* findMemoryNode(void* addr) {
+	MemoryNode* current = 0;
+
+	if (addr == 0) {
+	  /*
+		createLogMessage(MSG_WARNING,
+				"Reqesting MemoryNode with ID \"NULL\", discarding call!", 0);
+#		ifdef __DEBUG
+		printf("Reqesting MemoryNode with ID \"NULL\", discarding call!\n");
+		fflush(stdout);
+#		endif
+	  */
+		return 0;
+	}
+
+	current = firstMemoryNode;
+	while (current != 0) {  // is end of list
+		if (current->identityAddr == addr) {
+			// success, give back MemoryNode
+			return current;
+		}
+		current = current->next;
+	}
+
+/* 	// only used for debug output; comment it in if required 
+	if (current == 0) {
+		char msg[80];
+		msg[sprintf(msg, "Unable to find MemoryNode with ID \"%p\".", 
+				addr)] = 0;
+		createLogMessage(MSG_DEBUG, msg, 0);
+#		ifdef __DEBUG
+		printf("Unable to find MemoryNode with ID \"%p\".\n", addr);
+		fflush(stdout);
+#		endif
+	}
+*/
+
+	return 0;
+}
+
+
+MemoryNode* createMemoryNode(unsigned int size, char type, char* module,
+		unsigned int preSize) {
+
+	// check, if size is greater then preSize
+	if (size <= preSize) {
+		createLogMessage(MSG_ERROR,
+				"Error: asking for memory smaller or equal than its prefix size.",
+				0);
+#		ifdef __DEBUG
+		printf("Error: asking for memory smaller or equal than its prefix size.\n");
+		fflush(stdout);
+#		endif
+		return 0;
+	}
+
+	MemoryNode* memNode = (MemoryNode*) malloc(sizeof(MemoryNode));
+	if (memNode == 0) {
+		// insufficient memory
+		createLogMessage(MSG_ERROR,
+				"Insufficient memory! Unable to allocate memory for MemoryNode.",
+				0);
+#		ifdef __DEBUG
+		printf("Insufficient memory! Unable to allocate memory for MemoryNode.\n");
+		fflush(stdout);
+#		endif
+	}
+
+	// fill MemoryNode
+	void* ptr = (void*) malloc(size);
+	if (ptr == 0) {
+		// insufficient memory
+		char msg[100];
+		msg[sprintf(msg,
+				"Insufficient memory! Unable to allocate memory block of %d .",
+				size)] = 0;
+		createLogMessage(MSG_ERROR, msg, 0);
+#		ifdef __DEBUG
+		printf("Insufficient memory! Unable to allocate memory block of %d .\n",
+				size);
+		fflush(stdout);
+#		endif
+
+		free(memNode);
+		return 0;
+	}
+
+	memNode->ptr = ptr;
+	memNode->identityAddr = ptr + preSize;
+	memNode->mmData.memSize = size;
+	memNode->mmData.memType = type;
+	if (module != 0) {
+		strncpy(memNode->mmData.memDest, module, 30);
+		memNode->mmData.memDest[29] = 0;
+	} else {
+		memNode->mmData.memDest[0] = 0;
+	}
+	if (preSize > 0) {
+		memNode->mmData.prefixed = true;
+	} else {
+		memNode->mmData.prefixed = false;
+	}
+	memNode->mmData.prefixSize = preSize;
+
+	// add Node to list (add at end)
+	memNode->prev = lastMemoryNode;
+	memNode->next = 0;
+
+	if (lastMemoryNode != 0) {
+		lastMemoryNode->next = memNode;
+	}
+	lastMemoryNode = memNode;
+
+	if (firstMemoryNode == 0) {
+		firstMemoryNode = memNode;
+	}
+
+	return memNode;
+}
+
+
+void freeMemoryNode(MemoryNode* node) {
+	if (node == 0) {
+		return;
+	}
+
+	// free memory corresponding to this node
+	if (node->ptr != 0) {
+		free(node->ptr);
+	}
+
+	// redirect links in doubly linked list
+	if (node->next != 0) {
+		node->next->prev = node->prev;
+	} else {
+		lastMemoryNode = node->prev;
+	}
+
+	if (node->prev != 0) {
+		node->prev->next = node->next;
+	} else {
+		firstMemoryNode = node->next;
+	}
+
+	//free node itself
+	free(node);
+}
+
+
+void cleanupMemoryList() {
+	MemoryNode* current = firstMemoryNode;
+	while (current != 0) {
+		MemoryNode* nextMemNode = current->next;
+		freeMemoryNode(current);
+		current = nextMemNode;
+	}
+}
+
+
+// ------ NEW interface functions for memory management ------ //
+
+int allocateMemory(unsigned int size, char type, char* module,
+		char prefixPurpose, void** ptr) {
+	MemoryNode*	memNode = 0;
+	unsigned int realSize = 0;
+	unsigned int addSize = 0;
+	char msg[200];
+	*ptr = 0;
+
+	if (size == 0) {
+		createLogMessage(MSG_WARNING,
+				"FeeServer shall allocate memory of size 0; discarding call!", 0);
+#		ifdef __DEBUG
+		printf("FeeServer shall allocate memory of size 0; discarding call!\n");
+		fflush(stdout);
+#		endif
+		return FEE_INVALID_PARAM;
+	}
+
+	switch (prefixPurpose) {
+		case ('0'):
+			realSize = size;
+			break;
+
+		case ('A'):
+			realSize = size + HEADER_SIZE;
+			addSize = HEADER_SIZE;
+			break;
+
+		default:
+			msg[sprintf(msg,
+					"Received allocateMemory call with unknown prefix purpose ('%c'), discarding call.",
+					prefixPurpose)] = 0;
+			createLogMessage(MSG_ERROR, msg, 0);
+#			ifdef __DEBUG
+			printf("%s\n", msg);
+			fflush(stdout);
+#			endif
+			return FEE_INVALID_PARAM;
+	}
+
+	memNode = createMemoryNode(realSize, type, module, addSize);
+	if (memNode == 0) {
+		return FEE_FAILED;
+	}
+
+	*ptr = memNode->identityAddr;
+/*	// only for debug output to test functyionality
+	msg[sprintf(msg,
+			"Allocated memory (type %c) for %s of size %d + prefix memory size %d. Purpose is set to: %c.",
+			type, memNode->mmData.memDest, size, addSize, prefixPurpose)] = 0;
+	createLogMessage(MSG_DEBUG, msg, 0);
+#	ifdef __DEBUG
+	printf("%s\n", msg);
+	fflush(stdout);
+#	endif
+*/
+	return FEE_OK;
+}
+
+
+int freeMemory(void* addr) {
+	MemoryNode* memNode = 0;
+	if (addr == 0) {
+		// received NULL pointer
+		createLogMessage(MSG_WARNING,
+				"Received an NULL pointer for freeing memory, discarding call!", 0);
+#		ifdef __DEBUG
+		printf("Received an NULL pointer for freeing memory, discarding call! \n");
+		fflush(stdout);
+#		endif
+		return FEE_NULLPOINTER;
+	}
+
+	memNode = findMemoryNode(addr);
+	if (memNode == 0) {
+		// memory pointer id not found in list
+		return FEE_INVALID_PARAM;
+	}
+
+	freeMemoryNode(memNode);
+	return FEE_OK;
+}
+
+
+///   --- NEW FEATURE SINCE VERSION 0.8.2b [Char channel] (2007-07-28) --- ///
+
+int publishChar(CharItem* charItem) {
+    unsigned int id;
+    char* serviceName = 0;
+
+    // check for right state
+    if (state != COLLECTING) {
+        return FEE_WRONG_STATE;
+    }
+
+    // Testing for NULL - Pointer
+    // !! Attention: if pointer is not initialized and also NOT set to NULL, this won't help !!
+    if (charItem == 0) {
+#       ifdef __DEBUG
+        printf("Bad charItem, not published\n");
+        fflush(stdout);
+#       endif
+        return FEE_NULLPOINTER;
+    }
+    if (charItem->name == 0 || charItem->user_routine == 0) {
+#       ifdef __DEBUG
+        printf("Bad charItem, not published\n");
+        fflush(stdout);
+#       endif
+        return FEE_NULLPOINTER;
+    }
+
+    // Check name for duplicate here
+    // Check in Float list
+    if (findItem(charItem->name) != 0) {
+#       ifdef __DEBUG
+        printf("Item name already published in float list, char item discarded.\n");
+        fflush(stdout);
+#       endif
+        return FEE_ITEM_NAME_EXISTS;
+    }
+    // Check in INT list
+    if (findIntItem(charItem->name) != 0) {
+#       ifdef __DEBUG
+        printf("Item name already published in int list, char item discarded.\n");
+        fflush(stdout);
+#       endif
+        return FEE_ITEM_NAME_EXISTS;
+    }
+    // Check in CHAR list
+    if (findCharItem(charItem->name) != 0) {
+#       ifdef __DEBUG
+        printf("Item name already published in char list, new char item discarded.\n");
+        fflush(stdout);
+#       endif
+        return FEE_ITEM_NAME_EXISTS;
+    }
+
+    // -- add charItem as service --
+    serviceName = (char*) malloc(serverNameLength + strlen(charItem->name) + 2);
+    if (serviceName == 0) {
+        return FEE_INSUFFICIENT_MEMORY;
+    }
+    // terminate string with '\0'
+    serviceName[sprintf(serviceName, "%s_%s", serverName, charItem->name)] = 0;
+    // add service in DIM
+    id = dis_add_service(serviceName, "C", 0, 0, charItem->user_routine,
+            charItem->tag);
+    free(serviceName);
+
+    // !!! implement add_char_item_node() func !!!
+    add_char_item_node(id, charItem);
+
+    return FEE_OK;
+}
+
+
+CharItem* createCharItem() {
+    CharItem* charItem = 0;
+
+    charItem = (CharItem*) malloc(sizeof(CharItem));
+    if (charItem == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available for CharItem!\n");
+#       endif
+        return 0;
+    }
+    charItem->user_routine = 0;
+    charItem->name = 0;
+    charItem->tag = 0;
+    return charItem;
+}
+
+
+//CharItem* fillCharItem(void* funcPointer, char* itemName, long tag) {
+CharItem* fillCharItem(void (*funcPointer)(long*, int**, int*), char* itemName,
+        long tag) {
+    CharItem* charItem = 0;
+
+    charItem = createCharItem();
+    if (charItem == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available for CharItem!\n");
+#       endif
+        return 0;
+    }
+    charItem->user_routine = funcPointer;
+    charItem->name = (char*) malloc(strlen(itemName) + 1);
+    if (charItem->name == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available!\n");
+#       endif
+        free(charItem);
+        return 0;
+    }
+    strcpy(charItem->name, itemName);
+    charItem->tag = tag;
+    return charItem;
+}
+
+
+void add_char_item_node(unsigned int _id, CharItem* _char_item) {
+    //create new node with enough memory
+    CharItemNode* newNode = 0;
+
+    newNode = (CharItemNode*) malloc(sizeof(CharItemNode));
+    if (newNode == 0) {
+        //no memory available!
+#       ifdef __DEBUG
+        printf("no memory available while adding CharItemNode!\n");
+        fflush(stdout);
+#       endif
+        cleanUp();
+        exit(201);
+    }
+    //initialize "members" of node
+    newNode->prev = 0;
+    newNode->next = 0;
+    newNode->id = _id;
+    newNode->charItem = _char_item;
+
+#	ifdef __DEBUG
+    // complete debug display of added charItem
+/*
+    printf("CharItem ID: %d\n", _id);
+	printf("CharItem name: %s\n", _char_item->name);
+    printf("CharItem user_routine: %p\n", _char_item->user_routine);
+	printf("CharItem tag: %d\n", _char_item->tag);
+*/
+#	endif
+
+#   ifdef __DEBUG
+    // short debug display of added Item
+    printf("init of %s (char) with ID %d; user_routine at: %p\n", 
+			newNode->charItem->name, newNode->id, 
+			newNode->charItem->user_routine);
+    fflush(stdout);
+#   endif
+
+    ++charNodesAmount;
+    //redirect pointers of doubly linked list (char)
+    if (firstCharNode != 0) {
+        lastCharNode->next = newNode;
+        newNode->prev = lastCharNode;
+        lastCharNode = newNode;
+    } else {
+        firstCharNode = newNode;
+        lastCharNode = newNode;
+    }
+}
+
+
+CharItemNode* findCharItem(char* name) {
+//  char msg[70];
+    CharItemNode* current = 0;
+
+    if (name == 0) {
+        return 0;
+    }
+    current = firstCharNode;
+    while (current != 0) {  // is end of list
+        if (strcmp(name, current->charItem->name) == 0) {
+            // success, give back CharItemNode
+            return current;
+        }
+        current = current->next;
+    }
+// since three lists, which are searched seperately don't make log output in
+// findCharItem()-function -> move to where called to combine with other 
+// findXYItem calls
+/*
+    if (state == RUNNING) {
+        msg[sprintf(msg, "Item %s not found in CharItem list.", name)] = 0;
+        createLogMessage(MSG_WARNING, msg, 0);
+#       ifdef __DEBUG
+        printf("Item %s not found in CharItem list.\n", name);
+        fflush(stdout);
+#       endif
+    }
+*/
+    return 0;
+}
+
+
+int deleteCharItemList() {
+    CharItemNode* tmp = 0;
+
+    while (firstCharNode != 0) {
+        if (firstCharNode->charItem != 0) {
+            if (firstCharNode->charItem->name != 0) {
+                free(firstCharNode->charItem->name);
+            }
+            free(firstCharNode->charItem);
+        }
+
+        tmp = firstCharNode->next;
+        free(firstCharNode);
+        firstCharNode = tmp;
+    }
+    return FEE_OK;
+}
+
+
+void initCharItemNode(CharItemNode* charItemNode) {
+    charItemNode->prev = 0;
+    charItemNode->next = 0;
+    charItemNode->id = 0;
+    charItemNode->charItem = 0;
+}
+
+
+void unpublishCharItemList() {
+    CharItemNode* current = 0;
+
+    current = firstCharNode;
+    while (current != 0) {
+        dis_remove_service(current->id);
+        current = current->next;
+    }
+    // pretending CharItemList is completely empty to avoid access
+    // to not existing DIM services. Don't delete charItems, CE might still 
+	// try to access their content (same for float and int lists)
+    charNodesAmount = 0;
+    firstCharNode = 0;
+    lastCharNode = 0;
+}
+
+
+/// -- NEW FEATURE V. 0.9.1 [Set FeeServer Properies in CE] (2007-08-17) -- ///
+
+bool setFeeProperty(FeeProperty* prop) {
+	bool retVal = false;
+	if (state != INITIALIZING) {
+		createLogMessage(MSG_WARNING, 
+				"Trying to change a FeeProperty during wrong FeeServer state, ignoring ...",
+				0);
+#		ifdef __DEBUG
+		printf("Trying to change a FeeProperty during wrong FeeServer state, ignoring ...\n");
+		fflush(stdout);
+#		endif
+		return retVal;
+	}
+
+	if (prop == 0) {
+#       ifdef __DEBUG
+        printf("Received NULL pointer in setting FeeProperty, ignoring...\n");
+		fflush(stdout);
+#		endif
+		// No log message: in "INITIALIZING" state are no DIM channels available
+		return retVal;
+	}
+
+	switch (prop->flag) {
+		case (PROPERTY_UPDATE_RATE):
+            if (prop->uShortVal > 0) {
+                updateRate = prop->uShortVal;
+                retVal = true;
+#               ifdef __DEBUG
+                printf("FeeProperty changed: new update rate (%d).\n", 
+						updateRate);
+                fflush(stdout);
+#               endif
+            } else {
+#               ifdef __DEBUG
+                printf("Received invalid value for setting update rate (%d), ignoring...\n",
+                        prop->uShortVal);
+                fflush(stdout);
+#               endif
+            }
+			break;
+
+		case (PROPERTY_LOGWATCHDOG_TIMEOUT):
+            if (prop->uIntVal > 0) {
+                logWatchDogTimeout = prop->uIntVal;
+                retVal = true;
+#               ifdef __DEBUG
+                printf("FeeProperty changed: new log watchdog timeout (%d).\n",
+						logWatchDogTimeout);
+                fflush(stdout);
+#               endif
+            } else {
+#               ifdef __DEBUG
+                printf("Received invalid value for setting log watchdog timeout (%d), ignoring...\n",
+                        prop->uIntVal);
+                fflush(stdout);
+#               endif
+            }
+			break;
+
+		case (PROPERTY_ISSUE_TIMEOUT):
+			if (prop->uLongVal > 0) {
+                issueTimeout = prop->uLongVal;
+                retVal = true;
+#               ifdef __DEBUG
+                printf("FeeProperty changed: new issue timeout (%ld).\n", 
+						issueTimeout);
+                fflush(stdout);
+#               endif
+            } else {
+#               ifdef __DEBUG
+                printf("Received invalid value for setting issue timeout (%ld), ignoring...\n",
+                        prop->uLongVal);
+                fflush(stdout);
+#               endif
+            }
+			break;
+		
+		case (PROPERTY_LOGLEVEL):
+			if ((prop->uIntVal > 0) && (prop->uIntVal <= MSG_MAX_VAL)) {
+				logLevel = prop->uIntVal | MSG_ALARM;		
+				retVal = true;
+#				ifdef __DEBUG
+				printf("FeeProperty changed: new log level (%d).\n", logLevel);
+				fflush(stdout);
+#				endif
+			} else {
+#				ifdef __DEBUG
+				printf("Received invalid value for setting loglevel (%d), ignoring...\n",
+			    		prop->uIntVal);
+				fflush(stdout);
+#				endif
+			}
+			break;
+
+		default:
+			// unknown property flag, but no logging
+#			ifdef __DEBUG
+			printf("Received unknown flag in setting FeeProperty (%d), ignoring...\n",
+					prop->flag);
+			fflush(stdout);
+#			endif
+	}
+
+	return retVal;
+}
+
+
+/// ***************************************************************************
+/// -- only for the benchmarking cases necessary
+/// ***************************************************************************
+#ifdef __BENCHMARK
+void createBenchmark(char* msg) {
+	// this part is only used for benchmarking
+	// timestamp to benchmark reception of a command
+    struct tm *today;
+	struct timeval tStamp;
+	char benchmark_msg[200];
+	int status = 0;
+	FILE* pFile = 0;
+
+    status = gettimeofday(&tStamp, 0);
+    if (status != 0) {
+	benchmark_msg[sprintf(benchmark_msg,
+                "Unable to get timestamp for benchmark!")] = 0;
+	} else {
+        today = localtime(&(tStamp.tv_sec));
+    	benchmark_msg[sprintf(benchmark_msg,
+				"%s: \t%.8s - %ld us", msg, asctime(today) + 11,
+				tStamp.tv_usec)] = 0;
+	}
+
+	if (getenv("FEE_BENCHMARK_FILENAME")) {
+		pFile = fopen(getenv("FEE_BENCHMARK_FILENAME"), "a+");
+		if (pFile) {
+			fprintf(pFile, benchmark_msg);
+			fprintf(pFile, "\n");
+			fclose(pFile);
+		} else {
+#ifdef __DEBUG
+			printf("Unable to open benchmark file.\n");
+			printf("%s\n", benchmark_msg);
+#endif
+			createLogMessage(MSG_WARNING, "Unable to write to benchmarkfile.", 0);
+		}
+	} else {
+		createLogMessage(MSG_SUCCESS_AUDIT, benchmark_msg, 0);
+	}
+}
+#else
+// empty function
+void createBenchmark(char* msg) {
+}
+#endif
+
+
+
+/// ***************************************************************************
+/// -- only for the debugging cases necessary
+/// ***************************************************************************
+#ifdef __DEBUG
+void printData(char* data, int start, int size) {
+	int i;
+	int iBackUp;
+
+	if ((data == 0) || (size == 0)) {
+		return;
+	}
+	iBackUp = start;
+	for (i = start; (i < size) || (iBackUp < size); ++i) {
+		++iBackUp;
+		printf("%c", data[i]);
+	}
+	printf("\nData - Size: %d", size);
+	printf("\n\n");
+	fflush(stdout);
+}
+#endif
+
+
+//-- only for the testcases necessary
+#ifdef __UTEST
+const int getState() {
+	return state;
+}
+
+const ItemNode* getFirstNode() {
+	return firstNode;
+}
+
+const ItemNode* getLastNode() {
+	return lastNode;
+}
+
+int listSize() {
+	ItemNode* tmp = firstNode;
+	int count = 0;
+
+	while (tmp != 0) {
+		tmp = tmp->next;
+		++count;
+	}
+	return count;
+}
+
+const char* getCmndACK() {
+	return cmndACK;
+}
+
+void setState(int newState) {
+	state = newState;
+}
+
+void setCmndACK(char* newData) {
+	cmndACK = newData;
+}
+
+void setCmndACKSize(int size) {
+	cmndACKSize = size;
+}
+
+void setServerName(char* name) {
+	if (serverName != 0) {
+		free(serverName);
+	}
+	serverName = (char*) malloc(strlen(name) + 1);
+	if (serverName == 0) {
+		printf(" No memory available !\n");
+	}
+	strcpy(serverName, name);
+}
+
+void clearServerName() {
+	if (serverName != 0) {
+		free(serverName);
+	}
+}
+
+void stopServer() {
+	dis_remove_service(serviceACKID);
+	dis_remove_service(commandID);
+	dis_stop_serving();
+}
+
+pthread_cond_t* getInitCondPtr() {
+	return &init_cond;
+}
+
+
+pthread_mutex_t* getWaitInitMutPtr() {
+	return &wait_init_mut;
+}
+
+#endif
+
+
+
+--------------------------------------------------------------------------------
+for assistance refer to the CVS howto. Maintained by Matthias Richter Powered by
+ViewCVS 0.9.2  
Index: /trunk/FACT++/dim_v19r15/src/hash.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/hash.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/hash.c	(revision 10183)
@@ -0,0 +1,39 @@
+#define DIMLIB
+#include <dim.h>
+
+/*
+ * Hash function
+ */
+
+/*
+int HashFunction(name, max)
+char	*name;
+int	max;
+{
+    register int code = 0;
+
+	while(*name)
+	{
+		code += *name++;
+	}
+	return (code % max);
+}
+*/
+int HashFunction(char *name, int max)
+{
+   unsigned int b    = 378551;
+   unsigned int a    = 63689;
+   unsigned int hash = 0;
+   int i    = 0;
+   int len;
+
+   len = strlen(name);
+
+   for(i = 0; i < len; name++, i++)
+   {
+      hash = hash*a+(*name);
+      a = a*b;
+   }
+
+   return (hash % max);
+}
Index: /trunk/FACT++/dim_v19r15/src/open_dns.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/open_dns.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/open_dns.c	(revision 10183)
@@ -0,0 +1,445 @@
+/*
+ * A utility file. 
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+#define DIMLIB
+#include <dim.h>
+
+#define MAX_DNS_NODE 256
+
+typedef struct {
+	char node_name[MAX_NODE_NAME];
+	char task_name[MAX_TASK_NAME];
+	void (*recv_rout)();
+	void (*error_rout)();
+	TIMR_ENT *timr_ent;
+	SRC_TYPES src_type;
+} PENDING_CONN;
+
+typedef struct dns_ent{
+	struct dns_ent *next;
+	struct dns_ent *prev;
+	char node_name[MAX_DNS_NODE];
+	char task_name[MAX_TASK_NAME];
+	int port_number;
+	void (*recv_rout)();
+	void (*error_rout)();
+	TIMR_ENT *timr_ent;
+	SRC_TYPES src_type;
+	int conn_id;
+	int pending;
+	int connecting;
+} DNS_CONN;
+
+static int Timer_q = 0;
+static DNS_CONN *DNS_ids[3] = {0, 0, 0};
+static DNS_CONN *DNS_conn_head = (DNS_CONN *)0;	
+
+
+_DIM_PROTO( void retry_dns_connection,    ( int conn_pend_id ) );
+_DIM_PROTO( void init_dns_list,    (  ) );
+_DIM_PROTO( void set_dns_pars,    ( DNS_CONN *connp, char *node, int port ) );
+_DIM_PROTO( int get_dns_pars,    ( DNS_CONN *connp, char *node, int *port ) );
+
+
+int dim_set_dns_node(char *node)
+{
+	init_dns_list();
+	set_dns_pars(DNS_ids[SRC_DIS], node, 0);
+	set_dns_pars(DNS_ids[SRC_DIC], node, 0);
+	return(1);
+}
+
+int dic_set_dns_node(char *node)
+{
+	init_dns_list();
+	set_dns_pars(DNS_ids[SRC_DIC], node, 0);
+	return(1);
+}
+
+int dis_set_dns_node(char *node)
+{
+	init_dns_list();
+	set_dns_pars(DNS_ids[SRC_DIS], node, 0);
+	return(1);
+}
+
+int dim_get_dns_node(char *node)
+{
+	register int node_exists;
+	int port;
+	init_dns_list();
+	node_exists = get_dns_pars(DNS_ids[SRC_DIS], node, &port);
+	return(node_exists);
+}
+
+int dic_get_dns_node(char *node)
+{
+	register int node_exists;
+	int port;
+	init_dns_list();
+	node_exists = get_dns_pars(DNS_ids[SRC_DIC], node, &port);
+	return(node_exists);
+}
+
+int dis_get_dns_node(char *node)
+{
+	register int node_exists;
+	int port;
+	init_dns_list();
+	node_exists = get_dns_pars(DNS_ids[SRC_DIS], node, &port);
+	return(node_exists);
+}
+
+int dim_set_dns_port(int port)
+{
+	init_dns_list();
+	set_dns_pars(DNS_ids[SRC_DIS], 0, port);
+	set_dns_pars(DNS_ids[SRC_DIC], 0, port);
+	return(1);
+}
+
+int dic_set_dns_port(int port)
+{
+	init_dns_list();
+	set_dns_pars(DNS_ids[SRC_DIC], 0, port);
+	return(1);
+}
+
+int dis_set_dns_port(int port)
+{
+	init_dns_list();
+	set_dns_pars(DNS_ids[SRC_DIS], 0, port);
+	return(1);
+}
+
+int dim_get_dns_port()
+{
+int port;
+char node[MAX_DNS_NODE];
+	init_dns_list();
+	get_dns_pars(DNS_ids[SRC_DIS], node, &port);
+	return(port);
+}
+
+int dic_get_dns_port()
+{
+int port;
+char node[MAX_DNS_NODE];
+	init_dns_list();
+	get_dns_pars(DNS_ids[SRC_DIC], node, &port);
+	return(port);
+}
+
+int dis_get_dns_port()
+{
+int port;
+char node[MAX_DNS_NODE];
+	init_dns_list();
+	get_dns_pars(DNS_ids[SRC_DIS], node, &port);
+	return(port);
+}
+
+int rand_tmout( int min, int max )
+{
+	int aux;
+
+	aux = rand();
+	aux %= (max - min);
+	aux += min;
+	return(aux);
+}
+
+void init_dns_list()
+{
+	char node[MAX_DNS_NODE];
+	int port;
+	long sid, cid;
+
+	DISABLE_AST
+	if(!DNS_conn_head) 
+	{
+		DNS_conn_head = (DNS_CONN *)malloc(sizeof(DNS_CONN));
+		dll_init( (DLL *) DNS_conn_head );
+		node[0] = '\0';
+		get_dns_node_name(node);
+		port = get_dns_port_number();
+		sid = dis_add_dns(node, port);
+		cid = dic_add_dns(node, port);
+		DNS_ids[SRC_DIS] = (DNS_CONN *)sid;
+		DNS_ids[SRC_DIC] = (DNS_CONN *)cid;
+	}
+	ENABLE_AST
+}
+
+void set_dns_pars(DNS_CONN *connp, char *node, int port)
+{
+	if(node != 0)
+	{
+		strcpy(connp->node_name, node);
+	}
+	if(port != 0)
+	{
+		connp->port_number = port;
+	}
+}
+
+int get_dns_pars(DNS_CONN *connp, char *node, int *port)
+{
+	int exists = 0;
+
+	if(connp->node_name[0])
+	{
+		strcpy(node, connp->node_name);
+		exists = 1;
+	}
+	*port = connp->port_number;
+	return exists;
+}
+
+DNS_CONN *find_dns(char *node_name, int port_number, SRC_TYPES src_type)
+{
+	DNS_CONN *connp;
+
+	connp = DNS_conn_head;
+	while( (connp = (DNS_CONN *)dll_get_next( (DLL *) DNS_conn_head, 
+			(DLL*) connp)) )
+	{
+		if(connp->src_type == src_type)
+		{
+			if((!strcmp(connp->node_name, node_name)) &&
+				(connp->port_number == port_number))
+				return connp;
+		}
+	}
+	return (DNS_CONN *)0;
+}
+
+long dis_add_dns(char *node_name, int port_number)
+{
+	DNS_CONN *connp;
+
+	init_dns_list();
+	if(!(connp = find_dns(node_name, port_number, SRC_DIS)))
+	{
+		connp = (DNS_CONN *)malloc(sizeof(DNS_CONN));
+		strcpy(connp->node_name, node_name);
+		connp->port_number = DNS_PORT;
+		if(port_number != 0)
+			connp->port_number = port_number;
+		connp->src_type = SRC_DIS;
+		connp->pending = 0;
+		connp->conn_id = 0;
+		connp->connecting = 0;
+		dll_insert_queue( (DLL *) DNS_conn_head, (DLL *) connp );
+	}
+	return (long)connp;
+}
+
+long dic_add_dns(char *node_name, int port_number)
+{
+	DNS_CONN *connp;
+
+	init_dns_list();
+	if(!(connp = find_dns(node_name, port_number, SRC_DIC)))
+	{
+		connp = (DNS_CONN *)malloc(sizeof(DNS_CONN));
+		strcpy(connp->node_name, node_name);
+		connp->port_number = DNS_PORT;
+		if(port_number != 0)
+			connp->port_number = port_number;
+		connp->src_type = SRC_DIC;
+		connp->pending = 0;
+		connp->conn_id = 0;
+		connp->connecting = 0;
+		dll_insert_queue( (DLL *) DNS_conn_head, (DLL *) connp );
+	}
+	return (long)connp;
+}
+
+DNS_CONN *get_dns(DNS_CONN *connp, SRC_TYPES src_type)
+{
+	DNS_CONN *p = 0;
+
+	init_dns_list();
+	if(connp)
+	{
+		if(connp->src_type == src_type)
+		{
+			p = connp;
+		}
+	}
+	else
+	{
+		p = DNS_ids[src_type];
+	}
+	return p;
+}
+
+int close_dns(long dnsid, SRC_TYPES src_type)
+{
+	DNS_CONN *connp;
+
+	connp = get_dns((DNS_CONN *)dnsid, src_type);
+	if( !Timer_q )
+		Timer_q = dtq_create();
+	if( connp->pending ) 
+	{
+		connp->pending = 0;
+		dtq_rem_entry( Timer_q, connp->timr_ent );
+	}
+	return 1;
+}
+
+int open_dns(long dnsid, void (*recv_rout)(), void (*error_rout)(), int tmout_min, int tmout_max, SRC_TYPES src_type )
+{
+	char nodes[MAX_DNS_NODE];
+	char node_info[MAX_NODE_NAME+4];
+	register char *dns_node, *ptr; 
+	register int conn_id;
+	register int timeout, node_exists;
+	int i, dns_port;
+	int rand_tmout();
+	DNS_CONN *connp;
+
+	conn_id = 0;
+	if( !Timer_q )
+		Timer_q = dtq_create();
+
+	connp = get_dns((DNS_CONN *)dnsid, src_type);
+	node_exists = get_dns_pars(connp, nodes, &dns_port);
+	if( !(connp->pending) ) 
+	{
+		if(!node_exists)
+		{
+			return(-2);
+		}
+		ptr = nodes;			
+		while(1)
+		{
+			dns_node = ptr;
+			if( (ptr = (char *)strchr(ptr,',')) )
+			{
+				*ptr = '\0';			
+				ptr++;
+			}
+			strcpy(node_info,dns_node);
+			for(i = 0; i < 4; i ++)
+				node_info[strlen(node_info)+i+1] = (char)0xff;
+			connp->conn_id = 0;
+			connp->connecting = 1;
+			conn_id = dna_open_client( node_info, DNS_TASK, dns_port,
+						 TCPIP, recv_rout, error_rout, src_type );
+			connp->connecting = 0;
+			if(conn_id)
+				break;
+			if( !ptr )
+				break;
+		}
+		connp->conn_id = conn_id;
+		if(!conn_id)
+		{
+			strncpy(connp->task_name, DNS_TASK, MAX_TASK_NAME); 
+			connp->recv_rout = recv_rout;
+			connp->error_rout = error_rout;
+			connp->pending = 1;
+			timeout = rand_tmout( tmout_min, tmout_max );
+			connp->timr_ent = dtq_add_entry( Timer_q, timeout,
+				retry_dns_connection,
+				connp );
+			return( -1);
+		}
+	}
+	else
+		return(-1);
+	return(conn_id);
+}
+
+void retry_dns_connection( DNS_CONN *connp )
+{
+	char nodes[MAX_DNS_NODE];
+	char node_info[MAX_NODE_NAME+4];
+	register char *dns_node, *ptr;
+	register int conn_id, node_exists;
+	static int retrying = 0;
+	int i, dns_port;
+
+	if( retrying ) return;
+	retrying = 1;
+
+	conn_id = 0;
+	node_exists = get_dns_pars(connp, nodes, &dns_port);
+	if(node_exists)
+	{
+		ptr = nodes;			
+		while(1)
+		{
+			dns_node = ptr;
+			if( (ptr = (char *)strchr(ptr,',')) )
+			{
+				*ptr = '\0';			
+				ptr++;
+			}
+			strcpy(node_info,dns_node);
+			for(i = 0; i < 4; i ++)
+				node_info[strlen(node_info)+i+1] = (char)0xff;
+			connp->conn_id = 0;
+			connp->connecting = 1;
+			conn_id = dna_open_client( node_info, connp->task_name,
+					 dns_port, TCPIP,
+					 connp->recv_rout, connp->error_rout, connp->src_type );
+			connp->connecting = 0;
+			if( conn_id )
+				break;
+			if( !ptr )
+				break;
+		}
+	}
+	connp->conn_id = conn_id;
+	if(conn_id)
+	{
+		connp->pending = 0;
+		dtq_rem_entry( Timer_q, connp->timr_ent );
+	}
+	retrying = 0;
+}	
+
+long dns_get_dnsid(int conn_id, SRC_TYPES src_type)
+{
+	DNS_CONN *connp;
+	int found = 0;
+
+	connp = DNS_conn_head;
+	while( (connp = (DNS_CONN *)dll_get_next( (DLL *) DNS_conn_head, 
+			(DLL*) connp)) )
+	{
+		if(connp->conn_id == conn_id)
+		{
+			found = 1;
+			break;
+		}
+		else if((connp->conn_id == 0) && (connp->connecting))
+		{
+			connp->conn_id = conn_id;
+			found = 1;
+			break;
+		}
+	}
+	if(found)
+	{
+		if(connp == DNS_ids[src_type])
+		{
+			return (long)0;
+		}
+		else
+		{
+			return (long)connp;
+		}
+	}
+	return (long)-1;
+}
Index: /trunk/FACT++/dim_v19r15/src/sll.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/sll.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/sll.c	(revision 10183)
@@ -0,0 +1,135 @@
+/*
+ * A utility file. A single linked list.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+#define DIMLIB
+#include <dim.h>
+
+
+void sll_init( SLL* head )
+{
+	head->next = (SLL *)0;
+}
+
+
+int sll_insert_queue( SLL* head, SLL* item )
+{
+	SLL *auxp;
+
+	DISABLE_AST
+	auxp = head;
+	while( auxp->next )
+		auxp = auxp->next;
+	auxp->next = item;
+	item->next = 0;
+	ENABLE_AST
+	return(1);
+}
+
+
+SLL *sll_search( SLL* head, char *data, int size )
+{
+	DISABLE_AST
+	while( (head = head->next) )
+	{
+		if( !memcmp(head->user_info, data, size) )
+		{
+			break;
+		}
+	}
+	ENABLE_AST
+	return(head);
+}
+
+
+SLL *sll_get_next(SLL* item)
+{
+	DISABLE_AST
+	if( item )
+		item = item->next;
+	ENABLE_AST
+	return(item);
+}
+
+
+int sll_empty( SLL* head )
+{
+	register int ret;
+ 
+	DISABLE_AST
+	if(head->next)
+		ret = 0;
+	else
+		ret = 1;
+	ENABLE_AST
+	return(ret);
+}
+
+
+int sll_remove( SLL* head, SLL* item )
+{
+	register int ret = 0;
+
+	DISABLE_AST
+	while( head->next )
+	{
+		if( head->next == item )
+		{
+			head->next = item->next;
+			ret = 1;
+			break;
+		}
+		head = head->next;
+	}
+	ENABLE_AST
+	return(ret);
+}	
+
+
+SLL *sll_remove_head( SLL* head ) 
+{
+	register SLL *auxp;
+
+	DISABLE_AST
+	if( (auxp = head->next) )
+	{
+		head->next = auxp->next;
+	}
+	ENABLE_AST
+	return(auxp);
+}
+
+SLL *sll_get_head( SLL* head ) 
+{
+	register SLL *auxp;
+
+	DISABLE_AST
+	auxp = head->next;
+	ENABLE_AST
+	return(auxp);
+}
+
+
+SLL *sll_search_next_remove( SLL* item, int offset, char *data, int size )
+{
+	register SLL *auxp;
+ 
+	DISABLE_AST
+	while( (auxp = item->next) )
+	{
+		if( !memcmp(&(auxp->user_info[offset]), data, size) )
+		{
+			item->next = auxp->next;
+			break;
+		}
+		item = auxp;
+	}
+	ENABLE_AST
+	return(auxp);
+}
+
Index: /trunk/FACT++/dim_v19r15/src/swap.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/swap.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/swap.c	(revision 10183)
@@ -0,0 +1,165 @@
+/*
+ *  (Delphi Network Access) implements the network layer for the DIM
+ * (Delphi Information Managment) System.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+double _swapd( double d )
+{
+	double	r[2];
+	register char	*p, *q;
+	register int 	n;
+
+	p = (char *) &r[1];
+	q = (char *) &d;
+	for( n = sizeof(double)+1; --n; *--p = *q++) ;
+	return r[0];
+}
+
+int _swapl( int l )
+{
+	int	r[2];
+	register char	*p, *q;
+
+	p = (char *) &r[1];
+	q = (char *) &l;
+	*--p = *q++;
+	*--p = *q++;
+	*--p = *q++;
+	*--p = *q++;
+
+	return r[0];
+}
+
+short _swaps( short s )
+{
+	short	r[2];
+	register char	*p, *q;
+
+	p = (char *) &r[1];
+	q = (char *) &s;
+	*--p = *q++;
+	*--p = *q++;
+
+	return r[0];
+}
+
+double _swapd_by_addr( double *d )
+{
+	double	r[2];
+	register char	*p, *q;
+	register int 	n;
+
+	p = (char *) &r[1];
+	q = (char *) d;
+	for( n = sizeof(double)+1; --n; *--p = *q++) ;
+
+	return r[0];
+}
+
+int _swapl_by_addr( int *l )
+{
+	int	r[2];
+	register char	*p, *q;
+
+	p = (char *) &r[1];
+	q = (char *) l;
+	*--p = *q++;
+	*--p = *q++;
+	*--p = *q++;
+	*--p = *q++;
+
+	return r[0];
+}
+
+short _swaps_by_addr( short *s )
+{
+	short	r[2];
+	register char	*p, *q;
+
+	p = (char *) &r[1];
+	q = (char *) s;
+	*--p = *q++;
+	*--p = *q++;
+
+	return r[0];
+}
+
+void _swaps_buffer( short *s2, short *s1, int n)
+{
+	register char *p, *q;
+	short r[2];
+	register short *s;
+
+	p = (char *) s2;
+	q = (char *) s1;
+	if( p != q ) {
+		p += sizeof(short);
+		for( n++; --n; p += 2*sizeof(short)) {
+			*--p = *q++;
+			*--p = *q++;
+		}
+	} else {
+		for( s = s2, n++; --n; *s++ = r[0]) {
+			p = (char *) &r[1] ;
+			*--p = *q++;
+			*--p = *q++;
+		}
+	}
+}
+
+void _swapl_buffer( int *s2, int *s1, int n)
+{
+	register char *p, *q;
+	int r[2];
+	register int *l;
+
+	p = (char *) s2;
+	q = (char *) s1;
+	if( p != q ) {
+		p += sizeof(int);
+		for( n++; --n; p += 2*sizeof(int)) {
+			*--p = *q++;
+			*--p = *q++;
+			*--p = *q++;
+			*--p = *q++;
+		}
+	} else {
+		for( l = s2, n++; --n; *l++ = r[0]) {
+			p = (char *) &r[1] ;
+			*--p = *q++;
+			*--p = *q++;
+			*--p = *q++;
+			*--p = *q++;
+		}
+	}
+}
+
+
+void _swapd_buffer( double *s2, double *s1, int n)
+{
+	register char *p, *q;
+	double r[2];
+	register double *d;
+	register int m;
+
+	p = (char *) s2;
+	q = (char *) s1;
+	if( p != q ) {
+		p += sizeof(double);
+		for( n++; --n; p += 2*sizeof(double)) {
+			for( m = sizeof(double)+1; --m; *--p = *q++) ;
+		}
+	} else {
+		for( d = s2, n++; --n; *d++ = r[0]) {
+			p = (char *) &r[1] ;
+			for( m = sizeof(double)+1; --m; *--p = *q++) ;
+		}
+	}
+}
+
+
Index: /trunk/FACT++/dim_v19r15/src/tcpip.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/tcpip.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/tcpip.c	(revision 10183)
@@ -0,0 +1,1622 @@
+/*
+ * DNA (Delphi Network Access) implements the network layer for the DIM
+ * (Delphi Information Managment) System.
+ *
+ * Started           : 10-11-91
+ * Last modification : 29-07-94
+ * Written by        : C. Gaspar
+ * Adjusted by       : G.C. Ballintijn
+ *
+ */
+
+/*
+#define DEBUG
+*/
+
+/* Modifies the number of open connections to 8192 for Windows and Linux */
+/* Can not be moved from here ! */
+#include <dim_tcpip.h>
+
+#ifdef WIN32
+#define ioctl ioctlsocket
+
+#define closesock myclosesocket
+#define readsock recv
+#define writesock send
+
+#define EINTR WSAEINTR
+#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define ECONNREFUSED WSAECONNREFUSED
+#define HOST_NOT_FOUND	WSAHOST_NOT_FOUND
+#define NO_DATA	WSANO_DATA
+
+#else
+/*
+#define closesock(s) shutdown(s,2);
+*/
+#define closesock close
+#define readsock(a,b,c,d) read(a,b,c)
+
+#if defined(__linux__) && !defined (darwin)
+#define writesock(a,b,c,d) send(a,b,c,MSG_NOSIGNAL)
+#else
+#define writesock(a,b,c,d) write(a,b,c)
+#endif
+
+#ifdef solaris
+#define BSD_COMP
+/*
+#include <thread.h>
+*/
+#endif
+
+#ifdef LYNXOS
+#ifdef RAID
+typedef int pid_t;
+#endif
+#endif
+
+#include <ctype.h>
+#include <sys/socket.h>
+#include <fcntl.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <signal.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <netdb.h>
+#endif
+
+#include <stdio.h>
+#include <time.h>
+#define DIMLIB
+#include <dim.h>
+
+#define ushort unsigned short
+
+static int Threads_on = 0;
+
+static int init_done = FALSE;		/* Is this module initialized? */
+static int	queue_id = 0;
+
+#ifdef WIN32
+static struct sockaddr_in DIM_sockname;
+#endif
+
+static int DIM_IO_path[2] = {-1,-1};
+static int DIM_IO_Done = 0;
+static int DIM_IO_valid = 1;
+
+static int Write_timeout = 5;
+static int Write_buffer_size = TCP_SND_BUF_SIZE;
+static int Read_buffer_size = TCP_RCV_BUF_SIZE;
+
+int Tcpip_max_io_data_write = TCP_SND_BUF_SIZE - 16;
+int Tcpip_max_io_data_read = TCP_RCV_BUF_SIZE - 16;
+
+void dim_set_write_timeout(int secs)
+{
+  Write_timeout = secs;
+}
+
+int dim_get_write_timeout()
+{
+  return(Write_timeout);
+}
+
+int dim_set_write_buffer_size(int size)
+{
+	if(size >= TCP_SND_BUF_SIZE)
+	{
+		Write_buffer_size = size;
+		Tcpip_max_io_data_write = size - 16;
+		return(1);
+	}
+	return(0);
+}
+
+int dim_get_write_buffer_size()
+{
+	return(Write_buffer_size);
+}
+
+int dim_set_read_buffer_size(int size)
+{
+	if(size >= TCP_RCV_BUF_SIZE)
+	{
+		Read_buffer_size = size;
+		Tcpip_max_io_data_read = size - 16;
+		return(1);
+	}
+	return(0);
+}
+
+int dim_get_read_buffer_size()
+{
+	return(Read_buffer_size);
+}
+
+#ifdef WIN32
+int init_sock()
+{
+	WORD wVersionRequested;
+	WSADATA wsaData;
+	int err;
+	static int sock_init_done = 0;
+
+	if(sock_init_done) return(1);
+ 	wVersionRequested = MAKEWORD( 2, 0 );
+	err = WSAStartup( wVersionRequested, &wsaData );
+
+	if ( err != 0 ) 
+	{
+    	return(0);
+	}
+
+	/* Confirm that the WinSock DLL supports 2.0.*/
+	/* Note that if the DLL supports versions greater    */
+	/* than 2.0 in addition to 2.0, it will still return */
+	/* 2.0 in wVersion since that is the version we      */
+	/* requested.                                        */
+
+	if ( LOBYTE( wsaData.wVersion ) != 2 ||
+        HIBYTE( wsaData.wVersion ) != 0 ) 
+	{
+	    WSACleanup( );
+    	return(0); 
+	}
+	sock_init_done = 1;
+	return(1);
+}
+
+int myclosesocket(int path)
+{
+	int code, ret;
+	code = WSAGetLastError();
+	ret = closesocket(path);
+	WSASetLastError(code);
+	return ret;
+}
+#endif
+
+int dim_tcpip_init(int thr_flag)
+{
+#ifdef WIN32
+	int addr, flags = 1;
+/*
+    void tcpip_task();
+*/
+	void create_io_thread(void);
+#else
+	struct sigaction sig_info;
+	sigset_t set;
+	void io_sig_handler();
+	void dummy_io_sig_handler();
+	void tcpip_pipe_sig_handler();
+#endif
+
+	if(init_done) return(1);
+#ifdef WIN32
+	init_sock();
+	Threads_on = 1;
+#else
+	if(thr_flag)
+	{
+		Threads_on = 1;
+	}
+	else
+	{
+		sigemptyset(&set);
+
+		sigaddset(&set,SIGALRM);
+	    sig_info.sa_handler = io_sig_handler;
+	    sig_info.sa_mask = set;
+#ifndef LYNXOS
+	    sig_info.sa_flags = SA_RESTART;
+#else
+	    sig_info.sa_flags = 0;
+#endif
+  
+		if( sigaction(SIGIO, &sig_info, 0) < 0 ) 
+		{
+			perror( "sigaction(SIGIO)" );
+			exit(1);
+		}
+	      
+	    sigemptyset(&set);
+	    sig_info.sa_handler = tcpip_pipe_sig_handler;
+	    sig_info.sa_mask = set;
+#ifndef LYNXOS 
+	    sig_info.sa_flags = SA_RESTART;
+#else
+	    sig_info.sa_flags = 0;
+#endif
+
+	    if( sigaction(SIGPIPE, &sig_info, 0) < 0 ) {
+			perror( "sigaction(SIGPIPE)" );
+			exit(1);
+	    }
+	  
+	}
+#endif
+	if(Threads_on)
+	{
+#ifdef WIN32
+		if(DIM_IO_path[0] == -1)
+		{
+			if( (DIM_IO_path[0] = socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 
+			{
+				perror("socket");
+				return(0);
+			}
+		
+			DIM_sockname.sin_family = PF_INET;
+			addr = 0;
+			DIM_sockname.sin_addr = *((struct in_addr *) &addr);
+			DIM_sockname.sin_port = htons((ushort) 2000); 
+			ioctl(DIM_IO_path[0], FIONBIO, &flags);
+		}
+#else
+		if(DIM_IO_path[0] == -1)
+		{
+			pipe(DIM_IO_path);
+		}
+#endif
+	}
+	if(!queue_id)
+		queue_id = dtq_create();
+
+#ifdef WIN32
+/*
+#ifndef STDCALL
+	tid = _beginthread((void *)(void *)tcpip_task,0,NULL);
+#else
+	tid = _beginthreadex(NULL, NULL,
+			tcpip_task,0,0,NULL);
+#endif
+*/
+	create_io_thread();
+#endif
+	init_done = 1;
+	return(1);
+}
+
+void dim_tcpip_stop()
+{
+#ifdef WIN32
+	closesock(DIM_IO_path[0]);
+#else
+	close(DIM_IO_path[0]);
+	close(DIM_IO_path[1]);
+#endif
+	DIM_IO_path[0] = -1;
+	DIM_IO_path[1] = -1;
+	DIM_IO_Done = 0;
+	init_done = 0;
+}
+
+static int enable_sig(int conn_id)
+{
+	int ret = 1, flags = 1;
+#ifndef WIN32
+	int pid;
+#endif
+
+#ifdef DEBUG
+	if(!Net_conns[conn_id].channel)
+	{
+	    printf("Enabling signals on channel 0\n");
+	    fflush(stdout);
+	}
+#endif
+
+	if(!init_done)
+	{
+		dim_tcpip_init(0);
+	}
+	if(Threads_on)
+	{
+#ifdef WIN32
+		DIM_IO_valid = 0;
+/*
+		ret = connect(DIM_IO_path[0], (struct sockaddr*)&DIM_sockname, sizeof(DIM_sockname));
+*/
+		closesock(DIM_IO_path[0]);
+		DIM_IO_path[0] = -1;
+		if( (DIM_IO_path[0] = socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 
+		{
+			perror("socket");
+			return(1);
+		}		
+		ret = ioctl(DIM_IO_path[0], FIONBIO, &flags);
+		if(ret != 0)
+		{
+			perror("ioctlsocket");
+		}
+		DIM_IO_valid = 1;
+#else
+		if(DIM_IO_path[1] != -1)
+		{
+			if(!DIM_IO_Done)
+			{
+				DIM_IO_Done = 1;
+				write(DIM_IO_path[1], &flags, 4);
+			}
+		}
+#endif
+	}
+#ifndef WIN32
+	if(!Threads_on)
+	{
+	    pid = getpid();
+
+#ifndef __linux__
+		ret = ioctl(Net_conns[conn_id].channel, SIOCSPGRP, &pid );
+#else
+	    ret = fcntl(Net_conns[conn_id].channel,F_SETOWN, pid);
+#endif
+	    if(ret == -1)
+	    {
+#ifdef DEBUG
+	        printf("ioctl returned -1\n");
+#endif
+			return(ret);
+	    }
+	}
+	ret = ioctl(Net_conns[conn_id].channel, FIOASYNC, &flags );
+	if(ret == -1)
+	{
+#ifdef DEBUG
+		printf("ioctl1 returned -1\n");
+#endif
+		return(ret);
+	}
+	
+    flags = fcntl(Net_conns[conn_id].channel,F_GETFD,0);
+#ifdef DEBUG
+    if(flags == -1)
+    {
+		printf("error\n");
+    }
+#endif
+    ret = fcntl(Net_conns[conn_id].channel,F_SETFD, flags | FD_CLOEXEC );
+    if(ret == -1)
+    {
+#ifdef DEBUG
+		printf("ioctl2 returned -1\n");
+#endif
+		return(ret);
+    }
+#endif
+	return(1);
+}
+
+/*
+static void dump_list()
+{
+	int	i;
+
+	for( i = 1; i < Curr_N_Conns; i++ )
+		if( Dna_conns[i].busy ) {
+			printf( "dump_list: conn_id=%d reading=%d\n",
+				i, Net_conns[i].reading );
+		}
+}
+*/
+
+static int list_to_fds( fd_set *fds )
+{
+	int	i;
+	int found = 0;
+
+	FD_ZERO( fds ) ;
+	for( i = 1; i < Curr_N_Conns; i++ )
+    {
+		if( Dna_conns[i].busy )
+		{
+			if(Net_conns[i].channel)
+			{
+				found = 1;
+				FD_SET( Net_conns[i].channel, fds );
+
+			}
+		}
+	}
+	return(found);
+}
+
+static int fds_get_entry( fd_set *fds, int *conn_id ) 
+{
+	int	i;
+
+	for( i = 1; i < Curr_N_Conns; i++ )
+	{
+		if( Dna_conns[i].busy &&
+		    FD_ISSET(Net_conns[i].channel, fds) )
+		{
+			if(Net_conns[i].channel)
+		    {
+				*conn_id = i;
+				return 1;
+			}
+		}
+	}
+	return 0;
+}
+
+#if defined(__linux__) && !defined (darwin)
+
+void tcpip_set_keepalive( int channel, int tmout )
+{
+   int val;
+
+   /* Enable keepalive for the given channel */
+   val = 1;
+   setsockopt(channel, SOL_SOCKET, SO_KEEPALIVE, (char*)&val, sizeof(val));
+
+   /* Set the keepalive poll interval to something small.
+      Warning: this section may not be portable! */
+   val = tmout;
+   setsockopt(channel, IPPROTO_TCP, TCP_KEEPIDLE, (char*)&val, sizeof(val));
+   val = 3;
+   setsockopt(channel, IPPROTO_TCP, TCP_KEEPCNT, (char*)&val, sizeof(val));
+   val = 2;
+   setsockopt(channel, IPPROTO_TCP, TCP_KEEPINTVL, (char*)&val, sizeof(val));
+}
+
+#else
+
+static void tcpip_test_write( int conn_id )
+{
+	/* Write to every socket we use, which uses the TCPIP protocol,
+	 * which has an established connection (reading), which is currently
+	 * not writing data, so we can check if it is still alive.
+	 */
+	time_t cur_time;
+	
+	if(strcmp(Net_conns[conn_id].node,"MYNODE"))
+	{
+		cur_time = time(NULL);
+		if( cur_time - Net_conns[conn_id].last_used > Net_conns[conn_id].timeout )
+		{
+			dna_test_write( conn_id );
+		}
+	}
+}
+
+#endif
+
+void tcpip_set_test_write(int conn_id, int timeout)
+{
+#if defined(__linux__) && !defined (darwin)
+	tcpip_set_keepalive(Net_conns[conn_id].channel, timeout);
+#else
+	Net_conns[conn_id].timr_ent = dtq_add_entry( queue_id, timeout, 
+		tcpip_test_write, conn_id );
+	Net_conns[conn_id].timeout = timeout;
+	Net_conns[conn_id].last_used = time(NULL);
+#endif
+}
+
+void tcpip_rem_test_write(int conn_id)
+{
+	if(Net_conns[conn_id].timr_ent)
+	{
+		dtq_rem_entry(queue_id, Net_conns[conn_id].timr_ent);
+		Net_conns[conn_id].timr_ent = NULL;
+	}
+	Net_conns[conn_id].last_used = time(NULL);
+}
+
+void tcpip_pipe_sig_handler( int num )
+{
+	if(num){}
+/*
+	printf( "*** pipe_sig_handler called ***\n" );
+*/
+}
+
+static int get_bytes_to_read(int conn_id)
+{
+	int i, ret, count;
+	
+	for(i = 0; i < 3; i++)
+	{
+		ret = ioctl( Net_conns[conn_id].channel, FIONREAD, &count );
+	    if( ret != 0)
+		{
+			count = 0;
+			break;
+	    }
+	    if(count > 0)
+	    {
+			break;
+	    }
+	}
+	return(count);
+}
+
+static int do_read( int conn_id )
+{
+	/* There is 'data' pending, read it.
+	 */
+	int	len, totlen, size, count;
+	char	*p;
+
+	count = get_bytes_to_read(conn_id);
+	if(!count)
+	{
+/*
+		dna_report_error(conn_id, -1,
+			"Connection closed by remote peer", DIM_ERROR, DIMTCPRDERR);
+		printf("conn_id %d\n", conn_id);
+*/
+		Net_conns[conn_id].read_rout( conn_id, -1, 0 );
+		return 0;
+	}
+
+	size = Net_conns[conn_id].size;
+	p = Net_conns[conn_id].buffer;
+	totlen = 0;
+/*
+	count = 1;
+*/
+	while( size > 0 && count > 0 )
+	{
+/*
+		would this be better? not sure afterwards...
+		nbytes = (size < count) ? size : count;
+		if( (len = readsock(Net_conns[conn_id].channel, p, nbytes, 0)) <= 0 ) 
+*/
+		if( (len = readsock(Net_conns[conn_id].channel, p, size, 0)) <= 0 ) 
+		{	/* Connection closed by other side. */
+			Net_conns[conn_id].read_rout( conn_id, -1, 0 );
+			return 0;
+		} 
+		else 
+		{
+			
+			/*
+			printf("tcpip: read %d bytes:\n",len); 
+			printf( "buffer[0]=%d\n", vtohl((int *)p[0]));
+			printf( "buffer[1]=%d\n", vtohl((int *)p[1]));
+			printf( "buffer[2]=%x\n", vtohl((int *)p[2]));
+			*/
+			totlen += len;
+			size -= len;
+			p += len;
+		}
+		if(size)
+			count = get_bytes_to_read(conn_id);
+	}
+
+	Net_conns[conn_id].last_used = time(NULL);
+	Net_conns[conn_id].read_rout( conn_id, 1, totlen );
+	return 1;
+}
+
+
+void do_accept( int conn_id )
+{
+	/* There is a 'connect' pending, serve it.
+	 */
+	struct sockaddr_in	other;
+	int			othersize;
+
+	othersize = sizeof(other);
+	memset( (char *) &other, 0, othersize );
+	Net_conns[conn_id].mbx_channel = accept( Net_conns[conn_id].channel,
+						 (struct sockaddr*)&other, (unsigned int *)&othersize );
+	if( Net_conns[conn_id].mbx_channel < 0 ) 
+	{
+		return;
+	}
+/*
+	else
+	{
+			int all, a, b, c, d;
+			char *pall;
+
+			all = other.sin_addr.s_addr;
+			pall = &all;
+			a = pall[0];
+			a &= 0x000000ff;
+			b = pall[1];
+			b &= 0x000000ff;
+			c = pall[2];
+			c &= 0x000000ff;
+			d = pall[3];
+			d &= 0x000000ff;
+printf("TCPIP got %d.%d.%d.%d \n",
+		a,b,c,d);
+		if((a == 134) && (b == 79) && (c == 157) && (d == 40))
+		{
+			closesock(Net_conns[conn_id].mbx_channel);
+			return;
+		}
+	}
+*/
+
+	Net_conns[conn_id].last_used = time(NULL);
+	Net_conns[conn_id].read_rout( Net_conns[conn_id].mbx_channel,
+				      conn_id, TCPIP );
+}
+
+void io_sig_handler(int num)
+{
+    fd_set	rfds;
+    int	conn_id, ret, selret, count;
+	struct timeval	timeout;
+
+	if(num){}
+	do
+	{
+		timeout.tv_sec = 0;		/* Don't wait, just poll */
+		timeout.tv_usec = 0;
+		list_to_fds( &rfds );
+		selret = select(FD_SETSIZE, &rfds, NULL, NULL, &timeout);
+		if(selret > 0)
+		{
+			while( (ret = fds_get_entry( &rfds, &conn_id )) > 0 ) 
+			{
+				if( Net_conns[conn_id].reading )
+				{
+					count = 0;
+					do
+					{
+						if(Net_conns[conn_id].channel)
+						{
+							do_read( conn_id );
+							count = get_bytes_to_read(conn_id);
+						}
+						else
+						{
+							count = 0;
+						}
+					}while(count > 0 );
+				}
+				else
+				{
+					do_accept( conn_id );
+				}
+				FD_CLR( (unsigned)Net_conns[conn_id].channel, &rfds );
+	    	}
+		}
+	}while(selret > 0);
+}
+
+void tcpip_task( void *dummy)
+{
+	/* wait for an IO signal, find out what is happening and
+	 * call the right routine to handle the situation.
+	 */
+	fd_set	rfds, efds, *pfds;
+	int	conn_id, ret, count;
+#ifndef WIN32
+	int data;
+#endif
+	if(dummy){}
+	while(1)
+	{
+		while(!DIM_IO_valid)
+			dim_usleep(1000);
+
+		list_to_fds( &rfds );
+		FD_ZERO(&efds);
+#ifdef WIN32
+		pfds = &efds;
+#else
+		pfds = &rfds;
+#endif
+		FD_SET( DIM_IO_path[0], pfds );
+		ret = select(FD_SETSIZE, &rfds, NULL, &efds, NULL);
+		if(ret > 0)
+		{
+			if(FD_ISSET(DIM_IO_path[0], pfds) )
+			{
+#ifndef WIN32
+				read(DIM_IO_path[0], &data, 4);
+				DIM_IO_Done = 0;
+#endif
+				FD_CLR( (unsigned)DIM_IO_path[0], pfds );
+			}
+/*
+			{
+			DISABLE_AST
+*/
+			while( (ret = fds_get_entry( &rfds, &conn_id )) > 0 ) 
+			{
+				if( Net_conns[conn_id].reading )
+				{
+					count = 0;
+					do
+					{
+						DISABLE_AST
+						if(Net_conns[conn_id].channel)
+						{
+							do_read( conn_id );
+							count = get_bytes_to_read(conn_id);
+						}
+						else
+						{
+							count = 0;
+						}
+						ENABLE_AST
+					}while(count > 0 );
+				}
+				else
+				{
+					DISABLE_AST
+					do_accept( conn_id );
+					ENABLE_AST
+				}
+				FD_CLR( (unsigned)Net_conns[conn_id].channel, &rfds );
+			}
+/*
+			ENABLE_AST
+			}
+*/
+#ifndef WIN32
+			return;
+#endif
+		}
+	}
+}
+
+int tcpip_start_read( int conn_id, char *buffer, int size, void (*ast_routine)() )
+{
+	/* Install signal handler stuff on the socket, and record
+	 * some necessary information: we are reading, and want size
+	 * as size, and use buffer.
+	 */
+
+	Net_conns[conn_id].read_rout = ast_routine;
+	Net_conns[conn_id].buffer = buffer;
+	Net_conns[conn_id].size = size;
+	if(Net_conns[conn_id].reading == -1)
+	{
+		if(enable_sig( conn_id ) == -1)
+		{
+#ifdef DEBUG
+			printf("START_READ - enable_sig returned -1\n");
+#endif
+			return(0);
+		}
+	}
+	Net_conns[conn_id].reading = TRUE;
+	return(1);
+}
+
+int check_node_addr( char *node, unsigned char *ipaddr)
+{
+unsigned char *ptr;
+int ret;
+
+	ptr = (unsigned char *)node+strlen(node)+1;
+    ipaddr[0] = *ptr++;
+    ipaddr[1] = *ptr++;
+    ipaddr[2] = *ptr++;
+    ipaddr[3] = *ptr++;
+	if( (ipaddr[0] == 0xff) &&
+		(ipaddr[1] == 0xff) &&
+		(ipaddr[2] == 0xff) &&
+		(ipaddr[3] == 0xff) )
+	{
+		errno = ECONNREFUSED;	/* fake an error code */
+#ifdef WIN32
+		WSASetLastError(errno);
+#endif
+		return(0);
+	}
+	if( gethostbyaddr(ipaddr, sizeof(ipaddr), AF_INET) == (struct hostent *)0 )
+	{
+#ifndef WIN32
+		ret = h_errno;
+#else
+		ret = WSAGetLastError();
+#endif
+		if((ret == HOST_NOT_FOUND) || (ret == NO_DATA))
+				return(0);
+/*		
+		errno = ECONNREFUSED;
+#ifdef WIN32
+		WSASetLastError(errno);
+#endif
+		return(0);
+*/
+	}
+	return(1);
+}
+
+int tcpip_open_client( int conn_id, char *node, char *task, int port )
+{
+	/* Create connection: create and initialize socket stuff. Try
+	 * and make a connection with the server.
+	 */
+	struct sockaddr_in sockname;
+#ifndef VxWorks
+	struct hostent *host = 0;
+#else
+	int host_addr;
+#endif
+	int path, val, ret_code, ret;
+	int a,b,c,d;
+	unsigned char ipaddr[4];
+	int host_number = 0;
+
+    dim_tcpip_init(0);
+	if(isdigit(node[0]))
+	{
+		sscanf(node,"%d.%d.%d.%d",&a, &b, &c, &d);
+	    ipaddr[0] = a;
+	    ipaddr[1] = b;
+	    ipaddr[2] = c;
+	    ipaddr[3] = d;
+	    host_number = 1;
+#ifndef VxWorks
+		if( gethostbyaddr(ipaddr, sizeof(ipaddr), AF_INET) == (struct hostent *)0 )
+		{
+#ifndef WIN32
+			ret = h_errno;
+#else
+			ret = WSAGetLastError();
+#endif
+			if((ret == HOST_NOT_FOUND) || (ret == NO_DATA))
+			{
+				if(!check_node_addr(node, ipaddr))
+					return(0);
+			}
+		}
+#endif
+	}
+#ifndef VxWorks
+	else if( (host = gethostbyname(node)) == (struct hostent *)0 ) 
+	{
+		if(!check_node_addr(node, ipaddr))
+			return(0);
+		host_number = 1;
+/*
+          ptr = (unsigned char *)node+strlen(node)+1;
+          ipaddr[0] = *ptr++;
+          ipaddr[1] = *ptr++;
+          ipaddr[2] = *ptr++;
+          ipaddr[3] = *ptr++;
+          host_number = 1;
+		  if( (ipaddr[0] == 0xff) &&
+			  (ipaddr[1] == 0xff) &&
+			  (ipaddr[2] == 0xff) &&
+			  (ipaddr[3] == 0xff) )
+		  {
+			  errno = ECONNREFUSED;
+#ifdef WIN32
+			  WSASetLastError(errno);
+#endif
+			  return(0);
+		  }
+		  if( gethostbyaddr(ipaddr, sizeof(ipaddr), AF_INET) == (struct hostent *)0 )
+		  {
+			  errno = ECONNREFUSED;
+#ifdef WIN32
+			  WSASetLastError(errno);
+#endif
+			  return(0);
+		  }
+*/
+	}
+#else
+	*(strchr(node,'.')) = '\0';
+	host_addr = hostGetByName(node);
+	printf("node %s addr: %x\n",node, host_addr);
+#endif
+
+	if( (path = socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 
+	{
+		perror("socket");
+		return(0);
+	}
+
+	val = 1;
+      
+	if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_NODELAY, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set TCP_NODELAY\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	val = Write_buffer_size;      
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_SNDBUF, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_SNDBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	val = Read_buffer_size;
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_RCVBUF, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_RCVBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+#if defined(__linux__) && !defined (darwin)
+	val = 2;
+	if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_SYNCNT, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set TCP_SYNCNT\n");
+#endif
+	}
+#endif
+
+	sockname.sin_family = PF_INET;
+#ifndef VxWorks
+    if(host_number)
+		sockname.sin_addr = *((struct in_addr *) ipaddr);
+    else
+		sockname.sin_addr = *((struct in_addr *) host->h_addr);
+#else
+    if(host_number)
+		sockname.sin_addr = *((struct in_addr *) ipaddr);
+    else
+		sockname.sin_addr = *((struct in_addr *) &host_addr);
+#endif
+	sockname.sin_port = htons((ushort) port); /* port number to send to */
+	while((ret = connect(path, (struct sockaddr*)&sockname, sizeof(sockname))) == -1 )
+	{
+		if(errno != EINTR)
+		{
+			closesock(path);
+			return(0);
+		}
+	}
+	strcpy( Net_conns[conn_id].node, node );
+	strcpy( Net_conns[conn_id].task, task );
+	Net_conns[conn_id].channel = path;
+	Net_conns[conn_id].port = port;
+	Net_conns[conn_id].last_used = time(NULL);
+	Net_conns[conn_id].reading = -1;
+	Net_conns[conn_id].timr_ent = NULL;
+	return(1);
+}
+
+int tcpip_open_server( int conn_id, char *task, int *port )
+{
+	/* Create connection: create and initialize socket stuff,
+	 * find a free port on this node.
+	 */
+	struct sockaddr_in sockname;
+	int path, val, ret_code, ret;
+
+    dim_tcpip_init(0);
+	if( (path = socket(AF_INET, SOCK_STREAM, 0)) == -1 ) 
+	{
+		return(0);
+	}
+
+	val = 1;
+	if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_NODELAY, 
+			(char*)&val, sizeof(val))) == -1 ) 
+
+	{
+#ifdef DEBUG
+		printf("Couln't set TCP_NODELAY\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	val = Write_buffer_size;
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_SNDBUF, 
+			(void *)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_SNDBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+/*
+	sval1 = sizeof(val1);
+	if ((ret_code = getsockopt(path, SOL_SOCKET, SO_SNDBUF, 
+			(void *)&val1, &sval1)) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_SNDBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+printf("Set size to %d, got size %d\n", val, val1);
+*/
+	val = Read_buffer_size;
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_RCVBUF, 
+			(void *)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_RCVBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	if( *port == SEEK_PORT ) 
+	{	/* Search a free one. */
+		*port = START_PORT_RANGE - 1;
+		do 
+		{
+			(*port)++;
+			sockname.sin_family = AF_INET;
+			sockname.sin_addr.s_addr = INADDR_ANY;
+			sockname.sin_port = htons((ushort) *port);
+			if( *port > STOP_PORT_RANGE ) {
+				errno = EADDRNOTAVAIL;	/* fake an error code */
+				closesock(path);
+#ifdef WIN32
+				WSASetLastError(errno);
+#endif
+				return(0);
+			}
+			ret = bind(path, (struct sockaddr*)&sockname, sizeof(sockname));
+/*
+printf("Trying port %d, ret = %d\n", *port, ret);
+*/
+		} while( ret == -1 );
+/*
+		} while( bind(path, (struct sockaddr*)&sockname, sizeof(sockname)) == -1 );
+*/
+	} else {
+#ifndef WIN32
+		val = 1;
+		if( setsockopt(path, SOL_SOCKET, SO_REUSEADDR, (char*)&val, 
+			sizeof(val)) == -1 )
+		{
+#ifdef DEBUG
+			printf("Couln't set SO_REUSEADDR\n");
+#endif
+			closesock(path); 
+			return(0);
+		}
+#endif
+		sockname.sin_family = AF_INET;
+		sockname.sin_addr.s_addr = INADDR_ANY;
+		sockname.sin_port = htons((ushort) *port);
+		if( (ret = bind(path, (struct sockaddr*) &sockname, sizeof(sockname))) == -1 )
+		{
+			closesock(path);
+			return(0);
+		}
+	}
+
+	if( (ret = listen(path, 16)) == -1 )
+	{
+		closesock(path);
+		return(0);
+	}
+
+	strcpy( Net_conns[conn_id].node, "MYNODE" );
+	strcpy( Net_conns[conn_id].task, task );
+	Net_conns[conn_id].channel = path;
+	Net_conns[conn_id].port = *port;
+	Net_conns[conn_id].last_used = time(NULL);
+	Net_conns[conn_id].reading = -1;
+	Net_conns[conn_id].timr_ent = NULL;
+	return(1);
+}
+
+
+int tcpip_start_listen( int conn_id, void (*ast_routine)() )
+{
+	/* Install signal handler stuff on the socket, and record
+	 * some necessary information: we are NOT reading, thus
+	 * no size.
+	 */
+
+	Net_conns[conn_id].read_rout = ast_routine;
+	Net_conns[conn_id].size = -1;
+	if(Net_conns[conn_id].reading == -1)
+	{
+		if(enable_sig( conn_id ) == -1)
+		{
+#ifdef DEBUG
+			printf("START_LISTEN - enable_sig returned -1\n");
+#endif
+			return(0);
+		}
+	}
+	Net_conns[conn_id].reading = FALSE;
+	return(1);
+}
+
+
+int tcpip_open_connection( int conn_id, int path )
+{
+	/* Fill in/clear some fields, the node and task field
+	 * get filled in later by a special packet.
+	 */
+	int val, ret_code;
+
+
+	val = 1;
+	if ((ret_code = setsockopt(path, IPPROTO_TCP, TCP_NODELAY, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set TCP_NODELAY\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+	val = Write_buffer_size;      
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_SNDBUF, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_SNDBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	val = Read_buffer_size;
+	if ((ret_code = setsockopt(path, SOL_SOCKET, SO_RCVBUF, 
+			(char*)&val, sizeof(val))) == -1 ) 
+	{
+#ifdef DEBUG
+		printf("Couln't set SO_RCVBUF\n");
+#endif
+		closesock(path); 
+		return(0);
+	}
+
+	Net_conns[conn_id].channel = path;
+	Net_conns[conn_id].node[0] = 0;
+	Net_conns[conn_id].task[0] = 0;
+	Net_conns[conn_id].port = 0;
+	Net_conns[conn_id].reading = -1;
+	Net_conns[conn_id].timr_ent = NULL;
+	return(1);
+}
+
+
+void tcpip_get_node_task( int conn_id, char *node, char *task )
+{
+	strcpy( node, Net_conns[conn_id].node );
+	strcpy( task, Net_conns[conn_id].task );
+}
+
+int tcpip_write( int conn_id, char *buffer, int size )
+{
+	/* Do a (synchronous) write to conn_id.
+	 */
+	int	wrote;
+
+	wrote = writesock( Net_conns[conn_id].channel, buffer, size, 0 );
+	if( wrote == -1 ) {
+/*
+		Net_conns[conn_id].read_rout( conn_id, -1, 0 );
+*/
+		return(0);
+	}
+	return(wrote);
+}
+
+int set_non_blocking(int channel)
+{
+  int ret, flags = 1;
+	ret = ioctl(channel, FIONBIO, &flags );
+	if(ret == -1)
+	{
+#ifdef DEBUG
+	    printf("ioctl non block returned -1\n");
+#endif
+		return(ret);
+	}
+	return(1);
+}
+
+int set_blocking(int channel)
+{
+  int ret, flags = 0;
+	ret = ioctl(channel, FIONBIO, &flags );
+	if(ret == -1)
+	{
+#ifdef DEBUG
+	    printf("ioctl block returned -1\n");
+#endif
+		return(ret);
+	}
+	return(1);
+}
+
+int tcpip_write_nowait( int conn_id, char *buffer, int size )
+{
+	/* Do a (asynchronous) write to conn_id.
+	 */
+	int	wrote, ret, selret;
+
+	struct timeval	timeout;
+	fd_set wfds;
+	int tcpip_would_block();
+	
+	set_non_blocking(Net_conns[conn_id].channel);
+	wrote = writesock( Net_conns[conn_id].channel, buffer, size, 0 );
+#ifndef WIN32
+	ret = errno;
+#else
+	ret = WSAGetLastError();
+#endif
+	set_blocking(Net_conns[conn_id].channel);
+	if(wrote == -1)
+	{
+		if(tcpip_would_block(ret))
+		{
+			timeout.tv_sec = Write_timeout;
+			timeout.tv_usec = 0;
+			FD_ZERO(&wfds);
+			FD_SET( Net_conns[conn_id].channel, &wfds);
+			selret = select(FD_SETSIZE, NULL, &wfds, NULL, &timeout);
+			if(selret > 0)
+			{
+				wrote = writesock( Net_conns[conn_id].channel, buffer, size, 0 );
+				if( wrote == -1 ) 
+				{
+					return(0);
+				}
+			}
+		}
+		else
+			return(0);
+	}
+	return(wrote);
+}
+
+int tcpip_close( int conn_id )
+{
+	int channel;
+	/* Clear all traces of the connection conn_id.
+	 */
+	if(Net_conns[conn_id].timr_ent)
+	{
+		dtq_rem_entry(queue_id, Net_conns[conn_id].timr_ent);
+		Net_conns[conn_id].timr_ent = NULL;
+	}
+	channel = Net_conns[conn_id].channel;
+	Net_conns[conn_id].channel = 0;
+	Net_conns[conn_id].port = 0;
+	Net_conns[conn_id].node[0] = 0;
+	Net_conns[conn_id].task[0] = 0;
+	if(channel)
+		closesock(channel);
+	return(1);
+}
+
+
+int tcpip_failure( int code )
+{
+	return(!code);
+}
+
+int tcpip_would_block( int code )
+{
+   if(code == EWOULDBLOCK)
+		return(1);
+    return(0);
+}
+
+void tcpip_report_error( int code )
+{
+#ifndef WIN32
+	if(code){}
+	perror("tcpip");
+#else
+	int my_perror();
+
+	my_perror("tcpip", code);
+#endif
+}
+
+#ifdef WIN32
+int my_perror(char *str, int error)
+{
+int code;
+
+	if(error <= 0)
+		code = WSAGetLastError();
+	else
+		code = error;
+	printf("new - %s\n",strerror(code));
+	printf("%s: ",str);
+	switch(code)
+	{
+		case WSAEWOULDBLOCK:
+			printf("Operation would block");
+			break;
+		case WSAEINPROGRESS:
+			printf("Operation now in progress");
+			break;
+		case WSAEALREADY:
+			printf("Operation already in progress");
+			break;
+		case WSAENOTSOCK:
+			printf("Socket operation on non-socket");
+			break;
+		case WSAEDESTADDRREQ:
+			printf("Destination address required");
+			break;
+		case WSAEMSGSIZE:
+			printf("Message too long");
+			break;
+		case WSAEPROTOTYPE:
+			printf("Protocol wrong type for socket");
+			break;
+		case WSAENOPROTOOPT:
+			printf("Protocol not available");
+			break;
+		case WSAEPROTONOSUPPORT:
+			printf("Protocol not supported");
+			break;
+		case WSAESOCKTNOSUPPORT:
+			printf("Socket type not supported");
+			break;
+		case WSAEOPNOTSUPP:
+			printf("Operation not supported on transport endpoint");
+			break;
+		case WSAEPFNOSUPPORT:
+			printf("Protocol family not supported");
+			break;
+		case WSAEAFNOSUPPORT:
+			printf("Address family not supported by protocol");
+			break;
+		case WSAEADDRINUSE:
+			printf("Address already in use");
+			break;
+		case WSAEADDRNOTAVAIL:
+			printf("Cannot assign requested address");
+			break;
+		case WSAENETDOWN:
+			printf("Network is down");
+			break;
+		case WSAENETUNREACH:
+			printf("Network is unreachable");
+			break;
+		case WSAENETRESET:
+			printf("Network dropped connection because of reset");
+			break;
+		case WSAECONNABORTED:
+			printf("Software caused connection abort");
+			break;
+		case WSAECONNRESET:
+			printf("Connection reset by peer");
+			break;
+		case WSAENOBUFS:
+			printf("No buffer space available");
+			break;
+		case WSAEISCONN:
+			printf("Transport endpoint is already connected");
+			break;
+		case WSAENOTCONN:
+			printf("Transport endpoint is not connected");
+			break;
+		case WSAESHUTDOWN:
+			printf("Cannot send after transport endpoint shutdown");
+			break;
+		case WSAETOOMANYREFS:
+			printf("Too many references: cannot splice");
+			break;
+		case WSAETIMEDOUT:
+			printf("Connection timed out");
+			break;
+		case WSAECONNREFUSED:
+			printf("Connection refused");
+			break;
+		case WSAELOOP:
+			printf("Too many symbolic links encountered");
+			break;
+		case WSAENAMETOOLONG:
+			printf("File name too long");
+			break;
+		case WSAEHOSTDOWN:
+			printf("Host is down");
+			break;
+		case WSAEHOSTUNREACH:
+			printf("No route to host");
+			break;
+		case WSAENOTEMPTY:
+			printf("Directory not empty");
+			break;
+		case WSAEUSERS:
+			printf("Too many users");
+			break;
+		case WSAEDQUOT:
+			printf("Quota exceeded");
+			break;
+		case WSAESTALE:
+			printf("Stale NFS file handle");
+			break;
+		case WSAEREMOTE:
+			printf("Object is remote");
+			break;
+		case WSAHOST_NOT_FOUND:
+			printf("Host not found");
+			break;
+		case WSATRY_AGAIN:
+			printf("Host not found, or SERVERFAIL");
+			break;
+		case WSANO_RECOVERY:
+			printf("Non recoverable errors, FORMERR, REFUSED, NOTIMP");
+			break;
+		case WSANO_DATA:
+			printf("Valid name, no data record of requested type");
+			break;
+		default:
+			printf("Unknown error %d",code);
+	}
+	printf("\n");
+	return(1);
+}
+
+void my_strerror(int error, char *msg)
+{
+int code;
+char str[128];
+
+	if(error <= 0)
+		code = WSAGetLastError();
+	else
+		code = error;
+	switch(code)
+	{
+		case WSAEWOULDBLOCK:
+			sprintf(str,"Operation would block");
+			break;
+		case WSAEINPROGRESS:
+			sprintf(str,"Operation now in progress");
+			break;
+		case WSAEALREADY:
+			sprintf(str,"Operation already in progress");
+			break;
+		case WSAENOTSOCK:
+			sprintf(str,"Socket operation on non-socket");
+			break;
+		case WSAEDESTADDRREQ:
+			sprintf(str,"Destination address required");
+			break;
+		case WSAEMSGSIZE:
+			sprintf(str,"Message too long");
+			break;
+		case WSAEPROTOTYPE:
+			sprintf(str,"Protocol wrong type for socket");
+			break;
+		case WSAENOPROTOOPT:
+			sprintf(str,"Protocol not available");
+			break;
+		case WSAEPROTONOSUPPORT:
+			sprintf(str,"Protocol not supported");
+			break;
+		case WSAESOCKTNOSUPPORT:
+			sprintf(str,"Socket type not supported");
+			break;
+		case WSAEOPNOTSUPP:
+			sprintf(str,"Operation not supported on transport endpoint");
+			break;
+		case WSAEPFNOSUPPORT:
+			sprintf(str,"Protocol family not supported");
+			break;
+		case WSAEAFNOSUPPORT:
+			sprintf(str,"Address family not supported by protocol");
+			break;
+		case WSAEADDRINUSE:
+			sprintf(str,"Address already in use");
+			break;
+		case WSAEADDRNOTAVAIL:
+			sprintf(str,"Cannot assign requested address");
+			break;
+		case WSAENETDOWN:
+			sprintf(str,"Network is down");
+			break;
+		case WSAENETUNREACH:
+			sprintf(str,"Network is unreachable");
+			break;
+		case WSAENETRESET:
+			sprintf(str,"Network dropped connection because of reset");
+			break;
+		case WSAECONNABORTED:
+			sprintf(str,"Software caused connection abort");
+			break;
+		case WSAECONNRESET:
+			sprintf(str,"Connection reset by peer");
+			break;
+		case WSAENOBUFS:
+			sprintf(str,"No buffer space available");
+			break;
+		case WSAEISCONN:
+			sprintf(str,"Transport endpoint is already connected");
+			break;
+		case WSAENOTCONN:
+			sprintf(str,"Transport endpoint is not connected");
+			break;
+		case WSAESHUTDOWN:
+			sprintf(str,"Cannot send after transport endpoint shutdown");
+			break;
+		case WSAETOOMANYREFS:
+			sprintf(str,"Too many references: cannot splice");
+			break;
+		case WSAETIMEDOUT:
+			sprintf(str,"Connection timed out");
+			break;
+		case WSAECONNREFUSED:
+			sprintf(str,"Connection refused");
+			break;
+		case WSAELOOP:
+			sprintf(str,"Too many symbolic links encountered");
+			break;
+		case WSAENAMETOOLONG:
+			sprintf(str,"File name too long");
+			break;
+		case WSAEHOSTDOWN:
+			sprintf(str,"Host is down");
+			break;
+		case WSAEHOSTUNREACH:
+			sprintf(str,"No route to host");
+			break;
+		case WSAENOTEMPTY:
+			sprintf(str,"Directory not empty");
+			break;
+		case WSAEUSERS:
+			sprintf(str,"Too many users");
+			break;
+		case WSAEDQUOT:
+			sprintf(str,"Quota exceeded");
+			break;
+		case WSAESTALE:
+			sprintf(str,"Stale NFS file handle");
+			break;
+		case WSAEREMOTE:
+			sprintf(str,"Object is remote");
+			break;
+		case WSAHOST_NOT_FOUND:
+			sprintf(str,"Host not found");
+			break;
+		case WSATRY_AGAIN:
+			sprintf(str,"Host not found, or SERVERFAIL");
+			break;
+		case WSANO_RECOVERY:
+			sprintf(str,"Non recoverable errors, FORMERR, REFUSED, NOTIMP");
+			break;
+		case WSANO_DATA:
+			sprintf(str,"Valid name, no data record of requested type");
+			break;
+		default:
+			sprintf(str,"Unknown error %d",code);
+	}
+	strcpy(msg, str);
+}
+#endif
+
+void tcpip_get_error( char *str, int code )
+{
+	DISABLE_AST
+#ifndef WIN32
+	if(code){}
+	if((errno == ENOENT) && (h_errno == HOST_NOT_FOUND))
+		strcpy(str,"Host not found");
+	else
+		strcpy(str, strerror(errno));
+#else
+	my_strerror(code, str);
+#endif
+	ENABLE_AST
+}
Index: /trunk/FACT++/dim_v19r15/src/tokenstring.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/tokenstring.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/tokenstring.cxx	(revision 10183)
@@ -0,0 +1,218 @@
+#define DIMLIB
+#include "tokenstring.hxx"
+
+TokenString::TokenString(char *str)
+{
+	token_buff = new char[(strlen(str)+1)*2];
+	token_ptr = token_buff;
+	token_seps = 0;
+	store_str(str);
+	token_ptr = token_buff;
+	curr_token_ptr = token_ptr;
+}
+
+TokenString::TokenString(char *str, char *seps)
+{
+	token_buff = new char[(strlen(str)+1)*2];
+	token_ptr = token_buff;
+	token_seps = new char[(strlen(seps)+1)];
+	strcpy(token_seps,seps);
+	store_str(str);
+	token_ptr = token_buff;
+	curr_token_ptr = token_ptr;
+}
+
+TokenString::~TokenString()
+{
+  if(token_buff) 
+  { 
+	  delete []token_buff; 
+	  token_buff = 0; 
+  }
+  if(token_seps) 
+  { 
+	  delete []token_seps; 
+	  token_seps = 0; 
+  }
+}
+
+void TokenString::store_str(char *str)
+{
+int i, in_tok = 0;
+int sep = 0;
+
+	n_tokens = 0;
+	if(!token_seps)
+	{
+		while(*str)
+		{
+			if( (*str == '@') || (*str == '|') || (*str == '/') || 
+				(*str == '=') || (*str == '(') || (*str == ')') ||
+				(*str == '.') || (*str == '\n'))
+			{   	
+				if(in_tok)
+				{
+					*token_ptr++ = '\0';
+					n_tokens++;
+				}
+				*token_ptr++ = *str++;
+				*token_ptr++ = '\0';
+				n_tokens++;
+				in_tok = 0;
+			}
+			else if(*str == '"')
+			{
+				if(in_tok)
+				{
+					*token_ptr++ = '\0';
+					n_tokens++;
+				}
+				*token_ptr++ = *str++;
+				while(*str != '"')
+				{
+					*token_ptr++ = *str++;
+				}
+				*token_ptr++ = *str++;
+				*token_ptr++ = '\0';
+				n_tokens++;
+				in_tok = 0;
+			}
+			else if(*str == ':')
+			{
+				if(*(str+1) == ':')
+				{
+					if(in_tok)
+					{
+						*token_ptr++ = '\0';
+						n_tokens++;
+					}
+					*token_ptr++ = *str++;
+					*token_ptr++ = *str++;
+					*token_ptr++ = '\0';
+					n_tokens++;
+					in_tok = 0;
+				}
+				else
+				{
+					*token_ptr++ = *str++;
+					in_tok = 1;
+				}
+			}
+			else
+			{
+				*token_ptr++ = *str++;
+				in_tok = 1;
+			}
+		}
+	}
+	else
+	{
+		while(*str)
+		{
+			sep = 0;
+			for(i = 0; i < (int)strlen(token_seps); i++)
+			{
+				if(*str == token_seps[i])
+				{
+					if(in_tok)
+					{
+						*token_ptr++ = '\0';
+						n_tokens++;
+					}
+					*token_ptr++ = *str++;
+					*token_ptr++ = '\0';
+					sep = 1;
+					in_tok = 0;
+					n_tokens++;
+					break;
+				}
+			}
+			if(!sep)
+			{
+				*token_ptr++ = *str++;
+				in_tok = 1;
+			}
+		}
+	}
+	if(in_tok)
+	{
+		*token_ptr++ = '\0';
+		n_tokens++;
+	}
+	*token_ptr++ = '\0';
+}
+
+int TokenString::getToken(char *&token)
+{
+
+	if(!*token_ptr)
+	{
+		token_ptr = token_buff;
+		curr_token_ptr = token_ptr;
+		return(0);
+	}
+
+	curr_token_ptr = token_ptr;
+    token_ptr += strlen(curr_token_ptr)+1;
+	token = curr_token_ptr;
+
+	return(1);
+}		
+
+void TokenString::pushToken()
+{
+	push_token_ptr = token_ptr;
+}
+
+void TokenString::popToken()
+{
+	token_ptr = push_token_ptr;
+}
+
+int TokenString::cmpToken(char *str)
+{
+	if(!strcmp(curr_token_ptr, str))
+		return(1);
+	return(0);
+}
+
+int TokenString::firstToken()
+{
+	if(curr_token_ptr == token_buff)
+		return(1);
+	return(0);
+}
+
+int TokenString::getNTokens()
+{
+	return n_tokens;
+}
+
+int TokenString::getNTokens(char *str)
+{
+	int n = 0;
+	char *token;
+
+	while(getToken(token))
+	{
+		if(!strcmp(token,str))
+			n++;
+	}
+	return n;
+}
+/*
+main(int argc, char *argv[])
+{
+	TokenString *ts;
+	char *token;
+
+	ts = new TokenString(argv[1],"/)");
+	cout << "n = " << ts->getNTokens() << "\n";
+	cout.flush();
+	while(ts->getToken(token))
+	{
+		cout << token << "\n";
+		cout.flush();
+	}
+}
+*/
Index: /trunk/FACT++/dim_v19r15/src/util/check_dim_servers.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/util/check_dim_servers.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/util/check_dim_servers.cxx	(revision 10183)
@@ -0,0 +1,98 @@
+#include <iostream>
+#include <dic.hxx>
+using namespace std;
+
+#define MAX_SERVERS 5000
+char server_names[MAX_SERVERS][256];
+char server_nodes[MAX_SERVERS][256];
+int server_versions[MAX_SERVERS];
+int N_servers = 0;
+
+class DimVersion : public DimInfo
+{
+  int myIndex;
+	void infoHandler()
+	{
+      	  server_versions[myIndex] = getInt();
+	  //	  cout << server_names[myIndex] << " version " << server_versions[myIndex] << endl; 
+	}
+public :
+	DimVersion(char *service, int index) : 
+	  DimInfo(service,-1), myIndex(index) {};
+};
+
+int main()
+{
+  //	int version = 0;
+	int n;
+	char *server, *node;
+	/*
+	DimCurrentInfo dns("DIS_DNS/VERSION_NUMBER",10,-1);
+	
+	version = dns.getInt();
+	if(version == -1)
+		cout << "DNS not running" << endl;
+	else
+		cout << "DNS running" << endl;
+	return(0);
+	*/
+	DimBrowser br;
+	DimVersion *srvptr;
+	char serviceName[256];
+	int index;
+	int i;
+
+	for(i = 0; i < MAX_SERVERS; i++)
+	{
+	  server_names[i][0] = '\0';
+	  server_versions[i] = 0;
+	}  
+
+	n = br.getServers();
+	index = 0;
+	while(br.getNextServer(server, node))
+	{
+	  strcpy(server_names[index],server);
+	  strcpy(server_nodes[index],node);
+	  strcpy(serviceName,server);
+	  strcat(serviceName,"/VERSION_NUMBER");
+	  srvptr = new DimVersion(serviceName, index);
+	  //	  cout << "found " << server << " " << node << endl;
+	  index++;
+	}
+	cout << "found " << n << " servers" << endl;
+	N_servers = n;
+	while(1)
+	{
+	  int found = 0;
+	  sleep(1);
+	  for(i = 0; i < N_servers; i++)
+	  {
+	    if(server_versions[i] == 0)
+	    {
+	      found = 1;
+	    }
+	  }
+	  if(!found)
+	    break;
+	}
+	int max = 0;
+	for(i = 0; i < N_servers; i++)
+	{
+	    if(server_versions[i] > max)
+	    {
+	      max = server_versions[i];
+	    }
+	}
+	n = 0;
+	for(i = 0; i < N_servers; i++)
+	{
+	    if(server_versions[i] < max)
+	    {
+	      cout << server_names[i] <<"@" << server_nodes[i] << " version " << server_versions[i] << endl; 
+	    }
+	    else
+	      n++;
+	}	
+	cout << n << " Servers with version " << max << endl; 
+}
Index: /trunk/FACT++/dim_v19r15/src/util/check_dns.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/util/check_dns.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/util/check_dns.cxx	(revision 10183)
@@ -0,0 +1,16 @@
+#include <iostream>
+#include <dic.hxx>
+using namespace std;
+
+int main()
+{
+	int version = 0;
+	DimCurrentInfo dns("DIS_DNS/VERSION_NUMBER",10,-1);
+	
+	version = dns.getInt();
+	if(version == -1)
+		cout << "DNS not running" << endl;
+	else
+		cout << "DNS running" << endl;
+	return(0);
+}
Index: /trunk/FACT++/dim_v19r15/src/util/dim_get_service.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/util/dim_get_service.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/util/dim_get_service.c	(revision 10183)
@@ -0,0 +1,113 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <dic.h>
+
+int no_link = 0x0afefead;
+int version;
+	
+char str[132];
+int type, mode;
+int received = 0;
+
+void rout(tag, buffer, size)
+int *tag, *size;
+int *buffer;
+{
+void print_service();
+
+	if(tag){}
+	if((*size == 4 ) && (*buffer == no_link))
+	{
+		printf("Service %s Not Available\n", str);
+	}
+	else
+	{
+		printf("Service %s Contents :\n", str);
+		print_service(buffer, ((*size - 1)/4) + 1);
+	}
+	fflush(stdout);
+	received = 1;
+#ifdef WIN32
+	wake_up();
+#endif
+}
+
+int main(argc,argv)
+int argc;
+char **argv;                    
+{
+
+	if(argc < 2)
+	{
+		printf("Service Name > ");
+		fflush(stdout);
+		scanf("%s", str);
+	}
+	else
+	{
+		sprintf(str,argv[1]);
+	}
+	dic_info_service(str,ONCE_ONLY,60,0,0,rout,0,&no_link,4);
+	while(!received)
+	  dim_wait();
+	return(1);
+}
+
+void print_service(buff, size)
+int *buff, size;
+{
+int i,j;
+char *asc;
+int last[4];
+
+	asc = (char *)buff;
+	for( i = 0; i < size; i++)
+	{
+		if(!(i%4))
+			printf("H");
+		printf("   %08X ",buff[i]);
+		last[i%4] = buff[i];
+		if(i%4 == 3)
+		{
+			printf("    '");
+			for(j = 0; j <16; j++)
+			{
+				if(isprint(asc[j]))
+					printf("%c",asc[j]);
+				else
+					printf(".");
+			}
+			printf("'\n");
+			for(j = 0; j <4; j++)
+			{
+				if(j == 0)
+					printf("D");
+				printf("%11d ",last[j]);
+			}
+			printf("\n");
+			asc = (char *)&buff[i+1];
+		}
+	}
+	if(i%4)
+	{
+
+			for(j = 0; j < 4 - (i%4); j++)
+				printf("            ");
+			printf("    '");
+			for(j = 0; j < (i%4) * 4; j++)
+			{
+				if(isprint(asc[j]))
+					printf("%c",asc[j]);
+				else
+					printf(".");
+			}
+			printf("'\n");
+			for(j = 0; j < (i%4); j++)
+			{
+				if(j == 0)
+					printf("D");
+				printf("%11d ",last[j]);
+			}
+			printf("\n");
+	}
+}
Index: /trunk/FACT++/dim_v19r15/src/util/dim_send_command.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/util/dim_send_command.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/util/dim_send_command.c	(revision 10183)
@@ -0,0 +1,128 @@
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <dic.h>
+
+int received = 0;
+char str[132] = {'\0'};
+
+void rout(tag, code)
+int *tag;
+int *code;
+{
+  int silent;
+
+  silent = *tag;
+  if(!silent)
+      dim_print_date_time();
+  if(*code)
+  {
+	  if(!silent)
+		printf(" Command %s Successfully Sent\n", str);
+  }
+  else
+  {
+	  if(!silent)
+		printf(" Command %s Unsuccessfull\n", str);
+  }
+  received = 1;
+#ifdef WIN32
+  wake_up();
+#endif
+}
+/*
+main(argc,argv)
+int argc;
+char **argv;                    
+{
+  char data[1024] = {'\0'};
+  int silent = 0;
+
+	if(argc < 2)
+	{
+		printf("Command Name > ");
+		fflush(stdout);
+		scanf("%s", str);
+		printf("Command String > ");
+		fflush(stdout);
+		scanf("%s", data);
+	}
+	else
+	{
+		sprintf(str,argv[1]);
+		if(argc < 3)
+			data[0] = '\0';
+		else
+		{
+			sprintf(data,argv[2]);
+			if(argc > 3)
+				silent = 1;
+		}
+	}
+	dic_cmnd_callback(str,data,strlen(data)+1, rout, silent);
+	while(!received)
+	  dim_wait();
+	sleep(1);
+}
+*/
+int main(argc,argv)
+int argc;
+char **argv;                    
+{
+int i;
+int silent = 0;
+char data[1024] = {'\0'};
+char dns_node[128], *ptr;
+int dns_port = 0;
+
+	dns_node[0] = '\0'; 
+	for(i = 1; i < argc; i++)
+	{
+		if(!strcmp(argv[i],"-dns"))
+		{
+			strcpy(dns_node,argv[i+1]);
+			if((ptr = strchr(dns_node,':')))
+			{
+				*ptr = '\0';
+				ptr++;
+				sscanf(ptr,"%d",&dns_port);
+			}
+			i++;
+		}
+		else if(!strcmp(argv[i],"-s"))
+		{
+			silent = 1;
+		}
+		else
+		{
+			if(!str[0])
+			{
+				strcpy(str, argv[i]);
+			}
+			else if(!data[0])
+				strcpy(data,argv[i]);
+		}
+	}
+	if(dns_node[0])
+	{
+		dic_set_dns_node(dns_node);
+	}
+	if(dns_port)
+	{
+		dic_set_dns_port(dns_port);
+	}
+	if(!str[0])
+	{
+		printf("dim_send_command: Insufficient parameters\n");
+		printf("usage: dim_send_command <cmnd_name> [<data>] [-dns <dns_node>] [-s]\n");
+		exit(0);
+	}
+	if(!data[0])
+		data[0] = '\0';
+	dic_cmnd_callback(str,data,strlen(data)+1, rout, silent);
+	while(!received)
+	  dim_wait();
+	sleep(1);
+	return(1);
+}
Index: /trunk/FACT++/dim_v19r15/src/util/dimbridge.cxx
===================================================================
--- /trunk/FACT++/dim_v19r15/src/util/dimbridge.cxx	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/util/dimbridge.cxx	(revision 10183)
@@ -0,0 +1,357 @@
+#include <dic.hxx>
+#include <dis.hxx>
+#include <dim.h>
+#include <iostream>
+using namespace std;
+
+static int no_link = 0xdeaddead;
+static char from_node[64], to_node[64], bridge_name[64];
+
+class BridgeService: public DimInfo, public SLLItem 
+{
+  char srv_name[256];
+  char srv_format[256];
+  int declared;
+  DimService *srv;
+  void *srv_data, *data;
+  int srv_size;
+  int cmnd;
+  int found;
+  int copyFlag;
+
+  void infoHandler() {
+	char *server;
+    data = DimInfo::getData();
+    srv_size = DimInfo::getSize();
+
+// Sometimes gets a packet from DIS_DNS not understood why!!!"
+	server = DimClient::getServerName();
+	if(strstr(server,"DIS_DNS") != 0)
+	{
+dim_print_date_time();
+cout << "received from " << server << " size = " << srv_size << endl;
+		if(strstr(srv_name,"DIS_DNS") == 0)
+			return;
+	}
+	srv_data = data;
+    if(*(int *)srv_data == no_link)
+	{
+		if(srv)
+		{
+			delete(srv);
+			srv = 0;
+		}
+		declared = 0;
+//  		cout << "Disconnecting bridge for: " << srv_name << endl;
+	}
+    else if(!declared)
+    {
+//		DimServer::setDnsNode(to_node);
+		srv = new DimService(srv_name, srv_format, srv_data, srv_size);
+		if(copyFlag)
+			srv->setData(srv_data, srv_size);
+		DimServer::start(bridge_name);
+		declared = 1;
+//		DimClient::setDnsNode(from_node);
+	}
+    else
+	{
+		if(srv)
+		{
+			if(copyFlag)
+			{
+				srv->setData(srv_data, srv_size);
+				srv->updateService();
+			}
+			else
+			{
+				srv->updateService(srv_data, srv_size);
+			}
+		}
+	}
+  }
+
+  public:
+    BridgeService(char *name, char *format, int copy):
+		DimInfo(name, &no_link, sizeof(no_link)), declared(0), srv(0), copyFlag(copy)
+		{ 
+			strcpy(srv_format, format);
+			strcpy(srv_name, name);
+			cmnd = 0;
+			found = 1;
+//			cout << "Bridging Service: " << name << endl;
+		}
+	BridgeService(char *name, char *format, int rate, int copy):
+		DimInfo(name, rate, &no_link, sizeof(no_link)), declared(0), srv(0), copyFlag(copy)
+		{ 
+			strcpy(srv_format, format);
+			strcpy(srv_name, name);
+			cmnd = 0;
+			found = 1;
+//			cout << "Bridging Service: " << name << ", rate = " << rate << " seconds" << endl;
+		}
+  	~BridgeService()
+  	{
+  		if(declared)
+		{
+			if(srv)
+			{
+  				delete(srv);
+				srv = 0;
+			}
+		}
+  		declared = 0;
+//  		cout << "Stopped bridge for: " << srv_name << endl;
+  	}
+    char *getName() { return srv_name; };
+    void clear() { found = 0;};
+    void set() {found = 1;};
+    int find() {return found;};
+    int isCmnd() { return cmnd;};
+};
+
+class BridgeCommand: public DimCommand, public SLLItem 
+{
+  char srv_name[256];
+  char srv_format[256];
+  int declared;
+  DimService *srv;
+  void *srv_data;
+  int srv_size;
+  int cmnd;
+  int found;
+
+  void commandHandler() {
+    srv_data = DimCommand::getData();
+    srv_size = DimCommand::getSize();
+    DimClient::sendCommandNB(srv_name, srv_data, srv_size);
+  }
+
+  public:
+    BridgeCommand(char *name, char *format):
+		DimCommand(name, format) 
+		{ 
+			DimServer::start(bridge_name);
+			cmnd = 1;
+			found = 1;
+			strcpy(srv_name, name);
+//			cout << "Bridging Command: " << name << endl;
+		}
+    char *getName() { return srv_name; };
+    void clear() { found = 0;};
+    void set() {found = 1;};
+    int find() {return found;};
+    int isCmnd() { return cmnd;};
+};
+
+void print_usage()
+{
+	cout << "Usage: DimBridge [from_node] to_node services [time_interval] [-copy]" << endl;
+	cout << "    from_node - by default DIM_DNS_NODE" << endl;
+	cout << "    to_node - the complete node name of the new DNS" << endl;
+	cout << "    services - the list of service names (wildcards allowed)" << endl;
+	cout << "    time_interval - the interval in seconds to be used for updating the services" << endl;
+	cout << "    -copy - copy internally the service data" << endl;
+}
+
+int main(int argc, char **argv)
+{
+char services[132];
+DimBrowser dbr;
+char *service, *format, *p;
+int type, known;
+BridgeService *ptrs, *aux_ptrs;
+BridgeCommand *ptrc, *aux_ptrc;
+SLList lists, listc;
+int rate = 0;
+int copyFlag = 0;
+
+//dic_set_debug_on();
+	if(argc < 3)
+    {
+		print_usage();
+		return 0;
+    }
+	else if( argc == 3)
+    {
+		strcpy(from_node, DimClient::getDnsNode());
+		strcpy(to_node, argv[1]);
+		strcpy(services, argv[2]);
+    }
+	else if (argc == 4)
+	{
+		if(sscanf(argv[3],"%d", &rate))
+		{
+			strcpy(from_node, DimClient::getDnsNode());
+			strcpy(to_node, argv[1]);
+			strcpy(services, argv[2]);
+		}
+		else if(argv[3][0] == '-')
+		{
+			rate = 0;
+			strcpy(from_node, DimClient::getDnsNode());
+			strcpy(to_node, argv[1]);
+			strcpy(services, argv[2]);
+			copyFlag = 1;
+		}
+		else
+		{
+			rate = 0;
+			strcpy(from_node, argv[1]);
+			strcpy(to_node, argv[2]);
+			strcpy(services, argv[3]);
+		}
+    }
+	else if(argc == 5)
+	{
+		if(sscanf(argv[4],"%d", &rate))
+		{
+			strcpy(from_node, argv[1]);
+			strcpy(to_node, argv[2]);
+			strcpy(services, argv[3]);
+		}
+		else if(argv[4][0] == '-')
+		{
+			copyFlag = 1;
+			if(sscanf(argv[3],"%d", &rate))
+			{
+				strcpy(from_node, DimClient::getDnsNode());
+				strcpy(to_node, argv[1]);
+				strcpy(services, argv[2]);
+			}
+			else
+			{
+				rate = 0;
+				strcpy(from_node, argv[1]);
+				strcpy(to_node, argv[2]);
+				strcpy(services, argv[3]);
+			}
+		}
+	}
+	else if(argc == 6)
+	{
+		strcpy(from_node, argv[1]);
+		strcpy(to_node, argv[2]);
+		strcpy(services, argv[3]);
+		sscanf(argv[4],"%d", &rate);
+		copyFlag = 1;
+    }
+	else
+	{
+		cout << "Bad parameters" << endl;
+		return 0;
+	}
+
+	cout << "Starting DimBridge from "<<from_node<<" to "<<to_node<<" for "<< services;
+	if(rate)
+		cout << " interval=" << rate; 
+	if(copyFlag)
+		cout << " (internal data copy)"; 
+	cout << endl;
+
+	strcpy(bridge_name,"Bridge_");
+	strcat(bridge_name, from_node);
+	if( (p = strchr(bridge_name,'.')) )
+		*p = '\0';
+#ifndef WIN32
+	sprintf(p,"_%d",getpid());
+#else
+	sprintf(p,"_%d",_getpid());
+#endif
+	DimClient::setDnsNode(from_node);
+	DimServer::setDnsNode(to_node);
+	while(1)
+	{
+		ptrs = (BridgeService *)lists.getHead();
+		while(ptrs)
+		{
+			ptrs->clear();
+			ptrs = (BridgeService *)lists.getNext();
+		}
+		ptrc = (BridgeCommand *)listc.getHead();
+		while(ptrc)
+		{
+			ptrc->clear();
+			ptrc = (BridgeCommand *)listc.getNext();
+		}
+		dbr.getServices(services);
+		while( (type = dbr.getNextService(service, format)) )
+		{
+			known = 0;
+			ptrs = (BridgeService *)lists.getHead();
+			while(ptrs)
+			{
+				if(!strcmp(ptrs->getName(), service))
+				{
+					known = 1;
+					ptrs->set();
+					break;
+				}
+				ptrs = (BridgeService *)lists.getNext();
+			}
+			ptrc = (BridgeCommand *)listc.getHead();
+			while(ptrc)
+			{
+				if(!strcmp(ptrc->getName(), service))
+				{
+					known = 1;
+					ptrc->set();
+					break;
+				}
+				ptrc = (BridgeCommand *)listc.getNext();
+			}
+			if(strstr(service,"DIS_DNS"))
+				known = 1;
+			if(!known)
+			{
+				if(type == DimSERVICE)
+				{
+				  if(!rate)
+					ptrs = new BridgeService(service, format, copyFlag);
+				  else
+					ptrs = new BridgeService(service, format, rate, copyFlag);
+				  lists.add(ptrs);
+				}
+				else if (type == DimCOMMAND)
+				{
+//					DimClient::setDnsNode(to_node);
+					ptrc = new BridgeCommand(service, format);
+					listc.add(ptrc);
+//					DimClient::setDnsNode(from_node);
+				}
+			}
+		}
+		ptrs = (BridgeService *)lists.getHead();
+		while(ptrs)
+		{
+			aux_ptrs = 0;
+			if(!ptrs->find())
+			{
+				lists.remove(ptrs);
+				aux_ptrs = ptrs;
+			}
+			ptrs = (BridgeService *)lists.getNext();
+			if(aux_ptrs)
+			{
+				delete aux_ptrs;
+			}
+		}
+		ptrc = (BridgeCommand *)listc.getHead();
+		while(ptrc)
+		{
+			aux_ptrc = 0;
+			if(!ptrc->find())
+			{
+				listc.remove(ptrc);
+				aux_ptrc = ptrc;
+			}
+			ptrc = (BridgeCommand *)listc.getNext();
+			if(aux_ptrc)
+			{
+				delete aux_ptrc;
+			}
+		}
+		sleep(5);
+	}
+	return 1;
+}
Index: /trunk/FACT++/dim_v19r15/src/utilities.c
===================================================================
--- /trunk/FACT++/dim_v19r15/src/utilities.c	(revision 10183)
+++ /trunk/FACT++/dim_v19r15/src/utilities.c	(revision 10183)
@@ -0,0 +1,285 @@
+/*
+ * DNA (Delphi Network Access) implements the network layer for the DIM
+ * (Delphi Information Managment) System.
+ *
+ * Started date   : 10-11-91
+ * Written by     : C. Gaspar
+ * UNIX adjustment: G.C. Ballintijn
+ *
+ */
+
+#include <sys/types.h>
+#ifndef WIN32
+#include <netinet/in.h>
+#include <netdb.h>
+#endif
+#include <string.h>
+#include <time.h>
+#include <sys/timeb.h>
+#define DIMLIB
+#include <dim.h>
+
+int get_proc_name(char *proc_name)
+{
+#ifndef VxWorks
+	sprintf( proc_name, "%d", getpid() );
+#else
+	sprintf( proc_name, "%d", taskIdSelf() );      
+#endif
+	return(1);
+}
+
+
+int get_node_name(char *node_name)
+{
+#ifndef VxWorks
+struct hostent *host;
+#endif
+char *p;
+int	i;
+#ifdef WIN32
+extern void init_sock();
+#endif
+
+	DISABLE_AST
+#ifdef WIN32
+	init_sock();
+#endif
+	if( (p = getenv("DIM_HOST_NODE")) != NULL )
+	{
+		strcpy( node_name, p );
+		ENABLE_AST
+		return(1);
+	}
+	if((gethostname(node_name, MAX_NODE_NAME)) == -1)
+	{
+		ENABLE_AST
+		return(0);
+	}
+#ifndef VxWorks
+#ifndef RAID
+	if(!strchr(node_name,'.'))
+	{
+		if ((host = gethostbyname(node_name)) != (struct hostent *)0) 
+		{		
+			strcpy(node_name,host->h_name);
+			if(!strchr(node_name,'.'))
+			{
+				if(host->h_aliases)
+				{
+					if(host->h_aliases[0])
+					{
+						for(i = 0; host->h_aliases[i]; i++)
+						{
+							p = host->h_aliases[i];
+							if(strchr(p,'.'))
+							{
+								strcpy(node_name,p);
+								break;
+							}
+						}
+					}
+				}
+		    }
+		}
+	}
+#endif
+#endif
+	ENABLE_AST
+	return(1);
+}
+
+/* 
+Bug or Feature? 
+get_node_addr returns the "default" interface address, not the one chosen by 
+DIM_HOST_NODE. This makes the DNS or a DIM server respond to both interfaces 
+*/
+
+int get_node_addr(char *node_addr)
+{
+#ifndef VxWorks
+struct hostent *host;
+#endif
+char node_name[MAX_NODE_NAME];
+unsigned char *ptr;
+
+#ifdef WIN32
+	init_sock();
+#endif
+	gethostname(node_name, MAX_NODE_NAME);
+#ifndef VxWorks
+	if ((host = (struct hostent *)gethostbyname(node_name)) == (struct hostent *)0)
+	{
+		node_addr[0] = 0;
+		node_addr[1] = 0;
+		node_addr[2] = 0;
+		node_addr[3] = 0;
+		return(0);
+	}
+    ptr = (unsigned char *)host->h_addr;
+    node_addr[0] = *ptr++;
+    node_addr[1] = *ptr++;
+    node_addr[2] = *ptr++;
+    node_addr[3] = *ptr++;
+    return(1);
+#else
+    node_addr[0] = 0;
+    node_addr[1] = 0;
+    node_addr[2] = 0;
+    node_addr[3] = 0;
+	return(0);
+#endif
+}
+
+void dim_print_date_time()
+{
+	time_t t;
+	char str[128];
+
+	t = time((time_t *)0);
+/*
+#ifdef WIN32
+	strcpy(str, ctime(&t));
+#else
+#ifdef LYNXOS
+	ctime_r(&t, str, 128);
+#else
+	ctime_r(&t, str);
+#endif
+#endif
+*/
+	my_ctime(&t, str, 128);
+	str[strlen(str)-1] = '\0';
+	printf("PID %d - ",getpid());
+	printf("%s - ",str );
+}
+
+void dim_print_date_time_millis()
+{
+	int millies;
+
+#ifdef WIN32
+	struct timeb timebuf;
+#else
+	struct timeval tv;
+	struct timezone *tz;
+#endif
+
+#ifdef WIN32
+	ftime(&timebuf);
+	millies = timebuf.millitm;
+#else
+	tz = 0;
+	gettimeofday(&tv, tz);
+	millies = tv.tv_usec / 1000;
+#endif
+	dim_print_date_time();
+	printf("milliseconds: %d ", millies);
+}
+
+void dim_print_msg(char *msg, int severity)
+{
+	dim_print_date_time();
+	switch(severity)
+	{
+		case 0: printf("(INFO) ");
+			break;
+		case 1: printf("(WARNING) ");
+			break;
+		case 2: printf("(ERROR) ");
+			break;
+		case 3: printf("(FATAL) ");
+			break;
+	}
+	printf("%s\n",msg);
+	fflush(stdout);
+}
+
+void dim_panic( char *s )
+{
+	printf( "\n\nDNA library panic: %s\n\n", s );
+	exit(0);
+}
+
+int get_dns_node_name( char *node_name )
+{
+	char	*p;
+
+	if( (p = getenv("DIM_DNS_NODE")) == NULL )
+		return(0);
+	else {
+		strcpy( node_name, p );
+		return(1);
+	}
+}
+
+int get_dns_port_number()
+{
+	char	*p;
+
+	if( (p = getenv("DIM_DNS_PORT")) == NULL )
+		return(DNS_PORT);
+	else {
+		return(atoi(p));
+	}
+}
+
+int dim_get_env_var( char *env_var, char *value, int len )
+{
+	char	*p;
+	int tot, sz;
+
+	if( (p = getenv(env_var)) == NULL )
+		return(0);
+	else {
+		tot = strlen(p)+1;
+		if(value != 0)
+		{
+			sz = tot;
+			if(sz > len)
+				sz = len;
+			strncpy(value, p, sz);
+			if((sz == len) && (len > 0))
+				value[sz-1] = '\0';
+		}
+		return(tot);
+	}
+}
+
+int get_dns_accepted_domains( char *domains )
+{
+	char	*p;
+	int append = 0;
+
+	if(get_dns_accepted_nodes(domains))
+		append = 1;
+	if( (p = getenv("DIM_DNS_ACCEPTED_DOMAINS")) == NULL )
+	{
+		if(!append)
+			return(0);
+		else
+			return(1);
+	}
+	else {
+		if(!append)
+			strcpy( domains, p );
+		else
+		{
+			strcat( domains, ",");
+			strcat( domains, p);
+		}
+		return(1);
+	}
+}
+
+int get_dns_accepted_nodes( char *nodes )
+{
+	char	*p;
+
+	if( (p = getenv("DIM_DNS_ACCEPTED_NODES")) == NULL )
+		return(0);
+	else {
+		strcpy( nodes, p );
+		return(1);
+	}
+}
Index: /trunk/FACT++/src/Configuration.cc
===================================================================
--- /trunk/FACT++/src/Configuration.cc	(revision 10183)
+++ /trunk/FACT++/src/Configuration.cc	(revision 10183)
@@ -0,0 +1,949 @@
+// **************************************************************************
+/** @class Configuration
+
+@brief Commandline parsing, resource file parsing and database access
+
+
+@section User For the user
+
+The Configuration class will process the following steps:
+
+Check the command-line for <B> --default=default.rc </B> (If no configuration
+filename is given on the command-line use \e program_name.rc instead. (Note
+that the name is retrieved from \b argv[0] and might change if you start
+the program through a symbolic link with a different name)
+
+Read the "<B>database=user:password@database:port/database<B>" entry from the file.
+(For details about the syntax see Configuration::parse_database)
+The retrieved entry can be overwritten by
+"<B>--database=user:passwd@server:port/database</B>" from the command line. If
+neither option is given no configuration data will be read from the
+database. To suppress any database access use \b --no-database.
+
+Check the command-line for <B> -C priority.rc </B>
+
+The configuration data is now evaluated from the following sources in
+the following order. Note that options from earlier source have
+priority.
+
+   - (1) Commandline options
+   - (2) Options from the high prioroty configuration-file (given by \b -C or \b --config)
+   - (3) Database entries
+   - (4) Options from the default configuration-file (given by \b --default, defaults to \b program_name.rc)
+   - (5) Environment variables
+
+Which options are accepted is defined by the program. To get a list
+of all command-line option use \b --help. This also lists all other
+available options to list for exmaple the options available in the
+configuration files or from the databse. In addition some default options
+are available which allow to debug parsing of the options, by either printing
+the options retrieval or after parsing.
+
+Options in the configuration files must be given in the form
+
+   - key = value
+
+which is equivalent to the command-line option <b>--key=value</b>.
+
+If there are sections in the configuration file like
+
+\code
+
+   [section1]
+   key = value
+
+\endcode
+
+the key is transformed into <b>section1.key</b> (which would be equivalent
+to <b>--section1.key</b>)
+
+@attention
+In principle it is possible that an exception is thrown before options
+like \b --help are properly parsed and evaluated. In this case it is
+necessary to first resolve the problem. Usually, this mean that there
+is a design flaw in the program rather than a mistake of usage.
+
+For more details on the order in which configuration is read,
+check Configuration::Parse. For more details on the parsing itself
+see the documentation of boost::program_options.
+
+
+
+
+@section API For the programmer
+
+The Configuration class heavily uses the
+<A HREF="http://www.boost.org"><B>C++ boost library</B></A>
+and makes heavy use of the
+<A HREF="http://www.boost.org/doc/libs/release/doc/html/program_options.html">
+<B>boost::program_options</B></A>
+
+The databse access is based on the
+<A HREF="http://tangentsoft.net/mysql++/"><B>MySQL++ library</B></A>.
+
+The basic idea is to have an easy to use, but powerfull setup. The setup on
+all options is based on a special syntax of options_description. Here is an
+example:
+
+\code
+
+    int opt = 0;
+
+    po::options_description config("Section");
+    config.add_options()
+        ("option1",    po_string(),              "This is option1")
+        ("option2",    po_int(22),               "This is option2")
+        ("option3,o",  po_double()->required(),  "This option is mandatory")
+        ("option4",    po_int(&opt),             "This is option 4")
+        ("option5",    po_strings(),             "A list of strings")
+        ("option6",    po_strings(),             "A list of strings")
+        ("option7",    po_strings(),             "A list of strings")
+        ;
+
+\endcode
+
+This will setup, e.g.,  the commandline option '<b>--option1 arg</b>' (which
+is identical to '<b>--option1=arg</b>'. Option 3 can also be expressed
+in a short form as '<b>-o arg</b>' or '<b>-o=arg</b>'. Option 2 defaults
+to 22 if no explicit value is given. Option 3 is mandatory and an exceptionb
+is thrown if not specified. Option 4 will, apart from the usual access to the
+option values, also store its value in the variable opt.
+
+The used functions po_*() are defined in configuration.h and are abbreviations.
+Generally speaking also other variable types are possible.
+
+If the options are displayed, e.g. by \b --help the corresponding section will
+by titled \e Section, also untitled sections are possible.
+
+If an option can be given more than once then a std::vector<type> can be used.
+Abbreviations po_ints(), po_doubles() and po_strings() are available.
+
+In addition to options introduced by a minus, so calles positional options
+can be given on the command line. To describe these options use
+
+\code
+
+    po::positional_options_description p;
+    p.add("option5", 2); // The first 2 positional options
+    p.add("option6", 3); // The next three positional options
+    // p.add("option7", -1); // All others, if wanted
+
+\endcode
+
+This assigns option-keys to the positional options (arguments) in the
+command-line. Note that the validity of the given commandline is checked.
+Hence, this way of defining the options makes sense.
+
+As needed options_descriptions can be grouped together
+
+\code
+
+    po::options_description config1("Section1");
+    po::options_description config2("Section2");
+
+    po::options_description configall;
+    configall.add(config1);
+    configall.add(config2);
+
+\endcode
+
+The member functions of Configurations allow to define for which option
+source these options are valid. The member functions are:
+
+\code
+
+    Configuration conf;
+
+    conf.AddOptionsCommandline(configall, true);
+    conf.AddOptionsConfigfile(config1, true);
+    conf.AddOptionsDatabase(config2, true);
+
+    // To enable the mapping of the position arguments call this
+    conf.SetArgumentPositions(p);
+
+\endcode
+
+If the second option is false, the options will not be displayed in any
+\b --help directive, but are available to the user. Each of the functions
+can be called more than once.
+
+A special case are the options from environment variables. Since you might
+want to use the same option-key for the command-line and the environment
+a mapping is needed (e.g. from \b PATH to \b --path). This mapping
+can be implemented by a mapping function and be initialized like this:
+
+\code
+
+   const string name_mapper(const string &str)
+   {
+      return str=="PATH" ? "path" : "";
+   }
+
+   conf.SetNameMapper(name_mapper);
+
+\endcode
+
+Assuming all the above is done in a function calles SetupConfiguration(),
+a simple program to demonstrate the power of the class could look like this:
+
+\code
+
+   int main(int argc, char **argv)
+   {
+       int opt;
+
+       Configuration conf(argv[0]);
+       SetupConfiguration(conf, opt);
+
+       po::variables_map vm;
+       try
+       {
+          vm = conf.Parse(argc, argv);
+       }
+       catch (std::exception &e)
+       {
+           po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+           if (MO)
+               cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+           else
+               cout << "Error: " << e.what() << endl;
+           cout << endl;
+
+           return -1;
+       }
+
+       cout << "Opt1: " << conf.GetString("option1") << endl;
+       cout << "Opt2: " << conf.GetInt("option2") << endl;
+       cout << "Opt3: " << conf.GetDouble("option3") << endl;
+       cout << "Opt4: " << opt << endl;
+
+       return 0;
+   }
+
+\endcode
+
+Another possibility to access the result is the direct approach, for example:
+
+\code
+
+   vector<int>    i   = vm["option2"].as<int>();
+   vector<string> vec = vm["option6"].as<vector<string>>();
+
+\endcode
+
+Note that accessing an option which was not given will throw an exception.
+Therefor its availability should first be checked in one of the following
+ways:
+
+\code
+
+   bool has_option1 = vm.count("option1");
+   bool has_option2 = conf.Has("option2");
+
+\endcode
+
+@section Examples
+
+ - An example can be found in \ref argv.cc
+
+@todo Maybe we should remove the necessity to propagate argv[0] in the constructor?
+
+*/
+// **************************************************************************
+#include "Configuration.h"
+
+#include <iostream>
+
+#include <boost/regex.hpp>
+#include <boost/filesystem.hpp>
+#include <boost/program_options.hpp>
+
+#include <mysql++/mysql++.h>
+
+using namespace std;
+
+namespace style = boost::program_options::command_line_style;
+
+// --------------------------------------------------------------------------
+//
+//!  The purpose of this function is basically to connect to the database,
+//!  and retrieve all the options entries from the 'Configuration' table.
+//!
+//!  @param database
+//!      The URL of the database from which the configuration data is
+//!      retrieved. It should be given in the form
+//!          \li [user[:password]@]server.com[:port][/database]
+//!
+//!      with
+//!          - user:     user name (default is the current user)
+//!          - password: necessary if required by the database rights
+//!          - server:   the URL of the server (can be 'localhost')
+//!          - port:     the port to which to connect (usually obsolete)
+//!          - database: The name of the database containing the table
+//!
+//!  @param desc
+//!     A reference to the object with the description of the options
+//!     which should be retrieved.
+//!
+//!  @param allow_unregistered
+//!     If this is true also unregistered, i.e. options unknown to desc,
+//!     are returned. Otherwise an exception is thrown if such an option
+//!     was retrieved.
+//!
+//!  @return
+//!     Return an object of type basic_parsed_options containing all
+//!     the entries retrieved from the database. Options not found in
+//!     desc are flagged as unregistered.
+//!
+//!  @throws
+//!     Two types of exceptions are thrown
+//!        - It thows an unnamed exception if the options could not be
+//!          retrieved properly from the databse.
+//!        - If an option is not registered within the given descriptions
+//!          and \b allow_unregistered is \b false, an exception of type
+//!          \b  po::unknown_option is thrown.
+//!
+//!  @todo
+//!     - The exceptions handling should be improved.
+//!     - The final database layout is missing in the description
+//!     - Shell we allow options to be given more than once?
+//
+po::basic_parsed_options<char>
+    Configuration::parse_database(const string &database, const po::options_description& desc, bool allow_unregistered)
+{
+    //static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))?");
+    static const boost::regex expr("(([[:word:].-]+)(:(.+))?@)?([[:word:].-]+)(:([[:digit:]]+))?(/([[:word:].-]+))");
+    // 2: user
+    // 4: pass
+    // 5: server
+    // 7: port
+    // 9: db
+
+    boost::smatch what;
+    if (!boost::regex_match(database, what, expr, boost::match_extra))
+    {
+        cout << "Couldn't parse '" << database << "'." << endl;
+        throw;
+    }
+
+    if (what.size()!=10)
+    {
+        cout << "Error parsing '" << database << "'." << endl;
+        throw;
+    }
+
+    const string user   = what[2];
+    const string passwd = what[4];
+    const string server = what[5];
+    const string db     = what[9];
+    const int port      = atoi(string(what[7]).c_str());
+
+    cout << "Connecting to '";
+    if (!user.empty())
+        cout << user << "@";
+    cout << server;
+    if (port)
+        cout << ":" << port;
+    if (!db.empty())
+        cout << "/" << db;
+    cout << "'" << endl;
+
+    mysqlpp::Connection conn(db.c_str(), server.c_str(), user.c_str(), passwd.c_str(), port);
+    if (!conn.connected())
+    {
+        cout << "MySQL connection error: " << conn.error() << endl;
+        throw;
+    }
+
+    // Retrieve a subset of the sample stock table set up by resetdb
+    // and display it.
+    // FIXME: What about a prefix?
+    mysqlpp::Query query = conn.query("select `Key`, Value from Configuration");
+
+    mysqlpp::StoreQueryResult res = query.store();
+    if (!res)
+    {
+        cout << "MySQL query failed: " << query.error() << endl;
+        throw;
+    }
+
+    set<string> allowed_options;
+
+    const vector<boost::shared_ptr<po::option_description>> &options = desc.options();
+    for (unsigned i=0; i<options.size(); ++i)
+    {
+        const po::option_description &d = *options[i];
+        if (d.long_name().empty())
+            boost::throw_exception(po::error("long name required for database"));
+
+        allowed_options.insert(d.long_name());
+    }
+
+    po::parsed_options result(&desc);
+
+    for (vector<mysqlpp::Row>::iterator v=res.begin(); v<res.end(); v++)
+    {
+        const string key = (*v)[0].c_str();
+        if (key.empty())  // key  == > Throw exception
+            continue;
+
+        // Check if we are allowed to accept unregistered options,
+        // i.e. options which are not in options_description &desc.
+        const bool unregistered = allowed_options.find(key)==allowed_options.end();
+        if (unregistered && allow_unregistered)
+            boost::throw_exception(po::unknown_option(key));
+
+        // Create a key/value-pair and store whether it is a
+        // registered option of not
+        po::option n;
+        n.string_key = key;
+        // This is now identical to file parsing. What if we want
+        // to concatenate options like on the command line?
+        n.value.clear();          // Fixme: composing?
+        n.value.push_back((*v)[1].c_str());
+        n.unregistered = unregistered;
+
+        // If any parsing will be done in the future...
+        //n.value().original_tokens.clear();
+        //n.value().original_tokens.push_back(name);
+        //n.value().original_tokens.push_back(value);
+
+        result.options.push_back(n);
+    }
+
+    cout << endl;
+
+    return result;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+Configuration::Configuration(const string &prgname) : fName(prgname), fNameMapper(&NameMapper)
+{
+    po::options_description generic("Generic options");
+    generic.add_options()
+        ("help",                "Print available commandline options.")
+        ("help-environment",    "Print available environment variables.")
+        ("help-database",       "Print available options retreived from the database.")
+        ("help-config",         "Print available configuration file options.")
+        ("print-all",           "Print all options as parsed from all the different sources.")
+        ("print",               "Print options as parsed from the commandline.")
+        ("print-default",       "Print options as parsed from default configuration file.")
+        ("print-database",      "Print options as retrieved from the database.")
+        ("print-config",        "Print options as parsed from the high priority configuration file.")
+        ("print-environment",   "Print options as parsed from the environment.")
+        ("print-unknown",       "Print unrecognized options.")
+        ("print-options",       "Print options as passed to program.")
+        ("dont-check",          "Do not check validity of options from files and database.")
+        ("dont-check-files",    "Do not check validity of options from files.")
+        ("dont-check-database", "Do not check validity of options from database.")
+        ;
+
+    po::options_description def_config;
+    def_config.add_options()
+        ("default",  var<string>(prgname+string(".rc")), "Default configuration file.")
+        ;
+
+    po::options_description config("Configuration options");
+    config.add_options()
+        ("config,C",    var<string>(), "Configuration file overwriting options retrieved from the database.")
+        ("database",    var<string>(), "Database link as in\n\t[user:[password]@][server][:port][/database]\nOverwrites options from the default configuration file.")
+        ("no-database",                "Suppress any access to the database even if a database URL was set.")
+        ;
+
+    fOptionsCommandline[kVisible].add(generic);
+    fOptionsCommandline[kVisible].add(config);
+    fOptionsCommandline[kVisible].add(def_config);
+    fOptionsConfigfile[kVisible].add(config);
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::PrintParsed(const po::parsed_options &parsed) const
+{
+    const vector< po::basic_option<char> >& options = parsed.options;
+
+    // .description -> Pointer to opt_commandline
+    // const std::vector< shared_ptr<option_description> >& options() const;
+
+    //const std::string& key(const std::string& option) const;
+    //const std::string& long_name() const;
+    //const std::string& description() const;
+    //shared_ptr<const value_semantic> semantic() const;
+
+    int maxlen = 0;
+    for (unsigned i=0; i<options.size(); ++i)
+    {
+        const po::basic_option<char> &opt = options[i];
+
+        if (opt.value.size()>0 && opt.string_key[0]!='-')
+            Max(maxlen, opt.string_key.length());
+    }
+
+    cout.setf(ios_base::left);
+
+    // =============> Implement prining of parsed options
+    for(unsigned i=0; i<options.size(); ++i)
+    {
+        const po::basic_option<char> &opt = options[i];
+
+        if (opt.value.size()==0 && !opt.string_key[0]=='-')
+            cout << "--";
+        cout << setw(maxlen) << opt.string_key;
+        if (opt.value.size()>0)
+            cout << " = " << opt.value[0];
+
+        //for (int j=0; j<options[i].value.size(); j++)
+        //    cout << "\t = " << options[i].value[j];
+
+        //cout << "/" << options[i].position_key;
+        //cout << "/" << options[i].original_tokens[0];
+        //cout << "/" << options[i].unregistered << endl;
+        if (opt.unregistered)
+            cout << "   # option unknown";
+        cout << endl;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::PrintOptions()
+{
+    cout << "Options propagated to program:" << endl;
+
+    int maxlen = 0;
+    for (map<string,po::variable_value>::iterator m=fVariables.begin();
+         m!=fVariables.end(); m++)
+        Max(maxlen, m->first.length());
+
+    cout.setf(ios_base::left);
+
+    // =============> Implement prining of options in use
+    for (map<string,po::variable_value>::iterator m=fVariables.begin();
+         m!=fVariables.end(); m++)
+    {
+        cout << setw(maxlen) << m->first << " = ";
+
+        const po::variable_value &v = m->second;
+
+        if (v.value().type()==typeid(bool))
+            cout << (v.as<bool>()?"true":"false") << "   # bool";
+
+        if (v.value().type()==typeid(string))
+            cout << v.as<string>() << "   # string";
+
+        if (v.value().type()==typeid(int))
+            cout << v.as<int>() << "   # int";
+
+        if (v.value().type()==typeid(double))
+            cout << v.as<double>() << "   # double";
+
+        if (v.value().type()==typeid(float))
+            cout << v.as<float>() << "   # float";
+
+        if (v.value().type()==typeid(vector<string>))
+        {
+            vector<string> vec = v.as<vector<string>>();
+            for (vector<string>::iterator s=vec.begin(); s<vec.end(); s++)
+                cout << *s << " ";
+            cout << "   # strings";
+        }
+        if (v.value().type()==typeid(vector<double>))
+        {
+            vector<double> vec = v.as<vector<double>>();
+            for (vector<double>::iterator s=vec.begin(); s<vec.end(); s++)
+                cout << *s << " ";
+            cout << "   # doubles";
+        }
+
+        if (v.defaulted())
+            cout << "   # default value";
+        if (v.empty())
+            cout << "   # empty value";
+
+        cout << endl;
+    }
+
+    cout << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::PrintUnknown(vector<string> &vec, int steps)
+{
+    for (vector<string>::iterator v=vec.begin(); v<vec.end(); v+=steps)
+        cout << " " << *v << endl;
+    cout << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::PrintUnknown()
+{
+    if (fUnknownCommandline.size())
+    {
+        cout << "Unknown commandline options:" << endl;
+        PrintUnknown(fUnknownCommandline);
+    }
+
+    if (fUnknownConfigfile.size())
+    {
+        cout << "Unknown options in configfile:" << endl;
+        PrintUnknown(fUnknownConfigfile, 2);
+    }
+
+    if (fUnknownEnvironment.size())
+    {
+        cout << "Unknown environment variables:" << endl;
+        PrintUnknown(fUnknownEnvironment);
+    }
+
+    if (fUnknownDatabase.size())
+    {
+        cout << "Unknown database entry:" << endl;
+        PrintUnknown(fUnknownDatabase);
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::AddOptionsCommandline(const po::options_description &cl, bool visible)
+{
+    fOptionsCommandline[visible].add(cl);
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::AddOptionsConfigfile(const po::options_description &cf, bool visible)
+{
+    fOptionsConfigfile[visible].add(cf);
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::AddOptionsEnvironment(const po::options_description &env, bool visible)
+{
+    fOptionsEnvironment[visible].add(env);
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::AddOptionsDatabase(const po::options_description &db, bool visible)
+{
+    fOptionsDatabase[visible].add(db);
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::SetArgumentPositions(const po::positional_options_description &desc)
+{
+    fArgumentPositions = desc;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+void Configuration::SetNameMapper(const string (*mapper)(const string&))
+{
+    fNameMapper = mapper;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//! The idea of the Parse() memeber-function is to parse the command-line,
+//! the configuration files, the databse and the environment and return
+//! a proper combined result.
+//!
+//! In details the following actions are performed in the given order:
+//!
+//!  - (0)  Init local variables with the list of options described by the
+//!         data members.
+//!  - (1)  Reset the data members fPriorityFile, fDefaultFile, fDatabase
+//!  - (2)  Parse the command line
+//!  - (3)  Check for \b --help* command-line options and performe
+//!         corresponding action
+//!  - (4)  Check for \b --print and \b --print-all and perform corresponding
+//!         action
+//!  - (5)  Read and parse the default configuration file, which is either
+//!         given by the default name or the \b --default command-line
+//!         option. The default name is compiled from the argument
+//!         given to the constructor and ".rc".  If the file-name is
+//!         identical to the default (no command-line option given)
+//!         a missing configuration file is no error. Depending on
+//!         the \b --dont-check and \b --dont-check-files options,
+//!         unrecognized options in the file throw an exception or not.
+//!  - (6)  Check for \b --print-default and \b --print-all and perform
+//!         corresponding action
+//!  - (7)  Read and parse the priority configuration file, which must be given
+//!         by the \b --config or \b -C command-line option or a
+//!         corresponding entry in the default-configuration file.
+//!         If an option on the command-line and the in the configuration
+//!         file exists, the command-line option has priority.
+//!         If none is given, no priority file is read. Depending on
+//!         the \b --dont-check and \b --dont-check-files options,
+//!         unrecognized options in the file throw an exception or not.
+//!  - (8)  Check for \b --print-config and \b --print-all and perform
+//!         corresponding action
+//!  - (9)  Retrieve options from the database according to the
+//!         options \b --database and \b --no-database. Note that
+//!         options given on the command-line have highest priority.
+//!         The second priority is the priority-configuration file.
+//!         The options from the default configuration-file have
+//!         lowest priority.
+//!  - (10) Check for \b --print-database and \b --print-all and perform
+//!         corresponding action
+//!  - (11)  Parse the environment options.
+//!  - (12) Check for \b --print-environment and \b --print-all and perform
+//!         corresponding action
+//!  - (13) Compile the final result. The priority of the options is (in
+//!         decreasing order): command-line options, options from the
+//!         priority configuration file, options from the database,
+//!         options from the default configuration-file and options
+//!         from the environment.
+//!  - (14) Finally all options which were found and flagged as unrecognized,
+//!         because they are not in the user-defined list of described
+//!         options, are collected and stored in the corresponding
+//!         data-members.
+//!  - (15) Before the function returns it check for \b --print-options
+//!         and \b --print-unknown and performs the corresponding actions.
+//!
+//!
+//! @param argc,argv
+//!    arguments passed to <b>main(int argc, char **argv)</b>
+//!
+//! @returns
+//!    A reference to the list with the resulting options with their
+//!    values.
+//!
+//! @todo
+//!    - describe the exceptions
+//!    - describe what happens in a more general way
+//!    - print a waring when no default coonfig file is read
+//
+const po::variables_map &Configuration::Parse(int argc, char **argv)
+{
+    const po::positional_options_description &opt_positional = fArgumentPositions;
+
+    // ------------------------ (0) --------------------------
+
+    po::options_description opt_commandline;
+    po::options_description opt_configfile;
+    po::options_description opt_environment;
+    po::options_description opt_database;
+
+    for (int i=0; i<2; i++)
+    {
+        opt_commandline.add(fOptionsCommandline[i]);
+        opt_configfile.add(fOptionsConfigfile[i]);
+        opt_environment.add(fOptionsEnvironment[i]);
+        opt_database.add(fOptionsDatabase[i]);
+    }
+
+    // ------------------------ (1) --------------------------
+
+    fPriorityFile = "";
+    fDefaultFile  = "";
+    fDatabase     = "";
+
+    // ------------------------ (2) --------------------------
+
+    po::command_line_parser parser(argc, argv);
+    parser.options(opt_commandline);
+    parser.positional(opt_positional);
+    parser.style(style::unix_style&~style::allow_guessing);
+    //parser.allow_unregistered();
+
+    const po::parsed_options parsed_commandline = parser.run();
+
+    // ------------------------ (3) --------------------------
+
+    po::variables_map getfiles;
+    po::store(parsed_commandline, getfiles);
+
+    if (getfiles.count("help"))
+        cout << endl << fOptionsCommandline[kVisible] << endl;
+    if (getfiles.count("help-config"))
+        cout << endl << fOptionsConfigfile[kVisible] << endl;
+    if (getfiles.count("help-env"))
+        cout << endl << fOptionsEnvironment[kVisible] << endl;
+    if (getfiles.count("help-database"))
+        cout << endl << fOptionsDatabase[kVisible] << endl;
+
+    // ------------------------ (4) --------------------------
+
+    if (getfiles.count("print") || getfiles.count("print-all"))
+    {
+        cout << endl << "Parsed commandline options:" << endl;
+        PrintParsed(parsed_commandline);
+        cout << endl;
+    }
+
+    // ------------------------ (5) --------------------------
+
+    // Get default file from command line
+    if (getfiles.count("default"))
+    {
+        fDefaultFile = getfiles["default"].as<string>();
+        cout << "Reading configuration from '" << fDefaultFile << "'." << endl;
+    }
+
+    const bool checkf    = !getfiles.count("dont-check-files") && !getfiles.count("dont-check");
+    const bool defaulted = getfiles.count("default") && getfiles["default"].defaulted();
+    const bool exists    = boost::filesystem::exists(fDefaultFile);
+
+    const po::parsed_options parsed_defaultfile =
+        !exists && defaulted ?
+        po::parsed_options(&opt_configfile) :
+        po::parse_config_file<char>(fDefaultFile.c_str(), opt_configfile, !checkf);
+
+    // ------------------------ (6) --------------------------
+
+    if (getfiles.count("print-default") || getfiles.count("print-all"))
+    {
+        if (!exists && defaulted)
+            cout << "No configuration file by --default option specified." << endl;
+        else
+        {
+            cout << endl << "Parsed options from '" << fDefaultFile << "':" << endl;
+            PrintParsed(parsed_defaultfile);
+            cout << endl;
+        }
+    }
+
+    po::store(parsed_defaultfile, getfiles);
+
+    // ------------------------ (7) --------------------------
+
+    // Get priority from commandline(1), defaultfile(2)
+    if (getfiles.count("config"))
+    {
+        fPriorityFile = getfiles["config"].as<string>();
+        cout << "Retrieved option from '" << fPriorityFile << "'." << endl;
+    }
+
+    //        cout << "PRIO : " << fPriorityFile << endl;
+
+    const po::parsed_options parsed_priorityfile =
+        fPriorityFile.empty() ? po::parsed_options(&opt_configfile) :
+        po::parse_config_file<char>(fPriorityFile.c_str(), opt_configfile, !checkf);
+
+    // ------------------------ (8) --------------------------
+
+    if (getfiles.count("print-config") || getfiles.count("print-all"))
+    {
+        if (fPriorityFile.empty())
+            cout << "No configuration file by --config option specified." << endl;
+        else
+        {
+            cout << endl << "Parsed options from '" << fPriorityFile << "':" << endl;
+            PrintParsed(parsed_priorityfile);
+            cout << endl;
+        }
+    }
+
+    // ------------------------ (9) --------------------------
+
+    po::variables_map getdatabase;
+    po::store(parsed_commandline,  getdatabase);
+    po::store(parsed_priorityfile, getdatabase);
+    po::store(parsed_defaultfile,  getdatabase);
+
+    //        cout << "NODB : " << getdatabase.count("no-database") << endl;
+
+    if (getdatabase.count("database") && !getdatabase.count("no-database"))
+    {
+        fDatabase = getdatabase["database"].as<string>();
+        cout << "Retrieving configuration from '" << fDatabase << "'." << endl;
+    }
+
+    //        cout << "DB   : " << fDatabase << endl;
+    const bool checkdb = !getdatabase.count("dont-check-database") && !getdatabase.count("dont-check");
+
+    const po::parsed_options parsed_database =
+        fDatabase.empty() ? po::parsed_options(&opt_database) :
+        parse_database(fDatabase, opt_database, !checkdb);
+
+    // ------------------------ (10) -------------------------
+
+    if (getfiles.count("print-database") || getfiles.count("print-all"))
+    {
+        if (fDatabase.empty())
+            cout << "No database access requested." << endl;
+        else
+        {
+            cout << endl << "Options retrieved from '" << fDatabase << "':" << endl;
+            PrintParsed(parsed_database);
+            cout << endl;
+        }
+    }
+
+    // ------------------------ (11) -------------------------
+
+    const po::parsed_options parsed_environment = po::parse_environment(opt_environment, *fNameMapper);
+
+    // ------------------------ (12) -------------------------
+
+    if (getfiles.count("print-environment"))
+    {
+        cout << "Parsed options from environment:" << endl;
+        PrintParsed(parsed_environment);
+        cout << endl;
+    }
+
+    // ------------------------ (13) -------------------------
+
+    po::variables_map result;
+    po::store(parsed_commandline,  result);
+    po::store(parsed_priorityfile, result);
+    po::store(parsed_database,     result);
+    po::store(parsed_defaultfile,  result);
+    po::store(parsed_environment,  result);
+    po::notify(result);
+
+    fVariables = result;
+
+    // ------------------------ (14) -------------------------
+
+    const vector<string> unknown1 = collect_unrecognized(parsed_defaultfile.options,  po::exclude_positional);
+    const vector<string> unknown2 = collect_unrecognized(parsed_priorityfile.options, po::exclude_positional);
+
+    fUnknownConfigfile.clear();
+    fUnknownConfigfile.insert(fUnknownConfigfile.end(), unknown1.begin(), unknown1.end());
+    fUnknownConfigfile.insert(fUnknownConfigfile.end(), unknown2.begin(), unknown2.end());
+
+    fUnknownCommandline = collect_unrecognized(parsed_commandline.options, po::exclude_positional);
+    fUnknownEnvironment = collect_unrecognized(parsed_environment.options, po::exclude_positional);
+    fUnknownDatabase    = collect_unrecognized(parsed_database.options, po::exclude_positional);
+
+    // ------------------------ (15) -------------------------
+
+    if (result.count("print-options"))
+        PrintOptions();
+
+    if (result.count("print-unknown"))
+        PrintUnknown();
+
+    return fVariables;
+}
Index: /trunk/FACT++/src/Configuration.h
===================================================================
--- /trunk/FACT++/src/Configuration.h	(revision 10183)
+++ /trunk/FACT++/src/Configuration.h	(revision 10183)
@@ -0,0 +1,138 @@
+#ifndef FACT_Configuration
+#define FACT_Configuration
+
+#include <boost/program_options.hpp>
+/*
+\attention
+\callgraph
+\callergraph
+\category
+\dot
+\remark
+\see
+\throws
+\todo
+\warning
+
+\e  italic
+\b  bold
+\c  typewriter
+
+\code
+\endcode
+
+\f$
+\f[ \f]
+*/
+
+namespace po = boost::program_options;
+
+class Configuration
+{
+private:
+    /// Convienience enum to access the fOption* data memebers more verbosely.
+    enum
+    {
+        kHidden  = 0, ///< Index for hidden options (not shown in PrintParsed)
+        kVisible = 1  ///< Index for options visible in PrintParsed
+    };
+
+    const std::string fName; /// argv[0]
+
+    po::options_description fOptionsCommandline[2]; /// Description of the command-line options
+    po::options_description fOptionsConfigfile[2];  /// Description of the options in the configuration file
+    po::options_description fOptionsDatabase[2];    /// Description of options from the database
+    po::options_description fOptionsEnvironment[2]; /// Description of options from the environment
+
+    po::positional_options_description fArgumentPositions; /// Description of positional command-line options (arguments)
+
+    std::vector<std::string> fUnknownCommandline;   /// Storage container for unrecognized commandline options
+    std::vector<std::string> fUnknownConfigfile;    /// Storage container for unrecognized options from configuration files
+    std::vector<std::string> fUnknownEnvironment;   /// Storage container for unrecognized options from the environment
+    std::vector<std::string> fUnknownDatabase;      /// Storage container for unrecognized options retrieved from the database
+
+    std::string fPriorityFile;  /// File name of the priority configuration file (overwrites option from the databse)
+    std::string fDefaultFile;   /// File name of the default configuration file (usually {program}.rc)
+    std::string fDatabase;      /// URL for database connection (see Configuration::parse_database)
+
+    po::variables_map fVariables;  /// Variables as compiled by the Parse-function, which will be passed to the program
+
+    /// A default mapper for environment variables skipping all of them
+    static const std::string NameMapper(const std::string &) { return ""; }
+
+    /// Pointer to the mapper function for environment variables
+    const std::string (*fNameMapper)(const std::string&);
+
+    /// Helper function which return the max of the two arguments in the first argument
+    static void Max(int &val, const int &comp)
+    {
+        if (comp>val)
+            val=comp;
+    }
+
+    /// Print all options from a list of already parsed options
+    void PrintParsed(const po::parsed_options &parsed) const;
+    /// Print a list of all unkown options within the given vector
+    void PrintUnknown(std::vector<std::string> &vec, int steps=1);
+
+public:
+    Configuration(const std::string &prgname="");
+
+    /// Retrieve data from a database and return them as options
+    static po::basic_parsed_options<char>
+        parse_database(const std::string &database, const po::options_description& desc, bool allow_unregistered=false);
+
+    // Setup
+    void AddOptionsCommandline(const po::options_description &cl, bool visible=true);
+    void AddOptionsConfigfile(const po::options_description &cf, bool visible=true);
+    void AddOptionsEnvironment(const po::options_description &env, bool visible=true);
+    void AddOptionsDatabase(const po::options_description &db, bool visible=true);
+
+    void SetArgumentPositions(const po::positional_options_description &desc);
+
+    void SetNameMapper(const std::string (*mapper)(const std::string&));
+
+    // Output
+    void PrintOptions();
+    void PrintUnknown();
+
+    // Process command line arguments
+    const po::variables_map &Parse(int argc, char **argv);
+
+    bool HasHelp() const
+    {
+        return Has("help") || Has("help-config") || Has("help-env") || Has("help-database");
+    }
+
+    bool HasPrint() const
+    {
+        return Has("print-all") || Has("print") || Has("print-default") ||
+            Has("print-database") || Has("print-config") ||
+            Has("print-environment") || Has("print-unkown") ||
+            Has("print-options");
+    }
+
+    // Simplified access to the parsed options
+    template<class T>
+       T Get(const char *var) const { return Has(var) ? fVariables[var].as<T>() : T(); }
+    bool Has(const char *var) const { return fVariables.count(var)>0; }
+
+    const std::string &GetName() const { return fName; }
+};
+
+template<class T>
+inline po::typed_value<T> *var(T *ptr=0)
+{ return po::value<T>(ptr); }
+
+template<class T>
+inline po::typed_value<T> *var(const T &val, T *ptr=0)
+{ return po::value<T>(ptr)->default_value(val); }
+
+template<class T>
+inline po::typed_value<std::vector<T>> *vars()
+{ return po::value<std::vector<T>>(); }
+
+inline po::typed_value<bool> *po_switch()
+{ return po::bool_switch(); }
+
+#endif
Index: /trunk/FACT++/src/Connection.cc
===================================================================
--- /trunk/FACT++/src/Connection.cc	(revision 10183)
+++ /trunk/FACT++/src/Connection.cc	(revision 10183)
@@ -0,0 +1,371 @@
+// **************************************************************************
+/** @class Connection
+
+@brief Maintains an ansynchronous TCP/IP client connection
+
+*/
+// **************************************************************************
+#include "Connection.h"
+
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+
+using namespace std;
+
+namespace ba    = boost::asio;
+namespace bs    = boost::system;
+namespace dummy = ba::placeholders;
+
+using boost::lexical_cast;
+using ba::ip::tcp;
+
+
+    // -------- Abbreviations for starting async tasks ---------
+
+int Connection::Write(const Time &t, const char *txt, int qos)
+{
+    if (fLog)
+        return fLog->Write(t, txt, qos);
+
+    return MessageImp::Write(t, txt, qos);
+}
+
+void Connection::AsyncRead(ba::mutable_buffers_1 buffers)
+{
+    ba::async_read(*this, buffers,
+                   boost::bind(&Connection::HandleReceivedData, this,
+                               dummy::error, dummy::bytes_transferred));
+}
+
+void Connection::AsyncWrite(ba::mutable_buffers_1 buffers)
+{
+    ba::async_write(*this, buffers,
+                    boost::bind(&Connection::HandleSentData, this,
+                                dummy::error, dummy::bytes_transferred));
+}
+
+void Connection::AsyncWait(ba::deadline_timer &timer, int millisec,
+                           void (Connection::*handler)(const bs::error_code&))
+{
+    // - The boost::asio::basic_deadline_timer::expires_from_now()
+    //   function cancels any pending asynchronous waits, and returns
+    //   the number of asynchronous waits that were cancelled. If it
+    //   returns 0 then you were too late and the wait handler has
+    //   already been executed, or will soon be executed. If it
+    //   returns 1 then the wait handler was successfully cancelled.
+    // - If a wait handler is cancelled, the bs::error_code passed to
+    //   it contains the value bs::error::operation_aborted.
+    timer.expires_from_now(boost::posix_time::milliseconds(millisec));
+
+    timer.async_wait(boost::bind(handler, this, dummy::error));
+}
+
+void Connection::AsyncConnect(tcp::resolver::iterator iterator)
+{
+    //cout << "Start async connect(...)" << endl;
+    fConnectionStatus = 1;
+
+    tcp::endpoint endpoint = *iterator;
+
+    // AsyncConnect + Deadline
+    async_connect(endpoint,
+                  boost::bind(&Connection::ConnectImp,
+                              this, ba::placeholders::error,
+                              ++iterator));
+
+    // We will get a "Connection timeout anyway"
+    //AsyncWait(fConnectTimeout, 5, &Connection::HandleConnectTimeout);
+}
+
+// ------------------------ close --------------------------
+// close from another thread
+void Connection::CloseImp(bool restart)
+{
+    if (IsConnected())
+    {
+        stringstream str;
+        str << "Connection closed to " << URL() << ".";// << endl;
+        Message(str);
+    }
+
+    // Close the connection
+    fConnectionStatus = 0;
+    close();
+
+    // Stop deadline counters
+    fInTimeout.cancel();
+    fOutTimeout.cancel();
+    //fConnectTimeout.cancel();
+
+    if (!restart || IsConnecting())
+        return;
+
+    // We need some timeout before reconnecting!
+    // And we have to check if we are alreayd trying to connect
+    // We shoudl wait until all operations in progress were canceled
+
+    // Start trying to reconnect
+    AsyncConnect();
+}
+
+void Connection::PostClose(bool restart)
+{
+    get_io_service().post(boost::bind(&Connection::CloseImp, this, restart));
+}
+
+// ------------------------ write --------------------------
+void Connection::HandleWriteTimeout(const bs::error_code &error)
+{
+    // 125: Operation canceled
+    if (error && error!=bs::error_code(125, bs::system_category))
+    {
+        stringstream str;
+        str << "Write timeout of " << URL() << ": " << error.message() << " (" << error << ")";// << endl;
+        Error(str);
+    }
+
+    if (!is_open())
+    {
+        // For example: Here we could schedule a new accept if we
+        // would not want to allow two connections at the same time.
+        return;
+    }
+
+    // Check whether the deadline has passed. We compare the deadline
+    // against the current time since a new asynchronous operation
+    // may have moved the deadline before this actor had a chance
+    // to run.
+    if (fOutTimeout.expires_at() > ba::deadline_timer::traits_type::now())
+        return;
+
+    Error("fOutTimeout has expired, writing data to "+URL());
+
+    CloseImp();
+}
+
+void Connection::HandleSentData(const bs::error_code& error, size_t)
+{
+    if (error)
+    {
+        stringstream str;
+        str << "Writing to " << URL() << ": " << error.message() << " (" << error << ")";// << endl;
+        Error(str);
+
+        CloseImp();
+        return;
+    }
+
+    Message("Data successfully sent to "+URL());
+
+    // This is "thread" safe because SendMessage and HandleSentMessage
+    // are serialized in the EventQueue. Note: Do not call these
+    // functions directly from any other place then Handlers, use
+    // PostMessage instead
+    fOutQueue.pop_front();
+
+    if (fOutQueue.empty())
+    {
+        // Queue went empty, remove deadline
+        fOutTimeout.cancel();
+        return;
+    }
+
+    // AsyncWrite + Deadline
+    AsyncWrite(ba::buffer(fOutQueue.front())/*, &Connection::HandleSentData*/);
+    AsyncWait(fOutTimeout, 5000, &Connection::HandleWriteTimeout);
+}
+
+void Connection::SendMessageImp(const vector<char> &msg)
+{
+    /*
+    if (!fConnectionEstablished)
+    {
+        UpdateWarn("SendMessageImp, but no connection to "+fAddress+":"+fPort+".");
+        return;
+    }*/
+
+    const bool first_message_in_queue = fOutQueue.empty();
+
+    // This is "thread" safe because SendMessage and HandleSentMessage
+    // are serialized in the EventQueue. Note: Do not call these
+    // functions directly from any other place then Handlers, use
+    // PostMessage instead
+    fOutQueue.push_back(msg);
+
+    if (!first_message_in_queue)
+        return;
+
+    // AsyncWrite + Deadline
+    AsyncWrite(ba::buffer(fOutQueue.front())/*, &Connection::HandleSentData*/);
+    AsyncWait(fOutTimeout, 5000, &Connection::HandleWriteTimeout);
+}
+
+void Connection::PostMessage(const vector<char> &msg)
+{
+    get_io_service().post(boost::bind(&Connection::SendMessageImp, this, msg));
+}
+
+void Connection::PostMessage(const string &cmd, size_t max)
+{
+    if (max==size_t(-1))
+        max = cmd.length()+1;
+
+    vector <char>msg(max);
+
+    for (unsigned int i=0; i<max; i++)
+        msg[i] = 0;
+
+    for (unsigned int i=0; i<min(cmd.length()+1, max); i++)
+        msg[i] = cmd[i];
+
+    get_io_service().post(boost::bind(&Connection::SendMessageImp, this, msg));
+}
+
+void Connection::HandleConnectionTimer(const bs::error_code &error)
+{
+    // 125: Operation canceled
+    if (error && error!=bs::error_code(125, bs::system_category))
+    {
+        stringstream str;
+        str << "Connetion timer of " << URL() << ": " << error.message() << " (" << error << ")";// << endl;
+        Error(str);
+    }
+
+    if (is_open())
+    {
+        // For example: Here we could schedule a new accept if we
+        // would not want to allow two connections at the same time.
+        return;
+    }
+
+    // Check whether the deadline has passed. We compare the deadline
+    // against the current time since a new asynchronous operation
+    // may have moved the deadline before this actor had a chance
+    // to run.
+    if (fConnectionTimer.expires_at() < ba::deadline_timer::traits_type::now())
+        AsyncConnect();
+}
+
+void Connection::ConnectImp(const bs::error_code& error,
+                            tcp::resolver::iterator endpoint_iterator)
+{
+    // Connection established
+    if (!error)
+    {
+        Message("Connection established to "+URL()+"...");
+
+        // Initialize hardware...
+        // Set state to : connected/undefined until we get the first message
+        //                (send request for configuration) ?
+        //                (send configuration?)
+        fMsgConnect = "";
+        fErrConnect = "";
+
+        fConnectionStatus = 2;
+        //StartAsyncRead();
+
+        // We can create the buffer here and delete it in
+        // Handle Read. However, the read buffer is not filled again
+        // before it was not read within HandleReceivedData -- so a single
+        // buffer should be good enough. Before HandleReceivedData
+        // returns the data must be copied to a "safe" place.
+
+        // fSocket.get_io_service()/*fEventQueue*/.stop();
+        return;
+    }
+
+    // If returning from run will lead to deletion of this
+    // instance, close() is not needed (maybe implicitly called).
+    // If run is called again, close() is needed here. Otherwise:
+    // Software caused connection abort when we try to resolve
+    // the endpoint again.
+    CloseImp(false);
+    //fSocket.close();
+
+    // 111: Connection refused
+    if (1/*error!=bs::error_code(111, bs::system_category)*/)
+    {
+        stringstream msg;
+        msg << "Connecting to " << URL() << ": " << error.message() << " (" << error << ")";
+
+        if (fErrConnect!=msg.str())
+        {
+            fMsgConnect = "";
+            fErrConnect = msg.str();
+            Warn(fErrConnect);
+        }
+    }
+
+    // Go on with the next
+    if (endpoint_iterator != tcp::resolver::iterator())
+    {
+        AsyncConnect(endpoint_iterator);
+        return;
+    }
+
+    // No more entries to try, if we would not put anything else
+    // into the queue anymore it would now return (run() would return)
+
+    // Since we don't want to block the main loop, we wait using an
+    // asnychronous timer
+
+    // FIXME: Should we move this before AsyncConnect() ?
+    AsyncWait(fConnectionTimer, 250, &Connection::HandleConnectionTimer);
+}
+
+// FIXME: Async connect should get address and port as an argument
+void Connection::AsyncConnect()
+{
+    fConnectionStatus = 1;
+
+    tcp::resolver resolver(get_io_service());
+
+    tcp::resolver::query query(fAddress, fPort);
+    tcp::resolver::iterator iterator = resolver.resolve(query);
+
+    stringstream msg;
+    msg << "Trying to connect to " << fAddress << ":" << fPort << "...";
+
+    if (fMsgConnect!=msg.str())
+    {
+        fMsgConnect = msg.str();
+        Message(msg);
+    }
+
+    // Start connection attempts (will also reset deadline counter)
+    AsyncConnect(iterator);
+}
+
+void Connection::SetEndpoint(const char *addr, int port)
+{
+    if (fConnectionStatus>=1)
+        Warn("Connection or connection attempt in progress. New endpoint only valid for next connection.");
+
+    fAddress = addr;
+    fPort    = lexical_cast<string>(port);
+}
+
+
+Connection::Connection(ba::io_service& ioservice, ostream &out) :
+MessageImp(out), tcp::socket(ioservice),
+fLog(0), fAddress("localhost"), fPort("5000"),
+fInTimeout(ioservice), fOutTimeout(ioservice), fConnectionTimer(ioservice),
+fConnectionStatus(0)
+{
+}
+
+Connection::Connection(ba::io_service& ioservice, const string &addr, int port) :
+tcp::socket(ioservice),
+fLog(0), fAddress(addr), fPort(lexical_cast<string>(port)),
+fInTimeout(ioservice), fOutTimeout(ioservice), fConnectionTimer(ioservice),
+fConnectionStatus(0)
+{
+}
+
+Connection::Connection(ba::io_service& ioservice, const string &addr, const string &port) :
+tcp::socket(ioservice), fLog(0), fAddress(addr), fPort(port),
+fInTimeout(ioservice), fOutTimeout(ioservice), fConnectionTimer(ioservice),
+fConnectionStatus(0)
+{
+}
+
Index: /trunk/FACT++/src/Connection.h
===================================================================
--- /trunk/FACT++/src/Connection.h	(revision 10183)
+++ /trunk/FACT++/src/Connection.h	(revision 10183)
@@ -0,0 +1,91 @@
+#ifndef FACT_Connection
+#define FACT_Connection
+
+#include <deque>
+#include <string>
+#include <boost/asio.hpp>
+#include <boost/asio/deadline_timer.hpp>
+
+#include "MessageImp.h"
+
+class Connection : public MessageImp, public boost::asio::ip::tcp::socket
+{
+private:
+    MessageImp *fLog;
+
+    std::string fAddress;
+    std::string fPort;
+protected:
+    boost::asio::deadline_timer   fInTimeout;
+
+private:
+    boost::asio::deadline_timer   fOutTimeout;
+    boost::asio::deadline_timer   fConnectionTimer;
+    std::deque<std::vector<char>> fOutQueue; // Shell we directly put ba:buffers into the queue?
+
+    int fConnectionStatus;   // 0=offline, 1=connecting, 2=connected
+
+    std::string fErrConnect;
+    std::string fMsgConnect;
+
+protected:
+    char fReadBuffer[1000];
+
+
+public:
+    void SetLogStream(MessageImp *log) { fLog = log; }
+
+    // -------- Abbreviations for starting async tasks ---------
+
+    int Write(const Time &t, const char *txt, int qos=kInfo);
+
+    void AsyncRead(boost::asio::mutable_buffers_1 buffers/*,
+                   void (Connection::*handler)(const boost::system::error_code&, size_t)*/);
+    void AsyncWrite(boost::asio::mutable_buffers_1 buffers/*,
+                    void (Connection::*handler)(const boost::system::error_code&)*/);
+    void AsyncWait(boost::asio::deadline_timer &timer, int millisec,
+                   void (Connection::*handler)(const boost::system::error_code&));
+    void AsyncConnect(boost::asio::ip::tcp::resolver::iterator iterator);
+
+    std::string URL() const { return fAddress + ":" + fPort; }
+
+public:
+
+    // ------------------------ close --------------------------
+    // close from another thread
+    void CloseImp(bool restart=true);
+    void PostClose(bool restart=true);
+
+    // ------------------------ write --------------------------
+    void HandleConnectionTimer(const boost::system::error_code &error);
+    void HandleWriteTimeout(const boost::system::error_code &error);
+    void HandleSentData(const boost::system::error_code& error, size_t);
+    void SendMessageImp(const std::vector<char> &msg);
+    void PostMessage(const std::vector<char> &msg);
+    void PostMessage(const std::string &cmd, size_t s=-1);
+
+    // ------------------------ connect --------------------------
+
+    virtual void ConnectImp(const boost::system::error_code& error,
+                            boost::asio::ip::tcp::resolver::iterator endpoint_iterator);
+
+    void AsyncConnect();
+
+    Connection(boost::asio::io_service& io_service, std::ostream &out);
+    Connection(boost::asio::io_service& io_service, const std::string &addr="localhost", int port=5000);
+    Connection(boost::asio::io_service& io_service, const std::string &addr, const std::string &port);
+
+    void SetEndpoint(const char *addr, int port);
+
+    // ------------------------ others --------------------------
+
+    virtual void HandleReceivedData(const boost::system::error_code&, size_t) { }
+    virtual void HandleReadTimeout(const boost::system::error_code&) { }
+
+    int IsClosed() const { return !is_open(); }
+
+    bool IsConnected()  const { return fConnectionStatus==2; }
+    bool IsConnecting() const { return fConnectionStatus==1; }
+};
+
+#endif
Index: /trunk/FACT++/src/Console.cc
===================================================================
--- /trunk/FACT++/src/Console.cc	(revision 10183)
+++ /trunk/FACT++/src/Console.cc	(revision 10183)
@@ -0,0 +1,126 @@
+// **************************************************************************
+/** @class Console
+
+@brief This is an extension to the Readline class provding buffered output
+
+This in an extension to the Readline class. It's purpose is to keep a
+buffered output stream and flush the stream either between readline entries
+(non continous mode) or continously, keeping the readline prompt as
+intact as possible.
+
+ */
+// **************************************************************************
+#include "Console.h"
+
+#include <iostream>
+
+#include "tools.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Instantiate a console stream. It will create a WindowLog object
+//! and immediatel switch off its output to the console. The default more
+//! is non-continous.
+//!
+//! @param name
+//!     The name of the program passed to the Readline constructor
+//!
+Console::Console(const char *name) : Readline(name), fContinous(false)
+{
+    fLogO.SetNullOutput();
+    fLogI.SetNullOutput();
+    fLogO.SetBacklog(true);
+    fLogI.SetBacklog(true);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Flush the contents of the buffer before it is destroyed.
+//
+Console::~Console()
+{
+    // flush buffer to display before it is destroyed in its destructor
+    fLogO.Display();
+    fLogI.Display();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Before readline starts flush the buffer to display all stuff which was
+//! buffered since the last readline call returned.
+//
+void Console::Startup()
+{
+    // Call readline's startup (just in case, it is empty)
+    Readline::Startup();
+
+    // Flush the buffer and remove the flushed contents from the buffer
+    fLogO.Display(true);
+    fLogI.Display(true);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Flush the buffer if we are in continous mode, and call Readline's
+//! EventHook to update the prompt.
+//
+void Console::EventHook()
+{
+    // If the output is continous and we are going to output something
+    // first jump back to the beginning of the line (well, that
+    // doesn't work well if the input line is already two lines)
+    // and then flush the buffer.
+    if (fContinous && fLogO.GetSizeBacklog()>0)
+    {
+        std::cout << "\r";
+        fLogO.Display(true);
+    }
+
+    // Call Readline's EventHook to update the prompt
+    Readline::EventHook();
+}
+
+string Console::GetLinePrompt() const
+{
+    const string siz = fLogO.GetSizeStr();
+    return fContinous ?
+        Form("[%d]", GetLine()) : Form("[%d:%s]", GetLine(), siz.c_str());
+}
+
+/*
+// --------------------------------------------------------------------------
+//
+//! Flush the buffer before it is filled with contents produced by the
+//! command processing. This keeps things as seperated as possible,
+//! although there is no gurantee.
+//
+void Console::Shutdown(const char *)
+{
+    // Flush the buffer (after readline() returned, before processing commands)
+    fLog.Display(true);
+    // std::cout << std::endl;
+}
+*/
+
+// --------------------------------------------------------------------------
+//
+//! Before Readline::Run() is called the buffer is flushed as well as
+//! after the Run() loop has exited.
+//! command processing. This keeps things as seperated as possible,
+//! although there is no gurantee.
+//
+void Console::Run(const char *)
+{
+    // Flush the buffer before we stat out readline loop
+    fLogI.Display(true);
+    fLogO.Display(true);
+
+    // Now run readlines main loop
+    Readline::Run();
+
+    // flush buffer to display
+    fLogO.Display(true);
+    fLogI.Display(true);
+}
Index: /trunk/FACT++/src/Console.h
===================================================================
--- /trunk/FACT++/src/Console.h	(revision 10183)
+++ /trunk/FACT++/src/Console.h	(revision 10183)
@@ -0,0 +1,35 @@
+#ifndef FACT_Console
+#define FACT_Console
+
+#include "Readline.h"
+#include "WindowLog.h"
+
+class Console : public Readline
+{
+private:
+    WindowLog fLogO;
+    WindowLog fLogI;
+
+    bool fContinous;
+public:
+    Console(const char *name);
+    ~Console();
+
+    void SetContinous(bool cont) { fContinous = cont; }
+    bool IsContinous() const { return fContinous; }
+
+    WindowLog &GetStreamOut() { return fLogO; }
+    WindowLog &GetStreamIn()  { return fLogI; }
+
+    const WindowLog &GetStreamOut() const { return fLogO; }
+    const WindowLog &GetStreamIn()  const { return fLogI; }
+
+    std::string GetLinePrompt() const;
+
+    void Startup();
+    void EventHook();
+    //void Shutdown(const char * =0);
+    void Run(const char * = 0);
+};
+
+#endif
Index: /trunk/FACT++/src/Converter.cc
===================================================================
--- /trunk/FACT++/src/Converter.cc	(revision 10183)
+++ /trunk/FACT++/src/Converter.cc	(revision 10183)
@@ -0,0 +1,380 @@
+// **************************************************************************
+/** @class Converter
+
+@brief An interpreter to convert a command line into a command plus data memory
+
+The Converter class interprets arguments in a string accoring to the
+given format definition and produces a corresponding memory block from it
+which can be attached to an event later.
+
+The format is given according to the Dim format description:
+
+  The format parameter specifies the contents of the structure in the
+  form T:N[;T:N]*[;T] where T is the item type: (I)nteger, (C)haracter,
+  (L)ong, (S)hort, (F)loat, (D)ouble, X(tra long==long long) and N is the
+  number of such items. The type alone at the end means all following items
+  are of the same type. Example: "I:3;F:2;C" means 3 Integers, 2 Floats and
+  Characters until the end. The format parameter is used for
+  communicating between different platforms.
+
+For example:
+
+  Converter c(cout, "I:1;F:2;I:2", "COMMAND 1 2.5 4.2 3 4");
+
+would produce a 20 byte data block with the integers 1, the floats
+2.5 and 4.2, and the intergers 3 and 4, in this order.
+
+The opposite direction is also possible
+
+  Converter c(cout, "I:1;F:2;I:2", pointer, size);
+
+@remark
+    Most probably we support more formats than dim does...
+
+*/
+// **************************************************************************
+#include "Converter.h"
+
+#include <iomanip>
+#include <sstream>
+
+#include <boost/regex.hpp>
+
+#include "Readline.h"
+#include "WindowLog.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Gets a value of the template type T from the stringstream and adds the
+//! value as binary data to the end of the vector. If a value couldn't be
+//! obtained it is set to 0.
+//!
+//! @param i
+//!     The number of the processed argument (currently used for some debug
+//!     output when an argument is not available and artificially set to 0)
+//!
+//! @param line
+//!     The stringstream from which the data should be read
+//!
+//! @param vec
+//!     The vector of bytes at which end the data is added in binary format
+//!
+template <class T>
+    void Converter::Eval(int i, std::stringstream &line, std::vector<char> &vec) const
+{
+    T val = 0;
+    line >> val;
+    if (!line)
+        wout << " arg[" << i << "]";
+    else
+        wout << " (" << val << ")";
+
+    vec.insert(vec.end(),
+               reinterpret_cast<char*>(&val),
+               reinterpret_cast<char*>(&val+1));
+}
+
+// --------------------------------------------------------------------------
+//
+//! Constructs a data block from the given string according to the given
+//! format. (See also the class reference for more details).
+//!
+//! The data block is stored in a vector<char>. It's content can be
+//! retrieved using the member functions Ptr() and Size(). Whether parsing
+//! was successfull or not can be checked with GetRc().
+//! If parsing was not successfull, either the format contained something
+//! odd, the conversion failed (e.g. 5.5 for an int) or the string contained
+//! a wrong number of arguments.
+//!
+//! @param out
+//!    The ostream to which errors and debug messages should be printed.
+//!
+//! @param fmt
+//!    The format descriptor according to the dim definition
+//!
+//! @param str
+//!    The string which should be interpreted, e.g. "1 2 5.5 abcdef"
+//!
+Converter::Converter(std::ostream &out, const std::string &fmt, const std::string &str)
+: rc(false), wout(out)
+{
+    // If the format is empty we are already done
+    if (fmt.empty())
+    {
+        if (!str.empty())
+        {
+            wout << endl;
+            wout << kRed << "Data string not empty as it ought to be!" << endl;
+            return;
+        }
+
+        wout << endl;
+        rc = true;
+        return;
+    }
+
+    // Access both, the data and the format through a stringstream
+    stringstream line(str);
+    stringstream stream(fmt);
+
+    // For better performance we could use sregex
+    static const boost::regex expr("^[ ]*([CSILFDX])[ ]*(:[ ]*([1-9]+[0-9]*))?[ ]*$");
+
+    // Tokenize the format
+    int arg = 0;
+    string buffer;
+    while (getline(stream, buffer, ';'))
+    {
+        boost::smatch what;
+        if (!boost::regex_match(buffer, what, expr))
+        {
+            wout << endl;
+            wout << kRed << "Wrong format string '" << buffer << "'!" << endl;
+            return;
+        }
+
+        const string t = what[1]; // type id
+        const string n = what[3]; // counter
+
+        int cnt = atoi(n.c_str());
+
+        // Check if the format is just C (without a number)
+        // That would mean that it is a \0 terminated string
+        if (t[0]=='C' && cnt==0)
+        {
+            // Remove leading whitespaces
+            while (line.peek()==' ')
+                line.get();
+
+            // Copy the string into the buffer
+            getline(line, buffer, '\0');
+
+            wout << " (" << buffer << ")";
+            data.insert(data.end(), buffer.begin(), buffer.end());
+            data.push_back(0);
+            continue;
+        }
+
+        // if the :N part was not given assume 1
+        if (cnt==0)
+            cnt=1;
+
+        // Get as many items from the input line as requested
+        for (int j=0; j<cnt; j++)
+            switch (t[0])
+            {
+            case 'C': // Skip whitespaces when checking for characters
+                if (j>0)
+                    line >> noskipws;
+                Eval<char>(arg++, line, data);
+                line >> skipws;
+                break;
+            case 'S': Eval<short>    (arg++, line, data); break;
+            case 'I': Eval<int>      (arg++, line, data); break;
+            case 'L': Eval<long>     (arg++, line, data); break;
+            case 'F': Eval<float>    (arg++, line, data); break;
+            case 'D': Eval<double>   (arg++, line, data); break;
+            case 'X': Eval<long long>(arg++, line, data); break;
+            default:
+                // This should never happen!
+                wout << endl << kRed << "Format '" << t[0] << " not known!" << endl;
+                break;
+            }
+    }
+
+    wout << " [" << fmt << "]=" << data.size() << endl;
+
+    // Something wrong with the conversion (e.g. 5.5 for an int)
+    if (line.fail() && !line.eof())
+    {
+        line.clear(); // This is necesasary to get a proper response from tellg()
+        wout << kRed << "Error converting argument at " << arg << " [fmt=" << fmt << "]!" << endl;
+        wout << kRed << str << endl;
+        wout << kRed << setw(int(line.tellg())) << " " << "^" << endl;
+        return;
+    }
+
+    // Not enough arguments, we have not reached the end
+    if (line.fail() && line.eof())
+    {
+        line.clear();
+        wout << kRed << "Not enough arguments [fmt=" << fmt << "]!" << endl;
+        wout << kRed << str << endl;
+        wout << kRed << setw(int(line.tellg())+1) << " " << "^" << endl;
+        return;
+    }
+
+    // Too many arguments, we have not reached the end
+    // Unfortunately, this can also mean that there is something
+    // wrong with the last argument
+    if (line.good() && !line.eof())
+    {
+        wout << kRed << "More arguments available than expected [" << fmt << "]!" << endl;
+        wout << kRed << str << endl;
+        wout << kRed << setw(int(line.tellg())+1) << " " << "^" << endl;
+        return;
+    }
+
+    // Set return code to true (successfull)
+    rc = true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Gets the value as a binary from the ptr and return it as a string.
+//! The pointer is increased accordingly.
+//!
+//! @param ptr
+//!    A reference to a pointer to the data which should be converted.
+//!    The pointer is increased according to the size of the data.
+//!
+//! @returns
+//!    The data converted into a string
+//!
+template<class T>
+string Converter::Get(const char* &ptr) const
+{
+    ostringstream stream;
+    stream << *reinterpret_cast<const T*>(ptr);
+    ptr += sizeof(T);
+
+    return stream.str();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Constructs a string from the given data block according to the specified
+//! format. (See also the class reference for more details).
+//!
+//! The resulting string is stored in vector<char>  and 0-terminated.
+//! It can be accessed through Ptr().
+//!
+//! If the conversion faild GetRc will return false. In this case the data
+//! contents might not be well defined.
+//!
+//! If no format is given (size == 0) but the data size is finite (>0)
+//! then the data is converted into a hex representation.
+//!
+//! @remark
+//!    In cases of failures the stored data might be inexisting and
+//!    Ptr() might return NULL. If you output NULL to our streams
+//!    they might not show any further output anymore.
+//!
+//! @param fmt
+//!    The format descriptor according to the dim definition
+//!
+//! @param out
+//!    The ostream to which errors and debug messages should be printed.
+//!
+//! @param dat
+//!    Pointer to the start of the binary data
+//!
+//! @param size
+//!    Size of the binary data region
+//!
+Converter::Converter(ostream &out, const string &fmt, const void *dat, int size)
+: rc(false), wout(out)
+{
+    const char *ptr = reinterpret_cast<const char *>(dat);
+
+    ostringstream text;
+
+    // Structure: print hex representation
+    if (fmt.size()==0)
+    {
+        if (size==0)
+        {
+            data.push_back(0);
+            rc = true;
+            return;
+        }
+
+        text << hex;
+
+        for (int i=0; i<size; i++)
+            text << setw(2) << ptr[i] << " ";
+
+        const string &ref = text.str();
+        data.insert(data.begin(), ref.begin(), ref.end());
+        data.push_back(0);
+        return;
+    }
+
+    // Access both, the data and the format through a stringstream
+    stringstream stream(fmt);
+
+    // For better performance we could use sregex
+    static const boost::regex expr("^[ ]*([CSILFDX])[ ]*(:[ ]*([1-9]+[0-9]*))?[ ]*$");
+
+    // Tokenize the format
+    string buffer;
+    while (getline(stream, buffer, ';'))
+    {
+        if (ptr-size>=dat)
+        {
+            wout << kRed << "Format description '" << fmt << "' exceeds available data size (" << size << ")" << endl;
+            return;
+        }
+
+        boost::smatch what;
+        if (!boost::regex_match(buffer, what, expr))
+        {
+            wout << kRed << "Wrong format string '" << buffer << "'!" << endl;
+            return;
+        }
+
+        const string t = what[1]; // type id
+        const string n = what[3]; // counter
+
+        int cnt = atoi(n.c_str());
+
+        // Check if the format is just C (without a number)
+        // That would mean that it is a \0 terminated string
+        if (t[0]=='C' && cnt==0)
+        {
+            const string str(ptr);
+            text << ' ' << str;
+            ptr += str.length()+1;
+            break;
+        }
+
+        // if the :N part was not given assume 1
+        if (cnt==0)
+            cnt=1;
+
+        // Get as many items from the input line as requested
+        for (int j=0; j<cnt; j++)
+        {
+            text << ' ';
+
+            switch (t[0])
+            {
+            case 'C': text << Get<char>     (ptr); break;
+            case 'S': text << Get<short>    (ptr); break;
+            case 'I': text << Get<int>      (ptr); break;
+            case 'L': text << Get<long>     (ptr); break;
+            case 'F': text << Get<float>    (ptr); break;
+            case 'D': text << Get<double>   (ptr); break;
+            case 'X': text << Get<long long>(ptr); break;
+            default:
+                // This should never happen!
+                wout << kRed << "Format '" << t[0] << " not known!" << endl;
+                return;
+            }
+        }
+    }
+
+    if (ptr-size!=dat)
+    {
+        wout << kRed << "Data block size (" << size << ") doesn't fit format description '" << fmt << "'" << endl;
+        return;
+    }
+
+    rc = true;
+
+    const string &ref = text.str();
+    data.insert(data.begin(), ref.begin()+1, ref.end());
+    data.push_back(0);
+}
Index: /trunk/FACT++/src/Converter.h
===================================================================
--- /trunk/FACT++/src/Converter.h	(revision 10183)
+++ /trunk/FACT++/src/Converter.h	(revision 10183)
@@ -0,0 +1,33 @@
+#ifndef FACT_Converter
+#define FACT_Converter
+
+#include <vector>
+#include <ostream>
+
+class Converter
+{
+private:
+    bool rc;
+    std::ostream &wout;
+    std::vector<char> data;
+
+    template<class V>
+        void Eval(int i, std::stringstream &line, std::vector<char> &vec) const;
+
+    template<class T>
+        std::string Get(const char *&data) const;
+
+public:
+    Converter(std::ostream &out, const std::string &fmt, const std::string &str);
+    Converter(std::ostream &out, const std::string &fmt, const void *d, int size);
+
+    const char *Ptr() const { return &*data.begin(); }
+    const std::string Str() const { return std::string(&*data.begin(), data.size()); }
+    char *Ptr() { return &*data.begin(); }
+    int   Size() const { return data.size(); }
+    bool  GetRc() const { return rc; }
+
+
+};
+
+#endif
Index: /trunk/FACT++/src/DimErrorRedirecter.cc
===================================================================
--- /trunk/FACT++/src/DimErrorRedirecter.cc	(revision 10183)
+++ /trunk/FACT++/src/DimErrorRedirecter.cc	(revision 10183)
@@ -0,0 +1,66 @@
+// **************************************************************************
+/** @class DimErrorRedirecter
+
+*/
+// **************************************************************************
+#include "DimErrorRedirecter.h"
+
+#include <dic.hxx>
+
+#include "WindowLog.h"
+#include "MessageImp.h"
+
+using namespace std;
+
+int DimErrorRedirecter::cnt = 0;
+
+DimErrorRedirecter::DimErrorRedirecter(MessageImp &imp) : fMsg(imp)
+{
+    if (cnt++)
+    {
+        fMsg.Error("ERROR - More than one instance of MyHandlers.");
+        exit(-1);
+    }
+
+    DimClient::addErrorHandler(this);
+}
+
+void DimErrorRedirecter::errorHandler(int severity, int code, char *msg)
+{
+    switch (severity)
+    {
+    case DIM_FATAL:   fMsg.Error(msg); return;
+    case DIM_ERROR:   fMsg.Error(msg); return;
+    case DIM_WARNING: fMsg.Warn(msg);  return;
+    case DIM_INFO:    fMsg.Info(msg);  return;
+    }
+
+    stringstream str;
+    str << "Severity of Dim message unknown(" << severity << "): ";
+    str << msg << "(" << code << ")";
+    fMsg.Message(str);
+
+    /*
+     DIMDNSUNDEF	DIM_FATAL	DIM_DNS_NODE undefined
+     DIMDNSREFUS	DIM_FATAL	DIM_DNS refuses connection
+     DIMDNSDUPLC	DIM_FATAL	Service already exists in DNS
+     DIMDNSEXIT	        DIM_FATAL	DNS requests server to EXIT
+     DIMDNSTMOUT	DIM_WARNING	Server failed sending Watchdog
+
+     DIMDNSCNERR	DIM_ERROR	Connection to DNS failed
+     DIMDNSCNEST	DIM_INFO	Connection to DNS established
+
+     DIMSVCDUPLC	DIM_ERROR	Service already exists in Server
+     DIMSVCFORMT	DIM_ERROR	Bad format string for service
+     DIMSVCINVAL	DIM_ERROR	Invalid Service ID
+
+     DIMTCPRDERR	DIM_ERROR	TCP/IP read error
+     DIMTCPWRRTY	DIM_WARNING	TCP/IP write error - Retrying
+     DIMTCPWRTMO	DIM_ERROR	TCP/IP write error - Disconnected
+     DIMTCPLNERR	DIM_ERROR	TCP/IP listen error
+     DIMTCPOPERR	DIM_ERROR	TCP/IP open server error
+     DIMTCPCNERR	DIM_ERROR	TCP/IP connection error
+     DIMTCPCNEST	DIM_INFO	TCP/IP connection established
+     */
+}
+
Index: /trunk/FACT++/src/DimErrorRedirecter.h
===================================================================
--- /trunk/FACT++/src/DimErrorRedirecter.h	(revision 10183)
+++ /trunk/FACT++/src/DimErrorRedirecter.h	(revision 10183)
@@ -0,0 +1,22 @@
+#ifndef FACT_DimErrorRedirecter
+#define FACT_DimErrorRedirecter
+
+#include <dim.hxx>
+
+class MessageImp;
+
+class DimErrorRedirecter : public DimErrorHandler
+{
+private:
+    static int cnt;
+
+    MessageImp &fMsg;
+
+    void errorHandler(int severity, int code, char *msg);
+
+public:
+    DimErrorRedirecter(MessageImp &imp);
+
+};
+
+#endif
Index: /trunk/FACT++/src/Event.cc
===================================================================
--- /trunk/FACT++/src/Event.cc	(revision 10183)
+++ /trunk/FACT++/src/Event.cc	(revision 10183)
@@ -0,0 +1,122 @@
+// **************************************************************************
+/** @class Event
+
+@brief Concerete implementation of an EventImp stroring name, format, data and time
+
+This is the implementation of an event which can be posted to a state
+machine, hosting all the data itself. In addition to the base class
+it has storage for name, format, the data and a time stamp.
+
+*/
+// **************************************************************************
+#include "Event.h"
+
+#include <iostream>
+
+#include "Time.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Propagate the targetstate to the base class EventImp and store the
+//! name in fName and the format in fFormat. Initializes fTime to
+//! an invalid time.
+//!
+//! @param targetstate
+//!    Target state to be propagated to the base class constructor
+//!
+//! @param name
+//!    Name given to the event
+//!
+//! @param fmt
+//!    If the event has data attached (like arguments of commands)
+//!    the format can be given here. How the format string is defined
+//!    is defined within the dim libarary. It is used in console
+//!    and shell access to properly format the data sent with the event
+//!
+//! <B>From the dim manual:</B>
+//!    The format parameter specifies the contents of the structure in
+//!    the form T:N[;T:N]*[;T] where T is the item type: (I)nteger,
+//!    (C)haracter, (L)ong, (S)hort, (F)loat, (D)ouble, and N is the
+//!    number of such items. The type alone at the end means all
+//!    following items are of the same type. Example: "I:3;F:2;C" means
+//!    3 Integers, 2 Floats and Characters until the end. The format
+//!    parameter is used for communicating between different platforms.
+//!
+//
+Event::Event(int targetstate, const char *name, const char *fmt) : EventImp(targetstate),
+    fName(name), fFormat(fmt), fTime(Time::none)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Store the name in fName and the format in fFormat. Initializes fTime
+//! to an invalid time.
+//!
+//! @param name
+//!    Name given to the event
+//!
+//! @param fmt
+//!    If the event has data attached (like arguments of commands)
+//!    the format can be given here. How the format string is defined
+//!    is defined within the dim libarary. It is used in console
+//!    and shell access to properly format the data sent with the event
+//!
+//! <B>From the dim manual:</B>
+//!    The format parameter specifies the contents of the structure in
+//!    the form T:N[;T:N]*[;T] where T is the item type: (I)nteger,
+//!    (C)haracter, (L)ong, (S)hort, (F)loat, (D)ouble, and N is the
+//!    number of such items. The type alone at the end means all
+//!    following items are of the same type. Example: "I:3;F:2;C" means
+//!    3 Integers, 2 Floats and Characters until the end. The format
+//!    parameter is used for communicating between different platforms.
+//!
+//
+Event::Event(const string &name, const char *fmt) :
+    fName(name), fFormat(fmt), fTime(Time::none)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Copies the all contents from an EventImp. Note, that also the data
+//! area is copied. If the name contains a slash ('/') everything before
+//! the slash is removed.
+//!
+//! @param evt
+//!    Reference to an object of type EventImp.
+//
+Event::Event(const EventImp &evt) : EventImp(evt),
+fName(evt.GetName()), fFormat(evt.GetFormat()),
+fData(evt.GetText(), evt.GetText()+evt.GetSize()), fTime(evt.GetTime())
+{
+    const size_t pos = fName.find_first_of('/');
+    if (pos!=string::npos)
+        fName = fName.substr(pos+1);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Copies the all contents from an EventImp. fData is initialized from the
+//! given memory. If the name contains a slash ('/') everything before
+//! the slash is removed.
+//!
+//! @param evt
+//!    Reference to an object of type EventImp.
+//!
+//! @param ptr
+//!    Pointer to the memory region to be copied.
+//!
+//! @param siz
+//!    Size of the memory region to be copied.
+//
+Event::Event(const EventImp &evt, const char *ptr, size_t siz) : EventImp(evt),
+fName(evt.GetName()), fFormat(evt.GetFormat()),
+fData(ptr, ptr+siz)
+{
+    const size_t pos = fName.find_first_of('/');
+    if (pos!=string::npos)
+        fName = fName.substr(pos+1);
+}
Index: /trunk/FACT++/src/Event.h
===================================================================
--- /trunk/FACT++/src/Event.h	(revision 10183)
+++ /trunk/FACT++/src/Event.h	(revision 10183)
@@ -0,0 +1,54 @@
+#ifndef FACT_Event
+#define FACT_Event
+
+#include "EventImp.h"
+
+class Event : public EventImp
+{
+private:
+    std::string fName;       /// A name associated with the event
+    std::string fFormat;     /// A string describing the format of the data
+
+    std::vector<char> fData; /// Data associated with this event
+
+    Time  fTime;             /// Time stamp
+
+public:
+    /// Constructs an event as a combination of an EventImp and a DimCommand
+    Event(int targetstate, const char *name="", const char *fmt="");
+    Event(const std::string &name, const char *fmt="");
+    /// Copy constructor
+    Event(const EventImp &imp);
+    Event(const EventImp &imp, const char *name, size_t siz);
+
+
+    /// Return the stored name of the event
+    std::string GetName() const { return fName; }
+    /// Return the stored format of the data
+    std::string GetFormat() const { return fFormat; }
+
+    /// Return a pointer to the data region
+    const void *GetData() const { return &*fData.begin(); }
+    /// Return the size of the data
+    int         GetSize() const { return fData.size(); }
+
+    /// Return reference to a time stamp
+    Time GetTime() const { return fTime; }
+
+
+    void SetTime() { fTime = Time(); }
+    void SetData(const std::vector<char> &data) { fData = data; }
+    void SetData(const void *ptr, size_t siz) {
+        const char *c = reinterpret_cast<const char*>(ptr);
+        fData = std::vector<char>(c, c+siz); }
+
+    void SetInt(int i) { SetData(&i, sizeof(i)); }
+    void SetFloat(float f) { SetData(&f, sizeof(f)); }
+    void SetDouble(float d) { SetData(&d, sizeof(d)); }
+    void SetShort(short s) { SetData(&s, sizeof(s)); }
+    void SetText(const char *txt) { SetData(txt, strlen(txt)+1); }
+    void SetString(const std::string &str) { SetData(str.c_str(), str.length()+1); }
+
+};
+
+#endif
Index: /trunk/FACT++/src/EventDim.h
===================================================================
--- /trunk/FACT++/src/EventDim.h	(revision 10183)
+++ /trunk/FACT++/src/EventDim.h	(revision 10183)
@@ -0,0 +1,50 @@
+// **************************************************************************
+/** @class EventDim
+
+@brief Concerete implementation of an EventImp as a DimCommand
+
+This is the implementation of an event which can be posted to a state
+machine via the DIM network.
+
+@todo
+- Add reference to DIM docu
+- improve docu
+
+*/
+// **************************************************************************
+#ifndef FACT_EventDim
+#define FACT_EventDim
+
+#include "EventImp.h"
+
+#include "dis.hxx" // DimCommand
+
+class EventDim : public EventImp, public DimCommand
+{
+public:
+    EventDim(int target, const std::string &name, const std::string &format, DimCommandHandler *handler)
+        : EventImp(target), DimCommand(name.c_str(), format.c_str(), handler)
+    {
+        // Initialize these values from DimCommand, because DimCommand
+        // does not yet do it.
+        itsData   = 0;
+        itsSize   = 0;
+
+        secs      = 0;
+        millisecs = 0;
+    }
+
+    std::string GetName() const   { return const_cast<EventDim*>(this)->getName(); }
+    std::string GetFormat() const { return const_cast<EventDim*>(this)->getFormat(); }
+
+    const void *GetData() const   { return const_cast<EventDim*>(this)->getData(); }
+    int         GetSize() const   { return const_cast<EventDim*>(this)->getSize(); }
+
+    Time GetTime() const
+    {
+        return Time(const_cast<EventDim*>(this)->getTimestamp(),
+                    const_cast<EventDim*>(this)->getTimestampMillisecs());
+    }
+};
+
+#endif
Index: /trunk/FACT++/src/EventImp.cc
===================================================================
--- /trunk/FACT++/src/EventImp.cc	(revision 10183)
+++ /trunk/FACT++/src/EventImp.cc	(revision 10183)
@@ -0,0 +1,242 @@
+// **************************************************************************
+/** @class EventImp
+
+@brief A general base-class describing events issues in a state machine
+
+@section General purpose
+
+The general purpose of this class is to describe an event which can
+occur in one of our StateMachines. It provides pointers to data
+associated with the event, a target state and stores the states in which
+issuing this event is allowed. The target state might be negative to
+describe that no transition of the state is requested.
+
+Such an event canjust be a description of an event, but can also be
+an issued event which already contain data.
+
+The format can, but need not, contain the format of the data area.
+As a rule, it should follow the format also used in the DIM network.
+
+
+@section Assigning functions to an event
+
+To any event a function call can be assigned. Thanks to boost::bind there
+are various and different very powerful ways to do that. 
+
+The function assigned with AssignFunction must return int. When it is
+executed it is given a const reference of the current event as an argument,
+i.e. if you want to get such a reference in your function, you can reference
+it using the placeholder _1. (Remark: it is allowe to omit the _1 placeholder
+if no reference to the EventImp object is needed)
+
+A few examples:
+
+\code
+   int function(const EventImp &evt, int i, const char *txt) { return i; }
+
+   EventImp evt;
+   evt.AssignFunction(boost::bind(function, _1, 7, "hallo"));
+   cout << evt.Exec() << endl;
+   // 7
+\endcode
+
+When the function is executed later via ExecFunc() in will get a reference
+to the executing EventImp as its first argument (indicated by '_1'), it will
+get 7 and "hallo" as second and third argument.
+
+\code
+   int function(int i, const char *txt, const EventImp &evt) { return i; }
+
+   EventImp evt;
+   evt.AssignFunction(boost::bind(function, 7, "hallo", _1));
+   cout << evt.Exec() << endl;
+   // 7
+\endcode
+
+Is the same example than the one above, but the arguments are in a different
+order.
+
+\code
+   class A
+   {
+      int function(const EventImp &evt, int i, const char *txt)
+      {
+         cout << this << endl; return i;
+      }
+   };
+
+   A a;
+
+   EventImp evt;
+   evt.AssignFunction(boost::bind(&A::function, &a, _1, 7, "hallo"));
+   cout << evt.Exec() << endl;
+   // &a
+   // 7
+\endcode
+
+The advanatge of boost::bind is that it also works for member functions
+of classes. In this case the first argument after the function-pointer
+\b must be a pointer to a valid class-object. This can also be \em this
+if called from within a class object.
+
+Also note that everything (as usual) which is not a reference is copied
+when the bind function is invoked. If you want to distribute a reference
+instead use ref(something), like
+
+\code
+   int function(int &i)  { return i; }
+
+   int j = 5;
+   EventImp evt;
+   evt.AssignFunction(bind(function, ref(j));
+   j = 7;
+   cout << evt.Exec() << endl;
+   // 7
+\endcode
+
+Note, that you are responsible for the validity, that means: Do not
+destroy your object (eg. reference to j) while bind might still be called
+later, or a pointer to \em this.
+
+@section References
+   - <A HREF="http://www.boost.org/doc/libs/1_45_0/libs/bind/bind.html">boost::bind (V1.45.0)</A>
+
+@todo
+   Add link to DIM format
+
+*/
+// **************************************************************************
+#include "EventImp.h"
+
+#include <sstream>
+
+#include "Time.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Copy the contents of an EventImp (fTargetState, fAllowedStates and
+//!  fFunction)
+//
+EventImp::EventImp(const EventImp &cmd) :
+    fTargetState(cmd.fTargetState), fAllowedStates(cmd.fAllowedStates),
+    fFunction(cmd.fFunction)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! If the state is 0 or positive add it to fAllowedStates
+//!
+//! @param state
+//!     The state which should be added
+//
+void EventImp::AddAllowedState(int state)
+{
+    if (state>=0)
+        fAllowedStates.push_back(state);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Add all states in the string to fAllowedStates.
+//! 
+//! @param states
+//!    A string containing the states. They can either be separated by
+//!    whitespaces or commas, e.g. "1 2 3 4" or "1, 7, 9, 10". Note that
+//!    no real consistency check is done.
+//
+void EventImp::AddAllowedStates(const char *states)
+{
+    stringstream stream(states);
+
+    const bool sep = stream.str().find(',')==string::npos;
+
+    string buffer;
+    while (getline(stream, buffer, sep ? ' ' : ','))
+        AddAllowedState(atoi(buffer.c_str()));
+}
+
+// --------------------------------------------------------------------------
+//
+//! Return whether the given state is in the list of allowed states.
+//! 
+//! @param state
+//!    The state to look for in fAllowedStates
+//!
+//! @returns
+//!    If the given state is negative returns false. If the list of allowed
+//!    states is empty return true. Otherwise return whether the state
+//!    is found in fAllowedList or not.
+//
+bool EventImp::IsStateAllowed(int state) const
+{
+    // States with negative values are internal states and are
+    // never allowed
+    if (state<0)
+        return false;
+
+    // In case no allowed state is explicitly set
+    // all positive states are allowed
+    if (fAllowedStates.size()==0)
+        return true;
+
+    return find(fAllowedStates.begin(), fAllowedStates.end(), state)!=fAllowedStates.end();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Print the contents of the event to the given stream.
+//!
+//! @param out
+//!    An ostream to which the output should be redirected.
+//!
+void EventImp::Print(ostream &out) const
+{
+    out << " \xc2\xb7 ";
+
+    const string str = GetName();
+    if (!str.empty())
+        out << str;
+
+    const string fmt = GetFormat();
+    if (!fmt.empty())
+        out << "[" << fmt << "]";
+
+    out << ":";
+
+    for (unsigned int i=0; i<fAllowedStates.size(); i++)
+        out << " " << fAllowedStates[i];
+
+    if (fTargetState<0)
+        out << " [conf]";
+    else
+        out << " [trans->" << fTargetState << "]";
+
+    const Time tm = GetTime();
+
+    const bool t = tm!=Time::None && tm!=Time(1970,1,1);
+    const bool s = GetSize()>0;
+
+    if (s || t)
+        out << "(";
+    if (t)
+        out << tm.GetAsStr();
+    if (s && t)
+        out << "/";
+    if (s)
+        out << "size=" << GetSize();
+    if (s || t)
+        out << ")";
+    out << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls Print(std::cout)
+//
+void EventImp::Print() const
+{
+    Print(cout);
+}
Index: /trunk/FACT++/src/EventImp.h
===================================================================
--- /trunk/FACT++/src/EventImp.h	(revision 10183)
+++ /trunk/FACT++/src/EventImp.h	(revision 10183)
@@ -0,0 +1,62 @@
+#ifndef FACT_EventImp
+#define FACT_EventImp
+
+#include <string>
+#include <vector>
+
+#include <boost/function.hpp>
+
+#include "Time.h"
+
+class EventImp
+{
+    int              fTargetState;   /// Target state of an event
+    std::vector<int> fAllowedStates; /// List of states in which this event is allowed
+
+    /// http://www.boost.org/doc/libs/1_45_0/libs/bind/bind.html
+    boost::function<int(const EventImp &)> fFunction;
+
+public:
+    /// Constructor. Stores the target state given.
+    EventImp(int target=-1) : fTargetState(target) { }
+    /// Copy constructor
+    EventImp(const EventImp &cmd);
+
+    // Function handling
+    void AssignFunction(boost::function<int(const EventImp &)> func) { fFunction = func; }
+    bool HasFunc() const { return !fFunction.empty(); }
+    int ExecFunc() const { return HasFunc() ? fFunction(*this) : -1; }
+
+    // Print contents
+    virtual void Print(std::ostream &out) const;
+    virtual void Print() const;
+
+    // Handling of the states
+    void AddAllowedState(int state);
+    void AddAllowedStates(const char *states);
+
+    bool IsStateAllowed(int state) const;
+
+    int  GetTargetState() const { return fTargetState; }
+
+    // virtual function to return the data as stored in the derived classes
+    virtual std::string GetName() const   { return ""; }
+    virtual std::string GetFormat() const { return ""; }
+
+    virtual const void *GetData() const { return 0; }
+    virtual int         GetSize() const { return 0; }
+
+    virtual Time GetTime() const { return Time::None; }
+
+    // Getter for all the data contained (name, format, data and time)
+    short          GetShort()  const { return *reinterpret_cast<const short*>(GetData()); }
+    unsigned short GetUShort() const { return *reinterpret_cast<const unsigned short*>(GetData()); }
+    int            GetInt() const    { return *reinterpret_cast<const int*>(GetData()); }
+    unsigned int   GetUInt() const   { return *reinterpret_cast<const unsigned int*>(GetData()); }
+    float          GetFloat() const  { return *reinterpret_cast<const float*>(GetData()); }
+    double         GetDouble() const { return *reinterpret_cast<const double*>(GetData()); }
+    const char    *GetText() const   { return  reinterpret_cast<const char*>(GetData()); }
+
+};
+
+#endif
Index: /trunk/FACT++/src/LocalControl.cc
===================================================================
--- /trunk/FACT++/src/LocalControl.cc	(revision 10183)
+++ /trunk/FACT++/src/LocalControl.cc	(revision 10183)
@@ -0,0 +1,33 @@
+#include "LocalControl.h"
+
+#include "tools.h"
+
+string LocalConsole::GetUpdatePrompt() const
+{
+    const string beg = GetLinePrompt();
+
+    // Compile a string like "server:state> "
+    const string end =
+        Form("\033[34m\033[1m%s\033[0m:\033[32m\033[1m%s\033[0m> ",
+             fName.c_str(), fStateMachine->GetStateName().c_str());
+
+    // If we are continously flushing the buffer omit the buffer size
+    // If we are buffering show the buffer size
+    return "\n" + beg + " " + end;
+}
+
+//#include <boost/regex.hpp>
+
+string LocalShell::GetUpdatePrompt() const
+{
+    //const string s = (beg[0]=='\n'?beg.substr(1):beg) + " " + end;
+    //return boost::regex_replace(s, boost::regex("\033[[0-9]+m"), "");
+
+    const string beg = GetLinePrompt();
+
+    const string end =
+        Form("%s:%s> ", fName.c_str(),
+             fStateMachine->GetStateName().c_str());
+
+    return beg + " " + end;
+}
Index: /trunk/FACT++/src/LocalControl.h
===================================================================
--- /trunk/FACT++/src/LocalControl.h	(revision 10183)
+++ /trunk/FACT++/src/LocalControl.h	(revision 10183)
@@ -0,0 +1,138 @@
+#ifndef FACT_LocalControl
+#define FACT_LocalControl
+
+#include <ostream>
+
+class StateMachineImp;
+
+// **************************************************************************
+/** @class LocalControl
+
+@brief Implements a local control for a StateMachine based on a Readline class
+
+This template implements all functions which overwrite any function from the
+Readline class needed for a local control of a state machien. Since
+several derivatives of the Readline class implement different kind of
+Readline access, this class can be derived by any of them due to its
+template argument. However, the normal case will be deriving it from
+either Console or Shell.
+
+@tparam T
+   The base class for RemoteControl. Either Readlien or a class
+   deriving from it. This is usually either Console or Shell.
+
+**/
+// **************************************************************************
+#include <boost/filesystem.hpp>
+
+#include "WindowLog.h"
+#include "StateMachineImp.h"
+
+using namespace std;
+
+template <class T>
+class LocalControl : public T
+{
+private:
+    char **Completion(const char *text, int pos, int)
+    {
+        return pos>0 ? 0 : T::Complete(fStateMachine->GetEventNames(), text);
+    }
+
+protected:
+    StateMachineImp *fStateMachine;
+
+    std::ostream &lout;
+
+    std::string fName;
+
+    LocalControl(const char *name) : T(name), 
+        fStateMachine(0), lout(T::GetStreamIn()),
+        fName(boost::filesystem::path(name).filename())
+    { }
+
+    //bool PrintGeneralHelp()
+    //bool PrintKeyBindings()
+    bool PrintCommands()
+    {
+        lout << endl << kBold << "List of commands:" << endl;
+        fStateMachine->PrintListOfEvents(lout);
+        //lout << endl;
+
+        return true;
+    }
+
+    bool Process(const std::string &str)
+    {
+        if (T::Process(str))
+            return true;
+
+        return !fStateMachine->PostEvent(lout, str);
+    }
+
+public:
+
+    void SetReceiver(StateMachineImp &imp) { fStateMachine = &imp; }
+
+    void Run(const char * = 0)
+    {
+        lout << endl;
+        lout << kBlue << kBold << "You are on the " << fName << " terminal of the MCP -" << endl;
+        lout << kBlue << kBold << "the Master Control Program." << endl;
+        lout << endl;
+        lout << kBlue << kBold << "Hello Flynn..." << endl;
+        lout << endl;
+
+        T::Run();
+    }
+};
+
+// **************************************************************************
+/** @class LocalConsole
+
+@brief Derives the LocalControl from Control and adds prompt
+
+This is basically a LocalControl, which derives through the template
+argument from the Console class. It enhances the functionality of
+the local control with a proper updated prompt.
+
+ */
+// **************************************************************************
+#include "Console.h"
+#include "tools.h"
+
+class LocalConsole : public LocalControl<Console>
+{
+public:
+    LocalConsole(const char *name, bool continous=false)
+        : LocalControl<Console>(name)
+    {
+        SetContinous(continous);
+    }
+
+    string GetUpdatePrompt() const;
+};
+
+// **************************************************************************
+/** @class LocalShell
+
+@brief Derives the LocalControl from Shell and adds a colored prompt
+
+This is basically a LocalControl, which derives through the template
+argument from the Shell class. It enhances the functionality of
+the local control with a proper updated prompt.
+
+ */
+// **************************************************************************
+#include "Shell.h"
+
+class LocalShell : public LocalControl<Shell>
+{
+public:
+    LocalShell(const char *name, bool = false)
+        : LocalControl<Shell>(name) { }
+
+    string GetUpdatePrompt() const;
+};
+
+#endif
Index: /trunk/FACT++/src/MessageDim.cc
===================================================================
--- /trunk/FACT++/src/MessageDim.cc	(revision 10183)
+++ /trunk/FACT++/src/MessageDim.cc	(revision 10183)
@@ -0,0 +1,149 @@
+#include "MessageDim.h"
+
+#include "tools.h"
+#include "Time.h"
+
+using namespace std;
+
+// **************************************************************************
+/** @class MessageDimTX
+
+@brief Based on MessageImp, redirects log-output to a Dim service MESSAGE
+
+This is a special DimService which offers SERVER/MESSAGE to the DimNetwork
+and redirects output issued via its base-class MessageImp to the Dim
+service. The severity of the message is send as qualiy of service of
+the service message.
+
+@section Examples
+
+ - A simple and usefull example can be found in \ref log.cc and \ref logtime.cc
+
+**/
+// **************************************************************************
+
+// --------------------------------------------------------------------------
+//
+//! Constructs a DimService with the name SERVER/MESSAGE. And passes the
+//! given ostream down to the MessageImp base.
+//!
+//! @param name
+//!    Name of the message server to which we want to subscribe, e.g. DRIVE
+//!
+//! @param out
+//!    ostream passed to MessageImp. It is used to redirect the output to.
+//
+MessageDimTX::MessageDimTX(const std::string &name, std::ostream &out)
+: DimService((name + "/MESSAGE").c_str(), const_cast<char*>("")),
+MessageImp(out)
+{
+    // This is a message which will never arrive because
+    // the time to establish a client-sever connection is
+    // too short.
+    Message("MessageDim service started.");
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+MessageDimTX::~MessageDimTX()
+{
+    Message("MessageDim service shutting down..");
+}
+
+// --------------------------------------------------------------------------
+//
+//! First calls MessageImp::Write to output the message tobe transmitted
+//! also to a local logging stream. Then the Dim service is updated.
+//! If sending of the message failed a message is written to the
+//! logging stream stored in MessageImp. It is intentionally not
+//! output through Update to make it look different than usual
+//! transmitted messages.
+//
+int MessageDimTX::Write(const Time &t, const char *txt, int qos)
+{
+    MessageImp::Write(t, txt, qos);
+
+    // We have to use setData to make sure the DimService will
+    // hold a local copy of the data.
+    setQuality(qos);
+    setData(const_cast<char*>(txt));
+    const int rc = updateService();
+
+    if (rc==0)
+        Out() << " !! " << t.GetAsStr() << ": Sending failed!" << endl;
+
+    return rc;
+}
+
+
+
+// **************************************************************************
+/** @class MessageDimRX
+
+@brief Based on MessageImp, subscribes to a MESSAGE service in the Dim network
+
+This is a special DimInfoHandler. It subscribes to a service SERVER/MESSAGE
+on the DimNetwork and redirects all received output to its base class
+MessageImp view MessageImp::Write. the quality of service received with
+each service update is passed as severity.
+
+@section Examples
+
+ - A simple and usefull example can be found in \ref log.cc and \ref logtime.cc
+
+ @todo Maybe it is not a good idea that MessageImp is a base class,
+ maybe it should be a reference given in the constructor
+
+**/
+// **************************************************************************
+
+// --------------------------------------------------------------------------
+//
+//! Setup a DimStamedInfo service subscription for SERVER/MESSAGE
+//!
+//! @param name
+//!    the name of the SERVER
+//!
+//! @param imp
+//!    A reference to MessageImo to which messages will be redirected
+//
+MessageDimRX::MessageDimRX(const std::string &name, MessageImp &imp)
+: fMsg(imp),
+fDimMessage(Form("%s/MESSAGE", name.c_str()).c_str(), const_cast<char*>(""), this)
+{
+    fMinLogLevel = 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! If the server has been disconnected write a simple log-message.
+//! Skip all received messages which have a severity smaller than
+//! fMinLogLevel. Write any other message with MessageImp::Write.
+//
+void MessageDimRX::infoHandler()
+{
+    if (getInfo()!=&fDimMessage)
+        return;
+
+    // The server is diconnected. Do nothing
+    if (getInfo()->getTimestamp()==0)
+    {
+        fMsg.Message("Disconnected.");
+        return;
+    }
+
+    // skip all messages with a severity smaller than the minimum log level
+    if (getInfo()->getQuality()<fMinLogLevel)
+        return;
+
+    const string n = getInfo()->getName();
+
+    stringstream msg;
+    msg << n.substr(0, n.find_first_of('/')) << ": " << getInfo()->getString();
+
+    // Write the received message to the output
+    fMsg.Write(Time(getInfo()->getTimestamp(), getInfo()->getTimestampMillisecs()),
+               msg.str().c_str(), getInfo()->getQuality());
+}
Index: /trunk/FACT++/src/MessageDim.h
===================================================================
--- /trunk/FACT++/src/MessageDim.h	(revision 10183)
+++ /trunk/FACT++/src/MessageDim.h	(revision 10183)
@@ -0,0 +1,42 @@
+#ifndef FACT_MessageDim
+#define FACT_MessageDim
+
+#include "MessageImp.h"
+
+
+
+#include <dis.hxx> // DimService
+
+class MessageDimTX : public DimService, public MessageImp
+{
+public:
+    MessageDimTX(const std::string &name, std::ostream &out=std::cout);
+    ~MessageDimTX();
+
+    int Write(const Time &t, const char *txt, int qos=kInfo);
+};
+
+
+
+#include <dic.hxx> // DimStampedInfo
+
+class MessageDimRX : public DimInfoHandler
+{
+protected:
+    MessageImp &fMsg;
+
+private:
+    DimStampedInfo fDimMessage;
+
+    int fMinLogLevel;
+
+protected:
+    void infoHandler();
+
+public:
+    MessageDimRX(const std::string &name, MessageImp &imp);
+
+    void SetMinLogLevel(int min=0) { fMinLogLevel=min; }
+};
+
+#endif
Index: /trunk/FACT++/src/MessageImp.cc
===================================================================
--- /trunk/FACT++/src/MessageImp.cc	(revision 10183)
+++ /trunk/FACT++/src/MessageImp.cc	(revision 10183)
@@ -0,0 +1,122 @@
+// **************************************************************************
+/** @class MessageImp
+
+@brief The base implementation of a distributed messaging system
+
+
+Overwriting the Write() member function allows to change the look and
+feel and also the target of the messages issued through a MessageImp
+
+**/
+// **************************************************************************
+#include "MessageImp.h"
+
+#include <stdarg.h>
+
+#include "tools.h"
+#include "Time.h"
+#include "WindowLog.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Stores a reference to the given ostream in fOut. This is the stream to
+//! which all messaged issued are redirected by default if Write() has
+//! not been overwritten doing something else
+//!
+//! The stored reference can be accessed by either
+//!    operator()() or Out()
+//!
+//! Note, that you have to ensure the stream which is references doesn't
+//! go out of scope while in use by MessageImp or one of its derivatives.
+//!
+//! @param out
+//!    ostream to which the output should be redirected
+//
+MessageImp::MessageImp(std::ostream &out) : fOut(out)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! The basic implementation of the output of a message to the output
+//! stream. This can overwritten by inheriting classes. The default is
+//! to redirect the message to the stream fOut. In addition colors
+//! from WindowLog are used depending on the severity. The color are ignored
+//! if the stream is not of type WindowLog.
+//!
+//! The default message has the form:
+//!     ## 2011-02-22 11:13:32.000754 - Text message.
+//!
+//! while ## is a placeholder depending on the severity of the message, e.g.
+//!
+//!     kMessage:  default    ->
+//!     kInfo:     green      I>
+//!     kWarn:     yellow     W>
+//!     kError:    red        E>
+//!     kFatal:    red-blink  !>
+//!     kDebug:    blue
+//!     default:   bold       >>
+//!
+//! @param time
+//!    The time assigned to the message
+//!
+//! @param txt
+//!    The message text
+//!
+//! @param severity
+//!    The severity of the message
+//
+int MessageImp::Write(const Time &time, const char *txt, int severity)
+{
+    switch (severity)
+    {
+    case kMessage: fOut << kDefault       << " -> "; break;
+    case kInfo:    fOut << kGreen         << " I> "; break;
+    case kWarn:    fOut << kYellow        << " W> "; break;
+    case kError:   fOut << kRed           << " E> "; break;
+    case kFatal:   fOut << kRed << kBlink << " !> "; break;
+    case kDebug:   fOut << kBlue          << "    "; break;
+    default:       fOut << kBold          << " >> "; break;
+    }
+    fOut << time.GetAsStr() << " - " << txt << endl;
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls Write with the current time the message text and the severity.
+//!
+//! @param txt
+//!    The message text to be passed to Write
+//!
+//! @param severity
+//!    The severity of the message to be passed to Write
+//
+int MessageImp::Update(const char *txt, int severity)
+{
+    Write(Time(), txt, severity);
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Just a helper to format the message according to the user input.
+//! See the documentation of printf for details.
+//!
+//! @param severity
+//!    The severity of the message to be passed to Write
+//!
+//! @param fmt
+//!    Format string according to which the text is formatted
+//
+int MessageImp::Update(int severity, const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+    string str = Format(fmt, ap);
+    va_end(ap);
+    return Update(str, severity);
+}
Index: /trunk/FACT++/src/MessageImp.h
===================================================================
--- /trunk/FACT++/src/MessageImp.h	(revision 10183)
+++ /trunk/FACT++/src/MessageImp.h	(revision 10183)
@@ -0,0 +1,59 @@
+#ifndef FACT_MessageImp
+#define FACT_MessageImp
+
+#include <string>
+#include <sstream>
+#include <iostream>
+
+class Time;
+
+class MessageImp
+{
+public:
+    /// Severity of a message
+    enum Severity
+    {
+        kMessage = 10, ///< Just a message, usually obsolete
+        kInfo    = 20, ///< An info telling something which can be interesting to know
+        kWarn    = 30, ///< A warning, things that somehow might result in unexpected or unwanted bahaviour
+        kError   = 40, ///< Error, something unexpected happened, but can still be handled by the program
+        kFatal   = 50, ///< An error which cannot be handled at all happend, the only solution is program termination
+        kDebug   = 99, ///< A message used for debugging only
+    };
+
+private:
+    std::ostream &fOut; /// The ostream to which by default Write redirects its output
+
+public:
+    MessageImp(std::ostream &out=std::cout);
+
+    virtual int Write(const Time &time, const char *txt, int qos=kInfo);
+
+    int Update(const char *txt, int qos=kInfo);
+    int Update(const std::string &str, int qos=kInfo) { return Update(str.c_str(), qos); }
+    int Update(const std::stringstream &str, int qos=kInfo) { return Update(str.str(), qos); }
+    int Update(int qos, const char *fmt, ...);
+
+    int Message(const char *txt) { return Update(txt, kMessage); }
+    int Info(const char *txt)    { return Update(txt, kInfo);    }
+    int Warn(const char *txt)    { return Update(txt, kWarn);    }
+    int Error(const char *txt)   { return Update(txt, kError);   }
+    int Fatal(const char *txt)   { return Update(txt, kFatal);   }
+
+    int Message(const std::string &str) { return Message(str.c_str()); }
+    int Info(const std::string &str)    { return Info(str.c_str());    }
+    int Warn(const std::string &str)    { return Warn(str.c_str());    }
+    int Error(const std::string &str)   { return Error(str.c_str());   }
+    int Fatal(const std::string &str)   { return Fatal(str.c_str());   }
+
+    int Message(const std::stringstream &str) { return Message(str.str()); }
+    int Info(const std::stringstream &str)    { return Info(str.str());    }
+    int Warn(const std::stringstream &str)    { return Warn(str.str());    }
+    int Error(const std::stringstream &str)   { return Error(str.str());   }
+    int Fatal(const std::stringstream &str)   { return Fatal(str.str());   }
+
+    std::ostream &operator()() { return fOut; }
+    std::ostream &Out() { return fOut; }
+};
+
+#endif
Index: /trunk/FACT++/src/Readline.cc
===================================================================
--- /trunk/FACT++/src/Readline.cc	(revision 10183)
+++ /trunk/FACT++/src/Readline.cc	(revision 10183)
@@ -0,0 +1,1031 @@
+// **************************************************************************
+/** @class Readline
+
+@brief C++ wrapper for GNU's readline library
+
+This class is meant as a C++ wrapper around GNU's readline library.
+Note that because readline uses a global namespace only one instance
+of this class can exist at a time. Instantiating a second object after
+a first one was deleted might show unexpected results.
+
+When the object is instantiated readline's history is read from a file.
+At destruction the history in memory is copied back to that file.
+The history file will be truncated to fMaxLines.
+
+By overloading the Readline class the function used for auto-completion
+can be overwritten.
+
+Simple example:
+
+\code
+
+   Readline rl("MyProg"); // will read the history from "MyProg.his"
+   while (1)
+   {
+        string txt = rl.Prompt("prompt> ");
+        if (txt=="quit)
+           break;
+
+        // ... do something ...
+
+        rl.AddHistory(txt);
+   }
+
+   // On destruction the history will be written to the file
+
+\endcode
+
+Simpler example (you need to implement the Process() function)
+
+\code
+
+   Readline rl("MyProg"); // will read the history from "MyProg.his"
+   rl.Run("prompt> ");
+
+   // On destruction the history will be written to the file
+
+\endcode
+
+@section References
+
+ - <A HREF="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html">GNU Readline</A>
+
+ */
+// **************************************************************************
+#include "Readline.h"
+
+#include <fstream>
+#include <iostream>
+
+#include <readline/readline.h>
+#include <readline/history.h>
+
+#include "tools.h"
+
+using namespace std;
+
+Readline *Readline::This = 0;
+
+// --------------------------------------------------------------------------
+//
+//! Construct a Readline object. The constructor reads the history from a
+//! history file. The filename is compiled by adding ".his" to the
+//! supplied argument. The name oif the history file is stored in fName.
+//!
+//! Since readline has a global namespace, the creation of only one
+//! Readline instance is allowed.
+//!
+//! The provided program name is supplied to readline by means of
+//! rl_readline_name.
+//!
+//! Readlines default callback frunction for completions is redirected
+//! to CompletionImp which in turn will call Completion, which can be
+//! overwritten by the user.
+//!
+//! Bind some default key sequences like Page-up/-down for searching forward
+//! and backward in history.
+//!
+//! @param prgname
+//!    The prefix of the history filename. Usually the program name, which
+//!    can be initialized by argv[0].
+//
+Readline::Readline(const char *prgname) :
+    fMaxLines(500), fLine(0), fCompletion(0)
+{
+    if (This)
+    {
+        cout << "ERROR - Readline can only be instatiated once!" << endl;
+        exit(-1);
+    }
+
+    This = this;
+
+    // Alternative completion function
+    rl_attempted_completion_function = rl_ncurses_completion_function;
+
+    // Program name
+    rl_readline_name = prgname;
+
+    // Compile filename for history file
+    fName = string(prgname)+".his";
+
+    // Read history file
+    if (read_history(fName.c_str()))
+        cout << "WARNING - Reading " << fName << ": " << strerror(errno) << endl;
+
+    // Setup the readline callback which are needed to redirect
+    // the otuput properly to our ncurses panel
+    rl_getc_function                   = rl_ncurses_getc;
+    rl_startup_hook                    = rl_ncurses_startup;
+    rl_redisplay_function              = rl_ncurses_redisplay;
+    rl_event_hook                      = rl_ncurses_event_hook;
+    rl_completion_display_matches_hook = rl_ncurses_completion_display;
+
+    // Bind delete, page up, page down
+    rl_bind_keyseq("\e[3~",  rl_named_function("delete-char"));
+    rl_bind_keyseq("\e[5~",  rl_named_function("history-search-backward"));
+    rl_bind_keyseq("\e[6~",  rl_named_function("history-search-forward"));
+    rl_bind_keyseq("\033[1;3F", rl_named_function("kill-line"));
+    rl_bind_keyseq("\033[1;5D", rl_named_function("backward-word"));
+    rl_bind_keyseq("\033[1;5C", rl_named_function("forward-word"));
+    rl_bind_key(25, rl_named_function("kill-whole-line"));
+
+    //for (int i=0; i<10; i++) cout << (int)getchar() << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Writes the current history to the file with the name stored in fName.
+//! In addition the written file is truncated to fMaxLines to keep the
+//! file of a reasonable size. The number of lines fMaxLines can be set
+//! by SetMaxLines before the destructor is called. Setting fMaxLines
+//! to 0 or a negative value switches automatic truncation off.
+//
+Readline::~Readline()
+{
+    // Write current history to file
+    if (write_history(fName.c_str()))
+        cout << "WARNING - Write " << fName.c_str() << ": " << strerror(errno) << endl;
+
+    // Truncate file
+    if (fMaxLines>0 && history_truncate_file(fName.c_str(), fMaxLines))
+        cout << "WARNING - Truncate " << fName.c_str() << ": " << strerror(errno) << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is a static helper to remove leading and trailing whitespaces.
+//!
+//! @param buf
+//!    a pointer to the char array from which the whitespaces should be
+//!    removed
+//!
+//! @returns
+//!    a std::string with the whitespaces removed from buf
+//
+string Readline::TrimSpaces(const char *buf)
+{
+    const string str(buf);
+
+    // Trim Both leading and trailing spaces
+    const size_t start = str.find_first_not_of(" "); // Find the first character position after excluding leading blank spaces
+    const size_t end   = str.find_last_not_of(" ");  // Find the first character position from reverse af
+
+    // if all spaces or empty return an empty string
+    if (string::npos==start || string::npos==end)
+        return "";
+
+    return str.substr(start, end-start+1);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Redirected from rl_getc_function, calls Getc
+//
+int Readline::rl_ncurses_getc(FILE *f)
+{
+    return This->Getc(f);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Redirected from rl_startup_hook, calls Startup.
+//! A function called just before readline prints the first prompt.
+//
+int Readline::rl_ncurses_startup()
+{
+    This->Startup();
+    return 0; // What is this for?
+}
+
+// --------------------------------------------------------------------------
+//
+//! Redirected from rl_redisplay_function, calls Redisplay.
+//! Readline will call indirectly to update the display with the current
+//! contents of the editing buffer. 
+//
+void Readline::rl_ncurses_redisplay()
+{
+    This->Redisplay();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Redirected from rl_event_hook, calls Update().
+//! A function called periodically when readline is waiting for
+//! terminal input.
+//!
+int Readline::rl_ncurses_event_hook()
+{
+    This->EventHook();
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Redirected from rl_completion_display_matches_hook,
+//! calls CompletionDisplayImp
+//!
+//! A function to be called when completing a word would normally display
+//! the list of possible matches. This function is called in lieu of
+//! Readline displaying the list. It takes three arguments:
+//! (char **matches, int num_matches, int max_length) where matches is
+//! the array of matching strings, num_matches is the number of strings
+//! in that array, and max_length is the length of the longest string in
+//! that array. Readline provides a convenience function,
+//! rl_display_match_list, that takes care of doing the display to
+//! Readline's output stream. 
+//
+void Readline::rl_ncurses_completion_display(char **matches, int num, int max)
+{
+    This->CompletionDisplay(matches, num, max);
+}
+
+char **Readline::rl_ncurses_completion_function(const char *text, int start, int end)
+{
+    return This->Completion(text, start, end);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls the default rl_getc function.
+//
+int  Readline::Getc(FILE *f)
+{
+    return rl_getc(f);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Default: Do nothing.
+//
+void Readline::Startup()
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! The default is to redisplay the prompt which is gotten from
+//! GetUpdatePrompt(). If GetUpdatePrompt() returns an empty string the
+//! prompt is kept untouched. This can be used to keep a prompt updated
+//! with some information (e.g. time) just by overwriting GetUpdatePrompt()
+//!
+void Readline::EventHook()
+{
+    const string p = GetUpdatePrompt();
+    if (p.empty())
+        return;
+
+    UpdatePrompt("");
+    Redisplay();
+    UpdatePrompt(p);
+    Redisplay();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Called from Prompt and PromptEOF after readline has returned. It is
+//! meant as the opposite of Startup (called after readline finsihes)
+//! The default is to do nothing.
+//!
+//! @param buf
+//!    A pointer to the buffer returned by readline
+//
+void Readline::Shutdown(const char *)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Default: call rl_redisplay()
+//
+void Readline::Redisplay()
+{
+    rl_redisplay();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Default: call rl_completion_display_matches()
+//
+void Readline::CompletionDisplay(char **matches, int num, int max)
+{
+    rl_display_match_list(matches, num, max);
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is a static helper for the compilation of a completion-list.
+//! It compares the two inputs (str and txt) to a maximum of the size of
+//! txt. If they match, memory is allocated with malloc and a pointer to
+//! the null-terminated version of str is returned.
+//!
+//! @param str
+//!    A reference to the string which is checked (e.g. "Makefile.am")
+//!
+//! @param txt
+//!    A reference to the part of the string the user has already typed,
+//!    e.g. "Makef"
+//!
+//! @returns
+//!    A pointer to memory allocated with malloc containing the string str
+//
+char *Readline::Compare(const string &str, const string &txt)
+{
+    return str.substr(0, txt.length())==txt ? strndup(str.c_str(), str.length()) : 0;
+}
+
+char **Readline::CompletionMatches(const char *text, char *(*func)(const char*, int))
+{
+    return rl_completion_matches(text, func);
+}
+
+// --------------------------------------------------------------------------
+//
+//! The given vector should be a reference to a vector of strings
+//! containing all possible matches. The actual match-making is then
+//! done in Complete(const char *, int)
+//!
+//! The pointer fCompletion is redirected to the vector for the run time
+//! of the function, but restored afterwards. So by this you can set a
+//! default completion list in case Complete is not called or Completion
+//! not overloaded.
+//!
+//! @param v
+//!    reference to a vector of strings with all possible matches
+//!
+//! @param text
+//!    the text which should be matched (it is just propagated to
+//!    Readline::Completion)
+//!
+char **Readline::Complete(const vector<string> &v, const char *text)
+{
+    const vector<string> *save = fCompletion;
+
+    fCompletion = &v;
+    char **rc = rl_completion_matches(const_cast<char*>(text), CompleteImp);
+    fCompletion = save;
+
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
+//! If fCompletion==0 the default is to call readline's
+//! rl_filename_completion_function. Otherwise the contents of fCompletion
+//! are returned. To change fCompletion either initialize it via
+//! SetCompletion() (in this case you must ensure the life time of the
+//! object) or call
+//!    Complete(const vector<string>&, const char*)
+//! from
+//!    Completion(const char * int, int)
+//!
+//! This is the so called generator function, the readline manual says
+//! about this function:
+//!
+//!   The generator function is called repeatedly from
+//!   rl_completion_matches(), returning a string each time. The arguments
+//!   to the generator function are text and state. text is the partial word
+//!   to be completed. state is zero the first time the function is called,
+//!   allowing the generator to perform any necessary initialization, and a
+//!   positive non-zero integer for each subsequent call. The generator
+//!   function returns (char *)NULL to inform rl_completion_matches() that
+//!   there are no more possibilities left. Usually the generator function
+//!   computes the list of possible completions when state is zero, and
+//!   returns them one at a time on subsequent calls. Each string the
+//!   generator function returns as a match must be allocated with malloc();
+//!   Readline frees the strings when it has finished with them.
+//
+char *Readline::Complete(const char* text, int state)
+{
+    if (fCompletion==0)
+        return rl_filename_completion_function(text, state);
+
+    static vector<string>::const_iterator pos;
+    if (state==0)
+        pos = fCompletion->begin();
+
+    while (pos!=fCompletion->end())
+    {
+        char *rc = Compare(*pos++, text);
+        if (rc)
+            return rc;
+    }
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls Complete()
+//
+char *Readline::CompleteImp(const char* text, int state)
+{
+    return This->Complete(text, state);
+}
+
+// --------------------------------------------------------------------------
+//
+//! The readline manual says about this function:
+//!
+//!   A  pointer to an alternative function to create matches. The
+//!   function is called with text, start, and end. start and end are
+//!   indices in rl_line_buffer saying what the boundaries of text are.
+//!   If this function exists and returns NULL, or if this variable is
+//!   set to NULL, then rl_complete() will call the value of
+//!   rl_completion_entry_function to generate matches, otherwise the
+//!   array of strings returned will be used.
+//!
+//! This function is virtual and can be overwritten. It defaults to
+//! a call to rl_completion_matches with CompleteImp as an argument
+//! which defaults to filename completion, but can also be overwritten.
+//!
+//! It is suggested that you call
+//!    Complete(const vector<string>&, const char*)
+//! from here.
+//!
+//! @param text
+//!    A pointer to a char array conatining the text which should be
+//!    completed. The text is null-terminated.
+//!
+//! @param start
+//!    The start index within readline's line buffer rl_line_buffer,
+//!    at which the text starts which presumably should be completed.
+//!
+//! @param end
+//!    The end index within readline's line buffer rl_line_buffer,
+//!    at which the text ends which presumably should be completed.
+//!
+//! @returns
+//!    An array of strings which were allocated with malloc and which
+//!    will be freed by readline with the possible matches.
+//
+char **Readline::Completion(const char *text, int /*start*/, int /*end*/)
+{
+    // To do filename completion call
+    return rl_completion_matches((char*)text, CompleteImp);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Adds the given string to the history buffer of readline's history by
+//! calling add_history. If skip is set to true str will be compared
+//! with the last line added to the history and only be added if it difers.
+//!
+//! @param str
+//!    A reference to a string which should be added to readline's
+//!    history.
+//!
+//! @param skip
+//!    If skip is true do not add a new entry if it is identical to
+//!    the last one.
+//
+void Readline::AddToHistory(const string &str, bool skip)
+{
+    if (skip && fLastLine==str)
+        return;
+
+    if (str.empty())
+        return;
+
+    add_history(str.c_str());
+    fLastLine = str;
+}
+
+string Readline::GetLinePrompt() const
+{
+    return Form("[%d]", fLine);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls rl_set_prompt. This can be used from readline's callback function
+//! to change the prompt while a call to the readline function is in
+//! progress.
+//!
+//! @param prompt
+//!     The new prompt to be shown
+//
+void Readline::UpdatePrompt(const string &prompt) const
+{
+    rl_set_prompt(prompt.c_str());
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function is used to bind a key sequence via a call to
+//! rl_bind_keyseq.
+//!
+//! Readline's manual says about this function:
+//!
+//!   Bind the key sequence represented by the string keyseq to the
+//!   function function, beginning in the current keymap. This makes
+//!   new keymaps as necessary. The return value is non-zero if keyseq
+//!   is invalid.
+//!
+//! Key sequences are escaped sequences of characters read from an input
+//! stream when a special key is pressed. This is necessary because
+//! there are usually more keys and possible combinations than ascii codes.
+//!
+//! Possible key sequences are for example:
+//!   "\033OP"       F1
+//!   "\033[1;5A"    Ctrl+up
+//!   "\033[1;5B"    Ctrl+down
+//!   "\033[1;3A"    Alt+up
+//!   "\033[1;3B"    Alt+down
+//!   "\033[5;3~"    Alt+page up
+//!   "\033[6;3~"    Alt+page down
+//!   "\033+"        Alt++
+//!   "\033-"        Alt+-
+//!   "\033\t"       Alt+tab
+//!   "\033[1~"      Alt+tab
+//!
+//! @param seq
+//!     The key sequence to be bound
+//!
+//! @param func
+//!     A function of type "int func(int, int)
+//
+void Readline::BindKeySequence(const char *seq, int (*func)(int, int))
+{
+    rl_bind_keyseq(seq, func);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls rl_variable_dumper(1)
+//!
+//!   Print the readline variable names and their current values
+//!   to rl_outstream. If readable is non-zero, the list is formatted
+//!   in such a way that it can be made part of an inputrc file and
+//!   re-read.
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+bool Readline::DumpVariables()
+{
+    rl_variable_dumper(1);
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls rl_function_dumper(1)
+//!
+//!   Print the readline function names and the key sequences currently
+//!   bound to them to rl_outstream. If readable is non-zero, the list
+//!   is formatted in such a way that it can be made part of an inputrc
+//!   file and re-read.
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+bool Readline::DumpFunctions()
+{
+    rl_function_dumper(1);
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls rl_list_funmap_names()
+//!
+//!    Print the names of all bindable Readline functions to rl_outstream.
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+bool Readline::DumpFunmap()
+{
+    rl_list_funmap_names();
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Sets rl_outstream (the stdio stream to which Readline performs output)
+//! to the new stream.
+//!
+//! @param f
+//!    The new stdio stream to which readline should perform its output
+//!
+//! @return
+//!    The old stream to which readline was performing output
+//
+FILE *Readline::SetStreamOut(FILE *f)
+{
+    FILE *rc = rl_outstream;
+    rl_outstream = f;
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Sets rl_instream (the stdio stream from which Readline reads input)
+//! to the new stream.
+//!
+//! @param f
+//!    The new stdio stream from which readline should read its input
+//!
+//! @return
+//!    The old stream from which readline was reading it input
+//
+FILE *Readline::SetStreamIn(FILE *f)
+{
+    FILE *rc = rl_instream;
+    rl_instream = f;
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
+//! return rl_display_prompt (the prompt which should currently be
+//! displayed on the screen) while a readline command is in progress
+//
+string Readline::GetPrompt()
+{
+    return rl_display_prompt;
+}
+
+// --------------------------------------------------------------------------
+//
+//! return rl_line_buffer (the current input line which should currently be
+//! displayed on the screen) while a readline command is in progress
+//!
+//! The length of the current line buffer (rl_end) is available as
+//! GetLineBuffer().size()
+//!
+//! Note that after readline has returned the contents of rl_end might
+//! not reflect the correct buffer length anymore, hence, the returned buffer
+//! might be truncated.
+//
+string Readline::GetBuffer()
+{
+    return string(rl_line_buffer, rl_end);
+}
+
+// --------------------------------------------------------------------------
+//
+//! return rl_point (the current cursor position within the line buffer)
+//
+int Readline::GetCursor()
+{
+    return rl_point;
+}
+
+// --------------------------------------------------------------------------
+//
+//! return strlen(rl_display_prompt) + rl_point
+//
+int Readline::GetAbsCursor()
+{
+    return strlen(rl_display_prompt) + rl_point;
+}
+
+// --------------------------------------------------------------------------
+//
+//! return rl_end (the current total length of the line buffer)
+//! Note that after readline has returned the contents of rl_end might
+//! not reflect the correct buffer length anymore.
+//
+int Readline::GetBufferLength()
+{
+    return rl_end;
+}
+
+// --------------------------------------------------------------------------
+//
+//! return the length of the prompt plus the length of the line buffer
+//
+int Readline::GetLineLength()
+{
+    return strlen(rl_display_prompt) + rl_end;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls: Function: void rl_resize_terminal()
+//! Update Readline's internal screen size by reading values from the kernel.
+//
+void Readline::Resize()
+{
+    rl_resize_terminal();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calls: Function: void rl_set_screen_size (int rows, int cols)
+//! Set Readline's idea of the terminal size to rows rows and cols columns.
+//!
+//! @param width
+//!    Number of columns
+//!
+//! @param height
+//!    Number of rows
+//
+void Readline::Resize(int width, int height)
+{
+    rl_set_screen_size(height, width);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Get the number of cols readline assumes the screen size to be
+//
+int Readline::GetCols() const
+{
+    int rows, cols;
+    rl_get_screen_size(&rows, &cols);
+    return cols;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Get the number of rows readline assumes the screen size to be
+//
+int Readline::GetRows() const
+{
+    int rows, cols;
+    rl_get_screen_size(&rows, &cols);
+    return rows;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Return a list of pointer to the history contents
+//
+vector<const char*> Readline::GetHistory() const
+{
+    HIST_ENTRY **next = history_list();
+
+    vector<const char*> v;
+
+    for (; *next; next++)
+        v.push_back((*next)->line);
+
+    return v;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Clear readline history (calls clear_history())
+//!
+//! @returns
+//!     always true
+//
+bool Readline::ClearHistory()
+{
+    clear_history();
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Displays the current history on rl_outstream
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+bool Readline::DumpHistory()
+{
+    HIST_ENTRY **next = history_list();
+
+    for (; *next; next++)
+        fprintf(rl_outstream, "%s\n", (*next)->line);
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Print the available commands. This is intended for being overwritten
+//! by deriving classes.
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+//
+bool Readline::PrintCommands()
+{
+    fprintf(rl_outstream, "\n");
+    fprintf(rl_outstream, " Commands:\n");
+    fprintf(rl_outstream, "   No application specific commands defined.\n");
+    fprintf(rl_outstream, "\n");
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Print a general help message. This is intended for being overwritten
+//! by deriving classes.
+//!
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+//
+bool Readline::PrintGeneralHelp()
+{
+    fprintf(rl_outstream, "\n");
+    fprintf(rl_outstream, " General help:\n");
+    fprintf(rl_outstream, "   h,help       Print this help message\n");
+    fprintf(rl_outstream, "   clear        Clear history buffer\n");
+    fprintf(rl_outstream, "   lh,history   Dump the history buffer to the screen\n");
+    fprintf(rl_outstream, "   v,variables  Dump readline variables\n");
+    fprintf(rl_outstream, "   f,functions  Dump readline functions\n");
+    fprintf(rl_outstream, "   m,funmap     Dump readline funmap\n");
+    fprintf(rl_outstream, "   c,commands   Dump available commands\n");
+    fprintf(rl_outstream, "   k,keylist    Dump key bindings\n");
+    fprintf(rl_outstream, "   .q,quit      Quit\n");
+    fprintf(rl_outstream, "\n");
+    fprintf(rl_outstream, " The command history is automatically loaded and saves to\n");
+    fprintf(rl_outstream, " and from %s.\n", GetName().c_str());
+    fprintf(rl_outstream, "\n");
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Print a help text about key bindings. This is intended for being
+//! overwritten by deriving classes.
+//!
+//!
+//! rl_outstream can be redirected using SetStreamOut()
+//!
+//! @returns
+//!     always true
+//
+//
+bool Readline::PrintKeyBindings()
+{
+    fprintf(rl_outstream, "\n");
+    fprintf(rl_outstream, " Key bindings:\n");
+    fprintf(rl_outstream, "   Page-up         Search backward in history\n");
+    fprintf(rl_outstream, "   Page-dn         Search forward in history\n");
+    fprintf(rl_outstream, "   Ctrl-left       One word backward\n");
+    fprintf(rl_outstream, "   Ctrl-right      One word forward\n");
+    fprintf(rl_outstream, "   Ctrl-y          Delete line\n");
+    fprintf(rl_outstream, "   Alt-end/Ctrl-k  Delete until the end of the line\n");
+    fprintf(rl_outstream, "   F1              Toggle visibility of upper panel\n");
+    fprintf(rl_outstream, "\n");
+    fprintf(rl_outstream, " Default key-bindings are identical with your bash.\n");
+    fprintf(rl_outstream, "\n");
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+bool Readline::Process(const string &str)
+{
+    // ----------- Readline static -------------
+
+    if (str=="clear")
+        return ClearHistory();
+
+    if (str=="lh" || str=="history")
+        return DumpHistory();
+
+    if (str=="v" || str=="variables")
+        return DumpVariables();
+
+    if (str=="f" || str=="functions")
+        return DumpFunctions();
+
+    if (str=="m" || str=="funmap")
+        return DumpFunmap();
+
+    // ---------- Readline virtual -------------
+
+    if (str=="h" || str=="help")
+        return PrintGeneralHelp();
+
+    if (str=="c" || str=="commands")
+        return PrintCommands();
+
+    if (str=="k" || str=="keylist")
+        return PrintKeyBindings();
+
+    return false;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function is a wrapper around the call to readline. It encapsultes
+//! the return buffer into a std::string and deletes the memory allocated
+//! by readline. Furthermore, it removes leading and trailing whitespaces
+//! before return the result. The result is returned in the given
+//! argument containing the prompt. Before the function returns Shutdown()
+//! is called (as opposed to Startup when readline starts)
+//!
+//! @param str
+//!    The prompt which is to be shown by the readline libarary. it is
+//!    directly given to the call to readline. The result of the
+//!    readline call is returned in this string.
+//!
+//! @returns
+//!    true if the call succeeded as usual, false if EOF was detected
+//!    by the readline call.
+//
+bool Readline::PromptEOF(string &str)
+{
+    char *buf = readline(str.c_str());
+    Shutdown(buf);
+
+    // Happens when EOF is encountered
+    if (!buf)
+        return false;
+
+    str = TrimSpaces(buf);
+
+    free(buf);
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function is a wrapper around the call to readline. It encapsultes
+//! the return buffer into a std::string and deletes the memory allocated
+//! by readline. Furthermore, it removes leading and trailing whitespaces
+//! before return the result. Before the function returns Shutdown() is
+//! called (as opposed to Startup when readline starts)
+//!
+//! @param prompt
+//!    The prompt which is to be shown by the readline libarary. it is
+//!    directly given to the call to readline.
+//!
+//! @returns
+//!    The result of the readline call
+//
+string Readline::Prompt(const string &prompt)
+{
+    char *buf = readline(prompt.c_str());
+    Shutdown(buf ? buf : "");
+
+    const string str = buf ? TrimSpaces(buf) : ".q";
+
+    free(buf);
+
+    return str;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This implements a loop over readline calls. A prompt to issue can be
+//! given. If it is NULL, the prompt is retrieved from GetUpdatePrompt().
+//! It is updated regularly by means of calls to GetUpdatePrompt() from
+//! EventHook(). If Prompt() returns with "quit" or ".q" the loop is
+//! exited. If ".qqq" is entered exit(-1) is called. In case of ".qqqqqq"
+//! abort(). Both ways to exit the program are not recommended. Empty
+//! inputs are ignored. After that Process() with the returned string
+//! is called. If Process returns true the input is not counted and not
+//! added to the history, otherwise the line counter is increased
+//! and the input is added to the history.
+//!
+//! @param prompt
+//!    The prompt to be issued or NULL if GetUPdatePrompt should be used
+//!    instead.
+//!
+void Readline::Run(const char *prompt)
+{
+    fLine = 0;
+    while (1)
+    {
+        // Before we start we have to make sure that the
+        // screen looks like and is ordered like expected.
+        const string str = Prompt(prompt?prompt:GetUpdatePrompt());
+        if (str.empty())
+            continue;
+
+        if (str=="quit" || str==".q")
+            break;
+
+        if (str==".qqq")
+            exit(-1);
+
+        if (str==".qqqqqq")
+            abort();
+
+        if (Process(str))
+            continue;
+
+        fLine++;
+
+        AddToHistory(str);
+    }
+}
Index: /trunk/FACT++/src/Readline.h
===================================================================
--- /trunk/FACT++/src/Readline.h	(revision 10183)
+++ /trunk/FACT++/src/Readline.h	(revision 10183)
@@ -0,0 +1,116 @@
+#ifndef FACT_Readline
+#define FACT_Readline
+
+#include <string>
+#include <vector>
+
+class Readline
+{
+public:
+    static std::string TrimSpaces(const char *buf);
+
+protected:
+    /// A pointer to the unique instance of Readline to let the static
+    /// functions used as callback for readline call member function
+    /// with an object. This makes overwriting easier.
+    static Readline *This;
+
+private:
+    std::string fName;     /// Filename for the history file compiled in the constructor
+    int fMaxLines;         /// Maximum number of lines in the history file
+
+    std::string fLastLine; /// Last line adde to history
+
+    int fLine;
+
+    // Static member function which are used to adapt readline to ncurses
+    static int    rl_ncurses_getc(FILE *);
+    static int    rl_ncurses_startup();
+    static void   rl_ncurses_redisplay();
+    static int    rl_ncurses_event_hook();
+    static void   rl_ncurses_completion_display(char **matches, int num, int max);
+    static char **rl_ncurses_completion_function(const char *text, int start, int end);
+    static char   *CompleteImp(const char* text, int state);
+
+
+protected:
+    // The non static implementations of the callback funtions above
+    virtual int  Getc(FILE *);
+    virtual void Startup();
+    virtual void EventHook();
+    virtual void Shutdown(const char *buf);
+    virtual void Redisplay();
+    virtual void CompletionDisplay(char **matches, int num, int max);
+
+    // Functions dealing with auto completion
+    virtual char *Complete(const char* text, int state);
+    virtual char **Completion(const char *text, int start, int end);
+
+    /// Pointer to a list of possible matched for auto-completion
+    const std::vector<std::string> *fCompletion; 
+    void SetCompletion(const std::vector<std::string> *v) { fCompletion = v; }
+    char **Complete(const std::vector<std::string> &v, const char *text);
+
+public:
+    Readline(const char *prgname);
+    ~Readline();
+
+    // Access to readline
+    void BindKeySequence(const char *seq, int (*func)(int, int));
+
+    static  bool DumpVariables();
+    static  bool DumpFunctions();
+    static  bool DumpFunmap();
+    static  bool DumpHistory();
+
+    virtual bool PrintGeneralHelp();
+    virtual bool PrintCommands();
+    virtual bool PrintKeyBindings();
+
+    // History functions
+    std::string GetName() const { return fName; }
+
+    void AddToHistory(const std::string &str, bool skip=true);
+    static bool ClearHistory();
+    std::vector<const char*> GetHistory() const;
+
+    void SetMaxSize(int lines) { fMaxLines = lines; }
+
+    // Prompting
+    void UpdatePrompt(const std::string &prompt) const;
+    void UpdatePrompt() const { UpdatePrompt(GetUpdatePrompt()); }
+
+    virtual bool Process(const std::string &str);
+    virtual std::string GetUpdatePrompt() const { return ""; }
+    virtual bool PromptEOF(std::string &str);
+    virtual std::string Prompt(const std::string &prompt);
+    virtual void Run(const char *prompt=0);
+
+    int GetLine() const { return fLine; }
+    virtual std::string GetLinePrompt() const;
+
+    // Helper
+    static char  *Compare(const std::string &str, const std::string &txt);
+    static char **CompletionMatches(const char *text, char *(*func)(const char*, int));
+
+    // I/O Streams
+    static FILE *SetStreamOut(FILE *f);
+    static FILE *SetStreamIn(FILE *f);
+
+    // Other global readline variables
+    static std::string GetPrompt();
+    static std::string GetBuffer();
+    static int GetAbsCursor();
+    static int GetCursor();
+    static int GetBufferLength();
+    static int GetLineLength();
+
+    // Screen size
+    static void Resize();
+    static void Resize(int w, int h);
+    int GetCols() const;
+    int GetRows() const;
+
+};
+
+#endif
Index: /trunk/FACT++/src/ReadlineWindow.cc
===================================================================
--- /trunk/FACT++/src/ReadlineWindow.cc	(revision 10183)
+++ /trunk/FACT++/src/ReadlineWindow.cc	(revision 10183)
@@ -0,0 +1,361 @@
+// **************************************************************************
+/** @class ReadlineWindow
+
+@brief Helper to redirect readline's in- and output to an ncurses window
+
+The idea of this class is to allow the use of the readline functionality
+within a ncurses window. Therefore, several callback and hook function
+of the readline libarary are redirected, which allow to redirect the
+window's input stream to readline and the readline output to the
+window.
+
+After instantisation a pointer to a ncurses WINDOW must be given to the
+object to 'bind' readline to this window.
+
+In addition the color of the readline prompt can be set using the
+SetPromptColor() member function. Note that the given color must
+be the index of a COLOR_PAIR. For details on this see the ncurses
+documentation
+
+If ncurses will use more than one window on the screen it might
+be necessary to redraw the screen before the cursor is displayed.
+Therefore, the Refresh() function must be overwritten. It is called
+before the cursor is put to its final location in the readline line
+and after all update to the screen was performed.
+
+Refresh() can be used to force a redisplay of the current input line
+from a derived class. This might be necessary after changes top the
+screen or window size.
+
+@section References
+
+ - <A HREF="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html">GNU Readline</A>
+ - <A HREF="http://www.gnu.org/software/ncurses">GNU Ncurses</A>
+
+**/
+// **************************************************************************
+#include "Shell.h"
+
+#include <iostream>
+#include <string.h> // strlen
+
+#include "tools.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Propagate prgname to the Readline constructor.
+//! Initialize fPromtX and fPromtY to 0.
+//! Set fWindow to 0. 
+//!
+//! @param prgname
+//!    see Readline::Readline()
+//!
+//! @todo
+//!    Maybe we should add sanity check for fWindow==0 in the functions?
+//!
+ReadlineWindow::ReadlineWindow(const char *prgname) : Readline(prgname),
+    fWindow(0), fPromptX(0), fPromptY(0)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Set the window in which the readline prompt and all readline output
+//! is displayed. Sets the readline screen size (rl_set_screen_size)
+//! accoring to the size of the window.
+//!
+//! Setup all necessry callback functions. To redirect readline input
+//! and output properly.
+//!
+//! @param w
+//!    Pointer to a ncurses WINDOW.
+//
+void ReadlineWindow::SetWindow(WINDOW *w)
+{
+    if (!w)
+        return;
+
+    // Get size of the window
+    int width, height;
+    getmaxyx(w, height, width);
+
+    // Propagate the size to the readline library
+    Resize(width, height);
+
+    // Finally set the pointer to the panel in which we are supposed to
+    // operate
+    fWindow = w;
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! Callback function for readlines rl_getc_function. Apart from redirecting
+//! the input from the window to the readline libarary, it also checks if
+//! the input forced scrolling of the window contents and in this case
+//! adapt fPromptY.
+//!
+//! @return
+//!    the character read by wgetch
+//
+/*
+int ReadlineWindow::Getc(FILE *)
+{
+    /// ====   It seems this is obsolete because we will get teh scrolling
+    //         from the continous call to event hook anyway
+
+    // Get size of the window
+    int lines, cols;
+    getmaxyx(fWindow, lines, cols);
+
+    // Get current cursor position
+    int x0, y0, y1, x1;
+    getyx(fWindow, y0, x0);
+
+    // Read a character from stream in window
+    const int c = wgetch(fWindow);
+
+    // Get new cursor position
+    getyx(fWindow, y1, x1);
+
+    // Find out whether the last character initiated a scroll
+    if (y0==lines-1 && y1==lines-1 && x1==0 && x0==cols-1)
+        fPromptY--;
+
+    // return character
+    return c;
+}
+*/
+
+// --------------------------------------------------------------------------
+//
+//! Store the current cursor position in fPromptX/Y
+//
+void ReadlineWindow::Startup()
+{
+    getyx(fWindow, fPromptY, fPromptX);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Move the cursor to the position stored in fPromptX/Y which should
+//! correspond to the beginning of the output line
+//
+void ReadlineWindow::RewindCursor() const
+{
+    wmove(fWindow, fPromptY, fPromptX);
+}
+
+// --------------------------------------------------------------------------
+//
+//! The event hook which is called regularly when a readline call is in
+//! progress. We use this to synchronously upadte our prompt (mainly
+//! the current cursor position) and refresh the screen, so that all
+//! changes get displayed soon.
+//!
+//! By default, this will be called at most ten times a second if there
+//! is no keyboard input.
+//
+void ReadlineWindow::EventHook()
+{
+    Readline::EventHook();
+    Redisplay();
+    /*
+     * This doesn't work if the contents of the line changes, e.g. when
+     * the prompt is replaced
+
+    // Refresh the screen
+    Refresh();
+
+    // Now move the cursor to its expected position
+    int lines, cols;
+    getmaxyx(fWindow, lines, cols);
+
+    const int pos = fPromptY*cols + fPromptX + GetAbsCursor();
+    wmove(fWindow, pos/cols, pos%cols);
+
+    // Make the cursor movement visible on the screen
+    wrefresh(fWindow);
+    */
+
+    // The lines above are just a simplified version of Redisplay()
+    // which skips all the output.
+}
+
+// --------------------------------------------------------------------------
+//
+//! This basically implement displaying the whole line, starting with the
+//! prompt and the rl_line_buffer. It also checks if displaying it
+//! results in a scroll of the window and adapt fPromptY accordingly.
+//!
+//! The prompt is displayed in the color defined by fColor.
+//!
+//! Before the cursor position is finally set a screen refresh (Refresh())
+//! is initiated to ensure that nothing afterwards will change the cursor
+//! position. It might be necessary to overwrite this function.
+//!
+//! @todo fix docu
+//
+void ReadlineWindow::Redisplay()
+{
+    // Move to the beginning of the output
+    wmove(fWindow, fPromptY, fPromptX);
+
+    // Get site of the window
+    int lines, cols;
+    getmaxyx(fWindow, lines, cols);
+
+    const string prompt = GetPrompt();
+    const string buffer = GetBuffer();
+
+    // Issue promt and redisplay text
+    wattron(fWindow, fColor);
+    wprintw(fWindow, "%s", prompt.c_str());
+    wattroff(fWindow, fColor);
+    wprintw(fWindow, "%s", buffer.c_str());
+
+    // Clear everything after that
+    wclrtobot(fWindow);
+
+    // Calculate absolute position in window or beginning of output
+    int xy = fPromptY*cols + fPromptX;
+
+    // Calculate position of end of prompt
+    xy += prompt.length();
+
+    // Calculate position of cursor and end of output
+    const int cur = xy + GetCursor();
+    const int end = xy + buffer.size();
+
+    // Calculate if the above output scrolled the window and by how many lines
+    int scrolls = end/cols - lines + 1;
+
+    if (scrolls<0)
+        scrolls = 0;
+
+    fPromptY -= scrolls;
+
+    // new position
+    const int px = cur%cols;
+    const int py = scrolls>=1 ? cur/cols - scrolls : cur/cols;
+
+    // Make sure that whatever happens while typing the correct
+    // screen is shown (otherwise the top-panel disappears when
+    // we scroll)
+    Refresh();
+
+    // Move the cursor to the cursor position
+    wmove(fWindow, py, px);
+
+    // Make changes visible on screen
+    wrefresh(fWindow);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Callback function to display the finally compiled list of completion
+//! options. Adapts fPromtY for the number of scrolled lines.
+//!
+//! @param matches
+//!    A list with the matches found. The first element contains
+//!    what was completed. The length of the list is therefore
+//!    num+1.
+//!
+//! @param num
+//!    Number of possible completion entries in the list.
+//!
+//! @param max
+//!    maximum length of the entries
+//!
+//! @todo
+//!    Maybe we can use rl_outstream here if we find a way to redirect
+//!    the stream to us instead of a file.
+//
+void ReadlineWindow::CompletionDisplay(char **matches, int num, int max)
+{
+    // Increase maximum size by two to get gaps in between the columns
+    max += 2; // Two whitespaces in between the output
+
+    // Get size of window
+    int lines, cols;
+    getmaxyx(fWindow, lines, cols);
+
+    // Allow an empty space at the end of the lines for a '\n'
+    cols--;
+
+    // calculate the final number columns
+    const int ncols = cols / max;
+
+    // Compile a proper format string
+    const string fmt = Form("%%-%ds", max);
+
+    // loop over all entries and display them
+    int l=0;
+    for (int i=0; i<num; i++)
+    {
+        // Check if we have to put a line-break
+        if (i%ncols==0)
+        {
+            if ((max+0)*ncols < cols)
+                wprintw(fWindow, "\n");
+            l++;
+        }
+
+        // Display an entry
+        wprintw(fWindow, fmt.c_str(), matches[i+1]);
+    }
+
+    // Display an empty line after the list
+    if ((num-1)%ncols>0)
+        wprintw(fWindow, "\n");
+    wprintw(fWindow, "\n");
+
+    // Get new cursor position
+    int x, y;
+    getyx(fWindow, y, x);
+
+    // Clear everything behind the list
+    wclrtobot(fWindow);
+
+    // Adapt fPromptY for the number of scrolled lines if any.
+    if (y==lines-1)
+        fPromptY = lines-1;
+
+    // Display anything
+    wrefresh(fWindow);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Overwrites Shutdown() of Readline. After Readline::Prompt has
+//! returned a Redisplay() is forced to ensure a proper display of
+//! everything. Finally, the display line is ended by a \n.
+//!
+//! @param buf
+//!    The buffer returned by the readline call
+//
+void ReadlineWindow::Shutdown(const char *buf)
+{
+    // Move the cursor to the end of the total line entered by the user
+    // (the user might have pressed return in the middle of the line)...
+    int lines, cols;
+    getmaxyx(fWindow, lines, cols);
+
+    // Calculate absolute position in window or beginning of output
+    // We can't take a pointer to the buffer because rl_end is not
+    // valid anymore at the end of a readline call
+    int xy = fPromptY*cols + fPromptX + GetPrompt().size() + strlen(buf);
+    wmove(fWindow, xy/cols, xy%cols);
+
+    // ...and output a newline. We have to do the manually.
+    wprintw(fWindow, "\n");
+
+    // refresh the screen
+    wrefresh(fWindow);
+
+    // This might have scrolled the window
+    if (xy/cols==lines-1)
+        fPromptY--;
+}
Index: /trunk/FACT++/src/ReadlineWindow.h
===================================================================
--- /trunk/FACT++/src/ReadlineWindow.h	(revision 10183)
+++ /trunk/FACT++/src/ReadlineWindow.h	(revision 10183)
@@ -0,0 +1,42 @@
+#ifndef FACT_ReadlineWindow
+#define FACT_ReadlineWindow
+
+#include "Readline.h"
+
+typedef struct _win_st WINDOW;
+
+class ReadlineWindow : public Readline
+{
+    WINDOW *fWindow; /// Pointer to the panel for the input stream
+
+    int fPromptX;    /// When the readline call is issued the x position at which the output will start is stored here
+    int fPromptY;    /// When the readline call is issued the y position at which the output will start is stored here
+
+    int fColor;      /// Color index in which the prompt should be displayed
+
+protected:
+    // The implementations of the callback funtions
+    //int  Getc(FILE *);
+    void Startup();
+    void Redisplay();
+    void EventHook();
+    void CompletionDisplay(char **matches, int num, int max);
+
+    // Refresh the display before setting the cursor position
+    virtual void Refresh() { }
+
+    // Callback after readline has returned
+    void Shutdown(const char *buf);
+
+public:
+    ReadlineWindow(const char *prgname);
+
+    // Initialization
+    void SetWindow(WINDOW *w);
+    void SetColorPrompt(int col) { fColor = col; }
+
+    // Move cursor to start of last prompt
+    void RewindCursor() const;
+};
+
+#endif
Index: /trunk/FACT++/src/RemoteControl.cc
===================================================================
--- /trunk/FACT++/src/RemoteControl.cc	(revision 10183)
+++ /trunk/FACT++/src/RemoteControl.cc	(revision 10183)
@@ -0,0 +1,162 @@
+#include "RemoteControl.h"
+
+StateClient::StateClient(const std::string &name, MessageImp &imp) :
+    MessageDimRX(name, imp), fState(-2),
+    fInfoState((name + "/STATE").c_str(), const_cast<char*>(""), this)
+{
+}
+
+void StateClient::infoHandler()
+{
+    DimInfo *curr = getInfo(); // get current DimInfo address
+    if (!curr)
+        return;
+
+    if (curr==&fInfoState)
+    {
+        const char *txt = fInfoState.getString();
+
+        fState     = strlen(txt)==0 ? -2 : fInfoState.getQuality();
+        fStateTime = Time(fInfoState.getTimestamp(),
+                          fInfoState.getTimestampMillisecs());
+        fStateMsg  = txt;
+
+        if (fState!=-2)
+        {
+            stringstream msg;
+            msg << fInfoState.getName() << ": Changed state to " << fState << " '" << txt << "' received.";
+            fMsg.Write(fStateTime, msg.str().c_str(), MessageImp::kInfo);
+        }
+        return;
+    }
+
+    MessageDimRX::infoHandler();
+}
+
+// ==========================================================================
+
+void RemoteControlImp::infoHandler()
+{
+    const vector<string> &list = fServiceList.GetServerList();
+
+    // Remover StateClients which are not available anymore
+    for (ClientList::iterator l=fClientList.begin(); l!=fClientList.end(); l++)
+    {
+        const string &server = l->first;
+
+        // HasServer doesn't work here, I don't understand why.
+        if (find(list.begin(), list.end(), server)!=list.end())
+            continue;
+
+        delete l->second;
+        fClientList.erase(l);
+    }
+
+
+    // Add StateClients which are new
+    for (vector<string>::const_iterator l=list.begin(); l!=list.end(); l++)
+    {
+        if (*l=="DIS_DNS")
+            continue;
+
+        const ClientList::const_iterator p = fClientList.find(*l);
+        if (p!=fClientList.end())
+            continue;
+
+        fClientList[*l] = new StateClient(*l, *this);
+    }
+}
+
+bool RemoteControlImp::ProcessCommand(const std::string &str)
+{
+    if (fCurrentServer.empty())
+    {
+        if(fServiceList.HasServer(str))
+        {
+            fCurrentServer = str;
+            return true;
+        }
+        lout << kRed << "Unkown server '" << str << "'" << endl;
+        return false;
+    }
+
+    if (!fCurrentServer.empty() && str=="..")
+    {
+        fCurrentServer = "";
+        return false;
+    }
+
+    return !fServiceList.SendDimCommand(lout, fCurrentServer, str);
+}
+
+// ==========================================================================
+#include <boost/regex.hpp>
+
+#include "tools.h"
+
+string RemoteConsole::GetUpdatePrompt() const
+{
+    // If we are continously flushing the buffer omit the buffer size
+    // If we are buffering show the buffer size
+    const string beg = "\n" + GetLinePrompt();
+
+    // If we have not cd'ed to a server show only the line start
+    if (fCurrentServer.empty())
+        return beg + "> ";
+
+    // Check if we have cd'ed to a valid server
+    const ClientList::const_iterator l = fClientList.find(fCurrentServer);
+    if (l==fClientList.end())
+        return beg + "> ";//Form("\n[%d] \033[34m\033[1m%s\033[0m> ", GetLine(), fCurrentServer.c_str());
+
+    // The server is valid, check for the state from the last status message
+    const string msg = l->second->GetMsg();
+
+    static const boost::regex expr("(.+)\\[[0-9]+\\].*");
+
+    // The server
+    const string serv = Form("\033[34m\033[1m%s\033[0m", fCurrentServer.c_str());
+
+    boost::smatch what;
+    const int rc = boost::regex_match(msg, what, expr, boost::match_extra);
+
+    // If no match found or something wrong found just output the server
+    if (!rc || what.size()!=2)
+        return beg + " " + serv + "> ";//Form("[%d-%s] ", GetLine(), msg.c_str());
+
+    // If everything found add the state to the server
+    const string state = what[1];
+    return beg + " " + serv + Form(":\033[32m\033[1m%s\033[0m> ", state.c_str());
+}
+
+string RemoteShell::GetUpdatePrompt() const
+{
+    // If we are continously flushing the buffer omit the buffer size
+    // If we are buffering show the buffer size
+    const string beg = GetLinePrompt();
+
+    // If we have not cd'ed to a server show only the line start
+    if (fCurrentServer.empty())
+        return beg + "> ";
+
+    // Check if we have cd'ed to a valid server
+    const ClientList::const_iterator l = fClientList.find(fCurrentServer);
+    if (l==fClientList.end())
+        return beg + "> ";//Form("\n[%d] \033[34m\033[1m%s\033[0m> ", GetLine(), fCurrentServer.c_str());
+
+    // The server is valid, check for the state from the last status message
+    const string msg = l->second->GetMsg();
+
+    static const boost::regex expr("(.+)\\[[0-9]+\\].*");
+
+    boost::smatch what;
+    const int rc = boost::regex_match(msg, what, expr, boost::match_extra);
+
+    // If no match found or something wrong found just output the server
+    if (!rc || what.size()!=2)
+        return beg + " " + fCurrentServer + "> ";//Form("[%d-%s] ", GetLine(), msg.c_str());
+
+    // If everything found add the state to the server
+    const string state = what[1];
+    return beg + " " + fCurrentServer + ":" + state + "> ";
+}
Index: /trunk/FACT++/src/RemoteControl.h
===================================================================
--- /trunk/FACT++/src/RemoteControl.h	(revision 10183)
+++ /trunk/FACT++/src/RemoteControl.h	(revision 10183)
@@ -0,0 +1,240 @@
+#ifndef FACT_RemoteControl
+#define FACT_RemoteControl
+
+// **************************************************************************
+/** @class StateClient
+
+@brief A simple Dim client diriving from MessageDimRX subscribing to the STATE service
+
+This is a simple dim client which subscribes to the MESSAGE and STATE
+service of a server. It stores the last state and its time as well as
+the last message sent.
+
+**/
+// **************************************************************************
+#include "MessageDim.h"
+#include "Time.h"
+
+class StateClient : public MessageDimRX
+{
+private:
+    Time fStateTime;           /// Combine into one MTime (together with value)
+    int  fState;               /// -2 not initialized, -1 not connected, 0>= state of client
+
+    std::string fStateMsg;     /// The message received with the last state change
+
+    DimStampedInfo fInfoState; /// The dim service subscription
+
+protected:
+    void infoHandler();
+
+public:
+    StateClient(const std::string &name, MessageImp &imp);
+
+    bool        IsConnected() const { return fState>=0; }
+    int         GetState() const    { return fState;    }
+    std::string GetMsg() const      { return fStateMsg; }
+};
+
+// **************************************************************************
+/** @class RemoteControlImp
+
+@brief This implements the basic functions of a remote control via dim
+
+Through a ServiceList object this object subscribes to all available
+SERVICE_LISTs  in the dim network. This allows to keep an up-to-date
+list of all servers and services. Its ProcessCommand member function
+allows to emit commands according to the services found in the network.
+Its infoHandler() is called as an update notifier from the ClientList
+object.
+
+**/
+// **************************************************************************
+#include "ServiceList.h"
+#include "DimErrorRedirecter.h"
+
+using namespace std;
+
+class RemoteControlImp : public MessageImp, public DimErrorRedirecter, public DimInfoHandler
+{
+private:
+    std::ostream &lout;          /// Output stream for local synchrounous output
+
+protected:
+    typedef std::map<const std::string, StateClient*> ClientList;
+
+    ServiceList fServiceList;    /// An up-to-date list of all available commands
+    ClientList  fClientList;     /// A list with all MESSAGE services to which we subscribed
+
+    std::string fCurrentServer;  /// The server to which we currently cd'ed
+
+    void infoHandler();
+
+protected:
+    // Redirect asynchronous output to the output window
+    RemoteControlImp(std::ostream &out, std::ostream &in) :
+        MessageImp(out),
+        DimErrorRedirecter(static_cast<MessageImp&>(*this)),
+        lout(in), fServiceList("CMD", out)
+    {
+        fServiceList.SetHandler(this);
+    }
+    bool ProcessCommand(const std::string &str);
+};
+
+// **************************************************************************
+/** @class RemoteControl
+
+@brief Implements a remote control based on a Readline class for the dim network
+
+This template implements all functions which overwrite any function from the
+Readline class. Since several derivatives of the Readline class implement
+different kind of Readline access, this class can be derived by any of them
+due to its template argument. However, the normal case will be
+deriving it from either Console or Shell.
+
+@tparam T
+   The base class for RemoteControl. Either Readlien or a class
+    deriving from it. This is usually either Console or Shell.
+
+**/
+// **************************************************************************
+#include "WindowLog.h"
+
+template <class T>
+class RemoteControl : public T, public RemoteControlImp
+{
+private:
+    std::ostream &lout; /// Output stream for local synchrounous output
+
+    // This funtion defines which generator should be called.
+    // If it returns 0 the standard reaqdline generator are called.
+    // Otherwise set the right generator with rl_completion_matches.
+    char **Completion(const char *text, int start, int)
+    {
+        // Get the whole buffer before the tab-position
+        const string s = string(T::GetBuffer(), 0, start);
+        const string l = T::TrimSpaces(s.c_str());
+        if (l.empty())
+        {
+            if (fCurrentServer.empty())
+                return T::Complete(fServiceList.GetServerList(), text);
+            else
+                return T::Complete(fServiceList.GetServiceList(fCurrentServer), text);
+        }
+        return T::Complete(fServiceList.GetServiceList(l), text);
+    }
+
+    void infoHandler()
+    {
+        RemoteControlImp::infoHandler();
+        if (!fCurrentServer.empty() && !fServiceList.HasServer(fCurrentServer))
+        {
+            fCurrentServer = "";
+            T::UpdatePrompt();
+        }
+    }
+
+public:
+    // Redirect asynchronous output to the output window
+    RemoteControl(const char *name) : T(name),
+        RemoteControlImp(T::GetStreamOut(), T::GetStreamIn()),
+        lout(T::GetStreamIn())
+    {
+        fServiceList.SetHandler(this);
+    }
+
+
+    bool PrintGeneralHelp()
+    {
+        T::PrintGeneralHelp();
+        lout << " " << kUnderline << "Specific commands:" << endl;
+        lout << kBold << "  s,servers   " << kReset << "List all servers which are connected." << endl;
+        lout << endl;
+        return true;
+    }
+
+    bool PrintCommands()
+    {
+        lout << endl << kBold << "List of commands:" << endl;
+        fServiceList.PrintServiceList(lout);
+        return true;
+    }
+
+    // returns whether a command should be put into the history
+    bool Process(const std::string &str)
+    {
+        if (T::Process(str))
+            return true;
+
+        if (str=="servers" || str=="s")
+        {
+            fServiceList.PrintServerList(lout);
+            return true;
+        }
+
+        return ProcessCommand(str);
+    }
+    void Run(const char * = 0)
+    {
+        lout << endl;
+        lout << kBlue << kBold << "You are on the terminal of the MCP -" << endl;
+        lout << kBlue << kBold << "the Master Control Program." << endl;
+        lout << endl;
+        lout << kBlue << kBold << "Hello Flynn..." << endl;
+        lout << endl;
+
+        T::Run();
+    }
+};
+
+
+
+// **************************************************************************
+/** @class RemoteConsole
+
+@brief Derives the RemoteControl from Control and adds a proper prompt
+
+This is basically a RemoteControl, which derives through the template
+argument from the Console class. It enhances the functionality of
+the remote control with a proper updated prompt.
+
+ */
+// **************************************************************************
+#include "Console.h"
+
+class RemoteConsole : public RemoteControl<Console>
+{
+public:
+    RemoteConsole(const char *name, bool continous=false) :
+        RemoteControl<Console>(name)
+    {
+        SetContinous(continous);
+    }
+    string GetUpdatePrompt() const;
+};
+
+// **************************************************************************
+/** @class RemoteShell
+
+@brief Derives the RemoteControl from Shell and adds colored prompt
+
+This is basically a RemoteControl, which derives through the template
+argument from the Shell class. It enhances the functionality of
+the local control with a proper updated prompt.
+
+ */
+// **************************************************************************
+#include "Shell.h"
+
+class RemoteShell : public RemoteControl<Shell>
+{
+public:
+    RemoteShell(const char *name, bool = false) :
+        RemoteControl<Shell>(name)
+    {
+    }
+    string GetUpdatePrompt() const;
+};
+
+#endif
Index: /trunk/FACT++/src/ServiceList.cc
===================================================================
--- /trunk/FACT++/src/ServiceList.cc	(revision 10183)
+++ /trunk/FACT++/src/ServiceList.cc	(revision 10183)
@@ -0,0 +1,569 @@
+// **************************************************************************
+/** @class ServiceList
+
+@brief Maintains a list of all servers and services available in the Dim nbetwork
+
+The idea of this class is to maintain a list of servers and services
+available in the Dim network. The servers are retrieved by subscribing to
+DIS_DNS/SERVER_LIST. The services are retrieved by subscribing to all
+servers SERVICE_LIST service.
+
+The server names and the corresponidng DimInfo ovjects for their service
+lists are stored in fServerList.
+
+The services of all servers are stored in the fServiceList.
+
+From the services a lookup table fFormatList is created storing the
+received formats of all services/commands. The format list is only
+updated. So it might happen that formats for commands not available
+anymore are still in the list.
+
+Whether commands or services are stored can be selected in the constructor
+by the type argument. Use "CMD" for commands and "" for services.
+
+
+@todo
+- Resolve the dependancy on WindowLog, maybe we can issue the log-messages
+  via MessageImp or we provide more general modfiers (loike in MLogManip)
+- Maybe we also get updates (+/-) on the SERVCIE_LIST?
+- check if we really need our own logging stream
+- Implement fType=="*"
+
+*/
+// **************************************************************************
+#include "ServiceList.h"
+
+#include <sstream>
+
+#include "WindowLog.h"
+#include "Converter.h"
+
+#include "tools.h"
+#include "Time.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Instantiates the default output-stream, subscribes to the Dim service
+//! DIS_DNS/SERVER_LIST, which is supposed to contain all servers available
+//! in the network, sets fType to type and inistialises fHandler with 0
+//!
+//! @param type
+//!    The type of rows which is filtered out of the retrieved server list.
+//!    Use "CMD" for commands and "" for services.
+//!
+//! @param out
+//!    A log-stream to which errors are sent. This however is something
+//!    which should not happen anyway.
+//
+ServiceList::ServiceList(const char *type, ostream &out) :
+    wout(out), fDimServers("DIS_DNS/SERVER_LIST", const_cast<char*>(""), this),
+    fType(type), fHandler(0)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Instantiates the default output-stream, subscribes to the Dim service
+//! DIS_DNS/SERVER_LIST, which is supposed to contain all servers available
+//! in the network, sets fType to "CMD" and inistialises fHandler with 0
+//!
+//! @param out
+//!    A log-stream to which errors are sent. This however is something
+//!    which should not happen anyway.
+//
+ServiceList::ServiceList(ostream &out) :
+    wout(out), fDimServers("DIS_DNS/SERVER_LIST", const_cast<char*>(""), this),
+    fType(""), fHandler(0)
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Delete the allocated memory from fServerList
+//
+ServiceList::~ServiceList()
+{
+    for (ServerMap::iterator i=fServerList.begin(); i!=fServerList.end(); i++)
+            delete i->second;
+}
+
+// --------------------------------------------------------------------------
+//
+//! The infoHandler which is called when an update to one of our subscribed
+//! services is available. If it is the service list, it calls
+//! ProcessServerList() and ProcessServiceList() otherwise.
+//!
+//! After the update has been processed the infoHandler() of fHandler
+//! is called if fHandler is available to signal an update to a parent
+//! class.
+//
+void ServiceList::infoHandler()
+{
+    if (getInfo()==&fDimServers)
+        ProcessServerList();
+    else
+        ProcessServiceList(*getInfo());
+
+    if (fHandler)
+        fHandler->infoHandler();
+}
+
+// --------------------------------------------------------------------------
+//
+//! A helper to shorten the call to create a DimInfo.
+//!
+//! @param str
+//!    name of the service to which we want to subscribe
+//!
+//! @returns
+//!    a pointer to the newly created DimInfo
+//!
+DimInfo *ServiceList::CreateDimInfo(const string &str) const
+{
+    return new DimInfo((str+"/SERVICE_LIST").c_str(),
+                       const_cast<char*>(""),
+                       const_cast<ServiceList*>(this));
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function processes the update of the DIS_DNS/SERVER_LIST update.
+//! After this function the server list should be up-to-date again.
+//!
+//! For each new server a SERVER/SERVICE_LIST service subscription is
+//! created and stored in the fServerList. For each removed server
+//! the corresponding object are deleted, as well as the corresponding
+//! entries from the fServiceList.
+//!
+void ServiceList::ProcessServerList()
+{
+    // Get the received string from the handler
+    const string str = fDimServers.getString();
+
+    // Check if it starts with + or -
+    if (str[0]!='-' && str[0]!='+')
+    {
+        // If it doesn't start with + or - remove all existing servers
+        // we have received a full server list
+        for (ServerMap::iterator i=fServerList.begin(); i!=fServerList.end(); i++)
+        {
+            delete i->second;
+
+            ServiceMap::iterator x = fServiceList.find(i->first);
+            fServiceList.erase(x);
+            //wout << "Delete: " << i->first << endl;
+        }
+        fServerList.clear();
+    }
+
+    // Create a stringstream to tokenize the received string
+    stringstream stream(str);
+
+    // Loop over the seperating tokens
+    string buffer;
+    while (getline(stream, buffer, '|'))
+    {
+        // The first part before the first @ is the server name
+        const string server = buffer.substr(0, buffer.find_first_of('@'));
+        if (server.empty())
+            continue;
+
+        // If it starts with a - we have to remove an entry
+        if (server[0]=='-')
+        {
+            const string trunc = server.substr(1);
+
+            // Check if this server is not found in the list.
+            // This should never happen if Dim works reliable
+            const ServerMap::iterator v = fServerList.find(trunc);
+            if (v==fServerList.end())
+            {
+                wout << kRed << "Server '" << trunc << "' not in list as it ought to be." << endl;
+                continue;
+            }
+
+            // Remove the server from the server list
+            delete v->second;
+            fServerList.erase(v);
+
+            // Remove the server from the command list
+            ServiceMap::iterator w = fServiceList.find(trunc);
+            fServiceList.erase(w);
+
+            wout << " -> " << Time().GetAsStr() << " - " << trunc << "/SERVICE_LIST: Disconnected." << endl;
+            //wout << "Remove: " << server << endl;
+            continue;
+        }
+
+        // If it starts with a + we have to add an entry
+        if (server[0]=='+')
+        {
+            const string trunc = server.substr(1);
+
+            // Check if this server is already in the list.
+            // This should never happen if Dim works reliable
+            const ServerMap::iterator v = fServerList.find(trunc);
+            if (v!=fServerList.end())
+            {
+                wout << kRed << "Server '" << trunc << "' in list not as it ought to be." << endl;
+                continue;
+            }
+
+            // Add the new server to the server list
+            fServerList[trunc] = CreateDimInfo(trunc);
+
+            wout << " -> " << Time().GetAsStr() << " - " << trunc << "/SERVICE_LIST: Connected." << endl;
+            //wout << "Add   : " << server << endl;
+            continue;
+        }
+
+        // In any other case we just add the entry to the list
+        fServerList[server] = CreateDimInfo(server);
+        //wout << "Add  0: " << server << endl;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+//! Process an update of the SERVICE_LIST service of the given DimInfo
+//!
+//! All services found are stored in the fServiceList map to be accessible
+//! through the server name. Their format is format is stored in the
+//! fFormatList. Note, that the list if only updated. So it will also
+//! contain services which are not available anymore. For an up-to-date
+//! list of service use fServiceList
+//!
+//! Only entries matching the fType data member are stored.
+//!
+//! @todo
+//!    Make sure that we do not receive +/- updates on the SERVICE_LIST
+//!    like on the SERVER_LIST
+//!
+void ServiceList::ProcessServiceList(DimInfo &info)
+{
+    const string str = info.getString();
+    if (str.empty())
+        return;
+
+    // Get the name of the service
+    string buffer = info.getName();
+
+    // Get the server name from the service name
+    const string server = buffer.substr(0, buffer.find_first_of('/'));
+
+    // Initialize the entry with an empty list
+    if (str[0]!='+')
+        fServiceList[server] = vector<string>();
+
+    // For easy and fast access get the corresponding reference
+    vector<string> &list = fServiceList[server];
+
+    // Tokenize the stream into lines
+    stringstream stream(str);
+    while (getline(stream, buffer, '\n'))
+    {
+        if (buffer.empty())
+            continue;
+
+        // Get the type and compare it with fType
+        const string type = buffer.substr(buffer.find_last_of('|')+1);
+        if (type!=fType)
+            continue;
+
+        // Get format, name and command name
+        const string fmt  = buffer.substr(buffer.find_first_of('|')+1, buffer.find_last_of('|')-buffer.find_first_of('|')-1);
+        const string name = buffer.substr(buffer.find_first_of('/')+1, buffer.find_first_of('|')-buffer.find_first_of('/')-1);
+        const string cmd  = buffer.substr(0, buffer.find_first_of('|'));
+
+        // Add name the the list
+        list.push_back(name);
+
+        // Add format to the list
+        fFormatList[cmd] = fmt;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+//! @returns
+//!    the list of servers as a vector of strings.
+//
+vector<string> ServiceList::GetServerList() const
+{
+    vector<string> v;
+    for (ServerMap::const_iterator i=fServerList.begin(); i!=fServerList.end(); i++)
+        v.push_back(i->first);
+
+    return v;
+}
+
+vector<string> ServiceList::GetServiceList(const std::string &server) const
+{
+    const ServiceMap::const_iterator m = fServiceList.find(server);
+    return m==end() ? vector<string>() : m->second;
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! Get the format of a command or service
+//!
+//! @param service
+//!    full qualified service name, e.g. SERVER/EXIT
+//!
+//! @returns
+//!    the format corresponding to the given service. If the service is not
+//!    found an empty string is returned.
+//
+string ServiceList::GetFormat(const string &service) const
+{
+    FormatMap::const_iterator i = fFormatList.find(service);
+    return i==fFormatList.end() ? "" : i->second;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Get the format of a command or service
+//!
+//! @param server
+//!     the server name, e.g. SERVER
+//!
+//! @param name
+//!     the service name, e.g. EXIT
+//!
+//! @returns
+//!    the format corresponding to the given service. If the service is not
+//!    found an empty string is returned.
+//
+string ServiceList::GetFormat(const string &server, const string &name) const
+{
+    return GetFormat(server+"/"+name);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Checks if a server is existing.
+//!
+//! @param name
+//!     Name of a server, e.g. DIS_DNS
+//!
+//! @returns
+//!    true if the server is found in fServiceList, false otherwise
+//
+bool ServiceList::HasServer(const string &name) const
+{
+    return fServiceList.find(name)!=end();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Checks if a given service is existing.
+//!
+//! @param server
+//!     Name of a server, e.g. DIS_DNS
+//!
+//! @param service
+//!     Name of a service, e.g. EXIT
+//!
+//! @returns
+//!    true if the service is found in fServiceList, false otherwise.
+//
+bool ServiceList::HasService(const string &server, const string &service) const
+{
+    ServiceMap::const_iterator v = fServiceList.find(server);
+    if (v==end())
+        return false;
+
+    const vector<string> &w = v->second;
+    return find(w.begin(), w.end(), service)!=w.end();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Returns an iterator to the begin of ta vector<string> which will
+//! contain the service names of the given server.
+//!
+//! @param server
+//!     Name of a server, e.g. DIS_DNS
+//!
+//! @returns
+//!    an iterator to the vector of strings with the service names
+//!    for the given server. If none is found it returns
+//!    vector<string>().end()
+//
+vector<string>::const_iterator ServiceList::begin(const string &server) const
+{
+    ServiceMap::const_iterator i = fServiceList.find(server);
+    if (i==end())
+        return vector<string>().end();
+
+    return i->second.begin();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Returns an iterator to the end of ta vector<string> which will
+//! contain the service names of the given server.
+//!
+//! @param server
+//!     Name of a server, e.g. DIS_DNS
+//!
+//! @returns
+//!     an iterator to the vector of strings with the service names
+//!    for the given server. If none is found it returns
+//!    vector<string>().end()
+//
+vector<string>::const_iterator ServiceList::end(const string &server) const
+{
+    ServiceMap::const_iterator i = fServiceList.find(server);
+    if (i==end())
+        return vector<string>().end();
+
+    return i->second.end();
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! Print the stored list of servers to the given stream.
+//!
+//! @param out
+//!    ostream to which the server names stored in fServerList are dumped
+//!
+void ServiceList::PrintServerList(ostream &out) const
+{
+    out << endl << kBold << "ServerList:" << endl;
+
+    for (ServerMap::const_iterator i=fServerList.begin(); i!=fServerList.end(); i++)
+    {
+        const string &server = i->first;
+        DimInfo *ptr = i->second;
+
+        out << " " << server << " " << ptr->getName() << endl;
+    }
+    out << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Print the stored list of services to the given stream.
+//!
+//! @param out
+//!    ostream to which the services names stored in fServiceList are dumped
+//!
+void ServiceList::PrintServiceList(ostream &out) const
+{
+    out << endl << kBold << "ServiceList:" << endl;
+
+    for (ServiceMap::const_iterator i=fServiceList.begin(); i!=fServiceList.end(); i++)
+    {
+        const string &server = i->first;
+        const vector<string> &lst = i->second;
+
+        out << " " << server << endl;
+
+        for (vector<string>::const_iterator j=lst.begin(); j!=lst.end(); j++)
+            out << "  " << *j << " [" << GetFormat(server, *j) << "]" << endl;
+    }
+    out << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Request a SERVER_LIST from the name server and a SERVICE_LISZ from all
+//! servers in the list. Dumps the result to the given ostream.
+//!
+//! @param out
+//!    ostream to which the received info is redirected
+//!
+void ServiceList::DumpServiceList(ostream &out)
+{
+    DimCurrentInfo info1("DIS_DNS/SERVER_LIST", const_cast<char*>(""));
+
+    stringstream stream(info1.getString());
+
+    string buffer;
+    while (getline(stream, buffer, '|'))
+    {
+        const string server = buffer.substr(0, buffer.find_first_of('@'));
+        if (server.empty())
+            continue;
+
+        out << kBold << " " << server << endl;
+
+        DimCurrentInfo info2(Form("%s/SERVICE_LIST", server.c_str()).c_str(), const_cast<char*>(""));
+
+        string buffer2;
+
+        stringstream stream2(info2.getString());
+        while (getline(stream2, buffer2, '\n'))
+        {
+            if (buffer2.empty())
+                continue;
+
+            out << "  " << buffer2 << endl;
+        }
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+//! Tries to send a dim command according to the arguments.
+//! The command given is evaluated according to the available format string.
+//!
+//! @param lout
+//!    the ostream to which errors and debug output is redirected
+//!
+//! @param server
+//!    The name of the server to which the command should be send, e.g. DRIVE
+//!
+//! @param str
+//!    Command and data, eg "TRACK 12.5 13.8"
+//!
+//! @returns
+//!    If parsing the string was successfull and the command exists in the
+//!    network true is returned, false otherwise.
+//!
+bool ServiceList::SendDimCommand(ostream &lout, const string &server, const string &str) const
+{
+    // Find the delimiter between the command name and the data
+    size_t p0 = str.find_first_of(' ');
+    if (p0==string::npos)
+        p0 = str.length();
+
+    // Get just the command name separated from the data
+    const string name = str.substr(0, p0);
+
+    // Compile the command which will be sent to the state-machine
+    const string cmd = server + "/" + name;
+
+    if (!HasService(server, name))
+    {
+        lout << kRed << "Unkown command '" << cmd << "'" << endl;
+        return false;
+    }
+
+    // Get the format of the event data
+    const string fmt = GetFormat(cmd);
+
+    // Convert the user enetered data according to the format string
+    // into a data block which will be attached to the event
+    lout << kBlue << cmd;
+    Converter c(lout, fmt, str.substr(p0));
+
+    // Parsing was not successfull
+    if (!c.GetRc())
+    {
+        lout << kRed << "Couldn't properly parse the input... ignored." << endl;
+        return false;
+    }
+
+    const int rc = DimClient::sendCommand(cmd.c_str(), c.Ptr(), c.Size());
+    if (rc)
+        lout << kGreen << "Command " << cmd << " emitted successfully to DimClient." << endl;
+    else
+        lout << kRed << "ERROR - Sending command " << cmd << " failed." << endl;
+    return true;
+}
Index: /trunk/FACT++/src/ServiceList.h
===================================================================
--- /trunk/FACT++/src/ServiceList.h	(revision 10183)
+++ /trunk/FACT++/src/ServiceList.h	(revision 10183)
@@ -0,0 +1,76 @@
+#ifndef FACT_ServiceList
+#define FACT_ServiceList
+
+#include <map>
+#include <vector>
+#include <string>
+#include <iostream>
+
+#include "dic.hxx"
+#include "dis.hxx"
+
+class ServiceList : public DimClient
+{
+public:
+    typedef std::map<const std::string, DimInfo*>                 ServerMap;
+    typedef std::map<const std::string, std::vector<std::string>> ServiceMap;
+    typedef std::map<const std::string, std::string>              FormatMap;
+
+private:
+    std::ostream &wout;        /// stream for redirection of the output
+
+    DimInfo fDimServers;       /// A DimInfo to retrieve the SERVER_LIST from teh DNS server
+
+    const std::string fType;   /// A filter for the type of the services to be collected, e.g. CMD
+
+    ServerMap  fServerList;   /// A map storing server names and a DimInfo for their SERVICE_LIST
+    ServiceMap fServiceList;  /// A map storing server names and vector with all their available commands
+    FormatMap  fFormatList;   /// A map storing all commands and their format strings
+
+    DimInfoHandler *fHandler;  /// A callback to signal updates
+
+    DimInfo *CreateDimInfo(const std::string &str) const;
+
+    void ProcessServerList();
+    void ProcessServiceList(DimInfo &info);
+
+    void infoHandler();
+
+public:
+    ServiceList(const char *type, std::ostream &out=std::cout);
+    ServiceList(std::ostream &out=std::cout);
+    ~ServiceList();
+
+    void SetHandler(DimInfoHandler *handler=0) { fHandler=handler; }
+
+    std::vector<std::string> GetServerList() const;
+    std::vector<std::string> GetServiceList(const std::string &server) const;
+
+    bool HasServer(const std::string &name) const;
+    bool HasService(const std::string &server, const std::string &service) const;
+
+    ServiceMap::const_iterator begin() const { return fServiceList.begin(); }
+    ServiceMap::const_iterator end() const  { return fServiceList.end(); }
+
+    std::vector<std::string>::const_iterator begin(const std::string &server) const;
+    std::vector<std::string>::const_iterator end(const std::string &server) const;
+
+    std::string GetFormat(const std::string &server, const std::string &name) const;
+    std::string GetFormat(const std::string &service) const;
+
+    void PrintServerList(std::ostream &out) const;
+    void PrintServiceList(std::ostream &out) const;
+    void PrintServerList() const { PrintServerList(wout); }
+    void PrintServiceList() const { PrintServiceList(wout); }
+
+    static void DumpServiceList(std::ostream &out);
+    void DumpServiceList() const { DumpServiceList(wout); }
+
+    bool SendDimCommand(std::ostream &lout, const std::string &server, const std::string &str) const;
+    bool SendDimCommand(const std::string &server, const std::string &str) const
+    {
+        return SendDimCommand(std::cout, server, str);
+    }
+};
+
+#endif
Index: /trunk/FACT++/src/Shell.cc
===================================================================
--- /trunk/FACT++/src/Shell.cc	(revision 10183)
+++ /trunk/FACT++/src/Shell.cc	(revision 10183)
@@ -0,0 +1,680 @@
+// **************************************************************************
+/** @class Shell
+
+@brief Implementation of a console based user shell with an input and output window
+
+Shell is based on the ReadlineWindow class. It creates two windows
+(panels) using ncurses which are used for input and output. The output
+window panel is displayed on top of the input panel, but can be hidden
+for example by pressing F1.
+
+The idea is that continous messages like logging messages do not interfere
+with the input area, although one still has both diplayed in the same
+console window.
+
+To get a list of the command and functions supported by Shell
+type 'h' or 'help' at a command line prompt.
+
+The usage is quite simple. Instantiate an object of Shell with the
+programname as an argument. For its meaning see the base class
+documentation Readline::Readline(). The created input- and output-
+stream can be accessed through GetStreamIn() and GetStreamOut()
+whihc are both ostreams, one redirected to the input window and the
+other one redirected to the output window. Especially, GetStreamIn()
+should not be used while the Readline prompt is in progress, but can for
+example be used to display errors about what was entered.
+
+The recommanded way of usage is:
+
+\code
+
+   static Shell shell("myprog"); // readline will read the myprog.his history file
+
+   while (1)
+   {
+        string txt = shell.Prompt("prompt> ");
+        if (txt=="quit)
+           break;
+
+        // ... do something ...
+
+        shell.AddHistory(txt);
+   }
+
+   // On destruction redline will write the current history to the file
+   // By declaring the Shell static the correct terminal is restored even
+   // the program got killed (not if killed with SIGABRT)
+
+\endcode
+
+If for some reason the terminal is not correctly restored type (maybe blindly)
+<I>reset</I> in your console. This should restor everything back to normal.
+
+@section References
+
+ - <A HREF="http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html">GNU Readline</A>
+ - <A HREF="http://www.gnu.org/software/ncurses">GNU Ncurses</A>
+
+
+@todo
+ - Introduce the possibility to scroll in both windows
+ - Add redisplay functionality for both panels if the console was resized
+
+*/
+// **************************************************************************
+#include "Shell.h"
+
+#include <fstream>
+#include <iostream>
+
+#include <signal.h>    // SIGWINCH
+#include <sys/wait.h>  // waitpid
+#include <sys/ioctl.h> // ioctl
+
+#include <panel.h>
+
+#define FORK_ALLOWED
+
+using namespace std;
+
+Shell *Shell::This = 0;
+
+// --------------------------------------------------------------------------
+//
+//! This initializes the Ncurses environment. Since the ncurses environment
+//! is global only one instance of this class is allowed.
+//!
+//! The first 8 color pairs (COLOR_PAIR) are set to the first 8 color
+//! with default background.
+//!
+//! The shells windows and panels are created. And their pointers are
+//! propagated to the two associated WindowLog streams.
+//!
+//! Also some key bindings are initialized.
+//
+Shell::Shell(const char *prgname) : ReadlineWindow(prgname),
+    fPanelHeight(13), fIsVisible(1), fLine(0)
+{
+    if (stdscr!=0)
+    {
+        endwin();
+        cout << "ERROR - Only one instance of class Shell is allowed." << endl;
+        exit(-1);
+    }
+
+    This = this;
+
+    // ---------------------- Setup ncurses -------------------------
+
+    initscr();		      // Start curses mode
+
+    cbreak();		      // Line buffering disabled, Pass on
+    noecho();                 // Switch off echo mode
+    nonl();                   // Associate return with CR
+
+    intrflush(stdscr, FALSE);
+    keypad(stdscr, FALSE);    // Switch off keymapping for function keys
+
+    start_color();            // Initialize ncurses colors
+    use_default_colors();     // Assign terminal default colors to -1
+    //assume_default_colors(-1, -1); // standard terminal colors assigned to pair 0
+
+    // Setup colors
+    for (int i=1; i<8; i++)
+        init_pair(i, i, -1);  // -1: def background
+
+    signal(SIGWINCH, HandleResizeImp);  // Attach HandleResize to SIGWINCH signal
+
+    // ---------------------- Setup pansl --------------------------
+
+    // Create the necessary windows
+    WINDOW *wins[4];
+    CreateWindows(wins);
+
+    // Initialize the panels
+    fPanelIn    = new_panel(wins[0]);
+    fPanelFrame = new_panel(wins[1]);
+    fPanelOut   = new_panel(wins[2]);
+
+    win.SetWindow(wins[0]);
+    wout.SetWindow(wins[2]);
+
+    // Get the panels into the right order for startup
+    ShowHide(1);
+
+    // Setup Readline
+    SetWindow(wins[0]);
+    SetColorPrompt(COLOR_PAIR(COLOR_BLUE));
+
+    // ------------------- Setup key bindings -----------------------
+    BindKeySequence("\033OP",    rl_proc_F1);    // \033OP
+    BindKeySequence("\033[1;5B", rl_scroll_top); // \033OP
+    BindKeySequence("\033[1;5A", rl_scroll_top); // \033OP
+    BindKeySequence("\033[1;3A", rl_scroll_bot); // \033OP
+    BindKeySequence("\033[1;3B", rl_scroll_bot); // \033OP
+    BindKeySequence("\033[5;3~", rl_top_inc);    // \033OP
+    BindKeySequence("\033[6;3~", rl_top_dec);    // \033OP
+    BindKeySequence("\033+",     rl_top_resize); // \033OP
+    BindKeySequence("\033-",     rl_top_resize); // \033OP
+
+    /*
+     rl_bind_keyseq("\033\t",   rl_complete); // Meta-Tab
+     rl_bind_keyseq("\033[1~",  home); // Home (console)
+     rl_bind_keyseq("\033[H",   home); // Home (x)
+     rl_bind_keyseq("\033[4~",  end); // End (console)
+     rl_bind_keyseq("\033[F",   end); // End (x)
+     rl_bind_keyseq("\033[A",   up); // Up
+     rl_bind_keyseq("\033[B",   down); // Down
+     rl_bind_keyseq("\033[[B",  accept); // F2 (console)
+     rl_bind_keyseq("\033OQ",   accept); // F2 (x)
+     rl_bind_keyseq("\033[21~", cancel); // F10
+     */
+
+    // Ctrl+dn:   \033[1;5B
+    // Ctrl+up:   \033[1;5A
+    // Alt+up:    \033[1;3A
+    // Alt+dn:    \033[1;3B
+    // Alt+pg up: \033[5;3~
+    // Alt+pg dn: \033[6;3~
+}
+
+// --------------------------------------------------------------------------
+//
+//! Ends the ncurses environment by calling endwin().
+//
+Shell::~Shell()
+{
+    // Maybe not needed because the window is more or less valid until the
+    // object is destructed anyway.
+    //win.SetWindow(0);
+    //wout.SetWindow(0);
+    //SetWindow(0);
+
+    endwin();
+    cout << "The end." << endl;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function gets the windows into the expected order which is:
+//!
+//! @param v
+//!    - \b 0:  Do not show the output panel
+//!    - \b 1:  Show the output panel
+//!    - \b -1: Toggle the visibility of the output panel
+//!    - \b -2: Just update the panels, do not change their visibility
+//
+void Shell::ShowHide(int v)
+{
+    if (v>-2)
+        fIsVisible = v==-1 ? !fIsVisible : v;
+
+    if (fIsVisible)
+    {
+        show_panel(fPanelIn);
+        show_panel(fPanelFrame);
+        show_panel(fPanelOut);
+    }
+    else
+    {
+        show_panel(fPanelIn);
+        hide_panel(fPanelFrame);
+        hide_panel(fPanelOut);
+    }
+
+    update_panels();
+    doupdate();
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! Creates the windows to be used as panels and draws a frame around one
+//!
+//! @param w
+//!    pointers to the three windows which have been created are returned
+//!
+//! @param all
+//!   If all is false do not (re-)create the bottom or input-window
+//
+void Shell::CreateWindows(WINDOW *w[3], int all)
+{
+    int maxx, maxy;
+    getmaxyx(stdscr, maxy, maxx);
+
+    int separator = maxy-fPanelHeight;
+
+    WINDOW *new_in    = all ? newwin(maxy,    maxx,   0, 0) : 0;
+    WINDOW *new_frame = newwin(separator-1,   maxx,   0, 0);
+    WINDOW *new_out   = newwin(separator-1-2, maxx-2, 1, 1);
+
+    box(new_frame,     0,0);
+    wmove(new_frame,   0, 1);
+    waddch(new_frame,  ACS_RTEE);
+    wprintw(new_frame, " F1 ");
+    waddch(new_frame,  ACS_LTEE);
+
+    scrollok(new_out, true);
+    leaveok (new_out, true);
+
+    if (new_in)
+    {
+        scrollok(new_in, true);  // Allow scrolling
+        leaveok (new_in, false);  // Move the cursor with the output
+
+        wmove(new_in, maxy-1, 0);
+    }
+
+    w[0] = new_in;
+    w[1] = new_frame;
+    w[2] = new_out;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Key binding for F1. Toggles upper panel by calling ShowHide(-1)
+//
+int Shell::rl_proc_F1(int /*cnt*/, int /*key*/)
+{
+    This->ShowHide(-1); // toggle
+    return 0;
+}
+
+int Shell::rl_scroll_top(int, int key)
+{
+    This->win << "Scroll " << key << endl;
+    return 0;
+}
+
+int Shell::rl_scroll_bot(int, int key)
+{
+    This->win << "Scroll " << key << endl;
+    return 0;
+}
+
+int Shell::rl_top_inc(int, int key)
+{
+    This->win << "Increase " << key << endl;
+    return 0;
+}
+
+int Shell::rl_top_dec(int, int key)
+{
+    This->win << "Increase " << key << endl;
+    return 0;
+}
+
+int Shell::rl_top_resize(int, int key)
+{
+    This->Resize(key=='+' ? This->fPanelHeight-1 : This->fPanelHeight+1);
+    return 0;
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! Signal handler for SIGWINCH, calls HandleResize
+//
+void Shell::HandleResizeImp(int)
+{
+    This->HandleResize();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Signal handler for SIGWINCH. It resizes the terminal and all panels
+//! according to the new terminal size and redisplay the backlog buffer
+//! in both windows
+//!
+//! @todo
+//!   Maybe there are more efficient ways than to display the whole buffers
+//
+void Shell::HandleResize()
+{
+    // Get the new terminal size
+    struct winsize w;
+    ioctl(0, TIOCGWINSZ, &w);
+
+    // propagate it to the terminal
+    resize_term(w.ws_row, w.ws_col);
+
+    // Store the pointer to the old windows
+    WINDOW *w_in    = panel_window(fPanelIn);
+    WINDOW *w_frame = panel_window(fPanelFrame);
+    WINDOW *w_out   = panel_window(fPanelOut);
+
+    // Create new windows
+    WINDOW *wins[3];
+    CreateWindows(wins);
+
+    // Redirect the streams and the readline output to the new windows
+    win.SetWindow(wins[0]);
+    wout.SetWindow(wins[2]);
+
+    SetWindow(wins[0]);
+
+    // Replace windows in the panels
+    replace_panel(fPanelIn,    wins[0]);
+    replace_panel(fPanelFrame, wins[1]);
+    replace_panel(fPanelOut,   wins[2]);
+
+    // delete the old obsolete windows
+    delwin(w_in);
+    delwin(w_out);
+    delwin(w_frame);
+
+    // FIXME:  NEEDED also in Redisplay panel
+    //Redisplay();
+
+    // Redisplay their contents
+    win.Display();
+    wout.Display();
+}
+
+// --------------------------------------------------------------------------
+//
+//! This resized the top panel or output panel as requested by the argument.
+//! The argument is the number of lines which are kept free for the input
+//! panel below the top panel
+//!
+//! @returns
+//!    always true
+//
+bool Shell::Resize(int h)
+{
+    // Get curretn terminal size
+    int lines, cols;
+    getmaxyx(stdscr, lines, cols);
+
+    // Check if we are in a valid range
+    if (h<1 || h>lines-5)
+        return false;
+
+    // Set new height for panel to be kept free
+    fPanelHeight = h;
+
+    // Store the pointers of the old windows associated with the panels
+    // which should be resized
+    WINDOW *w_frame = panel_window(fPanelFrame);
+    WINDOW *w_out   = panel_window(fPanelOut);
+
+    // Create new windows
+    WINDOW *wins[3];
+    CreateWindows(wins, false);
+
+    // Redirect the output stream to the new window
+    wout.SetWindow(wins[2]);
+
+    // Replace the windows associated with the panels
+    replace_panel(fPanelFrame, wins[1]);
+    replace_panel(fPanelOut,   wins[2]);
+
+    // delete the ols windows
+    delwin(w_out);
+    delwin(w_frame);
+
+    // FIXME:  NEEDED also in Redisplay panel
+    //Redisplay();
+
+    // Redisplay the contents
+    wout.Display();
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This wrapt the given readline function into a redirection to a file,
+//! which contents is then displayed afterwards in the input panel.
+//!
+//! For convinience the given title is printed in bold before the list.
+//!
+//! This allows to show some readline output in the panel.
+//!
+//! @param function
+//!    Takes a function of type bool(*)() as argument
+//!
+//! @param title
+//!    A title streamed in bold before the output starts
+//!
+//! @returns
+//!    The return value of the function
+//
+bool Shell::RedirectionWrapper(bool (*function)(), const char *title)
+{
+    FILE *save = SetStreamOut(tmpfile());
+    const bool rc = function();
+    FILE *file = SetStreamOut(save);
+
+    const bool empty = ftell(file)==0;
+
+    rewind(file);
+
+    win << endl;
+    win << kBold << title << endl;
+
+    if (empty)
+    {
+        win << " <empty>" << endl;
+        fclose(file);
+        return rc;
+    }
+
+    while (1)
+    {
+        const int c = getc(file);
+        if (feof(file))
+            break;
+        win << (char)c;
+    }
+    win << endl;
+
+    fclose(file);
+
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Can be overwritten to display user defined commands when the command
+//! c is issued.
+//!
+//! @returns
+//!    always true
+//
+bool Shell::PrintCommands()
+{
+    win << endl;
+    win << " " << kUnderline << " Commands:" << endl;
+    win << "   No application specific commands defined." << endl;
+    win << endl;
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Displays the available ncurses attributes, like color.
+//!
+//! @returns
+//!    always true
+//
+bool Shell::PrintAttributes()
+{
+    //ostream &win = wout;
+    win << endl;
+    win << " Attributes:" << endl;
+    win << "   " << kReset      << "kReset" << endl;
+    win << "   " << kNormal     << "kNormal" << endl;
+    win << "   " << kHighlight  << "kHighlight" << endl;
+    win << "   " << kReverse    << "kReverse" << endl;
+    win << "   " << kUnderline  << "kUnderline" << endl;
+    win << "   " << kBlink      << "kBlink" << endl;
+    win << "   " << kDim        << "kDim" << endl;
+    win << "   " << kBold       << "kBold" << endl;
+    win << "   " << kProtect    << "kProtect" << endl;
+    win << "   " << kInvisible  << "kInvisible" << endl;
+    win << "   " << kAltCharset << "kAltCharset" << kReset << "  (kAltCharset)" << endl;
+    win << endl;
+    win << " Colors:" << endl;
+    win << "   " << kDefault << "kDefault  " << kBold << "+  kBold" << endl;
+    win << "   " << kRed     << "kRed      " << kBold << "+  kBold" << endl;
+    win << "   " << kGreen   << "kGreen    " << kBold << "+  kBold" << endl;
+    win << "   " << kYellow  << "kYellow   " << kBold << "+  kBold" << endl;
+    win << "   " << kBlue    << "kBlue     " << kBold << "+  kBold" << endl;
+    win << "   " << kMagenta << "kMagenta  " << kBold << "+  kBold" << endl;
+    win << "   " << kCyan    << "kCyan     " << kBold << "+  kBold" << endl;
+    win << "   " << kWhite   << "kWhite    " << kBold << "+  kBold" << endl;
+    win << "   " << endl;
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Displays the keybindings available due to the Shell class
+//!
+//! @returns
+//!    always true
+//!
+//! @todo
+//!    Update output
+//
+bool Shell::PrintKeyBindings()
+{
+    win << endl;
+    win << " " << kUnderline << "Key bindings:" << endl;
+    win << kBold << "   Page-up         " << kReset << "Search backward in history" << endl;
+    win << kBold << "   Page-dn         " << kReset << "Search forward in history" << endl;
+    win << kBold << "   Ctrl-left       " << kReset << "One word backward" << endl;
+    win << kBold << "   Ctrl-right      " << kReset << "One word forward" << endl;
+    win << kBold << "   Ctrl-y          " << kReset << "Delete line" << endl;
+    win << kBold << "   Alt-end/Ctrl-k  " << kReset << "Delete until the end of the line" << endl;
+    win << kBold << "   F1              " << kReset << "Toggle visibility of upper panel" << endl;
+    win << endl;
+    win << " Default key-bindings are identical with your bash." << endl;
+    win << endl;
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Print a general help text which also includes the commands pre-defined
+//! by the Shell class.
+//!
+//! @returns
+//!    always true
+//!
+//! @todo
+//!    Get it up-to-date
+//
+bool Shell::PrintGeneralHelp()
+{
+    win << endl;
+    win << " " << kUnderline << "General help:" << endl;
+    win << kBold << "   h,help       " << kReset << "Print this help message" << endl;
+    win << kBold << "   clear        " << kReset << "Clear history buffer" << endl;
+    win << kBold << "   lh,history   " << kReset << "Dump the history buffer to the screen" << endl;
+    win << kBold << "   v,variable   " << kReset << "Dump readline variables" << endl;
+    win << kBold << "   f,function   " << kReset << "Dump readline functions" << endl;
+    win << kBold << "   m,funmap     " << kReset << "Dump readline funmap" << endl;
+    win << kBold << "   c,command    " << kReset << "Dump available commands" << endl;
+    win << kBold << "   k,keylist    " << kReset << "Dump key bindings" << endl;
+    win << kBold << "   a,attrs      " << kReset << "Dump available stream attributes" << endl;
+    win << kBold << "   .q,quit      " << kReset << "Quit" << endl;
+    win << endl;
+    win << " The command history is automatically loaded and saves to" << endl;
+    win << " and from " << GetName() << endl;
+    win << endl;
+
+    return true;
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! Processes the command provided by the Shell-class.
+//!
+//! @returns
+//!    whether a command was successfully processed or could not be found
+//
+bool Shell::Process(const string &str)
+{
+    // Implement readline commands:
+    //   rl set     (rl_variable_bind(..))
+    //   rl_read_init_file(filename)
+    //  int rl_add_defun (const char *name, rl_command_func_t *function, int key)
+
+    // ----------- Readline -----------
+
+    if (str=="lh" || str=="history")
+        return RedirectionWrapper(DumpHistory, "History:");
+
+    if (str=="v" || str=="variable")
+        return RedirectionWrapper(DumpVariables, "Variables:");
+
+    if (str=="f" || str=="function")
+        return RedirectionWrapper(DumpFunctions, "Functions:");
+
+    if (str=="m" || str=="funmap")
+        return RedirectionWrapper(DumpFunmap, "Funmap:");
+
+    if (Readline::Process(str))
+        return true;
+
+    // ------------ ReadlineWindow -------------
+
+    if (str=="a" || str=="attrs")
+        return PrintAttributes();
+
+    // ----------- ReadlineNcurses -----------
+
+    if (string(str)=="hide")
+    {
+        ShowHide(0);
+        return true;
+    }
+    if (string(str)=="show")
+    {
+        ShowHide(1);
+        return true;
+    }
+
+    if (str.substr(0, 7)=="height ")
+    {
+        int h;
+        sscanf(str.c_str()+7, "%d", &h);
+        return Resize(h);
+    }
+
+    if (str=="d")
+    {
+        wout.Display();
+        return true;
+    }
+
+    return false;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Overwrites Shutdown. It's main purpose is to re-output
+//! the prompt and the buffer using the WindowLog stream so that it is
+//! buffered in its backlog.
+//!
+//! @param buf
+//!    A pointer to the buffer returned by readline
+//!
+void Shell::Shutdown(const char *buf)
+{
+    ReadlineWindow::Shutdown(buf);
+
+    // Now move the cursor to the start of the prompt
+    RewindCursor();
+
+    // Output the text ourself to get it into the backlog
+    // buffer of win. We cannot use GetBuffer() because rl_end
+    // is not updated finally.
+    win << kBlue << GetPrompt() << kReset << buf << endl;
+}
Index: /trunk/FACT++/src/Shell.h
===================================================================
--- /trunk/FACT++/src/Shell.h	(revision 10183)
+++ /trunk/FACT++/src/Shell.h	(revision 10183)
@@ -0,0 +1,75 @@
+#ifndef FACT_Shell
+#define FACT_Shell
+
+#include "ReadlineWindow.h"
+#include "WindowLog.h"
+
+class WindowLog;
+
+typedef struct panel PANEL;
+
+class Shell : public ReadlineWindow
+{
+protected:
+    static Shell *This; /// pointer to our glocal object to get the static member functions into scope
+
+    WindowLog win;//(&fPanelIn);    // FIXME: Ref
+    WindowLog wout;//(&fPanelOut);  // FIXME: Ref
+
+private:
+    PANEL *fPanelIn;    /// Pointer to the panel for the input stream
+    PANEL *fPanelFrame; /// Pointer to the panel for the frame around the output
+    PANEL *fPanelOut;   /// Pointer to the panel for the output stream
+
+    int fPanelHeight;   /// Space between the bottom of the screen and the output panel
+    int fIsVisible;     /// Flag whether the output panel is visible or not (for toggle operations)
+
+    int fLine;
+
+    // Callback function for key presses
+    static int rl_proc_F1(int cnt, int key);
+    static int rl_scroll_top(int cnt, int key);
+    static int rl_scroll_bot(int cnt, int key);
+    static int rl_top_inc(int cnt, int key);
+    static int rl_top_dec(int cnt, int key);
+    static int rl_top_resize(int cnt, int key);
+
+    /// Static member function used as callback for a signal which is
+    /// emitted by the system if the size of the console window has changed
+    static void HandleResizeImp(int dummy);
+
+    /// Non static member function called by HandleResize
+    void HandleResize();
+
+    // Wrapper function to redirect the output of some readline function
+    // into our own stream
+    bool RedirectionWrapper(bool (*function)(), const char *title);
+    bool PrintAttributes();  /// Show the available attributes
+
+    /// Helper for the constructor and window resizing to create the windows and panels
+    void CreateWindows(WINDOW *w[3], int all=true);
+
+    // Action after readline finished
+    void Shutdown(const char *);
+
+public:
+    Shell(const char *prgname);
+    ~Shell();
+
+    bool Resize(int h);
+    void ShowHide(int v);
+    void Refresh() { ShowHide(-2); }
+
+    bool PrintGeneralHelp();
+    bool PrintCommands();
+    bool PrintKeyBindings();
+
+    bool Process(const std::string &str);
+
+    WindowLog &GetStreamOut() { return wout; }
+    WindowLog &GetStreamIn() { return win; }
+    const WindowLog &GetStreamOut() const { return wout; }
+    const WindowLog &GetStreamIn() const { return win; }
+};
+
+#endif
Index: /trunk/FACT++/src/StateMachine.cc
===================================================================
--- /trunk/FACT++/src/StateMachine.cc	(revision 10183)
+++ /trunk/FACT++/src/StateMachine.cc	(revision 10183)
@@ -0,0 +1,72 @@
+// **************************************************************************
+/** @class StateMachine
+
+ @brief Class for a state machine implementation just on the console
+
+This class implements a StateMachine which is to be controlled from the
+console. It redirects all output posted via MessageImp to the console
+and, if the stream is a WindowLog, adds colors.
+
+When constructing the Dim network is started and while dstruction it is
+stopped.
+
+@todo
+   Do we really need to create Event-objects? Shouldn't we add a
+   ProcessEvent function which takes an event as argument instead?
+   Or something else which easily allows to add data to the events?
+
+*/
+// **************************************************************************
+#include "StateMachine.h"
+
+#include "WindowLog.h"
+
+#include "Event.h"
+#include "Time.h"
+#include "Shell.h"
+
+#include "tools.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Overwrite StateMachineImp::AddTransition to create an Event object
+//! instead of an EventImp object. The event name propagated is name.
+//!
+//! For parameter description see StateMachineImp.
+//!
+EventImp *StateMachine::CreateEvent(int targetstate, const char *name, const char *fmt)
+{
+    return new Event(targetstate, name, fmt);
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is (analog to StateMachineDim::commandHandler()) the function which
+//! is called if an event from the console is received. It then is
+//! supposed to send the event to the messge queue or handle it directly
+//! if the machine was not yet started.
+//!
+//! If fCurrentState is smaller than 0 or we are in kSM_FatalError state,
+//! all incoming commands are ignored.
+//!
+//! The commandHandler will go through the list of available commands
+//! (fListOfEventss). If the received command was recognized, it is added
+//! via PostCommand into the fifo.
+//!
+//! @todo
+//!    - Fix the exit when cmd is not of type EventImp
+//!    - Do we need a possibility to suppress a call to "HandleEvent"
+//!      or is a state<0 enough?
+//
+bool StateMachine::ProcessCommand(const std::string &str, const char *ptr, size_t siz)
+{
+    EventImp *evt = FindEvent(str);
+    if (!evt)
+        return false;
+
+    PostEvent(*evt, ptr, siz);
+    return true;
+}
+
Index: /trunk/FACT++/src/StateMachine.h
===================================================================
--- /trunk/FACT++/src/StateMachine.h	(revision 10183)
+++ /trunk/FACT++/src/StateMachine.h	(revision 10183)
@@ -0,0 +1,27 @@
+#ifndef FACT_StateMachine
+#define FACT_StateMachine
+
+#include "StateMachineImp.h"
+
+class StateMachine : public StateMachineImp
+{
+private:
+    /// Redirect our own logging to the console
+    /// int Write(const Time &t, const char *txt, int qos=kInfo);
+
+protected:
+    EventImp *CreateEvent(int targetstate, const char *name, const char *fmt);
+
+public:
+    StateMachine(std::ostream &out, const std::string &name="") :
+        StateMachineImp(out, name)
+    {
+    }
+
+    bool ProcessCommand(const std::string &str, const char *ptr, size_t siz);
+    bool ProcessCommand(const EventImp &evt);
+    bool ProcessCommand(const std::string &str) { return ProcessCommand(str, 0, 0); }
+
+};
+
+#endif
Index: /trunk/FACT++/src/StateMachineDim.cc
===================================================================
--- /trunk/FACT++/src/StateMachineDim.cc	(revision 10183)
+++ /trunk/FACT++/src/StateMachineDim.cc	(revision 10183)
@@ -0,0 +1,174 @@
+// **************************************************************************
+/** @class StateMachineDim
+
+@brief Class for a state machine implementation within a DIM network
+
+This class implements a StateMachine within a Dim network. It redirects
+all output posted via MessageImp to a service called "NAME/MESSAGE"
+while name is the name of the machine given in the constructor. In
+addition two services are offered: NAME/STATE and NAME/VERSION.
+NAME/STATE propagates any state change to the netork.
+
+When constructing the Dim network is started and while dstruction it is
+stopped.
+
+@todo
+    Proper support for versioning
+
+*/
+// **************************************************************************
+#include "StateMachineDim.h"
+
+#include "tools.h"
+
+#include "Time.h"
+#include "EventDim.h"
+
+using namespace std;
+
+const int StateMachineDim::fVersion = 42;
+
+// --------------------------------------------------------------------------
+//
+//! The constrcutor first initialized DimStart with the given machine name.
+//! DimStart is just a wrapper which constructor calls DimServer::start()
+//! to ensure that initializing the Dim sub-system, is the first what is
+//! done.
+//!
+//! The second objet instantiated is the MessageDim class which offers
+//! the MESSAGE service used to broadcast logging messages to other
+//! Dim clients.
+//!
+//! After this the services STATE and VERSION are setup. STATE will
+//! be used to broadcast the state of the machine. Version broadcasts
+//! the global version number of the StateMachineDim implementation
+//!
+//! After redirecting the handler which handels dim's EXIT command
+//! to ourself (it will then call StateMachineDim::exitHandler) and
+//! adding human readable state names for the default states
+//! implemented by StateMachingImp the state is set to kSM_Initializing.
+//! Warning: The EXIT handler is global!
+//!
+//! @param name
+//!    The name with which the dim-services should be prefixed, e.g.
+//!    "DRIVE" will lead to "DRIVE/SERVICE". It is also propagated
+//!    to DimServer::start()
+//!
+//! @param out
+//!    A refrence to an ostream which allows to redirect the log-output
+//!    to something else than cout. The default is cout. The reference
+//!    is propagated to fLog
+//!
+//! @todo
+//!    - Shell the VERSION be set from the derived class?
+//
+StateMachineDim::StateMachineDim(ostream &out, const std::string &name)
+: StateMachine(out, name), DimStart(name, *this), fLog(name, out),
+fSrvState(Form("%s/STATE", name.c_str()).c_str(), const_cast<char*>("")),
+fSrvVersion(Form("%s/VERSION", name.c_str()).c_str(), const_cast<int&>(fVersion))
+{
+    // WARNING: This exit handler is GLOBAL!
+    DimServer::addExitHandler(this);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Overwrite StateMachineImp::AddTransition to create a EventDim
+//! instead of an Event object. The event name propagated to the EventDim
+//! is fName+"/"+name.
+//!
+//! For parameter description see StateMachineImp.
+//!
+EventImp *StateMachineDim::CreateEvent(int targetstate, const char *name, const char *fmt)
+{
+    return new EventDim(targetstate, GetName()+"/"+name, fmt, this);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Overwrite StateMachineImp::SetCurrentState. In addition to
+//! calling StateMachineImo::SetCurrentState the new state is also
+//! distributed via the DimService STATE.
+//!
+//! For parameter description see StateMachineImp.
+//!
+string StateMachineDim::SetCurrentState(int state, const char *txt, const std::string &cmd)
+{
+    const string msg = StateMachineImp::SetCurrentState(state, txt, cmd);
+    if (msg.empty())
+        return "";
+
+    fSrvState.setQuality(state);
+    fSrvState.setData(const_cast<char*>(msg.c_str()));
+    fSrvState.updateService();
+
+    return msg;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Overwritten DimCommand::commandHandler()
+//!
+//! If fCurrentState is smaller than 0 or we are in kSM_FatalError state,
+//! all incoming commands are ignored.
+//!
+//! The commandHandler will go through the list of available commands
+//! (fListOfEventss). If the received command was recognized, it is added
+//! via PushCommand into the fifo.
+//!
+//! @todo
+//!    - Fix the exit when cmd is not of type EventImp
+//!    - Fix docu
+//!    - Do we need a possibility to suppress a call to "HandleEvent"
+//!      or is a state<0 enough?
+//
+void StateMachineDim::commandHandler()
+{
+    DimCommand *cmd = getCommand();
+    if (!cmd)
+        return;
+
+    const EventImp *evt = dynamic_cast<EventImp*>(cmd);
+
+    // FIXME: In the case of HandleEvent there is no need to copy the data
+    // FIMXE: Currentyl the time is not copied
+    // FIXME: Handle Event is not thread safe (Dim + Console)
+    if (HasEvent(evt))
+        PostEvent(*evt);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Overwrites MessageImp::Update. This redirects output issued via
+//! MessageImp to MessageDim object.
+//
+int StateMachineDim::Write(const Time &time, const char *txt, int qos)
+{
+    return fLog.Write(time, txt, qos);
+}
+
+// --------------------------------------------------------------------------
+//
+//! exitHandler of the DimServer. The EXIT command is implemented by each
+//! DimServer automatically. exitHandler calls Stop(code) and exit(-1)
+//! in case the received exit-value is a special number (42). abort()
+//! is called if 0x42 is received.
+//!
+//! @param code
+//!    value which is passed to Stop(code)
+//
+void StateMachineDim::exitHandler(int code)
+{
+    Out() << " -- " << Time().GetAsStr() << ": EXIT(" << code << ") command received." << endl;
+    if (code<0) // negative values reserved for internal use
+    {
+        Out() << " -- " << Time().GetAsStr() << ": ignored." << endl;
+        return;
+    }
+
+    Stop(code);
+    if (code==42)
+        exit(-1);
+    if (code==0x42)
+        abort();
+}
Index: /trunk/FACT++/src/StateMachineDim.h
===================================================================
--- /trunk/FACT++/src/StateMachineDim.h	(revision 10183)
+++ /trunk/FACT++/src/StateMachineDim.h	(revision 10183)
@@ -0,0 +1,54 @@
+#ifndef FACT_StateMachineDim
+#define FACT_StateMachineDim
+
+#include "MessageDim.h"       // MessageDimTX
+#include "StateMachine.h"     // StateMachien
+
+// ***************************************************************************
+/**
+ @class DimStart
+
+ @brief Ensures calling DimServer::start() in its constructor and DimServer::stop() in its destructor
+
+**/
+// ***************************************************************************
+#include "DimErrorRedirecter.h"
+
+class DimStart : public DimErrorRedirecter
+{
+protected:
+    DimStart(const std::string &name, MessageImp &imp) : DimErrorRedirecter(imp)
+    {
+        DimServer::addErrorHandler(this);
+        DimServer::start(name.c_str());
+    }
+    ~DimStart() { DimServer::stop(); }
+};
+
+class StateMachineDim : public DimCommandHandler, public DimExitHandler, public StateMachine, public DimStart
+{
+private:
+    MessageDimTX fLog;           /// Logging to the Dim network
+
+    static const int fVersion;   /// Version number
+
+    DimService fSrvState;        /// DimService offering fCurrentState
+    DimService fSrvVersion;      /// DimService offering fVersion
+
+    void exitHandler(int code);  /// Overwritten DimCommand::exitHandler.
+    void commandHandler();       /// Overwritten DimCommand::commandHandler 
+
+    /// Redirect our own logging to fLog
+    int Write(const Time &time, const char *txt, int qos);
+
+    /// This is an internal function to do some action in case of
+    /// a state change, like updating the corresponding service.
+    std::string SetCurrentState(int state, const char *txt="", const std::string &cmd="");
+
+    EventImp *CreateEvent(int targetstate, const char *name, const char *fmt);
+
+public:
+    StateMachineDim(std::ostream &out=std::cout, const std::string &name="DEFAULT");
+};
+
+#endif
Index: /trunk/FACT++/src/StateMachineImp.cc
===================================================================
--- /trunk/FACT++/src/StateMachineImp.cc	(revision 10183)
+++ /trunk/FACT++/src/StateMachineImp.cc	(revision 10183)
@@ -0,0 +1,985 @@
+// **************************************************************************
+/** @class StateMachineImp
+
+ @brief Base class for a state machine implementation
+
+ \dot
+  digraph example {
+      node [shape=record, fontname=Helvetica, fontsize=10];
+      s [ label="Constructor" style="rounded"  color="red"   URL="\ref StateMachineImp::StateMachineImp"];
+      a [ label="State -3 (kSM_NotReady)"      color="red"   URL="\ref StateMachineImp::StateMachineImp"];
+      b [ label="State -2 (kSM_Initializing)"  color="red"   URL="\ref StateMachineImp::StateMachineImp"];
+      c [ label="State -1 (kSM_Configuring)"   color="red"   URL="\ref StateMachineImp::StateMachineImp"];
+      y [ label="State 0 (kSM_Ready)"                        URL="\ref StateMachineImp::Run"];
+      r [ label="User states (Running)" ];
+      e [ label="State 256 (kSM_Error)" ];
+      f [ label="State 65535 (kSM_FatalError)" color="red"   URL="\ref StateMachineImp::Run"];
+
+      // ---- manual means: command or program introduced ----
+
+      // Startup from Run() to Ready
+      s -> a [ arrowhead="open" color="red"  style="solid"  ]; // automatic (mandatory)
+      a -> b [ arrowhead="open" color="red"  style="solid"  ]; // automatic (mandatory)
+      b -> c [ arrowhead="open" color="red"  style="solid"  ]; // automatic (mandatory)
+
+      c -> y [ arrowhead="open" color="red"  style="solid" URL="\ref StateMachineImp::Run" ]; // prg: Run()
+
+      y -> c [ arrowhead="open" style="dashed" URL="\ref StateMachineDim::exitHandler" ]; // CMD: EXIT
+      r -> c [ arrowhead="open" style="dashed" URL="\ref StateMachineDim::exitHandler" ]; // CMD: EXIT
+      e -> c [ arrowhead="open" style="dashed" URL="\ref StateMachineDim::exitHandler" ]; // CMD: EXIT
+
+      e -> y [ arrowhead="open" color="red"  style="dashed" ]; // CMD: RESET (e.g.)
+
+      y -> e [ arrowhead="open" color="blue" style="solid"  ]; // prg
+      r -> e [ arrowhead="open" color="blue" style="solid"  ]; // prg
+
+      y -> r [ arrowhead="open" color="blue" style="dashed" ]; // CMD/PRG
+      r -> y [ arrowhead="open" color="blue" style="dashed" ]; // CMD/PRG
+
+      y -> f [ arrowhead="open" color="blue" style="solid"  ]; // prg
+      r -> f [ arrowhead="open" color="blue" style="solid"  ]; // prg
+      e -> f [ arrowhead="open" color="blue" style="solid"  ]; // prg
+  }
+  \enddot
+
+  - <B>Red box</B>: Internal states. Events which are received are
+    discarded.
+  - <B>Black box</B>: State machine running. Events are accepted and
+    processed according to the implemented functions Transition(),
+    Configuration() and Execute(). Events are accepted accoding to the
+    lookup table of allowed transitions.
+  - <B>Red solid arrow</B>: A transition initiated by the program itself.
+  - <b>Dashed arrows in general</b>: Transitions which can be initiated
+    by a dim-command or get inistiated by the program.
+  - <b>Solid arrows in general</b>: These transitions are always initiated by
+    the program.
+  - <B>Red dashed</B>: Suggested RESET event (should be implemented by
+    the derived class)
+  - <B>Black dashed arrow</B>: Exit from the main loop. This can either
+    happen by the Dim-provided EXIT-command or a call to StateMachineDim::Stop.
+  - <B>Black arrows</B>: Other events or transitions which can be
+    implemented by the derived class.
+  - <B>Dotted black arrow</B>: Exit from the main-loop which is initiated
+    by the program itself through StateMachineDim::Stop() and not by the
+    state machine itself (Execute(), Configure() and Transition())
+  - <b>Blue dashed arrows</b>: Transitions which happen either by receiving
+    a event or are initiated from the state machine itself
+    (by return values of (Execute(), Configure() and Transition())
+  - <b>Blue solid</b>: Transitions which cannot be initiated by dim
+    event but only by the state machine itself.
+  - From the program point of view the fatal error is identical with
+    the kSM_Configuring state, i.e. it is returned from the main-loop.
+    Usually this will result in program termination. However, depending
+    on the state the program might decide to use different cleaning
+    routines.
+
+@todo
+   - A proper and correct cleanup after an EXIT or Stop() is missing.
+     maybe we have to force a state 0 first?
+*/
+// **************************************************************************
+#include "StateMachineImp.h"
+
+#include "Time.h"
+#include "Event.h"
+
+#include "WindowLog.h"
+#include "Converter.h"
+
+#include "tools.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! The state of the state machine (fCurrentState) is initialized with
+//! kSM_NotReady
+//!
+//! Default state names for kSM_NotReady, kSM_Ready, kSM_Error and
+//! kSM_FatalError are set via AddStateName.
+//!
+//! fExitRequested is set to 0, fRunning to false.
+//!
+//! Furthermore, the ostream is propagated to MessageImp, as well as
+//! stored in fOut.
+//!
+//! MessageImp is used for messages which are distributed (e.g. via DIM),
+//! fOut is used for messages which are only displayed on the local console.
+//!
+//! Subsequent, i.e. derived classes should setup all allowed state
+//! transitions as well as all allowed configuration event by
+//! AddTransition, AddConfiguration and AddStateName.
+//!
+//! @param out
+//!    A refrence to an ostream which allows to redirect the log-output
+//!    to something else than cout. The default is cout. The reference
+//!    is propagated to fLog
+//!
+//! @param name
+//!    The server name stored in fName
+//!
+//
+StateMachineImp::StateMachineImp(ostream &out, const std::string &name)
+    : MessageImp(out), fName(name), fCurrentState(kSM_NotReady),
+    fRunning(false), fExitRequested(0)
+{
+    AddStateName(kSM_NotReady,   "NotReady");
+    AddStateName(kSM_Ready,      "Ready");
+    AddStateName(kSM_Error,      "ERROR");
+    AddStateName(kSM_FatalError, "FATAL");
+}
+
+// --------------------------------------------------------------------------
+//
+//! delete all object stored in fListOfEvent and in fEventQueue
+//
+StateMachineImp::~StateMachineImp()
+{
+    // For this to work EventImp must be the first class from which
+    // the object inherits
+    for (vector<EventImp*>::iterator cmd=fListOfEvents.begin(); cmd!=fListOfEvents.end(); cmd++)
+        delete *cmd;
+
+    // Unfortunately, front() doesn't necessarily return 0 if
+    // queue is empty
+    if (fEventQueue.size())
+        for (Event *q=fEventQueue.front(); q; fEventQueue.pop_front())
+            delete q;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Puts the given event into the fifo. The fifo will take over ownership.
+//! Access to fEventQueue is encapsulated by fMutex.
+//!
+//! @param cmd
+//!    Pointer to an object of type Event to be stored in the fifo
+//!
+//! @todo
+//!    Can we also allow EventImp?
+//
+void StateMachineImp::PushEvent(Event *cmd)
+{
+    fMutex.lock();
+    fEventQueue.push_back(cmd);
+    fMutex.unlock();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Get an event from the fifo. We will take over the owenership of the
+//! object. The pointer is deleted from the fifo. Access of fEventQueue
+//! is encapsulated by fMutex.
+//!
+//! @returns
+//!    A pointer to an Event object
+//
+Event *StateMachineImp::PopEvent()
+{
+    fMutex.lock();
+
+    // Get the next event from the stack
+    // and remove event from the stack
+    Event *cmd = fEventQueue.front();
+    fEventQueue.pop_front();
+
+    fMutex.unlock();
+
+    return cmd;
+}
+
+// --------------------------------------------------------------------------
+//
+//! With this function commands are posted to the event queue. The data
+//! is not given as binary data but as a string instead. It is converted
+//! according to the format of the corresponding event and an event
+//! is posted to the queue if successfull.
+//!
+//! @param lout
+//!    Stream to which output should be redirected
+//!    event should be for.
+//!
+//! @param str
+//!    Command with data, e.g. "COMMAND 1 2 3 4 5 test"
+//!
+//! @returns
+//!    false if no event was posted to the queue. If
+//!    PostEvent(EventImp&,const char*, size_t) was called return its
+//!    return value
+//
+bool StateMachineImp::PostEvent(ostream &lout, const string &str)
+{
+    // Find the delimiter between the command name and the data
+    size_t p0 = str.find_first_of(' ');
+    if (p0==string::npos)
+        p0 = str.length();
+
+    // Compile the command which will be sent to the state-machine
+    const string name = fName + "/" + str.substr(0, p0);
+
+    // Check if this command is existing at all
+    EventImp *evt = FindEvent(name);
+    if (!evt)
+    {
+        lout << kRed << "Unknown command '" << name << "'" << endl;
+        return false;
+    }
+
+    // Get the format of the event data
+    const string fmt = evt->GetFormat();
+
+    // Convert the user enetered data according to the format string
+    // into a data block which will be attached to the event
+    lout << kBlue << name;
+
+    const Converter c(lout, fmt, str.substr(p0));
+
+    // Parsing was not successfull
+    if (!c.GetRc())
+    {
+        lout << kRed << "Couldn't properly parse the input... ignored." << endl;
+        return false;
+    }
+
+    return PostEvent(*evt, c.Ptr(), c.Size());
+}
+
+// --------------------------------------------------------------------------
+//
+//! With this function commands are posted to the event queue. If the
+//! event loop has not yet been started with Run() the command is directly
+//! handled by HandleEvent.
+//!
+//! Events posted when the state machine is in a negative state or
+//! kSM_FatalError are ignored.
+//!
+//! A new event is created and its data contents initialized with the
+//! specified memory.
+//!
+//! @param evt
+//!    The event to be posted. The precise contents depend on what the
+//!    event should be for.
+//!
+//! @param ptr
+//!    pointer to the memory which should be attached to the event
+//!
+//! @param siz
+//!    size of the memory which should be attached to the event
+//!
+//! @todo
+//!    - Shell we check for the validity of a command at the current state, too?
+//!    - should we also get the output stream as an argument here?
+//
+bool StateMachineImp::PostEvent(const EventImp &evt, const char *ptr, size_t siz)
+{
+    if (GetCurrentState()<0 || GetCurrentState()==kSM_FatalError)
+    {
+        Out() << kYellow << "Event ignored." << endl;
+        return false;
+    }
+
+    if (IsRunning())
+        PushEvent(new Event(evt, ptr, siz));
+    else
+    {
+        // FIXME: Is this thread safe? (Yes, because the data is copied)
+        // But two handlers could be called at the same time. Do we
+        // need to lock the handlers?
+        const Event event(evt, ptr, siz);
+        HandleEvent(event);
+    }
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! With this function commands are posted to the event queue. If the
+//! event loop has not yet been started with Run() the command is directly
+//! handled by HandleEvent.
+//!
+//! Events posted when the state machine is in a negative state or
+//! kSM_FatalError are ignored.
+//!
+//! @param evt
+//!    The event to be posted. The precise contents depend on what the
+//!    event should be for.
+//!
+//! @todo
+//!    - Shell we check for the validity of a command at the current state, too?
+//!    - should we also get the output stream as an argument here?
+//
+bool StateMachineImp::PostEvent(const EventImp &evt)
+{
+    if (GetCurrentState()<0 || GetCurrentState()==kSM_FatalError)
+    {
+        Out() << kYellow << "Event ignored." << endl;
+        return false;
+    }
+
+    if (IsRunning())
+        PushEvent(new Event(evt));
+    else
+    {
+        // FIXME: Is this thread safe? (Yes, because it is only used
+        // by Dim and this is thread safe) But two handlers could
+        // be called at the same time. Do we need to lock the handlers?
+        HandleEvent(evt);
+    }
+    return true;
+}
+
+const vector<string> StateMachineImp::GetEventNames() const
+{
+    vector<string> v;
+
+    const string &name = fName + "/";
+    const int     len  = name.length();
+
+    for (vector<EventImp*>::const_iterator i=fListOfEvents.begin();
+         i!=fListOfEvents.end(); i++)
+    {
+        const string evt = (*i)->GetName();
+
+        v.push_back(evt.substr(0, len)==name ? evt.substr(len) : evt);
+    }
+
+    return v;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Call for each event in fListEvents its Print function with the given
+//! stream.
+//!
+//! @param out
+//!    ostream to which the output should be redirected
+//
+void StateMachineImp::PrintListOfEvents(std::ostream &out)
+{
+    for (vector<EventImp*>::iterator c=fListOfEvents.begin(); c!=fListOfEvents.end(); c++)
+        (*c)->Print(out);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Call PrintListOfEvents with fOut as the output stream
+//
+void StateMachineImp::PrintListOfEvents()
+{
+    PrintListOfEvents(Out());
+}
+
+// --------------------------------------------------------------------------
+//
+//! Check whether an event (same pointer!) is in fListOfEvents
+//!
+//! @returns
+//!    true if the event was found, false otherwise
+//
+bool StateMachineImp::HasEvent(const EventImp *cmd) const
+{
+    // Find the event from the list of commands and queue it
+    for (vector<EventImp*>::const_iterator c=fListOfEvents.begin(); c!=fListOfEvents.end(); c++)
+        if (*c == cmd)
+            return true;
+
+    return false;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Check whether an event with the given name is found in fListOfEvents.
+//! Note that currently there is no mechanism which ensures that not two
+//! events have the same name.
+//!
+//! @returns
+//!    true if the event was found, false otherwise
+//
+EventImp *StateMachineImp::FindEvent(const std::string &evt) const
+{
+    // Find the command from the list of commands and queue it
+    for (vector<EventImp*>::const_iterator c=fListOfEvents.begin(); c!=fListOfEvents.end(); c++)
+        if (evt == (*c)->GetName())
+            return *c;
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Returns a pointer to a newly allocated object of base EventImp.
+//! It is meant to be overloaded by derived classes to create their
+//! own kind of events.
+//!
+//! @param targetstate
+//!    Defines the target state of the new transition. If \b must be
+//!    greater or equal zero. A negative target state is used to flag
+//!    commands which do not initiate a state transition. If this is
+//!    desired use AddConfiguration instead.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param fmt
+//!    A format as defined by the dim system can be given for the command.
+//!    However, it has no real meaning except that it is stored within the
+//!    DimCommand object. However, the user must make sure that the data of
+//!    received commands is properly extracted. No check is done.
+//
+EventImp *StateMachineImp::CreateEvent(int targetstate, const char *, const char *)
+{
+    return new EventImp(targetstate);
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calling this function a new allowed transition is added to the state
+//! machine. Via a call to CreateEvent a new event is created with the
+//! given targetstate, name and format. 
+//!
+//! The allowed states are passed to the new event and a message
+//! is written to the output-stream.
+//!
+//! @param targetstate
+//!    Defines the target state of the new transition. If \b must be
+//!    greater or equal zero. A negative target state is used to flag
+//!    commands which do not initiate a state transition. If this is
+//!    desired use AddConfiguration instead.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param states
+//!    A comma sepeareted list of ints, e.g. "1, 4, 5, 9" with states
+//!    in which this new state transition is allowed and will be accepted.
+//!
+//! @param fmt
+//!    A format as defined by the dim system can be given for the command.
+//!    However, it has no real meaning except that it is stored within the
+//!    DimCommand object. However, the user must make sure that the data of
+//!    received commands is properly extracted. No check is done.
+//
+EventImp *StateMachineImp::AddTransition(int targetstate, const char *name, const char *states, const char *fmt)
+{
+    EventImp *evt = CreateEvent(targetstate, name, fmt);
+
+    evt->AddAllowedStates(states);
+
+    Out() << ":   " << Time().GetAsStr() << ": Adding command " << evt->GetName();
+    Out() << " (transition to " << GetStateDescription(evt->GetTargetState()) << ")" << endl;
+
+    fListOfEvents.push_back(evt);
+
+    return evt;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calling this function a new allowed transition is added to the state
+//! machine. Therefore an instance of type DimEvent is created and added
+//! to the list of available commands fListOfEvents.
+//!
+//! @param targetstate
+//!    Defines the target state of the new transition. If \b must be
+//!    greater or equal zero. A negative target state is used to flag
+//!    commands which do not initiate a state transition. If this is
+//!    desired use AddConfiguration instead.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param s1, s2, s3, s4, s5
+//!    A list of states from which a transition to targetstate is allowed
+//!    by this command.
+//
+EventImp *StateMachineImp::AddTransition(int targetstate, const char *name, int s1, int s2, int s3, int s4, int s5)
+{
+    return AddTransition(targetstate, name, Form("%d %d %d %d %d", s1, s2, s3, s4, s5).c_str(), "");
+}
+
+// --------------------------------------------------------------------------
+//
+//! Calling this function a new allowed transition is added to the state
+//! machine. Therefore an instance of type DimEvent is created and added
+//! to the list of available commands fListOfEvents.
+//!
+//! @param targetstate
+//!    Defines the target state of the new transition. If \b must be
+//!    greater or equal zero. A negative target state is used to flag
+//!    commands which do not initiate a state transition. If this is
+//!    desired use AddConfiguration instead.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param fmt
+//!    A format as defined by the dim system can be given for the command.
+//!    However, it has no real meaning except that it is stored within the
+//!    DimCommand object. However, the user must make sure that the data of
+//!    received commands is properly extracted. No check is done.
+//!
+//! @param s1, s2, s3, s4, s5
+//!    A list of states from which a transition to targetstate is allowed
+//!    by this command.
+//
+EventImp *StateMachineImp::AddTransition(int targetstate, const char *name, const char *fmt, int s1, int s2, int s3, int s4, int s5)
+{
+    return AddTransition(targetstate, name, Form("%d %d %d %d %d", s1, s2, s3, s4, s5).c_str(), fmt);
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function calls AddTransition with a target-state of -1 which means
+//! that the command will not change the state at all. This shell be used
+//! for configuration commands. As well as in AddTransition the states in
+//! which such a configuration command is accepted can be given.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param states
+//!    A comma sepeareted list of ints, e.g. "1, 4, 5, 9" with states
+//!    in which this new state transition is allowed and will be accepted.
+//!
+//! @param fmt
+//!    A format as defined by the dim system can be given for the command.
+//!    However, it has no real meaning except that it is stored within the
+//!    DimCommand object. However, the user must make sure that the data of
+//!    received commands is properly extracted. No check is done.
+//!
+EventImp *StateMachineImp::AddConfiguration(const char *name, const char *states, const char *fmt)
+{
+    return AddTransition(-1, name, states, fmt);
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function calls AddTransition with a target-state of -1 which means
+//! that the command will not change the state at all. This shell be used
+//! for configuration commands. As well as in AddTransition the states in
+//! which such a configuration command is accepted can be given.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param s1, s2, s3, s4, s5
+//!    A list of states from which a transition to targetstate is allowed
+//!    by this command.
+//
+EventImp *StateMachineImp::AddConfiguration(const char *name, int s1, int s2, int s3, int s4, int s5)
+{
+    return AddTransition(-1, name, s1, s2, s3, s4, s5);
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function calls AddTransition with a target-state of -1 which means
+//! that the command will not change the state at all. This shell be used
+//! for configuration commands. As well as in AddTransition the states in
+//! which such a configuration command is accepted can be given.
+//!
+//! @param name
+//!    The command name which should initiate the transition. The DimCommand
+//!    will be constructed with the name given to the constructor and this
+//!    name, e.g. "DRIVE/CHANGE_STATE_TO_NEW_STATE"
+//!
+//! @param fmt
+//!    A format as defined by the dim system can be given for the command.
+//!    However, it has no real meaning except that it is stored within the
+//!    DimCommand object. However, the user must make sure that the data of
+//!    received commands is properly extracted. No check is done.
+//!
+//! @param s1, s2, s3, s4, s5
+//!    A list of states from which a transition to targetstate is allowed
+//!    by this command.
+//
+EventImp *StateMachineImp::AddConfiguration(const char *name, const char *fmt, int s1, int s2, int s3, int s4, int s5)
+{
+    return AddTransition(-1, name, fmt, s1, s2, s3, s4, s5);
+}
+
+// --------------------------------------------------------------------------
+//
+//! To be able to name states, i.e. present the current state in human
+//! readable for to the user, a string can be assigned to each state.
+//! For each state this function can be called only once, i.e. state name
+//! cannot be overwritten. Negative states are ignore.d
+//!
+//! @param state
+//!    Number of the state to which a name should be assigned
+//!
+//! @param name
+//!    A name which should be assigned to the state, e.g. "Tracking"
+//!
+//! @todo  FIX THE DOCU
+//
+void StateMachineImp::AddStateName(const int state, const std::string &name)
+{
+    if (fStateNames[state].empty())
+        fStateNames[state] = name;
+}
+
+// --------------------------------------------------------------------------
+//
+//! @param state
+//!    The state for which the name should be returned.
+//!
+//! @returns
+//!    The state name as stored in fStateName is returned corresponding
+//!    to the state given. If no name exists the number is returned
+//!    as string.
+//!
+const string StateMachineImp::GetStateName(int state) /*const*/
+{
+    const string &str = fStateNames[state];
+    return str.empty() ? Form("%d", state) : str;
+}
+
+
+// --------------------------------------------------------------------------
+//
+//! This functions works in analogy to GetStateName, but the state number
+//! is added in []-parenthesis after the state name if it is available.
+//!
+//! @param state
+//!    The state for which the name should be returned.
+//!
+//! @returns
+//!    The state name as stored in fStateName is returned corresponding
+//!    to the state given plus the state number added in []-parenthesis.
+//!    If no name exists the number is returned as string.
+//!
+//
+const string StateMachineImp::GetStateDescription(int state) /*const*/
+{
+    const string &str = fStateNames[state];
+    return str.empty() ? Form("%d", state) : (str+Form("[%d]", state));
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function is a helpter function to do all the corresponding action
+//! if the state machine decides to change its state.
+//!
+//! If state is equal to the current state (fCurrentState) nothing is done.
+//! Then the service STATE (fSrcState) is updated with the new state
+//! and the text message and updateService() is called to distribute
+//! the update to all clients.
+//!
+//! In addition a log message is created and set via UpdateMsg.
+//!
+//! @param state
+//!    The new state which should be applied
+//!
+//! @param txt
+//!    A text corresponding to the state change which is distributed
+//!    together with the state itself for convinience.
+//!
+//! @param cmd
+//!    This argument can be used to give an additional name of the function
+//!    which is reponsible for the state change. It will be included in the
+//!    message
+//!
+//! @return
+//!    return the new state which was set or -1 in case of no change
+//
+string StateMachineImp::SetCurrentState(int state, const char *txt, const std::string &cmd)
+{
+    if (state==fCurrentState)
+    {
+        Out() << " -- " << Time().GetAsStr() << ": State " << GetStateDescription(state) << " already set... ";
+        if (!cmd.empty())
+            Out() << "'" << cmd << "' ignored.";
+        Out() << endl;
+        return "";
+    }
+
+    const int old = fCurrentState;
+
+    const string nold = GetStateDescription(old);
+    const string nnew = GetStateDescription(state);
+
+    string msg = nnew + " " + txt;
+    if (!cmd.empty())
+        msg += " (" + cmd + ")";
+
+    fCurrentState = state;
+
+    // State might have changed already again...
+    // Not very likely, but possible. That's why state is used
+    // instead of fCurrentState.
+
+    stringstream str;
+    str << "State Transition from " << nold << " to " << nnew << " (" << txt;
+    if (!cmd.empty())
+        str << ": " << cmd;
+    str << ")";
+    Message(str);
+
+    return msg;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function handles a new state issued by one of the event handlers.
+//!
+//! @param newstate
+//!    A possible new state
+//!
+//! @param evt
+//!    A pointer to the event which was responsible for the state change,
+//!    NULL if no event was responsible.
+//!
+//! @param txt
+//!    Text which is issued if the current state has changed and the new
+//!    state is identical to the target state as stored in the event
+//!    reference, or when no alternative text was given, or the pointer to
+//!    evt is NULL.
+//!
+//! @param alt
+//!    An alternative text which is issues when the newstate of a state change
+//!    doesn't match the expected target state.
+//!
+//! @returns
+//!    false if newstate is kSM_FatalError, true otherwise
+//
+bool StateMachineImp::HandleNewState(int newstate, const EventImp *evt,
+                                     const char *txt, const char *alt)
+{
+    if (newstate==kSM_FatalError)
+        return false;
+
+    if (newstate==fCurrentState)
+        return true;
+
+    if (!evt || !alt || newstate==evt->GetTargetState())
+        SetCurrentState(newstate, txt, evt ? evt->GetName() : "");
+    else
+        SetCurrentState(newstate, alt, evt->GetName());
+
+    return true;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is the event handler. Depending on the type of event it calles
+//! the function associated with the evenet, the Transition() or
+//! Configure() function.
+//!
+//! It first checks if the given even is valid in the current state. If
+//! it is not valid the function returns with true.
+//!
+//! If it is valid, it is checked whether a function is associated with
+//! the event. If this is the case, evt.Exec() is called and HandleNewState
+//! called with its return value. 
+//!
+//! If the event's target state is negative the Configure() function is
+//! called with the event as argument and HandleNewState with its
+//! returned new state.
+//!
+//! If the event's target state is 0 or positive the Transition() function is
+//! called with the event as argument and HandleNewState with its
+//! returned new state.
+//!
+//! In all three cases the return value of HandleNewState is returned.
+//!
+//! Any of the three commands should usually return the current state
+//! or (in case of the Transition() command) return the new state. However,
+//! all three command can issue a state change by returning a new state.
+//! However, this will just change the internal state. Any action which
+//! is connected with the state change must have been executed already.
+//!
+//! @param evt
+//!    a reference to the event which should be handled
+//!
+//! @returns
+//!    false in case one of the commands changed teh state to kSM_FataError,
+//!    true otherwise
+//
+bool StateMachineImp::HandleEvent(const EventImp &evt)
+{
+    // Get the new state from the command
+    const int commandstate = evt.GetTargetState();
+
+    // Check if the received command is allow in the current state
+    if (!evt.IsStateAllowed(fCurrentState))
+    {
+        stringstream msg;
+        msg << evt.GetName() << ": Not allowed in state ";
+        msg << GetStateDescription() << "... ignored.";
+        Warn(msg);
+        return true;
+    }
+
+    if (evt.HasFunc())
+        return HandleNewState(evt.ExecFunc(), &evt,
+                              "by ExecFunc function-call");
+
+    // Check if this is a configuration command (a command which
+    // intention is not to change the state of our state-machine
+    if (commandstate<0)
+        return HandleNewState(Configure(evt), &evt, "by Configure-command");
+    else
+        return HandleNewState(Transition(evt), &evt,
+                              "by Transition-command (expected)",
+                              "by Transition-command (unexpected)");
+
+    // This is a fatal error, because it can never happen
+    return false;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is the main loop, or what could be called the running state
+//! machine. The flow diagram below shows what the loop is actually doing.
+//! It's main purpose is to serialize command excecution and the main
+//! loop in the state machine (e.g. the tracking loop)
+//!
+//! Leaving the loop can be forced by setting fExitRequested to another
+//! value than zero. This is done automatically if dim's EXIT command
+//! is received or can be forced by calling Stop().
+//!
+//! As long as no new command arrives the Execute() command is called
+//! continously. This should implement the current action which
+//! should be performed in the current state, e.g. calculating a
+//! new command value and sending it to the hardware.
+//!
+//! If a command is received it is put into the fifo by the commandHandler().
+//! The main loop now checks the fifo. If commands are in the fifo, it is
+//! checked whether the command is valid ithin this state or not. If it is
+//! not valid it is ignored. If it is valid the corresponding action
+//! is performed. This can either be a call to Configure() (when no state
+//! change is connected to the command) or Transition() (if the command
+//! involves a state change).
+//! In both cases areference to the received command (Command) is
+//! passed to the function. Note that after the functions have finished
+//! the command will go out of scope and be deleted.
+//!
+//! None of the commands should take to long for execution. Otherwise the
+//! response time of the main loop will become too slow.
+//!
+//! Any of the three commands should usually return the current state
+//! or (in case of the Transition() command) return the new state. However,
+//! all three command can issue a state change by returning a new state.
+//! However, this will just change the internal state. Any action which
+//! is connected with the state change must have been executed already.
+//!
+//!
+//!
+//!  \dot
+//!   digraph Run {
+//!       node  [ shape=record, fontname=Helvetica, fontsize=10 ];
+//!       edge  [ labelfontname=Helvetica, labelfontsize=8 ];
+//!       start0 [ label="Run()" style="rounded"];
+//!       start1 [ label="fExitRequested=0\nfRunning=true\nSetCurrentState(kSM_Ready)"];
+//!       cond1  [ label="Is fExitRequested==0?"];
+//!       exec   [ label="HandleNewState(Execute())"];
+//!       fifo   [ label="Any event in FIFO?"];
+//!       get    [ label="Get event from FIFO\n Is event allowed within the current state?" ];
+//!       handle [ label="HandleEvent()" ];
+//!       exit1  [ label="fRunning=false\nSetCurrentState(kSM_FatalError)\n return -1" style="rounded"];
+//!       exit2  [ label="fRunning=false\nSetCurrentState(kSM_NotReady)\n return fExitRequested-1" style="rounded"];
+//!
+//!       start0   -> start1   [ weight=8 ];
+//!       start1   -> cond1    [ weight=8 ];
+//!
+//!       cond1:e  -> exit2:n  [ taillabel="true"  ];
+//!       cond1    -> exec     [ taillabel="false"  weight=8 ];
+//!
+//!       exec     -> fifo     [ taillabel="true"   weight=8 ];
+//!       exec:e   -> exit1:e  [ taillabel="false" ];
+//!
+//!       fifo     -> cond1    [ taillabel="false" ];
+//!       fifo     -> get      [ taillabel="true"   weight=8 ];
+//!
+//!       get      -> handle   [ taillabel="true"  ];
+//!
+//!       handle:s -> exit1:n  [ taillabel="false"  weight=8 ];
+//!       handle   -> cond1    [ taillabel="true"  ];
+//!   }
+//!   \enddot
+//!
+//! @returns
+//!    In the case of a a fatal error -1 is returned, fExitRequested-1 in all
+//!    other cases (This corresponds to the exit code either received by the
+//!    EXIT event or given to the Stop() function)
+//!
+//! @todo  Fix docu (kSM_SetReady, HandleEvent)
+//
+int StateMachineImp::Run()
+{
+    if (fCurrentState>=kSM_Ready)
+    {
+        Error("Run() can only be called in the NotReady state.");
+        return -1;
+    }
+
+    fRunning       = true;
+    fExitRequested = 0;
+
+    SetCurrentState(kSM_Ready, "by constructor");
+
+    while (!fExitRequested)
+    {
+        usleep(1);
+
+        // Execute a step in the current state of the state machine
+        if (!HandleNewState(Execute(), "by Execute-command"))
+            break;
+
+        // If the command stack is empty go on with processing in the
+        // current state
+        if (IsQueueEmpty())
+            continue;
+
+        // Pop the next command which arrived from the stack
+        const auto_ptr<Event> cmd(PopEvent());
+
+        if (!HandleEvent(*cmd))
+            break;
+    }
+
+    fRunning = false;
+
+    if (!fExitRequested)
+    {
+        Fatal("Fatal Error occured... shutting down.");
+        return -1;
+    }
+
+    SetCurrentState(kSM_NotReady, "due to return from Run().");
+
+    return fExitRequested-1;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function can be called to stop the loop of a running state machine.
+//! Run() will then return with a return value corresponding to the value
+//! given as argument.
+//!
+//! Note that this is a dangerous operation, because as soon as one of the
+//! three state machine commands returns (Execute(), Configure() and
+//! Transition()) the loop will be left and Run(9 will return. The program
+//! is then responsible of correctly cleaning up the mess which might be left
+//! behind.
+//!
+//! @param code
+//!    int with which Run() should return when returning.
+//
+void StateMachineImp::Stop(int code)
+{
+    fExitRequested = code+1;
+}
Index: /trunk/FACT++/src/StateMachineImp.h
===================================================================
--- /trunk/FACT++/src/StateMachineImp.h	(revision 10183)
+++ /trunk/FACT++/src/StateMachineImp.h	(revision 10183)
@@ -0,0 +1,213 @@
+#ifndef FACT_StateMachineImp
+#define FACT_StateMachineImp
+
+#include <map>
+#include <deque>
+#include <mutex>
+#include <vector>
+
+#include "MessageImp.h"
+
+class Event;
+class EventImp;
+
+class StateMachineImp : public MessageImp
+{
+public:
+    /// A list of default states available to any state machine.
+    /// Derived classes must define different state-number for
+    /// their purpose
+    enum
+    {
+        kSM_NotReady   =     -1,  ///< Mainloop not running, state machine stopped
+        kSM_Ready      =      0,  ///< Mainloop running, state machine in operation
+        kSM_Error      =  0x100,  ///< Error states should be between 0x100 and 0xffff
+        kSM_FatalError = 0xffff,  ///< Fatal error: stop program
+    } defaultstates_t;
+
+private:
+    std::string fName;   /// Name of the state-machine / server (e.g. DRIVE)
+
+    int fCurrentState;   /// Current state of the state machine
+
+    /// Human readable names associated with the states
+    std::map<const int, std::string> fStateNames;
+
+    std::vector<EventImp*> fListOfEvents; /// List of available commands as setup by user
+    std::deque<Event*>     fEventQueue;   /// Event queue (fifo) for the received commands
+
+    std::mutex fMutex;   /// Mutex to ensure thread-safe access to the command fifo
+
+    bool fRunning;       /// Machine is in main-loop
+    int  fExitRequested; /// This is a flag which is set true if the main loop should stop
+
+    /// Push a command into the fifo. The fifo takes over ownership
+    void PushEvent(Event *cmd);
+    /// Pop a command from the fifo. You take over owenership
+    Event *PopEvent();
+
+    bool HandleNewState(int newstate, const EventImp *evt, const char *txt, const char *alt=0);
+    bool HandleNewState(int newstate, const char *txt)
+    {
+        return HandleNewState(newstate, 0, txt);
+    }
+
+    virtual EventImp *CreateEvent(int targetstate, const char *name, const char *fmt);
+
+    /// Is called continously to execute actions in the current state
+    virtual int Execute() { return fCurrentState; }
+    /// Is called when a configuration event is to be processed (no transition of state)
+    virtual int Configure(const Event &) { return kSM_FatalError; }
+    /// Is called when a transition change event is to be processed (from one state to another) is received
+    virtual int Transition(const Event &) { return kSM_FatalError; }
+
+protected:
+
+    bool HandleEvent(const EventImp &evt);
+
+    /// This is an internal function to do some action in case of
+    /// a state change, like updating the corresponding service.
+    virtual std::string SetCurrentState(int state, const char *txt="", const std::string &cmd="");
+
+    EventImp *AddTransition(int targetstate, const char *name, const char *states, const char *fmt);
+    EventImp *AddTransition(int targetstate, const char *name, int s1=-1, int s2=-1, int s3=-1, int s4=-1, int s5=-1);
+    EventImp *AddTransition(int targetstate, const char *name, const char *fmt, int s1=-1, int s2=-1, int s3=-1, int s4=-1, int s5=-1);
+
+    EventImp *AddConfiguration(const char *name, const char *states, const char *fmt);
+    EventImp *AddConfiguration(const char *name, int s1=-1, int s2=-1, int s3=-1, int s4=-1, int s5=-1);
+    EventImp *AddConfiguration(const char *name, const char *fmt, int s1=-1, int s2=-1, int s3=-1, int s4=-1, int s5=-1);
+
+    void AddStateName(const int state, const std::string &name);
+
+public:
+    StateMachineImp(std::ostream &out=std::cout, const std::string &name="");
+    ~StateMachineImp();
+
+    const std::string &GetName() const { return fName; }
+
+    /// return the current state of the machine
+    int GetCurrentState() const { return fCurrentState; }
+
+    void SetReady()    { SetCurrentState(kSM_Ready, "set manually");    }
+    void SetNotReady() { SetCurrentState(kSM_NotReady, "set manually"); }
+
+    /// Start the mainloop
+    int Run();
+
+    /// Request to stop the mainloop
+    void Stop(int code=1);
+
+    /// Used to check if the main loop is already running or still running
+    bool IsRunning() const { return fRunning; }
+
+    /// Post an event to the event queue
+    bool PostEvent(std::ostream &lout, const std::string &str);
+    bool PostEvent(const std::string &evt) { return PostEvent(std::cout, evt); }
+    bool PostEvent(const EventImp &evt);
+    bool PostEvent(const EventImp &evt, const char *ptr, size_t siz);
+
+    // Event handling
+    bool HasEvent(const EventImp *cmd) const;
+    EventImp *FindEvent(const std::string &evt) const;
+
+    bool IsQueueEmpty() const { return fEventQueue.size()==0; }
+
+    const std::vector<EventImp*> &GetListOfEvents() const { return fListOfEvents; }
+    const std::vector<std::string> GetEventNames() const;
+
+    void PrintListOfEvents(std::ostream &out);
+    void PrintListOfEvents();
+
+
+    const std::string GetStateName(int state) /*const*/;
+    const std::string GetStateName() { return GetStateName(fCurrentState); }
+
+    const std::string GetStateDescription(int state) /*const*/;
+    const std::string GetStateDescription() { return GetStateDescription(fCurrentState); }
+};
+
+#endif
+
+// ***************************************************************************
+/** @fn StateMachineImp::Execute()
+
+This is what the state machine is doing in a certain state
+continously. In an idle state this might just be doing nothing.
+
+In the tracking state of the drive system this might be sending
+new command values to the drive based on its current position.
+
+The current state of the state machine can be accessed by GetCurrentState()
+
+@returns
+   Usually it should just return the current state. However, sometimes
+   execution might lead to a new state, e.g. when a hardware error
+   is detected. In this case a new state can be returned to put the state
+   machine into a different state. Note, that the function is responsible
+   of doing all actions connected with the state change itself.
+   If not overwritten it returns the current status.
+
+**/
+// ***************************************************************************
+/** @fn StateMachineImp::Configure(const Event &evt)
+
+This function is called when a configuration event is to be processed.
+
+The current state of the state machine is accessible via GetCurrentState().
+
+The issued event and its corresponding data is accessible through
+evn. (see Event and DimEvent for details) Usually such an event
+will not change the state. In this case fCurrentState will be returned.
+However, to allow the machine to go into an error state it is possible
+to change the state by giving a different return value. When the
+Configure function is called the validity of the state transition has
+already been checked.
+
+@param evt
+   A reference to an Event object with the event which should
+   be processed. Note that the cmd-object will get deleted after the
+   function has returned.
+
+@returns
+   Usually it should just return the current state. However, sometimes
+   a configuration command which was not intended to change the state
+   has to change the state, e.g. to go to an error state. Return any
+   other state than GetCurrentState() can put the state machine into
+   a different state.  Note, that the function is responsible
+   of doing all actions connected with the state change itself.
+   If not overwritten it returns kSM_FatalError.
+
+**/
+// ***************************************************************************
+/** @fn StateMachineImp::Transition(const Event &evt)
+
+This function is called if a state transision was requested.
+
+The current state of the state machine is accessible via GetCurrentState().
+
+The new state is accessible via evt.GetTargetState().
+
+The event and its corresponding data is accessible through evt.
+(see DimCommand and DimEvent for details) If the transition was
+successfull the new status should be returned. If it was unsuccessfull
+either the old or any other new status will be returned.
+
+When the Transition function is called the validity of the state
+transition has already been checked.
+
+@param evt
+   A reference to an Event object with the event which should
+   be processed. Note that the cmd-object will get deleted after the
+   function has returned.
+
+@returns
+   Usually it should return the new state. However, sometimes
+   a transition command might has to change the state to a different
+   state than the one requested (e.g. an error has occured) In this
+   case it is also allowed to return a different state.  Note, that the
+   function is responsible of doing all actions connected with the
+   state change itself.
+   If not overwritten it returns kSM_FatalError.
+
+**/
+// ***************************************************************************
Index: /trunk/FACT++/src/Time.cc
===================================================================
--- /trunk/FACT++/src/Time.cc	(revision 10183)
+++ /trunk/FACT++/src/Time.cc	(revision 10183)
@@ -0,0 +1,273 @@
+// **************************************************************************
+/** @class Time
+
+@brief Adds some functionality to boost::posix_time::ptime for our needs
+
+This is basically a wrapper around boost::posix_time::ptime which is made
+to adapt the functionality to our needs. Time can store the current
+data and time with a precision up to nanoseconds if provided by the
+undrlaying system, otherwise microsecond precision is used.
+
+It main purpose is to provide needed constructors and simplyfy the
+conversion of dates and times from and to a string/stream.
+
+Note that posix_time (as Posix times have) has a limited range. You cannot
+use it for example for very early years of the last century.
+
+@section Examples
+
+ - An example can be found in \ref time.cc
+
+@section References
+
+ - <A HREF="http://www.boost.org/doc/libs/1_45_0/doc/html/date_time.html">BOOST++ date_time (V1.45.0)</A>
+
+**/
+// **************************************************************************
+#include "Time.h"
+
+using namespace std;
+using namespace boost::posix_time;
+
+const boost::gregorian::date Time::fUnixOffset(1970, 1, 1);
+
+const Time Time::None(Time::none);
+
+// strftime
+const _time_format Time::reset = 0;
+const _time_format Time::def   = "%c";
+const _time_format Time::std   = "%x %X%F";
+const _time_format Time::sql   = "%Y-%m-%d %H:%M:%S.%f";
+const _time_format Time::iso   = "%Y%m%dT%H%M%S%F%q";
+const _time_format Time::magic = "%Y %m %d %H %M %S %f";
+
+/*
+ using date_time::special_values;
+ using date_time::not_special;
+ using date_time::neg_infin;
+ using date_time::pos_infin;
+ using date_time::not_a_date_time;
+ using date_time::max_date_time;
+ using date_time::min_date_time;
+ */
+
+// --------------------------------------------------------------------------
+//
+//! Construct a Time object with either UTC or local time, or without any
+//! particular time.
+//!
+//! @param typ
+//!    enum as defined in Time::init_t
+//
+Time::Time(enum init_t typ)
+{
+    switch (typ)
+    {
+    case utc:
+        *this = microsec_clock::universal_time();
+        break;
+    case local:
+        *this = microsec_clock::local_time();
+        break;
+    case none:
+        break;
+    }
+}
+
+// --------------------------------------------------------------------------
+//
+//! Construct a Time object from seconds since 1970/1/1 and number of
+//! milliseconds, as for example returned by gettimeofday()
+//!
+//! @param tm
+//!    seconds since 1970/1/1
+//!
+//! @param millisec
+//!    number of milliseconds
+//
+Time::Time(const time_t &tm, const int &millisec)
+: ptime(fUnixOffset, time_duration(0, 0, tm, millisec))
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Construct a Time from a date and time.
+//!
+//! @param year, month, day, hh, mm, ss, microsec
+//!    A full date and time down to microsecond precision. From the end
+//!    arguments can be omitted.
+//!
+Time::Time(short year, unsigned char month, unsigned char day,
+           unsigned char hh, unsigned char mm, unsigned char ss, unsigned int microsec)
+// Last argument is fractional_seconds ( correct with num_fractional_digits() )
+: ptime(boost::gregorian::date(year, month, day),
+        time_duration(hh, mm, ss, microsec*pow(10, time_of_day().num_fractional_digits()-6)))
+{
+}
+
+// --------------------------------------------------------------------------
+//
+//! Set the Time object to a given MJD. Note that this involves
+//! conversion from double. So converting forth and back many many
+//! times might results in drifts.
+//!
+//! @param mjd
+//!    Modified Julian Date
+//!
+void Time::Mjd(double mjd)
+{
+    mjd -= 40587;
+    mjd *= 24*60*60;
+
+    const int exp = time_of_day().num_fractional_digits();
+    const double frac = fmod(mjd, 1)*pow(10, exp);
+
+    *this = ptime(fUnixOffset, time_duration(0, 0, mjd, frac));
+}
+
+// --------------------------------------------------------------------------
+//
+//! Get the current MJD. Note that this involves
+//! conversion to double. So converting forth and back many many
+//! times might results in drifts.
+//!
+//! @returns
+//!    Modified Julian Date
+//!
+double Time::Mjd() const
+{
+    const time_duration tod = time_of_day();
+
+    const int exp = tod.num_fractional_digits();
+    const double sec = tod.fractional_seconds()/pow(10, exp);
+
+    return date().modjulian_day()+sec/(24*60*60);
+
+    /*
+     const time_duration mjd = *this - ptime(fUnixOffset);
+     const double sec = mjd.total_seconds()+mjd.fractional_seconds()/1e6;
+     return sec/(24*60*60)+40587;
+     */
+}
+
+// --------------------------------------------------------------------------
+//
+//! Returns a string with the contents of the Time object formated
+//! as defined in format.
+//!
+//! @param format
+//!    format description of the string to be returned. For details
+//!    see the boost documentation or the man page of strftime
+//!
+//! @returns
+//!    A string with the time formatted as requested. Note some special
+//!    strings might be returned in case the time is invalid.
+//
+string Time::GetAsStr(const char *format) const
+{
+    stringstream out;
+    out << Time::fmt(format) << *this;
+    return out.str();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Sets the time of the Time object to a time corresponding to
+//! the one given as argument. It is evaluated according to the given
+//! format.
+//!
+//! @param str
+//!    The time as a string which should be converted to the Time object
+//!
+//! @param format
+//!    format description of the string to be returned. For details
+//!    see the boost documentation or the man page of strftime
+//!
+void Time::SetFromStr(const string &str, const char *format)
+{
+    // FIXME: exception handline
+    stringstream stream;
+    stream << str;
+    stream >> Time::fmt(format) >> *this;
+}
+
+// --------------------------------------------------------------------------
+//
+//! A stream manipulator which sets the streams Time output format
+//! as defined in the argument.
+//!
+//! @param format
+//!    format description of the manipulator be returned. For details
+//!    see the boost documentation or the man page of strftime
+//!
+//! @returns
+//!    a stream manipulator for the given format
+//!
+const _time_format Time::fmt(const char *format)
+{
+    return format;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Sets the locale discription of the stream (the way how a time is
+//! output) to the format defined by the given manipulator.
+//!
+//! Example:
+//! \code
+//!    Time t();
+//!    cout << Time::fmt("%Y:%m:%d %H:%M:%S.%f") << t << endl;
+//! \endcode
+//!
+//! @param out
+//!    Reference to the stream
+//!
+//! @param f
+//!    Time format described by a manipulator
+//!
+//! @returns
+//!    A reference to the stream
+//!
+ostream &operator<<(ostream &out, const _time_format &f)
+{
+    const locale loc(locale::classic(),
+                     f.ptr==0 ? 0 : new time_facet(f.ptr));
+
+    out.imbue(loc);
+
+    return out;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Sets the locale discription of the stream (the way how a time is
+//! input) to the format defined by the given manipulator.
+//!
+//! Example:
+//! \code
+//!    stringstream s;
+//!    s << "09.09.1974 21:59";
+//!
+//!    Time t;
+//!    s >> Time::fmt("%d.%m.%Y %H:%M") >> t;
+//! \endcode
+//!
+//! @param in
+//!    Reference to the stream
+//!
+//! @param f
+//!    Time format described by a manipulator
+//!
+//! @returns
+//!    A reference to the stream
+//!
+istream &operator>>(istream &in, const _time_format &f)
+{
+    const locale loc(locale::classic(),
+                     f.ptr==0 ? 0 : new time_input_facet(f.ptr));
+
+    in.imbue(loc);
+
+    return in;
+}
Index: /trunk/FACT++/src/Time.h
===================================================================
--- /trunk/FACT++/src/Time.h	(revision 10183)
+++ /trunk/FACT++/src/Time.h	(revision 10183)
@@ -0,0 +1,94 @@
+#ifndef FACT_Time
+#define FACT_Time
+
+#include <boost/date_time/local_time/local_time.hpp>
+
+// **************************************************************************
+/** @class _time_format
+
+@brief Helper to manipulate the input and output format of a time in a stream
+
+This class represents a stream manipulator. It is used to change the input
+or output format of a Time (or boost::posix_time) object to and from a
+stream.
+
+**/
+// **************************************************************************
+class _time_format
+{
+    friend std::ostream &operator<<(std::ostream &out, const _time_format &f);
+    friend std::istream &operator>>(std::istream &in,  const _time_format &f);
+private:
+    const char *ptr; /// pointer given to the iostreams
+
+public:
+    /// initialize ptr with what should be passed to the iostreams
+    _time_format(const char *txt) : ptr(txt) { }
+};
+
+class Time : public boost::posix_time::ptime
+{
+public:
+    /// A none-time, this can be used as a simple representation of an invalid time
+    static const Time None;
+
+    /// A stream manipulator to set the output/input format
+    static const _time_format fmt(const char *txt=0);
+
+    static const _time_format reset; /// Remove the format description from the stream
+    static const _time_format def;   /// set to format to the locale default
+    static const _time_format std;   /// set to format to the iso standard
+    static const _time_format sql;   /// set to format to the sql format
+    static const _time_format iso;   /// set to format to the extended iso standard
+    static const _time_format magic; /// set to format to the MAGIC report format
+
+    /// Enum used in the instantisation of the class to change the inititalisation value
+    enum init_t
+    {
+        none,  ///< Do not initialize the time
+        utc,   ///< Initialize with UTC
+        local  ///< Initialize with local time
+    };
+
+private:
+    /// Points to the famous 1/1/1970, the standard offset for unix times
+    const static boost::gregorian::date fUnixOffset;
+
+public:
+    // Constructors
+    Time(enum init_t type=utc);
+    Time(const time_t &tm, const int &ms);
+    Time(const ptime &pt) : boost::posix_time::ptime(pt) { }
+    Time(short year, unsigned char month, unsigned char day,
+         unsigned char h=0, unsigned char m=0, unsigned char s=0,
+         unsigned int us=0);
+
+    // Convesion from and to a string
+    std::string GetAsStr(const char *fmt="%Y-%m-%d %H:%M:%S.%f") const;
+    void SetFromStr(const std::string &str, const char *fmt="%Y-%m-%d %H:%M:%S.%f");
+
+    // Conversion to and from MJD
+    void Mjd(double mjd);
+    double Mjd() const;
+
+    // Check validity
+    bool IsValid() const   { return *this != boost::date_time::not_special; }
+    bool operator!() const { return *this == boost::date_time::not_special; }
+
+    // Getter
+    unsigned short Y() const  { return date().year(); }
+    unsigned short M() const  { return date().month(); }
+    unsigned short D() const  { return date().day(); }
+
+    unsigned short h() const  { return time_of_day().hours(); }
+    unsigned short m() const  { return time_of_day().minutes(); }
+    unsigned short s() const  { return time_of_day().seconds(); }
+
+    unsigned int   ms() const { return time_of_day().total_milliseconds()%1000; }
+    unsigned int   us() const { return time_of_day().total_microseconds()%1000000; }
+};
+
+std::ostream &operator<<(std::ostream &out, const _time_format &f);
+std::istream &operator>>(std::istream &in,  const _time_format &f);
+
+#endif
Index: /trunk/FACT++/src/Timers.h
===================================================================
--- /trunk/FACT++/src/Timers.h	(revision 10183)
+++ /trunk/FACT++/src/Timers.h	(revision 10183)
@@ -0,0 +1,43 @@
+class Timers
+{
+private:
+    std::ostream &fOut;
+
+    Time fT[4];
+
+    int fSum[2];
+    int fCnt;
+
+    int fNwait;
+
+public:
+    Timers(std::ostream &out=std::cout) : fOut(out) { fSum[0] = fSum[1] = fCnt = fNwait = 0;/*fT[0] = Time(); fT[1] = Time(); fT[2] = Time(); fT[3] = Time();*/ }
+
+    void SetT() { fT[1] = Time(); }
+
+    void Proc(bool cond, int maxwait=5000, int interval=10000)
+    {
+        fT[2] = Time();
+
+        fSum[0] += (fT[2]-fT[1]).total_microseconds();
+        fSum[1] += (fT[1]-fT[3]).total_microseconds();
+        fCnt++;
+
+        if (cond)
+        {
+            usleep(std::max(maxwait-(int)(fT[2]-fT[3]).total_microseconds(), 1));
+            fNwait++;
+        }
+
+        const int diff = (fT[2]-fT[0]).total_milliseconds();
+        if (diff > interval)
+        {
+            fOut << "Rate(10s):  poll=" << fSum[0]/fCnt << "us   exec=" << fSum[1]/fCnt << "us   (" << fNwait <<"/" << fCnt << ")" << std::endl;
+
+            fSum[0] = fSum[1] = fCnt = fNwait = 0;
+            fT[0] = Time();
+        }
+
+        fT[3] = Time();
+    }
+};
Index: /trunk/FACT++/src/WindowLog.cc
===================================================================
--- /trunk/FACT++/src/WindowLog.cc	(revision 10183)
+++ /trunk/FACT++/src/WindowLog.cc	(revision 10183)
@@ -0,0 +1,388 @@
+// **************************************************************************
+/** @class WindowLog
+
+@brief A C++ ostream to an ncurses window supporting attributes and colors
+
+@section References
+
+ - <A HREF="http://www.gnu.org/software/ncurses">GNU Ncurses</A>
+
+@todo
+   improve docu
+
+
+**/
+// **************************************************************************
+#include "WindowLog.h"
+
+#include <iostream>
+#include <algorithm>
+
+#include <curses.h>
+
+#include "tools.h"
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+//! Delete the contents of the backlog
+//
+void WindowLog::EmptyBacklog()
+{
+    fMuxBacklog.lock();
+    fBacklog.clear();
+    fMuxBacklog.unlock();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Display the backlog. If fWindow is NULL then it is flushed to cout
+//! otherwise to the window (including the colors and attributes)
+//!
+//! Access to cout, the backlog and the window is encapsulated in mutices.
+//
+void WindowLog::Display(bool empty)
+{
+    if (!fWindow)
+    {
+        fMuxBacklog.lock();
+        fMuxCout.lock();
+
+        for (unsigned int i=0; i<fBacklog.size(); i++)
+            cout << fBacklog[i];
+        cout.flush();
+
+        if (empty)
+            fBacklog.clear();
+
+        fMuxCout.unlock();
+        fMuxBacklog.unlock();
+        return;
+    }
+
+    int w, h;
+    getmaxyx(fWindow, h, w);
+
+    fMuxBacklog.lock();
+    fMuxWindow.lock();
+    vector<char>::iterator p0 = fBacklog.begin();
+
+    int lines = 0;
+    int x     = 0;
+
+    for (unsigned int i=0; i<fBacklog.size(); i++)
+    {
+        if (fAttributes.find(i)!=fAttributes.end())
+            fAttributes[i]==-1 ? wattrset(fWindow, 0) : wattron(fWindow, fAttributes[i]);
+
+        if (fBacklog[i]=='\n')
+        {
+            // The attribute is added to the backlog in WriteBuffer
+            //wattrset(fWindow, 0);
+            lines += x/w + 1;
+            x=0;
+        }
+        wprintw(fWindow, "%c", fBacklog[i]);
+        x++;
+    }
+
+    if (empty)
+        fBacklog.clear();
+
+    fMuxWindow.unlock();
+    fMuxBacklog.unlock();
+
+    lines += x/w;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Open a log-file into which any of the following output is written. If a
+//! log-file is alraedy open it is closed.
+//! before the new file is opened or an old one closed the current buffer
+//! is flushed.
+//!
+//! @param filename
+//!    The filename of the file to open
+//!
+//! @returns
+//!    Whether the log-file stream is open or not
+//
+bool WindowLog::OpenLogFile(const string &filename)
+{
+    fMuxFile.lock();
+    flush();
+
+    if (fLogFile.is_open())
+        fLogFile.close();
+
+    fLogFile.open(filename);
+    fMuxFile.unlock();
+
+    return fLogFile.is_open();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Close an open log-file
+//
+void WindowLog::CloseLogFile()
+{
+    fMuxFile.lock();
+    fLogFile.close();
+    fMuxFile.unlock();
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is the function which writes the stream physically to a device.
+//! If you want to add a new device this must be done here.
+//!
+//! If the backlog is enabled, the contents are put into the backlog.
+//! if fWindow is NULL the contents are flushed to cout, otherwise
+//! to the window defined by fWindow.
+//!
+//! In addition the contents are flushed to the log-file if open.
+//! If fIsNull is true any output on the screen (cout or fWindow) is
+//! suppressed.
+//!
+//! @todo
+//!    Truncate the backlog
+//
+void WindowLog::WriteBuffer()
+{
+    // Store the number of characters in the buffer which should be flushed
+    const int len = fPPtr - fBase;
+
+    // restart writing to the buffer at its first char
+    fPPtr = fBase;
+
+    // If the is nothing to output, we are done
+    if (len<=0)
+        return;
+
+    // FIXME: Truncate backlog!
+
+    // If fWindow is set, output everything to the window, otherwise
+    // to cout
+    const string sout = string(fBase, len);
+
+    if (!fIsNull)
+    {
+        if (fWindow)
+        {
+            fMuxWindow.lock();
+            if (!fIsNull)
+                wprintw(fWindow, "%s", sout.c_str());
+            // If the stream got flushed due to a line break
+            // reset all attributes
+            if (fBase[len-1]=='\n')
+                wattrset(fWindow, 0);
+            fMuxWindow.unlock();
+        }
+        else
+        {
+            fMuxCout.lock();
+            cout << sout;
+            // If the stream got flushed due to a line break
+            // reset all attributes
+            if (fBase[len-1]=='\n')
+                cout << "\033[0m";
+            cout.flush();
+            fMuxCout.unlock();
+        }
+    }
+
+    // Add the buffer to the backlog
+    if (fEnableBacklog)
+    {
+        fMuxBacklog.lock();
+        fBacklog.insert(fBacklog.end(), fBase, fBase+len);
+
+        // If the stream got flushed due to a line break
+        // add the reset of all attributes to the backlog
+        if (fBase[len-1]=='\n')
+        {
+            if (!fWindow)
+            {
+                const char *reset = "\033[0m";
+                fBacklog.insert(fBacklog.end(), reset, reset+4);
+
+            }
+            else
+                fAttributes[fBacklog.size()] = -1;
+        }
+        fMuxBacklog.unlock();
+    }
+
+    // Output everything also to the log-file
+    fMuxFile.lock();
+    fLogFile << sout;
+    fLogFile.flush();
+    fMuxFile.unlock();
+
+    // If we are flushing because of an EOL, we reset also all attributes
+}
+
+// --------------------------------------------------------------------------
+//
+//! This is called to flush the buffer of the streaming devices
+//
+int WindowLog::sync()
+{
+    WriteBuffer();
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! This function comes from streambuf and should output the buffer to
+//! the device (flush, endl) or handle a buffer overflow (too many chars)
+//! If a real overflow happens i contains the next chars which doesn't
+//! fit into the buffer anymore.If the buffer is not really filled,
+//! i is EOF(-1).
+//
+int WindowLog::overflow(int i) // i=EOF means not a real overflow
+{
+    *fPPtr++ = (char)i;
+
+    if (fPPtr == fEPtr)
+        WriteBuffer();
+
+    return 0;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Returns the size of the backlog buffer as string.
+//!
+//! @returns
+//!     Size of the backlog as a string, e.g. "1k"
+//
+string WindowLog::GetSizeStr() const
+{
+    int s = GetSizeBacklog()/1000;
+    if (s==0)
+        return "0";
+
+    char u = 'k';
+    if (s>999)
+    {
+        s/=1000;
+        u = 'M';
+    }
+    return Form("%d%c", s, u);
+}
+
+// --------------------------------------------------------------------------
+//
+//! @returns
+//!     the ANSI code corresponding to the attributes
+//
+string WindowLog::GetAnsiAttr(int m)
+{
+    if (m==kReset || m==kDefault)
+        return "\033[0m";
+
+    string rc;
+
+    if ((m&COLOR_PAIR(kRed)    )==COLOR_PAIR(kRed)    )  rc += "\033[31m";
+    if ((m&COLOR_PAIR(kGreen)  )==COLOR_PAIR(kGreen)  )  rc += "\033[32m";
+    if ((m&COLOR_PAIR(kYellow) )==COLOR_PAIR(kYellow) )  rc += "\033[33m";
+    if ((m&COLOR_PAIR(kBlue)   )==COLOR_PAIR(kBlue)   )  rc += "\033[34m";
+    if ((m&COLOR_PAIR(kMagenta))==COLOR_PAIR(kMagenta))  rc += "\033[35m";
+    if ((m&COLOR_PAIR(kCyan)   )==COLOR_PAIR(kCyan)   )  rc += "\033[36m";
+    if ((m&COLOR_PAIR(kWhite)  )==COLOR_PAIR(kWhite)  )  rc += "\033[0m\033[1m";
+
+    if ((m&kBold     )==kBold     )  rc += "\033[1m";
+    if ((m&kDim      )==kDim      )  rc += "\033[2m";
+    if ((m&kUnderline)==kUnderline)  rc += "\033[4m";
+    if ((m&kBlink    )==kBlink    )  rc += "\033[5m";
+
+    return rc;
+}
+
+// --------------------------------------------------------------------------
+//
+//! Add color to the stream according to the attribute. If fWindow is not
+//! set this is an ANSI color code, otherwise the window's output
+//! attributes are set.
+//! It is also added to the backlog. Access to the backlog is encapsulated
+//! into its mutex.
+//
+void WindowLog::AddColor(int m)
+{
+    const int col = COLOR_PAIR(m);
+
+    if (!fWindow)
+        // We don't have to flush here, because the attributes are simply
+        // part of the stream
+        *this << GetAnsiAttr(col);
+    else
+    {
+        // Before we change the attributes we have to flush the screen
+        // otherwise we would have to buffer them until we flush the
+        // contents
+        flush();
+        wattron(fWindow, col);
+    }
+
+    fMuxBacklog.lock();
+    fAttributes[fBacklog.size()] |= col;
+    fMuxBacklog.unlock();
+}
+
+// --------------------------------------------------------------------------
+//
+//! Add attributes to the stream according to the attribute. If fWindow is
+//! not set this is an ANSI code, otherwise the window's output
+//! attributes are set.
+//! It is also added to the backlog. Access to the backlog is encapsulated
+//! into its mutex.
+//
+void WindowLog::AddAttr(int m)
+{
+    if (!fWindow)
+        // We don't have to flush here, because the attributes are simply
+        // part of the stream
+        *this << GetAnsiAttr(m);
+    else
+    {
+        // Before we change the attributes we have to flush the screen
+        // otherwise we would have to buffer them until we flush the
+        // contents
+        flush();
+        m==kReset ? wattrset(fWindow, 0) : wattron(fWindow, m);
+    }
+
+    fMuxBacklog.lock();
+    m==kReset ?
+        fAttributes[fBacklog.size()] = -1 :
+        fAttributes[fBacklog.size()] |= m;
+    fMuxBacklog.unlock();
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+std::ostream &operator<<(std::ostream &lout, WindowLogColor m)
+{
+    WindowLog *log=dynamic_cast<WindowLog*>(lout.rdbuf());
+    if (log)
+        log->AddColor(m);
+    return lout;
+}
+
+// --------------------------------------------------------------------------
+//
+//!
+//
+std::ostream &operator<<(std::ostream &lout, WindowLogAttrs m)
+{
+    WindowLog *log=dynamic_cast<WindowLog*>(lout.rdbuf());
+    if (log)
+        log->AddAttr(m);
+    return lout;
+}
Index: /trunk/FACT++/src/WindowLog.h
===================================================================
--- /trunk/FACT++/src/WindowLog.h	(revision 10183)
+++ /trunk/FACT++/src/WindowLog.h	(revision 10183)
@@ -0,0 +1,135 @@
+#ifndef FACT_WindowLog
+#define FACT_WindowLog
+
+#include <map>
+#include <mutex>
+#include <vector>
+#include <fstream>
+
+#include <ncurses.h> // A_NORMAL etc
+
+/// Stream manipulators to change the color of a WindowLog stream
+enum WindowLogColor
+{
+    kDefault = 0,  ///< Set default colors
+    kRed     = 1,  ///< Set color Red
+    kGreen   = 2,  ///< Set color Green
+    kYellow  = 3,  ///< Set color Yellow
+    kBlue    = 4,  ///< Set color Blue
+    kMagenta = 5,  ///< Set color Magenta
+    kCyan    = 6,  ///< Set color Cyan
+    kWhite   = 7,  ///< Set color White
+};
+
+/// Stream manipulators to change the attributes of a WindowLog stream
+enum WindowLogAttrs
+{
+    kReset      = -1,            ///< Reset all attributes
+    kNormal     = A_NORMAL,      ///< Set attribute Normal
+    kHighlight  = A_STANDOUT,    ///< Set attribute Highlight
+    kUnderline  = A_UNDERLINE,   ///< Set attribute Underline
+    kReverse    = A_REVERSE,     ///< Set attribute Reverse
+    kBlink      = A_BLINK,       ///< Set attribute Blink
+    kDim        = A_DIM,         ///< Set attribute Dim
+    kBold       = A_BOLD,        ///< Set attribute Bold
+    kProtect    = A_PROTECT,     ///< Set attribute Protect
+    kInvisible  = A_INVIS,       ///< Set attribute Invisible
+    kAltCharset = A_ALTCHARSET,  ///< Set attribute Alternative charset
+};
+/*
+enum WindowLogManip
+{
+    kLogOn   = 1,
+    kLogOff  = 2,
+    kNullOn  = 3,
+    kNullOff = 4,
+};
+*/
+class WindowLog : public std::streambuf, public std::ostream
+{
+    friend std::ostream &operator<<(std::ostream &lout, WindowLogColor m);
+    friend std::ostream &operator<<(std::ostream &lout, WindowLogAttrs m);
+    //friend std::ostream &operator<<(std::ostream &lout, WindowLogManip m);
+private:
+    static const int fgBufferSize = 160;
+
+    char        fBuffer;               ///
+    char        fBase[fgBufferSize+1]; /// Buffer to store the data in
+    char       *fPPtr;                 /// Pointer to present position in buffer
+    const char *fEPtr;                 /// Pointer to end of buffer
+
+    WINDOW     *fWindow;               /// Pointer to an ncurses Window
+
+    std::vector<char>  fBacklog;       /// Backlog storage
+    std::map<int, int> fAttributes;    /// Storage for attributes (backlog)
+
+    std::ofstream fLogFile;    /// Stream for redirection to a log-file
+
+    bool fIsNull;              /// Switch to toggle off physical output to the screen
+    bool fEnableBacklog;       /// Switch to toggle storage in the backlog on or off
+
+    std::mutex fMuxBacklog;    /// Mutex securing backlog access
+    std::mutex fMuxFile;       /// Mutex securing file access
+    std::mutex fMuxCout;       /// Mutex securing output to cout
+    std::mutex fMuxWindow;     /// Mutex securing output to fWindow
+
+    static std::string GetAnsiAttr(int m);
+
+    void AddAttr(int m);
+    void AddColor(int m);
+
+    void WriteBuffer();
+
+    int sync();
+    int overflow(int i); // i=EOF means not a real overflow
+
+public:
+    // --------------------------------------------------------------------------
+    //
+    //! Default constructor which initializes the streamer and sets the device
+    //! which is used for the output
+    //!
+    //! Switch on backlog
+    //! Switch on screen output
+    //
+    WindowLog() : std::ostream(this), fPPtr(fBase), fEPtr(fBase+fgBufferSize), fWindow(0), fIsNull(false), fEnableBacklog(true)
+    {
+        fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering
+        setp(&fBuffer, &fBuffer+1);
+        *this << '\0';
+    }
+    WindowLog(WindowLog const& log) : std::ios(), std::streambuf(), std::ostream((std::streambuf*)&log), fWindow(log.fWindow), fIsNull(false), fEnableBacklog(true)
+    {
+        fLogFile.rdbuf()->pubsetbuf(0,0); // Switch off buffering
+    }
+
+    /// Redirect the output to an ncurses WINDOW instead of cout
+    void SetWindow(WINDOW *w) { fWindow=w; }
+
+    /// Open a log-file
+    bool OpenLogFile(const std::string &filename);
+
+    /// Close a log-file
+    void CloseLogFile();
+
+    /// Display backlog
+    void Display(bool empty=false);
+
+    /// Empty backlog
+    void EmptyBacklog();
+
+    /// Get the current size of the backlog in bytes
+    size_t GetSizeBacklog() const { return fBacklog.size(); }
+    std::string GetSizeStr() const;
+
+    /// Switch on or off any physical output to the screen (cout or fWindow)
+    void SetNullOutput(bool n=true) { fIsNull=n; }
+
+    /// Switch on or off any storage in the backlog
+    void SetBacklog(bool n=true) { fEnableBacklog=n; }
+};
+
+std::ostream &operator<<(std::ostream &lout, WindowLogColor m);
+std::ostream &operator<<(std::ostream &lout, WindowLogAttrs m);
+
+#endif
Index: /trunk/FACT++/src/argv.cc
===================================================================
--- /trunk/FACT++/src/argv.cc	(revision 10183)
+++ /trunk/FACT++/src/argv.cc	(revision 10183)
@@ -0,0 +1,247 @@
+#include "Configuration.h"
+
+#include <iostream>
+
+using namespace std;
+
+const string name_mapper(const string &str)
+{
+    if (str=="LINUX")           return "linux";
+    if (str=="PATH")            return "path";
+    if (str=="DIM_DNS_SERVER")  return "dns";
+
+    return "";
+}
+
+// --------------------------------------------------------------------------
+//
+//!  Main Doxygen/Autotools integration example program.
+//!
+//!  @param conf  Number of command line options.
+//!  @param opt  The command line options.
+//!  @return      The exit status.
+//
+void SetupConfiguration(Configuration &conf, int &opt)
+{
+    /*
+     // Default in case the option was not specified
+     typed_value* default_value(const T& v)
+     typed_value* default_value(const T& v, const std::string& textual)
+
+     // Default value in case the option was given
+     //    forces -o    to become -o5
+     //    forces --opt to become --opt=3
+     typed_value* implicit_value(const T &v)
+     typed_value* implicit_value(const T &v, const std::string& textual)
+
+     // notifier function when the final value is determined
+     typed_value* notifier(function1<void, const T&> f)
+
+     /// Merge values from different sources (e.g. file, command line)
+     typed_value* composing()
+
+     // Specifies that the value can span multiple tokens.
+     typed_value* multitoken()
+     typed_value* zero_tokens()
+
+     // Specifies that the value must occur.
+     typed_value* required()
+     */
+
+    // To merge the options from several parsers (e.g. comand_line and
+    // config file) use po_strings()->composing()
+    /*
+    po::options_description generic("Generic options");
+    generic.add_options()
+        ("help-config",   "Print available configuration file options.")
+        ("help-env",      "Print available environment variables.")
+        ("help",          "Print available commandline options.")
+        ("print-unknown", "Print unrecognized options.")
+        ("config", po_string("config.txt"), "Set configuration file name.")
+        ;
+
+
+    // Declare the supported options.
+    po::options_description generic("Generaic options");
+    generic.add_options()
+//        ("testreq",     po_int()->required(),         "set compression level (madatory)")
+        ("default",     po_string("my_default"),      "set compression level")
+        ("unknown",     po_int(1),                    "set compression level")
+        ("U",           po_int(2)->implicit_value(1), "set compression level")
+        ;
+      */
+    // Declare a group of options that will be
+    // allowed both on command line and in
+    // config file
+    po::options_description config("Configuration");
+    config.add_options()
+        ("compression",    var<int>(),                      "set compression level")
+        ("optimization",   var<int>(10, &opt),              "optimization level")
+        ("test-def",       var<int>(42),                    "optimization level")
+        ("include-path,I", vars<string>()/*->composing()*/, "include path")
+        ("test,T",         vars<string>()/*->composing()*/, "include path")
+        ("file1",          vars<string>(),                   "include path")
+        ("int1",           var<int>(),                      "include path")
+        ("Int2",           var<int>(),                      "include path")
+        ("Int1",           var<int>(),                      "include path")
+        ("test-db",        var<string>("database"),                      "include path")
+        ("float1",         var<double>(),                   "include path")
+//        (",A",          po_float(),                    "include path")
+        ("radec",         po::value<vector<double>>(),                    "include path")
+        ;
+
+    // !!! Option which are "shorted" must be placed last.
+    //     Can this be switched off?
+
+    po::options_description sections("Sections");
+    config.add_options()
+        ("unregistered",            var<string>(),                    "include path")
+        ("Section1.unregistered",   var<string>(),                    "include path")
+//        ("Section2*",               po_string(),                    "include path")
+        // The latter accepts all options starting with Section2.
+        ;
+
+    // Hidden options, will be allowed both on command line and
+    // in config file, but will not be shown to the user.
+    po::options_description hidden("Hidden options");
+    hidden.add_options()
+        ("input-file",  vars<string>(), "input file")
+        ("output-file", vars<string>(), "output file")
+        ("test-file",   vars<string>(), "test file")
+        ;
+
+    po::options_description env("Environment options");
+    env.add_options()
+        ("linux", var<string>(), "LINUX env")
+        ("path",  var<string>(), "PATH env")
+        ("dns",   var<string>(), "DIM_DNS_SERVER env")
+        ;
+
+
+    // define translation from position to name
+    po::positional_options_description p;
+    p.add("output-file", 2); // The first 2 positional options is output-file
+    p.add("test-file",   3); // The next three positional options is output-file
+    p.add("input-file", -1); // All others go to...
+
+
+    conf.AddOptionsCommandline(config);
+    conf.AddOptionsCommandline(sections);
+    conf.AddOptionsCommandline(hidden, false);
+
+    conf.AddOptionsConfigfile(config);
+    conf.AddOptionsConfigfile(sections);
+    conf.AddOptionsConfigfile(hidden, false);
+
+    conf.AddOptionsEnvironment(env);
+
+    conf.AddOptionsDatabase(config);
+
+    conf.SetArgumentPositions(p);
+
+    conf.SetNameMapper(name_mapper);
+}
+
+
+int main(int argc, char **argv)
+{
+    int opt;
+
+    Configuration conf(argv[0]);
+    SetupConfiguration(conf, opt);
+
+    po::variables_map vm;
+    try
+    {
+        vm = conf.Parse(argc, argv);
+    }
+    catch (std::exception &e)
+    {
+        po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+        if (MO)
+            cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+        else
+            cout << "Error: " << e.what() << endl;
+        cout << endl;
+
+        return -1;
+    }
+
+    if (conf.HasHelp() || conf.HasPrint())
+        return -1;
+
+    cout << "------------------------------" << endl;
+
+    cout << "Program " << argv[0] << " started successfully." << endl;
+    return 0;
+/*
+    if (vm.count("compression"))
+        cout << "Compression level was set to " << vm["compression"].as<int>() << ".\n";
+    else
+        cout << "Compression level was not set.\n";
+
+
+    cout << "Test default is always: " << vm["test-def"].as<int>() << "\n";
+    cout << "Optimization level is " << vm["optimization"].as<int>() << "\n";
+    //cout << "Int2: " << vm["Int2"].as<int>() << "\n";
+
+    cout << conf.GetString("unregistered") << endl;
+    cout << conf.GetString("Section1.unregistered") << endl;
+    cout << conf.Has("Section2.unregistered") << endl;
+    cout << conf.GetString("Section2.Section3.unregistered") << endl;
+    cout << "test-db: " << conf.GetString("test-db") << endl;
+
+
+    if (vm.count("include-path"))
+    {
+        vector<string> v = vm["include-path"].as< vector<string> >();
+        for (vector<string>::iterator s=v.begin(); s<v.end(); s++)
+            cout << "Incl P: " << *s << endl;
+    }
+
+    if (vm.count("input-file"))
+    {
+        vector<string> v = vm["input-file"].as< vector<string> >();
+        for (vector<string>::iterator s=v.begin(); s<v.end(); s++)
+            cout << "Incl F: " << *s << endl;
+    }
+
+    if (vm.count("output-file"))
+    {
+        vector<string> v = vm["output-file"].as< vector<string> >();
+        for (vector<string>::iterator s=v.begin(); s<v.end(); s++)
+            cout << "Out: " << *s << endl;
+    }
+
+    if (vm.count("test-file"))
+    {
+        vector<string> v = vm["test-file"].as< vector<string> >();
+        for (vector<string>::iterator s=v.begin(); s<v.end(); s++)
+            cout << "Testf: " << *s << endl;
+    }
+
+    cout << "Linux: " << conf.Get<string>("linux") << endl;
+
+    if (vm.count("path"))
+        cout << "Path: "   << vm["path"].as<string>()  << endl;
+    if (vm.count("file1"))
+        cout << "File1: "  << vm["file1"].as<string>() << endl;
+    if (vm.count("int1"))
+        cout << "Int1: "   << vm["int1"].as<int>()     << endl;
+    if (vm.count("float1"))
+        cout << "Float1: " << vm["float1"].as<float>() << endl;
+
+    if (vm.count("test"))
+    {
+        vector<string> v = vm["test"].as< vector<string> >();
+        for (vector<string>::iterator s=v.begin(); s<v.end(); s++)
+            cout << "Test: " << *s << endl;
+    }*/
+}
+// ***************************************************************************
+/** @example argv.cc
+
+Example for the usage of the class Configuration
+
+**/
+// ***************************************************************************
Index: /trunk/FACT++/src/dataLogger.cc
===================================================================
--- /trunk/FACT++/src/dataLogger.cc	(revision 10183)
+++ /trunk/FACT++/src/dataLogger.cc	(revision 10183)
@@ -0,0 +1,722 @@
+
+#include "Event.h"
+#include "Time.h"
+#include "StateMachineDim.h"
+#include "ServiceList.h"
+#include <fstream>
+
+#include <boost/bind.hpp>
+
+//****************************************************************
+/** @class DataLogger
+ * 
+ * @brief Logs all message and infos between the services
+ * 
+ * This is the main logging class facility. 
+ * It derives from StateMachineDim and DimInfoHandler. the first parent is here to enforce 
+ * a state machine behaviour, while the second one is meant to make the dataLogger receive
+ * dim services to which it subscribed from.
+ * The possible states and transitions of the machine are:
+ * \dot
+ * digraph datalogger {
+ * 		node [shape=record, fontname=Helvetica, fontsize=10];
+ * 	e [label="Error" color="red"];
+ *  r [label="Ready"]
+ *  d [label="DailyOpen"]
+ *  w [label="WaitingRun"]
+ * 	l [label="Logging"]
+ *  b [label="BadDailyconfig" color="red"]
+ *  c [label="BadRunConfig" color="red"]
+ * 
+ * e -> r
+ * r -> e
+ * r -> d
+ * r -> b
+ * d -> w
+ * d -> r
+ * w -> r
+ * l -> r
+ * l -> w
+ * b -> d
+ * w -> c
+ * w -> l
+ * b -> r
+ * c -> r
+ * c -> l
+ * }
+ * \enddot
+ * 
+ * @todo
+ * 	- A lot
+ ****************************************************************/
+class DataLogger : public StateMachineDim, DimInfoHandler
+{
+public:
+	/// The list of existing states specific to the DataLogger
+	enum
+	{
+		kSM_DailyOpen = 20, ///< Daily file openned and writing
+		kSM_WaitingRun = 30, ///< waiting for the run number to open the run file
+		kSM_Logging = 40, ///< both files openned and writing
+		kSM_BadDailyConfig = 0x101, ///< the folder specified for daily logging does not exist or has bad permissions
+		kSM_BadRunConfig = 0x102, ///<  the folder specified for the run logging does not exist or has wrong permissions or no run number
+	} localstates_t;
+	
+	DataLogger();
+	~DataLogger(); 
+	
+private:
+	//Define all the data structure specific to the DataLogger here
+	std::ofstream fDailyFile; /// ofstream for the dailyfile
+	std::ofstream fRunFile; /// ofstream for the run-specific file
+	std::string fDailyFileName; /// base path of the dailyfile
+	std::string fRunFileName; ///base path of the run file
+	int runNumber; ///run number (-1 means no run number specified)
+	
+	///Define all the static names
+	static const char* configDay;
+	static const char* configRun;
+	static const char* configRunNumber;
+	static const char* configLog;
+	static const char* transStart;
+	static const char* transStop;
+	static const char* transStartRun;
+	static const char* transStopRun;
+	static const char* transReset;
+	static const char* transWait;
+	static const char* runNumberInfo; ///< This is the name of the dimInfo received to specify the run number. It must be updated once the final name will be defined
+	
+	int Execute(); ///Inherited from state machine impl
+	
+	int Transition(const Event& evt); ///Inherited from state machine impl
+	
+	int Configure(const Event& evt); ///Inherited from state machine impl
+	
+	//overloading of DIM's infoHandler function
+	void infoHandler(); ///Inherited from DimInfoHandler
+	
+	ServiceList fServiceList;///for obtaining the name of the existing services
+	
+	std::map<std::string, std::vector<DimStampedInfo> > fServiceSubscriptions; ///All the services to which we've subscribed to. Sorted by server name
+	
+	//internal methods
+	void LogPlease(DimInfo* I); ///Logging method for the services info received
+	std::string ToString(const char *format, const void *data, int size); ///Convertion from raw format to human-readable string
+	//configure methods
+	int ConfigureDailyFileName(const Event& evt); ///Configuration of the daily file path
+	int ConfigureRunFileName(const Event& evt); ///Configuration fo the file name
+	//TODO this will be given by an info, not a command.
+	int ConfigureRunNumber(const Event& evt); ///DEPREC - configuration of the run number
+	int LogMessagePlease(const Event& evt); ///logging method for the messages
+	void CheckForServicesUpdate(); ///checks with fServiceList whether or not the services got updated
+	void CheckForRunNumber(DimInfo* I); ///checks whether or not the current info being treated is a run number
+	//transitions methods
+	int StartPlease(); /// start transition
+	int StopPlease(); ///stop transition
+	int StartRunPlease(); ///from waiting to logging transition
+	int StopRunPlease(); /// from logging to waiting transition
+	int ResetPlease(); ///reset transition
+	int DailyToWaitRunPlease(); ///from dailyOpen to waiting transition
+
+	void InitServiceSubscription(); ///first subscription to the dim services.
+	
+
+	
+}; //DataLogger
+
+//static members initialization
+//since I do not check the transition/config names any longer, indeed maybe these could be hard-coded... but who knows what will happen in the future ?
+const char* DataLogger::configDay = "CONFIG_DAY";
+const char* DataLogger::configRun = "CONFIG_RUN";
+const char* DataLogger::configRunNumber = "CONFIG_RUN_NUMBER";
+const char* DataLogger::configLog = "LOG";
+const char* DataLogger::transStart = "START";
+const char* DataLogger::transStop = "STOP";
+const char* DataLogger::transStartRun = "START_RUN";
+const char* DataLogger::transStopRun = "STOP_RUN";
+const char* DataLogger::transReset = "RESET";
+const char* DataLogger::transWait = "WAIT_RUN_NUMBER";
+const char* DataLogger::runNumberInfo = "RUN_NUMBER";
+
+/****************************************************************
+ * 
+ * DATA LOGGER CONSTRUCTOR
+ *
+ ****************************************************************/
+ //! Default constructor
+DataLogger::DataLogger() : StateMachineDim(std::cout, "DATA_LOGGER")
+{
+		//initialize member data
+		fDailyFileName = "";
+		fRunFileName = "";
+		runNumber = -1;
+		//Give a name to this machine's specific states
+		AddStateName(kSM_DailyOpen, "Daily_File_Openened");
+		AddStateName(kSM_WaitingRun, "Waiting_Run_Number");
+		AddStateName(kSM_Logging, "Logging data");
+		AddStateName(kSM_BadDailyConfig, "Folder_For_Daily_Logging_Badly_Configured");
+		AddStateName(kSM_BadRunConfig, "Folder_For_Run_Logging_Badly Configured");
+
+		/*Add the possible transitions for this machine*/
+		AddTransition(kSM_DailyOpen, transStart, kSM_Ready, kSM_BadDailyConfig) //start the daily logging. daily file location must be specified already
+			->AssignFunction(boost::bind(&DataLogger::StartPlease, this)); 
+		AddTransition(kSM_Ready, transStop, kSM_DailyOpen, kSM_WaitingRun, kSM_Logging) //stop the data logging
+			->AssignFunction(boost::bind(&DataLogger::StopPlease, this));
+		AddTransition(kSM_Logging, transStartRun, kSM_WaitingRun, kSM_BadRunConfig) //start the run logging. run file location must be specified already.
+			->AssignFunction(boost::bind(&DataLogger::StartRunPlease, this));
+		AddTransition(kSM_WaitingRun, transStopRun, kSM_Logging)
+			->AssignFunction(boost::bind(&DataLogger::StopRunPlease, this));
+		AddTransition(kSM_Ready, transReset, kSM_Error, kSM_BadDailyConfig, kSM_BadRunConfig, kSM_Error) //transition to exit error states. dunno if required or not, would close the daily file if already openned.
+			->AssignFunction(boost::bind(&DataLogger::ResetPlease, this));
+		AddTransition(kSM_WaitingRun, transWait, kSM_DailyOpen)
+			->AssignFunction(boost::bind(&DataLogger::DailyToWaitRunPlease, this));
+		/*Add the possible configurations for this machine*/
+		AddConfiguration(configDay, kSM_Ready, kSM_BadDailyConfig) //configure the daily file location. cannot be done before the file is actually opened
+			->AssignFunction(boost::bind(&DataLogger::ConfigureDailyFileName, this, _1));
+		AddConfiguration(configRun, kSM_Ready, kSM_BadDailyConfig, kSM_DailyOpen, kSM_WaitingRun, kSM_BadRunConfig) //configure the run file location. cannot be done before the file is actually opened, and not in a dailly related error.
+			->AssignFunction(boost::bind(&DataLogger::ConfigureRunFileName, this, _1));
+		/*wait for Dim to finish initializing*/
+		/*just a sleep for now. */
+		/*TODO: add a better way to wait: poll DIM for something I guess. Maybe get the configuration from conf server ? */
+
+		usleep(1000000); //10ms
+		
+		//Provide a logging command
+		//I get the feeling that I should be going through the EventImp 
+		//instead of DimCommand directly, mainly because the commandHandler 
+		//is already done in StateMachineImp.cc
+		//Thus I'll simply add a configuration, which I will treat as the logging command
+		AddConfiguration(configRun, kSM_DailyOpen, kSM_Logging, kSM_WaitingRun, kSM_BadRunConfig)
+			->AssignFunction(boost::bind(&DataLogger::LogMessagePlease, this, _1));
+			
+		InitServiceSubscription();
+
+		//All configuration done, callback funtions set, go to ready state and thus prevent the run loop from being executed
+		SetReady();
+}
+//! Initialization of the subscription to the services. 
+void DataLogger::InitServiceSubscription()
+{
+	//assign myself as the info handler
+	fServiceList.SetHandler(this);
+
+	//crawl through the list of services and subscribe to all of them
+	//TODO I still haven't figured out how the update of services shouldbe performed
+	//TODO: I don't think that the reference would work in this case because what is returned is a temporary. but should try anyway in case this works...
+	const std::vector<std::string> serverList = fServiceList.GetServerList();
+	for (unsigned int i=0;i<serverList.size();i++)
+	{//get the service list associated with each server
+		if (strstr(serverList[i].c_str(), "DIS_DNS") || strstr(serverList[i].c_str(), "DATA_LOGGER"))
+			continue;
+		for (std::vector<std::string>::const_iterator j=fServiceList.begin(serverList[i]); j != fServiceList.end(serverList[i]); j++)
+		{//and subscribe to each service !
+			fServiceSubscriptions[serverList[i]].push_back(DimStampedInfo(j->c_str(), const_cast<char*>(""), this));
+		}
+	}
+}
+//! destructor
+DataLogger::~DataLogger()
+{
+	if (fDailyFile.is_open())
+		fDailyFile.close();
+	if (fRunFile.is_open())
+		fRunFile.close();
+;
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S EXECUTE
+ * 
+ ****************************************************************/
+ //! Execute
+ //! Shouldn't be run as we use callbacks instead
+int DataLogger::Execute()
+{
+	//due to the callback mecanism, this function should never be called
+	return kSM_FatalError;
+	
+	switch (GetCurrentState())
+	{
+	case kSM_Error:
+	case kSM_Ready:
+	case kSM_DailyOpen:
+	case kSM_WaitingRun:
+	case kSM_Logging:
+	case kSM_BadDailyConfig:
+	case kSM_BadRunConfig:
+		return GetCurrentState();
+	
+	}
+	//this line below should never be hit. It here mainly to remove warnings at compilation
+	return kSM_FatalError;
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S TRANSITION
+ * 
+ ****************************************************************/
+
+ //! Shouldn't be run as we use callbacks instead
+ int DataLogger::Transition(const Event& evt)
+{
+	//due to the callback mecanism, this function should never be called
+	return kSM_FatalError;
+	
+	switch (evt.GetTargetState())
+	{
+		case kSM_Ready:
+		/*here we must figure out whether the STOP or RESET command was sent*/
+		/*close opened files and go back to ready state*/
+			switch (GetCurrentState())
+			{
+				case kSM_BadDailyConfig:
+				case kSM_BadRunConfig:
+				case kSM_Error:
+					return ResetPlease();
+					
+				case kSM_Logging:
+				case kSM_WaitingRun:
+				case kSM_DailyOpen:
+					return StopPlease();
+			}
+		break;
+		
+		case kSM_DailyOpen:
+			/*Attempt to open the daily file */
+			switch (GetCurrentState())
+			{
+				case kSM_Ready:
+				case kSM_BadDailyConfig:
+					return StartPlease();	
+			}
+		break;
+		
+		case kSM_WaitingRun:
+			/*either close the run file, or just go to the waitingrun state (if coming from daily open*/
+			switch (GetCurrentState())
+			{
+				case kSM_DailyOpen:
+					return kSM_WaitingRun;
+				
+				case kSM_Logging:
+					return StopRunPlease();	
+			}
+		break;
+		
+		case kSM_Logging:
+			/*Attempt to open run file */
+			switch (GetCurrentState())
+			{
+				case kSM_WaitingRun:
+				case kSM_BadRunConfig:
+					return StartRunPlease();
+			}	
+		break;
+	}
+	//Getting here means that an invalid transition has been asked. 
+	//TODO Log an error message
+	//and return the fatal error state
+	return kSM_FatalError;
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S CONFIGURE
+ * 
+ ****************************************************************/
+//! Shouldn't be run as we use callbacks instead
+ int DataLogger::Configure(const Event& evt)
+{
+	//due to the callback mecanism, this function should never be called
+	return kSM_FatalError;
+
+	switch (evt.GetTargetState())
+	{
+		case kSM_Ready:
+		case kSM_BadDailyConfig:
+			return ConfigureDailyFileName(evt);
+		break;
+		
+		case kSM_WaitingRun:
+		case kSM_BadRunConfig:
+			return ConfigureRunFileName(evt);	
+		break;
+		
+		case kSM_Logging:
+		case kSM_DailyOpen:
+				return LogMessagePlease(evt);	
+		break;
+
+	}	
+	//Getting here means that an invalid configuration has been asked.
+	//TODO Log an error message
+	//and return the fatal error state
+	return kSM_FatalError;
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S INFOHANDLER
+ * 
+ ****************************************************************/
+void DataLogger::infoHandler()
+{
+	DimInfo* I = getInfo();
+	//there I should get the services updates. It remains unclear whether I will be getting the new services or not through here
+//	CheckForServicesUpdate(); //in this function I will add/remove services subscription
+	CheckForRunNumber(I);
+	LogPlease(I);
+}
+//! Checks for changes in the existingn services
+//! @todo finish this function as most of it is still missing (plus what is already there isn't great)
+void DataLogger::CheckForServicesUpdate()
+{//TODO well... do it... 
+ //TODO handle the cases were one server/service was removed and one was added
+	 const std::vector<std::string> serverList = fServiceList.GetServerList();
+	 if (serverList.size() != fServiceSubscriptions.size())
+	 {//some servers were added/deleted. Rebuild the list entirely
+std::cout << "Redoing the server list entirely " << serverList.size() << " " << fServiceSubscriptions.size() << std::endl;
+	 		std::map<std::string, std::vector<DimStampedInfo> >::iterator it;
+	 		for (it=fServiceSubscriptions.begin(); it != fServiceSubscriptions.end(); it++)
+	 			(*it).second.clear();	
+	 		fServiceSubscriptions.clear();
+	 		InitServiceSubscription();
+	 		return;
+	 }
+	 //TODO crawl the list to see if any of the servers has updated its service list
+	
+}
+//! Looks whether the currently being processed DimInfo indeed is a run number or not
+void DataLogger::CheckForRunNumber(DimInfo* I)
+{
+	return;
+	if (strstr(I->getName(), runNumberInfo) != NULL)
+	{//assumes that the run number is an integer
+		//TODO check the format here
+		runNumber = I->getInt();	
+	}
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S RUN LOG
+ * 
+ * write info to run log. Go to error if anything goes wrong
+ * 
+ ****************************************************************/
+ //! write info to logs. Go to error if anything goes wrong
+void DataLogger::LogPlease(DimInfo* I)
+{
+	if (I->getSize() == 0)
+		return;
+	//TODO add service exclusion
+	
+	if (!fDailyFile.is_open())
+		return;
+	//construct the header
+	std::stringstream header;
+	Time cTime((time_t)(I->getTimestamp()), 0);
+	header << I->getName() << " " << cTime.Y() << " " << cTime.M() << " " << cTime.D() << " ";
+	header << cTime.h() << " " << cTime.m() << " " << cTime.s() << " ";
+	header << cTime.ms() << " " << I->getQuality() << " ";
+	
+	if (fDailyFile.is_open())
+		fDailyFile << header;
+	if (fRunFile.is_open())
+		fRunFile << header;
+	
+	
+	std::string text = ToString(I->getFormat(), I->getData(), I->getSize());
+	
+	if (!text.empty())
+	{//replace bizarre characters by white space
+		for (unsigned int i=0; i<text.size(); i++)
+		{
+			if (text[i] == '\n') 
+				text[i] = '\\';
+			else
+				if (iscntrl(text[i])) 
+					text[i] = ' ';	
+		}
+		if (fDailyFile.is_open())
+			fDailyFile << text;
+		if (fRunFile.is_open())
+			fRunFile << text;
+	}
+	else
+	{
+		if (fDailyFile.is_open())
+			fDailyFile << "Cannot interpret service format" << std::endl;
+		if (fRunFile.is_open())
+			fRunFile << "Cannot interpret service format" << std::endl;
+	}
+}
+//! Translates DIM data safely to string (assures no invalid memory accesses are made)
+//! Was mostly copied from DColl.cc
+std::string DataLogger::ToString(const char *format, const void *data, int size) {
+
+  std::ostringstream Text;
+  
+  // Structure: print hex representation 
+  if (strlen(format) != 1) {
+	for (int i=0; i<size; i++) {
+	  Text << std::setw(2) << std::hex << *((char *) data + i) << " ";
+	} 
+	return Text.str();
+  }
+
+  // String if format "C" and terminated with \0
+  if (strcmp(format, "C") == 0 && size > 0 && *((char *) data+size-1)=='\0') {
+	return std::string((char *) data);
+  }
+
+  // Number array
+  int ElementSize;
+  switch (*format) {
+    case 'C': ElementSize = sizeof(char);		break;
+    case 'I':
+    case 'L': ElementSize = sizeof(int);		break;
+    case 'S': ElementSize = sizeof(short);		break;
+    case 'F': ElementSize = sizeof(float);		break;
+    case 'D': ElementSize = sizeof(double);		break;
+    case 'X': ElementSize = sizeof(long long);	break;
+    default: return std::string();
+  }
+
+  for (int i=0; i<size/ElementSize; i++) {
+	// Space between entries
+    if (i != 0) Text << " ";
+
+	// Translate data
+	switch (*format) {
+      case 'C': Text << *((char *) data + i);		break;
+      case 'I':
+      case 'L': Text << *((int *) data + i);		break;
+      case 'S': Text << *((short *) data + i);		break;
+      case 'F': Text << *((float *) data + i);		break;
+      case 'D': Text << *((double *) data + i);		break;
+      case 'X': Text << *((long long *) data + i);	break;
+	}
+  }
+  
+  return Text.str();
+}
+//! write messages to logs. Go to error if anything goes wrong
+int DataLogger::LogMessagePlease(const Event& evt)
+{
+	if (!fDailyFile.is_open())
+		return GetCurrentState();
+	
+	std::stringstream header;
+	const Time& cTime = evt.GetTime();
+	header << evt.GetName() << " " << cTime.Y() << " " << cTime.M() << " " << cTime.D() << " ";
+	header << cTime.h() << " " << cTime.m() << " " << cTime.s() << " ";
+	header << cTime.ms() << " ";
+	
+	if (fDailyFile.is_open())
+		fDailyFile << header;
+	if (fRunFile.is_open())
+		fRunFile << header;
+	
+	std::string text = ToString(evt.GetFormat().c_str(), evt.GetData(), evt.GetSize());
+	
+	if (!text.empty())
+	{//replace bizarre characters by white space
+		for (unsigned int i=0; i<text.size(); i++)
+		{
+			if (text[i] == '\n') 
+				text[i] = '\\';
+			else
+				if (iscntrl(text[i])) 
+					text[i] = ' ';	
+		}
+		if (fDailyFile.is_open())
+			fDailyFile << text;
+		if (fRunFile.is_open())
+			fRunFile << text;
+	}
+	else
+	{
+		if (fDailyFile.is_open())
+			fDailyFile << "Cannot interpret log message format" << std::endl;
+		if (fRunFile.is_open())
+			fRunFile << "Cannot interpret log message format" << std::endl;
+	}	
+	
+	return GetCurrentState();	
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S RUN LOG
+ */
+ //!Set the current daily file name. This will NOT close any file
+ /* 
+ ****************************************************************/
+int DataLogger::ConfigureDailyFileName(const Event& evt)
+{
+	fDailyFileName = std::string(evt.GetText());	
+	return GetCurrentState();
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S CONFIGURE RUN FILE NAME
+ * 
+ */
+ //! Set the current run folder name. This will NOT close any file
+ /* 
+ ****************************************************************/
+int DataLogger::ConfigureRunFileName(const Event& evt)
+{
+	fRunFileName = std::string(evt.GetText());
+	return GetCurrentState();
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S CONFIGURE RUN NUMBER
+ * 
+ */
+ //! set the current run number. This will NOT close any file. 
+ /* 
+ ****************************************************************/
+int DataLogger::ConfigureRunNumber(const Event& evt)
+{
+	runNumber = evt.GetInt();
+	//TODO replace the run number in the filename if already exist. Otherwise just append it
+	return GetCurrentState();
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S START PLEASE
+ * 
+ */
+ //! Implements the start transition
+ /* 
+ ****************************************************************/
+int DataLogger::StartPlease()
+{
+	//TODO concatenate the dailyFileName and the formatted date and extension to obtain the full file name
+	Time time;//(Time::utc);
+	std::stringstream sTime;
+	sTime << time.Y() << "_" << time.M() << "_" << time.D();
+	std::string fullName = fDailyFileName + '/' + sTime.str() + ".log"; 
+	
+	fDailyFile.open(fullName.c_str(), std::ios_base::out | std::ios_base::ate); //maybe should be "app" instead of "ate" ??
+	if (!fDailyFile.is_open())
+	{
+		//TODO send an error message	
+	    return kSM_BadDailyConfig;
+	}
+	return kSM_DailyOpen; 	
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S STOP PLEASE
+ * 
+ */
+ //! Implements the stop transition
+ /* 
+ ****************************************************************/
+int DataLogger::StopPlease()
+{
+	if (fDailyFile.is_open())
+		fDailyFile.close();
+		
+	if (fRunFile.is_open())
+	    fRunFile.close();	
+	    
+	return kSM_Ready;
+
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S START RUN PLEASE
+ * 
+ */
+ //! Implements the start run transtition
+ /* 
+ ****************************************************************/
+int DataLogger::StartRunPlease()
+{
+	//attempt to open run file with current parameters
+	if (runNumber == -1)
+		return kSM_BadRunConfig;
+	std::stringstream sRun;
+	sRun << runNumber;
+	std::string fullName = fRunFileName + '/' + sRun.str() + ".log";
+
+	fRunFile.open(fullName.c_str(), std::ios_base::out | std::ios_base::ate); //maybe should be app instead of ate
+	if (!fRunFile.is_open())
+	{
+		//TODO send an error message
+		return kSM_BadRunConfig;	
+	}
+	
+	return kSM_Logging;
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S STOP RUN PLEASE
+ * 
+ */
+ //! Implements the stop run transition
+ /* 
+ ****************************************************************/
+int DataLogger::StopRunPlease()
+{
+	if (!fRunFile.is_open())
+		return kSM_FatalError;
+	
+	fRunFile.close();
+	
+	return kSM_WaitingRun;
+
+}
+/****************************************************************
+ * 
+ * DATA LOGGER'S RESET PLEASE
+ * 
+ */
+ //! Implements the reset transition
+ /* 
+ ****************************************************************/
+int DataLogger::ResetPlease()
+{
+	if (fDailyFile.is_open())
+		fDailyFile.close();
+
+	if (fRunFile.is_open())
+		fRunFile.close();
+			
+	return kSM_Ready;
+}
+//! Implements the Daily to WaitRun transition
+int DataLogger::DailyToWaitRunPlease()
+{
+	return kSM_WaitingRun;	
+}
+/*
+bool DataLogger::ServiceOk(DimInfo* item)
+{
+	return !((item->getSize() == strlen(NO_LINK)+1) && (memcmp(item->getData(), NO_LINK, item->getSize()) == 0));	
+}*/
+/****************************************************************
+ * 
+ * MAIN
+ * 
+ ****************************************************************/
+extern bool CheckDim(bool=true);
+ 
+int main()
+{
+	std::cout << "Data Logger Starting" << std::endl;
+	
+	if (!CheckDim())
+		return -1;
+	
+	std::cout << "Continuing" << std::endl;
+	DataLogger log; 
+	std::cout << "DataLogger created. Starting main loop" << std::endl;
+	while (!log.IsRExitRequested())
+	{
+				usleep(1);
+	}
+	return 0;
+	
+}
Index: /trunk/FACT++/src/dclient5.cc
===================================================================
--- /trunk/FACT++/src/dclient5.cc	(revision 10183)
+++ /trunk/FACT++/src/dclient5.cc	(revision 10183)
@@ -0,0 +1,559 @@
+#include <boost/bind.hpp>
+#include <boost/thread.hpp>
+#include <boost/asio/deadline_timer.hpp>
+
+#include "Event.h"
+#include "Shell.h"
+#include "StateMachineDim.h"
+#include "Connection.h"
+#include "Configuration.h"
+#include "Timers.h"
+#include "Console.h"
+
+#include "tools.h"
+
+namespace ba    = boost::asio;
+namespace bs    = boost::system;
+
+using ba::deadline_timer;
+using ba::ip::tcp;
+
+using namespace std;
+
+
+// ------------------------------------------------------------------------
+
+#include "LocalControl.h"
+
+// ------------------------------------------------------------------------
+
+class ConnectionFAD : public Connection
+{
+    MessageImp &fMsg;
+
+    int state;
+
+public:
+    void ConnectImp(const bs::error_code& error,
+                    tcp::resolver::iterator endpoint_iterator)
+    {
+        Connection::ConnectImp(error, endpoint_iterator);
+        if (IsConnected())
+            StartAsyncRead();
+    }
+
+    void HandleReadTimeout(const bs::error_code &error)
+    {
+        return;
+        if (!is_open())
+        {
+            // For example: Here we could schedule a new accept if we
+            // would not want to allow two connections at the same time.
+            return;
+        }
+
+        // 125: Operation canceled
+
+        if (error && error!=bs::error_code(125, bs::system_category))
+        {
+            stringstream str;
+
+            str << "HandleReadTimeout: " << error.message() << " (" << error << ")";// << endl;
+            if (error==bs::error_code(2, ba::error::misc_category))
+                Warn(str); // Connection: EOF (closed by remote host)
+            else
+                Error(str);
+        }
+
+        // Check whether the deadline has passed. We compare the deadline
+        // against the current time since a new asynchronous operation
+        // may have moved the deadline before this actor had a chance
+        // to run.
+        if (fInTimeout.expires_at() > deadline_timer::traits_type::now())
+            return;
+
+        Error("fInTimeout has expired...");
+
+        CloseImp();
+    }
+
+    void HandleReceivedData(const bs::error_code& error, size_t bytes_received)
+    {
+        // Do not schedule a new read if the connection failed.
+        if (bytes_received==0 || error)
+        {
+            // 107: Transport endpoint is not connected
+            // 125: Operation canceled
+            if (error && error!=bs::error_code(107, bs::system_category))
+            {
+                stringstream str;
+                str << "Reading from " << URL() << ": " << error.message() << " (" << error << ")";// << endl;
+                Error(str);
+            }
+            CloseImp(error!=bs::error_code(125, bs::system_category));
+            return;
+        }
+
+        string txt;
+
+        if (bytes_received==2)
+        {
+            txt = string(fReadBuffer, bytes_received);
+            //std::vector<char> buf(128);
+            //bytes_transferred = sock.receive(boost::asio::buffer(d3));
+
+            fMsg() << "Received b=" << bytes_received << ": " << (int)fReadBuffer[0] << " " << (int)txt[0] << " '" << txt << "' " << " " << error.message() << "  (" << error << ")" << endl;
+
+            if (fReadBuffer[0]=='T')
+            {
+                // AsyncRead + Deadline
+                // Do all manipulation to the buffer BEFORE this call!
+                AsyncRead(ba::buffer(fReadBuffer+2, 21)/*,
+                          &Connection::HandleReceivedData*/);
+                AsyncWait(fInTimeout, 5000, &Connection::HandleReadTimeout);
+            }
+            else
+            {
+                // AsyncRead + Deadline
+                // Do all manipulation to the buffer BEFORE this call!
+                AsyncRead(ba::buffer(fReadBuffer+2, 35)/*,
+                          &Connection::HandleReceivedData*/);
+                AsyncWait(fInTimeout, 5000, &Connection::HandleReadTimeout);
+            }
+        }
+        else
+        {
+            txt = string(fReadBuffer, bytes_received+2);
+            const int s = atoi(fReadBuffer+35);
+            if (s==9)
+                Info("Requested time received: "+txt);
+            else
+                state = s;
+
+            Out() << "Received b=" << bytes_received << ": " << (int)fReadBuffer[0] << " " << (int)txt[0] << " '" << txt << "' " << " " << error.message() << "  (" << error << ")" << endl;
+            memset(fReadBuffer, 0, 100);
+
+            // Do all manipulation to the buffer BEFORE this call!
+            AsyncRead(ba::buffer(fReadBuffer, 2)/*,
+                      &Connection::HandleReceivedData*/);
+
+
+        }
+    }
+
+    int GetState() const { return state; }
+
+    void StartAsyncRead()
+    {
+        // Start also a dealine_time for a proper timeout
+        // Therefore we must know how often we expect messages
+        // FIXME: Add deadline_counter
+
+        memset(fReadBuffer, 0, 100);
+
+        // AsyncRead + Deadline
+        AsyncRead(ba::buffer(fReadBuffer, 2)/*,
+                  &Connection::HandleReceivedData*/);
+        AsyncWait(fInTimeout, 5000, &Connection::HandleReadTimeout);
+    }
+
+    /*
+     ConnectionFAD(ba::io_service& io_service, const string &addr, int port) :
+     Connection(io_service, addr, port), state(0) { }
+     ConnectionFAD(ba::io_service& io_service, const string &addr, const string &port) :
+     Connection(io_service, addr, port), state(0) { }
+     */
+
+    ConnectionFAD(ba::io_service& ioservice, MessageImp &imp) :
+    Connection(ioservice, imp()), fMsg(imp), state(0)
+    {
+    }
+};
+
+template <class T>
+class StateMachineFAD : public T, public ba::io_service
+{
+public:
+    enum states_t
+    {
+        kSM_Disconnected = 1,
+        kSM_Connecting,
+        kSM_Connected,
+        kSM_Running,
+        kSM_SomeRunning,
+        kSM_Starting,
+        kSM_Stopping,
+        kSM_Reconnect,
+    };
+
+    ConnectionFAD c1;
+    ConnectionFAD c2;
+    ConnectionFAD c3;
+    ConnectionFAD c4;
+    ConnectionFAD c5;
+    ConnectionFAD c6;
+    ConnectionFAD c7;
+    ConnectionFAD c8;
+    ConnectionFAD c9;
+
+    /*
+    int Write(const Time &time, const char *txt, int qos)
+    {
+        return T::Write(time, txt, qos);
+    }
+    */
+    Timers fTimers;
+
+    StateMachineFAD(const string &name="", ostream &out=cout) :
+        T(out, name),
+        c1(*this, *this), c2(*this, *this), c3(*this, *this), c4(*this, *this),
+        c5(*this, *this), c6(*this, *this), c7(*this, *this), c8(*this, *this),
+        c9(*this, *this), fTimers(out)
+    {
+        c1.SetEndpoint("localhost", 5000);
+        c2.SetEndpoint("localhost", 4001);
+        c3.SetEndpoint("ftmboard1.ethz.ch", 5000);
+        c4.SetEndpoint("localhost", 4003);
+        c5.SetEndpoint("localhost", 4004);
+        c6.SetEndpoint("localhost", 4005);
+        c7.SetEndpoint("localhost", 4006);
+        c8.SetEndpoint("localhost", 4007);
+        c9.SetEndpoint("localhost", 4008);
+
+        c1.SetLogStream(this);
+        c2.SetLogStream(this);
+        c3.SetLogStream(this);
+        c4.SetLogStream(this);
+        c5.SetLogStream(this);
+        c6.SetLogStream(this);
+        c7.SetLogStream(this);
+        c8.SetLogStream(this);
+        c9.SetLogStream(this);
+
+        c1.AsyncConnect(); // This sets the connection to "open"
+        c2.AsyncConnect(); // This sets the connection to "open"
+        c3.AsyncConnect(); // This sets the connection to "open"
+        //c4.AsyncConnect(); // This sets the connection to "open"
+        //c5.AsyncConnect(); // This sets the connection to "open"
+        //c6.AsyncConnect(); // This sets the connection to "open"
+        //c7.AsyncConnect(); // This sets the connection to "open"
+        //c8.AsyncConnect(); // This sets the connection to "open"
+        //c9.AsyncConnect(); // This sets the connection to "open"
+
+        AddStateName(kSM_Disconnected,  "Disconnected");
+        AddStateName(kSM_Connecting,    "Connecting"); // Some connected
+        AddStateName(kSM_Connected,     "Connected");
+        AddStateName(kSM_Running,       "Running");
+        AddStateName(kSM_SomeRunning,   "SomeRunning");
+        AddStateName(kSM_Starting,      "Starting");
+        AddStateName(kSM_Stopping,      "Stopping");
+
+        AddTransition(kSM_Running,   "START", kSM_Connected)
+            ->AssignFunction(boost::bind(&StateMachineFAD::Start, this, _1, 5));
+        AddTransition(kSM_Connected, "STOP",  kSM_Running);
+
+        AddConfiguration("TIME", kSM_Running);
+        AddConfiguration("LED",  kSM_Connected);
+
+        T::AddConfiguration("MYT",  "I:1;C:5;I");
+        T::AddConfiguration("TESTI",            "I");
+        T::AddConfiguration("TESTI:5",          "I:5");
+        T::AddConfiguration("TESTI:5;F:1;D:2",  "I:5;F:1;D:2");
+        T::AddConfiguration("TESTC",            "C");
+        T::AddConfiguration("TESTI:5;C",        "I:5;C");
+
+        AddTransition(kSM_Reconnect, "RECONNECT");
+
+        T::PrintListOfEvents();
+    }
+
+    int Start(const EventImp &evt, int i)
+    {
+        switch (evt.GetTargetState())
+        {
+        case kSM_Running:    // We are coming from kRunning
+        case kSM_Starting:   // We are coming from kConnected
+            T::Out() << "Received Start(" << i << ")" << endl;
+            c1.PostMessage("START", 10);
+            c2.PostMessage("START", 10);
+            // We could introduce a "waiting for execution" state
+            return T::GetCurrentState();
+        }
+        return T::kSM_FatalError;
+    }
+
+    void Close()
+    {
+        c1.PostClose();
+        c2.PostClose();
+        c3.PostClose();
+        c4.PostClose();
+        c5.PostClose();
+        c6.PostClose();
+        c7.PostClose();
+        c8.PostClose();
+        c9.PostClose();
+    }
+
+
+    int Execute()
+    {
+        // Dispatch at most one handler from the queue. In contrary
+        // to run_run(), it doesn't wait until a handler is available
+        // which can be dispatched, so poll_one() might return with 0
+        // handlers dispatched. The handlers are always dispatched
+        // synchronously.
+
+        fTimers.SetT();
+        const int n = poll_one();
+        fTimers.Proc(n==0 && T::IsQueueEmpty());
+
+//        return c3.IsConnected() ? kSM_Connected : kSM_Disconnected;
+
+
+        // None is connected
+        if (!c1.IsConnected() && !c2.IsConnected())
+            return kSM_Disconnected;
+
+        // Some are connected
+        if (c1.IsConnected()!=c2.IsConnected())
+            return kSM_Connecting;
+
+        if (c1.GetState()==0 && c2.GetState()==0 && T::GetCurrentState()!=kSM_Starting)
+            return kSM_Connected;
+
+        if (c1.GetState()==1 && c2.GetState()==1 && T::GetCurrentState()!=kSM_Stopping)
+            return kSM_Running;
+
+        return kSM_SomeRunning;//GetCurrentState();
+    }
+
+    int Transition(const Event &evt)
+    {
+        ConnectionFAD *con1 = &c1;
+        ConnectionFAD *con2 = &c2;
+
+        switch (evt.GetTargetState())
+        {
+        case kSM_Reconnect:
+            // Close all connections
+            c1.PostClose(false);
+            c2.PostClose(false);
+            c3.PostClose(false);
+
+            // Now wait until all connection have been closed and
+            // all pending handlers have been processed
+            poll();
+
+            // Now we can reopen the connection
+            c1.PostClose(true);
+            c2.PostClose(true);
+            c3.PostClose(true);
+
+
+            //c4.PostClose(true);
+            //c5.PostClose(true);
+            //c6.PostClose(true);
+            //c7.PostClose(true);
+            //c8.PostClose(true);
+            //c9.PostClose(true);
+            return T::GetCurrentState();
+        case kSM_Running: // We are coming from kRunning
+        case kSM_Starting:   // We are coming from kConnected
+            T::Out() << "Received START" << endl;
+            con1->PostMessage("START", 10);
+            con2->PostMessage("START", 10);
+            // We could introduce a "waiting for execution" state
+            return T::GetCurrentState();
+            return kSM_Starting; //GetCurrentState();
+
+        case kSM_Connected:   // We are coming from kConnected
+        case kSM_Stopping: // We are coming from kRunning
+            T::Out() << "Received STOP" << endl;
+            con1->PostMessage("STOP", 10);
+            con2->PostMessage("STOP", 10);
+            // We could introduce a "waiting for execution" state
+            return T::GetCurrentState();
+            return kSM_Stopping;//GetCurrentState();
+        }
+
+        return T::kSM_FatalError; //evt.GetTargetState();
+    }
+    int Configure(const Event &evt)
+    {
+        if (evt.GetName()=="TIME")
+        {
+            c1.PostMessage("TIME", 10);
+            c2.PostMessage("TIME", 10);
+        }
+
+        vector<char> v(2);
+        v[0] = 0xc0;
+        v[1] = 0x00;
+
+        if (evt.GetName()=="LED")
+            c3.PostMessage(v);
+
+        return T::GetCurrentState();
+    }
+};
+
+// ------------------------------------------------------------------------
+
+template<class S>
+int RunDim(Configuration &conf)
+{
+    /*
+     initscr();		      // Start curses mode
+     cbreak();		      // Line buffering disabled, Pass on
+     intrflush(stdscr, FALSE);
+     start_color();            // Initialize ncurses colors
+     use_default_colors();     // Assign terminal default colors to -1
+     for (int i=1; i<8; i++)
+        init_pair(i, i, -1);  // -1: def background
+        scrollok(stdscr, true);
+        */
+
+    WindowLog wout;
+
+    //log.SetWindow(stdscr);
+    if (conf.Has("log"))
+        if (!wout.OpenLogFile(conf.Get<string>("log")))
+            wout << kRed << "ERROR - Couldn't open log-file " << conf.Get<string>("log") << ": " << strerror(errno) << endl;
+
+    // Start io_service.Run to use the StateMachineImp::Run() loop
+    // Start io_service.run to only use the commandHandler command detaching
+    StateMachineFAD<S> io_service("DATA_LOGGER", wout);
+    io_service.Run();
+
+    return 0;
+}
+
+template<class T, class S>
+int RunShell(Configuration &conf)
+{
+    static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
+
+    WindowLog &win  = shell.GetStreamIn();
+    WindowLog &wout = shell.GetStreamOut();
+
+    if (conf.Has("log"))
+        if (!wout.OpenLogFile(conf.Get<string>("log")))
+            win << kRed << "ERROR - Couldn't open log-file " << conf.Get<string>("log") << ": " << strerror(errno) << endl;
+
+    StateMachineFAD<S> io_service("DATA_LOGGER", wout);
+    shell.SetReceiver(io_service);
+
+    boost::thread t(boost::bind(&StateMachineFAD<S>::Run, &io_service));
+
+    //io_service.SetReady();
+
+    shell.Run();                 // Run the shell
+    io_service.Stop();           // Signal Loop-thread to stop
+    // io_service.Close();       // Obsolete, done by the destructor
+    // wout << "join: " << t.timed_join(boost::posix_time::milliseconds(0)) << endl;
+
+    // Wait until the StateMachine has finished its thread
+    // before returning and destroying the dim objects which might
+    // still be in use.
+    t.join();
+
+    return 0;
+}
+
+void SetupConfiguration(Configuration &conf)
+{
+    const string n = conf.GetName()+".log";
+
+    po::options_description config("Configuration");
+    config.add_options()
+        ("log,l",     var<string>(n), "Write log-file")
+        ("no-dim,d",  po_switch(), "Disable dim services")
+        ("console,c", var<int>(),    "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
+        ;
+
+    conf.AddOptionsCommandline(config);
+}
+
+int main(int argc, char* argv[])
+{
+    setenv("DIM_DNS_NODE", "localhost", 0);
+
+    Configuration conf(argv[0]);
+    SetupConfiguration(conf);
+
+    po::variables_map vm;
+    try
+    {
+        vm = conf.Parse(argc, argv);
+    }
+    catch (std::exception &e)
+    {
+        po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+        if (MO)
+            cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+        else
+            cout << "Error: " << e.what() << endl;
+        cout << endl;
+
+        return -1;
+    }
+
+    if (conf.HasHelp() || conf.HasPrint())
+        return -1;
+
+    try
+    {
+        // No console access at all
+        if (!conf.Has("console"))
+        {
+            if (conf.Get<bool>("no-dim"))
+                return RunDim<StateMachine>(conf);
+            else
+                return RunDim<StateMachineDim>(conf);
+        }
+        // Cosole access w/ and w/o Dim
+        if (conf.Get<bool>("no-dim"))
+        {
+            if (conf.Get<int>("console")==0)
+                return RunShell<LocalShell, StateMachine>(conf);
+            else
+                return RunShell<LocalConsole, StateMachine>(conf);
+        }
+        else
+        {
+            if (conf.Get<int>("console")==0)
+                return RunShell<LocalShell, StateMachineDim>(conf);
+            else
+                return RunShell<LocalConsole, StateMachineDim>(conf);
+        }
+    }
+    catch (std::exception& e)
+    {
+        std::cerr << "Exception: " << e.what() << "\n";
+    }
+
+    return 0;
+}
+
+/*
+class FADctrlDim : public StateMachineFAD<StateMachineDim>
+{
+public:
+FADctrlDim(const std::string &name="DATA_LOGGER", std::ostream &out=std::cout)
+: StateMachineFAD<StateMachineDim>(out, name) { }
+};
+
+ class FADctrlLocalShell : public StateMachineFAD<StateMachine>
+{
+public:
+    ostream &win;
+
+    FADctrlLocalShell(std::ostream &out, std::ostream &out2)
+        : StateMachineFAD<StateMachine>(out), win(out2) { }
+
+    FADctrlLocalShell(std::ostream &out=std::cout)
+        : StateMachineFAD<StateMachine>(out), win(out) { }
+
+};
+*/
Index: /trunk/FACT++/src/dserver2.cc
===================================================================
--- /trunk/FACT++/src/dserver2.cc	(revision 10183)
+++ /trunk/FACT++/src/dserver2.cc	(revision 10183)
@@ -0,0 +1,333 @@
+#include <iostream>
+#include <string>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/asio/deadline_timer.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+using boost::lexical_cast;
+
+#include "Time.h"
+
+using namespace std;
+
+namespace ba    = boost::asio;
+namespace bs    = boost::system;
+namespace dummy = ba::placeholders;
+
+using boost::lexical_cast;
+using ba::ip::tcp;
+
+int Port = 0;
+
+class tcp_connection : public ba::ip::tcp::socket, public boost::enable_shared_from_this<tcp_connection>
+{
+
+private:
+    void AsyncRead(ba::mutable_buffers_1 buffers)
+    {
+        ba::async_read(*this, buffers,
+                       boost::bind(&tcp_connection::HandleReceivedData, shared_from_this(),
+                                   dummy::error, dummy::bytes_transferred));
+    }
+
+    void AsyncWrite(ba::const_buffers_1 buffers)
+    {
+        ba::async_write(*this, buffers,
+                        boost::bind(&tcp_connection::HandleSentData, shared_from_this(),
+                                    dummy::error, dummy::bytes_transferred));
+    }
+    void AsyncWait(ba::deadline_timer &timer, int seconds,
+                               void (tcp_connection::*handler)(const bs::error_code&))// const
+    {
+        timer.expires_from_now(boost::posix_time::seconds(seconds));
+        timer.async_wait(boost::bind(handler, shared_from_this(), dummy::error));
+    }
+
+    static int inst;
+    int instance;
+    ba::deadline_timer deadline_;
+
+    std::string message_;
+    std::string message2;
+    std::string msg_in;
+
+    char mybuffer[10000];
+
+    int state;
+
+    // The constructor is prvate to force the obtained pointer to be shared
+    tcp_connection(ba::io_service& ioservice) : ba::ip::tcp::socket(ioservice),
+        instance(inst++), deadline_(ioservice)
+    {
+        deadline_.expires_at(boost::posix_time::pos_infin);
+        state=0;
+    }
+
+    // Callback when writing was successfull or failed
+    void HandleSentData(const boost::system::error_code& error, size_t bytes_transferred)
+    {
+        cout << "Data sent: (transmitted=" << bytes_transferred << ") rc=" << error.message() << " (" << error << ")" << endl;
+    }
+
+    void HandleReceivedData(const boost::system::error_code& error, size_t bytes_received)
+    {
+        string str = string(mybuffer, bytes_received);
+        cout << "Received b=" << bytes_received << ": '" << str << "' " << error.message() << " (" << error << ")" << endl;
+
+        // Do not schedule a new read if the connection failed.
+        if (bytes_received==0)
+        {
+            // Close the connection
+            close();
+            deadline_.cancel();
+            return;
+        }
+
+        if (strcmp(mybuffer, "START")==0 && state==0)
+            state = 1;
+
+        if (strcmp(mybuffer, "STOP")==0 && state==1)
+            state = 0;
+
+        if (strcmp(mybuffer, "TIME")==0)
+        {
+            stringstream msg;
+            msg << "s-" << Port << ": " << Time() << " 9";
+            message2 = msg.str();
+
+            AsyncWrite(ba::buffer(message2.c_str(), 37));
+
+            cout << msg.str() << endl;
+        }
+
+        AsyncRead(ba::buffer(mybuffer, 10));
+    }
+
+    void check_deadline(const boost::system::error_code &)
+    {
+        if (!is_open())
+        {
+            // For example: Here we could schedule a new accept if we
+            // would not want to allow two connections at the same time.
+            return;
+        }
+
+        // Check whether the deadline has passed. We compare the deadline
+        // against the current time since a new asynchronous operation
+        // may have moved the deadline before this actor had a chance
+        // to run.
+        if (deadline_.expires_at() <= ba::deadline_timer::traits_type::now())
+        {
+            stringstream str;
+            str << "s-" << Port << ": " << Time() << " " << state;
+
+            message_ = str.str();
+
+            // The deadline has passed. Stop the session. The other
+            // actors will terminate as soon as possible.
+            AsyncWrite(ba::buffer(message_.c_str(), 37));
+            AsyncWait(deadline_, 3, &tcp_connection::check_deadline);
+
+            cout << str.str() << endl;
+
+            return;
+        }
+
+        AsyncWait(deadline_, 3, &tcp_connection::check_deadline);
+    }
+
+public:
+    typedef boost::shared_ptr<tcp_connection> shared_ptr;
+
+    static shared_ptr create(ba::io_service& io_service)
+    {
+        return shared_ptr(new tcp_connection(io_service));
+    }
+
+    void start()
+    {
+        message_ = "This is the first msg. ";
+
+        // Ownership of buffer must be valid until Handler is called.
+
+        // Emit something to be written to the socket
+        AsyncRead(ba::buffer(mybuffer, 10));
+
+        // async_read_until
+        AsyncWrite(ba::buffer(message_));
+
+        // Whenever the time expires we will schedule a new message to be sent
+        AsyncWait(deadline_, 3, &tcp_connection::check_deadline);
+    }
+};
+
+
+int tcp_connection::inst = 0;
+
+
+class tcp_server : public tcp::acceptor
+{
+public:
+    tcp_server(ba::io_service& ioservice, int port) :
+        tcp::acceptor(ioservice, tcp::endpoint(tcp::v4(), port))
+
+    {
+        // We could start listening for more than one connection
+        // here, but since there is only one handler executed each time
+        // it would not make sense. Before one handle_accept is not
+        // finished no new handle_accept will be called.
+        // Workround: Start a new thread in handle_accept
+        start_accept();
+    }
+
+private:
+    void start_accept()
+    {
+        cout << "Start accept..." << flush;
+        tcp_connection::shared_ptr new_connection = tcp_connection::create(/*acceptor_.*/io_service());
+
+        // This will accept a connection without blocking
+        async_accept(*new_connection,
+                     boost::bind(&tcp_server::handle_accept,
+                                 this,
+                                 new_connection,
+                                 ba::placeholders::error));
+
+        cout << "start-done." << endl;
+    }
+
+    void handle_accept(tcp_connection::shared_ptr new_connection, const boost::system::error_code& error)
+    {
+        // The connection has been accepted and is now ready to use
+
+        // not installing a new handler will stop run()
+        cout << "Handle accept..." << flush;
+        if (!error)
+        {
+
+            new_connection->start();
+
+            // The is now an open connection/server (tcp_connection)
+            // we immediatly schedule another connection
+            // This allowed two client-connection at the same time
+            start_accept();
+        }
+        cout << "handle-done." << endl;
+    }
+};
+
+int main(int argc, const char **argv)
+{
+    try
+    {
+        ba::io_service io_service;
+
+        Port = argc==2 ? lexical_cast<int>(argv[1]) : 5000;
+
+        tcp_server server(io_service, Port);
+        //  ba::add_service(io_service, &server);
+        //  server.add_service(...);
+        cout << "Run..." << flush;
+
+        // Calling run() from a single thread ensures no concurrent access
+        // of the handler which are called!!!
+        io_service.run();
+
+        cout << "end." << endl;
+    }
+    catch (std::exception& e)
+    {
+        std::cerr << e.what() << std::endl;
+    }
+
+    return 0;
+}
+/*  ====================== Buffers ===========================
+
+char d1[128]; ba::buffer(d1));
+std::vector<char> d2(128); ba::buffer(d2);
+boost::array<char, 128> d3; by::buffer(d3);
+
+// --------------------------------
+char d1[128];
+std::vector<char> d2(128);
+boost::array<char, 128> d3;
+
+boost::array<mutable_buffer, 3> bufs1 = {
+   ba::buffer(d1),
+   ba::buffer(d2),
+   ba::buffer(d3) };
+sock.read(bufs1);
+
+std::vector<const_buffer> bufs2;
+bufs2.push_back(boost::asio::buffer(d1));
+bufs2.push_back(boost::asio::buffer(d2));
+bufs2.push_back(boost::asio::buffer(d3));
+sock.write(bufs2);
+
+
+// ======================= Read functions =========================
+
+ba::async_read_until --> delimiter
+
+streambuf buf; // Ensure validity until handler!
+by::async_read(s, buf, ....);
+
+ba::async_read(s, ba:buffer(data, size), handler);
+ // Single buffer
+ boost::asio::async_read(s,
+                         ba::buffer(data, size),
+ compl-func -->          ba::transfer_at_least(32),
+                         handler);
+
+ // Multiple buffers
+boost::asio::async_read(s, buffers,
+ compl-func -->         boost::asio::transfer_all(),
+                        handler);
+                        */
+
+// ================= Others ===============================
+
+        /*
+        strand   Provides serialised handler execution.
+        work     Class to inform the io_service when it has work to do.
+
+
+io_service::
+dispatch   Request the io_service to invoke the given handler.
+poll       Run the io_service's event processing loop to execute ready
+           handlers.
+poll_one   Run the io_service's event processing loop to execute one ready
+           handler.
+post       Request the io_service to invoke the given handler and return
+           immediately.
+reset      Reset the io_service in preparation for a subsequent run()
+           invocation.
+run        Run the io_service's event processing loop.
+run_one    Run the io_service's event processing loop to execute at most
+           one handler.
+stop       Stop the io_service's event processing loop.
+wrap       Create a new handler that automatically dispatches the wrapped
+           handler on the io_service.
+
+strand::         The io_service::strand class provides the ability to
+                 post and dispatch handlers with the guarantee that none
+                 of those handlers will execute concurrently.
+
+dispatch         Request the strand to invoke the given handler.
+get_io_service   Get the io_service associated with the strand.
+post             Request the strand to invoke the given handler and return
+                 immediately.
+wrap             Create a new handler that automatically dispatches the
+                 wrapped handler on the strand.
+
+work::           The work class is used to inform the io_service when
+                 work starts and finishes. This ensures that the io_service's run() function will not exit while work is underway, and that it does exit when there is no unfinished work remaining.
+get_io_service   Get the io_service associated with the work.
+work             Constructor notifies the io_service that work is starting.
+
+*/
+
+
Index: /trunk/FACT++/src/log.cc
===================================================================
--- /trunk/FACT++/src/log.cc	(revision 10183)
+++ /trunk/FACT++/src/log.cc	(revision 10183)
@@ -0,0 +1,43 @@
+#include "MessageDim.h"
+
+#include "tools.h"
+
+#include <iostream>
+
+int main(int, const char **argv)
+{
+    // We could use putenv to make the Configure class change the value...
+    setenv("DIM_DNS_NODE", "localhost", 0);
+
+    // Get the name of the server we should subscribe to from the cmd line
+    const std::string server = argv[1] ? argv[1] : "TIME";
+
+    // Some info on the console
+    std::cout << "Subscribing to " << server << "/MESSAGE...\n" << std::endl;
+
+    // Create a message handler (default: redirects to stdout)
+    MessageImp msg;
+
+    // Subscribe to SERVER/MESSAGE and start output
+    MessageDimRX msgrx(server, msg);
+
+    // Just do nothing ;)
+    while (1)
+        usleep(1);
+
+    return 0;
+}
+
+// **************************************************************************
+/** @example log.cc
+
+This is a simple example which subscribes to the message service of one
+dedicated dim client. It can be used to remotely log its log-messages.
+
+To redirect the output to a file use the shell redirection or the
+tee-program.
+
+The program is stopped by CTRL-C
+
+*/
+// **************************************************************************
Index: /trunk/FACT++/src/logtime.cc
===================================================================
--- /trunk/FACT++/src/logtime.cc	(revision 10183)
+++ /trunk/FACT++/src/logtime.cc	(revision 10183)
@@ -0,0 +1,42 @@
+#include "MessageDim.h"
+
+#include "tools.h"
+#include "Time.h"
+
+#include <iostream>
+
+int main(int, const char **)
+{
+   // We could use putenv to make the Configure class change the value...
+    setenv("DIM_DNS_NODE", "localhost", 0);
+
+    // Start a DimServer called TIME
+    DimServer::start("TIME");
+
+    // Some info on the console
+    std::cout << "Offering TIME/MESSAGE...\n" << std::endl;
+
+    // Setup a DimService called TIME/MESSAGE
+    MessageDimTX msg("TIME");
+    while (1)
+    {
+        // Send current time
+        msg.Message(Time().GetAsStr());
+
+        // wait approximately one second
+        usleep(1000000);
+    }
+
+    return 0;
+}
+
+// **************************************************************************
+/** @example logtime.cc
+
+This is a simple example how to log messages through the Dim network
+using MessageDimTX. Here we are offering the time once a second.
+
+The program is stopped by CTRL-C
+
+*/
+// **************************************************************************
Index: /trunk/FACT++/src/sched.cc
===================================================================
--- /trunk/FACT++/src/sched.cc	(revision 10183)
+++ /trunk/FACT++/src/sched.cc	(revision 10183)
@@ -0,0 +1,425 @@
+//
+// chat_client.cpp
+// ~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#include <iostream>
+#include <deque>
+#include <boost/filesystem.hpp>
+#include <boost/thread.hpp>
+#include <boost/asio.hpp>
+#include <boost/bind.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/asio/deadline_timer.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include "StateMachineDim.h"
+#include "Configuration.h"
+
+#include "StateMachineConsole.h"
+#include "Shell.h"
+
+namespace ba    = boost::asio;
+namespace bs    = boost::system;
+namespace fs    = boost::filesystem;
+namespace dummy = ba::placeholders;
+
+using boost::lexical_cast;
+using ba::deadline_timer;
+using ba::ip::tcp;
+
+using namespace std;
+
+#include "MessageDim.h"
+#include "Connection.h"
+#include "Time.h"
+#include "Event.h"
+#include "WindowLog.h"
+
+#include "tools.h" // CheckDim
+
+
+// ------------------------------------------------------------------------
+
+template <class T>
+class LocalTemplate : public T
+{
+public:
+    StateMachine *fImp;
+    string fName;
+
+    ostream &wout;
+
+    LocalTemplate(const char *name, ostream &out) : T(name), fImp(0),
+        fName(fs::path(name).filename()), wout(out) { }
+
+    void SetCommands(StateMachineConsole &imp)
+    {
+        fImp = &imp;
+    }
+
+    char *Complete(const char *text, int state)
+    {
+        static vector<EventImp*>::const_iterator pos;
+        if (state==0)
+            pos = fImp->GetListOfEvents().begin();
+
+        while (pos!=fImp->GetListOfEvents().end())
+        {
+            char *rc = Readline::Compare((*(pos++))->GetName(), text);
+            if (rc)
+                return rc;
+        }
+        return 0;
+    }
+
+    //bool PrintGeneralHelp()
+    //bool PrintKeyBindings()
+    bool PrintCommands()
+    {
+        wout << endl << kBold << "List of commands:" << endl;
+        fImp->PrintListOfEvents(wout);
+        wout << endl;
+
+        return true;
+    }
+
+    bool Process(const std::string &str)
+    {
+        if (T::Process(str))
+            return true;
+
+        if (str=="test")
+        {
+            wout << "Test" << endl;
+            return false;
+        }
+
+        Event evt(str);
+        evt.SetInt(7);
+
+        if (!fImp->ProcessCommand(evt))
+        {
+            wout << kRed << "Unknown command '" << str << "' " << kReset << " (type l for a list of commands)." << endl;
+            return true;
+        }
+
+        return false;
+    }
+};
+
+class LocalShell : public LocalTemplate<Shell>
+{
+public:
+    LocalShell(const char *name, bool = false) : LocalTemplate<Shell>(name, win) { }
+
+    string GetUpdatePrompt() const
+    {
+        int  s = Shell::wout.GetSizeBacklog()/1000;
+        char u = 'k';
+        if (s>999)
+        {
+            s/=1000;
+            u = 'M';
+        }
+        return Form("[%d:%d%c] %s:%s> ", GetLine(), s, u, fName.c_str(),
+                    fImp->GetStateName().c_str());
+    }
+
+    void Run(const char * = 0)
+    {
+        win << kBlue << kBold << "You are on the " << fName << " terminal of the MCP -" << endl;
+        win << kBlue << kBold << "the Master Control Program." << endl;
+        win << endl;
+        win << kBlue << kBold << "Hello Flynn..." << endl;
+        win << endl;
+
+        Shell::Run();
+    }
+};
+
+class LocalConsole : public LocalTemplate<Readline>
+{
+    WindowLog fLog;
+
+    bool fContinous;
+
+public:
+    LocalConsole(const char *name, bool continous=false)
+        : LocalTemplate<Readline>(name, fLog), fContinous(continous)
+    {
+        fLog.SetNullOutput();
+    }
+
+    string GetUpdatePrompt() const
+    {
+
+        if (fContinous)
+            return Form("\n[%d] \033[34m%s\033[0m:\033[32m\033[1m%s\033[0m> ",
+                        GetLine(), fName.c_str(), fImp->GetStateName().c_str());
+
+
+        int  s = fLog.GetSizeBacklog()/1000;
+        char u = 'k';
+        if (s>999)
+        {
+            s/=1000;
+            u = 'M';
+        }
+        return Form("\n[%d:%d%c] \033[34m%s\033[0m:\033[32m\033[1m%s\033[0m> ",
+                    GetLine(), s, u, fName.c_str(), fImp->GetStateName().c_str());
+    }
+
+    WindowLog &GetStreamOut() { return fLog; }
+    WindowLog &GetStreamIn()  { return fLog; }
+
+        void EventHook()
+        {
+            if (fContinous)
+            {
+                if (fLog.GetSizeBacklog()>0)
+                    cout << "\r";
+                fLog.Display(true);
+            }
+            Readline::EventHook();
+        }
+
+    void Shutdown(const char * =0)
+    {
+        fLog.Display(true);
+        cout << endl;
+    }
+
+    void Run(const char * = 0)
+    {
+        cout << endl;
+        cout << "\033[34mYou are on the " << fName << " terminal of the MCP -" << endl;
+        cout << "the Master Control Program." << endl;
+        cout << endl;
+        cout << "Hello Flynn...\033[0m" << endl;
+        cout << endl;
+
+        Shutdown();
+
+        Readline::Run();
+
+        fLog.Display();
+        fLog.SetNullOutput(false);
+        fLog.SetBacklog(false);
+    }
+};
+
+// =========================================================================
+
+template <class T>
+class AutoScheduler : public T
+{
+    bool fNextIsPreview;
+public:
+    enum states_t
+    {
+        kSM_Scheduling=1,
+        kSM_Comitting,
+    };
+
+    int fSessionId;
+
+    int Schedule()
+    {
+        stringstream str;
+        str << "Scheduling started -> Preview (id=" << fSessionId << ")";
+        T::Message(str);
+
+        usleep(3000000);
+        T::Message("Scheduling done.");
+
+        fSessionId = -1;
+
+        bool error = false;
+        return error ? T::kSM_Error : T::kSM_Ready;
+    }
+
+    int Commit()
+    {
+        stringstream str;
+        str << "Comitting preview (id=" << fSessionId << ")";
+        T::Message(str);
+
+        usleep(3000000);
+        T::Message("Comitted.");
+
+        fSessionId = -1;
+
+        bool error = false;
+        return error ? T::kSM_Error : T::kSM_Ready;
+    }
+
+    AutoScheduler(ostream &out=cout) : T(out, "SCHEDULER"), fNextIsPreview(true), fSessionId(-1)
+    {
+        AddStateName(kSM_Scheduling,  "Scheduling");
+        AddStateName(kSM_Comitting,   "Comitting");
+
+        AddTransition(kSM_Scheduling, "SCHEDULE", T::kSM_Ready);
+        AddTransition(kSM_Comitting,  "COMMIT",   T::kSM_Ready);
+
+        T::PrintListOfEvents();
+    }
+
+    int Execute()
+    {
+        switch (T::GetCurrentState())
+        {
+        case kSM_Scheduling:
+            return Schedule();
+        case kSM_Comitting:
+            return Commit();
+        }
+        return T::GetCurrentState();
+    }
+
+    int Transition(const Event &evt)
+    {
+        switch (evt.GetTargetState())
+        {
+        case kSM_Scheduling:
+        case kSM_Comitting:
+            fSessionId = evt.GetInt();
+            break;
+        }
+
+        return evt.GetTargetState();
+    }
+    int Configure(const Event &)
+    {
+        return T::GetCurrentState();
+    }
+};
+
+// ------------------------------------------------------------------------
+
+int RunDim(const char *prgname)
+{
+    if (!CheckDim())
+        return -1;
+
+    WindowLog wout;
+    if (!wout.OpenLogFile(string(prgname)+".log"))
+        wout << kRed << "ERROR - Couldn't open log-file: " << strerror(errno) << endl;
+
+    // Start io_service.Run to use the StateMachineImp::Run() loop
+    // Start io_service.run to only use the commandHandler command detaching
+    AutoScheduler<StateMachineDim> io_service(wout);
+    io_service.Run();
+
+    return 0;
+}
+
+template<class T>
+int RunShell(const char *prgname, bool cont=false)
+{
+    static T shell(prgname, cont);
+
+    WindowLog &win  = shell.GetStreamIn();
+    WindowLog &wout = shell.GetStreamOut();
+
+    if (!wout.OpenLogFile(string(prgname)+".log"))
+        win << kRed << "ERROR - Couldn't open log-file: " << strerror(errno) << endl;
+
+    AutoScheduler<StateMachineConsole> io_service(wout);
+    shell.SetCommands(io_service);
+
+    boost::thread t(boost::bind(&AutoScheduler<StateMachineConsole>::Run, &io_service));
+
+    shell.Run();                 // Run the shell
+    io_service.Stop();           // Signal Loop-thread to stop
+    // io_service.Close();       // Obsolete, done by the destructor
+    t.join();
+
+    return 0;
+}
+
+void SetupConfiguration(Configuration &conf)
+{
+    po::options_description config("Configuration");
+    config.add_options()
+        ("console,c", po_int(), "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
+        ;
+
+    conf.AddOptionsCommandline(config);
+}
+
+int main(int argc, char* argv[])
+{
+    Configuration conf(argv[0]);
+    SetupConfiguration(conf);
+
+    po::variables_map vm;
+    try
+    {
+        vm = conf.Parse(argc, argv);
+    }
+    catch (std::exception &e)
+    {
+        po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+        if (MO)
+            cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+        else
+            cout << "Error: " << e.what() << endl;
+        cout << endl;
+
+        return -1;
+    }
+
+    if (conf.HasHelp() || conf.HasPrint())
+        return -1;
+
+    const bool dim = !conf.Has("console");
+    try
+    {
+        if (dim)
+            return RunDim(argv[0]);
+        else
+            if (conf.GetInt("console")==0)
+                return RunShell<LocalShell>(argv[0]);
+            else
+                return RunShell<LocalConsole>(argv[0], conf.GetInt("console")!=1);
+
+        // Now shutdown everything....
+        // io_service.Close();  // Is this needed at all?
+        // io_service.Run();
+
+    }
+    catch (std::exception& e)
+    {
+        std::cerr << "Exception: " << e.what() << "\n";
+    }
+
+    return 0;
+}
+
+/*
+class FADctrlDim : public StateMachineFAD<StateMachineDim>
+{
+public:
+FADctrlDim(const std::string &name="DATA_LOGGER", std::ostream &out=std::cout)
+: StateMachineFAD<StateMachineDim>(out, name) { }
+};
+
+ class FADctrlLocalShell : public StateMachineFAD<StateMachineConsole>
+{
+public:
+    ostream &win;
+
+    FADctrlLocalShell(std::ostream &out, std::ostream &out2)
+        : StateMachineFAD<StateMachineConsole>(out), win(out2) { }
+
+    FADctrlLocalShell(std::ostream &out=std::cout)
+        : StateMachineFAD<StateMachineConsole>(out), win(out) { }
+
+};
+*/
Index: /trunk/FACT++/src/test3.cc
===================================================================
--- /trunk/FACT++/src/test3.cc	(revision 10183)
+++ /trunk/FACT++/src/test3.cc	(revision 10183)
@@ -0,0 +1,84 @@
+#include <boost/regex.hpp>
+#include <readline/readline.h>
+
+#include "tools.h"
+#include "Time.h"
+#include "StateMachineDim.h"
+#include "MessageDim.h"
+#include "Shell.h"
+#include "ServiceList.h"
+#include "Configuration.h"
+
+using namespace std;
+
+#include "RemoteControl.h"
+
+template <class T>
+void RunShell(Configuration &conf)
+{
+    // A normal kill will call its destructor! (Very nice feature ;) )
+    static T shell(conf.GetName().c_str(), conf.Get<int>("console")!=1);
+
+    WindowLog &win  = shell.GetStreamIn();
+    WindowLog &wout = shell.GetStreamOut();
+
+    if (conf.Has("log"))
+        if (!wout.OpenLogFile(conf.Get<string>("log")))
+            win << kRed << "ERROR - Couldn't open log-file " << conf.Get<string>("log") << ": " << strerror(errno) << endl;
+
+    shell.Run();
+}
+
+
+// ========================================================================
+void SetupConfiguration(Configuration &conf)
+{
+    const string n = conf.GetName()+".log";
+
+    po::options_description config("Configuration");
+    config.add_options()
+        ("log,l",     var<string>(n), "Write log-file")
+        ("console,c", var<int>(),     "Use console (0=shell, 1=simple buffered, X=simple unbuffered)")
+        ;
+
+    conf.AddOptionsCommandline(config);
+}
+
+int main(int argc, char *argv[])
+{
+    cout << "Starting " << argv[0] << "..." << endl;
+
+    // We could use putenv to make the Configure class change the value...
+    setenv("DIM_DNS_NODE", "localhost", 0);
+
+    Configuration conf(argv[0]);
+    SetupConfiguration(conf);
+
+    po::variables_map vm;
+    try
+    {
+        vm = conf.Parse(argc, argv);
+    }
+    catch (std::exception &e)
+    {
+        po::multiple_occurrences *MO = dynamic_cast<po::multiple_occurrences*>(&e);
+        if (MO)
+            cout << "Error: " << e.what() << " of '" << MO->get_option_name() << "' option." << endl;
+        else
+            cout << "Error: " << e.what() << endl;
+        cout << endl;
+
+        return -1;
+    }
+
+    if (conf.HasHelp() || conf.HasPrint())
+        return -1;
+
+    if (conf.Get<int>("console")==0)
+        RunShell<RemoteShell>(conf);
+    else
+        RunShell<RemoteConsole>(conf);
+
+
+    return 0;
+}
Index: /trunk/FACT++/src/time.cc
===================================================================
--- /trunk/FACT++/src/time.cc	(revision 10183)
+++ /trunk/FACT++/src/time.cc	(revision 10183)
@@ -0,0 +1,83 @@
+#include "Time.h"
+
+#include <iostream>
+
+using namespace std;
+
+int main(int, char **)
+{
+    // Print the local time in the default representation of cout
+    cout << endl;
+    cout << "Local Time:   " << Time(Time::local) << endl;
+
+    // Print UTC in several different representations
+    Time utc; 
+    cout << "Universal CT: " << utc << endl;
+    cout << "User defined: " << Time::fmt("%Y=%m=%d %H=%M=%S.%f") << utc << endl;
+    cout << "SQL-format:   " << Time::sql << utc << endl;
+    cout << "ISO-format:   " << Time::iso << utc << endl;
+    cout << "Default:      " << Time::reset << utc << endl;
+    cout << endl;
+
+    // Copy the UTC into a stringstream and show it on the screen
+    stringstream str;
+    str << "stringstream: " << Time::sql << utc;
+    cout << str.str() << endl;
+    cout << endl;
+
+    // Calculate the corresponsing MJD and shoud MJD and corresponding UTC
+    const double mjd1 = utc.Mjd();
+    cout << "Mjd:   " << Time::sql << utc << " (" << mjd1 << ")" << endl;
+
+    // Set utc to the previously calculated MJD
+    utc.Mjd(mjd1);
+
+    // Re-calcualte MJD from this
+    const double mjd2 = utc.Mjd();
+
+    // Show the newly calculated MJD and time and the difference between both
+    cout << "Mjd:   " << Time::sql << utc << " (" << mjd2 << ")" << endl;
+    cout << "Diff:  " << mjd1 - mjd2 << endl;
+    cout << endl;
+
+    // Instantiate a Time object with an artificial time
+    const Time bd(1974, 9, 9, 21, 59, 42, 123456);
+
+    // Show it in two different representations
+    cout << "Loc default:  " << Time::def << bd << endl;
+    cout << "Standard:     " << Time::std << bd << endl;
+    cout << endl;
+
+    // Clear the stringstream contents
+    str.str("");
+
+    // Stream the time in its sql representation into the stringstream
+    str << Time::sql << bd;
+
+    // Stream a time from the stringstream considering an sql representation
+    // into a Time object
+    Time tm;
+    str >> Time::sql >> tm;
+
+    // Output stream and interpreted time
+    cout << "Stream: " << str.str() << endl; 
+    cout << "Time:   " << Time::sql << tm << endl;
+    cout << endl;
+
+    // Print the individual elements of the date and the time
+    cout << "Elements: ";
+    cout << tm.Y() << " " << tm.M() << " " << tm.D() << " " ;
+    cout << tm.h() << " " << tm.m() << " " << tm.s() << " " ;
+    cout << tm.us() << endl;
+    cout << endl;
+
+    return 0;
+}
+
+// **************************************************************************
+/** @example time.cc
+
+Example for the usage of the class Time
+
+**/
+// **************************************************************************
Index: /trunk/FACT++/src/tools.cc
===================================================================
--- /trunk/FACT++/src/tools.cc	(revision 10183)
+++ /trunk/FACT++/src/tools.cc	(revision 10183)
@@ -0,0 +1,50 @@
+// **************************************************************************
+/** @file tools.cc
+
+@todo
+   - Resolve the dependancies with dim
+   - Move code to a more appropriate place
+   - put stuff in namespaces
+*/
+// **************************************************************************
+#include "tools.h"
+
+#include <stdarg.h>
+
+using namespace std;
+
+string Format(const char *fmt, va_list &ap)
+{
+    int n=256;
+
+    char *ret=0;
+    while (1)
+    {
+        ret = new char[n+1];
+
+        const int sz = vsnprintf(ret, n, fmt, ap);
+        if (sz<=n)
+            break;
+
+        n *= 2;
+        delete [] ret;
+    };
+
+    string str(ret);
+
+    delete [] ret;
+
+    return str;
+}
+
+string Form(const char *fmt, ...)
+{
+    va_list ap;
+    va_start(ap, fmt);
+
+    string str = Format(fmt, ap);
+
+    va_end(ap);
+
+    return str;
+}
Index: /trunk/FACT++/src/tools.h
===================================================================
--- /trunk/FACT++/src/tools.h	(revision 10183)
+++ /trunk/FACT++/src/tools.h	(revision 10183)
@@ -0,0 +1,4 @@
+#include <string>
+
+std::string Format(const char *fmt, va_list &ap);
+std::string Form(const char *fmt, ...);
