[pkg-nvidia-devel] r342 - in /packages/nvclock/branches/upstream/current: ./ CVS/ src/ src/CVS/ src/backend/ src/backend/CVS/ src/gtk/ src/gtk/CVS/ src/nvcontrol/ src/nvcontrol/CVS/ src/qt/CVS/

rdonald at users.alioth.debian.org rdonald at users.alioth.debian.org
Sat Jan 5 20:47:40 UTC 2008


Author: rdonald
Date: Sat Jan  5 20:47:40 2008
New Revision: 342

URL: http://svn.debian.org/wsvn/pkg-nvidia/?sc=1&rev=342
Log:
[svn-upgrade] Integrating new upstream version, nvclock (0.8b3)

Added:
    packages/nvclock/branches/upstream/current/src/backend/nv50.c
    packages/nvclock/branches/upstream/current/src/backend/nvreg.h
    packages/nvclock/branches/upstream/current/src/backend/utils.c
Removed:
    packages/nvclock/branches/upstream/current/aclocal.m4
    packages/nvclock/branches/upstream/current/src/backend/nv31.c
Modified:
    packages/nvclock/branches/upstream/current/ABOUT
    packages/nvclock/branches/upstream/current/CVS/Entries
    packages/nvclock/branches/upstream/current/ChangeLog
    packages/nvclock/branches/upstream/current/FAQ
    packages/nvclock/branches/upstream/current/README
    packages/nvclock/branches/upstream/current/configure
    packages/nvclock/branches/upstream/current/configure.in
    packages/nvclock/branches/upstream/current/nvclock.1
    packages/nvclock/branches/upstream/current/src/CVS/Entries
    packages/nvclock/branches/upstream/current/src/backend/CVS/Entries
    packages/nvclock/branches/upstream/current/src/backend/Makefile.in
    packages/nvclock/branches/upstream/current/src/backend/adt7473.c
    packages/nvclock/branches/upstream/current/src/backend/back_bsd.c
    packages/nvclock/branches/upstream/current/src/backend/back_linux.c
    packages/nvclock/branches/upstream/current/src/backend/back_win32.c
    packages/nvclock/branches/upstream/current/src/backend/backend.c
    packages/nvclock/branches/upstream/current/src/backend/backend.h
    packages/nvclock/branches/upstream/current/src/backend/bios.c
    packages/nvclock/branches/upstream/current/src/backend/config.c
    packages/nvclock/branches/upstream/current/src/backend/i2c.c
    packages/nvclock/branches/upstream/current/src/backend/i2c.h
    packages/nvclock/branches/upstream/current/src/backend/info.c
    packages/nvclock/branches/upstream/current/src/backend/nv30.c
    packages/nvclock/branches/upstream/current/src/backend/nv40.c
    packages/nvclock/branches/upstream/current/src/backend/nvclock.h
    packages/nvclock/branches/upstream/current/src/backend/nvcontrol.c
    packages/nvclock/branches/upstream/current/src/backend/overclock.c
    packages/nvclock/branches/upstream/current/src/gtk/CVS/Entries
    packages/nvclock/branches/upstream/current/src/gtk/gl.c
    packages/nvclock/branches/upstream/current/src/gtk/gl.h
    packages/nvclock/branches/upstream/current/src/gtk/hw.c
    packages/nvclock/branches/upstream/current/src/gtk/hw.h
    packages/nvclock/branches/upstream/current/src/gtk/main.c
    packages/nvclock/branches/upstream/current/src/nvclock.c
    packages/nvclock/branches/upstream/current/src/nvcontrol/CVS/Entries
    packages/nvclock/branches/upstream/current/src/nvcontrol/libnvcontrol.h
    packages/nvclock/branches/upstream/current/src/nvcontrol/nvcontrol.c
    packages/nvclock/branches/upstream/current/src/qt/CVS/Entries

Modified: packages/nvclock/branches/upstream/current/ABOUT
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/ABOUT?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/ABOUT (original)
+++ packages/nvclock/branches/upstream/current/ABOUT Sat Jan  5 20:47:40 2008
@@ -17,9 +17,9 @@
 http://www.sourceforge.net/projects/nvclock
 
 
-Udates:
+Updates:
 
-http://nvclock.sourceforge.net
+http://www.linuxhardware.org/nvclock
 
 
 Support:
@@ -34,10 +34,10 @@
 
 Forums
 
-missing ...
+http://www.linuxhardware.org/forums/viewforum.php?f=15
 
 or
 
 Author
 
-thunderbird2k at gmx.net
+thunderbird AT linux hardware DOT org

Modified: packages/nvclock/branches/upstream/current/CVS/Entries
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/CVS/Entries?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/CVS/Entries (original)
+++ packages/nvclock/branches/upstream/current/CVS/Entries Sat Jan  5 20:47:40 2008
@@ -2,7 +2,6 @@
 /ABOUT/1.2/Thu May 26 20:29:15 2005//
 /AUTHORS/1.3/Tue Aug 30 15:46:04 2005//
 /COPYING/1.1/Mon Sep 15 15:40:05 2003//
-/FAQ/1.2/Mon May 16 15:57:03 2005//
 /INSTALL/1.1/Mon Sep 15 15:40:05 2003//
 /Makefile.in/1.4/Sat May 28 14:11:35 2005//
 /NEWS/1.1/Mon Sep 15 15:40:05 2003//
@@ -10,7 +9,10 @@
 /autogen.sh/1.2/Fri Aug 26 16:13:23 2005//
 /install-sh/1.1/Mon Sep 15 15:49:41 2003//
 D/src////
-/configure.in/1.14/Fri Jul 28 17:20:05 2006//
-/README/1.7/Mon Jul 31 15:32:40 2006//
-/ChangeLog/1.13/Mon Jul 31 16:37:43 2006//
-/nvclock.1/1.8/Mon Jul 31 16:37:51 2006//
+/configure.in/1.15/Sun Dec  2 21:30:17 2007//
+/config.h.in/1.1/Sat Dec 29 01:48:18 2007//
+/configure/1.1/Thu Dec 27 15:15:32 2007//
+/README/1.10/Fri Jan  4 17:34:13 2008//
+/nvclock.1/1.9/Fri Jan  4 17:33:40 2008//
+/FAQ/1.3/Fri Jan  4 18:41:57 2008//
+/ChangeLog/1.16/Fri Jan  4 17:32:07 2008//

Modified: packages/nvclock/branches/upstream/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/ChangeLog?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/ChangeLog (original)
+++ packages/nvclock/branches/upstream/current/ChangeLog Sat Jan  5 20:47:40 2008
@@ -1,11 +1,24 @@
 Revision History:
 =================
+
+v0.8b3 - January, 4, 2008
+-------------------------
+
+ o Geforce8 support
+ o Rewritten lowlevel Geforce6/7 overclocking backend [experimental]
+ o Added bios PLL table parsing for Geforce6/7/8 cards
+ o Fanspeed adjustments for 8800 cards equipped with ADT7473 chips
+ o Support for additional Geforce7 AGP cards
+ o Add support for more NV-CONTROL OpenGL settings in GTK
+ o Geforce6 fake Quadro bugfixes
+ o Geforce6 pipeline modding bugfixes
+ o Tons of bugfixes
 
 v0.8b2 - July, 31, 2006
 ------------------------
 
  o Geforce 7300/7600/7800GS/7900 support
- o Smartdimmer support for 7600Go laptops
+ o Smartdimmer suppport for 7600Go laptops
  o Fanspeed adjustment support for 7600/7800GS/7900 cards
  o Support for ADT7473/W83781D sensors
  o PCI id modding support (Quadro faking)

Modified: packages/nvclock/branches/upstream/current/FAQ
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/FAQ?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/FAQ (original)
+++ packages/nvclock/branches/upstream/current/FAQ Sat Jan  5 20:47:40 2008
@@ -23,6 +23,23 @@
    ** If a program has setguid permission, anyone who has permission
      to run the program is treated as if they belong to the program's group.
      chmod 2755 nvclock.
+
+
+- Why does the temperature as reported by NVClock differ from nvidia-settings?
+
+o Starting from the Geforce 6200 (NV43) all Nvidia GPUs ship with an temperature
+  sensor builtin into the GPU. This sensor is very basic and in my opinion not
+  very accurate. Most midend and highend Geforce6 boards use an external 'LM99'
+  sensor connected to the I2C bus of the card. This sensor also reads the internal
+  GPU temperature and it also shows the board temperature (the temperature of the sensor
+  chip itself). Further something similar is the case for Geforce7 and Geforce8 cards. For
+  these most highend models (Geforce 7800/7900/8800) contain an ADT7473 sensor.
+
+  When an external sensor chip is present NVClock reads it out. Nvidia-settings in
+  general only reads out the internal GPU sensor (this is the case when only a single
+  temperature is shown). An exception to this rule are some NV43 based Geforce6 cards
+  which feature both an internal and external chip and in case nvidia-settings reads
+  out the external chip.
 
 
 - Why is overclocking of GeforceFX / Geforce6600GT hardware so complicated?
@@ -79,6 +96,7 @@
   way to overclock at system startup is to make sure that the kernel module is 
   loaded and initialized before running NVClock.
 
+
 - Why can't I change AGP settings in NVClock? 
 
 o At the moment the only thing NVClock does is displaying some AGP info. It reads

Modified: packages/nvclock/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/README?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/README (original)
+++ packages/nvclock/branches/upstream/current/README Sat Jan  5 20:47:40 2008
@@ -1,4 +1,4 @@
-NVClock Version 0.8 (Beta)
+NVClock Version 0.8 (Beta3)
  
 site: http://nvclock.sourceforge.net
 

Modified: packages/nvclock/branches/upstream/current/configure
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/configure?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/configure (original)
+++ packages/nvclock/branches/upstream/current/configure Sat Jan  5 20:47:40 2008
@@ -1,81 +1,35 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# 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.
 ## --------------------- ##
 ## 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
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  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
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)$' \| \
-	 .     : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\/\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
+  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'
@@ -96,124 +50,466 @@
   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
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+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
-
-       ;;
-  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
+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.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  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) >/dev/null 2>&1 && $as_unset $as_var
   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
-  '')
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+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
+
+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
+  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 at 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= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
+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 &&
+   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=:
@@ -222,7 +518,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'"
@@ -231,38 +548,26 @@
 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=
@@ -275,42 +580,134 @@
 # 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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CPP EGREP system PKG_CONFIG GTK_CFLAGS GTK_LIBS MOC UIC QEMBED QT_CXXFLAGS QT_LDADD QT_GUILINK QASSISTANTCLIENT_LDADD QT_CFLAGS QT_LIBS X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS X11_CFLAGS X11_LIBS HAVE_GTK2 HAVE_QT HAVE_NVCONTROL RANLIB 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
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+CXX
+CXXFLAGS
+ac_ct_CXX
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+SET_MAKE
+CPP
+GREP
+EGREP
+system
+PKG_CONFIG
+GTK_CFLAGS
+GTK_LIBS
+XMKMF
+MOC
+UIC
+QEMBED
+QT_CXXFLAGS
+QT_LDADD
+QT_GUILINK
+QASSISTANTCLIENT_LDADD
+QT_CFLAGS
+QT_LIBS
+X11_CFLAGS
+X11_LIBS
+X_CFLAGS
+X_PRE_LIBS
+X_LIBS
+X_EXTRA_LIBS
+HAVE_GTK2
+HAVE_QT
+HAVE_NVCONTROL
+RANLIB
+LIBOBJS
+LTLIBOBJS'
 ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CXX
+CXXFLAGS
+CCC
+CPP
+XMKMF'
+
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -337,34 +734,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}'
+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 ;;
@@ -386,33 +797,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- \
@@ -439,6 +862,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 ;;
@@ -463,13 +892,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)
@@ -534,6 +966,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 ;;
@@ -586,24 +1028,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.
@@ -634,8 +1072,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 ;;
 
   *)
@@ -655,27 +1092,19 @@
    { (exit 1); exit 1; }; }
 fi
 
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
+# 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
-    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-    *)  { 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
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-	      localstatedir libdir includedir oldincludedir infodir mandir
-do
-  eval ac_val=$`echo $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; }; };;
-  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'
@@ -702,82 +1131,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
+fi
+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; }; }
-  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
-   { (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_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_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+	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.
@@ -806,9 +1229,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]
@@ -826,15 +1246,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/PACKAGE]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
@@ -869,128 +1296,98 @@
   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>
   CXX         C++ compiler command
   CXXFLAGS    C++ compiler flags
   CPP         C preprocessor
+  XMKMF       Path to xmkmf, Makefile generator for X Window System
 
 Use these variables to override the choices made by `configure' or to help
 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;;
-esac
-
-    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
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
     else
       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
-
-Copyright (C) 2003 Free Software Foundation, Inc.
+configure
+generated by GNU Autoconf 2.61
+
+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
-fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+  exit
+fi
+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 $as_me, 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
 ## --------- ##
@@ -1009,7 +1406,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`
@@ -1023,6 +1420,7 @@
   test -z "$as_dir" && as_dir=.
   echo "PATH: $as_dir"
 done
+IFS=$as_save_IFS
 
 } >&5
 
@@ -1044,7 +1442,6 @@
 ac_configure_args=
 ac_configure_args0=
 ac_configure_args1=
-ac_sep=
 ac_must_keep_next=false
 for ac_pass in 1 2
 do
@@ -1055,7 +1452,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
@@ -1077,9 +1474,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
@@ -1090,8 +1485,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.
   {
@@ -1104,20 +1499,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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    *)
-      sed -n \
-	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
-      ;;
-    esac;
-}
+    esac |
+    sort
+)
     echo
 
     cat <<\_ASBOX
@@ -1128,22 +1537,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
@@ -1155,26 +1570,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.
 
@@ -1205,14 +1618,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
-fi
-for ac_site_file in $CONFIG_SITE; do
+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
+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;}
@@ -1228,8 +1644,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
@@ -1241,12 +1657,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
@@ -1271,8 +1686,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
@@ -1289,6 +1703,22 @@
    { (exit 1); exit 1; }; }
 fi
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1298,26 +1728,9 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-          ac_config_headers="$ac_config_headers config.h"
-
-          ac_config_commands="$ac_config_commands default-1"
+ac_config_headers="$ac_config_headers config.h"
+
+ac_config_commands="$ac_config_commands default-1"
 
 
 
@@ -1329,8 +1742,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
@@ -1343,32 +1756,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
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { 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 "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
@@ -1381,36 +1796,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
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  CC=$ac_ct_CC
+  { 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; }
+fi
+
+  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 at 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 at 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
@@ -1423,74 +1853,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
+  { 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
-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
-else
-  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
 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
@@ -1504,7 +1894,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
@@ -1515,6 +1905,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.
@@ -1532,22 +1923,23 @@
 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
+  { 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 "$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
@@ -1560,36 +1952,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
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { 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
+
 
     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
@@ -1602,29 +1996,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
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { 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; }
+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 at 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 at gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 fi
 
 fi
@@ -1637,21 +2047,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); }
@@ -1676,47 +2100,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
-else
+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
 
@@ -1728,19 +2182,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
@@ -1759,22 +2215,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
@@ -1785,9 +2246,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
@@ -1801,14 +2261,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
@@ -1828,14 +2288,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
@@ -1853,12 +2319,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
@@ -1881,49 +2347,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
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-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
@@ -1939,37 +2405,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
-  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_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
-fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+	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); } && {
+	 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); } && {
+	 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
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ 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
@@ -1985,12 +2532,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.  */
@@ -2024,11 +2571,16 @@
 /* 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);};
@@ -2044,219 +2596,79 @@
   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
+
+fi
+
+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" ;;
-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
+    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
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-ac_ext=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
@@ -2269,36 +2681,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
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { 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; }
+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
@@ -2311,55 +2725,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
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { 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; }
+fi
+
 
   test -n "$ac_ct_CXX" && break
 done
-test -n "$ac_ct_CXX" || ac_ct_CXX="g++"
-
-  CXX=$ac_ct_CXX
-fi
-
-
+
+  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 at 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 at 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
@@ -2382,49 +2826,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
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
 fi
-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
@@ -2440,37 +2884,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_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
+	CXXFLAGS=""
+      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); } && {
+	 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
+
+	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.  */
+
+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); } && {
+	 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 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
@@ -2486,110 +3011,6 @@
     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
-/* 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_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
-  :
-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_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
-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
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2597,29 +3018,35 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; 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 $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&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.
+
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -2634,8 +3061,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
@@ -2657,7 +3084,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.
@@ -2676,21 +3103,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.
@@ -2700,32 +3128,33 @@
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-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
 
@@ -2735,8 +3164,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=
@@ -2770,24 +3199,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
@@ -2796,9 +3223,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.  */
@@ -2808,24 +3236,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
@@ -2836,6 +3262,7 @@
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -2853,8 +3280,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
@@ -2877,24 +3304,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
@@ -2903,9 +3328,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.  */
@@ -2915,24 +3341,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
@@ -2943,6 +3367,7 @@
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -2965,23 +3390,170 @@
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-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
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
+  # 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
-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: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+    # 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_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_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; }
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3005,34 +3577,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
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+	ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
@@ -3088,6 +3657,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))
@@ -3107,18 +3677,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
@@ -3131,12 +3710,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
-fi
-fi
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+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; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -3169,13 +3750,12 @@
 
 
 
-echo "$as_me:$LINENO: checking for library containing getopt_long" >&5
-echo $ECHO_N "checking for library containing getopt_long... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for library containing getopt_long" >&5
+echo $ECHO_N "checking for library containing getopt_long... $ECHO_C" >&6; }
 if test "${ac_cv_search_getopt_long+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_getopt_long=no
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -3183,283 +3763,237 @@
 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 getopt_long ();
 int
 main ()
 {
-getopt_long ();
+return getopt_long ();
   ;
   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 '' getopt gnugetopt; 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_getopt_long="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_getopt_long=$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_getopt_long" = no; then
-  for ac_lib in getopt gnugetopt; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_getopt_long+set}" = set; then
+  break
+fi
+done
+if test "${ac_cv_search_getopt_long+set}" = set; then
+  :
+else
+  ac_cv_search_getopt_long=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_getopt_long" >&5
+echo "${ECHO_T}$ac_cv_search_getopt_long" >&6; }
+ac_res=$ac_cv_search_getopt_long
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: library 'gnugetopt' is needed" >&5
+echo "$as_me: error: library 'gnugetopt' is needed" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`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 { 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
 /* 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 getopt_long ();
-int
-main ()
-{
-getopt_long ();
-  ;
-  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_includes_default
+
+#include <$ac_header>
+_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 -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_getopt_long="-l$ac_lib"
-break
+  (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
 
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-  done
-fi
-LIBS=$ac_func_search_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_search_getopt_long" >&5
-echo "${ECHO_T}$ac_cv_search_getopt_long" >&6
-if test "$ac_cv_search_getopt_long" != no; then
-  test "$ac_cv_search_getopt_long" = "none required" || LIBS="$ac_cv_search_getopt_long $LIBS"
-
-else
-  { { echo "$as_me:$LINENO: error: library 'gnugetopt' is needed" >&5
-echo "$as_me: error: library 'gnugetopt' is needed" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`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
+	eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+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
+_ACEOF
+
+fi
+
+done
+
+
+if test "${ac_cv_header_getopt_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for getopt.h" >&5
+echo $ECHO_N "checking for getopt.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_getopt_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_getopt_h" >&5
+echo "${ECHO_T}$ac_cv_header_getopt_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking getopt.h usability" >&5
+echo $ECHO_N "checking getopt.h 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.  */
 $ac_includes_default
-
-#include <$ac_header>
+#include <getopt.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
-  eval "$as_ac_Header=yes"
+  (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
 
-eval "$as_ac_Header=no"
-fi
-rm -f 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
-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
-
-
-if test "${ac_cv_header_getopt_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for getopt.h" >&5
-echo $ECHO_N "checking for getopt.h... $ECHO_C" >&6
-if test "${ac_cv_header_getopt_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_getopt_h" >&5
-echo "${ECHO_T}$ac_cv_header_getopt_h" >&6
-else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking getopt.h usability" >&5
-echo $ECHO_N "checking getopt.h usability... $ECHO_C" >&6
+	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 getopt.h presence" >&5
+echo $ECHO_N "checking getopt.h 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.  */
-$ac_includes_default
 #include <getopt.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_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 -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_header_compiler=yes
+  (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_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
-
-# Is the header present?
-echo "$as_me:$LINENO: checking getopt.h presence" >&5
-echo $ECHO_N "checking getopt.h 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 <getopt.h>
-_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&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
-  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
+{ 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
@@ -3483,25 +4017,18 @@
 echo "$as_me: WARNING: getopt.h: proceeding with the preprocessor's result" >&2;}
     { echo "$as_me:$LINENO: WARNING: getopt.h: in the future, the compiler will take precedence" >&5
 echo "$as_me: WARNING: getopt.h: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to the AC_PACKAGE_NAME lists.  ##
-## ------------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for getopt.h" >&5
-echo $ECHO_N "checking for getopt.h... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for getopt.h" >&5
+echo $ECHO_N "checking for getopt.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_getopt_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_header_getopt_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_getopt_h" >&5
-echo "${ECHO_T}$ac_cv_header_getopt_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_getopt_h" >&5
+echo "${ECHO_T}$ac_cv_header_getopt_h" >&6; }
 
 fi
 if test $ac_cv_header_getopt_h = yes; then
@@ -3517,10 +4044,9 @@
 host=linux
 
 
-# Check whether --enable-gtk or --disable-gtk was given.
+# Check whether --enable-gtk was given.
 if test "${enable_gtk+set}" = set; then
-  enableval="$enable_gtk"
-
+  enableval=$enable_gtk;
     if test x$enableval = xno; then
 	enable_gtk=no
     else
@@ -3529,12 +4055,12 @@
 
 else
   enable_gtk=yes
-fi;
-
-# Check whether --enable-qt or --disable-qt was given.
+fi
+
+
+# Check whether --enable-qt was given.
 if test "${enable_qt+set}" = set; then
-  enableval="$enable_qt"
-
+  enableval=$enable_qt;
     if test x$enableval = xno; then
 	enable_qt=no
     else
@@ -3543,12 +4069,12 @@
 
 else
   enable_qt=no
-fi;
-
-# Check whether --enable-nvcontrol or --disable-nvcontrol was given.
+fi
+
+
+# Check whether --enable-nvcontrol was given.
 if test "${enable_nvcontrol+set}" = set; then
-  enableval="$enable_nvcontrol"
-
+  enableval=$enable_nvcontrol;
     if test x$enableval = xno; then
 	enable_nvcontrol=no
     else
@@ -3557,7 +4083,8 @@
 
 else
   enable_nvcontrol=yes
-fi;
+fi
+
 
 if test x"$enable_gtk" = "xyes"; then
 
@@ -3566,8 +4093,8 @@
   if test -z "$PKG_CONFIG"; then
     # 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_PKG_CONFIG+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -3582,27 +4109,28 @@
   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_PKG_CONFIG="$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_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
   ;;
 esac
 fi
 PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-
 if test -n "$PKG_CONFIG"; then
-  echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
-echo "${ECHO_T}$PKG_CONFIG" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
 
   fi
 
@@ -3614,25 +4142,25 @@
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        echo "$as_me:$LINENO: checking for gtk+-2.0 >= 2.4.0" >&5
-echo $ECHO_N "checking for gtk+-2.0 >= 2.4.0... $ECHO_C" >&6
+        { echo "$as_me:$LINENO: checking for gtk+-2.0 >= 2.4.0" >&5
+echo $ECHO_N "checking for gtk+-2.0 >= 2.4.0... $ECHO_C" >&6; }
 
         if $PKG_CONFIG --exists "gtk+-2.0 >= 2.4.0" ; 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; }
             succeeded=yes
 
-            echo "$as_me:$LINENO: checking GTK_CFLAGS" >&5
-echo $ECHO_N "checking GTK_CFLAGS... $ECHO_C" >&6
+            { echo "$as_me:$LINENO: checking GTK_CFLAGS" >&5
+echo $ECHO_N "checking GTK_CFLAGS... $ECHO_C" >&6; }
             GTK_CFLAGS=`$PKG_CONFIG --cflags "gtk+-2.0 >= 2.4.0"`
-            echo "$as_me:$LINENO: result: $GTK_CFLAGS" >&5
-echo "${ECHO_T}$GTK_CFLAGS" >&6
-
-            echo "$as_me:$LINENO: checking GTK_LIBS" >&5
-echo $ECHO_N "checking GTK_LIBS... $ECHO_C" >&6
+            { echo "$as_me:$LINENO: result: $GTK_CFLAGS" >&5
+echo "${ECHO_T}$GTK_CFLAGS" >&6; }
+
+            { echo "$as_me:$LINENO: checking GTK_LIBS" >&5
+echo $ECHO_N "checking GTK_LIBS... $ECHO_C" >&6; }
             GTK_LIBS=`$PKG_CONFIG --libs "gtk+-2.0 >= 2.4.0"`
-            echo "$as_me:$LINENO: result: $GTK_LIBS" >&5
-echo "${ECHO_T}$GTK_LIBS" >&6
+            { echo "$as_me:$LINENO: result: $GTK_LIBS" >&5
+echo "${ECHO_T}$GTK_LIBS" >&6; }
         else
             GTK_CFLAGS=""
             GTK_LIBS=""
@@ -3670,45 +4198,49 @@
 fi
 
 if test x"$enable_qt" = "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.
+    { echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6; }
+
+
+# Check whether --with-x was given.
 if test "${with_x+set}" = set; then
-  withval="$with_x"
-
-fi;
+  withval=$with_x;
+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}"'
-_ACEOF
-  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+incroot:
+	@echo incroot='${INCROOT}'
+usrlibdir:
+	@echo usrlibdir='${USRLIBDIR}'
+libdir:
+	@echo libdir='${LIBDIR}'
+_ACEOF
+  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
@@ -3716,7 +4248,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
@@ -3725,7 +4257,7 @@
     esac
   fi
   cd ..
-  rm -fr conftest.dir
+  rm -f -r conftest.dir
 fi
 
 # Standard set of common directories for X headers.
@@ -3766,7 +4298,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.  */
@@ -3776,24 +4308,22 @@
 /* end confdefs.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
@@ -3807,6 +4337,7 @@
   fi
 done
 fi
+
 rm -f conftest.err conftest.$ac_ext
 fi # $ac_x_includes = no
 
@@ -3832,26 +4363,23 @@
 }
 _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=
@@ -3859,79 +4387,80 @@
   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/libX11.$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
-fi
-
-  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
+;; #(
+    *) 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
-fi
-
-
-
-
-
-echo "$as_me:$LINENO: checking QTDIR" >&5
-echo $ECHO_N "checking QTDIR... $ECHO_C" >&6
-
-# Check whether --with-qtdir or --without-qtdir was given.
+  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
+
+
+
+
+
+{ echo "$as_me:$LINENO: checking QTDIR" >&5
+echo $ECHO_N "checking QTDIR... $ECHO_C" >&6; }
+
+# Check whether --with-qtdir was given.
 if test "${with_qtdir+set}" = set; then
-  withval="$with_qtdir"
-  QTDIR=$withval
-fi;
-
-# Check whether --with-qt-includes or --without-qt-includes was given.
+  withval=$with_qtdir; QTDIR=$withval
+fi
+
+
+# Check whether --with-qt-includes was given.
 if test "${with_qt_includes+set}" = set; then
-  withval="$with_qt_includes"
-  QT_INC_DIR=$withval
-fi;
-
-# Check whether --with-qt-libs or --without-qt-libs was given.
+  withval=$with_qt_includes; QT_INC_DIR=$withval
+fi
+
+
+# Check whether --with-qt-libs was given.
 if test "${with_qt_libs+set}" = set; then
-  withval="$with_qt_libs"
-  QT_LIB_DIR=$withval
-fi;
+  withval=$with_qt_libs; QT_LIB_DIR=$withval
+fi
+
 
 # Check that QTDIR is defined or that --with-qtdir given
 if test x"$QTDIR" = x; then
@@ -3988,8 +4517,8 @@
 QT_LIB_DIR=`echo $QT_LIB_DIR | perl -p -e 's/\\\\/\\//g'`
 
 # Figure out which version of Qt we are using
-echo "$as_me:$LINENO: checking Qt version" >&5
-echo $ECHO_N "checking Qt version... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking Qt version" >&5
+echo $ECHO_N "checking Qt version... $ECHO_C" >&6; }
 QT_VER=`grep 'define.*QT_VERSION_STR\W' $QT_INC_DIR/qglobal.h | perl -p -e 's/\D//g'`
 case "${QT_VER}" in
     2*)
@@ -4004,14 +4533,14 @@
    { (exit 1); exit 1; }; }
     ;;
 esac
-echo "$as_me:$LINENO: result: $QT_VER ($QT_MAJOR)" >&5
-echo "${ECHO_T}$QT_VER ($QT_MAJOR)" >&6
+{ echo "$as_me:$LINENO: result: $QT_VER ($QT_MAJOR)" >&5
+echo "${ECHO_T}$QT_VER ($QT_MAJOR)" >&6; }
 
 # Check that moc is in path
 # Extract the first word of "moc", so it can be a program name with args.
 set dummy moc; 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_MOC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4024,24 +4553,26 @@
   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_MOC="moc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 MOC=$ac_cv_prog_MOC
 if test -n "$MOC"; then
-  echo "$as_me:$LINENO: result: $MOC" >&5
-echo "${ECHO_T}$MOC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { echo "$as_me:$LINENO: result: $MOC" >&5
+echo "${ECHO_T}$MOC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
 
 if test x$MOC = x ; then
         { { echo "$as_me:$LINENO: error: *** moc must be in path" >&5
@@ -4052,8 +4583,8 @@
 # uic is the Qt user interface compiler
 # Extract the first word of "uic", so it can be a program name with args.
 set dummy uic; 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_UIC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4066,24 +4597,26 @@
   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_UIC="uic"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 UIC=$ac_cv_prog_UIC
 if test -n "$UIC"; then
-  echo "$as_me:$LINENO: result: $UIC" >&5
-echo "${ECHO_T}$UIC" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { echo "$as_me:$LINENO: result: $UIC" >&5
+echo "${ECHO_T}$UIC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
 
 if test x$UIC = x ; then
         { { echo "$as_me:$LINENO: error: *** uic must be in path" >&5
@@ -4096,8 +4629,8 @@
 # manually, we'll let it slide if it isn't present
 # Extract the first word of "qembed", so it can be a program name with args.
 set dummy qembed; 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_QEMBED+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4110,24 +4643,26 @@
   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_QEMBED="qembed"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 QEMBED=$ac_cv_prog_QEMBED
 if test -n "$QEMBED"; then
-  echo "$as_me:$LINENO: result: $QEMBED" >&5
-echo "${ECHO_T}$QEMBED" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
+  { echo "$as_me:$LINENO: result: $QEMBED" >&5
+echo "${ECHO_T}$QEMBED" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
 
 
 
@@ -4195,18 +4730,18 @@
         fi
         ;;
 esac
-echo "$as_me:$LINENO: checking if Qt is static" >&5
-echo $ECHO_N "checking if Qt is static... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $QT_IS_STATIC" >&5
-echo "${ECHO_T}$QT_IS_STATIC" >&6
-echo "$as_me:$LINENO: checking if Qt is multithreaded" >&5
-echo $ECHO_N "checking if Qt is multithreaded... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $QT_IS_MT" >&5
-echo "${ECHO_T}$QT_IS_MT" >&6
-echo "$as_me:$LINENO: checking if Qt is embedded" >&5
-echo $ECHO_N "checking if Qt is embedded... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $QT_IS_EMBEDDED" >&5
-echo "${ECHO_T}$QT_IS_EMBEDDED" >&6
+{ echo "$as_me:$LINENO: checking if Qt is static" >&5
+echo $ECHO_N "checking if Qt is static... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $QT_IS_STATIC" >&5
+echo "${ECHO_T}$QT_IS_STATIC" >&6; }
+{ echo "$as_me:$LINENO: checking if Qt is multithreaded" >&5
+echo $ECHO_N "checking if Qt is multithreaded... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $QT_IS_MT" >&5
+echo "${ECHO_T}$QT_IS_MT" >&6; }
+{ echo "$as_me:$LINENO: checking if Qt is embedded" >&5
+echo $ECHO_N "checking if Qt is embedded... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $QT_IS_EMBEDDED" >&5
+echo "${ECHO_T}$QT_IS_EMBEDDED" >&6; }
 
 QT_GUILINK=""
 QASSISTANTCLIENT_LDADD="-lqassistantclient"
@@ -4285,8 +4820,8 @@
 if test x$QT_IS_STATIC = xyes ; then
     OLDLIBS="$LIBS"
     LIBS="$QT_LDADD"
-    echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5
-echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for XftFontOpen in -lXft" >&5
+echo $ECHO_N "checking for XftFontOpen in -lXft... $ECHO_C" >&6; }
 if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -4299,55 +4834,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 XftFontOpen ();
 int
 main ()
 {
-XftFontOpen ();
+return XftFontOpen ();
   ;
   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_Xft_XftFontOpen=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xft_XftFontOpen=no
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_Xft_XftFontOpen=no
+fi
+
+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_Xft_XftFontOpen" >&5
-echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xft_XftFontOpen" >&5
+echo "${ECHO_T}$ac_cv_lib_Xft_XftFontOpen" >&6; }
 if test $ac_cv_lib_Xft_XftFontOpen = yes; then
   QT_LDADD="$QT_LDADD -lXft"
 fi
@@ -4355,14 +4888,14 @@
     LIBS="$LIBS"
 fi
 
-echo "$as_me:$LINENO: checking QT_CXXFLAGS" >&5
-echo $ECHO_N "checking QT_CXXFLAGS... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $QT_CXXFLAGS" >&5
-echo "${ECHO_T}$QT_CXXFLAGS" >&6
-echo "$as_me:$LINENO: checking QT_LDADD" >&5
-echo $ECHO_N "checking QT_LDADD... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $QT_LDADD" >&5
-echo "${ECHO_T}$QT_LDADD" >&6
+{ echo "$as_me:$LINENO: checking QT_CXXFLAGS" >&5
+echo $ECHO_N "checking QT_CXXFLAGS... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $QT_CXXFLAGS" >&5
+echo "${ECHO_T}$QT_CXXFLAGS" >&6; }
+{ echo "$as_me:$LINENO: checking QT_LDADD" >&5
+echo $ECHO_N "checking QT_LDADD... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $QT_LDADD" >&5
+echo "${ECHO_T}$QT_LDADD" >&6; }
 
 
 
@@ -4384,376 +4917,215 @@
 
 if test x"$enable_nvcontrol" = "xyes"; then
 
-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.
-if test "${with_x+set}" = set; then
-  withval="$with_x"
-
-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
+  succeeded=no
+
+  if test -z "$PKG_CONFIG"; then
+    # 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; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$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_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5
+echo "${ECHO_T}$PKG_CONFIG" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+
+  if test "$PKG_CONFIG" = "no" ; then
+     echo "*** The pkg-config script could not be found. Make sure it is"
+     echo "*** in your path, or set the PKG_CONFIG environment variable"
+     echo "*** to the full path to pkg-config."
+     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
   else
-    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
-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}"'
-_ACEOF
-  if (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`
-    # 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
-	ac_im_usrlibdir=$ac_im_libdir; break
-      fi
-    done
-    # Screen out bogus values from the imake configuration.  They are
-    # 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) ;;
-	*) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
-    esac
-    case $ac_im_usrlibdir in
-	/usr/lib | /lib) ;;
-	*) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;;
-    esac
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { echo "$as_me:$LINENO: checking for x11" >&5
+echo $ECHO_N "checking for x11... $ECHO_C" >&6; }
+
+        if $PKG_CONFIG --exists "x11" ; then
+            { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+            succeeded=yes
+
+            { echo "$as_me:$LINENO: checking X11_CFLAGS" >&5
+echo $ECHO_N "checking X11_CFLAGS... $ECHO_C" >&6; }
+            X11_CFLAGS=`$PKG_CONFIG --cflags "x11"`
+            { echo "$as_me:$LINENO: result: $X11_CFLAGS" >&5
+echo "${ECHO_T}$X11_CFLAGS" >&6; }
+
+            { echo "$as_me:$LINENO: checking X11_LIBS" >&5
+echo $ECHO_N "checking X11_LIBS... $ECHO_C" >&6; }
+            X11_LIBS=`$PKG_CONFIG --libs "x11"`
+            { echo "$as_me:$LINENO: result: $X11_LIBS" >&5
+echo "${ECHO_T}$X11_LIBS" >&6; }
+        else
+            X11_CFLAGS=""
+            X11_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            X11_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "x11"`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
   fi
-  cd ..
-  rm -fr conftest.dir
-fi
-
-# Standard set of common directories for X headers.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-ac_x_header_dirs='
-/usr/X11/include
-/usr/X11R6/include
-/usr/X11R5/include
-/usr/X11R4/include
-
-/usr/include/X11
-/usr/include/X11R6
-/usr/include/X11R5
-/usr/include/X11R4
-
-/usr/local/X11/include
-/usr/local/X11R6/include
-/usr/local/X11R5/include
-/usr/local/X11R4/include
-
-/usr/local/include/X11
-/usr/local/include/X11R6
-/usr/local/include/X11R5
-/usr/local/include/X11R4
-
-/usr/X386/include
-/usr/x386/include
-/usr/XFree86/include/X11
-
-/usr/include
-/usr/local/include
-/usr/unsupported/include
-/usr/athena/include
-/usr/local/x11r5/include
-/usr/lpp/Xamples/include
-
-/usr/openwin/include
-/usr/openwin/share/include'
-
-if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for a specified header file.
-  # First, try using that file with no special directory specified.
-  cat >conftest.$ac_ext <<_ACEOF
+
+  if test $succeeded = yes; then
+     :
+  else
+     if test "$no_x" = yes; then
+  # Not all programs may use this symbol, but it does not hurt to define it.
+
+cat >>confdefs.h <<\_ACEOF
+#define X_DISPLAY_MISSING 1
+_ACEOF
+
+  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
+else
+  if test -n "$x_includes"; then
+    X_CFLAGS="$X_CFLAGS -I$x_includes"
+  fi
+
+  # It would also be nice to do this for all -L options, not just this one.
+  if test -n "$x_libraries"; then
+    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 . . . .
+    { 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
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.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
+
+int
+main ()
+{
+
+  ;
+  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); } >/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
-  # We can compile using X headers with no special include directory.
-ac_x_includes=
+  (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
 
-  for ac_dir in $ac_x_header_dirs; do
-  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
-
-if test "$ac_x_libraries" = no; then
-  # Check for the libraries.
-  # See if we find them without any special options.
-  # Don't add to $LIBS permanently.
-  ac_save_LIBS=$LIBS
-  LIBS="-lX11 $LIBS"
-  cat >conftest.$ac_ext <<_ACEOF
+	LIBS="$ac_xsave_LIBS -R $x_libraries"
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Xlib.h>
+
 int
 main ()
 {
-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
-  LIBS=$ac_save_LIBS
-# We can link X programs with no special library path.
-ac_x_libraries=
+  (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
 
-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/libX11.$ac_extension; then
-      ac_x_libraries=$ac_dir
-      break 2
-    fi
-  done
-done
-fi
-rm -f conftest.err conftest.$ac_objext \
+	{ echo "$as_me:$LINENO: result: neither works" >&5
+echo "${ECHO_T}neither works" >&6; }
+fi
+
+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
-fi
-
-  fi
-  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
-  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
-fi
-
-fi
-if test "$no_x" = yes; then
-  # Not all programs may use this symbol, but it does not hurt to define it.
-
-cat >>confdefs.h <<\_ACEOF
-#define X_DISPLAY_MISSING 1
-_ACEOF
-
-  X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
-else
-  if test -n "$x_includes"; then
-    X_CFLAGS="$X_CFLAGS -I$x_includes"
-  fi
-
-  # It would also be nice to do this for all -L options, not just this one.
-  if test -n "$x_libraries"; then
-    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
-/* 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 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_R_nospace=yes
-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 \
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
       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
-/* 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 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_R_space=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_R_space=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      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
+    ac_c_werror_flag=$ac_xsave_c_werror_flag
+    LIBS=$ac_xsave_LIBS
   fi
 
   # Check for system-dependent libraries X programs must link with.
@@ -4774,49 +5146,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
@@ -4829,62 +5198,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_dnet_dnet_ntoa=no
+fi
+
+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
@@ -4897,62 +5264,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_dnet_stub_dnet_ntoa=no
+fi
+
+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"
 
@@ -4964,8 +5330,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
@@ -4992,71 +5358,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_func_gethostbyname=no
+fi
+
+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
@@ -5069,62 +5427,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_nsl_gethostbyname=no
+fi
+
+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
@@ -5137,55 +5493,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_bsd_gethostbyname=no
+fi
+
+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
@@ -5200,8 +5554,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
@@ -5228,71 +5582,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_func_connect=no
+fi
+
+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
@@ -5305,55 +5651,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_socket_connect=no
+fi
+
+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
@@ -5361,8 +5705,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
@@ -5389,71 +5733,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_func_remove=no
+fi
+
+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
@@ -5466,55 +5802,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_posix_remove=no
+fi
+
+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
@@ -5522,8 +5856,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
@@ -5550,71 +5884,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_func_shmat=no
+fi
+
+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
@@ -5627,55 +5953,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_ipc_shmat=no
+fi
+
+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
@@ -5692,8 +6016,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
@@ -5706,55 +6030,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
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_ICE_IceConnectionNumber=no
+fi
+
+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
@@ -5762,13 +6084,15 @@
   LDFLAGS=$ac_save_LDFLAGS
 
 fi
+
+  fi
 
     if test x$no_x = x ; then
         if test x$x_libraries = x ; then
             X11_LIBS=
 
-echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5
-echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5
+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6; }
 if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5781,55 +6105,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 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
   ac_cv_lib_X11_XOpenDisplay=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_X11_XOpenDisplay=no
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_X11_XOpenDisplay=no
+fi
+
+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_X11_XOpenDisplay" >&5
-echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5
+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6; }
 if test $ac_cv_lib_X11_XOpenDisplay = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBX11 1
@@ -5840,8 +6162,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for XextFindDisplay in -lXext" >&5
-echo $ECHO_N "checking for XextFindDisplay in -lXext... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for XextFindDisplay in -lXext" >&5
+echo $ECHO_N "checking for XextFindDisplay in -lXext... $ECHO_C" >&6; }
 if test "${ac_cv_lib_Xext_XextFindDisplay+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5854,55 +6176,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 XextFindDisplay ();
 int
 main ()
 {
-XextFindDisplay ();
+return XextFindDisplay ();
   ;
   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_Xext_XextFindDisplay=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xext_XextFindDisplay=no
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_Xext_XextFindDisplay=no
+fi
+
+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_Xext_XextFindDisplay" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_XextFindDisplay" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XextFindDisplay" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_XextFindDisplay" >&6; }
 if test $ac_cv_lib_Xext_XextFindDisplay = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBXEXT 1
@@ -5915,8 +6235,8 @@
             HAVE_NVCONTROL=yes
         else
 
-echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5
-echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for XOpenDisplay in -lX11" >&5
+echo $ECHO_N "checking for XOpenDisplay in -lX11... $ECHO_C" >&6; }
 if test "${ac_cv_lib_X11_XOpenDisplay+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -5929,55 +6249,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 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
   ac_cv_lib_X11_XOpenDisplay=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_X11_XOpenDisplay=no
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_X11_XOpenDisplay=no
+fi
+
+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_X11_XOpenDisplay" >&5
-echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XOpenDisplay" >&5
+echo "${ECHO_T}$ac_cv_lib_X11_XOpenDisplay" >&6; }
 if test $ac_cv_lib_X11_XOpenDisplay = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBX11 1
@@ -5988,8 +6306,8 @@
 fi
 
 
-echo "$as_me:$LINENO: checking for XextFindDisplay in -lXext" >&5
-echo $ECHO_N "checking for XextFindDisplay in -lXext... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for XextFindDisplay in -lXext" >&5
+echo $ECHO_N "checking for XextFindDisplay in -lXext... $ECHO_C" >&6; }
 if test "${ac_cv_lib_Xext_XextFindDisplay+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -6002,55 +6320,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 XextFindDisplay ();
 int
 main ()
 {
-XextFindDisplay ();
+return XextFindDisplay ();
   ;
   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_Xext_XextFindDisplay=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xext_XextFindDisplay=no
-fi
-rm -f conftest.err conftest.$ac_objext \
+	ac_cv_lib_Xext_XextFindDisplay=no
+fi
+
+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_Xext_XextFindDisplay" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_XextFindDisplay" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XextFindDisplay" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_XextFindDisplay" >&6; }
 if test $ac_cv_lib_Xext_XextFindDisplay = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBXEXT 1
@@ -6092,7 +6408,8 @@
 
 
 
-                                                            ac_config_files="$ac_config_files src/Makefile src/backend/Makefile src/nvcontrol/Makefile src/qt/Makefile src/gtk/Makefile Makefile"
+ac_config_files="$ac_config_files src/Makefile src/backend/Makefile src/nvcontrol/Makefile src/qt/Makefile src/gtk/Makefile Makefile"
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -6111,39 +6428,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
@@ -6151,21 +6487,6 @@
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # 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
 
@@ -6173,11 +6494,12 @@
 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
 
@@ -6208,73 +6530,26 @@
 ## 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
-fi
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  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
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)$' \| \
-	 .     : '\(.\)' 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
-  	  /^X\/\(\/\).*/{ s//\1/; q; }
-  	  s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
+  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'
@@ -6295,126 +6570,198 @@
   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
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+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
-
-       ;;
-  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
+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.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  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) >/dev/null 2>&1 && $as_unset $as_var
   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 '
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
   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= ;;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
+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 &&
+   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=:
@@ -6423,7 +6770,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'"
@@ -6432,31 +6800,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 $as_me, 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
@@ -6464,30 +6815,20 @@
   CONFIG_COMMANDS = $CONFIG_COMMANDS
   $ $0 $@
 
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
-_ACEOF
-
+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
-
-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
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
-
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
 current configuration.
@@ -6495,7 +6836,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
@@ -6514,19 +6855,21 @@
 $config_commands
 
 Report bugs to <bug-autoconf at gnu.org>."
-_ACEOF
-
+
+_ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.59,
-  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2003 Free Software Foundation, Inc.
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+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
@@ -6537,39 +6880,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
@@ -6579,18 +6907,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
@@ -6606,41 +6940,53 @@
 _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
-fi
-
-_ACEOF
-
+  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
 #
-# INIT-COMMANDS section.
+# INIT-COMMANDS
 #
 
 
-
-_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.
-  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
-  "src/backend/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/backend/Makefile" ;;
-  "src/nvcontrol/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/nvcontrol/Makefile" ;;
-  "src/qt/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/qt/Makefile" ;;
-  "src/gtk/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/gtk/Makefile" ;;
-  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-  "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
-  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "default-1") CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
+    "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+    "src/backend/Makefile") CONFIG_FILES="$CONFIG_FILES src/backend/Makefile" ;;
+    "src/nvcontrol/Makefile") CONFIG_FILES="$CONFIG_FILES src/nvcontrol/Makefile" ;;
+    "src/qt/Makefile") CONFIG_FILES="$CONFIG_FILES src/qt/Makefile" ;;
+    "src/gtk/Makefile") CONFIG_FILES="$CONFIG_FILES src/gtk/Makefile" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
   *) { { 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.
@@ -6653,326 +6999,394 @@
 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, at SHELL@,$SHELL,;t t
-s, at PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s, at PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s, at PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s, at PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s, at PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s, at PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s, at exec_prefix@,$exec_prefix,;t t
-s, at prefix@,$prefix,;t t
-s, at program_transform_name@,$program_transform_name,;t t
-s, at bindir@,$bindir,;t t
-s, at sbindir@,$sbindir,;t t
-s, at libexecdir@,$libexecdir,;t t
-s, at datadir@,$datadir,;t t
-s, at sysconfdir@,$sysconfdir,;t t
-s, at sharedstatedir@,$sharedstatedir,;t t
-s, at localstatedir@,$localstatedir,;t t
-s, at libdir@,$libdir,;t t
-s, at includedir@,$includedir,;t t
-s, at oldincludedir@,$oldincludedir,;t t
-s, at infodir@,$infodir,;t t
-s, at mandir@,$mandir,;t t
-s, at build_alias@,$build_alias,;t t
-s, at host_alias@,$host_alias,;t t
-s, at target_alias@,$target_alias,;t t
-s, at DEFS@,$DEFS,;t t
-s, at ECHO_C@,$ECHO_C,;t t
-s, at ECHO_N@,$ECHO_N,;t t
-s, at ECHO_T@,$ECHO_T,;t t
-s, at LIBS@,$LIBS,;t t
-s, at CC@,$CC,;t t
-s, at CFLAGS@,$CFLAGS,;t t
-s, at LDFLAGS@,$LDFLAGS,;t t
-s, at CPPFLAGS@,$CPPFLAGS,;t t
-s, at ac_ct_CC@,$ac_ct_CC,;t t
-s, at EXEEXT@,$EXEEXT,;t t
-s, at OBJEXT@,$OBJEXT,;t t
-s, at CXX@,$CXX,;t t
-s, at CXXFLAGS@,$CXXFLAGS,;t t
-s, at ac_ct_CXX@,$ac_ct_CXX,;t t
-s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-s, at INSTALL_DATA@,$INSTALL_DATA,;t t
-s, at SET_MAKE@,$SET_MAKE,;t t
-s, at CPP@,$CPP,;t t
-s, at EGREP@,$EGREP,;t t
-s, at system@,$system,;t t
-s, at PKG_CONFIG@,$PKG_CONFIG,;t t
-s, at GTK_CFLAGS@,$GTK_CFLAGS,;t t
-s, at GTK_LIBS@,$GTK_LIBS,;t t
-s, at MOC@,$MOC,;t t
-s, at UIC@,$UIC,;t t
-s, at QEMBED@,$QEMBED,;t t
-s, at QT_CXXFLAGS@,$QT_CXXFLAGS,;t t
-s, at QT_LDADD@,$QT_LDADD,;t t
-s, at QT_GUILINK@,$QT_GUILINK,;t t
-s, at QASSISTANTCLIENT_LDADD@,$QASSISTANTCLIENT_LDADD,;t t
-s, at QT_CFLAGS@,$QT_CFLAGS,;t t
-s, at QT_LIBS@,$QT_LIBS,;t t
-s, at X_CFLAGS@,$X_CFLAGS,;t t
-s, at X_PRE_LIBS@,$X_PRE_LIBS,;t t
-s, at X_LIBS@,$X_LIBS,;t t
-s, at X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
-s, at X11_CFLAGS@,$X11_CFLAGS,;t t
-s, at X11_LIBS@,$X11_LIBS,;t t
-s, at HAVE_GTK2@,$HAVE_GTK2,;t t
-s, at HAVE_QT@,$HAVE_QT,;t t
-s, at HAVE_NVCONTROL@,$HAVE_NVCONTROL,;t t
-s, at RANLIB@,$RANLIB,;t t
-s, at LIBOBJS@,$LIBOBJS,;t t
-s, at 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
+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
+CC!$CC$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
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+system!$system$ac_delim
+PKG_CONFIG!$PKG_CONFIG$ac_delim
+GTK_CFLAGS!$GTK_CFLAGS$ac_delim
+GTK_LIBS!$GTK_LIBS$ac_delim
+XMKMF!$XMKMF$ac_delim
+MOC!$MOC$ac_delim
+UIC!$UIC$ac_delim
+QEMBED!$QEMBED$ac_delim
+QT_CXXFLAGS!$QT_CXXFLAGS$ac_delim
+QT_LDADD!$QT_LDADD$ac_delim
+QT_GUILINK!$QT_GUILINK$ac_delim
+QASSISTANTCLIENT_LDADD!$QASSISTANTCLIENT_LDADD$ac_delim
+QT_CFLAGS!$QT_CFLAGS$ac_delim
+QT_LIBS!$QT_LIBS$ac_delim
+X11_CFLAGS!$X11_CFLAGS$ac_delim
+X11_LIBS!$X11_LIBS$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
+HAVE_GTK2!$HAVE_GTK2$ac_delim
+HAVE_QT!$HAVE_QT$ac_delim
+HAVE_NVCONTROL!$HAVE_NVCONTROL$ac_delim
+RANLIB!$RANLIB$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` = 80; 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
+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
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+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
+
+  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
-    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
-  fi
-fi # test -n "$CONFIG_FILES"
-
-_ACEOF
-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 ;;
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
   esac
 
-  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+  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 ;;
-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;;
-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
+
+
+  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
-
-  # 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
-_ACEOF
+_ACEOF
+
+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
@@ -6980,370 +7394,144 @@
 cat >>$CONFIG_STATUS <<\_ACEOF
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s, at configure_input@,$configure_input,;t t
-s, at srcdir@,$ac_srcdir,;t t
-s, at abs_srcdir@,$ac_abs_srcdir,;t t
-s, at top_srcdir@,$ac_top_srcdir,;t t
-s, at abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s, at builddir@,$ac_builddir,;t t
-s, at abs_builddir@,$ac_abs_builddir,;t t
-s, at top_builddir@,$ac_top_builddir,;t t
-s, at abs_top_builddir@,$ac_abs_top_builddir,;t t
-s, at 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
-
-#
-# 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'
+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;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :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=',;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".
-  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 ;;
-  esac
-
-  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
-
-# This sed command replaces #undef with comments.  This is necessary, for
+ac_dD=' ,'
+
+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
+
+# 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]*,/* & */,
-_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
+# (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 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
+  # 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
+  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
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
-  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
-  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
-  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$ac_dest" : 'X\(//\)[^/]' \| \
-	 X"$ac_dest" : 'X\(//\)$' \| \
-	 X"$ac_dest" : 'X\(/\)' \| \
-	 .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
-    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; }; }; }
-
-  ac_builddir=.
-
-if test "$ac_dir" != .; then
-  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
-
-case $srcdir in
-  .)  # No --srcdir option.  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_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;;
-esac
-
-
-  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
-  case $ac_dest in
-    default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;;
+  rm -f "$tmp/out12"
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
   esac
-done
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
+
+
+  case $ac_file$ac_mode in
+    "default-1":C) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;;
+
+  esac
+done # for ac_tag
+
 
 { (exit 0); exit 0; }
 _ACEOF

Modified: packages/nvclock/branches/upstream/current/configure.in
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/configure.in?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/configure.in (original)
+++ packages/nvclock/branches/upstream/current/configure.in Sat Jan  5 20:47:40 2008
@@ -103,7 +103,7 @@
 fi
 
 if test x"$enable_nvcontrol" = "xyes"; then
-    AC_PATH_XTRA
+    PKG_CHECK_MODULES([X11], [x11], , [AC_PATH_XTRA])
     if test x$no_x = x ; then
         if test x$x_libraries = x ; then
             X11_LIBS=

Modified: packages/nvclock/branches/upstream/current/nvclock.1
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/nvclock.1?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/nvclock.1 (original)
+++ packages/nvclock/branches/upstream/current/nvclock.1 Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 .\" NAME should be all caps, SECTION should be 1-8, maybe w/ subsection
 .\" other parms are allowed: see man(7), man(1)
-.TH "NVCLOCK" "1" "0.8beta2" "" ""
+.TH "NVCLOCK" "1" "0.8beta3" "" ""
 .SH "NAME"
 nvclock \- Overclock your nVidia graphics adapter.
 .SH "SYNOPSIS"
@@ -17,7 +17,7 @@
 A summary of options are included below.
 .TP
 .BI "-\-b, \-\-backend " "backend"
-By default NVClock uses its so called 'low-level' backend for reading and adjusting the clockspeeds of cards. Since NVidia driver 1.0-7667 the drivers also provide an overclocking mechanism called 'Coolbits'. It is only supported on desktop versions of the GeforceFX/6/7. The main advantages it has over the low-level backend is that it allows you to set the clocks to use in 2D and 3D programs. The problem is that various modern GeforceFX/6/7 cards run at different clockspeeds depending if you are running a 3D application or not.
+By default NVClock uses its so called 'low-level' backend for reading and adjusting the clockspeeds of cards. Since NVidia driver 1.0-7667 the drivers also provide an overclocking mechanism called 'Coolbits'. It is only supported on desktop versions of the GeforceFX/6/7. The main advantages it has over the low-level backend is that it allows you to set the clocks to use in 2D and 3D programs. The problem is that various modern GeforceFX/6/7/8 cards run at different clockspeeds depending if you are running a 3D application or not.
 
 Possible values for backend are: coolbits, coolbits2d, coolbits3d and lowlevel. The default option on GeforceFX/6/7 cards is coolbits which sets the same clocks for 2D/3D, further coolbits2d and coolbits3d set respectively the 2D and 3D clocks and finally lowlevel lets you use the lowlevel backend.
 .TP 

Modified: packages/nvclock/branches/upstream/current/src/CVS/Entries
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/CVS/Entries?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/CVS/Entries (original)
+++ packages/nvclock/branches/upstream/current/src/CVS/Entries Sat Jan  5 20:47:40 2008
@@ -4,4 +4,4 @@
 D/gtk////
 D/nvcontrol////
 D/qt////
-/nvclock.c/1.60/Mon Jul 31 16:37:22 2006//
+/nvclock.c/1.84/Fri Jan  4 17:32:57 2008//

Modified: packages/nvclock/branches/upstream/current/src/backend/CVS/Entries
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/CVS/Entries?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/CVS/Entries (original)
+++ packages/nvclock/branches/upstream/current/src/backend/CVS/Entries Sat Jan  5 20:47:40 2008
@@ -1,30 +1,32 @@
-/Makefile/1.2/Mon Mar  8 20:53:14 2004//
-/Makefile.in/1.13/Sat Jan 28 19:45:25 2006//
-/back_bsd.c/1.34/Thu Jan 12 21:36:47 2006//
-/back_linux.c/1.9/Thu Jan 12 21:36:47 2006//
-/back_win32.c/1.6/Thu Jan 12 21:36:47 2006//
-/backend.c/1.51/Thu Jan 12 21:36:47 2006//
-/error.c/1.3/Wed Oct  5 11:27:11 2005//
-/f75375.c/1.6/Thu Mar 23 22:24:23 2006//
-/f75375.h/1.4/Wed Oct  5 11:27:11 2005//
-/libc_wrapper.c/1.2/Wed Oct  5 11:27:11 2005//
-/lm99.c/1.6/Tue Oct 11 20:57:03 2005//
-/nv31.c/1.12/Sat Jan  7 21:26:11 2006//
-/nvcontrol.c/1.4/Sat Jan  7 21:26:11 2006//
-/overclock.c/1.17/Sat Jan  7 21:26:11 2006//
-/w83781d.c/1.2/Sun May  7 10:42:12 2006//
-/w83l785r.c/1.5/Wed Oct  5 11:27:11 2005//
-/xf86i2c.c/1.2/Wed Oct  5 11:27:11 2005//
-/xf86i2c.h/1.3/Sun May 15 18:39:24 2005//
-/xfree.h/1.1/Mon Apr  4 20:04:04 2005//
-/backend.h/1.23/Sat Jul 15 09:47:08 2006//
-/config.c/1.26/Fri Jul 28 15:56:43 2006//
-/bios.c/1.25/Mon Jul 31 11:01:35 2006//
-/info.c/1.66/Mon Jul 31 11:01:19 2006//
-/nv30.c/1.22/Mon Jul 31 11:01:42 2006//
-/i2c.c/1.11/Mon Jul 31 14:44:32 2006//
-/i2c.h/1.7/Mon Jul 31 14:26:07 2006//
-/nvclock.h/1.38/Mon Jul 31 14:33:41 2006//
-/adt7473.c/1.4/Mon Jul 31 16:06:14 2006//
-/nv40.c/1.45/Mon Jul 31 16:33:20 2006//
+/Makefile/1.2/Sun Apr 22 18:24:31 2007//
+/error.c/1.3/Sun Apr 22 18:24:32 2007//
+/f75375.c/1.6/Sun Apr 22 18:24:32 2007//
+/f75375.h/1.4/Sun Apr 22 18:24:32 2007//
+/i2c.h/1.8/Sun Apr 22 18:24:32 2007//
+/libc_wrapper.c/1.2/Sun Apr 22 18:24:32 2007//
+/lm99.c/1.6/Sun Apr 22 18:24:32 2007//
+/nvcontrol.c/1.5/Sun Apr 22 18:24:32 2007//
+/w83781d.c/1.2/Sun Apr 22 18:24:32 2007//
+/w83l785r.c/1.5/Sun Apr 22 18:24:32 2007//
+/xf86i2c.c/1.2/Sun Apr 22 18:24:32 2007//
+/xf86i2c.h/1.3/Sun Apr 22 18:24:33 2007//
+/xfree.h/1.1/Sun Apr 22 18:24:33 2007//
+/i2c.c/1.14/Tue Apr 24 08:10:47 2007//
+/adt7473.c/1.5/Fri Nov  2 10:23:00 2007//
+/nvreg.h/1.4/Thu Aug 30 16:47:04 2007//
+/overclock.c/1.19/Fri Nov  2 10:23:01 2007//
+/utils.c/1.3/Sun Dec  2 21:30:17 2007//
+/Makefile.in/1.16/Thu Jan  3 20:08:43 2008//
+/back_bsd.c/1.37/Thu Jan  3 20:08:43 2008//
+/back_linux.c/1.16/Thu Jan  3 20:08:43 2008//
+/back_win32.c/1.10/Thu Jan  3 20:08:43 2008//
+/backend.c/1.56/Thu Jan  3 20:08:43 2008//
+/backend.h/1.28/Thu Jan  3 20:08:43 2008//
+/config.c/1.30/Thu Jan  3 20:08:43 2008//
+/info.c/1.103/Thu Jan  3 20:08:43 2008//
+/nv30.c/1.26/Thu Jan  3 20:08:43 2008//
+/nv50.c/1.10/Thu Jan  3 20:08:43 2008//
+/nvclock.h/1.56/Thu Jan  3 20:08:43 2008//
+/bios.c/1.41/Fri Jan  4 13:05:38 2008//
+/nv40.c/1.66/Fri Jan  4 17:35:39 2008//
 D

Modified: packages/nvclock/branches/upstream/current/src/backend/Makefile.in
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/Makefile.in?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/Makefile.in (original)
+++ packages/nvclock/branches/upstream/current/src/backend/Makefile.in Sat Jan  5 20:47:40 2008
@@ -4,7 +4,7 @@
 
 system=@system@
 HAVE_NVCONTROL=@HAVE_NVCONTROL@
-OBJECTS=backend.o bios.o config.o error.o nv30.o nv31.o nv40.o info.o overclock.o i2c.o xf86i2c.o adt7473.o f75375.o lm99.o w83781d.o w83l785r.o libc_wrapper.o
+OBJECTS=backend.o bios.o config.o error.o nv30.o nv40.o nv50.o info.o overclock.o utils.o i2c.o xf86i2c.o adt7473.o f75375.o lm99.o w83781d.o w83l785r.o libc_wrapper.o
 CFLAGS=@X11_CFLAGS@ -I../.. -I../nvcontrol
 
 ifeq ($(system), FreeBSD)

Modified: packages/nvclock/branches/upstream/current/src/backend/adt7473.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/adt7473.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/adt7473.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/adt7473.c Sat Jan  5 20:47:40 2008
@@ -82,10 +82,8 @@
 {
 	I2CByte temp;
 	I2CByte cfg;
-	
-	xf86I2CReadByte(dev, ADT7473_REG_REMOTE_TEMP, &temp);
-	
-	/* Check if the sensor uses 2-complement or offset-64 mode */
+	int offset = 0;
+
 	/* We add a 10C offset to the temperature though this isn't conform
 	/  the ADT7473 datasheet. The reason we add this is to show a temperature
 	/  similar to the internal gpu sensor. Right now the board and gpu
@@ -94,12 +92,20 @@
 	/  temperature is a bit higher and assuming the temperature as reported
 	/  by the internal sensor is correct adding a 10C offset is a good solution.
 	/  (The offset seems to be the same independant of the temperature which)
+	/  Don't do it on NV50, it doesn't have an internal sensor?
 	*/
+	if(dev->arch & NV4X)
+		offset = 10;
+
+	xf86I2CReadByte(dev, ADT7473_REG_REMOTE_TEMP, &temp);
+	
+	/* Check if the sensor uses 2-complement or offset-64 mode */
+
 	xf86I2CReadByte(dev, ADT7473_REG_CFG5, &cfg);
 	if(cfg & 0x1)
-		return (int)((char)temp+10);
+		return (int)((char)temp + offset);
 	else
-		return temp - 64 + 10;
+		return temp - 64 + offset;
 }
 
 int adt7473_get_fanspeed_rpm(I2CDevPtr dev)

Modified: packages/nvclock/branches/upstream/current/src/backend/back_bsd.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/back_bsd.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/back_bsd.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/back_bsd.c Sat Jan  5 20:47:40 2008
@@ -33,7 +33,6 @@
 #include <sys/linker.h>
 #include <sys/mman.h>
 
-#include "nvclock.h"
 #include "backend.h"
 
 #if __FreeBSD_version < 430000
@@ -204,8 +203,13 @@
 	nv_card->PRAMDAC = map_dev_mem(fd, nv_card->reg_address + 0x680000, 0x2000);
 	nv_card->PROM    = map_dev_mem(fd, nv_card->reg_address + 0x300000, 0xffff);
  
- 	nv_card->mem_mapped = 1;
-
+	/* On Geforce 8xxx cards it appears that the pci config header has been moved */
+	if(nv_card->arch & NV5X)
+		nv_card->PBUS = map_dev_mem(fd, nv_card->reg_address + 0x88000, 0x100);
+	else
+		nv_card->PBUS = nv_card->PMC + 0x1800/4;
+
+	nv_card->mem_mapped = 1;
 	close(fd);
 	return 1;
 }
@@ -214,7 +218,7 @@
 {
 	unmap_dev_mem((unsigned long)nv_card->PEXTDEV, 0x1000);
 	unmap_dev_mem((unsigned long)nv_card->PFB, 0x1000);
-	unmap_dev_mem((unsigned long)nv_card->PMC, 0xffff);
+	unmap_dev_mem((unsigned long)nv_card->PMC, 0x2ffff);
 	unmap_dev_mem((unsigned long)nv_card->PCIO, 0x2000);
 	unmap_dev_mem((unsigned long)nv_card->PRAMDAC, 0x2000);
 	unmap_dev_mem((unsigned long)nv_card->PROM, 0xffff);

Modified: packages/nvclock/branches/upstream/current/src/backend/back_linux.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/back_linux.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/back_linux.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/back_linux.c Sat Jan  5 20:47:40 2008
@@ -1,7 +1,6 @@
-
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  * 
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://nvclock.sourceforge.net
  *
@@ -30,7 +29,6 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "nvclock.h"
 #include "backend.h"
 
 NVClock nvclock;
@@ -47,40 +45,41 @@
 {
 	FILE *proc;
 	char buffer[80];
-    
+
 	proc = fopen("/proc/modules", "r");
-    
-	if(proc != NULL) 
-	{
-		while(fgets(buffer, 80, proc) != NULL)
+
+	/* Don't crash when there's no /proc/modules */
+	if(proc == NULL)
+		return 0;
+
+	while(fgets(buffer, 80, proc) != NULL)
+	{
+		char name[80];
+		int size;
+		int used;
+
+		/* Check to see if NVdriver/nvidia is loaded and if it is used.
+		/  For various versions the driver isn't initialized when X hasn't
+		/  been started and it can crash then.
+		*/
+		if(sscanf(buffer,"%s %d %d",&name, &size, &used) != 3) continue;
 		{
-			char name[20];
-			int size;
-			int used;
-    
-			/* Check to see if NVdriver/nvidia is loaded and if it is used.
-			/  For various versions the driver isn't initialized when X hasn't
-			/  been started and it can crash then.
-			*/
-			if(sscanf(buffer,"%s %d %d",&name, &size, &used) != 3) continue;
+			if(strcmp(name, "NVdriver") == 0)
 			{
-				if(strcmp(name, "NVdriver") == 0)
-				{
-					fclose(proc);
-					if(used)
-						return 1;
-		    
+				fclose(proc);
+				if(used)
+					return 1;
+
 					return 0;
-				}
-
-				if(strcmp(name, "nvidia") == 0)
-				{
-					fclose(proc);
-		    		if(used)
-						return 2;
-
-					return 0;
-				}
+			}
+
+			if(strcmp(name, "nvidia") == 0)
+			{
+				fclose(proc);
+				if(used)
+					return 2;
+
+				return 0;
 			}
 		}
 	}
@@ -245,13 +244,18 @@
 	nv_card->PEXTDEV = map_dev_mem(fd, nv_card->reg_address + 0x101000, 0x1000);
 	nv_card->PFB     = map_dev_mem(fd, nv_card->reg_address + 0x100000, 0x1000);
 	/* normally pmc is till 0x2000 but extended it for nv40 */
-	nv_card->PMC     = map_dev_mem(fd, nv_card->reg_address + 0x000000, 0xffff);
+	nv_card->PMC     = map_dev_mem(fd, nv_card->reg_address + 0x000000, 0x2ffff);
 	nv_card->PCIO    = map_dev_mem(fd, nv_card->reg_address + 0x601000, 0x2000);
 	nv_card->PRAMDAC = map_dev_mem(fd, nv_card->reg_address + 0x680000, 0x2000);
 	nv_card->PROM    = map_dev_mem(fd, nv_card->reg_address + 0x300000, 0xffff);
-    
+
+	/* On Geforce 8xxx cards it appears that the pci config header has been moved */
+	if(nv_card->arch & NV5X)
+		nv_card->PBUS = map_dev_mem(fd, nv_card->reg_address + 0x88000, 0x100);
+	else
+		nv_card->PBUS = nv_card->PMC + 0x1800/4;
+
 	nv_card->mem_mapped = 1;
-
 	close(fd);
 	return 1;
 }

Modified: packages/nvclock/branches/upstream/current/src/backend/back_win32.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/back_win32.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/back_win32.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/back_win32.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  * 
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://nvclock.sourceforge.net
  *
@@ -24,127 +24,139 @@
 #include <stdint.h>
 #include <string.h>
 
-#include "nvclock.h"
 #include "backend.h"
 
-#include "WinIo.h"
+#include "MemAcc.h"
 
 void *lib_winio = NULL;
-WinIO winio = NULL;
-int (__stdcall *pInitializeWinIo)();
-int (__stdcall *pwinio_get_pci_header)(void* winio_handle, struct winio_pci_common_header *buf);
-void* (__stdcall *pMapIO)(void* winio_handle, unsigned long phys_addr, unsigned long size); 
-void (__stdcall *pUnMapIO)(void* winio_handle, void* virt_uaddr);
+int (__stdcall *pOpenLibrary)();
+int (__stdcall *pGetLastState)(char *sStatus);
+int (__stdcall *pGetDeviceBaseAddress)(unsigned short* VendorID, unsigned short*
+DeviceID, LONG nIndex, BADDR baddrBuffer[6]);
+int (__stdcall *pGetPCIDeviceInfo)(unsigned short* VendorID, unsigned short* DeviceID, long nIndex, unsigned long* Bus, unsigned
+long* Device, unsigned long* Function, PCI_CONFIG_HEADER *pcfg);
+
+void* (__stdcall *pMapPhysToLinear)(DWORD PhAddr, DWORD dwSize, HANDLE* hMem);
+
+
+static int probe_devices();
 
 NVClock nvclock;
 NVCard *nv_card = NULL;
 
 int init_nvclock()
 {
-    void *lib_winio = LoadLibrary("WinIo.dll");
-    if(lib_winio == NULL)
-    {
-	set_error_str("Can't open WinIo.dll\n");
+	void *lib_memacc = LoadLibrary("MemAcc.dll");
+
+	int nResult, nIndex;
+	int VendorID, DeviceID;
+	char* s;
+	int i;
+	char sError[255];
+
+	if(lib_memacc == NULL)
+	{
+		set_error_str("Can't open MemAcc.dll\n");
 	return 0;
-    }
+	}
+
+	pOpenLibrary = (void*)GetProcAddress(lib_memacc, "maOpenLibrary");
+	pGetLastState = (void*)GetProcAddress(lib_memacc, "maGetLastState");
+	pGetDeviceBaseAddress = (void*)GetProcAddress(lib_memacc, "maGetDeviceBaseAddress");
+	pGetPCIDeviceInfo = (void*)GetProcAddress(lib_memacc, "maGetPCIDeviceInfo");
+	pMapPhysToLinear = (void*)GetProcAddress(lib_memacc, "maMapPhysToLinear");
+
+	if(!pOpenLibrary())
+	{
+		char buf[80];
+		pGetLastState(buf);
+		printf("Loading of MemAcc.dll failed: %s \n", buf);
+	}
 	
-    pInitializeWinIo = GetProcAddress(lib_winio, "InitializeWinIo");
-    pMapIO = GetProcAddress(lib_winio, "MapIO");
-    pUnMapIO = GetProcAddress(lib_winio, "UnMapIO");
-    pwinio_get_pci_header = GetProcAddress(lib_winio, "winio_get_pci_header");
-	
-    winio = pInitializeWinIo();
-	
-    if(winio == NULL)
-    {
-	set_error_str("Can't initialize WinIO\n");
-    	return 0;
-    }
-    
-    /* Detect all nvidia cards; this needs to be done before creating directory and config file as that code needs card access */
-    if(!probe_devices())
-    {
-	/* probe_devices takes care of the error as it isn't certain it failed because of there are no nvidia cards */
-	return 0;
-    }
+	/* Detect all nvidia cards; this needs to be done before creating directory and config file as that code needs card access */
+	if(!probe_devices())
+	{
+		/* probe_devices takes care of the error as it isn't certain it failed because of there are no nvidia cards */
+		return 0;
+	}
 
-    if(!open_config())
-	return 0;
+	if(!open_config())
+		return 0;
 		
-    return 1;	
+	return 1;
 }
 
 static int probe_devices()
 {
-    int dev, irq, reg_addr, i=0;
+	unsigned short vendor_id=0xffff, device_id=0xffff;
+	int index=0;
+	int i=0;
+	unsigned long bus, dev, function;
+	PCI_CONFIG_HEADER pCfg;
+	BADDR baddrAddress[6];
 
-    struct winio_pci_common_header buf = {0, };
-    while(pwinio_get_pci_header(winio, &buf))
-    {
-        /* Check if the card contains an Nvidia chipset */	
-        if(buf.VendorID == 0x10de)
+	while(pGetPCIDeviceInfo(&vendor_id, &device_id, index, &bus, &dev, &function, &pCfg) == 1)
 	{
-	    /*
-	    When we enter this block of code we know that the device contains some 
-	    chip designed by Nvidia. In the past Nvidia only produced videochips but
-	    now they also make various other devices. Because of this we need to find
-	    out if the device is a videocard or not. There are two ways to do this. We can
-	    create a list of all Nvidia videochips or we can check the pci header of the device.
-	    We will read the pci header from /proc/bus/pci/(bus)/(function).(device). When
-	    the card is in our card database we report the name of the card and else we say
-	    it is an unknown card.
-	    */
-	    if(buf.BaseClass != 0x3)
-	        continue;
+		/* Check whether the vendor is nvidia and the BaseClass == VGA */
+		if(vendor_id == 0x10de && pCfg.BaseClass == 0x3)
+		{
+			printf("Found VendorID: 0x%x DeviceID: 0x%x\r\n", vendor_id, device_id);
+			
+			nvclock.card[i].device_id = device_id;
+			nvclock.card[i].arch = get_gpu_arch(nvclock.card[i].device_id);
+			nvclock.card[i].number = i;
+			nvclock.card[i].card_name = (char*)get_card_name(nvclock.card[i].device_id, &nvclock.card[i].gpu);
+			nvclock.card[i].reg_address = pCfg.BaseAddresses[0];
+//			nvclock.card[i].devbusfn = devbusfn;
+			nvclock.card[i].irq = pCfg.InterruptLine;
+			nvclock.card[i].state = 0;
+			i++;
+		}
 
-	    nvclock.card[i].device_id = buf.DeviceID;
-	    nvclock.card[i].arch = get_gpu_arch(nvclock.card[i].device_id);
-	    nvclock.card[i].number = i;
-	    nvclock.card[i].card_name = (char*)get_card_name(nvclock.card[i].device_id, &nvclock.card[i].gpu);
-	    nvclock.card[i].reg_address = buf.BaseAddresses[0];
-//	    nvclock.card[i].devbusfn = devbusfn;
-	    nvclock.card[i].irq = buf.InterruptLine;
-	    nvclock.card[i].state = 0;
-
-	    i++;
-    	}
-    }
-
-    if(i==0)
-    	set_error(NV_ERR_NO_DEVICES_FOUND);
-
-    nvclock.num_cards = i;
-    return 1;
+		index++;
+		vendor_id = 0xffff;
+		device_id = 0xffff;
+	}
+	nvclock.num_cards = i;
+	return 1;		
 }
 
 int32_t pciReadLong(unsigned short devbusfn, long offset)
 {
-    return -1;
+	return -1;
 }
 
 int map_mem(const char *dev_name)
 {
-    /* Map the registers of the nVidia chip */
-    nv_card->PEXTDEV = pMapIO(winio, nv_card->reg_address + 0x101000, 0x1000);
-    nv_card->PFB     = pMapIO(winio, nv_card->reg_address + 0x100000, 0x1000);
-    /* normally pmc is till 0x2000 but extended it for nv40 */
-    nv_card->PMC     = pMapIO(winio, nv_card->reg_address + 0x000000, 0xffff);
-    nv_card->PCIO    = pMapIO(winio, nv_card->reg_address + 0x601000, 0x2000);
-    nv_card->PRAMDAC = pMapIO(winio, nv_card->reg_address + 0x680000, 0x2000);
-    nv_card->PROM    = pMapIO(winio, nv_card->reg_address + 0x300000, 0xffff);
+	void *hmem; // do nothing with this for now
+	/* Map the registers of the nVidia chip */
+	nv_card->PEXTDEV = pMapPhysToLinear(nv_card->reg_address + 0x101000, 0x1000, &hmem);
+	nv_card->PFB	 = pMapPhysToLinear(nv_card->reg_address + 0x100000, 0x1000, &hmem);
+	/* normally pmc is till 0x2000 but extended it for nv40 */
+	nv_card->PMC	 = pMapPhysToLinear(nv_card->reg_address + 0x000000, 0x2ffff, &hmem);
+	nv_card->PCIO	= pMapPhysToLinear(nv_card->reg_address + 0x601000, 0x2000, &hmem);
+	nv_card->PRAMDAC = pMapPhysToLinear(nv_card->reg_address + 0x680000, 0x2000, &hmem);
+	nv_card->PROM	= pMapPhysToLinear(nv_card->reg_address + 0x300000, 0xffff, &hmem);
 
-    nv_card->mem_mapped = 1;
+	/* On Geforce 8xxx cards it appears that the pci config header has been moved */
+	if(nv_card->arch & NV5X)
+		nv_card->PBUS = pMapPhysToLinear(nv_card->reg_address + 0x88000, 0x100, &hmem);
+	else
+		nv_card->PBUS = nv_card->PMC + 0x1800/4;
 
-    return 1;
+	nv_card->mem_mapped = 1;
+	return 1;
 }
 
 void unmap_mem()
 {
-    pUnMapIO(winio, (void*)nv_card->PEXTDEV);
-    pUnMapIO(winio, (void*)nv_card->PFB);
-    pUnMapIO(winio, (void*)nv_card->PMC);
-    pUnMapIO(winio, (void*)nv_card->PCIO);
-    pUnMapIO(winio, (void*)nv_card->PRAMDAC);
-    pUnMapIO(winio, (void*)nv_card->PROM);
-    nv_card->mem_mapped = 0;
+#if 0
+	pUnMapIO(winio, (void*)nv_card->PEXTDEV);
+	pUnMapIO(winio, (void*)nv_card->PFB);
+	pUnMapIO(winio, (void*)nv_card->PMC);
+	pUnMapIO(winio, (void*)nv_card->PCIO);
+	pUnMapIO(winio, (void*)nv_card->PRAMDAC);
+	pUnMapIO(winio, (void*)nv_card->PROM);
+	nv_card->mem_mapped = 0;
+#endif
 }

Modified: packages/nvclock/branches/upstream/current/src/backend/backend.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/backend.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/backend.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/backend.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  * 
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://nvclock.sourceforge.net
  *
@@ -24,11 +24,36 @@
 #include <string.h>
 
 #include "config.h"
-#include "nvclock.h"
 #ifdef HAVE_NVCONTROL
     #include "nvcontrol.h"
 #endif
 #include "backend.h"
+
+/* Read a byte from the pci bus */
+unsigned char nv_read_pbus8(int offset)
+{
+	int shift = (offset % 4)*8;
+	return (nv_card->PBUS[offset/4] >> shift) & 0xff;
+}
+
+/* Read an unsigned short from the pci bus */
+unsigned short nv_read_pbus16(int offset)
+{
+	int shift = (offset / 2)*16;
+	return (nv_card->PBUS[offset/4] >> shift) & 0xffff;
+}
+
+/* Read an unsigned int from the pci bus */
+unsigned int nv_read_pbus(int offset)
+{
+	return nv_card->PBUS[offset/4];
+}
+
+/* Read an unsigned int from the PMC registers */
+unsigned int nv_read_pmc(int offset)
+{
+	return nv_card->PMC[offset/4];
+}
 
 /* This function is actually a basic version of set_card.
 /  It mainly copies the entries of the card list and maps 
@@ -83,14 +108,13 @@
 #endif /* HAVE_NVCONTROL */
 	
 	info_init();
-	i2c_init();
 
-	if(nv_card->arch & (NV30 | NV35))
+	if(nv_card->arch & NV3X)
 		nv30_init();
-	else if(nv_card->arch & NV31)
-		nv31_init();
 	else if(nv_card->arch & NV4X)
 		nv40_init();
+	else if(nv_card->arch & NV5X)
+		nv50_init();
 	else
 		nv_init();
 

Modified: packages/nvclock/branches/upstream/current/src/backend/backend.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/backend.h?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/backend.h (original)
+++ packages/nvclock/branches/upstream/current/src/backend/backend.h Sat Jan  5 20:47:40 2008
@@ -20,7 +20,9 @@
  */
 
 #include "config.h"
+#include "i2c.h"
 #include "nvclock.h"
+#include "nvreg.h"
 #include <stdint.h>
 
 /* Thanks to Alexey Nicolaychuk (Unwinder), the author of Rivatuner, for providing
@@ -31,18 +33,6 @@
 #define NV30_PLL_N1(PLL) ( ( ( PLL ) >> 8 ) & 0xff )
 #define NV30_PLL_N2(PLL) ( ( ( ( PLL ) >> 19 ) & 0x07 ) | ( ( ( PLL ) >> 21 ) & 0x18 ) )
 #define NV30_PLL_P(PLL) ( ( ( PLL ) >> 16 ) & 0x07 )
-
-#define PCI_CAPABILITY_LIST 0x34
-#define PCI_CAP_LIST_ID 0x0
-#define PCI_CAP_LIST_NEXT 0x1
-#define PCI_CAP_ID_AGP 0x2 /* AGP */
-#define PCI_CAP_ID_EXP 0x10 /* PCI-Express */
-#define PCIE_LINKCAP 0xc
-#define PCIE_LINKCONTROL 0x10
-#define PCIE_LINKSTATUS 0x12
-# define PCIE_LINK_SPEED_MASK 0x3f0
-# define PCIE_LINK_SPEED_SHIFT 4
-
 
 #define PCI_GET_BUS(devbusfn) ((devbusfn >> 8) & 0xff)
 #define PCI_GET_DEVICE(devbusfn) ((devbusfn & 0xff) >> 3)
@@ -74,14 +64,24 @@
 
 /* PLL to clock conversion */
 float GetClock(int base_freq, unsigned int pll);
-float GetClock_nv30(int base_freq, unsigned int pll);
-float GetClock_nv31(int base_freq, unsigned int pll, unsigned int pll2);
+float GetClock_nv30(int base_freq, unsigned int pll, unsigned int pll2);
 float GetClock_nv40(int base_freq, unsigned int pll, unsigned int pll2);
+float GetClock_nv50(int base_freq, unsigned int pll, unsigned int pll2);
 
 void info_init(void);
-void i2c_init(void);
+void i2c_sensor_init(void);
 
 void nv_init(void);
 void nv30_init(void);
 void nv31_init(void);
 void nv40_init(void);
+void nv50_init(void);
+
+/* PCI bus reading */
+unsigned char nv_read_pbus8(int offset);
+unsigned short nv_read_pbus16(int offset);
+unsigned int nv_read_pbus(int offset);
+
+/* PMC reading */
+unsigned int nv_read_pmc(int offset);
+

Modified: packages/nvclock/branches/upstream/current/src/backend/bios.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/bios.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/bios.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/bios.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  *
- * Copyright(C) 2001-2006 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * Copyright(C) 2005 Hans-Frieder Vogt
  * NV40 bios parsing improvements (BIT parsing rewrite + performance table fixes)
@@ -48,6 +48,24 @@
 struct nvbios *read_bios(char *file);
 static struct nvbios *parse_bios(char *rom);
 
+typedef struct
+{
+	unsigned char version;
+	unsigned char start;
+	unsigned char entry_size;
+	unsigned char num_entries;
+} BitTableHeader;
+
+typedef struct
+{
+	unsigned char version;
+	unsigned char start;
+	unsigned char num_active_entries;
+	unsigned char offset;
+	unsigned char entry_size;
+	unsigned char num_entries;
+} BitPerformanceTableHeader;
+
 /* Read a string from a given offset */
 static char* nv_read(char *rom, unsigned short offset)
 {
@@ -76,24 +94,24 @@
 }
 
 
-/* Read the GeforceFX performance table */
-static void nv30_read_performance(struct nvbios *bios, char *rom, int offset)
-{
-	int j = 0;
-	unsigned char start = 0;
-	unsigned char size = 0;
+/* Parse the GeforceFX performance table */
+static void parse_nv30_performance_table(struct nvbios *bios, char *rom, int offset)
+{
+	short i, num_entries;
+	unsigned char start;
+	unsigned char size;
 	int tmp = 0;
 
 	/* read how far away the start is */
 	start = rom[offset];
+	num_entries = rom[offset+2];
 	size = rom[offset + 3];
 
-	tmp = offset + start + 1;
-
-	bios->perf_entries=3;
-	for(j=0; j < 3; j++)
-	{
-		bios->perf_lst[j].nvclk =  (READ_INT(rom, tmp))/100;
+	bios->perf_entries=0;
+	offset += start + 1;
+	for(i=0; i < num_entries; i++)
+	{
+		bios->perf_lst[i].nvclk =  (READ_INT(rom, offset))/100;
 
 		/* The list can contain multiple distinct memory clocks.
 		/  Later on the ramcfg register can tell which of the ones is the right one.
@@ -104,16 +122,17 @@
 		/  is twice as high. It doesn't seem to be the case for all bioses though. In some effective
 		/  and real speed entries existed but this might be patched dumps.
 		*/
-		bios->perf_lst[j].memclk =  (READ_INT(rom, tmp+4))/50;
+		bios->perf_lst[i].memclk =  (READ_INT(rom, offset+4))/50;
 
 		/* Move behind the timing stuff to the fanspeed and voltage */
-		bios->perf_lst[j].fanspeed = (float)(unsigned char)rom[tmp + 54];
-		bios->perf_lst[j].voltage = (float)(unsigned char)rom[tmp + 55]/100;
+		bios->perf_lst[i].fanspeed = (float)(unsigned char)rom[offset + 54];
+		bios->perf_lst[i].voltage = (float)(unsigned char)rom[offset + 55]/100;
 		/* In case the voltage is 0, assume the voltage is similar to the previous voltage */
-		if(bios->perf_lst[j].voltage==0 && j>0)
-			bios->perf_lst[j].voltage = bios->perf_lst[j-1].voltage;
-
-		tmp = offset + start + (j+1)*size + 1;
+		if(bios->perf_lst[i].voltage==0 && i>0)
+			bios->perf_lst[i].voltage = bios->perf_lst[i-1].voltage;
+
+		bios->perf_entries++;
+		offset += size;
 	}
 }
 
@@ -129,7 +148,7 @@
 {
 	char res[15];
 	int version = READ_INT(rom, offset);
-	char extra = rom[offset+4];
+	unsigned char extra = rom[offset+4];
 
 	sprintf(res, "%02X.%02x.%02x.%02x.%02x%c", (version>>24) & 0xff, (version>>16) & 0xff, (version>>8) & 0xff, version&0xff, extra, '\0');
 	return (char*)strdup(res);
@@ -141,25 +160,26 @@
 /  most entries also have a different size. The task of this function is to move to the
 /  next entry in the table.
 */
-static int nv40_init_script_table_get_next_entry(char *rom, int offset)
+static int bit_init_script_table_get_next_entry(char *rom, int offset)
 {
 	unsigned char id = rom[offset];
+	int i=0;
 
 	switch(id)
 	{
 		case '2': /* 0x32 */
 			offset += 43;
 			break;
-		case '3': /* 0x33 */
+		case '3': /* 0x33: INIT_REPEAT */
 			offset += 2;
 			break;
-		case '6': /* 0x36 */
+		case '6': /* 0x36: INIT_REPEAT_END */
 			offset += 1;
 			break;
 		case '7': /* 0x37 */
 			offset += 11;
 			break;
-		case '8': /* 0x38 */
+		case '8': /* 0x38: INIT_NOT */
 			offset += 1;
 			break;
 		case '9': /* 0x39 */
@@ -175,13 +195,25 @@
 #endif
 			offset += 9;
 			break;
+		case 'M': /* 0x4D: INIT_ZM_I2C_BYTE */
+#if DEBUG
+			printf("'%c'\ti2c bytes: %x\n", id, rom[offset+3]);
+#endif
+			offset += 4 + rom[offset+3]*2;
+			break;
 		case 'Q': /* 0x51 */
 			offset += 5 + rom[offset+4];
 			break;
 		case 'R': /* 0x52 */
 			offset += 4;
 			break;
-		case 'S': /* 0x53 */
+		case 'S': /* 0x53: INIT_ZM_CR */
+#if DEBUG
+			/* +1 CRTC index (8-bit)
+			/  +2 value (8-bit)
+			*/
+			printf("'%c'\tCRTC index: %x value: %x\n", id, rom[offset+1], rom[offset+2]);
+#endif
 			offset += 3;
 			break;
 		case 'T': /* 0x54 */
@@ -191,6 +223,20 @@
 			offset += 3;
 			break;
 		case 'X': /* 0x58 */
+#if DEBUG
+			{
+				/* +1 register base (32-bit)
+				/  +5 number of values (8-bit)
+				/  +6 value (32-bit) to regbase+4
+				/  .. */
+				int base = READ_INT(rom, offset+1);
+				int number = (unsigned char)rom[offset+5];
+
+				printf("'%c'\tbase: %08x number: %d\n", id, base, number);
+				for(i=0; i<number; i++)
+					printf("'%c'\t %08x: %08x\n", id, base+4*i, READ_INT(rom, offset+6 + 4*i));
+			}
+#endif
 			offset += 6 + rom[offset+5] * 4;
 			break;
 		case '[': /* 0x5b */
@@ -205,10 +251,23 @@
 		case 'c': /* 0x63 */
 			offset +=1;
 			break;
-		case 'e': /* 0x65 */
+		case 'e': /* 0x65: INIT_RESET */
+#if DEBUG
+			/* +1 register (32-bit)
+			/  +5 value (32-bit)
+			/  +9 value (32-bit)
+			*/
+			printf("'%c'\t%08x %08x %08x\n", id, READ_INT(rom, offset+1), READ_INT(rom, offset+5), READ_INT(rom, offset+9));
+#endif
 			offset += 13;
 			break;
-		case 'k': /* 0x6b */
+		case 'i': /* 0x69 */
+			offset += 5;
+			break;
+		case 'k': /* 0x6b: INIT_SUB */
+#if DEBUG
+			printf("'%c' executing SUB: %x\n", id, rom[offset+1]);
+#endif
 			offset += 2;
 			break;
 		case 'n': /* 0x6e */
@@ -224,16 +283,33 @@
 		case 'q': /* 0x71: quit */
 			offset += 1;
 			break;
-		case 'r': /* 0x72 */
+		case 'r': /* 0x72: INIT_RESUME */
 			offset += 1;
 			break;
 		case 't': /* 0x74 */
 			offset += 3;
 			break;
-		case 'u': /* 0x75 */
+		case 'u': /* 0x75: INIT_CONDITION */
+#if DEBUG
+			printf("'%c'\t condition: %d\n", id, rom[offset+1]);
+#endif
 			offset += 2;
 			break;
-		case 'x': /* 0x78 */
+		case 'v': /* 0x76: INIT_IO_CONDITION */
+#if DEBUG
+			printf("'%c'\t IO condition: %d\n", id, rom[offset+1]);
+#endif
+			offset += 2;
+			break;
+		case 'x': /* 0x78: INIT_INDEX_IO */
+#if DEBUG
+			/* +1 CRTC reg (16-bit)
+			/  +3 CRTC index (8-bit)
+			/  +4 AND-mask (8-bit)
+			/  +5 OR-with (8-bit)
+			*/
+			printf("'%c'\tCRTC reg: %x CRTC index: %x AND-mask: %x OR-with: %x\n", id, READ_SHORT(rom, offset+1), rom[offset+3], rom[offset+4], rom[offset+5]);
+#endif
 			offset += 6;
 			break;
 		case 'y': /* 0x79 */
@@ -243,15 +319,33 @@
 #endif
 			offset += 7;
 			break;
-		case 'z': /* 0x7a */
+		case 'z': /* 0x7a: INIT_ZM_REG */
 #if DEBUG
 			/* +1 = register, +5 = value */
 			printf("'%c'\t%08x %08x\n", id, READ_INT(rom, offset+1), READ_INT(rom, offset+5));
 #endif
 			offset += 9;
 			break;
-		case 0x8f: /* 0x8f */
-			/* +5 = size of entry in bytes, +6 = num entries */
+		case 0x8e: /* 0x8e */
+			/* +1 what is this doing? */
+			offset += 1;
+			break;
+		case 0x8f: /* 0x8f: INIT_ZM_REG */
+#if DEBUG
+			{
+				/* +1 register 
+				/  +5 = length of sequence (?)
+				/  +6 = num entries
+				*/
+				int size = rom[offset+5];
+				int number = rom[offset+6];
+				printf("'%c'\treg: %08x size: %d number: %d", id, READ_INT(rom, offset+1), size, number);
+				/* why times 2? */
+				for(i=0; i<number*size*2; i++)
+					printf(" %08x", READ_INT(rom, offset + 7 + i));
+				printf("\n");
+			}
+#endif
 			offset += READ_BYTE(rom, offset+6) * 32 + 7;
 			break;
 		case 0x90: /* 0x90 */
@@ -264,13 +358,16 @@
 #endif
 			offset += 18;
 			break;
+		default:
+			printf("Unhandled init script entry with id '%c' at %04x\n", id, offset);
+			return 0;
 	}
 
 	return offset;
 }
 
 
-static void nv40_read_init_script_table(struct nvbios *bios, char *rom, int init_offset, int len)
+static void parse_bit_init_script_table(struct nvbios *bios, char *rom, int init_offset, int len)
 {
 	int i,offset;
 	int done=0;
@@ -279,17 +376,32 @@
 	/* Table 1 */
 	offset = READ_SHORT(rom, init_offset);
 
-	/* For pipeline modding purposes we cache 0x1540 */
+	/* For pipeline modding purposes we cache 0x1540 and for PLL generation the PLLs */
 	id = rom[offset];
-	while(id != 'q' && !done)
-	{
-		offset = nv40_init_script_table_get_next_entry(rom, offset);
+	while(id != 'q')
+	{
+		offset = bit_init_script_table_get_next_entry(rom, offset);
+		/* Break out of the loop if we find an unknown entry id */
+		if(!offset)
+			break;
 		id = rom[offset];
 
-		if(id == 'z' && READ_INT(rom, offset+1) == 0x1540)
+		if(id == 'z')
 		{
-			bios->pipe_cfg = READ_INT(rom, offset+5);
-			done=1;
+			int reg = READ_INT(rom, offset+1);
+			unsigned int val = READ_INT(rom, offset+5);
+			switch(reg)
+			{
+				case 0x1540:
+					bios->pipe_cfg = val;
+					break;
+				case 0x4000:
+					bios->nvpll = val;
+					break;
+				case 0x4020:
+					bios->mpll = val;
+					break;
+			}
 		}
 	}
 
@@ -312,9 +424,13 @@
 
 		while(id != 'q')
 		{
+			/* Break out of the loop if we find an unknown entry id */
+			if(!offset)
+				break;
+
 			if(!(id == 'K' || id == 'n' || id == 'x' || id == 'y' || id == 'z'))
 				printf("'%c' (%x)\n", id, id);
-			offset = nv40_init_script_table_get_next_entry(rom, offset);
+			offset = bit_init_script_table_get_next_entry(rom, offset);
 			id = rom[offset];
 		}
 
@@ -328,45 +444,65 @@
 }
 
 
-/* Read the Geforce6 performance table */
-static void nv40_read_performance(struct nvbios *bios, char *rom, int offset)
-{
-	short i, num_entries;
-	unsigned char size;
-	unsigned char start;
-
-	/* find start offset of entries, at the moment it seems to be always 0x0b */
-	start = rom[offset+1];
-
-	/* It seems that at +2 information is stored about the number of active
-	/  entries in the performance table. The only thing I don't know yet is
-	/  where to find which entry should be chosen. For all geforce6800(LE/GT/NU/Ultra)
-	/  bioses I tried, the first entry seemed correct but for a 6200 bios it wasn't.
-	/  (Note that 6200 bioses also work a little differently) Currently this assumption
-	/  is 'correct' until I have more information.
-	*/
-	if(rom[offset+2])
-		num_entries = rom[offset+2];
-	else
-		num_entries = 1;
+/* Parse the Geforce6/7/8 performance table */
+static void parse_bit_performance_table(struct nvbios *bios, char *rom, int offset)
+{
+	short i, entry;
+	unsigned char entry_size;
+	short nvclk_offset, memclk_offset, shader_offset, fanspeed_offset, voltage_offset;
+	BitPerformanceTableHeader *header = (BitPerformanceTableHeader*)&rom[offset];
+
+	/* The first byte contains a version number; based on this we set offsets to interesting entries */
+	switch(header->version)
+	{
+		case 0x25: /* First seen on Geforce 8800GTS bioses */
+			fanspeed_offset = 4;
+			voltage_offset = 5;
+			nvclk_offset = 8;
+			shader_offset = 10;
+			memclk_offset = 12;
+			break;
+		case 0x30: /* First seen on Geforce 8600GT bioses */
+			fanspeed_offset = 6;
+			voltage_offset = 7;
+			nvclk_offset = 8;
+			shader_offset = 10;
+			memclk_offset = 12;
+			break;
+		case 0x35: /* First seen on Geforce 8800GT bioses; what else is different? */
+			fanspeed_offset = 6;
+			voltage_offset = 7;
+			nvclk_offset = 8;
+			shader_offset = 10;
+			memclk_offset = 12;
+			break;
+		default: /* Default to this for all other bioses, I haven't seen issues yet for the entries we use */
+			shader_offset = 0;
+			fanspeed_offset = 4;
+			voltage_offset = 5;
+			nvclk_offset = 6;
+			memclk_offset = 11;
+	}
 
 	/* +5 contains the number of entries, +4 the size of one in bytes and +3 is some 'offset' */
-	size = rom[offset+3] + rom[offset+4] * rom[offset+5];
+	entry_size = header->offset + header->entry_size * header->num_entries;
 
 	/* now read entries
 	/  entries start with 0x20 for entry 0, 0x21 for entry 1, ...
 	*/
-	offset += start;
-	for(i=0; i<num_entries;)
-	{
-		if ((rom[offset] & 0xf0) != 0x20)
+	offset += header->start;
+
+	for(entry=0, i=0; entry<header->num_active_entries; entry++)
+	{
+		/* On bios version 0x35, this 0x20, 0x21 .. pattern doesn't exist anymore; do the last 4 bits of the first byte tell if an entry is active on 0x35? */
+		if ( (header->version != 0x35) && (rom[offset] & 0xf0) != 0x20)
 		{
 			break;
 		}
 
-		bios->perf_lst[i].fanspeed = (unsigned char)rom[offset+4];
-
-		bios->perf_lst[i].voltage = (float)(unsigned char)rom[offset+5]/100;
+		bios->perf_lst[i].fanspeed = (unsigned char)rom[offset+fanspeed_offset];
+
+		bios->perf_lst[i].voltage = (float)(unsigned char)rom[offset+voltage_offset]/100;
 		/* In case the voltage is 0, assume the voltage is similar to the previous voltage */
 		if(bios->perf_lst[i].voltage==0 && i>0)
 			bios->perf_lst[i].voltage = bios->perf_lst[i-1].voltage;
@@ -374,23 +510,106 @@
 		/* HACK: My collection of bioses contains a (valid) 6600 bios with two 'bogus' entries at 0x21 (100MHz) and 0x22 (200MHz)
 		/  these entries aren't the default ones for sure, so skip them until we have a better entry selection algorithm.
 		*/
-		if(READ_SHORT(rom, offset+6) > 200)
+		if(READ_SHORT(rom, offset+nvclk_offset) > 200)
 		{
-			bios->perf_lst[i].nvclk = READ_SHORT(rom, offset+6);
+			bios->perf_lst[i].nvclk = READ_SHORT(rom, offset+nvclk_offset);
 
 			/* Support delta clock reading on some NV4X boards. The entries seem to be present on most Geforce7 boards but are as far as I know only used on 7800/7900 boards.
 			/ On other boards the delta clocks are set to 0. Offset +8 contains the actual delta clock and offset +7 contains a divider for it. If the divider is 0 we don't read the delta clock. */
 			if((get_gpu_arch(bios->device_id) & (NV47 | NV49)) && rom[offset+7])
+			{
 				bios->perf_lst[i].delta = rom[offset+8]/rom[offset+7];
-		
-			bios->perf_lst[i].memclk = READ_SHORT(rom, offset+11)*2;
+				bios->perf_lst[i].memclk = READ_SHORT(rom, offset+memclk_offset);
+			}
+			/* Geforce8 cards have a shader clock, further the memory clock is at a different offset as well */
+			else if(get_gpu_arch(bios->device_id) & NV5X)
+			{
+				bios->perf_lst[i].shaderclk= READ_SHORT(rom, offset+shader_offset);
+				bios->perf_lst[i].memclk = READ_SHORT(rom, offset+memclk_offset);
+			}
+			else
+				bios->perf_lst[i].memclk = READ_SHORT(rom, offset+memclk_offset)*2;
+
 			bios->perf_entries = i+1;
 			i++;
 		}
-		offset += size;
-	}
-}
-
+		offset += entry_size;
+	}
+}
+
+/* Parse the table containing pll programming limits */
+static void parse_bit_pll_table(struct nvbios *bios, char *rom, unsigned short offset)
+{
+	BitTableHeader *header = (BitTableHeader*)&rom[offset];
+	int i;
+
+	offset += header->start;
+	for(i=0; i<header->num_entries; i++)
+	{
+		/* Each type of pll (corresponding to a certain register) has its own limits */
+		bios->pll_lst[i].reg = READ_INT(rom, offset);
+
+		/* Minimum/maximum frequency each VCO can generate */
+		bios->pll_lst[i].VCO1.minFreq = READ_SHORT(rom, offset+4)*1000;
+		bios->pll_lst[i].VCO1.maxFreq = READ_SHORT(rom, offset+6)*1000;
+		bios->pll_lst[i].VCO2.minFreq = READ_SHORT(rom, offset+8)*1000;
+		bios->pll_lst[i].VCO2.maxFreq = READ_SHORT(rom, offset+0xa)*1000;
+
+		/* Minimum/maximum input frequency for each VCO */
+		bios->pll_lst[i].VCO1.minInputFreq = READ_SHORT(rom, offset+0xc)*1000;
+		bios->pll_lst[i].VCO1.maxInputFreq = READ_SHORT(rom, offset+0xe)*1000;
+		bios->pll_lst[i].VCO2.minInputFreq = READ_SHORT(rom, offset+0x10)*1000;
+		bios->pll_lst[i].VCO2.maxInputFreq = READ_SHORT(rom, offset+0x12)*1000;
+
+		/* Low and high values for the dividers and multipliers */
+		bios->pll_lst[i].VCO1.minN = READ_BYTE(rom, offset+0x14);
+		bios->pll_lst[i].VCO1.maxN = READ_BYTE(rom, offset+0x15);
+		bios->pll_lst[i].VCO1.minM = READ_BYTE(rom, offset+0x16);
+		bios->pll_lst[i].VCO1.maxM = READ_BYTE(rom, offset+0x17);
+		bios->pll_lst[i].VCO2.minN = READ_BYTE(rom, offset+0x18);
+		bios->pll_lst[i].VCO2.maxN = READ_BYTE(rom, offset+0x19);
+		bios->pll_lst[i].VCO2.minM = READ_BYTE(rom, offset+0x1a);
+		bios->pll_lst[i].VCO2.maxM = READ_BYTE(rom, offset+0x1b);
+
+		bios->pll_lst[i].var1d = READ_BYTE(rom, offset+0x1d);
+		bios->pll_lst[i].var1e = READ_BYTE(rom, offset+0x1e);
+
+#if DEBUG
+		printf("register: %#08x\n", READ_INT(rom, offset));
+
+		/* Minimum/maximum frequency each VCO can generate */
+		printf("minVCO_1: %d\n", READ_SHORT(rom, offset+4));
+		printf("maxVCO_1: %d\n", READ_SHORT(rom, offset+6));
+		printf("minVCO_2: %d\n", READ_SHORT(rom, offset+8));
+		printf("maxVCO_2: %d\n", READ_SHORT(rom, offset+0xa));
+
+		/* Minimum/maximum input frequency for each VCO */
+		printf("minVCO_1_in: %d\n", READ_SHORT(rom, offset+0xc));
+		printf("minVCO_2_in: %d\n", READ_SHORT(rom, offset+0xe));
+		printf("maxVCO_1_in: %d\n", READ_SHORT(rom, offset+0x10));
+		printf("maxVCO_2_in: %d\n", READ_SHORT(rom, offset+0x12));
+
+		/* Low and high values for the dividers and multipliers */
+		printf("N1_low: %d\n", READ_BYTE(rom, offset+0x14));
+		printf("N1_high: %d\n", READ_BYTE(rom, offset+0x15));
+		printf("M1_low: %d\n", READ_BYTE(rom, offset+0x16));
+		printf("M1_high: %d\n", READ_BYTE(rom, offset+0x17));
+		printf("N2_low: %d\n", READ_BYTE(rom, offset+0x18));
+		printf("N2_high: %d\n", READ_BYTE(rom, offset+0x19));
+		printf("M2_low: %d\n", READ_BYTE(rom, offset+0x1a));
+		printf("M2_high: %d\n", READ_BYTE(rom, offset+0x1b));
+
+		/* What's the purpose of these? */
+		printf("1c: %d\n", READ_BYTE(rom, offset+0x1c));
+		printf("1d: %d\n", READ_BYTE(rom, offset+0x1d));
+		printf("1e: %d\n", READ_BYTE(rom, offset+0x1e));
+		printf("\n");
+#endif
+
+		bios->pll_entries = i+1;
+		offset += header->entry_size;
+	}
+}
 
 /* The internal gpu sensor most likely consists of a diode and a resistor.
 /  The voltage across this resistor is meassured using a ADC. Since the
@@ -405,12 +624,10 @@
 /  The code below is very similar to the code from the Rivatuner gpu diode by Alexey Nicolaychuk with a few adjustments.
 /  Rivatuner's code didn't contain constants for the latest Geforce7 (NV46/NV49/NV4B) cards so I had to add those myself.
 */
-static void nv40_read_temperature(struct nvbios *bios, char *rom, int offset)
+static void parse_bit_temperature_table(struct nvbios *bios, char *rom, int offset)
 {
 	short i;
-	unsigned char num_entries = rom[offset+3];
-	unsigned char size = rom[offset+2];
-	unsigned char start = rom[offset+1];
+	BitTableHeader *header = (BitTableHeader*)&rom[offset];
 
 	switch(get_gpu_arch(bios->device_id))
 	{
@@ -446,11 +663,12 @@
 			bios->sensor_cfg.slope_div = 10000;
 			break;
 	}
-	
-	for(i=0; i<num_entries; i++)
-	{
-		unsigned char id = rom[offset+start+size*i];
-		short value = READ_SHORT(rom, offset+start+size*i +1);
+
+	offset += header->start;
+	for(i=0; i<header->num_entries; i++)
+	{
+		unsigned char id = rom[offset];
+		short value = READ_SHORT(rom, offset+1);
 		
 		switch(id)
 		{
@@ -490,29 +708,49 @@
 				printf("0x%x: %x\n", id, value);
 #endif
 		}
-	}
-#if DEBUG
+		offset += header->entry_size;
+	}
+#if DEBUG
+	printf("temperature table version: %#x\n", header->version);
 	printf("correction: %d\n", bios->sensor_cfg.temp_correction);
 	printf("offset: %.3f\n", (float)bios->sensor_cfg.diode_offset_mult / (float)bios->sensor_cfg.diode_offset_div);
 	printf("slope: %.3f\n", (float)bios->sensor_cfg.slope_mult / (float)bios->sensor_cfg.slope_div);
 #endif
 }
 
-
-/* Read the voltage table for nv30/nv40 cards */
-static void read_voltage(struct nvbios *bios, char *rom, int offset)
+/* Read the voltage table for nv30/nv40/nv50 cards */
+static void parse_voltage_table(struct nvbios *bios, char *rom, int offset)
 {
 	unsigned char entry_size=0;
+	unsigned char start=0;
 	int i;
 
-	entry_size = rom[offset+1];
-	bios->volt_entries = rom[offset+2];
-	bios->volt_mask = rom[offset+4];
-
+	/* In case of the first voltage table revision, there was no start pointer? */
+	switch(rom[offset])
+	{
+		case 0x10:
+		case 0x12:
+ 			start = 5;
+			entry_size = rom[offset+1];
+			bios->volt_entries = rom[offset+2];
+			bios->volt_mask = rom[offset+4];
+			break;
+		default:
+			start = rom[offset+1];
+			bios->volt_entries = rom[offset+2];
+			entry_size = rom[offset+3];
+
+			/* The VID mask is stored right before the start of the first entry? */
+			bios->volt_mask = rom[offset+start -1];
+	}
+
+	offset += start;
 	for(i=0; i<bios->volt_entries; i++)
 	{
-		bios->volt_lst[i].voltage = (float)(unsigned char)rom[offset + 5 + entry_size * i] / 100;
-		bios->volt_lst[i].VID = rom[offset + 6 + entry_size * i];
+		/* The voltage is stored in multiples of 10mV, scale it to V */
+		bios->volt_lst[i].voltage = (float)(unsigned char)rom[offset] / 100;
+		bios->volt_lst[i].VID = rom[offset + 1];
+		offset += entry_size;
 	}
 }
 
@@ -537,17 +775,18 @@
 	init_offset = READ_SHORT(rom, nv_offset + 0x4d);
 
 	volt_offset = READ_SHORT(rom, nv_offset + 0x98);
-	read_voltage(bios, rom, volt_offset);
+	parse_voltage_table(bios, rom, volt_offset);
 
 	perf_offset = READ_SHORT(rom, nv_offset + 0x94);
-	nv30_read_performance(bios, rom, perf_offset);
-}
-
-
-static void nv40_parse(struct nvbios *bios, char *rom, unsigned int bit_offset)
+	parse_nv30_performance_table(bios, rom, perf_offset);
+}
+
+
+static void parse_bit_structure(struct nvbios *bios, char *rom, unsigned int bit_offset)
 {
 	unsigned short init_offset=0;
 	unsigned short perf_offset=0;
+	unsigned short pll_offset=0;
 	unsigned short signon_offset=0;
 	unsigned short temp_offset=0;
 	unsigned short volt_offset=0;
@@ -583,22 +822,25 @@
 			case 'B': /* BIOS related data */
 				bios->version = nv40_bios_version_to_str(rom, entry->offset);
 				break;
+			case 'C': /* Configuration table; it contains at least PLL parameters */
+				pll_offset = READ_SHORT(rom, entry->offset + 8);
+				parse_bit_pll_table(bios, rom, pll_offset);
+				break;
 			case 'I': /* Init table */
 				init_offset = READ_SHORT(rom, entry->offset);
-				nv40_read_init_script_table(bios, rom, init_offset, entry->len);
+				parse_bit_init_script_table(bios, rom, init_offset, entry->len);
 				break;
 			case 'P': /* Performance related data */
 				perf_offset = READ_SHORT(rom, entry->offset);
-				nv40_read_performance(bios, rom, perf_offset);
+				parse_bit_performance_table(bios, rom, perf_offset);
 
 				temp_offset = READ_SHORT(rom, entry->offset + 0xc);
-				nv40_read_temperature(bios, rom, temp_offset);
+				parse_bit_temperature_table(bios, rom, temp_offset);
 
 				/* 0x10 behind perf_offset the voltage table offset is stored */
 				volt_offset = READ_SHORT(rom, entry->offset + 0x10);
-				read_voltage(bios, rom, volt_offset);
-				break;
-
+				parse_voltage_table(bios, rom, volt_offset);
+				break;
 			case 'S':
 				/* table with string references of signon-message,
 				BIOS version, BIOS copyright, OEM string, VESA vendor,
@@ -620,7 +862,7 @@
 	int i;
 	char* data;
 
-/* We shouldn't assume this is allways 64kB */
+	/* We shouldn't assume this is allways 64kB */
 	for(i=offset; i<0xffff; i++)
 	{
 		data = (char*)&rom[i];
@@ -652,6 +894,8 @@
 
 	/* try to dump the bios */
 	fp = fopen(filename, "w+");
+        if(!fp) return;
+
 	for(i=0; i < 0xffff; i++)
 	{
 		unsigned char data;
@@ -691,12 +935,11 @@
 	struct nvbios *res;
 
 	if((fd = open(file, O_RDONLY)) == -1)
-	{
-		/* we need to redump the bios */
-		return 0;
-	}
+		return NULL; /* We might need to redump the bios */
 
 	rom = mmap(0, 0xffff, PROT_READ, MAP_SHARED, fd, 0);
+	if(!rom)
+		return NULL; /* We might need to redump the bios */
 
 	/* Do the actual bios parsing */
 	res = parse_bios(rom);
@@ -730,7 +973,7 @@
 		return NULL;
 
 	device_id = READ_SHORT(rom, pcir_offset + 6);
-	if(get_gpu_arch(device_id) & NV4X)
+	if(get_gpu_arch(device_id) & (NV4X | NV5X))
 	{
 	/* For NV40 card the BIT structure is used instead of the BMP structure (last one doesn't exist anymore on 6600/6800le cards). */
 		if(!(bit_offset = locate(rom, "BIT", 0)))
@@ -738,7 +981,7 @@
 
 		bios = calloc(1, sizeof(struct nvbios));
 		bios->device_id = device_id;
-		nv40_parse(bios, rom, bit_offset);
+		parse_bit_structure(bios, rom, bit_offset);
 	}
 	/* We are dealing with a card that only contains the BMP structure */
 	else
@@ -800,8 +1043,10 @@
 				if(bios->perf_lst[i].delta)
 				/* For now assume the first memory entry is the right one; should be fixed as some bioses contain various different entries */
 					printf("Performance level %d: gpu %d(+%d)MHz/memory %dMHz/ %.2fV / %d%%\n", i, bios->perf_lst[i].nvclk, bios->perf_lst[i].delta, bios->perf_lst[i].memclk, bios->perf_lst[i].voltage, bios->perf_lst[i].fanspeed);
-					else
-				printf("Performance level %d: gpu %dMHz/memory %dMHz/ %.2fV / %d%%\n", i, bios->perf_lst[i].nvclk, bios->perf_lst[i].memclk, bios->perf_lst[i].voltage, bios->perf_lst[i].fanspeed);
+				else if(bios->perf_lst[i].shaderclk)
+					printf("Performance level %d: gpu %d/shader %dMHz/memory %dMHz/ %.2fV / %d%%\n", i, bios->perf_lst[i].nvclk, bios->perf_lst[i].shaderclk, bios->perf_lst[i].memclk, bios->perf_lst[i].voltage, bios->perf_lst[i].fanspeed);
+				else
+					printf("Performance level %d: gpu %dMHz/memory %dMHz/ %.2fV / %d%%\n", i, bios->perf_lst[i].nvclk, bios->perf_lst[i].memclk, bios->perf_lst[i].voltage, bios->perf_lst[i].fanspeed);
 			}
 			else
 				printf("Performance level %d: %dMHz / %dMHz / %d%%\n", i, bios->perf_lst[i].nvclk, bios->perf_lst[i].memclk, bios->perf_lst[i].fanspeed);

Modified: packages/nvclock/branches/upstream/current/src/backend/config.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/config.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/config.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/config.c Sat Jan  5 20:47:40 2008
@@ -2,7 +2,7 @@
  *
  * site: http://nvclock.sourceforge.net
  *
- * Copyright(C) 2001-2004 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * 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
@@ -266,7 +266,7 @@
 {
 	char *file = NULL;
 	char *home = NULL;
-	struct stat tmp;
+	struct stat stat_buf;
 
 	if(!(home = getenv("HOME")))
 	{
@@ -279,14 +279,24 @@
 	sprintf(file, "%s/config", nvclock.path);
 
 	/* Check if our ~/.nvclock directory exists if not create it */
-	if(stat(nvclock.path, &tmp))
+	if(stat(nvclock.path, &stat_buf))
 	{
 		if(mkdir(nvclock.path, 0755))
 		{
-			/* needs to be handled by the new error code .. */
-			/* perror("Can't create home directory .nvclock"); */
+			char buf[80];
+			sprintf(buf, "Can't create '%s'. Do you have sufficient permissions?\n", nvclock.path);
+			set_error_str(buf);
 			return 0;
 		}
+	}
+
+	/* Check if .nvclock really is a directory. For some users it was a file and this led to a segfault. */
+	if(!S_ISDIR(stat_buf.st_mode))
+	{
+		char buf[80];
+		sprintf(buf, "Can't open '%s'. Is it really a directory?\n", nvclock.path);
+		set_error_str(buf);
+		return 0;
 	}
 
 	/* If there's no config or if the config is corrupt create a new one */
@@ -342,8 +352,8 @@
 		if((freq > 250) && (freq < 1100))
 			return 1;
 	}
-	/* Geforce6*/
-	else if(arch & (NV4X))
+	/* Geforce6/7/8*/
+	else if(arch & (NV4X | NV5X))
 	{
 		if((freq > 250) && (freq < 1200))
 			return 1;
@@ -363,21 +373,21 @@
 		if(validate_clock(arch, freq))
 			return 1;
 	}
-	else if(arch & (NV30 | NV35))
-	{
-		freq = (int)GetClock_nv30(base_freq, pll);
+	else if(arch & (NV3X))
+	{
+		freq = (int)GetClock_nv30(base_freq, pll, pll2);
 		if(validate_clock(arch, freq))
 			return 1;
 	}
-	else if(arch & (NV31))
-	{
-		freq = (int)GetClock_nv31(base_freq, pll, pll2);
+	else if(arch & (NV4X))
+	{
+		freq = (int)GetClock_nv40(base_freq, pll, pll2);
 		if(validate_clock(arch, freq))
 			return 1;
 	}
-	else if(arch & (NV4X))
-	{
-		freq = (int)GetClock_nv40(base_freq, pll, pll2);
+	else if(arch & (NV5X))
+	{
+		freq = (int)GetClock_nv50(base_freq, pll, pll2);
 		if(validate_clock(arch, freq))
 			return 1;
 	}
@@ -471,8 +481,8 @@
 			else
 				return 0;
 
-			/* NV31 and NV40 cards have extra pll registers */
-			if(nv_card->arch & (NV31 | NV4X))
+			/* NV31, NV4X and NV5X cards have extra pll registers; in case of NV30 the second pll is ignored but that happens in GetClock_nv30 */
+			if(nv_card->arch & (NV3X | NV4X | NV5X))
 			{
 				if((entry = (cfg_entry*)lookup_entry(&nvclock.cfg, section, "mpll2")))
 					nvclock.card[i].mpll2 = entry->value;
@@ -537,23 +547,23 @@
 #endif
 
 		base_freq = (nv_card->PEXTDEV[0x0000/4] & 0x40) ? 14318 : 13500;
-		if(nv_card->arch & (NV17 | NV25 | NV3X | NV4X))
+		if(nv_card->arch & (NV17 | NV25 | NV3X | NV4X | NV5X))
 		{
 			if (nv_card->PEXTDEV[0x0000/4] & (1<<22))
 				base_freq = 27000;
 		}
 		add_entry(&nvclock.cfg, section, "basefreq", base_freq);
 
-		/* TNT(1/2), Geforce(1/2/3/4) and GeforceFX 5200/5500/5800/5900 */
-		if(nv_card->arch & (NV5 | NV1X | NV2X | NV30 | NV35))
+		/* TNT(1/2) and Geforce(1/2/3/4) */
+		if(nv_card->arch & (NV5 | NV1X | NV2X))
 		{
 			add_entry(&nvclock.cfg, section, "mpll", nv_card->PRAMDAC[0x504/4]);
 			add_entry(&nvclock.cfg, section, "nvpll", nv_card->PRAMDAC[0x500/4]);
 			nvclock.card[i].nvpll = nv_card->PRAMDAC[0x500/4];
 			nvclock.card[i].mpll = nv_card->PRAMDAC[0x504/4];
 		}
-		/* GeforceFX 5600/5700 */
-		else if(nv_card->arch & NV31)
+		/* GeforceFX 5200/5500/5600/5700/5800/5900, note that FX5600/5700 require two PLLs */
+		else if(nv_card->arch & NV3X)
 		{
 			add_entry(&nvclock.cfg, section, "mpll", nv_card->PRAMDAC[0x504/4]);
 			add_entry(&nvclock.cfg, section, "mpll2", nv_card->PRAMDAC[0x574/4]);
@@ -576,6 +586,18 @@
 			nvclock.card[i].nvpll = nv_card->PMC[0x4000/4];
 			nvclock.card[i].nvpll2 = nv_card->PMC[0x4004/4];
 		}
+		/* Geforce8 */
+		else if(nv_card->arch & NV5X)
+		{
+			add_entry(&nvclock.cfg, section, "mpll", nv_card->PMC[0x4008/4]);
+			add_entry(&nvclock.cfg, section, "mpll2", nv_card->PMC[0x400c/4]);
+			add_entry(&nvclock.cfg, section, "nvpll", nv_card->PMC[0x4028/4]);
+			add_entry(&nvclock.cfg, section, "nvpll2", nv_card->PMC[0x402c/4]);
+			nvclock.card[i].mpll = nv_card->PMC[0x4008/4];
+			nvclock.card[i].mpll2 = nv_card->PMC[0x400c/4];
+			nvclock.card[i].nvpll = nv_card->PMC[0x4028/4];
+			nvclock.card[i].nvpll2 = nv_card->PMC[0x402c/4];
+		}
 
 		unset_card();
 	}

Modified: packages/nvclock/branches/upstream/current/src/backend/i2c.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/i2c.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/i2c.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/i2c.c Sat Jan  5 20:47:40 2008
@@ -40,7 +40,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
  *
- * $Id: i2c.c,v 1.11 2006/07/31 14:44:32 thunderbird Exp $
+ * $Id: i2c.c,v 1.14 2007/04/24 08:10:47 thunderbird Exp $
  *
  * Contents:
  *
@@ -92,7 +92,7 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include "xf86i2c.h"
-#include "nvclock.h"
+#include "backend.h"
 
 /*
  * DDC1 support only requires DDC_SDA_MASK,
@@ -103,8 +103,6 @@
 #define DDC_SDA_WRITE_MASK (1 << 4)
 #define DDC_SCL_WRITE_MASK (1 << 5)
 
-Bool I2CAddress(I2CDevPtr d, I2CSlaveAddr addr);
-
 static void NVLockUnlock(int lock)
 {
 	unsigned char cr11;
@@ -123,7 +121,7 @@
 static void NV_I2CGetBits(I2CBusPtr b, int *clock, int *data)
 {
 	unsigned char val;
-	int DDCBase = (int)b->DriverPrivate.ptr;
+	int DDCBase = (int)b->DriverPrivate.val;
 
 	/* Get the result. */
 	nv_card->PCIO[0x3d4] = DDCBase;
@@ -137,7 +135,7 @@
 static void NV_I2CPutBits(I2CBusPtr b, int clock, int data)
 {
 	unsigned char val;
-	int DDCBase = (int)b->DriverPrivate.ptr;
+	int DDCBase = (int)b->DriverPrivate.val;
 
 	nv_card->PCIO[0x3d4] = DDCBase + 1;
 	val = nv_card->PCIO[0x3d5] & 0xf0;
@@ -156,7 +154,7 @@
 }
 
 
-static I2CBusPtr NV_I2CCreateBusPtr(char *name, int bus)
+I2CBusPtr NV_I2CCreateBusPtr(char *name, int bus)
 {
 	I2CBusPtr I2CPtr;
 
@@ -169,7 +167,7 @@
 	I2CPtr->I2CPutBits = NV_I2CPutBits;
 	I2CPtr->I2CGetBits = NV_I2CGetBits;
 	I2CPtr->AcknTimeout = 5;
-	I2CPtr->DriverPrivate.ptr = (int*)bus; /* abuse a pointer for now */
+	I2CPtr->DriverPrivate.val = bus;
 
 	if (!xf86I2CBusInit(I2CPtr))
 	{
@@ -235,10 +233,16 @@
 	}
 	I2CProbeAllDevices(busses, num_busses);
 
+	if(nv_card->debug)
+		printf("Probing I2C busses\n");
+
 	for(bus = 0; bus < num_busses; bus++)
 	{
 		for(dev = busses[bus]->FirstDev; dev; dev = dev->NextDev)
 		{
+			if(nv_card->debug)
+				printf("bus: %x device: %x\n", bus, dev->SlaveAddr);
+
 			dev->arch = nv_card->arch;
 			switch(dev->SlaveAddr)
 			{
@@ -280,37 +284,9 @@
 	return NULL;
 }
 
-void i2c_init(void)
-{
-	/* For hardware monitoring support we need access to the i2c bus. Each card
-	/  has 2 or 3 of these busses. Currently we will create these busses here in set_card
-	/  and store them in the card list. It should also be possible to create just 3 busses and store
-	/  those in the nv_card struct and have each card use them and limit the number of used busses by
-	/  a variable but the issue is that this is not very nice and perhaps even incorrect. For example
-	/  different cards might need different i2c bus timings and further we mess up the xfree86 i2c structures
-	/  if we mix dev/bus structures from different cards.
-	/
-	/  Once the busses have been created they will be probed for sensor chips. If a sensor is found
-	/  a i2c device pointer will be stored. Using this pointer we can access the chip using standard
-	/  xf86 i2c functions.
-	*/
-	if(nv_card->busses[0] == NULL)
-	{
-		nv_card->num_busses = 2;
-		nv_card->busses[0] = NV_I2CCreateBusPtr("BUS0", 0x3e); /* available on riva128 and higher */
-		nv_card->busses[1] = NV_I2CCreateBusPtr("BUS1", 0x36); /* available on rivatnt hardware and higher */
-
-		/* There's an extra bus available on geforce4mx/ti, geforcefx and geforce6 cards.
-		/  The check below looks for geforce4mx/geforcefx/geforce6 architecture.
-		*/
-		if(nv_card->arch & (NV17 | NV25 | NV3X | NV4X))
-		{
-			nv_card->num_busses = 3;
-			nv_card->busses[2] = NV_I2CCreateBusPtr("BUS2", 0x50); 
-		}
-
-		nv_card->sensor = I2cProbeDevices(nv_card->busses, nv_card->num_busses);
-	}
+void i2c_sensor_init(void)
+{
+	nv_card->sensor = I2cProbeDevices(nv_card->busses, nv_card->num_busses);
 	
 	/* When a sensor is available, enable the correct function pointers */
 	if(nv_card->sensor)
@@ -365,3 +341,4 @@
 		nv_card->sensor = NULL;
 	}
 }
+

Modified: packages/nvclock/branches/upstream/current/src/backend/i2c.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/i2c.h?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/i2c.h (original)
+++ packages/nvclock/branches/upstream/current/src/backend/i2c.h Sat Jan  5 20:47:40 2008
@@ -18,6 +18,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
  */
+
+#ifndef I2C_H
+#define I2C_H
+
 #include "xf86i2c.h"
 
 #define LM99 0x1
@@ -26,6 +30,9 @@
 #define W83L785R 0x8
 #define W83781D 0x16
 #define ADT7473 0x32
+
+Bool I2CAddress(I2CDevPtr d, I2CSlaveAddr addr);
+I2CBusPtr NV_I2CCreateBusPtr(char *name, int bus);
 
 /* ADT7473 */
 int adt7473_detect(I2CDevPtr dev);
@@ -66,3 +73,4 @@
 int w83l785r_get_fanspeed_rpm(I2CDevPtr dev);
 float w83l785r_get_fanspeed_pwm(I2CDevPtr dev);
 int w83l785r_set_fanspeed_pwm(I2CDevPtr dev, float speed);
+#endif /* I2C_H */

Modified: packages/nvclock/branches/upstream/current/src/backend/info.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/info.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/info.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/info.c Sat Jan  5 20:47:40 2008
@@ -2,7 +2,7 @@
  *
  * site: http://nvclock.sourceforge.net
  *
- * Copyright(C) 2001-2006 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * 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
@@ -150,7 +150,8 @@
 	{ 0x40, "nVidia Geforce 6800 Ultra", DESKTOP },
 	{ 0x41, "nVidia Geforce 6800", DESKTOP },
 	{ 0x42, "nVidia Geforce 6800LE", DESKTOP },
-	{ 0x43, "NV40", DESKTOP },
+	{ 0x43, "nVidia Geforce 6800XE", DESKTOP },
+	{ 0x44, "nVidia Geforce 6800XT", DESKTOP },
 	{ 0x45, "nVidia Geforce 6800GT", DESKTOP },
 	{ 0x46, "nVidia Geforce 6800GT", DESKTOP },
 	{ 0x47, "nVidia Geforce 6800GS", DESKTOP },
@@ -171,6 +172,7 @@
 	{ 0xf1, "nVidia Geforce 6600/GT", DESKTOP },
 	{ 0xf2, "nVidia Geforce 6600", DESKTOP },
 	{ 0xf3, "nVidia Geforce 6200", DESKTOP },
+	{ 0xf4, "nVidia Geforce 6600LE", DESKTOP },
 	{ 0xf5, "nVidia Geforce 7800GS", DESKTOP },
 	{ 0xf6, "nVidia Geforce 6800GS/XT", DESKTOP },
 	{ 0xf8, "nVidia QuadroFX 3400", DESKTOP },
@@ -193,8 +195,8 @@
 	{ 0x149, "nVidia Geforce Go 6600GT", MOBILE },
 	{ 0x14a, "NV43", DESKTOP },
 	{ 0x14b, "NV43", DESKTOP },
-	{ 0x14c, "NV43", DESKTOP },
-	{ 0x14d, "NV43GL", DESKTOP },
+	{ 0x14c, "nVidia QuadroFX 550", DESKTOP },
+	{ 0x14d, "nVidia QuadroFX 550", DESKTOP },
 	{ 0x14e, "nVidia QuadroFX 540", DESKTOP },
 	{ 0x14f, "nVidia Geforce 6200", DESKTOP },
 	{ 0x160, "nVidia NV44", DESKTOP },
@@ -206,7 +208,8 @@
 	{ 0x166, "nVidia Geforce Go 6400", MOBILE },
 	{ 0x167, "nVidia Geforce Go 6200", MOBILE },
 	{ 0x168, "nVidia Geforce Go 6400", MOBILE },
-	{ 0x169, "NV44M", DESKTOP },
+	{ 0x169, "nVidia Geforce 6250", DESKTOP },
+	{ 0x16a, "nVidia Geforce 7100GS", DESKTOP },
 	{ 0x16b, "NV44GLM", DESKTOP },
 	{ 0x16c, "NV44GLM", DESKTOP },
 	{ 0x16d, "NV44GLM", DESKTOP },
@@ -218,11 +221,12 @@
 	{ 0x218, "nVidia Geforce 6800XT", DESKTOP },
 	{ 0x220, "Unknown NV44", DESKTOP },
 	{ 0x221, "nVidia Geforce 6200", DESKTOP },
-	{ 0x222, "Unknown NV44", DESKTOP },
+	{ 0x222, "nVidia Geforce 6200 A-LE", DESKTOP },
 	{ 0x228, "NV44M", MOBILE },
 	{ 0x240, "nVidia Geforce 6150", NFORCE },
-	{ 0x241, "nVidia Geforce 6150 LE", NFORCE },
+	{ 0x241, "nVidia Geforce 6150LE", NFORCE },
 	{ 0x242, "nVidia Geforce 6100", NFORCE },
+	{ 0x245, "nVidia Quadro NVS 210S / Geforce 6150LE", NFORCE },
 	{ 0x2dd, "nVidia Unknown NV4x", DESKTOP },
 	{ 0x2de, "nVidia Unknown NV4x", DESKTOP },
 	{ 0x90, "nVidia G70", DESKTOP },
@@ -237,15 +241,127 @@
 	{ 0x9e, "nVidia G70GL", DESKTOP },
 	{ 0x290, "nVidia Geforce 7900GTX", DESKTOP },
 	{ 0x291, "nVidia Geforce 7900GT", DESKTOP },
+	{ 0x292, "nVidia Geforce 7900GS", DESKTOP },
+	{ 0x295, "nVidia Geforce 7950GT", DESKTOP },
+	{ 0x298, "nVidia Geforce Go 7900GS", MOBILE },
+	{ 0x299, "nVidia Geforce Go 7900GTX", MOBILE },
+	{ 0x29a, "nVidia QuadroFX 2500M", MOBILE },
+	{ 0x29b, "nVidia QuadroFX 1500M", MOBILE },
+	{ 0x29c, "nVidia QuadroFX 5500", DESKTOP },
+	{ 0x29d, "nVidia QuadroFX 3500", DESKTOP },
+	{ 0x29e, "nVidia QuadroFX 1500", DESKTOP },
+	{ 0x29f, "nVidia QuadroFX 4500 X2", DESKTOP },
+	{ 0x390, "nVidia Geforce 7650GS", DESKTOP },
 	{ 0x391, "nVidia Geforce 7600GT", DESKTOP },
 	{ 0x392, "nVidia Geforce 7600GS", DESKTOP },
+	{ 0x393, "nVidia Geforce 7300GT", DESKTOP },
+	{ 0x394, "nVidia Geforce 7600LE", DESKTOP },
+	{ 0x395, "nVidia Geforce 7300GT", DESKTOP },
+	{ 0x397, "nVidia Geforce Go 7700", MOBILE },
 	{ 0x398, "nVidia Geforce Go 7600", MOBILE },
+	{ 0x399, "nVidia Geforce Go 7600GT", MOBILE },
+	{ 0x39a, "nVidia Quadro NVS 300M", MOBILE },
+	{ 0x39b, "nVidia Geforce Go 7900SE", MOBILE },
+	{ 0x39c, "nVidia QuadroFX 550M", MOBILE },
+	{ 0x39e, "nVidia QuadroFX 560", DESKTOP },
+	{ 0x2e0, "nVidia Geforce 7600GT", DESKTOP },
+	{ 0x2e1, "nVidia Geforce 7600GS", DESKTOP },
+	{ 0x2e2, "nVidia Geforce 7300GT", DESKTOP },
+	{ 0x2e4, "nVidia Geforce 7950GT", DESKTOP },
 	{ 0x1d1, "nVidia Geforce 7300LE", DESKTOP },
+	{ 0x1d3, "nVidia Geforce 7300SE", DESKTOP },
 	{ 0x1d7, "nVidia Geforce Go 7300", MOBILE },
 	{ 0x1d8, "nVidia Geforce Go 7400", MOBILE },
+	{ 0x1d9, "nVidia Geforce Go 7400GS", MOBILE },
 	{ 0x1da, "nVidia Quadro NVS 110M", MOBILE },
+	{ 0x1db, "nVidia Quadro NVS 120M", MOBILE },
+	{ 0x1dc, "nVidia QuadroFX 350M", MOBILE },
+	{ 0x1dd, "nVidia Geforce 7500LE", MOBILE },
 	{ 0x1de, "nVidia QuadroFX 350", DESKTOP },
 	{ 0x1df, "nVidia Geforce 7300GS", DESKTOP },
+	{ 0x190, "nVidia Geforce 8800", DESKTOP },
+	{ 0x191, "nVidia Geforce 8800GTX", DESKTOP },
+	{ 0x192, "nVidia Geforce 8800", DESKTOP },
+	{ 0x193, "nVidia Geforce 8800GTS", DESKTOP },
+	{ 0x194, "nVidia Geforce 8800Ultra", DESKTOP },
+	{ 0x197, "nVidia Geforce 8800", DESKTOP },
+	{ 0x19a, "nVidia G80-875", DESKTOP },
+	{ 0x19d, "nVidia QuadroFX 5600", DESKTOP },
+	{ 0x19e, "nVidia QuadroFX 4600", DESKTOP },
+	{ 0x400, "nVidia Geforce 8600GTS", DESKTOP },
+	{ 0x401, "nVidia Geforce 8600GT", DESKTOP },
+	{ 0x402, "nVidia Geforce 8600GT", DESKTOP },
+	{ 0x403, "nVidia Geforce 8600GS", DESKTOP },
+	{ 0x404, "nVidia Geforce 8400GS", DESKTOP },
+	{ 0x405, "nVidia Geforce 9500M GS", MOBILE },
+	{ 0x406, "nVidia Geforce NB9P-GE", MOBILE },
+	{ 0x407, "nVidia Geforce 8600M GT", MOBILE },
+	{ 0x408, "nVidia Geforce 8600M GTS", MOBILE },
+	{ 0x409, "nVidia Geforce 8700M GT", MOBILE },
+	{ 0x40a, "nVidia Quadro NVS 370M", MOBILE },
+	{ 0x40b, "nVidia Quadro NVS 320M", MOBILE },
+	{ 0x40c, "nVidia QuadroFX 570M", MOBILE },
+	{ 0x40d, "nVidia QuadroFX 1600M", MOBILE },
+	{ 0x40e, "nVidia QuadroFX 570", DESKTOP },
+	{ 0x40f, "nVidia QuadroFX 1700", DESKTOP },
+	{ 0x420, "nVidia Geforce 8400SE", DESKTOP },
+	{ 0x421, "nVidia Geforce 8500GT", DESKTOP },
+	{ 0x422, "nVidia Geforce 8400GS", DESKTOP },
+	{ 0x423, "nVidia Geforce 8300GS", DESKTOP },
+	{ 0x424, "nVidia Geforce 8400GS", DESKTOP },
+	{ 0x425, "nVidia Geforce 8600M GS", MOBILE },
+	{ 0x426, "nVidia Geforce 8400M GT", MOBILE },
+	{ 0x427, "nVidia Geforce 8400M GS", MOBILE },
+	{ 0x428, "nVidia Geforce 8400M G", MOBILE },
+	{ 0x429, "nVidia Quadro NVS 140M", MOBILE },
+	{ 0x42a, "nVidia Quadro NVS 130M", MOBILE },
+	{ 0x42b, "nVidia Quadro NVS 135M", MOBILE },
+	{ 0x42d, "nVidia Quadro FX 360M", MOBILE },
+	{ 0x42e, "nVidia Geforce 9300M G", MOBILE },
+	{ 0x42f, "nVidia Quadro NVS 290", DESKTOP },
+	{ 0x3d0, "nVidia Geforce 6100 nForce 430", NFORCE},
+	{ 0x3d1, "nVidia Geforce 6100 nForce 405", NFORCE},
+	{ 0x3d2, "nVidia Geforce 6100 nForce 400", NFORCE},
+	{ 0x3d5, "nVidia Geforce 6100 nForce 420", NFORCE},
+	{ 0x53a, "nVidia Geforce 7050PV nForce 630a", NFORCE},
+	{ 0x53b, "nVidia Geforce 7050PV nForce 630a", NFORCE},
+	{ 0x53e, "nVidia Geforce 7025 nForce 630a", NFORCE},
+	{ 0x600, "nVidia Geforce 8800GTS 512", DESKTOP },
+	{ 0x609, "nVidia Geforce 8800M GTS", MOBILE },
+	{ 0x611, "nVidia Geforce 8800GT", DESKTOP },
+	{ 0x61a, "nVidia QuadroFX 3700", DESKTOP },
+	{ 0x6e0, "nVidia G98", DESKTOP },
+	{ 0x6e1, "nVidia G98", DESKTOP },
+	{ 0x6e2, "nVidia Geforce 8400", DESKTOP },
+	{ 0x6e3, "nVidia G98", DESKTOP },
+	{ 0x6e4, "nVidia Geforce 8400GS", DESKTOP },
+	{ 0x6e5, "nVidia G98", DESKTOP },
+	{ 0x6e6, "nVidia G98", DESKTOP },
+	{ 0x6e7, "nVidia G98", DESKTOP },
+	{ 0x6e8, "nVidia G98", DESKTOP },
+	{ 0x6e9, "nVidia G98", DESKTOP },
+	{ 0x6ea, "nVidia G98", DESKTOP },
+	{ 0x6eb, "nVidia G98", DESKTOP },
+	{ 0x6ec, "nVidia G98", DESKTOP },
+	{ 0x6ed, "nVidia G98", DESKTOP },
+	{ 0x6ee, "nVidia G98", DESKTOP },
+	{ 0x6ef, "nVidia G98", DESKTOP },
+	{ 0x6f0, "nVidia G98", DESKTOP },
+	{ 0x6f1, "nVidia G98", DESKTOP },
+	{ 0x6f2, "nVidia G98", DESKTOP },
+	{ 0x6f3, "nVidia G98", DESKTOP },
+	{ 0x6f4, "nVidia G98", DESKTOP },
+	{ 0x6f5, "nVidia G98", DESKTOP },
+	{ 0x6f6, "nVidia G98", DESKTOP },
+	{ 0x6f7, "nVidia G98", DESKTOP },
+	{ 0x6f8, "nVidia G98", DESKTOP },
+	{ 0x6f9, "nVidia G98", DESKTOP },
+	{ 0x6fa, "nVidia G98", DESKTOP },
+	{ 0x6fb, "nVidia G98", DESKTOP },
+	{ 0x6fc, "nVidia G98", DESKTOP },
+	{ 0x6fd, "nVidia G98", DESKTOP },
+	{ 0x6fe, "nVidia G98", DESKTOP },
+	{ 0x6ff, "nVidia G98", DESKTOP },
 	{ 0, NULL, UNKNOWN }
 };
 
@@ -317,7 +433,6 @@
 		case 0x130:
 		case 0x210:
 		case 0x230:
-		case 0x240:
 			arch = NV40;
 			break;
 		case 0xc0:
@@ -342,6 +457,27 @@
 		case 0x390:
 			arch = NV4B; /* 7600 */
 			break;
+		case 0x190:
+			arch = NV50; /* 8800 'NV50 / G80' */
+			break;
+		case 0x400: /* 8600 'G84' */
+			arch = G84;
+			break;
+		case 0x420: /* 8500 'G86' */
+			arch = G86;
+			break;
+		case 0x600: /* G92 */
+		case 0x610: /* G92 */
+		case 0x6e0: /* G98 */
+		case 0x6f0: /* G98 */
+			arch = G86;
+			break;
+		case 0x240:
+		case 0x3d0: /* not sure if this is a C51 too */
+		case 0x530: /* not sure if the 70xx is C51 too */
+			arch = C51;
+			break;
+		case 0x2e0:
 		case 0xf0:
 			/* The code above doesn't work for pci-express cards as multiple architectures share one id-range */
 			switch(device_id)
@@ -356,6 +492,7 @@
 				case 0xf1: /* 6600/6600GT */
 				case 0xf2: /* 6600GT */
 				case 0xf3: /* 6200 */
+				case 0xf4: /* 6600LE */
 					arch = NV43;
 					break;
 				case 0xf5: /* 7800GS */
@@ -376,6 +513,14 @@
 				case 0xfe: /* Quadro 1300, has the same id as a FX3000 */
 					arch = NV35;
 					break;
+				case 0x2e0: /* Geforce 7600GT AGP (at least Leadtek uses this id) */
+				case 0x2e1: /* Geforce 7600GS AGP (at least BFG uses this id) */
+				case 0x2e2: /* Geforce 7300GT AGP (at least a Galaxy 7300GT uses this id) */
+					arch = NV4B;
+					break;
+				case 0x2e4: /* Geforce 7950 GT AGP */
+					arch = NV49;
+					break;
 			}
 			break;
 		default:
@@ -387,18 +532,19 @@
 /* Receive the real gpu architecture */
 static short get_gpu_architecture()
 {
-	return (nv_card->PMC[0/4] >> 20) & 0xff;
+	return (nv_read_pmc(NV_PMC_BOOT_0) >> 20) & 0xff;
 }
 
 /* Receive the gpu revision */
 static short get_gpu_revision()
 {
-	return nv_card->PMC[0/4] & 0xff;
-}
-
+	return nv_read_pmc(NV_PMC_BOOT_0) & NV_PMC_BOOT_0_REVISION_MASK;
+}
+
+/* Retrieve the 'real' PCI id from the card */
 static short get_gpu_pci_id()
 {
-	return (nv_card->PMC[0x1800/4]>>16) & 0xffff;
+	return nv_read_pbus16(PCI_DEVICE_ID);
 }
 
 static int set_gpu_pci_id(short id)
@@ -411,7 +557,7 @@
 		if(id > 3)
 			return 0;
 
-		nv_card->PEXTDEV[0x0/4] = pextdev_boot0 | (id & 0x3 << 12);
+		nv_card->PEXTDEV[0x0/4] = pextdev_boot0 | ((id & 0x3) << 12);
 		nv_card->device_id = get_gpu_pci_id();
 		nv_card->card_name = (char*)get_card_name(nv_card->device_id, &nv_card->gpu);
 		return 1;
@@ -425,9 +571,9 @@
 		if(id > 16)
 			return 0;
 		
-		/* On various NV4x cards the quadro capability bit in PBUS_DEBUG1 is locked. It can be unlocked by clearing a bit in 0xc020 */
-		if(nv_card->PMC[0xc020/4])
-			nv_card->PMC[0xc020/4] = 0;
+		/* On various NV4x cards the quadro capability bit in PBUS_DEBUG1 is locked. It can be unlocked by setting the first bit in 0xc020/0xc028 */
+		nv_card->PMC[0xc020/4] = 1;
+		nv_card->PMC[0xc028/4] = 1;
 
 		nv_card->PEXTDEV[0x0/4] = pextdev_boot0 | (((id>>2) & 0x3) << 20) | ((id & 0x3) << 12);
 		nv_card->device_id = get_gpu_pci_id();
@@ -449,14 +595,6 @@
 	*data = pciReadLong(nv_card->devbusfn,offset) & 0xff;
 }
 
-/* Function to read a single byte from some memory mapped register */
-static void nv_read_byte(volatile unsigned int *reg, int offset, unsigned char *data)
-{
-	int shift = (offset % 4)*8;
-	*data = (reg[offset/4] >> shift) & 0xff;
-}
-
-
 /* Check the videocard for a certain PCI capability like AGP/PCI-Express/PowerManagement.
 /  If a certain capability is supported return the position of the cap pointer. 
 */
@@ -487,18 +625,18 @@
 {
 	unsigned char pos, id;
 
-	nv_read_byte(nv_card->PMC, 0x1800 + PCI_CAPABILITY_LIST, &pos);
+	pos = nv_read_pbus8(PCI_CAPABILITY_LIST);
 
 	while(pos >= 0x40)
 	{
 		pos &= ~3;
-		nv_read_byte(nv_card->PMC, pos + 0x1800 + PCI_CAP_LIST_ID, &id);
+		id = nv_read_pbus8(pos + PCI_CAP_LIST_ID);
 		if(id == 0xff)
 			break;
 		if(id == cap)
 			return pos; /* Return the position of the cap pointer */
 
-		nv_read_byte(nv_card->PMC, pos + 0x1800 + PCI_CAP_LIST_NEXT, &pos);
+		pos = nv_read_pbus8(pos + PCI_CAP_LIST_NEXT);
 	}
 	return 0;
 }
@@ -538,6 +676,9 @@
 		case 0xf3: /* 6200 */
 		case 0xf5: /* 6800GS/XT */
 		case 0xf6: /* 7800GS */
+		case 0x2e0: /* 7600GT */
+		case 0x2e1: /* 7600GS */
+		case 0x2e2: /* 7300GT */
 			return "AGP (BR02)"; /* We return something different from AGP for now as we don't want to show the AGP tab */
 		case 0xf8: /* Quadro FX3400 */
 		case 0xf9: /* Geforce 6800 series */
@@ -561,59 +702,66 @@
 /* Needs better bus checks .. return a string ?*/
 static short get_agp_bus_rate()
 {
-	int agp_rate, agp_status;
-
-	/* If the card is an AGP card */
-	if(((nv_card->PEXTDEV[0x0/4]  >> 14) & 0x1) == 0x1)
-	{
-		agp_status = nv_card->PMC[0x1848/4];
-		agp_rate = nv_card->PMC[0x184c/4] & 0x7;
-
-		/* If true, the user has AGP8x support */
-		if(agp_status & 0x8)
-		{
-			agp_rate <<= 2;
-		}
-		return agp_rate;
-	}
-	return 0;
+	int agp_capptr, agp_rate, agp_status;
+
+	agp_capptr = nv_pci_find_capability(PCI_CAP_ID_AGP);
+	agp_status = nv_read_pbus(agp_capptr + PCI_AGP_STATUS);
+	agp_rate = nv_read_pbus(agp_capptr + PCI_AGP_COMMAND) & PCI_AGP_STATUS_RATE_MASK;
+
+	/* If true, the user has AGP8x support */
+	if(agp_status & PCI_AGP_STATUS_RATE_8X_SUPPORT)
+	{
+		agp_rate <<= PCI_AGP_STATUS_RATE_8X_SHIFT;
+	}
+	return agp_rate;
 }
 
 static char* get_agp_fw_status()
 {
-/* Check if Fast Writes is supported by the hostbridge */
-	if(((nv_card->PMC[0x1848/4] >> 4) & 0x1) == 1)
-		return ((nv_card->PMC[0x184c/4] >> 4) & 0x1) ? "Enabled" : "Disabled";
+	int agp_capptr = nv_pci_find_capability(PCI_CAP_ID_AGP);
+	unsigned int agp_status = nv_read_pbus(agp_capptr + PCI_AGP_STATUS);
+	unsigned int agp_command = nv_read_pbus(agp_capptr + PCI_AGP_COMMAND);
+
+	/* Check if Fast Writes is supported by the hostbridge */
+	if(agp_status & PCI_AGP_STATUS_FW)
+		return (agp_command & PCI_AGP_COMMAND_FW) ? "Enabled" : "Disabled";
 	else
 		return "Unsupported";
 }
 
 static char* get_agp_sba_status()
 {
-	/* Check if Fast Writes is supported by the hostbridge */
-	if(((nv_card->PMC[0x1848/4] >> 9) & 0x1) == 1)
-		return ((nv_card->PMC[0x184c/4] >> 9) & 0x1) ? "Enabled" : "Disabled";
+	int agp_capptr = nv_pci_find_capability(PCI_CAP_ID_AGP);
+	unsigned int agp_status = nv_read_pbus(agp_capptr + PCI_AGP_STATUS);
+	unsigned int agp_command = nv_read_pbus(agp_capptr + PCI_AGP_COMMAND);
+
+	/* Check if Sideband Addressing is supported by the hostbridge */
+	if(agp_status & PCI_AGP_STATUS_SBA)
+		return (agp_command & PCI_AGP_COMMAND_SBA) ? "Enabled" : "Disabled";
 	else
 		return "Unsupported";
 }
 
 static char* get_agp_status()
 {
-	return ((nv_card->PMC[0x184c/4] >> 8) & 0x1) ? "Enabled" : "Disabled";
+	int agp_capptr = nv_pci_find_capability(PCI_CAP_ID_AGP);
+	unsigned int agp_command = nv_read_pbus(agp_capptr + PCI_AGP_COMMAND);
+	return (agp_command & PCI_AGP_COMMAND_AGP) ? "Enabled" : "Disabled";
 }
 
 static char* get_agp_supported_rates()
 {
-	int agp_rates, agp_status, i;
+	int agp_capptr, agp_rates, agp_status, i;
 	static char *rate;
 
-	agp_status = nv_card->PMC[0x1848/4];
-	agp_rates = nv_card->PMC[0x1848/4] & 0x7;
+	agp_capptr = nv_pci_find_capability(PCI_CAP_ID_AGP);
+	agp_status = nv_read_pbus(agp_capptr + PCI_AGP_STATUS);
+	agp_rates = agp_status & PCI_AGP_STATUS_RATE_MASK;
 
 	/* If true, the user has AGP8x support */
-	if(agp_status & 0x8)
-	{
-		agp_rates <<= 2;
+	if(agp_status & PCI_AGP_STATUS_RATE_8X_SUPPORT)
+	{
+		agp_rates <<= PCI_AGP_STATUS_RATE_8X_SHIFT;
 	}
 
 	rate = (char*)calloc(1, sizeof(char));
@@ -640,10 +788,7 @@
 	pcie_status_reg = nv_pci_find_capability(PCI_CAP_ID_EXP);
 	if(pcie_status_reg != 0 )
 	{
-		/* The current pcie rate is stored in PCIE_LINKSTATUS (+18) but this would lead to a non-aligned read,
-		/  so read from PCIE_LINKCONTROL (+16) and then shift 2 bytes to get to PCIE_LINKSTATUS.
-		*/
-		pcie_rate = ((nv_card->PMC[(0x1800 + pcie_status_reg + PCIE_LINKCONTROL)/4] >> 16) & PCIE_LINK_SPEED_MASK) >> PCIE_LINK_SPEED_SHIFT;
+		pcie_rate = (nv_read_pbus16(pcie_status_reg + PCIE_LINKSTATUS) & PCIE_LINK_SPEED_MASK) >> PCIE_LINK_SPEED_SHIFT;
 		return pcie_rate;
 	}
 	return 0;
@@ -656,7 +801,7 @@
 	pcie_status_reg = nv_pci_find_capability(PCI_CAP_ID_EXP);
 	if(pcie_status_reg != 0 )
 	{
-		pcie_rate = (nv_card->PMC[(0x1800 + pcie_status_reg + PCIE_LINKCAP)/4] & PCIE_LINK_SPEED_MASK) >> PCIE_LINK_SPEED_SHIFT;
+		pcie_rate = (nv_read_pbus16(pcie_status_reg + PCIE_LINKCAP) & PCIE_LINK_SPEED_MASK) >> PCIE_LINK_SPEED_SHIFT;
 
 		return pcie_rate;
 	}
@@ -710,6 +855,24 @@
 				return 128;
 		}
 	}
+	else if(nv_card->arch & NV5X)
+	{
+		/* On Geforce 8800GTS/GTX and 8600GT/GTS cards the memory bandwith is proportional to the number of ROPs * 16.
+		*  In case of the 8500 this isn't the case, there the size is just 128 where there are 4 ROPs.
+		*  So for now use the number of ROPs as a meassure for the bus width.
+		*/
+		char rmask, rmask_default;
+		switch(nv_card->get_rop_units(&rmask, &rmask_default))
+		{
+			case 24: /* 8800GTX */
+				return 384;
+			case 20: /* 8800GTS */
+				return 320;
+			case 8: /* 8600GT/GTS */
+			case 4: /* 8500GT */
+				return 128;
+		}
+	}
 	/* Generic algorithm for cards up to the Geforce4 */
 	return (nv_card->PEXTDEV[0x0/4] & 0x17) ? 128 : 64;
 }
@@ -733,6 +896,14 @@
 		* In case of DDR3 the first byte contains 0x4 while in case of DDR it contains 0x1.
 		*/
 		return (nv_card->PFB[0x474/4] & 0x4) ? "DDR3" : "DDR";
+	}
+	else if(nv_card->arch & (NV5X))
+	{
+		/* For now use 0x100218 (PFB 0x218) to distinguish between DDR2 and DDR3. The contents of this
+		*  register differs between a 8500GT (DDR2) and 8600GTS/8800GTS (DDR3) according to the bios.
+		*  FIXME: use a better register
+		*/
+		return (nv_card->PFB[0x218/4] & 0x1000000) ? "DDR3" : "DDR2";
 	}
 	else
 		/* TNT, Geforce1/2/4MX */
@@ -797,12 +968,139 @@
 	return memory_size;
 }
 
+/* Print various GPU registers for debugging purposes */
+static void get_debug_info()
+{
+	printf("--- %s GPU registers ---\n", nv_card->card_name);
+	printf("NV_PMC_BOOT_0 (0x0): %08x\n", nv_card->PMC[0]);
+	printf("NV_PBUS_DEBUG_0 (0x1080): %08x\n", nv_card->PMC[0x1080/4]);
+	printf("NV_PBUS_DEBUG_1 (0x1084): %08x\n", nv_card->PMC[0x1084/4]);
+	printf("NV_PBUS_DEBUG_2 (0x1088): %08x\n", nv_card->PMC[0x1088/4]);
+	printf("NV_PBUS_DEBUG_3 (0x108c): %08x\n", nv_card->PMC[0x108c/4]);
+	printf("NV_10F0 (0x10f0): %08x\n", nv_card->PMC[0x10f0/4]);
+	printf("NV_1540 (0x1540): %08x\n", nv_card->PMC[0x1540/4]);
+	printf("NV_15B0 (0x15b0): %08x\n", nv_card->PMC[0x15b0/4]);
+	printf("NV_15B4 (0x15b4): %08x\n", nv_card->PMC[0x15b4/4]);
+	printf("NV_15B8 (0x15b8): %08x\n", nv_card->PMC[0x15b8/4]);
+	printf("NV_15F0 (0x15f0): %08x\n", nv_card->PMC[0x15f0/4]);
+	printf("NV_15F4 (0x15f4): %08x\n", nv_card->PMC[0x15f4/4]);
+	printf("NV_15F8 (0x15f8): %08x\n", nv_card->PMC[0x15f8/4]);
+	printf("NV_PBUS_PCI_0 (0x1800): %08x\n", nv_read_pbus(PCI_VENDOR_ID));
+
+	if(nv_card->arch & (NV4X | NV5X))
+	{
+		printf("NV_C010 (0xc010): %08x\n", nv_card->PMC[0xc010/4]);
+		printf("NV_C014 (0xc014): %08x\n", nv_card->PMC[0xc014/4]);
+		printf("NV_C018 (0xc018): %08x\n", nv_card->PMC[0xc018/4]);
+		printf("NV_C01C (0xc01c): %08x\n", nv_card->PMC[0xc01c/4]);
+		printf("NV_C020 (0xc020): %08x\n", nv_card->PMC[0xc020/4]);
+		printf("NV_C024 (0xc024): %08x\n", nv_card->PMC[0xc024/4]);
+		printf("NV_C028 (0xc028): %08x\n", nv_card->PMC[0xc028/4]);
+		printf("NV_C02C (0xc02c): %08x\n", nv_card->PMC[0xc02c/4]);
+		printf("NV_C040 (0xc040): %08x\n", nv_card->PMC[0xc040/4]);
+		printf("NV_4000 (0x4000): %08x\n", nv_card->PMC[0x4000/4]);
+		printf("NV_4004 (0x4004): %08x\n", nv_card->PMC[0x4004/4]);
+		printf("NV_4008 (0x4008): %08x\n", nv_card->PMC[0x4008/4]);
+		printf("NV_400C (0x400c): %08x\n", nv_card->PMC[0x400c/4]);
+		printf("NV_4010 (0x4010): %08x\n", nv_card->PMC[0x4010/4]);
+		printf("NV_4014 (0x4014): %08x\n", nv_card->PMC[0x4014/4]);
+		printf("NV_4018 (0x4018): %08x\n", nv_card->PMC[0x4018/4]);
+		printf("NV_401C (0x401c): %08x\n", nv_card->PMC[0x401c/4]);
+		printf("NV_4020 (0x4020): %08x\n", nv_card->PMC[0x4020/4]);
+		printf("NV_4024 (0x4024): %08x\n", nv_card->PMC[0x4024/4]);
+		printf("NV_4028 (0x4028): %08x\n", nv_card->PMC[0x4028/4]);
+		printf("NV_402C (0x402c): %08x\n", nv_card->PMC[0x402c/4]);
+		printf("NV_4030 (0x4030): %08x\n", nv_card->PMC[0x4030/4]);
+		printf("NV_4034 (0x4034): %08x\n", nv_card->PMC[0x4034/4]);
+		printf("NV_4038 (0x4038): %08x\n", nv_card->PMC[0x4038/4]);
+		printf("NV_403C (0x403c): %08x\n", nv_card->PMC[0x403c/4]);
+		printf("NV_4040 (0x4040): %08x\n", nv_card->PMC[0x4040/4]);
+		printf("NV_4044 (0x4044): %08x\n", nv_card->PMC[0x4044/4]);
+		printf("NV_4048 (0x4048): %08x\n", nv_card->PMC[0x4048/4]);
+		printf("NV_404C (0x404c): %08x\n", nv_card->PMC[0x404c/4]);
+		printf("NV_4050 (0x4050): %08x\n", nv_card->PMC[0x4050/4]);
+		printf("NV_4054 (0x4054): %08x\n", nv_card->PMC[0x4054/4]);
+		printf("NV_4058 (0x4058): %08x\n", nv_card->PMC[0x4058/4]);
+		printf("NV_405C (0x405c): %08x\n", nv_card->PMC[0x405c/4]);
+		printf("NV_4060 (0x4060): %08x\n", nv_card->PMC[0x4060/4]);
+	}
+	if(nv_card->arch & NV5X)
+	{
+		printf("NV_E100 (0xe100): %08x\n", nv_card->PMC[0xe100/4]);
+		printf("NV_E11C (0xe11c): %08x\n", nv_card->PMC[0xe11c/4]);
+		printf("NV_E120 (0xe120): %08x\n", nv_card->PMC[0xe120/4]);
+		printf("NV_20008 (0x20008): %08x\n", nv_card->PMC[0x20008/4]);
+	}
+
+	printf("NV_PFB_CFG0 (0x100200): %08x\n", nv_card->PFB[0x200/4]);
+	printf("NV_PFB_CFG0 (0x100204): %08x\n", nv_card->PFB[0x204/4]);
+	printf("NV_PFB_CFG0 (0x100208): %08x\n", nv_card->PFB[0x208/4]);
+	printf("NV_PFB_CFG0 (0x10020c): %08x\n", nv_card->PFB[0x20c/4]);
+	printf("NV_PFB_218  (0x100218): %08x\n", nv_card->PFB[0x218/4]);
+	printf("NV_PFB_TIMING0 (0x100220): %08x\n", nv_card->PFB[0x220/4]);
+	printf("NV_PFB_TIMING1 (0x100224): %08x\n", nv_card->PFB[0x224/4]);
+	printf("NV_PFB_TIMING2 (0x100228): %08x\n", nv_card->PFB[0x228/4]);
+	printf("NV_PFB_474     (0x100474): %08x\n", nv_card->PFB[0x474/4]);
+	printf("NV_PEXTDEV_BOOT_0 (0x101000): %08x\n", nv_card->PEXTDEV[0x0/4]);
+	printf("NV_NVPLL_COEFF_A (0x680500): %08x\n", nv_card->PRAMDAC[0x500/4]);
+	printf("NV_MPLL_COEFF_A (0x680504): %08x\n", nv_card->PRAMDAC[0x504/4]);
+	printf("NV_VPLL_COEFF (0x680508): %08x\n", nv_card->PRAMDAC[0x508/4]);
+	printf("NV_PLL_COEFF_SELECT (0x68050c): %08x\n", nv_card->PRAMDAC[0x50c/4]);
+	printf("NV_NVPLL_COEFF_B (0x680570: %08x\n", nv_card->PRAMDAC[0x570/4]);
+	printf("NV_MPLL_COEFF_B (0x680574: %08x\n", nv_card->PRAMDAC[0x574/4]);
+
+	/* The builtin tvout encoder is available on Geforce4MX/TI and all other GPUs upto NV3x/NV4x.
+	 * The registers are somewhere else on Geforce8 cards. There is a difference between the encoders
+	 * on the difference cards but I'm not sure which apart from more features like the addition of
+	 * component on the Geforce6 */
+	if(nv_card->arch & (NV17 | NV25 | NV3X | NV4X))
+	{
+		int index=0;
+		printf("--- TVOut regs ---\n");
+		printf("0xd200: 0x%08x\n", nv_card->PMC[0xd200/4]); /* bit27-24 flickering (?) */
+		printf("0xd204: 0x%08x\n", nv_card->PMC[0xd204/4]);
+		printf("0xd208: 0x%08x\n", nv_card->PMC[0xd208/4]); /* Overscan */
+		printf("0xd20c: 0x%08x\n", nv_card->PMC[0xd20c/4]);
+		printf("0xd210: 0x%08x\n", nv_card->PMC[0xd210/4]); /* bit 23-8 contain the horizontal resolution */
+		printf("0xd214: 0x%08x\n", nv_card->PMC[0xd214/4]); /* bit 23-8 contain the vertical resolution */
+		printf("0xd218: 0x%08x\n", nv_card->PMC[0xd218/4]); /* bit31 = sign bit; bit16 and up can be used for horizontal positioning */
+
+		printf("0xd21c: 0x%08x\n", nv_card->PMC[0xd21c/4]); /* bit31 = sign bit; bit16 and up can be used for vertical positioning */
+
+		printf("0xd228: 0x%08x\n", nv_card->PMC[0xd228/4]);  /* is this some clock signal?? */
+		printf("0xd22c: 0x%08x\n", nv_card->PMC[0xd22c/4]);
+		
+		printf("0xd230: 0x%08x\n", nv_card->PMC[0xd230/4]);
+		printf("0xd304: 0x%08x\n", nv_card->PMC[0xd304/4]); /* bit 25-16 hscaler (PAL 720, NTSC 720) */
+		printf("0xd508: 0x%08x\n", nv_card->PMC[0xd508/4]); /* bit 25-26 vscalar (PAL 288, NTSC 240) */
+		printf("0xd600: 0x%08x\n", nv_card->PMC[0xd600/4]);
+		printf("0xd604: 0x%08x\n", nv_card->PMC[0xd604/4]);
+		printf("0xd608: 0x%08x\n", nv_card->PMC[0xd608/4]);
+
+		/* Register 0xd220/0xd224 form a index/data register pair
+		 * - 0x7 = bit4:0 connector type; bit2 s-video, bit2-0 empty: composite?
+		 * - 0xe = bit7:0 tv system; ntscm (japan) 0x2; palb/d/g 0x4; palm/n/ntsc 0xc; is this correct? 
+		 * - 0x22 = tv saturation
+		 * - 0x25 = tv hue
+		 * how many indices exist ?
+		 */
+		for(index=0; index < 0x80; index++)
+		{
+			nv_card->PMC[0xd220/4] = index;
+			printf("index 0x%x: %02x\n", index, nv_card->PMC[0xd224/4]);
+		}
+	}
+}
+
+
 void info_init(void)
 {
 	nv_card->get_bus_type = get_bus_type;
 
-	/* Set the pci id again as the detected id might not be accurate in case of pci id modding. The OS doesn't allways update the id while it really changed! Only do it for cards without bridges (device_id != 0xf* */
-	if((nv_card->device_id & 0xfff0) != 0xf0)
+	/* Set the pci id again as the detected id might not be accurate in case of pci id modding. The OS doesn't allways update the id while it really changed! Only do it for cards without bridges (device_id != 0xf* and 0x2e*
+	* Don't use this for NV50 as the location of the pci config header has changed to an unknown position.
+	*/
+	if(((nv_card->device_id & 0xfff0) != 0xf0) && ((nv_card->device_id & 0xfff0) != 0x2e0) && !(nv_card->arch & NV5X))
 	{
 		nv_card->device_id = get_gpu_pci_id(); 
 		nv_card->card_name = (char*)get_card_name(nv_card->device_id, &nv_card->gpu);
@@ -849,10 +1147,10 @@
 		nv_card->get_agp_supported_rates = NULL;
 	}
 
-	/* Find out what memory is being used */
-	nv_card->mem_type = (nv_card->PFB[0x200/4] & 0x01) ? DDR : SDR;
-
 	nv_card->get_memory_size = get_memory_size;
 	nv_card->get_memory_type = get_memory_type;
 	nv_card->get_memory_width = get_memory_width;
-}
+
+	/* Debugging stuff */
+	nv_card->get_debug_info = get_debug_info;
+}

Modified: packages/nvclock/branches/upstream/current/src/backend/nv30.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/nv30.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/nv30.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/nv30.c Sat Jan  5 20:47:40 2008
@@ -2,7 +2,7 @@
  *
  * site: http://nvclock.sourceforge.net
  *
- * Copyright(C) 2001-2006 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * 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
@@ -20,9 +20,7 @@
  */
 
 #include <stdio.h>
-#include "nvclock.h"
 #include "backend.h"
-
 
 static float nv30_get_fanspeed()
 {
@@ -44,53 +42,63 @@
 	nv_card->PMC[0x10f0/4] = value;
 }
 
-static int CalcSpeed(int base_freq, int m, int n, int p)
-{
-	return (int)((float)n/(float)m * base_freq) >> p;
-}
-
-static int CalcSpeed_nv30(int base_freq, int m1, int m2, int n1, int n2, int p)
+static int CalcSpeed(int base_freq, int m1, int m2, int n1, int n2, int p)
 {
 	return (int)((float)(n1*n2)/(m1*m2) * base_freq) >> p;
 }
 
-float GetClock_nv30(int base_freq, unsigned int pll)
-{
-	/* All GeforceFX cards except the FX5200/FX5600/FX5700 use this algorithm */
-	/* If bit 7 is set use the new algorithm */
-	if(pll & 0x80)
-	{
-		int m1, m2, n1, n2, p;
-
-		m1 = NV30_PLL_M1(pll);
-		m2 = NV30_PLL_M2(pll);
-		n1 = NV30_PLL_N1(pll);
-		n2 = NV30_PLL_N2(pll);
-		p = NV30_PLL_P(pll);
-
-		/* Perhaps the 0x1f for n2 is wrong .. ? */
-	    
-		if(nv_card->debug)
-			printf("m1=%d m2=%d n1=%d n2=%d p=%d\n", m1, m2, n1, n2, p);
-	    
-		return (float)CalcSpeed_nv30(base_freq, m1, m2, n1, n2, p)/1000;
+float GetClock_nv30(int base_freq, unsigned int pll, unsigned int pll2)
+{
+	int m1, m2, n1, n2, p;
+
+	/* Geforce FX5600 cards and the FX5700?? (0x340) use an additional PLL register */
+	if(nv_card->arch & NV31)
+	{
+		m1 = pll & 0xff;
+		n1 = (pll >> 8) & 0xff;
+		p = (pll >> 16) & 0x0f;
+	
+		/* For some reasons a speed consists of two plls */
+		if(pll2 & 0x80000000)
+		{
+			m2 = pll2 & 0xff;
+			n2 = (pll2 >> 8) & 0xff;
+		}
+		else
+		{
+			m2 = 1;
+			n2 = 1;
+		}
 	}
 	else
 	{
-		int m, n, p;
-
-		m = NV30_PLL_M1(pll);
-		n = NV30_PLL_N1(pll);
-		p = NV30_PLL_P(pll);
-
-		if(nv_card->debug)
-			printf("m=%d n=%d p=%d\n", m, n, p);
-
-		return (float)CalcSpeed(base_freq, m, n, p)/1000;
-	}
-}
-
-static void ClockSelect_nv30(int clockIn, int p_current, unsigned int *pllOut)
+		/* All GeforceFX cards except the FX5200/FX5600/FX5700 use this algorithm */
+		/* If bit 7 is set use two VCOs else use the old algorithm; do cards fall back to a single PLL? */
+		if(pll & 0x80)
+		{
+			m1 = NV30_PLL_M1(pll);
+			m2 = NV30_PLL_M2(pll);
+			n1 = NV30_PLL_N1(pll);
+			n2 = NV30_PLL_N2(pll); /* Perhaps the 0x1f for n2 is wrong .. ? */
+			p = NV30_PLL_P(pll);
+		}
+		else
+		{
+			m1 = NV30_PLL_M1(pll);
+			m2 = 1;
+			n1 = NV30_PLL_N1(pll);
+			n2 = 1;
+			p = NV30_PLL_P(pll);
+		}
+	}
+
+	if(nv_card->debug)
+		printf("m1=%d m2=%d n1=%d n2=%d p=%d\n", m1, m2, n1, n2, p);
+
+	return (float)CalcSpeed(base_freq, m1, m2, n1, n2, p)/1000;
+}
+
+static void ClockSelect_nv30(int clockIn, int p_current, unsigned int *bestM1, unsigned int *bestM2, unsigned int *bestN1, unsigned int *bestN2, unsigned int *bestP)
 {
 	unsigned diff, diffOld;
 	unsigned VClk, Freq;
@@ -132,13 +140,20 @@
 						/* When the difference is 0 or less than .5% accept the speed */
 						if( (float)diff/(float)clockIn <= 0.005)
 						{
-							*pllOut = m + (m2<<4) + (n<<8) + ((n2 & 0x7) << 19) + ((n2 & 0x18)<<21) + (p<<16) + (1<<7);
+							*bestM1 = m;
+							*bestM2 = m2;
+							*bestN1 = n;
+							*bestN2 = n2;
+							*bestP = p;
 							return;
 						}
 						if(diff < diffOld)
 						{
-							*pllOut = m + (m2<<4) + (n<<8) + ((n2 & 0x7) << 19) + ((n2 & 0x18)<<21) + (p<<16) + (1<<7);
-							diffOld  = diff;
+							*bestM1 = m;
+							*bestM2 = m2;
+							*bestN1 = n;
+							*bestN2 = n2;
+							*bestP = p;
 						}
 					}
 				}
@@ -149,26 +164,31 @@
 
 static float nv30_get_gpu_speed()
 {
-	int nvpll = nv_card->PRAMDAC[0x500/4];
+	int pll = nv_card->PRAMDAC[0x500/4];
+	int pll2 = nv_card->PRAMDAC[0x570/4];
 	if(nv_card->debug == 1)
 	{
-		printf("NVPLL_COEFF=%08x\n", nvpll);
-	}
-
-	return (float)GetClock_nv30(nv_card->base_freq, nvpll);
+		printf("NVPLL_COEFF=%08x\n", pll);
+		printf("NVPLL_COEFF2=%08x\n", pll2);
+	}
+
+	return (float)GetClock_nv30(nv_card->base_freq, pll, pll2);
 }
 
 static void nv30_set_gpu_speed(unsigned int nvclk)
 {
 	unsigned int PLL=0;
-	int p;
+	int m1, m2, n1, n2, p;
 	nvclk *= 1000;
 
 	p = NV30_PLL_P(nv_card->PRAMDAC[0x500/4]);
-	ClockSelect_nv30(nvclk, p, &PLL);
+	ClockSelect_nv30(nvclk, p, &m1, &m2, &n1, &n2, &p);
+	PLL = m1 + (m2<<4) + (n1<<8) + ((n2 & 0x7) << 19) + ((n2 & 0x18)<<21) + (p<<16) + (1<<7);
 
 	if(nv_card->debug)
+	{
 		printf("NVPLL_COEFF: %08x\n", PLL);
+	}
 
 	/* Unlock the programmable NVPLL/MPLL */
 	nv_card->PRAMDAC[0x50c/4] |= 0x500;
@@ -177,24 +197,56 @@
 		nv_card->PRAMDAC[0x500/4] = PLL;
 }
 
+static void nv31_set_gpu_speed(unsigned int nvclk)
+{
+	unsigned int PLL, PLL2;
+	int m1, m2, n1, n2, p;
+	nvclk *= 1000;
+
+	p = NV30_PLL_P(nv_card->PRAMDAC[0x500/4]);
+	ClockSelect_nv30(nvclk, p, &m1, &m2, &n1, &n2, &p);
+	PLL  = (p << 16) | (n1 << 8) | m1;
+	PLL2 = (1<<31) | (n2 << 8) | m2;
+
+	/* Unlock the programmable NVPLL/MPLL */
+	nv_card->PRAMDAC[0x50c/4] |= 0x500;
+
+	/* When no speed is found, don't change the PLL */
+	/* The algorithm doesn't allow too low speeds */
+	if(PLL)
+	{
+		if(nv_card->debug)
+		{
+			printf("NVPLL_COEFF: %08x\n", PLL);
+			printf("NVPLL2_COEFF: %08x\n", PLL2);
+		}
+		nv_card->PRAMDAC[0x500/4] = PLL;
+		nv_card->PRAMDAC[0x570/4] = PLL2;
+	}
+}
+
 static float nv30_get_memory_speed()
 {
-	int mpll = nv_card->PRAMDAC[0x504/4];
+	int pll = nv_card->PRAMDAC[0x504/4];
+	int pll2 = nv_card->PRAMDAC[0x574/4];
 	if(nv_card->debug == 1)
 	{
-		printf("MPLL_COEFF=%08x\n", mpll);
-	}
-	return (float)GetClock_nv30(nv_card->base_freq, mpll);
+		printf("MPLL_COEFF=%08x\n", pll);
+		printf("MPLL_COEFF2=%08x\n", pll2);
+	}
+
+	return (float)GetClock_nv30(nv_card->base_freq, pll, pll2);
 }
 
 static void nv30_set_memory_speed(unsigned int memclk)
 {
 	unsigned int PLL=0;
-	int p;
+	int m1, m2, n1, n2, p;
 	memclk *= 1000;
 
-	p = NV30_PLL_P(nv_card->PRAMDAC[0x504/4]);
-	ClockSelect_nv30(memclk, p, &PLL);
+	p = NV30_PLL_P(nv_card->PRAMDAC[0x500/4]);
+	ClockSelect_nv30(memclk, p, &m1, &m2, &n1, &n2, &p);
+	PLL = m1 + (m2<<4) + (n1<<8) + ((n2 & 0x7) << 19) + ((n2 & 0x18)<<21) + (p<<16) + (1<<7);
 
 	if(nv_card->debug)
 		printf("MPLL_COEFF: %08x\n", PLL);
@@ -205,6 +257,34 @@
 		nv_card->PRAMDAC[0x504/4] = PLL;
 }
 
+static void nv31_set_memory_speed(unsigned int memclk)
+{
+	unsigned int PLL, PLL2;
+	int m1, m2, n1, n2, p;
+	memclk *= 1000;
+
+	p = NV30_PLL_P(nv_card->PRAMDAC[0x500/4]);
+	ClockSelect_nv30(memclk, p, &m1, &m2, &n1, &n2, &p);
+	PLL  = (p << 16) | (n1 << 8) | m1;
+	PLL2 = (1<<31) | (n2 << 8) | m2;
+
+	/* Unlock the programmable NVPLL/MPLL */
+	nv_card->PRAMDAC[0x50c/4] |= 0x500;
+
+	/* When no speed is found, don't change the PLL */
+	/* The algorithm doesn't allow too low speeds */
+	if(PLL)
+	{
+		if(nv_card->debug)
+		{
+			printf("MPLL_COEFF: %08x\n", PLL);
+			printf("MPLL2_COEFF: %08x\n", PLL2);
+		}
+		nv_card->PRAMDAC[0x504/4] = PLL;
+		nv_card->PRAMDAC[0x574/4] = PLL2;
+	}
+}
+
 static void nv30_reset_gpu_speed()
 {
 	/* FIXME: we need to use our bios info */
@@ -215,6 +295,17 @@
 	nv_card->PRAMDAC[0x500/4] = nv_card->nvpll;
 }
 
+static void nv31_reset_gpu_speed()
+{
+	/* FIXME: we need to use our bios info */
+	/* Unlock the programmable NVPLL/MPLL */
+	nv_card->PRAMDAC[0x50c/4] |= 0x500;
+
+	/* Set the gpu speed */
+	nv_card->PRAMDAC[0x500/4] = nv_card->nvpll;
+	nv_card->PRAMDAC[0x570/4] = nv_card->nvpll2;
+}
+
 static void nv30_reset_memory_speed()
 {
 	/* FIXME: we need to use our bios info */
@@ -225,13 +316,23 @@
 	nv_card->PRAMDAC[0x504/4] = nv_card->mpll;
 }
 
+static void nv31_reset_memory_speed()
+{
+	/* FIXME: we need to use our bios info */
+	/* Unlock the programmable NVPLL/MPLL */
+	nv_card->PRAMDAC[0x50c/4] |= 0x500;
+
+	/* Set the memory speed */
+	nv_card->PRAMDAC[0x504/4] = nv_card->mpll;
+	nv_card->PRAMDAC[0x574/4] = nv_card->mpll2;
+}
+
 static void nv30_set_state(int state)
 {
-	nv_card->state = state;
-
 #ifdef HAVE_NVCONTROL
 	if(state & (STATE_2D | STATE_3D))
 	{
+		nv_card->state = state;
 		nv_card->get_gpu_speed = nvcontrol_get_gpu_speed;
 		nv_card->get_memory_speed = nvcontrol_get_memory_speed;
 		nv_card->set_gpu_speed = nvcontrol_set_gpu_speed;
@@ -242,12 +343,25 @@
 	else
 #endif
 	{
-		nv_card->get_gpu_speed = nv30_get_gpu_speed;
-		nv_card->get_memory_speed = nv30_get_memory_speed;
-		nv_card->set_memory_speed = nv30_set_memory_speed;
-		nv_card->set_gpu_speed = nv30_set_gpu_speed;
-		nv_card->reset_gpu_speed = nv30_reset_gpu_speed;
-		nv_card->reset_memory_speed = nv30_reset_memory_speed;
+		nv_card->state = STATE_LOWLEVEL;
+		if(nv_card->arch & NV31)
+		{
+			nv_card->get_gpu_speed = nv30_get_gpu_speed;
+			nv_card->get_memory_speed = nv30_get_memory_speed;
+			nv_card->set_memory_speed = nv31_set_memory_speed;
+			nv_card->set_gpu_speed = nv31_set_gpu_speed;
+			nv_card->reset_gpu_speed = nv31_reset_gpu_speed;
+			nv_card->reset_memory_speed = nv31_reset_memory_speed;
+		}
+		else /* FX5800/5900 */
+		{
+			nv_card->get_gpu_speed = nv30_get_gpu_speed;
+			nv_card->get_memory_speed = nv30_get_memory_speed;
+			nv_card->set_memory_speed = nv30_set_memory_speed;
+			nv_card->set_gpu_speed = nv30_set_gpu_speed;
+			nv_card->reset_gpu_speed = nv30_reset_gpu_speed;
+			nv_card->reset_memory_speed = nv30_reset_memory_speed;
+		}
 	}
 }
 
@@ -256,7 +370,18 @@
 	nv_card->base_freq = 27000;
 
 	nv_card->set_state = nv30_set_state;
-	nv_card->set_state(nv_card->state); /* Set the clock function pointers */
+	nv_card->set_state(STATE_LOWLEVEL); /* Set the clock function pointers */
+
+	/* Register I2C busses for hardware monitoring purposes */
+	if(nv_card->busses[0] == NULL)
+	{
+		nv_card->num_busses = 3;
+		nv_card->busses[0] = NV_I2CCreateBusPtr("BUS0", 0x3e); /* available on riva128 and higher */
+		nv_card->busses[1] = NV_I2CCreateBusPtr("BUS1", 0x36); /* available on rivatnt hardware and  higher */
+		nv_card->busses[2] = NV_I2CCreateBusPtr("BUS2", 0x50);  /* available on geforce4mx/4ti/fx/6/7 */
+
+		i2c_sensor_init();
+	}
 
 	/* HW monitoring; bit 31 is an indication if fanspeed monitoring is available
 	/  Note this bit isn't very reliable as it is set on cards with advanced sensors too.
@@ -289,8 +414,8 @@
 	}
 	else
 	{
-		float memclk = GetClock_nv30(nv_card->base_freq, nv_card->mpll);
-		float nvclk = GetClock_nv30(nv_card->base_freq, nv_card->nvpll);
+		float memclk = GetClock_nv30(nv_card->base_freq, nv_card->mpll, nv_card->mpll2);
+		float nvclk = GetClock_nv30(nv_card->base_freq, nv_card->nvpll, nv_card->nvpll2);
 
 		/* Not great but better than nothing .. */
 		nv_card->memclk_min = (short)(memclk * .75);

Modified: packages/nvclock/branches/upstream/current/src/backend/nv40.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/nv40.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/nv40.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/nv40.c Sat Jan  5 20:47:40 2008
@@ -2,7 +2,7 @@
  *
  * site: http://nvclock.sourceforge.net
  *
- * Copyright(C) 2001-2006 Roderick Colenbrander
+ * Copyright(C) 2001-2008 Roderick Colenbrander
  *
  * Thanks to Erik Waling for doing Smartdimmer coding/testing. (his code isn't the one in NVClock)
  *
@@ -68,7 +68,6 @@
 
 #include <stdio.h>
 #include <string.h>
-#include "nvclock.h"
 #include "backend.h"
 
 /*
@@ -108,10 +107,10 @@
 / - NV44 0x0703 6200(Go)/Turbocache cards
 / - NV46 0x0703 7300 (is this correct?)
 / - NV47/NV49 0xff3f 7800/7900 cards
-/ - NV4B 0x1f07 7600 (is this correct?)
+/ - NV4B 0x1f0f 7600
 */
 
-static int nv40_get_default_mask()
+static int nv40_get_default_mask(char *pmask, char *vmask)
 {
 	int mask;
 	switch(nv_card->arch)
@@ -125,6 +124,7 @@
 		case NV43:
 		case NV44:
 		case NV46:
+		case C51:
 			mask = 0x703;
 			break;
 		case NV47:
@@ -132,34 +132,22 @@
 			mask = 0xff3f;
 			break;
 		case NV4B:
-			mask = 0x1f07;
+			mask = 0x1f0b;
 			break;
 	}
+
+	if(pmask)
+		*pmask = mask & 0xff;
+	if(vmask)
+		*vmask = (mask >> 8) & 0xff;
+
 	return mask;
-}
-
-/* Convert a mask containing enabled/disabled pipelines for nv4x cards
-/  to a binary string.
-*/
-static void nv40_unit_mask_to_binary(unsigned char mask, unsigned char hw_default, char *buf)
-{
-	int i, len;
-
-	/* Count the number of pipelines on the card */
-	for(i=0, len=0; i<8; i++)
-		len += (hw_default & (1<<i)) ? 1 : 0;
-
-	for(i=0; i<len; i++)
-	{
-		buf[i] = (mask & (1<<(len-i-1))) ? '1' : '0';
-	}
-	buf[len] = 0;
 }
 
 /* Try to locate hardware maskes units. On success we return 1 and pmask/vmask
 /  contain the masked units. When no hw masked units are found we return 0.
 */
-static int nv40_get_hw_masked_units(char *pmask, char *vmask, int byte)
+static int nv40_get_hw_masked_units(char *pmask, char *vmask)
 {
 	unsigned int mask = nv_card->PMC[0xc010/4]; /* Or should we show the currently locked pipes? */
 	unsigned int masked_units;
@@ -174,20 +162,12 @@
 	/  in favor of a segfault ;)
 	*/
 	/* What to do with NV47 which has 8 vertex units? */
-	masked_units = (((mask & 0x3f0000) >> 8) | (mask >> 22)) & nv40_get_default_mask();
+	masked_units = (((mask & 0x3f0000) >> 8) | (mask >> 22)) & nv40_get_default_mask(0, 0);
 
 	if(masked_units != 0)
 	{
-		if(byte)
-		{
-			*pmask = masked_units & 0xff; /* pixel */
-			*vmask = (masked_units >> 8) & 0xff; /* vertex */
-		}
-		else
-		{
-			nv40_unit_mask_to_binary(masked_units & 0xff, nv40_get_default_mask() & 0xff, pmask);
-			nv40_unit_mask_to_binary((masked_units >> 8)& 0xff, (nv40_get_default_mask()>>8) & 0xff, vmask);
-		}
+		*pmask = masked_units & 0xff; /* pixel */
+		*vmask = (masked_units >> 8) & 0xff; /* vertex */
 		return 1;
 	}
 
@@ -197,19 +177,12 @@
 /* Try to locate software maskes units. On success we return 1 and pmask/vmask
 /  contain the masked units. When no sw masked units are found we return 0.
 */
-static int nv40_get_sw_masked_units(char *pmask, char *vmask, int byte)
-{
-	unsigned int mask = nv40_get_default_mask();
+static int nv40_get_sw_masked_units(char *pmask, char *vmask)
+{
+	unsigned int mask = nv40_get_default_mask(0, 0);
 	unsigned int pipe_cfg;
 
-	/* When a biosdump is present read the default value from there
-	/  else we use the current pipe_cfg as an alternative. This isn't correct
-	/  but on some cards we just can't dump the bios (for instance on 6200go cards).
-	*/
-	if(nv_card->bios)
-		pipe_cfg = nv_card->bios->pipe_cfg;
-	else
-		nv_card->PMC[0x1540/4] & nv40_get_default_mask();
+	pipe_cfg = nv_card->PMC[0x1540/4] & nv40_get_default_mask(0, 0);
 
 	if(!pipe_cfg)
 		return 0;
@@ -222,16 +195,13 @@
 	*/
 	if((pipe_cfg & 0xffff) != mask)
 	{
-		if(byte)
-		{
-			*pmask = (pipe_cfg & ~mask) & 0xff;
-			*vmask = (pipe_cfg & ~mask) & 0xff00;
-		}
-		else
-		{
-			nv40_unit_mask_to_binary((pipe_cfg & ~mask) & 0xff, nv40_get_default_mask() & 0xff, pmask);
-			nv40_unit_mask_to_binary((pipe_cfg & ~mask) & 0xff00, (nv40_get_default_mask() >> 8) & 0xff, vmask);
-		}
+		/* First note the bits that are different
+		/  E.g. pipe_cfg = 0x701, while mask = 0x703
+		/  0x701 ^ 0x703 = 0x002
+		*/
+		pipe_cfg = (pipe_cfg ^ mask) & mask;
+		*pmask = pipe_cfg & 0xff;
+		*vmask = (pipe_cfg >> 8) & 0xff;
 		return 1;
 	}
 	return 0;
@@ -241,9 +211,9 @@
 /  store a mask with active pipelines. Further store the total
 /  number of pixel units per pipeline in total.
 */
-static int nv40_get_pixel_pipelines(char *mask, int byte, int *total)
-{
-	unsigned char pipe_cfg = nv_card->PMC[0x1540/4] & 0xff;;
+static int nv40_get_pixel_pipelines(char *mask, int *total)
+{
+	unsigned char pipe_cfg = nv_card->PMC[0x1540/4] & 0xff;
 	int i, pipelines=0;
 
 	/* The number of enabled pixel pipelines is stored in the first 4 (or more?) bits.
@@ -254,10 +224,7 @@
 		if((pipe_cfg >> i) & 0x1)
 			pipelines++;
 
-	if(byte)
-		*mask = pipe_cfg;
-	else
-		nv40_unit_mask_to_binary(pipe_cfg, nv40_get_default_mask() & 0xff, mask);
+	*mask = pipe_cfg;
 
 	/* NV44/NV46 use 2 pixel units per pipeline */
 	if(nv_card->arch & (NV44 | NV46))
@@ -271,7 +238,7 @@
 /* Receive the number of enabled vertex pipelines and also
 /  store a mask with active pipelines.
 */
-static int nv40_get_vertex_pipelines(char *mask, int byte)
+static int nv40_get_vertex_pipelines(char *mask)
 {
 	unsigned char pipe_cfg = (nv_card->PMC[0x1540/4]  >> 8) & 0xff;
 	int i, pipelines=0;
@@ -283,10 +250,7 @@
 		if((pipe_cfg >> i) & 0x1)
 			pipelines++;
 
-	if(byte)
-		*mask = pipe_cfg;
-	else
-		nv40_unit_mask_to_binary(pipe_cfg, (nv40_get_default_mask() >> 8) & 0xff, mask);
+	*mask = pipe_cfg;
 
 	return pipelines;
 }
@@ -419,8 +383,13 @@
 	{
 		/* Initialize the sensor, for now program a threshold value of 120C.
 		*/
-		nv_card->PMC[0x15b0/4] = 0x10000000 | ((int)(((float)120 - offset - correction) / slope)) ;
-		nv_card->PMC[0x15b8/4] = 0x14800000;
+		int max_temp = (int)(((float)120 - offset - correction) / slope);
+
+		/* 7300/7600/7900 cards need bit31 to be set while older cards need a different bit */
+		if(nv_card->arch & (NV46 | NV49 | NV4B))
+			nv_card->PMC[0x15b0/4] = 0x80000000 | max_temp;
+		else
+			nv_card->PMC[0x15b0/4] = 0x10000000 | max_temp;
 		usleep(500);
 	}
 
@@ -475,13 +444,12 @@
 		m2 = 1;
 		n2 = 1;
 	}
-	/* NV49/NV4B cards seem to use a different calculation; I'm not sure how it works yet, so for now check the architecture. Further it looks like bit 15 can be used to identify it but I'm not sure yet.
-	*/
-	else if((nv_card->arch & (NV49 | NV4B)) && (pll & 0x1000))
+	/* NV46/NV49/NV4B cards seem to use a different calculation; I'm not sure how it works yet, so for now check the architecture. Further it looks like bit 15 can be used to identify it but I'm not sure yet.
+	*/
+	else if(pll & 0x1000)
 	{
 		m2 = 1;
 		n2 = 1;
-		p = 0;
 	}
 	else
 	{
@@ -495,148 +463,366 @@
 	return (float)CalcSpeed_nv40(base_freq, m1, m2, n1, n2, p)/1000;
 }
 
-static void ClockSelectFractional_nv40(int clockIn, unsigned int pllIn, unsigned int *pllOut, unsigned int *pllBOut)
-{
-	unsigned diff, diffOld;
-	unsigned VClk, Freq;
-	unsigned m, m2, n, n2, p=0;
-	int base_freq = 27000;
-
-	diffOld = 0xFFFFFFFF;
-
-	if(clockIn < 125)
-		p = 3;
-	else if(clockIn < 250)
-		p = 2;
-	else if(clockIn < 500)
-		p = 1;
+const unsigned int pll_entries=2;
+/* TODO: add proper architecture specific defaults */
+const struct pll pll_lst[2] = { 
+	{0x0000, 7, 0, {3000, 25000, 100000, 405000, 1, 255, 1, 255}, {35000, 100000, 400000, 1000000, 1, 31, 1, 31}},
+	{0x4020, 7, 0, {3000, 25000, 100000, 405000, 1, 255, 1, 255}, {35000, 100000, 600000, 1400000, 1, 31, 1, 31}},
+};
+
+static const struct pll* GetPllLimits(unsigned int reg)
+{
+	int i;
+	if(nv_card->bios && nv_card->bios->pll_entries)
+	{
+		for(i=0; i<nv_card->bios->pll_entries; i++)
+		{
+			if(nv_card->bios->pll_lst[i].reg == reg)
+				return &nv_card->bios->pll_lst[i];
+		}
+		/* Return the default limits */
+		return &nv_card->bios->pll_lst[0];
+	}
 	else
-		p = 0;
-
-	VClk = (unsigned)clockIn;
-
-	Freq = VClk;
-	if ((Freq >= 75000) && (Freq <= 1200000))
-	{
-		for(m = 1; m <= 4; m++)
-		{
-			for (m2 = 1; m2 <= 4; m2++)
+	{
+		for(i=0; i<pll_entries; i++)
+		{
+			if(pll_lst[i].reg == reg)
+				return &pll_lst[i];
+		}
+		/* Return the default limits */
+		return &pll_lst[0];
+	}
+}
+
+static void ClockSelectSingleVCO_nv40(int clockIn, const struct pll *pll_limits, int *bestM, int *bestN, int *bestP)
+{
+	int clock, M, N, P;
+	int delta, bestDelta, minM, maxM, minN, maxN, maxP;
+	int minVCOInputFreq, minVCOFreq, maxVCOFreq;
+	int refClk = 27000;
+	int VCOFreq;
+	*bestM=*bestN=*bestP=0;
+	bestDelta = clockIn;
+
+	minVCOInputFreq = pll_limits->VCO1.minInputFreq;
+	minVCOFreq = pll_limits->VCO1.minFreq;
+	maxVCOFreq = pll_limits->VCO1.maxFreq;
+	minM = pll_limits->VCO1.minM;
+	maxM = pll_limits->VCO1.maxM;
+	minN = pll_limits->VCO1.minN;
+	maxN = pll_limits->VCO1.maxN;
+	maxP = 6;
+
+	/* The optimal frequency for the PLL to work at is somewhere in the center of its range.
+	/  Choose a post divider in such a way to achieve this.
+	/  The G8x nv driver does something similar but they they derive a minP and maxP. That
+	/  doesn't seem required as you get so many matching clocks that you don't enter a second
+	/  iteration for P. (The minP / maxP values in the nv driver only differ at most 1, so it is for
+	/  some rare corner cases.
+	*/
+	for(P=0, VCOFreq=maxVCOFreq/2; clockIn<=VCOFreq && P <= maxP; P++)
+	{
+		VCOFreq /= 2;
+	}
+
+	/* Calculate the m and n values. There are a lot of values which give the same speed;
+	/  We choose the speed for which the difference with the request speed is as small as possible.
+	*/
+	for(M=minM; M<=maxM; M++)
+	{
+		/* The VCO has a minimum input frequency */
+		if((refClk/M) < minVCOInputFreq)
+			break;
+
+		for(N=minN; N<=maxN; N++)
+		{
+			/* Calculate the frequency generated by VCO1 */
+			clock = (int)(refClk * N / (float)M);
+
+			/* Verify if the clock lies within the output limits of VCO1 */
+			if(clock < minVCOFreq)
+				continue;
+ 			else if (clock > maxVCOFreq) /* It is no use to continue as the clock will only become higher */
+				break;
+
+			clock >>= P;
+			delta = abs((int)(clockIn - clock));
+			/* When the difference is 0 or less than .5% accept the speed */
+			if(((delta == 0) || ((float)delta/(float)clockIn <= 0.005)))
 			{
-				for(n = 1; n <= 31; n++)
+				*bestM = M;
+				*bestN = N;
+				*bestP = P;
+				return;
+			}
+
+			/* When the new difference is smaller than the old one, use this one */
+			if(delta < bestDelta)
+			{
+				bestDelta = delta;
+				*bestM = M;
+				*bestN = N;
+				*bestP = P;
+			}
+		}
+	}
+}
+
+static void ClockSelectDoubleVCO_nv40(int clockIn, const struct pll *pll_limits, int *bestM, int *bestM2, int *bestN, int *bestN2, int *bestP)
+{
+	int clock1, clock2, M, M2, N, N2, P;
+	int delta, bestDelta, minM, minM2, maxM, maxM2, minN, minN2, maxN, maxN2, maxP;
+	int minVCOInputFreq, minVCO2InputFreq, maxVCO2InputFreq, minVCOFreq, minVCO2Freq, maxVCOFreq, maxVCO2Freq;
+	int maxClock, VCO2Freq;
+	int refClk = 27000;
+	bestDelta = clockIn;
+	*bestM=*bestM2=*bestN=*bestN2=*bestP=0;
+
+	minVCOInputFreq = pll_limits->VCO1.minInputFreq;
+	minVCOFreq = pll_limits->VCO1.minFreq;
+	maxVCOFreq = pll_limits->VCO1.maxFreq;
+	minM = pll_limits->VCO1.minM;
+	maxM = pll_limits->VCO1.maxM;
+	minN = pll_limits->VCO1.minN;
+	maxN = pll_limits->VCO1.maxN;
+
+	minVCO2InputFreq = pll_limits->VCO2.minInputFreq;
+	maxVCO2InputFreq = pll_limits->VCO2.maxInputFreq;
+	minVCO2Freq = pll_limits->VCO2.minFreq;
+	maxVCO2Freq = pll_limits->VCO2.maxFreq;
+	minM2 = pll_limits->VCO2.minM;
+	maxM2 = pll_limits->VCO2.maxM;
+	minN2 = pll_limits->VCO2.minN;
+	maxN2 = pll_limits->VCO2.maxN;
+	maxP = 6; /* This should be somewhere in the bios too */
+
+	maxClock = maxVCO2Freq;	
+	/* If the requested clock is behind the bios limits, try it anyway */
+	if(clockIn > maxVCO2Freq)
+		maxClock = clockIn + clockIn/200; /* Add a .5% margin */
+
+	/* The optimal frequency for the PLL to work at is somewhere in the center of its range.
+	/  Choose a post divider in such a way to achieve this.
+	/  The G8x nv driver does something similar but they they derive a minP and maxP. That
+	/  doesn't seem required as you get so many matching clocks that you don't enter a second
+	/  iteration for P. (The minP / maxP values in the nv driver only differ at most 1, so it is for
+	/  some rare corner cases.
+	*/
+	for(P=0, VCO2Freq=maxClock/2; clockIn<=VCO2Freq && P <= maxP; P++)
+	{
+		VCO2Freq /= 2;
+	}
+
+	/* The PLLs on Geforce6/7 hardware can operate in a single stage made with only 1 VCO
+	/  and a cascade mode of two VCOs. This second mode is in general used for relatively high
+	/  frequencies. The loop below calculates the divider and multiplier ratios for the cascade
+	/  mode. The code takes into account limits defined in the video bios.
+	*/
+	for(M=minM; M<=maxM; M++)
+	{
+		/* The VCO has a minimum input frequency */
+		if((refClk/M) < minVCOInputFreq)
+			break;
+
+		for(N=minN; N<=maxN; N++)
+		{
+			/* Calculate the frequency generated by VCO1 */
+			clock1 = (int)(refClk * N / (float)M);
+			/* Verify if the clock lies within the output limits of VCO1 */
+			if( (clock1 < minVCOFreq) )
+				continue;
+			else if(clock1 > maxVCOFreq) /* For future N, the clock will only increase so stop; xorg nv continues but that is useless */
+				break;
+
+			for(M2=minM2; M2<=maxM2; M2++)
+			{
+				/* The clock fed to the second VCO needs to lie within a certain input range */
+				if(clock1 / M2 < minVCO2InputFreq)
+					break;
+				else if(clock1 / M2 > maxVCO2InputFreq)
+					continue;
+
+				N2 = (int)((float)((clockIn << P) * M * M2) / (float)(refClk * N)+.5);
+				if( (N2 < minN2) || (N2 > maxN2) )
+					continue;
+
+				/* The clock before being fed to the post-divider needs to lie within a certain range.
+				/  Further there are some limits on N2/M2.
+				*/
+				clock2 = (int)((float)(N*N2)/(M*M2) * refClk);
+				if( (clock2 < minVCO2Freq) || (clock2 > maxClock))// || ((N2 / M2) < 4) || ((N2 / M2) > 10) )
+					continue;
+
+				/* The post-divider delays the 'high' clock to create a low clock if requested.
+				/  This post-divider exists because the VCOs can only generate frequencies within
+				/  a limited frequency range. This range has been tuned to lie around half of its max
+				/  input frequency. It tries to calculate all clocks (including lower ones) around this
+				/  'center' frequency.
+				*/
+				clock2 >>= P;
+				delta = abs((int)(clockIn - clock2));
+
+				/* When the difference is 0 or less than .5% accept the speed */
+				if(((delta == 0) || ((float)delta/(float)clockIn <= 0.005)))
 				{
-					n2 = (int)((float)((VClk << p) * m * m2) / (float)(base_freq * n)+.5);
-
-					if((n2 < 24) && (n >= n2) && (m >= m2))
-					{
-						Freq = ((base_freq * n * n2) / (m * m2)) >> p;
-						if (Freq > VClk)
-							diff = Freq - VClk;
-						else
-							diff = VClk - Freq;
-
-						/* When the difference is 0 or less than .5% accept the speed */
-						if(((diff == 0) || ((float)diff/(float)clockIn <= 0.001)))
-						{
-							/* What do the 0x1c and 0xe mean? further there is some bit in pllOut that is sometimes 1 */
-							*pllOut = (pllIn & 0xfffcffff) + (p << 16);
-							*pllBOut = m + (n<<8) + (m2<<16) + (n2 << 24);
-							return;
-						}
-						if (diff < diffOld)
-						{
-							*pllOut = (pllIn & 0xfffcffff) + (p << 16);
-							*pllBOut = m + (n<<8) + (m2<<16) + (n2 << 24);
-							diffOld  = diff;
-						}
-					}
+					*bestM = M;
+					*bestM2 = M2;
+					*bestN = N;
+					*bestN2 = N2;
+					*bestP = P;
+					return;
+				}
+	
+				/* When the new difference is smaller than the old one, use this one */
+				if(delta < bestDelta)
+				{
+					bestDelta = delta;
+					*bestM = M;
+					*bestM2 = M2;
+					*bestN = N;
+					*bestN2 = N2;
+					*bestP = P;
 				}
 			}
 		}
 	}
 }
 
-static void ClockSelectInteger_nv40(int clockIn, unsigned int pllIn, unsigned int *pllOut, unsigned int *pllBOut)
-{
-	int m, n, p, bestm, bestn, bestp;
-	int diff, diffOld, mlow, mhigh, nlow, nhigh, plow, phigh;
-	int done = 0;
-	diffOld = clockIn;
-
-	/* NV49/NV4B integer pll algorithm for memory */
-	if(pllIn & 0x1000)
-	{
-		mlow = 1;
-		mhigh = 13;
-		nlow = 1;
-		nhigh = 95;
-		p = 0;
+static void ClockSelect_nv40(int clockIn, unsigned int reg, unsigned int *pllOut, unsigned int *pllBOut)
+{
+	int PLL=0, PLL2=0;
+	int bestM=0, bestM2=1, bestN=0, bestN2=1, bestP=0;
+	const struct pll *pll_limits = GetPllLimits(reg);
+	int pllIn = nv_card->PMC[reg/4];
+
+	printf("Warning using experimental NV4x lowlevel clock adjustment, if you encounter strange issues, issue a bugreport.\n");
+
+	/* Use a single VCO if the clock isn't high enough to require a second.
+	/  This is what apparently the Nvidia drivers are doing. For instance on my 7600GS
+	/  the max frequency for the first VCO in case of the GPU clock is 300MHz. Indeed below
+	/  300MHz it moves to a single VCO.
+	/  We could likely also check if the limits of the second divider and multiplier are 1.  */
+	if(clockIn < pll_limits->VCO1.maxFreq)
+	{
+		ClockSelectSingleVCO_nv40(clockIn, pll_limits, &bestM, &bestN, &bestP);
+
+		/* Bit31 enables the first VCO */
+		PLL = 0x80000000;
+
+		/* Select only a single VCO; bit12 is apparently used when there is a single VCO (G7x)
+		/  while bit8 is used when there are two VCOs, so it is apparently some disable bit.
+		/
+		/  On some cards at least on G7x ones, a single VCO is used for the memory
+		/  In this case the min and max reference dividers (M) are equal.
+		*/
+		if(pll_limits->VCO2.minM == pll_limits->VCO2.maxM)
+			PLL |= 0x1000;
+		else
+			PLL |= 0x100;
+
+		/* Set the reference divider (M) and the feedback divider (N) */
+		PLL2 = (bestN<<8) | bestM;
 	}
 	else
 	{
-		/* The values below are based on observations on a Geforce6600GT at clocks between 75MHz and 250MHz */
-		mlow = 2;
-		mhigh = 13;
-		nlow = 10;
-		nhigh = 75;
-
-		if(clockIn < 125*1000)
-			p = 1;
-		else
-			p = 0;
-	}
-
-	/*
-	Calculate the m and n values. There are a lot of values which give the same speed;
-	We choose the speed for which the difference with the request speed is as small as possible.
-	*/
-	for(m = mlow; m <= mhigh && !done; m++)
-	{
-		for(n=nlow; n<= nhigh && !done; n++)
-		{
-			diff = abs((int)(clockIn - CalcSpeed_nv40(27000, m, 1, n, 1, p)));
-			/* When the difference is 0 or less than .5% accept the speed */
-			if(((diff == 0) || ((float)diff/(float)clockIn <= 0.005)))
+		ClockSelectDoubleVCO_nv40(clockIn, pll_limits, &bestM, &bestM2, &bestN, &bestN2, &bestP);
+
+		/* Bit31 enables the first VCO, bit30 the second */
+		PLL = 0xc0000000;
+		/* Set the reference dividers (M, M2) and the feedback dividers (N, N2) */
+		PLL2 = (bestN2<<24) | (bestM2<<16) | (bestN<<8) | bestM;
+	}
+
+	/* Set the post divider */
+	PLL |= (bestP<<16);
+
+	if(reg == 0x4020) /* MPLL */
+	{
+		unsigned int default_pll = nv_card->bios ? nv_card->bios->mpll : 0;
+
+		/* This data comes from the init script tables of bios of the respective cards */
+		if(!default_pll)
+		{
+			switch(nv_card->arch)
 			{
-				bestm = m;
-				bestn = n;
-				bestp = p;
-				done = 1;
+				case NV40:
+				case NV41: /* I'm not sure if this is correct */
+				case NV43:
+				case NV44:
+					default_pll = 0x2000001c;
+					break;
+				case NV46:
+					default_pll = 0x20000000;
+					break;
+				case NV47:
+					default_pll = 0x2400001c;
+					break;
+				case NV49:
+				case NV4B:
+					default_pll = 0x24800000;
+					break;
+				default:
+					printf("Unknown default pll for %#x\n", nv_card->arch);
 			}
-
-			/* When the new difference is smaller than the old one, use this one */
-			if(diff < diffOld)
+		}
+
+		/* According to a vbtracetool log, this is done. Why a second post divider for the MPLL? */
+		PLL |= (bestP + pll_limits->var1e) << 20;
+		/* Or with the 'empty' PLL but make sure that it doesn't adjust the post dividers or the enable bits */
+		PLL |= (default_pll & 0x3f88ffff);
+	}
+	else /* NVPLL */
+	{
+		unsigned int default_pll = nv_card->bios ? nv_card->bios->nvpll : 0;
+		if(!default_pll)
+		{
+			switch(nv_card->arch)
 			{
-				diffOld = diff;
-				bestm = m;
-				bestn = n;
-				bestp = p;
+				case NV40:
+				case NV41: /* I'm not sure if this is correct */
+				case NV43:
+					default_pll = 0x0000001c;
+					break;
+				case NV44:
+					default_pll = 0xc000001c;
+					break;
+				case NV46:
+					default_pll = 0xc0000000;
+					break;
+				case NV47:
+					default_pll = 0x0001001f;
+					break;
+				case NV49:
+				case NV4B:
+					default_pll = 0x00010000;
+					break;
+				case C51:
+				default:
+					printf("Unknown default pll for %#x\n", nv_card->arch);
+					default_pll = 0xc0000000; /* this should only get reached for C51 */
 			}
 		}
-	}
-
-	/* NV49/NV4B integer pll algorithm for memory */
-	if(pllIn & 0x1000)
-	{
-		/* pllOut isn't used. I'm not sure what's in it but I haven't seen its contents changing for different clocks */
-		*pllBOut = (bestn << 8) | bestm;
-	}
-	else
-	{
-		/* Bit8 selects the integer mode, further bit31 seems to be set in all cases. Some other bits like bit30 are set in some cases too but I don't know when. This looks more or less correct */
-		*pllOut = 0x80000000 + (bestp << 16) + 0x11c;
-		/* M2 and N2 need to be set to 1  */
-		*pllBOut = (1<<24) + (31 << 16) + (bestn << 8) + bestm;
-	}
-}
-
-static void ClockSelect_nv40(int clockIn, unsigned int pllIn, unsigned int *pllOut, unsigned int *pllBOut)
-{
-	/* The gpu will be programmed in integer mode for now when that is currently enabled on the card */
-	if((pllIn & 0x1000) || (pllIn & 0x100))
-		ClockSelectInteger_nv40(clockIn, pllIn, pllOut, pllBOut);
-	else
-		ClockSelectFractional_nv40(clockIn, pllIn, pllOut, pllBOut);
-
+
+		/* Or with the 'empty' PLL but make sure that it doesn't adjust the post dividers or the enable bits */
+		PLL |= (default_pll & 0x3f88ffff);
+	}
+
+	/* TODO: at some stage we should perhaps also play nice with 0xc040.
+	/ Before programming a PLL, we should disable it in there. Then
+	/ we should put the PLL in program mode (?) by setting bit28. After that
+	/ we should program the PLLs (first the dividers/multipliers and then the config),
+	/ then re-enable the PLL in 0xc040 and then unset bit28 of the pll config register.
+	/ At least this is what happens in a vbtracetool log.
+	*/
+	*pllOut = PLL;
+	*pllBOut = PLL2;
+
+	if(nv_card->debug)
+	{
+		printf("register=%#x, clockIn=%d, calculated=%d\n", reg, clockIn, CalcSpeed_nv40(27000, bestM, bestM2, bestN, bestN2, bestP));
+		printf("PLL=%#08x, PLL2=%08x\n", *pllOut, *pllBOut);
+	}
 }
 
 static float nv40_get_gpu_speed()
@@ -657,7 +843,7 @@
 	unsigned int PLL=0, PLL2=0;
 	nvclk *= 1000;
 
-	ClockSelect_nv40(nvclk, nv_card->PMC[0x4000/4], &PLL, &PLL2);
+	ClockSelect_nv40(nvclk, 0x4000, &PLL, &PLL2);
 
 	/* When no speed is found, don't change the PLL */
 	/* The algorithm doesn't allow too low speeds */
@@ -692,7 +878,7 @@
 	unsigned int PLL=0, PLL2=0;
 	memclk *= 1000;
 
-	ClockSelect_nv40(memclk, nv_card->PMC[0x4020/4], &PLL, &PLL2);
+	ClockSelect_nv40(memclk, 0x4020, &PLL, &PLL2);
 
 	/* When no speed is found, don't change the PLL */
 	/* The algorithm doesn't allow too low speeds */
@@ -726,6 +912,7 @@
 				nv_card->PMC[0x4038/4] = PLL;
 				nv_card->PMC[0x403c/4] = PLL2;
 			case NV44:
+			case NV46:
 				nv_card->PMC[0x4020/4] = PLL;
 				nv_card->PMC[0x4024/4] = PLL2;
 		}
@@ -759,6 +946,7 @@
 			nv_card->PMC[0x4038/4] = nv_card->mpll;
 			nv_card->PMC[0x403c/4] = nv_card->mpll2;
 		case NV44:
+		case NV46:
 			nv_card->PMC[0x4020/4] = nv_card->mpll;
 			nv_card->PMC[0x4024/4] = nv_card->mpll2;
 	}
@@ -766,11 +954,10 @@
 
 static void nv40_set_state(int state)
 {
-	nv_card->state = state;
-	
 #ifdef HAVE_NVCONTROL
 	if(state & (STATE_2D | STATE_3D))
 	{
+		nv_card->state = state;
 		nv_card->get_gpu_speed = nvcontrol_get_gpu_speed;
 		nv_card->get_memory_speed = nvcontrol_get_memory_speed;
 		nv_card->set_gpu_speed = nvcontrol_set_gpu_speed;
@@ -781,6 +968,7 @@
 	else
 #endif
 	{
+		nv_card->state = STATE_LOWLEVEL;
 		nv_card->get_gpu_speed = nv40_get_gpu_speed;
 		nv_card->get_memory_speed = nv40_get_memory_speed;
 		nv_card->set_memory_speed = nv40_set_memory_speed;
@@ -795,7 +983,7 @@
 	nv_card->base_freq = 27000;
 
 	nv_card->set_state = nv40_set_state;
-	nv_card->set_state(nv_card->state); /* Set the clock function pointers */	
+	nv_card->set_state(STATE_LOWLEVEL); /* Set the clock function pointers */	
 	
 	nv_card->get_default_mask = nv40_get_default_mask;
 	nv_card->get_hw_masked_units = nv40_get_hw_masked_units;
@@ -803,6 +991,17 @@
 	nv_card->get_pixel_pipelines = nv40_get_pixel_pipelines;
 	nv_card->get_vertex_pipelines = nv40_get_vertex_pipelines;
 
+	/* Register I2C busses for hardware monitoring purposes */
+	if(nv_card->busses[0] == NULL)
+	{
+		nv_card->num_busses = 3;
+		nv_card->busses[0] = NV_I2CCreateBusPtr("BUS0", 0x3e); /* available on riva128 and higher */
+		nv_card->busses[1] = NV_I2CCreateBusPtr("BUS1", 0x36); /* available on rivatnt hardware and  higher */
+		nv_card->busses[2] = NV_I2CCreateBusPtr("BUS2", 0x50);  /* available on geforce4mx/4ti/fx/6/7 */
+
+		i2c_sensor_init();
+	}
+
 	/* For now enable modding on NV40 cards and NV43 revisions prior to A4; other cards are locked */
 	if((nv_card->arch & NV40) || ((nv_card->arch & NV43) && (nv_card->get_gpu_revision() < 0xA4)))
 	{
@@ -811,12 +1010,12 @@
 		nv_card->set_vertex_pipelines = nv40_set_vertex_pipelines;
 	}
 
-	/* For now support Smartdimmer on 6200Go(0x160)/7600Go(0x390) laptops */
-	if((((nv_card->device_id & 0xff0) == 0x160) || ((nv_card->device_id & 0xff0) == 0x390)) && nv_card->gpu == MOBILE)
+	/* If the smartdimmer register contains a value (default 21) then smartdimmer is supported on the laptop; This should work on various 6200Go/7600Go cards */
+	if((nv_card->PMC[0x15f0/4] & 0xff) && nv_card->gpu == MOBILE)
 	{
 		nv_card->caps |= SMARTDIMMER;
-		nv_card->mobile_get_smartdimmer = nv44_mobile_get_smartdimmer;
-		nv_card->mobile_set_smartdimmer = nv44_mobile_set_smartdimmer;
+		nv_card->get_smartdimmer = nv44_mobile_get_smartdimmer;
+		nv_card->set_smartdimmer = nv44_mobile_set_smartdimmer;
 	}
 	
 	/* Temperature monitoring; all cards after the NV40 feature an internal temperature sensor.
@@ -839,7 +1038,7 @@
 		nv_card->get_fanspeed = nv40_get_fanspeed;
 		nv_card->set_fanspeed = nv40_set_fanspeed;
 	}
-	else if(((nv_card->arch & (NV41 | NV43 | NV44 | NV47)) && (nv_card->PMC[0x15f4/4] & 0x80000000)) && !(nv_card->caps & I2C_FANSPEED_MONITORING))
+	else if(((nv_card->arch & (NV41 | NV43 | NV44 | NV47 | NV4B)) && (nv_card->PMC[0x15f4/4] & 0x80000000)) && !(nv_card->caps & I2C_FANSPEED_MONITORING))
 	{
 		nv_card->caps |= GPU_FANSPEED_MONITORING;
 		nv_card->get_fanspeed = nv43_get_fanspeed;
@@ -880,7 +1079,7 @@
 		nv_card->nvclk_max = nv_card->nvclk_3d * 1.25;
 
 		/* FIXME: Divide the memory clocks by two on Geforc7600/7900 cards because we program the 'real' clocks for those instead of the effective DDR ones which are twice as high */
-		if(nv_card->arch & (NV49 | NV4B))
+		if(nv_card->arch & (NV46 | NV49 | NV4B))
 		{
 			nv_card->memclk_min /= 2;
 			nv_card->memclk_max /= 2;

Added: packages/nvclock/branches/upstream/current/src/backend/nv50.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/nv50.c?rev=342&op=file
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/nv50.c (added)
+++ packages/nvclock/branches/upstream/current/src/backend/nv50.c Sat Jan  5 20:47:40 2008
@@ -1,0 +1,321 @@
+/* NVClock 0.8 - Linux overclocker for NVIDIA cards
+ *
+ * site: http://nvclock.sourceforge.net
+ *
+ * Copyright(C) 2007 Roderick Colenbrander
+ *
+ * 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-1307, USA
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "backend.h"
+
+static void nv50_i2c_get_bits(I2CBusPtr bus, int *clock, int *data)
+{
+	const int offset = bus->DriverPrivate.val;
+	unsigned char val;
+
+	val = nv_card->PMC[(0x0000E138 + offset)/4];
+	*clock = !!(val & 1);
+	*data = !!(val & 2);
+}
+
+static void nv50_i2c_put_bits(I2CBusPtr bus, int clock, int data)
+{
+	const int offset = bus->DriverPrivate.val;
+	nv_card->PMC[(0x0000E138 + offset)/4] = 4 | clock | data << 1;
+}
+
+static I2CBusPtr nv50_i2c_create_bus_ptr(char *name, int bus)
+{
+	I2CBusPtr I2CPtr;
+
+	I2CPtr = xf86CreateI2CBusRec();
+	if(!I2CPtr) return NULL;
+
+	I2CPtr->BusName    = name;
+	I2CPtr->scrnIndex  = nv_card->number; /* We need to use unique indices or else it can lead to a segfault in multicard situations */
+	I2CPtr->I2CAddress = I2CAddress;
+	I2CPtr->I2CPutBits = nv50_i2c_put_bits;
+	I2CPtr->I2CGetBits = nv50_i2c_get_bits;
+	I2CPtr->AcknTimeout = 40;
+	I2CPtr->DriverPrivate.val = bus;
+
+	if (!xf86I2CBusInit(I2CPtr))
+	{
+		return 0;
+	}
+	return I2CPtr;
+}
+
+static int nv50_get_default_mask(char *smask, char *rmask)
+{
+	int mask;
+	switch(nv_card->arch)
+	{
+		case NV50:
+			mask = 0x3f00ff;
+			break;
+		case G84:
+			mask = 0x030003;
+			break;
+		case G86:
+			mask = 0x010001;
+			break;
+	}
+
+	if(smask)
+		*smask = mask & 0xff;
+	if(rmask)
+		*rmask = (mask >> 16) & 0xff;
+
+	return mask;
+}
+
+/* Receive the number of enabled stream processors and also
+/  store a mask with active pipelines.
+*/
+static int nv50_get_stream_units(char *mask, char *default_mask)
+{
+	int i, stream_units=0;
+	unsigned char stream_units_cfg = nv_card->PMC[0x1540/4] & 0xff;
+	/* The number of shaders is again stored in 0x1540
+		bit7-0: number of unified pixel shaders in blocks of 16
+		bit23-16: number of ROP units in blocks of 4
+		bit31-24: what's in here?
+	 */
+
+	for(i=0; i<8; i++)
+		if((stream_units_cfg >> i) & 0x1)
+			stream_units++;
+
+	nv50_get_default_mask(default_mask, 0);
+
+	*mask = stream_units_cfg;
+	return (stream_units << 4); /* stream units are stored in blocks of 16 */
+}
+
+/* Receive the number of enabled ROP units and also
+/  store a mask with active units.
+*/
+static int nv50_get_rop_units(char *mask, char *default_mask)
+{
+	int i, rop_units=0;
+	unsigned char rop_units_cfg = (nv_card->PMC[0x1540/4] >> 16) & 0xff;
+
+	for(i=0; i<8; i++)
+		if((rop_units_cfg >> i) & 0x1)
+			rop_units++;
+
+	nv50_get_default_mask(0, default_mask);
+
+	*mask = rop_units_cfg;
+	return (rop_units << 2); /* rop units are stored in blocks of 4 */
+}
+
+/* Reading of the internal gpu sensor, it not entirely correct yet */
+static int nv50_get_gpu_temp(void *sensor)
+{
+	int temp;
+	int correction=0;
+	float offset;
+	float slope;
+
+	/* For now use a hardcoded offset and gain. This isn't correct but I don't know how the new temperture table works yet; this at least gives something */
+	offset = -227.0;
+	slope = 430.0/10000.0;
+
+	temp = nv_card->PMC[0x20008/4] & 0x1fff;
+	return (int)(temp * slope + offset) + correction;
+}
+
+static int CalcSpeed_nv50(int base_freq, int m1, int m2, int n1, int n2, int p)
+{
+	return (int)((float)(n1*n2)/(m1*m2) * base_freq) >> p;
+}
+
+float GetClock_nv50(int base_freq, unsigned int pll, unsigned int pll2)
+{
+	int m1, m2, n1, n2, p;
+
+	p = (pll >> 16) & 0x03;
+	m1 = pll2 & 0xFF;
+	n1 = (pll2 >> 8) & 0xFF;
+
+	/* This is always 1 for NV5x? */
+	m2 = 1;
+	n2 = 1;
+
+	if(nv_card->debug)
+		printf("m1=%d m2=%d n1=%d n2=%d p=%d\n", m1, m2, n1, n2, p);
+
+	/* The clocks need to be multiplied by 4 for some reason. Is this 4 stored in 0x4000/0x4004? */
+	return (float)4*CalcSpeed_nv50(base_freq, m1, m2, n1, n2, p)/1000;
+}
+
+static float nv50_get_gpu_speed()
+{
+	int pll = nv_card->PMC[0x4028/4];
+	int pll2 = nv_card->PMC[0x402c/4];
+	if(nv_card->debug == 1)
+	{
+		printf("NVPLL_COEFF=%08x\n", pll);
+		printf("NVPLL2_COEFF=%08x\n", pll2);
+	}
+
+	return (float)GetClock_nv50(nv_card->base_freq, pll, pll2);
+}
+
+static void nv50_set_gpu_speed(unsigned int nvclk)
+{
+}
+
+static float nv50_get_memory_speed()
+{
+	/* The memory clock appears to be in 0x4008/0x400c, 0x4010/0x4014 and 0x4018/0x401c but the second and third set aren't always set to the same values as 0x4008/0x400c */ 
+	int pll = nv_card->PMC[0x4008/4];
+	int pll2 = nv_card->PMC[0x400c/4];
+	if(nv_card->debug == 1)
+	{
+		printf("MPLL_COEFF=%08x\n", pll);
+		printf("MPLL2_COEFF=%08x\n", pll2);
+	}
+
+	return (float)GetClock_nv50(nv_card->base_freq, pll, pll2);
+}
+
+static void nv50_set_memory_speed(unsigned int memclk)
+{
+	printf("blaat: %d %p %x\n", memclk, nvclock.dpy, nv_card->state);
+}
+
+static float nv50_get_shader_speed()
+{
+	int pll = nv_card->PMC[0x4020/4];
+	int pll2 = nv_card->PMC[0x4024/4];
+	if(nv_card->debug == 1)
+	{
+		printf("SPLL_COEFF=%08x\n", pll);
+		printf("SPLL2_COEFF=%08x\n", pll2);
+	}
+
+	return (float)GetClock_nv50(nv_card->base_freq, pll, pll2);
+}
+
+static void nv50_set_shader_speed(unsigned int clk)
+{
+}
+
+static void nv50_reset_gpu_speed()
+{
+}
+
+static void nv50_reset_memory_speed()
+{
+}
+
+static void nv50_reset_shader_speed()
+{
+}
+
+static void nv50_set_state(int state)
+{
+#ifdef HAVE_NVCONTROL
+	if(state & (STATE_2D | STATE_3D))
+	{
+		nv_card->state = state;
+		nv_card->get_gpu_speed = nvcontrol_get_gpu_speed;
+		nv_card->get_memory_speed = nvcontrol_get_memory_speed;
+		nv_card->set_gpu_speed = nvcontrol_set_gpu_speed;
+		nv_card->set_memory_speed = nvcontrol_set_memory_speed;
+		nv_card->reset_gpu_speed = nvcontrol_reset_gpu_speed;
+		nv_card->reset_memory_speed = nvcontrol_reset_memory_speed;	
+	}
+	else
+#endif
+	{
+		nv_card->state = STATE_LOWLEVEL;
+		nv_card->get_gpu_speed = nv50_get_gpu_speed;
+		nv_card->get_memory_speed = nv50_get_memory_speed;
+		nv_card->set_memory_speed = nv50_set_memory_speed;
+		nv_card->set_gpu_speed = nv50_set_gpu_speed;
+		nv_card->reset_gpu_speed = nv50_reset_gpu_speed;
+		nv_card->reset_memory_speed = nv50_reset_memory_speed;
+	}
+	nv_card->get_shader_speed = nv50_get_shader_speed;
+	nv_card->set_shader_speed = nv50_set_shader_speed;
+	nv_card->reset_shader_speed = nv50_reset_shader_speed;
+}
+
+void nv50_init(void)
+{
+	nv_card->base_freq = 27000;
+
+	nv_card->set_state = nv50_set_state;
+	nv_card->set_state(STATE_LOWLEVEL); /* Set the clock function pointers */	
+
+	nv_card->get_stream_units = nv50_get_stream_units;
+	nv_card->get_rop_units = nv50_get_rop_units;
+
+	/* Initialize the NV50 I2C busses; compared to older hardware they are located at different register addresses */
+	if(nv_card->busses[0] == NULL)
+	{
+		nv_card->num_busses = 4;
+		nv_card->busses[0] = nv50_i2c_create_bus_ptr("BUS0", 0x0);
+		nv_card->busses[1] = nv50_i2c_create_bus_ptr("BUS1", 0x18);
+		nv_card->busses[2] = nv50_i2c_create_bus_ptr("BUS2", 0x30);
+		nv_card->busses[3] = nv50_i2c_create_bus_ptr("BUS3", 0x48);
+
+		i2c_sensor_init();
+	}
+
+	/* Temperature monitoring; all NV50 cards feature an internal temperature sensor
+	/  but only use it when there is no I2C sensor around.
+	*/
+	if(!(nv_card->caps & GPU_TEMP_MONITORING))
+	{
+		nv_card->caps |= GPU_TEMP_MONITORING;
+		nv_card->sensor_name = (char*)strdup("GPU Internal Sensor");
+		nv_card->get_gpu_temp = (int(*)(I2CDevPtr))nv50_get_gpu_temp;
+	}
+
+	/* Mobile GPU check; we don't want to overclock those unless the user wants it */
+	if(nv_card->gpu == MOBILE)
+	{
+		nv_card->caps = ~(~nv_card->caps | GPU_OVERCLOCKING | MEM_OVERCLOCKING);
+	}
+	else
+		nv_card->caps |= (GPU_OVERCLOCKING | MEM_OVERCLOCKING);
+
+#if 0		
+	/* Set the speed range */
+	if(nv_card->bios)
+	{
+
+	}
+	else
+#endif
+	{
+		float memclk = GetClock_nv50(nv_card->base_freq, nv_card->mpll, nv_card->mpll2);
+		float nvclk = GetClock_nv50(nv_card->base_freq, nv_card->nvpll, nv_card->nvpll2);
+
+		/* Not great but better than nothing .. */
+		nv_card->memclk_min = (short)(memclk * .75);
+		nv_card->memclk_max = (short)(memclk * 1.5);
+		nv_card->nvclk_min = (short)(nvclk * .75);
+		nv_card->nvclk_max = (short)(nvclk * 1.5);
+	}	
+}

Modified: packages/nvclock/branches/upstream/current/src/backend/nvclock.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/nvclock.h?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/nvclock.h (original)
+++ packages/nvclock/branches/upstream/current/src/backend/nvclock.h Sat Jan  5 20:47:40 2008
@@ -2,7 +2,7 @@
  *
  * site: http://nvclock.sourceforge.net
  *
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * 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
@@ -21,8 +21,6 @@
 
 #ifndef NVCLOCK_H
 #define NVCLOCK_H
-
-#include "i2c.h"
 
 #define MAX_CARDS 4
 
@@ -45,7 +43,12 @@
 #define NV47 (1<<13)
 #define NV49 (1<<14)
 #define NV4B (1<<15)
-#define NV4X (NV40 | NV41 | NV43 | NV44 | NV46 | NV47 | NV49 | NV4B)
+#define C51  (1<<16)
+#define NV4X (NV40 | NV41 | NV43 | NV44 | NV46 | NV47 | NV49 | NV4B | C51)
+#define NV50 (1<<17)
+#define G84 (1<<18)
+#define G86 (1<<19)
+#define NV5X (NV50 | G84 | G86)
 
 #define NV_ERR_NO_DEVICES_FOUND 1
 #define NV_ERR_NO_DRIVERS_FOUND 2
@@ -69,6 +72,11 @@
 #define STATE_3D (1<<2)
 #define STATE_BOTH (STATE_2D | STATE_3D)
 
+/* Define some i2c types, so that we don't depend on additional headers when using NVClock as a library */
+#ifndef _XF86I2C_H
+typedef void* I2CBusPtr;
+typedef void* I2CDevPtr;
+#endif
 
 typedef struct
 {
@@ -109,8 +117,26 @@
 	int nvclk;
 	int delta;
 	int memclk;
+	int shaderclk;
 	int fanspeed;
 	float voltage;
+};
+
+struct vco
+{
+	unsigned int minInputFreq, maxInputFreq;
+	unsigned int minFreq, maxFreq;
+	unsigned char minN, maxN;
+	unsigned char minM, maxM;
+};
+
+struct pll
+{
+	unsigned int reg;
+	unsigned char var1d;
+	unsigned char var1e;
+	struct vco VCO1;
+	struct vco VCO2;
 };
 
 struct sensor
@@ -138,7 +164,15 @@
 	short perf_entries;
 	struct performance perf_lst[3];
 
+	short pll_entries;
+	struct pll pll_lst[8];
+
 	struct sensor sensor_cfg;
+
+	/* Cache the 'empty' PLLs, this is needed for PLL calculation */
+	unsigned int mpll;
+	unsigned int nvpll;
+	unsigned int spll;
 
 	unsigned int pipe_cfg; /* Used to cache the NV4x pipe_cfg register */
 };
@@ -220,18 +254,25 @@
 	float (*get_i2c_fanspeed_pwm)(I2CDevPtr dev); /* Duty cycle of the pwm signal that controls the fan */
 	int (*set_i2c_fanspeed_pwm)(I2CDevPtr dev, float speed); /* By adjusting the duty cycle of the pwm signal, the fanspeed can be adjusted. */
 
-	/* Pipeline stuff; On various Geforce6 boards disabled pixel/vertex pipelines can be re-enabled. */
-	int (*get_default_mask)();
-	int (*get_hw_masked_units)(char *pmask, char *vmask, int byte); /* byte switches between returning a byte or string */
-	int (*get_sw_masked_units)(char *pmask, char *vmask, int byte);
-	int (*get_pixel_pipelines)(char *mask, int byte, int *total);
+	/* Pipeline stuff for NV4x; On various Geforce6 boards disabled pixel/vertex pipelines can be re-enabled. */
+	int (*get_default_mask)(char *pmask, char *vmask);
+	int (*get_hw_masked_units)(char *pmask, char *vmask);
+	int (*get_sw_masked_units)(char *pmask, char *vmask);
+	int (*get_pixel_pipelines)(char *mask, int *total);
 	void (*set_pixel_pipelines)(unsigned char mask);
-	int (*get_vertex_pipelines)(char *mask, int byte);
+	int (*get_vertex_pipelines)(char *mask);
 	void (*set_vertex_pipelines)(unsigned char mask);
 
+	/* NV5x (Geforce8) shader stuff */
+	float (*get_shader_speed)(); /* NV5X-only */
+	void (*set_shader_speed)(unsigned int clk); /* NV5X-only */
+	void (*reset_shader_speed)();
+	int (*get_stream_units)(char *mask, char *default_mask);
+	int (*get_rop_units)(char *mask, char *default_mask);
+
 	/* Smartdimmer (adjustment of the brigthenss of the backlight on Laptops) */
-	int (*mobile_get_smartdimmer)();
-	void (*mobile_set_smartdimmer)(int level);
+	int (*get_smartdimmer)();
+	void (*set_smartdimmer)(int level);
 
 	/* Overclocking */
 	volatile unsigned int mpll; /* default memory speed */
@@ -246,6 +287,9 @@
 	void (*set_memory_speed)(unsigned int memclk);
 	void (*reset_gpu_speed)();
 	void (*reset_memory_speed)();
+
+	/* Debug */
+	void (*get_debug_info)();
 } NVCard, *NVCardPtr;
 
 typedef struct
@@ -286,6 +330,10 @@
 void set_error(int code);
 void set_error_str(const char *err);
 
+/* utility functions */
+int convert_gpu_architecture(short arch, char *buf);
+void convert_unit_mask_to_binary(char mask, char hw_default, char *buf);
+
 #ifdef __cplusplus
 };
 #endif

Modified: packages/nvclock/branches/upstream/current/src/backend/nvcontrol.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/nvcontrol.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/nvcontrol.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/nvcontrol.c Sat Jan  5 20:47:40 2008
@@ -20,7 +20,6 @@
  */
 
 #include <stdio.h>
-#include "nvclock.h"
 #include "libnvcontrol.h"
 #include "backend.h"
 

Added: packages/nvclock/branches/upstream/current/src/backend/nvreg.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/nvreg.h?rev=342&op=file
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/nvreg.h (added)
+++ packages/nvclock/branches/upstream/current/src/backend/nvreg.h Sat Jan  5 20:47:40 2008
@@ -1,0 +1,81 @@
+/* NVClock 0.8 - Linux overclocker for NVIDIA cards
+ * 
+ * Copyright(C) 2001-2007 Roderick Colenbrander
+ *
+ * site: http://nvclock.sourceforge.net
+ *
+ * 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-1307, USA
+ */
+
+/* PCI stuff */
+#define PCI_VENDOR_ID 0x0 /* 16-bit */
+#define PCI_DEVICE_ID 0x2 /* 16-bit */
+#define PCI_CAPABILITY_LIST 0x34
+#define PCI_CAP_LIST_ID 0x0
+#define PCI_CAP_LIST_NEXT 0x1
+#define PCI_CAP_ID_AGP 0x2 /* AGP */
+#define PCI_AGP_STATUS 0x4
+# define PCI_AGP_STATUS_SBA 0x200  /* Sideband Addressing */
+# define PCI_AGP_STATUS_64BIT 0x20
+# define PCI_AGP_STATUS_FW 0x10  /* Fast Writes */
+# define PCI_AGP_STATUS_RATE_8X_SUPPORT 0x8 /* If set AGP1x/AGP2x need to be interpreted as AGP4x/AGP8x */
+# define PCI_AGP_STATUS_RATE_8X_SHIFT 0x2 /* Needs to be used when 8x support is enabled to translate 1x/ -> 4x/8x*/
+# define PCI_AGP_STATUS_RATE_4X 0x4
+# define PCI_AGP_STATUS_RATE_2X 0x2
+# define PCI_AGP_STATUS_RATE_1X 0x1
+# define PCI_AGP_STATUS_RATE_MASK 0x7 /* AGP4X | AGP2X | AGP1X */
+#define PCI_AGP_COMMAND 0x8
+# define PCI_AGP_COMMAND_SBA 0x200  /* Sideband Addressing */
+# define PCI_AGP_COMMAND_AGP 0x100  /* Tells if AGP is enabled */
+# define PCI_AGP_COMMAND_64BIT 0x20
+# define PCI_AGP_COMMAND_FW 0x10  /* Fast Writes */
+# define PCI_AGP_COMMAND_RATE_4X 0x4
+# define PCI_AGP_COMMAND_RATE_2X 0x2
+# define PCI_AGP_COMMAND_RATE_1X 0x1
+# define PCI_AGP_COMMAND_RATE_MASK 0x7 /* AGP4X | AGP2X | AGP1X */
+#define PCI_CAP_ID_EXP 0x10 /* PCI-Express */
+#define PCIE_LINKCAP 0xc
+#define PCIE_LINKCONTROL 0x10
+#define PCIE_LINKSTATUS 0x12
+# define PCIE_LINK_SPEED_MASK 0x3f0
+# define PCIE_LINK_SPEED_SHIFT 4
+
+/* PMC */
+#define NV_PMC_BOOT_0 0x0
+# define NV_PMC_BOOT_0_REVISION_MINOR 0xf
+# define NV_PMC_BOOT_0_REVISION_MAJOR 0xf0 /* in general A or B, on pre-NV10 it was different */
+# define NV_PMC_BOOT_0_REVISION_MASK 0xff
+
+/* NV4X registers
+*
+*  0xc040: used to enble/disable parts of the GPU?
+*   bit1:0, enable/disable PLL 0x4000/0x4004; perhaps one bit is enable and the other a PLL layout switch?
+*   bit3:2, ??
+*   bit5:4, seems similar to bit1:0, perhaps for a VPLL? but in various cases it is equal to bit1:0
+*   bit7:6, ??
+*   bit9:8,  seems similar to bit1:0, perhaps for a VPLL? but in various cases it is equal to bit1:0
+*   bit11:10, seems related to 0x4030/0x4034 (??)
+*   bit12:13, ??
+*   bit15:14, seems related to 0x4020/0x4024; perhaps it is for all MPLL ones? (what about bit11:10 then?)
+*   bit17:16, seems related to 0x680508/0x680578 (primary VPLL)
+*   bit29:28, seems to be off when dumping bios
+*/
+
+/* NV5x registers
+*
+*  The following register is around again but much more bits are used, so start a new description
+*  0xc040: used to enable/disable parts of the GPU
+*   bit21:20, used to enable/disable PLL 0x4008/0x400c (gpu clock)
+*/

Modified: packages/nvclock/branches/upstream/current/src/backend/overclock.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/overclock.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/overclock.c (original)
+++ packages/nvclock/branches/upstream/current/src/backend/overclock.c Sat Jan  5 20:47:40 2008
@@ -21,9 +21,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include "nvclock.h"
 #include "backend.h"
-
 
 static int CalcSpeed(int base_freq, int m, int n, int p)
 {
@@ -34,7 +32,7 @@
 float GetClock(int base_freq, unsigned int pll)
 {
 	int m, n, p;
-    
+
 	m = pll & 0xff;
 	n = (pll >> 8) & 0xff;
 	p = (pll >> 16) & 0x0f;
@@ -76,23 +74,23 @@
 	}
 	if(clockIn > 340000)
 	{
-	/* When DDR memory is used we should perhaps force mhigh to 1, since
-	* on some cards the framebuffer needs to be reinitialized and image corruption
-	* can occur.
- 	*/
+		/* When DDR memory is used we should perhaps force mhigh to 1, since
+		* on some cards the framebuffer needs to be reinitialized and image corruption
+		* can occur.
+ 		*/
 		mlow = 1;
 		mhigh = 2;
 		nlow = 14;
 		nhigh = 93;
 	}
-    
+
 	/* postdivider locking to improve stability.
 	* in the near future we will provide some tuning options for the
 	* overclocking algorithm which will extend this.
 	*/
 	plow = (*PLL >> 16) & 0x0f;
 	phigh = (*PLL >> 16) & 0x0f;
-    
+
 	/*
 	Calculate the m and n values. There are a lot of values which give the same speed;
 	We choose the speed for which the difference with the request speed is as small as possible.
@@ -277,6 +275,23 @@
 	nv_card->reset_gpu_speed = reset_gpu_speed;
 	nv_card->reset_memory_speed = reset_memory_speed;
 
+	/* Register I2C busses for hardware monitoring purposes */
+	if(nv_card->busses[0] == NULL)
+	{
+		nv_card->num_busses = 2;
+		nv_card->busses[0] = NV_I2CCreateBusPtr("BUS0", 0x3e); /* available on riva128 and higher */
+		nv_card->busses[1] = NV_I2CCreateBusPtr("BUS1", 0x36); /* available on rivatnt hardware and  higher */
+
+		/* There's an extra bus available on geforce4mx/ti, geforcefx and geforce6 cards.
+		/  The check below looks for geforce4mx/geforcefx/geforce6 architecture.
+		*/
+		if(nv_card->arch & (NV17 | NV25 | NV3X | NV4X))
+		{
+			nv_card->num_busses = 3;
+			nv_card->busses[2] = NV_I2CCreateBusPtr("BUS2", 0x50); 
+		}
+	}
+
 	/* Mobile GPU check; we don't want to overclock those unless the user wants it */
 	if(nv_card->gpu == MOBILE)
 	{
@@ -300,6 +315,9 @@
 	nv_card->memclk_max = (short)(memclk * 1.5);
 	nv_card->nvclk_min = (short)(nvclk * .75);
 	nv_card->nvclk_max = (short)(nvclk * 1.5);
+
+	/* Find out what memory is being used */
+	nv_card->mem_type = (nv_card->PFB[0x200/4] & 0x01) ? DDR : SDR;
 	
 	/* Hack.
 	* Nvidia was so nice to ship support both DDR and SDR memory on some gf2mx and gf4mx cards :(

Added: packages/nvclock/branches/upstream/current/src/backend/utils.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/backend/utils.c?rev=342&op=file
==============================================================================
--- packages/nvclock/branches/upstream/current/src/backend/utils.c (added)
+++ packages/nvclock/branches/upstream/current/src/backend/utils.c Sat Jan  5 20:47:40 2008
@@ -1,0 +1,77 @@
+/* NVClock 0.8 - Linux overclocker for NVIDIA cards
+ *
+ * site: http://nvclock.sourceforge.net
+ *
+ * Copyright(C) 2001-2007 Roderick Colenbrander
+ *
+ * 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-1307, USA
+ */
+
+#include <stdio.h>
+
+/* Convert the gpu architecture to a string using NVxx/Gxx naming */
+int convert_gpu_architecture(short arch, char *buf)
+{
+	if(!buf)
+		return 0;
+
+	switch(arch)
+	{
+		case 0x46:
+			sprintf(buf, "NV46/G72"); /* 7300 */
+			break;
+		case 0x47:
+			sprintf(buf, "NV47/G70"); /* 7800 */
+			break;
+		case 0x49:
+			sprintf(buf, "NV49/G71"); /* 7900 */
+			break;
+		case 0x4b:
+			sprintf(buf, "NV4B/G73"); /* 7600 */
+			break;
+		case 0x4c: /* is this correct also a C51? */
+		case 0x4e:
+			sprintf(buf, "C51"); /* Geforce 6x00 nForce */
+			break;
+		// sprintf(buf, "C68"); /* Geforce 70xx nForce */ 
+		case 0x50:
+			sprintf(buf, "NV50/G80"); /* 8800 */
+			break;
+		default:
+			if(arch <= 0x44) /* The NV44/6200TC is the last card with only an NV name */
+				sprintf(buf, "NV%X", arch);
+			else /* Use Gxx for anything else */
+				sprintf(buf, "G%X", arch);
+	}
+	return 1;
+}
+
+/* Convert a mask containing enabled/disabled pipelines for nv4x cards
+/  to a binary string.
+*/
+void convert_unit_mask_to_binary(char mask, char hw_default, char *buf)
+{
+	int i, len;
+
+	/* Count the number of pipelines on the card */
+	for(i=0, len=0; i<8; i++)
+		len += (hw_default & (1<<i)) ? 1 : 0;
+
+	for(i=0; i<len; i++)
+	{
+		buf[i] = (mask & (1<<(len-i-1))) ? '1' : '0';
+	}
+	buf[len] = 0;
+}

Modified: packages/nvclock/branches/upstream/current/src/gtk/CVS/Entries
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/gtk/CVS/Entries?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/gtk/CVS/Entries (original)
+++ packages/nvclock/branches/upstream/current/src/gtk/CVS/Entries Sat Jan  5 20:47:40 2008
@@ -4,12 +4,12 @@
 /banner.h/1.3/Sat Dec 10 20:47:25 2005//
 /banner_gl.h/1.2/Mon Aug 29 11:47:55 2005//
 /banner_hw.h/1.2/Mon Aug 29 11:47:55 2005//
-/gl.c/1.15/Sat Jan 28 19:45:25 2006//
-/gl.h/1.10/Sat Jan 28 19:45:25 2006//
 /interface.h/1.9/Sat Dec 10 20:47:26 2005//
 /settings.c/1.6/Sat Dec 10 20:47:26 2005//
 /settings.h/1.4/Sat Dec 10 20:47:26 2005//
-/hw.h/1.17/Mon Jul 31 13:20:23 2006//
-/hw.c/1.46/Mon Jul 31 15:18:44 2006//
-/main.c/1.21/Mon Jul 31 16:35:58 2006//
+/gl.c/1.18/Thu Jan  3 20:08:44 2008//
+/gl.h/1.11/Thu Jan  3 20:08:44 2008//
+/hw.c/1.51/Thu Jan  3 20:08:44 2008//
+/hw.h/1.18/Thu Jan  3 20:08:44 2008//
+/main.c/1.23/Fri Jan  4 17:32:38 2008//
 D

Modified: packages/nvclock/branches/upstream/current/src/gtk/gl.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/gtk/gl.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/gtk/gl.c (original)
+++ packages/nvclock/branches/upstream/current/src/gtk/gl.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  *
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://NVClock.sourceforge.net
  *
@@ -318,6 +318,13 @@
 	return 0;
 }
 
+void aa_line_gamma_set_value(GtkToggleButton *button, GtkWidget *widget)
+{
+	int value =  gtk_toggle_button_get_active(button);
+	NVGlGeneral *general = NV_GLGENERAL(widget);
+
+	GLSetAttribute(general->conf, general->dpy, 0, 0, NV_OPENGL_AA_LINE_GAMMA, value);
+}
 
 void generic_cpu_set_value(GtkToggleButton *button, GtkWidget *widget)
 {
@@ -446,7 +453,7 @@
 	gtk_container_add(GTK_CONTAINER(opengl->frm_glx), opengl->tbl_glx);
 	gtk_box_pack_start(GTK_BOX(opengl), opengl->frm_glx, FALSE, FALSE, 0);
 
-	opengl->lbl_glx_vendor = gtk_label_new("Vendor");
+	opengl->lbl_glx_vendor = gtk_label_new("Vendor:");
 	gtk_misc_set_alignment (GTK_MISC (opengl->lbl_glx_vendor), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(opengl->tbl_glx), GTK_WIDGET(opengl->lbl_glx_vendor), 0, 1, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -455,7 +462,7 @@
 	gtk_table_attach (GTK_TABLE(opengl->tbl_glx), GTK_WIDGET(opengl->lbl_glx_vendor_txt), 1, 2, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	opengl->lbl_glx_version = gtk_label_new("Version");
+	opengl->lbl_glx_version = gtk_label_new("Version:");
 	gtk_misc_set_alignment (GTK_MISC (opengl->lbl_glx_version), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(opengl->tbl_glx), GTK_WIDGET(opengl->lbl_glx_version), 0, 1, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -464,7 +471,7 @@
 	gtk_table_attach (GTK_TABLE(opengl->tbl_glx), GTK_WIDGET(opengl->lbl_glx_version_txt), 1, 2, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	opengl->lbl_glx_dri = gtk_label_new("Direct rendering");
+	opengl->lbl_glx_dri = gtk_label_new("Direct rendering:");
 	gtk_misc_set_alignment (GTK_MISC (opengl->lbl_glx_dri), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(opengl->tbl_glx), GTK_WIDGET(opengl->lbl_glx_dri), 0, 1, 2, 3,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -480,7 +487,7 @@
 	gtk_container_add(GTK_CONTAINER(opengl->frm_gl), opengl->tbl_gl);
 	gtk_box_pack_start(GTK_BOX(opengl), opengl->frm_gl, FALSE, FALSE, 0);
 
-	opengl->lbl_gl_vendor = gtk_label_new("Vendor");
+	opengl->lbl_gl_vendor = gtk_label_new("Vendor:");
 	gtk_misc_set_alignment (GTK_MISC (opengl->lbl_gl_vendor), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(opengl->tbl_gl), GTK_WIDGET(opengl->lbl_gl_vendor), 0, 1, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -489,7 +496,7 @@
 	gtk_table_attach (GTK_TABLE(opengl->tbl_gl), GTK_WIDGET(opengl->lbl_gl_vendor_txt), 1, 2, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	opengl->lbl_gl_renderer = gtk_label_new("Renderer");
+	opengl->lbl_gl_renderer = gtk_label_new("Renderer:");
 	gtk_misc_set_alignment (GTK_MISC (opengl->lbl_gl_renderer), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(opengl->tbl_gl), GTK_WIDGET(opengl->lbl_gl_renderer), 0, 1, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -498,7 +505,7 @@
 	gtk_table_attach (GTK_TABLE(opengl->tbl_gl), GTK_WIDGET(opengl->lbl_gl_renderer_txt), 1, 2, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	opengl->lbl_gl_version = gtk_label_new("Version");
+	opengl->lbl_gl_version = gtk_label_new("Version:");
 	gtk_misc_set_alignment (GTK_MISC (opengl->lbl_gl_version), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(opengl->tbl_gl), GTK_WIDGET(opengl->lbl_gl_version), 0, 1, 2, 3,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -560,6 +567,14 @@
 		gtk_box_pack_start(GTK_BOX(vbox), general->chk_generic_cpu, FALSE, FALSE, 0);
 
 		gtk_tooltips_set_tip (GTK_TOOLTIPS (general->tips), general->chk_generic_cpu, "When enabled cpu optimizations like MMX, 3dnow! and SSE will be disabled. Disabling this option reduces performance but helps applications like Valgrind which is a memory debugger.", NULL);
+	}
+
+	if(GLGetAttribute(conf, dpy, 0, 0, NV_OPENGL_AA_LINE_GAMMA, &val))
+	{
+		general->chk_aa_line_gamma = gtk_check_button_new_with_label("Enable gamma correction for antialiased lines");
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(general->chk_aa_line_gamma), val);
+		g_signal_connect(GTK_TOGGLE_BUTTON(general->chk_aa_line_gamma), "toggled", G_CALLBACK (aa_line_gamma_set_value), general);
+		gtk_box_pack_start(GTK_BOX(vbox), general->chk_aa_line_gamma, FALSE, FALSE, 0);
 	}
 
 	if(GLGetAttribute(conf, dpy, 0, 0, NV_TEXTURE_CLAMPING, &val))
@@ -664,7 +679,7 @@
 
 		NVGetValidAttributeValues(dpy, 0, 0, NV_FSAA, &res);
 		quality->fsaa_entries=0;
-		for(i=n=0; i<10; i++)
+		for(i=n=0; i<=NV_FSAA_MODE_MAX; i++)
 		{
 			if((res->data1 >> i) & 0x1)
 			{
@@ -672,10 +687,15 @@
 				/  Unfortunately the option 8xS was added to the NV-CONTROL
 				/  extension some time after 16x. Because of this we need to do some swapping.
 				*/
-				if((i == 9) && (quality->fsaa_lst[n-1] == 8))
+				if((i == NV_FSAA_MODE_8xS) && (quality->fsaa_lst[n-1] == NV_FSAA_MODE_16x))
 				{
-					quality->fsaa_lst[n] = 8;
-					quality->fsaa_lst[n-1] = 9;
+					quality->fsaa_lst[n] = NV_FSAA_MODE_16x;
+					quality->fsaa_lst[n-1] = NV_FSAA_MODE_8xS;
+				}
+				else if((i == NV_FSAA_MODE_8xQ) && (quality->fsaa_lst[n-1] == NV_FSAA_MODE_16x))
+				{
+					quality->fsaa_lst[n] = NV_FSAA_MODE_16x;
+					quality->fsaa_lst[n-1] = NV_FSAA_MODE_8xQ;
 				}
 				else
 					quality->fsaa_lst[n] = i;
@@ -771,14 +791,14 @@
 		switch(nvevent->option)
 		{
 			case NV_FLIPPING_ALLOWED:
-				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_flipping, flipping_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_flipping, flipping_set_value, NV_GLGENERAL(opengl->general));
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLGENERAL(opengl->general)->chk_flipping), nvevent->value);
-				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_flipping, flipping_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_flipping, flipping_set_value, NV_GLGENERAL(opengl->general));
 				break;
 			case NV_FORCE_GENERIC_CPU:
-				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_generic_cpu, generic_cpu_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_generic_cpu, generic_cpu_set_value, NV_GLGENERAL(opengl->general));
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLGENERAL(opengl->general)->chk_generic_cpu), nvevent->value);
-				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_generic_cpu, generic_cpu_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_generic_cpu, generic_cpu_set_value, NV_GLGENERAL(opengl->general));
 				break;
 			case NV_FSAA:
 				g_signal_handlers_block_by_func(NV_GLQUALITY(opengl->quality)->scale_fsaa, fsaa_set_value, NV_GLQUALITY(opengl->quality));
@@ -805,20 +825,25 @@
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLQUALITY(opengl->quality)->chk_aniso_app_control), nvevent->value);
 				g_signal_handlers_unblock_by_func(NV_GLQUALITY(opengl->quality)->chk_aniso_app_control, aniso_set_app_controlled, NV_GLQUALITY(opengl->quality));
 				break;
+			case NV_OPENGL_AA_LINE_GAMMA:
+				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_aa_line_gamma, aa_line_gamma_set_value, NV_GLGENERAL(opengl->general));
+				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLGENERAL(opengl->general)->chk_aa_line_gamma), nvevent->value);
+				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_aa_line_gamma, aa_line_gamma_set_value, NV_GLGENERAL(opengl->general));
+				break;
 			case NV_SYNC_VBLANK:
-				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_vsync, vsync_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_vsync, vsync_set_value, NV_GLGENERAL(opengl->general));
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLGENERAL(opengl->general)->chk_vsync), nvevent->value);
-				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_vsync, vsync_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_vsync, vsync_set_value, NV_GLGENERAL(opengl->general));
 				break;
 			case NV_SHOW_SLI_HUD:
-				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_slihud, slihud_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_slihud, slihud_set_value, NV_GLGENERAL(opengl->general));
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLGENERAL(opengl->general)->chk_slihud), nvevent->value);
-				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_slihud, slihud_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_slihud, slihud_set_value, NV_GLGENERAL(opengl->general));
 				break;
 			case NV_TEXTURE_CLAMPING:
-				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_tex_clamping, tex_clamping_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_block_by_func(NV_GLGENERAL(opengl->general)->chk_tex_clamping, tex_clamping_set_value, NV_GLGENERAL(opengl->general));
 				gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(NV_GLGENERAL(opengl->general)->chk_tex_clamping), nvevent->value);
-				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_generic_cpu, tex_clamping_set_value, NV_GLQUALITY(opengl->quality));
+				g_signal_handlers_unblock_by_func(NV_GLGENERAL(opengl->general)->chk_generic_cpu, tex_clamping_set_value, NV_GLGENERAL(opengl->general));
 				break;
 			case NV_TEXTURE_SHARPEN:
 				g_signal_handlers_block_by_func(NV_GLQUALITY(opengl->quality)->chk_tex_sharpen, tex_sharpen_set_value, NV_GLQUALITY(opengl->quality));

Modified: packages/nvclock/branches/upstream/current/src/gtk/gl.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/gtk/gl.h?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/gtk/gl.h (original)
+++ packages/nvclock/branches/upstream/current/src/gtk/gl.h Sat Jan  5 20:47:40 2008
@@ -114,6 +114,7 @@
 	config *conf;
 	GtkTooltips *tips;
 
+	GtkWidget *chk_aa_line_gamma;
 	GtkWidget *chk_generic_cpu;
 	GtkWidget *chk_flipping;
 	GtkWidget *chk_vsync;

Modified: packages/nvclock/branches/upstream/current/src/gtk/hw.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/gtk/hw.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/gtk/hw.c (original)
+++ packages/nvclock/branches/upstream/current/src/gtk/hw.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  *
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://NVClock.sourceforge.net
  *
@@ -183,6 +183,33 @@
 }
 
 
+GType nv_shader_get_type (void)
+{
+	static GType shader_type = 0;
+
+	if (!shader_type)
+	{
+		static const GTypeInfo shader_info =
+		{
+			sizeof (NVShaderClass),
+			NULL,		/* base_init */
+			NULL,		/* base_finalize */
+			NULL,
+			NULL,		/* class_finalize */
+			NULL,		/* class_data */
+			sizeof (NVShader),
+			0,		/* n_preallocs */
+			NULL		/* instance_init */
+		};
+
+		shader_type = g_type_register_static (GTK_TYPE_VBOX, "NVShader",
+			&shader_info, 0);
+	}
+
+	return shader_type;
+}
+
+
 GType nv_thermal_get_type (void)
 {
 	static GType thermal_type = 0;
@@ -275,7 +302,7 @@
 		{
 			dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, "%s", "Overclocking on Laptops is more dangerous than normal overclocking because they are more sensitive to heat.\n\nAre you sure you want to enable overclocking?");
 		}
-		else if((nv_card->arch & (NV3X | NV4X)) && nv_card->gpu == DESKTOP && !(nv_card->caps & COOLBITS_OVERCLOCKING))
+		else if((nv_card->arch & (NV3X | NV4X | NV5X)) && nv_card->gpu == DESKTOP && !(nv_card->caps & COOLBITS_OVERCLOCKING))
 		{
 			dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO, "%s", "NVClock supports GeforceFX/6/7 overclocking through a low-level backend and through the Nvidia drivers (Coolbits).\nThe low-level backend should work in all cases but can give issues if your card uses different clocks in 2D and 3D. The Coolbits backend on the other hand supports 2D/3D clocks but requires Nvidia driver 1.0-7664. The Coolbits backend can't be used on your system right now either because the driver is too old or the option isn't enabled in the X config file.\n\nAre you sure you want to use the low-level backend?");
 		}
@@ -700,7 +727,7 @@
 
 	for(i=0; i<nv_card->bios->perf_entries; i++)
 	{
-		int column = 2;
+		int column = 0;
 		gchar *nvclk, *memclk;
 		
 		if(nv_card->bios->perf_lst[i].delta)
@@ -710,7 +737,19 @@
 		memclk = g_strdup_printf("%d MHz", nv_card->bios->perf_lst[i].memclk);
 
 		gtk_tree_store_append(bios->store_perf, &iter, NULL);
-		gtk_tree_store_set(bios->store_perf, &iter, 0 /* column 0 */, nvclk, 1 /* column 1 */, memclk, -1 );
+		gtk_tree_store_set(bios->store_perf, &iter, 0 /* column 0 */, nvclk, -1);
+		column++;
+
+		if(nv_card->arch & NV5X)
+		{
+			gchar *shaderclk = g_strdup_printf("%d MHz", nv_card->bios->perf_lst[i].shaderclk);
+			gtk_tree_store_set(bios->store_perf, &iter, column, shaderclk, -1 );
+			g_free(shaderclk);
+			column++;
+		}
+
+		gtk_tree_store_set(bios->store_perf, &iter, column, memclk, -1 );
+		column++;
 
 		if(nv_card->bios->volt_entries)
 		{
@@ -731,9 +770,9 @@
 	}
 
 	if(nv_card->bios->volt_entries)
-		gtk_label_set_label(GTK_LABEL(bios->lbl_volt), "Voltage Levels");
-
-	for(i=0; i<nv_card->bios->perf_entries; i++)
+		gtk_label_set_label(GTK_LABEL(bios->lbl_volt), "Voltage Levels:");
+
+	for(i=0; i<nv_card->bios->volt_entries; i++)
 	{
 		gchar *voltage, *vid;
 		
@@ -868,12 +907,12 @@
 	int i;
 	GtkTreeIter iter;
 
-	mask = nv_card->get_default_mask();
-	if(nv_card->get_hw_masked_units(&pmask, &vmask, 1))
+	mask = nv_card->get_default_mask(&pmask, &vmask);
+	if(nv_card->get_hw_masked_units(&pmask, &vmask))
 		hw_masked = (vmask << 8) | pmask;
 
-	punits = nv_card->get_pixel_pipelines(&pmask, 1, &total);
-	units = g_strdup_printf("Pixel: %dx%d\tVertex: %dx1", total, punits, nv_card->get_vertex_pipelines(&vmask, 1));
+	punits = nv_card->get_pixel_pipelines(&pmask, &total);
+	units = g_strdup_printf("Pixel: %dx%d\tVertex: %dx1", total, punits, nv_card->get_vertex_pipelines(&vmask));
 	gtk_label_set_text(GTK_LABEL(pipeline->lbl_pipes_txt), units);
 	g_free(units);
 
@@ -940,6 +979,32 @@
 }
 
 
+void set_shader_info(GtkWidget *widget)
+{
+	NVShader *shader = NV_SHADER(widget);
+	char *clock_txt, *config_txt, *ropunits_txt, *streamunits_txt, rmask, smask, rmask_default, smask_default;
+	short ropunits, streamunits;
+
+	clock_txt = g_strdup_printf("%0.3f MHz", nv_card->get_shader_speed());
+	gtk_label_set_text(GTK_LABEL(shader->lbl_clock_txt), clock_txt);
+	g_free(clock_txt);
+
+	streamunits = nv_card->get_stream_units(&smask, &smask_default);
+	streamunits_txt = g_strdup_printf("%d", streamunits);
+	gtk_label_set_text(GTK_LABEL(shader->lbl_streamunits_txt), streamunits_txt);
+	g_free(streamunits_txt);
+
+	ropunits = nv_card->get_rop_units(&rmask, &rmask_default);
+	ropunits_txt = g_strdup_printf("%d", ropunits);
+	gtk_label_set_text(GTK_LABEL(shader->lbl_ropunits_txt), ropunits_txt);
+	g_free(ropunits_txt);
+
+	config_txt = g_strdup_printf("0x%06X", rmask << 16 | smask);
+	gtk_label_set_text(GTK_LABEL(shader->lbl_config_txt), config_txt);
+	g_free(config_txt);
+}
+
+
 void set_thermal_info(GtkWidget *widget)
 {
 	NVThermal *thermal = NV_THERMAL(widget);
@@ -1023,7 +1088,7 @@
 	gtk_table_set_col_spacings(GTK_TABLE(agp->table), 2);
 	gtk_table_set_row_spacings(GTK_TABLE(agp->table), 3);
 
-	agp->lbl_agp = gtk_label_new("AGP Status");
+	agp->lbl_agp = gtk_label_new("AGP Status:");
 	gtk_misc_set_alignment (GTK_MISC (agp->lbl_agp), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_agp), 0, 1, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1033,7 +1098,7 @@
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_agp_txt), 1, 2, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	agp->lbl_agprate = gtk_label_new("AGP rate");
+	agp->lbl_agprate = gtk_label_new("AGP rate:");
 	gtk_misc_set_alignment (GTK_MISC (agp->lbl_agprate), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_agprate), 0, 1, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1043,7 +1108,7 @@
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_agprate_txt), 1, 2, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	agp->lbl_agprates = gtk_label_new("Supported AGP Rates");
+	agp->lbl_agprates = gtk_label_new("Supported AGP Rates:");
 	gtk_misc_set_alignment (GTK_MISC (agp->lbl_agprates), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_agprates), 0, 1, 2, 3,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1053,7 +1118,7 @@
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_agprates_txt), 1, 2, 2, 3,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	agp->lbl_fw = gtk_label_new("Fast Writes");
+	agp->lbl_fw = gtk_label_new("Fast Writes:");
 	gtk_misc_set_alignment (GTK_MISC (agp->lbl_fw), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_fw), 0, 1, 3, 4,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1063,7 +1128,7 @@
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_fw_txt), 1, 2, 3, 4,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	agp->lbl_sba = gtk_label_new("Sideband Addressing");
+	agp->lbl_sba = gtk_label_new("Sideband Addressing:");
 	gtk_misc_set_alignment (GTK_MISC (agp->lbl_sba), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(agp->table), GTK_WIDGET(agp->lbl_sba), 0, 1, 4, 5,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1084,7 +1149,7 @@
 
 GtkWidget* nv_bios_new (NVCard *card)
 {
-	int column = 2;
+	int column = 0;
 	NVBios *bios = g_object_new (NV_TYPE_BIOS, NULL);
 	bios->table = gtk_table_new(3,2, FALSE);
 
@@ -1094,7 +1159,7 @@
 	bios->frame = gtk_frame_new("VideoBios Information");
 	gtk_container_add(GTK_CONTAINER(bios->frame), bios->table);
 
-	bios->lbl_signonmsg = gtk_label_new("Title");
+	bios->lbl_signonmsg = gtk_label_new("Title:");
 	gtk_misc_set_alignment (GTK_MISC (bios->lbl_signonmsg), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(bios->table), GTK_WIDGET(bios->lbl_signonmsg), 0, 1, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1104,14 +1169,14 @@
 	gtk_table_attach (GTK_TABLE(bios->table), GTK_WIDGET(bios->lbl_signonmsg_txt), 1, 2, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	bios->lbl_perf = gtk_label_new("Perf. Levels");
+	bios->lbl_perf = gtk_label_new("Perf. Levels:");
 	gtk_misc_set_alignment (GTK_MISC (bios->lbl_perf), 0.02, 0);
 	gtk_table_attach (GTK_TABLE(bios->table), GTK_WIDGET(bios->lbl_perf), 0, 1, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
 	/* Create a treeview for storing the performance table */
 	bios->tree_view_perf = gtk_tree_view_new();
-	bios->store_perf = gtk_tree_store_new(N_PIPE_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
+	bios->store_perf = gtk_tree_store_new(5, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING );
 	gtk_tree_view_set_model(GTK_TREE_VIEW(bios->tree_view_perf), GTK_TREE_MODEL(bios->store_perf));
 
 	/* Create GPU clock column */
@@ -1119,16 +1184,30 @@
 	gtk_tree_view_column_set_title(bios->column_perf, "GPU");
 	bios->renderer_perf = gtk_cell_renderer_text_new();
 	gtk_tree_view_column_pack_start(bios->column_perf, bios->renderer_perf, FALSE);
-	gtk_tree_view_column_set_attributes(bios->column_perf, bios->renderer_perf, "text", 0, NULL);
+	gtk_tree_view_column_set_attributes(bios->column_perf, bios->renderer_perf, "text", column, NULL);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(bios->tree_view_perf), bios->column_perf);
+	column++;
+
+	/* Create Shader clock column for NV5x */
+	if(card->arch & NV5X)
+	{
+		bios->column_perf = gtk_tree_view_column_new();
+		gtk_tree_view_column_set_title(bios->column_perf, "Shader");
+		bios->renderer_perf = gtk_cell_renderer_text_new();
+		gtk_tree_view_column_pack_start(bios->column_perf, bios->renderer_perf, FALSE);
+		gtk_tree_view_column_set_attributes(bios->column_perf, bios->renderer_perf, "text", column, NULL);
+		gtk_tree_view_append_column(GTK_TREE_VIEW(bios->tree_view_perf), bios->column_perf);
+		column++;
+	}
 
 	/* Create Memory clock column */
 	bios->column_perf = gtk_tree_view_column_new();
 	gtk_tree_view_column_set_title(bios->column_perf, "Memory");
 	bios->renderer_perf = gtk_cell_renderer_text_new();
 	gtk_tree_view_column_pack_start(bios->column_perf, bios->renderer_perf, FALSE);
-	gtk_tree_view_column_set_attributes(bios->column_perf, bios->renderer_perf, "text", 1, NULL);
+	gtk_tree_view_column_set_attributes(bios->column_perf, bios->renderer_perf, "text", column, NULL);
 	gtk_tree_view_append_column(GTK_TREE_VIEW(bios->tree_view_perf), bios->column_perf);
+	column++;
 
 	/* Create GPU Voltage column if the bios contains voltage entires*/
 	if(card->bios->volt_entries)
@@ -1211,7 +1290,7 @@
 	gtk_table_set_col_spacings(GTK_TABLE(info->table), 2);
 	gtk_table_set_row_spacings(GTK_TABLE(info->table), 3);
 
-	info->lbl_gpu = gtk_label_new("Graphics Processor");
+	info->lbl_gpu = gtk_label_new("Graphics Processor:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_gpu), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_gpu), 0, 1, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1221,7 +1300,7 @@
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_gpu_txt), 1, 2, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	info->lbl_arch = gtk_label_new("Architecture");
+	info->lbl_arch = gtk_label_new("Architecture:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_arch), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_arch), 0, 1, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1231,7 +1310,7 @@
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_arch_txt), 1, 2, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	info->lbl_bios = gtk_label_new("Bios Version");
+	info->lbl_bios = gtk_label_new("Bios Version:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_bios), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_bios), 0, 1, 2, 3,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1241,7 +1320,7 @@
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_bios_txt), 1, 2, 2, 3,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	info->lbl_bustype = gtk_label_new("Bus Type");
+	info->lbl_bustype = gtk_label_new("Bus Type:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_bustype), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_bustype), 0, 1, 3, 4,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1251,7 +1330,7 @@
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_bustype_txt), 1, 2, 3, 4,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	info->lbl_vidmem = gtk_label_new("Video Memory");
+	info->lbl_vidmem = gtk_label_new("Video Memory:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_vidmem), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_vidmem), 0, 1, 4, 5,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1261,7 +1340,7 @@
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_vidmem_txt), 1, 2, 4, 5,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	info->lbl_memtype = gtk_label_new("Memory Type");
+	info->lbl_memtype = gtk_label_new("Memory Type:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_memtype), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_memtype), 0, 1, 5, 6,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1271,7 +1350,7 @@
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_memtype_txt), 1, 2, 5, 6,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	info->lbl_irq = gtk_label_new("IRQ");
+	info->lbl_irq = gtk_label_new("IRQ:");
 	gtk_misc_set_alignment (GTK_MISC (info->lbl_irq), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(info->table), GTK_WIDGET(info->lbl_irq), 0, 1, 6, 7,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1410,7 +1489,7 @@
 	gtk_table_set_row_spacings(GTK_TABLE(pipeline->table), 3);
 	gtk_container_add(GTK_CONTAINER(pipeline->frame), pipeline->table);
 
-	pipeline->lbl_pipes = gtk_label_new("Active units");
+	pipeline->lbl_pipes = gtk_label_new("Active units:");
 	gtk_misc_set_alignment (GTK_MISC (pipeline->lbl_pipes), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(pipeline->table), GTK_WIDGET(pipeline->lbl_pipes), 0, 1, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1420,7 +1499,7 @@
 	gtk_table_attach (GTK_TABLE(pipeline->table), GTK_WIDGET(pipeline->lbl_pipes_txt), 1, 2, 0, 1,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
 
-	pipeline->lbl_config = gtk_label_new("Configuration");
+	pipeline->lbl_config = gtk_label_new("Configuration:");
 	gtk_misc_set_alignment (GTK_MISC (pipeline->lbl_config), 0.02, 0.5);
 	gtk_table_attach (GTK_TABLE(pipeline->table), GTK_WIDGET(pipeline->lbl_config), 0, 1, 1, 2,
 		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
@@ -1479,6 +1558,66 @@
 }
 
 
+GtkWidget *nv_shader_new(config *conf, NVCard *card)
+{
+	NVShader *shader = g_object_new(NV_TYPE_SHADER, NULL);
+
+	shader->frame = gtk_frame_new("Shader information");
+	gtk_box_pack_start(GTK_BOX(shader), shader->frame, FALSE, FALSE, 2);
+
+	shader->table = gtk_table_new(2,2, FALSE);
+	gtk_table_set_col_spacings(GTK_TABLE(shader->table), 2);
+	gtk_table_set_row_spacings(GTK_TABLE(shader->table), 3);
+	gtk_container_add(GTK_CONTAINER(shader->frame), shader->table);
+
+	shader->lbl_clock = gtk_label_new("Clock:");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_clock), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_clock), 0, 1, 0, 1,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_clock_txt = gtk_label_new("");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_clock_txt), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_clock_txt), 1, 2, 0, 1,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_streamunits = gtk_label_new("Stream units:");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_streamunits), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_streamunits), 0, 1, 1, 2,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_streamunits_txt = gtk_label_new("");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_streamunits_txt), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_streamunits_txt), 1, 2, 1, 2,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_ropunits = gtk_label_new("ROP units:");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_ropunits), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_ropunits), 0, 1, 2, 3,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_ropunits_txt = gtk_label_new("");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_ropunits_txt), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_ropunits_txt), 1, 2, 2, 3,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_config = gtk_label_new("Configuration:");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_config), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_config), 0, 1, 3, 4,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	shader->lbl_config_txt = gtk_label_new("");
+	gtk_misc_set_alignment (GTK_MISC (shader->lbl_config_txt), 0.02, 0.5);
+	gtk_table_attach (GTK_TABLE(shader->table), GTK_WIDGET(shader->lbl_config_txt), 1, 2, 3, 4,
+		(GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (GTK_FILL), 3, 0);
+
+	gtk_widget_show_all(GTK_WIDGET(shader));
+
+	set_shader_info(GTK_WIDGET(shader));
+
+	return GTK_WIDGET(shader);
+}
+
+
 GtkWidget *nv_thermal_new(config *conf, GtkTooltips *tips, NVCard *card)
 {
 	NVThermal *thermal = g_object_new(NV_TYPE_THERMAL, NULL);
@@ -1496,7 +1635,7 @@
 	gtk_container_add(GTK_CONTAINER(thermal->frame), thermal->vbox);
 
 	hbox = gtk_hbox_new(FALSE, 2);
-	thermal->lbl_sensor = gtk_label_new("Sensor chip ");
+	thermal->lbl_sensor = gtk_label_new("Sensor chip: ");
 	gtk_misc_set_alignment(GTK_MISC(thermal->lbl_sensor), 0.02, 0.5);
 	gtk_box_pack_start(GTK_BOX(hbox), thermal->lbl_sensor, FALSE, FALSE, 0);
 	thermal->lbl_sensor_txt = gtk_label_new("");
@@ -1634,6 +1773,9 @@
 
 		if(nv_card->arch & NV4X)
 			add(&child, &parent, "Pipelines", BANNER_HW, nv_pipeline_new(conf, &nvclock.card[i]));
+
+		if(nv_card->arch & NV5X)
+			add(&child, &parent, "Shaders", BANNER_HW, nv_shader_new(conf, &nvclock.card[i]));
 	}
 
 	return 1;

Modified: packages/nvclock/branches/upstream/current/src/gtk/hw.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/gtk/hw.h?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/gtk/hw.h (original)
+++ packages/nvclock/branches/upstream/current/src/gtk/hw.h Sat Jan  5 20:47:40 2008
@@ -65,6 +65,13 @@
 #define NV_IS_PIPELINE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), NV_TYPE_PIPELINE))
 #define NV_PIPELINE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), NV_TYPE_PIPELINE, NVPipelineClass))
 
+#define NV_TYPE_SHADER                  (nv_shader_get_type ())
+#define NV_SHADER(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), NV_TYPE_SHADER, NVShader))
+#define NV_SHADER_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), NV_TYPE_SHADER, NVShaderClass))
+#define NV_IS_SHADER(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NV_TYPE_SHADER))
+#define NV_IS_SHADER_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), NV_TYPE_SHADER))
+#define NV_SHADER_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), NV_TYPE_SHADER, NVPipelineClass))
+
 #define NV_TYPE_THERMAL                  (nv_thermal_get_type ())
 #define NV_THERMAL(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), NV_TYPE_THERMAL, NVThermal))
 #define NV_THERMAL_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), NV_TYPE_THERMAL, NVThermalClass))
@@ -94,6 +101,9 @@
 
 typedef struct _NVPipeline  NVPipeline;
 typedef struct _NVPipelineClass NVPipelineClass;
+
+typedef struct _NVShader       NVShader;
+typedef struct _NVShaderClass  NVShaderClass;
 
 typedef struct _NVThermal       NVThermal;
 typedef struct _NVThermalClass  NVThermalClass;
@@ -215,6 +225,22 @@
 	GtkTreeStore *store;
 };
 
+struct _NVShader
+{
+	GtkVBox parent;
+
+	GtkWidget *frame;
+	GtkWidget *table;
+	GtkWidget *lbl_clock;
+	GtkWidget *lbl_clock_txt;
+	GtkWidget *lbl_streamunits;
+	GtkWidget *lbl_streamunits_txt;
+	GtkWidget *lbl_ropunits;
+	GtkWidget *lbl_ropunits_txt;
+	GtkWidget *lbl_config;
+	GtkWidget *lbl_config_txt;
+};
+
 struct _NVThermal
 {
 	GtkVBox parent;
@@ -276,6 +302,11 @@
 	GtkVBoxClass parent_class;
 };
 
+struct _NVShaderClass
+{
+	GtkVBoxClass parent_class;
+};
+
 struct _NVThermalClass
 {
 	GtkVBoxClass parent_class;
@@ -296,5 +327,8 @@
 GType      nv_pipeline_get_type   (void) G_GNUC_CONST;
 GtkWidget* nv_pipeline_new        (config *conf, NVCard *card);
 
+GType      nv_shader_get_type   (void) G_GNUC_CONST;
+GtkWidget* nv_shader_new        (config *conf, NVCard *card);
+
 GType      nv_thermal_get_type   (void) G_GNUC_CONST;
 GtkWidget* nv_thermal_new     (config *conf, GtkTooltips *tips, NVCard *card);

Modified: packages/nvclock/branches/upstream/current/src/gtk/main.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/gtk/main.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/gtk/main.c (original)
+++ packages/nvclock/branches/upstream/current/src/gtk/main.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  *
- * Copyright(C) 2001-2005 Roderick Colenbrander
+ * Copyright(C) 2001-2008 Roderick Colenbrander
  *
  * site: http://NVClock.sourceforge.net
  *
@@ -58,7 +58,7 @@
 
 	window_nvclock = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 	gtk_window_set_default_size(GTK_WINDOW(window_nvclock), 540, 280);
-	gtk_window_set_title(GTK_WINDOW(window_nvclock), "NVClock 0.8 (Beta2)");
+	gtk_window_set_title(GTK_WINDOW(window_nvclock), "NVClock 0.8 (Beta3)");
 
 	main_window = (struct MainWindow*)calloc(1, sizeof(struct MainWindow));
 

Modified: packages/nvclock/branches/upstream/current/src/nvclock.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/nvclock.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/nvclock.c (original)
+++ packages/nvclock/branches/upstream/current/src/nvclock.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  *
- * Copyright(C) 2001-2006 Roderick Colenbrander
+ * Copyright(C) 2001-2008 Roderick Colenbrander
  *
  * site: http://NVClock.sourceforge.net
  *
@@ -61,11 +61,11 @@
 
 int usage()
 {
-	printf("NVClock v0.8 (Beta2)\n\n");
+	printf("NVClock v0.8 (Beta3)\n\n");
 	printf("Using NVClock you can overclock your Nvidia videocard under Linux and FreeBSD.\nUse this program at your own risk, because it can damage your system!\n\n");
 	printf("Usage: ./nvclock [options]\n\n");
 	printf("Overclock options:\n");
-	printf("   -b  --backend backend\tBackend to use: coolbits/coolbits2d/coolbits3d/lowlevel (NV3X/NV4X only)\n");
+	printf("   -b  --backend backend\tBackend to use: coolbits/coolbits2d/coolbits3d/lowlevel (NV3X/NV4X/NV5X only)\n");
 	printf("   -m  --memclk speed\t\tMemory clock in MHz\n");
 	printf("   -n  --nvclk speed\t\tGPU clock in MHz\n");
 	printf("   -r  --reset\t\t\tRestore the original speeds\n");
@@ -347,7 +347,7 @@
 	{
 		int i;
 		printf("Supported values are:");
-		for(i=0; i <= 10; i++)
+		for(i=0; i <= 13; i++)
 		{
 			if((res->data1 >> i) & 0x1)
 			{
@@ -540,76 +540,6 @@
 }
 
 
-/* Print various GPU registers for debugging purposes */
-void print_debug_info()
-{
-	printf("--- %s GPU registers ---\n", nv_card->card_name);
-	printf("NV_PMC_BOOT_0 (0x0): %08x\n", nv_card->PMC[0]);
-	printf("NV_PBUS_DEBUG_0 (0x1080): %08x\n", nv_card->PMC[0x1080/4]);
-	printf("NV_PBUS_DEBUG_1 (0x1084): %08x\n", nv_card->PMC[0x1084/4]);
-	printf("NV_PBUS_DEBUG_2 (0x1088): %08x\n", nv_card->PMC[0x1088/4]);
-	printf("NV_PBUS_DEBUG_3 (0x108c): %08x\n", nv_card->PMC[0x108c/4]);
-	printf("NV_10F0 (0x10f0): %08x\n", nv_card->PMC[0x10f0/4]);
-	printf("NV_1540 (0x1540): %08x\n", nv_card->PMC[0x1540/4]);
-	printf("NV_15B0 (0x15b0): %08x\n", nv_card->PMC[0x15b0/4]);
-	printf("NV_15B4 (0x15b4): %08x\n", nv_card->PMC[0x15b4/4]);
-	printf("NV_15B8 (0x15b8): %08x\n", nv_card->PMC[0x15b8/4]);
-	printf("NV_15F0 (0x15f0): %08x\n", nv_card->PMC[0x15f0/4]);
-	printf("NV_15F4 (0x15f4): %08x\n", nv_card->PMC[0x15f4/4]);
-	printf("NV_15F8 (0x15f8): %08x\n", nv_card->PMC[0x15f8/4]);
-	printf("NV_PBUS_PCI_0 (0x1800): %08x\n", nv_card->PMC[0x1800/4]);
-
-	if(nv_card->arch & NV4X)
-	{
-		printf("NV_C010 (0xc010): %08x\n", nv_card->PMC[0xc010/4]);
-		printf("NV_C014 (0xc014): %08x\n", nv_card->PMC[0xc014/4]);
-		printf("NV_C018 (0xc018): %08x\n", nv_card->PMC[0xc018/4]);
-		printf("NV_C01C (0xc01c): %08x\n", nv_card->PMC[0xc01c/4]);
-		printf("NV_C020 (0xc020): %08x\n", nv_card->PMC[0xc020/4]);
-		printf("NV_C024 (0xc024): %08x\n", nv_card->PMC[0xc024/4]);
-		printf("NV_C028 (0xc028): %08x\n", nv_card->PMC[0xc028/4]);
-		printf("NV_C02C (0xc02c): %08x\n", nv_card->PMC[0xc02c/4]);
-		printf("NV_C040 (0xc040): %08x\n", nv_card->PMC[0xc040/4]);
-		printf("NV40_NVPLL_A (0x4000): %08x\n", nv_card->PMC[0x4000/4]);
-		printf("NV40_NVPLL_B (0x4004): %08x\n", nv_card->PMC[0x4004/4]);
-		printf("NV_4008 (0x4008): %08x\n", nv_card->PMC[0x4008/4]);
-		printf("NV_400C (0x400c): %08x\n", nv_card->PMC[0x400c/4]);
-		printf("NV_4010 (0x4010): %08x\n", nv_card->PMC[0x4010/4]);
-		printf("NV_4014 (0x4014): %08x\n", nv_card->PMC[0x4014/4]);
-		printf("NV_4018 (0x4018): %08x\n", nv_card->PMC[0x4018/4]);
-		printf("NV_401C (0x401c): %08x\n", nv_card->PMC[0x401c/4]);
-		printf("NV40_MPLL_A (0x4020): %08x\n", nv_card->PMC[0x4020/4]);
-		printf("NV40_MPLL_B (0x4024): %08x\n", nv_card->PMC[0x4024/4]);
-		printf("NV_4028 (0x4028): %08x\n", nv_card->PMC[0x4028/4]);
-		printf("NV_402C (0x402c): %08x\n", nv_card->PMC[0x402c/4]);
-		printf("NV_4030 (0x4030): %08x\n", nv_card->PMC[0x4030/4]);
-		printf("NV_4034 (0x4034): %08x\n", nv_card->PMC[0x4034/4]);
-		printf("NV_4038 (0x4038): %08x\n", nv_card->PMC[0x4038/4]);
-		printf("NV_403C (0x403c): %08x\n", nv_card->PMC[0x403c/4]);
-		printf("NV_4040 (0x4040): %08x\n", nv_card->PMC[0x4040/4]);
-		printf("NV_4044 (0x4044): %08x\n", nv_card->PMC[0x4044/4]);
-		printf("NV_4048 (0x4048): %08x\n", nv_card->PMC[0x4048/4]);
-		printf("NV_404C (0x404c): %08x\n", nv_card->PMC[0x404c/4]);
-		printf("NV_4050 (0x4050): %08x\n", nv_card->PMC[0x4050/4]);
-		printf("NV_4054 (0x4054): %08x\n", nv_card->PMC[0x4054/4]);
-		printf("NV_4058 (0x4058): %08x\n", nv_card->PMC[0x4058/4]);
-		printf("NV_405C (0x405c): %08x\n", nv_card->PMC[0x405c/4]);
-		printf("NV_4060 (0x4060): %08x\n", nv_card->PMC[0x4060/4]);
-	}
-	printf("NV_PFB_CFG0 (0x100200): %08x\n", nv_card->PFB[0x200/4]);
-	printf("NV_PFB_TIMING0 (0x100220): %08x\n", nv_card->PFB[0x220/4]);
-	printf("NV_PFB_TIMING1 (0x100224): %08x\n", nv_card->PFB[0x224/4]);
-	printf("NV_PFB_TIMING2 (0x100228): %08x\n", nv_card->PFB[0x228/4]);
-	printf("NV_PEXTDEV_BOOT_0 (0x101000): %08x\n", nv_card->PEXTDEV[0x0/4]);
-	printf("NV_NVPLL_COEFF_A (0x680500): %08x\n", nv_card->PRAMDAC[0x500/4]);
-	printf("NV_MPLL_COEFF_A (0x680504): %08x\n", nv_card->PRAMDAC[0x504/4]);
-	printf("NV_VPLL_COEFF (0x680508): %08x\n", nv_card->PRAMDAC[0x508/4]);
-	printf("NV_PLL_COEFF_SELECT (0x68050c): %08x\n", nv_card->PRAMDAC[0x50c/4]);
-	printf("NV_NVPLL_COEFF_B (0x680570: %08x\n", nv_card->PRAMDAC[0x570/4]);
-	printf("NV_MPLL_COEFF_B (0x680574: %08x\n", nv_card->PRAMDAC[0x574/4]);
-}
-
-
 void unload_nvclock()
 {
 #ifdef HAVE_NVCONTROL
@@ -634,7 +564,7 @@
 	char *fanspeed = NULL;
 	char *screen = NULL;
 	char *smartdimmer = NULL;
-	unsigned char punit, vunit;
+	char punit, vunit;
 #ifdef HAVE_NVCONTROL
 	Display *dpy = NULL;
 #endif
@@ -904,11 +834,11 @@
 		return 0;
 
 #ifdef HAVE_NVCONTROL
-	/* NV3X/NV4X can use low-level access and Coolbits for overclocking.
+	/* NV3X/NV4X/NV5X can use low-level access and Coolbits for overclocking.
 	/  Coolbits is part of the NV-CONTROL extension for X and because of this
 	/  needs a X Display. The hack below does this.
 	*/
-	if(nvclock.card[0].arch & (NV3X | NV4X) && (nvclock.dpy == NULL))
+	if(nvclock.card[0].arch & (NV3X | NV4X | NV5X) && (nvclock.dpy == NULL))
 		nvclock.dpy = XOpenDisplay("");
 #endif  /* HAVE_NVCONTROL */
 
@@ -941,7 +871,10 @@
 			}
 			else
 			{
-				printf("Memory clock: \t%0.3f MHz\n", nv_card->get_memory_speed());
+				if(nv_card->gpu == NFORCE)
+					printf("Memory clock: \t-\n");
+				else
+					printf("Memory clock: \t%0.3f MHz\n", nv_card->get_memory_speed());
 				printf("GPU clock: \t%0.3f MHz\n\n", nv_card->get_gpu_speed());
 			}
 			/* Detect only the requested card */
@@ -957,38 +890,6 @@
 		char buf[80];
 		fprintf(stderr, "Error: %s\n", get_error(buf, 80));
 		return 0;
-	}
-
-	if(backend_opt)
-	{
-		if(backend == STATE_LOWLEVEL)
-			nv_card->set_state(STATE_LOWLEVEL);
-		else if((nv_card->caps & COOLBITS_OVERCLOCKING) && nvclock.dpy)
-			nv_card->set_state(backend);
-		else if(!nvclock.dpy) /* If not lowlevel then we want to use Coolbits */
-		{
-			fprintf(stderr, "Error:\n");
-			fprintf(stderr, "Can't switch to the Coolbits backend because X isn't loaded\n");
-			return 0;
-		}
-		else if(!(nv_card->arch & (NV3X | NV4X)))
-		{
-			fprintf(stderr, "Error:\n");
-			fprintf(stderr, "Can't switch to the Coolbits backend because it requires a GeforceFX/6/7 card.\n");
-			return 0;
-		}
-		else if(nv_card->gpu == MOBILE)
-		{
-			fprintf(stderr, "Error:\n");
-			fprintf(stderr, "Can't switch to the Coolbits backend because it doesn't work on Mobile GPUs.\n");
-			return 0;
-		}
-		else
-		{
-			fprintf(stderr, "Error:\n");
-			fprintf(stderr, "Can't switch to the Coolbits backend because the NV-CONTROL extension wans't found.\nThis can happen when you aren't using Nvidia driver 1.0-7676 or newer or when the option isn't enabled in the X config file.\n");
-			return 0;
-		}
 	}
 
 	/* Make NVClock work on unsupported cards and access higher speeds as requested by the user */
@@ -1015,7 +916,7 @@
 	*/
 	if(debug_opt)
 	{
-		print_debug_info();
+		nv_card->get_debug_info();
 		return 0;
 	}
 
@@ -1070,8 +971,6 @@
 				fprintf(stderr, "Error: This card doesn't support automatic fanspeed adjustments.\n");
 				return 0;
 			}
-			nv_card->set_i2c_fanspeed_mode(nv_card->sensor, 0); /* Put the sensor back in auto mode */
-			printf("New fanspeed mode: %s\n", nv_card->get_i2c_fanspeed_mode(nv_card->sensor) ? "manual" : "auto");
 		}
 		else
 		{
@@ -1086,16 +985,24 @@
 		/* First process cards with 'advanced' sensor chips */
 		if(nv_card->caps & I2C_FANSPEED_MONITORING)
 		{
-			printf("Current fanspeed: %d RPM\n", nv_card->get_i2c_fanspeed_rpm(nv_card->sensor));
-			printf("PWM duty cycle: %.1f%%\n", nv_card->get_i2c_fanspeed_pwm(nv_card->sensor));
-			printf("Changing duty cycle from %.1f to %.1f\n", nv_card->get_i2c_fanspeed_pwm(nv_card->sensor), dutycycle);
-												  /* speed is a value between 10% and 100% */
-			nv_card->set_i2c_fanspeed_pwm(nv_card->sensor, dutycycle);
-
-			/* It takes a short time for the fanspeed to change */
-			usleep(100);
-			printf("Fanspeed: %d RPM\n", nv_card->get_i2c_fanspeed_rpm(nv_card->sensor));
-			printf("New PWM duty cycle: %.1f\n", nv_card->get_i2c_fanspeed_pwm(nv_card->sensor));
+			if(strcmp(fanspeed, "auto") == 0)
+			{
+				nv_card->set_i2c_fanspeed_mode(nv_card->sensor, 0); /* Put the sensor back in auto mode */
+				printf("New fanspeed mode: %s\n", nv_card->get_i2c_fanspeed_mode(nv_card->sensor) ? "manual" : "auto");
+			}
+			else
+			{
+				printf("Current fanspeed: %d RPM\n", 	nv_card->get_i2c_fanspeed_rpm(nv_card->sensor));
+				printf("PWM duty cycle: %.1f%%\n", 	nv_card->get_i2c_fanspeed_pwm(nv_card->sensor));
+				printf("Changing duty cycle from %.1f to %.1f\n", 	nv_card->get_i2c_fanspeed_pwm(nv_card->sensor), dutycycle);
+				/* speed is a value between 10% and 100% */
+				nv_card->set_i2c_fanspeed_pwm(nv_card->sensor, dutycycle);
+
+				/* It takes a short time for the fanspeed to change */
+				usleep(100);
+				printf("Fanspeed: %d RPM\n", nv_card->get_i2c_fanspeed_rpm(nv_card->sensor));
+				printf("New PWM duty cycle: %.1f\n", nv_card->get_i2c_fanspeed_pwm(nv_card->sensor));
+			}
 		}
 		/* Various standard GeforceFX/6 also have some fanspeed monitoring support */
 		else if(nv_card->caps & GPU_FANSPEED_MONITORING)
@@ -1116,7 +1023,7 @@
 			fprintf(stderr, "If you really know what you are doing you can enable it by adding the -f switch to the nvclock command.\n");
 		}
 		else
-			fprintf(stderr, "Error: Your adjustment of the fanspeed isn't supported on your type of videocard!\n");
+			fprintf(stderr, "Error: adjustment of the fanspeed isn't supported on your type of videocard!\n");
 
 		return 0;
 	}
@@ -1127,13 +1034,13 @@
 		if(!(nv_card->caps & SMARTDIMMER))
 		{
 			fprintf(stderr, "Error!\n");
-			fprintf(stderr, "Smartdimmer is only supported on laptops using a Geforce 6200Go. If you want support on your laptop contact the author.\n");
+			fprintf(stderr, "Smartdimmer is only supported on certain laptops using a Geforce 6200/7x00Go. If you want support on your laptop contact the author.\n");
 			return 0;
 		}
 
 		if(smartdimmer[0] == '+' || smartdimmer[0] == '-')
 		{
-			brightness = nv_card->mobile_get_smartdimmer() + strtol(smartdimmer, (char**)NULL, 10);
+			brightness = nv_card->get_smartdimmer() + strtol(smartdimmer, (char**)NULL, 10);
 			if((brightness < 15) || (brightness > 100))
 			{
 				fprintf(stderr, "Error: The proposed Smartdimmer change would result in a brightness level lower than 15%% or higher than 100%%.\n");
@@ -1150,24 +1057,27 @@
 			}
 		}
 
-		printf("Changing Smartdimmer level from %d%% to %d%%\n", nv_card->mobile_get_smartdimmer(), brightness);
-		nv_card->mobile_set_smartdimmer(brightness);
-		printf("New Smartdimmer level: %d%%\n", nv_card->mobile_get_smartdimmer());
+		printf("Changing Smartdimmer level from %d%% to %d%%\n", nv_card->get_smartdimmer(), brightness);
+		nv_card->set_smartdimmer(brightness);
+		printf("New Smartdimmer level: %d%%\n", nv_card->get_smartdimmer());
 		free(smartdimmer);
 	}
 
 	if(punit_opt && (nv_card->caps & PIPELINE_MODDING) && force_opt)
 	{
-		char pmask[8], vmask[8];
+		char pmask, pmask_default, vmask, vmask_default;
+		char pmask_str[8];
 		unsigned char hw_default = 0;
 		int punits, total;
-		if(nv_card->get_sw_masked_units(pmask, vmask, 1))
-		{
-			hw_default = ~pmask[0] & nv_card->get_default_mask() & 0xff;
-		}
-		else if(nv_card->get_hw_masked_units(pmask, vmask, 1))
-		{
-			hw_default = ~pmask[0] & nv_card->get_default_mask() & 0xff;
+
+		nv_card->get_default_mask(&pmask_default, &vmask_default);
+		if(nv_card->get_sw_masked_units(&pmask, &vmask))
+		{
+			hw_default = ~pmask & pmask_default;
+		}
+		else if(nv_card->get_hw_masked_units(&pmask, &vmask))
+		{
+			hw_default = ~pmask & pmask_default;
 		}
 		else /* No locked units, so nothing left to enable */
 		{
@@ -1176,17 +1086,20 @@
 		}
 
 		/* We can't enable more pixel units then available */
-		if(punit > (nv_card->get_default_mask() & 0xff))
+		if(punit > pmask_default)
 		{
 			fprintf(stderr, "Error: Illegal mask '%x', can't enable more pixel units than your card contains ('%x')!\n", punit, hw_default);
 			return 0;
 		}
 
-		punits = nv_card->get_pixel_pipelines(pmask, 0, &total);
-		printf("Current pixel unit configuration: %dx%d (%sb)\n", total, punits, pmask);
+		punits = nv_card->get_pixel_pipelines(&pmask, &total);
+		convert_unit_mask_to_binary(pmask, pmask_default, pmask_str);
+		printf("Current pixel unit configuration: %dx%d (%sb)\n", total, punits, pmask_str);
+
 		nv_card->set_pixel_pipelines(punit);
-		punits = nv_card->get_pixel_pipelines(pmask, 0, &total);
-		printf("New pixel unit configuration: %dx%d (%sb)\n", total, punits, pmask);
+		punits = nv_card->get_pixel_pipelines(&pmask, &total);
+		convert_unit_mask_to_binary(pmask, pmask_default, pmask_str);
+		printf("New pixel unit configuration: %dx%d (%sb)\n", total, punits, pmask_str);
 	}
 	else if(punit_opt)
 	{
@@ -1206,16 +1119,19 @@
 
 	if(vunit_opt && (nv_card->caps & PIPELINE_MODDING) && force_opt)
 	{
-		char pmask[8], vmask[8];
+		char pmask, pmask_default, vmask, vmask_default;
+		char vmask_str[8];
 		unsigned char hw_default = 0;
 		int vunits;
-		if(nv_card->get_sw_masked_units(pmask, vmask, 1))
-		{
-			hw_default = ~vmask[0] & (nv_card->get_default_mask() >> 8);
-		}
-		else if(nv_card->get_hw_masked_units(pmask, vmask, 1))
-		{
-			hw_default = ~vmask[0] & (nv_card->get_default_mask() >> 8);
+
+		nv_card->get_default_mask(&pmask_default, &vmask_default);
+		if(nv_card->get_sw_masked_units(&pmask, &vmask))
+		{
+			hw_default = ~vmask & vmask_default;
+		}
+		else if(nv_card->get_hw_masked_units(&pmask, &vmask))
+		{
+			hw_default = ~vmask & vmask_default;
 		}
 		else /* No locked units, so nothing left to enable */
 		{
@@ -1224,17 +1140,20 @@
 		}
 
 		/* We can't enable more vertex units then available */
-		if(vunit > (nv_card->get_default_mask()>>8))
+		if(vunit > vmask_default)
 		{
 			fprintf(stderr, "Error: Illegal mask '%x', can't enable more vertex units than your card contains ('%x')!\n", punit, hw_default);
 			return 0;
 		}
 
-		vunits = nv_card->get_vertex_pipelines(vmask, 0);
-		printf("Current pixel unit configuration: %dx1 (%sb)\n", vunits, vmask);
+		vunits = nv_card->get_vertex_pipelines(&vmask);
+		convert_unit_mask_to_binary(vmask, vmask_default, vmask_str);
+		printf("Current pixel unit configuration: %dx1 (%sb)\n", vunits, vmask_str);
+
 		nv_card->set_vertex_pipelines(vunit);
-		vunits = nv_card->get_vertex_pipelines(vmask, 0);
-		printf("New vertex unit configuration: %dx1 (%sb)\n", vunits, vmask);
+		vunits = nv_card->get_vertex_pipelines(&vmask);
+		convert_unit_mask_to_binary(vmask, vmask_default, vmask_str);
+		printf("New vertex unit configuration: %dx1 (%sb)\n", vunits, vmask_str);
 	}
 	else if(vunit_opt)
 	{
@@ -1269,13 +1188,17 @@
 	/* Get the card information for the currently selected card */
 	if(info_opt)
 	{
-		/* In case of NV3x/NV4x boards make sure we use the low-level path */
+		char arch[10];
+
+		/* In case of NV3x/NV4x/NV5x boards make sure we use the low-level path */
 		if((nv_card->caps & COOLBITS_OVERCLOCKING)  && (nv_card->state != STATE_LOWLEVEL))
 			nv_card->set_state(STATE_LOWLEVEL);
 
 		printf("-- General info --\n");
 		printf("Card: \t\t%s\n",  nv_card->card_name);
-		printf("Architecture: \tNV%X %X\n",  nv_card->get_gpu_architecture(), nv_card->get_gpu_revision());
+		
+		convert_gpu_architecture(nv_card->get_gpu_architecture(), arch);
+		printf("Architecture: \t%s %X\n", arch, nv_card->get_gpu_revision());
 		printf("PCI id: \t0x%x\n", nv_card->device_id);
 		printf("GPU clock: \t%0.3f MHz\n", nv_card->get_gpu_speed());
 		printf("Bustype: \t%s\n\n", nv_card->get_bus_type());
@@ -1283,30 +1206,65 @@
 		/* Pipeline info is supported on NV4X cards */
 		if(nv_card->arch & NV4X)
 		{
-			char pmask[8], vmask[8];
+			char pmask, pmask_default, vmask, vmask_default;
+			char pmask_str[8], vmask_str[8];
 			int pixel_pipes, vertex_pipes, total;
 
+			nv_card->get_default_mask(&pmask_default, &vmask_default);
+
 			printf("-- Pipeline info --\n");
-			pixel_pipes = nv_card->get_pixel_pipelines(pmask, 0, &total);
-			printf("Pixel units: %dx%d (%sb)\n", pixel_pipes, total, pmask);
-			vertex_pipes = nv_card->get_vertex_pipelines(vmask, 0);
-			printf("Vertex units: %dx1 (%sb)\n", vertex_pipes, vmask);
-
-			if(nv_card->get_hw_masked_units(pmask, vmask, 0))
-				printf("HW masked units: pixel %sb vertex %sb\n", pmask, vmask);
+			pixel_pipes = nv_card->get_pixel_pipelines(&pmask, &total);
+			convert_unit_mask_to_binary(pmask, pmask_default, pmask_str);
+			printf("Pixel units: %dx%d (%sb)\n", pixel_pipes, total, pmask_str);
+			vertex_pipes = nv_card->get_vertex_pipelines(&vmask);
+			convert_unit_mask_to_binary(vmask, vmask_default, vmask_str);
+			printf("Vertex units: %dx1 (%sb)\n", vertex_pipes, vmask_str);
+
+			if(nv_card->get_hw_masked_units(&pmask, &vmask))
+			{
+				convert_unit_mask_to_binary(pmask, pmask_default, pmask_str);
+				convert_unit_mask_to_binary(vmask, vmask_default, vmask_str);
+				printf("HW masked units: pixel %sb vertex %sb\n", pmask_str, vmask_str);
+			}
 			else
 				printf("HW masked units: None\n");
 
-			if(nv_card->get_sw_masked_units(pmask, vmask, 0))
-				printf("SW masked units: pixel %sb\t vertex %sb\n\n", pmask, vmask);
+			if(nv_card->get_sw_masked_units(&pmask, &vmask))
+			{
+				convert_unit_mask_to_binary(pmask, pmask_default, pmask_str);
+				convert_unit_mask_to_binary(vmask, vmask_default, vmask_str);
+				printf("SW masked units: pixel %sb vertex %sb\n\n", pmask_str, vmask_str);
+			}
 			else
 				printf("SW masked units: None\n\n");
+		}
+
+		if(nv_card->arch & NV5X)
+		{
+			char smask, smask_default, rmask, rmask_default;
+			char smask_str[8], rmask_str[8];
+			int stream_units, rop_units;
+
+			printf("-- Shader info --\n");
+			printf("Clock: %0.3f MHz\n", nv_card->get_shader_speed());
+			stream_units = nv_card->get_stream_units(&smask, &smask_default);
+			convert_unit_mask_to_binary(smask, smask_default, smask_str);
+			printf("Stream units: %d (%sb)\n", stream_units, smask_str);
+			rop_units= nv_card->get_rop_units(&rmask, &rmask_default);
+			convert_unit_mask_to_binary(rmask, rmask_default, rmask_str);
+			printf("ROP units: %d (%sb)\n", rop_units, rmask_str);
 		}
 
 		printf("-- Memory info --\n");
 		printf("Amount: \t%d MB\n", nv_card->get_memory_size());
 		printf("Type: \t\t%d bit %s\n", nv_card->get_memory_width(), nv_card->get_memory_type());
-		printf("Clock: \t\t%0.3f MHz\n\n", nv_card->get_memory_speed());
+
+		/* nForce cards don't have local video memory */
+		if(nv_card->gpu == NFORCE)
+			printf("Clock: \t\t-\n\n");
+		else
+			printf("Clock: \t\t%0.3f MHz\n\n", nv_card->get_memory_speed());
+
 
 		if(strcmp(nv_card->get_bus_type(), "AGP") == 0)
 		{
@@ -1328,7 +1286,7 @@
 		if(nv_card->caps & SMARTDIMMER)
 		{
 			printf("-- Smartdimmer info --\n");
-			printf("Backlight level: %d%%\n\n", nv_card->mobile_get_smartdimmer());
+			printf("Backlight level: %d%%\n\n", nv_card->get_smartdimmer());
 		}
 
 		/* On some Geforce 6600(GT) cards, we can adjust the fans while we can't access the sensor yet */
@@ -1370,6 +1328,8 @@
 				printf("Performance level %d: gpu %d", i, nv_card->bios->perf_lst[i].nvclk);
 				if(nv_card->bios->perf_lst[i].delta)
 					printf("(+%d)", nv_card->bios->perf_lst[i].delta);
+				if(nv_card->bios->perf_lst[i].shaderclk)
+					printf("MHz/shader %d", nv_card->bios->perf_lst[i].shaderclk);
 				printf("MHz/memory %dMHz", nv_card->bios->perf_lst[i].memclk);
 				if(nv_card->bios->volt_entries)
 					printf("/%.2fV", nv_card->bios->perf_lst[i].voltage);
@@ -1392,6 +1352,42 @@
 		return 0;
 	}
 
+	if(backend_opt)
+	{
+		if(backend == STATE_LOWLEVEL)
+			nv_card->set_state(STATE_LOWLEVEL);
+		else if((nv_card->caps & COOLBITS_OVERCLOCKING) && nvclock.dpy)
+			nv_card->set_state(backend);
+		else if(!nvclock.dpy) /* If not lowlevel then we want to use Coolbits */
+		{
+			fprintf(stderr, "Error:\n");
+			fprintf(stderr, "Can't switch to the Coolbits backend because X isn't loaded\n");
+			return 0;
+		}
+		else if(!(nv_card->arch & (NV3X | NV4X | NV5X )))
+		{
+			fprintf(stderr, "Error:\n");
+			fprintf(stderr, "Can't switch to the Coolbits backend because it requires a GeforceFX/6/7/8 card.\n");
+			return 0;
+		}
+		else if(nv_card->gpu == MOBILE)
+		{
+			fprintf(stderr, "Error:\n");
+			fprintf(stderr, "Can't switch to the Coolbits backend because either it isn't supported on your laptop driver yet (requires 169.x) or you don't have it enabled in your xorg.conf.\n");
+			return 0;
+		}
+		else
+		{
+			fprintf(stderr, "Error:\n");
+			fprintf(stderr, "Can't switch to the Coolbits backend because the NV-CONTROL extension wans't found.\nThis can happen when you aren't using Nvidia driver 1.0-7676 or newer or when the option isn't enabled in the X config file.\n");
+			return 0;
+		}
+	}
+
+	/* When the backend option isn't specified we default to coolbits when it is available */
+	if(!backend_opt && nv_card->caps & COOLBITS_OVERCLOCKING)
+		nv_card->set_state(STATE_BOTH);
+
 	if(reset_opt)
 	{
 		if(nv_card->gpu == MOBILE && !force_opt)

Modified: packages/nvclock/branches/upstream/current/src/nvcontrol/CVS/Entries
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/nvcontrol/CVS/Entries?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/nvcontrol/CVS/Entries (original)
+++ packages/nvclock/branches/upstream/current/src/nvcontrol/CVS/Entries Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /Makefile.in/1.3/Fri Dec  9 19:46:05 2005//
 /libnvcontrol.c/1.3/Tue Jul  5 13:36:58 2005//
-/libnvcontrol.h/1.9/Sat Jan 28 19:45:25 2006//
-/nvcontrol.h/1.5/Sat Jul 15 09:47:09 2006//
-/nvcontrol.c/1.10/Mon Jul 31 11:03:10 2006//
+/nvcontrol.h/1.5/Tue Jul 11 18:18:55 2006//
+/libnvcontrol.h/1.11/Thu Jan  3 20:08:45 2008//
+/nvcontrol.c/1.12/Thu Jan  3 20:08:45 2008//
 D

Modified: packages/nvclock/branches/upstream/current/src/nvcontrol/libnvcontrol.h
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/nvcontrol/libnvcontrol.h?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/nvcontrol/libnvcontrol.h (original)
+++ packages/nvclock/branches/upstream/current/src/nvcontrol/libnvcontrol.h Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  * 
- * Copyright(C) 2001-2004 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://NVClock.sourceforge.net
  *
@@ -8,7 +8,6 @@
  * The nvEvent, NVEvent, and NVAttributeChangedEvent structures
  * were copied from Nvidia's GPLed nvidia-settings to allow NVClock
  * to receive notification of NV-CONTROL update events. To make Nvidia happy:
- 
  * 	nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
  * 	and Linux systems.
  *
@@ -133,8 +132,25 @@
 NV_GPU_OPTIMAL_CLOCK_DETECTION,
 NV_GPU_OPTIMAL_CLOCK_DETECTION_STATE,
 NV_IMAGE_QUALITY=221,
-NV_SHOW_SLI_HUD=225
+NV_SHOW_SLI_HUD=225,
+NV_FSAA_APP_ENHANCED=255
 };
+
+#define NV_FSAA_MODE_NONE 0
+#define NV_FSAA_MODE_2x 1
+#define NV_FSAA_MODE_2x_5t 2
+#define NV_FSAA_MODE_15x15 3
+#define NV_FSAA_MODE_2x2 4
+#define NV_FSAA_MODE_4x 5
+#define NV_FSAA_MODE_4x_9t 6
+#define NV_FSAA_MODE_8x 7
+#define NV_FSAA_MODE_16x 8
+#define NV_FSAA_MODE_8xS 9
+#define NV_FSAA_MODE_8xQ 10
+#define NV_FSAA_MODE_16xS 11
+#define NV_FSAA_MODE_16xQ 12
+#define NV_FSAA_MODE_32xS 13
+#define NV_FSAA_MODE_MAX NV_FSAA_MODE_32xS
 
 enum {
 NV_STR_CARDTYPE = 0,

Modified: packages/nvclock/branches/upstream/current/src/nvcontrol/nvcontrol.c
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/nvcontrol/nvcontrol.c?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/nvcontrol/nvcontrol.c (original)
+++ packages/nvclock/branches/upstream/current/src/nvcontrol/nvcontrol.c Sat Jan  5 20:47:40 2008
@@ -1,6 +1,6 @@
 /* NVClock 0.8 - Linux overclocker for NVIDIA cards
  * 
- * Copyright(C) 2001-2006 Roderick Colenbrander
+ * Copyright(C) 2001-2007 Roderick Colenbrander
  *
  * site: http://NVClock.sourceforge.net
  *
@@ -33,6 +33,10 @@
     {"8x", 7},
     {"16x", 8},
     {"8xS", 9},
+    {"8xQ", 10},
+    {"16xS", 11},
+    {"16xQ", 12},
+    {"32xS", 13},
     {NULL, -1}
 };
 

Modified: packages/nvclock/branches/upstream/current/src/qt/CVS/Entries
URL: http://svn.debian.org/wsvn/pkg-nvidia/packages/nvclock/branches/upstream/current/src/qt/CVS/Entries?rev=342&op=diff
==============================================================================
--- packages/nvclock/branches/upstream/current/src/qt/CVS/Entries (original)
+++ packages/nvclock/branches/upstream/current/src/qt/CVS/Entries Sat Jan  5 20:47:40 2008
@@ -9,5 +9,5 @@
 /qt_xfree.cpp/1.2/Mon Apr  4 16:16:36 2005//
 /qt_xfree.h/1.1/Tue Dec 28 21:41:32 2004//
 /x.xpm/1.1/Tue Dec 28 21:41:32 2004//
-/qt_nvclock.cpp/1.10/Fri Jul 28 19:27:48 2006//
+/qt_nvclock.cpp/1.10/Sun Aug 20 17:56:16 2006//
 D




More information about the Pkg-nvidia-devel mailing list