#! /bin/sh /usr/share/dpatch/dpatch-run
## cvs20110227.dpatch by Yaroslav Halchenko <debian@onerussian.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Dated CVS snapshot

@DPATCH@

diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/aclocal.m4 lush-cvs/aclocal.m4
--- lush/aclocal.m4	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/aclocal.m4	2006-12-17 09:08:04.000000000 -0500
@@ -129,7 +129,8 @@
        AC_CHECK_CC_OPT([-O3],[OPTS="$OPTS -O3"],
          [ AC_CHECK_CC_OPT([-O2], [OPTS="$OPTS -O2"] ) ] )
        if test -z "$ac_cpu" ; then
-        AC_MSG_WARN([guessing cpu type (use --with-cpu=cpuname to override.)])
+        test "$host_cpu" = "x86_64" && host_cpu="nocona" 
+        AC_MSG_WARN([guessing cpu $host_cpu (override with --with-cpu=cpuname.)])
        fi
        opt="-march=${ac_cpu-${host_cpu}}"
        AC_CHECK_CC_OPT([$opt], [OPTS="$OPTS $opt"],
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/bin/lush lush-cvs/bin/lush
--- lush/bin/lush	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/bin/lush	2007-11-25 18:42:58.000000000 -0500
@@ -26,7 +26,7 @@
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#;;; $Id: lush,v 1.1 2005/05/18 19:00:15 leonb Exp $
+#;;; $Id: lush,v 1.2 2007/11/25 23:42:58 leonb Exp $
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -78,6 +78,7 @@
    exec $progdir/$host/lush "$@"
 fi
 
+host=none
 for n in $progdir/* 
 do
    if [ -d $n -a -x $n/lush ] 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/configure lush-cvs/configure
--- lush/configure	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/configure	2008-09-16 11:59:27.000000000 -0400
@@ -1,26 +1,55 @@
 #! /bin/sh
 # From configure.ac Id: configure.ac.
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for lush 1.0.
+# Generated by GNU Autoconf 2.61 for lush 1.0.
 #
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 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 Bourne compatible
+# 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=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -30,8 +59,43 @@
 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.)
+as_nl='
+'
+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
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -45,18 +109,19 @@
   if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    $as_unset $as_var
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+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
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -64,157 +129,388 @@
 
 
 # Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)$' \| \
-	 .     : '\(.\)' 2>/dev/null ||
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\/\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
 
+# CDPATH.
+$as_unset CDPATH
 
-# PATH needs CR, and LINENO needs CR and PATH.
-# 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
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+
+  if test $as_have_required = yes && 	 (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
 fi
 
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  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
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
 
-       ;;
-  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
-    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-	 case $as_dir in
+  case $as_dir in
 	 /*)
-	   if ("$as_dir/$as_base" -c '
+	   for as_base in sh bash ksh sh5; do
+	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+	   done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+	 # Try only shells that exist, to save several forks.
+	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		{ ("$as_shell") 2> /dev/null <<\_ASEOF
+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
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+	       as_have_required=yes
+	       if { "$as_shell" 2> /dev/null <<\_ASEOF
+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
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-	     CONFIG_SHELL=$as_dir/$as_base
-	     export CONFIG_SHELL
-	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-	   fi;;
-	 esac
-       done
-done
-;;
-  esac
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
       N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
+  chmod +x "$as_me.lineno" ||
     { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); 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 sensible to this).
-  . ./$as_me.lineno
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
   # Exit status is that of the last command.
   exit
 }
 
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='	' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 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
+fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
+  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'
-  else
-    as_ln_s='ln -s'
-  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.file
+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=:
@@ -223,7 +519,28 @@
   as_mkdir_p=false
 fi
 
-as_executable_p="test -f"
+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'"
@@ -232,39 +549,27 @@
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" 	$as_nl"
-
-# CDPATH.
-$as_unset CDPATH
 
+exec 7<&0 </dev/null 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
-exec 6>&1
-
 #
 # Initializations.
 #
 ac_default_prefix=/usr/local
+ac_clean_files=
 ac_config_libobj_dir=.
+LIBOBJS=
 cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete.  It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
 # Identity of this package.
 PACKAGE_NAME='lush'
 PACKAGE_TARNAME='lush'
@@ -277,42 +582,154 @@
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#if STDC_HEADERS
+#ifdef STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
 #else
-# if HAVE_STDLIB_H
+# ifdef HAVE_STDLIB_H
 #  include <stdlib.h>
 # endif
 #endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
 #  include <memory.h>
 # endif
 # include <string.h>
 #endif
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif
-#if HAVE_INTTYPES_H
+#ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
 #endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CXX F77 SET_MAKE CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT OPTS GCC CXXFLAGS ac_ct_CXX FFLAGS ac_ct_F77 CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB LN_S MV CP RM AR TOUCH INDENT EGREP BFD_YES X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS PKGCONFIG X_YES PTHREAD_LIBS PTHREAD_FLAGS LDCC SOEXT CC_EXP_FLAG CC_PIC_FLAG MAKESO UNIX_YES WIN32_YES LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+CC
+CXX
+F77
+SET_MAKE
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+OPTS
+GCC
+CXXFLAGS
+ac_ct_CXX
+FFLAGS
+ac_ct_F77
+CPP
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+RANLIB
+LN_S
+MV
+CP
+RM
+AR
+TOUCH
+INDENT
+GREP
+EGREP
+BFD_YES
+XMKMF
+X_CFLAGS
+X_PRE_LIBS
+X_LIBS
+X_EXTRA_LIBS
+PKGCONFIG
+X_YES
+PTHREAD_LIBS
+PTHREAD_FLAGS
+CPP_YES
+LDCC
+SOEXT
+CC_EXP_FLAG
+CC_PIC_FLAG
+MAKESO
+UNIX_YES
+WIN32_YES
+LIBOBJS
+LTLIBOBJS'
 ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+OPTS
+CXX
+CXXFLAGS
+CCC
+F77
+FFLAGS
+CPP
+XMKMF
+PTHREAD_LIBS
+PTHREAD_FLAGS'
+
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -339,34 +756,48 @@
 # 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'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+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"
+    eval $ac_prev=\$ac_option
     ac_prev=
     continue
   fi
 
-  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+  case $ac_option in
+  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)	ac_optarg=yes ;;
+  esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case $ac_option in
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
@@ -388,33 +819,45 @@
   --config-cache | -C)
     cache_file=config.cache ;;
 
-  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+  -datadir | --datadir | --datadi | --datad)
     ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
-  | --da=*)
+  -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_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval "enable_$ac_feature=no" ;;
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=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_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "enable_$ac_feature='$ac_optarg'" ;;
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -441,6 +884,12 @@
   -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 ;;
@@ -465,13 +914,16 @@
   | --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 | --local | --loca | --loc | --lo)
+  | --localstate | --localstat | --localsta | --localst | --locals)
     ac_prev=localstatedir ;;
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
-  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
     localstatedir=$ac_optarg ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -536,6 +988,16 @@
   | --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 ;;
@@ -588,24 +1050,20 @@
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "with_$ac_package='$ac_optarg'" ;;
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
 
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/-/_/g'`
-    eval "with_$ac_package=no" ;;
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -636,8 +1094,7 @@
     expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
    { (exit 1); exit 1; }; }
-    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
-    eval "$ac_envvar='$ac_optarg'"
+    eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
   *)
@@ -657,27 +1114,19 @@
    { (exit 1); exit 1; }; }
 fi
 
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
-do
-  eval ac_val=$`echo $ac_var`
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
-  esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-	      localstatedir libdir includedir oldincludedir infodir mandir
+# Be sure to have absolute directory names.
+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=$`echo $ac_var`
+  eval ac_val=\$$ac_var
   case $ac_val in
-    [\\/$]* | ?:[\\/]* ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -704,102 +1153,76 @@
 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 .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
 # 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 its parent.
-  ac_confdir=`(dirname "$0") 2>/dev/null ||
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 	 X"$0" : 'X\(//\)[^/]' \| \
 	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| \
-	 .     : '\(.\)' 2>/dev/null ||
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-  	  /^X\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
+    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
+  if test ! -r "$srcdir/$ac_unique_file"; then
     srcdir=..
   fi
 else
   ac_srcdir_defaulted=no
 fi
-if test ! -r $srcdir/$ac_unique_file; then
-  if test "$ac_srcdir_defaulted" = yes; then
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
    { (exit 1); exit 1; }; }
-  else
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
-  fi
 fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
-  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
    { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_OPTS_set=${OPTS+set}
-ac_env_OPTS_value=$OPTS
-ac_cv_env_OPTS_set=${OPTS+set}
-ac_cv_env_OPTS_value=$OPTS
-ac_env_CXX_set=${CXX+set}
-ac_env_CXX_value=$CXX
-ac_cv_env_CXX_set=${CXX+set}
-ac_cv_env_CXX_value=$CXX
-ac_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_env_CXXFLAGS_value=$CXXFLAGS
-ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_cv_env_CXXFLAGS_value=$CXXFLAGS
-ac_env_F77_set=${F77+set}
-ac_env_F77_value=$F77
-ac_cv_env_F77_set=${F77+set}
-ac_cv_env_F77_value=$F77
-ac_env_FFLAGS_set=${FFLAGS+set}
-ac_env_FFLAGS_value=$FFLAGS
-ac_cv_env_FFLAGS_set=${FFLAGS+set}
-ac_cv_env_FFLAGS_value=$FFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
-ac_env_PTHREAD_LIBS_set=${PTHREAD_LIBS+set}
-ac_env_PTHREAD_LIBS_value=$PTHREAD_LIBS
-ac_cv_env_PTHREAD_LIBS_set=${PTHREAD_LIBS+set}
-ac_cv_env_PTHREAD_LIBS_value=$PTHREAD_LIBS
-ac_env_PTHREAD_FLAGS_set=${PTHREAD_FLAGS+set}
-ac_env_PTHREAD_FLAGS_value=$PTHREAD_FLAGS
-ac_cv_env_PTHREAD_FLAGS_set=${PTHREAD_FLAGS+set}
-ac_cv_env_PTHREAD_FLAGS_value=$PTHREAD_FLAGS
+	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.
@@ -828,9 +1251,6 @@
   -n, --no-create         do not create output files
       --srcdir=DIR        find the sources in DIR [configure dir or \`..']
 
-_ACEOF
-
-  cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
 			  [$ac_default_prefix]
@@ -848,15 +1268,22 @@
   --bindir=DIR           user executables [EPREFIX/bin]
   --sbindir=DIR          system admin executables [EPREFIX/sbin]
   --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
   --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]
-  --infodir=DIR          info documentation [PREFIX/info]
-  --mandir=DIR           man documentation [PREFIX/man]
+  --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/lush]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
@@ -900,14 +1327,16 @@
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
-  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
-              headers in a nonstandard directory <include dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
   OPTS        Optimization flags for all compilers.
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   F77         Fortran 77 compiler command
   FFLAGS      Fortran 77 compiler flags
   CPP         C preprocessor
+  XMKMF       Path to xmkmf, Makefile generator for X Window System
   PTHREAD_LIBS
               Flags for linking pthread programs.
   PTHREAD_FLAGS
@@ -917,120 +1346,86 @@
 it to find libraries and programs with nonstandard names/locations.
 
 _ACEOF
+ac_status=$?
 fi
 
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
-  ac_popdir=`pwd`
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d $ac_dir || continue
+    test -d "$ac_dir" || continue
     ac_builddir=.
 
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`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
-  .)  # No --srcdir option.  We are building in place.
+  .)  # We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
+    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 ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
-  case "$ac_dir" in
-  .) ac_abs_builddir=`pwd`;;
-  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-  *) ac_abs_builddir=`pwd`/"$ac_dir";;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
-  case ${ac_top_builddir}. in
-  .) ac_abs_top_builddir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
-  case $ac_srcdir in
-  .) ac_abs_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
-  case $ac_top_srcdir in
-  .) ac_abs_top_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-  esac;;
+    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
-    # Check for guested configure; otherwise get Cygnus style 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
-    elif test -f $ac_srcdir/configure.ac ||
-	   test -f $ac_srcdir/configure.in; then
-      echo
-      $ac_configure --help
+    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
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi
-    cd "$ac_popdir"
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
   done
 fi
 
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 lush configure 1.0
-generated by GNU Autoconf 2.59
+generated by GNU Autoconf 2.61
 
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 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 0
+  exit
 fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+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 lush $as_me 1.0, which was
-generated by GNU Autoconf 2.59.  Invocation command line was
+generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
 
 _ACEOF
+exec 5>>config.log
 {
 cat <<_ASUNAME
 ## --------- ##
@@ -1049,7 +1444,7 @@
 /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`
-hostinfo               = `(hostinfo) 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`
@@ -1063,6 +1458,7 @@
   test -z "$as_dir" && as_dir=.
   echo "PATH: $as_dir"
 done
+IFS=$as_save_IFS
 
 } >&5
 
@@ -1084,7 +1480,6 @@
 ac_configure_args=
 ac_configure_args0=
 ac_configure_args1=
-ac_sep=
 ac_must_keep_next=false
 for ac_pass in 1 2
 do
@@ -1095,7 +1490,7 @@
     -q | -quiet | --quiet | --quie | --qui | --qu | --q \
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
-    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+    *\'*)
       ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
@@ -1117,9 +1512,7 @@
 	  -* ) ac_must_keep_next=true ;;
 	esac
       fi
-      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-      # Get rid of the leading space.
-      ac_sep=" "
+      ac_configure_args="$ac_configure_args '$ac_arg'"
       ;;
     esac
   done
@@ -1130,8 +1523,8 @@
 # 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: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# 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.
   {
@@ -1144,20 +1537,34 @@
 _ASBOX
     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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
   (set) 2>&1 |
-    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    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"
-      ;;
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
     *)
-      sed -n \
-	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    esac;
-}
+    esac |
+    sort
+)
     echo
 
     cat <<\_ASBOX
@@ -1168,22 +1575,28 @@
     echo
     for ac_var in $ac_subst_vars
     do
-      eval ac_val=$`echo $ac_var`
-      echo "$ac_var='"'"'$ac_val'"'"'"
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
       cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
 _ASBOX
       echo
       for ac_var in $ac_subst_files
       do
-	eval ac_val=$`echo $ac_var`
-	echo "$ac_var='"'"'$ac_val'"'"'"
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	echo "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
@@ -1195,26 +1608,24 @@
 ## ----------- ##
 _ASBOX
       echo
-      sed "/^$/d" confdefs.h | sort
+      cat confdefs.h
       echo
     fi
     test "$ac_signal" != 0 &&
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core *.core &&
-  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
-     ' 0
+' 0
 for ac_signal in 1 2 13 15; do
   trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
 
 # Predefined preprocessor variables.
 
@@ -1245,14 +1656,17 @@
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-  fi
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+	"$ac_default_prefix/etc/config.site"
 fi
-for ac_site_file in $CONFIG_SITE; do
+shift
+for ac_site_file
+do
   if test -r "$ac_site_file"; then
     { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1268,8 +1682,8 @@
     { echo "$as_me:$LINENO: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
-      [\\/]* | ?:[\\/]* ) . $cache_file;;
-      *)                      . ./$cache_file;;
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
     esac
   fi
 else
@@ -1281,12 +1695,11 @@
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
-	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+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"
+  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,)
       { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1311,8 +1724,7 @@
   # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
-    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
@@ -1329,12 +1741,6 @@
    { (exit 1); exit 1; }; }
 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
-
 
 
 
@@ -1359,118 +1765,158 @@
 
 
 
+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_aux_dir=
-for ac_dir in config $srcdir/config; do
-  if test -f $ac_dir/install-sh; then
+for ac_dir in config "$srcdir"/config; 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
+  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
+  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
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;}
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;}
    { (exit 1); exit 1; }; }
 fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# 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_config_headers="$ac_config_headers include/lushconf.h"
+
+ac_config_headers="$ac_config_headers include/lushconf.h"
 
 
 # Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
-  ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
+  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 &&
   { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
 build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+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
 
 
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
-  ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+  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` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
+fi
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
 host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+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
 
 
 
 
-# Check whether --with-extra-includes or --without-extra-includes was given.
+# Check whether --with-extra-includes was given.
 if test "${with_extra_includes+set}" = set; then
-  withval="$with_extra_includes"
-   if test -d "$withval" ; then
+  withval=$with_extra_includes;  if test -d "$withval" ; then
             CPPFLAGS="$CPPFLAGS -I$withval"
           else
             { { echo "$as_me:$LINENO: error: Cannot stat directory $withval" >&5
 echo "$as_me: error: Cannot stat directory $withval" >&2;}
    { (exit 1); exit 1; }; }
           fi
-fi;
+fi
+
 
 
-# Check whether --with-extra-libraries or --without-extra-libraries was given.
+# Check whether --with-extra-libraries was given.
 if test "${with_extra_libraries+set}" = set; then
-  withval="$with_extra_libraries"
-   if test -d "$withval" ; then
+  withval=$with_extra_libraries;  if test -d "$withval" ; then
            LDFLAGS="$LDFLAGS -L$withval"
           else
             { { echo "$as_me:$LINENO: error: Cannot stat directory $withval" >&5
 echo "$as_me: error: Cannot stat directory $withval" >&2;}
    { (exit 1); exit 1; }; }
           fi
-fi;
+fi
+
 
 # Always look into a "gnu" directory.
 curwd=`pwd`
@@ -1501,18 +1947,18 @@
 
 ac_have_mpi=no
 
-# Check whether --with-mpi or --without-mpi was given.
+# Check whether --with-mpi was given.
 if test "${with_mpi+set}" = set; then
-  withval="$with_mpi"
-   if test $withval != no ; then
+  withval=$with_mpi;  if test $withval != no ; then
             ac_have_mpi=yes
           fi
-fi;
+fi
+
 if test $ac_have_mpi = yes ; then
   # Extract the first word of "mpicc", so it can be a program name with args.
 set dummy mpicc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1527,32 +1973,33 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CC="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   test -z "$ac_cv_path_CC" && ac_cv_path_CC="none"
   ;;
 esac
 fi
 CC=$ac_cv_path_CC
-
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   # Extract the first word of "mpiCC", so it can be a program name with args.
 set dummy mpiCC; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1567,32 +2014,33 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   test -z "$ac_cv_path_CXX" && ac_cv_path_CXX="none"
   ;;
 esac
 fi
 CXX=$ac_cv_path_CXX
-
 if test -n "$CXX"; then
-  echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   # Extract the first word of "mpif77", so it can be a program name with args.
 set dummy mpif77; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1607,28 +2055,29 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_F77="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   test -z "$ac_cv_path_F77" && ac_cv_path_F77="none"
   ;;
 esac
 fi
 F77=$ac_cv_path_F77
-
 if test -n "$F77"; then
-  echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   if test $CC = none || test $CXX = none || test $F77 = none ; then
     { { echo "$as_me:$LINENO: error: Cannot locate MPI compiler drivers" >&5
 echo "$as_me: error: Cannot locate MPI compiler drivers" >&2;}
@@ -1646,32 +2095,33 @@
 # Programs
 # ----------------------------------------
 
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
-if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
 all:
-	@echo 'ac_maketemp="$(MAKE)"'
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
 _ACEOF
 # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
-  eval ac_cv_prog_make_${ac_make}_set=yes
-else
-  eval ac_cv_prog_make_${ac_make}_set=no
-fi
+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 \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
   SET_MAKE=
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
   SET_MAKE="MAKE=${MAKE-make}"
 fi
 
@@ -1684,8 +2134,8 @@
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1698,32 +2148,34 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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}gcc"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
   # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1736,36 +2188,51 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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="gcc"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 else
   CC="$ac_cv_prog_CC"
 fi
 
 if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
 set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1778,74 +2245,34 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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}cc"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  CC=$ac_ct_CC
-else
-  CC="$ac_cv_prog_CC"
-fi
 
+  fi
 fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1859,7 +2286,7 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -1870,6 +2297,7 @@
   fi
 done
 done
+IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
   # We found a bogon in the path, so make sure we never use it.
@@ -1887,22 +2315,23 @@
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$CC"; then
   if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl
+  for ac_prog in cl.exe
   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
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1915,36 +2344,38 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
     test -n "$CC" && break
   done
 fi
 if test -z "$CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl
+  for ac_prog in cl.exe
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1957,29 +2388,45 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$ac_ct_CC" && break
 done
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 fi
 
 fi
@@ -1992,21 +2439,35 @@
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for C compiler version" >&5
+echo "$as_me:$LINENO: checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
@@ -2031,47 +2492,77 @@
 # 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.
-echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
-  (eval $ac_link_default) 2>&5
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  # Find the output, starting from the most likely.  This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+  # 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 | *.o | *.obj )
-	;;
-    conftest.$ac_ext )
-	# This is the source file.
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
 	;;
     [ab].out )
 	# We found the default executable, but exeext='' is most
 	# certainly right.
 	break;;
     *.* )
-	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	# FIXME: I believe we export ac_cv_exeext for Libtool,
-	# but it would be cool to find out if it's true.  Does anybody
-	# maintain Libtool? --akim.
-	export ac_cv_exeext
+        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
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
@@ -2083,19 +2574,21 @@
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
 
-# Check the compiler produces executables we can run.  If not, either
+# Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -2114,22 +2607,27 @@
     fi
   fi
 fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
 
 rm -f a.out a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run.  If not, either
+# Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
@@ -2140,9 +2638,8 @@
 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 | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-	  export ac_cv_exeext
 	  break;;
     * ) break;;
   esac
@@ -2156,14 +2653,14 @@
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2183,14 +2680,20 @@
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  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 ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
@@ -2208,12 +2711,12 @@
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2236,49 +2739,49 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_compiler_gnu=no
+	ac_compiler_gnu=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2294,37 +2797,118 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_prog_cc_g=no
+
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+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
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$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
@@ -2340,12 +2924,12 @@
     CFLAGS=
   fi
 fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_prog_cc_stdc=no
+  ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -2379,12 +2963,17 @@
 /* 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 -std1 is added to get
+   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 -std1.  */
+   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);};
@@ -2399,223 +2988,78 @@
   return 0;
 }
 _ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX			-qlanglvl=ansi
-# Ultrix and OSF/1	-std1
-# HP-UX 10.20 and later	-Ae
-# HP-UX older versions	-Aa -D_HPUX_SOURCE
-# SVR4			-Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
   rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
 CC=$ac_save_CC
 
 fi
-
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
   *)
-    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
 esac
 
-# Some people use a C++ compiler to compile C.  Since we use `exit',
-# in C++ we need to declare it.  In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
-  choke me
-#endif
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  for ac_declaration in \
-   '' \
-   'extern "C" void std::exit (int) throw (); using std::exit;' \
-   'extern "C" void std::exit (int); using std::exit;' \
-   'extern "C" void exit (int) throw ();' \
-   'extern "C" void exit (int);' \
-   'void exit (int);'
-do
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_declaration
-#include <stdlib.h>
-int
-main ()
-{
-exit (42);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_declaration
-int
-main ()
-{
-exit (42);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
-  echo '#ifdef __cplusplus' >>confdefs.h
-  echo $ac_declaration      >>confdefs.h
-  echo '#endif'             >>confdefs.h
-fi
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-fi
-rm -f conftest.err conftest.$ac_objext 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
-
-
-echo "$as_me:$LINENO: checking whether the compiler supports complex numbers" >&5
-echo $ECHO_N "checking whether the compiler supports complex numbers... $ECHO_C" >&6
-if test "${ac_cv_cc_complex+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+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
+
+
+{ echo "$as_me:$LINENO: checking whether the compiler supports complex numbers" >&5
+echo $ECHO_N "checking whether the compiler supports complex numbers... $ECHO_C" >&6; }
+if test "${ac_cv_cc_complex+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&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 >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
@@ -2632,34 +3076,31 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_cc_complex=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_cc_complex=no
+	ac_cv_cc_complex=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
  ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2668,8 +3109,8 @@
 
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cc_complex" >&5
-echo "${ECHO_T}$ac_cv_cc_complex" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_cc_complex" >&5
+echo "${ECHO_T}$ac_cv_cc_complex" >&6; }
 if test "$ac_cv_cc_complex" = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -2680,19 +3121,19 @@
 
 
 
-   # Check whether --enable-debug or --disable-debug was given.
+   # Check whether --enable-debug was given.
 if test "${enable_debug+set}" = set; then
-  enableval="$enable_debug"
-  ac_debug=$enableval
+  enableval=$enable_debug; ac_debug=$enableval
 else
   ac_debug=no
-fi;
+fi
 
-# Check whether --with-cpu or --without-cpu was given.
+
+# Check whether --with-cpu was given.
 if test "${with_cpu+set}" = set; then
-  withval="$with_cpu"
-  ac_cpu=$withval
-fi;
+  withval=$with_cpu; ac_cpu=$withval
+fi
+
 
 
    if test x${OPTS+set} = xset ; then
@@ -2704,10 +3145,10 @@
          *) CFLAGS="$CFLAGS $opt" ;;
        esac
      done
-     echo "$as_me:$LINENO: checking user provided debugging flags" >&5
-echo $ECHO_N "checking user provided debugging flags... $ECHO_C" >&6
-     echo "$as_me:$LINENO: result: $OPTS" >&5
-echo "${ECHO_T}$OPTS" >&6
+     { echo "$as_me:$LINENO: checking user provided debugging flags" >&5
+echo $ECHO_N "checking user provided debugging flags... $ECHO_C" >&6; }
+     { echo "$as_me:$LINENO: result: $OPTS" >&5
+echo "${ECHO_T}$OPTS" >&6; }
    else
      saved_CFLAGS="$CFLAGS"
      CFLAGS=
@@ -2722,48 +3163,48 @@
        OPTS=-DNO_DEBUG
 
  opt="-Wall"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS -Wall"
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
 
  fi
 
 
  opt="-O3"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS -O3"
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
 
  opt="-O2"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS -O2"
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
 
  fi
@@ -2771,38 +3212,39 @@
  fi
 
        if test -z "$ac_cpu" ; then
-        { echo "$as_me:$LINENO: WARNING: guessing cpu type (use --with-cpu=cpuname to override.)" >&5
-echo "$as_me: WARNING: guessing cpu type (use --with-cpu=cpuname to override.)" >&2;}
+        test "$host_cpu" = "x86_64" && host_cpu="nocona"
+        { echo "$as_me:$LINENO: WARNING: guessing cpu $host_cpu (override with --with-cpu=cpuname.)" >&5
+echo "$as_me: WARNING: guessing cpu $host_cpu (override with --with-cpu=cpuname.)" >&2;}
        fi
        opt="-march=${ac_cpu-${host_cpu}}"
 
  opt="$opt"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS $opt"
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
      opt="-mcpu=${ac_cpu-${host_cpu}}"
 
  opt="$opt"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS $opt"
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
 
  fi
@@ -2812,19 +3254,19 @@
        if test -z "$ac_cpu" -a "$host_cpu" = "i686" ; then
 
  opt="-mmmx"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS -mmmx"
               { echo "$as_me:$LINENO: WARNING: use --with-cpu=cpuname to avoid assuming that MMX works." >&5
 echo "$as_me: WARNING: use --with-cpu=cpuname to avoid assuming that MMX works." >&2;}
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
 
  fi
@@ -2832,19 +3274,19 @@
             if test -r /proc/cpuinfo && grep -q sse /proc/cpuinfo ; then
 
  opt="-msse"
- echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
-echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6
+ { echo "$as_me:$LINENO: checking if $CC accepts $opt" >&5
+echo $ECHO_N "checking if $CC accepts $opt... $ECHO_C" >&6; }
  echo 'void f(){}' > conftest.c
  if test -z "`${CC} ${CFLAGS} ${OPTS} $opt -c conftest.c 2>&1`"; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
     rm conftest.*
     OPTS="$OPTS -msse"
                 { echo "$as_me:$LINENO: WARNING: use --with-cpu=cpuname to avoid assuming that SSE works." >&5
 echo "$as_me: WARNING: use --with-cpu=cpuname to avoid assuming that SSE works." >&2;}
  else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     rm conftest.*
 
  fi
@@ -2855,18 +3297,22 @@
    fi
 
 
-ac_ext=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
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+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
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2879,36 +3325,38 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6
+  { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
     test -n "$CXX" && break
   done
 fi
 if test -z "$CXX"; then
   ac_ct_CXX=$CXX
-  for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC
+  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
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2921,55 +3369,85 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-echo "${ECHO_T}$ac_ct_CXX" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$ac_ct_CXX" && break
 done
-test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
 
-  CXX=$ac_ct_CXX
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CXX=$ac_ct_CXX
+  fi
 fi
 
-
+  fi
+fi
 # Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for C++ compiler version" >&5
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
 
-echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2992,49 +3470,49 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_compiler_gnu=no
+	ac_compiler_gnu=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
 GXX=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CXXFLAGS=${CXXFLAGS+set}
 ac_save_CXXFLAGS=$CXXFLAGS
-CXXFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
 if test "${ac_cv_prog_cxx_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3050,156 +3528,133 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_prog_cxx_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_prog_cxx_g=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-echo "${ECHO_T}$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
-for ac_declaration in \
-   '' \
-   'extern "C" void std::exit (int) throw (); using std::exit;' \
-   'extern "C" void std::exit (int); using std::exit;' \
-   'extern "C" void exit (int) throw ();' \
-   'extern "C" void exit (int);' \
-   'void exit (int);'
-do
-  cat >conftest.$ac_ext <<_ACEOF
+	CXXFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_declaration
-#include <stdlib.h>
+
 int
 main ()
 {
-exit (42);
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   :
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-continue
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
+	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_declaration
+
 int
 main ()
 {
-exit (42);
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_cxx_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
+  (exit $ac_status); } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cxx_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
-  echo '#ifdef __cplusplus' >>confdefs.h
-  echo $ac_declaration      >>confdefs.h
-  echo '#endif'             >>confdefs.h
+
+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
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$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'
@@ -3211,12 +3666,12 @@
 ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_f77_compiler_gnu
 if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
   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
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3229,36 +3684,38 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 F77=$ac_cv_prog_F77
 if test -n "$F77"; then
-  echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6
+  { echo "$as_me:$LINENO: result: $F77" >&5
+echo "${ECHO_T}$F77" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
     test -n "$F77" && break
   done
 fi
 if test -z "$F77"; then
   ac_ct_F77=$F77
-  for ac_prog in g77 f77 xlf frt pgf77 fort77 fl32 af77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 ifc efc pgf95 lf95 gfortran
+  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3271,48 +3728,78 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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_F77="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_F77=$ac_cv_prog_ac_ct_F77
 if test -n "$ac_ct_F77"; then
-  echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-echo "${ECHO_T}$ac_ct_F77" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
+echo "${ECHO_T}$ac_ct_F77" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$ac_ct_F77" && break
 done
 
-  F77=$ac_ct_F77
+  if test "x$ac_ct_F77" = x; then
+    F77=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    F77=$ac_ct_F77
+  fi
 fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:3301:" \
-     "checking for Fortran 77 compiler version" >&5
+echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
@@ -3322,8 +3809,8 @@
 # input file.  (Note that this only needs to work for GNU compilers.)
 ac_save_ext=$ac_ext
 ac_ext=F
-echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
 if test "${ac_cv_f77_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3336,45 +3823,42 @@
       end
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_f77_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_compiler_gnu=no
+	ac_compiler_gnu=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_f77_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
 ac_ext=$ac_save_ext
 ac_test_FFLAGS=${FFLAGS+set}
 ac_save_FFLAGS=$FFLAGS
 FFLAGS=
-echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
+echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
 if test "${ac_cv_prog_f77_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3385,38 +3869,35 @@
       end
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_f77_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_f77_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_prog_f77_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_prog_f77_g=no
+	ac_cv_prog_f77_g=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-echo "${ECHO_T}$ac_cv_prog_f77_g" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
+echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
 if test "$ac_test_FFLAGS" = set; then
   FFLAGS=$ac_save_FFLAGS
 elif test $ac_cv_prog_f77_g = yes; then
@@ -3445,8 +3926,8 @@
 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
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -3480,24 +3961,22 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -3506,9 +3985,10 @@
   # Broken: fails on valid input.
 continue
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether non-existent headers
+  # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -3518,24 +3998,22 @@
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   # Broken: success on invalid input.
 continue
 else
@@ -3546,6 +4024,7 @@
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -3563,8 +4042,8 @@
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
@@ -3587,24 +4066,22 @@
 #endif
 		     Syntax error
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -3613,9 +4090,10 @@
   # Broken: fails on valid input.
 continue
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether non-existent headers
+  # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -3625,24 +4103,22 @@
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   # Broken: success on invalid input.
 continue
 else
@@ -3653,6 +4129,7 @@
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -3688,8 +4165,8 @@
 # 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.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -3711,7 +4188,7 @@
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	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.
@@ -3730,21 +4207,22 @@
     ;;
 esac
 done
+IFS=$as_save_IFS
 
 
 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.  We don't cache a
-    # path for INSTALL within a source directory, because that will
+    # 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 path is relative.
+    # removed, or if the value is a relative name.
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -3757,8 +4235,8 @@
 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
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3771,32 +4249,34 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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"
     echo "$as_me:$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
-  echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6
+  { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}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
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3809,46 +4289,60 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  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"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
-  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
 fi
 fi
 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
 if test -n "$ac_ct_RANLIB"; then
-  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  RANLIB=$ac_ct_RANLIB
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
 else
   RANLIB="$ac_cv_prog_RANLIB"
 fi
 
-echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
 LN_S=$as_ln_s
 if test "$LN_S" = "ln -s"; then
-  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
 else
-  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6
+  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
 fi
 
 # Extract the first word of "mv", so it can be a program name with args.
 set dummy mv; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_MV+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3863,31 +4357,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 MV=$ac_cv_path_MV
-
 if test -n "$MV"; then
-  echo "$as_me:$LINENO: result: $MV" >&5
-echo "${ECHO_T}$MV" >&6
+  { echo "$as_me:$LINENO: result: $MV" >&5
+echo "${ECHO_T}$MV" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 # Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_CP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3902,31 +4397,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 CP=$ac_cv_path_CP
-
 if test -n "$CP"; then
-  echo "$as_me:$LINENO: result: $CP" >&5
-echo "${ECHO_T}$CP" >&6
+  { echo "$as_me:$LINENO: result: $CP" >&5
+echo "${ECHO_T}$CP" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_RM+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3941,31 +4437,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 RM=$ac_cv_path_RM
-
 if test -n "$RM"; then
-  echo "$as_me:$LINENO: result: $RM" >&5
-echo "${ECHO_T}$RM" >&6
+  { echo "$as_me:$LINENO: result: $RM" >&5
+echo "${ECHO_T}$RM" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 # Extract the first word of "ar", so it can be a program name with args.
 set dummy ar; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_AR+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3980,31 +4477,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 AR=$ac_cv_path_AR
-
 if test -n "$AR"; then
-  echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6
+  { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 # Extract the first word of "touch", so it can be a program name with args.
 set dummy touch; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_TOUCH+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4019,31 +4517,32 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_TOUCH="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 TOUCH=$ac_cv_path_TOUCH
-
 if test -n "$TOUCH"; then
-  echo "$as_me:$LINENO: result: $TOUCH" >&5
-echo "${ECHO_T}$TOUCH" >&6
+  { echo "$as_me:$LINENO: result: $TOUCH" >&5
+echo "${ECHO_T}$TOUCH" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 # Extract the first word of "indent", so it can be a program name with args.
 set dummy indent; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_INDENT+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4058,37 +4557,38 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_INDENT="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 INDENT=$ac_cv_path_INDENT
-
 if test -n "$INDENT"; then
-  echo "$as_me:$LINENO: result: $INDENT" >&5
-echo "${ECHO_T}$INDENT" >&6
+  { echo "$as_me:$LINENO: result: $INDENT" >&5
+echo "${ECHO_T}$INDENT" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
 
-if test -x $INDENT ; then
-  echo "$as_me:$LINENO: checking if $INDENT accepts GNU options" >&5
-echo $ECHO_N "checking if $INDENT accepts GNU options... $ECHO_C" >&6
+
+if test -x "$INDENT" ; then
+  { echo "$as_me:$LINENO: checking if $INDENT accepts GNU options" >&5
+echo $ECHO_N "checking if $INDENT accepts GNU options... $ECHO_C" >&6; }
   if $INDENT -gnu </dev/null 2>/dev/null ; then
-    echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+    { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
   else
-    echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+    { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
     unset INDENT
   fi
 fi
@@ -4100,8 +4600,8 @@
 
 # misc
 
-echo "$as_me:$LINENO: checking for sqrt in -lm" >&5
-echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for sqrt in -lm" >&5
+echo $ECHO_N "checking for sqrt in -lm... $ECHO_C" >&6; }
 if test "${ac_cv_lib_m_sqrt+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4114,55 +4614,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char sqrt ();
 int
 main ()
 {
-sqrt ();
+return sqrt ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_m_sqrt=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_m_sqrt=no
+	ac_cv_lib_m_sqrt=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5
-echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_sqrt" >&5
+echo "${ECHO_T}$ac_cv_lib_m_sqrt" >&6; }
 if test $ac_cv_lib_m_sqrt = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBM 1
@@ -4173,8 +4671,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
 if test "${ac_cv_lib_dl_dlopen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4187,55 +4685,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char dlopen ();
 int
 main ()
 {
-dlopen ();
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_dl_dlopen=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dl_dlopen=no
+	ac_cv_lib_dl_dlopen=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
 if test $ac_cv_lib_dl_dlopen = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBDL 1
@@ -4246,8 +4742,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
 if test "${ac_cv_lib_dld_shl_load+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4260,55 +4756,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char shl_load ();
 int
 main ()
 {
-shl_load ();
+return shl_load ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_dld_shl_load=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dld_shl_load=no
+	ac_cv_lib_dld_shl_load=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
 if test $ac_cv_lib_dld_shl_load = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBDLD 1
@@ -4319,8 +4813,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for openpty in -lutil" >&5
-echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for openpty in -lutil" >&5
+echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6; }
 if test "${ac_cv_lib_util_openpty+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4333,55 +4827,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char openpty ();
 int
 main ()
 {
-openpty ();
+return openpty ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_util_openpty=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_util_openpty=no
+	ac_cv_lib_util_openpty=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5
-echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5
+echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6; }
 if test $ac_cv_lib_util_openpty = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBUTIL 1
@@ -4398,9 +4890,9 @@
 for ac_func in NSLinkModule
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -4426,67 +4918,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -4498,11 +4983,11 @@
 
 # bfd
 
-# Check whether --with-bfd or --without-bfd was given.
+# Check whether --with-bfd was given.
 if test "${with_bfd+set}" = set; then
-  withval="$with_bfd"
-  require_bfd=$withval
-fi;
+  withval=$with_bfd; require_bfd=$withval
+fi
+
 
 if test x$require_bfd = xno ; then
     BFD_YES='#'
@@ -4510,8 +4995,8 @@
     BFD_YES=''
     has_bfd=yes
 
-echo "$as_me:$LINENO: checking for xmalloc in -liberty" >&5
-echo $ECHO_N "checking for xmalloc in -liberty... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for xmalloc in -liberty" >&5
+echo $ECHO_N "checking for xmalloc in -liberty... $ECHO_C" >&6; }
 if test "${ac_cv_lib_iberty_xmalloc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4524,55 +5009,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char xmalloc ();
 int
 main ()
 {
-xmalloc ();
+return xmalloc ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_iberty_xmalloc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_iberty_xmalloc=no
+	ac_cv_lib_iberty_xmalloc=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_xmalloc" >&5
-echo "${ECHO_T}$ac_cv_lib_iberty_xmalloc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_xmalloc" >&5
+echo "${ECHO_T}$ac_cv_lib_iberty_xmalloc" >&6; }
 if test $ac_cv_lib_iberty_xmalloc = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBIBERTY 1
@@ -4584,8 +5067,8 @@
 
     if test $ac_cv_lib_iberty_xmalloc = no; then
 
-echo "$as_me:$LINENO: checking for mmalloc in -lmmalloc" >&5
-echo $ECHO_N "checking for mmalloc in -lmmalloc... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for mmalloc in -lmmalloc" >&5
+echo $ECHO_N "checking for mmalloc in -lmmalloc... $ECHO_C" >&6; }
 if test "${ac_cv_lib_mmalloc_mmalloc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4598,55 +5081,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char mmalloc ();
 int
 main ()
 {
-mmalloc ();
+return mmalloc ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_mmalloc_mmalloc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_mmalloc_mmalloc=no
+	ac_cv_lib_mmalloc_mmalloc=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_mmalloc_mmalloc" >&5
-echo "${ECHO_T}$ac_cv_lib_mmalloc_mmalloc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_mmalloc_mmalloc" >&5
+echo "${ECHO_T}$ac_cv_lib_mmalloc_mmalloc" >&6; }
 if test $ac_cv_lib_mmalloc_mmalloc = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBMMALLOC 1
@@ -4657,8 +5138,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for xcalloc in -liberty" >&5
-echo $ECHO_N "checking for xcalloc in -liberty... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for xcalloc in -liberty" >&5
+echo $ECHO_N "checking for xcalloc in -liberty... $ECHO_C" >&6; }
 if test "${ac_cv_lib_iberty_xcalloc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4671,55 +5152,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char xcalloc ();
 int
 main ()
 {
-xcalloc ();
+return xcalloc ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_iberty_xcalloc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_iberty_xcalloc=no
+	ac_cv_lib_iberty_xcalloc=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_xcalloc" >&5
-echo "${ECHO_T}$ac_cv_lib_iberty_xcalloc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_iberty_xcalloc" >&5
+echo "${ECHO_T}$ac_cv_lib_iberty_xcalloc" >&6; }
 if test $ac_cv_lib_iberty_xcalloc = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBIBERTY 1
@@ -4731,23 +5210,170 @@
 
     fi
 
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    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
+    ac_count=`expr $ac_count + 1`
+    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
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_GREP=$GREP
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  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
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    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
+    ac_count=`expr $ac_count + 1`
+    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
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+else
+  ac_cv_path_EGREP=$EGREP
+fi
+
+
+   fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
 
 
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4771,34 +5397,31 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_stdc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_stdc=no
+	ac_cv_header_stdc=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+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.
@@ -4854,6 +5477,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* 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))
@@ -4873,18 +5497,27 @@
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
 	|| toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
+      return 2;
+  return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -4897,12 +5530,14 @@
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -4925,9 +5560,9 @@
 		  inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -4941,37 +5576,35 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+	eval "$as_ac_Header=no"
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -4983,17 +5616,17 @@
 
 
 if test "${ac_cv_header_bfd_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for bfd.h" >&5
-echo $ECHO_N "checking for bfd.h... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for bfd.h" >&5
+echo $ECHO_N "checking for bfd.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_bfd_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_bfd_h" >&5
-echo "${ECHO_T}$ac_cv_header_bfd_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_bfd_h" >&5
+echo "${ECHO_T}$ac_cv_header_bfd_h" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking bfd.h usability" >&5
-echo $ECHO_N "checking bfd.h usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking bfd.h usability" >&5
+echo $ECHO_N "checking bfd.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5004,40 +5637,37 @@
 #include <bfd.h>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking bfd.h presence" >&5
-echo $ECHO_N "checking bfd.h presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking bfd.h presence" >&5
+echo $ECHO_N "checking bfd.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5046,24 +5676,22 @@
 /* end confdefs.h.  */
 #include <bfd.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -5071,9 +5699,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -5097,25 +5726,18 @@
 echo "$as_me: WARNING: bfd.h: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: bfd.h: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: bfd.h: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for bfd.h" >&5
-echo $ECHO_N "checking for bfd.h... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for bfd.h" >&5
+echo $ECHO_N "checking for bfd.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_bfd_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_header_bfd_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_bfd_h" >&5
-echo "${ECHO_T}$ac_cv_header_bfd_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_bfd_h" >&5
+echo "${ECHO_T}$ac_cv_header_bfd_h" >&6; }
 
 fi
 if test $ac_cv_header_bfd_h = yes; then
@@ -5126,8 +5748,8 @@
 
 
 
-echo "$as_me:$LINENO: checking for bfd_init in -lbfd" >&5
-echo $ECHO_N "checking for bfd_init in -lbfd... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for bfd_init in -lbfd" >&5
+echo $ECHO_N "checking for bfd_init in -lbfd... $ECHO_C" >&6; }
 if test "${ac_cv_lib_bfd_bfd_init+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5140,55 +5762,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char bfd_init ();
 int
 main ()
 {
-bfd_init ();
+return bfd_init ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_bfd_bfd_init=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_bfd_bfd_init=no
+	ac_cv_lib_bfd_bfd_init=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_bfd_bfd_init" >&5
-echo "${ECHO_T}$ac_cv_lib_bfd_bfd_init" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_bfd_bfd_init" >&5
+echo "${ECHO_T}$ac_cv_lib_bfd_bfd_init" >&6; }
 if test $ac_cv_lib_bfd_bfd_init = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBBFD 1
@@ -5207,8 +5827,8 @@
 if test x$has_bfd = xyes ; then
     n_LIBS=$LIBS
     has_intl=
-    echo "$as_me:$LINENO: checking for dcgettext in -lintl" >&5
-echo $ECHO_N "checking for dcgettext in -lintl... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for dcgettext in -lintl" >&5
+echo $ECHO_N "checking for dcgettext in -lintl... $ECHO_C" >&6; }
 if test "${ac_cv_lib_intl_dcgettext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5221,55 +5841,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char dcgettext ();
 int
 main ()
 {
-dcgettext ();
+return dcgettext ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_intl_dcgettext=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_intl_dcgettext=no
+	ac_cv_lib_intl_dcgettext=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_intl_dcgettext" >&5
-echo "${ECHO_T}$ac_cv_lib_intl_dcgettext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_dcgettext" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_dcgettext" >&6; }
 if test $ac_cv_lib_intl_dcgettext = yes; then
   has_intl=yes
 else
@@ -5280,8 +5898,8 @@
     sn_LIBS=`echo $n_LIBS | sed -e 's/-lbfd\( -liberty\)*/-Wl,-Bstatic & -Wl,-Bdynamic/'`
     si_LIBS=`echo $i_LIBS | sed -e 's/-lbfd\( -liberty\)*/-Wl,-Bstatic & -Wl,-Bdynamic/'`
     LIBS=$sn_LIBS
-    echo "$as_me:$LINENO: checking whether bfd works with -Bstatic" >&5
-echo $ECHO_N "checking whether bfd works with -Bstatic... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking whether bfd works with -Bstatic" >&5
+echo $ECHO_N "checking whether bfd works with -Bstatic... $ECHO_C" >&6; }
     cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5298,42 +5916,40 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   okay_bfd=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-okay_bfd=no
+	okay_bfd=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext;
-    echo "$as_me:$LINENO: result: $okay_bfd" >&5
-echo "${ECHO_T}$okay_bfd" >&6
+    { echo "$as_me:$LINENO: result: $okay_bfd" >&5
+echo "${ECHO_T}$okay_bfd" >&6; }
     if test x$okay_bfd = xno ; then
 	if test x$has_intl = xyes ; then
 	    LIBS=$si_LIBS
-	    echo "$as_me:$LINENO: checking whether bfd works with -Bstatic and -lintl" >&5
-echo $ECHO_N "checking whether bfd works with -Bstatic and -lintl... $ECHO_C" >&6
+	    { echo "$as_me:$LINENO: checking whether bfd works with -Bstatic and -lintl" >&5
+echo $ECHO_N "checking whether bfd works with -Bstatic and -lintl... $ECHO_C" >&6; }
 	    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5350,42 +5966,40 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   okay_bfd=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-okay_bfd=no
+	okay_bfd=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext;
-	    echo "$as_me:$LINENO: result: $okay_bfd" >&5
-echo "${ECHO_T}$okay_bfd" >&6
+	    { echo "$as_me:$LINENO: result: $okay_bfd" >&5
+echo "${ECHO_T}$okay_bfd" >&6; }
 	fi
 	if test x$okay_bfd = xno ; then
 	    LIBS=$n_LIBS
-	    echo "$as_me:$LINENO: checking whether bfd works alone" >&5
-echo $ECHO_N "checking whether bfd works alone... $ECHO_C" >&6
+	    { echo "$as_me:$LINENO: checking whether bfd works alone" >&5
+echo $ECHO_N "checking whether bfd works alone... $ECHO_C" >&6; }
 	    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5402,42 +6016,40 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   okay_bfd=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-okay_bfd=no
+	okay_bfd=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext;
-	    echo "$as_me:$LINENO: result: $okay_bfd" >&5
-echo "${ECHO_T}$okay_bfd" >&6
+	    { echo "$as_me:$LINENO: result: $okay_bfd" >&5
+echo "${ECHO_T}$okay_bfd" >&6; }
 	    if test x$okay_bfd = xno ; then
 		if test x$has_intl = xyes ; then
 		    LIBS=$i_LIBS
-		    echo "$as_me:$LINENO: checking whether bfd works with -lintl" >&5
-echo $ECHO_N "checking whether bfd works with -lintl... $ECHO_C" >&6
+		    { echo "$as_me:$LINENO: checking whether bfd works with -lintl" >&5
+echo $ECHO_N "checking whether bfd works with -lintl... $ECHO_C" >&6; }
 		    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5454,37 +6066,35 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   okay_bfd=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-okay_bfd=no
+	okay_bfd=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext;
-		    echo "$as_me:$LINENO: result: $okay_bfd" >&5
-echo "${ECHO_T}$okay_bfd" >&6
+		    { echo "$as_me:$LINENO: result: $okay_bfd" >&5
+echo "${ECHO_T}$okay_bfd" >&6; }
 		fi
 		if test x$okay_bfd = xno ; then
 		    LIBS=$n_LIBS
@@ -5493,8 +6103,8 @@
 	fi
     fi
     if test x$okay_bfd = xyes ; then
-	echo "$as_me:$LINENO: checking whether bfd_hash_table_init wants two arguments" >&5
-echo $ECHO_N "checking whether bfd_hash_table_init wants two arguments... $ECHO_C" >&6
+	{ echo "$as_me:$LINENO: checking whether bfd_hash_table_init wants two arguments" >&5
+echo $ECHO_N "checking whether bfd_hash_table_init wants two arguments... $ECHO_C" >&6; }
         cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -5511,36 +6121,33 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   bfd_hash_init_2_args=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-bfd_hash_init_2_args=no
+	bfd_hash_init_2_args=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-        echo "$as_me:$LINENO: result: $bfd_hash_init_2_args" >&5
-echo "${ECHO_T}$bfd_hash_init_2_args" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+        { echo "$as_me:$LINENO: result: $bfd_hash_init_2_args" >&5
+echo "${ECHO_T}$bfd_hash_init_2_args" >&6; }
         if test x$bfd_hash_init_2_args = xyes ; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -5579,47 +6186,49 @@
 fi
 
 # x11
+{ echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6; }
 
-if test "x$ac_path_x_has_been_run" != xyes; then
-  echo "$as_me:$LINENO: checking for X" >&5
-echo $ECHO_N "checking for X... $ECHO_C" >&6
 
-ac_path_x_has_been_run=yes
-
-# Check whether --with-x or --without-x was given.
+# Check whether --with-x was given.
 if test "${with_x+set}" = set; then
-  withval="$with_x"
+  withval=$with_x;
+fi
 
-fi;
 # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
 if test "x$with_x" = xno; then
   # The user explicitly disabled X.
   have_x=disabled
 else
-  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-    # Both variables are already set.
-    have_x=yes
-  else
-    if test "${ac_cv_have_x+set}" = set; then
+  case $x_includes,$x_libraries in #(
+    *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5
+echo "$as_me: error: Cannot use X directory names containing '" >&2;}
+   { (exit 1); exit 1; }; };; #(
+    *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   # One or both of the vars are not set, and there is no cached value.
 ac_x_includes=no ac_x_libraries=no
-rm -fr conftest.dir
+rm -f -r conftest.dir
 if mkdir conftest.dir; then
   cd conftest.dir
-  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
   cat >Imakefile <<'_ACEOF'
-acfindx:
-	@echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
+incroot:
+	@echo incroot='${INCROOT}'
+usrlibdir:
+	@echo usrlibdir='${USRLIBDIR}'
+libdir:
+	@echo libdir='${LIBDIR}'
 _ACEOF
-  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
     # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    for ac_var in incroot usrlibdir libdir; do
+      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
+    done
     # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
     for ac_extension in a so sl; do
-      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
-	 test -f $ac_im_libdir/libX11.$ac_extension; then
+      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+	 test -f "$ac_im_libdir/libX11.$ac_extension"; then
 	ac_im_usrlibdir=$ac_im_libdir; break
       fi
     done
@@ -5627,7 +6236,7 @@
     # bogus both because they are the default anyway, and because
     # using them would break gcc on systems where it needs fixed includes.
     case $ac_im_incroot in
-	/usr/include) ;;
+	/usr/include) ac_x_includes= ;;
 	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
     esac
     case $ac_im_usrlibdir in
@@ -5636,7 +6245,7 @@
     esac
   fi
   cd ..
-  rm -fr conftest.dir
+  rm -f -r conftest.dir
 fi
 
 # Standard set of common directories for X headers.
@@ -5677,7 +6286,7 @@
 /usr/openwin/share/include'
 
 if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for a specified header file.
+  # Guess where to find include files, by looking for Xlib.h.
   # First, try using that file with no special directory specified.
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
@@ -5685,26 +6294,24 @@
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   # We can compile using X headers with no special include directory.
 ac_x_includes=
 else
@@ -5712,12 +6319,13 @@
 sed 's/^/| /' conftest.$ac_ext >&5
 
   for ac_dir in $ac_x_header_dirs; do
-  if test -r "$ac_dir/X11/Intrinsic.h"; then
+  if test -r "$ac_dir/X11/Xlib.h"; then
     ac_x_includes=$ac_dir
     break
   fi
 done
 fi
+
 rm -f conftest.err conftest.$ac_ext
 fi # $ac_x_includes = no
 
@@ -5726,43 +6334,40 @@
   # See if we find them without any special options.
   # Don't add to $LIBS permanently.
   ac_save_LIBS=$LIBS
-  LIBS="-lXt $LIBS"
+  LIBS="-lX11 $LIBS"
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
 int
 main ()
 {
-XtMalloc (0)
+XrmInitialize ()
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   LIBS=$ac_save_LIBS
 # We can link X programs with no special library path.
 ac_x_libraries=
@@ -5770,56 +6375,56 @@
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-LIBS=$ac_save_LIBS
+	LIBS=$ac_save_LIBS
 for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
 do
   # Don't even attempt the hair of trying to link an X program!
   for ac_extension in a so sl; do
-    if test -r $ac_dir/libXt.$ac_extension; then
+    if test -r "$ac_dir/libX11.$ac_extension"; then
       ac_x_libraries=$ac_dir
       break 2
     fi
   done
 done
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi # $ac_x_libraries = no
 
-if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
-  # Didn't find X anywhere.  Cache the known absence of X.
-  ac_cv_have_x="have_x=no"
-else
-  # Record where we found X for the cache.
-  ac_cv_have_x="have_x=yes \
-		ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
-fi
+case $ac_x_includes,$ac_x_libraries in #(
+  no,* | *,no | *\'*)
+    # Didn't find X, or a directory has "'" in its name.
+    ac_cv_have_x="have_x=no";; #(
+  *)
+    # Record where we found X for the cache.
+    ac_cv_have_x="have_x=yes\
+	ac_x_includes='$ac_x_includes'\
+	ac_x_libraries='$ac_x_libraries'"
+esac
 fi
-
-  fi
+;; #(
+    *) have_x=yes;;
+  esac
   eval "$ac_cv_have_x"
 fi # $with_x != no
 
 if test "$have_x" != yes; then
-  echo "$as_me:$LINENO: result: $have_x" >&5
-echo "${ECHO_T}$have_x" >&6
+  { echo "$as_me:$LINENO: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6; }
   no_x=yes
 else
   # If each of the values was on the command line, it overrides each guess.
   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
   # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes \
-		ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  # It might be that x_includes is empty (headers are found in the
-  # standard search path. Then output the corresponding message
-  ac_out_x_includes=$x_includes
-  test "x$x_includes" = x && ac_out_x_includes="in standard search path"
-  echo "$as_me:$LINENO: result: libraries $x_libraries, headers $ac_out_x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $ac_out_x_includes" >&6
+  ac_cv_have_x="have_x=yes\
+	ac_x_includes='$x_includes'\
+	ac_x_libraries='$x_libraries'"
+  { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; }
 fi
 
-fi
 if test "$no_x" = yes; then
   # Not all programs may use this symbol, but it does not hurt to define it.
 
@@ -5838,12 +6443,12 @@
     X_LIBS="$X_LIBS -L$x_libraries"
     # For Solaris; some versions of Sun CC require a space after -R and
     # others require no space.  Words are not sufficient . . . .
-    case `(uname -sr) 2>/dev/null` in
-    "SunOS 5"*)
-      echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
-echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
-      ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-      cat >conftest.$ac_ext <<_ACEOF
+    { echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6; }
+    ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
+    ac_xsave_c_werror_flag=$ac_c_werror_flag
+    ac_c_werror_flag=yes
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5859,42 +6464,32 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_R_nospace=yes
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+       X_LIBS="$X_LIBS -R$x_libraries"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_R_nospace=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-      if test $ac_R_nospace = yes; then
-	echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-	X_LIBS="$X_LIBS -R$x_libraries"
-      else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
-	cat >conftest.$ac_ext <<_ACEOF
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5910,46 +6505,42 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_R_space=yes
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+	  X_LIBS="$X_LIBS -R $x_libraries"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_R_space=no
+	{ echo "$as_me:$LINENO: result: neither works" >&5
+echo "${ECHO_T}neither works" >&6; }
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
-	if test $ac_R_space = yes; then
-	  echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-	  X_LIBS="$X_LIBS -R $x_libraries"
-	else
-	  echo "$as_me:$LINENO: result: neither works" >&5
-echo "${ECHO_T}neither works" >&6
-	fi
-      fi
-      LIBS=$ac_xsave_LIBS
-    esac
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+    ac_c_werror_flag=$ac_xsave_c_werror_flag
+    LIBS=$ac_xsave_LIBS
   fi
 
   # Check for system-dependent libraries X programs must link with.
@@ -5970,49 +6561,46 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char XOpenDisplay ();
 int
 main ()
 {
-XOpenDisplay ();
+return XOpenDisplay ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   :
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
-echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6
+	{ echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6; }
 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6025,62 +6613,60 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char dnet_ntoa ();
 int
 main ()
 {
-dnet_ntoa ();
+return dnet_ntoa ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_dnet_dnet_ntoa=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dnet_dnet_ntoa=no
+	ac_cv_lib_dnet_dnet_ntoa=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6; }
 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
 fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-      echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5
-echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6; }
 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6093,62 +6679,61 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char dnet_ntoa ();
 int
 main ()
 {
-dnet_ntoa ();
+return dnet_ntoa ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_dnet_stub_dnet_ntoa=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dnet_stub_dnet_ntoa=no
+	ac_cv_lib_dnet_stub_dnet_ntoa=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
 fi
 
     fi
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
     LIBS="$ac_xsave_LIBS"
 
@@ -6160,8 +6745,8 @@
     # on Irix 5.2, according to T.E. Dickey.
     # The functions gethostbyname, getservbyname, and inet_addr are
     # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-    echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for gethostbyname" >&5
+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6; }
 if test "${ac_cv_func_gethostbyname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6188,71 +6773,63 @@
 
 #undef gethostbyname
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char gethostbyname ();
 /* 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_gethostbyname) || defined (__stub___gethostbyname)
+#if defined __stub_gethostbyname || defined __stub___gethostbyname
 choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != gethostbyname;
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_gethostbyname=no
+	ac_cv_func_gethostbyname=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6; }
 
     if test $ac_cv_func_gethostbyname = no; then
-      echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; }
 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6265,62 +6842,60 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char gethostbyname ();
 int
 main ()
 {
-gethostbyname ();
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_nsl_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_nsl_gethostbyname=no
+	ac_cv_lib_nsl_gethostbyname=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; }
 if test $ac_cv_lib_nsl_gethostbyname = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
 fi
 
       if test $ac_cv_lib_nsl_gethostbyname = no; then
-	echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5
-echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6
+	{ echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5
+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6; }
 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6333,55 +6908,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char gethostbyname ();
 int
 main ()
 {
-gethostbyname ();
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_bsd_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_bsd_gethostbyname=no
+	ac_cv_lib_bsd_gethostbyname=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6; }
 if test $ac_cv_lib_bsd_gethostbyname = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
 fi
@@ -6396,8 +6969,8 @@
     # variants that don't use the name server (or something).  -lsocket
     # must be given before -lnsl if both are needed.  We assume that
     # if connect needs -lnsl, so does gethostbyname.
-    echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for connect" >&5
+echo $ECHO_N "checking for connect... $ECHO_C" >&6; }
 if test "${ac_cv_func_connect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6424,71 +6997,63 @@
 
 #undef connect
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char connect ();
 /* 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_connect) || defined (__stub___connect)
+#if defined __stub_connect || defined __stub___connect
 choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != connect;
+return connect ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_connect=no
+	ac_cv_func_connect=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
+echo "${ECHO_T}$ac_cv_func_connect" >&6; }
 
     if test $ac_cv_func_connect = no; then
-      echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6; }
 if test "${ac_cv_lib_socket_connect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6501,55 +7066,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char connect ();
 int
 main ()
 {
-connect ();
+return connect ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_socket_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_socket_connect=no
+	ac_cv_lib_socket_connect=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6; }
 if test $ac_cv_lib_socket_connect = yes; then
   X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
 fi
@@ -6557,8 +7120,8 @@
     fi
 
     # Guillermo Gomez says -lposix is necessary on A/UX.
-    echo "$as_me:$LINENO: checking for remove" >&5
-echo $ECHO_N "checking for remove... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for remove" >&5
+echo $ECHO_N "checking for remove... $ECHO_C" >&6; }
 if test "${ac_cv_func_remove+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6585,71 +7148,63 @@
 
 #undef remove
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char remove ();
 /* 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_remove) || defined (__stub___remove)
+#if defined __stub_remove || defined __stub___remove
 choke me
-#else
-char (*f) () = remove;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != remove;
+return remove ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_remove=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_remove=no
+	ac_cv_func_remove=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5
-echo "${ECHO_T}$ac_cv_func_remove" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5
+echo "${ECHO_T}$ac_cv_func_remove" >&6; }
 
     if test $ac_cv_func_remove = no; then
-      echo "$as_me:$LINENO: checking for remove in -lposix" >&5
-echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for remove in -lposix" >&5
+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6; }
 if test "${ac_cv_lib_posix_remove+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6662,55 +7217,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char remove ();
 int
 main ()
 {
-remove ();
+return remove ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_posix_remove=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_posix_remove=no
+	ac_cv_lib_posix_remove=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5
-echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5
+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6; }
 if test $ac_cv_lib_posix_remove = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
 fi
@@ -6718,8 +7271,8 @@
     fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    echo "$as_me:$LINENO: checking for shmat" >&5
-echo $ECHO_N "checking for shmat... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for shmat" >&5
+echo $ECHO_N "checking for shmat... $ECHO_C" >&6; }
 if test "${ac_cv_func_shmat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6746,71 +7299,63 @@
 
 #undef shmat
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char shmat ();
 /* 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_shmat) || defined (__stub___shmat)
+#if defined __stub_shmat || defined __stub___shmat
 choke me
-#else
-char (*f) () = shmat;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != shmat;
+return shmat ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_shmat=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_shmat=no
+	ac_cv_func_shmat=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5
-echo "${ECHO_T}$ac_cv_func_shmat" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5
+echo "${ECHO_T}$ac_cv_func_shmat" >&6; }
 
     if test $ac_cv_func_shmat = no; then
-      echo "$as_me:$LINENO: checking for shmat in -lipc" >&5
-echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for shmat in -lipc" >&5
+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6; }
 if test "${ac_cv_lib_ipc_shmat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6823,55 +7368,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char shmat ();
 int
 main ()
 {
-shmat ();
+return shmat ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_ipc_shmat=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ipc_shmat=no
+	ac_cv_lib_ipc_shmat=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5
-echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5
+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6; }
 if test $ac_cv_lib_ipc_shmat = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
 fi
@@ -6888,8 +7431,8 @@
   # These have to be linked with before -lX11, unlike the other
   # libraries we check for below, so use a different variable.
   # John Interrante, Karl Berry
-  echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5
-echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5
+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6; }
 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6902,55 +7445,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char IceConnectionNumber ();
 int
 main ()
 {
-IceConnectionNumber ();
+return IceConnectionNumber ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_ICE_IceConnectionNumber=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ICE_IceConnectionNumber=no
+	ac_cv_lib_ICE_IceConnectionNumber=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
-echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then
   X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
 fi
@@ -6968,8 +7509,8 @@
 
   # Extract the first word of "pkg-config", so it can be a program name with args.
 set dummy pkg-config; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_PKGCONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6984,32 +7525,33 @@
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PKGCONFIG="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 PKGCONFIG=$ac_cv_path_PKGCONFIG
-
 if test -n "$PKGCONFIG"; then
-  echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
-echo "${ECHO_T}$PKGCONFIG" >&6
+  { echo "$as_me:$LINENO: result: $PKGCONFIG" >&5
+echo "${ECHO_T}$PKGCONFIG" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
 
 
 
-  echo "$as_me:$LINENO: checking for library Xft" >&5
-echo $ECHO_N "checking for library Xft... $ECHO_C" >&6
+
+  { echo "$as_me:$LINENO: checking for library Xft" >&5
+echo $ECHO_N "checking for library Xft... $ECHO_C" >&6; }
 if test "${ac_cv_cc_xft+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7049,8 +7591,8 @@
     fi
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_cc_xft" >&5
-echo "${ECHO_T}$ac_cv_cc_xft" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_cc_xft" >&5
+echo "${ECHO_T}$ac_cv_cc_xft" >&6; }
   if test x$ac_cv_cc_xft = xyes ; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -7073,17 +7615,17 @@
 # First, check if the POSIX threads header, pthread.h, is available.
 # If it isn't, don't bother looking for the threads libraries.
 if test "${ac_cv_header_pthread_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for pthread.h" >&5
-echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for pthread.h" >&5
+echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_pthread_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
-echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking pthread.h usability" >&5
-echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking pthread.h usability" >&5
+echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7094,40 +7636,37 @@
 #include <pthread.h>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking pthread.h presence" >&5
-echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking pthread.h presence" >&5
+echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7136,24 +7675,22 @@
 /* end confdefs.h.  */
 #include <pthread.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -7161,9 +7698,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -7187,25 +7725,18 @@
 echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: pthread.h: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: pthread.h: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for pthread.h" >&5
-echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for pthread.h" >&5
+echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_pthread_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_header_pthread_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
-echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+echo "${ECHO_T}$ac_cv_header_pthread_h" >&6; }
 
 fi
 if test $ac_cv_header_pthread_h = yes; then
@@ -7229,8 +7760,8 @@
         CXXFLAGS="$CXXFLAGS $PTHREAD_FLAGS"
         save_LIBS="$LIBS"
         LIBS="$PTHREAD_LIBS $LIBS"
-        echo "$as_me:$LINENO: checking provided PTHREAD_LIBS/PTHREAD_FLAGS." >&5
-echo $ECHO_N "checking provided PTHREAD_LIBS/PTHREAD_FLAGS.... $ECHO_C" >&6
+        { echo "$as_me:$LINENO: checking provided PTHREAD_LIBS/PTHREAD_FLAGS." >&5
+echo $ECHO_N "checking provided PTHREAD_LIBS/PTHREAD_FLAGS.... $ECHO_C" >&6; }
         cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7238,52 +7769,51 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char pthread_join ();
 int
 main ()
 {
-pthread_join ();
+return pthread_join ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   acx_pthread_ok=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
-        echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
-echo "${ECHO_T}$acx_pthread_ok" >&6
+        { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+echo "${ECHO_T}$acx_pthread_ok" >&6; }
         if test x"$acx_pthread_ok" = xno; then
                 PTHREAD_LIBS=""
                 PTHREAD_FLAGS=""
@@ -7330,17 +7860,17 @@
 for flag in $acx_pthread_flags; do
         case $flag in
                 none)
-                echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
-echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6
+                { echo "$as_me:$LINENO: checking whether pthreads work without any flags" >&5
+echo $ECHO_N "checking whether pthreads work without any flags... $ECHO_C" >&6; }
                 ;;
                 -*)
-                echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
-echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6
+                { echo "$as_me:$LINENO: checking whether pthreads work with $flag" >&5
+echo $ECHO_N "checking whether pthreads work with $flag... $ECHO_C" >&6; }
                 PTHREAD_FLAGS="$flag"
                 ;;
                 *)
-                echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
-echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6
+                { echo "$as_me:$LINENO: checking for the pthreads library -l$flag" >&5
+echo $ECHO_N "checking for the pthreads library -l$flag... $ECHO_C" >&6; }
                 PTHREAD_LIBS="-l$flag"
                 ;;
         esac
@@ -7377,39 +7907,38 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   acx_pthread_ok=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
         LIBS="$save_LIBS"
         CFLAGS="$save_CFLAGS"
         CXXFLAGS="$save_CXXFLAGS"
-        echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
-echo "${ECHO_T}$acx_pthread_ok" >&6
+        { echo "$as_me:$LINENO: result: $acx_pthread_ok" >&5
+echo "${ECHO_T}$acx_pthread_ok" >&6; }
         if test "x$acx_pthread_ok" = xyes; then
                 break;
         fi
@@ -7425,15 +7954,15 @@
         CFLAGS="$CFLAGS $PTHREAD_FLAGS"
         save_CXXFLAGS="$CXXFLAGS"
         CXXFLAGS="$CXXFLAGS $PTHREAD_FLAGS"
-        echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
-echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6
+        { echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
+echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6; }
         flag=no
         case "${host_cpu}-${host_os}" in
                 *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
                 *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
         esac
-        echo "$as_me:$LINENO: result: ${flag}" >&5
-echo "${ECHO_T}${flag}" >&6
+        { echo "$as_me:$LINENO: result: ${flag}" >&5
+echo "${ECHO_T}${flag}" >&6; }
         if test "x$flag" != xno; then
                 PTHREAD_FLAGS="$flag $PTHREAD_FLAGS"
         fi
@@ -7458,8 +7987,8 @@
 
 # readline
 
-echo "$as_me:$LINENO: checking for tputs in -lcurses" >&5
-echo $ECHO_N "checking for tputs in -lcurses... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for tputs in -lcurses" >&5
+echo $ECHO_N "checking for tputs in -lcurses... $ECHO_C" >&6; }
 if test "${ac_cv_lib_curses_tputs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7472,55 +8001,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char tputs ();
 int
 main ()
 {
-tputs ();
+return tputs ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_curses_tputs=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_curses_tputs=no
+	ac_cv_lib_curses_tputs=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tputs" >&5
-echo "${ECHO_T}$ac_cv_lib_curses_tputs" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tputs" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_tputs" >&6; }
 if test $ac_cv_lib_curses_tputs = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBCURSES 1
@@ -7531,8 +8058,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
-echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
+echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
 if test "${ac_cv_lib_readline_readline+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7545,55 +8072,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char readline ();
 int
 main ()
 {
-readline ();
+return readline ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_readline_readline=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_readline_readline=no
+	ac_cv_lib_readline_readline=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
-echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
+echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
 if test $ac_cv_lib_readline_readline = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBREADLINE 1
@@ -7604,9 +8129,9 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for iconv_open in -liconv" >&5
-echo $ECHO_N "checking for iconv_open in -liconv... $ECHO_C" >&6
-if test "${ac_cv_lib_iconv_iconv_open+set}" = set; then
+{ echo "$as_me:$LINENO: checking for libiconv_open in -liconv" >&5
+echo $ECHO_N "checking for libiconv_open in -liconv... $ECHO_C" >&6; }
+if test "${ac_cv_lib_iconv_libiconv_open+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -7618,56 +8143,54 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char iconv_open ();
+char libiconv_open ();
 int
 main ()
 {
-iconv_open ();
+return libiconv_open ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_iconv_iconv_open=yes
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_iconv_libiconv_open=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_iconv_iconv_open=no
+	ac_cv_lib_iconv_libiconv_open=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_iconv_open" >&5
-echo "${ECHO_T}$ac_cv_lib_iconv_iconv_open" >&6
-if test $ac_cv_lib_iconv_iconv_open = yes; then
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv_open" >&5
+echo "${ECHO_T}$ac_cv_lib_iconv_libiconv_open" >&6; }
+if test $ac_cv_lib_iconv_libiconv_open = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBICONV 1
 _ACEOF
@@ -7683,8 +8206,8 @@
 # Header Files
 # ----------------------------------------
 
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -7708,34 +8231,31 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_stdc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_stdc=no
+	ac_cv_header_stdc=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+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.
@@ -7791,6 +8311,7 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* 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))
@@ -7810,18 +8331,27 @@
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
 	|| toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
+      return 2;
+  return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -7834,12 +8364,14 @@
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -7856,9 +8388,9 @@
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
-echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -7880,37 +8412,35 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+	eval "$as_ac_Header=no"
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
@@ -7922,13 +8452,12 @@
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
 if test "${ac_cv_search_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -7936,124 +8465,83 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char opendir ();
 int
 main ()
 {
-opendir ();
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="none required"
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_opendir" = no; then
-  for ac_lib in dir; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-  done
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
 fi
+rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6
-if test "$ac_cv_search_opendir" != no; then
-  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 else
-  echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
 if test "${ac_cv_search_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8061,120 +8549,80 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char opendir ();
 int
 main ()
 {
-opendir ();
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="none required"
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_opendir" = no; then
-  for ac_lib in x; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-  done
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
 fi
+rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6
-if test "$ac_cv_search_opendir" != no; then
-  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 fi
 
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
 if test "${ac_cv_header_time+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8198,37 +8646,34 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_time=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_time=no
+	ac_cv_header_time=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
 if test $ac_cv_header_time = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -8237,8 +8682,8 @@
 
 fi
 
-echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; }
 if test "${ac_cv_header_sys_wait_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -8251,7 +8696,7 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 #ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
 #endif
 #ifndef WIFEXITED
 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
@@ -8268,37 +8713,34 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_sys_wait_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_sys_wait_h=no
+	ac_cv_header_sys_wait_h=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; }
 if test $ac_cv_header_sys_wait_h = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -8314,18 +8756,19 @@
 for ac_header in wchar.h wctype.h langinfo.h iconv.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8336,40 +8779,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8378,24 +8818,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -8403,9 +8841,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -8429,25 +8868,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -8467,18 +8900,19 @@
 for ac_header in memory.h string.h strings.h limits.h alloca.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8489,40 +8923,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8531,24 +8962,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -8556,9 +8985,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -8582,25 +9012,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -8620,18 +9044,19 @@
 for ac_header in unistd.h sys/mman.h termios.h pty.h util.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8642,40 +9067,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8684,24 +9106,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -8709,9 +9129,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -8735,25 +9156,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -8773,18 +9188,19 @@
 for ac_header in dlfcn.h dl.h ieeefp.h fpu_control.h fenv.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8795,40 +9211,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8837,24 +9250,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -8862,9 +9273,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -8888,25 +9300,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -8926,18 +9332,19 @@
 for ac_header in stropts.h sys/stropts.h sys/select.h sys/types.h sys/ttold.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8948,40 +9355,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -8990,24 +9394,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9015,9 +9417,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -9041,25 +9444,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -9075,22 +9472,22 @@
 
 
 
-
-for ac_header in sys/time.h sys/timeb.h locale.h readline/readline.h bfd.h
+for ac_header in sys/time.h sys/timeb.h locale.h bfd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9101,40 +9498,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9143,24 +9537,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9168,9 +9560,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -9194,25 +9587,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -9224,123 +9611,259 @@
 
 done
 
-# Check whether --enable-largefile or --disable-largefile was given.
-if test "${enable_largefile+set}" = set; then
-  enableval="$enable_largefile"
 
-fi;
-if test "$enable_largefile" != no; then
 
-  echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
-echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6
-if test "${ac_cv_sys_largefile_CC+set}" = set; then
+for ac_header in readline/readline.h readline/history.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-     	 # IRIX 6.2 and later do not support large files by default,
-     	 # so use the C compiler's -n32 option if that helps.
-	 cat >conftest.$ac_ext <<_ACEOF
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-		       && LARGE_OFF_T % 2147483647 == 1)
-		      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
+$ac_includes_default
+#include <$ac_header>
 _ACEOF
-     	 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+  enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+  { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+	 # IRIX 6.2 and later do not support large files by default,
+	 # so use the C compiler's -n32 option if that helps.
+	 cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+	 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext
-     	 CC="$CC -n32"
-     	 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+
+rm -f core conftest.err conftest.$ac_objext
+	 CC="$CC -n32"
+	 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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_sys_largefile_CC=' -n32'; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext
+
+rm -f core conftest.err conftest.$ac_objext
 	 break
        done
        CC=$ac_save_CC
        rm -f conftest.$ac_ext
     fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
-echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }
   if test "$ac_cv_sys_largefile_CC" != no; then
     CC=$CC$ac_cv_sys_largefile_CC
   fi
 
-  echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }
 if test "${ac_cv_sys_file_offset_bits+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   while :; do
-  ac_cv_sys_file_offset_bits=no
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9365,33 +9888,31 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_file_offset_bits=no; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9417,53 +9938,53 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_sys_file_offset_bits=64; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_file_offset_bits=unknown
   break
 done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
-echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
-if test "$ac_cv_sys_file_offset_bits" != no; then
-
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+  no | unknown) ;;
+  *)
 cat >>confdefs.h <<_ACEOF
 #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
 _ACEOF
-
-fi
+;;
+esac
 rm -f conftest*
-  echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
-echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
+  if test $ac_cv_sys_file_offset_bits = unknown; then
+    { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }
 if test "${ac_cv_sys_large_files+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   while :; do
-  ac_cv_sys_large_files=no
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9488,33 +10009,31 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_sys_large_files=no; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9540,46 +10059,47 @@
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_sys_large_files=1; break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  ac_cv_sys_large_files=unknown
   break
 done
 fi
-echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
-echo "${ECHO_T}$ac_cv_sys_large_files" >&6
-if test "$ac_cv_sys_large_files" != no; then
-
+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+  no | unknown) ;;
+  *)
 cat >>confdefs.h <<_ACEOF
 #define _LARGE_FILES $ac_cv_sys_large_files
 _ACEOF
-
-fi
+;;
+esac
 rm -f conftest*
+  fi
 fi
 
 
@@ -9588,18 +10108,19 @@
 for ac_header in mpi.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9610,40 +10131,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -9652,24 +10170,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -9677,9 +10193,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -9703,25 +10220,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -9740,8 +10251,8 @@
 # Types
 # ----------------------------------------
 
-echo "$as_me:$LINENO: checking for mode_t" >&5
-echo $ECHO_N "checking for mode_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for mode_t" >&5
+echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_mode_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9752,49 +10263,47 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+typedef mode_t ac__type_new_;
 int
 main ()
 {
-if ((mode_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (mode_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_mode_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_mode_t=no
+	ac_cv_type_mode_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
-echo "${ECHO_T}$ac_cv_type_mode_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+echo "${ECHO_T}$ac_cv_type_mode_t" >&6; }
 if test $ac_cv_type_mode_t = yes; then
   :
 else
@@ -9805,8 +10314,8 @@
 
 fi
 
-echo "$as_me:$LINENO: checking for off_t" >&5
-echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_off_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9817,61 +10326,59 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+typedef off_t ac__type_new_;
 int
 main ()
 {
-if ((off_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (off_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_off_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_off_t=no
+	ac_cv_type_off_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
-echo "${ECHO_T}$ac_cv_type_off_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6; }
 if test $ac_cv_type_off_t = yes; then
   :
 else
 
 cat >>confdefs.h <<_ACEOF
-#define off_t long
+#define off_t long int
 _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking for size_t" >&5
-echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_size_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9882,61 +10389,59 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+typedef size_t ac__type_new_;
 int
 main ()
 {
-if ((size_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (size_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_size_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_size_t=no
+	ac_cv_type_size_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
-echo "${ECHO_T}$ac_cv_type_size_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
 if test $ac_cv_type_size_t = yes; then
   :
 else
 
 cat >>confdefs.h <<_ACEOF
-#define size_t unsigned
+#define size_t unsigned int
 _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking for pid_t" >&5
-echo $ECHO_N "checking for pid_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_pid_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -9947,49 +10452,47 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+typedef pid_t ac__type_new_;
 int
 main ()
 {
-if ((pid_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (pid_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_pid_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_pid_t=no
+	ac_cv_type_pid_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
-echo "${ECHO_T}$ac_cv_type_pid_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6; }
 if test $ac_cv_type_pid_t = yes; then
   :
 else
@@ -10000,8 +10503,8 @@
 
 fi
 
-echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
 if test "${ac_cv_type_signal+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10013,63 +10516,52 @@
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <signal.h>
-#ifdef signal
-# undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
 
 int
 main ()
 {
-int i;
+return *(signal (0, 0)) (0) == 1;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_signal=void
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_signal=int
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_signal=int
+	ac_cv_type_signal=void
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define RETSIGTYPE $ac_cv_type_signal
 _ACEOF
 
 
-echo "$as_me:$LINENO: checking for long long int" >&5
-echo $ECHO_N "checking for long long int... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for long long int" >&5
+echo $ECHO_N "checking for long long int... $ECHO_C" >&6; }
 if test "${ac_cv_type_long_long_int+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10080,49 +10572,47 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 $ac_includes_default
+typedef long long int ac__type_new_;
 int
 main ()
 {
-if ((long long int *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (long long int))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_long_long_int=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_long_long_int=no
+	ac_cv_type_long_long_int=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
-echo "${ECHO_T}$ac_cv_type_long_long_int" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
+echo "${ECHO_T}$ac_cv_type_long_long_int" >&6; }
 if test $ac_cv_type_long_long_int = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -10132,8 +10622,8 @@
 
 fi
 
-echo "$as_me:$LINENO: checking for wchar_t" >&5
-echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for wchar_t" >&5
+echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_wchar_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10145,49 +10635,47 @@
 /* end confdefs.h.  */
 #include "stddef.h"
 
+typedef wchar_t ac__type_new_;
 int
 main ()
 {
-if ((wchar_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (wchar_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_wchar_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_wchar_t=no
+	ac_cv_type_wchar_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5
-echo "${ECHO_T}$ac_cv_type_wchar_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5
+echo "${ECHO_T}$ac_cv_type_wchar_t" >&6; }
 if test $ac_cv_type_wchar_t = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -10197,8 +10685,8 @@
 
 fi
 
-echo "$as_me:$LINENO: checking for wint_t" >&5
-echo $ECHO_N "checking for wint_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for wint_t" >&5
+echo $ECHO_N "checking for wint_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_wint_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10210,49 +10698,47 @@
 /* end confdefs.h.  */
 #include "wchar.h"
 
+typedef wint_t ac__type_new_;
 int
 main ()
 {
-if ((wint_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (wint_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_wint_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_wint_t=no
+	ac_cv_type_wint_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_wint_t" >&5
-echo "${ECHO_T}$ac_cv_type_wint_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_wint_t" >&5
+echo "${ECHO_T}$ac_cv_type_wint_t" >&6; }
 if test $ac_cv_type_wint_t = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -10262,8 +10748,8 @@
 
 fi
 
-echo "$as_me:$LINENO: checking for mbstate_t" >&5
-echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for mbstate_t" >&5
+echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6; }
 if test "${ac_cv_type_mbstate_t+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10275,49 +10761,47 @@
 /* end confdefs.h.  */
 #include "wchar.h"
 
+typedef mbstate_t ac__type_new_;
 int
 main ()
 {
-if ((mbstate_t *) 0)
+if ((ac__type_new_ *) 0)
   return 0;
-if (sizeof (mbstate_t))
+if (sizeof (ac__type_new_))
   return 0;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_type_mbstate_t=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_mbstate_t=no
+	ac_cv_type_mbstate_t=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5
-echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_mbstate_t" >&5
+echo "${ECHO_T}$ac_cv_type_mbstate_t" >&6; }
 if test $ac_cv_type_mbstate_t = yes; then
 
 cat >>confdefs.h <<_ACEOF
@@ -10339,18 +10823,19 @@
 for ac_header in stdlib.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10361,40 +10846,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10403,24 +10885,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -10428,9 +10908,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -10454,25 +10935,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -10488,9 +10963,9 @@
 for ac_func in getpagesize
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10516,67 +10991,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -10585,8 +11053,8 @@
 fi
 done
 
-echo "$as_me:$LINENO: checking for working mmap" >&5
-echo $ECHO_N "checking for working mmap... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for working mmap" >&5
+echo $ECHO_N "checking for working mmap... $ECHO_C" >&6; }
 if test "${ac_cv_func_mmap_fixed_mapped+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -10628,21 +11096,21 @@
 #include <fcntl.h>
 #include <sys/mman.h>
 
-#if !STDC_HEADERS && !HAVE_STDLIB_H
+#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
 char *malloc ();
 #endif
 
 /* This mess was copied from the GNU getpagesize.h.  */
-#if !HAVE_GETPAGESIZE
+#ifndef HAVE_GETPAGESIZE
 /* Assume that all systems that can run configure have sys/param.h.  */
-# if !HAVE_SYS_PARAM_H
+# ifndef HAVE_SYS_PARAM_H
 #  define HAVE_SYS_PARAM_H 1
 # endif
 
 # ifdef _SC_PAGESIZE
 #  define getpagesize() sysconf(_SC_PAGESIZE)
 # else /* no _SC_PAGESIZE */
-#  if HAVE_SYS_PARAM_H
+#  ifdef HAVE_SYS_PARAM_H
 #   include <sys/param.h>
 #   ifdef EXEC_PAGESIZE
 #    define getpagesize() EXEC_PAGESIZE
@@ -10681,15 +11149,15 @@
   /* First, make a file with some known garbage in it. */
   data = (char *) malloc (pagesize);
   if (!data)
-    exit (1);
+    return 1;
   for (i = 0; i < pagesize; ++i)
     *(data + i) = rand ();
   umask (0);
   fd = creat ("conftest.mmap", 0600);
   if (fd < 0)
-    exit (1);
+    return 1;
   if (write (fd, data, pagesize) != pagesize)
-    exit (1);
+    return 1;
   close (fd);
 
   /* Next, try to mmap the file at a fixed address which already has
@@ -10697,17 +11165,17 @@
      we see the same garbage.  */
   fd = open ("conftest.mmap", O_RDWR);
   if (fd < 0)
-    exit (1);
+    return 1;
   data2 = (char *) malloc (2 * pagesize);
   if (!data2)
-    exit (1);
-  data2 += (pagesize - ((long) data2 & (pagesize - 1))) & (pagesize - 1);
+    return 1;
+  data2 += (pagesize - ((long int) data2 & (pagesize - 1))) & (pagesize - 1);
   if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
 		     MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    exit (1);
+    return 1;
   for (i = 0; i < pagesize; ++i)
     if (*(data + i) != *(data2 + i))
-      exit (1);
+      return 1;
 
   /* Finally, make sure that changes to the mapped area do not
      percolate back to the file as seen by read().  (This is a bug on
@@ -10716,24 +11184,33 @@
     *(data2 + i) = *(data2 + i) + 1;
   data3 = (char *) malloc (pagesize);
   if (!data3)
-    exit (1);
+    return 1;
   if (read (fd, data3, pagesize) != pagesize)
-    exit (1);
+    return 1;
   for (i = 0; i < pagesize; ++i)
     if (*(data + i) != *(data3 + i))
-      exit (1);
+      return 1;
   close (fd);
-  exit (0);
+  return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -10746,11 +11223,13 @@
 ( exit $ac_status )
 ac_cv_func_mmap_fixed_mapped=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
-echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_mmap_fixed_mapped" >&5
+echo "${ECHO_T}$ac_cv_func_mmap_fixed_mapped" >&6; }
 if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -10761,22 +11240,22 @@
 rm -f conftest.mmap
 
 
-
-for ac_header in unistd.h vfork.h
+for ac_header in vfork.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10787,40 +11266,37 @@
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+	ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10829,24 +11305,22 @@
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -10854,9 +11328,10 @@
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
@@ -10880,25 +11355,19 @@
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------- ##
-## Report this to the lush lists.  ##
-## ------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -10915,9 +11384,9 @@
 for ac_func in fork vfork
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10943,67 +11412,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11013,8 +11475,8 @@
 done
 
 if test "x$ac_cv_func_fork" = xyes; then
-  echo "$as_me:$LINENO: checking for working fork" >&5
-echo $ECHO_N "checking for working fork... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for working fork" >&5
+echo $ECHO_N "checking for working fork... $ECHO_C" >&6; }
 if test "${ac_cv_func_fork_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11022,27 +11484,40 @@
   ac_cv_func_fork_works=cross
 else
   cat >conftest.$ac_ext <<_ACEOF
-/* By Ruediger Kuhlmann. */
-      #include <sys/types.h>
-      #if HAVE_UNISTD_H
-      # include <unistd.h>
-      #endif
-      /* Some systems only have a dummy stub for fork() */
-      int main ()
-      {
-	if (fork() < 0)
-	  exit (1);
-	exit (0);
-      }
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+
+	  /* By Ruediger Kuhlmann. */
+	  return fork () < 0;
+
+  ;
+  return 0;
+}
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -11055,11 +11530,13 @@
 ( exit $ac_status )
 ac_cv_func_fork_works=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
-echo "${ECHO_T}$ac_cv_func_fork_works" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
+echo "${ECHO_T}$ac_cv_func_fork_works" >&6; }
 
 else
   ac_cv_func_fork_works=$ac_cv_func_fork
@@ -11079,8 +11556,8 @@
 fi
 ac_cv_func_vfork_works=$ac_cv_func_vfork
 if test "x$ac_cv_func_vfork" = xyes; then
-  echo "$as_me:$LINENO: checking for working vfork" >&5
-echo $ECHO_N "checking for working vfork... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for working vfork" >&5
+echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; }
 if test "${ac_cv_func_vfork_works+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11094,15 +11571,9 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 /* Thanks to Paul Eggert for this test.  */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+$ac_includes_default
 #include <sys/wait.h>
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-#if HAVE_VFORK_H
+#ifdef HAVE_VFORK_H
 # include <vfork.h>
 #endif
 /* On some sparc systems, changes by the child to local and incoming
@@ -11173,7 +11644,7 @@
 
     while (wait(&status) != child)
       ;
-    exit(
+    return (
 	 /* Was there some problem with vforking?  */
 	 child < 0
 
@@ -11190,13 +11661,22 @@
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -11209,11 +11689,13 @@
 ( exit $ac_status )
 ac_cv_func_vfork_works=no
 fi
-rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
-echo "${ECHO_T}$ac_cv_func_vfork_works" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
+echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; }
 
 fi;
 if test "x$ac_cv_func_fork_works" = xcross; then
@@ -11247,9 +11729,9 @@
 for ac_func in strftime
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11275,67 +11757,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11343,8 +11818,8 @@
 
 else
   # strftime is in -lintl on SCO UNIX.
-echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
-echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6; }
 if test "${ac_cv_lib_intl_strftime+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -11357,55 +11832,53 @@
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char strftime ();
 int
 main ()
 {
-strftime ();
+return strftime ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_intl_strftime=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_intl_strftime=no
+	ac_cv_lib_intl_strftime=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
-echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6; }
 if test $ac_cv_lib_intl_strftime = yes; then
   cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRFTIME 1
@@ -11426,9 +11899,9 @@
 for ac_func in strchr memcpy sigaction sigvec strerror getcwd
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11454,67 +11927,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11530,9 +11996,9 @@
 for ac_func in feenableexcept ieee_handler fpsetmask __setfpucw
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11558,67 +12024,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11636,9 +12095,9 @@
 for ac_func in tanh sincos dlopen sigsetjmp waitpid openpty
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11664,67 +12123,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11741,9 +12193,9 @@
 for ac_func in mprotect getpagesize gettimeofday ftime cfree
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11769,67 +12221,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11846,9 +12291,9 @@
 for ac_func in gethostbyname flockfile sysconf fpathconf tcsetattr
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11874,67 +12319,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -11950,9 +12388,9 @@
 for ac_func in setenv putenv fseeko ftello
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -11978,67 +12416,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -12048,8 +12479,8 @@
 done
 
 
-  echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5
-echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking whether mbrtowc and mbstate_t are properly declared" >&5
+echo $ECHO_N "checking whether mbrtowc and mbstate_t are properly declared... $ECHO_C" >&6; }
 if test "${ac_cv_func_mbrtowc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -12063,44 +12494,46 @@
 int
 main ()
 {
-mbstate_t state; return ! (sizeof state && mbrtowc);
+wchar_t wc;
+	      char const s[] = "";
+	      size_t n = 1;
+	      mbstate_t state;
+	      return ! (sizeof state && (mbrtowc) (&wc, s, n, &state));
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_mbrtowc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_mbrtowc=no
+	ac_cv_func_mbrtowc=no
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5
-echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_mbrtowc" >&5
+echo "${ECHO_T}$ac_cv_func_mbrtowc" >&6; }
   if test $ac_cv_func_mbrtowc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -12111,13 +12544,12 @@
 
 
 
-
-for ac_func in setlocale nl_langinfo iconv
+for ac_func in setlocale nl_langinfo
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -12143,67 +12575,60 @@
 
 #undef $ac_func
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* 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
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* 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_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-	 { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+	eval "$as_ac_var=no"
 fi
-rm -f conftest.err conftest.$ac_objext \
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+	       { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -12214,24 +12639,85 @@
 
 
 
+# iconv function might be defined as libiconv in iconv.h
+{ echo "$as_me:$LINENO: checking for iconv" >&5
+echo $ECHO_N "checking for iconv... $ECHO_C" >&6; }
+ac_has_iconv=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include "iconv.h"
+int
+main ()
+{
+iconv((iconv_t)0, (char**)0, (size_t*)0, (char**)0, (size_t*)0);
+  ;
+  return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_has_iconv=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
 
-# ----------------------------------------
-# Xtra
-# ----------------------------------------
+fi
 
-LDCC=${CC}
-SOEXT=so
-CC_EXP_FLAG=
-CC_PIC_FLAG=
-MAKESO=
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_has_iconv" >&5
+echo "${ECHO_T}$ac_has_iconv" >&6; }
+if test x$ac_has_iconv = xyes ; then
 
-if test x${GCC} = xyes ; then
-    test x${GXX} = xyes && LDCC=${CXX}
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ICONV 1
+_ACEOF
+
+fi
+
+
+
+
+# ----------------------------------------
+# Xtra
+# ----------------------------------------
+
+LDCC=${CC}
+SOEXT=so
+CC_EXP_FLAG=
+CC_PIC_FLAG=
+MAKESO=
+
+CPP_YES='#'
+if test x${GCC} = xyes ; then
+    test x${GXX} = xyes && LDCC=${CXX} && CPP_YES=''
     CC_PIC_FLAG='-fPIC'
     MAKESO="$LDCC -shared -o"
 fi
 
+
+
 # Tested?
 case "$host" in
     *-linux*)
@@ -12239,7 +12725,7 @@
         ;;
     *-darwin* | *-macos10* | *-rhapsody*)
         SOEXT=dylib
-        MAKESO="$LDCC -dylib -o"
+        MAKESO="$LDCC -bundle -flat_namespace -undefined suppress -o"
         ;;
     *-freebsd2*)
         CC_PIC_FLAG='-fPIC'
@@ -12338,11 +12824,11 @@
   exec_prefix="${save_exec_prefix}"
 
 
-          ac_config_files="$ac_config_files Makefile"
+ac_config_files="$ac_config_files Makefile"
 
-          ac_config_files="$ac_config_files src/Makefile"
+ac_config_files="$ac_config_files src/Makefile"
 
-          ac_config_files="$ac_config_files include/lushmake.h"
+ac_config_files="$ac_config_files include/lushmake.h"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -12362,39 +12848,58 @@
 
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# 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_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
   (set) 2>&1 |
-    case `(ac_space=' '; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    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 \
-	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    esac;
-} |
+    esac |
+    sort
+) |
   sed '
+     /^ac_cv_env_/b end
      t clear
-     : clear
+     :clear
      s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
      t end
-     /^ac_cv_env/!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" && echo "updating cache $cache_file"
+     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" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    echo "not updating unwritable cache $cache_file"
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -12403,32 +12908,18 @@
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ 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[	 ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[	 ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[	 ]*$//;
-}'
-fi
-
 DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
-  ac_i=`echo "$ac_i" |
-	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
-  # 2. Add them.
-  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`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.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
@@ -12459,17 +12950,45 @@
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be Bourne compatible
+# 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=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
-DUALCASE=1; export DUALCASE # for MKS sh
 
 # Support unset when possible.
 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
@@ -12479,8 +12998,43 @@
 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.)
+as_nl='
+'
+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
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -12494,18 +13048,19 @@
   if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    $as_unset $as_var
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+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
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -12513,159 +13068,120 @@
 
 
 # Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)$' \| \
-	 .     : '\(.\)' 2>/dev/null ||
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\/\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
 
+# CDPATH.
+$as_unset CDPATH
 
-# PATH needs CR, and LINENO needs CR and PATH.
-# 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
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
 
 
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  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
-
-       ;;
-  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
-    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-	 case $as_dir in
-	 /*)
-	   if ("$as_dir/$as_base" -c '
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-	     CONFIG_SHELL=$as_dir/$as_base
-	     export CONFIG_SHELL
-	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-	   fi;;
-	 esac
-       done
-done
-;;
-  esac
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
       N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
-    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); 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 sensible to this).
-  . ./$as_me.lineno
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
   # Exit status is that of the last command.
   exit
 }
 
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='	' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 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
+fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
+  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'
-  else
-    as_ln_s='ln -s'
-  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.file
+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=:
@@ -12674,7 +13190,28 @@
   as_mkdir_p=false
 fi
 
-as_executable_p="test -f"
+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'"
@@ -12683,31 +13220,14 @@
 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS=" 	$as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
 exec 6>&1
 
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# 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.  Logging --version etc. is OK.
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
+# values after options handling.
+ac_log="
 This file was extended by lush $as_me 1.0, which was
-generated by GNU Autoconf 2.59.  Invocation command line was
+generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -12715,30 +13235,19 @@
   CONFIG_COMMANDS = $CONFIG_COMMANDS
   $ $0 $@
 
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
 _ACEOF
 
+cat >>$CONFIG_STATUS <<_ACEOF
 # Files that config.status was made for.
-if test -n "$ac_config_files"; then
-  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
 
-if test -n "$ac_config_headers"; then
-  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
-  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
-  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
-
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
 current configuration.
@@ -12746,7 +13255,7 @@
 Usage: $0 [OPTIONS] [FILE]...
 
   -h, --help       print this help, then exit
-  -V, --version    print version number, then exit
+  -V, --version    print version number and configuration settings, then exit
   -q, --quiet      do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
@@ -12762,19 +13271,21 @@
 $config_headers
 
 Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
 
+_ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 lush config.status 1.0
-configured by $0, generated by GNU Autoconf 2.59,
-  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright (C) 2003 Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-INSTALL="$INSTALL"
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
@@ -12785,39 +13296,24 @@
 do
   case $1 in
   --*=*)
-    ac_option=`expr "x$1" : 'x\([^=]*\)='`
-    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
-  -*)
+  *)
     ac_option=$1
     ac_optarg=$2
     ac_shift=shift
     ;;
-  *) # This is not an option, so the user has probably given explicit
-     # arguments.
-     ac_option=$1
-     ac_need_defaults=false;;
   esac
 
   case $ac_option in
   # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
-  --version | --vers* | -V )
-    echo "$ac_cs_version"; exit 0 ;;
-  --he | --h)
-    # Conflict between --help and --header
-    { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit 0 ;;
-  --debug | --d* | -d )
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
@@ -12827,18 +13323,24 @@
     $ac_shift
     CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
     ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    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.
-  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
    { (exit 1); exit 1; }; } ;;
 
-  *) ac_config_targets="$ac_config_targets $1" ;;
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
 
   esac
   shift
@@ -12854,31 +13356,45 @@
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 if \$ac_cs_recheck; then
-  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
 fi
 
 _ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
 
-
-
-
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
 for ac_config_target in $ac_config_targets
 do
-  case "$ac_config_target" in
-  # Handling of arguments.
-  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-  "include/lushmake.h" ) CONFIG_FILES="$CONFIG_FILES include/lushmake.h" ;;
-  "include/lushconf.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/lushconf.h" ;;
+  case $ac_config_target in
+    "include/lushconf.h") CONFIG_HEADERS="$CONFIG_HEADERS include/lushconf.h" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "include/lushmake.h") CONFIG_FILES="$CONFIG_FILES include/lushmake.h" ;;
+
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   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
@@ -12889,594 +13405,547 @@
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
 # creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# 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 ||
 {
-  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
   trap '{ (exit 1); exit 1; }' 1 2 13 15
 }
-
 # Create a (secure) tmp directory for tmp files.
 
 {
-  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
   test -n "$tmp" && test -d "$tmp"
 }  ||
 {
-  tmp=./confstat$$-$RANDOM
-  (umask 077 && mkdir $tmp)
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
 } ||
 {
    echo "$me: cannot create a temporary directory in ." >&2
    { (exit 1); exit 1; }
 }
 
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
 #
-# CONFIG_FILES section.
+# Set up the sed scripts for CONFIG_FILES section.
 #
 
 # No need to generate the scripts if there are no CONFIG_FILES.
 # This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
-  # Protect against being on the right side of a sed subst in config.status.
-  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
-   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@CC@,$CC,;t t
-s,@CXX@,$CXX,;t t
-s,@F77@,$F77,;t t
-s,@SET_MAKE@,$SET_MAKE,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@OPTS@,$OPTS,;t t
-s,@GCC@,$GCC,;t t
-s,@CXXFLAGS@,$CXXFLAGS,;t t
-s,@ac_ct_CXX@,$ac_ct_CXX,;t t
-s,@FFLAGS@,$FFLAGS,;t t
-s,@ac_ct_F77@,$ac_ct_F77,;t t
-s,@CPP@,$CPP,;t t
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-s,@RANLIB@,$RANLIB,;t t
-s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
-s,@LN_S@,$LN_S,;t t
-s,@MV@,$MV,;t t
-s,@CP@,$CP,;t t
-s,@RM@,$RM,;t t
-s,@AR@,$AR,;t t
-s,@TOUCH@,$TOUCH,;t t
-s,@INDENT@,$INDENT,;t t
-s,@EGREP@,$EGREP,;t t
-s,@BFD_YES@,$BFD_YES,;t t
-s,@X_CFLAGS@,$X_CFLAGS,;t t
-s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
-s,@X_LIBS@,$X_LIBS,;t t
-s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
-s,@PKGCONFIG@,$PKGCONFIG,;t t
-s,@X_YES@,$X_YES,;t t
-s,@PTHREAD_LIBS@,$PTHREAD_LIBS,;t t
-s,@PTHREAD_FLAGS@,$PTHREAD_FLAGS,;t t
-s,@LDCC@,$LDCC,;t t
-s,@SOEXT@,$SOEXT,;t t
-s,@CC_EXP_FLAG@,$CC_EXP_FLAG,;t t
-s,@CC_PIC_FLAG@,$CC_PIC_FLAG,;t t
-s,@MAKESO@,$MAKESO,;t t
-s,@UNIX_YES@,$UNIX_YES,;t t
-s,@WIN32_YES@,$WIN32_YES,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
-  cat >>$CONFIG_STATUS <<\_ACEOF
-  # Split the substitutions into bite-sized pieces for seds with
-  # small command number limits, like on Digital OSF/1 and HP-UX.
-  ac_max_sed_lines=48
-  ac_sed_frag=1 # Number of current file.
-  ac_beg=1 # First line for current file.
-  ac_end=$ac_max_sed_lines # Line after last line for current file.
-  ac_more_lines=:
-  ac_sed_cmds=
-  while $ac_more_lines; do
-    if test $ac_beg -gt 1; then
-      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    else
-      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    fi
-    if test ! -s $tmp/subs.frag; then
-      ac_more_lines=false
-    else
-      # The purpose of the label and of the branching condition is to
-      # speed up the sed processing (if there are no `@' at all, there
-      # is no need to browse any of the substitutions).
-      # These are the two extra sed commands mentioned above.
-      (echo ':t
-  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
-      if test -z "$ac_sed_cmds"; then
-	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
-      else
-	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
-      fi
-      ac_sed_frag=`expr $ac_sed_frag + 1`
-      ac_beg=$ac_end
-      ac_end=`expr $ac_end + $ac_max_sed_lines`
-    fi
-  done
-  if test -z "$ac_sed_cmds"; then
-    ac_sed_cmds=cat
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+CC!$CC$ac_delim
+CXX!$CXX$ac_delim
+F77!$F77$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+OPTS!$OPTS$ac_delim
+GCC!$GCC$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+FFLAGS!$FFLAGS$ac_delim
+ac_ct_F77!$ac_ct_F77$ac_delim
+CPP!$CPP$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+RANLIB!$RANLIB$ac_delim
+LN_S!$LN_S$ac_delim
+MV!$MV$ac_delim
+CP!$CP$ac_delim
+RM!$RM$ac_delim
+AR!$AR$ac_delim
+TOUCH!$TOUCH$ac_delim
+INDENT!$INDENT$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+BFD_YES!$BFD_YES$ac_delim
+XMKMF!$XMKMF$ac_delim
+X_CFLAGS!$X_CFLAGS$ac_delim
+X_PRE_LIBS!$X_PRE_LIBS$ac_delim
+X_LIBS!$X_LIBS$ac_delim
+X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim
+PKGCONFIG!$PKGCONFIG$ac_delim
+X_YES!$X_YES$ac_delim
+PTHREAD_LIBS!$PTHREAD_LIBS$ac_delim
+PTHREAD_FLAGS!$PTHREAD_FLAGS$ac_delim
+CPP_YES!$CPP_YES$ac_delim
+LDCC!$LDCC$ac_delim
+SOEXT!$SOEXT$ac_delim
+CC_EXP_FLAG!$CC_EXP_FLAG$ac_delim
+CC_PIC_FLAG!$CC_PIC_FLAG$ac_delim
+MAKESO!$MAKESO$ac_delim
+UNIX_YES!$UNIX_YES$ac_delim
+WIN32_YES!$WIN32_YES$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 95; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
-fi # test -n "$CONFIG_FILES"
+done
 
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
 _ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ 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[	 ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[	 ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[	 ]*$//
+}'
+fi
+
 cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-	cat >$tmp/stdin
-	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[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
 
-  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+  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 ||
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$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 "`IFS=:
+	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    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 ||
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-  	  /^X\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
-  { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
     as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`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 ||
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-  	  /^X\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
+    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 ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
    { (exit 1); exit 1; }; }; }
-
   ac_builddir=.
 
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`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
-  .)  # No --srcdir option.  We are building in place.
+  .)  # We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
+    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 ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+    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
 
-# Do not use `cd foo && pwd` to compute absolute paths, because
-# the directories may not exist.
-case `pwd` in
-.) ac_abs_builddir="$ac_dir";;
-*)
-  case "$ac_dir" in
-  .) ac_abs_builddir=`pwd`;;
-  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
-  *) ac_abs_builddir=`pwd`/"$ac_dir";;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_builddir=${ac_top_builddir}.;;
-*)
-  case ${ac_top_builddir}. in
-  .) ac_abs_top_builddir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
-  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_srcdir=$ac_srcdir;;
-*)
-  case $ac_srcdir in
-  .) ac_abs_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
-  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
-  esac;;
-esac
-case $ac_abs_builddir in
-.) ac_abs_top_srcdir=$ac_top_srcdir;;
-*)
-  case $ac_top_srcdir in
-  .) ac_abs_top_srcdir=$ac_abs_builddir;;
-  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
-  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
-  esac;;
-esac
 
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
 
   case $INSTALL in
   [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
   esac
+_ACEOF
 
-  # 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.  */
-  if test x"$ac_file" = x-; then
-    configure_input=
-  else
-    configure_input="$ac_file.  "
-  fi
-  configure_input=$configure_input"Generated from `echo $ac_file_in |
-				     sed 's,.*/,,'` by configure."
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-	 # Absolute (can't be DOS-style, as IFS=:)
-	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-	 echo "$f";;
-      *) # Relative
-	 if test -f "$f"; then
-	   # Build tree
-	   echo "$f"
-	 elif test -f "$srcdir/$f"; then
-	   # Source tree
-	   echo "$srcdir/$f"
-	 else
-	   # /dev/null tree
-	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-	 fi;;
-      esac
-    done` || { (exit 1); exit 1; }
-
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
+cat >>$CONFIG_STATUS <<\_ACEOF
+# 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=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
+  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
   sed "$ac_vpsub
 $extrasub
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;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,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-s,@INSTALL@,$ac_INSTALL,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
-  rm -f $tmp/stdin
-  if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
-  else
-    cat $tmp/out
-    rm -f $tmp/out
-  fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;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
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+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"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+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;}
 
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([	 ]*\)#\([	 ]*define[	 ][	 ]*\)'
-ac_dB='[	 ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([	 ]*\)#\([	 ]*\)undef\([	 ][	 ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  rm -f "$tmp/stdin"
   case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-	cat >$tmp/stdin
-	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
   esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
+ac_dB='\\)[	 (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
 
-  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-	 # Absolute (can't be DOS-style, as IFS=:)
-	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-	 # Do quote $f, to prevent DOS paths from being IFS'd.
-	 echo "$f";;
-      *) # Relative
-	 if test -f "$f"; then
-	   # Build tree
-	   echo "$f"
-	 elif test -f "$srcdir/$f"; then
-	   # Source tree
-	   echo "$srcdir/$f"
-	 else
-	   # /dev/null tree
-	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-	 fi;;
-      esac
-    done` || { (exit 1); exit 1; }
-  # Remove the trailing spaces.
-  sed 's/[	 ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h.  The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status.  Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*\)\(([^)]*)\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless.  Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
+uniq confdefs.h |
+  sed -n '
+	t rset
+	:rset
+	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
+	t ok
+	d
+	:ok
+	s/[\\&,]/\\&/g
+	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
 
-# This sed command replaces #undef with comments.  This is necessary, for
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
 # example, in the case of _POSIX_SOURCE, which is predefined and required
 # on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[	 ]*#[	 ]*undef[	 ][	 ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[	 #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
+/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
+b
+:def
 _ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo '  if grep "^[	 ]*#[	 ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo '  :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
-do
-  # Write a limited-size here document to $tmp/defines.sed.
-  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
-  # Speed up: don't consider the non `#define' lines.
-  echo '/^[	 ]*#[	 ]*define/!b' >>$CONFIG_STATUS
-  # Work around the forget-to-reset-the-flag bug.
-  echo 't clr' >>$CONFIG_STATUS
-  echo ': clr' >>$CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
   echo 'CEOF
-  sed -f $tmp/defines.sed $tmp/in >$tmp/out
-  rm -f $tmp/in
-  mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
   rm -f conftest.defines
   mv conftest.tail conftest.defines
 done
-rm -f conftest.defines
-echo '  fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
-  # Write a limited-size here document to $tmp/undefs.sed.
-  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
-  # Speed up: don't consider the non `#undef'
-  echo '/^[	 ]*#[	 ]*undef/!b' >>$CONFIG_STATUS
-  # Work around the forget-to-reset-the-flag bug.
-  echo 't clr' >>$CONFIG_STATUS
-  echo ': clr' >>$CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
-  echo 'CEOF
-  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
-  rm -f $tmp/in
-  mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
-  rm -f conftest.undefs
-  mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
+rm -f conftest.defines conftest.tail
 
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
 cat >>$CONFIG_STATUS <<\_ACEOF
-  # 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.  */
-  if test x"$ac_file" = x-; then
-    echo "/* Generated by configure.  */" >$tmp/config.h
-  else
-    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
-  fi
-  cat $tmp/in >>$tmp/config.h
-  rm -f $tmp/in
   if test x"$ac_file" != x-; then
-    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
       { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
-      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$ac_file" : 'X\(//\)[^/]' \| \
-	 X"$ac_file" : 'X\(//\)$' \| \
-	 X"$ac_file" : 'X\(/\)' \| \
-	 .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-  	  /^X\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
-      { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
-    as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| \
-	 .     : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-  	  /^X\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
-    done
-    test ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-   { (exit 1); exit 1; }; }; }
-
       rm -f $ac_file
-      mv $tmp/config.h $ac_file
+      mv "$tmp/config.h" $ac_file
     fi
   else
-    cat $tmp/config.h
-    rm -f $tmp/config.h
+    echo "/* $configure_input  */"
+    cat "$ac_result"
   fi
-done
-_ACEOF
+  rm -f "$tmp/out12"
+ ;;
+
+
+  esac
+
+done # for ac_tag
 
-cat >>$CONFIG_STATUS <<\_ACEOF
 
 { (exit 0); exit 0; }
 _ACEOF
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/configure.ac lush-cvs/configure.ac
--- lush/configure.ac	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/configure.ac	2008-09-16 11:59:27.000000000 -0400
@@ -5,7 +5,7 @@
 
 AC_PREREQ(2.50)
 AC_INIT(lush, 1.0)
-AC_REVISION($Id: configure.ac,v 1.50 2006/08/17 19:17:13 leonb Exp $)
+AC_REVISION($Id: configure.ac,v 1.55 2008/09/16 15:59:27 leonb Exp $)
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_SRCDIR(README)
 AC_CONFIG_HEADER(include/lushconf.h)
@@ -99,7 +99,7 @@
 AC_PATH_PROG(TOUCH, touch)
 AC_PATH_PROG(INDENT, indent)
 
-if test -x $INDENT ; then
+if test -x "$INDENT" ; then
   AC_MSG_CHECKING([if $INDENT accepts GNU options])
   if $INDENT -gnu </dev/null 2>/dev/null ; then 
     AC_MSG_RESULT(yes)
@@ -240,7 +240,7 @@
 # readline
 AC_CHECK_LIB(curses,tputs)
 AC_CHECK_LIB(readline,readline)
-AC_CHECK_LIB(iconv,iconv_open)
+AC_CHECK_LIB(iconv,libiconv_open)
 
 
 
@@ -257,7 +257,8 @@
 AC_CHECK_HEADERS(unistd.h sys/mman.h termios.h pty.h util.h)
 AC_CHECK_HEADERS(dlfcn.h dl.h ieeefp.h fpu_control.h fenv.h)
 AC_CHECK_HEADERS(stropts.h sys/stropts.h sys/select.h sys/types.h sys/ttold.h)
-AC_CHECK_HEADERS(sys/time.h sys/timeb.h locale.h readline/readline.h bfd.h)
+AC_CHECK_HEADERS(sys/time.h sys/timeb.h locale.h bfd.h)
+AC_CHECK_HEADERS(readline/readline.h readline/history.h)
 AC_SYS_LARGEFILE
 
 if test $ac_have_mpi = yes ; then
@@ -295,7 +296,20 @@
 AC_CHECK_FUNCS(gethostbyname flockfile sysconf fpathconf tcsetattr)
 AC_CHECK_FUNCS(setenv putenv fseeko ftello)
 AC_FUNC_MBRTOWC
-AC_CHECK_FUNCS(setlocale nl_langinfo iconv)
+AC_CHECK_FUNCS(setlocale nl_langinfo)
+
+
+# iconv function might be defined as libiconv in iconv.h
+AC_MSG_CHECKING([for iconv])
+ac_has_iconv=no
+AC_TRY_LINK([#include "iconv.h"],
+            [iconv((iconv_t)0, (char**)0, (size_t*)0, (char**)0, (size_t*)0);],
+            [ac_has_iconv=yes])
+AC_MSG_RESULT($ac_has_iconv)
+if test x$ac_has_iconv = xyes ; then
+    AC_DEFINE(HAVE_ICONV,1,
+        [Define to 1 if you have the `iconv' function.])
+fi
 
 
 
@@ -310,11 +324,14 @@
 CC_PIC_FLAG=
 MAKESO=
 
+CPP_YES='#'
 if test x${GCC} = xyes ; then
-    test x${GXX} = xyes && LDCC=${CXX}
+    test x${GXX} = xyes && LDCC=${CXX} && CPP_YES=''
     CC_PIC_FLAG='-fPIC'
     MAKESO="$LDCC -shared -o"
 fi
+AC_SUBST(CPP_YES)
+
 
 # Tested?
 case "$host" in
@@ -323,7 +340,7 @@
         ;;
     *-darwin* | *-macos10* | *-rhapsody*)
         SOEXT=dylib
-        MAKESO="$LDCC -dylib -o"
+        MAKESO="$LDCC -bundle -flat_namespace -undefined suppress -o"
         ;;
     *-freebsd2*)
         CC_PIC_FLAG='-fPIC'
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/COPYRIGHT lush-cvs/COPYRIGHT
--- lush/COPYRIGHT	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/COPYRIGHT	2010-12-29 22:34:42.000000000 -0500
@@ -6,6 +6,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2003-2010 Yann Le Cun, Leon Bottou.
 ;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
 ;;; Includes parts of TL3:
 ;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
@@ -29,7 +30,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: COPYRIGHT,v 1.2 2002/04/16 19:16:06 leonb Exp $
+;;; $Id: COPYRIGHT,v 1.3 2010/12/29 20:32:10 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ----------------------------------------------
@@ -63,5 +64,5 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: COPYRIGHT,v 1.2 2002/04/16 19:16:06 leonb Exp $
+ * $Id: COPYRIGHT,v 1.3 2010/12/29 20:32:10 profshadoko Exp $
  **********************************************************************/
\ No newline at end of file
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/etc/lush.el lush-cvs/etc/lush.el
--- lush/etc/lush.el	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/etc/lush.el	2009-12-13 16:59:55.000000000 -0500
@@ -24,18 +24,179 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: lush.el,v 1.4 2002/10/01 18:32:28 profshadoko Exp $
+;;; $Id: lush.el,v 1.16 2009/12/13 21:59:55 ysulsky Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+;; this file contains useful definitions for emacs
+
+(require 'pcomplete)
+
+;; if this is set to nil then tab completion will read the environment
+;; from the lush process every time, even when nothing new was defined
+(defvar cache-symbols t)
+
+(defvar *lush-symbols* ())
+(defvar *lush-symbols-stale?* t)
+
+;; make this a local variable (shadow the global) and set to true when
+;; in a lush buffer to define/setup items local to the lush buffer
+(defvar *lush-buffer?* nil)
+
+(defun lush-proc ()
+  (condition-case err
+      (inferior-lisp-proc)
+    (error ())))
+
 ;; call this with M-X lush
 (defun lush ()
-  "starts Lush"
+  "starts Lush in another subwindow"
   (interactive)
-  (inferior-lisp "lush"))
+  (switch-to-buffer-other-window "*inferior-lisp*")
+  (inferior-lisp "lush")
+  (other-window -1)
+  (set-buffer "*inferior-lisp*")
+  (set (make-local-variable '*lush-buffer?*) t)
+  (setq comint-prompt-regexp "^?")
+  (setq comint-get-old-input #'lush-get-incomplete-input)
+  (if cache-symbols
+      (progn
+        ;; override comint-send-string to check for definitions/file loads
+        ;; entered by hand in the repl or through the lisp-load-file command
+        (defadvice comint-send-string (around lush-send-string (proc inp) activate)
+          "Overrides comint-send-string globally but executes lush specific code only when in a lush REPL buffer"
+          (if *lush-buffer?* 
+              (let ((stale-re "load\\|\\^L\\|def\\|dmd\\|set\\|(d[efmz][\\t\\n ]"))
+                (if (and (eq proc (lush-proc))
+                         (string-match stale-re inp))
+                    (setq *lush-symbols-stale?* t))))
+          ad-do-it)
+
+        ;; comint-send-region was not really meant to be overriden,
+        ;; but defadvice provides a safe means of doing so.  as-do-it
+        ;; marks where the original function (comint-send-region)
+        ;; should be called.
+        ;; whenever the lisp-eval-* commands are used
+        (defadvice comint-send-region (around lush-send-region activate)
+          "Overrides comint-send-region globally but executes lush specific code only when in a lush REPL buffer"
+          (if *lush-buffer?* (setq *lush-symbols-stale?* t))
+          ad-do-it)))
+    
+  (set (make-local-variable 'pcomplete-parse-arguments-function)
+       'lush-parse-arguments)
+
+  (local-set-key "\r" 'lush-filter-input)
+  (local-set-key "\n" 'lush-filter-input)
+  (local-set-key "\t" 'lush-indent-and-complete-symbol))
 
 (global-set-key "\C-xg" 'goto-line)
 
-;; this file contains useful definitions for emacs
+
+(defun lush-avail? (mark)
+  (let ((prompt (save-excursion
+                     (search-backward-regexp "^?" nil t))))
+    (and prompt (= mark (+ prompt 2)))))
+
+(defun lush-filter-input ()
+  (interactive)
+  (let ((proc (lush-proc)))
+    (if (and proc (eq (current-buffer) (process-buffer proc)))
+        (progn
+          (insert "\n")
+          (let ((cur (point))
+                (end (point-max))
+                (mark (process-mark proc)))
+            (if (lush-avail? mark)
+                ;; we're at the repl, not in debug or other i/o
+                (let ((status (with-syntax-table lisp-mode-syntax-table
+                                (parse-partial-sexp mark end))))
+                  (if (and (= (car status) 0)   ; balanced parens
+                           (not (elt status 3)) ; inside string
+                           (not (elt status 4)) ; inside comment
+                           (<= (point) cur))    ; not inside the expression
+                      (let ((expr (buffer-substring 
+                                   (or (elt status 2) (- (point) 1))
+                                   (- (point) 1))))
+                        (comint-send-string proc (concat expr "\n"))
+                        (comint-add-to-input-history expr)
+                        (setq comint-input-ring-index nil)
+                        (command-execute 'comint-set-process-mark))
+                    (goto-char cur)))
+              ;; just send the input to lush
+              (let ((expr (buffer-substring-no-properties mark (- end 1))))
+                (comint-send-string proc (concat expr "\n"))
+                (comint-add-to-input-history expr)
+                (setq comint-input-ring-index nil)
+                (command-execute 'comint-set-process-mark))))))))
+
+(defun filter (p lst)
+  (let ((ret ()))
+    (mapc (lambda (x) (if (funcall p x) (setq ret (cons x ret)))) lst)
+    (nreverse ret)))
+
+;; be careful; calling this when lush isn't available will cause this to hang
+(defun lush-symbols ()
+  (let ((proc (lush-proc)))
+    (if proc
+        (car (read-from-string
+              (lush-results-from-process 
+               proc "(symblist)" "(" ")")))
+      ())))
+
+(defun lush-complete (sym)
+  (let* ((sym-name (downcase (if (stringp sym) sym (symbol-name sym))))
+         (minl (length sym-name))
+         (proc (lush-proc)))
+    ;; if we have the prompt and the symbols are stale, update *lush-symbols*
+    (if (and *lush-symbols-stale?*
+             proc
+             (eq (current-buffer) (process-buffer proc))
+             (lush-avail? (process-mark proc)))
+        (progn
+          (setq *lush-symbols* (lush-symbols))
+          (if cache-symbols
+              (setq *lush-symbols-stale?* ()))))
+    (filter (lambda (s)
+              (and (>= (length s) minl)
+                   (string= sym-name (substring s 0 minl))))
+            *lush-symbols*)))
+
+(defun lush-get-incomplete-input ()
+  (let ((proc (lush-proc)))
+    (if (and proc (eq (current-buffer) (process-buffer proc)))
+        (buffer-substring (process-mark proc) (point-max))
+      "")))
+
+;; see http://www.emacswiki.org/cgi-bin/wiki/PcompleteExamples
+(defun lush-parse-arguments ()
+  (save-excursion
+    (let* ((cur (point))
+           (beg (search-backward-regexp "[][{}#():'\" \t\n]" nil t))
+           (pos (if beg (+ beg 1) cur))
+           (arg (buffer-substring-no-properties pos cur)))
+      (cons (list "lush-complete" arg)
+            (list (point-min) pos)))))
+
+(defun pcomplete/lush-complete ()
+  "Complete the symbol at point"
+  (let* ((sym (cadr (car (lush-parse-arguments))))
+         (completions (lush-complete sym)))
+    (if completions
+        (throw 'pcomplete-completions completions)
+      (pcomplete-here (pcomplete-all-entries)))))
+
+(defun lush-indent-and-complete-symbol ()
+  "This function is stolen from slime.el of the slie package.
+Indents the current line and performs symbol completion.  First
+indent the line. If indenting doesn't move point, complete the
+symbol.  If there's no symbol at the point, show the arglist for
+the most recently enclosed macro or function."
+  (interactive)
+  (let ((pos (point)))
+    (unless (get-text-property (line-beginning-position) 'lush-repl-prompt)
+      (lisp-indent-line))
+    (when (= pos (point))
+      (cond ((save-excursion (re-search-backward "[^() \n\t\r]+\\=" nil t))
+             (pcomplete))))))
 
 ;; detection
 (setq auto-mode-alist (cons (cons "\\.sn$" 'lisp-mode) auto-mode-alist))
@@ -119,3 +280,35 @@
    "\\<:\\sw\\sw+\\>" 0 (internal-find-face 'default) t t)
 ) )
 
+;; Compare to comint-redirect-results-list - less processing required
+;; if this is all that is needed.  A regexp of (.*) running on output
+;; like: ("abe" "bat" "cat" "dat"...) will have a stack overflow with
+;; significantly large output.
+(defun lush-results-from-process (process command &optional beg-string end-string)
+  "Send COMMAND to PROCESS.
+Return the result of COMMAND starting with BEG-STRING and ending
+with END-STRING if non-nil.  If BEG-STRING is nil, the result
+string will start from (point) in the results buffer.  If
+END-STRING is nil, the result string will end at (point-max) in
+the results buffer."
+  (let ((output-buffer " *Comint Redirect Work Buffer*"))
+    (save-excursion
+      (set-buffer (get-buffer-create output-buffer))
+      (erase-buffer)
+      (comint-redirect-send-command-to-process command
+					       output-buffer process nil t)
+      ;; Wait for the process to complete
+      (set-buffer (process-buffer process))
+      (while (null comint-redirect-completed)
+	(accept-process-output nil 1))
+      ;; Collect the output
+      (set-buffer output-buffer)
+      (goto-char (point-min))
+      ;; Skip past the command, if it was echoed
+      (and (looking-at command)
+	   (forward-line))
+      (let ((beg (if beg-string 
+                     (progn (search-forward beg-string nil t) (match-beginning 0)) 
+                   (point)))
+            (end (if end-string (search-forward end-string nil t) (point-max))))        
+        (buffer-substring-no-properties beg end)))))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/include/check_func.h lush-cvs/include/check_func.h
--- lush/include/check_func.h	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/include/check_func.h	2009-10-16 12:07:04.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: check_func.h,v 1.10 2004/10/23 01:23:55 leonb Exp $
+ * $Id: check_func.h,v 1.11 2009/10/16 16:07:04 leonb Exp $
  **********************************************************************/
 
 #ifndef CHECK_FUNC_H
@@ -49,7 +49,7 @@
 
 
 struct dh_trace_stack {
-    char *info;
+    const char *info;
     struct dh_trace_stack *next;
 };
 
@@ -127,8 +127,8 @@
 /* ---------------------------------------- */
 
 
-LUSHAPI void srg_resize_compiled(struct srg* ,intg ,char *, int);
-LUSHAPI void srg_resize(struct srg *, intg , char *, int );
+LUSHAPI void srg_resize_compiled(struct srg* ,intg, const char *, int);
+LUSHAPI void srg_resize(struct srg *, intg , const char *, int );
 LUSHAPI void srg_free(struct srg *);
 
 #define Mis_sized(i1) \
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/include/define.h lush-cvs/include/define.h
--- lush/include/define.h	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/include/define.h	2009-09-11 19:25:26.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: define.h,v 1.15 2005/06/03 04:10:09 leonb Exp $
+ * $Id: define.h,v 1.16 2009/09/11 23:25:26 leonb Exp $
  **********************************************************************/
 
 #ifndef DEFINE_H
@@ -174,6 +174,7 @@
 #endif
 
 #ifndef STDC_HEADERS
+#ifndef __APPLE__
 # ifdef toupper
 #  undef toupper
 # endif
@@ -183,6 +184,7 @@
 # define NEED_TOUPPER
 # define NEED_TOLOWER
 #endif
+#endif
 
 #ifdef HAVE_WCHAR_H
 # include <wchar.h>
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/include/dh.h lush-cvs/include/dh.h
--- lush/include/dh.h	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/include/dh.h	2009-10-16 12:07:04.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: dh.h,v 1.20 2004/10/23 01:23:55 leonb Exp $
+ * $Id: dh.h,v 1.21 2009/10/16 16:07:04 leonb Exp $
  **********************************************************************/
 #ifndef DH_H
 #define DH_H
@@ -126,7 +126,7 @@
   enum dht_type op;	    /* Type of the record */
   short access;             /* Type of access */
   short ndim;		    /* number of dimensions/fields */
-  char *name;               /* field name */
+  const char *name;         /* field name */
   void *arg;                /* field argument */
   struct s_dhrecord *end;   /* point on the next dhrecord. */
 } dhrecord;
@@ -233,10 +233,10 @@
 {
   dhrecord *argdata;            /* points to the metainformation records */
   struct {
-    char *c_name;		/* string with the C_name */
-    char *m_name;		/* string with the M_name or nil */
+    const char *c_name;		/* string with the C_name */
+    const char *m_name;		/* string with the M_name or nil */
     dharg (*call)(dharg *);	/* pointer to the X_name function */
-    char *k_name;               /* string with the K_name_Rxxxxxxxx */
+    const char *k_name;         /* string with the K_name_Rxxxxxxxx */
     dhdoc_t *dhtest;            /* pointer to the dhdoc for the testfunc */ 
   } lispdata;
 };
@@ -298,12 +298,12 @@
   dhrecord *argdata;            /* points to the metainformation records */
   struct {
     dhclassdoc_t *ksuper;       /* dhclassdoc for the superclass */
-    char *lname;                /* string with the lisp class name */
-    char *cname;                /* string with the c class name 
+    const char *lname;          /* string with the lisp class name */
+    const char *cname;          /* string with the c class name 
                                    (prepend CClass_ or VClass_) */
-    char *v_name;               /* string with the name of the vtable 
+    const char *v_name;         /* string with the name of the vtable 
                                    (V_name_Rxxxxxxxx) */
-    char *k_name;               /* string with the name of the classdoc 
+    const char *k_name;         /* string with the name of the classdoc 
                                    (K_name_Rxxxxxxxx) */
     int size;                   /* data size */
     int nmet;                   /* number of methods */
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/include/header.h lush-cvs/include/header.h
--- lush/include/header.h	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/include/header.h	2009-10-16 12:07:04.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: header.h,v 1.67 2006/02/22 22:28:06 leonb Exp $
+ * $Id: header.h,v 1.70 2009/10/16 16:07:04 leonb Exp $
  **********************************************************************/
 
 #ifndef HEADER_H
@@ -98,7 +98,7 @@
 #ifdef UNIX
 /* interruptions */
 extern TLAPI int break_attempt;
-TLAPI void lastchance(char *s) no_return;
+TLAPI void lastchance(const char *s) no_return;
 /* unix hooks */
 void init_unix(void);
 void fini_unix(void);
@@ -367,12 +367,12 @@
 TLAPI void garbage(int flag);
 
 /* Allocation functions */
-LUSHAPI void *lush_malloc(int,char*,int);
-LUSHAPI void *lush_calloc(int,int,char*,int);
-LUSHAPI void *lush_realloc(gptr,int,char*,int);
-LUSHAPI void lush_free(gptr,char*,int);
-LUSHAPI void lush_cfree(gptr,char*,int);
-LUSHAPI void set_malloc_file(char*);
+LUSHAPI void *lush_malloc(int,const char*,int);
+LUSHAPI void *lush_calloc(int,int,const char*,int);
+LUSHAPI void *lush_realloc(gptr,int,const char*,int);
+LUSHAPI void lush_free(gptr,const char*,int);
+LUSHAPI void lush_cfree(gptr,const char*,int);
+LUSHAPI void set_malloc_file(const char*);
 
 /* Malloc debug file (from sn3.2) */
 #define malloc(x)    lush_malloc(x,__FILE__,__LINE__)
@@ -430,9 +430,9 @@
 #define SYMBOL_UNLOCKED 1
 
 
-TLAPI at *new_symbol(char *s);
-TLAPI at *named(char *s);
-TLAPI at *namedclean(char *s);
+TLAPI at *new_symbol(const char *s);
+TLAPI at *named(const char *s);
+TLAPI at *namedclean(const char *s);
 TLAPI char *nameof(at *p);
 TLAPI void symbol_push (at *p, at *q);
 TLAPI void symbol_pop (at *p);
@@ -444,7 +444,7 @@
 TLAPI void var_SET(at *p, at *q); /* Set variable regardless of lock mode */
 TLAPI void var_lock(at *p);
 TLAPI at *var_get(at *p);
-TLAPI at *var_define(char *s);
+TLAPI at *var_define(const char *s);
 
 
 
@@ -470,8 +470,8 @@
   /* contains info for printing error messages */
   at *this_call;
   at *error_call;
-  char *error_prefix;
-  char *error_text;
+  const char *error_prefix;
+  const char *error_text;
   at *error_suffix;
   short debug_tab;
   short ready_to_an_error;
@@ -494,8 +494,9 @@
   sigjmp_buf error_jump;
   char *input_string;
   FILE *input_file;
-  FILE *output_file;
   short input_tab;
+  short input_case_sensitive;
+  FILE *output_file;
   short output_tab;
 } *context;
 
@@ -503,8 +504,8 @@
 TLAPI void context_pop(void);
 TLAPI int  recur_push_ok(struct recur_elt *elt, void *call, at *p);
 TLAPI void recur_pop(struct recur_elt *elt);
-TLAPI void toplevel(char *in, char *out, char *new_prompt);
-TLAPI void error(char *prefix, char *text, at *suffix) no_return;
+TLAPI void toplevel(const char *in, const char *out, const char *new_prompt);
+TLAPI void error(const char *prefix, const char *text, at *suffix) no_return;
 TLAPI void user_break(char *s);
 TLAPI void init_lush (char *program_name);
 TLAPI void start_lisp(int argc, char **argv, int quiet);
@@ -536,11 +537,12 @@
 TLAPI char *str_number_hex(double x);
 TLAPI char *str_gptr(gptr x);
 
-TLAPI char *regex_compile(char *pattern, short int *bufstart, short int *bufend,
+TLAPI char *regex_compile(char *pattern, 
+                          unsigned short *bufstart, unsigned short *bufend,
 			  int strict, int *rnum);
-TLAPI int regex_exec(short int *buffer, char *string, 
+TLAPI int regex_exec(unsigned short *buffer, char *string, 
 		     char **regptr, int *reglen, int nregs);
-TLAPI int regex_seek(short int *buffer, char *string, char *seekstart, 
+TLAPI int regex_seek(unsigned short *buffer, char *string, char *seekstart, 
 		     char **regptr, int *reglen, int nregs, 
 		     char **start, char **end);
 
@@ -651,31 +653,31 @@
 #define OPEN_READ(f,s)  new_extern(&file_R_class,open_read(f,s))
 #define OPEN_WRITE(f,s) new_extern(&file_W_class,open_write(f,s))
 
-TLAPI char *cwd(char *s);
-TLAPI at *files(char *s);
-TLAPI int dirp(char *s);
-TLAPI int filep(char *s);
-TLAPI char *dirname(char *fname);
-TLAPI char *basename(char *fname, char *suffix);
-TLAPI char *concat_fname(char *from, char *fname);
-TLAPI char *relative_fname(char *from, char *fname);
+TLAPI char *cwd(const char *s);
+TLAPI at *files(const char *s);
+TLAPI int dirp(const char *s);
+TLAPI int filep(const char *s);
+TLAPI const char *dirname(const char *fname);
+TLAPI const char *basename(const char *fname, const char *suffix);
+TLAPI const char *concat_fname(const char *from, const char *fname);
+TLAPI const char *relative_fname(const char *from, const char *fname);
 TLAPI void clean_tmp_files(void);
-TLAPI char *tmpname(char *s, char *suffix);
-TLAPI char *search_file(char *s, char *suffixes);
+TLAPI const char *tmpname(const char *s, const char *suffix);
+TLAPI const char *search_file(const char *s, const char *suffixes);
 TLAPI void test_file_error(FILE *f);
-TLAPI FILE *open_read(char *s, char *suffixes);
-TLAPI FILE *open_write(char *s, char *suffixes);
-TLAPI FILE *open_append(char *s, char *suffixes);
-TLAPI FILE *attempt_open_read(char *s, char *suffixes);
-TLAPI FILE *attempt_open_write(char *s, char *suffixes);
-TLAPI FILE *attempt_open_append(char *s, char *suffixes);
+TLAPI FILE *open_read(const char *s, const char *suffixes);
+TLAPI FILE *open_write(const char *s, const char *suffixes);
+TLAPI FILE *open_append(const char *s, const char *suffixes);
+TLAPI FILE *attempt_open_read(const char *s, const char *suffixes);
+TLAPI FILE *attempt_open_write(const char *s, const char *suffixes);
+TLAPI FILE *attempt_open_append(const char *s, const char *suffixes);
 TLAPI void file_close(FILE *f);
-TLAPI void set_script(char *s);
+TLAPI void set_script(const char *s);
 TLAPI int read4(FILE *f);
 TLAPI int write4(FILE *f, unsigned int l);
 TLAPI off_t file_size(FILE *f);
 #ifndef HAVE_STRERROR
-TLAPI char *strerror(int errno);
+TLAPI const char *strerror(int errno);
 #endif
 
 
@@ -687,7 +689,7 @@
 extern TLAPI char *prompt_string;
 
 TLAPI void print_char (char c);
-TLAPI void print_string(char *s);
+TLAPI void print_string(const char *s);
 TLAPI void print_list(at *list);
 TLAPI void print_tab(int n);
 TLAPI char *pname(at *l);
@@ -696,7 +698,7 @@
 TLAPI char next_char(void);
 TLAPI int  ask (char *t);
 TLAPI char *dmc(char *s, at *l);
-TLAPI char skip_char(char *s);
+TLAPI char skip_char(const char *s);
 TLAPI char skip_to_expr(void);
 TLAPI at *read_list(void);
 
@@ -783,20 +785,20 @@
 
 extern LUSHAPI class module_class;
 
-TLAPI void class_define(char *name, class *cl);
-TLAPI void dx_define(char *name, at *(*addr) (int, at **));
-TLAPI void dy_define(char *name, at *(*addr) (at *));
-LUSHAPI void dxmethod_define(class *cl, char *name, at *(*addr) (int, at **));
-LUSHAPI void dymethod_define(class *cl, char *name, at *(*addr) (at *));
-
-LUSHAPI void dhclass_define(char *name, dhclassdoc_t *kclass);
-LUSHAPI void dh_define(char *name, dhdoc_t *kname);
-LUSHAPI void dhmethod_define(dhclassdoc_t *kclass, char *name, dhdoc_t *kname);
+TLAPI void class_define(const char *name, class *cl);
+TLAPI void dx_define(const char *name, at *(*addr) (int, at **));
+TLAPI void dy_define(const char *name, at *(*addr) (at *));
+LUSHAPI void dxmethod_define(class *cl, const char *name, at *(*addr) (int, at **));
+LUSHAPI void dymethod_define(class *cl, const char *name, at *(*addr) (at *));
+
+LUSHAPI void dhclass_define(const char *name, dhclassdoc_t *kclass);
+LUSHAPI void dh_define(const char *name, dhdoc_t *kname);
+LUSHAPI void dhmethod_define(dhclassdoc_t *kclass, const char *name, dhdoc_t *kname);
 
 LUSHAPI void check_primitive(at *prim, void *info);
 LUSHAPI at *find_primitive(at *module, at *name);
 LUSHAPI at *module_list(void);
-LUSHAPI at *module_load(char *filename, at *hook);
+LUSHAPI at *module_load(const char *filename, at *hook);
 LUSHAPI void module_unload(at *atmodule);
 
 
@@ -1284,7 +1286,7 @@
 
 extern LUSHAPI int run_time_error_flag;
 extern LUSHAPI jmp_buf run_time_error_jump;
-LUSHAPI void run_time_error(char *s);
+LUSHAPI void run_time_error(const char *s);
 
 
 /* EVENT.H ----------------------------------------------------- */
@@ -1312,7 +1314,7 @@
 
 /* Compatible event queue functions */
 LUSHAPI void  enqueue_event(at*, int event, int, int, int, int);
-LUSHAPI void  enqueue_eventdesc(at*, int event, int, int, int, int, char*);
+LUSHAPI void  enqueue_eventdesc(at*, int event, int, int, int, int, const char*);
 #define EVENT_NONE        (-1L)
 #define EVENT_ASCII_MIN   (0L)
 #define EVENT_ASCII_MAX   (255L)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/include/idxops.h lush-cvs/include/idxops.h
--- lush/include/idxops.h	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/include/idxops.h	2006-11-12 01:31:43.000000000 -0500
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: idxops.h,v 1.6 2005/10/06 22:17:36 profshadoko Exp $
+ * $Id: idxops.h,v 1.7 2006/11/12 06:31:43 profshadoko Exp $
  **********************************************************************/
 
 #ifndef IDXOPS_H
@@ -75,7 +75,7 @@
 /* ============== copy operations, m0, m1, m2, ma =========== */
 
 #define Midx_m0copy(i1,i2, Type1, Type2) \
-   *IDX_PTR(i2, Type1) = *IDX_PTR(i1, Type2)
+   *IDX_PTR(i2, Type2) = *IDX_PTR(i1, Type1)
 
 #define Midx_m1copy(i1,i2, Type1, Type2) \
 { Type1 *c1; \
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/include/lushconf.h.in lush-cvs/include/lushconf.h.in
--- lush/include/lushconf.h.in	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/include/lushconf.h.in	2008-01-23 17:45:06.000000000 -0500
@@ -202,6 +202,9 @@
 /* Define to 1 if you have the `putenv' function. */
 #undef HAVE_PUTENV
 
+/* Define to 1 if you have the <readline/history.h> header file. */
+#undef HAVE_READLINE_HISTORY_H
+
 /* Define to 1 if you have the <readline/readline.h> header file. */
 #undef HAVE_READLINE_READLINE_H
 
@@ -369,13 +372,13 @@
 /* Define to `int' if <sys/types.h> does not define. */
 #undef mode_t
 
-/* Define to `long' if <sys/types.h> does not define. */
+/* Define to `long int' if <sys/types.h> does not define. */
 #undef off_t
 
 /* Define to `int' if <sys/types.h> does not define. */
 #undef pid_t
 
-/* Define to `unsigned' if <sys/types.h> does not define. */
+/* Define to `unsigned int' if <sys/types.h> does not define. */
 #undef size_t
 
 /* Define as `fork' if `vfork' does not work. */
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/local/local-manual.hlp lush-cvs/local/local-manual.hlp
--- lush/local/local-manual.hlp	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/local/local-manual.hlp	2003-01-14 18:34:33.000000000 -0500
@@ -0,0 +1,7 @@
+
+#? **** Local Packages
+This section contains the documentation of
+packages that are special to your local installation of Lush.
+Those packages can be found in the <local> directory in the 
+Lush installation directory.
+ 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/local/mnist/README lush-cvs/local/mnist/README
--- lush/local/mnist/README	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/local/mnist/README	2004-02-11 13:11:38.000000000 -0500
@@ -0,0 +1,4 @@
+The mnist data files should be 
+manually added in this directory.
+You can find them at
+http://yann.lecun.com/exdb/mnist/index.html
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/compiler/compiler.hlp lush-cvs/lsh/compiler/compiler.hlp
--- lush/lsh/compiler/compiler.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/compiler/compiler.hlp	2007-11-12 00:34:15.000000000 -0500
@@ -659,10 +659,10 @@
 to in the Lisp code by preceding them with a dollar sign.
 {<ul>
  {<li> <$legal-c-identifier> refers to the lisp variable of the same name}
- {<li> <$legal-lisp-variable> refers to the lisp variable (the braces
+ {<li> <${legal-lisp-variable}> refers to the lisp variable (the braces
    are required if the lisp variable name is not a legal C name,
    e.g. if it contains dashes).}
- {<li> <($lisp expression)> refers to the result returned be the lisp 
+ {<li> <$(lisp expression)> refers to the result returned be the lisp 
   expression.}
 }
 
@@ -834,14 +834,158 @@
 
 #? ** << libc/constants.lsh
 
-#? ** Interfacing C Code
-[under construction]
+#? ** Interfacing C/C++ Code
+
+Using Lush's inline C capability and the <mod-load> function,
+interfacing existing C code to Lush is extremely simple.
+
+#? * Calling C/C++ functions defined in a library
+
+If the code is available as a dynamic library <libasd.so>
+or a static library <libasd.a>, one merely needs to 
+include the library and the header file in a call
+to <dhc-make-with-libs>. Let's assume that our library
+defines a function <cblah> that we would like to call
+in a Lush function <blah>. Here is an example:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+
+ (dhc-make-with-libs ()
+   '("libasd.so")
+   #{ #include <asd.h> #}
+   blah)
+</code>}
+This will only work if <libasd.so> is in the system's library search path,
+and if <asd.h> is in the standard header file search path.
+
+Let's say that <libasd.so> and <asd.h> were placed in the same directory
+as our Lush file, we can do the following:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+
+ (libload "libc/make")
+ (let* ((current-dir (dirname file-being-loaded))
+        (dhc-make-lushflags (concat dhc-make-lushflags (sprintf " -I%s" current-dir))))
+
+   (dhc-make-with-libs ()
+     (list (concat current-dir "/libpng.so"))
+     #{ #include "asd.h" #}
+   blah))
+</code>}
+
+
+
+#? * Calling C/C++ functions defined in an object file
+
+If the code is available as an object file </wherever/asd.o>, one
+merely needs to do <(mod-load "/wherever/asd.o")>.  The C functions
+and global variables defined in <asd.o> are automatically visible from
+inline C code in Lush.
+
+Here is a simple example of a Lush file that dynamically loads <asd.o>
+and defines a function <blah> that calls the C function <cblah>
+defined in <asd.o>:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+ 
+ (mod-load "/wherever/asd.o")
+ (dhc-make ()
+   #{ double cblah(double); #}
+   blah)
+</code>}    
+
+Rather than explicitely defining the C prototype of <cblah> in
+the <dhc-make> call, one may prefer to include the header file <asd.h> 
+that corresponds to <asd.o>. This can be done easily:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+ 
+ (mod-load "/wherever/asd.o")
+ (dhc-make ()
+   #{ #include "/wherever/asd.h" #}
+   blah)
+</code>}    
+
+Naturally, rather than refering to absolute paths, we may prefer
+to put <asd.o> and <asd.h> in the same directory as our Lush file.
+In that case, we need to tell Lush and the C compiler where to find
+everything:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+ 
+ (let* ((current-dir (dirname file-being-loaded))
+        (dhc-make-lushflags (concat dhc-make-lushflags (sprintf " -I%s" current-dir))))
+   (mod-load (concat current-dir "/asd.o"))
+   (dhc-make ()
+     #{ #include "asd.h" #}
+   blah))
+</code>}
+Redefining <dhc-make-lushflags> like this will add the directory where the
+Lush file resides to the path in which the C compiler looks for header files.
+
+Naturally, all of this assumes that <asd.o> has previously been compiled.
+Lush conveniently provides a "make"-like utility to compile C files
+and specify dependencies called <LushMake> (see the corresponding documentation. 
+Using <LushMake> as shown below will automatically generate
+<asd.o> when the Lush file is loaded, whenever <asd.c> or <asd.h> 
+have been modified:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+
+ (libload "libc/make")
+ (let* ((current-dir (dirname file-being-loaded))
+        (dhc-make-lushflags (concat dhc-make-lushflags (sprintf " -I%s" current-dir)))
+        (lm (new LushMake current-dir)))
+   ;; compile asd.c to asd.o and mod-load asd.o
+   (==> lm setflags (sprintf "-I%s" current-dir))
+   (==> lm rule "asd.o"  '("asd.c" "asd.h"))
+   (==> lm load)
+
+   (dhc-make ()
+     #{ #include "asd.h" #}
+   blah))
+</code>}
+
+Perhaps the functions defined in <asd.o> call functions from 
+a library that must be linked-in, say <libpng.so>. These 
+libraries can easily be added into using <dhc-make-with-libs> 
+instead of <dhc-make>:
+{<code>
+ (de blah (x) ((-double-) x) (to-double #{ cblah($x) #}))
+
+ (libload "libc/make")
+ (let* ((current-dir (dirname file-being-loaded))
+        (dhc-make-lushflags (concat dhc-make-lushflags (sprintf " -I%s" current-dir)))
+        (lm (new LushMake current-dir)))
+   ;; compile asd.c to asd.o and mod-load asd.o
+   (==> lm setflags (sprintf "-I%s" current-dir))
+   (==> lm rule "asd.o"  '("asd.c" "asd.h"))
+   (==> lm load)
+
+   (dhc-make-with-libs ()
+     '("libpng.so")
+     #{ #include "asd.h" #}
+   blah))
+</code>}
+
+If our code in <asd.c> is written in C++ instead of C,
+we must replace the call to <dhc-make-with-libs> with
+<dhc-make-with-c++>.
+
 
-#? ** Interfacing C++ Code
-[under construction]
 
 #? ** Interfacing FORTRAN Code
-[under construction]
+
+[This section is under construction]
+
+Basically, this works like calling C code.
+FORTRAN libraries can be loaded 
+
+
+
+#? *** << make-standalone.lsh
+
+
 
 #? *** More on the Lisp-C Interface
 [under construction]
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/compiler/dh-compile.lsh lush-cvs/lsh/compiler/dh-compile.lsh
--- lush/lsh/compiler/dh-compile.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/compiler/dh-compile.lsh	2009-10-01 08:49:42.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: dh-compile.lsh,v 1.64 2005/05/09 01:21:55 leonb Exp $
+;;; $Id: dh-compile.lsh,v 1.65 2009/10/01 12:49:42 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -522,6 +522,7 @@
           (each ((slot slot-list))
             (let ((sym (new dhc-symbol (car slot) 0)))
               (dhc-unify-types (cdr slot) :sym:type)
+              (==> :sym:type access 'write)
               (setq :sym:c-name 
                     (concat "L1_this->" 
                             (dhc-lisp-to-c-slot-name (nameof (car slot)))) )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/compiler/dh-macro.lsh lush-cvs/lsh/compiler/dh-macro.lsh
--- lush/lsh/compiler/dh-macro.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/compiler/dh-macro.lsh	2008-07-07 11:16:33.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: dh-macro.lsh,v 1.50 2006/11/07 20:31:49 leonb Exp $
+;;; $Id: dh-macro.lsh,v 1.52 2008/07/07 15:16:33 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -1109,26 +1109,36 @@
 ;;; DIADIC FUNCTIONS
 ;;; -----------------
 (dhm-t -(source)
-  (when (and (<> 2 (length source)) (<> 3 (length source)) )
-	(dhc-error "wrong number of arguments"))
-  (process-numerical-args-t (cdr source)))
-
+  (cond
+   ((> (length source) 3)
+    (let ((ns `(progn (- ,(cadr source) (+ ,@(cddr source))))))
+      (dhc-parse-replacement-source-t source ns) ) )
+   ((< (length source) 2)
+    (dhc-error "wrong number of arguments") )
+   (t
+    (process-numerical-args-t (cdr source)) ) ) )
+   
 (dhm-c -(source treetype retplace)
-   (let ((arg1 (dhc-parse-expr-c (cadr source) (cadr :treetype:tn-list) ())))
-     (if (= (length source) 2)
-	 (concat "(-" arg1 ")")
-       (concat "(" arg1 "-" (dhc-parse-expr-c (caddr source) 
-					      (caddr :treetype:tn-list)
-					      ()) ")"))))
+  (let ((arg1 (dhc-parse-expr-c (cadr source) (cadr :treetype:tn-list) ())))
+    (if (= (length source) 2)
+        (concat "(-" arg1 ")")
+      (concat "(" arg1 "-" (dhc-parse-expr-c (caddr source) 
+                                             (caddr :treetype:tn-list)
+                                             ()) ")"))))
 
 (dhm-t /(source)
-  (when (and (<> 2 (length source)) (<> 3 (length source)) )
-	(dhc-error "wrong number of arguments"))
-  (let ((tnode (process-numerical-args-t (cdr source))))
-    ;; integer division in C isn't used
-    (when (==> :tnode:type is-an-int)
-      (setq :tnode:type (new dhc-type 'dht-real)))
-    tnode))
+  (cond
+   ((> (length source) 3)
+    (let ((ns `(progn (/ ,(cadr source) (* ,@(cddr source))))))
+      (dhc-parse-replacement-source-t source ns) ) )
+   ((< (length source) 2)
+    (dhc-error "wrong number of arguments") )
+   (t
+    (let ((tnode (process-numerical-args-t (cdr source))))
+      ;; integer division in C isn't used
+      (when (==> :tnode:type is-an-int)
+        (setq :tnode:type (new dhc-type 'dht-real)))
+      tnode) ) ) )
 
 (de dhc-c-cast (type)
     (if (==> type is-a-real) "(real)"
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/compiler/dh-util.lsh lush-cvs/lsh/compiler/dh-util.lsh
--- lush/lsh/compiler/dh-util.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/compiler/dh-util.lsh	2006-11-16 11:28:16.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: dh-util.lsh,v 1.56 2005/04/25 18:57:06 leonb Exp $
+;;; $Id: dh-util.lsh,v 1.57 2006/11/16 16:28:16 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -480,6 +480,8 @@
            (kname (sprintf "Kc_%s_R%s" cname (dhu-hash ctype))) )
       (when (dhu-class ctype)
         (dhc-add-c-externs 
+         (dhc-class-to-vtable-decl (dhu-type type)) )
+        (dhc-add-c-externs
          (sprintf "extern_c struct VClass_%s Vt_%s;" cname cname) )
         (dhc-add-c-externs
          (dhc-class-to-struct-decl (dhu-type type)) ) )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/compiler/make-standalone.lsh lush-cvs/lsh/compiler/make-standalone.lsh
--- lush/lsh/compiler/make-standalone.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/compiler/make-standalone.lsh	2006-12-24 09:23:09.000000000 -0500
@@ -139,11 +139,15 @@
 ;; This does not check if the C file actually exists, it merely
 ;; returns its supposed path. This simply turns a string of the form
 ;; "blah/asd.lsh" into a string of the form "blah/C/asd.c".
-(de lushc.lsh-to-c (fname)
+
+(de lushc.lsh-to-c (fname) ;; old version, wrong sometimes
   (concat (dirname fname) "/C/" 
 	  (dhc-lisp-to-c-name (basename (filename-chop-suffixes fname))) 
 	  "." (or (getconf "CEXT") "c")))
 
+(de lushc.lsh-to-c (fname) ;; new version., correct in all cases
+  (dhc-make-c-filename fname) )
+
 
 #? (lushc.o-to-c <oname>)
 ;; get the name of the compiler-generated .c file that corresponds to a 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/compiler/quicktour.txt lush-cvs/lsh/compiler/quicktour.txt
--- lush/lsh/compiler/quicktour.txt	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/lsh/compiler/quicktour.txt	2009-09-03 08:30:05.000000000 -0400
@@ -0,0 +1,237 @@
+
+This file contains a summary description of 
+the Lush compiler internals. This overview
+hopefully helps making sense of the comments
+in the code and of the code itself.
+
+The compiler was started in 1991 by Leon Bottou,
+completed in 1992 by Yann LeCun, redesigned in 1995-1996 by 
+Patrice Simard, and slightly refreshed in 2002 by Leon Bottou.
+The present overview was written in 2009 by Leon Bottou.
+Please allow for some memory lapses...
+
+The compiler is implemented in three files 
+<"dh-util.lsh">, <"dh-macro.lsh">, and <"dh-compiler.lsh">.
+Each file is neatly separated in sections using large comments.
+
+
+FILE DH-UTIL.LSH
+----------------
+
+File <"dh-util.lsh"> contains the following sections:
+
+- Section UTILITIES contains small utilities:
+  list manipulation functions, accessors for type fields,
+  helpers for generating code, etc.
+
+- Section TYPE INFERENCE defines an object class to 
+  represent types. Most fields of a type object 
+  are represented by "unodes" in order to support 
+  type inference. The unode functions are defined in at.c
+  but I cannot find their documentation.
+
+  Basically unodes are lisp trees that can be 
+  attached together using physical list manipulation.
+  They are created using function <new-unode>.
+  Each unode has a value accessed with function <unode-val>.
+  Example:
+  ? (setq ua (new-unode 1))
+  = (() . 1)
+  ? (setq ub (new-unode 2))
+  = (() . 2)
+  ? (setq uc (new-unode 3)))
+  = (() . 3)
+  ? (unode-val ua)
+  = 1
+  ? (unode-val ub)
+  = 2
+  ? (unode-val uc)
+  = 3
+  Unodes can be "unified" with function <unode-unify>.
+  The third argument of <unode-unify> is a function
+  that merges the values of both unodes.
+  ? (unode-unify ub uc min)
+  ? (unode-val ua)
+  = 1
+  ? (unode-val ub)
+  = 2
+  ? (unode-val uc)
+  = 2  ;<<<<< CHANGED 
+  and function <unode-eq> tests if unodes have been unified.
+  ? (if (unode-eq ua ub) 't)
+  = ()
+  ? (if (unode-eq uc ub) 't)
+  = t
+  Unification works by joining the unode trees
+  with a common new pair containing the unified 
+  value of both unodes.
+  ? ub
+  = ((() . 2) . 2)
+  ? uc
+  = ((() . 2) . 3)
+  ? (== (car ub) (car uc))
+  = t
+  Unification is transitive.
+  In the following example, since ub and uc are unified,
+  unifying ub and ua also unifies ua and uc:
+  ? (unode-unify ub ua min)
+  ? (if (unode-eq ua uc) 't)
+  = t
+  ? (unode-val uc)
+  = 1 ;<<<<<< CHANGED  
+
+  For the little history, when lush was still called "sn",
+  there used to be a package "prolog.sn" implementing 
+  a prolog-like rule system using unodes. 
+
+  The file <"dh-util.lsh"> defines a number of functions that
+  are used to compute the unified values of various
+  fields of the type structure.  These functions
+  are often called <dhc-combine-xxx>.
+  All this is usually called through function <dhc-unify-t> 
+  which unifies all the fields of two type objects or 
+  complain when the types are incompatible.
+
+  The fields <u-bump> and <u-access> are unusual for type structures.
+  The value of field <u-access> records whether a variablas been written to.
+  The value of field <u-bump> is the outermost lexical level inside a function
+  where the type has been encountered.  These are the key components
+  of the escape analysis mechanism for identifying which objects allocated 
+  inside a function need to be preserved after the function returns.
+  Such things were quite rare in 1995.
+
+  When compiling a function (or a class) the compiler
+  uses function <dhc-gather-type> to collect all the types
+  associated with stuff returned by the function 
+  such as the return value, but also all the slots of objects
+  passed as arguments when they have been written to.
+  The compiler then unifies their u-bump field with value 0 to 
+  indicate that their values can be used outside the function.
+  This propagates to all types that have ever been unified
+  with these return points, and in particular to the types
+  of all objects allocated inside the function.  Those
+  with bump level zero are then changed into hidden
+  function argument in the hope that they will not escape 
+  the calling function.  This happens in <"dh-compiler.lsh">.
+
+  Note that unification (a transitive equivalence relation) 
+  is a bit too strong for this use. In theory it would have been
+  sufficient to implement an antisymmetric order relation
+  between types. As a result the compiler sometimes bumps
+  variables it could have discarded. On the other hand,
+  the compilation speed is vastly improved because the
+  unode system works very efficiently.
+
+- See below the discussion of section SYMBOL TABLE.
+
+- Section PARSER is the one I understand the least.
+  It defines the structure t-node representing the nodes
+  of the parse tree. In general the t-node for an evaluatable
+  list contains the type of the return value and
+  a list <tn-list> containing one t-node for each list 
+  element, including the function name.
+  Slot <tranfer> in the t-node is used as a placeholder
+  for information passed to the code generator.
+  Slot <ignore> is used to disable some error 
+  checks (function <unprotect>) but I believe this is 
+  now deprecated.
+
+  The parser section also defines the functions <dhm-t>, <dhm-c> and <dhm-pp>.
+  These functions provide easy means to define lisp code that the
+  compiler calls when it encounters a particular function.
+  Code defined with <dhm-pp> is called when performing the 
+  macro expansion.  Code defined with <dhm-t> is called when building
+  the parse tree.  Code defined with <dhm-c> is called when generating
+  the C code, even though this is not really part of the parser.
+  File <"dhc-macro.lsh"> defines lots of such DHM functions.
+
+  In general functions whose name ends with suffix <-t> are called 
+  when building the parse tree and functions whose name ends with suffix <-c>
+  are called when generating the C code. 
+  For instance function <dhc-parse-expr-t> takes a lisp 
+  expression and constructs the t-node for that expression.
+  This function often ends up calling the right DHM-T function
+  to do the actual work.
+
+  The corresponding function <dhc-parse-expr-c> takes a lisp 
+  expression and its parse tree, generates the corresponding c code,
+  and returns a string representing the C expression for the return value.
+  The last argument <retplace> is indicates a variable name for 
+  the return value of the expression. This argument is also found in
+  all the DHM-C functions called from this function. 
+  When <retplace> is nonnull, the C code must store the return value 
+  in that variable and the function returns <retplace>.  
+  When <retplace> is nil, the function is free to either 
+  return a C expression or allocate a variable for holding 
+  the return value and return that variable name.
+  The code for a C block delimited by braces is recorded in list of 
+  strings via functions <dhc-add-c-declarations>, <dhc-add-c-statements>, 
+  and <dhc-add-c-epilog>.  Function <dhc-push-scope-c> is called whenever
+  one wants to create a new C block.  See the DHM-C for function <let>
+  in file <"dh-macros.lsh">.
+  
+
+- Section SYMBOL TABLE first defines a structure for representing symbols.
+  In fact the symbol tables are simply alists associating the symbol name
+  to the symbol structure. This is convenient because the function <let>
+  for instance, simply extends the symbol table by prepending new alist
+  elements for the symbols it defines.  When we leave the function, 
+  we can simply restore the previous pointer.
+  This is encapsulated in macro <dhm-push-scope-t>.
+  See the DHM-T function for function <let> in <"dh-macros.lsh">.
+
+
+
+
+
+FILE DH-COMPILER.LSH
+--------------------
+
+- Section CODE GENERATION contains the essential function <dhc-generate-c>.
+  Function <dhc-generate-c> performs two passes
+  on the functions and classes listed as argument to function <dhc-make>.   
+
+  The first pass first expands all macros,
+  possibly calling the functions declared with <dhc-pp> and, 
+  in the case of a function, calls <dhc-parse-expr-t> to parse the lambda 
+  expression for each function.  All the parsing work is then done
+  by the DHM-T for <lambda> defined below.  Classes are handled with    
+  the helper function <dhc-compile-class-t> because things are 
+  a bit more complicated.  The local variable <treetype-list> accumulate
+  the list of parse trees, the local variable <global-table> contains
+  the global symbol table, and the local variable <symbol-table> contains
+  the local symbol table and is rebound whenever one calls <dhc-push-scope-t>.
+  As you can see, the compiler makes extensive use of the dynamical symbol
+  binding semantics of lush (which is precisely what it cannot compile...)
+
+  The second pass then generate the c code for all functions.
+  This is accumulated into the list of strings <c-pheader>, <c-header>
+  for the file headers, <program> for the function C code, and <metaprogram>
+  for the DHDOC information. There is also <external-symbols> and 
+  <external-metasymbols> for declaring symbols defined in other compilation
+  units, <initialization-calls> for the dh_define calls, and <c-depends> for 
+  recording the hash codes of all external dependencies. File <"dhc-util.lsh">
+  defines a number of <dhc-add-xxxx> functions to add stuff to these lists.
+  Then the pass assemble the final C code by concatenating all these
+  lists of strings in the right order...
+
+
+- Section CONTROL contains the logic that starts with function <dhc-make>
+  and eventually calls function <dhc-generate-c>.
+  This is quite well described by the "compiler internals" section 
+  of the lush documentation.
+
+
+
+
+FILE DH-MACRO.LSH
+-----------------
+
+This file defines DHM functions for all the compilable constructions....
+
+
+
+
+
+
+ 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libc/files.lsh lush-cvs/lsh/libc/files.lsh
--- lush/lsh/libc/files.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/lsh/libc/files.lsh	2007-06-14 16:04:05.000000000 -0400
@@ -0,0 +1,205 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: files.lsh,v 1.2 2007/06/14 20:04:05 profshadoko Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? *** Unix File Descriptor Handling
+;; Functions in this section provide an interface to the
+;; Unix low-level file descriptor functions, such as 
+;; <open>, <close>, <read>, <write>, <fcntl>, and <ioctl>.
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; constants
+
+(libload "libc/constants")
+
+(defconstant "O_ACCMODE" 3)
+(defconstant "O_RDONLY" 0)
+(defconstant "O_WRONLY" 1)
+(defconstant "O_RDWR" 2)
+(defconstant "O_CREAT" 64)
+(defconstant "O_EXCL" 128)
+(defconstant "O_NOCTTY" 256)
+(defconstant "O_TRUNC" 512)
+(defconstant "O_APPEND" 1024)
+(defconstant "O_NONBLOCK" 2048)
+(defconstant "O_NDELAY" 2048)
+(defconstant "O_SYNC" 4096)
+(defconstant "O_FSYNC" 4096)
+(defconstant "O_ASYNC" 8192)
+(defconstant "O_DIRECT" 16384)
+(defconstant "O_DIRECTORY" 65536)
+(defconstant "O_NOFOLLOW" 131072)
+(defconstant "O_NOATIME" 262144)
+(defconstant "O_DSYNC" 4096)
+(defconstant "O_RSYNC" 4096)
+(defconstant "O_LARGEFILE" 32768)
+(defconstant "F_DUPFD" 0)
+(defconstant "F_GETFD" 1)
+(defconstant "F_SETFD" 2)
+(defconstant "F_GETFL" 3)
+(defconstant "F_SETFL" 4)
+(defconstant "F_GETLK" 5)
+(defconstant "F_SETLK" 6)
+(defconstant "F_SETLKW" 7)
+(defconstant "F_GETLK64" 12)
+(defconstant "F_SETLK64" 13)
+(defconstant "F_SETLKW64" 14)
+(defconstant "F_SETOWN" 8)
+(defconstant "F_GETOWN" 9)
+(defconstant "F_SETSIG" 10)
+(defconstant "F_GETSIG" 11)
+(defconstant "F_SETLEASE" 1024)
+(defconstant "F_GETLEASE" 1025)
+(defconstant "F_NOTIFY" 1026)
+(defconstant "FD_CLOEXEC" 1)
+(defconstant "F_RDLCK" 0)
+(defconstant "F_WRLCK" 1)
+(defconstant "F_UNLCK" 2)
+(defconstant "F_EXLCK" 4)
+(defconstant "F_SHLCK" 8)
+(defconstant "LOCK_SH" 1)
+(defconstant "LOCK_EX" 2)
+(defconstant "LOCK_NB" 4)
+(defconstant "LOCK_UN" 8)
+(defconstant "LOCK_MAND" 32)
+(defconstant "LOCK_READ" 64)
+(defconstant "LOCK_WRITE" 128)
+(defconstant "LOCK_RW" 192)
+(defconstant "DN_ACCESS" 1)
+(defconstant "DN_MODIFY" 2)
+(defconstant "DN_CREATE" 4)
+(defconstant "DN_DELETE" 8)
+(defconstant "DN_RENAME" 16)
+(defconstant "DN_ATTRIB" 32)
+(defconstant "DN_MULTISHOT" -2147483648)
+(defconstant "FAPPEND" 1024)
+(defconstant "FFSYNC" 4096)
+(defconstant "FASYNC" 8192)
+(defconstant "FNONBLOCK" 2048)
+(defconstant "FNDELAY" 2048)
+(defconstant "POSIX_FADV_NORMAL" 0)
+(defconstant "POSIX_FADV_RANDOM" 1)
+(defconstant "POSIX_FADV_SEQUENTIAL" 2)
+(defconstant "POSIX_FADV_WILLNEED" 3)
+(defconstant "POSIX_FADV_DONTNEED" 4)
+(defconstant "POSIX_FADV_NOREUSE" 5)
+(defconstant "SYNC_FILE_RANGE_WAIT_BEFORE" 1)
+(defconstant "SYNC_FILE_RANGE_WRITE" 2)
+(defconstant "SYNC_FILE_RANGE_WAIT_AFTER" 4)
+(defconstant "SPLICE_F_MOVE" 1)
+(defconstant "SPLICE_F_NONBLOCK" 2)
+(defconstant "SPLICE_F_MORE" 4)
+(defconstant "SPLICE_F_GIFT" 8)
+
+
+#? * file-desc
+;; Unix file descriptor
+(defclass file-desc object
+  ((-int-) fd))
+
+#? (new file-desc <filename> <flags>)
+;; Open a new file descriptor object on file <filename>
+;; (a string), with flags <flags>.
+;; The <flags> variable can be any additive combination of 
+;; the constants:
+;; <O_RDONLY>, <O_WRONLY>, <O_RDWR>, <O_ACCMODE>,
+;; <O_CREAT>, <O_EXCL>, <O_NOCTTY>, <O_TRUNC>,
+;; <O_APPEND>, <O_NONBLOCK>, <O_NDELAY>, <O_SYNC>,
+;; <O_FSYNC>, <O_ASYNC>, <O_DIRECT>, <O_DIRECTORY>,
+;; <O_NOFOLLOW>, <O_NOATIME>.
+;; The <fd> slot contains the integer Unix filed descriptor.
+;; The file is automatically closed when the object is destroyed.
+;; Examples:
+;; {{<code>
+;;  (setq f (new file-desc "blah" (+ @O_RDWR @O_NOCTTY @O_NONBLOCK)))
+;;  (setq f ()) ;; close file descriptor
+;; </code>}
+(defmethod file-desc file-desc (s flags)
+  ((-str-) s)
+  ((-int-) flags)
+  (setq fd (fd-open s flags))
+  (when (< fd 0) (error "could not open file"))
+  ())
+
+(defmethod file-desc -destructor ()
+  (when (>= fd 0) (fd-close fd)))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? * low-level Unix file descriptor functions
+
+#? (fd-open <s> <flags>)
+;; open file <s> using Unix function <open>.
+;; returns an integer file descriptor, or a negative
+;; number if the operation failed. <flags> 
+;; can be any combination of the constants
+;; <O_RDONLY>, <O_WRONLY>, <O_RDWR>, <O_ACCMODE>,
+;; <O_CREAT>, <O_EXCL>, <O_NOCTTY>, <O_TRUNC>,
+;; <O_APPEND>, <O_NONBLOCK>, <O_NDELAY>, <O_SYNC>,
+;; <O_FSYNC>, <O_ASYNC>, <O_DIRECT>, <O_DIRECTORY>,
+;; <O_NOFOLLOW>, <O_NOATIME>.
+;; example:
+;; {<code>
+;;  (setq fd (open "blah" (+ @O_RDWR @O_NOCTTY @O_NONBLOCK)))
+;; </code>}
+(de fd-open (s flags)
+  ((-str-) s)
+  ((-int-) flags)
+  (to-int #{ open($s->data, $flags) #}))
+
+#? (fd-close <fd>)
+;; close file descriptor <fd>.
+(de fd-close (fd)
+  ((-int-) fd)
+  (to-int #{ close($fd) #}))
+
+#? (fd-fcntl <fd> <cmd> <arg>)
+;; file control.
+(de fd-fcntl (fd cmd arg)
+  ((-int-) fd cmd arg)
+  (to-int #{ fcntl($fd,$cmd,(long)$arg) #}))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(dhc-make 
+ ()
+ #{
+   #include <sys/types.h>
+   #include <sys/stat.h>
+   #include <sys/ioctl.h>
+   #include <fcntl.h>
+   #include <unistd.h>
+ #}
+ fd-open
+ fd-close
+ fd-fcntl
+ ;; need to implement this
+ ;; fd-read
+ ;; fd-write
+ ;; fd-ioctl
+)
\ No newline at end of file
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libc/fortran.lsh lush-cvs/lsh/libc/fortran.lsh
--- lush/lsh/libc/fortran.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libc/fortran.lsh	2009-10-23 18:50:15.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: fortran.lsh,v 1.3 2003/01/02 20:13:59 leonb Exp $
+;;; $Id: fortran.lsh,v 1.5 2009/10/23 22:50:15 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -65,50 +65,54 @@
 
 ;;;; SPECIAL CODE FOR GCC
 (when (= (getconf "GCC") "yes")
-  (let ((libgcc ())
-        (libg77 ())
-        (libg77name "libg2c") )
+  (let ((cc (getconf "CC"))
+        (f77 (getconf "F77"))
+        (exists (lambda(s) (when (filep s) s)))
+        (libgcc ())
+        (libf77 ()) )
     ;; Locate libgcc
-    (reading (concat "| " (getconf "CC") " --print-file-name=libgcc.a")
-      (setq libgcc (read-string)) )
+    (reading (concat "| " f77 " --print-file-name=libgcc.a")
+      (setq libgcc (or libgcc (exists (read-string)))) )
+    (reading (concat "| " cc " --print-file-name=libgcc.a")
+      (setq libgcc (or libgcc (exists (read-string)))) )
+    ;; Search fortran lib
     (when (filep libgcc)
-      ;; Search shared lib in libgcc path
-      ;; Note: libg77 is a wild guess for future versions of g77
-      (let ((shared-library-path (list (dirname libgcc))))
-        (setq libg77 (or (find-shared-library "libg77")
-                         (find-shared-library "libg2c") ) ) )
-      ;; Decide g77 support library name
-      (when (not libg77)
-        (when (filep (concat-fname (dirname libgcc) "libg77.a"))
-          (setq libg77name "libg77") ) ) )
-    ;; Search shared library
-    (when (not libg77)
-      (setq libg77 (find-shared-library libg77name)) )
-    ;; Search static library
-    (when (not libg77)
-      (let ((static-library-path static-library-path))
-        (when (filep libgcc)
-          (setq static-library-path (cons (dirname libgcc) static-library-path)) )
-        (when (setq libg77 (find-static-library libg77name))
+      (let* ((libgcc-dir (dirname libgcc))
+             (shared-library-path (list libgcc-dir)) )
+        (setq libf77 (or (find-shared-library "libgfortran")
+                         (find-shared-library "libg2c") ) )
+        (when (not libf77)
+          (when (setq libf77 
+                      (or (exists (concat-fname libgcc-dir "libgfortran.a"))
+                          (exists (concat-fname libgcc-dir "libg2c.a")) ) )
+            (setq fortran-libs-static-p t) ) ) ) )
+    ;; Keep searching
+    (when (and (not libf77) (not (= f77 "g77")))
+      (when (not (setq libf77 (find-shared-library "libgfortran")))
+        (when (setq libf77 (find-static-library "libgfortran"))
+          (setq fortran-libs-static-p t) ) ) )
+    (when (and (not libf77) (not (= f77 "gfortran")))
+      (when (not (setq libf77 (find-shared-library "libg2c")))
+        (when (setq libf77 (find-static-library "libg2c"))
           (setq fortran-libs-static-p t) ) ) )
     ;; Trouble
-    (when (not libg77)
-      (when (not (setq libg77 (find-shared-library "libf2c")))
-        (when (setq libg77 (find-static-library "libf2c"))
+    (when (and (not libf77) (not (= f77 "gfortran")))
+      (when (not (setq libf77 (find-shared-library "libf2c")))
+        (when (setq libf77 (find-static-library "libf2c"))
           (setq fortran-libs-static-p t) ) )
-      (when libg77
+      (when libf77
         (printf "*** Warning: Cannot find libg2c. Found libf2c instead\n")
         (printf "***   Fortran support might be incomplete and/or unreliable\n") ) )
     ;; Big trouble
-    (when (not libg77)
-      (printf "*** Warning: Cannot find libg2c.\n")
+    (when (not libf77)
+      (printf "*** Warning: Cannot find fortran support library.\n")
       (printf "***   Fortran support will be incomplete and/or unreliable\n") )
     ;; Store
-    (when (and (stringp libg77) (filep libg77))
-      (setq fortran-libs (list libg77)) ) ) )
-    
+    (when (and (stringp libf77) (filep libf77))
+      (setq fortran-libs (list libf77)) ) ) )
+
 
-;;; CODE FOR NON-GCC OR NON-G77
+;;; CODE FOR NON-GCC OR NON-GFORTRAN
 (when (not fortran-libs)
   (each ((lib (list "libF77" "libV77")))  ;; insert more
     (let ((fname ()))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libc/make.lsh lush-cvs/lsh/libc/make.lsh
--- lush/lsh/libc/make.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libc/make.lsh	2009-10-16 11:50:10.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: make.lsh,v 1.12 2006/05/15 19:16:08 leonb Exp $
+;;; $Id: make.lsh,v 1.13 2009/10/16 15:50:10 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -257,24 +257,24 @@
 ;; object file targets defined by the rules.
 
 (defmethod LushMake load targets
-  (setq dryrun ())
-  (when (not targets)
-    (setq targets (htable-keys rules)) )
-  (let ((done (htable)))
-    (each ((target targets))
-      (==> this rebuild target done) ) )
-  (let ((ext (concat "." (or (getconf "OBJEXT") "o"))))
-    (each ((obj targets))
-      (when (= (right obj (len ext)) ext)
-        (mod-load obj) )
-      ;; record dependencies with libload.
-      (let ((mark (lambda(f)
-                    (let ((dep (cadr (rules f))))
-                      (each ((d dep))
-                        (libload-add-dependency d)
-                        (mark d) ) ) ) ))
-        (mark obj) ) ) )
-  t )
+  (let ((dryrun ()))
+    (when (not targets)
+      (setq targets (htable-keys rules)) )
+    (let ((done (htable)))
+      (each ((target targets))
+        (==> this rebuild target done) ) )
+    (let ((ext (concat "." (or (getconf "OBJEXT") "o"))))
+      (each ((obj targets))
+        (when (= (right obj (len ext)) ext)
+          (mod-load obj) )
+        ;; record dependencies with libload.
+        (let ((mark (lambda(f)
+                      (let ((dep (cadr (rules f))))
+                        (each ((d dep))
+                          (libload-add-dependency d)
+                          (mark d) ) ) ) ))
+          (mark obj) ) ) )
+    t ) )
 
 
         
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libidx/idx-array.lsh lush-cvs/lsh/libidx/idx-array.lsh
--- lush/lsh/libidx/idx-array.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libidx/idx-array.lsh	2010-12-24 17:08:13.000000000 -0500
@@ -24,10 +24,10 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: idx-array.lsh,v 1.2 2002/08/19 17:47:10 leonb Exp $
+;;; $Id: idx-array.lsh,v 1.3 2010/12/24 22:08:13 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-#? *** Arrays of vectors and matrices
+#? *** idx-array: arrays of vectors and matrices
 ;; arrays of idx1 of floats, and idx2 of floats.
 ;; This class is convenient way of handling sets
 ;; of vectors or matrices of disparate sizes.
@@ -42,9 +42,6 @@
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#? (to-idx1flt <gptr>)
-;; Casts a gptr into a (-idx1- (-flt-))
-;; No checks are performed in compiled mode.
 (de to-idx1flt(g)
   (when (is-of-class g |GPTR|)
     (setq g (to-obj g)) )
@@ -54,9 +51,6 @@
     (error 'to-idx1flt "Incorrect index type" g) )
   g )
 
-#? (to-idx2flt <gptr>)
-;; Casts a gptr into a (-idx2- (-flt-))
-;; No checks are performed in compiled mode.
 (de to-idx2flt(g)
   (when (is-of-class g |GPTR|)
     (setq g (to-obj g)) )
@@ -218,6 +212,18 @@
   (for (i 0 (1- (idx-dim ar 0)))
     (==> this set i (ar i))))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+#? * Casting gptr to vectors and matrices
+
+#? (to-idx1flt <gptr>)
+;; Casts a gptr into a (-idx1- (-flt-))
+;; No checks are performed in compiled mode.
+
+#? (to-idx2flt <gptr>)
+;; Casts a gptr into a (-idx2- (-flt-))
+;; No checks are performed in compiled mode.
+
+
 ;;-----------------------------------------------------------------------------
 (dhc-make ()
           (idx1-array idx1-array set get)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libidx/idx-convol.lsh lush-cvs/lsh/libidx/idx-convol.lsh
--- lush/lsh/libidx/idx-convol.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libidx/idx-convol.lsh	2007-10-05 03:10:14.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: idx-convol.lsh,v 1.3 2002/10/09 06:43:39 profshadoko Exp $
+;;; $Id: idx-convol.lsh,v 1.4 2007/10/05 07:10:14 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #? **** Convolution, Subsampling, Oversampling.
@@ -326,7 +326,7 @@
 #? (idx-m1convol <input> <kernel> <output>)
 ;; 1D convolution on idx1 of floats
 ;; (alias of idx-f1convol)
-(setq idx-m1convol idx-f1convol)
+(defparameter idx-m1convol idx-f1convol)
 
 #? (idx-d1convol <input> <kernel> <output>)
 ;; 1D convolution on idx1 of double
@@ -359,7 +359,7 @@
 #? (idx-m1backconvol <input> <kernel> <output>)
 ;; 1D back convolution on floats
 ;; (alias of idx-f1backconvol.
-(setq idx-m1backconvol idx-f1backconvol)
+(defparameter idx-m1backconvol idx-f1backconvol)
 
 #? (idx-d1backconvol <input> <kernel> <output>)
 ;; 1D back convolution on doubles
@@ -391,7 +391,7 @@
 #? (idx-m2convol <input> <kernel> <output>)
 ;; 2D convolution. all arguments are idx2 of floats.
 ;; (alias for idx-f2convol)
-(setq idx-m2convol idx-f2convol)
+(defparameter idx-m2convol idx-f2convol)
 
 #? (idx-d2convol <input> <kernel> <output>)
 ;; 2D convolution. all arguments are idx2 of doubles.
@@ -421,7 +421,7 @@
 
 #? (idx-m2convolacc <input> <kernel> <output>)
 ;; 2D convolution with accumulation . all arguments are idx2.
-(setq idx-m2convolacc idx-f2convolacc)
+(defparameter idx-m2convolacc idx-f2convolacc)
 
 #? (idx-d2convolacc <input> <kernel> <output>)
 ;; 2D convolution with accumulation . all arguments are idx2 of double.
@@ -454,7 +454,7 @@
 #? (idx-m2backconvol <input> <kernel> <output>)
 ;; 2D back-convolution. all arguments are idx2 of floats
 ;; (alias for idx-f2baconvol)
-(setq idx-m2backconvol idx-f2backconvol)
+(defparameter idx-m2backconvol idx-f2backconvol)
 
 #? (idx-d2backconvol <input> <kernel> <output>)
 ;; 2D back-convolution. all arguments are idx2 of floats.
@@ -485,7 +485,7 @@
 
 #? (idx-m2backconvolacc <input> <kernel> <output>)
 ;; 2D back-convolution. all arguments are idx2 of floats.
-(setq idx-m2backconvolacc idx-f2backconvolacc)
+(defparameter idx-m2backconvolacc idx-f2backconvolacc)
 
 #? (idx-d2backconvolacc <input> <kernel> <output>)
 ;; 2D back-convolution. all arguments are idx2 of floats.
@@ -526,7 +526,7 @@
 
 #? (idx-m1subsample <input> <n> <output>)
 ;; subsampling and summing of size <n>
-(setq idx-m1subsample idx-f1subsample)
+(defparameter idx-m1subsample idx-f1subsample)
 
 #? (idx-d1subsample <input> <n> <output>)
 ;; subsampling and summing of size <n>
@@ -560,7 +560,7 @@
 
 #? (idx-m1oversample <input> <n> <output>)
 ;; oversampling of size <n>
-(setq idx-m1oversample idx-f1oversample) 
+(defparameter idx-m1oversample idx-f1oversample) 
 
 #? (idx-d1oversample <input> <n> <output>)
 ;; oversampling of size <n>
@@ -596,7 +596,7 @@
 
 #? (idx-m2subsample <input> <n> <output>)
 ;; subsampling and summing of size <n>
-(setq idx-m2subsample idx-f2subsample)
+(defparameter idx-m2subsample idx-f2subsample)
 
 #? (idx-d2subsample <input> <n> <output>)
 ;; subsampling and summing of size <n>
@@ -632,7 +632,7 @@
 
 #? (idx-m2oversample <input> <n> <output>)
 ;; oversampling of size <n>
-(setq idx-m2oversample idx-f2oversample)
+(defparameter idx-m2oversample idx-f2oversample)
 
 #? (idx-d2oversample <input> <n> <output>)
 ;; oversampling of size <n>
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libimage/image-io.lsh lush-cvs/lsh/libimage/image-io.lsh
--- lush/lsh/libimage/image-io.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libimage/image-io.lsh	2008-08-25 16:47:51.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: image-io.lsh,v 1.9 2006/02/27 15:43:47 laseray Exp $
+;;; $Id: image-io.lsh,v 1.11 2008/08/25 20:47:51 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #? *** Reading/Writing Image Files to/from IDX
@@ -65,7 +65,9 @@
 ;; (setq img (image-read-rgb "-geometry 50x50% myimage.jpg"))
 (de image-read-rgb (s)
   ((-str-) s)
-  (let ((f (popen (sprintf "%s %s PPM:-" @@*convert-cmd* s) "r")))
+  ;; the "-compress lossless" option is to force convert
+  ;; to produce a RAW PNM file.
+  (let ((f (popen (sprintf "%s -compress lossless -depth 8 %s PPM:-" @@*convert-cmd* s) "r")))
     (when (not f) (error "couldn't open convert pipe file"))
     (prog1 (pnm-fread-rgb f) (pclose f))))
 
@@ -91,11 +93,11 @@
 ;; (setq img (image-read-rgba "-geometry 50x50% PNG:myimage"))
 (de image-read-rgba (s)
   ((-str-) s)
-  (let ((f (popen (sprintf "%s %s PPM:-" @@*convert-cmd* s) "r")))
+  (let ((f (popen (sprintf "%s -compress lossless -depth 8 %s PPM:-" @@*convert-cmd* s) "r")))
     (when (not f) (error "couldn't open convert pipe file"))
     (let ((r (pnm-fread-rgba f)))
       (pclose f)
-      (setq f (popen (sprintf "%s -channel Matte %s PGM:-"
+      (setq f (popen (sprintf "%s -compress lossless -depth 8 -channel Matte %s PGM:-"
                               @@*convert-cmd* s) "r"))
       (when (not f) (error "couldn't open alpha channel pipe file"))
       (pnm-fread-into-ubim f (select r 2 3))
@@ -111,7 +113,7 @@
 ;; to PGM.
 (de image-read-ubim (s)
   ((-str-) s)
-  (let* ((f (popen (sprintf "%s %s PPM:-" @@*convert-cmd* s) "r")))
+  (let* ((f (popen (sprintf "%s -compress lossless -depth 8 %s PPM:-" @@*convert-cmd* s) "r")))
     (when (not f) (error "couldn't open convert pipe file"))
     (prog1 (pnm-fread-ubim f) (pclose f))))
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libimage/img-util.lsh lush-cvs/lsh/libimage/img-util.lsh
--- lush/lsh/libimage/img-util.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libimage/img-util.lsh	2008-08-25 16:47:51.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: img-util.lsh,v 1.3 2005/08/24 21:47:14 leonb Exp $
+;;; $Id: img-util.lsh,v 1.5 2008/08/25 20:47:51 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #? *** Miscellaneous Image Macros and Conversions
@@ -35,6 +35,35 @@
 (dm FGREEN(f) '0.587)
 (dm FBLUE(f) '0.114)
 
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; conversion between various formats
+
+(de convert-yuv422-to-rgb (src dst)
+  ((-idx3- (-ubyte-)) src)
+  ((-idx3- (-ubyte-)) dst)
+  (when (or (<> (idx-dim src 0) (idx-dim dst 0))
+	    (<> (idx-dim src 1) (idx-dim dst 1))
+	    (< (idx-dim src 2) 2)
+	    (< (idx-dim dst 2) 3))
+    (error "invalid or incompatible dimensions for images"))
+  (cidx-bloop ("i" "j" ("src" src) ("dst" dst))
+    #{{float f, y, u, v;
+       y = src[0]; 
+       if (j & 1) {
+         u = src[-1]; v = src[1];
+       } else {
+         u = src[1]; v = src[3];
+       }
+       f = 1.164383*(y-16) + 1.596027*(v-128);
+       dst[0] = (f>=255)?0xff:((f<0)?0x00:(unsigned char)f);
+       f = 1.164383*(y-16) - 0.812968*(v-128) - 0.391726*(u-128);
+       dst[1] = (f>=255)?0xff:((f<0)?0x00:(unsigned char)f);
+       f = 1.164383*(y-16) + 2.017232*(u-128);
+       dst[2] = (f>=255)?0xff:((f<0)?0x00:(unsigned char)f);
+    }#} ) ())
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; internal format conversions
 
@@ -64,9 +93,9 @@
       (idx-bloop ((ubpix ubrow)(pix row))
         (let ((x (pix)))
           ((-int-) x) ;; C inline?
-          (ubpix 0 (bitand 0xff (bitshr x 24)))
           (ubpix 0 (bitand 0xff (bitshr x 16)))
-          (ubpix 2 (bitand 0xff x)) ) ) )
+          (ubpix 1 (bitand 0xff (bitshr x 8)))
+          (ubpix 2 (bitand 0xff (bitshr x 0))) ) ) )
     ubim ) )
   
 
@@ -155,6 +184,7 @@
 ________________________________________________________________
 
 (dhc-make () 
+	  convert-yuv422-to-rgb
           rgbaim2rgbafim rgbafim2rgbaim pixel2rgbim
           (img-dim-C img-dim-C) 
           equal-dim align-dimensions)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libogre/ogre.hlp lush-cvs/lsh/libogre/ogre.hlp
--- lush/lsh/libogre/ogre.hlp	2010-12-28 14:34:13.000000000 -0500
+++ lush-cvs/lsh/libogre/ogre.hlp	2011-02-27 09:14:42.000000000 -0500
@@ -448,6 +448,10 @@
 events when the function <process-pending-events> is called. It is a
 good practice to call this function a few times during long programs.
 
+#? (ogre-close-all)
+Closes all open ogre windows.
+
+
 #? ** Error Handling in the Ogre Library
 .SEE Errors in Lush.
 .SEE (debug-hook)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libogre/ogre.lsh lush-cvs/lsh/libogre/ogre.lsh
--- lush/lsh/libogre/ogre.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libogre/ogre.lsh	2011-02-27 09:14:42.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: ogre.lsh,v 1.32 2006/03/01 19:39:57 leonb Exp $
+;;; $Id: ogre.lsh,v 1.34 2011/01/02 18:14:30 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1239,6 +1239,8 @@
   (setq thisform this)
   (setq thiswindowobject this)
   (setq color-palette :color-palette)
+  (when :ogre-task
+    (:ogre-task:allwindows this t) )
   (each ((i contenu))
     (==> this insert i) )
   (==> this realize (ogre-new-window x y w h title)) )
@@ -1283,12 +1285,16 @@
 
 (defclass OgreTasks object
   timerid
+  allwindows
   damagedwindows )
 
+(defmethod OgreTasks OgreTasks()
+  (setq allwindows (htable 7 t)) )
+
 (defmethod OgreTasks damaged-window(w)
   (when (not timerid)
     (setq timerid (create-timer this 0)) )
-`<  (when (not (member w damagedwindows))
+  (when (not (member w damagedwindows))
     (setq damagedwindows (cons w damagedwindows)) ) )
 
 (defmethod OgreTasks handle (event)
@@ -1338,6 +1344,12 @@
     (setq :ogre-task (new OgreTasks)) )
   t)
 
+;; close all ogre windows
+(de ogre-close-all()
+  (when :ogre-task
+    (let ((wins :ogre-task:allwindows))
+      (when (is-of-class wins |HTABLE|)
+        (each ((x (htable-keys wins))) (delete x)) ) ) ) )
 
 ;; function that processes events until its argument is nil
 (de wait (s) (while s (waitevent) (process-pending-events)))
@@ -1434,13 +1446,18 @@
   (when window
     (if (not contents)
 	(==> this resize 0 0)
-      (let* ((lines (div (+ (length contents) columns -1) columns))
+      (let* ((items (length contents))
+             (lines (div (+ items columns -1) columns))
 	     (wmat (float-matrix lines columns))
 	     (hmat (float-matrix lines columns)) )
 	(setq wsize (float-matrix columns))
 	(setq hsize (float-matrix lines))
-	(wmat () () (all ((i contents)) (nth 3 i)))
-	(hmat () () (all ((i contents)) (nth 4 i)))
+	(wmat () () 
+              (nconc (all ((i contents)) (nth 3 i))
+                     (makelist (- (* lines columns) items) 0) ))
+	(hmat () () 
+              (nconc (all ((i contents)) (nth 4 i))
+                     (makelist (- (* lines columns) items) 0) ))
 	(for (i 0 (1- lines))
 	  (hsize i (sup (cons 0 (hmat i ())))) )
 	(for (i 0 (1- columns))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libstd/brace.lsh lush-cvs/lsh/libstd/brace.lsh
--- lush/lsh/libstd/brace.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libstd/brace.lsh	2007-03-19 08:40:10.000000000 -0400
@@ -22,7 +22,7 @@
 ;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
 ;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;  $Id: brace.lsh,v 1.18 2006/03/15 04:16:42 profshadoko Exp $
+;;;;  $Id: brace.lsh,v 1.19 2007/03/19 12:40:10 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;; Functions and classes to handle brace lists.
@@ -202,7 +202,8 @@
 (defvar *brace.ex-tmp* ())
 
 (de brace.ex-tmp () 
-  (setq *brace.ex-tmp* (tmpname))
+  (when (not (stringp *brace.ex-tmp*))
+    (setq *brace.ex-tmp* (tmpname)) )
   *brace.ex-tmp* )
 
 ;; read preformatted text
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libstd/cluster.lsh lush-cvs/lsh/libstd/cluster.lsh
--- lush/lsh/libstd/cluster.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libstd/cluster.lsh	2008-01-14 11:36:34.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: cluster.lsh,v 1.10 2005/05/09 01:21:56 leonb Exp $
+;;; $Id: cluster.lsh,v 1.11 2008/01/14 16:36:34 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -51,7 +51,7 @@
 #? cluster-default
 ;;.TYPE VAR
 ;; List of cluster machine names.
-(defvar cluster-default '("vc140" "vc141")) )
+(defvar cluster-default '("localhost")) )
 
 #? (cluster-connect <machine> <outputfile>)
 ;; Attempts to start the script <lushslave> on computer <machine>.
@@ -68,8 +68,8 @@
 ;;.TYPE VAR
 ;; This is the name of the script launched by
 ;; the default implementation of <cluster-connect>.
-(defvar cluster-lushslave "lushslave")
-
+(defvar cluster-lushslave 
+  "PATH=$PATH lushslave") 
 
 #? (cluster-kill <machine> <signal> <pid>)
 ;; Sends unix signal <signal> to process <pid> of computer <machine>.
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libstd/plotenv.lsh lush-cvs/lsh/libstd/plotenv.lsh
--- lush/lsh/libstd/plotenv.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libstd/plotenv.lsh	2010-01-28 18:26:17.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: plotenv.lsh,v 1.27 2005/12/04 01:36:53 leonb Exp $
+;;; $Id: plotenv.lsh,v 1.38 2010/01/28 23:26:17 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;    Standard functions for plotting curves.
@@ -252,10 +252,13 @@
   xlabels ylabels           ;; label interval (or list of values)
   xgrid ygrid 		    ;; flag telling whether grid lines must be drawn
   xlabel2str ylabel2str     ;; functions to convert values into labels
+  legend                    ;; position of the legend
   ;; computed values
   cmargintop cmarginbottom cmarginleft cmarginright crect
   cxmin cymin cxmax cymax rbx rby
-  cxticks cyticks cxlabels cylabels )
+  cxticks cyticks cxlabels cylabels 
+  legendrect legendlineh 
+  legendlogox legendlogow legendlinex)
 
 (defmethod PlotContext -destructor()
   (delete plotwindow)
@@ -293,7 +296,7 @@
              (stem (regex-subst " *[0-9]+$" "" name))
              (count 0) )
         (while (member name names)
-          (setq name (sprintf "%s%d" stem (incr count))) )
+          (setq name (sprintf "%s %d" stem (incr count))) )
         (setq :curve:name name)
         (setq names (cons name names)) ) ) ) )
 
@@ -426,6 +429,26 @@
     (setq crect (list (+ x cmarginleft) (+ y cmargintop)
 		      (max 0 (- w (+ cmarginleft cmarginright)))
 		      (max 0 (- h (+ cmargintop cmarginbottom))) )) )
+  ;; legend
+  (when legend
+    (let ((lw 0)(lh 0)(ln 0))
+      (each ((curve curves))
+        (setq lh (max lh (==> this text-height :curve:name plot-context-labels)))
+        (setq lw (max lw (==> this text-width :curve:name plot-context-labels)))
+        (incr ln) )
+      (setq legendlineh lh)
+      (setq legendlogox (* .67 lh))
+      (setq legendlogow (* 3 lh))
+      (setq legendlinex (* 4.33 lh))
+      (setq lw (+ lw (* lh 5)))
+      (setq lh (* lh (1+ ln)))
+      (let (((x y w h) crect))
+        (setq legendrect
+              (selectq legend
+                (topleft (list (+ x legendlineh) y lw lh))
+                (bottomleft (list (+ x legendlineh) (- (+ y h) (+ lh legendlineh)) lw lh))
+                (bottomright (list (- (+ x w) lw) (- (+ y h) (+ lh legendlineh)) lw lh))
+                (t (list (- (+ x w) lw) y lw lh)) ) ) ) ) )
   ;; rbx
   (let (((cx cy cw ch) crect))
     (setq rbx cx)
@@ -543,6 +566,18 @@
            (each ((curve curves))
              (graphics-batch 
               (==> curve execute rbx rby this) ) ) )
+         ;; draw legend
+         (when legend
+           (let (((x y w h) legendrect))
+             (gsave
+              (color color-bg) (fill-rect x y w h)
+              (color color-fg) (draw-rect x y w h)
+              (incr y (* 1.5 legendlineh))
+              (plot-context-labels)
+              (each ((curve curves))
+                (==> curve logo (+ x legendlogox) (- y legendlineh) legendlogow legendlineh)
+                (gprintf (+ x legendlinex) y "%s" :curve:name)
+                (incr y legendlineh) ) ) ) )
          ;; draw title
          (when title
            (gsave
@@ -566,14 +601,18 @@
 ;; All curve types are subclasses of this class.
 ;; Must define two methods: <execute> to plot the curve,
 ;; and <bounds> to compute its bounding rectangle.
-(defclass PlotGenericCurve Object)
+(defclass PlotGenericCurve Object
+  name )
+
+(defmethod PlotGenericCurve set-name(n)
+  (when (stringp n) (setq name n)) )
+
 
 #? PlotCurve
 ;; The only curve type currently implemented.
 ;; Contains an arbitrary list of plt-xxx commands.
 
 (defclass PlotCurve PlotGenericCurve
-  name
   cur-object
   cur-object-size 
   cur-sd-size
@@ -582,7 +621,7 @@
   cmds)
 
 (defmethod PlotCurve plotcurve(&optional lx ly lv)
-  (setq name "Curve1")
+  (setq name "Curve 1")
   (setq cur-object open-square)
   (setq cur-object-size 3)
   (setq cur-sd-size 3)
@@ -704,6 +743,24 @@
     (when (and xmin ymin xmax ymax)
       (list xmin ymin xmax ymax) ) ) )
 
+(defmethod PlotCurve logo rect
+  (gsave
+   (when (addclip rect)
+     (color -1)
+     (linestyle 0)
+     (let ((current-object open-square)
+           (object-size 3)
+	   (sd-bar-size 3))
+       (each ((cmd (reverse cmds)))
+	 (when (member (car cmd) '(color color-rgb linestyle setq))
+           (eval cmd) ) )
+       (let (((x y w h) rect))
+         (incr y (2/ h))
+         (draw-line x y (+ x w) y)
+         (incr x (2/ w))
+         (linestyle 0)
+         (current-object x y) ) ) ) ) )
+
 (defmethod PlotCurve set-color(c)
   (when (not (numberp c))
     (error '==> "illegal color argument" c) )
@@ -895,19 +952,25 @@
 ;; in the plot setup dialog.
 
 (defclass PlotDataSetup Form
-  titleedit )
+  titleedit 
+  legendbox )
 
 (defmethod PlotDataSetup PlotDataSetup()
   (==> this form
        (new column 
-            (setq titleedit (new editstring 30)) ) ) )
+            (setq titleedit (new editstring 30)) 
+            (new emptyspace 10 10)
+            (setq legendbox (new checkbox "Display legend") ) ) ) )
 
 (defmethod PlotDataSetup load(plot)
-  (==> titleedit setdata (or :plot:title "")) )
+  (==> titleedit setdata (or :plot:title "")) 
+  (==> legendbox setdata :plot:legend) )
 
 (defmethod PlotDataSetup save(plot)
   (let ((s (==> titleedit getdata)))
-    (setq :plot:title (when (<> s "") s)) ) )
+    (setq :plot:title (when (<> s "") s)) )
+  (let ((b (==> legendbox getdata)))
+    (setq :plot:legend (when b (or :plot:legend t))) ) )
 
 (defmethod PlotDataSetup name()
   "Title" )
@@ -1035,7 +1098,7 @@
   (new PlotCurveSetup this) )
 
 (defmethod PlotCurveSetup PlotCurveSetup(thecurve)
-  (let ((xeq (lambda(c) (setq :thisform:changed t))))
+  (let ((xeq (eval `(lambda(c) (setq :,this:changed t)))))
     (setq curve thecurve)
     (setq objectchoice 
           (new fancychoicemenu
@@ -1244,6 +1307,7 @@
 
 (defmethod PlotSetup save()
   (when plot
+    (==> this activate ())
     (each (((k . obj) thestuff))
       (when (check==> (classof obj) 'save)
         (==> obj save plot) ) )
@@ -1351,13 +1415,17 @@
   
 ;; Replacement for copy-plot-port.
 (de copy-plot-port(port &optional object)
-  (setq object (or object (nth 2 port)))
-  (let ((pp (cadr port))
+  (let ((pp port)
         (pc (new PlotCurve)))
+    (when (consp pp)
+      (setq object (or object (nth 2 pp)))
+      (setq pp (cadr pp)) )
+    (when (not (is-of-class port PlotContext))
+      (error 'copy-plot-port "not a plot-port or plotcontext" port) )
     (when (functionp object)
       (let ((window (==> pp window)))
         (==> pc command `(setq current-object ,object)) ) )
-    (setq :pc:name "Compat1")
+    (setq :pc:name "PlotPort 1")
     (==> pp add pc)
     (list pc pp object) ) )
   
@@ -1506,6 +1574,11 @@
     (putp k 'graph-options f) ) )
 
 (let ((f (lambda(pw pp pc k s)
+           (letslot pp (set k (when (symbolp s) s)) t) )))
+  (each ((k '(legend)))
+    (putp k 'graph-options f) ) )
+
+(let ((f (lambda(pw pp pc k s)
            (when (or (null s) 
                      (let-filter (((a b) s)) 
                        (and (numberp a) (numberp b)) ) )
@@ -1529,11 +1602,11 @@
 
 (let ((f (lambda(pw pp pc k . args)
            (setq k (namedclean (concat "set-" (nameof k))))
-           (if (and pc (check==> (classof pc) k))
-               (eval (list ==> pc k . args))
-             (printf "+++ warning: unrecognized option: %l\n"
-                     (cons k args)) ) )))
-  (each ((k '(color color-rgb linestyle object object-size sd-bar-size)))
+           (if  (and pc (check==> (classof pc) k))
+               (prog1 (eval (list ==> pc k . args))
+                 (when (= k 'set-name) (==> pp make-unique-names)) )
+             (printf "+++ warning: unrecognized option: %l\n" (cons k args)) ) )))
+  (each ((k '(color color-rgb linestyle object object-size sd-bar-size name)))
     (putp k 'graph-options f) ) )
 
 (de graph-options args
@@ -1558,7 +1631,7 @@
       (setq pw (new PlotWindow))
       (setq pp :pw:plot) )
     (when (not pc)
-      (setq pc (last :v:curves)) )
+      (setq pc (last :pp:curves)) )
     (each ((arg args))
       (when (not 
              (cond
@@ -1579,6 +1652,33 @@
     (==> pp execute)
     pp ) )
 
+(de graph-curve args
+  (let ((pc ()) (pp ()) (name ()))
+    (each ((arg args))
+      (cond
+       ((is-of-class arg PlotGenericCurve)
+        (setq pc arg) )
+       ((is-of-class arg PlotWindow) 
+        (setq pp :pw:plot) )
+       ((is-of-class arg PlotContext)
+        (setq pp arg) )
+       ((and (consp arg) 
+             (is-of-class (car arg) PlotCurve)
+             (is-of-class (cadr arg) PlotContext) )
+        (setq pc (car arg))
+        (setq pp (cadr arg)) )
+       ((stringp arg)
+        (setq name arg) )
+       (t
+        (error 'graph-curve "Unrecognized argument" arg) ) ) )
+    (when (not pp)
+      (error 'graph-curve "No plot context specified" ()) )
+    (when (and (not pc) name)
+      (each ((c :pp:curves))
+        (when (= name :c:name)
+          (setq pc c) ) ) )
+    pc ) )
+
 (de graph-xy(lx ly . options)
   (let* ((pc (new PlotCurve lx ly))
          (pp (graph-options pc . options)) )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libstd/svgwindow.lsh lush-cvs/lsh/libstd/svgwindow.lsh
--- lush/lsh/libstd/svgwindow.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/libstd/svgwindow.lsh	2008-01-07 19:06:44.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;  $Id: svgwindow.lsh,v 1.2 2006/02/26 15:34:47 laseray Exp $
+;;;  $Id: svgwindow.lsh,v 1.7 2008/01/08 00:06:44 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -66,50 +66,47 @@
 ;; for drawing objects. This includes manipulating
 ;; coordinate transforms, stroke width, stroke styles,
 ;; separate stroke color and fill color, opacity, etc.
-;;
-;; The coordinate unit is set to 0.25mm by default.
-;; This can be changed by passing an additional argument
-;; to function <svg-window> to specify 
-;; the number of units per millimeter.
-
 
 
-#? (svg-window [[<w> <h>] <name> [<units-per-mm>]])
+#? (svg-window [<w> <h>] <name> [<rw> <rh> <units>])
 ;; Function <svg-window> creates a window descriptor
-;; that produces a SVG file named <name>.
+;; that produces an SVG file named <name>.
 ;;
-;; Arguments <w> and <h> specify the width and height 
-;; of the coordinate system. Argument <units-per-mm>
-;; indicates the number of graphic units per millimeter
-;; and defaults to 4.
+;; Arguments <w> and <h> specify the width and height of the drawing
+;; rectangle in drawing units (default: 512x512). Optional arguments
+;; <rw> <rh> and <units> indicate the physical size of the rectangle
+;; into which the drawing rectangle will be mapped (not necessarily
+;; preserving the aspect ratio).  <units> is the unit in which this
+;; physical size is expressed. The default is "px" (pixels).  Possible
+;; units are "pt" (=1.25px), "pc" (=15px), "mm" (=3.543307px), "cm"
+;; (=35.43307px), and "in" (=90px).  By default, the real size is
+;; <w>px by <h>px.  hence the resolution is 90 units per inch.
 ;;
 ;; Unlike <new-window> or <print-window>, this function does not store 
 ;; the newly created window in the variable <window>, and thus does not 
 ;; make this window current.
 
 (de svg-window args
-  (let ((w 512)(h 512)(f "tloutput.svg")(upm 4))
-    (when (and (numberp (car args))
-               (numberp (cadr args))
-               (numberp (car (cddr args)))
-               (numberp (cadr (cddr args))) )
-      (setq args (cddr args)) )
-    (when (and (numberp (car args))
-               (numberp (cadr args)) )
-      (setq w (car args))
-      (setq h (cadr args))
-      (setq args (cddr args)) )
-    (when (consp args)
-      (setq f (car args))
-      (setq args (cddr args))
-      (when (not (stringp f))
-        (error 'svg-window "string expected" f) ) )
-    (when args
-      (when (or (not (consp args)) (not (numberp (car args))) (cdr args))
-        (error 'svg-window "too many arguments" args) )
-      (setq upm (car args)) )
-    (lisp-window (new SVGWindow f w h upm)) ) )
-
+  (let ((w 512)(h 512)(rw ())(rh ())(units ())
+	(a1 (car args)) (a2 (cadr args)) 
+	(a3 (caddr args)) (a4 (car (cdddr args)))
+	(a5 (cadr (cdddr args))) (a6 (caddr (cdddr args))))
+    (when (> (length args) 6) (error "too many arguments (6 max)"))
+    (cond
+     ((and (numberp a1) (numberp a2) (stringp a3) (numberp a4) (numberp a5) (stringp a6))
+      (setq w a1 h a2 f a3 rw a4 rh a5 units a6))
+     ((and (numberp a1) (numberp a2) (stringp a3) (numberp a4) (numberp a5) (not a6))
+      (setq w a1 h a2 f a3 rw a4 rh a5))
+     ((and (numberp a1) (numberp a2) (stringp a3) (not a4) (not a5) (not a6))
+      (setq w a1 h a2 f a3))
+     ((and (stringp a1) (numberp a2) (numberp a3) (stringp a4) (not a5) (not a6))
+      (setq f a1 rw a2 rh a3 units a4))
+     ((and (stringp a1) (numberp a2) (numberp a3) (not a4) (not a5) (not a6))
+      (setq f a1 rw a2 rh a3))
+     ((and (stringp a1) (not a2) (not a3) (not a4) (not a5) (not a6))
+      (setq f a1))
+     (t (error "illegal combination of arguments")))
+    (lisp-window (new SVGWindow f w h rw rh units))))
 
 
 #? SVGWindow
@@ -158,27 +155,29 @@
 
 
 
-#? (new SVGWindow <svg-file> <width> <height> [<resolution>])
+#? (new SVGWindow <svg-file> <w> <h> [<real-width> <real-height> <units>])
 ;; Create a new SVGWindow object whose output is written to the
-;; file <svg-file>. The parameters <width> and <height> determine the 
-;; size of the drawing surface in pixel-like arbitrary units.
-;; The optional resolution argument determines the number of units
-;; per millimeter. The default value is 4, which means that
-;; an 800 unit window will occupy roughly 20.0cm (7.87 inches),
-;; which is roughly the usable width of an A4 or US Letter page.
-;; This is a little more than 100 units per inch.
-;; If you want 100 units per inch, set the resolution to 3.937.
-;;
-;; In general, if you want your drawing to have a precise width
-;; in millimeters, use:
-;; {<code> 
-;;  (setq z (new SVGWindow "drawing.svg" width height (/ width width-in-mm)))
-;; </code>}
-;; For an actual width in inches, use:
-;; {<code> 
-;;  (setq z (new SVGWindow "drawing.svg" width height (/ (* 25.4 width) width-in-inches)))
+;; file <svg-file>. The parameters <w> and <h> are
+;; size of the window in drawing coordinates (i.e. a object
+;; drawn at coordinates (0,0) will be in the upper left corner, 
+;; and an object with coordinates (<w>,<h>) will be in the
+;; lower right corner of the drawing area. Optional parameters 
+;; <real-width> and <real-height> give the physical size of a
+;; rectangle within which the drawing are will be mapped 
+;; (not necessarily preserving the aspect ratio).
+;; <units> is a string with the name of the units in which
+;; these sizes are expressed. The default is "px" (pixels).
+;; Possible units are "pt" (=1.25px), "pc" (=15px), 
+;; "mm" (=3.543307px), "cm" (=35.43307px), and "in" (=90px).
+;; By default, the real size is <w>px by <h>px.
+;; hence the resolution is 90 units per inch.
+;; example:
+;; {<code>
+;;   ;; make a drawing whose real size is 180x90mm
+;;   ;; but the drawing coordinate range from 0,0 to 2000,1000
+;;   (new SVGWindow "stuff.svg" 2000 1000 180 90 "mm")
 ;; </code>}
-(defmethod SVGWindow SVGWindow (f w h &optional (units-per-mm 4))
+(defmethod SVGWindow SVGWindow (f w h &optional realw realh units)
   (setq svgwin-file (open-write f))
   (setq svgwin-image-path (filename-chop-suffix f))
   (setq svgwin-image-basename (filename-chop-suffix (basename f)))
@@ -186,6 +185,9 @@
   (setq svgwin-stack ())
   (setq svgwin-width w)
   (setq svgwin-height h)
+  (setq realw (or realw w))
+  (setq realh (or realh h))
+  (setq units (or units "px"))
   (setq svgwin-font-family "Courier")
   (setq svgwin-font-style "normal")
   (setq svgwin-font-weight "bold")
@@ -209,25 +211,15 @@
       svgwin-coeff svgwin-stroke svgwin-fill svgwin-fill-opacity
       svgwin-fill-rule svgwin-stroke-linecap svgwin-stroke-linejoin
       svgwin-stroke-opacity svgwin-opacity ))
-
   (writing svgwin-file 
     (printf "<svg\n")
     (printf " xmlns=\"http://www.w3.org/2000/svg\"\n")
     (printf " xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n")
-    (printf " xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"\n")
     (printf " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n")
-    (printf " xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n")
-    (printf " xmlns:rdf=\"http://www.w3.Org/1999/02/22-rdf-syntax-ns#\"\n")
-    (printf " xmlns:cc=\"http://web.resource.org/cc/\"\n")
-    (printf " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n")
-    (printf " inkscape:export-xdpi=\"101.60000\"\n")
-    (printf " inkscape:export-ydpi=\"101.60000\"\n")
-    (printf " width=\"%gmm\" height=\"%gmm\" viewBox=\"0 0 %g %g\" >\n" 
-	    (/ svgwin-width units-per-mm) (/ svgwin-height units-per-mm)
-	    svgwin-width svgwin-height)
-    
-    (printf "<sodipodi:namedview id=\"base\" pagecolor=\"#ffffff\" ")
-    (printf "  inkscape:pageopacity=\"1.0\" showborder=\"false\" />\n")
+    ;; (printf " width=\"%gpx\" height=\"%gpx\" >\n" svgwin-width svgwin-height)
+    (printf " width=\"%g%s\" height=\"%g%s\" viewBox=\"%g %g %g %g\" >\n" 
+	realw units realh units
+        0 0 svgwin-width svgwin-height)
     )
   )
 
@@ -313,12 +305,14 @@
 (defmethod SVGWindow fill-color (r g b) 
   (setq svgwin-fill (rgb2hex r g b)))
 
-#? (==> <SVGWindow> start-group [<tx> <ty> <r> <sx> <sy>])
+#? (==> <SVGWindow> start-group [<tx> <ty> <r> <sx> <sy> <skx> <sky>])
 ;; Start a new group of drawing commands. The optional arguments
 ;; can be used to specify a local coordinate transform.
 ;; <tx> and <ty> are the horizontal and vertical translations,
 ;; <r> a clockwise rotation angle in degrees, and <sx> and <sy> are scaling
-;; factors. The group is terminated by a call to the <end-group> method.
+;; factors, and <skx> and <sky> are skew angles in degrees along the X and Y axes. 
+;; The order fo transformations is: translation, skew, rotation, scaling.
+;; The group is terminated by a call to the <end-group> method.
 ;; This command can be handy for drawing rotated objects.
 ;; For example, drawing a vertical text at coordinate 100 200
 ;; can be done with:
@@ -327,11 +321,11 @@
 ;;  (draw-text 0 0 "blah blah")
 ;;  (==> my-SVGWindow end-group)
 ;; </code>}
-(defmethod SVGWindow start-group (&optional (tx 0) (ty 0) (r 0) (sx 1) (sy 1))
+(defmethod SVGWindow start-group (&optional (tx 0) (ty 0) (r 0) (sx 1) (sy 1) (skx 0) (sky 0))
   (writing svgwin-file 
     (incr svgwin-open-groups)
-    (printf "<g transform=\"translate(%g,%g) rotate(%g) scale(%g,%g)\">\n"
-	    tx ty r sx sy)))
+    (printf "<g transform=\"translate(%g,%g) skewX(%g) skewY(%g) rotate(%g) scale(%g,%g)\">\n"
+	    tx ty skx sky r sx sy)))
 
 #? (==> <SVGWindow> end-group)
 ;; End a group started with <start-group>, possibly
@@ -341,23 +335,33 @@
   (incr svgwin-open-groups -1)
   (writing svgwin-file (printf "</g>\n")))
 
+#? (==> <SVGWindow> gspecial <s>)
+;; Write string <s> into the SVG file.
+;; This allows to write raw SVG directly.
+(defmethod SVGWindow gspecial (s) 
+  (writing svgwin-file (printf s)))
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Standard lisp-driver functions
 
-(defmethod SVGWindow begin()
-  (==> this start-group) )
+(defmethod SVGWindow begin() ())
 
-(defmethod SVGWindow end()
-  (==> this end-group) )
+(defmethod SVGWindow end() ())
 
 (defmethod SVGWindow clear () ())
 
 (defmethod SVGWindow color(x)
-  (setq svgwin-stroke 
-        (sprintf "#%s%s%s" 
-                 (right (concat "00" (mid (strhex (bitand x 0xff)) 3)) 2)
-                 (right (concat "00" (mid (strhex (bitand (bitshr x 16) 0xff)) 3)) 2)
-                 (right (concat "00" (mid (strhex (bitand (bitshr x 24) 0xff)) 3)) 2) ) ) 
+  (cond 
+   ((= -1 x) (setq svgwin-stroke "#000000"))
+   ((= -2 x) (setq svgwin-stroke "#ffffff"))
+   ((= -3 x) (setq svgwin-stroke "#808080"))
+   (t (setq svgwin-stroke 
+	    (sprintf "#%s%s%s" 
+		     (right (concat "00" (mid (strhex (bitand (bitshr x 16) 0xff)) 3)) 2)
+		     (right (concat "00" (mid (strhex (bitand (bitshr x 8) 0xff)) 3)) 2)
+		     (right (concat "00" (mid (strhex (bitand x 0xff)) 3)) 2) ) ) ))
+  ;; (print svgwin-stroke) (pause "asd")
   (setq svgwin-fill svgwin-stroke) )
 
 (defmethod SVGWindow rect-text (x y s)
@@ -369,9 +373,6 @@
 
 (defmethod SVGWindow ysize () svgwin-height)
 
-(defmethod SVGWindow gspecial (s) 
-  (writing svgwin-file (printf s)))
-
 (defmethod SVGWindow linestyle (s)
   (cond
    ((numberp s)
@@ -456,7 +457,7 @@
 (defmethod SVGWindow pixel-map(x y image zx zy)
   (let* ((imref (sprintf "%s-%04d.png" svgwin-image-basename svgwin-image-num))
 	 (impath (sprintf "%s-%04d.png" svgwin-image-path svgwin-image-num))
-         (ubim (image2rgbaim image)))
+         (ubim (pixel2rgbim image)))
     (let ((f (open-append (sprintf "| %s PPM:- %s" @@*convert-cmd* impath))))
       (writing f (printf "P6 %d %d 255\n" (idx-dim image 1) (idx-dim image 0)))
       (export-raw-matrix ubim f) )
@@ -480,7 +481,7 @@
 (de svg-demo (f)
   (setq m (ubyte-matrix 100 200 3))
   (idx-bloop ((m m)) (idx-bloop ((m m)) (idx-bloop ((m m)) (m (rand 0 255)))))
-  (let* ((window (svg-window f 500 500))
+  (let* ((window (svg-window 500 500 f))
          (zz (lisp-window-delegate window)))
     ;; plain rectangle
     (draw-rect 10 10 100 50)
@@ -525,8 +526,17 @@
 
 ;; plot a curve
 (de svg-demo2 (f)
-  (let ((window (svg-window f 500 500)))
-    (setup-axes 0 -1.2 20 1.2 2 0.2)
-    (let ((xx (range 0 20 0.4)))
-      (plot-lists xx (all ((x xx)) (cos x))))
-    (delete window) ) )
+  (libload "libplot/plotter")
+  (let* ((window (svg-window 800 600 f))
+	 (p (new plotter 0 0 800 600)))
+    (==> p setgrid 0.2)
+    (==> p setxscale -1.2 1.2)
+    (==> p setyscale -1.2 1.2)
+    (==> p setxticks (range -1.2 1.2 0.2))
+    (==> p setyticks (range -1.2 1.2 0.2))
+    (==> p plotxy "lips" 
+	 sin 
+	 (lambda (x) (cos (* 2.33 x)))
+	 0 10 0.1 (alloccolor 1 0 0))
+    (==> p redisplay)
+    ()))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libtex/bibtex.lsh lush-cvs/lsh/libtex/bibtex.lsh
--- lush/lsh/libtex/bibtex.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/lsh/libtex/bibtex.lsh	2007-02-04 03:16:11.000000000 -0500
@@ -0,0 +1,412 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: bibtex.lsh,v 1.2 2007/02/04 08:16:11 profshadoko Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+(libload "libtex/texutf8")
+(libload "libtex/texhtml")
+
+
+;;#? (bibtex-mogrify <s>)
+;; In order to avoid parsing stuff that is quoted by nested braces,
+;; this function encodes all characters inside the braces into
+;; a control-c followed by two capital letters.
+(de bibtex-mogrify(s)
+  (let ((ob (asc "{"))
+        (cb (asc "}"))
+        (mm (asc "\^C"))
+        (ls (explode-bytes s))
+        (ns ())
+        (count 0))
+    (while ls
+      (let ((c (car ls)))
+        (setq ls (cdr ls))
+        (when (= c ob) 
+          (incr count +1) )
+        (if (<= count 0) 
+            (setq ns (cons c ns))
+          (setq ns (cons mm ns))
+          (setq ns (cons (+ 65 (div c 16)) ns))
+          (setq ns (cons (+ 65 (mod c 16)) ns)) )
+        (when (= c cb) 
+          (setq count (max 0 (1- count))) ) ) )
+    (implode-bytes (reverse ns)) ) )
+
+;;#? (bibtex-unmogrify <s>)
+;;Undo the transformation achieved by <bibtex-mogrify>.
+(de bibtex-unmogrify(s)
+  (let ((ob (asc "{"))
+        (cb (asc "}"))
+        (mm (asc "\^C"))
+        (ls (explode-bytes s))
+        (ns ()))
+    (while ls
+      (let ((c (car ls))
+            (c1 (cadr ls))
+            (c2 (caddr ls)) )
+        (setq ls (cdr ls))
+        (if (and (= c mm) c1 c2 (>= c1 65) (>= c2 65) (< c1 81) (< c2 81))
+            (setq c (+ (* 16 (- c1 65)) (- c2 65)) ls (cddr ls)) )
+        (setq ns (cons c ns)) ) )
+    (implode-bytes (reverse ns)) ) )
+
+
+#? (bibtex-process-author <authorstring>)
+;; Returns a list <(lastname firstname)> for 
+;; a bibtex author entry <authorstring>
+;; containing a single author.
+
+(de bibtex-process-author(author)
+  (setq author (bibtex-mogrify author))
+  (let* ((rx (regex-extract "(.*),[ \n\r\t]*(.*)" author)))
+    (if (consp rx)
+        (list (bibtex-unmogrify (car rx)) (bibtex-unmogrify (cadr rx)))
+      (setq rx (regex-extract "(.*)[ \n\r\t]+([^ \n\r\t]+)" author))
+      (if (consp rx)
+          (list (bibtex-unmogrify (cadr rx)) (bibtex-unmogrify (car rx)))
+        (list (bibtex-unmogrify author)) ) ) ) )
+
+#? (bibtex-process-author-list <authorliststring>)
+;; Returns a list of lists <(lastname firstname)> 
+;; for the authors in a bibtex authors entry <authorstring>
+;; possibly containing multiple authors.
+
+(de bibtex-process-author-list(authors)
+  (setq authors (bibtex-mogrify authors))
+  (setq authors (regex-subst "^[ \n\t\r]*" "" authors))
+  (setq authors (regex-subst "[ \n\t\r]*$" "" authors))
+  (let ((data ())
+        (re "(.*[^ \n\r\t])[ \n\r\t]+and[ \n\r\t]+(.*)")
+        (rx ()) )
+    (while (setq rx (regex-extract re authors))
+      (setq authors (car rx)) 
+      (when (<> (cadr rx) "")
+        (setq data (cons (bibtex-process-author (bibtex-unmogrify (cadr rx))) data)) ) )
+    (when (<> authors "")
+      (setq data (cons (bibtex-process-author (bibtex-unmogrify authors)) data)) )
+    ;;(print data)
+    data ) )
+
+
+
+;; ---------------------------------------------
+
+#? (read-bibtex-file <f>)
+;; This is the main function for reading a bibtex file <f>.
+;; It returns a hash table associating a <bibtex-entry>
+;; object to each bibtex key string.
+;;.VP
+;;  ? (setq m (read-bibtex-file "/home/leonb/publis.bib")))
+;;  = ::HTABLE:81e2278
+;;  ? (setq r (m "bottou-cortes-94"))
+;;  = ::bibtex-entry:8895d98
+;;  ? (==> r get 'title)
+;;  = "Comparison of classifier methods: a case study in handwritten digit recognition"
+;;  ? (==> r get 'author)
+;;  = "Bottou, Léon and Cortes, Corinna and Denker, John S. and Drucker, Harris and .....
+;;  ? (bibtex-process-author-list (==> r get 'author))
+;;  = (("Bottou" "Léon") ("Cortes" "Corinna") ("Denker" "John S.") ("Drucker" "Harris") ...
+
+
+(de read-bibtex-file(f)
+  (let ((map (htable))
+        (b (new bibtex-reader f)))
+    (while (==> b spaces)
+      (let ((e (==> b read t)))
+        (when e
+          (when (stringp f)
+            (setq :e:source f) )
+          (map (downcase :e:key) e) ) ) )
+    map ) )
+
+
+
+
+#? bibtex-entry.
+;; Class <bibtex-entry> represents a single bibtex entry.
+;; Instances of this class are created by the function <read-bibtex-file>.
+;;.IP
+;; Slot <type> contains the entry type string.
+;;.IP
+;; Slot <key> contains the entry key string.
+;;.IP
+;; Slot <source> contains the name of the bibtex file containing this entry.
+;;.IP
+;; Slot <fields> is a hash table containing the entry fields.
+
+(defclass bibtex-entry object
+  type
+  key
+  source
+  fields
+  data )
+
+(defmethod bibtex-entry bibtex-entry(xtype xkey)
+  (setq type (downcase xtype))
+  (setq key xkey)
+  (setq data (htable)) )
+
+
+#? (==> <bibtex-entry> get <fieldsymbol> [<type>])
+;; Returns the bibtex entry field named <fieldsymbol>.
+;; When <type> is <'utf8> (the default), special TeX
+;; characters are recoded in utf8. When <type> is <'html>
+;; special TeX characters are recoded into HTML sequences.
+;; For all other values of <type> the result is left
+;; unchanged.
+
+(defmethod bibtex-entry get(key &optional (type 'utf8))
+  (let ((a (data key)))
+    (when (and a type (not (member key '(original url))))
+      (selectq type
+	(utf8 (setq a (tex-to-utf8-list a)) )
+	(html (setq a (tex-to-html-list a)) )
+	(t )))
+    a ) )
+
+
+;; bibtex-reader.
+;; internal
+
+(defclass bibtex-reader object
+  fd
+  lineno
+  curline
+  curpos 
+  strings )
+
+(defmethod bibtex-reader bibtex-reader(f)
+  (when (stringp f) 
+    (setq f (open-read f)) )
+  (when (not (is-of-class f |FILE_RO|))
+    (error "read file descriptor expected" f) )
+  (setq fd f)
+  (setq lineno 0)
+  (setq curline (reading fd (read-string)))
+  (setq curpos 1) 
+  (setq strings (htable)) )
+
+(defmethod bibtex-reader fill()
+  (when curline
+    (when (> curpos (len curline))
+      (let ((c (reading fd (read-string 1))))
+        (when (and (= "\r" c) (= "\n" (reading fd (skip-char ""))))
+          (setq c (reading fd (read-string 1))) )
+        (if (or (= c "\e") (= c ""))
+            (setq curline ())
+          (setq curline (reading fd (read-string)))
+          (incr lineno) )
+        (setq curpos 1) ) )
+    curline ) )
+
+(defmethod bibtex-reader peek()
+  (when (==> this fill)
+    (mid curline curpos) ) )
+
+(defmethod bibtex-reader spaces()
+  (let ((again t))
+    (while (and again (==> this fill))
+      (let* ((r (regex-seek "[^ \n\r\t]" curline curpos)))
+        (if (consp r)
+            (setq curpos (car r) again ())
+          (setq curpos (1+ (len curline))) ) ) ) )
+  curline )
+
+(defmethod bibtex-reader token(&optional re)
+  (when (==> this spaces)
+    (let ((c (==> this peek)))
+      (setq re (or re "[-_A-Za-z][-_A-Za-z0-9]*"))
+      (if (regex-match (concat re ".*")  c)
+          (let ((r (regex-seek re c)))
+            (incr curpos (cadr r))
+            (left c (cadr r)) )
+        (incr curpos)
+      (left c 1) ) ) ) )
+
+(defmethod bibtex-reader expect(s)
+  (when (<> (==> this token) s)
+    (error (sprintf "Token '%s' expected on line %d" s lineno)) ) )
+
+(defmethod bibtex-reader bdata(equote)
+  (let ((count 0) (data ()))
+    (while (>= count 0)
+      (when (not (==> this fill))
+        (error (sprintf "Premature end-of-file")) )
+      (let* ((re (if (= count 0) (concat "[{}" equote "]") "[{}]"))
+             (rs (regex-seek re curline curpos)))
+        (if (not rs)
+            (progn 
+              (setq data (cons "\n" (cons (mid curline curpos) data)))
+              (setq curpos (1+ (len curline))) )
+          (setq data (cons (mid curline curpos (- (car rs) curpos)) data))
+          (setq curpos (1+ (car rs)))
+          (let ((c (mid curline (car rs) 1)))
+            (if (= c "{")
+                (incr count +1)
+              (incr count -1)
+              (when (<> c (if (>= count 0) "}" equote))
+                (error (sprintf "Unbalanced {...} or \"...\" on line %d" lineno)) ) )
+            (when (>= count 0)
+              (setq data (cons c data)) ) ) ) ) )
+    (apply concat (reverse data)) ) )
+
+(defmethod bibtex-reader fdata()
+  (when (==> this spaces)
+    (let ((c (mid curline curpos 1)))
+      (cond
+       ((= c "\"") 
+        (incr curpos) 
+        (==> this bdata c))
+       ((= c "{" ) 
+        (incr curpos) 
+        (==> this bdata "}"))
+       ((regex-match "[0-9]" c) 
+        (==> this token "[0-9]+") )
+       (t 
+        (let ((s (==> this token "[^ \n\r\t,/}=]+")))
+          (or (strings (downcase s))
+              (list 'undefined s) ) ) ) ) ) ) )
+
+
+(defmethod bibtex-reader read(&optional loose)
+  (when loose
+    (while (<> (left (==> this peek) 1) "@")
+      (incr curpos) ) )
+  (==> this expect "@")
+  (let ((type ()) (key ()) (closechar "}"))
+    (setq type (==> this token))
+    (let ((openchar (==> this token)))
+      (cond
+       ((= openchar "{") (setq closechar "}"))
+       ((= openchar "(") (setq closechar ")"))
+       (t (error (sprintf "Token '{' or '(' expected on line %d" lineno))) ) )
+    (setq key (==> this token "[^ \n\r\t,/}=]+"))
+    (cond
+     ;; string
+     ((= (downcase type) "string")
+      (==> this expect "=")
+      (strings (downcase key) (==> this fdata))
+      (==> this expect "}")
+      () )
+     ;; comment entry
+     ((= (downcase type) "comment")
+      (==> this fdata)
+      () )
+     ;; regular entry
+     (t
+      (==> this expect ",")
+      (let ((e (new bibtex-entry type key)))
+        ;; read fields
+        (let ((lasttok ","))
+          (while (= lasttok ",")
+            (setq lasttok (==> this token))
+            (when (<> lasttok "}")
+              (==> this expect "=")
+              (let ((fname (named (downcase lasttok)))
+                    (fdata (==> this fdata)) )
+                (setq lasttok (==> this token))
+                (while (= lasttok "#")
+                  (let ((moredata (==> this fdata)))
+                    (setq fdata (if (not (stringp fdata)) fdata
+                                  (if (not (stringp moredata)) moredata
+                                    (concat fdata moredata) ) ) )
+                    (setq lasttok (==> this token)) ) )
+                (:e:data fname fdata)
+                (setq :e:fields (nconc1 :e:fields fname)) ) ) )
+          (when (<> lasttok closechar)
+            (error (sprintf "Missing comma around line %d" lineno)) ) )
+        e ) ) ) ) )
+      
+
+
+
+
+
+;;; ---- generate bibtex output
+
+
+
+(defmethod bibtex-entry pretty()
+  (printf "%l\n" this)
+  (printf ";; @%s{%s,\n" type key)
+  (each ((k fields))
+    (printf ";;   %l = %l,\n" k (data k)) )
+  (printf ";; }\n") )
+
+
+#? (==> <bibtex-entry> to-bibtex [<httpurl>] [<strict>])
+;; Prints a bibtex entry.
+;; Argument <httpurl> is an optional string representing
+;; the document url. The sequence <"%s"> in this string 
+;; represents the bibtex entry key. 
+;; This function normalizes the author and editor fields
+;; in name, firstname form. Setting the argument <strict> 
+;; to <t> prevents this normalization.
+;;.VP
+;;   (==> r to-bibtex "http://foo.com/papers/%s.html")
+;;   ;;; entry nips-2005 from /home/leonb/publis.bib
+;;   @proceedings{nips-2005,
+;;      editor = {Saul, Lawrence and Weiss, Yair and Bottou, L\'{e}on},
+;;      title = {Advances in Neural Information Processing Systems 17},
+;;      publisher = {MIT Press},
+;;      year = {2005},
+;;     url = {http://foo.com/papers/nips-2005.html},
+;;   }
+
+(defmethod bibtex-entry to-bibtex(&optional (httpurl ()) (strict ()))
+  (when source
+    (printf "\n\n;;; entry %s from %s\n" key source) )
+  (printf "@%s{%s,\n" type key)
+  (each ((k fields))
+    (when (not (or (= k original)
+                   (and (= k url) httpurl) ) )
+      (let ((s (data k)))
+        (cond
+         ((stringp s)
+          (when (and (not strict) (member k '(author editor)))
+            (setq s (bibtex-process-author-list s))
+            (let ((l ())(n ""))
+              (each ((author s))
+                (setq l (cons
+                         (if (cadr author)
+                             (sprintf "%s%s, %s" n (car author) (cadr author))
+                           (sprintf "%s%s" n (car author)) ) l))
+                (setq n " and ") )
+              (setq s (apply concat (reverse l))) ) )
+          (printf "    %l = {%s},\n" k (regex-subst "[ \n\r\t]+" " " s)) )
+         ((and (consp s) (stringp (cadr s)))
+          (setq s (cadr s))
+          (writing "$stderr" (printf "Warning: Undefined string '%s' in entry '%s'\n" s key))
+          (printf "    %l = %s,\n" k (regex-subst "[ \n\r\t]+" " " s)) )
+         (t
+          (error "should not happen") ) ) ) ) )
+  (when httpurl
+    (printf "    url = {%s},\n" (sprintf httpurl key)) )
+  (printf "}\n") )
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libtex/README lush-cvs/lsh/libtex/README
--- lush/lsh/libtex/README	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/lsh/libtex/README	2007-01-19 18:55:16.000000000 -0500
@@ -0,0 +1,2 @@
+
+Lush functions that help manipulating TeX/BibTex files.
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libtex/texhtml.lsh lush-cvs/lsh/libtex/texhtml.lsh
--- lush/lsh/libtex/texhtml.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/lsh/libtex/texhtml.lsh	2007-02-04 03:16:12.000000000 -0500
@@ -0,0 +1,73 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: texhtml.lsh,v 1.1 2007/02/04 08:16:12 profshadoko Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? (tex-to-html <s>)
+;; Convert tex special characters into HTML.
+;; This function knows a limited number of tex constructs.
+;; Its efficiency is mediocre. But progress is still possible.
+(de tex-to-html(s)
+  ;; add as needed. Use explode-bytes to find out
+  (setq s (regex-subst "\\\\'{?e}?" "&eacute;" s))
+  (setq s (regex-subst "\\\\`{?a}?" "&agrave;" s))
+  (setq s (regex-subst "\\\\`{?e}?" "&egrave;" s))
+  (setq s (regex-subst "\\\\`{?u}?" "&ugrave;" s))
+  (setq s (regex-subst "\\\\\\^{?a}?" "&acirc;" s))
+  (setq s (regex-subst "\\\\\\^{?e}?" "&ecirc;" s))
+  (setq s (regex-subst "\\\\\\^{?i}?" "&icirc;" s))
+  (setq s (regex-subst "\\\\\\^{?o}?" "&ocirc;" s))
+  (setq s (regex-subst "\\\\\\^{?u}?" "&ucirc" s))
+  (setq s (regex-subst "\\\\\\^{?y}?" "y;" s))
+  (setq s (regex-subst "\\\\\"{?a}?" "&auml;" s))
+  (setq s (regex-subst "\\\\\"{?e}?" "&euml;" s))
+  (setq s (regex-subst "\\\\\"{?i}?" "&iuml;" s))
+  (setq s (regex-subst "\\\\\"{?o}?" "&ouml;" s))
+  (setq s (regex-subst "\\\\\"{?u}?" "&uuml;" s))
+  (setq s (regex-subst "\\\\\"{?y}?" "yuml;" s))
+  (setq s (regex-subst "\\\\~{?n}?"  "&ntilde;" s))
+  (setq s (regex-subst "\\\\~{?o}?" "&otilde;" s))
+  (setq s (regex-subst "\\\\~{?N}?" "&Ntilde;" s))
+  (setq s (regex-subst "\\\\~{?O}?" "&Otilde;" s))
+  (setq s (regex-subst "\\\\c{?c}?" "&ccedil;" s))
+  (setq s (regex-subst "\\\\c{?C}?" "&Ccedil;" s))
+  ;; clear remaining latex stuff
+  (setq s (regex-subst "~" " " s))
+  (setq s (regex-subst "\\\\" "" s))
+  (setq s (regex-subst "{" "" s))
+  (setq s (regex-subst "}" "" s))
+  (setq s (regex-subst "$" "" s))
+  ;; more cleanups
+  (regex-subst "[ \n\r\t]+" " " s) )
+
+#? (tex-to-html-list <l>)
+;; Traverse lists l and recursively convert tex special characters into HTML.
+(de tex-to-html-list(l)
+  (cond
+   ((stringp l) (tex-to-html l))
+   ((consp l) (mapcar tex-to-html-list l))
+   (t l) ) )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/libtex/texutf8.lsh lush-cvs/lsh/libtex/texutf8.lsh
--- lush/lsh/libtex/texutf8.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/lsh/libtex/texutf8.lsh	2006-12-13 16:15:30.000000000 -0500
@@ -0,0 +1,79 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: texutf8.lsh,v 1.1 2006/12/13 21:15:30 leonb Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+
+#? (tex-to-utf8 <s>)
+;; Convert tex special characters into utf8.
+;; This function knows a limited number of tex constructs.
+;; Its efficiency is mediocre. But progress is still possible.
+
+(de tex-to-utf8(s)
+  ;; add as needed. Use explode-bytes to find out
+  (setq s (regex-subst "\\\\'{?e}?" (implode-bytes '(195 169)) s))
+  (setq s (regex-subst "\\\\`{?a}?" (implode-bytes '(195 160)) s))
+  (setq s (regex-subst "\\\\`{?e}?" (implode-bytes '(195 168)) s))
+  (setq s (regex-subst "\\\\`{?u}?" (implode-bytes '(195 185)) s))
+  (setq s (regex-subst "\\\\\\^{?a}?" (implode-bytes '(195 162)) s))
+  (setq s (regex-subst "\\\\\\^{?e}?" (implode-bytes '(195 170)) s))
+  (setq s (regex-subst "\\\\\\^{?i}?" (implode-bytes '(195 174)) s))
+  (setq s (regex-subst "\\\\\\^{?o}?" (implode-bytes '(195 180)) s))
+  (setq s (regex-subst "\\\\\\^{?u}?" (implode-bytes '(195 187)) s))
+  (setq s (regex-subst "\\\\\\^{?y}?" (implode-bytes '(197 183)) s))
+  (setq s (regex-subst "\\\\\"{?a}?" (implode-bytes '(195 164)) s))
+  (setq s (regex-subst "\\\\\"{?e}?" (implode-bytes '(195 171)) s))
+  (setq s (regex-subst "\\\\\"{?i}?" (implode-bytes '(195 175)) s))
+  (setq s (regex-subst "\\\\\"{?o}?" (implode-bytes '(195 182)) s))
+  (setq s (regex-subst "\\\\\"{?u}?" (implode-bytes '(195 188)) s))
+  (setq s (regex-subst "\\\\\"{?y}?" (implode-bytes '(195 191)) s))
+  (setq s (regex-subst "\\\\~{?n}?" (implode-bytes '(195 177)) s))
+  (setq s (regex-subst "\\\\~{?o}?" (implode-bytes '(195 181)) s))
+  (setq s (regex-subst "\\\\~{?N}?" (implode-bytes '(195 145)) s))
+  (setq s (regex-subst "\\\\~{?O}?" (implode-bytes '(195 149)) s))
+  (setq s (regex-subst "\\\\c{?c}?" (implode-bytes '(195 167)) s))
+  (setq s (regex-subst "\\\\c{?C}?" (implode-bytes '(195 135)) s))
+  ;; clear remaining latex stuff
+  (setq s (regex-subst "~" " " s))
+  (setq s (regex-subst "\\\\" "" s))
+  (setq s (regex-subst "{" "" s))
+  (setq s (regex-subst "}" "" s))
+  (setq s (regex-subst "$" "" s))
+  ;; more cleanups
+  (regex-subst "[ \n\r\t]+" " " s) )
+
+
+
+#? (tex-to-utf8-list <l>)
+;; Traverse lists l and recursively convert tex special characters into utf8.
+
+(de tex-to-utf8-list(l)
+  (cond
+   ((stringp l) (tex-to-utf8 l))
+   ((consp l) (mapcar tex-to-utf8-list l))
+   (t l) ) )
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/lush-manual.hlp lush-cvs/lsh/lush-manual.hlp
--- lush/lsh/lush-manual.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/lush-manual.hlp	2007-09-10 17:20:59.000000000 -0400
@@ -171,55 +171,106 @@
     Video4Linux Video-Grabbing API Interface}
 
   {<li>
-    Advanced Linux Sound Architecture API (Alsa) Interface}
+    MIDI ALSA/sequencer device}
+
+  {<li>
+    Various devices, such as serial port, parallel port, and joystick}
+
+  {<li>
+    Low-level Advanced Linux Sound Architecture API (Alsa) Interface}
 }
 
+#? *** Numerical Packages
+High-level interfaces to various
+numerical packages.
 
-#? *** << alsa/alsa.hlp
+#? ** << libnum/libnum.hlp
 
-#? *** << audio/audio.hlp
+#? ** << fftw/fftw.lsh
 
-#? *** << blas/blas.hlp
 
-#? *** << devices/devices.hlp
+#? *** Machine Learning
+Libraries for machine learning, statistical
+estimation, and pattern recognition.
+
+#? ** << gblearn2/gb-learn.hlp
+
+#? ** << svm/svm.hlp
+
+#? ** << sn28/sn28.hlp
+
+#? ** << htk/htk.hlp
+
+#? ** << torch/torch.hlp
+
+
+#? *** Music, Audio, MIDI
+High-level interfaces to audio, MIDI
+and music-related libraries.
+
+#? ** << music/music.hlp
 
-#? *** << video/libdc/libdc.hlp
+#? ** << audio/audio.hlp
 
-#? *** << ffmpeg/ffmpeg.hlp
+#? ** << audiofile/audiofile.hlp
 
-#? *** << fftw/fftw.lsh
 
-#? *** << gblearn2/gb-learn.hlp
+#? *** Video grabbing
 
-#? *** << gsl/gsl.hlp
+#? ** << video4linux/v4l.hlp
+
+#? ** << video/libdc/libdc.hlp
+
+
+#? *** Images, Video, Multimedia, Graphics, Games
+High-level interfaces to various libraries
+for processing images and videos, and for 
+producing graphics, multimedia, and
+games.
+
+#? ** << ffmpeg/ffmpeg.hlp
+
+#? ** << jpeg/jpeg.lsh
+
+#? ** << opencv/opencv.hlp
+
+#? ** << opengl/opengl.hlp
+
+#? ** << sdl/sdl.hlp
+
+#? ** << inventor/inventor.hlp
+
+
+#? *** << devices/devices.hlp
 
-#? *** << htk/htk.hlp
 
-#? *** << lapack/lapack.hlp
+#? *** Numerical Libraries (low-level interfaces)
+These interface merely provide raw, low-level
+stubs to various libraries. Most users
+will probably have little use for these
+and will prefer the high-level interfaces.
 
-#? *** << audiofile/audiofile.hlp
+#? ** << blas/blas.hlp
 
-#? *** << libnum/libnum.hlp
+#? ** << gsl/gsl.hlp
 
-#? *** << opencv/opencv.hlp
+#? ** << lapack/lapack.hlp
 
-#? *** << opengl/opengl.hlp
 
-#? *** << inventor/inventor.hlp
+#? *** Miscellaneous low-level interfaces
+These are collections of stubs for
+various libraries.
 
-#? *** << mpi/mpi.hlp
+#? ** << alsa/alsa.hlp
 
-#? *** << python/python.hlp
 
-#? *** << sdl/sdl.hlp
+#? *** Other Packages
 
-#? *** << sn28/sn28.hlp
+#? ** << mpi/mpi.hlp
 
-#? *** << torch/torch.hlp
+#? ** << python/python.hlp
 
-#? *** << video4linux/v4l.hlp
 
-#? *** << svm/libsvm.lsh
 
 
 #? **** Applications
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/manual/graphics.hlp lush-cvs/lsh/manual/graphics.hlp
--- lush/lsh/manual/graphics.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/manual/graphics.hlp	2009-10-30 23:43:38.000000000 -0400
@@ -1,4 +1,4 @@
-$Id: graphics.hlp,v 1.19 2006/03/01 19:39:59 leonb Exp $
+$Id: graphics.hlp,v 1.21 2009/10/31 03:43:38 leonb Exp $
 #? *** Graphics
 
 Lush features a collection of graphics functions for creating
@@ -754,13 +754,15 @@
 
 #? (graph-options <...options...>)
 
-This function provides for changing the appearance of a plot.
+This function provides for creating an empty plot or
+changing the appearance of a plot.
 The optional arguments <...options...> are used to specify
 which curve or plot context should be modified and 
 which attributes should be modified.
 
 The following arguments can be used to specify
-which curve or plot context should be modified:
+which curve or plot context should be modified.
+Absent such an argument, a new plot is created.
 .IP
 Pass a <PlotContext> object to select the plot context of interest.
 Such objects are returned by function <graph-xy> for instance.
@@ -802,6 +804,10 @@
 <(xgrid <boolean>)> and <(ygrid <boolean>)>
 to display a grid for an axis.
 .IP
+<(legend <symb>)> to display a legend with the curve names.
+Argument <s> can be the empty list (no legend) or one of
+the symbols <topright>, <topleft>, <bottomright>, <bottomleft>.
+.IP
 <(xbounds <b>)> or <(ybounds <b>)>
 to specify the bounds of an axis.
 Argument <b> can be the empty list (for the automatic mode) 
@@ -822,6 +828,8 @@
 .PP
 The following curve attributes are recognized:
 .IP
+<(name <s>)> to specify the curve name.
+.IP
 <(color-rgb <r> <g> <b>)> and <(color <c>)>
 to specify the curve color.
 Arguments <r>, <g>, and <b> are numbers in range 0 to 1
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/manual/idx.hlp lush-cvs/lsh/manual/idx.hlp
--- lush/lsh/manual/idx.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/manual/idx.hlp	2010-12-24 17:08:48.000000000 -0500
@@ -1064,3 +1064,8 @@
 #? (m+c <a> <b> [<c>])
 obsolete and non-compilable addition of a scalar
 to the elements of a matrix.
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? *** << ../libidx/idx-array.lsh
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/manual/lush-tutorial.hlp lush-cvs/lsh/manual/lush-tutorial.hlp
--- lush/lsh/manual/lush-tutorial.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/manual/lush-tutorial.hlp	2007-11-29 17:09:48.000000000 -0500
@@ -1243,15 +1243,18 @@
 {<code>
   (setq z (double-matrix 3 3 2))
 </code>}
-Several complex arithmetics and functions are provided. The function names all begin
-with the letter <c>. Complex dyadic functions include <c+, c-, c*, c/, c**, clogb>
-(addition, subtraction, multiplication, division, power, complex log with complex base).
-All commonunary operations on complex are also provided, including conjugate, inverse,
-square root, exponential, log, and trigonometric functions. More details can be
-obtained in the packages/libnum section of the Lush manual ({<hlink> "libnum: Numerical Library"}).
+Several complex arithmetics and functions are provided. The function
+names all begin with the letter <c>. Complex dyadic functions include
+<c+, c-, c*, c/, c**, clogb> (addition, subtraction, multiplication,
+division, power, complex log with complex base).  All commonunary
+operations on complex are also provided, including conjugate, inverse,
+square root, exponential, log, and trigonometric functions. More
+details can be obtained in the packages/libnum section of the Lush
+manual ({<hlink> "libnum: Numerical Library"}).
 
-The meory layout of complex vectors and matrices so defined are compatible with the 
-LAPACK and GSL functions that take double complex vectors and matrices as arguments.
+The memory layout of complex vectors and matrices so defined are
+compatible with the LAPACK and GSL functions that take double complex
+vectors and matrices as arguments.
 
 
 #? *** Object-Oriented Lush Programming
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/manual/objects.hlp lush-cvs/lsh/manual/objects.hlp
--- lush/lsh/manual/objects.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/manual/objects.hlp	2011-02-27 09:14:42.000000000 -0500
@@ -1,4 +1,4 @@
-$Id: objects.hlp,v 1.8 2006/04/08 19:59:40 laseray Exp $
+$Id: objects.hlp,v 1.13 2011/01/02 18:16:47 leonb Exp $
 
 #? *** Objects
 
@@ -344,6 +344,8 @@
   </code>}
 }
 
+
+
 #? ** Accessing Slots
 
 {<p>
@@ -862,3 +864,42 @@
   symbols, classes, and so forth.
 }
 
+
+#? (==> <obj> -destructor)
+
+{<type> MSG}
+{<see> Constructors and Destructors}
+
+{<p>
+  This method is invoked when the object is destroyed.
+}
+
+
+#? (==> <obj> -unknown <symb> <args>)
+
+{<type> MSG}
+{<see> Sending Messages}
+
+{<p>
+  This method is invoked when a message <symb> 
+  is sent to an object <obj> whose class or superclasses
+  do not define a suitable method. Argument <args> is the 
+  list of message arguments the object is destroyed.
+  An error message is produced when this method is not defined.
+}
+
+
+
+#? (==> <obj> -call <args>)
+
+{<type> MSG}
+
+{<p>
+  This method is invoked when the object <obj>
+  is used like a function as the first element
+  of a list to be evaluated.
+  Argument <args> contains the arguments of
+  the calling form.
+  An error message is produced when this method is not defined.
+}
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/lsh/manual/strings.hlp lush-cvs/lsh/manual/strings.hlp
--- lush/lsh/manual/strings.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/lsh/manual/strings.hlp	2009-05-24 22:12:18.000000000 -0400
@@ -1,4 +1,4 @@
-$Id: strings.hlp,v 1.9 2006/02/26 15:34:46 laseray Exp $
+$Id: strings.hlp,v 1.12 2009/05/25 02:12:18 leonb Exp $
 #? *** Strings
 
 Strings are null terminated sequences of bytes representing 
@@ -32,6 +32,11 @@
 <\ooo> for a byte whose octal representation is <ooo>.
 .IP
 <\xhh> for a byte whose hexadecimal representation is <hh>.
+.IP
+<\uhhhh> or <\Uhhhhhh> for the representation of 
+unicode character <hhhh> or <hhhhhh> in 
+the current locale.  If no such representation exists,
+the utf8 representation is used.
 .PP
 
 #? ** Basic String Functions
@@ -455,6 +460,7 @@
 is incorrect, or because the system does not provide
 suitable conversion facilities.
 
+
 #? (utf8-to-locale-to <s>)
 Converts a string from UTF-8 encoding to locale encoding.
 This is a best effort function:
@@ -462,3 +468,42 @@
 if the conversion is impossible, either because the string <s>
 is incorrect, or because the system does not provide
 suitable conversion facilities.
+
+
+#? (explode-chars <s>)
+Returns a list of integers with the wide character
+codes of all characters in the string.
+This function interprets multibyte sequences 
+according to the encoding specified by the current locale.
+
+Example (under a UTF8 locale):
+.VP
+? (explode-chars "\xe2\x82\xac")
+= (8364)
+
+#? (implode-chars <l>)
+Returns a string composed of the characters
+whose wide character code are specified by the
+list of integers <l>.  Multibyte characters are
+generated according to the current locale.
+For instance, under a UTF8 locale,
+
+Example
+.EX (implode-chars '(8364 50 51 46 53 32 61 32 32 162 50 51 53 48))
+
+#? (explode-bytes <s>)
+Returns a list of integers representing
+the sequence of bytes in string <s>,
+regardless of their character interpretation.
+
+Example
+.EX (explode-bytes "\xe2\x82\xac")
+
+
+#? (implode-bytes <l>)
+Assemble a string composed of the bytes
+whose value is specified by the list of integers <l>,
+regardless of their multibyte representation.
+
+Example
+.EX (implode-bytes '(226 130 172 50 51))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/Makefile.in lush-cvs/Makefile.in
--- lush/Makefile.in	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/Makefile.in	2007-04-24 12:11:22.000000000 -0400
@@ -24,7 +24,7 @@
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#;;; $Id: Makefile.in,v 1.31 2005/06/03 04:09:56 leonb Exp $
+#;;; $Id: Makefile.in,v 1.32 2007/04/24 16:11:22 leonb Exp $
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 @SET_MAKE@
@@ -39,6 +39,7 @@
 prefix = @prefix@
 exec_prefix = @exec_prefix@
 bindir = @bindir@
+datarootdir = @datarootdir@
 datadir = @datadir@
 libdir = @libdir@
 mandir = @mandir@
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/audio/simple-audio.lsh lush-cvs/packages/audio/simple-audio.lsh
--- lush/packages/audio/simple-audio.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/audio/simple-audio.lsh	2009-07-04 16:12:22.000000000 -0400
@@ -40,9 +40,9 @@
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defvar read-sound-cmd "sox %s -s -w -c 1 -t raw -r %d -s -w -c 1 -")
-(defvar write-sound-cmd "sox -t raw -r %d -s -w -c 1 - -t wav -s -w -c 1 %s")
-(defvar play-sound-cmd "play -t raw -r %d -f s -s w -c 1 -")
+(defvar read-sound-cmd "sox %s -s -c 1 -t raw -r %d -s -c 1 -")
+(defvar write-sound-cmd "sox -t s2 -r %d -c 1 - -t wav -c 1 %s")
+(defvar play-sound-cmd "play -t s2 -r %d -c 1 -")
 
 #? (read-sound <f> <r>)
 ;; read a sound file and return a vector of doubles with the samples
@@ -67,7 +67,7 @@
 ;; The samples are written as shorts, so
 ;; they should be between -32768 and 32767.
 (de write-sound (m f r)
-  (let ((fp (popen (sprintf write-sound-cmd f r) "rb")))
+  (let ((fp (popen (sprintf write-sound-cmd r f) "wb")))
     (write-shorts-idx fp m)
     (pclose fp)))
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/audiofile/demos/kde_beep_honk.wav lush-cvs/packages/audiofile/demos/kde_beep_honk.wav
--- lush/packages/audiofile/demos/kde_beep_honk.wav	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/audiofile/demos/kde_beep_honk.wav	2007-01-10 18:51:29.000000000 -0500
@@ -0,0 +1,3 @@
+RIFF
+  WAVEfmt      w+  w+    data
+  {xwvuyzurtv{xxzzvsojlw~~y{~~xrptwyzwnfmx{}xroq{tffwtwu{{wsx|~vc\mzmywqspm}y|jU[vfeo}}lmnrs~|aS`xftsk{|xozu}mzv[Ukke|ltuyokuslhzr]\sdgs{qwmpxv~ak~r\^vfl~stoslxzzgyo_kvfw|wuz{u~{oi`tmgwyuypr~jv{bdz|gmrxrxmu~zizlZd}rbp|qsutk|liiatff~ru~ksmk{cnuagzvbl}qtqyjuocxphxmk{q}zhnplgipk{|hpy|vlxr{nxyensjztsp{sqgzvkuol}|sjr{xigpfs{glxsycrvu|gmnjz{jpuvxkxy{fonl{uitw{skztyvfuhi}nfv~s|pn}tsi}iqhfyyo{yhu}vzad}kassemvuvl}wwyeqkg{pfru{ro~vviz}kpol|u~nwylitjxvflyvym~}|iqkfxoestvrn~u|teskj}mhwpyps{nfy|hm{ij|}wsyoowdmvhl}|vlx{xlrvftwjo{wzn{|}~kssl|vkuxwvo~xitnh|pjwuxnm}vrfukl}mou~rwwmeyzgl{eg~}u|lwzx}hjtcowjqwwwkxv|yitrhzpkzz{ur|zobpln~rmzv}nryum~{nrnl{x}kv{}pr{krzmqyyul{{whrun{mivs|lm}znhyol{ko}}s}ir|w|jlyiqukt|xwkyz}tfmkfwleosu|ln~wphypoml}|sztdfqu|fg}wlvwjr}ywiru~|sywqvmsyuit{uesml|ii|u|{ko{|ni{zkoyjpq}{jpz~~mnzltuho}w~shv|yikskyrhq{ztenvtfrpkznkztymhszuk~tu}ljyxpztfmu|knvnxxov}ymv{pvwwpm~}nnwoj~~ryzlr{zseqxtdj~nl|nisv|liqwoeryjrkk||tcgpy~jh|ulvsjuz|tekr}lp}nm~pjwyqpuzxnuzntvdi~~~llp{qm|smyvjr~tglsjn}prrjw}vmqtynxsyprmlqypivsm{{jp|nmq|no|xntoiw}nhpurgq{roxyimz~}zjjoy}jj{|osrhp~pjoupemtnho{mo}{mnt}vs|yv}xnxxklw|sxyvxnlymip}vrwyuzznr|mlr}rqtsuoiwtgjuyqtuqr||jkzxjdir}uqqolo}seky{lflwtqrnnwqmywgcmvxrrojo{zjm|}qjoxywwuuxypwqjq~~wvtruojuxlkvtttppxuhn~wlgmw{stpnu}qmxtjkrwuvsu}vko}ymjq{|tspot~~oluzpkpzyuutsw{moz{mdhr{ztmp~okszrntwutor{ymq}xpr{~}xuvypt~xsu}}zwrpwzllw{rrzyvtps{vpvvrrz}xursz|pqx}vsrw{wsswsmq{}qou~|xwz{qpx~vrtx}|zvvw}yuw~{vtw{{
\ No newline at end of file
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/audiofile/demos/read-wav.lsh lush-cvs/packages/audiofile/demos/read-wav.lsh
--- lush/packages/audiofile/demos/read-wav.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/audiofile/demos/read-wav.lsh	2007-01-10 18:51:30.000000000 -0500
@@ -1,6 +1,14 @@
 ;; read and display a WAV file.
 ;; Yann LeCun, October 2002.
 
+;; This method of reading an audiofile uses the
+;; audiofile library interface.
+;; There is also a much simpler (but less flexible) way
+;; using the functions in lush/packages/audio/simple-audio.lsh
+;; Those functions use sox (a command-line audio processing app)
+;; to decode audiofile into a simple format that Lush can grok
+;; directly. 
+
 (libload "audiofile/audiofile")
 
 (de plot-wave (x y w off sx sy)
@@ -9,10 +17,13 @@
 	 (draw-line lx ly (+ x i) (+ y (* sy (- (w i) off))))
 	 (setq lx (+ x i)) (setq ly (+ y (* sy (- (w i) off)))))))
 
-(setq wave (audiofile-read 
-	    (concat-fname lushdir "packages/audiofile/demos/space.wav")))
+(setq wave 
+      (audiofile-read 
+       (concat-fname lushdir "packages/audiofile/demos/kde_beep_honk.wav")))
 
+(when (not window) (new-window))
 (for (k 0 (- (idx-dim wave 0) 500) 5)
      (graphics-batch
       (cls)
       (plot-wave 10 250 (narrow wave 0 500 k) 128 1 3)))
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/devices/serial.lsh lush-cvs/packages/devices/serial.lsh
--- lush/packages/devices/serial.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/devices/serial.lsh	2007-08-06 10:25:06.000000000 -0400
@@ -58,15 +58,17 @@
       ("O" (setq par 2))
       (t (error "parity should be a one-character string containing N, E or O")))
     #{ {struct termios  term;
-        int sp;
+        long flags;
+        int sp = B0;
         $fd = open( $port->data, O_RDWR + O_NOCTTY + O_NDELAY);
         if ($fd < 0) { 
           printf("port=[%s]\n",(unsigned char *)($port->data));
-          error(NIL,"could not open serial port",NIL); 
+          run_time_error("could not open serial port"); 
         }
-        if(fcntl($fd, F_SETFL, 0) == -1) {
+        if (((flags = fcntl($fd, F_GETFL, 0)) < 0) ||
+            (fcntl($fd, F_SETFL, flags & ~O_NONBLOCK) < 0) ) {
           close($fd);
-          error(NIL,"cannot set blocking IO on serial port",NIL);
+          run_time_error("cannot set blocking IO on serial port");
         }
         tcgetattr($fd ,&term);    
         switch ($speed) {
@@ -88,7 +90,7 @@
           case 38400 : sp=B38400; break;
           case 57600 : sp=B57600; break;
           case 115200 : sp=B115200; break;
-          default: error(NIL,"illegal baud rate for serial port",NIL);
+          default: run_time_error("illegal baud rate for serial port");
         }
         cfsetospeed(&term, sp);
         cfsetispeed(&term, sp);
@@ -96,19 +98,19 @@
           case 0:  term.c_cflag &= ~PARENB; break;
           case 1:  term.c_cflag |= PARENB; term.c_cflag &= ~PARODD; break;
           case 2:  term.c_cflag |= PARENB; term.c_cflag |= PARODD; break;
-          default: error(NIL,"serial-open internal error 1",NIL);
+          default: run_time_error("serial-open internal error 1");
         }
         switch ($bits) {
           case 5: term.c_cflag &= ~CSIZE; term.c_cflag |= CS5; break;
           case 6: term.c_cflag &= ~CSIZE; term.c_cflag |= CS6; break;
           case 7: term.c_cflag &= ~CSIZE; term.c_cflag |= CS7; break;
           case 8: term.c_cflag &= ~CSIZE; term.c_cflag |= CS8; break;
-          default: error(NIL,"serial-open internal error 2",NIL);
+          default: run_time_error("serial-open internal error 2");
         }
         switch ($stop) {
           case 1: term.c_cflag &= ~CSTOPB; break;
           case 2: term.c_cflag |= CSTOPB; break;
-          default: error(NIL,"serial-open internal error 3",NIL);
+          default: run_time_error("serial-open internal error 3");
         }
         tcsetattr($fd, TCSANOW, &term);
     } #} 
@@ -130,6 +132,41 @@
   (let* ((l (len s)))
     (to-int #{ write($fd,($s)->data,$l) #})))
 
+
+#? (fd-read-byte <fd> <c>)
+;; Read one unsigned byte <c> from file descriptor <fd>.
+;; When not data is available, this function waits until
+;; at least one byte is received. Returns -1 if an error occurs.
+(de fd-read-byte (fd) 
+  ((-int-) fd)
+  (let ((c 0)(s -1))
+    ((-ubyte-) c)
+    ((-int-) s)
+    (setq s (to-int #{ read($fd, &$c, 1) #}))
+    (if (< s 0) -1 (to-int c)) ) )
+
+#? (fd-read-test <fd>)
+;; Test if data is available for reading on file descriptor <fd>
+;; using the unix function select(2).
+(de fd-read-test(fd)
+   ((-int-) fd)
+   (let ((r ()))
+     ((-bool-) r)
+     (cpheader "#include <sys/select.h>")
+     #{
+         fd_set s;
+         struct timeval tm;
+         int i;
+         tm.tv_sec = 0;
+         tm.tv_usec = 10;
+         FD_ZERO(&s);
+	 FD_SET($fd,&s);
+         i = select($fd+1, &s, NULL, NULL, &tm);
+         $r = (i >= 0);
+     #} 
+     r ) ) )
+
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #? ** serial-port
@@ -181,8 +218,11 @@
     ()))
         
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(dhc-make () serial-dummy serial-open serial-close fd-write-byte fd-write-string
-	  (serial-port serial-port -destructor write-byte write-string))
+(dhc-make () serial-dummy serial-open serial-close 
+          fd-write-byte fd-write-string
+          fd-read-byte fd-read-test
+	  (serial-port serial-port -destructor 
+                       write-byte write-string))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/fftw/fftw.lsh lush-cvs/packages/fftw/fftw.lsh
--- lush/packages/fftw/fftw.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/fftw/fftw.lsh	2009-12-13 17:02:58.000000000 -0500
@@ -148,6 +148,56 @@
 ;; These functions perform 1D and 2D FFTs
 ;; from complex to complex, and real to complex.
 
+#? (fftw-dct-1d (in out forward norm)
+;; compute the 1D DCT-II transform of vector <in>,
+;; and put result in <out>. <forward> is an integer which
+;; should be set to 1 for a forward transform and
+;; to -1 for an inverse transform. <norm> is a 
+;; boolean that should be set to nil for no
+;; normalization and t for normalization.
+(de fftw-dct-1d (in out forward norm)
+  ((-idx1- (-double-)) in out)
+  ((-int-) forward)
+  ((-bool-) norm)
+  (when (<> (idx-dim in 0) (idx-dim out 0)) (error "input and output have different sizes"))
+  (when (or (not (contiguousp in)) (not (contiguousp out))) (error "vector not contiguous"))
+  (let ((n (idx-dim in 0)))
+    ((-int-) n)
+    #{{ fftw_plan p;
+        p = fftw_plan_r2r_1d($n, IDX_PTR($in,double), IDX_PTR($out,double), 
+                             (($forward>0)?FFTW_REDFT10:FFTW_REDFT01), FFTW_ESTIMATE);
+        fftw_execute(p);
+        fftw_destroy_plan(p);
+     }#}
+    (when norm
+      (let ((s (/ 0.5 (to-double n)))) ; extra factor of 2 in the DCT
+	((-double-) s)
+	(cidx-bloop ("i" ("out" out)) #{ *out *= $s; #} ))) ()))
+    
+
+#? (fftw-dht-1d <in> <out> <norm>)
+;; computes the discrete hartley transform of <in>
+;; and puts the result into <out>. <norm> is a boolean
+;; that should be set to t to divide the output by its
+;; length.
+(de fftw-dht-1d (in out norm)
+  ((-idx1- (-double-)) in out)
+  ((-bool-) norm)
+  (when (<> (idx-dim in 0) (idx-dim out 0)) (error "input and output have different sizes"))
+  (when (or (not (contiguousp in)) (not (contiguousp out))) (error "vector not contiguous"))
+  (let ((n (idx-dim in 0)))
+    ((-int-) n)
+    #{{ fftw_plan p;
+        p = fftw_plan_r2r_1d($n, IDX_PTR($in,double), IDX_PTR($out,double), 
+                             FFTW_DHT, FFTW_ESTIMATE);
+        fftw_execute(p);
+        fftw_destroy_plan(p);
+     }#}
+    (when norm
+      (let ((s (/ 1 (to-double n))))
+	((-double-) s)
+	(cidx-bloop ("i" ("out" out)) #{ *out *= $s; #} ))) ()))
+    
 
 #? (fftw-dft-c2c-1d <in> <out> <forward> <norm>)
 ;; compute the complex-to-complex 1D fourier 
@@ -205,6 +255,32 @@
 	(cidx-bloop ("i" ("out" out)) #{ out[0] *= $s; out[1] *= $s; #} ))) ()))
 
 
+#? (fftw-dft-c2r-1d <in> <out> <norm>)
+;; compute the complex-to-real backwards 1D fourier 
+;; transform of complex vector <in>, and put
+;; result in the real vector <out>. 
+;; <norm> is a boolean that should be set to nil 
+;; for no normalization and t for normalization.
+(de fftw-dft-c2r-1d (in out norm)
+  ((-idx2- (-double-)) in)
+  ((-idx1- (-double-)) out)
+  ((-bool-) norm)
+  (when (<> 2 (idx-dim in 1)) (error "second dimension of output should be 2"))
+  (when (<> (idx-dim in 0) (idx-dim out 0)) (error "input and output have different sizes"))
+  (when (or (not (contiguousp in)) (not (contiguousp out))) (error "vector not contiguous"))
+  (let ((n (idx-dim out 0)))
+    ((-int-) n)
+    #{{ fftw_plan p;
+        p = fftw_plan_dft_c2r_1d($n, IDX_PTR($in,fftw_complex), IDX_PTR($out,double), FFTW_ESTIMATE);
+        fftw_execute(p);
+        fftw_destroy_plan(p);
+     }#}
+    (when norm
+      (let ((s (/ 1 (to-double n))))
+	((-double-) s)
+	(cidx-bloop ("i" ("out" out)) #{ out[0] *= $s; #} ))) ()))
+
+
 #? (fftw-dft-c2c-2d <in> <out> <forward> <norm>)
 ;; compute the complex-to-complex 2D fourier 
 ;; transform of complex matrix <in>, and put
@@ -354,8 +430,11 @@
    ;; Headers
    #{ #include <fftw3.h> #}
    ;; functions
+   fftw-dct-1d
+   fftw-dht-1d
    fftw-dft-c2c-1d
    fftw-dft-r2c-1d
+   fftw-dft-c2r-1d
    fftw-dft-c2c-2d
    fftw-dft-r2c-2d
    idx1-complex2norm
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/jpeg/jidctflt.c lush-cvs/packages/jpeg/jidctflt.c
--- lush/packages/jpeg/jidctflt.c	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/jpeg/jidctflt.c	2007-05-19 22:56:15.000000000 -0400
@@ -0,0 +1,286 @@
+/*
+ * jidctflt.c
+ *
+ * Copyright (C) 1994-1998, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ *
+ * The authors make NO WARRANTY or representation, either express or implied,
+ * with respect to this software, its quality, accuracy, merchantability, or 
+ * fitness for a particular purpose.  This software is provided "AS IS", and you,
+ * its user, assume the entire risk as to its quality and accuracy.
+ *
+ * This software is copyright (C) 1991-1998, Thomas G. Lane.
+ * All Rights Reserved except as specified below.
+ *
+ * Permission is hereby granted to use, copy, modify, and distribute this
+ * software (or portions thereof) for any purpose, without fee, subject to these
+ * conditions:
+ * (1) If any part of the source code for this software is distributed, then this
+ * README file must be included, with this copyright and no-warranty notice
+ * unaltered; and any additions, deletions, or changes to the original files
+ * must be clearly indicated in accompanying documentation.
+ * (2) If only executable code is distributed, then the accompanying
+ * documentation must state that "this software is based in part on the work of
+ * the Independent JPEG Group".
+ * (3) Permission for use of this software is granted only if the user accepts
+ * full responsibility for any undesirable consequences; the authors accept
+ * NO LIABILITY for damages of any kind.
+ * 
+ * These conditions apply to any software derived from or based on the IJG code,
+ * not just to the unmodified library.  If you use our work, you ought to
+ * acknowledge us.
+ * 
+ * Permission is NOT granted for the use of any IJG author's name or company name
+ * in advertising or publicity relating to this software or products derived from
+ * it.  This software may be referred to only as "the Independent JPEG Group's
+ * software".
+ * 
+ * We specifically permit and encourage the use of this software as the basis of
+ * commercial products, provided that all warranty or liability claims are
+ * assumed by the product vendor.
+ *
+ *
+ * This file contains a floating-point implementation of the
+ * inverse DCT (Discrete Cosine Transform).  In the IJG code, this routine
+ * must also perform dequantization of the input coefficients.
+ *
+ * This implementation should be more accurate than either of the integer
+ * IDCT implementations.  However, it may not give the same results on all
+ * machines because of differences in roundoff behavior.  Speed will depend
+ * on the hardware's floating point capacity.
+ *
+ * A 2-D IDCT can be done by 1-D IDCT on each column followed by 1-D IDCT
+ * on each row (or vice versa, but it's more convenient to emit a row at
+ * a time).  Direct algorithms are also available, but they are much more
+ * complex and seem not to be any faster when reduced to code.
+ *
+ * This implementation is based on Arai, Agui, and Nakajima's algorithm for
+ * scaled DCT.  Their original paper (Trans. IEICE E-71(11):1095) is in
+ * Japanese, but the algorithm is described in the Pennebaker & Mitchell
+ * JPEG textbook (see REFERENCES section in file README).  The following code
+ * is based directly on figure 4-8 in P&M.
+ * While an 8-point DCT cannot be done in less than 11 multiplies, it is
+ * possible to arrange the computation so that many of the multiplies are
+ * simple scalings of the final outputs.  These multiplies can then be
+ * folded into the multiplications or divisions by the JPEG quantization
+ * table entries.  The AA&N method leaves only 5 multiplies and 29 adds
+ * to be done in the DCT itself.
+ * The primary disadvantage of this method is that with a fixed-point
+ * implementation, accuracy is lost due to imprecise representation of the
+ * scaled quantization values.  However, that problem does not arise if
+ * we use floating point arithmetic.
+ */
+
+#include <stdint.h>
+#include "tinyjpeg-internal.h"
+
+#define FAST_FLOAT float
+#define DCTSIZE	   8
+#define DCTSIZE2   (DCTSIZE*DCTSIZE)
+
+#define DEQUANTIZE(coef,quantval)  (((FAST_FLOAT) (coef)) * (quantval))
+
+#if defined(__GNUC__) && (defined(__i686__) || defined(__x86_64__))
+
+static inline unsigned char descale_and_clamp(int x, int shift)
+{
+  __asm__ (
+      "add %3,%1\n"
+      "\tsar %2,%1\n"
+      "\tsub $-128,%1\n"
+      "\tcmovl %5,%1\n"	/* Use the sub to compare to 0 */
+      "\tcmpl %4,%1\n" 
+      "\tcmovg %4,%1\n"
+      : "=r"(x) 
+      : "0"(x), "Ir"(shift), "ir"(1UL<<(shift-1)), "r" (0xff), "r" (0)
+      );
+  return x;
+}
+
+#else
+static inline unsigned char descale_and_clamp(int x, int shift)
+{
+  x += (1UL<<(shift-1));
+  if (x<0)
+    x = (x >> shift) | ((~(0UL)) << (32-(shift)));
+  else
+    x >>= shift;
+  x += 128;
+  if (x>255)
+    return 255;
+  else if (x<0)
+    return 0;
+  else 
+    return x;
+}
+#endif
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients.
+ */
+
+void
+tinyjpeg_idct_float (struct component *compptr, uint8_t *output_buf, int stride)
+{
+  FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
+  FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
+  FAST_FLOAT z5, z10, z11, z12, z13;
+  int16_t *inptr;
+  FAST_FLOAT *quantptr;
+  FAST_FLOAT *wsptr;
+  uint8_t *outptr;
+  int ctr;
+  FAST_FLOAT workspace[DCTSIZE2]; /* buffers data between passes */
+
+  /* Pass 1: process columns from input, store into work array. */
+
+  inptr = compptr->DCT;
+  quantptr = compptr->Q_table;
+  wsptr = workspace;
+  for (ctr = DCTSIZE; ctr > 0; ctr--) {
+    /* Due to quantization, we will usually find that many of the input
+     * coefficients are zero, especially the AC terms.  We can exploit this
+     * by short-circuiting the IDCT calculation for any column in which all
+     * the AC terms are zero.  In that case each output is equal to the
+     * DC coefficient (with scale factor as needed).
+     * With typical images and quantization tables, half or more of the
+     * column DCT calculations can be simplified this way.
+     */
+    
+    if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
+	inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
+	inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
+	inptr[DCTSIZE*7] == 0) {
+      /* AC terms all zero */
+      FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+      
+      wsptr[DCTSIZE*0] = dcval;
+      wsptr[DCTSIZE*1] = dcval;
+      wsptr[DCTSIZE*2] = dcval;
+      wsptr[DCTSIZE*3] = dcval;
+      wsptr[DCTSIZE*4] = dcval;
+      wsptr[DCTSIZE*5] = dcval;
+      wsptr[DCTSIZE*6] = dcval;
+      wsptr[DCTSIZE*7] = dcval;
+      
+      inptr++;			/* advance pointers to next column */
+      quantptr++;
+      wsptr++;
+      continue;
+    }
+    
+    /* Even part */
+
+    tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
+    tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
+    tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
+    tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
+
+    tmp10 = tmp0 + tmp2;	/* phase 3 */
+    tmp11 = tmp0 - tmp2;
+
+    tmp13 = tmp1 + tmp3;	/* phases 5-3 */
+    tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; /* 2*c4 */
+
+    tmp0 = tmp10 + tmp13;	/* phase 2 */
+    tmp3 = tmp10 - tmp13;
+    tmp1 = tmp11 + tmp12;
+    tmp2 = tmp11 - tmp12;
+    
+    /* Odd part */
+
+    tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
+    tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
+    tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
+    tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
+
+    z13 = tmp6 + tmp5;		/* phase 6 */
+    z10 = tmp6 - tmp5;
+    z11 = tmp4 + tmp7;
+    z12 = tmp4 - tmp7;
+
+    tmp7 = z11 + z13;		/* phase 5 */
+    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); /* 2*c4 */
+
+    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
+    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
+    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */
+
+    tmp6 = tmp12 - tmp7;	/* phase 2 */
+    tmp5 = tmp11 - tmp6;
+    tmp4 = tmp10 + tmp5;
+
+    wsptr[DCTSIZE*0] = tmp0 + tmp7;
+    wsptr[DCTSIZE*7] = tmp0 - tmp7;
+    wsptr[DCTSIZE*1] = tmp1 + tmp6;
+    wsptr[DCTSIZE*6] = tmp1 - tmp6;
+    wsptr[DCTSIZE*2] = tmp2 + tmp5;
+    wsptr[DCTSIZE*5] = tmp2 - tmp5;
+    wsptr[DCTSIZE*4] = tmp3 + tmp4;
+    wsptr[DCTSIZE*3] = tmp3 - tmp4;
+
+    inptr++;			/* advance pointers to next column */
+    quantptr++;
+    wsptr++;
+  }
+  
+  /* Pass 2: process rows from work array, store into output array. */
+  /* Note that we must descale the results by a factor of 8 == 2**3. */
+
+  wsptr = workspace;
+  outptr = output_buf;
+  for (ctr = 0; ctr < DCTSIZE; ctr++) {
+    /* Rows of zeroes can be exploited in the same way as we did with columns.
+     * However, the column calculation has created many nonzero AC terms, so
+     * the simplification applies less often (typically 5% to 10% of the time).
+     * And testing floats for zero is relatively expensive, so we don't bother.
+     */
+    
+    /* Even part */
+
+    tmp10 = wsptr[0] + wsptr[4];
+    tmp11 = wsptr[0] - wsptr[4];
+
+    tmp13 = wsptr[2] + wsptr[6];
+    tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13;
+
+    tmp0 = tmp10 + tmp13;
+    tmp3 = tmp10 - tmp13;
+    tmp1 = tmp11 + tmp12;
+    tmp2 = tmp11 - tmp12;
+
+    /* Odd part */
+
+    z13 = wsptr[5] + wsptr[3];
+    z10 = wsptr[5] - wsptr[3];
+    z11 = wsptr[1] + wsptr[7];
+    z12 = wsptr[1] - wsptr[7];
+
+    tmp7 = z11 + z13;
+    tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);
+
+    z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); /* 2*c2 */
+    tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; /* 2*(c2-c6) */
+    tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; /* -2*(c2+c6) */
+
+    tmp6 = tmp12 - tmp7;
+    tmp5 = tmp11 - tmp6;
+    tmp4 = tmp10 + tmp5;
+
+    /* Final output stage: scale down by a factor of 8 and range-limit */
+
+    outptr[0] = descale_and_clamp((int)(tmp0 + tmp7), 3);
+    outptr[7] = descale_and_clamp((int)(tmp0 - tmp7), 3);
+    outptr[1] = descale_and_clamp((int)(tmp1 + tmp6), 3);
+    outptr[6] = descale_and_clamp((int)(tmp1 - tmp6), 3);
+    outptr[2] = descale_and_clamp((int)(tmp2 + tmp5), 3);
+    outptr[5] = descale_and_clamp((int)(tmp2 - tmp5), 3);
+    outptr[4] = descale_and_clamp((int)(tmp3 + tmp4), 3);
+    outptr[3] = descale_and_clamp((int)(tmp3 - tmp4), 3);
+
+    
+    wsptr += DCTSIZE;		/* advance pointer to next row */
+    outptr += stride;
+  }
+}
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/jpeg/jpeg.lsh lush-cvs/packages/jpeg/jpeg.lsh
--- lush/packages/jpeg/jpeg.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/jpeg/jpeg.lsh	2007-05-19 22:56:15.000000000 -0400
@@ -0,0 +1,115 @@
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; uses Jean-Luc Saillard's tinyjpegdecoder to decode a JPEG
+;; image in memory.
+;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(libload "libc/make")
+
+;; compile Jean-Luc's C code
+(let ((lm (new lushmake)))
+  (==> lm rule "tinyjpeg.o" '("tinyjpeg.c" "tinyjpeg-internal.h" "tinyjpeg.h"))
+  (==> lm rule "jidctflt.o" '("jidctflt.c" "tinyjpeg-internal.h" "tinyjpeg.h"))
+  (==> lm make)
+  (==> lm load))
+
+#? * jpeg decompression
+;; This set of functions provides a simple way to decode JPEG
+;; images in memory. It is based on Jean-Luc Saillard's 
+;; tinyjpegdecoder library which can be found at:
+;; http://www.saillard.org/programs_and_patches/tinyjpegdecoder .
+;; These functions are useful to decode JPEG streams from memory.
+
+#? (jpeg-decode <buffer> <image>)
+;; decode a JPEG stream in <buffer> (which must be an idx1 of ubytes
+;; into an RGB image, <image> (which must be an idx3 of ubyte). The
+;; image is automatically resized to the size of the JPEG image. If
+;; the JPEG image is grayscale, only the first component is filled.
+;; {<code>
+;;  (let ((buf (ubyte-matrix 1))
+;;        (m (ubyte-matrix 1 1 3)))
+;;    (read-file-to-idx "myimage.jpg" buf)
+;;    (jpeg-decode buf m))
+;; </code>}
+(de jpeg-decode (buffer m)
+  ((-idx1- (-ubyte-)) buffer)
+  ((-idx3- (-ubyte-)) m)
+  (cpheader "#include \"../tinyjpeg.h\"")
+  (let* ((n (idx-dim buffer 0))
+	 (err 0)
+	 (width 0)
+	 (height 0))
+    ((-int-) n err width height)
+    #{{ struct jdec_private *jdec;
+       jdec = tinyjpeg_init(); 
+       unsigned char *components[4];
+       if (jdec == NULL) {
+         printf("Not enough memory to alloc the structure need for decompressing\n");
+         $err = -1;
+       } else {
+         if (tinyjpeg_parse_header(jdec, IDX_PTR($buffer, unsigned char), $n)<0) {
+           printf("%s\n",tinyjpeg_get_errorstring(jdec));
+           $err = -2;
+         } else {
+           tinyjpeg_get_size(jdec, (unsigned int *)&$width, (unsigned int *)&$height);
+           if (tinyjpeg_decode(jdec, TINYJPEG_FMT_RGB24) < 0) {
+             printf("%s\n",tinyjpeg_get_errorstring(jdec));
+             $err = -3;
+           } else {
+             tinyjpeg_get_components(jdec, components);
+             Midx_init_dim3($m,$height,$width,3);
+             memcpy(IDX_PTR($m,unsigned char),components[0],$height*$width*3);
+           }
+         }
+       }
+     tinyjpeg_free(jdec);
+    } #}
+    err))
+
+#? (read-file-to-idx <f> <m>)
+;; read the content of a file <f> into an idx1 of ubyte <m>. 
+;; <m> is automatically resized to the proper size.
+;; Returns 0 on success, -1 if the file could not
+;; be open.
+(de read-file-to-idx (f m)
+  ((-str-) f)
+  ((-idx1- (-ubyte-)) m)
+  (let ((err 0))
+    ((-int-) err)
+    #{{long pos;
+       FILE *fp;
+       if ((fp = fopen($f->data, "rb")) == NULL) {
+         $err = -1;
+       } else {
+         fseek(fp, 0, SEEK_END);
+         pos = ftell(fp);
+         fseek(fp, 0, SEEK_SET);
+         Midx_init_dim1($m,pos);
+         fread(IDX_PTR($m, unsigned char), 1, pos, fp);
+         fclose(fp);
+      }
+    } #} err))
+
+#? (jpeg-decode-file <f>)
+;; return an RGB image (idx1 of ubyte height by width by 3)
+;; with the decoded image in JPEG file <f>.
+(de jpeg-decode-file (f)
+  ((-str-) f)
+  (let ((buf (ubyte-matrix 1))
+	(m (ubyte-matrix 1 1 3)))
+    (if (<> 0 (read-file-to-idx f buf))
+	(error "could not open file")
+      (jpeg-decode buf m) m)))
+
+
+(dhc-make () read-file-to-idx jpeg-decode jpeg-decode-file)
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(de test-jpeg-decode (f)
+  (let ((buf (ubyte-matrix 1))
+	(m (ubyte-matrix 1 1 3)))
+    (read-file-to-idx f buf)
+    (print (cputime (jpeg-decode buf m)))
+    (when (not window) (new-window))
+    (rgb-draw-matrix 0 0 m)))
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/jpeg/loadjpeg.c lush-cvs/packages/jpeg/loadjpeg.c
--- lush/packages/jpeg/loadjpeg.c	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/jpeg/loadjpeg.c	2007-05-19 22:56:15.000000000 -0400
@@ -0,0 +1,341 @@
+/*
+ * Small jpeg decoder library - testing application
+ *
+ * Copyright (c) 2006, Luc Saillard <luc@saillard.org>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of its contributors may be
+ *  used to endorse or promote products derived from this software without
+ *  specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "tinyjpeg.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+
+
+static void exitmessage(const char *message) __attribute__((noreturn));
+static void exitmessage(const char *message)
+{
+  printf("%s\n", message);
+  exit(0);
+}
+
+static int filesize(FILE *fp)
+{
+  long pos;
+  fseek(fp, 0, SEEK_END);
+  pos = ftell(fp);
+  fseek(fp, 0, SEEK_SET);
+  return pos;
+}
+
+/**
+ * Save a buffer in 24bits Targa format 
+ * (BGR byte order)
+ */
+static void write_tga(const char *filename, int input_format, int width, int height, unsigned char **components)
+{
+  unsigned char targaheader[18];
+  FILE *F;
+  char temp[1024];
+  unsigned int bufferlen = width * height * 3;
+  unsigned char *rgb_data = components[0];
+
+  snprintf(temp, sizeof(temp), filename);
+
+  memset(targaheader,0,sizeof(targaheader));
+
+  targaheader[12] = (unsigned char) (width & 0xFF);
+  targaheader[13] = (unsigned char) (width >> 8);
+  targaheader[14] = (unsigned char) (height & 0xFF);
+  targaheader[15] = (unsigned char) (height >> 8);
+  targaheader[17] = 0x20;    /* Top-down, non-interlaced */
+  targaheader[2]  = 2;       /* image type = uncompressed RGB */
+  targaheader[16] = 24;
+
+  if (input_format == TINYJPEG_FMT_RGB24)
+   {
+     unsigned char *data = rgb_data + bufferlen - 3;
+     do
+      { 
+	unsigned char c = data[0];
+	data[0] = data[2];
+	data[2] = c;
+	data-=3;
+      }
+     while (data > rgb_data);
+   }
+
+  F = fopen(temp, "wb");
+  fwrite(targaheader, sizeof(targaheader), 1, F);
+  fwrite(rgb_data, 1, bufferlen, F);
+  fclose(F);
+}
+
+/**
+ * Save a buffer in three files (.Y, .U, .V) useable by yuvsplittoppm
+ */
+static void write_yuv(const char *filename, int input_format, int width, int height, unsigned char **components)
+{
+  FILE *F;
+  char temp[1024];
+
+  snprintf(temp, 1024, "%s.Y", filename);
+  F = fopen(temp, "wb");
+  fwrite(components[0], width, height, F);
+  fclose(F);
+  snprintf(temp, 1024, "%s.U", filename);
+  F = fopen(temp, "wb");
+  fwrite(components[1], width*height/4, 1, F);
+  fclose(F);
+  snprintf(temp, 1024, "%s.V", filename);
+  F = fopen(temp, "wb");
+  fwrite(components[2], width*height/4, 1, F);
+  fclose(F);
+}
+
+/**
+ * Save a buffer in grey image (pgm format)
+ */
+static void write_pgm(const char *filename, int input_format, int width, int height, unsigned char **components)
+{
+  FILE *F;
+  char temp[1024];
+
+  snprintf(temp, 1024, "%s", filename);
+  F = fopen(temp, "wb");
+  fprintf(F, "P5\n%d %d\n255\n", width, height);
+  fwrite(components[0], width, height, F);
+  fclose(F);
+}
+
+/**
+ * Load one jpeg image, and try to decompress 1000 times, and save the result.
+ * This is mainly used for benchmarking the decoder, or to test if between each
+ * called of the library the DCT is corrected reset (a bug was found).
+ */
+int load_multiple_times(const char *filename, const char *outfilename, int output_format)
+{
+  FILE *fp;
+  int count, length_of_file;
+  unsigned int width, height;
+  unsigned char *buf;
+  struct jdec_private *jdec;
+  unsigned char *components[4];
+
+  jdec = tinyjpeg_init();
+  count = 0;
+
+  /* Load the Jpeg into memory */
+  fp = fopen(filename, "rb");
+  if (fp == NULL)
+    exitmessage("Cannot open filename\n");
+  length_of_file = filesize(fp);
+  buf = (unsigned char *)malloc(length_of_file + 4);
+  fread(buf, length_of_file, 1, fp);
+  fclose(fp);
+
+  while (count<1000)
+   {
+     if (tinyjpeg_parse_header(jdec, buf, length_of_file)<0)
+       exitmessage(tinyjpeg_get_errorstring(jdec));
+
+     tinyjpeg_decode(jdec, output_format);
+
+     count++;
+   }
+
+  /* 
+   * Get address for each plane (not only max 3 planes is supported), and
+   * depending of the output mode, only some components will be filled 
+   * RGB: 1 plane, YUV420P: 3 planes, GREY: 1 plane
+   */
+  tinyjpeg_get_components(jdec, components);
+  tinyjpeg_get_size(jdec, &width, &height);
+
+  /* Save it */
+  switch (output_format)
+   {
+    case TINYJPEG_FMT_RGB24:
+    case TINYJPEG_FMT_BGR24:
+      write_tga(outfilename, output_format, width, height, components);
+      break;
+    case TINYJPEG_FMT_YUV420P:
+      write_yuv(outfilename, output_format, width, height, components);
+      break;
+    case TINYJPEG_FMT_GREY:
+      write_pgm(outfilename, output_format, width, height, components);
+      break;
+   }
+
+  free(buf);
+  tinyjpeg_free(jdec);
+  return 0;
+}
+
+/**
+ * Load one jpeg image, and decompress it, and save the result.
+ */
+int convert_one_image(const char *infilename, const char *outfilename, int output_format)
+{
+  FILE *fp;
+  unsigned int length_of_file;
+  unsigned int width, height;
+  unsigned char *buf;
+  struct jdec_private *jdec;
+  unsigned char *components[3];
+
+  /* Load the Jpeg into memory */
+  fp = fopen(infilename, "rb");
+  if (fp == NULL)
+    exitmessage("Cannot open filename\n");
+  length_of_file = filesize(fp);
+  buf = (unsigned char *)malloc(length_of_file + 4);
+  if (buf == NULL)
+    exitmessage("Not enough memory for loading file\n");
+  fread(buf, length_of_file, 1, fp);
+  fclose(fp);
+
+  /* Decompress it */
+  jdec = tinyjpeg_init();
+  if (jdec == NULL)
+    exitmessage("Not enough memory to alloc the structure need for decompressing\n");
+
+  if (tinyjpeg_parse_header(jdec, buf, length_of_file)<0)
+    exitmessage(tinyjpeg_get_errorstring(jdec));
+
+  /* Get the size of the image */
+  tinyjpeg_get_size(jdec, &width, &height);
+
+  printf("Decoding JPEG image...\n");
+  if (tinyjpeg_decode(jdec, output_format) < 0)
+    exitmessage(tinyjpeg_get_errorstring(jdec));
+
+  /* 
+   * Get address for each plane (not only max 3 planes is supported), and
+   * depending of the output mode, only some components will be filled 
+   * RGB: 1 plane, YUV420P: 3 planes, GREY: 1 plane
+   */
+  tinyjpeg_get_components(jdec, components);
+
+  /* Save it */
+  switch (output_format)
+   {
+    case TINYJPEG_FMT_RGB24:
+    case TINYJPEG_FMT_BGR24:
+      write_tga(outfilename, output_format, width, height, components);
+      break;
+    case TINYJPEG_FMT_YUV420P:
+      write_yuv(outfilename, output_format, width, height, components);
+      break;
+    case TINYJPEG_FMT_GREY:
+      write_pgm(outfilename, output_format, width, height, components);
+      break;
+   }
+
+  /* Only called this if the buffers were allocated by tinyjpeg_decode() */
+  tinyjpeg_free(jdec);
+  /* else called just free(jdec); */
+
+  free(buf);
+  return 0;
+}
+
+static void usage(void)
+{
+    fprintf(stderr, "Usage: loadjpeg [options] <input_filename.jpeg> <format> <output_filename>\n");
+    fprintf(stderr, "options:\n");
+    fprintf(stderr, "  --benchmark - Convert 1000 times the same image\n");
+    fprintf(stderr, "format:\n");
+    fprintf(stderr, "  yuv420p - output 3 files .Y,.U,.V\n");
+    fprintf(stderr, "  rgb24   - output a .tga image\n");
+    fprintf(stderr, "  bgr24   - output a .tga image\n");
+    fprintf(stderr, "  gray    - output a .pgm image\n");
+    exit(1);
+}
+
+/**
+ * main
+ *
+ */
+int main(int argc, char *argv[])
+{
+  int output_format = TINYJPEG_FMT_YUV420P;
+  char *output_filename, *input_filename;
+  clock_t start_time, finish_time;
+  unsigned int duration;
+  int current_argument;
+  int benchmark_mode = 0;
+
+  if (argc < 3)
+    usage();
+
+  current_argument = 1;
+  while (1)
+   {
+     if (strcmp(argv[current_argument], "--benchmark")==0)
+       benchmark_mode = 1;
+     else
+       break;
+     current_argument++;
+   }
+
+  if (argc < current_argument+2)
+    usage();
+
+  input_filename = argv[current_argument];
+  if (strcmp(argv[current_argument+1],"yuv420p")==0)
+    output_format = TINYJPEG_FMT_YUV420P;
+  else if (strcmp(argv[current_argument+1],"rgb24")==0)
+    output_format = TINYJPEG_FMT_RGB24;
+  else if (strcmp(argv[current_argument+1],"bgr24")==0)
+    output_format = TINYJPEG_FMT_BGR24;
+  else if (strcmp(argv[current_argument+1],"grey")==0)
+    output_format = TINYJPEG_FMT_GREY;
+  else
+    exitmessage("Bad format: need to be one of yuv420p, rgb24, bgr24, grey\n");
+  output_filename = argv[current_argument+2];
+
+  start_time = clock();
+
+  if (benchmark_mode)
+    load_multiple_times(input_filename, output_filename, output_format);
+  else
+    convert_one_image(input_filename, output_filename, output_format);
+
+  finish_time = clock();
+  duration = finish_time - start_time;
+  printf("Decoding finished in %u ticks\n", duration);
+
+  return 0;
+}
+
+
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/jpeg/tinyjpeg.c lush-cvs/packages/jpeg/tinyjpeg.c
--- lush/packages/jpeg/tinyjpeg.c	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/jpeg/tinyjpeg.c	2007-05-19 22:56:15.000000000 -0400
@@ -0,0 +1,2143 @@
+/*
+ * Small jpeg decoder library
+ *
+ * Copyright (c) 2006, Luc Saillard <luc@saillard.org>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of its contributors may be
+ *  used to endorse or promote products derived from this software without
+ *  specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+
+#include "tinyjpeg.h"
+#include "tinyjpeg-internal.h"
+
+enum std_markers {
+   DQT  = 0xDB, /* Define Quantization Table */
+   SOF  = 0xC0, /* Start of Frame (size information) */
+   DHT  = 0xC4, /* Huffman Table */
+   SOI  = 0xD8, /* Start of Image */
+   SOS  = 0xDA, /* Start of Scan */
+   RST  = 0xD0, /* Reset Marker d0 -> .. */
+   RST7 = 0xD7, /* Reset Marker .. -> d7 */
+   EOI  = 0xD9, /* End of Image */
+   DRI  = 0xDD, /* Define Restart Interval */
+   APP0 = 0xE0,
+};
+
+#define cY	1
+#define cCb	2
+#define cCr	3
+
+#define BLACK_Y 0
+#define BLACK_U 127
+#define BLACK_V 127
+
+#define SANITY_CHECK 1
+
+#if DEBUG
+#define trace(fmt, args...) do { \
+   fprintf(stderr, fmt, ## args); \
+   fflush(stderr); \
+} while(0)
+#else
+#define trace(fmt, args...) do { } while (0)
+#endif
+#define error(fmt, args...) do { \
+   snprintf(error_string, sizeof(error_string), fmt, ## args); \
+   return -1; \
+} while(0)
+
+
+#if 1
+static char *print_bits(unsigned int value, char *bitstr)
+{
+  int i, j;
+  i=31;
+  while (i>0)
+   {
+     if (value & (1UL<<i))
+       break;
+     i--;
+   }
+  j=0;
+  while (i>=0)
+   {
+     bitstr[j++] = (value & (1UL<<i))?'1':'0';
+     i--;
+   }
+  bitstr[j] = 0;
+  return bitstr;
+}
+
+static void print_next_16bytes(int offset, const unsigned char *stream)
+{
+  trace("%4.4x: %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x %2.2x\n",
+	offset,
+	stream[0], stream[1], stream[2], stream[3], 
+	stream[4], stream[5], stream[6], stream[7],
+	stream[8], stream[9], stream[10], stream[11], 
+	stream[12], stream[13], stream[14], stream[15]);
+}
+
+#endif
+
+/* Global variable to return the last error found while deconding */
+static char error_string[256];
+
+static const unsigned char zigzag[64] = 
+{
+   0,  1,  5,  6, 14, 15, 27, 28,
+   2,  4,  7, 13, 16, 26, 29, 42,
+   3,  8, 12, 17, 25, 30, 41, 43,
+   9, 11, 18, 24, 31, 40, 44, 53,
+  10, 19, 23, 32, 39, 45, 52, 54,
+  20, 22, 33, 38, 46, 51, 55, 60,
+  21, 34, 37, 47, 50, 56, 59, 61,
+  35, 36, 48, 49, 57, 58, 62, 63
+};
+
+/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
+/* IMPORTANT: these are only valid for 8-bit data precision! */
+static const unsigned char bits_dc_luminance[17] =
+{ 
+  0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 
+};
+static const unsigned char val_dc_luminance[] =
+{
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 
+};
+  
+static const unsigned char bits_dc_chrominance[17] =
+{
+  0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 
+};
+static const unsigned char val_dc_chrominance[] = 
+{
+  0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 
+};
+  
+static const unsigned char bits_ac_luminance[17] =
+{
+  0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d 
+};
+static const unsigned char val_ac_luminance[] =
+{
+  0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
+  0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
+  0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
+  0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
+  0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
+  0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
+  0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
+  0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
+  0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
+  0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
+  0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
+  0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
+  0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
+  0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+  0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
+  0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
+  0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
+  0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
+  0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
+  0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+  0xf9, 0xfa
+};
+
+static const unsigned char bits_ac_chrominance[17] =
+{ 
+  0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 
+};
+
+static const unsigned char val_ac_chrominance[] =
+{
+  0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
+  0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
+  0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
+  0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
+  0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
+  0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
+  0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
+  0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
+  0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
+  0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+  0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
+  0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+  0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
+  0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
+  0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
+  0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
+  0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
+  0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
+  0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
+  0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
+  0xf9, 0xfa
+};
+
+
+/*
+ * 4 functions to manage the stream
+ *
+ *  fill_nbits: put at least nbits in the reservoir of bits.
+ *              But convert any 0xff,0x00 into 0xff
+ *  get_nbits: read nbits from the stream, and put it in result,
+ *             bits is removed from the stream and the reservoir is filled
+ *             automaticaly. The result is signed according to the number of
+ *             bits.
+ *  look_nbits: read nbits from the stream without marking as read.
+ *  skip_nbits: read nbits from the stream but do not return the result.
+ * 
+ * stream: current pointer in the jpeg data (read bytes per bytes)
+ * nbits_in_reservoir: number of bits filled into the reservoir
+ * reservoir: register that contains bits information. Only nbits_in_reservoir
+ *            is valid.
+ *                          nbits_in_reservoir
+ *                        <--    17 bits    -->
+ *            Ex: 0000 0000 1010 0000 1111 0000   <== reservoir
+ *                        ^
+ *                        bit 1
+ *            To get two bits from this example
+ *                 result = (reservoir >> 15) & 3
+ *
+ */
+#define fill_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted) do { \
+   while (nbits_in_reservoir<nbits_wanted) \
+    { \
+      unsigned char c; \
+      if (stream >= priv->stream_end) \
+        longjmp(priv->jump_state, -EIO); \
+      c = *stream++; \
+      reservoir <<= 8; \
+      if (c == 0xff && *stream == 0x00) \
+        stream++; \
+      reservoir |= c; \
+      nbits_in_reservoir+=8; \
+    } \
+}  while(0);
+
+/* Signed version !!!! */
+#define get_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted,result) do { \
+   fill_nbits(reservoir,nbits_in_reservoir,stream,(nbits_wanted)); \
+   result = ((reservoir)>>(nbits_in_reservoir-(nbits_wanted))); \
+   nbits_in_reservoir -= (nbits_wanted);  \
+   reservoir &= ((1U<<nbits_in_reservoir)-1); \
+   if ((unsigned int)result < (1UL<<((nbits_wanted)-1))) \
+       result += (0xFFFFFFFFUL<<(nbits_wanted))+1; \
+}  while(0);
+
+#define look_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted,result) do { \
+   fill_nbits(reservoir,nbits_in_reservoir,stream,(nbits_wanted)); \
+   result = ((reservoir)>>(nbits_in_reservoir-(nbits_wanted))); \
+}  while(0);
+
+/* To speed up the decoding, we assume that the reservoir have enough bit 
+ * slow version:
+ * #define skip_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted) do { \
+ *   fill_nbits(reservoir,nbits_in_reservoir,stream,(nbits_wanted)); \
+ *   nbits_in_reservoir -= (nbits_wanted); \
+ *   reservoir &= ((1U<<nbits_in_reservoir)-1); \
+ * }  while(0);
+ */
+#define skip_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted) do { \
+   nbits_in_reservoir -= (nbits_wanted); \
+   reservoir &= ((1U<<nbits_in_reservoir)-1); \
+}  while(0);
+
+
+#define be16_to_cpu(x) (((x)[0]<<8)|(x)[1])
+
+static void resync(struct jdec_private *priv);
+
+/**
+ * Get the next (valid) huffman code in the stream.
+ *
+ * To speedup the procedure, we look HUFFMAN_HASH_NBITS bits and the code is
+ * lower than HUFFMAN_HASH_NBITS we have automaticaly the length of the code
+ * and the value by using two lookup table.
+ * Else if the value is not found, just search (linear) into an array for each
+ * bits is the code is present.
+ *
+ * If the code is not present for any reason, -1 is return.
+ */
+static int get_next_huffman_code(struct jdec_private *priv, struct huffman_table *huffman_table)
+{
+  int value, hcode;
+  unsigned int extra_nbits, nbits;
+  uint16_t *slowtable;
+
+  look_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, HUFFMAN_HASH_NBITS, hcode);
+  value = huffman_table->lookup[hcode];
+  if (value >= 0)
+  { 
+     unsigned int code_size = huffman_table->code_size[value];
+     skip_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, code_size);
+     return value;
+  }
+
+  /* Decode more bits each time ... */
+  for (extra_nbits=0; extra_nbits<16-HUFFMAN_HASH_NBITS; extra_nbits++)
+   {
+     nbits = HUFFMAN_HASH_NBITS + 1 + extra_nbits;
+
+     look_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, nbits, hcode);
+     slowtable = huffman_table->slowtable[extra_nbits];
+     /* Search if the code is in this array */
+     while (slowtable[0]) {
+	if (slowtable[0] == hcode) {
+	   skip_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, nbits);
+	   return slowtable[1];
+	}
+	slowtable+=2;
+     }
+   }
+  return 0;
+}
+
+
+
+
+/**
+ *
+ * Decode a single block that contains the DCT coefficients.
+ * The table coefficients is already dezigzaged at the end of the operation.
+ *
+ */
+static void process_Huffman_data_unit(struct jdec_private *priv, int component)
+{
+  unsigned char j;
+  unsigned int huff_code;
+  unsigned char size_val, count_0;
+
+  struct component *c = &priv->component_infos[component];
+  short int DCT[64];
+
+  /* Initialize the DCT coef table */
+  memset(DCT, 0, sizeof(DCT));
+
+  /* DC coefficient decoding */
+  huff_code = get_next_huffman_code(priv, c->DC_table);
+  if (huff_code) {
+     get_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, huff_code, DCT[0]);
+     DCT[0] += c->previous_DC;
+     c->previous_DC = DCT[0];
+  } else {
+     DCT[0] = c->previous_DC;
+  }
+
+
+  /* AC coefficient decoding */
+  j = 1;
+  while (j<64)
+   {
+     huff_code = get_next_huffman_code(priv, c->AC_table);
+
+     size_val = huff_code & 0xF;
+     count_0 = huff_code >> 4;
+
+     if (size_val == 0)
+      { /* RLE */
+	if (count_0 == 0)
+	  break;	/* EOB found, go out */
+	else if (count_0 == 0xF)
+	  j += 16;	/* skip 16 zeros */
+      }
+     else
+      {
+	j += count_0;	/* skip count_0 zeroes */
+	get_nbits(priv->reservoir, priv->nbits_in_reservoir, priv->stream, size_val, DCT[j]);
+	j++;
+      }
+   }
+
+  for (j = 0; j < 64; j++)
+    c->DCT[j] = DCT[zigzag[j]];
+}
+
+/*
+ * Takes two array of bits, and build the huffman table for size, and code
+ * 
+ * lookup will return the symbol if the code is less or equal than HUFFMAN_HASH_NBITS.
+ * code_size will be used to known how many bits this symbol is encoded.
+ * slowtable will be used when the first lookup didn't give the result.
+ */
+static void build_huffman_table(const unsigned char *bits, const unsigned char *vals, struct huffman_table *table)
+{
+  unsigned int i, j, code, code_size, val, nbits;
+  unsigned char huffsize[257], *hz;
+  unsigned int huffcode[257], *hc;
+  int next_free_entry;
+
+  /*
+   * Build a temp array 
+   *   huffsize[X] => numbers of bits to write vals[X]
+   */
+  hz = huffsize;
+  for (i=1; i<=16; i++)
+   {
+     for (j=1; j<=bits[i]; j++)
+       *hz++ = i;
+   }
+  *hz = 0;
+
+  memset(table->lookup, 0xff, sizeof(table->lookup));
+  for (i=0; i<(16-HUFFMAN_HASH_NBITS); i++)
+    table->slowtable[i][0] = 0;
+
+  /* Build a temp array
+   *   huffcode[X] => code used to write vals[X]
+   */
+  code = 0;
+  hc = huffcode;
+  hz = huffsize;
+  nbits = *hz;
+  while (*hz)
+   {
+     while (*hz == nbits) {
+	*hc++ = code++;
+	hz++;
+     }
+     code <<= 1;
+     nbits++;
+   }
+
+  /*
+   * Build the lookup table, and the slowtable if needed.
+   */
+  next_free_entry = -1;
+  for (i=0; huffsize[i]; i++)
+   {
+     val = vals[i];
+     code = huffcode[i];
+     code_size = huffsize[i];
+
+     trace("val=%2.2x code=%8.8x codesize=%2.2d\n", i, code, code_size);
+
+     table->code_size[val] = code_size;
+     if (code_size <= HUFFMAN_HASH_NBITS)
+      {
+	/*
+	 * Good: val can be put in the lookup table, so fill all value of this
+	 * column with value val 
+	 */
+	int repeat = 1UL<<(HUFFMAN_HASH_NBITS - code_size);
+	code <<= HUFFMAN_HASH_NBITS - code_size;
+	while ( repeat-- )
+	  table->lookup[code++] = val;
+
+      }
+     else
+      {
+	/* Perhaps sorting the array will be an optimization */
+	uint16_t *slowtable = table->slowtable[code_size-HUFFMAN_HASH_NBITS-1];
+	while(slowtable[0])
+	  slowtable+=2;
+	slowtable[0] = code;
+	slowtable[1] = val;
+	slowtable[2] = 0;
+	/* TODO: NEED TO CHECK FOR AN OVERFLOW OF THE TABLE */
+      }
+
+   }
+
+}
+
+static void build_default_huffman_tables(struct jdec_private *priv)
+{
+  if (   (priv->flags & TINYJPEG_FLAGS_MJPEG_TABLE) 
+      && priv->default_huffman_table_initialized)
+    return;
+
+  build_huffman_table(bits_dc_luminance, val_dc_luminance, &priv->HTDC[0]);
+  build_huffman_table(bits_ac_luminance, val_ac_luminance, &priv->HTAC[0]);
+
+  build_huffman_table(bits_dc_chrominance, val_dc_chrominance, &priv->HTDC[1]);
+  build_huffman_table(bits_ac_chrominance, val_ac_chrominance, &priv->HTAC[1]);
+
+  priv->default_huffman_table_initialized = 1;
+}
+
+
+
+/*******************************************************************************
+ *
+ * Colorspace conversion routine
+ *
+ *
+ * Note:
+ * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
+ * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
+ * The conversion equations to be implemented are therefore
+ *      R = Y                + 1.40200 * Cr
+ *      G = Y - 0.34414 * Cb - 0.71414 * Cr
+ *      B = Y + 1.77200 * Cb
+ * 
+ ******************************************************************************/
+
+static unsigned char clamp(int i)
+{
+  if (i<0)
+    return 0;
+  else if (i>255)
+    return 255;
+  else
+    return i;
+}   
+
+
+/**
+ *  YCrCb -> YUV420P (1x1)
+ *  .---.
+ *  | 1 |
+ *  `---'
+ */
+static void YCrCB_to_YUV420P_1x1(struct jdec_private *priv)
+{
+  const unsigned char *s, *y;
+  unsigned char *p;
+  int i,j;
+
+  p = priv->plane[0];
+  y = priv->Y;
+  for (i=0; i<8; i++)
+   {
+     memcpy(p, y, 8);
+     p+=priv->width;
+     y+=8;
+   }
+
+  p = priv->plane[1];
+  s = priv->Cb;
+  for (i=0; i<8; i+=2)
+   {
+     for (j=0; j<8; j+=2, s+=2)
+       *p++ = *s;
+     s += 8; /* Skip one line */
+     p += priv->width/2 - 4;
+   }
+
+  p = priv->plane[2];
+  s = priv->Cr;
+  for (i=0; i<8; i+=2)
+   {
+     for (j=0; j<8; j+=2, s+=2)
+       *p++ = *s;
+     s += 8; /* Skip one line */
+     p += priv->width/2 - 4;
+   }
+}
+
+/**
+ *  YCrCb -> YUV420P (2x1)
+ *  .-------.
+ *  | 1 | 2 |
+ *  `-------'
+ */
+static void YCrCB_to_YUV420P_2x1(struct jdec_private *priv)
+{
+  unsigned char *p;
+  const unsigned char *s, *y1;
+  unsigned int i;
+
+  p = priv->plane[0];
+  y1 = priv->Y;
+  for (i=0; i<8; i++)
+   {
+     memcpy(p, y1, 16);
+     p += priv->width;
+     y1 += 16;
+   }
+
+  p = priv->plane[1];
+  s = priv->Cb;
+  for (i=0; i<8; i+=2)
+   {
+     memcpy(p, s, 8);
+     s += 16; /* Skip one line */
+     p += priv->width/2;
+   }
+
+  p = priv->plane[2];
+  s = priv->Cr;
+  for (i=0; i<8; i+=2)
+   {
+     memcpy(p, s, 8);
+     s += 16; /* Skip one line */
+     p += priv->width/2;
+   }
+}
+
+
+/**
+ *  YCrCb -> YUV420P (1x2)
+ *  .---.
+ *  | 1 |
+ *  |---|
+ *  | 2 |
+ *  `---'
+ */
+static void YCrCB_to_YUV420P_1x2(struct jdec_private *priv)
+{
+  const unsigned char *s, *y;
+  unsigned char *p;
+  int i,j;
+
+  p = priv->plane[0];
+  y = priv->Y;
+  for (i=0; i<16; i++)
+   {
+     memcpy(p, y, 8);
+     p+=priv->width;
+     y+=8;
+   }
+
+  p = priv->plane[1];
+  s = priv->Cb;
+  for (i=0; i<8; i++)
+   {
+     for (j=0; j<8; j+=2, s+=2)
+       *p++ = *s;
+     p += priv->width/2 - 4;
+   }
+
+  p = priv->plane[2];
+  s = priv->Cr;
+  for (i=0; i<8; i++)
+   {
+     for (j=0; j<8; j+=2, s+=2)
+       *p++ = *s;
+     p += priv->width/2 - 4;
+   }
+}
+
+/**
+ *  YCrCb -> YUV420P (2x2)
+ *  .-------.
+ *  | 1 | 2 |
+ *  |---+---|
+ *  | 3 | 4 |
+ *  `-------'
+ */
+static void YCrCB_to_YUV420P_2x2(struct jdec_private *priv)
+{
+  unsigned char *p;
+  const unsigned char *s, *y1;
+  int i;
+
+  p = priv->plane[0];
+  y1 = priv->Y;
+  for (i=0; i<16; i++)
+   {
+     memcpy(p, y1, 16);
+     p += priv->width;
+     y1 += 16;
+   }
+
+  p = priv->plane[1];
+  s = priv->Cb;
+  for (i=0; i<8; i++)
+   {
+     memcpy(p, s, 8);
+     s += 8;
+     p += priv->width/2;
+   }
+
+  p = priv->plane[2];
+  s = priv->Cr;
+  for (i=0; i<8; i++)
+   {
+     memcpy(p, s, 8);
+     s += 8;
+     p += priv->width/2;
+   }
+}
+
+/**
+ *  YCrCb -> RGB24 (1x1)
+ *  .---.
+ *  | 1 |
+ *  `---'
+ */
+static void YCrCB_to_RGB24_1x1(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = priv->width*3 - 8*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       y  = (*Y++) << SCALEBITS;
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+
+    }
+
+    p += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+/**
+ *  YCrCb -> BGR24 (1x1)
+ *  .---.
+ *  | 1 |
+ *  `---'
+ */
+static void YCrCB_to_BGR24_1x1(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = priv->width*3 - 8*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       y  = (*Y++) << SCALEBITS;
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+
+    }
+
+    p += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+
+/**
+ *  YCrCb -> RGB24 (2x1)
+ *  .-------.
+ *  | 1 | 2 |
+ *  `-------'
+ */
+static void YCrCB_to_RGB24_2x1(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = priv->width*3 - 16*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       y  = (*Y++) << SCALEBITS;
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+
+       y  = (*Y++) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+
+    }
+
+    p += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+/*
+ *  YCrCb -> BGR24 (2x1)
+ *  .-------.
+ *  | 1 | 2 |
+ *  `-------'
+ */
+static void YCrCB_to_BGR24_2x1(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = priv->width*3 - 16*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       y  = (*Y++) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+
+       y  = (*Y++) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+
+    }
+
+    p += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+/**
+ *  YCrCb -> RGB24 (1x2)
+ *  .---.
+ *  | 1 |
+ *  |---|
+ *  | 2 |
+ *  `---'
+ */
+static void YCrCB_to_RGB24_1x2(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p, *p2;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  p2 = priv->plane[0] + priv->width*3;
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = 2*priv->width*3 - 8*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       y  = (*Y++) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+
+       y  = (Y[8-1]) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p2++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p2++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p2++ = clamp(b);
+
+    }
+    Y += 8;
+    p += offset_to_next_row;
+    p2 += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+/*
+ *  YCrCb -> BGR24 (1x2)
+ *  .---.
+ *  | 1 |
+ *  |---|
+ *  | 2 |
+ *  `---'
+ */
+static void YCrCB_to_BGR24_1x2(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p, *p2;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  p2 = priv->plane[0] + priv->width*3;
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = 2*priv->width*3 - 8*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       y  = (*Y++) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+
+       y  = (Y[8-1]) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p2++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p2++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p2++ = clamp(r);
+
+    }
+    Y += 8;
+    p += offset_to_next_row;
+    p2 += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+
+/**
+ *  YCrCb -> RGB24 (2x2)
+ *  .-------.
+ *  | 1 | 2 |
+ *  |---+---|
+ *  | 3 | 4 |
+ *  `-------'
+ */
+static void YCrCB_to_RGB24_2x2(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p, *p2;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  p2 = priv->plane[0] + priv->width*3;
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = (priv->width*3*2) - 16*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       y  = (*Y++) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+
+       y  = (*Y++) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+
+       y  = (Y[16-2]) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p2++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p2++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p2++ = clamp(b);
+
+       y  = (Y[16-1]) << SCALEBITS;
+       r = (y + add_r) >> SCALEBITS;
+       *p2++ = clamp(r);
+       g = (y + add_g) >> SCALEBITS;
+       *p2++ = clamp(g);
+       b = (y + add_b) >> SCALEBITS;
+       *p2++ = clamp(b);
+    }
+    Y  += 16;
+    p  += offset_to_next_row;
+    p2 += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+
+/*
+ *  YCrCb -> BGR24 (2x2)
+ *  .-------.
+ *  | 1 | 2 |
+ *  |---+---|
+ *  | 3 | 4 |
+ *  `-------'
+ */
+static void YCrCB_to_BGR24_2x2(struct jdec_private *priv)
+{
+  const unsigned char *Y, *Cb, *Cr;
+  unsigned char *p, *p2;
+  int i,j;
+  int offset_to_next_row;
+
+#define SCALEBITS       10
+#define ONE_HALF        (1UL << (SCALEBITS-1))
+#define FIX(x)          ((int)((x) * (1UL<<SCALEBITS) + 0.5))
+
+  p = priv->plane[0];
+  p2 = priv->plane[0] + priv->width*3;
+  Y = priv->Y;
+  Cb = priv->Cb;
+  Cr = priv->Cr;
+  offset_to_next_row = (priv->width*3*2) - 16*3;
+  for (i=0; i<8; i++) {
+
+    for (j=0; j<8; j++) {
+
+       int y, cb, cr;
+       int add_r, add_g, add_b;
+       int r, g , b;
+
+       cb = *Cb++ - 128;
+       cr = *Cr++ - 128;
+       add_r = FIX(1.40200) * cr + ONE_HALF;
+       add_g = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;
+       add_b = FIX(1.77200) * cb + ONE_HALF;
+
+       y  = (*Y++) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+
+       y  = (*Y++) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p++ = clamp(r);
+
+       y  = (Y[16-2]) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p2++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p2++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p2++ = clamp(r);
+
+       y  = (Y[16-1]) << SCALEBITS;
+       b = (y + add_b) >> SCALEBITS;
+       *p2++ = clamp(b);
+       g = (y + add_g) >> SCALEBITS;
+       *p2++ = clamp(g);
+       r = (y + add_r) >> SCALEBITS;
+       *p2++ = clamp(r);
+    }
+    Y  += 16;
+    p  += offset_to_next_row;
+    p2 += offset_to_next_row;
+  }
+
+#undef SCALEBITS
+#undef ONE_HALF
+#undef FIX
+
+}
+
+
+
+/**
+ *  YCrCb -> Grey (1x1)
+ *  .---.
+ *  | 1 |
+ *  `---'
+ */
+static void YCrCB_to_Grey_1x1(struct jdec_private *priv)
+{
+  const unsigned char *y;
+  unsigned char *p;
+  unsigned int i;
+  int offset_to_next_row;
+
+  p = priv->plane[0];
+  y = priv->Y;
+  offset_to_next_row = priv->width;
+
+  for (i=0; i<8; i++) {
+     memcpy(p, y, 8);
+     y+=8;
+     p += offset_to_next_row;
+  }
+}
+
+/**
+ *  YCrCb -> Grey (2x1)
+ *  .-------.
+ *  | 1 | 2 |
+ *  `-------'
+ */
+static void YCrCB_to_Grey_2x1(struct jdec_private *priv)
+{
+  const unsigned char *y;
+  unsigned char *p;
+  unsigned int i;
+
+  p = priv->plane[0];
+  y = priv->Y;
+
+  for (i=0; i<8; i++) {
+     memcpy(p, y, 16);
+     y += 16;
+     p += priv->width;
+  }
+}
+
+
+/**
+ *  YCrCb -> Grey (1x2)
+ *  .---.
+ *  | 1 |
+ *  |---|
+ *  | 2 |
+ *  `---'
+ */
+static void YCrCB_to_Grey_1x2(struct jdec_private *priv)
+{
+  const unsigned char *y;
+  unsigned char *p;
+  unsigned int i;
+
+  p = priv->plane[0];
+  y = priv->Y;
+
+  for (i=0; i<16; i++) {
+     memcpy(p, y, 8);
+     y += 8;
+     p += priv->width;
+  }
+}
+
+/**
+ *  YCrCb -> Grey (2x2)
+ *  .-------.
+ *  | 1 | 2 |
+ *  |---+---|
+ *  | 3 | 4 |
+ *  `-------'
+ */
+static void YCrCB_to_Grey_2x2(struct jdec_private *priv)
+{
+  const unsigned char *y;
+  unsigned char *p;
+  unsigned int i;
+
+  p = priv->plane[0];
+  y = priv->Y;
+
+  for (i=0; i<16; i++) {
+     memcpy(p, y, 16);
+     y += 16;
+     p += priv->width;
+  }
+}
+
+
+/*
+ * Decode all the 3 components for 1x1 
+ */
+static void decode_MCU_1x1_3planes(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 8);
+  
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+  IDCT(&priv->component_infos[cCb], priv->Cb, 8);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+  IDCT(&priv->component_infos[cCr], priv->Cr, 8);
+}
+
+/*
+ * Decode a 1x1 directly in 1 color
+ */
+static void decode_MCU_1x1_1plane(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 8);
+  
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+  IDCT(&priv->component_infos[cCb], priv->Cb, 8);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+  IDCT(&priv->component_infos[cCr], priv->Cr, 8);
+}
+
+
+/*
+ * Decode a 2x1
+ *  .-------.
+ *  | 1 | 2 |
+ *  `-------'
+ */
+static void decode_MCU_2x1_3planes(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+8, 16);
+
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+  IDCT(&priv->component_infos[cCb], priv->Cb, 8);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+  IDCT(&priv->component_infos[cCr], priv->Cr, 8);
+}
+
+/*
+ * Decode a 2x1
+ *  .-------.
+ *  | 1 | 2 |
+ *  `-------'
+ */
+static void decode_MCU_2x1_1plane(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+8, 16);
+
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+}
+
+
+/*
+ * Decode a 2x2
+ *  .-------.
+ *  | 1 | 2 |
+ *  |---+---|
+ *  | 3 | 4 |
+ *  `-------'
+ */
+static void decode_MCU_2x2_3planes(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+8, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+64*2, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+64*2+8, 16);
+
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+  IDCT(&priv->component_infos[cCb], priv->Cb, 8);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+  IDCT(&priv->component_infos[cCr], priv->Cr, 8);
+}
+
+/*
+ * Decode a 2x2 directly in GREY format (8bits)
+ *  .-------.
+ *  | 1 | 2 |
+ *  |---+---|
+ *  | 3 | 4 |
+ *  `-------'
+ */
+static void decode_MCU_2x2_1plane(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+8, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+64*2, 16);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+64*2+8, 16);
+
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+}
+
+/*
+ * Decode a 1x2 mcu
+ *  .---.
+ *  | 1 |
+ *  |---|
+ *  | 2 |
+ *  `---'
+ */
+static void decode_MCU_1x2_3planes(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 8);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+64, 8);
+
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+  IDCT(&priv->component_infos[cCb], priv->Cb, 8);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+  IDCT(&priv->component_infos[cCr], priv->Cr, 8);
+}
+
+/*
+ * Decode a 1x2 mcu
+ *  .---.
+ *  | 1 |
+ *  |---|
+ *  | 2 |
+ *  `---'
+ */
+static void decode_MCU_1x2_1plane(struct jdec_private *priv)
+{
+  // Y
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y, 8);
+  process_Huffman_data_unit(priv, cY);
+  IDCT(&priv->component_infos[cY], priv->Y+64, 8);
+
+  // Cb
+  process_Huffman_data_unit(priv, cCb);
+
+  // Cr
+  process_Huffman_data_unit(priv, cCr);
+}
+
+static void print_SOF(const unsigned char *stream)
+{
+  int width, height, nr_components, precision;
+#if DEBUG
+  const char *nr_components_to_string[] = {
+     "????",
+     "Grayscale",
+     "????",
+     "YCbCr",
+     "CYMK"
+  };
+#endif
+
+  precision = stream[2];
+  height = be16_to_cpu(stream+3);
+  width  = be16_to_cpu(stream+5);
+  nr_components = stream[7];
+
+  trace("> SOF marker\n");
+  trace("Size:%dx%d nr_components:%d (%s)  precision:%d\n", 
+      width, height,
+      nr_components, nr_components_to_string[nr_components],
+      precision);
+}
+
+/*******************************************************************************
+ *
+ * JPEG/JFIF Parsing functions
+ *
+ * Note: only a small subset of the jpeg file format is supported. No markers,
+ * nor progressive stream is supported.
+ *
+ ******************************************************************************/
+
+static void build_quantization_table(float *qtable, const unsigned char *ref_table)
+{
+  /* Taken from libjpeg. Copyright Independent JPEG Group's LLM idct.
+   * For float AA&N IDCT method, divisors are equal to quantization
+   * coefficients scaled by scalefactor[row]*scalefactor[col], where
+   *   scalefactor[0] = 1
+   *   scalefactor[k] = cos(k*PI/16) * sqrt(2)    for k=1..7
+   * We apply a further scale factor of 8.
+   * What's actually stored is 1/divisor so that the inner loop can
+   * use a multiplication rather than a division.
+   */
+  int i, j;
+  static const double aanscalefactor[8] = {
+     1.0, 1.387039845, 1.306562965, 1.175875602,
+     1.0, 0.785694958, 0.541196100, 0.275899379
+  };
+  const unsigned char *zz = zigzag;
+
+  for (i=0; i<8; i++) {
+     for (j=0; j<8; j++) {
+       *qtable++ = ref_table[*zz++] * aanscalefactor[i] * aanscalefactor[j];
+     }
+   }
+
+}
+
+static int parse_DQT(struct jdec_private *priv, const unsigned char *stream)
+{
+  int qi;
+  float *table;
+  const unsigned char *dqt_block_end;
+
+  trace("> DQT marker\n");
+  dqt_block_end = stream + be16_to_cpu(stream);
+  stream += 2;	/* Skip length */
+
+  while (stream < dqt_block_end)
+   {
+     qi = *stream++;
+#if SANITY_CHECK
+     if (qi>>4)
+       error("16 bits quantization table is not supported\n");
+     if (qi>4)
+       error("No more 4 quantization table is supported (got %d)\n", qi);
+#endif
+     table = priv->Q_tables[qi];
+     build_quantization_table(table, stream);
+     stream += 64;
+   }
+  trace("< DQT marker\n");
+  return 0;
+}
+
+static int parse_SOF(struct jdec_private *priv, const unsigned char *stream)
+{
+  int i, width, height, nr_components, cid, sampling_factor;
+  int Q_table;
+  struct component *c;
+
+  trace("> SOF marker\n");
+  print_SOF(stream);
+
+  height = be16_to_cpu(stream+3);
+  width  = be16_to_cpu(stream+5);
+  nr_components = stream[7];
+#if SANITY_CHECK
+  if (stream[2] != 8)
+    error("Precision other than 8 is not supported\n");
+  if (width>JPEG_MAX_WIDTH || height>JPEG_MAX_HEIGHT)
+    error("Width and Height (%dx%d) seems suspicious\n", width, height);
+  if (nr_components != 3)
+    error("We only support YUV images\n");
+  if (height%16)
+    error("Height need to be a multiple of 16 (current height is %d)\n", height);
+  if (width%16)
+    error("Width need to be a multiple of 16 (current Width is %d)\n", width);
+#endif
+  stream += 8;
+  for (i=0; i<nr_components; i++) {
+     cid = *stream++;
+     sampling_factor = *stream++;
+     Q_table = *stream++;
+     c = &priv->component_infos[cid];
+     c->Vfactor = sampling_factor&0xf;
+     c->Hfactor = sampling_factor>>4;
+     c->Q_table = priv->Q_tables[Q_table];
+     trace("Component:%d  factor:%dx%d  Quantization table:%d\n",
+	 cid, c->Hfactor, c->Hfactor, Q_table );
+
+  }
+  priv->width = width;
+  priv->height = height;
+
+  trace("< SOF marker\n");
+
+  return 0;
+}
+
+static int parse_SOS(struct jdec_private *priv, const unsigned char *stream)
+{
+  unsigned int i, cid, table;
+  unsigned int nr_components = stream[2];
+
+  trace("> SOS marker\n");
+
+#if SANITY_CHECK
+  if (nr_components != 3)
+    error("We only support YCbCr image\n");
+#endif
+
+  stream += 3;
+  for (i=0;i<nr_components;i++) {
+     cid = *stream++;
+     table = *stream++;
+#if SANITY_CHECK
+     if ((table&0xf)>=4)
+	error("We do not support more than 2 AC Huffman table\n");
+     if ((table>>4)>=4)
+	error("We do not support more than 2 DC Huffman table\n");
+     trace("ComponentId:%d  tableAC:%d tableDC:%d\n", cid, table&0xf, table>>4);
+#endif
+     priv->component_infos[cid].AC_table = &priv->HTAC[table&0xf];
+     priv->component_infos[cid].DC_table = &priv->HTDC[table>>4];
+  }
+  priv->stream = stream+3;
+  trace("< SOS marker\n");
+  return 0;
+}
+
+static int parse_DHT(struct jdec_private *priv, const unsigned char *stream)
+{
+  unsigned int count, i;
+  unsigned char huff_bits[17];
+  int length, index;
+
+  length = be16_to_cpu(stream) - 2;
+  stream += 2;	/* Skip length */
+
+  trace("> DHT marker (length=%d)\n", length);
+
+  while (length>0) {
+     index = *stream++;
+
+     /* We need to calculate the number of bytes 'vals' will takes */
+     huff_bits[0] = 0;
+     count = 0;
+     for (i=1; i<17; i++) {
+	huff_bits[i] = *stream++;
+	count += huff_bits[i];
+     }
+#if SANITY_CHECK
+     if (count > 1024)
+       error("No more than 1024 bytes is allowed to describe a huffman table");
+     if ( (index &0xf) >= HUFFMAN_TABLES)
+       error("No mode than %d Huffman tables is supported\n", HUFFMAN_TABLES);
+     trace("Huffman table %s n%d\n", (index&0xf0)?"AC":"DC", index&0xf);
+     trace("Length of the table: %d\n", count);
+#endif
+
+     if (index & 0xf0 )
+       build_huffman_table(huff_bits, stream, &priv->HTAC[index&0xf]);
+     else
+       build_huffman_table(huff_bits, stream, &priv->HTDC[index&0xf]);
+
+     length -= 1;
+     length -= 16;
+     length -= count;
+     stream += count;
+  }
+  trace("< DHT marker\n");
+  return 0;
+}
+
+static int parse_DRI(struct jdec_private *priv, const unsigned char *stream)
+{
+  unsigned int length;
+
+  trace("> DRI marker\n");
+
+  length = be16_to_cpu(stream);
+
+#if SANITY_CHECK
+  if (length != 4)
+    error("Length of DRI marker need to be 4\n");
+#endif
+
+  priv->restart_interval = be16_to_cpu(stream+2);
+
+#if DEBUG
+  trace("Restart interval = %d\n", priv->restart_interval);
+#endif
+
+  trace("< DRI marker\n");
+
+  return 0;
+}
+
+
+
+static void resync(struct jdec_private *priv)
+{
+  int i;
+
+  /* Init DC coefficients */
+  for (i=0; i<COMPONENTS; i++)
+     priv->component_infos[i].previous_DC = 0;
+
+  priv->reservoir = 0;
+  priv->nbits_in_reservoir = 0;
+  if (priv->restart_interval > 0)
+    priv->restarts_to_go = priv->restart_interval;
+  else
+    priv->restarts_to_go = -1;
+}
+
+static int find_next_rst_marker(struct jdec_private *priv)
+{
+  int rst_marker_found = 0;
+  int marker;
+  const unsigned char *stream = priv->stream;
+
+  /* Parse marker */
+  while (!rst_marker_found)
+   {
+     while (*stream++ != 0xff)
+      {
+	if (stream >= priv->stream_end)
+	  error("EOF while search for a RST marker.");
+      }
+     /* Skip any padding ff byte (this is normal) */
+     while (*stream == 0xff)
+       stream++;
+
+     marker = *stream++;
+     if ((RST+priv->last_rst_marker_seen) == marker)
+       rst_marker_found = 1;
+     else if (marker >= RST && marker <= RST7)
+       error("Wrong Reset marker found, abording");
+     else if (marker == EOI)
+       return 0;
+   }
+
+  priv->stream = stream;
+  priv->last_rst_marker_seen++;
+  priv->last_rst_marker_seen &= 7;
+
+  return 0;
+}
+
+static int parse_JFIF(struct jdec_private *priv, const unsigned char *stream)
+{
+  int chuck_len;
+  int marker;
+  int sos_marker_found = 0;
+  int dht_marker_found = 0;
+  const unsigned char *next_chunck;
+
+  /* Parse marker */
+  while (!sos_marker_found)
+   {
+     if (*stream++ != 0xff)
+       goto bogus_jpeg_format;
+     /* Skip any padding ff byte (this is normal) */
+     while (*stream == 0xff)
+       stream++;
+
+     marker = *stream++;
+     chuck_len = be16_to_cpu(stream);
+     next_chunck = stream + chuck_len;
+     switch (marker)
+      {
+       case SOF:
+	 if (parse_SOF(priv, stream) < 0)
+	   return -1;
+	 break;
+       case DQT:
+	 if (parse_DQT(priv, stream) < 0)
+	   return -1;
+	 break;
+       case SOS:
+	 if (parse_SOS(priv, stream) < 0)
+	   return -1;
+	 sos_marker_found = 1;
+	 break;
+       case DHT:
+	 if (parse_DHT(priv, stream) < 0)
+	   return -1;
+	 dht_marker_found = 1;
+	 break;
+       case DRI:
+	 if (parse_DRI(priv, stream) < 0)
+	   return -1;
+	 break;
+       default:
+	 trace("> Unknown marker %2.2x\n", marker);
+	 break;
+      }
+
+     stream = next_chunck;
+   }
+
+  if (!dht_marker_found) {
+    trace("No Huffman table loaded, using the default one\n");
+    build_default_huffman_tables(priv);
+  }
+
+#ifdef SANITY_CHECK
+  if (   (priv->component_infos[cY].Hfactor < priv->component_infos[cCb].Hfactor)
+      || (priv->component_infos[cY].Hfactor < priv->component_infos[cCr].Hfactor))
+    error("Horizontal sampling factor for Y should be greater than horitontal sampling factor for Cb or Cr\n");
+  if (   (priv->component_infos[cY].Vfactor < priv->component_infos[cCb].Vfactor)
+      || (priv->component_infos[cY].Vfactor < priv->component_infos[cCr].Vfactor))
+    error("Vertical sampling factor for Y should be greater than vertical sampling factor for Cb or Cr\n");
+  if (   (priv->component_infos[cCb].Hfactor!=1) 
+      || (priv->component_infos[cCr].Hfactor!=1)
+      || (priv->component_infos[cCb].Vfactor!=1)
+      || (priv->component_infos[cCr].Vfactor!=1))
+    error("Sampling other than 1x1 for Cr and Cb is not supported");
+#endif
+
+  return 0;
+bogus_jpeg_format:
+  trace("Bogus jpeg format\n");
+  return -1;
+}
+
+/*******************************************************************************
+ *
+ * Functions exported of the library.
+ *
+ * Note: Some applications can access directly to internal pointer of the
+ * structure. It's is not recommended, but if you have many images to
+ * uncompress with the same parameters, some functions can be called to speedup
+ * the decoding.
+ *
+ ******************************************************************************/
+
+/**
+ * Allocate a new tinyjpeg decoder object.
+ *
+ * Before calling any other functions, an object need to be called.
+ */
+struct jdec_private *tinyjpeg_init(void)
+{
+  struct jdec_private *priv;
+ 
+  priv = (struct jdec_private *)calloc(1, sizeof(struct jdec_private));
+  if (priv == NULL)
+    return NULL;
+  return priv;
+}
+
+/**
+ * Free a tinyjpeg object.
+ *
+ * No others function can be called after this one.
+ */
+void tinyjpeg_free(struct jdec_private *priv)
+{
+  int i;
+  for (i=0; i<COMPONENTS; i++) {
+     if (priv->components[i])
+       free(priv->components[i]);
+     priv->components[i] = NULL;
+  }
+  free(priv);
+}
+
+/**
+ * Initialize the tinyjpeg object and prepare the decoding of the stream.
+ *
+ * Check if the jpeg can be decoded with this jpeg decoder.
+ * Fill some table used for preprocessing.
+ */
+int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size)
+{
+  int ret;
+
+  /* Identify the file */
+  if ((buf[0] != 0xFF) || (buf[1] != SOI))
+    error("Not a JPG file ?\n");
+
+  priv->stream_begin = buf+2;
+  priv->stream_length = size-2;
+  priv->stream_end = priv->stream_begin + priv->stream_length;
+
+  ret = parse_JFIF(priv, priv->stream_begin);
+
+  return ret;
+}
+
+static const decode_MCU_fct decode_mcu_3comp_table[4] = {
+   decode_MCU_1x1_3planes,
+   decode_MCU_1x2_3planes,
+   decode_MCU_2x1_3planes,
+   decode_MCU_2x2_3planes,
+};
+
+static const decode_MCU_fct decode_mcu_1comp_table[4] = {
+   decode_MCU_1x1_1plane,
+   decode_MCU_1x2_1plane,
+   decode_MCU_2x1_1plane,
+   decode_MCU_2x2_1plane,
+};
+
+static const convert_colorspace_fct convert_colorspace_yuv420p[4] = {
+   YCrCB_to_YUV420P_1x1,
+   YCrCB_to_YUV420P_1x2,
+   YCrCB_to_YUV420P_2x1,
+   YCrCB_to_YUV420P_2x2,
+};
+
+static const convert_colorspace_fct convert_colorspace_rgb24[4] = {
+   YCrCB_to_RGB24_1x1,
+   YCrCB_to_RGB24_1x2,
+   YCrCB_to_RGB24_2x1,
+   YCrCB_to_RGB24_2x2,
+};
+
+static const convert_colorspace_fct convert_colorspace_bgr24[4] = {
+   YCrCB_to_BGR24_1x1,
+   YCrCB_to_BGR24_1x2,
+   YCrCB_to_BGR24_2x1,
+   YCrCB_to_BGR24_2x2,
+};
+
+static const convert_colorspace_fct convert_colorspace_grey[4] = {
+   YCrCB_to_Grey_1x1,
+   YCrCB_to_Grey_1x2,
+   YCrCB_to_Grey_2x1,
+   YCrCB_to_Grey_2x2,
+};
+
+/**
+ * Decode and convert the jpeg image into @pixfmt@ image
+ *
+ * Note: components will be automaticaly allocated if no memory is attached.
+ */
+int tinyjpeg_decode(struct jdec_private *priv, int pixfmt)
+{
+  unsigned int x, y, xstride_by_mcu, ystride_by_mcu;
+  unsigned int bytes_per_blocklines[3], bytes_per_mcu[3];
+  decode_MCU_fct decode_MCU;
+  const decode_MCU_fct *decode_mcu_table;
+  const convert_colorspace_fct *colorspace_array_conv;
+  convert_colorspace_fct convert_to_pixfmt;
+
+  if (setjmp(priv->jump_state))
+    return -1;
+
+  /* To keep gcc happy initialize some array */
+  bytes_per_mcu[1] = 0;
+  bytes_per_mcu[2] = 0;
+  bytes_per_blocklines[1] = 0;
+  bytes_per_blocklines[2] = 0;
+
+  decode_mcu_table = decode_mcu_3comp_table;
+  switch (pixfmt) {
+     case TINYJPEG_FMT_YUV420P:
+       colorspace_array_conv = convert_colorspace_yuv420p;
+       if (priv->components[0] == NULL)
+	 priv->components[0] = (uint8_t *)malloc(priv->width * priv->height);
+       if (priv->components[1] == NULL)
+	 priv->components[1] = (uint8_t *)malloc(priv->width * priv->height/4);
+       if (priv->components[2] == NULL)
+	 priv->components[2] = (uint8_t *)malloc(priv->width * priv->height/4);
+       bytes_per_blocklines[0] = priv->width;
+       bytes_per_blocklines[1] = priv->width/4;
+       bytes_per_blocklines[2] = priv->width/4;
+       bytes_per_mcu[0] = 8;
+       bytes_per_mcu[1] = 4;
+       bytes_per_mcu[2] = 4;
+       break;
+
+     case TINYJPEG_FMT_RGB24:
+       colorspace_array_conv = convert_colorspace_rgb24;
+       if (priv->components[0] == NULL)
+	 priv->components[0] = (uint8_t *)malloc(priv->width * priv->height * 3);
+       bytes_per_blocklines[0] = priv->width * 3;
+       bytes_per_mcu[0] = 3*8;
+       break;
+
+     case TINYJPEG_FMT_BGR24:
+       colorspace_array_conv = convert_colorspace_bgr24;
+       if (priv->components[0] == NULL)
+	 priv->components[0] = (uint8_t *)malloc(priv->width * priv->height * 3);
+       bytes_per_blocklines[0] = priv->width * 3;
+       bytes_per_mcu[0] = 3*8;
+       break;
+
+     case TINYJPEG_FMT_GREY:
+       decode_mcu_table = decode_mcu_1comp_table;
+       colorspace_array_conv = convert_colorspace_grey;
+       if (priv->components[0] == NULL)
+	 priv->components[0] = (uint8_t *)malloc(priv->width * priv->height);
+       bytes_per_blocklines[0] = priv->width;
+       bytes_per_mcu[0] = 8;
+       break;
+
+     default:
+       trace("Bad pixel format\n");
+       return -1;
+  }
+
+  xstride_by_mcu = ystride_by_mcu = 8;
+  if ((priv->component_infos[cY].Hfactor | priv->component_infos[cY].Vfactor) == 1) {
+     decode_MCU = decode_mcu_table[0];
+     convert_to_pixfmt = colorspace_array_conv[0];
+     trace("Use decode 1x1 sampling\n");
+  } else if (priv->component_infos[cY].Hfactor == 1) {
+     decode_MCU = decode_mcu_table[1];
+     convert_to_pixfmt = colorspace_array_conv[1];
+     ystride_by_mcu = 16;
+     trace("Use decode 1x2 sampling (not supported)\n");
+  } else if (priv->component_infos[cY].Vfactor == 2) {
+     decode_MCU = decode_mcu_table[3];
+     convert_to_pixfmt = colorspace_array_conv[3];
+     xstride_by_mcu = 16;
+     ystride_by_mcu = 16;
+     trace("Use decode 2x2 sampling\n");
+  } else {
+     decode_MCU = decode_mcu_table[2];
+     convert_to_pixfmt = colorspace_array_conv[2];
+     xstride_by_mcu = 16;
+     trace("Use decode 2x1 sampling\n");
+  }
+
+  resync(priv);
+
+  /* Don't forget to that block can be either 8 or 16 lines */
+  bytes_per_blocklines[0] *= ystride_by_mcu;
+  bytes_per_blocklines[1] *= ystride_by_mcu;
+  bytes_per_blocklines[2] *= ystride_by_mcu;
+
+  bytes_per_mcu[0] *= xstride_by_mcu/8;
+  bytes_per_mcu[1] *= xstride_by_mcu/8;
+  bytes_per_mcu[2] *= xstride_by_mcu/8;
+
+  /* Just the decode the image by macroblock (size is 8x8, 8x16, or 16x16) */
+  for (y=0; y < priv->height/ystride_by_mcu; y++)
+   {
+     //trace("Decoding row %d\n", y);
+     priv->plane[0] = priv->components[0] + (y * bytes_per_blocklines[0]);
+     priv->plane[1] = priv->components[1] + (y * bytes_per_blocklines[1]);
+     priv->plane[2] = priv->components[2] + (y * bytes_per_blocklines[2]);
+     for (x=0; x < priv->width; x+=xstride_by_mcu)
+      {
+	decode_MCU(priv);
+	convert_to_pixfmt(priv);
+	priv->plane[0] += bytes_per_mcu[0];
+	priv->plane[1] += bytes_per_mcu[1];
+	priv->plane[2] += bytes_per_mcu[2];
+	if (priv->restarts_to_go>0)
+	 {
+	   priv->restarts_to_go--;
+	   if (priv->restarts_to_go == 0)
+	    {
+	      priv->stream -= (priv->nbits_in_reservoir/8);
+	      resync(priv);
+	      if (find_next_rst_marker(priv) < 0)
+		return -1;
+	    }
+	 }
+      }
+   }
+
+  return 0;
+}
+
+const char *tinyjpeg_get_errorstring(struct jdec_private *priv)
+{
+  return error_string;
+}
+
+void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height)
+{
+  *width = priv->width;
+  *height = priv->height;
+}
+
+int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components)
+{
+  int i;
+  for (i=0; priv->components[i] && i<COMPONENTS; i++)
+    components[i] = priv->components[i];
+  return 0;
+}
+
+int tinyjpeg_set_components(struct jdec_private *priv, unsigned char **components, unsigned int ncomponents)
+{
+  unsigned int i;
+  if (ncomponents > COMPONENTS)
+    ncomponents = COMPONENTS;
+  for (i=0; i<ncomponents; i++)
+    priv->components[i] = components[i];
+  return 0;
+}
+
+int tinyjpeg_set_flags(struct jdec_private *priv, int flags)
+{
+  int oldflags = priv->flags;
+  priv->flags = flags;
+  return oldflags;
+}
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/jpeg/tinyjpeg.h lush-cvs/packages/jpeg/tinyjpeg.h
--- lush/packages/jpeg/tinyjpeg.h	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/jpeg/tinyjpeg.h	2007-05-19 22:56:15.000000000 -0400
@@ -0,0 +1,73 @@
+/*
+ * Small jpeg decoder library (header file)
+ *
+ * Copyright (c) 2006, Luc Saillard <luc@saillard.org>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of its contributors may be
+ *  used to endorse or promote products derived from this software without
+ *  specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#ifndef __JPEGDEC_H__
+#define __JPEGDEC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct jdec_private;
+
+/* Flags that can be set by any applications */
+#define TINYJPEG_FLAGS_MJPEG_TABLE	(1<<1)
+
+/* Format accepted in outout */
+enum tinyjpeg_fmt {
+   TINYJPEG_FMT_GREY = 1,
+   TINYJPEG_FMT_BGR24,
+   TINYJPEG_FMT_RGB24,
+   TINYJPEG_FMT_YUV420P,
+};
+
+struct jdec_private *tinyjpeg_init(void);
+void tinyjpeg_free(struct jdec_private *priv);
+
+int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size);
+int tinyjpeg_decode(struct jdec_private *priv, int pixel_format);
+const char *tinyjpeg_get_errorstring(struct jdec_private *priv);
+void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height);
+int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components);
+int tinyjpeg_set_components(struct jdec_private *priv, unsigned char **components, unsigned int ncomponents);
+int tinyjpeg_set_flags(struct jdec_private *priv, int flags);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/jpeg/tinyjpeg-internal.h lush-cvs/packages/jpeg/tinyjpeg-internal.h
--- lush/packages/jpeg/tinyjpeg-internal.h	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/jpeg/tinyjpeg-internal.h	2007-05-19 22:56:15.000000000 -0400
@@ -0,0 +1,115 @@
+/*
+ * Small jpeg decoder library (Internal header)
+ *
+ * Copyright (c) 2006, Luc Saillard <luc@saillard.org>
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ * - Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ *  this list of conditions and the following disclaimer in the documentation
+ *  and/or other materials provided with the distribution.
+ *
+ * - Neither the name of the author nor the names of its contributors may be
+ *  used to endorse or promote products derived from this software without
+ *  specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#ifndef __TINYJPEG_INTERNAL_H_
+#define __TINYJPEG_INTERNAL_H_
+
+#include <setjmp.h>
+
+struct jdec_private;
+
+#define HUFFMAN_HASH_NBITS 9
+#define HUFFMAN_HASH_SIZE  (1UL<<HUFFMAN_HASH_NBITS)
+#define HUFFMAN_HASH_MASK  (HUFFMAN_HASH_SIZE-1)
+
+#define HUFFMAN_TABLES	   4
+#define COMPONENTS	   4
+#define JPEG_MAX_WIDTH	   2048
+#define JPEG_MAX_HEIGHT	   2048
+
+struct huffman_table
+{
+  /* Fast look up table, using HUFFMAN_HASH_NBITS bits we can have directly the symbol,
+   * if the symbol is <0, then we need to look into the tree table */
+  short int lookup[HUFFMAN_HASH_SIZE];
+  /* code size: give the number of bits of a symbol is encoded */
+  unsigned char code_size[HUFFMAN_HASH_SIZE];
+  /* some place to store value that is not encoded in the lookup table 
+   * FIXME: Calculate if 256 value is enough to store all values
+   */
+  uint16_t slowtable[16-HUFFMAN_HASH_NBITS][256];
+};
+
+struct component 
+{
+  unsigned int Hfactor;
+  unsigned int Vfactor;
+  float *Q_table;		/* Pointer to the quantisation table to use */
+  struct huffman_table *AC_table;
+  struct huffman_table *DC_table;
+  short int previous_DC;	/* Previous DC coefficient */
+  short int DCT[64];		/* DCT coef */
+};
+
+
+typedef void (*decode_MCU_fct) (struct jdec_private *priv);
+typedef void (*convert_colorspace_fct) (struct jdec_private *priv);
+
+struct jdec_private
+{
+  /* Public variables */
+  uint8_t *components[COMPONENTS];
+  unsigned int width, height;	/* Size of the image */
+  unsigned int flags;
+
+  /* Private variables */
+  const unsigned char *stream_begin, *stream_end;
+  unsigned int stream_length;
+
+  const unsigned char *stream;	/* Pointer to the current stream */
+  unsigned int reservoir, nbits_in_reservoir;
+
+  struct component component_infos[COMPONENTS];
+  float Q_tables[COMPONENTS][64];		/* quantization tables */
+  struct huffman_table HTDC[HUFFMAN_TABLES];	/* DC huffman tables   */
+  struct huffman_table HTAC[HUFFMAN_TABLES];	/* AC huffman tables   */
+  int default_huffman_table_initialized;
+  int restart_interval;
+  int restarts_to_go;				/* MCUs left in this restart interval */
+  int last_rst_marker_seen;			/* Rst marker is incremented each time */
+
+  /* Temp space used after the IDCT to store each components */
+  uint8_t Y[64*4], Cr[64], Cb[64];
+
+  jmp_buf jump_state;
+  /* Internal Pointer use for colorspace conversion, do not modify it !!! */
+  uint8_t *plane[COMPONENTS];
+
+};
+
+#define IDCT tinyjpeg_idct_float
+void tinyjpeg_idct_float (struct component *compptr, uint8_t *output_buf, int stride);
+
+#endif
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/lapack/lapack-d.lsh lush-cvs/packages/lapack/lapack-d.lsh
--- lush/packages/lapack/lapack-d.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/lapack/lapack-d.lsh	2008-05-13 01:16:27.000000000 -0400
@@ -35697,7 +35697,7 @@
     "dlarfx" "dlargv" "dlarnv" "dlarrb" "dlarre" "dlarrf" "dlarrv"
     "dlartg" "dlartv" "dlaruv" "dlarzb" "dlarz" "dlarzt" "dlas2" "dlascl"
     "dlasd0" "dlasd1" "dlasd2" "dlasd3" "dlasd4" "dlasd5" "dlasd6"
-    "dlasd7" "dlasd8" "dlasd9" "dlasda" "dlasdq" "dlasdt" "dlaset"
+    "dlasd7" "dlasd8"          "dlasda" "dlasdq" "dlasdt" "dlaset"
     "dlasq1" "dlasq2" "dlasq3" "dlasq4" "dlasq5" "dlasq6" "dlasr" "dlasrt"
     "dlassq" "dlasv2" "dlaswp" "dlasy2" "dlasyf" "dlatbs" "dlatdf"
     "dlatps" "dlatrd" "dlatrs" "dlatrz" "dlatzm" "dlauu2" "dlauum"
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/lapack/lapack-s.lsh lush-cvs/packages/lapack/lapack-s.lsh
--- lush/packages/lapack/lapack-s.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/lapack/lapack-s.lsh	2008-05-13 01:16:27.000000000 -0400
@@ -35699,7 +35699,7 @@
     "slarfb" "slarf" "slarfg" "slarft" "slarfx" "slargv" "slarnv" "slarrb"
     "slarre" "slarrf" "slarrv" "slartg" "slartv" "slaruv" "slarzb" "slarz"
     "slarzt" "slas2" "slascl" "slasd0" "slasd1" "slasd2" "slasd3" "slasd4"
-    "slasd5" "slasd6" "slasd7" "slasd8" "slasd9" "slasda" "slasdq"
+    "slasd5" "slasd6" "slasd7" "slasd8"         "slasda" "slasdq"
     "slasdt" "slaset" "slasq1" "slasq2" "slasq3" "slasq4" "slasq5"
     "slasq6" "slasr" "slasrt" "slassq" "slasv2" "slaswp" "slasy2" "slasyf"
     "slatbs" "slatdf" "slatps" "slatrd" "slatrs" "slatrz" "slatzm"
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/libnum/interpolator.lsh lush-cvs/packages/libnum/interpolator.lsh
--- lush/packages/libnum/interpolator.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/libnum/interpolator.lsh	2007-04-24 12:11:24.000000000 -0400
@@ -68,27 +68,34 @@
     (setq yarray (double-matrix n))
     (idx-copy xa xarray)
     (idx-copy ya yarray)
+    (cpheader "static const gsl_interp_type\n\
+ ** volatile ilinear = &gsl_interp_linear,\n\
+ ** volatile ipolynomial = &gsl_interp_polynomial,\n\
+ ** volatile icspline = &gsl_interp_cspline,\n\
+ ** volatile icspline_periodic = &gsl_interp_cspline_periodic,\n\
+ ** volatile iakima = &gsl_interp_akima,\n\
+ ** volatile iakima_periodic = &gsl_interp_akima_periodic;\n")
     #{{ $xp = IDX_PTR($xarray, double);
         $yp = IDX_PTR($yarray, double);
         $accel = (void *)gsl_interp_accel_alloc();
         switch($type) {
-         case 0: 
-           $gslinterp = (void *)gsl_interp_alloc(gsl_interp_linear, $n);
+         case 0:
+           $gslinterp = (void *)gsl_interp_alloc(*ilinear, $n);
            break;
          case 1: 
-           $gslinterp = (void *)gsl_interp_alloc(gsl_interp_polynomial, $n);
+           $gslinterp = (void *)gsl_interp_alloc(*ipolynomial, $n);
            break;
          case 2: 
-           $gslinterp = (void *)gsl_interp_alloc(gsl_interp_cspline, $n);
+           $gslinterp = (void *)gsl_interp_alloc(*icspline, $n);
            break;
          case 3: 
-           $gslinterp = (void *)gsl_interp_alloc(gsl_interp_cspline_periodic, $n);
+           $gslinterp = (void *)gsl_interp_alloc(*icspline_periodic, $n);
            break;
          case 4: 
-           $gslinterp = (void *)gsl_interp_alloc(gsl_interp_akima, $n);
+           $gslinterp = (void *)gsl_interp_alloc(*iakima, $n);
            break;
          case 5: 
-           $gslinterp = (void *)gsl_interp_alloc(gsl_interp_akima_periodic, $n);
+           $gslinterp = (void *)gsl_interp_alloc(*iakima_periodic, $n);
            break;
          default: run_time_error("illegal interpolation type (must be 0-5)"); 
         }
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/libnum/stats.lsh lush-cvs/packages/libnum/stats.lsh
--- lush/packages/libnum/stats.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/libnum/stats.lsh	2008-10-04 12:07:24.000000000 -0400
@@ -6,7 +6,11 @@
 ;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
 ;;; Includes selected parts of SN3.2:
 ;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;  
 ;;;
+;;; Bronze additions
+;;; Copyright (C) Scott Locklin, Lugos LLC
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Includes information derived from the GSL (Gnu Scientific Library)
 ;;;   header files which are copyrighted and distributed under the GPL
 ;;;   by their respective authors.
@@ -27,10 +31,12 @@
 ;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+
 (libload "gsl/gsl-config")
 (libload "gsl/gsl-idx")
 (libload "gsl/statistics")
 
+
 ;; dummy function that adds GSL C header files in C file
 (eval `(de dummy_stats () ,gsl-cpheader-cmd ()))
 
@@ -38,6 +44,7 @@
 ;; This is a set of simple statistical functions.
 ;; Most of them are high-level calls to GSL functions.
 ;; They operate on vectors of double.
+;; Included some of the other functions not included in the Lush distrib.
 
 #? (stat-mean <v>)
 ;; return the mean of elements of vector <v>.
@@ -48,6 +55,43 @@
 	(s (idx-modulo v 0)))
     (to-double #{ gsl_stats_mean( $pv, $s, $n) #})))
 
+#? (stat-absdev <v>)
+;;returns the absolute deviation of elements of vector <v>
+(de stat-absdev (v)
+  ((-idx1- (-double-)) v)
+  (let ((pv (idx-ptr v))
+	(n (idx-dim v 0))
+	(s (idx-modulo v 0)))
+    (to-double #{ gsl_stats_absdev( $pv, $s, $n) #})))
+
+#? (stat-median <v>)
+;;returns the median value of sorted list <v> (idx-d1sortup v)
+(de stat-median (v)
+  ((-idx1- (-double-)) v)
+  (let ((pv (idx-ptr v))
+	(n (idx-dim v 0))
+	(s (idx-modulo v 0)))
+    (to-double #{ gsl_stats_median_from_sorted_data( $pv, $s, $n) #})))
+
+#? (stat-quantile <v> <f>)
+;;returns the quantile of sorted list <v> (idx-d1sortup v) quantile <f>
+(de stat-quantile (v f)
+  ((-idx1- (-double-)) v)
+  ((-double-) f)
+  (let ((pv (idx-ptr v))
+	(n (idx-dim v 0))
+	(s (idx-modulo v 0)))
+    (to-double #{ gsl_stats_quantile_from_sorted_data( $pv, $s, $n, $f) #})))
+
+#? (stat-autocorr <v>)
+;;returns the lag 1 autocorrelation of elements of vector <v>
+(de stat-autocorr (v)
+  ((-idx1- (-double-)) v)
+  (let ((pv (idx-ptr v))
+	(n (idx-dim v 0))
+	(s (idx-modulo v 0)))
+    (to-double #{ gsl_stats_lag1_autocorrelation( $pv, $s, $n) #})))
+
 #? (stat-variance <v>)
 ;; return the variance of values in vector <v>.
 (de stat-variance (v)
@@ -96,9 +140,81 @@
 	(n (idx-dim v1 0))
 	(s1 (idx-modulo v1 0))
 	(s2 (idx-modulo v2 0)))
-    (when (<> n (idx-dim v1 0)) (error "vectors have different sizes"))
+    (when (<> n (idx-dim v2 0)) (error "vectors have different sizes"))
     (to-double #{ gsl_stats_covariance( $pv1, $s1, $pv2, $s2, $n) #})))
 
+#? (stat-wmean <v> <w>)
+;; weighted mean of vector <v> with weights <w>
+(de stat-wmean (v w)
+  ((-idx1- (-double-)) v w)
+  (let ((pv (idx-ptr v))
+	(pw (idx-ptr w))
+	(n (idx-dim v 0))
+	(s1 (idx-modulo v 0))
+	(s2 (idx-modulo w 0)))
+    (when (<> n (idx-dim w 0)) (error "vectors have different sizes"))
+    (to-double #{ gsl_stats_wmean( $pw, $s1, $pv, $s2, $n) #})))
+
+#? (stat-wvariance <v> <w>)
+;; weighted variance of vector <v> with weights <w>
+(de stat-wvariance (v w)
+  ((-idx1- (-double-)) v w)
+  (let ((pv (idx-ptr v))
+	(pw (idx-ptr w))
+	(n (idx-dim v 0))
+	(s1 (idx-modulo v 0))
+	(s2 (idx-modulo w 0)))
+    (when (<> n (idx-dim w 0)) (error "vectors have different sizes"))
+    (to-double #{ gsl_stats_wvariance( $pw, $s1, $pv, $s2, $n) #})))
+
+#? (stat-wsdev <v> <w>)
+;; weighted standard deviation of vector <v> with weights <w>
+(de stat-wsdev (v w)
+  ((-idx1- (-double-)) v w)
+  (let ((pv (idx-ptr v))
+	(pw (idx-ptr w))
+	(n (idx-dim v 0))
+	(s1 (idx-modulo v 0))
+	(s2 (idx-modulo w 0)))
+    (when (<> n (idx-dim w 0)) (error "vectors have different sizes"))
+    (to-double #{ gsl_stats_wsd( $pw, $s1, $pv, $s2, $n) #})))
+
+#? (stat-wabsdev <v> <w>)
+;; weighted absolute deviation of vector <v> with weights <w>
+(de stat-wabsdev (v w)
+  ((-idx1- (-double-)) v w)
+  (let ((pv (idx-ptr v))
+	(pw (idx-ptr w))
+	(n (idx-dim v 0))
+	(s1 (idx-modulo v 0))
+	(s2 (idx-modulo w 0)))
+    (when (<> n (idx-dim w 0)) (error "vectors have different sizes"))
+    (to-double #{ gsl_stats_wabsdev( $pw, $s1, $pv, $s2, $n) #})))
+
+#? (stat-wskew <v> <w>)
+;; weighted skew of vector <v> with weights <w>
+(de stat-wskew (v w)
+  ((-idx1- (-double-)) v w)
+  (let ((pv (idx-ptr v))
+	(pw (idx-ptr w))
+	(n (idx-dim v 0))
+	(s1 (idx-modulo v 0))
+	(s2 (idx-modulo w 0)))
+    (when (<> n (idx-dim w 0)) (error "vectors have different sizes"))
+    (to-double #{ gsl_stats_wskew( $pw, $s1, $pv, $s2, $n) #})))
+
+#? (stat-wkurtosis <v> <w>)
+;; weighted kurtosis of vector <v> with weights <w>
+(de stat-wkurtosis (v w)
+  ((-idx1- (-double-)) v w)
+  (let ((pv (idx-ptr v))
+	(pw (idx-ptr w))
+	(n (idx-dim v 0))
+	(s1 (idx-modulo v 0))
+	(s2 (idx-modulo w 0)))
+    (when (<> n (idx-dim w 0)) (error "vectors have different sizes"))
+    (to-double #{ gsl_stats_wkurtosis( $pw, $s1, $pv, $s2, $n) #})))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (dhc-make
  ()
@@ -109,6 +225,16 @@
  stat-skew
  stat-kurtosis
  stat-covariance
+ stat-absdev
+ stat-quantile
+ stat-autocorr
+ stat-median
+ stat-wmean
+ stat-wvariance
+ stat-wsdev
+ stat-wabsdev
+ stat-wskew
+ stat-wkurtosis
  )
 
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/music/asound-config.lsh lush-cvs/packages/music/asound-config.lsh
--- lush/packages/music/asound-config.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/music/asound-config.lsh	2007-09-10 16:35:24.000000000 -0400
@@ -0,0 +1,52 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: asound-config.lsh,v 1.1 2007/09/10 20:35:24 profshadoko Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defvar asound-libs ())
+(defvar asound-cflags ())
+
+(when (not asound-libs)
+  (let ((soregex (concat ".*\\." (or (getconf "SOEXT") "so") "[0-9.]*")))
+    (let ((lib (find-shared-or-static-library "libasound")))
+      (if (and lib (filep lib))
+	  (setq asound-libs (list lib))
+        (printf "libasound.so could not be found.\n")
+        (printf "please make sure ALSO/libasound is installed.\n")
+        (printf "Both the library and the development packages are needed.\n")
+        (printf "(see %s for more details)\n" file-being-loaded)
+        (error "cannot configure ALSA/libasound") ) )))
+
+(when (not asound-cflags)
+  (setq asound-cflags "")
+  (when (not (find-c-include "alsa/asoundlib.h"))
+    (printf "alsa/asoundlib.h could not be found.\n")
+    (printf "please make sure the alsa-dev package is installed.\n")
+    (printf "Both the library and the development packages are needed.\n")
+    (printf "(see %s for more details)\n" file-being-loaded)
+    (error "cannot configure ALSA/libasound") ) )
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/music/midi-seq.lsh lush-cvs/packages/music/midi-seq.lsh
--- lush/packages/music/midi-seq.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/music/midi-seq.lsh	2007-09-15 18:33:28.000000000 -0400
@@ -0,0 +1,484 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: midi-seq.lsh,v 1.2 2007/09/15 22:33:28 profshadoko Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(libload "asound-config")
+
+;; a class to handle MIDI input and output through
+;; Linux's sequencer device.
+
+#? ** MIDI with the sequencer device
+;; {<author> Yann LeCun}
+;; This package provides a couple of classes to
+;; receive and transmit simple MIDI events from and
+;; to the ALSA sequencer device on Linux. 
+;; The classes are built on top of the ALSA API.
+;; Any MIDI port created with these classes appears
+;; on the Jack MIDI panel and can be connected 
+;; to physical MIDI interfaces, software Synthesizers,
+;; or other MIDI-enabled software using Jack Control
+;; or other MIDI patching software.
+
+#? * midi-input 
+;; a class to handle MIDI input through 
+;; Linux's seq device.
+;; Here is a typical example of use:
+;; {<code>
+;; (setq z (new midi-input "lushmidi"))
+;; (let ((r 0))
+;;    (while t
+;;      ;; wait on midi port
+;;      (while (= 0 (==> z poll 1000) ) ())
+;;      ;; process all events
+;;      (do-while (> (==> z pending-events) 0)
+;;        (setq r (==> z read-event))
+;;        (when (= 0 r)
+;;	  (printf "chan=%2d, type=%3d, prm=%4d, val=%4d [r=%d]\n"
+;;		  :z:eventchannel :z:eventtype :z:eventparam :z:eventvalue r))))))
+;; </code>}
+(defclass midi-input object
+  ((-gptr-) pfds) 
+  ((-gptr-) seqhandle)
+  ((-int-) nfds)
+  ((-str-) clientname)
+  ((-int-) portid)
+  ((-int-) clientid)
+  ;; midi channel on which last midi event was sent
+  ((-int-) eventchannel)
+  ;; type of event (noteon, noteoff, pitchbend....)
+  ((-int-) eventtype)
+  ;; main parameter value (e.g. note value, controller number...)
+  ((-int-) eventparam)
+  ;; main value (e.g. velocity for a note, controller value for a
+  ;; a controller event
+  ((-int-) eventvalue)
+  )
+
+#? (new midi-input <name>)
+;; create a new MIDI input object.
+;; The midi input will appear as the string
+;; <name> in the jack MIDI device list. 
+(defmethod midi-input midi-input (name)
+  ((-str-) name)
+  (setq clientname name)
+  (setq clientid -1)
+  (setq portid -1)
+  #{{
+    snd_seq_t *seq_handle;
+
+    if (snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_INPUT, 0) < 0) {
+      run_time_error("Error opening ALSA sequencer"); 
+    }
+    snd_seq_set_client_name(seq_handle, STRING_DATA($name));
+    $clientid = snd_seq_client_id(seq_handle);
+    if (($portid = snd_seq_create_simple_port(seq_handle,STRING_DATA($name),
+          SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,
+          SND_SEQ_PORT_TYPE_APPLICATION)) < 0) {
+      run_time_error("could not create port to midi/sequencer");
+    }
+    /* resize clientname before writing into it */
+    /*
+    Msrg_resize($clientname,256);
+    sprintf(STRING_DATA($clientname), "%s_%d_%d", STRING_DATA($name), $clientid, $portid);
+    */
+    $seqhandle = (void*)seq_handle;
+
+    $nfds = snd_seq_poll_descriptors_count(seq_handle, POLLIN);
+    $pfds = (void*)malloc(sizeof(struct pollfd)*$nfds);
+    snd_seq_poll_descriptors(seq_handle, (struct pollfd*)$pfds, $nfds, POLLIN);
+   }#}
+  ())
+
+
+(defmethod midi-input -destructor ()
+  (when (<> -1 portid) #{ snd_seq_delete_port((snd_seq_t *)$seqhandle,$portid); #})
+  (when (not (= (to-gptr ()) seqhandle)) #{ snd_seq_close((snd_seq_t *)$seqhandle); #})
+  (when (not (= (to-gptr ()) pfds)) #{ free($pfds); #})
+  ())
+
+#? (==> <midi-input> poll <timout>)
+;; Waits for a MIDI event to arrive.
+;; return 1 if a midi event has arrived before
+;; <timeout> milliseconds have elapsed. If no event
+;; has arrived by that time, the call returns a zero.
+(defmethod midi-input poll(timeout)
+  ((-int-) timeout)
+  (let ((rez 0))
+    ((-int-) rez)
+    #{{int i; 
+       if ( poll( (struct pollfd *)$pfds, $nfds, $timeout ) > 0 ) {
+         for (i = 0; i < $nfds; i++) {
+           if ( ((struct pollfd*)$pfds)[i].revents > 0 ) $rez = 1;
+         }
+       }
+    }#} rez))
+
+#? (==> <mid-input> read-event)
+;; This reads the next available MIDI event.
+;; This method blocks if no event is present on the queue.
+;; Checking whether a MIDI event is present can be 
+;; done with the <poll> method. If a MIDI event of
+;; a known type was succesfully read, the slots
+;; <eventchannel>, <eventtype>, <eventparam>, and <eventvalue>
+;; are filled with the corresponding value from the event,
+;; and 0 is returned. If an event of an unknown type was
+;; read, a -1 is returned.
+;; After a succesful read, the <eventchannel> slot contains
+;; the channel on which the MIDI event was sent. <eventtype>
+;; contains the type of event as an integer (e.g. SND_SEQ_EVENT_NOTEON,
+;; SND_SEQ_EVENT_CONTROLLER, SND_SEQ_EVENT_PITCHBEND, see 
+;; </usr/include/alsa/seq_event.h> for a list of types).
+;; <eventparam> contains the event main parameter, i.e. the pitch
+;; for a NOTEON or NOTEOFF event, the controller number for
+;; a CONTROLLER event, etc). <eventvalue> contains the value
+;; of the parameters, i.e. the velocity of a note, the 
+;; value of a controller, etc.
+;; The known event types are: <SND_SEQ_EVENT_NOTEON>,
+;; <SND_SEQ_EVENT_NOTEOFF>, <SND_SEQ_EVENT_KEYPRESS>,
+;; <SND_SEQ_EVENT_CONTROLLER>, <SND_SEQ_EVENT_PITCHBEND>,
+;; <SND_SEQ_EVENT_PGMCHANGE>.
+(defmethod midi-input read-event()
+  (let ((rez 0))
+    ((-int-) rez)
+    #{{snd_seq_t *seq_handle = (snd_seq_t *)$seqhandle;
+       snd_seq_event_t *ev ;
+       snd_seq_event_input(seq_handle, &ev);
+       $eventtype = (int)(ev->type);
+       $eventchannel = (int)(ev->data.control.channel);
+       switch (ev->type) {
+         case SND_SEQ_EVENT_NOTEON:
+           $eventparam = (int)(ev->data.note.note);
+           $eventvalue = (int)(ev->data.note.velocity);
+           break;
+         case SND_SEQ_EVENT_NOTEOFF:
+           $eventparam = (int)(ev->data.note.note);
+           $eventvalue = -1;
+           break;
+         case SND_SEQ_EVENT_KEYPRESS:
+           $eventparam = (int)(ev->data.note.note);
+           $eventvalue = (int)(ev->data.note.velocity);
+           break;
+         case SND_SEQ_EVENT_CONTROLLER:
+           $eventparam = (int)(ev->data.control.param);
+           $eventvalue = (int)(ev->data.control.value);
+           break;
+         case SND_SEQ_EVENT_PITCHBEND:
+           $eventparam = -1;
+           $eventvalue = (int)(ev->data.control.value);
+           break;
+         case SND_SEQ_EVENT_PGMCHANGE:
+           $eventparam = (int)(ev->data.control.param);
+           $eventvalue = (int)(ev->data.control.value);
+           break;
+         default:
+           $eventparam = -1;
+           $eventvalue = -1;
+           $rez = -1;
+       }
+       snd_seq_free_event(ev);
+     }#}
+    rez))
+
+#? (==> <midi-input> pending-events)
+;; return the number of pending MIDI events in the queue.
+;; This uses the ALSA function <snd_seq_event_input_pending>,
+;; which, strangely enough, returns zero even if the <poll>
+;; method detected a MIDI event. It only seems to get updated
+;; after <snd_seq_event_input> has been called by the method
+;; <read-event>. Hence, <pending-events> should be used
+;; in a <do-while> loop, after a call to <poll>, as in:
+;; {<code>
+;; (setq z (new midi-input "lushmidi"))
+;; (let ((r 0))
+;;    (while t
+;;      ;; wait for an event on midi port
+;;      (while (= 0 (==> z poll 1000) ) ())
+;;      ;; process all events
+;;      (do-while (> (==> z pending-events) 0)
+;;        (setq r (==> z read-event))
+;;        (when (= r 0) (do-midi-stuff z)))))
+;; </code>}
+(defmethod midi-input pending-events()
+   (to-int #{ snd_seq_event_input_pending((snd_seq_t *)$seqhandle, 0) #}))
+
+#? (==> <midi-input> debug-events)
+;; A simple method that displays every valid MIDI event
+;; that arrives to the <midi-input> object.
+(defmethod midi-input debug-events ()
+  (let ((r 0))
+    (while t
+      ;; wait on midi port
+      ;; (printf "waiting\n")
+      (while (= 0 (==> this poll 1000) ) ())
+      ;; process all events
+      (do-while (> (==> this pending-events) 0)
+        (setq r (==> this read-event))
+	(when (= 0 r)
+	  (printf "chan=%2d, type=%3d, prm=%4d, val=%4d [r=%d]\n"
+		  eventchannel eventtype eventparam eventvalue r))))))
+
+#? (midi-input-test)
+;; simple example function that creates a MIDI input port
+;; and prints all events that arrive on it.
+(de midi-input-test ()
+  (setq z (new midi-input "lushmidi"))
+  (==> z debug-events))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? * midi-output
+;; A class to send simple MIDI events to the sequencer 
+;; device. 
+(defclass midi-output object
+  ((-gptr-) seqhandle)			; handle on sequencer device
+  ((-str-) clientname)			; name of this client
+  ((-int-) portid)			; MIDI port id number
+  ((-int-) clientid)			; client id number
+  ((-gptr-) event)			; preallocated ALSA event structure
+  )
+
+#? (new midi-output <client-name>)
+;; Creates a new MIDI client and port with which
+;; MIDI events can be sent from Lush to a physical
+;; MIDI interface or another MIDI-enabled software.
+;; <client-name> should be a string containing a
+;; name to identify this client. The client opens
+;; a single port.
+;; {<code>
+;;  (setq z (new midi-output "lush-midi-out"))
+;; </code>}
+(defmethod midi-output midi-output (name)
+  ((-str-) name)
+  (setq clientname name)
+  (setq clientid -1)
+  (setq portid -1)
+  #{{
+    snd_seq_t *seq_handle;
+
+    if (snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_OUTPUT, 0) < 0) {
+      run_time_error("Error opening ALSA sequencer"); 
+    }
+    snd_seq_set_client_name(seq_handle, STRING_DATA($name));
+    $clientid = snd_seq_client_id(seq_handle);
+    if (($portid = snd_seq_create_simple_port(seq_handle,STRING_DATA($name),
+          SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ,
+          SND_SEQ_PORT_TYPE_APPLICATION)) < 0) {
+      run_time_error("could not create port to midi/sequencer");
+    }
+    $seqhandle = (void*)seq_handle;
+    $event = malloc(sizeof(snd_seq_event_t));
+    snd_seq_ev_clear( (snd_seq_event_t *)($event) );
+    snd_seq_ev_set_source( (snd_seq_event_t *)($event), $portid);
+    snd_seq_ev_set_subs( (snd_seq_event_t *)($event) );
+    snd_seq_ev_set_direct( (snd_seq_event_t *)($event) );
+   }#}
+  ())
+
+(defmethod midi-output -destructor ()
+  (when (<> -1 portid) #{ snd_seq_delete_port((snd_seq_t *)$seqhandle,$portid); #})
+  (when (not (= (to-gptr ()) seqhandle)) #{ snd_seq_close((snd_seq_t *)$seqhandle); #})
+  ())
+
+#? (==> <midi-output> note <ch> <key> <vel> <dur>)
+;; send a <note> event to MIDI channel <ch>.
+;; <key>, <vel>, <dur> are the key, velocity and duration
+;; of the note.
+(defmethod midi-output note (ch key vel dur)
+  ((-int-) ch key vel dur)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_note( ev, $ch, $key, $vel, $dur);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> noteon <ch> <key> <vel>)
+;; send a <noteon> event to MIDI channel <ch>.
+;; <key>, and <vel> are the key, and velocity of the note.
+;; A subsequent <noteoff> event with the same channel and
+;; key must be sent subsequently to shut off the note.
+(defmethod midi-output noteon (ch key vel)
+  ((-int-) ch key vel)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_noteon( ev, $ch, $key, $vel);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> noteon <ch> <key> <vel>)
+;; send a <noteoff> event to MIDI channel <ch>.
+;; <key>, and <vel> are the key, and velocity (usually 0)
+;; of the note to turn off. This generally follows an
+;; <noteon> event with the same channel and key.
+(defmethod midi-output noteoff (ch key vel)
+  ((-int-) ch key vel)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_noteoff( ev, $ch, $key, $vel);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> keypress <ch> <key> <vel>)
+;; send a <keypress> (aftertouch) event to MIDI channel 
+;; <ch>. <key>, and <vel> are the key, and velocity.
+(defmethod midi-output keypress (ch key vel)
+  ((-int-) ch key vel)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_keypress( ev, $ch, $key, $vel);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> controller <ch> <cc> <val>)
+;; Send a MIDI controller event to MIDI channel <ch>.
+;; <cc> is the controller number, and <val> the value.
+;; Here is a partial list of the most commonly used
+;; MIDI controllers with their <cc> value:
+;; 0: Bank Select; 1:  Modulation Wheel or Lever;
+;; 2: Breath Controller; 4:  Foot Controller;
+;; 5: Portamento Time; 6:  Data Entry MSB;
+;; 7:  Channel Volume; 8:  Balance; 10: Pan;
+;; 11: Expression Controller; 12: Effect Control 1;
+;; 13: Effect Control 2.
+;; A complete table is available at:
+;; http://www.midi.org/about-midi/table3.shtml
+(defmethod midi-output controller (ch cc val)
+  ((-int-) ch cc val)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_controller( ev, $ch, $cc, $val);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> modulation <ch> <val>)
+;; Send MIDI modulation value <val>. Equivalent
+;; to calling <controller> with <cc=1>.
+(defmethod midi-output modulation (ch val)
+  ((-int-) ch val)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_controller( ev, $ch, 1, $val);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> breath <ch> <val>)
+;; Send MIDI breath control value <val>. Equivalent
+;; to calling <controller> with <cc=2>.
+(defmethod midi-output breath (ch val)
+  ((-int-) ch val)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_controller( ev, $ch, 2, $val);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> pgmchange <ch> <val>)
+;; Send MIDI program change <val> to channel <ch>.
+(defmethod midi-output pgmchange (ch val)
+  ((-int-) ch val)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_pgmchange( ev, $ch, $val);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> pitchbend <ch> <val>)
+;; Send MIDI pitchbend value <val> to channel <ch>.
+(defmethod midi-output pitchbend (ch val)
+  ((-int-) ch val)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_pitchbend( ev, $ch, $val);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> chanpress <ch> <val>)
+;; Send MIDI channel pressure <val> to channel <ch>.
+(defmethod midi-output chanpress (ch val)
+  ((-int-) ch val)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      snd_seq_ev_set_chanpress( ev, $ch, $val);
+      snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+  }#}
+  ())
+
+#? (==> <midi-output> sysex <ch> <data>)
+;; Send MIDI system exclusive data to channel <ch>.
+;; <data> must be an IDX1 of ubytes (of any size) 
+;; containing the data to be transmitted.
+(defmethod midi-output sysex (ch data)
+  ((-int-) ch)
+  ((-idx1- (-ubyte-)) data)
+  (let ((n (idx-dim data 0)))
+    ((-int-) n)
+    #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+        snd_seq_ev_set_sysex( ev, (unsigned int)$n, IDX_PTR($data, void));
+        snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+    }#}
+    ()))
+
+#? (==> <midi-output> write-event <ch> <type> <param> <value>)
+;; Send a generic MIDI event to channel <ch>.
+(defmethod midi-output write-event (ch type param value)
+  ((-int-) ch type param value)
+  #{{ snd_seq_event_t *ev = (snd_seq_event_t *)$event;
+      ev->data.control.channel = $ch;
+      ev->type = $type;
+      switch ($type) {
+        case SND_SEQ_EVENT_NOTEON:
+           ev->data.note.note = $param;
+           ev->data.note.velocity = $value;
+           break;
+         case SND_SEQ_EVENT_NOTEOFF:
+           ev->data.note.note = $param;
+           break;
+         case SND_SEQ_EVENT_KEYPRESS:
+           ev->data.note.note = $param;
+           ev->data.note.velocity = $value;
+           break;
+         default: 
+           ev->data.control.param = $param;
+           ev->data.control.value = $value;
+       }
+       snd_seq_event_output_direct( (snd_seq_t *)$seqhandle, ev);
+     }#} 
+  ())
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(dhc-make-with-libs
+  ()
+  asound-libs
+  #{ 
+    #include <alsa/asoundlib.h> 
+    #define STRING_DATA(s) (char *)(s->data)
+  #}
+  (midi-input midi-input -destructor poll read-event pending-events)
+  (midi-output midi-output -destructor note noteon noteoff keypress 
+	       controller pgmchange pitchbend chanpress sysex write-event)
+  )
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/music/music.hlp lush-cvs/packages/music/music.hlp
--- lush/packages/music/music.hlp	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/music/music.hlp	2007-09-10 16:35:24.000000000 -0400
@@ -0,0 +1,9 @@
+#? **** Music and MIDI: High-level interfaces to various 
+;; MIDI, audio, and music-related libraries, such
+;; as the ALSA sequencer device (for MIDI) and
+;; the Jack audio server.
+;; This is somewhat different from and easier to use than the 
+;; raw interface provided by the ALSA package.
+
+#? *** << music/midi-seq.lsh
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/aux_const.lsh lush-cvs/packages/opencv/aux_const.lsh
--- lush/packages/opencv/aux_const.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/aux_const.lsh	2007-09-02 21:32:58.000000000 -0400
@@ -493,6 +493,8 @@
 (defconstant "CV_SVD_U_T"                            2 )
 (defconstant "CV_SVD_V_T"                            4 )
 
+(defconstant "CV_FLOODFILL_FIXED_RANGE"              (bitshl 1 16))
+(defconstant "CV_FLOODFILL_MASK_ONLY"                (bitshl 1 17))
 
 ;;******************************************************************************
 ;;  constants defined in enum types
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/aux_convert.lsh lush-cvs/packages/opencv/aux_convert.lsh
--- lush/packages/opencv/aux_convert.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/aux_convert.lsh	2007-09-02 21:32:58.000000000 -0400
@@ -478,51 +478,76 @@
 (de idx8u_ipl_share (mat img)
     ((-gptr- "IplImage *") img)
     ((-idx3- (-ubyte-)) mat)
-     #{ {
-     int width,height,channels,rowbytes;
-     CvSize sz;
-
-     height = Midx_dim($mat,0);
-     width  = Midx_dim($mat,1);
-     channels = Midx_dim($mat,2);
-     rowbytes = Midx_mod($mat,0)*sizeof(unsigned char);
-     sz=cvSize(width,height);
-
-     if($img->imageData)
-           cvReleaseData($img);
-
-     cvInitImageHeader($img,sz,IPL_DEPTH_8U,channels,IPL_ORIGIN_TL,4);
-     $img->imageData = (char *) IDX_PTR($mat, uchar);
-     } #}
-     ())
+    
+    (when (<> 1 (idx-modulo mat 2))
+      (error "The rows of mat must lie in contiguous storage. In other words, (idx-modulo mat 2) must equal 1"))
+
+    (let* ((byte-alignment 4) ;; must be 4 or 8
+	   (rowbytes #{ Midx_mod($mat,0)*sizeof(unsigned char) #} ))
+      ((-int-) byte-alignment rowbytes)
+      
+      (when (<> 0 (mod rowbytes byte-alignment))
+	(error "matrix row size in bytes must be a multiple of 4"))
+
+      #{ {
+      int width,height,channels;
+      CvSize sz;
+      
+      height = Midx_dim($mat,0);
+      width  = Midx_dim($mat,1);
+      channels = Midx_dim($mat,2);
+      sz=cvSize(width,height);
+
+      if($img->imageData)
+      cvReleaseData($img);
+      
+      cvInitImageHeader($img,sz,IPL_DEPTH_8U,channels,IPL_ORIGIN_TL,$byte_alignment);
+      $img->imageData = (char *) IDX_PTR($mat, uchar);
+      } #}
+      ()))
  
 
 (de idx8s_ipl_share (mat img)
     ((-gptr- "IplImage *") img)
     ((-idx3- (-byte-)) mat)
-     #{ {
-     int width,height,channels,rowbytes;
-     CvSize sz;
 
+    (when (<> 1 (idx-modulo mat 2))
+      (error "The rows of mat must lie in contiguous storage. In other words, (idx-modulo mat 2) must equal 1"))
 
-     height = Midx_dim($mat,0);
-     width  = Midx_dim($mat,1);
-     channels = Midx_dim($mat,2);
-     rowbytes = Midx_mod($mat,0)*sizeof(signed char);
-     sz=cvSize(width,height);
-
-     if($img->imageData)
-           cvReleaseData($img);
-
-     cvInitImageHeader($img,sz,IPL_DEPTH_8S,channels,IPL_ORIGIN_TL,4);
-     $img->imageData = (char *)IDX_PTR($mat, signed char);
-     } #}
-     ())
+    (let* ((byte-alignment 4) ;; must be 4 or 8
+	   (rowbytes #{ Midx_mod($mat,0)*sizeof(signed char) #} ))
+      ((-int-) byte-alignment rowbytes)
+      
+      (when (<> 0 (mod rowbytes byte-alignment))
+	(error "matrix row size in bytes must be a multiple of 4"))
+
+      #{ {
+      int width,height,channels,rowbytes;
+      CvSize sz;
+
+      
+      height = Midx_dim($mat,0);
+      width  = Midx_dim($mat,1);
+      channels = Midx_dim($mat,2);
+      rowbytes = Midx_mod($mat,0)*sizeof(signed char);
+      sz=cvSize(width,height);
+      
+      if($img->imageData)
+        cvReleaseData($img);
+      
+      cvInitImageHeader($img,sz,IPL_DEPTH_8S,channels,IPL_ORIGIN_TL,$byte_alignment);
+      $img->imageData = (char *)IDX_PTR($mat, signed char);
+      } #}
+      ()))
      
 
 (de idx16s_ipl_share (mat img)
     ((-gptr- "IplImage *") img)
     ((-idx3- (-short-)) mat)
+
+    (when (<> 1 (idx-modulo mat 2))
+      (error "The rows of mat must lie in contiguous storage. In other words, (idx-modulo mat 2) must equal 1"))
+
      #{ {
      int width,height,channels,rowbytes;
      CvSize sz;
@@ -545,6 +570,10 @@
 (de idx32s_ipl_share (mat img)
     ((-gptr- "IplImage *") img)
     ((-idx3- (-int-)) mat)
+
+    (when (<> 1 (idx-modulo mat 2))
+      (error "The rows of mat must lie in contiguous storage. In other words, (idx-modulo mat 2) must equal 1"))
+
      #{ {
      int width,height,channels,rowbytes;
      CvSize sz;
@@ -567,6 +596,10 @@
 (de idx32f_ipl_share (mat img)
     ((-gptr- "IplImage *") img)
     ((-idx3- (-float-)) mat)
+
+    (when (<> 1 (idx-modulo mat 2))
+      (error "The rows of mat must lie in contiguous storage. In other words, (idx-modulo mat 2) must equal 1"))
+
      #{ {
      int width,height,channels,rowbytes;
      CvSize sz;
@@ -589,6 +622,10 @@
 (de idx64f_ipl_share (mat img)
     ((-gptr- "IplImage *") img)
     ((-idx3- (-double-)) mat)
+
+    (when (<> 1 (idx-modulo mat 2))
+      (error "The rows of mat must lie in contiguous storage. In other words, (idx-modulo mat 2) must equal 1"))
+
      #{ {
      int width,height,channels,rowbytes;
      CvSize sz;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/aux_io.lsh lush-cvs/packages/opencv/aux_io.lsh
--- lush/packages/opencv/aux_io.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/aux_io.lsh	2007-03-31 16:37:44.000000000 -0400
@@ -7,6 +7,9 @@
 
 (eval `(de |dummy_cvimage| () ,cv-cpheader-cmd ()))
 
+#? (cvimage-read-rgb <imagefile>)
+;; read an image and return a 
+;; cvimage object with it.
 (de cvimage-read-rgb (filename)
   ((-str-) filename)
   (let* ((buf_idx (image-read-rgb filename))
@@ -17,18 +20,33 @@
     (idx8u_ipl buf_idx  :ret_img:p)
     ret_img))
 
-(de cvimage-show ( img )
+#? (cvimage-draw <x> <y> <cvimage> [<zoomx> <zoomy>])
+;; Display an OpenCV image in the current window
+;; at coordinates <x> <y> with optional integer zoom 
+;; factors <zoomx> <zoomy>.
+(de cvimage-draw (x y img &optional (zx 1) (zy 1))
   ((-obj- (cvimage)) img)
-  (when ~window (new-window 
-		 (==> img get_width) 
-		 (==> img get_height)))
-  (let ((buf_idx (ubyte-matrix 1 1 1)))
-    (ipl8u_idx  :img:p  buf_idx)
-    (if (= (idx-dim  buf_idx 2) 1)          ;; gray image?
-	(rgb-draw-matrix 0 0 
-			 (select buf_idx 2 0))  ;; draw gray image
-      (rgb-draw-matrix 0 0 
-		       buf_idx))                ;; draw rgb image
-    ()))
+  (let ((img-idx (ubyte-matrix 1 1 1)))
+    (ipl8u_idx  :img:p  img-idx)
+    (if (>= (idx-dim img-idx 2) 3)
+	(rgb-draw-matrix x y img-idx zx zy)
+      (rgb-draw-matrix x y (select img-idx 2 0) zx zy))))
+
+#? (cvimage-show <cvimage> [<title>])
+;; open a suitably sized X11 window and 
+;; display OpenCV image <cvimage> in it.
+;; return the window object. The returned window
+;; should be set to a variable, otherwise the window
+;; will disappear at the next evaluation.
+;; The window will be closed when the variable
+;; is set to something else (or when the window is
+;; closed by hand).
+(de cvimage-show (img &optional (title "Lush/OpenCV image"))
+  ((-obj- (cvimage)) img)
+  (let ((window (x11-window 0 0 (==> img get-width) (==> img get-height) title)))
+    (cvimage-draw 0 0 img)
+    window))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (dhc-make () |dummy_cvimage| cvimage-read-rgb)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/aux_object.lsh lush-cvs/packages/opencv/aux_object.lsh
--- lush/packages/opencv/aux_object.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/aux_object.lsh	2007-03-31 12:18:00.000000000 -0400
@@ -257,12 +257,12 @@
 
 (defmethod cvmat get ( row col)
   ((-int-) row col)
-  (double #{ cvmGet((cvMat *)$p, $row, $col) #}))
+  (double #{ cvmGet((CvMat *)$p, $row, $col) #}))
 
 (defmethod cvmat set ( row col val)
   ((-int-) row col)
   ((-double-) val)
-  #{ cvmSet( (cvMat *)$p, $row, $col, $val); #}
+  #{ cvmSet( (CvMat *)$p, $row, $col, $val); #}
   ())
 
 (defmethod cvmat -destructor ()
@@ -300,6 +300,7 @@
    (cvtermcriteria cvtermcriteria)
    (cvbigob cvbigob -destructor)
    (cvimage cvimage -destructor get-width get-height get-depth get-nchannels)
-   (cvmat cvmat -destructor get set)
+   ;; (cvmat cvmat -destructor get set)
+   (cvmat cvmat -destructor)
    (cvsmobarray cvsmobarray ptr-nth)
 )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/cv-config.lsh lush-cvs/packages/opencv/cv-config.lsh
--- lush/packages/opencv/cv-config.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/cv-config.lsh	2007-09-02 21:32:58.000000000 -0400
@@ -28,7 +28,8 @@
 ;;;  3/5/2005  modified for OpenCV version 0.9.7 by Ralf Juengling
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defvar cv-libnames (list "libcv" "libcvaux" "libcxcore"))
+;;(defvar cv-libnames (list "libcv" "libcvaux" "libcxcore"))
+(defvar cv-libnames (list "libcv" "libcvaux"))
 (defvar cv-version ())
 (defvar cv-libs-loaded ())
 (defvar cv-libs ())
@@ -99,6 +100,10 @@
   ;; load libraries
   ;; THIS IS COMPLETELY WRONG **AGAIN**
   ;; THE INTERFACE SHOULD USE DHC-MAKE-WITH-LIBS INSTEAD OF THIS HACK
+;;  (mapc mod-load cv-libs)
+  ;;(pause "paused in cv-config")
   (mapc mod-load cv-libs)
+;;  (each ((cv-lib cv-libs))
+;;    (libload cv-lib))
   (setq cv-libs-loaded t) 
 )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/cvmatrix.lsh lush-cvs/packages/opencv/cvmatrix.lsh
--- lush/packages/opencv/cvmatrix.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opencv/cvmatrix.lsh	2007-03-31 12:18:00.000000000 -0400
@@ -0,0 +1,849 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; Includes information derived from the GSL (Gnu Scientific Library)
+;;;   header files which are copyrighted and distributed under the GPL
+;;;   by their respective authors.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(libload "opencv/cv-config")
+
+
+#? *** matrix
+
+;; dummy function that adds OpenCV C header files in C file
+(eval `(de dummy_cvmatrix () ,cv-cpheader-cmd ()))
+
+;; #? * (cvadd <srca> <srcb> <dst> <mask>)
+;; #? * (cvadds <src> <value> <dst> <mask>)
+;; #? * (cvsub <srca> <srcb> <dst> <mask>)
+;; #? * (cvsubs <src> <value> <dst> <mask>)
+;; #? * (cvsubrs <src> <value> <dst> <mask>)
+;; #? * (cvmul <srca> <srcb> <dst>)
+;; #? * (cvscaleadd <src1> <scale> <src2> <dst>)
+;; #? * (cvmuladds <src1> <scale> <src2> <dst>)
+;; #? * (cvdotproduct <srca> <srcb>)
+;; #? * (cvcrossproduct <srca> <srcb> <dst>)
+;; #? * (cvmatmuladd <srca> <srcb> <srcc> <dst>)
+;; #? * (cvmultransposed <srcarr> <dstarr> <order>)
+;; #? * (cvtranspose <src> <dst>)
+;; #? * (cvt <src> <dst>)
+;; #? * (cvflip <src> <dst> <flipmode>)
+;; #? * (cvinvert <src> <dst>)
+;; #? * (cvsolve <a> <b> <x>)
+;; #? * (cvdet <mat>)
+;; #? * (cvtrace <mat> <s>)
+;; #? * (cvsvd <a> <w> <u> <v> <flag>)
+;; #? * (cvpseudoinverse <a> <b> <flags>)
+;; #? * (cveigenvv <src> <evects> <evals> <eps>)
+;; #? * (cvsetzero <mat>)
+;; #? * (cvsetidentity <mat>)
+;; #? * (cvmahalonobis <srca> <srcb> <mat>)
+;; #? * (cvperspectivetransform <src> <dst> <mat>)
+
+;; ********************************************************
+
+;;  /****************************************************************************************\
+;;  *                                      Matrix Functions                                  *
+;;  \****************************************************************************************/
+
+#? (cvAdd <srca> <srcb> <dst> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvAdd
+;;  //    Purpose:    Adds one array to another
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcA - first source array
+;;  //      srcB - second source array
+;;  //      dst  - destination array: dst = srcA + srcB
+;;  //      mask - optional mask
+;;  //    Returns:
+;;  //F*/
+;;  OPENCVAPI  void  cvAdd( const CvArr* srcA, const CvArr* srcB, CvArr* dst,
+;;                          const CvArr* mask CV_DEFAULT(0));
+
+(de cvAdd (srca srcb dst mask)
+    ((-gptr- "const CvArr *") srca srcb mask)
+    ((-gptr- "CvArr *") dst)
+    #{ cvAdd($srca, $srcb, $dst, $mask);  #}
+    ())
+
+#? (cvAddS <src> <value> <dst> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvAddS
+;;  //    Purpose:    Adds array to scalar
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src  - source array
+;;  //      value - added scalar
+;;  //      dst  - destination array: dst = src + value
+;;  //      mask - optional mask
+;;  //    Returns:
+;;  //F*/
+;;  OPENCVAPI  void  cvAddS( const CvArr* src, CvScalar value, CvArr* dst,
+;;                           const CvArr* mask CV_DEFAULT(0));
+
+(de cvAddS (src value dst mask)
+    ((-gptr- "const CvArr *") src mask)
+    ((-gptr- "CvScalar *") value)
+    ((-gptr- "CvArr *") dst)
+    #{ cvAddS($src, *$value, $dst, $mask);  #}
+    ())
+
+#? (cvSub <srca> <srcb> <dst> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSub
+;;  //    Purpose:    Subtracts one array from another
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcA - first source array
+;;  //      srcB - second source array 
+;;  //      dst  - destination array: dst = srcA - srcB
+;;  //    Returns:
+;;  //F*/
+;;  OPENCVAPI  void  cvSub( const CvArr* srcA, const CvArr* srcB, CvArr* dst,
+;;                          const CvArr* mask CV_DEFAULT(0));
+
+(de cvSub (srca srcb dst mask)
+    ((-gptr- "const CvArr *") srca srcb mask)
+    ((-gptr- "CvArr *") dst)
+    #{ cvSub($srca, $srcb, $dst, $mask);  #}
+    ())
+
+#? (cvSubS <src> <value> <dst> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSubS
+;;  //    Purpose:    Subtracts a scalar value from array
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source array
+;;  //      value - subtracted scalar
+;;  //      dst  - destination array: dst = src - value
+;;  //      mask - optional mask
+;;  //    Returns:
+;;  //F*/
+;;  CV_INLINE  void  cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
+;;                           const CvArr* mask CV_DEFAULT(0));
+;;  CV_INLINE  void  cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
+;;                           const CvArr* mask )
+;;  {
+;;      cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]),
+;;              dst, mask );
+;;  }
+
+(de cvSubS (src value dst mask)
+    ((-gptr- "const CvArr *") src mask)
+    ((-gptr- "CvScalar *") value)
+    ((-gptr- "CvArr *") dst)
+    #{ cvSubS($src, *$value, $dst, $mask);  #}
+    ())
+
+#? (cvSubRS <src> <value> <dst> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSubRS
+;;  //    Purpose:    Subtracts a scalar value from array
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source array
+;;  //      value - scalar to subtract from
+;;  //      dst  - destination array: dst = value - src
+;;  //      mask - optional mask
+;;  //    Returns:
+;;  //F*/
+;;  OPENCVAPI  void  cvSubRS( const CvArr* src, CvScalar value, CvArr* dst,
+;;                            const CvArr* mask CV_DEFAULT(0));
+
+(de cvSubRS (src value dst mask)
+    ((-gptr- "const CvArr *") src mask)
+    ((-gptr- "CvScalar *") value)
+    ((-gptr- "CvArr *") dst)
+    #{ cvSubRS($src, *$value, $dst, $mask);  #}
+    ())
+
+#? (cvMul <src1> <src2> <dst> <scale>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvMul
+;;  //    Purpose:    Multiplies two arrays
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src1 - first source array
+;;  //      src2 - second source array
+;;  //      dst  - destination array: dst(x,y) = srcA(x,y) * srcB(x,y)
+;;  //      scale- scale factor
+;;  //    Returns:
+;;  //F*/
+;;  OPENCVAPI  void  cvMul( const CvArr* srcA, const CvArr* srcB, CvArr* dst, double scale);
+
+(de cvMul (srca srcb dst scale)
+    ((-gptr- "const CvArr *") srca srcb)
+    ((-gptr- "CvArr *") dst)
+    ((-double-) scale)
+    #{ cvMul($srca, $srcb, $dst, $scale);  #}
+    ())
+
+
+#? * (cvinrange <src> <lower> <upper> <dst>)
+;;.PRE
+;;  /* dst(idx) = lower(idx) <= src(idx) < upper(idx) */
+;;  OPENCVAPI void cvInRange( const CvArr* src, const CvArr* lower,
+;;                            const CvArr* upper, CvArr* dst );
+
+;; Jie's comments: (5/9/2002) 
+;; are "opencvInRange" and "cvInRangeS" implemented at all?
+
+(de cvInRange (src lower upper  dst)
+    ((-gptr- "const CvArr *") src lower upper)
+    ((-gptr- "CvArr *") dst)
+    #{ cvInRange($src, $lower, $upper, $dst);  #}
+    ())
+
+
+#? * (cvinranges <src> <lower> <upper> <dst>)
+;;.PRE
+;;  /* dst(idx) = lower <= src(idx) < upper */
+;;  OPENCVAPI void cvInRangeS( const CvArr* src, CvScalar lower,
+;;                             CvScalar upper, CvArr* dst );
+
+(de cvInRangeS (src lower upper  dst)
+    ((-gptr- "const CvArr *") src)
+    ((-gptr- "CvScalar *") lower upper)
+    ((-gptr- "CvArr *") dst)
+    #{ cvInRangeS($src, *$lower, *$upper, $dst);  #}
+    ())
+
+
+;;  /****************************************************************************************\
+;;  *                                      Logic Operations                                  *
+;;  \****************************************************************************************/
+
+#? * (cvand <src1> <src2> <dst> <mask>)
+;;.PRE
+;;  /* dst(idx) = src1(idx) & src2(idx) */
+;;  OPENCVAPI void cvAnd( const CvArr* src1, const CvArr* src2,
+;;                        CvArr* dst, const CvArr* mask CV_DEFAULT(0));
+
+(de cvAnd (src1 src2 dst mask)
+    ((-gptr- "const CvArr *") src1 src2 mask)
+    ((-gptr- "CvArr *") dst)
+    #{ cvAnd($src1, $src2, $dst, $mask); #}
+    ())
+
+#? * (cvands <src> <value> <dst> <mask>)
+;;.PRE
+;;  /* dst(idx) = src(idx) & value */
+;;  OPENCVAPI void cvAndS( const CvArr* src, CvScalar value,
+;;                         CvArr* dst, const CvArr* mask CV_DEFAULT(0));
+
+(de cvAndS (src value dst mask)
+    ((-gptr- "const CvArr *") src mask)
+    ((-gptr- "CvScalar *") value)
+    ((-gptr- "CvArr *") dst)
+    #{  cvAndS($src, *$value, $dst, $mask); #}
+    ())
+
+#? * (cvor <src1> <src2> <dst> <mask>)
+;;.PRE
+;;  /* dst(idx) = src1(idx) | src2(idx) */
+;;  OPENCVAPI void cvOr( const CvArr* src1, const CvArr* src2,
+;;                       CvArr* dst, const CvArr* mask CV_DEFAULT(0));
+
+(de cvOr (src1 src2 dst mask)
+    ((-gptr- "const CvArr *") src1 src2 mask)
+    ((-gptr- "CvArr *") dst)
+    #{ cvOr($src1, $src2, $dst, $mask); #}
+    ())
+
+#? * (cvors <src> <value> <dst> <mask>)
+;;.PRE
+;;  /* dst(idx) = src(idx) | value */
+;;  OPENCVAPI void cvOrS( const CvArr* src, CvScalar value,
+;;                        CvArr* dst, const CvArr* mask CV_DEFAULT(0));
+
+(de cvOrS (src value dst mask)
+    ((-gptr- "const CvArr *") src mask)
+    ((-gptr- "CvScalar *") value)
+    ((-gptr- "CvArr *") dst)
+    #{  cvOrS($src, *$value, $dst, $mask); #}
+    ())
+
+
+#? * (cvxor <src1> <src2> <dst> <mask>)
+;;.PRE
+;;  /* dst(idx) = src1(idx) ^ src2(idx) */
+;;  OPENCVAPI void cvXor( const CvArr* src1, const CvArr* src2,
+;;                        CvArr* dst, const CvArr* mask CV_DEFAULT(0));
+
+(de cvXor (src1 src2 dst mask)
+    ((-gptr- "const CvArr *") src1 src2 mask)
+    ((-gptr- "CvArr *") dst)
+    #{ cvXor($src1, $src2, $dst, $mask); #}
+    ())
+
+#? * (cvxors <src> <value> <dst> <mask>)
+;;.PRE
+;;  /* dst(idx) = src(idx) ^ value */
+;;  OPENCVAPI void cvXorS( const CvArr* src, CvScalar value,
+;;                         CvArr* dst, const CvArr* mask CV_DEFAULT(0));
+
+(de cvXorS (src value dst mask)
+    ((-gptr- "const CvArr *") src mask)
+    ((-gptr- "CvScalar *") value)
+    ((-gptr- "CvArr *") dst)
+    #{  cvXorS($src, *$value, $dst, $mask); #}
+    ())
+
+#? (cvScaleAdd <src1> <scale> <src2> <dst>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvScaleAdd
+;;  //    Purpose:    Multiplies all array elements by a scalar value and
+;;  //                adds another scalar to the scaled array
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source array
+;;  //      scale - scale factor
+;;  //      delta - shift value
+;;  //      dst - destination array
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  void  cvScaleAdd( const CvArr* src1, CvScalar scale,
+;;                               const CvArr* src2, CvArr* dst );
+
+(de cvScaleAdd( src1 scale src2 dst)
+    ((-gptr- "const CvArr *") src1 src2)
+    ((-gptr- "CvScalar *") scale)
+    ((-gptr- "CvArr *") dst)
+    #{ cvScaleAdd($src1, *$scale, $src2, $dst); #}
+    ())
+
+
+#? * (cvmatmuladds <src> <dst> <transform> <shiftvec>)
+;;.PRE
+;;  #define cvMulAddS cvScaleAdd
+
+(de cvMulAddS( src1 scale src2 dst)
+    ((-gptr- "const CvArr *") src1 src2)
+    ((-gptr- "CvScalar *") scale)
+    ((-gptr- "CvArr *") dst)
+    #{ cvScaleAdd($src1, *$scale, $src2, $dst); #}
+    ())
+
+#? (cvDotProduct  <srca> <srcb>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvDotProduct
+;;  //    Purpose:    Evaluates dot product of two vectors
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcA - first source array
+;;  //      srcB - second source array
+;;  //
+;;  //    Returns:
+;;  //      Dot product of srcA and srcB:  sum(srcA(i,j)*srcB(i,j))
+;;  //                                     i,j
+;;  //F*/
+;;  OPENCVAPI  double  cvDotProduct( const CvArr* srcA, const CvArr* srcB );
+
+(de cvDotProduct ( srca srcb)
+    ((-gptr- "const CvArr *") srca srcb)
+    (let ((s 0))
+      ((-double-) s)
+      #{ $s = cvDotProduct($srca, $srcb); #}
+      s))
+
+#? (cvCrossProduct <srca> <srcb> <dst>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvCrossProduct
+;;  //    Purpose:    Evaluates cross product of two 3d vectors
+;;  //    Context:
+;;  //    Parameters: srcA - first source vector
+;;  //                srcB - second source vector
+;;  //                dst  - destination vector
+;;  //    Returns:
+;;  //
+;;  //F*/
+;;  OPENCVAPI  void  cvCrossProduct( const CvArr* srcA, const CvArr* srcB, CvArr* dst );
+
+(de cvCrossProduct (srca srcb dst)
+    ((-gptr- "const CvArr *") srca srcb)
+    ((-gptr- "CvArr *") dst)
+    #{ cvCrossProduct($srca, $srcb, $dst); #}
+    ())
+
+
+#? (cvMatMulAdd <srca> <srcb> <srcc> <dst>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvMatMulAdd
+;;  //    Purpose:    Evaluates product of two matrices and
+;;  //                adds the third matrix to the product
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcA - first source matrix
+;;  //      srcB - second source matrix
+;;  //      srcC - added matrix
+;;  //      dst  - destination matrix
+;;  //    Returns:
+;;  //
+;;  //F*/
+;;  OPENCVAPI  void  cvMatMulAdd( const CvArr* srcA, const CvArr* srcB,
+;;                                const CvArr* srcC, CvArr* dst );
+(de cvMatMulAdd (srca srcb srcc dst)
+    ((-gptr- "const CvArr *") srca srcb srcc)
+    ((-gptr- "CvArr *") dst)
+    #{ cvMatMulAdd($srca, $srcb, $srcc, $dst); #}
+    ())
+
+
+#? (cvMatMulAddS  <src> <dst> <transform> <shiftvec>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvMatMulAddS
+;;  //    Purpose:    Performs matrix transformation for every vector of the source array
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcr - source array
+;;  //      dst  - destination array
+;;  //      transform - transformation matrix
+;;  //      shiftvec - optional shift (may be encoded in the matrix as well)
+;;  //    Returns:
+;;  //
+;;  //F*/
+;;  OPENCVAPI  void  cvMatMulAddS( const CvArr* src, CvArr* dst,
+;;                                 const CvArr* transform,
+;;                                 const CvArr* shiftvec CV_DEFAULT(0));
+
+(de cvMatMulAddS ( src dst transform shiftvec)
+    ((-gptr- "const CvArr *") src transform shiftvec)
+    ((-gptr- "CvArr *") dst)
+    #{ cvMatMulAddS($src, $dst, $transform, $shiftvec); #}
+    ())
+
+#? (cvMulTransposed <srcarr> <dstarr> <order>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvMulTransposed
+;;  //    Purpose:    Evaluates product of matix by itself transposed
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcarr - the source matrix
+;;  //      dstarr - the destination matrix
+;;  //      order - determines the order of multiplication
+;;  //              if order = 0, function evaluates A*At
+;;  //              if order = 1, function evaluates At*A
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI void cvMulTransposed( const CvArr* srcarr,
+;;                                  CvArr* dstarr, int order );
+
+(de cvMulTransposed (srcarr dstarr order)
+    ((-gptr- "const CvArr *") srcarr)
+    ((-gptr- "CvArr *") dstarr)
+    ((-int-) order)
+    #{ cvMulTransposed($srcarr, $dstarr, $order, NULL, 1.); #}
+    ())
+
+#? (cvTranspose <src> <dst>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvTranspose
+;;  //    Purpose:    Transposes matrix
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source matrix
+;;  //      dst - destination matrix
+;;  //    Returns:
+;;  //    Notes:
+;;  //      square matrices can be transposed in-place.
+;;  //F*/
+;;  OPENCVAPI  void  cvTranspose( const CvArr* src, CvArr* dst );
+
+(de cvTranspose (src dst)
+    ((-gptr- "const CvArr *") src)
+    ((-gptr- "CvArr *") dst)
+    #{  cvTranspose($src, $dst); #}
+    ())
+
+;;  #define cvT cvTranspose
+
+(de cvT (src dst)
+    ((-gptr- "const CvArr *") src)
+    ((-gptr- "CvArr *") dst)
+    #{  cvTranspose($src, $dst); #}
+    ())
+
+#? (cvFlip <src> <dst> <flipmode>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvFlip
+;;  //    Purpose:    Mirrors the matrix around vertical or horizontal axis
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source matrix
+;;  //      dst - destination matrix
+;;  //      flipAxis - 0: horizontal axis
+;;  //                 1: vertical axis
+;;  //                -1: both axis
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  void  cvFlip( const CvArr* src, CvArr* dst, int flip_mode );
+
+(de cvFlip (src dst flipmode)
+    ((-gptr- "const CvArr *") src)
+    ((-gptr- "CvArr *") dst)
+    ((-int-) flipmode)
+    #{ cvFlip ($src, $dst, $flipmode); #}
+    ())
+
+
+#? * (cvmirror <src> <dst> <flipmode>)
+;;.PRE
+;;  #define cvMirror cvFlip
+
+(de cvMirror (src dst flipmode)
+    ((-gptr- "const CvArr *") src)
+    ((-gptr- "CvArr *") dst)
+    ((-int-) flipmode)
+    #{ cvFlip ($src, $dst, $flipmode); #}
+    ())
+
+#? (cvInvert  <src> <dst>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvInvert
+;;  //    Purpose:    Inverts Matrix using LU decomposition
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source matrix
+;;  //      dst - destination matrix
+;;  //    Returns:
+;;  //      1 if the matrix inverted and 0 if it is a singular (or very close to it)
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  int  cvInvert( const CvArr* src, CvArr* dst );
+
+(de cvInvert ( src dst )
+    ((-gptr- "const CvArr *") src)
+    ((-gptr- "CvArr *") dst)
+    (let ((s 0))
+      ((-int-) s)
+      #{ $s = cvInvert($src, $dst, CV_LU); #}
+      s))
+
+;(defalias cvInv cvInvert)
+
+#? (cvSolve  <a> <b> <x>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSolve
+;;  //    Purpose:    Solves linear system Ax = b using LU decomposition
+;;  //    Context:
+;;  //    Parameters:
+;;  //      A - the matrix
+;;  //      b - the "right side" of the system
+;;  //      x - destination array (solution of the system)
+;;  //    Returns:
+;;  //      1 if the system is solved and 0 if the matrix is a singular (or very close to it)
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  int  cvSolve( const CvArr* A, const CvArr* b, CvArr* x );
+
+(de cvSolve ( a b x)
+    ((-gptr- "const CvArr *") a b)
+    ((-gptr- "CvArr *") x)
+    (let ((s 0))
+      ((-int-) s)
+      #{ $s = cvSolve ($a, $b, $x, CV_LU); #}
+      s))
+
+#? (cvDetmat <mat>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvDet
+;;  //    Purpose:    Calculates determinant of the matrix
+;;  //    Context:
+;;  //    Parameters:
+;;  //      mat - source matrix
+;;  //    Returns:
+;;  //      Matrix determinant
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  double cvDet( const CvArr* mat );
+
+(de cvDet (mat)
+    ((-gptr- "const CvArr *") mat)
+    (let ((s 0))
+      ((-double-) s)
+      #{ $s = cvDet($mat); #}
+      s))
+
+#? (cvTracemat <s>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvTrace
+;;  //    Purpose:    Calculates trace of the matrix (sum of elements on the main diagonal) 
+;;  //    Context:
+;;  //    Parameters:
+;;  //      mat - source matrix
+;;  //    Returns:
+;;  //      Matrix determinant
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  CvScalar cvTrace( const CvArr* mat );
+
+(de cvTrace(mat s)
+    ((-gptr- "const CvArr *") mat)
+    ((-gptr- "CvScalar *") s)
+    #{ { CvScalar tmp;
+    tmp = cvTrace($mat);
+    memcpy($s, &tmp, sizeof(CvScalar));
+    } #}
+    ())
+
+#? (cvSVD  <a> <w> <u> <v> <flag>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSVD
+;;  //    Purpose:    Calculates Singular Value Decomposition for the input matrix: 
+;;  //       A = U W V',   U & V are orthogonal, W is diagonal matrix that can be
+;;  //                     either real matrix (the same size as A) or a vector of
+;;  //                     size min(A->rows,A->cols).
+;;  //       U & V are optional,
+;;  //       flags:  0th bit, reset to 0, means that A is copyied before processing,
+;;  //                        otherwise it is modified during the processing, which is
+;;  //                        faster.
+;;  //               1st bit, reset to 0, means that U is returned normal, otherwise it
+;;  //                        is returned transposed, which is faster.
+;;  //               2nd bit, reset to 0, means that V is returned normal, otherwise it
+;;  //                        is returned transposed, which is faster.
+;;  //F*/
+;;  OPENCVAPI  void   cvSVD( CvArr* A, CvArr* W CV_DEFAULT(0),
+;;                           CvArr* U CV_DEFAULT(0),
+;;                           CvArr* V CV_DEFAULT(0),
+;;                           int flag CV_DEFAULT(0));
+(de cvSVD ( a w u v flag)
+    ((-gptr- "CvArr *") a w u v)
+    ((-int-) flag)
+    #{ cvSVD($a, $w, $u, $v, $flag); #}
+    ())
+
+
+#? (cvPseudoInverse  <a> <b>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvPseudoInv
+;;  //    Purpose:    Calculates inverse or pseudo-inverse matrix for the input matrix.
+;;  //       if A is (m x n) matrix, B will be (n x m) matrix, such that
+;;  //       AB = I(m x m), BA = I(n x n).
+;;  //
+;;  //    Return value:
+;;  //       The function returns condition number or DBL_MAX if the matrix is signular.
+;;  //F*/
+;;  OPENCVAPI  double  cvPseudoInverse( CvArr* A, CvArr* B);
+
+(de cvPseudoInverse ( a b)
+    ((-gptr- "CvArr *") a b)
+    (let ((s 0))
+      ((-double-) s)
+      #{ $s = cvInvert($a, $b, CV_SVD); #}
+      s))
+
+;(defalias cvPseudoInv cvPseudoInverse)
+
+
+#? (cvEigenVV  <src> <evects> <evals> <eps>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvEigenVV
+;;  //    Purpose:    Finds eigenvalues & eigenvectors of a symmetric matrix:
+;;  //    Context:
+;;  //    Parameters:
+;;  //      src - source symmetric matrix,
+;;  //      evects - matrix of its eigenvectors
+;;  //               (i-th row is an i-th eigenvector),
+;;  //      evals - vector of its eigenvalues
+;;  //              (i-th element is an i-th eigenvalue),
+;;  //      eps - accuracy of diagonalization.
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  void  cvEigenVV( CvArr* src, CvArr* evects, CvArr* evals, double eps );
+
+(de cvEigenVV ( src evects evals eps)
+    ((-gptr- "CvArr *") src evects evals)
+    ((-double-) eps)
+    #{ cvEigenVV($src, $evects, $evals, $eps); #}
+    ())
+
+#? (cvSetZero  <mat> )
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSetZero
+;;  //    Purpose:    Clears all the matrix elements (sets them to 0)
+;;  //    Context:
+;;  //    Parameters: mat  - matrix
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  void  cvSetZero( CvArr* mat );
+
+(de cvSetZero ( mat )
+    ((-gptr- "CvArr *") mat)
+    #{ cvSetZero($mat); #}
+    ())
+
+
+#? * (cvzero <mat>)
+;;.PRE
+;;  #define cvZero  cvSetZero
+
+(de cvZero ( mat )
+    ((-gptr- "CvArr *") mat)
+    #{ cvSetZero($mat); #}
+    ())
+
+#? (cvSetIdentity  <mat> <value>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvSetIdentity
+;;  //    Purpose:    Fills identity matrix
+;;  //    Context:
+;;  //    Parameters:
+;;  //      mat - matrix
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  void  cvSetIdentity( CvArr* mat );
+
+(de cvSetIdentity ( mat )
+    ((-gptr- "CvArr *") mat)
+    #{ cvSetIdentity($mat, cvRealScalar(1)); #}
+    ())
+
+#? (cvMahalanobis  <srca> <srcb> <mat>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvMahalanobis
+;;  //    Purpose:    Calculates Mahalanobis(weighted) distance.
+;;  //    Context:
+;;  //    Parameters:
+;;  //      srcA - first source vector
+;;  //      srcB - second source vector
+;;  //      matr - covariance matrix
+;;  //    Returns:
+;;  //      Mahalanobis distance
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  double  cvMahalanobis( const CvArr* srcA, const CvArr* srcB, CvArr* mat );
+
+(de cvMahalanobis ( srca srcb mat)
+     ((-gptr- "const CvArr *") srca srcb)
+     ((-gptr- "CvArr *") mat)
+     (let ((s 0))
+       ((-double-) s )
+       #{ $s = cvMahalanobis($srca, $srcb, $mat); #}
+       s))
+
+;;  #define cvMahalonobis  cvMahalanobis
+
+(de cvMahalonobis ( srca srcb mat)
+     ((-gptr- "const CvArr *") srca srcb)
+     ((-gptr- "CvArr *") mat)
+     (let ((s 0))
+       ((-double-) s )
+       #{ $s = cvMahalanobis($srca, $srcb, $mat); #}
+       s))
+
+#? (cvPerspectiveTransform <src> <dst> <mat>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //    Name:       cvPerspectiveTransform
+;;  //    Purpose:    Applies perspective transform to the array of vectors
+;;  //    Context:
+;;  //    Parameters: mat - matrix
+;;  //                src - source array
+;;  //                dst - destination array
+;;  //    Returns:
+;;  //    Notes:
+;;  //F*/
+;;  OPENCVAPI  void  cvPerspectiveTransform( const CvArr* src, CvArr* dst, const CvArr* mat );
+
+(de cvPerspectiveTransform (src dst mat)
+    ((-gptr- "const CvArr *") src mat)
+    ((-gptr- "CvArr *") dst)
+    #{ cvPerspectiveTransform ($src, $dst, $mat); #}
+    ())
+;; ********************************************************
+
+(dhc-make ()
+  dummy_cvmatrix
+  cvadd
+  cvadds
+  cvsub
+  cvsubs
+  cvsubrs
+  cvmul
+;;  cvinrange
+;;  cvinranges
+  cvand
+  cvands
+  cvor
+  cvors
+  cvxor
+  cvxors
+  cvscaleadd
+  cvmuladds
+  cvdotproduct
+  cvcrossproduct
+  cvmatmuladd
+  cvmatmuladds
+  cvmultransposed
+  cvtranspose
+  cvt
+  cvflip
+  cvmirror
+  cvinvert
+  cvsolve
+  cvdet
+  cvtrace
+  cvsvd
+  cvpseudoinverse
+  cveigenvv
+  cvsetzero
+  cvzero
+  cvsetidentity
+  cvmahalanobis
+  cvmahalonobis
+  cvperspectivetransform
+)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/cv-statistics.lsh lush-cvs/packages/opencv/cv-statistics.lsh
--- lush/packages/opencv/cv-statistics.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opencv/cv-statistics.lsh	2007-09-02 21:32:58.000000000 -0400
@@ -0,0 +1,201 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; Includes information derived from the GSL (Gnu Scientific Library)
+;;;   header files which are copyrighted and distributed under the GPL
+;;;   by their respective authors.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(libload "opencv/cv-config")
+
+
+
+#? *** statistics
+
+;; dummy function that adds OpenCV C header files in C file
+(eval `(de dummy_cv_statistics () ,cv-cpheader-cmd ()))
+
+;; #? * (dummy_statistics)
+;; #? * (cvsum <array> <s>)
+;; #? * (cvcountnonzero <array>)
+;; #? * (cvavg <array> <mask> <s>)
+;; #? * (cvavgsdv <array> <mean> <std_dev> <mask>)
+;; #? * (cvminmaxloc <array> <min_val> <max_val> <min_loc> <max_loc> <mask>)
+
+;; ********************************************************
+
+;;  /****************************************************************************************\
+;;  *      Image statistics functions support the next image formats:                        *
+;;  *         single-channel: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_32F                      *
+;;  *         three-channel: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_32F (COI must be != 0)    *
+;;  \****************************************************************************************/
+
+#? (cvSum  <array> <s>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //
+;;  //    Name:    cvSum
+;;  //    Purpose:
+;;  //      Sums all the elements in the image ROI or in the matrix
+;;  //    Context:
+;;  //    Parameters:
+;;  //        array - image or matrix.
+;;  //    Returns:
+;;  //        sum of every channel.
+;;  //    Note:
+;;  //        In case of COI is set the sum over the selected channel is saved
+;;  //        if the 0-th element of the returned CvScalar structure.
+;;  //F*/
+;;  OPENCVAPI  CvScalar  cvSum( const CvArr* array );
+
+(de cvSum (array s)
+    ((-gptr- "const CvArr *") array)
+    ((-gptr- "CvScalar *") s)
+    #{ {
+    CvScalar tmp;
+    tmp=cvSum($array);
+    memcpy($s,&tmp,sizeof(CvScalar));
+    } #}
+    ())
+    
+#? (cvCountNonZero <array>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //
+;;  //    Name:    cvCountNonZero
+;;  //    Purpose:
+;;  //        Counts all the non-zero elements in the image ROI or in the matrix
+;;  //    Context:
+;;  //    Parameters:
+;;  //        array - image or matrix.
+;;  //    Returns:
+;;  //        count of non-zero pixels
+;;  //    Note:
+;;  //        For multi-channel images COI must be set.
+;;  //F*/
+;;  OPENCVAPI  int  cvCountNonZero( const CvArr* array );
+
+(de cvCountNonZero(array)
+    ((-gptr- "const CvArr *") array)
+    (let ((s 0))
+      ((-int-) s)
+      #{ $s = cvCountNonZero($array); #}
+      s))
+
+#? (cvAvg <array> <mask> <s>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //
+;;  //    Name:    cvAvg
+;;  //    Purpose:
+;;  //      Calculates average value of the image region or the matrix.
+;;  //    Context:
+;;  //    Parameters:
+;;  //        array - input image or matrix.
+;;  //        mask - optional parameter: 8uC1 or 8sC1 array that specifies
+;;  //               the processed region of the input array
+;;  //    Returns:
+;;  //        average value for every channel. In case of COI is set, average value
+;;  //        of the selected COI is stored into 0-th element
+;;  //        of the returned CvScalar structure
+;;  //F*/
+;;  OPENCVAPI  CvScalar  cvAvg( const CvArr* array, const CvArr* mask CV_DEFAULT(0) );
+
+(de cvAvg(array mask s)
+    ((-gptr- "const CvArr *") array)
+    ((-gptr- "const CvArr *") mask)
+    ((-gptr- "CvScalar *") s)
+    #{ { CvScalar tmp;
+    tmp = cvAvg($array, $mask);
+    memcpy($s, &tmp, sizeof(CvScalar));
+    } #}
+    ())
+
+#? (cvAvgSdv  <array> <mean> <std_dev> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //
+;;  //    Name:    cvAvgSdv
+;;  //    Purpose:
+;;  //      Calculates mean and standard deviation of pixels in the image region
+;;  //    Context:
+;;  //    Parameters:
+;;  //        img - input image.
+;;  //        mean - mean value
+;;  //        std_dev - standard deviation
+;;  //        mask - mask(byte-depth, single channel)
+;;  //    Returns:
+;;  //
+;;  //F*/
+;;  OPENCVAPI  void  cvAvgSdv( const CvArr* array, CvScalar* mean, CvScalar* std_dev,
+;;                             const CvArr* mask CV_DEFAULT(0) );
+
+(de cvAvgSdv( array mean std_dev mask)
+    ((-gptr- "const CvArr *") array mask)
+    ((-gptr- "CvScalar *") mean std_dev)
+    #{ cvAvgSdv($array, $mean, $std_dev, $mask); #}
+    ())
+ 
+#? (cvMinMaxLoc  <array> <min_val> <max_val> <min_loc> <max_loc> <mask>)
+;;.VP
+;;  /*F///////////////////////////////////////////////////////////////////////////////////////
+;;  //
+;;  //    Name:    cvMinMaxLoc
+;;  //    Purpose:
+;;  //      Finds minimum and maximum pixel values in the image region
+;;  //      and determines their locations.
+;;  //    Context:
+;;  //    Parameters:
+;;  //        img - input image.
+;;  //        minVal - minimum value
+;;  //        maxVal - maximum value
+;;  //        minLoc - location of the minimum
+;;  //        maxLoc - location of the maximum
+;;  //        mask - mask(byte-depth, single channel)
+;;  //    Returns:
+;;  //    Note:
+;;  //      If there are several global minimums and/or maximums,
+;;  //      function returns the most top-left extremums.
+;;  //F*/
+;;  OPENCVAPI  void  cvMinMaxLoc( const CvArr* array, double* min_val, double* max_val,
+;;                                CvPoint* min_loc CV_DEFAULT(0),
+;;                                CvPoint* max_loc CV_DEFAULT(0),
+;;                                const CvArr* mask CV_DEFAULT(0) );
+
+(de cvMinMaxLoc (array min_val max_val min_loc max_loc mask)
+    ((-gptr- "const CvArr *") array mask)
+    ((-gptr- "double *") min_val max_val)
+    ((-gptr- "CvPoint *") min_loc max_loc)
+    #{ cvMinMaxLoc($array, $min_val, $max_val, $min_loc, $max_loc, $mask);  #}
+    ())
+;; ********************************************************
+
+(dhc-make ()
+  dummy_cv_statistics
+  cvsum
+  cvcountnonzero
+  cvavg
+  cvavgsdv
+  cvminmaxloc
+)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d01_sample.lsh lush-cvs/packages/opencv/demos/d01_sample.lsh
--- lush/packages/opencv/demos/d01_sample.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d01_sample.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -9,4 +9,4 @@
 (cvPyrDown :img:p  :simg:p  7)
 (cvPyrUp   :simg:p :img:p   7)
 
-(cvimage-show  img)
+(defparameter cvwin (cvimage-show  img))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d02_cannyedge.lsh lush-cvs/packages/opencv/demos/d02_cannyedge.lsh
--- lush/packages/opencv/demos/d02_cannyedge.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d02_cannyedge.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -21,4 +21,5 @@
      (cvCanny     :grayimg:p    :edgeimg:p   0 50 5)
      (cvDilate    :edgeimg:p    :edgeimg:p   (gptr ()) 1)
 
-     (cvimage-show  edgeimg)  )
+     (defparameter cvwin (cvimage-show  edgeimg)  ))
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d03_pyrseg.lsh lush-cvs/packages/opencv/demos/d03_pyrseg.lsh
--- lush/packages/opencv/demos/d03_pyrseg.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d03_pyrseg.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -20,7 +20,7 @@
 		       :storage:p  :connectedcomp:pp  
 		       level  threshold1 threshold2) )
 
-(cvimage-show  image1)
+(defparameter cvwin (cvimage-show  image1))
 
 ;; the steps below are NOT really necessary, 
 ;; since the objects will be garbage collected automatically
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d04_video.lsh lush-cvs/packages/opencv/demos/d04_video.lsh
--- lush/packages/opencv/demos/d04_video.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d04_video.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -12,26 +12,26 @@
 (libload "opencv/opencv")
 
 
-(setq width 320)
-(setq height 240)
 
-(new-window width height  "webcam")
-(setq webcam (new v4ldevice 
-		  "/dev/video0" "NTSC" 0 width height))
-
-(setq captimg (ubyte-matrix height width 3))
-(setq bufimg (new cvimage width height @IPL_DEPTH_8U 3))
-(setq roirect (new cvrect 0 0 width height))
-(setq grayimg (new cvimage width height @IPL_DEPTH_8U 1))
-
- (while t
-   (==> webcam grab-into-rgb captimg)
-   (idx8u_ipl  captimg  :bufimg:p)
-
-   (cvSetImageCOI  :bufimg:p 1)
-   (cvSetImageROI  :bufimg:p :roirect:p)
-
-   (cvCopy     :bufimg:p  :grayimg:p  (gptr ()) )
-   (cvimage-show grayimg)
-)
+
+(let* ((width 320) (height 240)
+       (webcam (new v4ldevice 
+		    "/dev/video0" "NTSC" 0 width height))
+       (captimg (ubyte-matrix height width 3))
+       (bufimg (new cvimage width height @IPL_DEPTH_8U 3))
+       (roirect (new cvrect 0 0 width height))
+       (grayimg (new cvimage width height @IPL_DEPTH_8U 1)))
+
+  (new-window 0 0 width height "Lush/OpenCV video demo")
+  (printf "hit CTRL-C to stop\n")
+  (while t
+    (==> webcam grab-into-rgb captimg)
+    (idx8u_ipl  captimg  :bufimg:p)
+
+    (cvSetImageCOI  :bufimg:p 1)
+    (cvSetImageROI  :bufimg:p :roirect:p)
+
+    (cvCopy     :bufimg:p  :grayimg:p  (gptr ()) )
+    (cvimage-draw 0 0 grayimg)))
+
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d05_video_edge.lsh lush-cvs/packages/opencv/demos/d05_video_edge.lsh
--- lush/packages/opencv/demos/d05_video_edge.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d05_video_edge.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -6,34 +6,33 @@
 (libload "video4linux/v4l")
 (libload "opencv/opencv")
 
-(setq width 640)
-(setq height 480)
-
-(new-window width height  "webcam")
-(setq webcam (new v4ldevice 
-		  "/dev/video0" "NTSC" 0 width height))
-
-(setq captimg (ubyte-matrix height width 3))
-(setq bufimg (new cvimage width height @IPL_DEPTH_8U 3))
-(setq roirect (new cvrect 0 0 width height))
-(setq grayimg (new cvimage width height @IPL_DEPTH_8U 1))
-(setq edgeimg (new cvimage width height @IPL_DEPTH_8U 1))
-(setq halfimg (new cvimage 
-		   (/ width 2) (/ height 2) 
-		   @IPL_DEPTH_8U 3))
-
- (while t
-   (==> webcam grab-into-rgb captimg)
-   (idx8u_ipl  captimg  :bufimg:p)
-
-   (cvPyrDown :bufimg:p  :halfimg:p  7)
-   (cvPyrUp   :halfimg:p :bufimg:p   7)
-
-   (cvSetImageCOI  :bufimg:p 1)
-   (cvSetImageROI  :bufimg:p :roirect:p)
-   (cvCopy     :bufimg:p  :grayimg:p  (gptr ()) )
-
-   (cvCanny  :grayimg:p    :edgeimg:p  0 50 3)
-   (cvDilate :edgeimg:p    :edgeimg:p  (gptr ()) 1)
-   (cvimage-show edgeimg))
+(de opencv-canny-demo ()
+  (let* ((width 640) (height 480)
+	 (webcam (new v4ldevice 
+		      "/dev/video0" "NTSC" 0 width height))
+	 (captimg (ubyte-matrix height width 3))
+	 (bufimg (new cvimage width height @IPL_DEPTH_8U 3))
+	 (roirect (new cvrect 0 0 width height))
+	 (grayimg (new cvimage width height @IPL_DEPTH_8U 1))
+	 (edgeimg (new cvimage width height @IPL_DEPTH_8U 1))
+	 (halfimg (new cvimage (/ width 2) (/ height 2) 
+		       @IPL_DEPTH_8U 3))
+	 )
+    (new-window 0 0 width height "Lush/OpenCV Edge Demo")
+    (printf "type CTRL-C to stop\n")
+    (while t
+      (==> webcam grab-into-rgb captimg)
+      (idx8u_ipl  captimg  :bufimg:p)
+
+      (cvPyrDown :bufimg:p  :halfimg:p  7)
+      (cvPyrUp   :halfimg:p :bufimg:p   7)
+
+      (cvSetImageCOI  :bufimg:p 1)
+      (cvSetImageROI  :bufimg:p :roirect:p)
+      (cvCopy     :bufimg:p  :grayimg:p  (gptr ()) )
+
+      (cvCanny  :grayimg:p    :edgeimg:p  0 50 3)
+      (cvDilate :edgeimg:p    :edgeimg:p  (gptr ()) 1)
+      (cvimage-draw 0 0 edgeimg))))
 
+(opencv-canny-demo)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d06_corners.lsh lush-cvs/packages/opencv/demos/d06_corners.lsh
--- lush/packages/opencv/demos/d06_corners.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d06_corners.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -18,7 +18,7 @@
 (setq corners (new cvsmobarray 
 		   (memsize_cvpoint2d32f) 300))
 
-(setq count   (new cvsmobarray 4 1))
+(setq count (new cvsmobarray 4 1))
 (poke-int (==> count ptr_nth 0) 1000)  ;; maximum
 
 (setq eigimg  (new cvimage 640 480 32 1))
@@ -36,16 +36,16 @@
 		       0.04)        ;; k
 
 (setq numpoints (peek-int (==> count ptr_nth 0)))
-(setq ccolor (new CvScalar 255 0 0 0))
 
-(for (i 0 (1- numpoints))
-     (let* ((ipoint  (new cvpoint 0 0))
-	    (fpoint  (new cvpoint2d32f 0 0)))
-       (==> fpoint copy (==> corners ptr_nth i))
-       (==> ipoint set_x (cvround (==> fpoint get_x)))
-       (==> ipoint set_y (cvround (==> fpoint get_y)))
-
-       (cvCircle :img1:p :ipoint:p 4 
-		 (==> ccolor getp) 2 8 0) ) )
-(cvimage-show img1)
-(delete ccolor)
+(let ((ccolor (new CvScalar 255 0 0 0)))
+  (for (i 0 (1- numpoints))
+       (let* ((ipoint  (new cvpoint 0 0))
+	      (fpoint  (new cvpoint2d32f 0 0)))
+	 (==> fpoint copy (==> corners ptr_nth i))
+	 (==> ipoint set_x (cvround (==> fpoint get_x)))
+	 (==> ipoint set_y (cvround (==> fpoint get_y)))
+
+	 (cvCircle :img1:p :ipoint:p 4 
+		   (==> ccolor getp) 2 8 0) ) )
+  (defparameter cvwin (cvimage-show img1)))
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/demos/d07_lk_track.lsh lush-cvs/packages/opencv/demos/d07_lk_track.lsh
--- lush/packages/opencv/demos/d07_lk_track.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/demos/d07_lk_track.lsh	2007-03-31 16:37:16.000000000 -0400
@@ -1,6 +1,7 @@
-
+;; Lukas-Kanade tracking demo.
 ;; by Fu Jie Huang, Jan 2003
 ;;  updated Oct 2006
+;; updated by  Yann LeCun March 2007.
 
 ;; when all the points are lost in the tracking,
 ;; the program does nothing but displaying the frame
@@ -27,9 +28,7 @@
 		    8       ;; line type (default)
 		    0)      ;; shift (default)
 	 ())
-    (delete ipoint)
-    (delete fpoint)
-    ()))  
+    ()))
 
 (de find_dots ( img dots count )
   (let* ((width  (==> img get_width))
@@ -74,107 +73,97 @@
 	  #{ #include <cv.h> #}
 	  update_dots)
 
-(setq width 640)
-(setq height 480)
-
-(new-window width height  "webcam")
-(setq webcam (new v4ldevice 
-		  "/dev/video0" "NTSC" 
-		  0 width height))
-
-(setq captimg (ubyte-matrix height width 3))
-(setq bufimg  (new cvimage width height 8 3))
-(setq nextimg (new cvimage width height 8 3))
-
-(setq bufgray  (new cvimage width height 8 1))
-(setq nextgray (new cvimage width height 8 1))
-
-(setq pyramid  (new cvimage width height 8 1))
-(setq nextpyr  (new cvimage width height 8 1))
-
-(setq disimg  (new cvimage width height 8 3))
 
-(setq corners     (new cvsmobarray (memsize_cvpoint2d32f) 300))
-(setq nextcorners (new cvsmobarray (memsize_cvpoint2d32f) 300))
+(let* ((width 640) (height 480)
+       (webcam (new v4ldevice "/dev/video0" "NTSC" 0 width height))
+       (captimg (ubyte-matrix height width 3))
+       (bufimg (new cvimage width height 8 3))
+       (nextimg (new cvimage width height 8 3))
+       (bufgray (new cvimage width height 8 1))
+       (nextgray (new cvimage width height 8 1))
+       (pyramid (new cvimage width height 8 1))
+       (nextpyr (new cvimage width height 8 1))
+       (disimg (new cvimage width height 8 3))
+       (corners (new cvsmobarray (memsize_cvpoint2d32f) 300))
+       (nextcorners (new cvsmobarray (memsize_cvpoint2d32f) 300))
+       (count  (new cvsmobarray 4 1))
+       (numpoints 0)
+
+       (status   (new cvsmobarray 1 300))
+       (winsize  (new cvsize 10 10))
+       (criteria (new cvtermcriteria 
+		      (bitor @CV_TERMCRIT_ITER  
+			     @CV_TERMCRIT_EPS)  
+		      20  0.03 ))
+       (flag 0))
 
-(setq count   (new cvsmobarray 4 1))
-(poke-int (==> count ptr_nth 0) 1000)  ;; maximum
+  (new-window 0 0 width height "Lush/OpenCV Tracking demo")
 
-(==> webcam grab-into-rgb captimg)
-
-(idx8u_ipl  captimg  :bufimg:p)
-(find_dots  bufimg   corners  count)
-(setq  numpoints (peek-int (==> count ptr_nth 0)))
-
-(idx8u_ipl  captimg  :disimg:p)
-(put_dots   disimg   corners  numpoints)
- 
-(cvimage-show disimg) 
-;; (idx8u_ipl  captimg  :bufimg:p)
-
-(setq status   (new cvsmobarray 1 300))
-(setq winsize  (new cvsize 10 10))
-(setq criteria (new cvtermcriteria 
-		    (bitor @CV_TERMCRIT_ITER  
-			   @CV_TERMCRIT_EPS)  
-		    20  0.03 ))
- 
-(setq flag 0)
-
-(setq  numpoints (peek-int (==> count ptr_nth 0)))
-(while t 
+  (poke-int (==> count ptr_nth 0) 1000)	;; maximum
   (==> webcam grab-into-rgb captimg)
-  (idx8u_ipl   captimg  :disimg:p)
+  (idx8u_ipl  captimg  :bufimg:p)
+  (find_dots bufimg corners count)
+  (setq  numpoints (peek-int (==> count ptr_nth 0)))
+  (idx8u_ipl  captimg  :disimg:p)
+  (put_dots disimg corners  numpoints)
+  (cvimage-show disimg) 
+  ;; (idx8u_ipl  captimg  :bufimg:p)
+  (setq  numpoints (peek-int (==> count ptr_nth 0)))
+
+  (while t 
+    (==> webcam grab-into-rgb captimg)
+    (idx8u_ipl   captimg  :disimg:p)
  
-  (when (and (= flag 0)
-	     (<> numpoints 0))
-    (idx8u_ipl  captimg  :nextimg:p)
-    (cvSetImageCOI  :nextimg:p 1)
-    (cvcopy :nextimg:p   :nextgray:p (gptr ()) )
-    (cvsetimagecoi  :bufimg:p  1)
-    (cvcopy :bufimg:p    :bufgray:p (gptr ()) )
-    (cvcalcOpticalFlowPyrLK  :bufgray:p  
-			     :nextgray:p  
-			     :pyramid:p
-			     :nextpyr:p
-			     :corners:p  
-			     :nextcorners:p 
-			     numpoints
-			     :winsize:p  
-			     3
-			     :status:p   
-			     (gptr ())
-			     :criteria:p 
-			     0)
-    (setq flag 1) 
-    (setq numpoints (update_dots :nextcorners:p :status:p numpoints))
-    (put_dots    disimg  nextcorners  numpoints))
+    (when (and (= flag 0)
+	       (<> numpoints 0))
+      (idx8u_ipl  captimg  :nextimg:p)
+      (cvSetImageCOI  :nextimg:p 1)
+      (cvcopy :nextimg:p   :nextgray:p (gptr ()) )
+      (cvsetimagecoi  :bufimg:p  1)
+      (cvcopy :bufimg:p    :bufgray:p (gptr ()) )
+      (cvcalcOpticalFlowPyrLK  :bufgray:p  
+			       :nextgray:p  
+			       :pyramid:p
+			       :nextpyr:p
+			       :corners:p  
+			       :nextcorners:p 
+			       numpoints
+			       :winsize:p  
+			       3
+			       :status:p   
+			       (gptr ())
+			       :criteria:p 
+			       0)
+      (setq flag 1) 
+      (setq numpoints (update_dots :nextcorners:p :status:p numpoints))
+      (put_dots    disimg  nextcorners  numpoints))
  
-  (when (and (= flag 1)
-	     (<> numpoints 0))
-    (idx8u_ipl  captimg  :bufimg:p)
-    (cvSetImageCOI  :bufimg:p 1)
-    (cvSetImageCOI  :nextimg:p 1)
-    (cvcopy :nextimg:p   :nextgray:p (gptr ()) )
-    (cvcopy :bufimg:p    :bufgray:p (gptr ()) )
-    (cvcalcOpticalFlowPyrLK  :nextgray:p  
-			     :bufgray:p  
-			     :nextpyr:p
-			     :pyramid:p
-			     :nextcorners:p  
-			     :corners:p 
-			     numpoints
-			     :winsize:p  
-			     3
-			     :status:p   
-			     (gptr ())
-			     :criteria:p 
-			     0)
-    (setq flag 0) 
-    (setq numpoints (update_dots :corners:p :status:p numpoints))
-    (put_dots    disimg  corners  numpoints))    
+    (when (and (= flag 1)
+	       (<> numpoints 0))
+      (idx8u_ipl  captimg  :bufimg:p)
+      (cvSetImageCOI  :bufimg:p 1)
+      (cvSetImageCOI  :nextimg:p 1)
+      (cvcopy :nextimg:p   :nextgray:p (gptr ()) )
+      (cvcopy :bufimg:p    :bufgray:p (gptr ()) )
+      (cvcalcOpticalFlowPyrLK  :nextgray:p  
+			       :bufgray:p  
+			       :nextpyr:p
+			       :pyramid:p
+			       :nextcorners:p  
+			       :corners:p 
+			       numpoints
+			       :winsize:p  
+			       3
+			       :status:p   
+			       (gptr ())
+			       :criteria:p 
+			       0)
+      (setq flag 0) 
+      (setq numpoints (update_dots :corners:p :status:p numpoints))
+      (put_dots    disimg  corners  numpoints))    
   
-  (cvimage-show disimg) )
+    (cvimage-draw 0 0 disimg)))
+
 
     
     
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/matrix.lsh lush-cvs/packages/opencv/matrix.lsh
--- lush/packages/opencv/matrix.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/matrix.lsh	1969-12-31 19:00:00.000000000 -0500
@@ -1,850 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; LUSH Lisp Universal Shell
-;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
-;;; Includes parts of TL3:
-;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
-;;; Includes selected parts of SN3.2:
-;;;   Copyright (C) 1991-2001 AT&T Corp.
-;;;
-;;; Includes information derived from the GSL (Gnu Scientific Library)
-;;;   header files which are copyrighted and distributed under the GPL
-;;;   by their respective authors.
-;;;
-;;; 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.
-;;;
-;;; 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, USA
-;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(libload "opencv/cv-config")
-
-
-#? *** matrix
-
-;; dummy function that adds OpenCV C header files in C file
-(eval `(de dummy_matrix () ,cv-cpheader-cmd ()))
-
-;; #? * (dummy_matrix)
-;; #? * (cvadd <srca> <srcb> <dst> <mask>)
-;; #? * (cvadds <src> <value> <dst> <mask>)
-;; #? * (cvsub <srca> <srcb> <dst> <mask>)
-;; #? * (cvsubs <src> <value> <dst> <mask>)
-;; #? * (cvsubrs <src> <value> <dst> <mask>)
-;; #? * (cvmul <srca> <srcb> <dst>)
-;; #? * (cvscaleadd <src1> <scale> <src2> <dst>)
-;; #? * (cvmuladds <src1> <scale> <src2> <dst>)
-;; #? * (cvdotproduct <srca> <srcb>)
-;; #? * (cvcrossproduct <srca> <srcb> <dst>)
-;; #? * (cvmatmuladd <srca> <srcb> <srcc> <dst>)
-;; #? * (cvmultransposed <srcarr> <dstarr> <order>)
-;; #? * (cvtranspose <src> <dst>)
-;; #? * (cvt <src> <dst>)
-;; #? * (cvflip <src> <dst> <flipmode>)
-;; #? * (cvinvert <src> <dst>)
-;; #? * (cvsolve <a> <b> <x>)
-;; #? * (cvdet <mat>)
-;; #? * (cvtrace <mat> <s>)
-;; #? * (cvsvd <a> <w> <u> <v> <flag>)
-;; #? * (cvpseudoinverse <a> <b> <flags>)
-;; #? * (cveigenvv <src> <evects> <evals> <eps>)
-;; #? * (cvsetzero <mat>)
-;; #? * (cvsetidentity <mat>)
-;; #? * (cvmahalonobis <srca> <srcb> <mat>)
-;; #? * (cvperspectivetransform <src> <dst> <mat>)
-
-;; ********************************************************
-
-;;  /****************************************************************************************\
-;;  *                                      Matrix Functions                                  *
-;;  \****************************************************************************************/
-
-#? (cvAdd <srca> <srcb> <dst> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvAdd
-;;  //    Purpose:    Adds one array to another
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcA - first source array
-;;  //      srcB - second source array
-;;  //      dst  - destination array: dst = srcA + srcB
-;;  //      mask - optional mask
-;;  //    Returns:
-;;  //F*/
-;;  OPENCVAPI  void  cvAdd( const CvArr* srcA, const CvArr* srcB, CvArr* dst,
-;;                          const CvArr* mask CV_DEFAULT(0));
-
-(de cvAdd (srca srcb dst mask)
-    ((-gptr- "const CvArr *") srca srcb mask)
-    ((-gptr- "CvArr *") dst)
-    #{ cvAdd($srca, $srcb, $dst, $mask);  #}
-    ())
-
-#? (cvAddS <src> <value> <dst> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvAddS
-;;  //    Purpose:    Adds array to scalar
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src  - source array
-;;  //      value - added scalar
-;;  //      dst  - destination array: dst = src + value
-;;  //      mask - optional mask
-;;  //    Returns:
-;;  //F*/
-;;  OPENCVAPI  void  cvAddS( const CvArr* src, CvScalar value, CvArr* dst,
-;;                           const CvArr* mask CV_DEFAULT(0));
-
-(de cvAddS (src value dst mask)
-    ((-gptr- "const CvArr *") src mask)
-    ((-gptr- "CvScalar *") value)
-    ((-gptr- "CvArr *") dst)
-    #{ cvAddS($src, *$value, $dst, $mask);  #}
-    ())
-
-#? (cvSub <srca> <srcb> <dst> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSub
-;;  //    Purpose:    Subtracts one array from another
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcA - first source array
-;;  //      srcB - second source array 
-;;  //      dst  - destination array: dst = srcA - srcB
-;;  //    Returns:
-;;  //F*/
-;;  OPENCVAPI  void  cvSub( const CvArr* srcA, const CvArr* srcB, CvArr* dst,
-;;                          const CvArr* mask CV_DEFAULT(0));
-
-(de cvSub (srca srcb dst mask)
-    ((-gptr- "const CvArr *") srca srcb mask)
-    ((-gptr- "CvArr *") dst)
-    #{ cvSub($srca, $srcb, $dst, $mask);  #}
-    ())
-
-#? (cvSubS <src> <value> <dst> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSubS
-;;  //    Purpose:    Subtracts a scalar value from array
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source array
-;;  //      value - subtracted scalar
-;;  //      dst  - destination array: dst = src - value
-;;  //      mask - optional mask
-;;  //    Returns:
-;;  //F*/
-;;  CV_INLINE  void  cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
-;;                           const CvArr* mask CV_DEFAULT(0));
-;;  CV_INLINE  void  cvSubS( const CvArr* src, CvScalar value, CvArr* dst,
-;;                           const CvArr* mask )
-;;  {
-;;      cvAddS( src, cvScalar( -value.val[0], -value.val[1], -value.val[2], -value.val[3]),
-;;              dst, mask );
-;;  }
-
-(de cvSubS (src value dst mask)
-    ((-gptr- "const CvArr *") src mask)
-    ((-gptr- "CvScalar *") value)
-    ((-gptr- "CvArr *") dst)
-    #{ cvSubS($src, *$value, $dst, $mask);  #}
-    ())
-
-#? (cvSubRS <src> <value> <dst> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSubRS
-;;  //    Purpose:    Subtracts a scalar value from array
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source array
-;;  //      value - scalar to subtract from
-;;  //      dst  - destination array: dst = value - src
-;;  //      mask - optional mask
-;;  //    Returns:
-;;  //F*/
-;;  OPENCVAPI  void  cvSubRS( const CvArr* src, CvScalar value, CvArr* dst,
-;;                            const CvArr* mask CV_DEFAULT(0));
-
-(de cvSubRS (src value dst mask)
-    ((-gptr- "const CvArr *") src mask)
-    ((-gptr- "CvScalar *") value)
-    ((-gptr- "CvArr *") dst)
-    #{ cvSubRS($src, *$value, $dst, $mask);  #}
-    ())
-
-#? (cvMul <src1> <src2> <dst> <scale>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvMul
-;;  //    Purpose:    Multiplies two arrays
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src1 - first source array
-;;  //      src2 - second source array
-;;  //      dst  - destination array: dst(x,y) = srcA(x,y) * srcB(x,y)
-;;  //      scale- scale factor
-;;  //    Returns:
-;;  //F*/
-;;  OPENCVAPI  void  cvMul( const CvArr* srcA, const CvArr* srcB, CvArr* dst, double scale);
-
-(de cvMul (srca srcb dst scale)
-    ((-gptr- "const CvArr *") srca srcb)
-    ((-gptr- "CvArr *") dst)
-    ((-double-) scale)
-    #{ cvMul($srca, $srcb, $dst, $scale);  #}
-    ())
-
-
-#? * (cvinrange <src> <lower> <upper> <dst>)
-;;.PRE
-;;  /* dst(idx) = lower(idx) <= src(idx) < upper(idx) */
-;;  OPENCVAPI void cvInRange( const CvArr* src, const CvArr* lower,
-;;                            const CvArr* upper, CvArr* dst );
-
-;; Jie's comments: (5/9/2002) 
-;; are "opencvInRange" and "cvInRangeS" implemented at all?
-
-(de cvInRange (src lower upper  dst)
-    ((-gptr- "const CvArr *") src lower upper)
-    ((-gptr- "CvArr *") dst)
-    #{ cvInRange($src, $lower, $upper, $dst);  #}
-    ())
-
-
-#? * (cvinranges <src> <lower> <upper> <dst>)
-;;.PRE
-;;  /* dst(idx) = lower <= src(idx) < upper */
-;;  OPENCVAPI void cvInRangeS( const CvArr* src, CvScalar lower,
-;;                             CvScalar upper, CvArr* dst );
-
-(de cvInRangeS (src lower upper  dst)
-    ((-gptr- "const CvArr *") src)
-    ((-gptr- "CvScalar *") lower upper)
-    ((-gptr- "CvArr *") dst)
-    #{ cvInRangeS($src, *$lower, *$upper, $dst);  #}
-    ())
-
-
-;;  /****************************************************************************************\
-;;  *                                      Logic Operations                                  *
-;;  \****************************************************************************************/
-
-#? * (cvand <src1> <src2> <dst> <mask>)
-;;.PRE
-;;  /* dst(idx) = src1(idx) & src2(idx) */
-;;  OPENCVAPI void cvAnd( const CvArr* src1, const CvArr* src2,
-;;                        CvArr* dst, const CvArr* mask CV_DEFAULT(0));
-
-(de cvAnd (src1 src2 dst mask)
-    ((-gptr- "const CvArr *") src1 src2 mask)
-    ((-gptr- "CvArr *") dst)
-    #{ cvAnd($src1, $src2, $dst, $mask); #}
-    ())
-
-#? * (cvands <src> <value> <dst> <mask>)
-;;.PRE
-;;  /* dst(idx) = src(idx) & value */
-;;  OPENCVAPI void cvAndS( const CvArr* src, CvScalar value,
-;;                         CvArr* dst, const CvArr* mask CV_DEFAULT(0));
-
-(de cvAndS (src value dst mask)
-    ((-gptr- "const CvArr *") src mask)
-    ((-gptr- "CvScalar *") value)
-    ((-gptr- "CvArr *") dst)
-    #{  cvAndS($src, *$value, $dst, $mask); #}
-    ())
-
-#? * (cvor <src1> <src2> <dst> <mask>)
-;;.PRE
-;;  /* dst(idx) = src1(idx) | src2(idx) */
-;;  OPENCVAPI void cvOr( const CvArr* src1, const CvArr* src2,
-;;                       CvArr* dst, const CvArr* mask CV_DEFAULT(0));
-
-(de cvOr (src1 src2 dst mask)
-    ((-gptr- "const CvArr *") src1 src2 mask)
-    ((-gptr- "CvArr *") dst)
-    #{ cvOr($src1, $src2, $dst, $mask); #}
-    ())
-
-#? * (cvors <src> <value> <dst> <mask>)
-;;.PRE
-;;  /* dst(idx) = src(idx) | value */
-;;  OPENCVAPI void cvOrS( const CvArr* src, CvScalar value,
-;;                        CvArr* dst, const CvArr* mask CV_DEFAULT(0));
-
-(de cvOrS (src value dst mask)
-    ((-gptr- "const CvArr *") src mask)
-    ((-gptr- "CvScalar *") value)
-    ((-gptr- "CvArr *") dst)
-    #{  cvOrS($src, *$value, $dst, $mask); #}
-    ())
-
-
-#? * (cvxor <src1> <src2> <dst> <mask>)
-;;.PRE
-;;  /* dst(idx) = src1(idx) ^ src2(idx) */
-;;  OPENCVAPI void cvXor( const CvArr* src1, const CvArr* src2,
-;;                        CvArr* dst, const CvArr* mask CV_DEFAULT(0));
-
-(de cvXor (src1 src2 dst mask)
-    ((-gptr- "const CvArr *") src1 src2 mask)
-    ((-gptr- "CvArr *") dst)
-    #{ cvXor($src1, $src2, $dst, $mask); #}
-    ())
-
-#? * (cvxors <src> <value> <dst> <mask>)
-;;.PRE
-;;  /* dst(idx) = src(idx) ^ value */
-;;  OPENCVAPI void cvXorS( const CvArr* src, CvScalar value,
-;;                         CvArr* dst, const CvArr* mask CV_DEFAULT(0));
-
-(de cvXorS (src value dst mask)
-    ((-gptr- "const CvArr *") src mask)
-    ((-gptr- "CvScalar *") value)
-    ((-gptr- "CvArr *") dst)
-    #{  cvXorS($src, *$value, $dst, $mask); #}
-    ())
-
-#? (cvScaleAdd <src1> <scale> <src2> <dst>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvScaleAdd
-;;  //    Purpose:    Multiplies all array elements by a scalar value and
-;;  //                adds another scalar to the scaled array
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source array
-;;  //      scale - scale factor
-;;  //      delta - shift value
-;;  //      dst - destination array
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  void  cvScaleAdd( const CvArr* src1, CvScalar scale,
-;;                               const CvArr* src2, CvArr* dst );
-
-(de cvScaleAdd( src1 scale src2 dst)
-    ((-gptr- "const CvArr *") src1 src2)
-    ((-gptr- "CvScalar *") scale)
-    ((-gptr- "CvArr *") dst)
-    #{ cvScaleAdd($src1, *$scale, $src2, $dst); #}
-    ())
-
-
-#? * (cvmatmuladds <src> <dst> <transform> <shiftvec>)
-;;.PRE
-;;  #define cvMulAddS cvScaleAdd
-
-(de cvMulAddS( src1 scale src2 dst)
-    ((-gptr- "const CvArr *") src1 src2)
-    ((-gptr- "CvScalar *") scale)
-    ((-gptr- "CvArr *") dst)
-    #{ cvScaleAdd($src1, *$scale, $src2, $dst); #}
-    ())
-
-#? (cvDotProduct  <srca> <srcb>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvDotProduct
-;;  //    Purpose:    Evaluates dot product of two vectors
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcA - first source array
-;;  //      srcB - second source array
-;;  //
-;;  //    Returns:
-;;  //      Dot product of srcA and srcB:  sum(srcA(i,j)*srcB(i,j))
-;;  //                                     i,j
-;;  //F*/
-;;  OPENCVAPI  double  cvDotProduct( const CvArr* srcA, const CvArr* srcB );
-
-(de cvDotProduct ( srca srcb)
-    ((-gptr- "const CvArr *") srca srcb)
-    (let ((s 0))
-      ((-double-) s)
-      #{ $s = cvDotProduct($srca, $srcb); #}
-      s))
-
-#? (cvCrossProduct <srca> <srcb> <dst>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvCrossProduct
-;;  //    Purpose:    Evaluates cross product of two 3d vectors
-;;  //    Context:
-;;  //    Parameters: srcA - first source vector
-;;  //                srcB - second source vector
-;;  //                dst  - destination vector
-;;  //    Returns:
-;;  //
-;;  //F*/
-;;  OPENCVAPI  void  cvCrossProduct( const CvArr* srcA, const CvArr* srcB, CvArr* dst );
-
-(de cvCrossProduct (srca srcb dst)
-    ((-gptr- "const CvArr *") srca srcb)
-    ((-gptr- "CvArr *") dst)
-    #{ cvCrossProduct($srca, $srcb, $dst); #}
-    ())
-
-
-#? (cvMatMulAdd <srca> <srcb> <srcc> <dst>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvMatMulAdd
-;;  //    Purpose:    Evaluates product of two matrices and
-;;  //                adds the third matrix to the product
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcA - first source matrix
-;;  //      srcB - second source matrix
-;;  //      srcC - added matrix
-;;  //      dst  - destination matrix
-;;  //    Returns:
-;;  //
-;;  //F*/
-;;  OPENCVAPI  void  cvMatMulAdd( const CvArr* srcA, const CvArr* srcB,
-;;                                const CvArr* srcC, CvArr* dst );
-(de cvMatMulAdd (srca srcb srcc dst)
-    ((-gptr- "const CvArr *") srca srcb srcc)
-    ((-gptr- "CvArr *") dst)
-    #{ cvMatMulAdd($srca, $srcb, $srcc, $dst); #}
-    ())
-
-
-#? (cvMatMulAddS  <src> <dst> <transform> <shiftvec>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvMatMulAddS
-;;  //    Purpose:    Performs matrix transformation for every vector of the source array
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcr - source array
-;;  //      dst  - destination array
-;;  //      transform - transformation matrix
-;;  //      shiftvec - optional shift (may be encoded in the matrix as well)
-;;  //    Returns:
-;;  //
-;;  //F*/
-;;  OPENCVAPI  void  cvMatMulAddS( const CvArr* src, CvArr* dst,
-;;                                 const CvArr* transform,
-;;                                 const CvArr* shiftvec CV_DEFAULT(0));
-
-(de cvMatMulAddS ( src dst transform shiftvec)
-    ((-gptr- "const CvArr *") src transform shiftvec)
-    ((-gptr- "CvArr *") dst)
-    #{ cvMatMulAddS($src, $dst, $transform, $shiftvec); #}
-    ())
-
-#? (cvMulTransposed <srcarr> <dstarr> <order>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvMulTransposed
-;;  //    Purpose:    Evaluates product of matix by itself transposed
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcarr - the source matrix
-;;  //      dstarr - the destination matrix
-;;  //      order - determines the order of multiplication
-;;  //              if order = 0, function evaluates A*At
-;;  //              if order = 1, function evaluates At*A
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI void cvMulTransposed( const CvArr* srcarr,
-;;                                  CvArr* dstarr, int order );
-
-(de cvMulTransposed (srcarr dstarr order)
-    ((-gptr- "const CvArr *") srcarr)
-    ((-gptr- "CvArr *") dstarr)
-    ((-int-) order)
-    #{ cvMulTransposed($srcarr, $dstarr, $order, NULL, 1.); #}
-    ())
-
-#? (cvTranspose <src> <dst>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvTranspose
-;;  //    Purpose:    Transposes matrix
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source matrix
-;;  //      dst - destination matrix
-;;  //    Returns:
-;;  //    Notes:
-;;  //      square matrices can be transposed in-place.
-;;  //F*/
-;;  OPENCVAPI  void  cvTranspose( const CvArr* src, CvArr* dst );
-
-(de cvTranspose (src dst)
-    ((-gptr- "const CvArr *") src)
-    ((-gptr- "CvArr *") dst)
-    #{  cvTranspose($src, $dst); #}
-    ())
-
-;;  #define cvT cvTranspose
-
-(de cvT (src dst)
-    ((-gptr- "const CvArr *") src)
-    ((-gptr- "CvArr *") dst)
-    #{  cvTranspose($src, $dst); #}
-    ())
-
-#? (cvFlip <src> <dst> <flipmode>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvFlip
-;;  //    Purpose:    Mirrors the matrix around vertical or horizontal axis
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source matrix
-;;  //      dst - destination matrix
-;;  //      flipAxis - 0: horizontal axis
-;;  //                 1: vertical axis
-;;  //                -1: both axis
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  void  cvFlip( const CvArr* src, CvArr* dst, int flip_mode );
-
-(de cvFlip (src dst flipmode)
-    ((-gptr- "const CvArr *") src)
-    ((-gptr- "CvArr *") dst)
-    ((-int-) flipmode)
-    #{ cvFlip ($src, $dst, $flipmode); #}
-    ())
-
-
-#? * (cvmirror <src> <dst> <flipmode>)
-;;.PRE
-;;  #define cvMirror cvFlip
-
-(de cvMirror (src dst flipmode)
-    ((-gptr- "const CvArr *") src)
-    ((-gptr- "CvArr *") dst)
-    ((-int-) flipmode)
-    #{ cvFlip ($src, $dst, $flipmode); #}
-    ())
-
-#? (cvInvert  <src> <dst>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvInvert
-;;  //    Purpose:    Inverts Matrix using LU decomposition
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source matrix
-;;  //      dst - destination matrix
-;;  //    Returns:
-;;  //      1 if the matrix inverted and 0 if it is a singular (or very close to it)
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  int  cvInvert( const CvArr* src, CvArr* dst );
-
-(de cvInvert ( src dst )
-    ((-gptr- "const CvArr *") src)
-    ((-gptr- "CvArr *") dst)
-    (let ((s 0))
-      ((-int-) s)
-      #{ $s = cvInvert($src, $dst, CV_LU); #}
-      s))
-
-;(defalias cvInv cvInvert)
-
-#? (cvSolve  <a> <b> <x>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSolve
-;;  //    Purpose:    Solves linear system Ax = b using LU decomposition
-;;  //    Context:
-;;  //    Parameters:
-;;  //      A - the matrix
-;;  //      b - the "right side" of the system
-;;  //      x - destination array (solution of the system)
-;;  //    Returns:
-;;  //      1 if the system is solved and 0 if the matrix is a singular (or very close to it)
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  int  cvSolve( const CvArr* A, const CvArr* b, CvArr* x );
-
-(de cvSolve ( a b x)
-    ((-gptr- "const CvArr *") a b)
-    ((-gptr- "CvArr *") x)
-    (let ((s 0))
-      ((-int-) s)
-      #{ $s = cvSolve ($a, $b, $x, CV_LU); #}
-      s))
-
-#? (cvDetmat <mat>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvDet
-;;  //    Purpose:    Calculates determinant of the matrix
-;;  //    Context:
-;;  //    Parameters:
-;;  //      mat - source matrix
-;;  //    Returns:
-;;  //      Matrix determinant
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  double cvDet( const CvArr* mat );
-
-(de cvDet (mat)
-    ((-gptr- "const CvArr *") mat)
-    (let ((s 0))
-      ((-double-) s)
-      #{ $s = cvDet($mat); #}
-      s))
-
-#? (cvTracemat <s>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvTrace
-;;  //    Purpose:    Calculates trace of the matrix (sum of elements on the main diagonal) 
-;;  //    Context:
-;;  //    Parameters:
-;;  //      mat - source matrix
-;;  //    Returns:
-;;  //      Matrix determinant
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  CvScalar cvTrace( const CvArr* mat );
-
-(de cvTrace(mat s)
-    ((-gptr- "const CvArr *") mat)
-    ((-gptr- "CvScalar *") s)
-    #{ { CvScalar tmp;
-    tmp = cvTrace($mat);
-    memcpy($s, &tmp, sizeof(CvScalar));
-    } #}
-    ())
-
-#? (cvSVD  <a> <w> <u> <v> <flag>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSVD
-;;  //    Purpose:    Calculates Singular Value Decomposition for the input matrix: 
-;;  //       A = U W V',   U & V are orthogonal, W is diagonal matrix that can be
-;;  //                     either real matrix (the same size as A) or a vector of
-;;  //                     size min(A->rows,A->cols).
-;;  //       U & V are optional,
-;;  //       flags:  0th bit, reset to 0, means that A is copyied before processing,
-;;  //                        otherwise it is modified during the processing, which is
-;;  //                        faster.
-;;  //               1st bit, reset to 0, means that U is returned normal, otherwise it
-;;  //                        is returned transposed, which is faster.
-;;  //               2nd bit, reset to 0, means that V is returned normal, otherwise it
-;;  //                        is returned transposed, which is faster.
-;;  //F*/
-;;  OPENCVAPI  void   cvSVD( CvArr* A, CvArr* W CV_DEFAULT(0),
-;;                           CvArr* U CV_DEFAULT(0),
-;;                           CvArr* V CV_DEFAULT(0),
-;;                           int flag CV_DEFAULT(0));
-(de cvSVD ( a w u v flag)
-    ((-gptr- "CvArr *") a w u v)
-    ((-int-) flag)
-    #{ cvSVD($a, $w, $u, $v, $flag); #}
-    ())
-
-
-#? (cvPseudoInverse  <a> <b>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvPseudoInv
-;;  //    Purpose:    Calculates inverse or pseudo-inverse matrix for the input matrix.
-;;  //       if A is (m x n) matrix, B will be (n x m) matrix, such that
-;;  //       AB = I(m x m), BA = I(n x n).
-;;  //
-;;  //    Return value:
-;;  //       The function returns condition number or DBL_MAX if the matrix is signular.
-;;  //F*/
-;;  OPENCVAPI  double  cvPseudoInverse( CvArr* A, CvArr* B);
-
-(de cvPseudoInverse ( a b)
-    ((-gptr- "CvArr *") a b)
-    (let ((s 0))
-      ((-double-) s)
-      #{ $s = cvInvert($a, $b, CV_SVD); #}
-      s))
-
-;(defalias cvPseudoInv cvPseudoInverse)
-
-
-#? (cvEigenVV  <src> <evects> <evals> <eps>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvEigenVV
-;;  //    Purpose:    Finds eigenvalues & eigenvectors of a symmetric matrix:
-;;  //    Context:
-;;  //    Parameters:
-;;  //      src - source symmetric matrix,
-;;  //      evects - matrix of its eigenvectors
-;;  //               (i-th row is an i-th eigenvector),
-;;  //      evals - vector of its eigenvalues
-;;  //              (i-th element is an i-th eigenvalue),
-;;  //      eps - accuracy of diagonalization.
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  void  cvEigenVV( CvArr* src, CvArr* evects, CvArr* evals, double eps );
-
-(de cvEigenVV ( src evects evals eps)
-    ((-gptr- "CvArr *") src evects evals)
-    ((-double-) eps)
-    #{ cvEigenVV($src, $evects, $evals, $eps); #}
-    ())
-
-#? (cvSetZero  <mat> )
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSetZero
-;;  //    Purpose:    Clears all the matrix elements (sets them to 0)
-;;  //    Context:
-;;  //    Parameters: mat  - matrix
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  void  cvSetZero( CvArr* mat );
-
-(de cvSetZero ( mat )
-    ((-gptr- "CvArr *") mat)
-    #{ cvSetZero($mat); #}
-    ())
-
-
-#? * (cvzero <mat>)
-;;.PRE
-;;  #define cvZero  cvSetZero
-
-(de cvZero ( mat )
-    ((-gptr- "CvArr *") mat)
-    #{ cvSetZero($mat); #}
-    ())
-
-#? (cvSetIdentity  <mat> <value>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvSetIdentity
-;;  //    Purpose:    Fills identity matrix
-;;  //    Context:
-;;  //    Parameters:
-;;  //      mat - matrix
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  void  cvSetIdentity( CvArr* mat );
-
-(de cvSetIdentity ( mat )
-    ((-gptr- "CvArr *") mat)
-    #{ cvSetIdentity($mat, cvRealScalar(1)); #}
-    ())
-
-#? (cvMahalanobis  <srca> <srcb> <mat>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvMahalanobis
-;;  //    Purpose:    Calculates Mahalanobis(weighted) distance.
-;;  //    Context:
-;;  //    Parameters:
-;;  //      srcA - first source vector
-;;  //      srcB - second source vector
-;;  //      matr - covariance matrix
-;;  //    Returns:
-;;  //      Mahalanobis distance
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  double  cvMahalanobis( const CvArr* srcA, const CvArr* srcB, CvArr* mat );
-
-(de cvMahalanobis ( srca srcb mat)
-     ((-gptr- "const CvArr *") srca srcb)
-     ((-gptr- "CvArr *") mat)
-     (let ((s 0))
-       ((-double-) s )
-       #{ $s = cvMahalanobis($srca, $srcb, $mat); #}
-       s))
-
-;;  #define cvMahalonobis  cvMahalanobis
-
-(de cvMahalonobis ( srca srcb mat)
-     ((-gptr- "const CvArr *") srca srcb)
-     ((-gptr- "CvArr *") mat)
-     (let ((s 0))
-       ((-double-) s )
-       #{ $s = cvMahalanobis($srca, $srcb, $mat); #}
-       s))
-
-#? (cvPerspectiveTransform <src> <dst> <mat>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //    Name:       cvPerspectiveTransform
-;;  //    Purpose:    Applies perspective transform to the array of vectors
-;;  //    Context:
-;;  //    Parameters: mat - matrix
-;;  //                src - source array
-;;  //                dst - destination array
-;;  //    Returns:
-;;  //    Notes:
-;;  //F*/
-;;  OPENCVAPI  void  cvPerspectiveTransform( const CvArr* src, CvArr* dst, const CvArr* mat );
-
-(de cvPerspectiveTransform (src dst mat)
-    ((-gptr- "const CvArr *") src mat)
-    ((-gptr- "CvArr *") dst)
-    #{ cvPerspectiveTransform ($src, $dst, $mat); #}
-    ())
-;; ********************************************************
-
-(dhc-make ()
-  dummy_matrix
-  cvadd
-  cvadds
-  cvsub
-  cvsubs
-  cvsubrs
-  cvmul
-;;  cvinrange
-;;  cvinranges
-  cvand
-  cvands
-  cvor
-  cvors
-  cvxor
-  cvxors
-  cvscaleadd
-  cvmuladds
-  cvdotproduct
-  cvcrossproduct
-  cvmatmuladd
-  cvmatmuladds
-  cvmultransposed
-  cvtranspose
-  cvt
-  cvflip
-  cvmirror
-  cvinvert
-  cvsolve
-  cvdet
-  cvtrace
-  cvsvd
-  cvpseudoinverse
-  cveigenvv
-  cvsetzero
-  cvzero
-  cvsetidentity
-  cvmahalanobis
-  cvmahalonobis
-  cvperspectivetransform
-)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/opencv.hlp lush-cvs/packages/opencv/opencv.hlp
--- lush/packages/opencv/opencv.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/opencv.hlp	2007-09-02 21:32:58.000000000 -0400
@@ -45,7 +45,7 @@
 #? ** << opencv/hough.lsh
 #? ** << opencv/kalman.lsh
 #? ** << opencv/libutils.lsh
-#? ** << opencv/matrix.lsh
+#? ** << opencv/cvmatrix.lsh
 #? ** << opencv/memstorage.lsh
 #? ** << opencv/moments.lsh
 #? ** << opencv/morphology.lsh
@@ -54,7 +54,7 @@
 #? ** << opencv/posit.lsh
 #? ** << opencv/pyramids.lsh
 #? ** << opencv/snake.lsh
-#? ** << opencv/statistics.lsh
+#? ** << opencv/cv-statistics.lsh
 #? ** << opencv/subdiv.lsh
 #? ** << opencv/thresholds.lsh
 #? ** << opencv/undistortion.lsh
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/opencv.lsh lush-cvs/packages/opencv/opencv.lsh
--- lush/packages/opencv/opencv.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/opencv.lsh	2007-09-02 21:32:58.000000000 -0400
@@ -32,7 +32,7 @@
 (libload "opencv/hough.lsh")
 (libload "opencv/kalman.lsh")
 ;(libload "opencv/libutils.lsh")
-(libload "opencv/matrix.lsh")
+(libload "opencv/cvmatrix.lsh")
 (libload "opencv/memstorage.lsh")
 (libload "opencv/moments.lsh")
 (libload "opencv/morphology.lsh")
@@ -41,7 +41,7 @@
 (libload "opencv/posit.lsh")
 (libload "opencv/pyramids.lsh")
 (libload "opencv/snake.lsh")
-(libload "opencv/statistics.lsh")
+(libload "opencv/cv-statistics.lsh")
 (libload "opencv/subdiv.lsh")
 (libload "opencv/thresholds.lsh")
 (libload "opencv/undistortion.lsh")
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opencv/statistics.lsh lush-cvs/packages/opencv/statistics.lsh
--- lush/packages/opencv/statistics.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opencv/statistics.lsh	1969-12-31 19:00:00.000000000 -0500
@@ -1,201 +0,0 @@
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;
-;;; LUSH Lisp Universal Shell
-;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
-;;; Includes parts of TL3:
-;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
-;;; Includes selected parts of SN3.2:
-;;;   Copyright (C) 1991-2001 AT&T Corp.
-;;;
-;;; Includes information derived from the GSL (Gnu Scientific Library)
-;;;   header files which are copyrighted and distributed under the GPL
-;;;   by their respective authors.
-;;;
-;;; 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.
-;;;
-;;; 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, USA
-;;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(libload "opencv/cv-config")
-
-
-
-#? *** statistics
-
-;; dummy function that adds OpenCV C header files in C file
-(eval `(de dummy_statistics () ,cv-cpheader-cmd ()))
-
-;; #? * (dummy_statistics)
-;; #? * (cvsum <array> <s>)
-;; #? * (cvcountnonzero <array>)
-;; #? * (cvavg <array> <mask> <s>)
-;; #? * (cvavgsdv <array> <mean> <std_dev> <mask>)
-;; #? * (cvminmaxloc <array> <min_val> <max_val> <min_loc> <max_loc> <mask>)
-
-;; ********************************************************
-
-;;  /****************************************************************************************\
-;;  *      Image statistics functions support the next image formats:                        *
-;;  *         single-channel: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_32F                      *
-;;  *         three-channel: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_32F (COI must be != 0)    *
-;;  \****************************************************************************************/
-
-#? (cvSum  <array> <s>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //
-;;  //    Name:    cvSum
-;;  //    Purpose:
-;;  //      Sums all the elements in the image ROI or in the matrix
-;;  //    Context:
-;;  //    Parameters:
-;;  //        array - image or matrix.
-;;  //    Returns:
-;;  //        sum of every channel.
-;;  //    Note:
-;;  //        In case of COI is set the sum over the selected channel is saved
-;;  //        if the 0-th element of the returned CvScalar structure.
-;;  //F*/
-;;  OPENCVAPI  CvScalar  cvSum( const CvArr* array );
-
-(de cvSum (array s)
-    ((-gptr- "const CvArr *") array)
-    ((-gptr- "CvScalar *") s)
-    #{ {
-    CvScalar tmp;
-    tmp=cvSum($array);
-    memcpy($s,&tmp,sizeof(CvScalar));
-    } #}
-    ())
-    
-#? (cvCountNonZero <array>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //
-;;  //    Name:    cvCountNonZero
-;;  //    Purpose:
-;;  //        Counts all the non-zero elements in the image ROI or in the matrix
-;;  //    Context:
-;;  //    Parameters:
-;;  //        array - image or matrix.
-;;  //    Returns:
-;;  //        count of non-zero pixels
-;;  //    Note:
-;;  //        For multi-channel images COI must be set.
-;;  //F*/
-;;  OPENCVAPI  int  cvCountNonZero( const CvArr* array );
-
-(de cvCountNonZero(array)
-    ((-gptr- "const CvArr *") array)
-    (let ((s 0))
-      ((-int-) s)
-      #{ $s = cvCountNonZero($array); #}
-      s))
-
-#? (cvAvg <array> <mask> <s>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //
-;;  //    Name:    cvAvg
-;;  //    Purpose:
-;;  //      Calculates average value of the image region or the matrix.
-;;  //    Context:
-;;  //    Parameters:
-;;  //        array - input image or matrix.
-;;  //        mask - optional parameter: 8uC1 or 8sC1 array that specifies
-;;  //               the processed region of the input array
-;;  //    Returns:
-;;  //        average value for every channel. In case of COI is set, average value
-;;  //        of the selected COI is stored into 0-th element
-;;  //        of the returned CvScalar structure
-;;  //F*/
-;;  OPENCVAPI  CvScalar  cvAvg( const CvArr* array, const CvArr* mask CV_DEFAULT(0) );
-
-(de cvAvg(array mask s)
-    ((-gptr- "const CvArr *") array)
-    ((-gptr- "const CvArr *") mask)
-    ((-gptr- "CvScalar *") s)
-    #{ { CvScalar tmp;
-    tmp = cvAvg($array, $mask);
-    memcpy($s, &tmp, sizeof(CvScalar));
-    } #}
-    ())
-
-#? (cvAvgSdv  <array> <mean> <std_dev> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //
-;;  //    Name:    cvAvgSdv
-;;  //    Purpose:
-;;  //      Calculates mean and standard deviation of pixels in the image region
-;;  //    Context:
-;;  //    Parameters:
-;;  //        img - input image.
-;;  //        mean - mean value
-;;  //        std_dev - standard deviation
-;;  //        mask - mask(byte-depth, single channel)
-;;  //    Returns:
-;;  //
-;;  //F*/
-;;  OPENCVAPI  void  cvAvgSdv( const CvArr* array, CvScalar* mean, CvScalar* std_dev,
-;;                             const CvArr* mask CV_DEFAULT(0) );
-
-(de cvAvgSdv( array mean std_dev mask)
-    ((-gptr- "const CvArr *") array mask)
-    ((-gptr- "CvScalar *") mean std_dev)
-    #{ cvAvgSdv($array, $mean, $std_dev, $mask); #}
-    ())
- 
-#? (cvMinMaxLoc  <array> <min_val> <max_val> <min_loc> <max_loc> <mask>)
-;;.VP
-;;  /*F///////////////////////////////////////////////////////////////////////////////////////
-;;  //
-;;  //    Name:    cvMinMaxLoc
-;;  //    Purpose:
-;;  //      Finds minimum and maximum pixel values in the image region
-;;  //      and determines their locations.
-;;  //    Context:
-;;  //    Parameters:
-;;  //        img - input image.
-;;  //        minVal - minimum value
-;;  //        maxVal - maximum value
-;;  //        minLoc - location of the minimum
-;;  //        maxLoc - location of the maximum
-;;  //        mask - mask(byte-depth, single channel)
-;;  //    Returns:
-;;  //    Note:
-;;  //      If there are several global minimums and/or maximums,
-;;  //      function returns the most top-left extremums.
-;;  //F*/
-;;  OPENCVAPI  void  cvMinMaxLoc( const CvArr* array, double* min_val, double* max_val,
-;;                                CvPoint* min_loc CV_DEFAULT(0),
-;;                                CvPoint* max_loc CV_DEFAULT(0),
-;;                                const CvArr* mask CV_DEFAULT(0) );
-
-(de cvMinMaxLoc (array min_val max_val min_loc max_loc mask)
-    ((-gptr- "const CvArr *") array mask)
-    ((-gptr- "double *") min_val max_val)
-    ((-gptr- "CvPoint *") min_loc max_loc)
-    #{ cvMinMaxLoc($array, $min_val, $max_val, $min_loc, $max_loc, $mask);  #}
-    ())
-;; ********************************************************
-
-(dhc-make ()
-  dummy_statistics
-  cvsum
-  cvcountnonzero
-  cvavg
-  cvavgsdv
-  cvminmaxloc
-)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/nehe_tutorial/00_miniglut.lsh lush-cvs/packages/opengl/nehe_tutorial/00_miniglut.lsh
--- lush/packages/opengl/nehe_tutorial/00_miniglut.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opengl/nehe_tutorial/00_miniglut.lsh	2007-05-23 12:20:53.000000000 -0400
@@ -0,0 +1,21 @@
+;; Fu Jie Huang, May 2007
+;; a minimal glut window demo
+
+(libload "opengl/glut")
+
+;; create an instance of glutwindow
+(defvar mini-glut (new glutwindow))
+
+;; minimal window setup, note that there is no glut main loop.
+(glut-init-display-mode  @(bitor @GLUT_RGBA @GLUT_DEPTH @GLUT_DOUBLE))
+(==> mini-glut create 0 0 400 400 "minimal glut window")
+
+;; clear the background
+(glClearColor 0.0 0.0 0.0 0.0)
+(glClear @(bitor @GL_COLOR_BUFFER_BIT  @GL_DEPTH_BUFFER_BIT))
+(glut-swap-buffers) 
+
+
+
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/nehe_tutorial/00_simpleglut.lsh lush-cvs/packages/opengl/nehe_tutorial/00_simpleglut.lsh
--- lush/packages/opengl/nehe_tutorial/00_simpleglut.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opengl/nehe_tutorial/00_simpleglut.lsh	2007-05-23 12:20:54.000000000 -0400
@@ -0,0 +1,30 @@
+;; Fu Jie Huang, May 2007
+;; glut window demo
+
+(libload "opengl/glut")
+
+;; lush glut usage pattern: 
+;;    inherit from class "glutwindow"
+;;    put initilazation code in the constructor
+
+(defclass simple-glut glutwindow)
+
+(defmethod simple-glut simple-glut()
+  (glut-init-display-mode  @(bitor @GLUT_RGBA @GLUT_DEPTH @GLUT_DOUBLE))
+  (==> this create 0 0 400 400 "minimal glut window")
+  ())
+
+(defvar glut-demo-win (new simple-glut))
+
+(glClearColor 0.0 0.0 0.0 0.0)
+(glClear @(bitor @GL_COLOR_BUFFER_BIT  @GL_DEPTH_BUFFER_BIT))
+(glut-swap-buffers) 
+
+;; since the two methods "glut-reshape" and "glut-display" inherited 
+;; are empty, the window doesn't responding properly to resizing
+
+
+
+
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/nehe_tutorial/01_glut.lsh lush-cvs/packages/opengl/nehe_tutorial/01_glut.lsh
--- lush/packages/opengl/nehe_tutorial/01_glut.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opengl/nehe_tutorial/01_glut.lsh	2007-05-23 12:20:54.000000000 -0400
@@ -0,0 +1,32 @@
+;; Fu Jie Huang, May 2007
+;; glut window demo
+
+(libload "opengl/glut")
+
+;; to handle window resizing, you need to 
+;; override two methods: 
+;;    glut-reshape 
+;;    glut-display
+
+(defclass glut-win glutwindow)
+
+(defmethod glut-win glut-win()
+  (glut-init-display-mode  @(bitor @GLUT_RGBA @GLUT_DEPTH @GLUT_DOUBLE))
+  (==> this create 0 0 400 400 "minimal glut window")
+  (glClearColor 0.0 0.0 0.0 0.0)
+  ())
+
+(defmethod glut-win glut-reshape(w h)
+  (glViewport 0 0 w h)
+  ())
+
+(defmethod glut-win glut-display()
+  (glClear @(bitor @GL_COLOR_BUFFER_BIT  @GL_DEPTH_BUFFER_BIT))
+  (glut-swap-buffers) 
+  ()) 
+
+(defvar glut-demo-win (new glut-win))
+
+
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/nehe_tutorial/06_texture.lsh lush-cvs/packages/opengl/nehe_tutorial/06_texture.lsh
--- lush/packages/opengl/nehe_tutorial/06_texture.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opengl/nehe_tutorial/06_texture.lsh	2007-05-25 01:28:59.000000000 -0400
@@ -0,0 +1,123 @@
+;; Fu Jie Huang, May 2007
+
+;; texture mapping demo
+
+(libload "opengl/glut")
+(libload "libimage/image-io")
+
+(defclass glut-win glutwindow
+  ((-float-) xrot  yrot  zrot))
+
+(defmethod glut-win glut-win()
+  (glut-init-display-mode  @(bitor @GLUT_RGBA @GLUT_DEPTH @GLUT_DOUBLE))
+  (==> this create 0 0 400 400 "texture mapping")
+
+  (let ((image (image-read-rgba "nehe.png")))
+    (glPixelStorei @GL_UNPACK_ALIGNMENT  1)
+    (glTexImage2D  @GL_TEXTURE_2D 
+		   0 3 
+		   (idx-dim image 0) (idx-dim image 1)
+		   0 @GL_RGBA 
+		   @GL_UNSIGNED_BYTE 
+		   (idx-ptr image)))
+
+  (glTexParameterf @GL_TEXTURE_2D @GL_TEXTURE_WRAP_S @GL_REPEAT)
+  (glTexParameterf @GL_TEXTURE_2D @GL_TEXTURE_WRAP_T @GL_REPEAT)
+  (glTexParameterf @GL_TEXTURE_2D @GL_TEXTURE_MAG_FILTER
+		   @GL_NEAREST)
+  (glTexParameterf @GL_TEXTURE_2D @GL_TEXTURE_MIN_FILTER 
+		   @GL_NEAREST)
+  (glTexEnvf @GL_TEXTURE_ENV @GL_TEXTURE_ENV_MODE @GL_DECAL)
+  (glEnable @GL_TEXTURE_2D)
+
+  (glClearColor 0.0 0.0 0.0 0.0)
+
+  (glClearDepth 1.0)			
+  (glDepthFunc @GL_LESS)		
+  (glEnable @GL_DEPTH_TEST)		
+
+  (glShadeModel @GL_SMOOTH)		
+	
+  (glMatrixMode @GL_PROJECTION)
+  (glLoadIdentity)			
+  (gluPerspective 45.0 1.0 0.1 100.0)
+  (glMatrixMode @GL_MODELVIEW)
+
+  (setq xrot 0)
+  (setq yrot 0)
+  (setq zrot 0)
+  ())
+
+(defmethod glut-win glut-reshape(w h)
+  ((-int-) w h)
+  (glViewport 0 0 w h)
+
+  (glMatrixMode @GL_PROJECTION)
+  (glLoadIdentity)			
+  (gluPerspective 45.0 (/ w h) 0.1 100.0)
+  (glMatrixMode @GL_MODELVIEW)
+  ())
+
+(defmethod glut-win glut-display()
+  (glClear @(bitor @GL_COLOR_BUFFER_BIT  @GL_DEPTH_BUFFER_BIT))
+
+  (glLoadIdentity)			
+  (glTranslatef 0.0 0.0 -5.0)		
+
+  (glRotatef   xrot  1.0 0.0 0.0)		
+  (glRotatef   yrot  0.0 1.0 0.0)		
+  (glRotatef   zrot  0.0 0.0 1.0)		
+    
+  (glBegin @GL_QUADS)
+
+  (glTexCoord2f 0.0 0.0)  (glVertex3f  -1.0 -1.0 1.0)
+  (glTexCoord2f 1.0 0.0)  (glVertex3f  1.0 -1.0  1.0)
+  (glTexCoord2f 1.0 1.0)  (glVertex3f  1.0  1.0  1.0)
+  (glTexCoord2f 0.0 1.0)  (glVertex3f -1.0  1.0  1.0)
+
+  (glTexCoord2f 1.0 0.0)  (glVertex3f  -1.0 -1.0 -1.0)
+  (glTexCoord2f 1.0 1.0)  (glVertex3f  -1.0  1.0  -1.0)
+  (glTexCoord2f 0.0 1.0)  (glVertex3f  1.0  1.0  -1.0)
+  (glTexCoord2f 0.0 0.0)  (glVertex3f -1.0  -1.0  -1.0)
+
+  (glTexCoord2f 0.0 1.0)  (glVertex3f  -1.0 1.0 -1.0)
+  (glTexCoord2f 0.0 0.0)  (glVertex3f  -1.0 1.0  1.0)
+  (glTexCoord2f 1.0 0.0)  (glVertex3f  1.0  1.0  1.0)
+  (glTexCoord2f 1.0 1.0)  (glVertex3f 1.0  1.0  -1.0)
+
+  (glTexCoord2f 1.0 1.0)  (glVertex3f  -1.0 -1.0 -1.0)
+  (glTexCoord2f 0.0 1.0)  (glVertex3f  1.0 -1.0  -1.0)
+  (glTexCoord2f 0.0 0.0)  (glVertex3f  1.0  -1.0  1.0)
+  (glTexCoord2f 1.0 0.0)  (glVertex3f -1.0  -1.0  1.0)
+
+  (glTexCoord2f 1.0 0.0)  (glVertex3f  1.0 -1.0 -1.0)
+  (glTexCoord2f 1.0 1.0)  (glVertex3f  1.0 1.0  -1.0)
+  (glTexCoord2f 0.0 1.0)  (glVertex3f  1.0  1.0  1.0)
+  (glTexCoord2f 0.0 0.0)  (glVertex3f 1.0  -1.0  1.0)
+
+  (glTexCoord2f 0.0 0.0)  (glVertex3f  -1.0 -1.0 -1.0)
+  (glTexCoord2f 1.0 0.0)  (glVertex3f  -1.0 -1.0  1.0)
+  (glTexCoord2f 1.0 1.0)  (glVertex3f  -1.0  1.0  1.0)
+  (glTexCoord2f 0.0 1.0)  (glVertex3f -1.0  1.0  -1.0)
+  (glend)
+
+  (glut-swap-buffers) 
+  ()) 
+
+(defmethod glut-win glut-timer()
+  (when (> (glut-get-window) 0)
+    (setq xrot (+ xrot 0.2))
+    (setq yrot (+ yrot 0.2))
+    (setq zrot (+ zrot 0.2))
+    (glut-post-redisplay) ) )
+
+(dhc-make () (glut-win glut-win 
+		       glut-reshape glut-display glut-timer))
+
+(defvar glut-demo-win (new glut-win))
+
+(defvar glut-demo-timer (new timer 0 1
+			     (lambda (c) (==> glut-demo-win glut-timer))))
+
+
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/nehe_tutorial/nehe.png lush-cvs/packages/opengl/nehe_tutorial/nehe.png
--- lush/packages/opengl/nehe_tutorial/nehe.png	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opengl/nehe_tutorial/nehe.png	2007-05-25 01:28:59.000000000 -0400
@@ -0,0 +1,151 @@
+PNG
+
+   
IHDR         ?1   	vpAg       g܊   IDATx]I'ާU4HY]U5ݵ5C.m(K=_FiE#iF5fv3]Kdf@&~@  ++XdĻpS8eS`fMpS|8eS8eS8eS8eS8eS8eS8eS8eSP4x*q<?ǟ:8A)|B 
+@D! pef f`"ff >Mq'rC8eo0n}B(*Bǜ.;&qB 8p8LC{(0S | *%FeP]0S`;
+QHF(R@|PYcC\RhRaJRx`qג,
+8JJ1(
+	B<g
+-[G3  # 틔 0wԼT:.w~2{v{u8FVfjLF[xPލvg@RT0%DIQiP L>w
+1N
$I	MڀR(KD;6'03K
+}
76UmgΪv-@bwj*@v7B6A!d,/\,\&ԡ8,ki	 no^ 
+	R6Bae*FPcᐲ*2#0 E0)Q.S:1kl2L9 "c&/%夔Ƙr\.(˲hf hLx^֦eJ4	+rtlq|O5TL/ٳ[_?$L	"(nfE;||9T/=iD
+ B#FJ<~g`Kd	B
+  AjRp\
+1=dfF$( )0 lR̜?~4loo{+Ϗ6S*TX٭|]ߎvvv{v7{ @
+˙?~q加iC{m _4uADTRTJ"@wg˺<%K
OP4;2C7JZU5AՍtQj,rM$IF[UfKW,9wO\|Kzp%yg͎?w%fIOZ)-^\JXʧ>oCxۥ?Y* ThVT{U%햞ITc8gC:-]w	qSnԓ隬RԐIXU zwaL30E/s<'"clV^4;;6LN63ҪiTwO}EgmR:$Jk^ܴ>Ȟ0(eJuTRFɀ(j#J%LeZq+gw~Ɵb<Y hk=~?0@3i^?^*yER`(666666~_-//v:͍,˾ (
+	HB6s7OTDv{ zD4W(_zYHyp:"DT4m(	H5ޚh?]OJT4yJJ/p8\]]?>LMMmooommcz%';t`VC<2JS>TJQ]xW7Ͽhxjy=ABJ% CbD"H%6":^,K)MMM}駻R*t'-^-Q,O?ӫ|
DRҨ*)ʓ}<"AN"zȾ%%g =B$Q
+A|Ugeenhͽ;wsq@>l?]ms3\7MP rM9^Q3	 D?7:A@J(jea2L&Fq̙7͹s.^8;;^9|U 31OIg.7t
B~d @
+a<7;@!P* t@PV`@*@y_h|g7n GJRw}7ޘU׏ i)@~fzQ(Mxo|CDq;J__r|۷$y?z~sU*TO bg;XX&7fI雦ȼL|T4}7Z˛J_O	a|ete<w_|oOMMsnaaayyTzٓd  8vOuZӍi|z/ƍJƍ333.]R׋BJB}L',T2ȏ(w_^{߹sg~~̙3oBΝ[ZZzaQZQ
+TR
+`{;ƥ"!VR
+y￙XsdW"BT!#軡1h4L&nwaa?;wٳg>K BTJihZIH>Ahs%ZH)cZ4Il!0FWRS"P8'Eh]N9
+ޗ_~277W.	!Ο??;;֡@@)RR+)+ jr&;kl[3{Zi%x2(ш蜣o]J
+RRJDdOYF+)Pm	eJKKKo֭[fgg;;;'}@6A02E|N]~Zy#*;C~?>P0ZSF+D恸勒ZI9wBW+ZbRJdbs?P!$DQ 0$y1^狋/_wx<>sLTZ__ϲ$| @@:CAC9F~R3JfC6aQak(
RkePbr;' @ O(%sg")
+ N-.rU-
+7ǽ
:!Bpee޽>33 +++'|@!Mr'P^XFz{/MulwZZk7r@D)Hι$&q^. d Q` "v;qv'&ick$׼2۫RWgy{ DſRǈ8#1^T<#L{}eK轷@bߘB0$uz!Ո0áyD0F+u`sS禗M9L&V_T㍍V^___XXxbZ}+㩦2Fs|= η7߮PbsO-I`p3類>VR$v(3@>)1ZbZ<JL!":)2!ci(N/U
gdG),PZ3A/xVk&-3RSddWZW- uTޯ:N/nݺUœ^1 DZKi{t99L~2yVr5x6+C4w)W3R13טu6;[!2d6g3Rvws+͖ʤNҤRwS|`J"AF!ޗ xR(-CyĢ'ԩyZ	o|l6\y(2AkޗvU5 @1+.\"CIYN0gJ:SDa;^߹_",
 1ҥK'مo  R
+  
+ǜG  `IۜfAKIDV
+Z%ScLU՗tͩ9__޸ٍ7u.]}k鍷:KBV{rLkf{w?@"Pb4(@	8xVBDdSFca[X>Wk|/Ogߺ<t `k?z?ٺwg{s6{;^3t'=+x~܅o|WVw.,]ho7^;666ܹs1tqq1k1 ֺX!x&X3*Ԫ|֕$x?hW8sߞ_ZZ~Tc+wlyF:{?%J! j>rk$/,133
+v{VI?_^5;3@LӋ igq:n٤T|6w>l:wJ5;oڭ7|s㳗d   $IΟ?~iiiqqqooXE{u	B$F	!q\|(1so"=_Sr^[3["='}Fg5;+xs[;{__/ۭv1p!J+](W. PHO{	D)E遽/WXJ B2Is?vW>I:03 ~-&b&&{o\l(:o7х7~gZgp8|woܸ155twbRJ 7T_R2MRh
+}!yVd٫ =('Hz rb|ݨ13{pO&?gATN-}{Z[]Mo/߿?fkI:VLs@&@BH4@y	YW"%ǧx1 B 
+FQF	aԌ_8ӽwsP O\36JvwTX*M,n[zja!y%   U",--5?U1jkfwao3W[Cc(
+(^)EbbTpю
+03sWz(VpRѮp	EZp[2nkS.PKo$m]O?ljy
)p,()(QJJ"	$RcU8>ePIa iy CX7P{[^s}\#> ]18IKLQPBJz_[[[/_/ӟtnnn<?Ru[ ZkRVkffAVꥻsZ`o;dm/+3Fi9Wo!mBсꈢۻeJb?M=ﭯZgHlE6u	Q_:똜-
31#1Z*Q6F4! J(ւZ*%%T* sa=3}DIVQff;/Q<[_-7Ǽ!]RD]"A
fG<eˡ(K.
å^w3$hcH 0LOOʩBzXi8nmmmoo Z3;*@tĺ 1DdVR:OхPtwT\tᗲ\Z%Z
+HJ
+ bJKS33W7*ƣ;IpN+
+ؔ#'D'i1/,
+RHl0P, }.0 2Z3us/V"RX^77v(|ט1J--)ϜMwVW}G1 {  O?Gm}$IRI)l6[2N&͸{p8v@2+db}&8sIGZd GߙYwq]6}@ 1x߿2f
rrrFO-f^wlRi$˿ie*ExEDJ6/Ft(p)&	-Q*Ӊ~1/a~㿘/>MZBH8Lo;t׿{&nNF
N ":g. (;A=3yܼxٳghvvݻGA_iZT*J BdeZ[Vc1tx`%4MjZm7͒-t-án  JI?	 @ļlr	}9/7P8ƨ
+@ % m?QqT$-{'_w$%?T;+B8p@'WVZ21s4
+&74mU Ѝ-xFFQ8?bf &Iuڗ7ڭf3 h#g97gݭKÿkzATu{ʇ{#o<{{_f.'n(v,;`0hZJrѨjՏ>h<$˗/W* !8笵hww7nt80jFPJ~5jb6lE܅xͽ0:a2:TB҉$1Ynv"H)YJal~~f>̝P&}>|~7.g|wC!,l2m,Mm챔Ghacx f>*\\Vhro6lI}CBָ{k_$iso~Rj@!wm&{o_ M[[}TZ*'_=
+asV>$kW	cݻwgffg%PViVjgff,Ik`0ٹ~$t2YkmTkZt:q()`0
nW7(J 1,D3a?l$v6:4n]28ft?i^b&aؽGfoB˛(Tc*nqO&p*ŃA0FEkC:*Iî0 ~BNx'f.JC}t9R"{+m,^WC`C9ݛ[Y\p.4i)P ^>F'd0Vo^/WkL|1{̙շ~T*F
+2z]t:sssZ-I_ׇE,~[kn޼Y~8â(V?6ƌ㍍ht噙rkkknw8F#kmʀD-D&()ֹgra!T<\Nc1	DﭮlU+s @>a{xS3Uz{{{ᯒt ֝y>8 \('ȋGUfݳ~<
;9
+*41rpJMam*.N,J %Jf*y3<((1e
+=0dz_V|D;T+
+ :$~NO_EQ,ͱX.gffx<{=x<QaeG8DBzxV
+|Ɔ̀bU*Nvʲ}Ԕm3A
++÷D#(+Pi~\N$P0J*cB/O S}QD!2
+g)u~&H5Kh= #`t'{!"8qNsioZ#{l!Em@*YHȀL{ ?Y/kxg¥ttݼys}}w?j777?xlGh)gff,}/^;Dm{{{gg(c{J`>\DI̞#5
+wR˷dP"vrhxl$b24*)JR~2e"OG͠DB M# (Zl7Z'ZyZP|ңO+[̤+`,dV_w$8/ǀG62R,,,Tp_\._z7ߜL&kkkͱUw޽sεk~{777777wwwoǓ!$
+j=JID؇@d=H0
+yODZkQGnQo=5q7kΟe >߽?+͕ {Agf<B=b^{VRIi	FN,W9UD(i;D&'E2JҬ,+&&<ϱJ`a#!q R$IzBݛ7oƴhT^_XXt:O$IctbR#EBϗDl"L@}HVJ}HSb2S"?z[_8@7j9
gDD _c2Z=t!3RkI2JTfvQ01;)4r{Vs-ל1&h9"zDx@$Ip8˿ˋ/g?sέonnv]"⧾)B^ڻh4766vvvz97 ᎍ1PD~2ɇ`}hdahI̢\GMpDp®Е(eQJL{FC@Tv>0s;X5BWΟaQm$RB_`j\!P| Iv;;;@RFtկ:Ο!VWWO#^ggg?Lw%/bss,"Q	Dt#DD >_~rc[Dʇ^s TB'h>S
+2l@ 3y_i,"RRkNy!H]m
+mad* Ҳ)=Wj#DiӉWݻ74MWWWcLdvvvnn._paffݿ?<<%2#;X+A "by$:UiZ?u\ D,I~؛MChwd
+ddEcL%= 
bƠT ^A1&J%f^__d=bxBL/~q7xc8~|BRb7Ν;W.766666gBazKEMEuLWZ  `ݳ @JA9f@1+
(`B
+h4ӟ|ɕ+Wvvv#4@FnܹisRV}QܼssC]kXN@	!ք`fV  zw+_	BTbv &xbXkpq_Z/..pHD|ٜo41߼yIOrnnl޸qV-,,zc	:9b۞WQ= ` G+7|Ua9ZVy`6TxvvT*vZǞ jwܑR^|y2R梫+++GC2^d|='5=HeJMj] 76ˣzx`=2hő	<` !,c ^v{nn޽{gΜ?R$I4ܽ{vcfggׯ\l6?ǵ"U(Gj<'gB!*ggk\wV;no3֗=mY2|׃Α_BzvHSlz]D<9gwHgC6"[w'
Oyj(|O:ma p8|ݻ2vBlnn{DjxGOHa y	84|㣿glHD@]\_E0$Й-U{&zV]cw8KznYZ,_uջho|f!R
Խ:!4]\\ߺuի[[[ VkiiZ_?^R]I-I
+ǝ\5n<|>ow{AEHD4ۖ}Kqp k
?V5 #+/rփU8U]8G?#$KKEN}*"F0g}v`3V$Iܹzeby5 ǭ诈X{iuB6
+y3`<vH>Pt7Ũ;t
(-`u\o+HDĪ- ăN08^
qD H:Rn@}JgԢ$dH6<cw@بjfgg\⽿w
62@RF!镕Wu.Wvm!Pa DhymbQ{j<"0
¬mGm$ R8Y
+*lZDr\<$&m߿$)ǀ6w~RHxA+ȹ
+
+)|EF:cLݞF1{LsC N/^!S01岔[GǸ)xxDU))Jmo> <,cɦ
+a~#QI !1I)ufzl)*U1O%nC~Vh7<d,IèOdC :q zFW^F(quuuzzz2WBviii{{S^~w(P<nMJG JM)2?|?|X0b3mc0C`RkTIJ=Q<"bP3I='~k) @!BRXV.&PIt:
+:ثj.LMM1۷Ox|H(6֨?o'akk+FP7,N O3
+D5 (#Hklv4+	Ξ
bA@tXv.oN(P(֋u1rvͷ=vfQZm7ouW(S2?ϻex)	xN(
* %
+B86/XKjnn >rK_08
 Bc\.DYĴFc۷;1eƌ~s蟘 h{SfJSvo'ϙVH)PQD'1i_5;?_Gko'3gTu4 @ cs9j,le)f(<i4*֦B( d 4'a(PyQj]$%pH~"b˗wvvnݺ;J:GJxUy{{l\~=ZEQC!>1IAU/F7Lsҕ AudCf&6ݿ2%lf+^B\(! x
p.hR'р  dؓl)<Ρ ų(TJV9T@ $ K	!4ʲ엿[o53351@!sT=jy`<߿~~ʕ+}r~~9srb?bsKibLc<}N'y%Q)EPYEf}NXFwWOs%r.@6{}wMZf?yy
%2K!Y &.gJ7fTRw0!<nx%J)B$3 [\k2WldUJEl6/h4'2nݺ^̬x{^6콏;_Q駟.//?>MӍ#%"Z+VچiJԞB=FB8ay@;EwԻs?jưp@ZX%qc^LUJj}D pcҬrY*)jx0 F`O![ّ^*I1&lk>]Lk!Gj<cap"wʕ+1sss9G`gggnnnqqV*ZbC?"/W^/h~~>L&eb:yi>.֋Z1==V l~ہ]g _Dydtҙz~U##))QGdI_lr ,J1K~ &!{Sw]?|y_(1z2_:ؓxK2Rj^j5f^3gcvww777K:b޽{MMMzWxfhZ]\\|w666n޼yv}޽ʊd  iz烰c  TPkIg>rZI!ãgCw2 @^$J=T{@*%%[T<gUR̳yRh%HGC &g
+9pt2ӒTM1ϴDEZm6V+Ν'Ox=??733B?~?`]XXh6o|˗/OOO߻w9O8昨fB)IdpxnBy~jpGCp!LlKуhMK{P
+`/1PS"R2!""<>=_' }SZX['d.Bx+GsT"U*FQ)gDjvj }fk/D(epV]r{ｷx<~hthK&z_˗/_'nl&	#
 %ZI`
ɠQjuyJ+BWMtVRjFk0A+F0ZYZֺ$1ZkJO>~@Up"`X!Y ѩ/B&ʁO1"kV,˺F\v zn7!
[*Μ9{Lֱ(bsss0[G=O/_{a{8!kYBʇcV:FAw+5;jRJ)Dn%e01m$HD0<R> (ɠ>8W
+ VO{!%"bS8ϰ!]a<Cb"jc;!DcVKW}0@lZ.>^7?? ~fL&ޞjۍF#^Ο?oǢѻq^C()Oǝ Ha{JUpyNHg[v<<dX4(l}8v)QJks|0BP)*J$CchL'ڈ @IiaE󇥧(%W@c
+I
+ RJ)eSSSJeoookkͽ{YzhaxeeEko7y<+'9ǛiG.]Z^^^XX
bGh ?0yRi[kt/幩>!Fu.z~FEauw*u
Llɝzr9# u>A4Zvy;
+%zY!?.07F-1 MƟcx{[2rQ,S+iijugg޽{;;;SSS333sss~֭[EQE$?1'뭬\xի|k`ww+,{t~v_-׮]1Z[׆ZI5xJ9fARz/]ZJmsvRh u<وBTj*,xt}V~mPRqE(NZkm TDJ(Ct_"H%Xa䳓iwt-҄E{ڎ»٢Zo;۷oYěovQU'2055uՏ>ڵkΝZҟ_Ah4fff|Mknx<Y7O̐J[(ER6RuvpMWjA~!~#1Bu:Rh>)痌R1$T{Yo=9e><("1R ?8RTAw#1F)~vHˋKWHbz8qۘ޺yJ:|Z֎x4ʢ666 `~~zsU*,˾:cݽ<733~kkkssl..O)=xNxo4Z
+(%aڼdja<O)Bk}د!G"n1c麟gYv7^5fd
{1F뜊cepdX"|Dwa|p[fN6ZQ႖ϭULOFVsv^=Ev&kمZwoomm-jۼ Q(x͛fsiiRܿ:E,ԑejTKKKl;7dgd:MHZҲ(T^J,nnᘰCùC`^mlsn̅sJJ@)%'G=*)Y, PTffo*BFZ&YBdw{7\}]NgF!Dfzo~˗/={ՙ"ڋ޽{޽rt:δI<2֬JIu>D u:/J^m/C>ގǾ@8fLG홰
>W)pLA)O
+tvtLJ4l3{-x߭IR	d52)jbΏn!6ַf	f-dnn̙3~˗kif޽{+\+X>:wZDD&B)͍W
Ǽ$ZYePHs($2#)OŦR
+Ѻ`Rh`_(<8t%ՅFK}͇ٞ{
_-x·?szy]~}42q8|55+JRQ(ӦrŎJ)cѻJHQ+tR=;ؘhfd<Qbҙڷ@ *Z/+s[v֏`R>1 :.݈>Xk-"iRpT(B~r0O ;0X+lB63˾0'u֘h4;;;33333_j/\9k
"-.lZF()11uH4ZqjVϧ,QΏ߉g	RR,u?Z)8R`h
 Vl~@4FĦFAB 30~̓TRhrb BhL: O=/  `fB8L6Ɂnojw[ZZ:|Պ
ߠٸKPQ(%U Crި[>sܚè"R(DVJJL䜷{ )0xXM2C>o|B=rmaeF@k1ǃBPJ8!QW<
+pdGQk%e,7Oy$"6@&!:~	P91d (uNl-26``0Ǳ{M&rʹs[}>0sbVJdDzKf׍7f3ެ-Mw$d=ԫe)w>&X@tvjդΆS;%'lcnfݮ,O7g%000vv^7wHILN$Ft.u2614cQIoЧ7XRZI)Lp{DrDRz'{?j4#LH,20a yWoX%Fq?/~q/[[[OjrU#GĉBF>R*	_6WYk̏(l]fym@μvwO^0 (USgj+-Pj `RuvtwC>Гjf3;81:m!OXD@!PRq3·xd0@zEsŧ[QVR.zU+I
+CLPG`c ^Qvd^777733ӟm4SSSdcc#B DRBb{5`&~;qiZ<+B>ϊKS;RnI
+FamNgҮ7ƤuEV_oC<."c֊;DN}뜔RKIZX]dODrKXq4Ԣ$@J*O+F۷o~?я;ws.]BvԋA&|x(\oʳ%O@3|[ooϾ)+0&o45RՆj 0U?$' ,{
==F!2p'ڊJˣ-f"{ɽ-d/T}nsw;H	jU0@3[kכfӹts~駋1'F}>W&CS;;ͭL*)3Zc\@d|Wv׻oMʹ{ҽ7zb2_RW)q Y̟zCEJ,9x.HcT
+<E>nZڛ7oFoZY\\v{{{_-ꕷwe'&L?\DE*DTPJQth_kzpؿ~	~nD*S1Ay|7][[[ZmzzJ^w]Dxb́ގVu2owV!8xd9޸}!P(Bb,EkH?h<#XCo(Z` )E	^\.Wjz$I<O'+Wkd/s%9B y\8v[RL'pdw.Lx7rv$H!i[?_Dp8Rih4|M>L\bA!db}2wfi@7a; b
+H9c0
0#䷚}0Lc>6' A a!T(%
+ ;nd2ZjNs$Iܹ033zXѨt<{ּ TV_i͵S	)vb
+/z.̱{\ sdf<c@4@AH1"^*MFd+T*ϟ뭷.tu"sRh4's.<ɻ3Jx23,  e!|
+_vO2@ 9EYflJ@ʲ$
+ ޳d
c's &A
+< !̳'pbRDyژ
+&oK m7 NM\Q^OgffΟ?v1͝={97<o;kʊc[(a`bSL$rY={qxi[40ƫD}
n})o>>IHd~7.Prh&(, O>c?dCh\P@Z8|X@CNT=!H'%2G e,|m`C6!~?ܹFczzٳΝݻyOli6*7pyµ(T="QoѰu¸?}LMo~3{~UA 3SK'|]	Lv%KewC1AWy&@Lg+[^--̣IPijKEYd.g}  h 9[ݲPxu"L
ǏC"nC"jVpVTi0ls'۱?xo"yZvn`!1d7TQ}ZD +ˢJ:*1n~r+ @m҅s&N퍿L-$KC190p$NPJUqw|cYkj]$F֭q̶Nk|<"'B`mQ@,}{k˳KgT"ANJx,Fe{2uΡ7++իT"U* Eg΂|w8I/,B6ecvDCDk۷G0ZZtjm59{hF|\L T־ 
+7Woo|^l B=[||9i~~IIwfT^MӂK' &wGwO\(WE"9&k0;GK	U0TQQ G	|؏c  mD@**JDv<
+Z#bBEC 'Ώ*0ThD!PCx_U8
+TTj삩
+ü `- B70.L~naT"-ZS:RCm)}B&~u0wBeUoZ[Uj4>8EG]ɀI	M"TDVc;0fe	2B6f P#UYˊ5X||IZb"!88@:6d5%%EPffNe0*G]A޲-YoE, 2"~c}O hx\AB 
+O_#n#HڳhF)Q)Z(IE")$AA*!s
+*2*2.rP$"-EB	Ejc&4R8!*IIe8Oۚyr9&{c~'3./>-߽ <e^rD&c
R/:f >[\E>%L@ 0xXKD޲͊YL*qɟGβ+zDi=` ᅈgo;>3L<)+Oo1+ocǡș:T
+3&=M!'} {}%*l}DdoL  (D)]G.P`
+`#D!AHjWC8퀤o~	p$xw8p$rq8wl;)^CN5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5N5?*PJiZTjV+ij B{o<˲deYQιvc~qm$y|m|t(B$IjZT*D!~r<&ӥ> RJuZnw:z^V1B 9gG`v2pxb!|0t]!D\gfVJU*fjz$̜y/"IxoHkBFr9n<ϕR
<iIĿ"c(?v'Q)%""N&(3C!,j"Fdx!S9}| I$IRj0x9犢  f6x,{T*ENR<hJF_
+t}j6R)ظ\RRH)2sQF#Is.b)x)[om$0@a4"B(ƽz
+@\VPJ@<
 :'-Ew{}}m}#K|(+$It0)t}lኬ=(MMtR[Nq,6^mkU5*ܝ͙ٙjO!f`6U)V7w\(dU}SQ;טl<fmgf`mȇ2`GΕGkmT8fmA*;݃ɲS33B(BJe;g;BƭwW7E BRC]VasRpzK|Yyvfu]"7ھ౵7%B)FJ)ksnXõ-s+VӚ풞 Z9U:6/]8	%`Ͽwo	deo!LUdIq*BR|c8 햀PPFSei {?LH%lksrK{劙ZP3h.'m1@T4Pd@(U	]XnW Pokg&&{;NبJN-/R|c훏m B +(U(ՂNy[k$)yf|xOpܩb RjVXǣL%Mt|TSbfr(
+{2Q-D\Z^[D _S}CRR #E1vs"UVs0@ܦQQkT5Lz  q6O(,AYlCu^o^21J̎Ύ$Y rSTT,(0<y><_,PD¤JAc@ZҞ R)Nmxt
+B
+*:U,i<PQ*Q?P5J4 Dgp  %vC>7=^Z1 32C A#*  zjVjUB*%JtZ)}Ӌk  B
+] jm
+yd`8g1  !PH]ZQiZ*Br$	*r`V[
++k 
+!B1&;IU$e `f! C N\x+݀
+YFW\*{WҢ^ғΫ"á=v~$_G	@H!!f]!Dë]دǾCR__-]H]&/\rj<F)e5t!&}t? cobhZ}^ A 撪M{QՌ?]<aȪH,⋎FHaalA/Zc$Z	Q|GK R(Z		!RRSyEB@Du+ˇO;[kȲ,˲iv<helni;!Yy+p@D Dd`?J Tc&203K)76Lb2ώ17!k@䎱zbt$Rh=FkmkEķp:|_9kg @D Pʇwjh48yD| ǭ.C$)J$1s(1_õ)Fq]C|*~&jH$10!>>_Y\?30G'-T&Zk+sg.:sS*JRZ<8$*^9BYœ%D qFQ.1I"o%RJCa/W3  "DGT#HӴn7fY.1f8x Ÿy)e̓'J\8TQ˃#r0KP9|N8CxZǏq(JR|s~!!j܍qӃ%"52rґaf̓(v=<w ιQhy>,<c(d󟬵'u$ZjZr9Hgƣo"$~ o#t:sssi
+!aߏBy<d@CRi4 D{,r4
xw[\=PT*R9MjkZ䠓RN#o< kٔRFsYMcγ Q*jC07h_PdHdB0TѮN6crj*J:j$/2s6AD~?8rVJ="j6QY
DT`4yeT^G^"'J٨iUߗf055vqnˆ
+dqmuN[j9ZM)=XTRBHfbf?eD7kӝF{/n[)R63sӕZdRx}cmIwpz=&1d29Kgg.D'A
nMY/GySH*S'r>^uv2M>x+t7NTxTJͽL/=VJi!@0_d?}!3Lϴ?qz,{=ON<
07ݑ:|$gΜEQF3?|TU˜¡LneVh!7 ymm~/I;n쀪:c%o_Z>4wo}fFr_ωo0;ՙ7[f)̍{Ph2(DѪ$KNe	TM`((U#./+hK"n)"J^7zv;;aookT|sw׷m)Iz4@A$tTL |j%shT=):|W*fvwvO}ADQ.\IK%!eg>ZNfT~ٷ]*ݭeeetY4*

.﹕a;Nt]6Ν+bwwweumq~Ez~wr)&vsӝ;[NHxj)7TGP̙3fƍ[۳yfsѧ:ڻtj{{*4f	c5ZJBvo|yڬO!sֈTHSsvhJ~ܻx2U7gT#C@tyemȣiʄIjɅ\h̕JnufL&[sＵ<ӾYjE5]ij{҄7geЀp Jl$Q* dJ)-VZI
eTA4
BcN3??m&[	vT2?	%
+lx7Z#8[+hҶLi
;2ɥg~me|PL
+zg{u	%f Lɹ3g{+o]xڕf-m=GBSu`kB٥|QׄHD!ġ;1@Z]XX`fݷNEs-p.Vf[/hV%BWN{SSOnܻ4
+\OdozޤdX:]r{=4vd^%4I%3ӣ]6SǬ38ER	UDT*JݽvWN	s毡p]}ۥoܮ%JNW)j}hAB @N`DIQ@do,%׀O?4vc(I2hM:-5(mnM@A]*G03)RM8)Ľ+{jB	P=?rUVz
+H=z9u'#;[ۗ_p~8C".pr\v[]
+Leݵs7t־XX"mjjw7[6Z׿[n/-dmYI$s{*	6wk+Al'DJ9׮j FJըźNjͫnAD<X `ޓ-#wL_;ܹhT(6`
+)"ҡRv]Aҹ+y]0}-1\s_[wܚN3+ʣG>omf´NDh8b?>$1$I0a^uW&5\>uv@`99?3<s@̃0LLYk]/6Z}R{T57`NN.ngdݺxn~_݀ŹN/O
+bKpEd[JY]Jey7$m$^M2ww:rƥKK}r՞ƹks3U; D6 *xᐭ9sfizQoeBժ6P^>؆O9ejA4.Tp*#B@)O((54snw{3蟭ٙ)7E}I$_Q8s>mfYQBIɁ*
+OV 3#rZn=BI6Sܗrqq-i׳1 &idMVQԜs
{]gTRVTrm	Ol3]Pi5hFGZ>W)JWf*q"7H%=E&9ξp\BT*f^}ͫ777?|kVԥ3szCZ&(g})= "1+S<ϣ[ oCPLR6J&jv}(Tk˩4E EJ/8TԥMİVo <ۍo<_E!gcT
+(YLAsq8Zkժ")2fv(ҏm6+eˣZze#&+1"4{z9jYݡNҤYN;*emD ʉ%rvj+&-zA5ʉK%&hk.r]Q%JJ%xgI1hP	H
b(P%u2@;4_2oΤiINf]	 ƘvRV A):TD]'#cLZJ*U)kp$ &CiZN^4 MZmFZOE&t:i:	H-R^5zjGcf 	liZJ%TRIBSZZ$1  BC>  0`AD됏C>i5
A `DzZvi*aB-Mҕ|<JK)TRJ+  ZOBk]eFdHƔ1jႷ\q6W*kmnR)iiʇV*JHQ"! T*L$ESrg^WUݝwnNkLEb'_gB¨\F:)ˉjɼD=;!b  mRA9I SĔ$I|m55RDB%J|2 DnĴDBSQTk͸cNk<߿O4D|
+ղ 8_7m(Qm`ZiI` p &0U v1:O.
+s{J!~BX^
;
+Ao*
+JC O|>>JօZ+b# ``3 PJ( l5BGJxخztR3B
*=-0RJrRס
+ZoZ; qQ}L{# !	JrDJAL C$Fi
  T6je_ըMB(އd@3`,"J P!`f)c4bIR J$J$ZEc8FaHQ+"[͚NyG&,b$5` ( j8ѶRI{@,7ḺhaըBW!%	\ "B[1{p>@>HA&eI  ##4FJjXY2>J|bR (T`
VT1֒`N$yaAax3@$IaSr)֝sZ'C㇇ R
+D?Ģ`!@+%<d }p1_NZ)6UVJUb5
+X3i
|: 4gRHo)aTt)%֥
+k\[kSB3 Is1703g I)Fyp#/8L|> Bs#?{MelSMհӜkrN2 !g"/2@GD*-Z5Gtsؑ`@
+D )EQ=M:v B`71ҎүebB+$qߖ"0)	H( eֶ! ZmyQ7/BX\X)RIbLAPI1 r<1W8b /F J#*asp62  f 
+; bc\j|MUWIdR pXq{g- s4h?TBc[
+|vp*<wVşA~UC睵 C#bA3 PLM6b$J1#	+i&/@X\c
+T(0J) !Oqގk TRޗ B9D>Rbvw9 ~ <w R=77=<)ZRҩWi{ D( .,w@1j_iRx  T+320x֚a Ei*`MI*u410	@"j) k	0 9X!ep wŤ!300d2I1PLҾ8ȧiF(PqѴ3uvqaL~vs+RUjV;+B8nO{EzA#*Jk|i3)$C`]f
+!PJOѶ.M=}	բeIJ "(D_d `'C뉼 L āD
E .+E'\h,2(r '([ȈjC1t!.?N2
}Z|,)fDڗ sD$`OD<O͍Ao#
+cD /2edd˝`I!=d1+f2:!h3ԫFyT!D+t|V+
+Imv
+ile}fvan*O~)|{A,P "/B0B
3>MNDZPKI//̠d@LRr b'ly/D3.ʶODlZ-'F\1zr ȲFBsnP/rM)(7s
n'[|YNhݭ)|{@X!˼6R$uJh!x(F!ˌ@d,ʉ@K2  W0&TGo@d "Ѳ\ J)rhH1g*(TxxܧdK5L`l>]쮮y}+ bD1C  f܅6`H743ː3	0y<RyC!ĺ0Bȯba	 Z0{bBxٱ.Mx
+
+#?z3.rBoZ*mt1 `G՛ x mqևr-x^B	 9R·HncjV)	]XJ8!g1,B!*d`&G Boxk2u{R D
+1Y_<&J1yAR"،uZqŘKiV`?8 W&Lv[)Dގa, )cBH;1/+/o` bB|TX7)
+uNd{{V&F4iX@jr+	_[hIwTq@3>ФKb!!U[P %!Dg!PajKRB$E:XXNKFp p貰9e}0eN *d%!CS㴁R2GrՊ>  `z*[bQXQC	ș|K',F<U,N*)UvRVdX3D2A7a~p
+څtXr<f@TT(M˔TJIj B|DD2ij%&;y:6}LC#*$C1B`1GaX.?B``DaDp8l>wԕT>ԊӵJ^iu [RYef`B`ti*K/${N!(Ta貐%ZxVޗ4u\靜z5c&8M%ZV8?zm)y* 59/U (Bzߪxs/3o頋92@(]6R
/> p.iIQ
+tp cY9c| (Bd[W%?_y'.vp9\3GU
+[1ɋ|9m2`Db|dq+šFb%kC@YiLf@(m!WULZ:y6YQf9&B"Y=g'{0KAl6U%C")oZ  pţ.\DkM?FY/yb_[~=3ڶ6Ӵ5٫q,WzRXocgwPk(e %tI9Ny-%qcq |,JeERf)QOsDT(h59U=$vWi7*
+%
Rk Yk&T~aI B%NwK 4S"kƨuޟ[#qKMGN ( "4O)s̙Ndk@mr"
+Q!#h)֢vejcJ*{tVxB5ûA9qrZѧŐ#E  4<Vpz$[|H3` ?؞TR	N	ݹq{<kqN@Bs5j BPd#pcGMl2G֖!D2KF:G 3(BQ[(%M`5_Qcm!YaP=ŀ9@9R2q% G ninRyKv`&8+(+]
 sݐ0bX ;J :@g,:JUSA]uS0()J( X'겠*e	Ϋaa<(+7 tWxw-ԍ* 	upeh
+Sx0KsRa5L&%<qC5{%0!jjzB<c% 1eJ h2N*'`j]AP8J(P@4
EXy2WQ[Csa^5MeYQze N׀ ơHk
 iõyПy`? +we7S,L&k-IޤS@4Eb	 !@S6h)9{'t:ue4 PجE"FKj*AB( NiS)%Xjgl(4Mymooo6t	DN3le:U럶
x͟ 	6ך4Cſ8WWWϝ;Eo1yh4'IQ)o 3;0J
j` (L)%R?HjX0j_4:qc4z
+cUaB2I[ƨ.3 }Ǳ{2m!m A
+:	b)5'uo\]<e2"  Ccnݬ)^zZH`h4RJOU[G~x
+ B31yrε1H	gqҪ4MNQ3sFuHPQ.Y(2J*88^:s 'CZwqxIXKXn*aZ6Ux  |mmmuu/ݾ1OLӸJN2"+s_ꦔj4  qy+<}b	!sxd!cp☶S@E׶hPŜsD""s`G(/U]:%t zR;{ɤizBO
Ҩա:hQƒ-JM&Qvg>Bax ܸ3Ko*+&Ã
i:[%vC)`i P&? gN2RԇveYj8af-f4DD	`  Pn.! t?^p{"`|9M6޿{ʽ=d:2ZL*քk`B68Աp@O꠿9"ɲrY.8e^fr}'~R  9:jO;0kƘ-	E7s@X5
$S'#V3p!VFT1JurUU?jwwvܸqvkDQƺPb$-1H	WQzV)9?V5$ K3{1R 07wA bBkkΞt:u3ZzX> =4=yrG,bPJٗ:ꝯxBb$LU90Bh[A9Z@ f YY
+#`6 "\#
+Y6BNV_Wb!%҉IGkMӔU]ׄeDa\)w`LR"0ԙY[bspMFC] #PnV+ۓn2  IDATUVp<]=fs;G7PJz{IG^K	d3
B yG_{P, PBLw$9J#@8Un"+6qUUY>-D *s!Ґ'I7tucBRʄ 0zL)on@3*B9m$7=*_}L&Ƙk(I!$iBnةntO#skq?RJj4yXQo0Ƭa_f5>>'%-wnr
'u@Oo(*
ch$m 6'2!Lp!d9+V!yȁDQv% 2R$Z35!sMً=x%!D(
gFJH)-˲RsG	n>x^ٙ&4%.Ab"RE_j4IAiꦮ#ALq
`8R#<pӑ!2M48ܷ"I3`wuC0&-FVGp)r@GȬ0PƘBHMQS΂y[HdxwPJaL5e[fB8GZ 1.TKnx"ȫrF)Zq؎UT%(NY`*˲,rgDNY@5Mm:)K=,&}z	Kc XknӇ}!DD
C|F8@ R Ku]{"w_S%lcm x  s%-BKa839F`|\	.Cp/rflS} Oe*ɭ;vG:Ƅp0?!QM4aP)909+eEΧeYc${Hd43JP&R	]=v%op%{e4xh6GQ	W2""?cVfU{Y@YưbM>}\,71^m !8rv&4MjZU`M\u{7ET ΜW) bKnL#"#fBR
+ƍs<IZ$!dZI$'!l^Vkxx*)B\v 3QExx
+GR
+!RY9 zŁvni+T,Jӳ;fe[W4ODJ4&#1X w(T0WFc`B4EMTSuhgڝh?:{Yq:	×w$0!!;Ӌ<ϵWp8W뮀09'SevM r7:ct:5T"<Eq !Ag,dY2 CMS ;A2JQ)N)}4Bŀx )`K oytRly#l
Zg[\\woERޫ}/2W/ɚ8r
+FI J`cNC$=	[|t嬎RDI N2"L5! TPh߯oFF@%G g</˲qL;ǈNkqVSv;ccL@Qά^Z# GT 2),cMH-g(<ϋZ',HehIJ!Lesh{q(cisv7R_˲vPm !P%C{1&,sRU7$TO s)呛y]׌gj*U?rנ@9 vaN&;͇V>K_gW;\=u"Q/luCMRcptJnKJÀ^Ksq^e/b9_4"BBfjZk]e6AJZJWVL|%:w~۱^	0	Oi<Ө.] $RVUTɹ8?!c(RJʅSDJTO@Ը3!v$K4Hk=}<|PEڨLW$X5R8oP0gۄ4	U^%/wBɛ2?u(iCD0mZSҵZiUUPD{"ӷ~n\̧wx_|jP,j=cE T Pe]Z^,H}sN^x߹o5ܻl:+<J8YV]8!(~5[׫RR߸'kz0s1ngqgRdeY6$ON;
+>Sh.4\ uNv$uZIЊviu5eLRt6PRm<'9뤥Zݕ8,-Z7
"f5_;GLR&j`Z_tۗIateNNigJ݄GMЊ:Cغl2vWDȤ(`!$AOdb[͛W/]^"thtN=hc<MC,;ugʵFw6~^zr士Ĺ?zW>+ d;8[J;]+{fbdeegp|q)qr`?y]_87~_c{ì˲soyq)<VIKV$w7n5M3ݥ`M9qz*Lvm1nu{u}K+{{Mjqg9o>ˌkl쟺$zdӳ9WB&ؕU7vu'`uYp!ÚC}
ewoqfl)ⴝ9L kz+Y48r'Tm޽<Nן}{G ;?}J)';ZqZ
+NLB1.z?靿Qh%=}ċwߺɻʥO5_3DW\*,3q?7=.~${v1_]_O._|{;7FqnGvII_IQYܙ{E6&\FѩᤘGouOb[+nYɘGYNȭ[7Mμuv)^V˻YAE+VO0$-
+<{yvu!xQ!:Kzk3?q`~lC~s}fv*Qh:zsyǷ~^;&0kڔagF{zD#sX-/]B_|}/*iV6+J?g}ot<+yrRDDQ$ztȃ##agq\w}ڠFD6޹uƵkû"NgϮ|g}C}O>{[_q!^~<~N>z9pbyoCzǟ~𫍛 ݳo
jڅA?;7o^,fڭ7?w;A;vR߼s֭;?J话__[<oGm6ܹ}#+sS%~or]ǃ)INu\2[#lYv-^>s~}uMƧW1GSچ7N'3VO/Vw XLը^_xvy}Ћ:iSܼt1Zӯo-LK;rr3=ֹsW>?(D|R/D=L4hEr6XL{kI/V$Op!M/?7Ά21;ׇ{O^frg/~ޛa-te/dGɝk	tj,-ݸ@4{VE 0Kʠt@k˫[K}Y
֐@^\\
:IR	osW{^b_n>9Qf.{pobjbk8hأp9QA5knǡ
+d޽{3
+,kZnơRtgk_PMNοK[5UMJ\otG#0ÝٌAZA{aɀ2|7T=yI)VwRƚ'u̇~OQOt9^L<ۧ9/:s|s`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98ј`98 s9N2?,v&<B    IENDB`
\ No newline at end of file
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/nehe_tutorial/README lush-cvs/packages/opengl/nehe_tutorial/README
--- lush/packages/opengl/nehe_tutorial/README	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/opengl/nehe_tutorial/README	2007-05-23 01:12:17.000000000 -0400
@@ -0,0 +1,6 @@
+
+Fu Jie Huang, May 2007
+
+The set of popular "nehe" OpenGL tutorials (http://nehe.gamedev.net) 
+translated into Lush.
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/opengl.lsh lush-cvs/packages/opengl/opengl.lsh
--- lush/packages/opengl/opengl.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opengl/opengl.lsh	2008-05-13 00:18:46.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: opengl.lsh,v 1.4 2004/01/18 05:15:52 leonb Exp $
+;;; $Id: opengl.lsh,v 1.5 2008/05/13 04:18:46 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -92,6 +92,7 @@
 ;;
 
 (de glClearIndex( c )
+    (cheader "#include <stddef.h>")
     (cheader "#include <GL/gl.h>")
     ((GLfloat) c)
     #{ glClearIndex($c); #} ())
@@ -136,8 +137,8 @@
     ((GLenum) mode )
     #{ glFrontFace( $mode ); #} ())
 
-(de glPointSize( size )
-    ((GLfloat) size )
+	(de glPointSize( size )
+	    ((GLfloat) size )
     #{ glPointSize( $size ); #} ())
 
 (de glLineWidth( width )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/opengl/openglu.lsh lush-cvs/packages/opengl/openglu.lsh
--- lush/packages/opengl/openglu.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/opengl/openglu.lsh	2008-05-13 00:18:46.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: openglu.lsh,v 1.4 2004/01/18 05:15:52 leonb Exp $
+;;; $Id: openglu.lsh,v 1.5 2008/05/13 04:18:46 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -46,6 +46,7 @@
 
 (de gluBeginCurve (nurb)
     ((-gptr- "GLUnurbs*") nurb)
+    (cheader "#include <stddef.h>")
     (cheader "#include <GL/glu.h>")
     #{ gluBeginCurve ($nurb); #} ())
 (de gluBeginPolygon (tess)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/demos/mnist-kernel.lsh lush-cvs/packages/svm/demos/mnist-kernel.lsh
--- lush/packages/svm/demos/mnist-kernel.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/svm/demos/mnist-kernel.lsh	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: mnist-kernel.lsh,v 1.9 2005/05/19 15:30:09 leonb Exp $
+;;; $Id: mnist-kernel.lsh,v 1.10 2009/10/16 16:07:05 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -86,6 +86,7 @@
                   int s=0;
 
                 #if defined(__SSE2__)
+                # define asm __asm__
 
                   asm("pxor %%xmm6,%%xmm6\n\t"
                       "pxor %%xmm7,%%xmm7"
@@ -119,6 +120,7 @@
                       : "=m" (s) : "i"(0x4e), "i"(0x93) : "memory" );
 
                 #elif defined(__MMX__)
+                # define asm __asm__
 
                   asm("pxor %%mm6,%%mm6\n\t"
                       "pxor %%mm7,%%mm7"
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/demos/mnist-svqp.lsh lush-cvs/packages/svm/demos/mnist-svqp.lsh
--- lush/packages/svm/demos/mnist-svqp.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/svm/demos/mnist-svqp.lsh	2007-01-19 18:55:18.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: mnist-svqp.lsh,v 1.6 2006/01/25 15:15:25 leonb Exp $
+;;; $Id: mnist-svqp.lsh,v 1.7 2007/01/19 23:55:18 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -92,3 +92,39 @@
 	       (setq s (if (> s 0) c1 c2))
 	       (when (<> s y) (incr nerror)) ) ) ) )
     (printf "%d/%d errors (%l%%)\n" nerror nex (* 100 (/ nerror nex))) ) )
+
+
+(de run-pair-with-max-number-of-examples(c1 c2 maxno)
+  (printf "--------------------\nLoading data\n")
+  (setq mnist-svm (new Svqp2SVM mnist-kernel 20000) )
+  (let ((k 0) (n1 0) (n2 0))
+    (for (i 0 59999)
+	 (let ((y (==> mnist-kernel label i)))
+	   (when (or (and (= y c1) (< n1 maxno))
+                     (and (= y c2) (< n2 maxno)) )
+             (if (= y c1) (incr n1) (incr n2))
+	     (:mnist-svm:x k i)
+	     (:mnist-svm:y k (if (= y c1) +1 -1))
+	     (incr k) ) ) )
+    (idx-i1resize :mnist-svm:x k)
+    (idx-d1resize :mnist-svm:y k)
+    (printf "%d examples\n" k) )
+  (setq :mnist-svm:maxcachesize (* 200 1024 1024))
+  (setq :mnist-svm:cp 10)
+  (setq :mnist-svm:cn 10)
+  (printf "--------------------\nTraining 1 C-SVC ... Wait\n")
+  (let ((delay (cputime (==> mnist-svm run))))
+    (printf "Total time: %l cpu seconds (%d SV) \n" delay :mnist-svm:nsv) )
+  (printf "--------------------\nTesting on 10K test set ... Wait\n")
+  (let ((nex 0)
+	(nerror 0)
+	(lexp (==> mnist-svm get-expansion)) )
+    (for (i 60000 69999)
+	 (let ((y (==> mnist-kernel label i)))
+	   (when (or (= y c1) (= y c2))
+	     (let ((s (==> lexp predict i)))
+	       (incr nex)
+	       (setq s (if (> s 0) c1 c2))
+	       (when (<> s y) (incr nerror)) ) ) ) )
+    (printf "%d/%d errors (%l%%)\n" nerror nex (* 100 (/ nerror nex))) ) )
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/lasvm/kcache.c lush-cvs/packages/svm/lasvm/kcache.c
--- lush/packages/svm/lasvm/kcache.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/svm/lasvm/kcache.c	2007-01-25 17:42:09.000000000 -0500
@@ -24,13 +24,14 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: kcache.c,v 1.5 2005/04/27 15:42:49 leonb Exp $
+ * $Id: kcache.c,v 1.9 2007/01/25 22:42:09 leonb Exp $
  **********************************************************************/
 
 #include <stdlib.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
+#include <math.h>
 
 #include "messages.h"
 #include "kcache.h"
@@ -45,12 +46,15 @@
 
 struct lasvm_kcache_s {
   lasvm_kernel_t func;
+  lasvm_kcache_t *prevbuddy;
+  lasvm_kcache_t *nextbuddy;
   void *closure;
   long maxsize;
   long cursize;
   int l;
   int *i2r;
   int *r2i;
+  int maxrowlen;
   /* Rows */
   int    *rsize;
   float  *rdiag;
@@ -121,7 +125,10 @@
   self = (lasvm_kcache_t*)xmalloc(sizeof(lasvm_kcache_t));
   memset(self, 0, sizeof(lasvm_kcache_t));
   self->l = 0;
+  self->maxrowlen = 0;
   self->func = kernelfunc;
+  self->prevbuddy = self;
+  self->nextbuddy = self;
   self->closure = closure;
   self->cursize = sizeof(lasvm_kcache_t);
   self->maxsize = 256*1024*1024;
@@ -140,6 +147,11 @@
   if (self)
     {
       int i;
+      lasvm_kcache_t *nb = self->nextbuddy;
+      lasvm_kcache_t *pb = self->prevbuddy;
+      pb->nextbuddy = nb;
+      nb->prevbuddy = pb;
+      /* delete */
       if (self->i2r)
 	free(self->i2r);
       if (self->r2i)
@@ -193,6 +205,7 @@
       self->rdata[k] = ndata;
       self->rsize[k] = nlen;
       self->cursize += (long)(nlen - olen) * sizeof(float);
+      self->maxrowlen = max(self->maxrowlen, nlen);
     }
 }
 
@@ -226,52 +239,60 @@
 static void
 xswap(lasvm_kcache_t *self, int i1, int i2, int r1, int r2)
 {
-  int k = self->rnext[-1];
-  while (k >= 0)
+  /* swap row data */
+  if (r1 < self->maxrowlen || r2 < self->maxrowlen )
     {
-      int nk = self->rnext[k];
-      int n  = self->rsize[k];
-      int rr = self->i2r[k];
-      float *d = self->rdata[k];
-      if (r1 < n)
-	{
-	  if (r2 < n)
-	    {
-	      float t1 = d[r1];
-	      float t2 = d[r2];
-	      d[r1] = t2;
-	      d[r2] = t1;
-	    }
-	  else if (rr == r2)
-            {
-              d[r1] = self->rdiag[k];
-            }
-          else
-            {
-	      int arsize = self->rsize[i2];
-              if (rr < arsize && rr != r1)
-                d[r1] = self->rdata[i2][rr];
-              else
-                xtruncate(self, k, r1);
-            }
-	}
-      else if (r2 < n)
+      int mrl = 0;
+      int k = self->rnext[-1];
+      while (k >= 0)
         {
-          if (rr == r1)
+          int nk = self->rnext[k];
+          int n  = self->rsize[k];
+          int rr = self->i2r[k];
+          float *d = self->rdata[k];
+          if (r1 < n)
             {
-              d[r2] = self->rdiag[k];
+              if (r2 < n)
+                {
+                  float t1 = d[r1];
+                  float t2 = d[r2];
+                  d[r1] = t2;
+                  d[r2] = t1;
+                }
+              else if (rr == r2)
+                {
+                  d[r1] = self->rdiag[k];
+                }
+              else
+                {
+                  int arsize = self->rsize[i2];
+                  if (rr < arsize && rr != r1)
+                    d[r1] = self->rdata[i2][rr];
+                  else
+                    xtruncate(self, k, r1);
+                }
             }
-          else 
+          else if (r2 < n)
             {
-	      int arsize = self->rsize[i1];
-              if (rr < arsize && rr != r2)
-                d[r2] = self->rdata[i1][rr];
-              else
-                xtruncate(self, k, r2);
+              if (rr == r1)
+                {
+                  d[r2] = self->rdiag[k];
+                }
+              else 
+                {
+                  int arsize = self->rsize[i1];
+                  if (rr < arsize && rr != r2)
+                    d[r2] = self->rdata[i1][rr];
+                  else
+                    xtruncate(self, k, r2);
+                }
             }
+          mrl = max(mrl, self->rsize[k]);
+          k = nk;
         }
-      k = nk;
+      self->maxrowlen = mrl;
     }
+  /* swap r2i and i2r */
   self->r2i[r1] = i2;
   self->r2i[r2] = i1;
   self->i2r[i1] = r2;
@@ -299,30 +320,126 @@
   xswap(self, self->r2i[r1], i2, r1, self->i2r[i2]);
 }
 
-double 
-lasvm_kcache_query(lasvm_kcache_t *self, int i, int j)
+int 
+lasvm_kcache_shuffle(lasvm_kcache_t *self, int *ilist, int ilen)
 {
-  int l = self->l;
-  ASSERT(i>=0);
-  ASSERT(j>=0);
-  if (i<l && j<l)
+  int k = 0;
+  int maxid = 0;
+  float *m = 0;
+  char *c = 0;
+  int mrl = 0;
+  int i, j, r;
+
+  ASSERT(ilist);
+  ASSERT(ilen>0);
+  
+  /* find max index */
+  for (r=0; r<ilen; r++)
     {
-      /* check cache */
-      int s = self->rsize[i];
-      int p = self->i2r[j];
-      if (p < s)
-	return self->rdata[i][p];
-      else if (i == j && s >= 0)
-	return self->rdiag[i];
-      p = self->i2r[i];
-      s = self->rsize[j];
-      if (p < s)
-	return self->rdata[j][p];
+      i = ilist[r];
+      ASSERT(i>=0 && i<self->l);
+      maxid = max(maxid, i);
     }
+  /* compute map */
+  xminsize(self, maxid+1);
+  c = xmalloc(self->l);
+  memset(c, 0, self->l * sizeof(char));
+  for (r=0; r<ilen; r++)
+    c[ ilist[r] ] = 1;
+  /* sort ilist and remove duplicates */
+  ilen = 0;
+  for (i=0; i<self->l; i++)
+    if (c[i])
+      ilist[ilen++] = i;
+  /* reorganize cache entries */
+  m = xmalloc(ilen * sizeof(float));
+  k = self->rnext[-1];
+  while (k >= 0)
+    {
+      int nk = self->rnext[k];
+      int n  = self->rsize[k];
+      int rr = self->i2r[k];
+      float *d = self->rdata[k];
+      /* collect */
+      for (j=0; j<ilen; j++)
+        {
+          int r = self->i2r[ ilist[j] ];
+          if (r < n)
+            m[j] = d[r];
+          else if (r == rr)
+            m[j] = self->rdiag[r];
+          else
+            break;
+        }
+      /* copy */
+      if (j < n)
+        xtruncate(self, k, j);
+      else
+        xextend(self, k, j);
+      d = self->rdata[k];      
+      for (i=0; i<j; i++)
+        d[i] = m[i];
+      mrl = max(mrl, j);
+      /* next */
+      k = nk;
+    }
+  free(m);
+  /* recompose i2r and r2i */
+  r = 0;
+  for (i=0; i<self->l; i++)
+    if (c[i])
+      self->r2i[r++] = i;
+  for (i=0; i<self->l; i++)
+    if (!c[i])
+      self->r2i[r++] = i;
+  ASSERT(r == self->l);
+  for (r=0; r<self->l; r++)
+    self->i2r[ self->r2i[r] ] = r;
+  ASSERT(mrl <= ilen);
+  free(c);
+  /* return */
+  self->maxrowlen = mrl;
+  return ilen;
+}
+
+
+static double 
+xquery(lasvm_kcache_t *self, int i, int j)
+{
+  /* search buddies */
+  lasvm_kcache_t *cache = self->nextbuddy;
+  do {
+    int l = cache->l;
+    if (i<l && j<l)
+      {
+        int s = cache->rsize[i];
+        int p = cache->i2r[j];
+        if (p < s)
+          return cache->rdata[i][p];
+        if (i == j && s >= 0)
+          return cache->rdiag[i];
+        p = cache->i2r[i];
+        s = cache->rsize[j];
+        if (p < s)
+          return cache->rdata[j][p];
+      }
+    cache = cache->nextbuddy;
+  } while (cache != self);
   /* compute */
   return (*self->func)(i, j, self->closure);
 }
 
+
+double 
+lasvm_kcache_query(lasvm_kcache_t *self, int i, int j)
+{
+  ASSERT(self);
+  ASSERT(i>=0);
+  ASSERT(j>=0);
+  return xquery(self, i, j);
+}
+
+
 static void 
 xpurge(lasvm_kcache_t *self)
 {
@@ -349,29 +466,25 @@
     }
   else
     {
-      int olen, p, q;
+      int olen, p;
       float *d;
       if (i >= self->l || len >= self->l)
 	xminsize(self, max(1+i,len));
       olen = self->rsize[i];
-      if (olen < 0)
-	{
-	  self->rdiag[i] = (*self->func)(i, i, self->closure);
-	  olen = self->rsize[i] = 0;
-	}
-      xextend(self, i, len);
-      q = self->i2r[i];
-      d = self->rdata[i];
-      for (p=olen; p<len; p++)
-	{
-	  int j = self->r2i[p];
-	  if (i == j)
-	    d[p] = self->rdiag[i];
-	  else if (q < self->rsize[j])
-	    d[p] = self->rdata[j][q];
-	  else
-	    d[p] = (*self->func)(i, j, self->closure);
-	}
+      if (olen < len)
+        {
+          if (olen < 0)
+            {
+              self->rdiag[i] = (*self->func)(i, i, self->closure);
+              olen = self->rsize[i] = 0;
+            }
+          xextend(self, i, len);
+          d = self->rdata[i];
+          self->rsize[i] = olen;
+          for (p=olen; p<len; p++)
+            d[p] = lasvm_kcache_query(self, self->r2i[p], i);
+          self->rsize[i] = len;
+        }
       self->rnext[self->rprev[i]] = self->rnext[i];
       self->rprev[self->rnext[i]] = self->rprev[i];
       xpurge(self);
@@ -432,3 +545,22 @@
   return self->cursize;
 }
 
+void 
+lasvm_kcache_set_buddy(lasvm_kcache_t *self, lasvm_kcache_t *buddy)
+{
+  lasvm_kcache_t *p = self;
+  lasvm_kcache_t *selflast = self->prevbuddy;
+  lasvm_kcache_t *buddylast = buddy->prevbuddy;
+  /* check functions are identical */
+  ASSERT(self->func == buddy->func);
+  /* make sure we are not already buddies */
+  do { 
+    if (p == buddy) return; 
+    p = p->nextbuddy; 
+  } while (p != self);
+  /* link */
+  selflast->nextbuddy = buddy;
+  buddy->prevbuddy = selflast;
+  buddylast->nextbuddy = self;
+  self->prevbuddy = buddylast;
+}
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/lasvm/kcache.h lush-cvs/packages/svm/lasvm/kcache.h
--- lush/packages/svm/lasvm/kcache.h	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/svm/lasvm/kcache.h	2007-01-25 17:42:09.000000000 -0500
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: kcache.h,v 1.4 2005/06/29 20:47:13 leonb Exp $
+ * $Id: kcache.h,v 1.8 2007/01/25 22:42:09 leonb Exp $
  **********************************************************************/
 
 #ifndef KCACHE_H
@@ -146,6 +146,27 @@
 void lasvm_kcache_swap_ri(lasvm_kcache_t *self, int r1, int i2);
 
 
+/* --- lasvm_kcache_shuffle
+   Swaps the row ordering table in order to make sure that the 
+   first elements are exactly those found in <ilist[0]...ilist[ilen-1]>.
+   The elements are always kept in increasing order and the duplicates are eliminated. 
+   This function returns the number <n> of distinct elements.
+   Array <ilist> is reordered in the process.
+*/
+
+int lasvm_kcache_shuffle(lasvm_kcache_t *self, int *ilist, int ilen);
+
+
+
+/* --- lasvm_kcache_set_buddy
+   This function is called to indicate that the caches <self> and <buddy>
+   implement the same kernel function. When a buddy experiences a cache
+   miss, it can try querying its buddies instead of calling the 
+   kernel function.  Buddy relationship is transitive. */
+
+void lasvm_kcache_set_buddy(lasvm_kcache_t *self, lasvm_kcache_t *buddy);
+
+
 #ifdef __cplusplus__
 }
 #endif
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/lasvmcache.lsh lush-cvs/packages/svm/lasvmcache.lsh
--- lush/packages/svm/lasvmcache.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/svm/lasvmcache.lsh	2007-01-25 17:42:05.000000000 -0500
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: lasvmcache.lsh,v 1.3 2005/04/27 15:42:32 leonb Exp $
+;;; $Id: lasvmcache.lsh,v 1.7 2007/01/25 22:42:05 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -156,6 +156,25 @@
   () )
 
 
+(defmethod KernelCache shuffle(a)
+  ((-idx1- (-int-)) a)
+  (let ((len (idx-dim a 0)))
+    ((-int-) len)
+    #{{
+      int *ilist = IDX_PTR($a, int);
+      $len = lasvm_kcache_shuffle($kcache, ilist, $len);
+    }#}
+    len ) )
+
+(defmethod KernelCache set-buddy(k)
+  ((-obj- (KernelCache)) k)
+  (let ((other :k:kcache))
+    #{{
+      lasvm_kcache_set_buddy($kcache, $other);
+    }#}
+    k ) )
+
+
 ;; ----------------------------------------
 ;; COMPILE
 
@@ -176,6 +195,6 @@
 	    (KernelCache KernelCache -destructor call call-bypass label
 			 set-maximum-size get-maximum-size get-current-size
 			 get-i2r get-r2i i2r r2i swap-rr swap-ii swap-ri 
-			 row status discard) ) )
+			 row status discard shuffle set-buddy) ) )
 
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/svm.hlp lush-cvs/packages/svm/svm.hlp
--- lush/packages/svm/svm.hlp	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/svm/svm.hlp	2007-09-10 17:27:31.000000000 -0400
@@ -0,0 +1,28 @@
+#? *** Support Vector Machine (SVM)
+This package contains several implementations of the Support Vector
+Machine method. It includes interfaces to well known SVM libraries,
+such as libsvm, and svmfu. It also contain a few ultra-efficient
+implementations due to Leon Bottou and his collaborators
+such as lasvm, svqp, svqp2 and svqp3.
+
+Now for the bad news: there is essentially no documentation
+and practically no comment in the code. If you don't like
+it, complain to Leon Bottou.
+
+
+#? ** SVM Demos
+Demos of some of the SVMs on the MNIST
+dataset are available in <lush/packages/svm/demos>.
+
+
+#? ** lasvm
+Lasvm is a super-duper fast implementation of SVMs
+waiting for a documentation.
+
+
+#? ** libsvm
+Waiting for documentation.
+
+
+#? ** Optimizers
+svqp and svqp2 optimizers waiting for a documentation
\ No newline at end of file
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/svm/svqp2/svqp2.cpp lush-cvs/packages/svm/svqp2/svqp2.cpp
--- lush/packages/svm/svqp2/svqp2.cpp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/svm/svqp2/svqp2.cpp	2009-06-05 14:40:07.000000000 -0400
@@ -26,7 +26,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: svqp2.cpp,v 1.14 2006/10/02 12:58:08 leonb Exp $
+ * $Id: svqp2.cpp,v 1.16 2009/06/05 18:40:07 leonb Exp $
  **********************************************************************/
 
 //////////////////////////////////////
@@ -256,7 +256,9 @@
 	  p = new Arow(ai);
 #if HMG
           p->diag = (*Afunction)(ai, ai, Aclosure);
+# if KSTATS
           SVQP2::kcalcs += 1;
+# endif
 #endif
 	  p->next = c[h];
 	  c[h] = p;
@@ -460,7 +462,7 @@
   for (int i=0; i<n; i++)
     rows[i] = 0;
   for (int i=0; i<n; i++)
-    Aperm[i] = i;
+    Aperm[i] = pivot[i] = i;
   for (int i=0; i<n; i++)
     x[i] = cmin[i] = cmax[i] = b[i] = 0;
 }
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/video4linux/demos/demo-v4l2 lush-cvs/packages/video4linux/demos/demo-v4l2
--- lush/packages/video4linux/demos/demo-v4l2	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/video4linux/demos/demo-v4l2	2007-10-05 03:07:35.000000000 -0400
@@ -0,0 +1,167 @@
+#!/bin/sh
+exec lush "$0" "$@"
+!#
+
+(libload "video4linux/v4l2")
+(libload "libc/stopwatch")
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; process command line arguments
+
+(defparameter dev "/dev/video0")
+(defparameter width 640)
+(defparameter height 480)
+(defparameter eff ())
+(defparameter fps 30)
+(defparameter nb 4)
+(defparameter zz ())
+
+(when (or (member "-h" argv) (member "--help" argv))
+  (writing "$stderr" 
+	   (render-brace-text 0 72
+		'{<p> Synopsis: ,,(basename (or (car argv) "")) [-d device] [-s width height] [-e]<br>
+		A simple demo of video capture using the v4l2 interface
+		{<ul>
+		{<li> "-h": show this message}
+		{<li> "-d device": use <device> (default "/dev/video0")}
+		{<li> "-s width height": set width and height of image (default: 640 480)}
+		{<li> "-e": turn on edge extraction}
+		}}))
+  (exit 0))
+
+(let ((zz (member "-d" argv)))
+  (when zz
+    (if (not (cadr zz))
+	(progn
+	  (writing "$stderr" (printf "device missing\n"))
+	  (exit 1))
+      (setq dev (cadr zz)))))
+
+(let ((zz (member "-e" argv))) (when zz (setq eff t)))
+
+(let ((zz (member "-s" argv)))
+  (when zz
+    (if (not (cadr zz))
+	(progn
+	  (writing "$stderr" (printf "width missing\n"))
+	  (exit 1))
+      (setq width (val (cadr zz))))
+    (if (not (caddr zz))
+	(progn
+	  (writing "$stderr" (printf "height missing\n"))
+	  (exit 1))
+      (setq height (val (caddr zz))))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; video effects
+
+(defclass effect object 
+  ((-int-) width)
+  ((-int-) height))
+
+#? (new effect <width> <height>)
+;; noop effect: simply copies the input to the output unaffected
+(defmethod effect effect (w h) 
+  ((-int-) w h)
+  (setq width w) (setq height h))
+(defmethod effect width () width)
+(defmethod effect height () height)
+(defmethod effect fprop (in out)
+  ((-idx3- (-ubyte-)) in out) 
+  (idx-copy in out) ())
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(libload "libidx/idx-convol")
+
+;; simple edge detection
+(defclass effect-edge effect
+  ((-idx2- (-float-)) fin)
+  ((-idx2- (-float-)) fout)
+  ((-float-) bias)
+  ((-idx2- (-float-)) kernel))
+
+#? (new effect-edge <width> <height>)
+;; performs a simple edge detection by applying
+;; an on-center/off-surround convolution filter 
+;; and rectifying, amplifying and saturating the result.
+(defmethod effect-edge effect-edge (w h)
+  ((-int-) w h)
+  (setq width w) (setq height h)
+  (setq fin (float-matrix h w))
+  (setq kernel (float-matrix 5 5))
+  (idx-dotm0 
+   [f [-1 -2 -4 -2 -1]
+      [-2  2  4  2 -2]
+      [-4  4 12  4 -4]
+      [-2  2  4  2 -2]
+      [-1 -2 -4 -2 -1]]
+   ((float-matrix) 0.4) kernel)
+  (setq fout (float-matrix (1+ (- h (idx-dim kernel 0)))
+		     (1+ (- w (idx-dim kernel 1)))))
+  (setq bias -40))
+
+
+(defmethod effect-edge fprop (in out)
+  ((-idx3- (-ubyte-)) in out)
+  (let* ((oh (idx-dim fout 0))
+	 (ow (idx-dim fout 1)))
+    ;; compute luminance
+    (cidx-bloop ("i" "j" ("pin" in) ("pout" fin))
+      #{ *pout = 0.299 * (flt)(pin[0]) + 
+                 0.587 * (flt)(pin[1]) + 0.114 * (flt)(pin[2]); #})
+    (idx-f2convol fin kernel fout)
+    (let ((z (narrow (narrow out 0 oh 2) 1 ow 2)))
+      ;; rectify, amplify, invert, saturate
+      (cidx-bloop ("i" "j" ("pin" fout) ("pout" z))
+	#{{ register float zin;
+	    register unsigned char zout;
+ 	    zin = 255 - (fabs(*pin) + $bias);
+            zout = (unsigned char)( (zin > 0)? ( (zin < 256) ? zin : 255 ) : 0);
+  	    pout[0] = pout[1] = pout[2] = zout; 
+	    pout[3] = 255;
+          } #}) ())))
+
+(dhc-make () (effect effect fprop) (effect-edge effect-edge fprop))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; demo 
+
+(de demo (d width height eff fps nb)
+    (new-window (+ width 20) (+ height 20))
+    (let* ((evlock (new EventLock window))
+	   (event ())
+	   (stop ())
+	   (z (new v4l2device d width height fps nb))
+	   (frame-rgb (ubyte-matrix height width 3))
+	   (edge (new effect-edge width height))
+	   (frame-out (ubyte-matrix height width 3))
+	   (sw (new stopwatch))
+	   (tim 0))
+
+      (cls)
+      (setq tim (==> sw get))
+      
+      (while (and window (not stop))
+	(graphics-batch
+	 (==> z get-frame-rgb frame-rgb)
+	 (if eff
+	     (progn
+	       (==> edge fprop frame-rgb frame-out)
+	       (rgb-draw-matrix 10 10 frame-out))
+	   (rgb-draw-matrix 10 10 frame-rgb))
+	 (let ((ntim (==> sw get)))
+	   (color-rgb 0.2 0.2 1)
+	   (gprintf 12 30 "%4.1f FPS" (/ 1 (- ntim tim)))
+	   (setq tim ntim)))
+	(while (setq event (==> evlock check-event))
+	  (selectq (car event)
+	    (("q" delete) (setq stop t)))))))
+
+
+(writing "$stderr" (printf "Press 'q' to quit\n"))
+
+;; run demo
+(demo dev width height eff fps nb)
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/video4linux/demos/v4l-demo.lsh lush-cvs/packages/video4linux/demos/v4l-demo.lsh
--- lush/packages/video4linux/demos/v4l-demo.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/video4linux/demos/v4l-demo.lsh	2007-10-11 16:29:53.000000000 -0400
@@ -19,7 +19,7 @@
 (de v4l-demo-rgb (in swidth sheight)
   (when (not window) (new-window))
   (let* ((bg (ubyte-matrix sheight swidth 3))
-	 (vdev (new v4ldevice "/dev/video" "NTSC" in swidth sheight)))
+	 (vdev (new v4ldevice "/dev/video0" "NTSC" in swidth sheight)))
     (while t
       (==> vdev grab-into-rgb bg)
       (rgb-draw-matrix 2 2 bg))))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/video4linux/v4l2.lsh lush-cvs/packages/video4linux/v4l2.lsh
--- lush/packages/video4linux/v4l2.lsh	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/packages/video4linux/v4l2.lsh	2009-07-15 16:00:06.000000000 -0400
@@ -0,0 +1,633 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;
+;;; LUSH Lisp Universal Shell
+;;;   Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
+;;; Includes parts of TL3:
+;;;   Copyright (C) 1987-1999 Leon Bottou and Neuristique.
+;;; Includes selected parts of SN3.2:
+;;;   Copyright (C) 1991-2001 AT&T Corp.
+;;;
+;;; 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.
+;;;
+;;; 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, USA
+;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;; $Id: v4l2.lsh,v 1.5 2009/07/15 20:00:06 profshadoko Exp $
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; interface to Video4Linux-V2 (V4L2)
+;; See http://www.linuxtv.org/downloads/video4linux/API/V4L2_API/
+;; for API documentation.
+
+(libload "libc/constants")
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? ** v4l2device
+;; the v4l2 device is the main class through
+;; which video frames can be grabbed using the Video4Linux v2
+;; API. This requires a v4l2 compatible video grabbing card
+;; or webcam.
+;; 
+;; Although the v4l2 API supports a variety of video formats
+;; for grabbing, this interface only grabs images in the
+;; YUV422 format (also known as YUYV). The image can be
+;; converted to RGB is required using the <convert-yuv422-to-rgb>
+;; found in <libimage/img-util>
+;;
+;; Here is an example of code that repeatedly grabs an image
+;; from the composite video input and displays it on the screen:
+;;{<code>
+;; (de v4l2-test (d width height fps)
+;;   (libload "libimage/img-util")
+;;   (let  ((z (new v4l2device d width height fps 4))
+;; 	 (frame-rgb (ubyte-matrix height width 3)))
+;;     (when (not window) (new-window 0 0 (+ width 20) (+ height 20) "v4l2"))
+;;     (cls)
+;;     (repeat 1000
+;;       (==> z get-frame-rgb frame-rgb)
+;;       (rgb-draw-matrix 10 10 frame-rgb)) ))
+;; (v4l2-test "/dev/video0" 640 480 30)
+;; </code>}
+
+(defclass v4l2device object
+  ((-int-) fd)
+  ((-int-) width)
+  ((-int-) height)
+  ((-int-) started)
+  ((-idx1- (-gptr-)) buffers)
+  ((-idx1- (-int-)) bsizes)
+  ((-gptr- "struct v4l2_capability *") capptr)
+  ((-gptr- "struct v4l2_cropcap *") cropcapptr)
+  ((-gptr- "struct v4l2_crop *") cropptr)
+  ((-gptr- "struct v4l2_format *") fmtptr)
+  ((-gptr- "struct v4l2_requestbuffers *") rbptr)
+  )
+
+#? (new v4l2device <devname> <w> <h> <fps> <nb>)
+;; Open video device (webcam etc) <devname> (e.g. <"/dev/video0">)
+;; preparing to grab images of resoltion <w> by <h>.
+;; <fps> is the number of frames per seconds that the v4l2
+;; subsystem will grab. The period between two frames obtained
+;; from the device may be longer the <1/fps> if Lush spends too
+;; much time between calls to one of the <get-frame-XXX> methods.
+;; <nb> is the number of v4l2 buffers requested. Typical numbers
+;; are 2 or 4.
+(defmethod v4l2device v4l2device (devname w h fps nb)
+  ((-str-) devname)
+  ((-int-) w h fps nb)
+  (setq width w)
+  (setq height h)
+  (setq buffers (gptr-matrix nb))
+  (setq bsizes (int-matrix nb))
+  (setq capptr (to-gptr ()))
+  (setq cropcapptr (to-gptr ()))
+  (setq cropptr (to-gptr ()))
+  (setq fmtptr (to-gptr ()))
+  (setq fd -1)
+  (setq started 0)
+  (setq fd (to-int #{ open((char *)($devname->data), O_RDWR) #}))
+  (when (= fd -1) (error "could not open v4l2 device"))
+  (let ((ret 0))
+    ((-int-) ret)
+    (setq capptr (to-gptr #{ malloc(sizeof(struct v4l2_capability)) #}))
+    #{ memset($capptr, 0, sizeof(struct v4l2_capability));
+       $ret = ioctl($fd, VIDIOC_QUERYCAP, $capptr);
+    #}
+    (when (< ret 0) 
+      (==> this cleanup)
+      (error "could not query v4l2 device"))
+    (when (= 0 (to-int #{ $capptr->capabilities & V4L2_CAP_VIDEO_CAPTURE #}))
+      (==> this cleanup)
+      (error "v4l2 device does not support video capture"))
+    (when (= 0 (to-int #{ $capptr->capabilities & V4L2_CAP_STREAMING #}))
+      (==> this cleanup)
+      (error "v4l2 device does not support streaming i/o"))
+
+    ;; resetting cropping to full frame
+    (setq cropcapptr (to-gptr #{ malloc(sizeof(struct v4l2_cropcap)) #}))
+    (setq cropptr (to-gptr #{ malloc(sizeof(struct v4l2_crop)) #}))
+    #{ memset($cropcapptr, 0, sizeof(struct v4l2_cropcap));
+       $cropcapptr->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       if (0 == ioctl($fd, VIDIOC_CROPCAP, $cropcapptr)) {
+         $cropptr->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+         $cropptr->c = $cropcapptr->defrect; 
+         ioctl($fd, VIDIOC_S_CROP, $cropptr);
+       }
+    #}
+
+    ;; set format
+    (setq fmtptr (to-gptr #{ malloc(sizeof(struct v4l2_format)) #}))
+    #{ memset($fmtptr, 0, sizeof(struct v4l2_format));
+       $fmtptr->type                = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+       $fmtptr->fmt.pix.width       = $width; 
+       $fmtptr->fmt.pix.height      = $height;
+       $fmtptr->fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
+       $fmtptr->fmt.pix.field       = V4L2_FIELD_ANY;
+    #}
+    (when (< (to-int #{ ioctl($fd, VIDIOC_S_FMT, $fmtptr) #}) 0)
+      (==> this cleanup)
+      (error "unable to set v4l2 format"))
+
+    ;; set framerate
+    #{{ struct v4l2_streamparm* setfps;  
+        setfps=(struct v4l2_streamparm *) calloc(1, sizeof(struct v4l2_streamparm));
+        memset(setfps, 0, sizeof(struct v4l2_streamparm));
+        setfps->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        setfps->parm.capture.timeperframe.numerator=1;
+        setfps->parm.capture.timeperframe.denominator=$fps;
+        ioctl($fd, VIDIOC_S_PARM, setfps); 
+    } #}
+
+    ;; allocate and map the buffers
+    (setq rbptr (to-gptr #{ malloc(sizeof(struct v4l2_requestbuffers)) #}))
+    (let ((nbuf (idx-dim buffers 0)))
+      ((-int-) nbuf)
+      #{ $rbptr->count = $nbuf;
+         $rbptr->type =  V4L2_BUF_TYPE_VIDEO_CAPTURE;
+         $rbptr->memory = V4L2_MEMORY_MMAP;
+         $ret = ioctl($fd, VIDIOC_REQBUFS, $rbptr);
+      #}
+      (when (< ret 0)
+	(==> this cleanup)
+	(error "could not allocate v4l2 buffers"))
+      (setq ret 0)
+      #{{ void **bufp; int *sizep;
+          int i;
+          bufp = IDX_PTR($buffers,void*);
+          sizep = IDX_PTR($bsizes,int);
+          for (i=0; i<$nbuf; i++) { 
+            struct v4l2_buffer buf;
+	    int r;
+            memset(&buf, 0, sizeof(struct v4l2_buffer));
+            buf.index = i;
+	    buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	    buf.memory = V4L2_MEMORY_MMAP;
+
+	    r = ioctl($fd, VIDIOC_QUERYBUF, &buf);
+            /* printf("i=%u, length: %u, offset: %u, r=%d\n", i, buf.length, buf.m.offset, r); */
+            if (r < 0) { $ret = -(i+1); }
+            if ($ret == 0) {
+  	      bufp[i] = mmap(0, buf.length, PROT_READ + PROT_WRITE, MAP_SHARED, $fd, buf.m.offset);
+              sizep[i] = buf.length;
+	      if ( bufp[i] == MAP_FAILED) { $ret = -(i+1000); }
+            }
+          }
+         }#} )
+      (when (< ret 0)
+	(printf "ret=%d\n" ret)
+	(if (> ret -1000) 
+	    (progn
+	      (printf "query buffer %d\n" (- (+ 1 ret)))
+	      (==> this cleanup)
+	      (error "could not query v4l2 buffer")))
+	(printf "map buffer %d\n" (- (+ 1000 ret)))
+	(==> this cleanup)
+	(error "could not map v4l2 buffer"))
+      ;; set auto exposure
+      ;; (==> this set-exposure -1)
+      ;; (if (< (==> this set-gain -1) 0) (==> this set-gain 200))
+      ()))
+
+#? (==> <v4l2device> set-input <n>)
+;; Set active input to <n>.
+;; return 0 on success, -1 on failure.
+(defmethod v4l2device set-input (n)
+  ((-int-) n)
+  (to-int #{ ioctl($fd, VIDIOC_S_INPUT, &$n) #}))
+
+#? (==> <v4l2device> set-exposure <n>)
+;; Set exposure  to <n>.
+;; a Negative number sets to auto exposure,
+;; while a positive number sets to absolute exposure.
+;; return 0 on success, -1 on failure.
+(defmethod v4l2device set-exposure (n)
+  ((-int-) n)
+  (let ((ret 0) (ret2 0))
+    ((-int-) ret ret2)
+    (if (< n 0)
+	(progn
+          #{{ struct v4l2_control control;
+              memset (&control, 0, sizeof (control));
+              control.id = V4L2_CID_EXPOSURE_AUTO;
+              control.value = 1;
+              $ret = ioctl($fd, VIDIOC_S_CTRL, &control);
+          }#} ())
+      #{{ struct v4l2_control control;
+          memset (&control, 0, sizeof (control));
+          control.id = V4L2_CID_EXPOSURE_AUTO;
+          control.value = 0;
+          $ret = ioctl($fd, VIDIOC_S_CTRL, &control);
+          memset (&control, 0, sizeof (control));
+          control.id = V4L2_CID_EXPOSURE_ABSOLUTE;
+          control.value = $n;
+          $ret2 = ioctl($fd, VIDIOC_S_CTRL, &control);
+          }#} ())
+    (+ ret (* 2 ret2))))
+
+#? (==> <v4l2device> set-gain <n>)
+;; Set exposure  to <n>.
+;; a Negative number sets to auto gain,
+;; while a positive number sets to absolute gain.
+;; return 0 on success, -1 on failure.
+(defmethod v4l2device set-gain (n)
+  ((-int-) n)
+  (let ((ret 0) (ret2 0))
+    ((-int-) ret ret2)
+    (if (< n 0)
+	(progn
+          #{{ struct v4l2_control control;
+              memset (&control, 0, sizeof (control));
+              control.id = V4L2_CID_AUTOGAIN;
+              control.value = 1;
+              $ret = ioctl($fd, VIDIOC_S_CTRL, &control);
+          }#} ())
+      #{{ struct v4l2_control control;
+          memset (&control, 0, sizeof (control));
+          control.id = V4L2_CID_AUTOGAIN;
+          control.value = 0;
+          $ret = ioctl($fd, VIDIOC_S_CTRL, &control);
+          memset (&control, 0, sizeof (control));
+          control.id = V4L2_CID_GAIN;
+          control.value = $n;
+          $ret2 = ioctl($fd, VIDIOC_S_CTRL, &control);
+          }#} ())
+    (+ ret (* 2 ret2))))
+
+#? (==> <v4l2device> set-brightness <n>)
+;; Set brightness to <n>.
+;; return 0 on success, -1 on failure.
+(defmethod v4l2device set-brightness (n)
+  ((-int-) n)
+  (let ((ret 0))
+    ((-int-) ret)
+    #{{ struct v4l2_control control;
+        memset (&control, 0, sizeof (control));
+        control.id = V4L2_CID_BRIGHTNESS;
+        control.value = $n;
+        $ret = ioctl($fd, VIDIOC_S_CTRL, &control);
+    }#}
+    ret))
+
+#? (==> <v4l2device> set-contrast <n>)
+;; Set brightness to <n>.
+;; return 0 on success, -1 on failure.
+(defmethod v4l2device set-contrast (n)
+  ((-int-) n)
+  (let ((ret 0))
+    ((-int-) ret)
+    #{{ struct v4l2_control control;
+        memset (&control, 0, sizeof (control));
+        control.id = V4L2_CID_CONTRAST;
+        control.value = $n;
+        $ret = ioctl($fd, VIDIOC_S_CTRL, &control);
+    }#}
+    ret))
+
+
+#? (==> <v4l2device> get-frame-rgb <frame>)
+;; Get the next available frame from the v4l2 device
+;; and place it in <frame> in RGB format.
+;; <frame> must be an idx3 of ubytes of size
+;; <height> by <width> by <bpp>, where <bpp>
+;; must be at least 3.
+;; The underlying frame is actually grabbed in
+;; YUYV and converted to RGB.
+(defmethod v4l2device get-frame-rgb (frame) 
+  ((-idx3- (-ubyte-)) frame)
+  (when (or (< (idx-dim frame 2) 3) 
+	    (<> (idx-dim frame 0) height)
+	    (<> (idx-dim frame 1) width))
+    (error "frame has wrong size"))
+  (when (= 0 started) (==> this start))
+  (let ((ret 0)
+	(m0 (idx-modulo frame 0))
+	(m1 (idx-modulo frame 1)))
+    ((-int-) ret m0 m1)
+    #{{ struct v4l2_buffer buf;
+        void **buffers;
+        unsigned char *src, *dst;
+        int *bsizes, i, j, k;
+        buffers = IDX_PTR($buffers,void *);
+        bsizes = IDX_PTR($bsizes,int);
+        memset(&buf, 0, sizeof(struct v4l2_buffer));
+        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        $ret = ioctl ($fd, VIDIOC_DQBUF, &buf);
+        src = (unsigned char *)(buffers[buf.index]);
+        dst = IDX_PTR($frame,unsigned char);
+        for (i=0; i<$height; i++) {
+          for (j=0, k=0; j<$width; j++, k+=$m1) {
+            float f, y, u, v;
+            int j2;
+            j2 = j<<1;
+            y = src[j2]; 
+            if (j & 1) {
+              u = src[j2-1]; v = src[j2+1];
+            } else {
+              u = src[j2+1]; v = src[j2+3];
+            }
+            f = 1.164383*(y-16) + 1.596027*(v-128);
+            dst[k] = (f>=255)?0xff:((f<0)?0x00:(unsigned char)f);
+            f = 1.164383*(y-16) - 0.812968*(v-128) - 0.391726*(u-128);
+            dst[k+1] = (f>=255)?0xff:((f<0)?0x00:(unsigned char)f);
+            f = 1.164383*(y-16) + 2.017232*(u-128);
+            dst[k+2] = (f>=255)?0xff:((f<0)?0x00:(unsigned char)f);
+          }
+          src += $width << 1;
+          dst += $m0;
+        }
+        $ret += ioctl($fd, VIDIOC_QBUF, &buf);
+     }#} ret))
+
+
+#? (==> <v4l2device> get-frame-grey <frame>)
+;; Get the next available frame from the v4l2 device
+;; and place it in <frame> in greyscale format.
+;; <frame> must be an idx2 of ubytes of size
+;; <height> by <width>.
+(defmethod v4l2device get-frame-grey (frame) 
+  ((-idx2- (-ubyte-)) frame)
+  (when (or (<> (idx-dim frame 0) height)
+	    (<> (idx-dim frame 1) width))
+    (error "frame has wrong size"))
+  (when (= 0 started) (==> this start))
+  (let ((ret 0))
+    ((-int-) ret)
+    #{{ struct v4l2_buffer buf;
+        void **buffers;
+        unsigned char *buffer, *grey;
+        int *bsizes, i, j;
+        buffers = IDX_PTR($buffers,void *);
+        bsizes = IDX_PTR($bsizes,int);
+        memset(&buf, 0, sizeof(struct v4l2_buffer));
+        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        $ret = ioctl ($fd, VIDIOC_DQBUF, &buf);
+        buffer = (unsigned char *)(buffers[buf.index]);
+        grey = IDX_PTR($frame,unsigned char);
+        for (i=0; i<$height; i++) {
+          for (j=0; j<$width; j++) {
+            int k = i*$width+j;
+            grey[k] = buffer[k<<1];
+          }
+        }
+        $ret += ioctl($fd, VIDIOC_QBUF, &buf);
+     }#} ret))
+
+#? (==> <v4l2device> get-frame-yuv <frame>)
+;; Get the next available frame from the v4l2 device
+;; and place it in <frame> in YUV format.
+;; Unlike with YUV422, the U and V components are
+;; not subsampled.
+;; <frame> must be an idx3 of ubytes of size
+;; <height> by <width> by <bpp>, where <bpp>
+;; must be at least 3.
+;; The underlying frame is actually grabbed in
+;; YUYV (aka YUV422) and converted to YUV.
+(defmethod v4l2device get-frame-yuv (frame) 
+  ((-idx3- (-ubyte-)) frame)
+  (when (or (< (idx-dim frame 2) 3) 
+	    (<> (idx-dim frame 0) height)
+	    (<> (idx-dim frame 1) width))
+    (error "frame has wrong size"))
+  (when (= 0 started) (==> this start))
+  (let ((ret 0)
+	(m0 (idx-modulo frame 0))
+	(m1 (idx-modulo frame 1)))
+    ((-int-) ret m0 m1)
+    #{{ struct v4l2_buffer buf;
+        void **buffers;
+        unsigned char *src, *dst;
+        int *bsizes, i, j, k;
+        buffers = IDX_PTR($buffers,void *);
+        bsizes = IDX_PTR($bsizes,int);
+        memset(&buf, 0, sizeof(struct v4l2_buffer));
+        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        $ret = ioctl ($fd, VIDIOC_DQBUF, &buf);
+        src = (unsigned char *)(buffers[buf.index]);
+        dst = IDX_PTR($frame,unsigned char);
+        for (i=0; i<$height; i++) {
+          for (j=0, k=0; j<$width; j++, k+=$m1) {
+            int j2;
+            j2 = j<<1;
+            dst[k] = src[j2]; 
+            if (j & 1) {
+              dst[k+1] = src[j2-1]; dst[k+2] = src[j2+1];
+            } else {
+              dst[k+1] = src[j2+1]; dst[k+2] = src[j2+3];
+            }
+          }
+          src += $width << 1;
+          dst += $m0;
+        }
+        $ret += ioctl($fd, VIDIOC_QBUF, &buf);
+     }#} ret))
+
+
+#? (==> <v4l2device> get-frame-yuv422 <frame>)
+;; Get the next available frame from the v4l2 device
+;; and place it in <frame> in yuv422 format
+;; (also known as YUYV). <frame> must be an idx3 of 
+;; ubytes of size <height> by <width> by <2>.
+;; This is the most efficient of the <get-frame-XXX>
+;; functions as YUYV is the native format of
+;; many devices.
+(defmethod v4l2device get-frame-yuv422 (frame) 
+  ((-idx3- (-ubyte-)) frame)
+  (when (or (<> (idx-dim frame 2) 2) 
+	    (<> (idx-dim frame 0) height)
+	    (<> (idx-dim frame 1) width))
+    (error "frame has wrong size"))
+  (when (= 0 started) (==> this start))
+  (let ((ret 0))
+    ((-int-) ret)
+    #{{ struct v4l2_buffer buf;
+        void **buffers;
+        int *bsizes;
+        buffers = IDX_PTR($buffers,void *);
+        bsizes = IDX_PTR($bsizes,int);
+        memset(&buf, 0, sizeof(struct v4l2_buffer));
+        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        buf.memory = V4L2_MEMORY_MMAP;
+        $ret = ioctl ($fd, VIDIOC_DQBUF, &buf);
+        memcpy(IDX_PTR($frame,unsigned char), buffers[buf.index], bsizes[buf.index]);
+        $ret += ioctl($fd, VIDIOC_QBUF, &buf);
+     }#} ret))
+
+
+#? (==> v4l2device <start>)
+;; Tells the v4l2 device to start grabbing frames.
+;; There is no need to call this method explicitely as it 
+;; is called automatically when the first
+;; call to one of the <get-frame-XXX" methods is performed.
+(defmethod v4l2device start () 
+  (let ((ret 0))
+    ((-int-) ret)
+    ;; queue all buffers
+    (idx-gloop ((i) (b buffers))
+      #{{ struct v4l2_buffer buf;
+          memset(&buf, 0, sizeof(struct v4l2_buffer));
+          buf.type        = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+          buf.memory      = V4L2_MEMORY_MMAP;
+          buf.index       = $i;
+          $ret += ioctl ($fd, VIDIOC_QBUF, &buf);
+      }#})
+    (when (< ret 0) (printf "WARNING: could not enqueue v4l2 buffers\n"))
+    #{{ enum v4l2_buf_type type;
+        type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+        $ret = ioctl ($fd, VIDIOC_STREAMON, &type);
+    }#}
+    (if (< ret 0) 
+	(progn
+	  (printf "WARNING: could not start v4l2 capture\n")
+	  (setq started 0))
+      (setq started 1))
+    ()))
+
+#? (==> v4l2device <start>)
+;; Tells the v4l2 device to stop grabbing frames.
+;; There is no need to call this method explicitely as it 
+;; is called automatically when the device is destroyed.
+(defmethod v4l2device stop ()
+  (let ((ret -1))
+    ((-int-) ret)
+    (when (<> -1 fd)
+      #{{ enum v4l2_buf_type type;
+	  type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+  	  $ret = ioctl($fd, VIDIOC_STREAMOFF, &type);
+      }#})
+    (if (< ret 0) 
+	(printf "WARNING: could not stop v4l2 streaming\n")
+      (setq started 0))
+    ret))
+
+#? (==> <v4l2device> cleanup)
+;; private method to cleanup allocated objects in a v4l2 device.
+(defmethod v4l2device cleanup ()
+  (when (<> 0 started) (==> this stop))
+  #{ if ($capptr != NULL) { free($capptr); $capptr = NULL; }
+     if ($cropcapptr != NULL) { free($cropcapptr); $cropcapptr = NULL; }
+     if ($cropptr != NULL) { free($cropptr); $cropptr = NULL; }
+     if ($fmtptr != NULL) { free($fmtptr); $fmtptr = NULL; }
+     if ($rbptr != NULL) { free($rbptr); $rbptr = NULL; }
+  #} 
+  (let ((ret 0) (n (idx-dim buffers 0)))
+    ((-int-) ret n)
+    #{{ void **bufp; int *sizep, i;
+        bufp = IDX_PTR($buffers,void*);
+        sizep = IDX_PTR($bsizes,int);
+        for (i=0; i<$n; i++) { $ret += munmap( bufp[i], sizep[i] ); }
+    }#}
+    (when (< ret 0) (printf "WARNING: could not unmap v4l2 buffers\n")))
+  (when (<> -1 fd) #{ close($fd); #})
+  ())
+
+(defmethod v4l2device -destructor ()
+  (==> this cleanup) ())
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+#? * v4l2 utilities
+
+#? (find-video-devices)
+;; return a list of all available video devices,
+;; i.e. files of the form </dev/videoXX>.
+(de find-video-devices () 
+  (mapcar (concat "/dev/" (glob "video.*" (ls "/dev")))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; demo/test
+
+#? * v4l2 demos
+
+#? (v4l2-demo [<device>] [<width>] [<height>] [<input>] [<nbuf>] [<fps>] [<mode>])
+;; Testing/demo function for <v4l2device>: grabs 1000 video frames
+;; and simultaneously displays them in a Lush graphic window.
+;; All arguments are optional:
+;; <device>: video device (default: <"/dev/video0">).
+;; <width>, <height>: dimensions of the images to be grabbed
+;; (default: 320 by 240).
+;; <input>: input number from which frames will be grabbed (generally 0, 1, or 2). 
+;;  Default is -1, which leaves the input unchanged from the last time the
+;;  device was used.
+;; <nbuf>: number of frame buffers (default: 2).
+;; <mode>: 0 for RGB, 1 for grayscale, 2 for YUYV with "manual"
+;; conversion to RGB before display (default: 0).
+;; <fps>: frame rate at which v4l2 will grab frames.
+;; The actual frame rate is displayed on the screen. It may
+;; be lower than the one requested in <fps> (generally half).
+;; Example:
+;; {<code>
+;; (v4l2-demo "/dev/video0" 960 720 0 2 30 0)
+;; </code>}
+(de v4l2-demo (&optional (d "/dev/video0") (width 320) (height 240) (input -1) (nb 2) (fps 30) (mode 0))
+  (libload "libimage/img-util")
+  (libload "libc/stopwatch")
+  (let  ((z (new v4l2device d width height fps nb))
+	 (frame-grey (ubyte-matrix height width))
+	 (frame-yuv (ubyte-matrix height width 2))
+	 (frame-rgb (ubyte-matrix height width 3))
+	 (sw (new stopwatch))
+	 (tim 0))
+    (when (>= input 0) 
+      (when (< (==> z set-input input) 0) 
+	(printf "input=%d\n" input)
+	(error "could not select input")))
+    (when (not window) (new-window 0 0 (+ width 20) (+ height 20) "v4l2"))
+    (cls)
+    (setq tim (==> sw get))
+    (repeat 1000
+      (graphics-batch
+       (selectq mode
+	 ;; RGB (internal conversion from YUYV)
+	 (0 (==> z get-frame-rgb frame-rgb)
+	    (rgb-draw-matrix 10 10 frame-rgb))
+	 ;; greyscale
+	 (1 (==> z get-frame-grey frame-grey)
+	    (rgb-draw-matrix 10 10 frame-grey))
+	 ;; YUYV with "manual" conversion to RGB
+	 (2 (==> z get-frame-yuv422 frame-yuv)
+	    (convert-yuv422-to-rgb frame-yuv frame-rgb)
+	    (rgb-draw-matrix 10 10 frame-rgb))
+	 (t (error "unknown mode")))
+       (let ((ntim (==> sw get)))
+	 (color-rgb 0.2 0.2 1)
+	 (gprintf 12 30 "%4.1f FPS" (/ 1 (- ntim tim)))
+	 (setq tim ntim))))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(dhc-make 
+ ()
+ #{ #include <fcntl.h>              /* low-level i/o */
+    #include <unistd.h>
+    #include <errno.h>
+    #include <malloc.h>
+    #include <sys/stat.h>
+    #include <sys/types.h>
+    #include <sys/time.h>
+    #include <sys/mman.h>
+    #include <sys/ioctl.h>
+    #include <asm/types.h>          /* for videodev2.h */
+    #include <linux/videodev2.h>
+  #}
+ (v4l2device start stop cleanup 
+	     set-exposure set-gain set-brightness set-contrast
+	     v4l2device -destructor set-input 
+	     get-frame-yuv422 get-frame-grey get-frame-yuv get-frame-rgb)
+ )
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/video4linux/v4l.hlp lush-cvs/packages/video4linux/v4l.hlp
--- lush/packages/video4linux/v4l.hlp	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/video4linux/v4l.hlp	2007-09-30 22:53:56.000000000 -0400
@@ -2,22 +2,33 @@
 {<author> Yann LeCun}
 The video4linux package allows video frame grabbing under Linux using
 the video4linux API of the Linux kernel.  This interface is compatible
-with most video grabbing hardware supported by video4linux. Notable
-examples include (among many others) TV/Tuner cards based on the
-BrookTree BT8x8 chips (such as the WinTV cards from Hauppaugge), and
-v4l-supported webcams such the Logitech Quickam Pro 3000 and other USB
-webcams based on the Philips chipset (see list at {<hlink>
-"http://www.smcc.demon.nl/webcam"}.  NOTE: these Philips-based webcams
-requires a non-opensource driver called "pwcx" to handle resolutions
-higher than 160x120.  This driver can downloaded from {<hlink>
-"http://www.smcc.demon.nl/webcam/release.html"}.
-
-#? ** Requirements and Installation
-video4linux and appropriate device drivers are usually provided with
-most recent Linux distributions (as of september 2002, RedHat 7.3 
-and Mandrake 8.2). No special installation is required.
+with most video grabbing hardware supported by v4l and v4l2. 
 
-#? *** Video4Linux API
+IMPORTANT: two separate classes are provided for v4l and v4l2 devices.
+Some webcams and frame grabbers are only compatible with v4l2.
+
+Notable examples include (among many others) TV/Tuner cards based on
+the BrookTree BT8x8 chips (such as the WinTV cards from Hauppaugge),
+v4l-supported webcams such the Logitech Quickam Pro 3000 and 4000,
+and v4l2-supported webcams, such as the 250 or so listed at 
+<http://mxhaard.free.fr/spca5xx.html>. 
+
+NOTE: most of the webcams listed at the above page are only
+compatible with the v4l2 interface, NOT the v4l interface.
+
+Personnally, I use a Logitech Quickcam for Notebooks Pro, which
+can go up to 960x720 resolution.
+
+
+#? ** Requirements and Installation video4linux and appropriate device
+drivers are usually provided with most recent Linux distributions
+(e.g. Ubuntu 7.x). No special installation is required.
+
+#? *** Video4Linux-v2 API (v4l2)
+
+#? << video4linux/v4l2.lsh
+
+#? *** Video4Linux API (v4l)
 The Video4Linux interface to Lush is implemented through
 the class <v4ldevice>. Creating a new <v4ldevice> will open
 and initialize one of the Linux video devices.
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/packages/video4linux/v4l.lsh lush-cvs/packages/video4linux/v4l.lsh
--- lush/packages/video4linux/v4l.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/packages/video4linux/v4l.lsh	2007-09-30 22:53:56.000000000 -0400
@@ -22,7 +22,7 @@
 ;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
 ;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;; $Id: v4l.lsh,v 1.8 2003/01/14 22:08:46 profshadoko Exp $
+;;; $Id: v4l.lsh,v 1.9 2007/10/01 02:53:56 profshadoko Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -167,6 +167,9 @@
     (when (<> _info "") (printf "%s\n" _info))
     (error ,err)))
 
+;; simple warning message.
+(dmd v4l-warning (info) `(let ((_info ,info)) (printf "v4l Warning: %s\n" _info)))
+
 #? (==> <v4ldevice> cleanup)
 ;; deallocate all malloced slots and
 ;; close device. This is a private method called by
@@ -290,7 +293,7 @@
       #{ $channel->channel = $c;
          $retcode = ioctl($fd,VIDIOCGCHAN,$channel);
       #}
-      (when (= -1 retcode) (v4l-fatalerror "could not get channel info" ""))
+      (when (= -1 retcode) (v4l-warning "could not get channel info"))
       (cond 
        ((= "PAL" n) #{ $channel->norm = VIDEO_MODE_PAL; #} 
 	())
@@ -302,7 +305,7 @@
 	())
        (t (v4l-fatalerror "unsupported video mode (must be NTSC, PAL, SECAM, or AUTO)" "")))
       #{ $retcode = ioctl($fd,VIDIOCSCHAN,$channel); #}
-      (when (= -1 retcode) (v4l-fatalerror "could not set channel" "")))
+      (when (= -1 retcode) (v4l-warning "could not set channel")))
 
     ;; get max number of frames in buffer
     #{ $retcode = ioctl($fd,VIDIOCGMBUF,$mbuffer); #}    
@@ -761,6 +764,63 @@
      } #}
     (if (<> retcode 0) -1 frame)))
 
+#? (==> <v4ldevice> grab-yuv420p-into-yuv <img>)
+;; grab an image from the v4l device in YUV420P (planar) format 
+;; into a preexisting image (a ubyte-matrix of size 
+;; heightxwidthxdepth with depth at least equal to 3).
+;; Consecutive elements are interpreted as YUV components.
+;; This mode is useful for certain webcam that
+;; support YUV grabbing (e.g. Logitech Quickam 3000 Pro).
+(defmethod v4ldevice grab-yuv420p-into-yuv (img)
+  ((-idx3- (-ubyte-)) img)
+
+  (when (or (<> (idx-dim img 0) height)
+	    (<> (idx-dim img 1) width)
+	    (< (idx-dim img 2) 3))
+      (error "wrong size for YUVX image matrix"))
+  (let ((retcode 0))
+    ((-int-) retcode)
+    #{{
+        int i,j,lastframe,code;
+        unsigned char *imgptr, *bufptr;
+	int y_pos, cb_pos, cr_pos;
+	int even;
+        int mod1 = $img->mod[1];
+	lastframe = $frame;
+
+	/* compute next frame number */
+	$frame++; 
+	if ($frame >= $nframe) $frame = 0;
+
+        $mmapinfo->format = VIDEO_PALETTE_YUV420P;
+        $mmapinfo->width = $width;
+        $mmapinfo->height = $height;
+        $mmapinfo->frame = $frame;
+        $depth = depths[$mmapinfo->format];
+
+	$retcode = ioctl($fd, VIDIOCMCAPTURE, $mmapinfo);
+	code = ioctl($fd, VIDIOCSYNC, &lastframe);
+        // if (code == -1) error(NIL,"error ioctl(VIDIOCSYNC)",NIL);
+	$framebuffer = bufptr = (unsigned char *)$buffer + $mbuffer->offsets[lastframe];
+	imgptr = IDX_PTR($img, unsigned char);
+
+	even=1;
+	for (i=0; i<$height; i++) {
+          for (j=0; j<$width; j++) {
+               // if (i==200) { printf("new: %d %d %d\n",i,j,(int)(imgptr));}
+	       y_pos=i*$width+j;
+	       cb_pos=$width*$height + (i/2)*$width/2 + j/2;
+	       cr_pos=$width*$height*5/4 +(i/2)*$width/2 + j/2;
+               imgptr[0] = bufptr[y_pos];
+	       imgptr[1] = bufptr[cb_pos];
+	       imgptr[2] = bufptr[cr_pos];
+	       even = 1 - even;
+               imgptr += mod1;
+	  }
+	}
+     } #}
+    (if (<> retcode 0) -1 frame)))
+
 #? (==> <v4ldevice> grab-yuv420p-into-rgba <img> <alpha>)
 ;; grab an image from the v4l device in YUV420P (planar) format 
 ;; into a preexisting image (a ubyte-matrix of size 
@@ -828,6 +888,7 @@
      } #}
     (if (<> retcode 0) -1 frame)))
 
+
 #? (==> <v4ldevice> grab-grey-into-y <img>)
 ;; grab an image from the v4l device in GREY (monocrhome) format 
 ;; into a preexisting image (a ubyte-matrix of size heightxwidth.
@@ -1070,6 +1131,7 @@
 	   grab-yuv422-into-yuv422 
 	   grab-yuv420p-into-rgbx 
 	   grab-yuv420p-into-rgba 
+	   grab-yuv420p-into-yuv
 	   grab-grey-into-y 
 	   grab-into-rgb
 	   grab-into-rgbx 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/README lush-cvs/README
--- lush/README	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/README	2008-10-13 00:01:58.000000000 -0400
@@ -1,3 +1,4 @@
+
 ------------------------------------------------------------------------
 LUSH: The Lisp Universal SHell
 ------------------------------------------------------------------------
@@ -74,78 +75,47 @@
 
 
 ------------------------------------------------------------------------
-WHAT IS IN THIS DISTRIBUTION
-------------------------------------------------------------------------
-
-demos: A set of executable Lush scripts that demonstrate
-     its capabilities.
-
-config: contains configuration scripts and information
-
-src: source code of the interpreter
-
-lib: .a or .so files (currently unused)
-
-etc: various shell scripts and utilities
-
-include: .h files
-
-sys: core libraries (lush sources) without which Lush cannot run.
-     A minimal/customized version of Lush needs only that directory to run.
-
-lsh: library files (lush sources) that are part of the standard distribution.
-     Although they are not required for Lush to run, life would 
-     really suck without them.
-
-packages: library files (lush sources) for special applications or platforms, or
-     programs that have been contributed by users and cannot be assumed to be 
-     present/working in all installations of Lush.
-
-local: (empty) lush libraries that are specific to your site.
-
-doc: documentation in HTML, LaTeX, PostScript, PDF, and DjVu.
-
-
-------------------------------------------------------------------------
 PRE-REQUISITES TO INSTALLATION
 ------------------------------------------------------------------------
 
 Before you install Lush, you must make sure that certain packages
 are installed on your system. 
 
-ABSOLUTE PREREQUISITES (without this, Lush doesn't work):
+* DEBIAN, UBUNTU, and other Debian-based distros:
+
+ - REQUIRED PACKAGES: without these, Lush won't run properly:
+    - compilers: gcc, g++
+    - XWindows headers: libx11-dev
+    - dynamic loader library: binutils-dev
+    - various: indent, libreadline5, libreadline5-dev,
+    - Gnu Scientific Library: libgsl0 or libgsl0ldbl, libgsl0-dev.
+ - OPTIONAL PACKAGES: Lush is a lot more fun with these:
+    - OpenGL 3D graphics: freeglut3, freeglut3-dev, libgl1-mesa-dev
+    - SDL 2D graphics: 
+        libsdl1.2debian, libsdl1.2-dev, libsdl-image1.2, libsdl-image1.2dev
+    - linear algebra: BLAS/LAPACK: 
+        lapack3 and lapack3-dev OR atlas3-xxx, atlas3-xxx-dev
+    - Other optional packages used in some Lush specialized packages:
+        OpenCV, OpenRM, ALSA, HTK, libaudiofile
+
+* OTHER LINUX DISTROS:
+
+on Mandriva, SuSE, Fedora Core, etc, you should install 
+whatever packages give the same functionality as the ones
+above. They have similar names. The most important package
+is called either binutils or libbinutils, and the corresponding
+development package bintutils-devel or libbinturils-devel.
+CAUTION: install binutils from RPM or packages that come with your
+distro. DO NOT try to download, compile, and install binutils from the
+FSF as this may override some pretty low-level C libraries and screw
+up your system. If you are on a non-Linux system, you are probably OK
+installing this from source.
+
 
-- Under LINUX: libiberty and libbfd: 
-  These librariesare included in most Linux 
+ON OTHER LINUX/UNIX (Solaris, Irix):
+- libiberty and libbfd: These librariesare included in most Unices
   distros, but are not necessarily installed by default. They are
-  generally found in one of the "binutils" or "libbinutils" packages 
-  (For example, Mandrake 8.2 has it in libbinutils2-devel-2.11.92.0.12-6mdk.rpm
-  and Mandrake 9.0 in libbinutils2-devel-2.12.90.0.15-1mdk.i586.rpm).
-  CAUTION: if you are on Linux, install those from the RPMs that
-  come with your distro. DO NOT try to download, compile, and install 
-  binutils from the FSF as this may override some pretty low-level
-  C libraries and screw up your system. If you are on a non-Linux
-  system, you are probably OK installing this from source.
-
-
-OPTIONAL PREREQUISITES (without these, Lush is a lot less fun):
-[ A list of the corresponding RPM packages for various 
-  Linux distros is given at the bottom of this file]
-
-- GSL, BLAS, LAPACK: Most Linux distros come with some version of the Gnu 
-  Scientific Library (GSL), and the Linear Algebra Packages (LAPACK) on 
-  the CD, but the corresponding packages are generally not installed by 
-  default. Go to you CD and install gsl or libgsl, lapack or liblapack, 
-  and the corresponding -devel packages. You can also download the source
-  and install them by hand.
-- SDL: Most Linux distros come with some version of the Simple Directmedia 
-  Layer library (SDL), but many do not install the -devel packages by default.
-  (e.g. on Mandrake 8.2 libSDL1.2-1.2.3-6mdk and libSDL1.2-devel-1.2.3-6mdk).
-- OpenGL: Lush has support for 3D graphics with OpenGL. Make sure
-  you have accelerated OpenGL correctly set up on your machine
-  if you want to use that.
-- OpenCV, OpenRM, ALSA, HTK, libaudiofile: those packages are used by
-  some Lush packages. Install them if you need them.
+  generally found in one of the "binutils" or "libbinutils" 
 
 
 ------------------------------------------------------------------------
@@ -176,6 +146,39 @@
 begins with "OPTS=" or Lush may crash.
 
 ------------------------------------------------------------------------
+CONTENT OF THE DIRECTORIES
+------------------------------------------------------------------------
+
+demos: A set of executable Lush scripts that demonstrate
+     its capabilities.
+
+config: contains configuration scripts and information
+
+src: source code of the interpreter
+
+lib: .a or .so files (currently unused)
+
+etc: various shell scripts and utilities
+
+include: .h files
+
+sys: core libraries (lush sources) without which Lush cannot run.
+     A minimal/customized version of Lush needs only that directory to run.
+
+lsh: library files (lush sources) that are part of the standard distribution.
+     Although they are not required for Lush to run, life would 
+     really suck without them.
+
+packages: library files (lush sources) for special applications or platforms, or
+     programs that have been contributed by users and cannot be assumed to be 
+     present/working in all installations of Lush.
+
+local: (empty) lush libraries that are specific to your site.
+
+doc: documentation in HTML, LaTeX, PostScript, PDF, and DjVu.
+
+
+------------------------------------------------------------------------
 RUNNING LUSH INTERACTIVELY
 ------------------------------------------------------------------------
 
@@ -299,51 +302,3 @@
    [GPL]      (LeCun, Huang-Fu, NEC) 
 
      
-------------------------------------------------------------------------
-LIST OF PACKAGES THAT SHOULD BE INSTALLED BEFORE INSTALLING LUSH
-------------------------------------------------------------------------
-
-*********************
-*** Mandrake 9.0: ***
-*********************
-[packages marked (installed) are generally installed by default].
-
-REQUIRED:
-libbinutils2-2.12.90.0.15-1mdk.i586.rpm (installed)
-libbinutils2-devel-2.12.90.0.15-1mdk.i586.rpm
-
-OPTIONAL:
-libgsl0-1.2-2mdk.i586.rpm
-libgsl0-devel-1.2-2mdk.i586.rpm
-gsl-doc-1.2-2mdk.i586.rpm
-gsl-progs-1.2-2mdk.i586.rpm
-
-libblas3-3.0-1mdk.i586.rpm
-libblas3-devel-3.0-1mdk.i586.rpm
-liblapack3-3.0-1mdk.i586.rpm
-liblapack3-devel-3.0-1mdk.i586.rpm
-
-libalsa2-0.9.0-0.8rc2mdk.i586.rpm (installed)
-libalsa-data-0.9.0-0.8rc2mdk.i586.rpm (installed)
-libalsa2-devel-0.9.0-0.8rc2mdk.i586.rpm
-libalsa2-docs-0.9.0-0.8rc2mdk.i586.rpm
-
-libSDL1.2-1.2.4-11mdk.i586.rpm (installed)
-libSDL_image1.2-1.2.2-3mdk.i586.rpm (installed)
-libSDL_mixer1.2-1.2.4-5mdk.i586.rpm (installed)
-libSDL_net1.2-1.2.4-5mdk.i586.rpm (installed)
-libSDL_ttf2.0-2.0.5-3mdk.i586.rpm (installed)
-
-libSDL1.2-devel-1.2.4-11mdk.i586.rpm
-libSDL_image1.2-devel-1.2.2-3mdk.i586.rpm
-libSDL_mixer1.2-devel-1.2.4-5mdk.i586.rpm
-libSDL_net1.2-devel-1.2.4-5mdk.i586.rpm
-libSDL_ttf2.0-devel-2.0.5-3mdk.i586.rpm
-
-libMesaGL1-4.0.3-6mdk.i586.rpm (installed)
-libMesaGLU1-4.0.3-6mdk.i586.rpm (installed)
-libMesaglut3-4.0.3-6mdk.i586.rpm (installed)
-Mesa-4.0.3-6mdk.i586.rpm (installed)
-Mesa-demos-4.0.3-6mdk.i586.rpm (installed)
-libMesaGLU1-devel-4.0.3-6mdk.i586.rpm
-libMesaglut3-devel-4.0.3-6mdk.i586.rpm
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/README.mac lush-cvs/README.mac
--- lush/README.mac	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/README.mac	2007-12-18 10:26:49.000000000 -0500
@@ -10,7 +10,7 @@
 --------------
 
 You probably want to install some packages from either
-DarwinPorts: <http://darwinports.opendarwin.org/>  
+MacPorts: <http://www.macports.org/>  
 or Fink <http://fink.sourceforge.net/>.
 We recomment the following packages:
 	readline
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/allocate.c lush-cvs/src/allocate.c
--- lush/src/allocate.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/allocate.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: allocate.c,v 1.15 2004/02/07 01:32:49 leonb Exp $
+ * $Id: allocate.c,v 1.16 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 /***********************************************************************
@@ -474,7 +474,7 @@
 
 static FILE *malloc_file = 0;
 
-void set_malloc_file(char *s)
+void set_malloc_file(const char *s)
 {
     if (malloc_file) 
 	fclose(malloc_file);
@@ -485,7 +485,7 @@
 }
 
 
-void *lush_malloc(int x, char *file, int line)
+void *lush_malloc(int x, const char *file, int line)
 {
     void *z = malloc(x);
     if (malloc_file)
@@ -496,7 +496,7 @@
 }
 
 
-void *lush_calloc(int x,int y,char *file,int line)
+void *lush_calloc(int x,int y,const char *file,int line)
 {
     void *z = calloc(x,y);
     if (malloc_file)
@@ -506,7 +506,7 @@
     return z;
 }
 
-void *lush_realloc(void *x,int y,char *file,int line)
+void *lush_realloc(void *x,int y,const char *file,int line)
 {
     void *z = (void*)realloc(x,y);
     if (malloc_file) {
@@ -519,14 +519,14 @@
 }
 
 
-void lush_free(void *x,char *file,int line)
+void lush_free(void *x,const char *file,int line)
 {
     free(x);
     if (malloc_file)
 	fprintf(malloc_file,"%p\tfree\t%d\t%s:%d\n",x,0,file,line);
 }
 
-void lush_cfree(void *x,char *file,int line)
+void lush_cfree(void *x,const char *file,int line)
 {
 #if HAVE_CFREE
     cfree(x);
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/arith.c lush-cvs/src/arith.c
--- lush/src/arith.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/arith.c	2008-06-25 11:47:52.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: arith.c,v 1.4 2004/10/20 16:06:30 leonb Exp $
+ * $Id: arith.c,v 1.5 2008/06/25 15:47:52 leonb Exp $
  **********************************************************************/
 
 #include "header.h"
@@ -241,35 +241,38 @@
 
 DX(xsub)
 {
-  real a1, a2;
-
+  int i;
+  real a = 0;
   if (arg_number == 1) {
     ARG_EVAL(1);
     return NEW_NUMBER(-AREAL(1));
+  } else if (arg_number < 1) {
+    ARG_NUMBER(-1);
   } else {
-    ARG_NUMBER(2);
     ALL_ARGS_EVAL;
-    a1 = AREAL(1);
-    a2 = AREAL(2);
-    return NEW_NUMBER(a1 - a2);
+    a = AREAL(1);
+    for (i=2; i<=arg_number; i++)
+      a -= AREAL(i);
   }
+  return NEW_NUMBER(a);
 }
 
 DX(xdiv)
 {
-  real a1, a2;
-
+  int i;
+  real a =  0;
   if (arg_number == 1) {
     ARG_EVAL(1);
-    a1 = 1.0;
-    a2 = AREAL(1);
+    return NEW_NUMBER(1.0 / AREAL(1));
+  } else if (arg_number < 1) {
+    ARG_NUMBER(-1);
   } else {
-    ARG_NUMBER(2);
     ALL_ARGS_EVAL;
-    a1 = AREAL(1);
-    a2 = AREAL(2);
+    a = AREAL(1);
+    for (i=2; i<=arg_number; i++)
+      a /= AREAL(i);
   }
-  return NEW_NUMBER(a1 / a2);
+  return NEW_NUMBER(a);
 }
 
 DX(xpower)
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/check_func.c lush-cvs/src/check_func.c
--- lush/src/check_func.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/check_func.c	2009-10-16 12:07:05.000000000 -0400
@@ -25,7 +25,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: check_func.c,v 1.6 2004/04/16 14:42:58 leonb Exp $
+ * $Id: check_func.c,v 1.7 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 /* Functions that check the dimensions of index parameters */
@@ -93,7 +93,7 @@
 void print_dh_trace_stack(void)
 {
     struct dh_trace_stack *st = dh_trace_root;
-    char *lastinfo;
+    const char *lastinfo;
     int lastcount;
     
     /* Safely called from compiled code or from RUN_TIME_ERROR. */
@@ -166,7 +166,7 @@
  *****************************************************************************/
 
 void
-srg_resize_compiled(struct srg *sr, int new_size, char *file, int line) 
+srg_resize_compiled(struct srg *sr, int new_size, const char *file, int line) 
 {
   if(sr->flags & STS_MALLOC)  { 
     char *malloc_ptr; 
@@ -196,7 +196,7 @@
 }
 
 void
-srg_resize(struct srg *sr, int new_size, char *file, int line) 
+srg_resize(struct srg *sr, int new_size, const char *file, int line) 
 {
 #ifndef NOLISP
   if(sr->flags & STS_MALLOC) { 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/cpp.cpp lush-cvs/src/cpp.cpp
--- lush/src/cpp.cpp	1969-12-31 19:00:00.000000000 -0500
+++ lush-cvs/src/cpp.cpp	2008-09-16 11:59:27.000000000 -0400
@@ -0,0 +1,4 @@
+/* A dummy cpp file to make sure we link the right cpp support libraries */
+
+int dummy() { return 0; }
+
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/dh.c lush-cvs/src/dh.c
--- lush/src/dh.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/dh.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: dh.c,v 1.20 2005/01/17 18:23:25 leonb Exp $
+ * $Id: dh.c,v 1.21 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 #include "header.h"
@@ -361,8 +361,8 @@
 
 
 /* Remove extra chars added by enclose_in_string */
-static char *
-strclean(char *s)
+static const char *
+strclean(const char *s)
 {
   if (s != 0)
     while (*s && (*s==' ' || *s=='\t' || *s=='\n' || *s=='\r'))
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/dldbfd.c lush-cvs/src/dldbfd.c
--- lush/src/dldbfd.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/dldbfd.c	2008-09-16 11:59:27.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: dldbfd.c,v 1.54 2006/11/02 16:46:09 leonb Exp $
+ * $Id: dldbfd.c,v 1.57 2008/09/16 15:59:27 leonb Exp $
  **********************************************************************/
 
 #ifdef HAVE_CONFIG_H
@@ -2302,7 +2302,7 @@
                       else
                         {
                           fprintf(stderr,
-                                  "dldbfd: x86_64 relocation overflow\n"
+                                  "dldbfd: x86_64 relocation overflow (%s)\n"
                                   "  This happens when accessing data variables\n"
                                   "  located in a shared object loaded via dlopen\n"
                                   "  Instead of\n"
@@ -2310,9 +2310,9 @@
                                   "     if (remotevar = 15) ....\n"
                                   "  You can do:\n"
                                   "     extern int remotevar;\n"
-                                  "     int * volatile premotevar = &remotevar\n"
-                                  "     if (*premotevar = 15) ....\n"
-                                  );
+                                  "     static int* volatile premotevar = &remotevar\n"
+                                  "     if (*premotevar = 15) ....\n",
+                                  dummy_symbol.name );
                         }
 #endif
 		      if (stub)
@@ -3035,7 +3035,7 @@
 
 
 
-/* Some g++ versions need this symbol. */
+/* Some g++ versions need these symbols. */
 
 #if defined(__GNUC__) && (__GNUC__ < 3)
 void 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/dump.c lush-cvs/src/dump.c
--- lush/src/dump.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/dump.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: dump.c,v 1.7 2003/01/14 23:37:16 leonb Exp $
+ * $Id: dump.c,v 1.8 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 
@@ -182,7 +182,7 @@
 
 
 int 
-isdump(char *s)
+isdump(const char *s)
 {
   FILE *f;
   at *atf;
@@ -197,7 +197,7 @@
 }
 
 void 
-undump(char *s)
+undump(const char *s)
 {
   at *p;
   at *sym;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/event.c lush-cvs/src/event.c
--- lush/src/event.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/event.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: event.c,v 1.21 2004/02/04 19:52:17 leonb Exp $
+ * $Id: event.c,v 1.22 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 #include "header.h"
@@ -780,7 +780,7 @@
 
 void
 enqueue_eventdesc(at *handler, int event, 
-                  int xd, int yd, int xu, int yu, char *desc)
+                  int xd, int yd, int xu, int yu, const char *desc)
 {
   int mods = -1;
   at *ev = event_to_list(event, xd, yd, xu, yu, &mods);
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/fileio.c lush-cvs/src/fileio.c
--- lush/src/fileio.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/fileio.c	2010-09-26 14:29:02.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: fileio.c,v 1.26 2006/06/05 07:29:33 leonb Exp $
+ * $Id: fileio.c,v 1.29 2010/09/26 18:29:02 leonb Exp $
  **********************************************************************/
 
 
@@ -102,7 +102,7 @@
 /** cwd **/
 
 char *
-cwd(char *s)
+cwd(const char *s)
 {
 #ifdef UNIX
   if (s)
@@ -142,7 +142,7 @@
 /** files **/
 
 at *
-files(char *s)
+files(const char *s)
 {
   at *ans = NIL;
   at **where = &ans;
@@ -214,7 +214,7 @@
 
 
 static int 
-makedir(char *s)
+makedir(const char *s)
 {
 #ifdef UNIX
   return mkdir(s,0777);
@@ -235,7 +235,7 @@
 
 
 static int 
-deletefile(char *s)
+deletefile(const char *s)
 {
 #ifdef WIN32
    if (dirp(s))
@@ -319,11 +319,12 @@
  * using O_EXCL */
    
 static int 
-lockfile(char *filename)
+lockfile(const char *filename)
 {
   int fd;
   time_t tl;
-
+  char *s = string_buffer;
+  ssize_t n;
 #ifdef WIN32
   fd = _open(filename, _O_RDWR|_O_CREAT|_O_EXCL, 0644);
 #else
@@ -363,7 +364,18 @@
 	    user, computer, time(&tl));
   }
 #endif
-  write(fd, string_buffer, strlen(string_buffer));
+  n = strlen(string_buffer);
+  while (n > 0)
+    {
+      ssize_t l = write(fd, s, n);
+      if (l <= 0)
+        {
+          close(fd);
+          test_file_error(NULL);
+        }
+      s += l;
+      n -= l;
+    }
   close(fd);
   return 1;
 }
@@ -384,7 +396,7 @@
 /** dirp **/
 
 int 
-dirp(char *s)
+dirp(const char *s)
 {
   /* UNIX implementation */
 #ifdef UNIX
@@ -426,7 +438,7 @@
 /** filep **/
 
 int 
-filep(char *s)
+filep(const char *s)
 {
 #ifdef UNIX
   struct stat buf;
@@ -545,13 +557,13 @@
 
 /** dirname **/
 
-char *
-dirname(char *fname)
+const char *
+dirname(const char *fname)
 {
   /* UNIX implementation */  
 #ifdef UNIX
-  char *s = fname;
-  char *p = 0;
+  const char *s = fname;
+  const char *p = 0;
   char *q = string_buffer;
   while (*s) {
     if (s[0]=='/' && s[1])
@@ -585,7 +597,7 @@
   }
   /* Search last non terminal / or \ */
   p = 0;
-  s = fname;
+  s = (char*)fname;
   while (*s) {
     if (s[0]=='\\' || s[0]=='/')
       if (s[1] && s[1]!='/' && s[1]!='\\')
@@ -641,8 +653,8 @@
 
 /** basename **/
 
-char *
-basename(char *fname, char *suffix)
+const char *
+basename(const char *fname, const char *suffix)
 {
   /* UNIX implementation */
 #ifdef UNIX
@@ -674,8 +686,8 @@
   /* WIN32 implementation */
 #ifdef WIN32
   int sl;
-  char *p = fname;
-  char *s = fname;
+  char *p = (char*)fname;
+  char *s = (char*)fname;
   /* Special cases */
   if (fname[0] && fname[1]==':') {
     strcpyif(string_buffer,fname);
@@ -729,8 +741,8 @@
 
 /** concat_fname **/
 
-char *
-concat_fname(char *from, char *fname)
+const char *
+concat_fname(const char *from, const char *fname)
 {
   /* UNIX implementation */
 #ifdef UNIX
@@ -862,8 +874,8 @@
 
 /** relative_fname **/
 
-char *
-relative_fname(char *from, char *fname)
+const char *
+relative_fname(const char *from, const char *fname)
 {
   int fromlen;
   from = concat_fname(NULL,from);
@@ -900,7 +912,7 @@
 
 DX(xrelative_fname)
 {
-  char *s;
+  const char *s;
   ARG_NUMBER(2);
   ARG_EVAL(1);
   ARG_EVAL(2);
@@ -934,12 +946,12 @@
   }
 }
 
-char *
-tmpname(char *dir, char *suffix)
+const char *
+tmpname(const char *dir, const char *suffix)
 {
   char buffer[64];
-  char *tmp;
-  char *dot;
+  const char *tmp;
+  const char *dot;
   struct tmpname *tm;
   static int uniq = 0;
   int fd;
@@ -1076,7 +1088,7 @@
 
   /* Searches auxilliary files */
   {
-    static char *trials[] = {
+    static const char *trials[] = {
       "stdenv.dump",
       "sys/stdenv.dump",
       "sys/stdenv.lshc",
@@ -1100,11 +1112,11 @@
 #endif
       0L,
     };
-    char **st = trials;
+    const char **st = trials;
     strcpy(file_name,dirname(file_name));
     while (*st) 
       {
-	char *s = concat_fname(file_name,*st++);
+	const char *s = concat_fname(file_name,*st++);
 #ifdef DEBUG_DIRSEARCH
 	printf("D %s\n",s);
 #endif
@@ -1136,10 +1148,11 @@
  *   
  */
 
-static char *
-add_suffix(char *q, char *suffixes)
+static const char *
+add_suffix(const char *q, const char *suffixes)
 {
-  char *s;
+  char *d;
+  const char *s;
   /* Trivial suffixes */
   if (!suffixes)
     return q;
@@ -1173,10 +1186,10 @@
   if (strlen(q) + (s - suffixes) > FILELEN - 4)
     error(NIL,"Filename is too long",NIL);
   strcpy(file_name, q);
-  q = file_name + strlen(file_name);
-  *q++ = '.';
-  strncpy(q, suffixes, s - suffixes);
-  q[s-suffixes] = 0;
+  d = file_name + strlen(file_name);
+  *d++ = '.';
+  strncpy(d, suffixes, s - suffixes);
+  d[s-suffixes] = 0;
   return file_name;
 }
 
@@ -1190,7 +1203,7 @@
  */
 
 static int
-test_suffixes(char *suffixes)
+test_suffixes(const char *suffixes)
 {
   if (!suffixes)
   {
@@ -1218,9 +1231,9 @@
   else
   {
     /* New style suffix */
-    char *s = suffixes;
+    const char *s = suffixes;
+    const char *r;
     char *q = file_name + strlen(file_name);
-    char *r;
     /* -- loop over suffix string */
     while (s)
     {
@@ -1251,10 +1264,10 @@
  * Returns the full filename in a static area.
  */
 
-char *
-search_file(char *ss, char *suffixes)
+const char *
+search_file(const char *ss, const char *suffixes)
 {
-  char *c;
+  const char *c;
   char s[FILELEN];
   
   /* -- copy ss into static buffer */
@@ -1306,8 +1319,8 @@
 
 DX(xfilepath)
 {
-  char *suf = "|.lshc|.snc|.tlc|.lsh|.sn|.tl";
-  char *ans;
+  const char *suf = "|.lshc|.snc|.tlc|.lsh|.sn|.tl";
+  const char *ans;
   ALL_ARGS_EVAL;
   if (arg_number!=1)
   {
@@ -1335,7 +1348,7 @@
 int stdout_errors = 0;
 
 #ifndef HAVE_STRERROR
-char *
+const char *
 strerror(int errno)
 {
 
@@ -1406,10 +1419,10 @@
  */
 
 FILE *
-attempt_open_read(char *s, char *suffixes)
+attempt_open_read(const char *s, const char *suffixes)
 {
   FILE *f;
-  char *name;
+  const char *name;
 
   /*** spaces in name ***/
   while (isspace((int)(unsigned char)*s))
@@ -1442,7 +1455,7 @@
 
 
 FILE *
-open_read(char *s, char *suffixes)
+open_read(const char *s, const char *suffixes)
 {
   FILE *f;
   
@@ -1463,7 +1476,7 @@
  */
 
 FILE *
-attempt_open_write(char *s, char *suffixes)
+attempt_open_write(const char *s, const char *suffixes)
 {
   FILE *f;
 
@@ -1514,7 +1527,7 @@
 
 
 FILE *
-open_write(char *s, char *suffixes)
+open_write(const char *s, const char *suffixes)
 {
   FILE *f;
   
@@ -1534,7 +1547,7 @@
  */
 
 FILE *
-attempt_open_append(char *s, char *suffixes)
+attempt_open_append(const char *s, const char *suffixes)
 {
   FILE *f;
 
@@ -1580,7 +1593,7 @@
 
 
 FILE *
-open_append(char *s, char *suffixes)
+open_append(const char *s, const char *suffixes)
 {
   FILE *f;
   
@@ -1700,7 +1713,7 @@
  */
 
 void 
-set_script(char *s)
+set_script(const char *s)
 {
   if (error_doc.script_file) {
     fputs("\n\n *** End of script ***\n", error_doc.script_file);
@@ -1833,6 +1846,7 @@
 
   context_push(&mycontext);
   context->input_tab = 0;
+  context->input_case_sensitive = 0;
   context->input_string = 0;
   context->input_file = f;
 
@@ -1928,6 +1942,7 @@
     error("reading-string", "string expected", str);
   context_push(&mycontext);
   context->input_tab = 0;
+  context->input_case_sensitive = 0;
   context->input_string = SADD(str->Object);
   if (sigsetjmp(context->error_jump, 1)) {
     context->input_tab = -1;
@@ -2017,7 +2032,7 @@
 init_fileio(char *program_name)
 {
   at *q;
-  char *s;
+  const char *s;
 
   /** SETUP PATH */
   at_path = var_define("*PATH");
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/graphics.c lush-cvs/src/graphics.c
--- lush/src/graphics.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/graphics.c	2007-02-06 14:36:46.000000000 -0500
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: graphics.c,v 1.16 2006/02/24 17:14:27 leonb Exp $
+ * $Id: graphics.c,v 1.17 2007/02/06 19:36:46 leonb Exp $
  **********************************************************************/
 
 
@@ -206,14 +206,19 @@
           UNLOCK(q);
           error(NIL, "this driver does not support 'font'", NIL);
         }
-      UNLOCK(q);
-    q = NIL;
-    if (r)
-      {
-        q = str_utf8_to_mb(r);
-        UNLOCK(win->font);
-        win->font = q;
-      }
+      if (r)
+        {
+          at *a = str_utf8_to_mb(r);
+          UNLOCK(win->font);
+          win->font = a;
+          UNLOCK(q);
+          q = a;
+        }
+      else
+        {
+          UNLOCK(q);
+          q = NIL;
+        }
     }
   LOCK(q);
   return q;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/htable.c lush-cvs/src/htable.c
--- lush/src/htable.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/htable.c	2010-10-28 22:37:16.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: htable.c,v 1.14 2006/11/07 20:58:34 leonb Exp $
+ * $Id: htable.c,v 1.16 2010/10/29 02:37:16 leonb Exp $
  **********************************************************************/
 
 /***********************************************************************
@@ -403,7 +403,7 @@
         for (n=htable->table[i]; n; n=n->next)
           {
             p = cons(n->key, p); /* steal lock */
-            add_finalizer(p, hashelt_finalize, htable);
+            add_finalizer(n->key, hashelt_finalize, htable);
           }
       htable->keylockp = 0;
       UNLOCK(p);
@@ -571,10 +571,11 @@
 {
   char buffer[24];
   unsigned long x;
+  int l = 2 * sizeof(long);
   ARG_NUMBER(1);
   ARG_EVAL(1);
   x = hash_value(APOINTER(1));
-  sprintf(buffer,"%08x", (int)(x));
+  sprintf(buffer,"%0*lx", l, x);
   return new_string(buffer);
 }
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/index.c lush-cvs/src/index.c
--- lush/src/index.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/index.c	2010-10-28 22:37:16.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: index.c,v 1.28 2005/11/14 15:35:06 leonb Exp $
+ * $Id: index.c,v 1.31 2010/10/29 02:37:16 leonb Exp $
  **********************************************************************/
 
 /******************************************************************************
@@ -287,6 +287,7 @@
   real (*get)(gptr,int) = *storage_type_getr[type];
   gptr base;
   union { real r; long l[2]; } u;
+  u.l[0] = u.l[1] = 0;
   /* compute */
   index_read_idx(ind,&id);
   base = (char*) IDX_DATA_PTR(&id);
@@ -2218,14 +2219,14 @@
   int size, elsize, type;
   char *pntr;
   real x;
-  void (*setf)(gptr,int,flt);
+  void (*setr)(gptr,int,real);
 
   /* validate */
   mode_check(p, &size, &elsize);
   contiguity_check(p);
   ind = p->Object;
   type = ind->st->srg.type;
-  setf = storage_type_setf[type];
+  setr = storage_type_setr[type];
   if (ind->flags & IDF_UNSIZED)
     return;
   if (ind->st->srg.type == ST_AT ||
@@ -2240,7 +2241,7 @@
       index_rls_idx(ind,&id);
       error(NIL,"Cannot read a number",NIL);
     }
-    (*setf)(pntr, off, rtoF(x));
+    (*setr)(pntr, off, x);
   } end_idx_aloop1(&id, off);
   index_rls_idx(ind,&id);
 }
@@ -2390,13 +2391,13 @@
   load_matrix_header(f, &ndim, &magic, &swapflag, dim);
   /* Create */
   switch (magic) {
-  case ASCII_MATRIX:
   case BINARY_MATRIX:
     ans = F_matrix(ndim, dim);
     break;
   case PACKED_MATRIX:
     ans = P_matrix(ndim, dim);
     break;
+  case ASCII_MATRIX:
   case DOUBLE_MATRIX:
     ans = D_matrix(ndim, dim);
     break;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/io.c lush-cvs/src/io.c
--- lush/src/io.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/io.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: io.c,v 1.23 2006/10/09 12:50:47 leonb Exp $
+ * $Id: io.c,v 1.27 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 /***********************************************************************
@@ -424,7 +424,7 @@
  * make_testchar_map(s,buf[256])
  */
 static void
-make_testchar_map(char *s, char *buf)
+make_testchar_map(const char *s, char *buf)
 {
   memset(buf, 0, 256);
   if (s)
@@ -461,7 +461,7 @@
  * available
  */
 char 
-skip_char(char *s)
+skip_char(const char *s)
 {
   int c;
   char map[256];
@@ -681,8 +681,11 @@
       if (!isascii(c) || iscntrl(c))
 	goto errw1;
       else if (s < string_buffer + STRING_BUFFER - 2) {
-        if (s > string_buffer && c == '_') c = '-';
-	*s++ = tolower(c);
+        if (s > string_buffer && c == '_') 
+          c = '-';
+        if (! context->input_case_sensitive)
+          c = tolower(c);
+        *s++ = c;
       } else
 	goto errw2;
     }
@@ -706,6 +709,40 @@
  */
 
 static at *
+rl_utf8(long h)
+{
+  char ub[8];
+  char *u = ub;
+  if (h > 0x10ffff)
+    return 0;
+  else if (h > 0xffff)
+    {
+      *u++ = 0xe0 | (unsigned char)(h>>18);
+      *u++ = 0x80 | (unsigned char)((h>>12)&0x3f);
+      *u++ = 0x80 | (unsigned char)((h>>6)&0x3f);
+      *u++ = 0x80 | (unsigned char)(h&0x3f);
+    }
+  else if (h > 0x7ff)
+    {
+      *u++ = 0xe0 | (unsigned char)(h>>12);
+      *u++ = 0x80 | (unsigned char)((h>>6)&0x3f);
+      *u++ = 0x80 | (unsigned char)(h&0x3f);
+    }
+  else if (h > 0x7f)
+    {
+      *u++ = 0xc0 | (unsigned char)(h>>6);
+      *u++ = 0x80 | (unsigned char)(h&0x3f);
+    }
+  else
+    {
+      *u++ = (unsigned char)h;
+    }
+  *u++ = 0;
+  return str_utf8_to_mb(ub);
+}
+
+
+static at *
 rl_string(register char *s)
 {
   register char *d, *ind;
@@ -737,24 +774,44 @@
 	  goto err_string;
 	*d++ = h;
 
+      } else if (*s == 'u' || *s == 'U') {
+	unsigned long h = 0;
+        int c = ((*s == 'u') ? 4 : 8);
+        at *m;
+	s++;
+	for (; c > 0; c--) {
+	  ind = strchr(digit_string, tolower((unsigned char)*s));
+	  if (*s && ind) {
+	    h *= 16;
+	    h += (ind - digit_string);
+	    s++;
+	  } else
+	    break;
+	}
+        m = rl_utf8(h);
+        if (! EXTERNP(m, &string_class))
+	  goto err_string;
+        strcpy(d, SADD(m->Object));
+        d += strlen(d);
+        UNLOCK(m);
+
       } else if (*s == '^' && s[1]) {	/* control */
 	*d++ = (s[1]) & (0x1f);
 	s += 2;
-	
+
       } else if (*s == '+' && s[1]) {	/* high bit latin1*/
-#if HAVE_WCRTOMB
-	wchar_t wc = s[1] | 0x80;
-	char buffer[MB_LEN_MAX];
-	int m = wcrtomb(buffer, wc, NULL);
-	if (m > 0)
-	  {
-	    memcpy(d, buffer, m);
-	    d += m;
-	  }
-	else
-#endif	
-	  *d++ = (s[1]) | (0x80);
+#if HAVE_ICONV
+        at *m = rl_utf8(s[1] | 0x80);
+        if (! EXTERNP(m, &string_class))
+	  goto err_string;
+        strcpy(d, SADD(m->Object));
+        d += strlen(d);
+        UNLOCK(m);
+#else
+        *d++ = (s[1]) | 0x80;
+#endif
 	s += 2;
+
       } else if (*s == '\n') {	/* end of line */
 	s++;
 	
@@ -994,7 +1051,7 @@
  * print_string s prints the string s via the print_char routine.
  */
 void 
-print_string(register char *s)
+print_string(const char *s)
 {
   if (s)
     {
@@ -1102,17 +1159,17 @@
       UNLOCK(l);
       l = checksend(cl,at_print);
       if (l)
-      {
-        if (recur_push_ok(&elt,&print_string,list))
         {
-          list = send_message(NIL, list, at_print, NIL);
-          recur_pop(&elt);
+          if (recur_push_ok(&elt,&print_string,list))
+            {
+              list = send_message(NIL, list, at_print, NIL);
+              recur_pop(&elt);
+              UNLOCK(l);
+              UNLOCK(list);
+              return;
+            }
           UNLOCK(l);
-          UNLOCK(list);
-          return;
-        }
-        UNLOCK(l);
-      } 
+        } 
     }
     print_string(pname(list));
   }
@@ -1381,8 +1438,8 @@
       
       mode = 0;
       if (list->flags & X_SYMBOL) {
-	for (m = n; *m; m++)
-	  if (!isascii((unsigned char)*m) || 
+        for (m = n; *m; m++)
+          if (!isascii((unsigned char)*m) || 
               iscntrl((unsigned char)*m) ||
               isupper((unsigned char)*m) ||
               (m>n && *m=='_') ||
@@ -1391,7 +1448,9 @@
               mode = 1;
               break;
             }
-	if(!*n)
+        if (!mode && (q = str_val(n)))
+          mode = 1;
+        if (!mode && !*n)
 	  mode = 1;
       }
       if (mode)
@@ -1408,6 +1467,7 @@
       return s;
     }
  exit_convert:
+  UNLOCK(q);
   *s = 0;
   strcpy(s, " ... ");
   return 0L;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/lisp_c.c lush-cvs/src/lisp_c.c
--- lush/src/lisp_c.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/lisp_c.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: lisp_c.c,v 1.36 2005/11/14 15:35:06 leonb Exp $
+ * $Id: lisp_c.c,v 1.38 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 
@@ -1271,7 +1271,8 @@
 
 
 
-/* lside_dld_partial -- called from DLD.C when objects become non executable */
+/* lside_dld_partial -- called from MODULE.C when 
+   objects become non executable */
 
 int
 lside_mark_unlinked(void *cdoc)
@@ -2615,7 +2616,7 @@
 jmp_buf run_time_error_jump;
 
 void
-run_time_error(char *s)
+run_time_error(const char *s)
 {
   if (run_time_error_flag)
     {
@@ -2932,8 +2933,19 @@
       cfunc = p->Object;
       if (CONSP(cfunc->name))
         check_primitive(cfunc->name, cfunc->info);
-      if (( dhdoc = (dhdoc_t*)(cfunc->info) ))
-        return NEW_GPTR(dhdoc->lispdata.call);
+      void *funcall = 0;
+#if HAVE_LIBBFD
+      extern void *dld_get_func(const char *);         /* defined in DLDBFD.C */
+      if ((dhdoc = (dhdoc_t*)(cfunc->info)) && dhdoc->lispdata.c_name)
+        funcall = dld_get_func(dhdoc->lispdata.c_name);
+#endif
+#if HAVE_NSBUNDLE
+      extern void *nsbundle_lookup(const char *, int); /* defined in MODULE.C */
+      if ((dhdoc = (dhdoc_t*)(cfunc->info)) && dhdoc->lispdata.c_name)
+        funcall = nsbundle_lookup(dhdoc->lispdata.c_name, 0);
+#endif
+      if (funcall)
+        return NEW_GPTR(funcall);
     }
   error(NIL,"Cannot make a compiled version of this lisp object",p);
 }
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/lisp_driver.c lush-cvs/src/lisp_driver.c
--- lush/src/lisp_driver.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/lisp_driver.c	2008-01-07 19:05:48.000000000 -0500
@@ -290,7 +290,7 @@
 	error(NIL,"Method alloccolor returned something illegal", p);
       return (int)(p->Number);
     }
-  return (((int)(b*255)<<16) | ((int)(g*255)<<8) | (int)(r*255));
+  return (((int)(r*255)<<16) | ((int)(g*255)<<8) | (int)(b*255));
 }
 
 static int
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/main.c lush-cvs/src/main.c
--- lush/src/main.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/main.c	2007-04-02 12:02:57.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: main.c,v 1.9 2006/08/19 11:40:49 leonb Exp $
+ * $Id: main.c,v 1.10 2007/04/02 16:02:57 leonb Exp $
  **********************************************************************/
 
 #include "header.h"
@@ -39,19 +39,25 @@
 LUSHAPI int
 main(int argc, char **argv)
 {
-  /* Define quiet mode. */
+  /* Skip options and define quiet mode 
+     if there are remaining arguments. */
+  int i = 1;
   int quiet = FALSE;
+  if (i<argc && argv[i][0]=='@')
+    i++;
+  while (i<argc && argv[i][0]=='-')
+    i++;
+  if (i < argc)
+    quiet = TRUE;
+  lush_argc = argc;
+  lush_argv = argv;
+
   /* Setup locale */
 #if HAVE_SETLOCALE && defined(LC_ALL)
   setlocale(LC_ALL,"");
   setlocale(LC_NUMERIC,"C");
 #endif
-  lush_argc = argc;
-  lush_argv = argv;
-  if (argc>1 && argv[1][0]!='@')
-    quiet = TRUE;
-  else if (argc>2)
-    quiet = TRUE;
+
   /* Message */
   if (! quiet) 
     {
@@ -71,6 +77,7 @@
               "of the GNU Public Licence (GPL) with ABSOLUTELY NO WARRANTY.\n"
               "Type `(helptool)' for details.\n");
     } 
+
   /* Start */
   FMODE_BINARY(stderr);
   init_lush(argv[0]);
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/Makefile.in lush-cvs/src/Makefile.in
--- lush/src/Makefile.in	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/Makefile.in	2008-09-16 11:59:27.000000000 -0400
@@ -24,7 +24,7 @@
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-#;;; $Id: Makefile.in,v 1.25 2006/03/29 15:15:21 leonb Exp $
+#;;; $Id: Makefile.in,v 1.26 2008/09/16 15:59:27 leonb Exp $
 #;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 @SET_MAKE@
@@ -88,10 +88,11 @@
 @UNIX_YES@@X_YES@OBJS2=x11_driver.o
 @WIN32_YES@OBJS3=win32.o win_driver.o
 @BFD_YES@OBJS4=dldbfd.o
+@CPP_YES@OBJS5=cpp.o
 
 LUSHFLAGS = ${DEFS} ${OPTS} ${INCS} ${PTHREAD_FLAGS} ${X_CFLAGS}
 LUSHLIBS = ${X_LIBS} ${LIBS} ${PTHREAD_LIBS}
-LUSHOBJS=${OBJS1} ${OBJS2} ${OBJS3} ${OBJS4}
+LUSHOBJS=${OBJS1} ${OBJS2} ${OBJS3} ${OBJS4} ${OBJS5}
 LDCCFLAGS= ${LDFLAGS} ${LUSHFLAGS} ${CC_EXP_FLAG}
 
 all: ${LUSH}
@@ -128,11 +129,14 @@
 
 .PHONY: FORCE
 
-.SUFFIXES: .c
+.SUFFIXES: .c .cpp
 
 .c.o:
 	${CC} ${CPPFLAGS} ${CFLAGS} ${LUSHFLAGS} -c $<
 
+.cpp.o:
+	${CXX} ${CPPFLAGS} ${CFLAGS} ${LUSHFLAGS} -c $<
+
 ${LUSHOBJS}: Makefile
 
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/module.c lush-cvs/src/module.c
--- lush/src/module.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/module.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: module.c,v 1.78 2006/03/29 20:22:44 leonb Exp $
+ * $Id: module.c,v 1.80 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 
@@ -378,7 +378,7 @@
   return -1;
 }
 
-static void *
+void * /* USED FROM LISP_C.C */
 nsbundle_lookup(const char *sname, int exist)
 {
   void *addr = 0;
@@ -542,7 +542,7 @@
       m = (*pp)->Object;
       fname = "";
       if (m != &root)
-        if (! (fname = relative_fname(lushdir_name, m->filename)))
+        if (! (fname = (char*)relative_fname(lushdir_name, m->filename)))
           fname = m->filename;
     }
   serialize_string(&fname, code, -1);
@@ -1215,9 +1215,9 @@
 
 
 at *
-module_load(char *filename, at *hook)
+module_load(const char *fname, at *hook)
 {
-  char *l;
+  const char *l;
   int len;
   at *ans;
   struct module *m;
@@ -1226,7 +1226,7 @@
   dlopen_handle_t handle = 0;
 #endif
   /* Check that file exists */
-  filename = concat_fname(NULL, filename);
+  const char *filename = concat_fname(NULL, fname);
   ans = new_string(filename);
   filename = SADD(ans->Object);
   if (! filep(filename))
@@ -1275,7 +1275,7 @@
   m->bundle.nsimage = 0;
   m->bundle.nsmodule = 0;
 #endif
-  m->filename = filename = strdup(filename);
+  filename = m->filename = strdup(filename);
   m->initname = 0;
   m->initaddr = 0;
   m->defs = 0;
@@ -1332,9 +1332,11 @@
 #endif
   if (! m->initaddr)
     {
+      char *tmp;
       strcpy(string_buffer, "init_");
       strcat(string_buffer, basename(m->filename, 0));
-      if ((l = strchr(string_buffer, '.'))) l[0] = 0;
+      if ((tmp = strchr(string_buffer, '.'))) 
+        *tmp = 0;
       m->initaddr = dynlink_symbol(m, string_buffer, 1, 1);
     }
   if (m->initaddr)
@@ -1583,7 +1585,7 @@
 
 
 void 
-class_define(char *name, class *cl)
+class_define(const char *name, class *cl)
 {
   at *symb;
   at *classat;
@@ -1605,7 +1607,7 @@
 }
 
 void 
-dx_define(char *name, at *(*addr) (int, at **))
+dx_define(const char *name, at *(*addr) (int, at **))
 {
   at *symb = new_symbol(name);
   at *priminame = module_priminame(symb);
@@ -1617,7 +1619,7 @@
 }
 
 void 
-dy_define(char *name, at *(*addr) (at *))
+dy_define(const char *name, at *(*addr) (at *))
 {
   at *symb = new_symbol(name);
   at *priminame = module_priminame(symb);
@@ -1629,7 +1631,7 @@
 }
 
 void 
-dxmethod_define(class *cl, char *name, at *(*addr) (int, at **))
+dxmethod_define(class *cl, const char *name, at *(*addr) (int, at **))
 {
   at *symb = new_symbol(name);
   at *priminame = module_method_priminame(cl, symb);
@@ -1642,7 +1644,7 @@
 
 
 void 
-dymethod_define(class *cl, char *name, at *(*addr) (at *))
+dymethod_define(class *cl, const char *name, at *(*addr) (at *))
 {
   at *symb = new_symbol(name);
   at *priminame = module_method_priminame(cl, symb);
@@ -1655,7 +1657,7 @@
 
 
 void 
-dhclass_define(char *name, dhclassdoc_t *kclass)
+dhclass_define(const char *name, dhclassdoc_t *kclass)
 {
   at *symb;
   at *classat;
@@ -1674,7 +1676,7 @@
 
 
 void 
-dh_define(char *name, dhdoc_t *kname)
+dh_define(const char *name, dhdoc_t *kname)
 {
   at *symb = new_symbol(name);
   at *priminame = module_priminame(symb);
@@ -1686,7 +1688,7 @@
 }
 
 void 
-dhmethod_define(dhclassdoc_t *kclass, char *name, dhdoc_t *kname)
+dhmethod_define(dhclassdoc_t *kclass, const char *name, dhdoc_t *kname)
 {
   at *symb, *priminame, *func;
   dhrecord *drec;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/nan.c lush-cvs/src/nan.c
--- lush/src/nan.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/nan.c	2010-03-20 11:12:37.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: nan.c,v 1.17 2006/11/07 20:57:43 leonb Exp $
+ * $Id: nan.c,v 1.19 2010/03/20 15:12:37 profshadoko Exp $
  **********************************************************************/
 
 #include "header.h"
@@ -78,7 +78,8 @@
 {
   if (ieee_present <= 0)
     error(NIL,"IEEE754 is not supported on this computer",NIL);
-  return * (flt*) (char*) ieee_nanf;
+  char *p = (char*) ieee_nanf;
+  return * (flt*) p;
 }
 
 flt
@@ -86,7 +87,8 @@
 {
   if (ieee_present <= 0)
     error(NIL,"IEEE754 is not supported on this computer",NIL);
-  return * (flt*) (char*) ieee_inftyf;
+  char *p = (char*) ieee_inftyf;
+  return * (flt*) p;
 }
 
 int
@@ -126,7 +128,8 @@
 {
   if (ieee_present <= 0)
     error(NIL,"IEEE754 is not supported on this computer",NIL);
-  return * (real*) (char*) ieee_nand;
+  char *p = (char*) ieee_nand;
+  return * (real*) p;
 }
 
 real
@@ -134,7 +137,8 @@
 {
   if (ieee_present <= 0)
     error(NIL,"IEEE754 is not supported on this computer",NIL);
-  return * (real*) (char*) ieee_inftyd;
+  char *p = (char*) ieee_inftyd;
+  return * (real*) p;
 }
 
 int
@@ -326,7 +330,7 @@
   
 #define DO(c,f) mask=((c)?(mask|(f)):(mask&~(f)));
 
-#if defined(__i386__) || defined(__alpha__)
+#if defined(__i386__) || defined(__alpha__) || (defined(__sh__) && defined(__SH4__))
 #ifdef _FPU_MASK_IM
   DO(!doINV, _FPU_MASK_IM);
 #endif
@@ -530,13 +534,18 @@
       set_fpe_irq();
       /* Check that NaN works as expected */
       if (ieee_present)
-        if (!isnanD(*(real*)(char*)ieee_nand + 3.0) ||
-            !isnanD(*(real*)(char*)ieee_nand - 3.0e40) ||
-            !isinfD(*(real*)(char*)ieee_inftyd - 3.0e40) )
-          {
-            ieee_present = 0;
-            set_fpe_irq();
-          }
+        {
+          char *nand = (char*) ieee_nand;
+          char *inftyd = (char*) ieee_inftyd;
+          
+          if (!isnanD(*(real*)nand + 3.0) ||
+              !isnanD(*(real*)nand - 3.0e40) ||
+              !isinfD(*(real*)inftyd - 3.0e40) )
+            {
+              ieee_present = 0;
+              set_fpe_irq();
+            }
+        }
     }
   /* Define functions */
   dx_define("nan"    , xnan    );
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/oostruct.c lush-cvs/src/oostruct.c
--- lush/src/oostruct.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/oostruct.c	2011-02-27 09:14:43.000000000 -0500
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: oostruct.c,v 1.22 2005/08/19 14:38:53 leonb Exp $
+ * $Id: oostruct.c,v 1.25 2011/01/02 18:17:25 leonb Exp $
  **********************************************************************/
 
 /***********************************************************************
@@ -41,6 +41,7 @@
 static at *at_this;
 static at *at_destroy;
 static at *at_unknown;
+static at *at_call;
 
 static struct hashelem *getmethod(class *cl, at *prop);
 static at *call_method(at *obj, struct hashelem *hx, at *args);
@@ -162,6 +163,15 @@
   zombie_action(q,action);
 }
 
+static at*
+oostruct_listeval(at *p, at *q)
+{
+  struct hashelem *hx;
+  if ((hx = getmethod(p->Class, at_call)))
+    return call_method(p, hx, q->Cdr);
+  return generic_listeval(p, q);
+}
+
 static int
 oostruct_compare(at *p, at *q, int order)
 {
@@ -233,7 +243,7 @@
   oostruct_action,
   generic_name,
   generic_eval,
-  generic_listeval,
+  oostruct_listeval,
   generic_serialize,
   oostruct_compare,
   oostruct_hash,
@@ -1424,6 +1434,7 @@
 
 
 
+
 /* --------- INITIALISATION CODE --------- */
 
 void 
@@ -1462,4 +1473,5 @@
   at_destroy = var_define("-destructor");
   at_mexpand = var_define("macro-expand");
   at_unknown = var_define("-unknown");
+  at_call = var_define("-call");
 }
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/string.c lush-cvs/src/string.c
--- lush/src/string.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/string.c	2008-12-02 20:03:38.000000000 -0500
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: string.c,v 1.36 2006/07/13 20:36:13 leonb Exp $
+ * $Id: string.c,v 1.46 2008/12/03 01:03:38 leonb Exp $
  **********************************************************************/
 
 #include "header.h"
@@ -1227,6 +1227,8 @@
       if (! NUMBERP(p->Car))
         error(NIL,"Number expected",p->Car);
       c = (char)(p->Car->Number);
+      if (! c)
+        break;
       if (p->Car->Number != (real)(unsigned char)c)
         error(NIL,"Integer in range 0..255 expected",p->Car);
       large_string_add(&ls, &c, 1);
@@ -1251,6 +1253,8 @@
       if (! NUMBERP(p->Car))
         error(NIL,"Number expected",p->Car);
       wc = (wchar_t)(p->Car->Number);
+      if (! wc)
+        break;
       if (p->Car->Number != (real)wc)
         error(NIL,"Integer expected",p->Car);
       d = wcrtomb(buffer, wc, &ps);
@@ -1354,7 +1358,7 @@
 
 static sigjmp_buf rejmpbuf;
 static char  *pat, *dat, *datstart;
-static unsigned short *buf;
+static unsigned short *buf, *bufstart;
 
 #define RE_LIT      0x0000
 #define RE_RNG      0x1000
@@ -1584,46 +1588,66 @@
 regex_execute(char **regsptr, int *regslen, int nregs)
 {
   unsigned short c;
-  unsigned short *buffail;
-  char  *datfail;
+  unsigned short **bfail;
+  char **dfail;
+  int sp = 0;
+  int spmax = 2000;
+
+  // allocate stack
+  bfail = malloc(sizeof(short*)*spmax);
+  dfail = malloc(sizeof(char*)*spmax);
+  if (! bfail || !dfail)
+    error(NIL,"Out of memory",NIL);
+  
   while ((c = *buf++)) {
 #ifdef DEBUG_REGEX
     printf("%04x (%02x)\n",(int)(c)&0xffff,(dat?*dat:0)); 
 #endif
     switch (c&0xf000) {
 
+    fail:
+      if (--sp < 0)
+        {
+          free(bfail);
+          free(dfail);
+          return 0;
+        }
+      buf = bfail[sp];
+      dat = dfail[sp];
+      break;
+
     case RE_CARET:
       if (dat != datstart)
-	return 0;
+        goto fail;
       break;
 
     case RE_DOLLAR:
       if (*dat)
-	return 0;
+	goto fail;
       break;
 
     case RE_LIT:
       if (!*dat)
-	return 0;
+	goto fail;
       if (*dat++ != (char)(c&0x00ff))
-	return 0;
+	goto fail;
       break;
 
     case RE_RNG:
       if (!*dat)
-	return 0;
+	goto fail;
       c -= RE_RNG;
       if (*dat>=c*16)
-	return 0;
+	goto fail;
       if (!charset_tst( buf, *dat))
-	return 0;
+	goto fail;
       buf += c;
       dat++;
       break;
 
     case RE_ANY:
       if (!*dat)
-	return 0;
+	goto fail;
       dat++;
       break;
 
@@ -1634,37 +1658,38 @@
       break;
       
     case RE_FAIL&0xf000:
-      buffail = buf + c - RE_FAIL;
-      datfail = dat;
-      if (!regex_execute(regsptr,regslen,nregs)) {
-#ifdef DEBUG_REGEX
-	printf("fail\n");
-#endif
-	buf = buffail;
-	dat = datfail;
+      if (sp >= spmax) { /* grow stack */
+        spmax += spmax;
+        bfail = realloc(bfail, sizeof(short*)*spmax);
+        dfail = realloc(dfail, sizeof(char*)*spmax);
+        if (! bfail || !dfail)
+          error(NIL,"Out of memory",NIL);
       }
+      dfail[sp] = dat;
+      bfail[sp] = buf + c - RE_FAIL;
+      if (sp>0 && dfail[sp]==dfail[sp>>1] && bfail[sp] == bfail[sp>>1])
+        goto fail; /* infinite recursion. should we call error instead? */
+      sp += 1;
       break;
-
+      
     case RE_START:
       c &= 0x00ff;
-      if (c<nregs)
-	regsptr[c] = dat;
+      if (c < nregs)
+        regsptr[nregs+c] = dat;
       break;
-
+      
     case RE_END:
       c &= 0x00ff;
-      if (c<nregs) {
-	if (dat)
-	  regslen[c] = dat-regsptr[c];
-	else if (regsptr[c])
-	  regslen[c] = strlen(regsptr[c]);
-	else
-	  regslen[c] = 0;
-      }
+      if (c >= nregs)
+        break;
+      regsptr[c] = regsptr[nregs+c];
+      regslen[c] = dat-regsptr[c];
       break;
     }
   }
-  buf--;
+  buf -= 1;
+  free(bfail);
+  free(dfail);
   return 1;
 }
 
@@ -1675,7 +1700,7 @@
 
 char *
 regex_compile(char *pattern, 
-	      short int *bufstart, short int *bufend, 
+	      unsigned short *bufstart, unsigned short *bufend, 
 	      int strict, int *rnum)
 {
   int regnum = 0;
@@ -1691,8 +1716,8 @@
   else 
     {
       bounds buf, tmp;
-      buf.beg = (unsigned short*) bufstart;
-      buf.end = (unsigned short*) bufend;
+      buf.beg = bufstart + 1;
+      buf.end = bufend - 1;
       if (strict) 
 	{
 	  *buf.beg++ = RE_CARET;
@@ -1703,37 +1728,41 @@
       if (strict) 
 	*buf.end++ = RE_DOLLAR;
       *buf.end = 0;
+      *bufstart = buf.end - bufstart + 1;
       return 0L;
     }
 }
 
 
 int 
-regex_exec(short int *buffer, char *string, 
+regex_exec(unsigned short *buffer, char *string, 
 	   char **regptr, int *reglen, int nregs)
 {
   int c;
-  
+  for(c=0;c<2*nregs;c++)
+    regptr[c] = 0;
   for(c=0;c<nregs;c++)
     reglen[c] = 0;
   dat = datstart = string;
-  buf = (unsigned short*) buffer;
-  return regex_execute(regptr,reglen,nregs);
+  buf = bufstart = (unsigned short*)(buffer+1);
+  c = regex_execute(regptr,reglen,nregs);
+  return c;
 }
 
 
 int 
-regex_seek(short int *buffer, char *string, char *seekstart, 
+regex_seek(unsigned short *buffer, char *string, char *seekstart, 
 	   char **regptr, int *reglen, int nregs, char **start, char **end)
 {
-  int c;
-  
+  int c; 
   datstart = string;
   while (*seekstart) {
+    for(c=0;c<2*nregs;c++)
+      regptr[c] = 0;
     for(c=0;c<nregs;c++)
       reglen[c] = 0;
     dat = seekstart;
-    buf = (unsigned short*) buffer;
+    buf = bufstart = (unsigned short*)(buffer+1);
     if (regex_execute(regptr,reglen,nregs)) {
       *start = seekstart;
       *end = dat;
@@ -1768,7 +1797,7 @@
 DX(xregex_match)
 {
   char *pat, *dat;
-  short buffer[1024];
+  unsigned short buffer[1024];
 
   ARG_NUMBER(2);
   ALL_ARGS_EVAL;
@@ -1779,7 +1808,6 @@
   pat = regex_compile(pat,buffer,buffer+1024,1,NULL);
   if (pat)
     error(NIL,pat,APOINTER(1));
-
   if (regex_exec(buffer,dat,NULL,NULL,0))
     return true();  
   else
@@ -1790,11 +1818,11 @@
 DX(xregex_extract)
 {
   char *pat, *dat;
-  short buffer[1024];
+  unsigned short buffer[1024];
   at *ans=NIL;
   at **where = &ans;
-  char **regptr;
-  int *reglen;
+  char **regptr = 0;
+  int *reglen = 0;
   int regnum = 0;
   int i;
 
@@ -1805,12 +1833,13 @@
   pat = regex_compile(pat,buffer,buffer+1024,1,&regnum);
   if (pat)
     error(NIL,pat,APOINTER(1));
-
-  regptr = malloc((regnum+1)*sizeof(char*));
-  reglen = malloc((regnum+1)*sizeof(int));
-  if (!regptr || !reglen)
-    error(NIL,"out of memory",NIL);
-
+  if (regnum > 0)
+    {
+      regptr = malloc(2*regnum*sizeof(char*));
+      reglen = malloc(regnum*sizeof(int));
+      if (!regptr || !reglen)
+        error(NIL,"out of memory",NIL);
+    }
   if (regex_exec(buffer,dat,regptr,reglen,regnum))
     {
       for (i=0; i<regnum; i++) 
@@ -1823,8 +1852,10 @@
       if (!ans)
 	*where = new_cons(APOINTER(2),NIL);
     }
-  free(regptr);
-  free(reglen);
+  if (regptr)
+    free(regptr);
+  if (regnum)
+    free(reglen);
   return ans;
 }
 
@@ -1835,7 +1866,7 @@
 {
   char *pat, *dat,*datstart, *start,*end;
   int n;
-  short buffer[1024];
+  unsigned short buffer[1024];
 
   ALL_ARGS_EVAL;
   if (arg_number==3)
@@ -1848,11 +1879,9 @@
   dat = datstart = ASTRING(2);
   while (--n>0 && *dat)
     dat++;
-
   pat = regex_compile(pat,buffer,buffer+1024,0,NULL);
   if (pat)
     error(NIL,pat,APOINTER(1));
-  
   if (regex_seek(buffer,datstart,dat,NULL,NULL,0,&start,&end)) {
     dat = ASTRING(2);
     return cons(NEW_NUMBER(1+start-dat),
@@ -1867,9 +1896,10 @@
 DX(xregex_subst)
 {
   char *pat, *dat, *datstart, *str; 
-  short buffer[1024];
-  char *regptr[10];
-  int  reglen[10];
+  unsigned short buffer[1024];
+  char *regptr[20];
+  int reglen[10];
+  int regnum = 0;
   char *start, *end, *s1;
   struct large_string ls;
 
@@ -1881,10 +1911,9 @@
   str = ASTRING(2);
   dat = datstart = ASTRING(3);
 
-  pat = regex_compile(pat,buffer,buffer+1024,0,NULL);
+  pat = regex_compile(pat,buffer,buffer+1024,0,&regnum);
   if (pat)
     error(NIL,pat,APOINTER(1));
-  
   large_string_init(&ls);
   do {
     if (! regex_seek(buffer,datstart,dat,regptr,reglen,10,&start,&end))
@@ -1907,9 +1936,10 @@
                 large_string_add(&ls, s1++, 1);
               } else {
                 int reg = *s1++ - '0';
-                if (reg<0 || reg>9)
+                if (reg<0 || reg>9 || reg>=regnum)
                   error(NIL,"bad register number",APOINTER(3));
-                large_string_add(&ls, regptr[reg], reglen[reg]);
+                if (reglen[reg]>0)
+                  large_string_add(&ls, regptr[reg], reglen[reg]);
               }
             } 
           else 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/symbol.c lush-cvs/src/symbol.c
--- lush/src/symbol.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/symbol.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: symbol.c,v 1.10 2006/02/20 16:04:00 leonb Exp $
+ * $Id: symbol.c,v 1.11 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 
@@ -59,9 +59,9 @@
  */
 
 static struct hash_name *
-search_by_name(unsigned char *s, int mode)
+search_by_name(const unsigned char *s, int mode)
 {
-  unsigned char *ss;
+  const unsigned char *ss;
   unsigned long hash;
   struct hash_name **lasthn;
   struct hash_name *hn;
@@ -129,7 +129,7 @@
  */
 
 at *
-named(char *s)
+named(const char *s)
 {
   return new_symbol(s);
 }
@@ -147,7 +147,7 @@
  */
 
 at *
-namedclean(char *n)
+namedclean(const char *n)
 {
   at *ans;
   char *s, *d;
@@ -511,7 +511,7 @@
  */
 
 at *
-new_symbol(char *s)
+new_symbol(const char *s)
 {
   at *p;
   struct symbol *symb;
@@ -520,7 +520,7 @@
   if (s[0] == ':' && s[1] == ':')
     error(s, "belongs to a reserved package... ", NIL);
 
-  hn = search_by_name((unsigned char *) s, (int) 1);
+  hn = search_by_name((const unsigned char *) s, (int) 1);
   if (hn->named) {		/* symbol exists	 */
     LOCK(hn->named);		/* don't create it !	 */
     return hn->named;
@@ -689,7 +689,7 @@
 
 
 at *
-var_define(char *s)
+var_define(const char *s)
 {
   at *p;
   struct symbol *symb;
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/toplevel.c lush-cvs/src/toplevel.c
--- lush/src/toplevel.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/toplevel.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: toplevel.c,v 1.38 2006/04/12 22:52:55 leonb Exp $
+ * $Id: toplevel.c,v 1.41 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 
@@ -105,8 +105,8 @@
 extern int compute_bump_active;
 
 /* From DUMP.C */
-extern int isdump (char *s);
-extern void undump (char *s);
+extern int isdump (const char *s);
+extern void undump (const char *s);
 
 /* From BINARY.C */
 extern int in_bwrite;
@@ -228,7 +228,7 @@
   at *p, *q;
   at **where;
   int i;
-  char *s, *r;
+  const char *s, *r;
   error_doc.script_file = NIL;
   error_doc.script_mode = SCRIPT_OFF;
   error_doc.error_prefix = NIL;
@@ -243,9 +243,12 @@
 
   context = &first_context;
   context->next = NIL;
+  context->input_string = 0;
   context->input_file = stdin;
+  context->input_tab = 0;
+  context->input_case_sensitive = 0;
   context->output_file = stdout;
-  context->input_tab = context->output_tab = 0;
+  context->output_tab = 0;
 
   quiet = quietflag;
   if (! sigsetjmp(context->error_jump, 1)) 
@@ -482,7 +485,7 @@
 static int exit_flag = 0;
 
 void 
-toplevel(char *in, char *out, char *prompts)
+toplevel(const char *in, const char *out, const char *prompts)
 {
   FILE *f1, *f2;
   at *ans = NIL;
@@ -490,6 +493,7 @@
   char *ps1 = 0;
   char *ps2 = 0;
   char *ps3 = 0;
+  char *saved_prompt = prompt_string;
   struct context mycontext;
   /* Open files */
   f1 = f2 = NIL;
@@ -505,6 +509,7 @@
   if (f1) {
     context->input_file = f1;
     context->input_tab = 0;
+    context->input_case_sensitive = 0;
   }
   if (f2) {
     context->output_file = f2;
@@ -548,6 +553,7 @@
       free(ps1);
     context_pop();
     symbol_pop(at_file);
+    prompt_string = saved_prompt;
     siglongjmp(context->error_jump, -1);
   }
   /* Toplevel loop */
@@ -609,6 +615,7 @@
     free(ps1);
   context_pop();
   symbol_pop(at_file);
+  prompt_string = saved_prompt;
   exit_flag = 0;
 }
 
@@ -680,10 +687,10 @@
 error_text(void)
 {
   extern char *print_buffer;
-  char *prefix = error_doc.error_prefix;
-  char *prefixsep = " : ";
-  char *text = error_doc.error_text;
-  char *textsep = " : ";
+  const char *prefix = error_doc.error_prefix;
+  const char *prefixsep = " : ";
+  const char *text = error_doc.error_text;
+  const char *textsep = " : ";
   at *suffix = error_doc.error_suffix;
   at *call = error_doc.error_call;
   
@@ -764,7 +771,7 @@
 
 
 void 
-error(char *prefix, char *text, at *suffix)
+error(const char *prefix, const char *text, at *suffix)
 {
   if (run_time_error_flag)
     run_time_error(text);
@@ -898,6 +905,23 @@
   return ((quiet) ? true() : NIL);
 }
 
+DX(xcasesensitive)
+{
+  ALL_ARGS_EVAL;
+  if (arg_number>0)
+    {
+      ARG_NUMBER(1);
+      if (APOINTER(1))
+        context->input_case_sensitive = 1;
+      else
+        context->input_case_sensitive = 0;
+    }
+  if (context->input_case_sensitive)
+    return true();
+  return NIL;
+}
+
+
 /* --------- INITIALISATION CODE --------- */
 
 
@@ -918,4 +942,5 @@
   dx_define("where", xwhere);
   dx_define("errname", xerrname);
   dx_define("lush-is-quiet", xquiet);
+  dx_define("lush-is-case-sensitive", xcasesensitive);
 }
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/unix.c lush-cvs/src/unix.c
--- lush/src/unix.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/unix.c	2009-10-16 12:07:05.000000000 -0400
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: unix.c,v 1.59 2006/02/13 20:00:28 leonb Exp $
+ * $Id: unix.c,v 1.64 2009/10/16 16:07:05 leonb Exp $
  **********************************************************************/
 
 /************************************************************************
@@ -114,10 +114,15 @@
 #  undef HAVE_CONFIG_H
 # endif
 # include <readline/readline.h>
-# include <readline/history.h>
+# ifdef HAVE_READLINE_HISTORY_H
+#  include <readline/history.h>
+# endif
 # ifdef HAVE_LUSHCONF_H
 #  define HAVE_CONFIG_H HAVE_LUSHCONF_H 
 # endif
+# ifndef RL_READLINE_VERSION
+#  define RL_READLINE_VERSION 0  /* non-gnu */
+# endif
 #endif
 #ifdef HAVE_MPI
 # ifdef HAVE_MPI_H
@@ -244,7 +249,7 @@
 /* lastchance -- safety code for hopeless situations */
 
 void 
-lastchance(char *s)
+lastchance(const char *s)
 {
   static int already = 0;
   at *q;
@@ -784,18 +789,7 @@
 /* console_getline -- 
    gets a line on the console (and process events) */
 
-#if HAVE_LIBREADLINE
-# if HAVE_READLINE_READLINE_H
-#  ifdef RL_READLINE_VERSION
-#   define READLINE 1
-#   if RL_READLINE_VERSION >= 0x400
-#     define READLINE_COMPLETION 1
-#   endif
-#  endif
-# endif
-#endif
-
-#if READLINE
+#ifdef RL_READLINE_VERSION
 
 static int console_in_eventproc = 0;
 
@@ -831,8 +825,6 @@
   return rl_getc(f);
 }
 
-#if READLINE_COMPLETION
-
 static char *
 symbol_generator(const char *text, int state)
 {
@@ -886,6 +878,8 @@
 }
 
 
+#if RL_READLINE_VERSION > 0x400
+
 static char **
 console_complete(const char *text, int start, int end)
 {
@@ -940,9 +934,9 @@
 console_init(void)
 {
   /* quotes etc. */
-  rl_special_prefixes = "|";
-  rl_basic_quote_characters = "\"";
-  rl_basic_word_break_characters = 
+  static const char *special_prefixes = "|";
+  static const char *quote_characters = "\"";
+  static const char *word_break_characters = 
     " ()#^\"|;"   /* syntactic separators */
     "~'`,@[]{}:"  /* common macro characters */
     "\001\002\003\004\005\006\007"
@@ -952,19 +946,27 @@
   /* callbacks */
   rl_getc_function = console_getc;
   /* completion */
-#if READLINE_COMPLETION
+#if RL_READLINE_VERSION > 0x400
+  rl_special_prefixes = special_prefixes;
+  rl_basic_quote_characters = quote_characters;
+  rl_basic_word_break_characters = word_break_characters;
   rl_attempted_completion_function = console_complete;
+#else
+  rl_special_prefixes = special_prefixes;
+  rl_completer_quote_characters = quote_characters;
+  rl_completer_word_break_characters = word_break_characters;
+  rl_completion_entry_function = symbol_generator;
 #endif
   /* matching parenthesis */
-#if RL_READLINE_VERSION > 0x401
-# if RL_READLINE_VERSION > 0x402
+#if RL_READLINE_VERSION > 0x402
   rl_set_paren_blink_timeout(250000);
-# endif
+#endif
+#if RL_READLINE_VERSION > 0x401
   rl_bind_key (')', rl_insert_close);
   rl_bind_key (']', rl_insert_close);
   rl_bind_key ('}', rl_insert_close);
 #endif 
-  /* variables */
+  /* comments */
 #if RL_READLINE_VERSION > 0x400
   rl_variable_bind("comment-begin",";;; ");
 #endif  
@@ -1044,7 +1046,7 @@
     }
 }
 
-#else /* !READLINE */
+#else /* !RL_READLINE_VERSION */
 
 static void
 console_init(void)
@@ -1079,7 +1081,7 @@
 toplevel_unix(void)
 {
   break_attempt = 0;
-#if READLINE
+#ifdef RL_READLINE_VERSION
   console_in_eventproc = 0;
   rl_deprep_terminal();
 #endif
@@ -1368,10 +1370,9 @@
       newenv[envsize] = environ[envsize];
     newenv[envsize] = s;
     newenv[envsize+1] = 0;
-    environ = newenv;
     if (environ == lastenv)
       free(environ);
-    lastenv = environ;
+    environ = lastenv = newenv;
     return 0;
   } 
 #endif
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/src/x11_driver.c lush-cvs/src/x11_driver.c
--- lush/src/x11_driver.c	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/src/x11_driver.c	2008-11-20 16:58:07.000000000 -0500
@@ -24,7 +24,7 @@
  ***********************************************************************/
 
 /***********************************************************************
- * $Id: x11_driver.c,v 1.27 2006/03/29 15:15:21 leonb Exp $
+ * $Id: x11_driver.c,v 1.29 2008/11/20 21:58:07 leonb Exp $
  **********************************************************************/
 
 /***********************************************************************
@@ -73,8 +73,9 @@
 #include "header.h"
 #include "graphics.h"
 
-
-
+#ifdef class
+# undef class
+#endif
 
 /* ============================  X11DRIVER STRUCTURES */
 
@@ -226,7 +227,7 @@
   char *tempstr;
   int i;
   XColor xc;
-  XVisualInfo vinfo;
+  XVisualInfo vinfo, *vinfoptr;
 
   /* Open display */
   dpyname = search_display_name();
@@ -234,31 +235,40 @@
   ifn(xdef.dpy)
     error(NIL, "X11: Can't open display on", new_string(dpyname));
 
-  /* Get visual */
+  /* Check if default visual is good enough or look for a better one... */
   xdef.screen = DefaultScreen(xdef.dpy);
-  if ( XMatchVisualInfo(xdef.dpy, xdef.screen, 32, TrueColor, &vinfo) || 
-       XMatchVisualInfo(xdef.dpy, xdef.screen, 24, TrueColor, &vinfo) ||
-       XMatchVisualInfo(xdef.dpy, xdef.screen, 16, TrueColor, &vinfo) ||
-       XMatchVisualInfo(xdef.dpy, xdef.screen, 15, TrueColor, &vinfo)   )
-    {
-      xdef.visual = vinfo.visual;
-      xdef.depth = vinfo.depth;
-      xdef.red_mask = vinfo.red_mask;
-      xdef.green_mask = vinfo.green_mask;
-      xdef.blue_mask = vinfo.blue_mask;
-      xdef.cmapflag = 1;
-      xdef.cmap =  XCreateColormap (xdef.dpy, DefaultRootWindow(xdef.dpy),
-                                    xdef.visual, AllocNone );
-    }
-  else
+  xdef.visual = DefaultVisual(xdef.dpy, xdef.screen);
+  xdef.depth = DisplayPlanes(xdef.dpy, xdef.screen);
+  xdef.red_mask = 0;
+  xdef.green_mask = 0;
+  xdef.blue_mask = 0;
+  xdef.cmap = DefaultColormap(xdef.dpy, xdef.screen);
+  xdef.cmapflag = 0;
+  vinfo.visualid = XVisualIDFromVisual(xdef.visual);
+  vinfoptr = XGetVisualInfo(xdef.dpy, VisualIDMask, &vinfo, &i);
+  if (vinfoptr)
     {
-      xdef.visual = DefaultVisual(xdef.dpy, xdef.screen);
-      xdef.depth = DisplayPlanes(xdef.dpy, xdef.screen);
-      xdef.red_mask = 0;
-      xdef.green_mask = 0;
-      xdef.blue_mask = 0;
-      xdef.cmap = DefaultColormap(xdef.dpy, xdef.screen);
-      xdef.cmapflag = 0;
+      vinfo = *vinfoptr;
+      XFree(vinfoptr);
+      if (vinfo.class == TrueColor || vinfo.class == DirectColor)
+        {
+          xdef.red_mask = vinfo.red_mask;
+          xdef.green_mask = vinfo.green_mask;
+          xdef.blue_mask = vinfo.blue_mask;
+        }
+      else if  (XMatchVisualInfo(xdef.dpy, xdef.screen, 24, TrueColor, &vinfo) ||
+                XMatchVisualInfo(xdef.dpy, xdef.screen, 16, TrueColor, &vinfo) ||
+                XMatchVisualInfo(xdef.dpy, xdef.screen, 15, TrueColor, &vinfo) )
+        {
+          xdef.visual = vinfo.visual;
+          xdef.depth = vinfo.depth;
+          xdef.red_mask = vinfo.red_mask;
+          xdef.green_mask = vinfo.green_mask;
+          xdef.blue_mask = vinfo.blue_mask;
+          xdef.cmapflag = 1;
+          xdef.cmap =  XCreateColormap (xdef.dpy, DefaultRootWindow(xdef.dpy),
+                                        xdef.visual, AllocNone );
+        }
     }
   
   /* Defaults */
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/sys/stdenv.lsh lush-cvs/sys/stdenv.lsh
--- lush/sys/stdenv.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/sys/stdenv.lsh	2007-04-02 12:02:57.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;  $Id: stdenv.lsh,v 1.23 2005/08/10 23:40:57 leonb Exp $
+;;;  $Id: stdenv.lsh,v 1.24 2007/04/02 16:02:57 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -90,31 +90,42 @@
   ;; Process arguments
   ;; ------------------------------
   (when argv
-    ;; Usage
-    (when (= (car argv) "-h")
-      (writing "$stderr"
-        (printf "Usage:\n")
-        (printf "- Type 'lush' without arguments for the interactive mode.\n")
-        (printf "- Type 'lush <lshfile> <...args...>' for script mode.\n")
-        (printf "- Type 'lush -e \"lush expression\"' for immediate evaluation.\n")
-        (exit 10) ) )
-    ;; check if this is an immediate execute
-    (when (= (car argv) "-e")
-      (let ((tmp (tmpname)))
-	(writing tmp 
-	  (each ((x (cdr argv))) (printf "%s " x))
-	  (printf "\n"))
-	(load tmp)
-	(unlink tmp)
-	(exit 0)))
-    ;; Check that the first argument is a file,
-    (when (not (filep (car argv)))
-      (writing "$stderr"
-        (printf "lush: file not found: %s\n" (car argv))
-        (exit 10) ) )
-    ;; ... run it,
-    (libload (car argv))
-    ;; ... and exit with exit code 0.
+    ;; Process options
+    (while (and (consp argv) (= (left (car argv) 1) "-"))
+      (cond
+       ;; Option -h for help
+       ((= (car argv) "-h")
+        (writing "$stderr"
+          (printf "Usage:\n")
+          (printf " 'lush [options]' for the interactive mode.\n")
+          (printf " 'lush [options] <lshfile> <...args...>' for script mode.\n")
+          (printf " 'lush [options] -e \"lush expression\"' for immediate eval.\n")
+          (exit 10) ) )
+       ;; Option -e for immediate execute
+       ((= (car argv) "-e") 
+        (let ((tmp (tmpname)))
+          (writing tmp 
+            (each ((x (cdr argv))) (printf "%s " x))
+            (printf "\n"))
+          (load tmp)
+          (unlink tmp)
+          (lush-is-quiet t)
+          (setq argv ()) ) )
+       ;; Unrecognized option
+       (t 
+        (writing "$stderr"
+          (printf "Warning: unrecognized option %s\n" (car argv)) 
+          (exit 10) ) ) )
+      (setq argv (cdr argv)) )
+    ;; Process file arguments
+    (when (consp argv)
+      (when (not (filep (car argv)))
+        (writing "$stderr"
+          (printf "lush: file not found: %s\n" (car argv))
+          (exit 10) ) )
+      (libload (car argv))
+      (setq argv ()) )
+    ;; Exit with code 0 unless lush is interactive.
     (when (lush-is-quiet)
       (exit 0) ) ) )
 
diff -x config.sub -x config.guess -x .svn -x CVS -x .git -x debian -Naur lush/sys/sysenv.lsh lush-cvs/sys/sysenv.lsh
--- lush/sys/sysenv.lsh	2011-01-01 11:53:25.000000000 -0500
+++ lush-cvs/sys/sysenv.lsh	2010-03-24 12:03:38.000000000 -0400
@@ -24,7 +24,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;  $Id: sysenv.lsh,v 1.124 2006/04/10 18:36:21 laseray Exp $
+;;;  $Id: sysenv.lsh,v 1.128 2010/03/24 16:03:38 leonb Exp $
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 
@@ -520,7 +520,8 @@
   (when (and (not l) l2)
     (setq l (list (car l2)))
     (setq l2 (cdr l2)) )
-  (each ((i l2)) (when ~(member i l) (nconc1 l i))))
+  (each ((i l2)) (when ~(member i l) (nconc1 l i)))
+  l)
 
 
 (lock_symbol caddr cdddr cdadr caadr cadar cddar cdaar caaar
@@ -589,7 +590,16 @@
 
 (de clone-matrix (mat)
   (let* ((size (apply * (bound mat)))
-         (sto (float-storage)))
+         (typ (classof (idx-storage mat)))
+         (sto (cond 
+               ((= typ |DSTORAGE|)    (double-storage))
+               ((= typ |FSTORAGE|)    (float-storage))
+               ((= typ |I32STORAGE|)  (int-storage))
+               ((= typ |I16STORAGE|)  (short-storage))
+               ((= typ |I8STORAGE|)   (byte-storage))
+               ((= typ |U8STORAGE|)   (ubyte-storage))
+               ((= typ |GPTRSTORAGE|) (gptr-storage))
+               (t (atom-storage)) )) )
     (storage-malloc-nc sto size)
     (new-index sto (bound mat))))
 
@@ -1445,7 +1455,7 @@
            (dm ,fn (fn . args)
              (if (not (symbolp (car args)))
                  declare.autoreplace
-               (printf "*** Warning\007: old style declaration : %l\n" (cons fn args))    
+               (printf "*** Warning\007: old style declaration : %l\n" (cons fn args))
                (list 'declare (list fn) . args) ) )
            (lock-symbol ,fn) )) )
 
@@ -1454,7 +1464,7 @@
            (dm ,fn (fn . args)
              (if (not (symbolp (car args)))
                  declare.autoreplace
-               (printf "*** Warning\007: old style declaration : %l\n" (cons fn args))    
+               (printf "*** Warning\007: old style declaration : %l\n" (cons fn args))
                (list 'declare (list fn '(-flt-)) . args) ) )
            (lock-symbol ,fn) )) )
 
@@ -1746,25 +1756,39 @@
       (setq extlist (list (concat "." (or (getconf "AEXT") "a")))) ) )
   (find-file static-library-path name extlist) )
 
+(de find-shared-library.parse(file p)
+  (when (filep file)
+    (reading file
+      (while (<> (skip-char "\n\r\t ") "\e")
+        (let ((d (read-string "~\n\r\t\b")))
+          (cond 
+           ((regex-match " *include +.+" d)
+            (reading (concat "|" (regex-subst " *include" "echo" d))
+              (while (<> (skip-char) "\e")
+                (setq p (find-shared-library.parse (read-string "~\n\r\t\b ") p)) ) ) )
+           ((and (dirp d) (not (member d p)))
+            (setq p (nconc1 p d)) ) ) ) ) ) )
+  p )
+
+(de find-shared-library.linux()
+  ;; maybe expand dirs with cpuflags here?
+  (find-shared-library.parse "/etc/ld.so.conf" ()) )
+
 (de find-shared-library(name &optional extlist)
-  (let ((p shared-library-path))
-    (when (not extlist)
-      (setq extlist '(""))
-      (when (not (index "." (basename name)))
-        (setq extlist (list (concat "." (or (getconf "SOEXT") "so")))) ) )
-    (when (filep "/etc/ld.so.conf")
-      (reading "/etc/ld.so.conf"
-	(while (<> (skip-char) "\e")
-	  (let ((d (read-string "~\n\r\t\b ")))
-	    (when (and (dirp d) (not (member d p)))
-	      (setq p (cons d p)) ) ) ) ) )
-    (find-file (reverse p) name extlist) ) )
+  (when (not extlist)
+    (setq extlist '(""))
+    (when (not (index "." (basename name)))
+      (setq extlist (list (concat "." (or (getconf "SOEXT") "so")))) ) )
+  (let ((p (nconc (find-shared-library.linux) shared-library-path)))
+    (find-file p name extlist) ) )
 
 (de find-shared-or-static-library(name &optional extlist)
   (or (find-shared-library name extlist)
       (find-static-library name) ) )
 
 (lock-symbol find-c-include
+             find-shared-library.parse  
+             find-shared-library.linux
              find-shared-library  
              find-static-library  
              find-shared-or-static-library )
