[Pkg-electronics-commits] [SCM] Packaging for Gerbv branch, master, updated. debian/2.4.0-1-12-g3f07491

أحمد المحمو =?UTF-8?Q?=D8=AF=D9=8A=20?=(Ahmed El-Mahmoudy) aelmahmoudy at sabily.org
Sun Jun 19 06:05:10 UTC 2011


The following commit has been merged in the master branch:
commit 3f0749162b090b7cc1f0c7fbaa96f4f7d5be4dab
Author: Luk Claes <luk at debian.org>
Date:   Sat Jun 11 12:17:52 2011 +0200

    Imported Debian patch 2.4.0-1.1

diff --git a/ChangeLog b/ChangeLog
index 2422419..f30ae80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,196 +1,3 @@
-2011-01-08   Dan McMahill * dan AT mcmahill dot net *
-
-	* src/Makefile.am: Bump shared lib version in prep for 2.5 release.
-
-2011-01-07   Dan McMahill * dan AT mcmahill dot net *
-
-	* README-release.txt: Minor updates (version numbers only) for the
-	up and coming 2.5 release.
-
-2011-01-07   Dan McMahill * dan AT mcmahill dot net *
-
-	* win32/build_gerbv: Expand this script to cover pcb and wcalc as
-	well as gerbv.  Until such time as I get a decent NetBSD or Linux
-	hosted cross build environment set up I should at least have an
-	easier job of maintaining this script since it should be shared with
-	no changes between the three projects now.
-
-2011-01-07   Dan McMahill * dan AT mcmahill dot net *
-
-	* win32/gerbv.nsi.in: Update some of the installer license info to
-	reflect the latest set of gtk for win32 and friends downloads
-
-2011-01-07   Dan McMahill * dan AT mcmahill dot net *
-
-	* win32/extract_gtk_win32: Update for the latest set of downloads of
-	gtk for win32
-
-2011-01-02   Dan McMahill * dan AT mcmahill dot net *
-
-	* win32/gerbv.nsi.in:  Use @prog instead of @gerbv in this file
-	which makes it a little easier to use the same top level build
-	script for both pcb and gerbv.
-
-2011-01-02   Dan McMahill * dan AT mcmahill dot net *
-
-	* : commit 966ac7e1567380978f8f6e63e11829105c055179  Author: Dan
-	McMahill * dan AT mcmahill dot net * Date:   Sat Jan 1 13:26:43 2011
-	-0500
-
-2011-01-01   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* : commit 3b0ad206c7df6a5b1aa9cc0d6d308f70c32e68dc  Author: Julian
-	Lamb * thepurlieu AT gmail dot com * Date:   Sat Jan 1 09:58:53 2011
-	-0500
-
-2010-12-31   Dan McMahill * dan AT mcmahill dot net *
-
-	* src/interface.c: Add missing header for malloc().
-
-2010-12-30   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/drill.c: * fix leak and possible segfault in drill parser (patch by Doug
-	Springer)
-
-2010-12-22   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/pick-and-place.c: * fix segfault in pick-and-place parser (bug 3141941)
-
-2010-12-14   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/callbacks.c, src/callbacks.h, src/gerbv.c, src/gerbv.h,
-	src/interface.c, src/interface.h, src/main.c, src/main.h,
-	src/project.c, src/render.c: * add persistent keyboard accelerators, extra menu options, and do
-	general cleanup large patch from Stefan Tauner, which finishes
-	mapping every possible command to the menus, as well as add
-	persistent keyboard accelerators for everything. Also lots of
-	general cleanup in the interface code.
-
-2010-10-12   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/render.c: * increase max zoom 4 times, to allow more accurate measurements The
-	previous zoom limit was set to prevent GDK rendering artifacts, but
-	the rendering speedups in the code now eliminate those so there is
-	no issue with zooming in.
-
-2010-09-08   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/drill.c: * fix crasher in drill parsing (bug 3061736) crasher was caused in
-	bug in get_line function when given an empty line
-
-2010-08-24   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/interface.c: * add accelerator for color changing
-
-2010-08-24   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/interface.c: * change F8 shortcut to F7, per the GNOME HIG
-
-2010-08-24   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/callbacks.c, src/callbacks.h, src/interface.c: * add keyboard shortcut for moving layers up and down (patch by
-	Stefan Tauner)
-
-2010-08-22   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/interface.c: * change toolbar visibility key shortcut to F8, since F10 is
-	normally stolen for the GTK menu
-
-2010-08-22   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/callbacks.c, src/callbacks.h, src/interface.c: * add pseudo-fullscreen mode (patch by Stefan Tauner)
-
-2010-08-20   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/callbacks.c, src/callbacks.h, src/draw.c, src/interface.c: add
-	ability to toggle sidebar visibility and add menu and keyboard
-	shortcut for layer visibility (patch by Stefan Tauner)
-
-2010-08-18   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/callbacks.c, src/callbacks.h, src/interface.c: add ability to
-	toggle toolbar visibility, and add additional menu accelerators
-	(patch by Stefan Tauner)
-
-2010-08-18   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/draw.c: pixel-align the coordinates when rendering via cairo
-	(benchmark shows a 10%-15% speed boost)
-
-2010-08-11   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/drill.c: * fix length calcs in previous patch to prevent possible buffer
-	overruns
-
-2010-08-11   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/drill.c: * ignore comments in drill files when determining file type patch by Doug Springer (ID:3043154)
-
-2010-07-28   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/gerb_image.c, src/gerber.c, src/gerber.h: recalculate the
-	bounding boxes when drawing primatives via the libgerbv API
-
-2010-06-30   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/gerber.c: fix handling of trailing zero suppression with very
-	large precisions (TAX35, etc) (bug 3022957)
-
-2010-06-11   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* doc/example-code/example1.c, doc/example-code/example2.c,
-	doc/example-code/example4.c, doc/example-code/example5.c,
-	src/export-rs274x.c: fix the example code files showing how to use
-	libgerv, and use a default identity transform during exporting if
-	nothing is specified
-
-2010-04-29   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/draw-gdk.c: fix GDK rendering or Macro 22 elements when
-	negative coordinates are present (bug 2994471)
-
-2010-04-27   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/interface.c: fix tooltip for modify layer button (patch by
-	Joerg Wunsch)
-
-2010-03-25   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/gerber.c: fix handling of whitespace in the middle of an
-	RS274X command (bug 2976400)
-
-2010-03-11   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/export-rs274x.c: * fix bug in exporting outline macros (fixes bug 2968567 and
-	2968550)
-
-2010-02-25   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/callbacks.c: unselect all items if a layer is hidden (bug
-	2957479)
-
-2010-02-25   Julian Lamb * thepurlieu AT gmail dot com *
-
-	* src/drill.c: fix drill parsing bug when INCH command has nothing
-	after it (bug 2957994)
-
-2010-02-20   Dan McMahill * dan AT mcmahill dot net *
-
-	* configure.ac: Welcome to 2.4A
-
-2010-02-20   Dan McMahill * dan AT mcmahill dot net *
-
-	* src/Makefile.am: Increment revision for shared lib in prep for the
-	2.4.0 release.
-
-2010-02-20   Dan McMahill * dan AT mcmahill dot net *
-
-	* ChangeLog, NEWS: Update ChangeLog and NEWS for the 2.4.0 release
-
-2010-02-20   Dan McMahill * dan AT mcmahill dot net *
-
-	* utils/git2cl: Strip trailing whitespace on comment lines.
-
 2010-02-20   Dan McMahill * dan AT mcmahill dot net *
 
 	* README-release.txt: Minor updates for 2.4.0 release.
diff --git a/NEWS b/NEWS
index 033400c..d302deb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,33 +1,4 @@
 ========================================================================
-Release Notes for gerbv-2.5.0
-========================================================================
-The following is a summary of the changes which went into gerbv-2.5.0.
-For a complete list of changes, refer to ChangeLog.  This release
-is primarily a bug fix release.
-
-- libgerbv:  fix leak and possible segfault in drill parser
-- libgerbv:  fix segfault in pick and place parser
-- gerbv:     add persistent keyboard accelerators and extra menu options
-- gerbv:     increase max zoom 4x to allow more accurate measurements
-- libgerbv:  fix bug which caused the drill parser to crash on an empty line
-- gerbv:     change F8 shortcut to F7 per GNOME HIG
-- gerbv:     add psuedo fullscreen mode
-- gerbv:     add ability to toggle sidebar visibility
-- gerbv:     speed up cairo rendering.
-- libgerbv:  improved detection of drill files (comment lines are now
-             ignored during file type detection)
-- libgerbv:  fix handling of trailing zero suppression with very large
-             precisions.
-- examples:  fix some of the example code showing how to use libgerbv.
-- gerbv:     fix gdk rendering of macro 22 elements with negative coordinates
-- gerbv:     fix tooltip for modify layer button
-- libgerbv:  fix handling of whitespace in the middle of an RS-274X command
-- libgerbv:  fix bug in exporting outline macros
-- gerbv:     unselect all items if a layer is hidden
-- libgerbv:  fix drill parsing when INCH has nothing after it
-
-
-========================================================================
 Release Notes for gerbv-2.4.0
 ========================================================================
 The following is a summary of the changes which went into gerbv-2.4.0.
diff --git a/README-release.txt b/README-release.txt
index 98418fd..c0d7445 100644
--- a/README-release.txt
+++ b/README-release.txt
@@ -1,5 +1,6 @@
 #!/bin/sh
 #
+# $Id$
 #
 
 This documents what is done to create a gerbv release.  The releases now
@@ -73,14 +74,14 @@ To make a gerbv release do the following:
 =)	if this is a major release, then tag and branch:
 
         1. Create the release branch and push to the remote repository
-                git branch gerbv-2-5
-                git push origin gerbv-2-5
+                git branch gerbv-2-4
+                git push origin gerbv-2-4
 
 	2. On the trunk, update configure.ac to update the version.
            The rules for versioning is that we append uppercase
            letters to the branch version.
  
-           For example 2.5A after creating the gerbv-2-5 branch
+           For example 2.4A after creating the gerbv-2-4 branch
                 git checkout master
                 vi configure.ac
                 git commit configure.ac
@@ -88,9 +89,9 @@ To make a gerbv release do the following:
 
 	3. On the release branch, update configure.ac to update the
            version.  On a new branch, add a 0RC1 to the teeny number.
-           for example 2.5.0RC1.
+           for example 2.4.0RC1.
 
-                git checkout gerbv-2-5
+                git checkout gerbv-2-4
                 vi configure.ac
                 git commit configure.ac
                 git push
@@ -103,9 +104,9 @@ To make a gerbv release do the following:
 
 	4. When the release branch is ready to go,  update configure.ac to
 	   set the final release version.  The first version from a
-	   branch has 0 for the teeny version.  For example, 2.5.0.
+	   branch has 0 for the teeny version.  For example, 2.4.0.
 
-                git checkout gerbv-2-5
+                git checkout gerbv-2-4
                 vi configure.ac
                 git commit configure.ac
                 ./autogen.sh
@@ -114,17 +115,17 @@ To make a gerbv release do the following:
 
 	   Next tag the release.
 
-                git tag -a gerbv-2-5-RELEASE
+                git tag -a gerbv-2-4-RELEASE
                 git push --tags
 
-	   Update the version on the branch to 2.5.1RC1
-                git checkout gerbv-2-5
+	   Update the version on the branch to 2.4.1RC1
+                git checkout gerbv-2-4
                 vi configure.ac
                 git commit configure.ac
                 git push
 		
 	   Update to the tagged released sources and build tarballs
-                git checkout gerbv-2-5-RELEASE
+                git checkout gerbv-2-4-RELEASE
 		./autogen.sh 
 		./configure --enable-maintainer-mode --disable-update-desktop-database
 		gmake maintainer-clean
@@ -133,17 +134,17 @@ To make a gerbv release do the following:
 		gmake distcheck
 
            If teeny version bumps are made for a bug fix, then the tag name
-	   should be gerbv-2-5-PATCH001 for gerbv-2.5.1,
-	   gerbv-2-5-PATCH002 for gerbv-2.5.2, etc.
+	   should be gerbv-2-4-PATCH001 for gerbv-2.4.1,
+	   gerbv-2-4-PATCH002 for gerbv-2.4.2, etc.
 
 	5. Create checksums
 
-		openssl md5 gerbv-2.5.0.tar.gz > gerbv-2.5.0.cksum
-		openssl rmd160 gerbv-2.5.0.tar.gz >> gerbv-2.5.0.cksum
-		openssl sha1 gerbv-2.5.0.tar.gz >> gerbv-2.5.0.cksum
+		openssl md5 gerbv-2.4.0.tar.gz > gerbv-2.4.0.cksum
+		openssl rmd160 gerbv-2.4.0.tar.gz >> gerbv-2.4.0.cksum
+		openssl sha1 gerbv-2.4.0.tar.gz >> gerbv-2.4.0.cksum
 
 	6. Create a new file release for the package "gerbv" with a release name of
-	   "gerbv-2.5.0" (for gerbv-2.5.0).  Do this by logging into www.sourceforge.net
+	   "gerbv-2.4.0" (for gerbv-2.4.0).  Do this by logging into www.sourceforge.net
 	   and then navigating to
 
 	   https://sourceforge.net/projects/gerbv  (you must be logged in to sourceforge)
@@ -172,13 +173,13 @@ To make a gerbv release do the following:
 
 		git checkout master
 
-=) 	if this is a patch release (2.5.1 for example), then simply
+=) 	if this is a patch release (2.4.1 for example), then simply
 	make desired changes to the branch:
 
-		git checkout gerbv-2-5
+		git checkout gerbv-2-4
 		# make changes
 		git commit
-                git tag -a gerbv-2-5-PATCH001
+                git tag -a gerbv-2-4-PATCH001
                 git push
 
 
diff --git a/config.guess b/config.guess
new file mode 100755
index 0000000..b6e6955
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1516 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-03-06'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa:Linux:*:*)
+    	echo xtensa-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100755
index 0000000..5defff6
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1622 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-01-18'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16c)
+		basic_machine=cr16c-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
index 6a39a46..341b221 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for gerbv 2.5.0.
+# Generated by GNU Autoconf 2.61 for gerbv 2.4.0.
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
 # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -726,8 +726,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='gerbv'
 PACKAGE_TARNAME='gerbv'
-PACKAGE_VERSION='2.5.0'
-PACKAGE_STRING='gerbv 2.5.0'
+PACKAGE_VERSION='2.4.0'
+PACKAGE_STRING='gerbv 2.4.0'
 PACKAGE_BUGREPORT=''
 
 ac_unique_file="src/gerbv.c"
@@ -1419,7 +1419,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures gerbv 2.5.0 to adapt to many kinds of systems.
+\`configure' configures gerbv 2.4.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1489,7 +1489,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of gerbv 2.5.0:";;
+     short | recursive ) echo "Configuration of gerbv 2.4.0:";;
    esac
   cat <<\_ACEOF
 
@@ -1605,7 +1605,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-gerbv configure 2.5.0
+gerbv configure 2.4.0
 generated by GNU Autoconf 2.61
 
 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1619,7 +1619,7 @@ 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 gerbv $as_me 2.5.0, which was
+It was created by gerbv $as_me 2.4.0, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
@@ -2311,7 +2311,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='gerbv'
- VERSION='2.5.0'
+ VERSION='2.4.0'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -21991,7 +21991,7 @@ exec 6>&1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by gerbv $as_me 2.5.0, which was
+This file was extended by gerbv $as_me 2.4.0, which was
 generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22044,7 +22044,7 @@ Report bugs to <bug-autoconf at gnu.org>."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-gerbv config.status 2.5.0
+gerbv config.status 2.4.0
 configured by $0, generated by GNU Autoconf 2.61,
   with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.ac b/configure.ac
index 30e41f4..a757ce8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ dnl  along with this program; if not, write to the Free Software
 dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
 
 
-AC_INIT([gerbv], [2.5.0])
+AC_INIT([gerbv], [2.4.0])
 AC_CONFIG_SRCDIR([src/gerbv.c])
 AC_PREREQ([2.59])
 AM_INIT_AUTOMAKE([1.9])
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..399da22
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,2 @@
+The buildsystem uses dpatch to add a few minor patches to the program.
+
diff --git a/debian/changelog b/debian/changelog
index 3ebe1d9..0d50219 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,15 +1,3 @@
-gerbv (2.5.0-1) unstable; urgency=low
-
-  * New upstream release
-  * Bump standards version to 3.9.2
-  * Add git and homepage fields to control file
-  * Switch to dpkg-source 3.0 (quilt) format
-  * Rewrote both patches in quilt format
-  * Change debhelper dependency to 8
-  * Changed build targets according to new standard
-
- -- Gudjon I. Gudjonsson <gudjon at gudjon.org>  Sat, 18 Jun 2011 11:32:33 +0200
-
 gerbv (2.4.0-1.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff --git a/debian/control b/debian/control
index e608f4b..894ce1f 100644
--- a/debian/control
+++ b/debian/control
@@ -3,17 +3,13 @@ Section: electronics
 Priority: optional
 Maintainer: Debian Electronics Team <pkg-electronics-devel at lists.alioth.debian.org>
 Uploaders: Hamish Moffatt <hamish at debian.org>, Wesley J. Landaker <wjl at icecavern.net>, Ramakrishnan Muthukrishnan <rkrishnan at debian.org>, Gudjon I. Gudjonsson <gudjon at gudjon.org>
-Standards-Version: 3.9.2
-Build-Depends: debhelper (>= 8), libgtk2.0-dev, libglib2.0-dev, libpng12-dev, libcairo2-dev, autotools-dev
-Homepage: http://gerbv.gpleda.org/
-Vcs-Git: git://git.debian.org/pkg-electronics/gerbv.git
-Vcs-Browser: http://git.debian.org/?p=pkg-electronics/gerbv.git
+Standards-Version: 3.8.4
+Build-Depends: debhelper (>= 7), libgtk2.0-dev, libglib2.0-dev, libpng12-dev, libcairo2-dev, dpatch, autotools-dev
 
 Package: gerbv
 Architecture: any
 Depends: ${misc:Depends}, ${shlibs:Depends}
 Recommends: extra-xdg-menus
 Description: Gerber file viewer for PCB design
- gerbv is a utility for viewing Gerber RS-274X files, Excellon drill files, 
- and CSV pick-and-place files. Gerber files are used for communicating
- printed circuit board (PCB) designs to PCB manufacturers.
+ gerbv is a utility for viewing Gerber files. Gerber files are used
+ for communicating printed circuit board (PCB) designs to PCB manufacturers.
diff --git a/debian/gerbv.lintian-overrides b/debian/gerbv.lintian-overrides
index c816880..8e5afdc 100644
--- a/debian/gerbv.lintian-overrides
+++ b/debian/gerbv.lintian-overrides
@@ -1,2 +1,2 @@
 gerbv: package-name-doesnt-match-sonames libgerbv1
-#gerbv: non-dev-pkg-with-shlib-symlink usr/lib/libgerbv.so.1.0.5 usr/lib/libgerbv.so
+gerbv: non-dev-pkg-with-shlib-symlink usr/lib/libgerbv.so.1.0.5 usr/lib/libgerbv.so
diff --git a/debian/patches/00list b/debian/patches/00list
new file mode 100644
index 0000000..dab1960
--- /dev/null
+++ b/debian/patches/00list
@@ -0,0 +1 @@
+01_fix_desktop
diff --git a/debian/patches/01_desktop_file.diff b/debian/patches/01_desktop_file.diff
deleted file mode 100644
index 4bae93a..0000000
--- a/debian/patches/01_desktop_file.diff
+++ /dev/null
@@ -1,10 +0,0 @@
-Removes encoding key
---- a/desktop/gerbv.desktop
-+++ b/desktop/gerbv.desktop
-@@ -1,6 +1,5 @@
- [Desktop Entry]
- Version=1.0
--Encoding=UTF-8
- Name=Gerbv Gerber File Viewer
- GenericName=Gerber File Viewer
- Comment=Gerber file viewer for PCB design
diff --git a/debian/patches/01_fix_desktop.dpatch b/debian/patches/01_fix_desktop.dpatch
new file mode 100644
index 0000000..37ea3bb
--- /dev/null
+++ b/debian/patches/01_fix_desktop.dpatch
@@ -0,0 +1,16 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01_fix_desktop.dpatch by  <gudjon at gudjon.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Move program to the Science category
+
+ at DPATCH@
+diff -urNad gerbv-2.3.0~/desktop/gerbv.desktop gerbv-2.3.0/desktop/gerbv.desktop
+--- gerbv-2.3.0~/desktop/gerbv.desktop	2009-11-01 16:15:41.000000000 +0100
++++ gerbv-2.3.0/desktop/gerbv.desktop	2009-11-01 16:16:16.000000000 +0100
+@@ -8,4 +8,4 @@
+ Exec=gerbv %F
+ Icon=gerbv
+ MimeType=application/x-gerber;application/x-excellon;
+-Categories=Engineering;Electronics;
++Categories=Electronics;Science;Education;
diff --git a/debian/patches/02_fix_manpage.diff b/debian/patches/02_fix_manpage.diff
deleted file mode 100644
index f0e382a..0000000
--- a/debian/patches/02_fix_manpage.diff
+++ /dev/null
@@ -1,48 +0,0 @@
-Fixes minor errors in man-page
---- a/man/gerbv.1.in
-+++ b/man/gerbv.1.in
-@@ -32,7 +32,7 @@
- Use foreground color <hex>. <hex> is specified as an html-color code, 
- e.g. #00FF00 for Green. If a user also wants to set the alpha (rendering 
- with Cairo) it can be specified as an #RRGGBBAA code. Use multiple 
---f flags to set the color for multiple layers.
-+\-f flags to set the color for multiple layers.
- .TP
- .BI -l\ <filename>|--log=<filename>
- All error messages etc are stored in a file with filename \fI<filename>\fP.
-@@ -45,7 +45,7 @@
- the same directory as the gerber files.
- 
- .SS gerbv Export-specific options:
--The following commands can be used in combination with the -x flag:
-+The following commands can be used in combination with the \-x flag:
- .BI -B<b>|--Border=<b>
- Set the border around the image <b> percent of the width and height. 
- Default <b> is 5%%.
-@@ -57,7 +57,7 @@
- Defaults to 72 DPI in both directions.
- .TP
- .BI -T<X,Y>|--translate=<X,Y>   
--Translate the image by the distance <X,Y>. Use multiple -T flags to translate
-+Translate the image by the distance <X,Y>. Use multiple \-T flags to translate
- multiple files.
- .TP
- .BI -O<XxY>|--origin=<XxY>
-@@ -185,7 +185,7 @@
- you want, set all the colors etc and do a "Save Project As...".
- 
- You load a project either from the menu bar or by using the commandline 
--switches -p or --project.
-+switches \-p or \-\-project.
- 
- Currently there is a limit in that the project file must be in the same
- directory as the gerber files to be loaded.
-@@ -219,7 +219,7 @@
- CAM processor, and the error report tells you which tools you "forgot".
- Then you put these tools into the file and rerun the CAM processor.
- 
--You load a tool file by using the commandline switches -t or --tools.
-+You load a tool file by using the commandline switches \-t or \-\-tools.
- The file can have any name you wish, but Eagle expects the file type to
- be ".drl", so it makes sense to keep it this way. Some board houses are
- still using CAM software from DOS era, so you may want to excercise caution
diff --git a/debian/patches/02_fix_manpage.dpatch b/debian/patches/02_fix_manpage.dpatch
new file mode 100644
index 0000000..f01638e
--- /dev/null
+++ b/debian/patches/02_fix_manpage.dpatch
@@ -0,0 +1,18 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_fix_manpage.dpatch by  <gudjon at gudjon.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Removes .l from manpage
+
+ at DPATCH@
+diff -urNad gerbv-2.3.0~/man/gerbv.1.in gerbv-2.3.0/man/gerbv.1.in
+--- gerbv-2.3.0~/man/gerbv.1.in	2008-05-01 21:25:29.000000000 +0200
++++ gerbv-2.3.0/man/gerbv.1.in	2009-09-06 20:26:08.000000000 +0200
+@@ -12,7 +12,6 @@
+ files produced by the program PCB (http://pcb.sf.net).
+ 
+ .SH OPTIONS
+-.l
+ .B Warning! 
+ On some platforms, which hasn't long option available, only
+ short options are available.
diff --git a/debian/patches/series b/debian/patches/series
deleted file mode 100644
index 7a9bfed..0000000
--- a/debian/patches/series
+++ /dev/null
@@ -1,2 +0,0 @@
-01_desktop_file.diff
-02_fix_manpage.diff
diff --git a/debian/rules b/debian/rules
index aae6737..9f08fa5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,8 +1,10 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpatch/dpatch.make
+
 export LDFLAGS=-ldl
 
-config.status: configure
+config.status: patch configure
 	dh_testdir
 
 	# Add here commands to configure the package.
@@ -14,16 +16,14 @@ ifneq "$(wildcard /usr/share/misc/config.guess)" ""
 endif
 	./configure --prefix=/usr --enable-exportpng  --disable-update-desktop-database
 
-build: build-arch build-indep
-build-arch: build-stamp
-build-indep: build-stamp
+build: build-stamp
 build-stamp: config.status
 	dh_testdir
 
 	$(MAKE) 
 	touch $@
 
-clean:
+clean: unpatch
 	dh_testdir
 	dh_testroot
 
diff --git a/debian/source/format b/debian/source/format
deleted file mode 100644
index 163aaf8..0000000
--- a/debian/source/format
+++ /dev/null
@@ -1 +0,0 @@
-3.0 (quilt)
diff --git a/desktop/gerbv.desktop b/desktop/gerbv.desktop
index ba3bac3..4d5f537 100644
--- a/desktop/gerbv.desktop
+++ b/desktop/gerbv.desktop
@@ -1,5 +1,6 @@
 [Desktop Entry]
 Version=1.0
+Encoding=UTF-8
 Name=Gerbv Gerber File Viewer
 GenericName=Gerber File Viewer
 Comment=Gerber file viewer for PCB design
diff --git a/doc/example-code/example1.c b/doc/example-code/example1.c
index 0182e6c..f2feab3 100644
--- a/doc/example-code/example1.c
+++ b/doc/example-code/example1.c
@@ -41,7 +41,7 @@ main(int argc, char *argv[]) {
 	/* export the first (and only) image in the project, which will be the
 	   one we just loaded */
 	gerbv_export_rs274x_file_from_image ("example1-output.gbx",
-			mainProject->file[0]->image, NULL);
+			mainProject->file[0]->image);
 
 	/* destroy the top-level structure and free all memory */
 	gerbv_destroy_project (mainProject);
diff --git a/doc/example-code/example2.c b/doc/example-code/example2.c
index d58b363..d364dd2 100644
--- a/doc/example-code/example2.c
+++ b/doc/example-code/example2.c
@@ -55,7 +55,7 @@ main(int argc, char *argv[]) {
 	gerbv_image_copy_image (duplicatedImage, &newTransformation, originalImage);
 	
 	/* export the merged image to a new rs274x file */
-	gerbv_export_rs274x_file_from_image ("example2-output.gbx",	originalImage, NULL);
+	gerbv_export_rs274x_file_from_image ("example2-output.gbx",	originalImage);
 
 	/* destroy all created structures */
 	gerbv_destroy_image (originalImage);
diff --git a/doc/example-code/example4.c b/doc/example-code/example4.c
index 2791af7..d38c842 100644
--- a/doc/example-code/example4.c
+++ b/doc/example-code/example4.c
@@ -53,7 +53,7 @@ main(int argc, char *argv[]) {
 	}
 
 	/* export the modified image to a new rs274x file */
-	gerbv_export_rs274x_file_from_image ("example4-output.gbx", workingImage, NULL);
+	gerbv_export_rs274x_file_from_image ("example4-output.gbx", workingImage);
 
 	/* destroy all created structures */
 	gerbv_destroy_image (workingImage);
diff --git a/man/gerbv.1.in b/man/gerbv.1.in
index cacfc57..ff69508 100644
--- a/man/gerbv.1.in
+++ b/man/gerbv.1.in
@@ -32,7 +32,7 @@ e.g. #FF0000 for Red.
 Use foreground color <hex>. <hex> is specified as an html-color code, 
 e.g. #00FF00 for Green. If a user also wants to set the alpha (rendering 
 with Cairo) it can be specified as an #RRGGBBAA code. Use multiple 
-\-f flags to set the color for multiple layers.
+-f flags to set the color for multiple layers.
 .TP
 .BI -l\ <filename>|--log=<filename>
 All error messages etc are stored in a file with filename \fI<filename>\fP.
@@ -45,7 +45,7 @@ Load a stored project. Please note that the project file must be stored in
 the same directory as the gerber files.
 
 .SS gerbv Export-specific options:
-The following commands can be used in combination with the \-x flag:
+The following commands can be used in combination with the -x flag:
 .BI -B<b>|--Border=<b>
 Set the border around the image <b> percent of the width and height. 
 Default <b> is 5%%.
@@ -57,7 +57,7 @@ render engine). Use <R> to have the same resolution in both directions.
 Defaults to 72 DPI in both directions.
 .TP
 .BI -T<X,Y>|--translate=<X,Y>   
-Translate the image by the distance <X,Y>. Use multiple \-T flags to translate
+Translate the image by the distance <X,Y>. Use multiple -T flags to translate
 multiple files.
 .TP
 .BI -O<XxY>|--origin=<XxY>
@@ -185,7 +185,7 @@ way to create a project is to load all files you want into the layer
 you want, set all the colors etc and do a "Save Project As...".
 
 You load a project either from the menu bar or by using the commandline 
-switches \-p or \-\-project.
+switches -p or --project.
 
 Currently there is a limit in that the project file must be in the same
 directory as the gerber files to be loaded.
@@ -219,7 +219,7 @@ A standard practice with Eagle is to create an empty Tools file, run the
 CAM processor, and the error report tells you which tools you "forgot".
 Then you put these tools into the file and rerun the CAM processor.
 
-You load a tool file by using the commandline switches \-t or \-\-tools.
+You load a tool file by using the commandline switches -t or --tools.
 The file can have any name you wish, but Eagle expects the file type to
 be ".drl", so it makes sense to keep it this way. Some board houses are
 still using CAM software from DOS era, so you may want to excercise caution
diff --git a/src/Makefile.am b/src/Makefile.am
index dac338d..d8df632 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,8 @@
 ##
 ##    Copyright (C) 2000-2003 Stefan Petersen (spe at stacken.kth.se)
 ##
+##  $Id$
+##
 ##  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
@@ -75,7 +77,7 @@ libgerbv_la_SOURCES= \
 # 6. If any interfaces have been removed since the last public release, then
 #    set age to 0.
 #
-libgerbv_la_LDFLAGS = -version-info 1:6:0 -no-undefined
+libgerbv_la_LDFLAGS = -version-info 1:5:0 -no-undefined
 
 gerbv_SOURCES = \
 		opdefines.h \
diff --git a/src/Makefile.in b/src/Makefile.in
index 272243f..4e861f9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -271,7 +271,7 @@ libgerbv_la_SOURCES = \
 # 6. If any interfaces have been removed since the last public release, then
 #    set age to 0.
 #
-libgerbv_la_LDFLAGS = -version-info 1:6:0 -no-undefined
+libgerbv_la_LDFLAGS = -version-info 1:5:0 -no-undefined
 gerbv_SOURCES = \
 		opdefines.h \
 		dynload.c dynload.h \
diff --git a/src/callbacks.c b/src/callbacks.c
index 6cca471..d08d107 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -115,11 +115,7 @@ char *ap_names[] = {"NONE",
 		    "MACRO_LINE22"    /* a RS274X line (code 22) macro */
 };
 
-static gint callbacks_get_selected_row_index (void);
-static void callbacks_units_changed (gerbv_gui_unit_t unit);
-static void callbacks_update_statusbar_coordinates (gint x, gint y);
-static void callbacks_update_ruler_scales (void);
-static void callbacks_render_type_changed (void);
+gint callbacks_get_selected_row_index  (void);
 
 /* --------------------------------------------------------- */
 GtkWidget *
@@ -514,69 +510,6 @@ callbacks_print_activate (GtkMenuItem *menuitem, gpointer user_data)
 
 /* --------------------------------------------------------- */
 void
-callbacks_fullscreen_toggled (GtkMenuItem *menuitem, gpointer user_data)
-{
-	//struct GtkWindow *win = (struct GtkWindow *)(screen.win.topLevelWindow);
-	GdkWindow *win;
-	g_object_get(screen.win.topLevelWindow, "window", &win, NULL);
-	GdkWindowState state = gdk_window_get_state (win);
-
-	if(state & GDK_WINDOW_STATE_FULLSCREEN)
-		gtk_window_unfullscreen (GTK_WINDOW(screen.win.topLevelWindow));
-	else
-		gtk_window_fullscreen (GTK_WINDOW(screen.win.topLevelWindow));
-}
-
-/* --------------------------------------------------------- */
-void
-callbacks_show_toolbar_toggled (GtkMenuItem *menuitem, gpointer user_data)
-{
-	if (GTK_CHECK_MENU_ITEM(menuitem)->active){
-		gtk_widget_show (user_data);
-	}
-	else {
-		gtk_widget_hide (user_data);
-	}
-}
-
-/* --------------------------------------------------------- */
-void
-callbacks_show_sidepane_toggled (GtkMenuItem *menuitem, gpointer user_data)
-{
-	if (GTK_CHECK_MENU_ITEM(menuitem)->active){
-		gtk_widget_show (user_data);
-	}
-	else {
-		gtk_widget_hide (user_data);
-	}
-}
-
-/* --------------------------------------------------------- */
-/** View/"Toggle visibility layer X" menu item was activated.
-  * Set the isVisible flag on file X and update the treeview and rendering.
-*/
-void
-callbacks_toggle_layer_visibility_activate (GtkMenuItem *menuitem, gpointer user_data)
-{
-	int i = GPOINTER_TO_INT(user_data);
-	if (0 <= i && i <= mainProject->last_loaded) {
-		mainProject->file[i]->isVisible = !mainProject->file[i]->isVisible;
-		/* clear any selected items so they don't show after the layer is hidden */
-		render_clear_selection_buffer();
-
-	    callbacks_update_layer_tree ();
-		if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
-			render_refresh_rendered_image_on_screen();
-		}
-		else {
-			render_recreate_composite_surface (screen.drawing_area);
-			callbacks_force_expose_event_for_screen ();
-		}
-	}
-}
-
-/* --------------------------------------------------------- */
-void
 callbacks_zoom_in_activate                    (GtkMenuItem     *menuitem,
                                         gpointer         user_data)
 {
@@ -1581,57 +1514,7 @@ void callbacks_update_ruler_pointers (void) {
 }
 
 /* --------------------------------------------------------- */
-static void
-callbacks_render_type_changed () {
-	static gboolean isChanging = FALSE;
-	if (isChanging)
-		return;
-
-	isChanging = TRUE;
-	gerbv_render_types_t type = screenRenderInfo.renderType;
-	GtkCheckMenuItem *check_item = screen.win.menu_view_render_group[type];
-	dprintf ("%s():  type = %d, check_item = %p\n", __FUNCTION__, type, check_item);
-	gtk_check_menu_item_set_active (check_item, TRUE);
-	gtk_combo_box_set_active (screen.win.sidepaneRenderComboBox, type);
-
-	render_refresh_rendered_image_on_screen();
-	isChanging = FALSE;
-}
-
-/* --------------------------------------------------------- */
-static void
-callbacks_units_changed (gerbv_gui_unit_t unit) {
-	static gboolean isChanging = FALSE;
-
-	if (isChanging)
-		return;
-
-	isChanging = TRUE;
-	screen.unit = unit;
-
-	if (unit == GERBV_MILS){
-		gtk_combo_box_set_active (GTK_COMBO_BOX (screen.win.statusUnitComboBox), GERBV_MILS);
-		gtk_check_menu_item_set_active (screen.win.menu_view_unit_group[GERBV_MILS], TRUE);
-	} else if (unit == GERBV_MMS){
-		gtk_combo_box_set_active (GTK_COMBO_BOX (screen.win.statusUnitComboBox), GERBV_MMS);
-		gtk_check_menu_item_set_active (screen.win.menu_view_unit_group[GERBV_MMS], TRUE);
-	} else {
-		gtk_combo_box_set_active (GTK_COMBO_BOX (screen.win.statusUnitComboBox), GERBV_INS);
-		gtk_check_menu_item_set_active (screen.win.menu_view_unit_group[GERBV_INS], TRUE);
-	}
-
-	callbacks_update_ruler_scales ();
-	callbacks_update_statusbar_coordinates (screen.last_x, screen.last_y);
-	
-	if (screen.tool == MEASURE)
-		callbacks_update_statusbar_measured_distance (screen.win.lastMeasuredX, screen.win.lastMeasuredY);
-	
-	isChanging = FALSE;
-}
-
-/* --------------------------------------------------------- */
-static void
-callbacks_update_ruler_scales (void) {
+void callbacks_update_ruler_scales (void) {
 	double xStart, xEnd, yStart, yEnd;
 
 	xStart = screenRenderInfo.lowerLeftX;
@@ -1750,18 +1633,16 @@ callbacks_layer_tree_visibility_button_toggled (GtkCellRendererToggle *cell_rend
 	
 	GtkTreePath *treePath = gtk_tree_path_new_from_string (path);
 	if (gtk_tree_model_get_iter((GtkTreeModel *)list_store, &iter, treePath)) {
-	      gint *indices;
+	      gint *indeces;
 	      
-	      indices = gtk_tree_path_get_indices (treePath);
-	      index = indices[0];
+	      indeces = gtk_tree_path_get_indices (treePath);
+	      index = indeces[0];
 		if (mainProject->file[index]->isVisible)
 			 newVisibility = FALSE;
 		mainProject->file[index]->isVisible = newVisibility;
-		/* clear any selected items so they don't show after the layer is hidden */
-		render_clear_selection_buffer();
 
 	      callbacks_update_layer_tree ();
-		if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
+		if (screenRenderInfo.renderType < 2) {
 			render_refresh_rendered_image_on_screen();
 		}
 		else {
@@ -1955,7 +1836,7 @@ callbacks_remove_layer_button_clicked  (GtkButton *button, gpointer   user_data)
 	      callbacks_update_layer_tree ();
 	      callbacks_select_row (0);
 
-		if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
+		if (screenRenderInfo.renderType < 2) {
 			render_refresh_rendered_image_on_screen();
 		}
 		else {
@@ -1967,13 +1848,6 @@ callbacks_remove_layer_button_clicked  (GtkButton *button, gpointer   user_data)
 
 /* --------------------------------------------------------- */
 void
-callbacks_move_layer_down_menu_activate (GtkMenuItem *menuitem, gpointer user_data) {
-	callbacks_move_layer_down_button_clicked(NULL, NULL);
-	gtk_widget_grab_focus (screen.win.layerTree);
-}
-
-/* --------------------------------------------------------- */
-void
 callbacks_move_layer_down_button_clicked  (GtkButton *button, gpointer   user_data) {
 	gint index=callbacks_get_selected_row_index();
 	
@@ -1981,7 +1855,7 @@ callbacks_move_layer_down_button_clicked  (GtkButton *button, gpointer   user_da
 		gerbv_change_layer_order (mainProject, index, index + 1);
 	      callbacks_update_layer_tree ();
 	      callbacks_select_row (index + 1);
-		if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
+		if (screenRenderInfo.renderType < 2) {
 			render_refresh_rendered_image_on_screen();
 		}
 		else {
@@ -1993,21 +1867,14 @@ callbacks_move_layer_down_button_clicked  (GtkButton *button, gpointer   user_da
 
 /* --------------------------------------------------------- */
 void
-callbacks_move_layer_up_menu_activate (GtkMenuItem *menuitem, gpointer user_data) {
-	callbacks_move_layer_up_button_clicked(NULL, NULL);
-	gtk_widget_grab_focus (screen.win.layerTree);
-}
-
-/* --------------------------------------------------------- */
-void
-callbacks_move_layer_up_button_clicked  (GtkButton *button, gpointer   user_data) {
+callbacks_move_layer_up_clicked  (GtkButton *button, gpointer   user_data) {
 	gint index=callbacks_get_selected_row_index();
 	
 	if (index > 0) {
 		gerbv_change_layer_order (mainProject, index, index - 1);
 		callbacks_update_layer_tree ();
 		callbacks_select_row (index - 1);
-		if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
+		if (screenRenderInfo.renderType < 2) {
 			render_refresh_rendered_image_on_screen();
 		}
 		else {
@@ -2020,12 +1887,12 @@ callbacks_move_layer_up_button_clicked  (GtkButton *button, gpointer   user_data
 /* --------------------------------------------------------- */
 void callbacks_layer_tree_row_inserted (GtkTreeModel *tree_model, GtkTreePath  *path,
                               GtkTreeIter  *oIter, gpointer user_data) {
-	gint *indices=NULL,oldPosition,newPosition;
+	gint *indeces=NULL,oldPosition,newPosition;
       
 	if ((!screen.win.treeIsUpdating)&&(path != NULL)) {
-		indices = gtk_tree_path_get_indices (path);
-		if (indices) {
-			newPosition = indices[0];
+		indeces = gtk_tree_path_get_indices (path);
+		if (indeces) {
+			newPosition = indeces[0];
 			oldPosition = callbacks_get_selected_row_index ();
 			/* compensate for the fact that the old row has already
 			   been removed */
@@ -2035,7 +1902,7 @@ void callbacks_layer_tree_row_inserted (GtkTreeModel *tree_model, GtkTreePath  *
 				oldPosition--;
 			gerbv_change_layer_order (mainProject, oldPosition, newPosition);
 
-			if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
+			if (screenRenderInfo.renderType < 2) {
 				render_refresh_rendered_image_on_screen();
 			}
 			else {
@@ -2068,7 +1935,7 @@ callbacks_show_color_picker_dialog (gint index){
 		gtk_color_selection_set_current_color (colorsel, &mainProject->file[index]->color);
 	else
 		gtk_color_selection_set_current_color (colorsel, &mainProject->background);
-	if ((screenRenderInfo.renderType >= GERBV_RENDER_TYPE_CAIRO_NORMAL)&&(index >= 0)) {
+	if ((screenRenderInfo.renderType >= 2)&&(index >= 0)) {
 		gtk_color_selection_set_has_opacity_control (colorsel, TRUE);
 		gtk_color_selection_set_current_alpha (colorsel, mainProject->file[index]->alpha);
 	}
@@ -2085,7 +1952,7 @@ callbacks_show_color_picker_dialog (gint index){
 			gtk_color_selection_get_current_color (colorsel, &mainProject->background);
 			gdk_colormap_alloc_color(gdk_colormap_get_system(), &mainProject->background, FALSE, TRUE);
 		}
-		if ((screenRenderInfo.renderType >= GERBV_RENDER_TYPE_CAIRO_NORMAL)&&(index >= 0)) {
+		if ((screenRenderInfo.renderType >= 2)&&(index >= 0)) {
 			mainProject->file[rowIndex]->alpha = gtk_color_selection_get_current_alpha (colorsel);
 		}
 		
@@ -2220,35 +2087,6 @@ callbacks_change_layer_format_clicked  (GtkButton *button, gpointer   user_data)
 
 /* --------------------------------------------------------------------------- */
 gboolean
-callbacks_layer_tree_key_press (GtkWidget *widget, GdkEventKey *event, gpointer user_data) {
-	/* if space is pressed while a color picker icon is in focus,
-	show the color picker dialog. */
-	if(event->keyval == GDK_space){
-		GtkTreeView *tree;
-		GtkTreePath *path;
-		GtkTreeViewColumn *col;
-		gint *indices;
-		gint idx;
-
-		tree = (GtkTreeView *) screen.win.layerTree;
-		gtk_tree_view_get_cursor (tree, &path, &col);
-		if (path) {
-			indices = gtk_tree_path_get_indices (path);
-			if (indices) {
-				idx = callbacks_get_col_number_from_tree_view_column (col);
-				if ((idx == 1) && (indices[0] <= mainProject->last_loaded)){
-					callbacks_show_color_picker_dialog (indices[0]);
-				}
-			}
-			gtk_tree_path_free (path);
-		}
-	}
-	/* by default propagate the key press */
-	return FALSE;
-}
-
-/* --------------------------------------------------------------------------- */
-gboolean
 callbacks_layer_tree_button_press (GtkWidget *widget, GdkEventButton *event,
                                    gpointer user_data) {
       GtkTreePath *path;
@@ -2263,12 +2101,12 @@ callbacks_layer_tree_button_press (GtkWidget *widget, GdkEventButton *event,
 	      if (gtk_tree_view_get_path_at_pos  ((GtkTreeView *) widget, event->x, event->y,
 	      	&path, &column, &x, &y)) {
 		      if (gtk_tree_model_get_iter((GtkTreeModel *)list_store, &iter, path)) {
-		      	gint *indices;
-		      	indices = gtk_tree_path_get_indices (path);
-		      	if (indices) {
+		      	gint *indeces;
+		      	indeces = gtk_tree_path_get_indices (path);
+		      	if (indeces) {
 					columnIndex = callbacks_get_col_number_from_tree_view_column (column);
-					if ((columnIndex == 1) && (indices[0] <= mainProject->last_loaded)){
-						callbacks_show_color_picker_dialog (indices[0]);
+					if ((columnIndex == 1) && (indeces[0] <= mainProject->last_loaded)){
+						callbacks_show_color_picker_dialog (indeces[0]);
 						/* don't propagate the signal, since drag and drop can
 					   	sometimes activated during color selection */
 						return TRUE;
@@ -2529,7 +2367,7 @@ callbacks_support_benchmark (gerbv_render_info_t *renderInfo) {
 		now = time(NULL);
 		dprintf("Elapsed time = %ld seconds\n", (long int) (now - start));
 	}
-	g_message("FAST (=GDK) mode benchmark: %d redraws in %ld seconds (%g redraws/second)\n",
+	g_message("FAST mode benchmark: %d redraws in %ld seconds (%g redraws/second)\n",
 		      i, (long int) (now - start), (double) i / (double)(now - start));
 	gdk_pixmap_unref(renderedPixmap);
 	
@@ -2537,7 +2375,7 @@ callbacks_support_benchmark (gerbv_render_info_t *renderInfo) {
 	i = 0;
 	start = time(NULL);
 	now = start;
-	renderInfo->renderType = GERBV_RENDER_TYPE_CAIRO_NORMAL;
+	renderInfo->renderType = 2;
 	while( now - 30 < start) {
 		i++;
 		dprintf("Benchmark():  Starting redraw #%d\n", i);
@@ -2550,7 +2388,7 @@ callbacks_support_benchmark (gerbv_render_info_t *renderInfo) {
 		now = time(NULL);
 		dprintf("Elapsed time = %ld seconds\n", (long int) (now - start));
 	}
-	g_message("NORMAL (=Cairo) mode benchmark: %d redraws in %ld seconds (%g redraws/second)\n",
+	g_message("NORMAL mode benchmark: %d redraws in %ld seconds (%g redraws/second)\n",
 		      i, (long int) (now - start), (double) i / (double)(now - start));
 }
 
@@ -2687,7 +2525,7 @@ callbacks_drawingarea_configure_event (GtkWidget *widget, GdkEventConfigure *eve
 gboolean
 callbacks_drawingarea_expose_event (GtkWidget *widget, GdkEventExpose *event)
 {
-	if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR) {
+	if (screenRenderInfo.renderType < 2) {
 		GdkPixmap *new_pixmap;
 		GdkGC *gc = gdk_gc_new(widget->window);
 
@@ -2804,7 +2642,7 @@ callbacks_screen2board(gdouble *X, gdouble *Y, gint x, gint y) {
 }
 
 /* --------------------------------------------------------- */
-static void
+void
 callbacks_update_statusbar_coordinates (gint x, gint y) {
 	gdouble X, Y;
 
@@ -3170,53 +3008,28 @@ callbacks_update_statusbar_measured_distance (gdouble dx, gdouble dy){
 /* --------------------------------------------------------- */
 void
 callbacks_sidepane_render_type_combo_box_changed (GtkComboBox *widget, gpointer user_data) {
-	int type = gtk_combo_box_get_active (widget);
+	int activeRow = gtk_combo_box_get_active (widget);
 	
-	dprintf ("%s():  type = %d\n", __FUNCTION__, type);
-
-	if (type < 0 || type == screenRenderInfo.renderType)
-		return;
-
-	screenRenderInfo.renderType = type;
-	callbacks_render_type_changed ();
-}
-
-/* --------------------------------------------------------- */
-void
-callbacks_viewmenu_rendertype_changed (GtkCheckMenuItem *widget, gpointer user_data) {
-	gint type = GPOINTER_TO_INT(user_data);
-
-	if (type == screenRenderInfo.renderType)
-		return;
-
-	dprintf ("%s():  type = %d\n", __FUNCTION__, type);
-
-	screenRenderInfo.renderType = type;
-	callbacks_render_type_changed ();
-}
-
-/* --------------------------------------------------------- */
-void
-callbacks_viewmenu_units_changed (GtkCheckMenuItem *widget, gpointer user_data) {
-	gint unit = GPOINTER_TO_INT(user_data);
-
-	if (unit < 0 || unit == screen.unit)
-		return;
-
-	dprintf ("%s():  unit = %d, screen.unit = %d\n", __FUNCTION__, unit, screen.unit);
-
-	callbacks_units_changed (unit);
+	dprintf ("%s():  activeRow = %d\n", __FUNCTION__, activeRow);
+	screenRenderInfo.renderType = activeRow;
+	
+	render_refresh_rendered_image_on_screen();
 }
 
 /* --------------------------------------------------------- */
 void
 callbacks_statusbar_unit_combo_box_changed (GtkComboBox *widget, gpointer user_data) {
-	int unit = gtk_combo_box_get_active (widget);
+	int activeRow = gtk_combo_box_get_active (widget);
 	
-	if (unit < 0 || unit == screen.unit)
-		return;
-
-	callbacks_units_changed (unit);
+	if (activeRow >= 0) {
+		screen.unit = activeRow;	
+	}
+	callbacks_update_ruler_scales();
+	callbacks_update_statusbar_coordinates (screen.last_x, screen.last_y);
+	
+	if (screen.tool == MEASURE)
+		callbacks_update_statusbar_measured_distance (screen.win.lastMeasuredX,
+							screen.win.lastMeasuredY);
 }
 
 /* --------------------------------------------------------- */
@@ -3352,8 +3165,8 @@ void callbacks_force_expose_event_for_screen (void){
 	gdk_window_invalidate_rect (screen.drawing_area->window, &update_rect, FALSE);
 	
 	/* update other gui things that could have changed */
-	callbacks_update_ruler_scales ();
-	callbacks_update_scrollbar_limits ();
-	callbacks_update_scrollbar_positions ();
+	callbacks_update_ruler_scales();
+	callbacks_update_scrollbar_limits();
+	callbacks_update_scrollbar_positions();
 }
 
diff --git a/src/callbacks.h b/src/callbacks.h
index 9b8d698..c5de096 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -75,22 +75,6 @@ callbacks_quit_activate                       (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 
 void
-callbacks_fullscreen_toggled                  (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-callbacks_show_toolbar_toggled                (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-callbacks_show_sidepane_toggled               (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
-callbacks_toggle_layer_visibility_activate                (GtkMenuItem     *menuitem,
-                                        gpointer         user_data);
-
-void
 callbacks_zoom_in_activate                    (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
 
@@ -169,12 +153,6 @@ void
 callbacks_statusbar_unit_combo_box_changed (GtkComboBox *widget, gpointer user_data);
 
 void
-callbacks_viewmenu_units_changed (GtkCheckMenuItem *widget, gpointer user_data);
-
-void
-callbacks_viewmenu_rendertype_changed (GtkCheckMenuItem *widget, gpointer user_data);
-
-void
 callbacks_sidepane_render_type_combo_box_changed (GtkComboBox *widget, gpointer user_data);
 
 void
@@ -198,10 +176,6 @@ void
 callbacks_update_layer_tree (void);
 
 gboolean
-callbacks_layer_tree_key_press (GtkWidget *widget, GdkEventKey *event,
-                                   gpointer user_data);
-
-gboolean
 callbacks_layer_tree_button_press (GtkWidget *widget, GdkEventButton *event,
                                    gpointer user_data);
 
@@ -209,13 +183,9 @@ void callbacks_add_layer_button_clicked  (GtkButton *button, gpointer   user_dat
 
 void callbacks_remove_layer_button_clicked  (GtkButton *button, gpointer   user_data);
 
-void callbacks_move_layer_down_menu_activate (GtkMenuItem *menuitem, gpointer user_data);
-
 void callbacks_move_layer_down_button_clicked  (GtkButton *button, gpointer   user_data);
 
-void callbacks_move_layer_up_menu_activate (GtkMenuItem *menuitem, gpointer user_data);
-
-void callbacks_move_layer_up_button_clicked  (GtkButton *button, gpointer   user_data);
+void callbacks_move_layer_up_clicked  (GtkButton *button, gpointer   user_data);
 
 void callbacks_layer_tree_row_inserted (GtkTreeModel *tree_model, GtkTreePath  *path,
                               GtkTreeIter  *oIter, gpointer      user_data);
diff --git a/src/draw-gdk.c b/src/draw-gdk.c
index 769cdf7..7e692fb 100644
--- a/src/draw-gdk.c
+++ b/src/draw-gdk.c
@@ -531,19 +531,19 @@ gerbv_gdk_draw_prim22(GdkPixmap *pixmap, GdkGC *gc, double *p,
 
     points[2].x = (int)round((p[x_lower_left_idx]  + p[width_idx])
 			     * scale);
-    points[2].y = (int)round((p[y_lower_left_idx]  + p[height_idx])
+    points[2].y = (int)round((p[y_lower_left_idx]  - p[height_idx])
 			     * scale);
 
     points[3].x = (int)round(p[x_lower_left_idx] * scale);
-    points[3].y = (int)round((p[y_lower_left_idx] + p[height_idx])
+    points[3].y = (int)round((p[y_lower_left_idx] - p[height_idx])
 			     * scale);
 
     for (i = 0; i < nuf_points; i++) {
 	points[i] = rotate_point(points[i], p[rotation_idx]);
-	points[i].x = x + points[i].x;
-	points[i].y = y - points[i].y;
+	points[i].x += x;
+	points[i].y += y;
     }
-
+    
     gdk_gc_copy(local_gc, gc);
 
     /* Exposure */
diff --git a/src/draw.c b/src/draw.c
index 46c79dd..94f8774 100644
--- a/src/draw.c
+++ b/src/draw.c
@@ -45,51 +45,6 @@
 #include <cairo.h>
 
 #define dprintf if(DEBUG) printf
-#define PIXEL_ALIGN 1
-
-void
-draw_cairo_line_to (cairo_t *cairoTarget, gdouble x, gdouble y, gboolean adjustByHalf){
-	gdouble x1 = x, y1 = y;
-#ifdef PIXEL_ALIGN
-	cairo_user_to_device (cairoTarget, &x1, &y1);
-	x1 = round(x1);
-	y1 = round(y1);
-	if (adjustByHalf) {
-		x1 += 0.5;
-		y1 += 0.5;
-	}
-	cairo_device_to_user (cairoTarget, &x1, &y1);
-#endif
-	cairo_line_to (cairoTarget, x1, y1);
-}
-
-void
-draw_cairo_move_to (cairo_t *cairoTarget, gdouble x, gdouble y, gboolean oddWidth){
-	gdouble x1 = x, y1 = y;
-#ifdef PIXEL_ALIGN
-	cairo_user_to_device (cairoTarget, &x1, &y1);
-	x1 = round(x1);
-	y1 = round(y1);
-	if (oddWidth) {
-		x1 += 0.5;
-		y1 += 0.5;
-	}
-	cairo_device_to_user (cairoTarget, &x1, &y1);
-#endif
-	cairo_move_to (cairoTarget, x1, y1);
-}
-
-void
-draw_cairo_translate_adjust (cairo_t *cairoTarget, gdouble x, gdouble y){
-	gdouble x1 = x, y1 = y;
-#ifdef PIXEL_ALIGN
-	cairo_user_to_device (cairoTarget, &x1, &y1);
-	x1 = round(x1);
-	y1 = round(y1);
-	cairo_device_to_user (cairoTarget, &x1, &y1);
-#endif
-	cairo_translate (cairoTarget, x1, y1);
-}
 
 gboolean
 draw_net_in_selection_buffer (gerbv_net_t *net, gerbv_selection_info_t *selectionInfo) {
@@ -193,16 +148,8 @@ gerbv_draw_circle(cairo_t *cairoTarget, gdouble diameter)
  * Draws a rectangle _centered_ at x,y with sides x_side, y_side
  */
 static void
-gerbv_draw_rectangle(cairo_t *cairoTarget, gdouble width1, gdouble height1)
+gerbv_draw_rectangle(cairo_t *cairoTarget, gdouble width, gdouble height)
 {
-	gdouble width = width1, height = height1;
-	cairo_user_to_device_distance (cairoTarget, &width, &height);
-	width = round(width);
-	height = round(height);
-	width -= ((int)width % 2);
-	height -= ((int)height % 2);
-	cairo_device_to_user_distance (cairoTarget, &width, &height);
-	
     cairo_rectangle (cairoTarget, - width / 2.0, - height / 2.0, width, height);
     return;
 } /* gerbv_draw_rectangle */
@@ -532,7 +479,7 @@ draw_render_polygon_object (gerbv_net_t *oldNet, cairo_t *cairoTarget, gdouble s
 			cp_y = currentNet->cirseg->cp_y + sr_y;
 		}
 		if (!haveDrawnFirstFillPoint) {
-			draw_cairo_move_to (cairoTarget, x2, y2, FALSE);
+			cairo_move_to (cairoTarget, x2,y2);
 			haveDrawnFirstFillPoint=TRUE;
 			continue;
 		}
@@ -541,7 +488,7 @@ draw_render_polygon_object (gerbv_net_t *oldNet, cairo_t *cairoTarget, gdouble s
 			case GERBV_INTERPOLATION_LINEARx01 :
 			case GERBV_INTERPOLATION_LINEARx001 :
 			case GERBV_INTERPOLATION_LINEARx1 :
-				draw_cairo_line_to (cairoTarget, x2, y2, FALSE);
+				cairo_line_to (cairoTarget, x2,y2);
 				break;
 			case GERBV_INTERPOLATION_CW_CIRCULAR :
 			case GERBV_INTERPOLATION_CCW_CIRCULAR :
@@ -569,8 +516,6 @@ draw_render_polygon_object (gerbv_net_t *oldNet, cairo_t *cairoTarget, gdouble s
 	}
 }
 
-
-
 int
 draw_image_to_cairo_target (cairo_t *cairoTarget, gerbv_image_t *image,
 					gdouble pixelWidth,
@@ -579,14 +524,14 @@ draw_image_to_cairo_target (cairo_t *cairoTarget, gerbv_image_t *image,
  					gerbv_user_transformation_t transform, gboolean limitPixelSize){
 	struct gerbv_net *net, *polygonStartNet=NULL;
 	double x1, y1, x2, y2, cp_x=0, cp_y=0;
-	gdouble p1, p2, p3, p4, p5, dx, dy, lineWidth;
+	gdouble p1, p2, p3, p4, p5, dx, dy;
 	gerbv_netstate_t *oldState;
 	gerbv_layer_t *oldLayer;
 	int repeat_X=1, repeat_Y=1;
 	double repeat_dist_X = 0, repeat_dist_Y = 0;
 	int repeat_i, repeat_j;
 	cairo_operator_t drawOperatorClear, drawOperatorDark;
-	gboolean invertPolarity = FALSE, oddWidth = FALSE;
+	gboolean invertPolarity = FALSE;
 	gdouble minX=0, minY=0, maxX=0, maxY=0;
 	gdouble criticalRadius;
 	gdouble scaleX = transform.scaleX;
@@ -810,18 +755,8 @@ draw_image_to_cairo_target (cairo_t *cairoTarget, gerbv_image_t *image,
 				*/
 				else
 					criticalRadius = image->aperture[net->aperture]->parameter[0]/2.0;
-				lineWidth = criticalRadius*2.0;
-				// convert to a pixel integer
-				cairo_user_to_device_distance (cairoTarget, &lineWidth, &x1);
-				lineWidth = round(lineWidth);
-				if ((int)lineWidth % 2) {
-					oddWidth = TRUE;
-				}
-				else {
-					oddWidth = FALSE;
-				}
-				cairo_device_to_user_distance (cairoTarget, &lineWidth, &x1);
-				cairo_set_line_width (cairoTarget, lineWidth);
+
+				cairo_set_line_width (cairoTarget, criticalRadius*2.0);
 				switch (net->interpolation) {
 					case GERBV_INTERPOLATION_x10 :
 					case GERBV_INTERPOLATION_LINEARx01 :
@@ -833,8 +768,8 @@ draw_image_to_cairo_target (cairo_t *cairoTarget, gerbv_image_t *image,
 
 						switch (image->aperture[net->aperture]->type) {
 							case GERBV_APTYPE_CIRCLE :
-								draw_cairo_move_to (cairoTarget, x1, y1, oddWidth);
-								draw_cairo_line_to (cairoTarget, x2, y2, oddWidth);
+								cairo_move_to (cairoTarget, x1,y1);
+								cairo_line_to (cairoTarget, x2,y2);
 								draw_stroke (cairoTarget, drawMode, selectionInfo, image, net);
 								break;
 							case GERBV_APTYPE_RECTANGLE :				
@@ -845,19 +780,19 @@ draw_image_to_cairo_target (cairo_t *cairoTarget, gerbv_image_t *image,
 								if(y1 > y2)
 									dy = -dy;
 								cairo_new_path(cairoTarget);
-								draw_cairo_move_to (cairoTarget, x1 - dx, y1 - dy, FALSE);
-								draw_cairo_line_to (cairoTarget, x1 - dx, y1 + dy, FALSE);
-								draw_cairo_line_to (cairoTarget, x2 - dx, y2 + dy, FALSE);
-								draw_cairo_line_to (cairoTarget, x2 + dx, y2 + dy, FALSE);
-								draw_cairo_line_to (cairoTarget, x2 + dx, y2 - dy, FALSE);
-								draw_cairo_line_to (cairoTarget, x1 + dx, y1 - dy, FALSE);
+								cairo_move_to (cairoTarget, x1 - dx, y1 - dy);
+								cairo_line_to (cairoTarget, x1 - dx, y1 + dy);
+								cairo_line_to (cairoTarget, x2 - dx, y2 + dy);
+								cairo_line_to (cairoTarget, x2 + dx, y2 + dy);
+								cairo_line_to (cairoTarget, x2 + dx, y2 - dy);
+								cairo_line_to (cairoTarget, x1 + dx, y1 - dy);
 								draw_fill (cairoTarget, drawMode, selectionInfo, image, net);
 								break;
 							/* for now, just render ovals or polygons like a circle */
 							case GERBV_APTYPE_OVAL :
 							case GERBV_APTYPE_POLYGON :
-								draw_cairo_move_to (cairoTarget, x1,y1, oddWidth);
-								draw_cairo_line_to (cairoTarget, x2,y2, oddWidth);
+								cairo_move_to (cairoTarget, x1,y1);
+								cairo_line_to (cairoTarget, x2,y2);
 								draw_stroke (cairoTarget, drawMode, selectionInfo, image, net);
 								break;
 							/* macros can only be flashed, so ignore any that might be here */
@@ -905,8 +840,8 @@ draw_image_to_cairo_target (cairo_t *cairoTarget, gerbv_image_t *image,
 				p5 = image->aperture[net->aperture]->parameter[4];
 
 				cairo_save (cairoTarget);
-				draw_cairo_translate_adjust(cairoTarget, x2, y2);
-				
+				cairo_translate (cairoTarget, x2, y2);
+
 				switch (image->aperture[net->aperture]->type) {
 					case GERBV_APTYPE_CIRCLE :
 						gerbv_draw_circle(cairoTarget, p1);
diff --git a/src/drill.c b/src/drill.c
index 16b3c1c..b44b2d6 100644
--- a/src/drill.c
+++ b/src/drill.c
@@ -518,9 +518,6 @@ parse_drillfile(gerb_file_t *fd, gerbv_HID_Attribute *attr_list, int n_attr, int
 							 GERBV_MESSAGE_WARNING);
 			       }
 			   }
-			   else
-			   /* unget the char in case we just advanced past a new line char */
-			   	gerb_ungetc (fd);
 		       }
 		   }
 		   break;
@@ -623,6 +620,7 @@ parse_drillfile(gerb_file_t *fd, gerbv_HID_Attribute *attr_list, int n_attr, int
 				      -1,
 				      string,
 				      GERBV_MESSAGE_NOTE);
+		g_free(string);
 		g_free(tmps);
 		break;
 	    case DRILL_M_NOT_IMPLEMENTED :
@@ -849,7 +847,7 @@ parse_drillfile(gerb_file_t *fd, gerbv_HID_Attribute *attr_list, int n_attr, int
 gboolean
 drill_file_p(gerb_file_t *fd, gboolean *returnFoundBinary)
 {
-    char *buf=NULL, *tbuf;
+    char *buf;
     int len = 0;
     char *letter;
     int ascii;
@@ -863,34 +861,16 @@ drill_file_p(gerb_file_t *fd, gboolean *returnFoundBinary)
     gboolean found_T = FALSE;
     gboolean found_X = FALSE;
     gboolean found_Y = FALSE;
-    gboolean end_comments=FALSE;
  
-    tbuf = g_malloc(MAXL);
-    if (tbuf == NULL) 
-		GERB_FATAL_ERROR("malloc buf failed while checking for drill file.\n");
-
-    while (fgets(tbuf, MAXL, fd->fd) != NULL) {
-	len = strlen(tbuf);
-	buf=tbuf;
-	/* check for comments at top of file.  */
-	if(!end_comments){
-		if(g_strstr_len(buf, len, ";")!=NULL){/* comments at top of file  */
-			for (i=0;i<len-1;++i){
-				if(buf[i]=='\n' && buf[i+1] != ';' && buf[i+1] != '\r' && buf[i+1] != '\n'){
-					end_comments=TRUE;
-					buf=&tbuf[i+1];	/* set rest of parser to end of comments  */
-					
-				}
-			}
-			if(!end_comments)
-				continue;
-		}			
-		else 
-			end_comments=TRUE;
-	}
+    buf = g_malloc(MAXL);
+    if (buf == NULL) 
+	GERB_FATAL_ERROR("malloc buf failed while checking for drill file.\n");
 
-	/* First look through the file for indications of its type */
+    while (fgets(buf, MAXL, fd->fd) != NULL) {
 	len = strlen(buf);
+
+	/* First look through the file for indications of its type */
+
 	/* check that file is not binary (non-printing chars) */
 	for (i = 0; i < len; i++) {
 	    ascii = (int) buf[i];
@@ -944,7 +924,7 @@ drill_file_p(gerb_file_t *fd, gboolean *returnFoundBinary)
     } /* while (fgets(buf, MAXL, fd->fd) */
 
     rewind(fd->fd);
-    free(tbuf);
+    free(buf);
     *returnFoundBinary = found_binary;
     
     /* Now form logical expression determining if this is a drill file */
@@ -1695,27 +1675,26 @@ eat_line(gerb_file_t *fd)
     }
 } /* eat_line */
 
+
 /* -------------------------------------------------------------- */
 static char *
 get_line(gerb_file_t *fd)
 {
-	int read = gerb_fgetc(fd);
-	gchar *retstring;
-	gchar *tmps=g_strdup("");
-
-	while(read != 10 && read != 13) {
-		if (read == EOF)
-			return tmps;
-		retstring = g_strdup_printf("%s%c", tmps, read);
-
-		/* since g_strdup_printf allocates memory, we need to free it */
-		if (tmps)  {
-			g_free (tmps);
-			tmps = NULL;
-		}
-		tmps = retstring;;
-		read = gerb_fgetc(fd);
+    int read = gerb_fgetc(fd);
+    gchar *retstring = "";
+    gchar *tmps = NULL;
+
+    while(read != 10 && read != 13) {
+	if (read == EOF) return retstring;
+	retstring = g_strdup_printf("%s%c", retstring, read);
+
+	/* since g_strdup_printf allocates memory, we need to free it */
+	if (tmps)  {
+	    g_free (tmps);
+	    tmps = NULL;
 	}
-	return tmps;
+	tmps = retstring;;
+	read = gerb_fgetc(fd);
+    }
+    return retstring;
 } /* get_line */
-
diff --git a/src/export-rs274x.c b/src/export-rs274x.c
index 46460a0..a848de5 100644
--- a/src/export-rs274x.c
+++ b/src/export-rs274x.c
@@ -61,8 +61,8 @@ export_rs274x_write_macro (FILE *fd, gerbv_aperture_t *currentAperture,
 			
 			fprintf(fd, "4,%d,%d,\n",(int) ls->parameter[OUTLINE_EXPOSURE],
 				numberOfPoints);
-			/* add 1 point for the starting point here */
-			for (pointCounter=0; pointCounter <= numberOfPoints; pointCounter++) {
+			
+			for (pointCounter=0; pointCounter < numberOfPoints; pointCounter++) {
 			    fprintf(fd, "%f,%f,",ls->parameter[pointCounter * 2 + OUTLINE_FIRST_X],
 					   ls->parameter[pointCounter * 2 + OUTLINE_FIRST_Y]);
 			}
@@ -199,22 +199,14 @@ gerbv_export_rs274x_file_from_image (gchar *filename, gerbv_image_t *inputImage,
 	gerbv_netstate_t *oldState;
 	gerbv_layer_t *oldLayer;
 	gboolean insidePolygon=FALSE;
-	gerbv_user_transformation_t *thisTransform;
-	
-	if (transform != NULL) {
-		thisTransform = transform;
-	}
-	else {
-		gerbv_user_transformation_t identityTransform = {0,0,1,1,0,FALSE,FALSE,FALSE};
-		thisTransform = &identityTransform;
-	}
+
 	if ((fd = g_fopen(filename, "w")) == NULL) {
 		GERB_MESSAGE("Can't open file for writing: %s\n", filename);
 		return FALSE;
 	}
 	
 	/* duplicate the image, cleaning it in the process */
-	gerbv_image_t *image = gerbv_image_duplicate_image (inputImage, thisTransform);
+	gerbv_image_t *image = gerbv_image_duplicate_image (inputImage, transform);
 	
 	/* write header info */
 	fprintf(fd, "G04 This is an RS-274x file exported by *\n");
@@ -241,8 +233,8 @@ gerbv_export_rs274x_file_from_image (gchar *filename, gerbv_image_t *inputImage,
 	if (image->info->plotterFilm)
 		fprintf(fd, "%%PF%s*%%\n",image->info->plotterFilm);
 	/* image rotation */
-	if ((image->info->imageRotation != 0.0)||(thisTransform->rotation != 0.0))
-		fprintf(fd, "%%IR%d*%%\n",(int) ((image->info->imageRotation + thisTransform->rotation)*180/M_PI)%360);
+	if ((image->info->imageRotation != 0.0)||(transform->rotation != 0.0))
+		fprintf(fd, "%%IR%d*%%\n",(int) ((image->info->imageRotation + transform->rotation)*180/M_PI)%360);
 	if ((image->info->imageJustifyTypeA != GERBV_JUSTIFY_NOJUSTIFY) ||
 		(image->info->imageJustifyTypeB != GERBV_JUSTIFY_NOJUSTIFY)) {
 		fprintf(fd, "%%IJA");
@@ -259,13 +251,13 @@ gerbv_export_rs274x_file_from_image (gchar *filename, gerbv_image_t *inputImage,
 
 	}
 	/* handle scale user orientation transforms */
-	if ((fabs(thisTransform->scaleX - 1) > 0.00001) ||
-	(fabs(thisTransform->scaleY - 1) > 0.00001)) {
-		fprintf(fd, "%%SFA%.4fB%.4f*%%\n",thisTransform->scaleX,thisTransform->scaleY);
+	if ((fabs(transform->scaleX - 1) > 0.00001) ||
+	(fabs(transform->scaleY - 1) > 0.00001)) {
+		fprintf(fd, "%%SFA%.4fB%.4f*%%\n",transform->scaleX,transform->scaleY);
 	}
 	/* handle mirror image user orientation transform */
-	if ((thisTransform->mirrorAroundX)||(thisTransform->mirrorAroundY)) {
-		fprintf(fd, "%%MIA%dB%d*%%\n",thisTransform->mirrorAroundY,thisTransform->mirrorAroundX);
+	if ((transform->mirrorAroundX)||(transform->mirrorAroundY)) {
+		fprintf(fd, "%%MIA%dB%d*%%\n",transform->mirrorAroundY,transform->mirrorAroundX);
 	}
 	
 	/* define all apertures */
diff --git a/src/gerb_image.c b/src/gerb_image.c
index f027325..9ae3f27 100644
--- a/src/gerb_image.c
+++ b/src/gerb_image.c
@@ -681,36 +681,24 @@ gerbv_image_create_rectangle_object (gerbv_image_t *image, gdouble coordinateX,
 	currentNet->start_y = coordinateY;
 	currentNet->stop_x = coordinateX + width;
 	currentNet->stop_y = coordinateY;
-	gerber_update_min_and_max (&currentNet->boundingBox,currentNet->stop_x,currentNet->stop_y, 
-		0,0,0,0);
-	gerber_update_image_min_max (&currentNet->boundingBox, 0, 0, image);
-		
+	
 	currentNet = gerber_create_new_net (currentNet, NULL, NULL);
 	currentNet->interpolation = GERBV_INTERPOLATION_LINEARx1;
 	currentNet->aperture_state = GERBV_APERTURE_STATE_ON;
 	currentNet->stop_x = coordinateX + width;
 	currentNet->stop_y = coordinateY + height;
-	gerber_update_min_and_max (&currentNet->boundingBox,currentNet->stop_x,currentNet->stop_y, 
-		0,0,0,0);
-	gerber_update_image_min_max (&currentNet->boundingBox, 0, 0, image);
 	
 	currentNet = gerber_create_new_net (currentNet, NULL, NULL);
 	currentNet->interpolation = GERBV_INTERPOLATION_LINEARx1;
 	currentNet->aperture_state = GERBV_APERTURE_STATE_ON;
 	currentNet->stop_x = coordinateX;
 	currentNet->stop_y = coordinateY + height;
-	gerber_update_min_and_max (&currentNet->boundingBox,currentNet->stop_x,currentNet->stop_y, 
-		0,0,0,0);
-	gerber_update_image_min_max (&currentNet->boundingBox, 0, 0, image);
 	
 	currentNet = gerber_create_new_net (currentNet, NULL, NULL);
 	currentNet->interpolation = GERBV_INTERPOLATION_LINEARx1;
 	currentNet->aperture_state = GERBV_APERTURE_STATE_ON;
 	currentNet->stop_x = coordinateX;
 	currentNet->stop_y = coordinateY;
-	gerber_update_min_and_max (&currentNet->boundingBox,currentNet->stop_x,currentNet->stop_y, 
-		0,0,0,0);
-	gerber_update_image_min_max (&currentNet->boundingBox, 0, 0, image);
 	
 	/* create the polygon end node */
 	currentNet = gerber_create_new_net (currentNet, NULL, NULL);
@@ -776,21 +764,6 @@ gerbv_image_create_arc_object (gerbv_image_t *image, gdouble centerX, gdouble ce
 	currentNet->cirseg = g_new0 (gerbv_cirseg_t,1);
 	*(currentNet->cirseg) = cirSeg;
 	
-	gdouble angleDiff = currentNet->cirseg->angle2 - currentNet->cirseg->angle1;
-	gint i, steps = abs(angleDiff);
-	for (i=0; i<=steps; i++){
-		gdouble tempX = currentNet->cirseg->cp_x + currentNet->cirseg->width / 2.0 *
-				 cos ((currentNet->cirseg->angle1 +
-				 (angleDiff * i) / steps)*M_PI/180);
-		gdouble tempY = currentNet->cirseg->cp_y + currentNet->cirseg->width / 2.0 *
-				 sin ((currentNet->cirseg->angle1 +
-				 (angleDiff * i) / steps)*M_PI/180);
-		gerber_update_min_and_max (&currentNet->boundingBox,
-			       tempX, tempY, 
-			       lineWidth/2,lineWidth/2,
-			       lineWidth/2,lineWidth/2);
-	}
-	gerber_update_image_min_max (&currentNet->boundingBox, 0, 0, image);	
 	return;
 }
 
@@ -820,11 +793,6 @@ gerbv_image_create_line_object (gerbv_image_t *image, gdouble startX, gdouble st
 	currentNet->stop_x = endX;
 	currentNet->stop_y = endY;
 
-	gerber_update_min_and_max (&currentNet->boundingBox,currentNet->stop_x,currentNet->stop_y, 
-		lineWidth/2,lineWidth/2,lineWidth/2,lineWidth/2);
-	gerber_update_min_and_max (&currentNet->boundingBox,currentNet->start_x,currentNet->start_y, 
-		lineWidth/2,lineWidth/2,lineWidth/2,lineWidth/2);
-	gerber_update_image_min_max (&currentNet->boundingBox, 0, 0, image);
 	return;
 }
 
diff --git a/src/gerber.c b/src/gerber.c
index ac63a8a..84bfc8e 100644
--- a/src/gerber.c
+++ b/src/gerber.c
@@ -75,6 +75,12 @@ static void calc_cirseg_sq(struct gerbv_net *net, int cw,
 static void calc_cirseg_mq(struct gerbv_net *net, int cw, 
 			   double delta_cp_x, double delta_cp_y);
 
+static void
+gerber_update_min_and_max(gerbv_render_size_t *boundingBox,
+			  gdouble x, gdouble y, gdouble apertureSizeX1,
+			  gdouble apertureSizeX2,gdouble apertureSizeY1,
+			  gdouble apertureSizeY2);
+
 
 static void gerber_update_any_running_knockout_measurements(gerbv_image_t *image);
 
@@ -186,10 +192,6 @@ gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image,
 	    if (image->format && image->format->omit_zeros == GERBV_OMIT_ZEROS_TRAILING) {
 		
 		switch ((image->format->x_int + image->format->x_dec) - len) {
-		case 7:
-		    coord *= 10;
-		case 6:
-		    coord *= 10;
 		case 5:
 		    coord *= 10;
 		case 4:
@@ -218,10 +220,6 @@ gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image,
 	    if (image->format && image->format->omit_zeros == GERBV_OMIT_ZEROS_TRAILING) {
 
 		switch ((image->format->y_int + image->format->y_dec) - len) {
-		case 7:
-		    coord *= 10;
-		case 6:
-		    coord *= 10;
 		case 5:
 		    coord *= 10;
 		case 4:
@@ -250,10 +248,6 @@ gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image,
 	    if (image->format && image->format->omit_zeros == GERBV_OMIT_ZEROS_TRAILING) {
 
 		switch ((image->format->y_int + image->format->y_dec) - len) {
-		case 7:
-		    coord *= 10;
-		case 6:
-		    coord *= 10;
 		case 5:
 		    coord *= 10;
 		case 4:
@@ -279,10 +273,6 @@ gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image,
 	    if (image->format && image->format->omit_zeros == GERBV_OMIT_ZEROS_TRAILING) {
 
 		switch ((image->format->y_int + image->format->y_dec) - len) {
-		case 7:
-		    coord *= 10;
-		case 6:
-		    coord *= 10;
 		case 5:
 		    coord *= 10;
 		case 4:
@@ -305,10 +295,7 @@ gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image,
 	    dprintf("... Found %% code\n");
 	    while (1) {
 	    	parse_rs274x(levelOfRecursion, fd, image, state, curr_net, stats, directoryPath);
-	    	/* advance past any whitespace here */
 		int c = gerb_fgetc(fd);
-		while ((c == '\n')||(c == '\r')||(c == ' ')||(c == '\t')||(c == 0))
-			c = gerb_fgetc(fd);
 		if(c == EOF || c == '%')
 		    break;
 		// loop again to catch multiple blocks on the same line (separated by * char)
@@ -685,8 +672,14 @@ gerber_parse_file_segment (gint levelOfRecursion, gerbv_image_t *image,
 					     
 		}
 		/* update the info bounding box with this latest bounding box */
-		gerber_update_image_min_max(&boundingBox, repeat_off_X, repeat_off_Y, image);
-		
+		if (boundingBox.left < image->info->min_x)
+			image->info->min_x = boundingBox.left;
+		if (boundingBox.right+repeat_off_X > image->info->max_x)
+			image->info->max_x = boundingBox.right+repeat_off_X;
+		if (boundingBox.bottom < image->info->min_y)
+			image->info->min_y = boundingBox.bottom;
+		if (boundingBox.top+repeat_off_Y > image->info->max_y)
+			image->info->max_y = boundingBox.top+repeat_off_Y;
 		/* optionally update the knockout measurement box */
 		if (knockoutMeasure) {
 			if (boundingBox.left < knockoutLimitXmin)
@@ -2659,19 +2652,7 @@ gerber_calculate_final_justify_effects(gerbv_image_t *image)
 } /* gerber_calculate_final_justify_effects */
 
 
-void gerber_update_image_min_max (gerbv_render_size_t *boundingBox, double repeat_off_X,
-		double repeat_off_Y, gerbv_image_t* image) {
-	if (boundingBox->left < image->info->min_x)
-		image->info->min_x = boundingBox->left;
-	if (boundingBox->right+repeat_off_X > image->info->max_x)
-		image->info->max_x = boundingBox->right+repeat_off_X;
-	if (boundingBox->bottom < image->info->min_y)
-		image->info->min_y = boundingBox->bottom;
-	if (boundingBox->top+repeat_off_Y > image->info->max_y)
-		image->info->max_y = boundingBox->top+repeat_off_Y;
-}
-
-void
+static void
 gerber_update_min_and_max(gerbv_render_size_t *boundingBox,
 			  gdouble x, gdouble y, gdouble apertureSizeX1,
 			  gdouble apertureSizeX2,gdouble apertureSizeY1,
diff --git a/src/gerber.h b/src/gerber.h
index b30510f..98f9ec8 100644
--- a/src/gerber.h
+++ b/src/gerber.h
@@ -69,13 +69,6 @@ gerber_create_new_net (gerbv_net_t *currentNet, gerbv_layer_t *layer, gerbv_nets
 gboolean
 gerber_create_new_aperture (gerbv_image_t *image, int *indexNumber,
 		gerbv_aperture_type_t apertureType, gdouble parameter1, gdouble parameter2);
-		
-void gerber_update_image_min_max (gerbv_render_size_t *boundingBox, double repeat_off_X,
-		double repeat_off_Y, gerbv_image_t* image);
-void gerber_update_min_and_max(gerbv_render_size_t *boundingBox,
-			  gdouble x, gdouble y, gdouble apertureSizeX1,
-			  gdouble apertureSizeX2,gdouble apertureSizeY1,
-			  gdouble apertureSizeY2);
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gerbv.c b/src/gerbv.c
index 6a78db0..e5fa510 100644
--- a/src/gerbv.c
+++ b/src/gerbv.c
@@ -689,10 +689,10 @@ gerbv_render_to_pixmap_using_gdk (gerbv_project_t *gerbvProject, GdkPixmap *pixm
 			gdk_gc_set_function(gc, GDK_COPY);
 			gdk_draw_rectangle(colorStamp, gc, TRUE, 0, 0, -1, -1);
 			
-			if (renderInfo->renderType == GERBV_RENDER_TYPE_GDK) {
+			if (renderInfo->renderType == 0) {
 				gdk_gc_set_function(gc, GDK_COPY);
 			}
-			else if (renderInfo->renderType == GERBV_RENDER_TYPE_GDK_XOR) {
+			else if (renderInfo->renderType == 1) {
 				gdk_gc_set_function(gc, GDK_XOR);
 			}
 			/*
@@ -808,11 +808,11 @@ gerbv_render_cairo_set_scale_and_translation(cairo_t *cr, gerbv_render_info_t *r
 	
 	/* renderTypes 0 and 1 use GDK rendering, so we shouldn't have made it
 	   this far */
-	if (renderInfo->renderType == GERBV_RENDER_TYPE_CAIRO_NORMAL) {
+	if (renderInfo->renderType == 2) {
 		cairo_set_tolerance (cr, 1.0);
 		cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
 	}
-	else if (renderInfo->renderType == GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY) {
+	else if (renderInfo->renderType == 3) {
 		cairo_set_tolerance (cr, 0.1);
 		cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
 	}
diff --git a/src/gerbv.h b/src/gerbv.h
index 5756e1a..081ad76 100644
--- a/src/gerbv.h
+++ b/src/gerbv.h
@@ -226,8 +226,7 @@ typedef enum {GERBV_SELECTION_EMPTY, /*!< the selection buffer is empty */
 typedef enum {GERBV_RENDER_TYPE_GDK, /*!< render using normal GDK drawing functions */
 		GERBV_RENDER_TYPE_GDK_XOR, /*!< use the GDK_XOR mask to draw a pseudo-transparent scene */
 		GERBV_RENDER_TYPE_CAIRO_NORMAL, /*!< use the cairo library */
-		GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY, /*!< use the cairo library with the smoothest edges */
-		GERBV_RENDER_TYPE_MAX /*!< End-of-enum indicator */
+		GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY /*!< use the cairo library with the smoothest edges */
 } gerbv_render_types_t;
 
 /* 
diff --git a/src/interface.c b/src/interface.c
index ebb53a1..a5839db 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -34,7 +34,6 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <string.h>
-#include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
 
@@ -54,11 +53,11 @@
 #include "icons.h"
 extern gerbv_render_info_t screenRenderInfo;
 
+static 	GtkWidget *render_combobox;
+
 #define WIN_TITLE "Gerbv -- gEDA's Gerber Viewer"
 #define _(String) (String)
 
-#define dprintf if(DEBUG) printf
-
 /* ---------------------------------------------- */
 void
 rename_main_window(char const* filename, GtkWidget *main_win)
@@ -92,32 +91,8 @@ set_window_icon (GtkWidget * this_window)
 
 /* ---------------------------------------------- */
 void
-interface_load_accels (void)
-{	
-	gchar *accel_map_filename = g_build_filename (g_get_home_dir(), GERBV_ACCELS_RELPATH, NULL);
-	if (accel_map_filename) {
-		gtk_accel_map_load (accel_map_filename);
-		g_free (accel_map_filename);
-	}
-}
-
-/* ---------------------------------------------- */
-void
-interface_save_accels (void)
-{
-	gchar *accel_map_filename = g_build_filename (g_get_home_dir(), GERBV_ACCELS_RELPATH, NULL);
-	if (accel_map_filename) {
-		gtk_accel_map_save (accel_map_filename);
-		g_free (accel_map_filename);
-	}
-}
-
-/* ---------------------------------------------- */
-void
 interface_create_gui (int req_width, int req_height)
 {
-	GtkStockItem stock;
-
 	GtkWidget *mainWindow;
 	GtkWidget *vbox1;
 	GtkWidget *menubar1;
@@ -139,40 +114,18 @@ interface_create_gui (int req_width, int req_height)
 	GtkWidget *png;
 	GtkWidget *separator1;
 	GtkWidget *quit;
+	GtkWidget *backgroundColor;
 
 	GtkWidget *menuitem_edit;
 	GtkWidget *menuitem_edit_menu;
 	GtkWidget *delete_selected, *modify_selected;
+
 	GtkWidget *menuitem_view;
 	GtkWidget *menuitem_view_menu;
-	GtkWidget *view_fullscreen;
-	GtkWidget *show_toolbar;
-	GtkWidget *show_sidepane;
-	GtkWidget *separator3;
-	GtkWidget *layer_up;
-	GtkWidget *layer_down;
-	GtkWidget *toggle_layer_visibility_item1;
-	GtkWidget *toggle_layer_visibility_item2;
-	GtkWidget *toggle_layer_visibility_item3;
-	GtkWidget *toggle_layer_visibility_item4;
-	GtkWidget *toggle_layer_visibility_item5;
-	GtkWidget *toggle_layer_visibility_item6;
-	GtkWidget *toggle_layer_visibility_item7;
-	GtkWidget *toggle_layer_visibility_item8;
-	GtkWidget *toggle_layer_visibility_item9;
-	GtkWidget *toggle_layer_visibility_item10;
-	GtkWidget *separator4;
 	GtkWidget *zoom_in;
 	GtkWidget *zoom_out;
-	GtkWidget *fit_to_window;
 	GtkWidget *separator5;
-	GtkWidget *backgroundColor;
-	GtkWidget *menuitem_view_render, *menuitem_view_render_menu;
-	GSList *menu_view_render_group;
-	GtkWidget *render_fast, *render_fast_xor, *render_normal, *render_hq;
-	GtkWidget *menuitem_view_unit, *menuitem_view_unit_menu;
-	GSList *menu_view_unit_group;
-	GtkWidget *unit_mil, *unit_mm, *unit_in;
+	GtkWidget *fit_to_window;
 	GtkWidget *menuitem_analyze;
 	GtkWidget *menuitem_analyze_menu;
 	GtkWidget *analyze_active_gerbers;
@@ -192,8 +145,6 @@ interface_create_gui (int req_width, int req_height)
 	GtkWidget *zoom_tool;
 	GtkWidget *measure_tool;
 	GtkWidget *menuitem10;
-	GtkWidget *layer_visibility_menu;
-	GtkWidget *layer_visibility_main_menu;
 	GtkWidget *menuitem10_menu;
 	/*GtkWidget *online_manual;*/
 	GtkWidget *about;
@@ -232,7 +183,6 @@ interface_create_gui (int req_width, int req_height)
 	GtkWidget *vbox10;
 	GtkWidget *hbox4;
 	GtkWidget *label1;
-	GtkWidget *render_combobox;
 	GtkWidget *scrolledwindow1;
 	GtkWidget *hbox1;
 	GtkWidget *button4;
@@ -255,7 +205,7 @@ interface_create_gui (int req_width, int req_height)
 	GtkWidget *vRuler;
 	GtkWidget *hbox5;
 	GtkWidget *statusbar_label_left;
-	GtkWidget *statusUnitComboBox;
+	GtkWidget *combobox2;
 	GtkWidget *statusbar_label_right;
 	GtkWidget *drawingarea, *hAdjustment, *vAdjustment, *hScrollbar, *vScrollbar;
 	
@@ -273,6 +223,7 @@ interface_create_gui (int req_width, int req_height)
 	GtkWidget *tempImage;
 	GtkWidget *tempMenuItem;
 	
+	GtkStockItem item;
 	pointerpixbuf = gdk_pixbuf_new_from_inline(-1, pointer, FALSE, NULL);
 	movepixbuf = gdk_pixbuf_new_from_inline(-1, move, FALSE, NULL);
 	zoompixbuf = gdk_pixbuf_new_from_inline(-1, lzoom, FALSE, NULL);
@@ -282,7 +233,7 @@ interface_create_gui (int req_width, int req_height)
 	accel_group = gtk_accel_group_new ();
 
 	mainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-	gtk_window_set_title (GTK_WINDOW (mainWindow), _(WIN_TITLE));
+	gtk_window_set_title (GTK_WINDOW (mainWindow), _("Gerbv -- gEDA's Gerber Viewer"));
 
 	vbox1 = gtk_vbox_new (FALSE, 0);
 	gtk_container_add (GTK_CONTAINER (mainWindow), vbox1);
@@ -296,35 +247,35 @@ interface_create_gui (int req_width, int req_height)
 
 	/* File menu items dealing with a gerbv project. */
 	menuitem_file_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(menuitem_file_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(menuitem_file_menu), ACCEL_FILE);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_file), menuitem_file_menu);
 
-	new = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_NEW, ACCEL_FILE_NEW);
+	new = gtk_image_menu_item_new_from_stock ("gtk-new", accel_group);
 	gtk_tooltips_set_tip (tooltips, new, "Close all layers and start a new project", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), new);
+	gtk_widget_add_accelerator (new, "activate", accel_group,
+	                        GDK_n, (GdkModifierType) GDK_CONTROL_MASK,
+	                        GTK_ACCEL_VISIBLE);
+
 
-	open_project = gtk_image_menu_item_new_with_mnemonic (_("_Open project..."));
+	open_project = gtk_image_menu_item_new_with_mnemonic (_("_Open Project..."));
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), open_project);
 	gtk_tooltips_set_tip (tooltips, open_project, "Open an existing Gerbv project", NULL);
-	image33 = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
+	image33 = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (open_project), image33);
 
-	save = gtk_image_menu_item_new_with_mnemonic (_("Save project"));
+	save = gtk_image_menu_item_new_with_mnemonic ("Save Project");
 	gtk_tooltips_set_tip (tooltips, save, "Save the current project", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_SAVE, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (save), tempImage);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), save);
 
-	save_as = gtk_image_menu_item_new_with_mnemonic (_("Save project as..."));
+	save_as = gtk_image_menu_item_new_with_mnemonic ("Save Project As...");
 	gtk_tooltips_set_tip (tooltips, save_as, "Save the current project to a new file", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-save-as", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (save_as), tempImage);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), save_as);
 	
-	revert = gtk_image_menu_item_new_from_stock (GTK_STOCK_REVERT_TO_SAVED, NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_REVERT_TO_SAVED, ACCEL_FILE_REVERT);
+	revert = gtk_image_menu_item_new_from_stock ("gtk-revert-to-saved", accel_group);
 	gtk_tooltips_set_tip (tooltips, revert, "Reload all layers", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), revert);
 
@@ -333,19 +284,22 @@ interface_create_gui (int req_width, int req_height)
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), separator1);
 	gtk_widget_set_sensitive (separator1, FALSE);
 
-	open_layer = gtk_menu_item_new_with_mnemonic (_("Open _layer(s)..."));
-	gtk_accel_map_add_entry (ACCEL_FILE_OPEN_LAYER_PATH, ACCEL_FILE_OPEN_LAYER_KEY, ACCEL_FILE_OPEN_LAYER_MOD);
+	open_layer = gtk_menu_item_new_with_mnemonic (_("Open _Layer(s)..."));
+	gtk_widget_add_accelerator (open_layer, "activate", accel_group, 'O', GDK_CONTROL_MASK,
+				GTK_ACCEL_VISIBLE);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), open_layer);
 	gtk_tooltips_set_tip (tooltips, open_layer, "Open Gerber, drill, or pick and place file(s)", NULL);
 
 	save_layer = gtk_menu_item_new_with_mnemonic (_("_Save active layer"));
 	gtk_tooltips_set_tip (tooltips, save_layer, "Save the active layer", NULL);
-	gtk_accel_map_add_entry (ACCEL_FILE_SAVE_LAYER_PATH, ACCEL_FILE_SAVE_LAYER_KEY, ACCEL_FILE_SAVE_LAYER_MOD);
+	gtk_widget_add_accelerator (save_layer, "activate", accel_group, 'S', GDK_CONTROL_MASK,
+				GTK_ACCEL_VISIBLE);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), save_layer);
 	
-	save_as_layer = gtk_menu_item_new_with_mnemonic (_("Save active layer _as..."));
+	save_as_layer = gtk_menu_item_new_with_mnemonic (_("Save active layer _As..."));
 	gtk_tooltips_set_tip (tooltips, save_as_layer, "Save the active layer to a new file", NULL);
-	gtk_accel_map_add_entry (ACCEL_FILE_SAVE_LAYER_AS_PATH, ACCEL_FILE_SAVE_LAYER_AS_KEY, ACCEL_FILE_SAVE_LAYER_AS_MOD);
+	gtk_widget_add_accelerator (save_as_layer, "activate", accel_group, 'S',
+			GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_ACCEL_VISIBLE);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), save_as_layer);
 
 	/* File menu items dealing with exporting different types of files. */
@@ -358,11 +312,9 @@ interface_create_gui (int req_width, int req_height)
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), export);
 
 	export_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(export_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(export_menu), ACCEL_FILE_EXPORT);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (export), export_menu);
 
-	png = gtk_menu_item_new_with_mnemonic (_("P_NG..."));
+	png = gtk_menu_item_new_with_mnemonic (_("PNG..."));
 	gtk_container_add (GTK_CONTAINER (export_menu), png);
 	gtk_tooltips_set_tip (tooltips, png, _("Export project to a PNG file..."), NULL);
 
@@ -371,22 +323,22 @@ interface_create_gui (int req_width, int req_height)
 	GtkWidget *svg;
 	GtkWidget *postscript;
 	
-	pdf = gtk_menu_item_new_with_mnemonic (_("P_DF..."));
+	pdf = gtk_menu_item_new_with_mnemonic (_("PDF..."));
 	gtk_container_add (GTK_CONTAINER (export_menu), pdf);
 	gtk_tooltips_set_tip (tooltips, pdf, _("Export project to a PDF file..."), NULL);
 
-	svg = gtk_menu_item_new_with_mnemonic (_("_SVG..."));
+	svg = gtk_menu_item_new_with_mnemonic (_("SVG..."));
 	gtk_container_add (GTK_CONTAINER (export_menu), svg);
 	gtk_tooltips_set_tip (tooltips, svg, _("Export project to a SVG file"), NULL);
 	
-	postscript = gtk_menu_item_new_with_mnemonic (_("_PostScript..."));
+	postscript = gtk_menu_item_new_with_mnemonic (_("PostScript..."));
 	gtk_container_add (GTK_CONTAINER (export_menu), postscript);
 	gtk_tooltips_set_tip (tooltips, postscript, _("Export project to a PostScript file"), NULL);
-	rs274x = gtk_menu_item_new_with_mnemonic (_("RS-274X (_Gerber)..."));
+	rs274x = gtk_menu_item_new_with_mnemonic (_("RS-274X (Gerber)..."));
 	gtk_container_add (GTK_CONTAINER (export_menu), rs274x);
 	gtk_tooltips_set_tip (tooltips, rs274x, _("Export layer to a RS-274X (Gerber) file"), NULL);
 	
-	drill = gtk_menu_item_new_with_mnemonic (_("_Excellon drill..."));
+	drill = gtk_menu_item_new_with_mnemonic (_("Excellon drill..."));
 	gtk_container_add (GTK_CONTAINER (export_menu), drill);
 	gtk_tooltips_set_tip (tooltips, drill, _("Export layer to an Excellon drill file"), NULL);
 	
@@ -395,14 +347,13 @@ interface_create_gui (int req_width, int req_height)
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), separator1);
 	gtk_widget_set_sensitive (separator1, FALSE);
 #if GTK_CHECK_VERSION(2,10,0)
-	if (gtk_stock_lookup(GTK_STOCK_PRINT, &stock)) {
+	if (gtk_stock_lookup("gtk-print", &item)) {
 	    gchar new[] = "_Print..."; 
-	    stock.label = new;
-	    gtk_stock_add(&stock, 1);
+	    item.label = new;
+	    gtk_stock_add(&item, 1);
 	}
 
-	print = gtk_image_menu_item_new_from_stock (GTK_STOCK_PRINT, NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_PRINT, ACCEL_FILE_PRINT);
+	print = gtk_image_menu_item_new_from_stock ("gtk-print", accel_group);
 	gtk_tooltips_set_tip (tooltips, print, "Print the visible layers", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), print);
 
@@ -410,8 +361,7 @@ interface_create_gui (int req_width, int req_height)
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), separator2);
 	gtk_widget_set_sensitive (separator2, FALSE);
 #endif
-	quit = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_QUIT, ACCEL_FILE_QUIT);
+	quit = gtk_image_menu_item_new_from_stock ("gtk-quit", accel_group);
 	gtk_tooltips_set_tip (tooltips, quit, "Quit Gerbv", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_file_menu), quit);
 
@@ -420,138 +370,48 @@ interface_create_gui (int req_width, int req_height)
 	gtk_container_add (GTK_CONTAINER (menubar1), menuitem_edit);
 
 	menuitem_edit_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(menuitem_edit_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(menuitem_edit_menu), ACCEL_EDIT);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_edit), menuitem_edit_menu);
 
-	/* Already in the analyze menu.
-	properties_selected = gtk_image_menu_item_new_with_mnemonic (_("Display object _properties"));
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_PROPERTIES, ACCEL_EDIT_PROPERTIES);
-	gtk_tooltips_set_tip (tooltips, properties_selected, "Examine the properties of the selected object", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (properties_selected), tempImage);
-	gtk_container_add (GTK_CONTAINER (menuitem_edit_menu), properties_selected);
-	*/
-
 	delete_selected = gtk_image_menu_item_new_with_mnemonic (_("_Delete selected object(s)"));
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_REMOVE, ACCEL_EDIT_DELETE);
-	gtk_tooltips_set_tip (tooltips, delete_selected, "Delete selected objects", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
+	gtk_tooltips_set_tip (tooltips, delete_selected,
+			      "Delete selected objects", NULL);
+	tempImage = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (delete_selected), tempImage);
 	gtk_container_add (GTK_CONTAINER (menuitem_edit_menu), delete_selected);
+	gtk_widget_add_accelerator (delete_selected, "activate", accel_group,
+	                        GDK_Delete, (GdkModifierType) 0, GTK_ACCEL_VISIBLE);
 
 	modify_selected = gtk_menu_item_new_with_mnemonic (_("_Modify layer orientation"));
-	gtk_tooltips_set_tip (tooltips, modify_selected, 
+	gtk_tooltips_set_tip (tooltips, delete_selected, 
 			      "Translate, zoom, rotate, or mirror the active layer", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_edit_menu), modify_selected);
 
-	/* --- Next menu item (View) --- */
+	/* --- Next menu item --- */
 	menuitem_view = gtk_menu_item_new_with_mnemonic (_("_View"));
 	gtk_container_add (GTK_CONTAINER (menubar1), menuitem_view);
 
 	menuitem_view_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(menuitem_view_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(menuitem_view_menu), ACCEL_VIEW);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_view), menuitem_view_menu);
-	
-	view_fullscreen = gtk_check_menu_item_new_with_mnemonic (_("Fullscr_een"));
-	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (view_fullscreen), FALSE);
-	gtk_tooltips_set_tip (tooltips, view_fullscreen, "Toggle between fullscreen and normal view", NULL);
-	SET_ACCELS (ACCEL_VIEW_FULLSCREEN);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), view_fullscreen);
-
-	show_toolbar = gtk_check_menu_item_new_with_mnemonic (_("Show _Toolbar"));
-	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (show_toolbar), TRUE);
-	gtk_tooltips_set_tip (tooltips, show_toolbar, "Toggle visibility of the toolbar", NULL);
-	SET_ACCELS (ACCEL_VIEW_TOOLBAR);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), show_toolbar);
-
-	show_sidepane = gtk_check_menu_item_new_with_mnemonic (_("Show _Sidepane"));
-	gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (show_sidepane), TRUE);
-	gtk_tooltips_set_tip (tooltips, show_sidepane, "Toggle visibility of the sidepane", NULL);
-	SET_ACCELS (ACCEL_VIEW_SIDEPANE);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), show_sidepane);
-
-	separator3 = gtk_separator_menu_item_new ();
-	gtk_widget_set_sensitive (separator3, FALSE);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), separator3);
-	
-	layer_up = gtk_menu_item_new_with_mnemonic (_("Move current layer _up"));
-	gtk_tooltips_set_tip (tooltips, layer_up, "Move the layer selected in the sidepane one step up", NULL);
-	SET_ACCELS (ACCEL_VIEW_LAYER_UP);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), layer_up);
-
-	layer_down = gtk_menu_item_new_with_mnemonic (_("Move current layer _down"));
-	gtk_tooltips_set_tip (tooltips, layer_down, "Move the layer selected in the sidepane one step down", NULL);
-	SET_ACCELS (ACCEL_VIEW_LAYER_DOWN);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), layer_down);
-
-	layer_visibility_main_menu = gtk_menu_item_new_with_mnemonic (_("Toggle layer _visibility"));
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), layer_visibility_main_menu);
-	
-	layer_visibility_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(layer_visibility_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(layer_visibility_menu), ACCEL_VIEW_VIS);
-	gtk_menu_item_set_submenu (GTK_MENU_ITEM (layer_visibility_main_menu), layer_visibility_menu);
-	
-	toggle_layer_visibility_item1 = gtk_menu_item_new_with_label ("Toggle visibility of layer 1");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER1);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item1);
-
-	toggle_layer_visibility_item2 = gtk_menu_item_new_with_label ("Toggle visibility of layer 2");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER2);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item2);
-
-	toggle_layer_visibility_item3 = gtk_menu_item_new_with_label ("Toggle visibility of layer 3");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER3);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item3);
-
-	toggle_layer_visibility_item4 = gtk_menu_item_new_with_label ("Toggle visibility of layer 4");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER4);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item4);
-
-	toggle_layer_visibility_item5 = gtk_menu_item_new_with_label ("Toggle visibility of layer 5");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER5);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item5);
 
-	toggle_layer_visibility_item6 = gtk_menu_item_new_with_label ("Toggle visibility of layer 6");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER6);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item6);
-
-	toggle_layer_visibility_item7 = gtk_menu_item_new_with_label ("Toggle visibility of layer 7");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER7);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item7);
-
-	toggle_layer_visibility_item8 = gtk_menu_item_new_with_label ("Toggle visibility of layer 8");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER8);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item8);
-
-	toggle_layer_visibility_item9 = gtk_menu_item_new_with_label ("Toggle visibility of layer 9");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER9);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item9);
-
-	toggle_layer_visibility_item10 = gtk_menu_item_new_with_label ("Toggle visibility of layer 10");
-	SET_ACCELS (ACCEL_VIEW_VIS_LAYER10);
-	gtk_container_add (GTK_CONTAINER (layer_visibility_menu), toggle_layer_visibility_item10);
-
-	separator4 = gtk_separator_menu_item_new ();
-	gtk_widget_set_sensitive (separator4, FALSE);
-	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), separator4);
-
-	zoom_in = gtk_image_menu_item_new_from_stock (GTK_STOCK_ZOOM_IN, NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_ZOOM_IN, ACCEL_VIEW_ZOOM_IN);
+	zoom_in = gtk_image_menu_item_new_from_stock ("gtk-zoom-in", accel_group);
 	gtk_tooltips_set_tip (tooltips, zoom_in, "Zoom in", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), zoom_in);
+	gtk_widget_add_accelerator (zoom_in, "activate", accel_group,
+	                        GDK_z, (GdkModifierType) 0, GTK_ACCEL_VISIBLE);
 	                        
-	zoom_out = gtk_image_menu_item_new_from_stock (GTK_STOCK_ZOOM_OUT, NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_ZOOM_OUT, ACCEL_VIEW_ZOOM_OUT);
+	zoom_out = gtk_image_menu_item_new_from_stock ("gtk-zoom-out", accel_group);
 	gtk_tooltips_set_tip (tooltips, zoom_out, "Zoom out", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), zoom_out);
+	gtk_widget_add_accelerator (zoom_out, "activate", accel_group,
+	                        GDK_z, (GdkModifierType) GDK_SHIFT_MASK,
+	                        GTK_ACCEL_VISIBLE);
 	                        
-	fit_to_window = gtk_image_menu_item_new_from_stock (GTK_STOCK_ZOOM_FIT, NULL);
+	fit_to_window = gtk_image_menu_item_new_from_stock ("gtk-zoom-fit", accel_group);
 	gtk_tooltips_set_tip (tooltips, fit_to_window, "Zoom to fit all visible layers in the window", NULL);
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_ZOOM_FIT, ACCEL_VIEW_ZOOM_FIT);
 	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), fit_to_window);
+	gtk_widget_add_accelerator (fit_to_window, "activate", accel_group,
+	                        GDK_f, (GdkModifierType) 0,
+	                        GTK_ACCEL_VISIBLE);
 	                        
 	separator5 = gtk_separator_menu_item_new ();
 	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), separator5);
@@ -560,85 +420,11 @@ interface_create_gui (int req_width, int req_height)
 	backgroundColor = gtk_menu_item_new_with_mnemonic ("Change background color");
 	gtk_tooltips_set_tip (tooltips, backgroundColor, "Change the background color", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_view_menu), backgroundColor);
-
-	{	// rendering submenu
-		menuitem_view_render = gtk_menu_item_new_with_mnemonic (_("_Rendering"));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_menu), menuitem_view_render);
-		
-		menuitem_view_render_menu = gtk_menu_new ();
-		gtk_menu_set_accel_group (GTK_MENU(menuitem_view_render_menu), accel_group);
-		gtk_menu_set_accel_path (GTK_MENU(menuitem_view_render_menu), ACCEL_VIEW_RENDER);
-		gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_view_render), menuitem_view_render_menu);
-
-		menu_view_render_group = NULL;
-
-		render_fast = gtk_radio_menu_item_new_with_mnemonic (menu_view_render_group, _("_Fast"));
-		menu_view_render_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (render_fast));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_render_menu), render_fast);
-
-		render_fast_xor = gtk_radio_menu_item_new_with_mnemonic (menu_view_render_group, _("Fast (_XOR)"));
-		menu_view_render_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (render_fast_xor));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_render_menu), render_fast_xor);
-
-		render_normal = gtk_radio_menu_item_new_with_mnemonic (menu_view_render_group, _("_Normal"));
-		menu_view_render_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (render_normal));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_render_menu), render_normal);
-
-		render_hq = gtk_radio_menu_item_new_with_mnemonic (menu_view_render_group, _("High _Quality"));
-		menu_view_render_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (render_hq));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_render_menu), render_hq);
-
-		screen.win.menu_view_render_group = malloc(4*sizeof(GtkWidget *));
-		if(screen.win.menu_view_render_group == NULL)
-			GERB_FATAL_ERROR("malloc for rendering type synchronization failed.\n");
-
-		screen.win.menu_view_render_group[GERBV_RENDER_TYPE_GDK] = GTK_CHECK_MENU_ITEM(render_fast);
-		screen.win.menu_view_render_group[GERBV_RENDER_TYPE_GDK_XOR] = GTK_CHECK_MENU_ITEM(render_fast_xor);
-		screen.win.menu_view_render_group[GERBV_RENDER_TYPE_CAIRO_NORMAL] = GTK_CHECK_MENU_ITEM(render_normal);
-		screen.win.menu_view_render_group[GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY] = GTK_CHECK_MENU_ITEM(render_hq);
-	}
-
-	{	// units submenu
-		gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (render_fast), TRUE);
-
-		menuitem_view_unit = gtk_menu_item_new_with_mnemonic (_("U_nits"));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_menu), menuitem_view_unit);
-
-		menuitem_view_unit_menu = gtk_menu_new ();
-		gtk_menu_set_accel_group (GTK_MENU(menuitem_view_unit_menu), accel_group);
-		gtk_menu_set_accel_path (GTK_MENU(menuitem_view_unit_menu), ACCEL_VIEW_RENDER);
-		gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_view_unit), menuitem_view_unit_menu);
-
-		menu_view_unit_group = NULL;
-
-		unit_mil = gtk_radio_menu_item_new_with_mnemonic (menu_view_unit_group, _("mi_l"));
-		menu_view_unit_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (unit_mil));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_unit_menu), unit_mil);
-
-		unit_mm = gtk_radio_menu_item_new_with_mnemonic (menu_view_unit_group, _("_mm"));
-		menu_view_unit_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (unit_mm));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_unit_menu), unit_mm);
-
-		unit_in = gtk_radio_menu_item_new_with_mnemonic (menu_view_unit_group, _("_in"));
-		menu_view_unit_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (unit_in));
-		gtk_container_add (GTK_CONTAINER (menuitem_view_unit_menu), unit_in);
-		
-		screen.win.menu_view_unit_group = malloc(3*sizeof(GtkWidget *));
-		if(screen.win.menu_view_unit_group == NULL)
-			GERB_FATAL_ERROR("malloc for display unit synchronization failed.\n");
-
-		screen.win.menu_view_unit_group[GERBV_MILS] = GTK_CHECK_MENU_ITEM(unit_mil);
-		screen.win.menu_view_unit_group[GERBV_MMS] = GTK_CHECK_MENU_ITEM(unit_mm);
-		screen.win.menu_view_unit_group[GERBV_INS] = GTK_CHECK_MENU_ITEM(unit_in);
-	}
-
-	/* --- Next menu item (Analyze) --- */
+	
 	menuitem_analyze = gtk_menu_item_new_with_mnemonic (_("_Analyze"));
 	gtk_container_add (GTK_CONTAINER (menubar1), menuitem_analyze);
 
 	menuitem_analyze_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(menuitem_analyze_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(menuitem_analyze_menu), ACCEL_ANAL);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem_analyze), menuitem_analyze_menu);
 
 	analyze_active_gerbers = gtk_menu_item_new_with_mnemonic (_("Analyze visible _Gerber layers"));
@@ -651,16 +437,18 @@ interface_create_gui (int req_width, int req_height)
 			      "Examine a detailed anaylsis of the contents of all visible drill layers", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_analyze_menu), analyze_active_drill);
 
-	analyze_display_selected_obj_props = gtk_image_menu_item_new_with_mnemonic (_("Display selected object(s) _properties"));
-	SET_ACCELS_FROM_STOCK (GTK_STOCK_PROPERTIES, ACCEL_ANAL_PROPERTIES);
-	gtk_tooltips_set_tip (tooltips, analyze_display_selected_obj_props, "Examine the properties of the selected object", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU);
-	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (analyze_display_selected_obj_props), tempImage);
+
+	analyze_display_selected_obj_props = gtk_menu_item_new_with_mnemonic (_("Display selected object(s) _properties"));
+	gtk_tooltips_set_tip (tooltips, analyze_display_selected_obj_props, 
+			      "Show the properties of the selected object(s).", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_analyze_menu), analyze_display_selected_obj_props);
+	gtk_widget_add_accelerator (analyze_display_selected_obj_props,
+					"activate", accel_group, GDK_q, (GdkModifierType) 0,
+	                        GTK_ACCEL_VISIBLE);
 
-	analyze_benchmark = gtk_menu_item_new_with_mnemonic (_("_Benchmark (1 min)"));
+	analyze_benchmark = gtk_menu_item_new_with_mnemonic (_("_Benchmark"));
 	gtk_tooltips_set_tip (tooltips, analyze_benchmark, 
-			      "Benchmark different rendering methods. Will make the application unresponsive for 1 minute!", NULL);
+			      "Show the properties of the selected object(s).", NULL);
 	gtk_container_add (GTK_CONTAINER (menuitem_analyze_menu), analyze_benchmark);
 
 
@@ -673,50 +461,54 @@ interface_create_gui (int req_width, int req_height)
 	gtk_container_add (GTK_CONTAINER (menubar1), menubar_tools);
 
 	menubar_tools_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(menubar_tools_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(menubar_tools_menu), ACCEL_TOOLS);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menubar_tools), menubar_tools_menu);
 	pointer_tool = gtk_image_menu_item_new_with_mnemonic (_("_Pointer Tool"));
 	/*
 	GtkWidget *tempImage = gtk_image_new_from_pixbuf (pointerpixbuf);
 	gtk_image_menu_item_set_image ((GtkImageMenuItem *)pointer_tool, tempImage);
 	*/
-	SET_ACCELS (ACCEL_TOOLS_POINTER);
 	gtk_container_add (GTK_CONTAINER (menubar_tools_menu), pointer_tool);
 	gtk_tooltips_set_tip (tooltips, pointer_tool, "Select objects on the screen", NULL);
+	gtk_widget_add_accelerator (pointer_tool, "activate", accel_group,
+	                        GDK_F1, (GdkModifierType) 0,
+	                        GTK_ACCEL_VISIBLE);
 	pan_tool = gtk_image_menu_item_new_with_mnemonic ("Pa_n Tool");
 	/*
 	tempImage = gtk_image_new_from_pixbuf (movepixbuf);
 	gtk_image_menu_item_set_image ((GtkImageMenuItem *)pan_tool, tempImage);
 	*/
-	SET_ACCELS (ACCEL_TOOLS_PAN);
 	gtk_container_add (GTK_CONTAINER (menubar_tools_menu), pan_tool);
 	gtk_tooltips_set_tip (tooltips, pan_tool, "Pan by left clicking and dragging", NULL);
+	gtk_widget_add_accelerator (pan_tool, "activate", accel_group,
+	                        GDK_F2, (GdkModifierType) 0,
+	                        GTK_ACCEL_VISIBLE);
 
 	zoom_tool = gtk_image_menu_item_new_with_mnemonic (_("_Zoom Tool"));
 	/*
 	tempImage = gtk_image_new_from_pixbuf (zoompixbuf);
 	gtk_image_menu_item_set_image ((GtkImageMenuItem *)zoom_tool, tempImage);
 	*/
-	SET_ACCELS (ACCEL_TOOLS_ZOOM);
 	gtk_container_add (GTK_CONTAINER (menubar_tools_menu), zoom_tool);
 	gtk_tooltips_set_tip (tooltips, zoom_tool, "Zoom by left clicking or dragging", NULL);
+	gtk_widget_add_accelerator (zoom_tool, "activate", accel_group,
+	                        GDK_F3, (GdkModifierType) 0,
+	                        GTK_ACCEL_VISIBLE);
 
 	measure_tool = gtk_image_menu_item_new_with_mnemonic (_("_Measure Tool"));
 	/*
 	tempImage = gtk_image_new_from_pixbuf (measurepixbuf);
 	gtk_image_menu_item_set_image ((GtkImageMenuItem *)measure_tool, tempImage);
 	*/
-	SET_ACCELS (ACCEL_TOOLS_MEASURE);
 	gtk_container_add (GTK_CONTAINER (menubar_tools_menu), measure_tool);
 	gtk_tooltips_set_tip (tooltips, measure_tool, "Measure distances on the screen", NULL);
+	gtk_widget_add_accelerator (measure_tool, "activate", accel_group,
+	                        GDK_F4, (GdkModifierType) 0,
+	                        GTK_ACCEL_VISIBLE);
 
 	menuitem10 = gtk_menu_item_new_with_mnemonic (_("_Help"));
 	gtk_container_add (GTK_CONTAINER (menubar1), menuitem10);
 
 	menuitem10_menu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(menuitem10_menu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(menuitem10_menu), ACCEL_HELP);
 	gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem10), menuitem10_menu);
 	/* Not ready for 2.0
 	online_manual = gtk_menu_item_new_with_mnemonic (_("_Online Manual..."));
@@ -728,7 +520,7 @@ interface_create_gui (int req_width, int req_height)
 	about = gtk_image_menu_item_new_with_mnemonic (_("_About Gerbv..."));
 	gtk_container_add (GTK_CONTAINER (menuitem10_menu), about);
 	gtk_tooltips_set_tip (tooltips, about, "View information about gerbv", NULL);
-	image34 = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_MENU);
+	image34 = gtk_image_new_from_stock ("gtk-dialog-info", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (about), image34);
 
 	bugs_menuitem = gtk_menu_item_new_with_mnemonic (_("Known _bugs in this version..."));
@@ -749,41 +541,41 @@ interface_create_gui (int req_width, int req_height)
 	gtk_toolbar_set_style (GTK_TOOLBAR (button_toolbar), GTK_TOOLBAR_ICONS);
 	tmp_toolbar_icon_size = gtk_toolbar_get_icon_size (GTK_TOOLBAR (button_toolbar));
 
-	toolbutton_new = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_NEW);
+	toolbutton_new = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-new");
 	gtk_tooltips_set_tip (tooltips, toolbutton_new, "Close all layers and start a new project", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_new);
 
-	toolbutton_open = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_OPEN);
+	toolbutton_open = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-open");
 	gtk_tooltips_set_tip (tooltips, toolbutton_open, "Open a previously saved gerbv project", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_open);
 
-	toolbutton_revert = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_REVERT_TO_SAVED);
+	toolbutton_revert = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-revert-to-saved");
 	gtk_tooltips_set_tip (tooltips, toolbutton_revert, "Reload all layers in project", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_revert);
 
-	toolbutton_save = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_SAVE);
+	toolbutton_save = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-save");
 	gtk_tooltips_set_tip (tooltips, toolbutton_save, "Save the current project", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_save);
 
 	separatortoolitem1 = (GtkWidget*) gtk_separator_tool_item_new ();
 	gtk_container_add (GTK_CONTAINER (button_toolbar), separatortoolitem1);
 #if GTK_CHECK_VERSION(2,10,0)
-	toolbutton_print = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_PRINT);
+	toolbutton_print = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-print");
 	gtk_tooltips_set_tip (tooltips, toolbutton_print, "Print the visible layers", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_print);
 
 	separatortoolitem2 = (GtkWidget*) gtk_separator_tool_item_new ();
 	gtk_container_add (GTK_CONTAINER (button_toolbar), separatortoolitem2);
 #endif
-	toolbutton_zoom_in = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_ZOOM_IN);
+	toolbutton_zoom_in = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-zoom-in");
 	gtk_tooltips_set_tip (tooltips, toolbutton_zoom_in, "Zoom in", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_zoom_in);
 
-	toolbutton_zoom_out = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_ZOOM_OUT);
+	toolbutton_zoom_out = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-zoom-out");
 	gtk_tooltips_set_tip (tooltips, toolbutton_zoom_out, "Zoom out", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_zoom_out);
 
-	toolbutton_zoom_fit = (GtkWidget*) gtk_tool_button_new_from_stock (GTK_STOCK_ZOOM_FIT);
+	toolbutton_zoom_fit = (GtkWidget*) gtk_tool_button_new_from_stock ("gtk-zoom-fit");
 	gtk_tooltips_set_tip (tooltips, toolbutton_zoom_fit, "Zoom to fit all visible layers in the window", NULL);
 	gtk_container_add (GTK_CONTAINER (button_toolbar), toolbutton_zoom_fit);
 
@@ -864,7 +656,7 @@ interface_create_gui (int req_width, int req_height)
 	gtk_combo_box_append_text (GTK_COMBO_BOX (render_combobox), _("Fast, with XOR"));
 	gtk_combo_box_append_text (GTK_COMBO_BOX (render_combobox), _("Normal"));
 	gtk_combo_box_append_text (GTK_COMBO_BOX (render_combobox), _("High quality"));
-	if (screenRenderInfo.renderType < GERBV_RENDER_TYPE_MAX)
+	if (screenRenderInfo.renderType < 4)
 	    gtk_combo_box_set_active (GTK_COMBO_BOX (render_combobox), screenRenderInfo.renderType);
 
 	scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
@@ -881,25 +673,25 @@ interface_create_gui (int req_width, int req_height)
 	button4 = gtk_button_new ();
 	gtk_box_pack_start (GTK_BOX (hbox1), button4, FALSE, TRUE, 0);
 
-	image8 = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
+	image8 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_BUTTON);
 	gtk_container_add (GTK_CONTAINER (button4), image8);
 
 	button5 = gtk_button_new ();
 	gtk_box_pack_start (GTK_BOX (hbox1), button5, FALSE, TRUE, 0);
 
-	image9 = gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON);
+	image9 = gtk_image_new_from_stock ("gtk-go-down", GTK_ICON_SIZE_BUTTON);
 	gtk_container_add (GTK_CONTAINER (button5), image9);
 
 	button6 = gtk_button_new ();
 	gtk_box_pack_start (GTK_BOX (hbox1), button6, FALSE, TRUE, 0);
 
-	image10 = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON);
+	image10 = gtk_image_new_from_stock ("gtk-go-up", GTK_ICON_SIZE_BUTTON);
 	gtk_container_add (GTK_CONTAINER (button6), image10);
 
 	button7 = gtk_button_new ();
 	gtk_box_pack_start (GTK_BOX (hbox1), button7, FALSE, TRUE, 0);
 
-	image11 = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_BUTTON);
+	image11 = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_BUTTON);
 	gtk_container_add (GTK_CONTAINER (button7), image11);
 
 	Layer_label = gtk_label_new (_("Layers"));
@@ -922,7 +714,7 @@ interface_create_gui (int req_width, int req_height)
 	gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (message_textview), GTK_WRAP_WORD);
 	gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (message_textview), FALSE);
 
-	clear_messages_button = gtk_button_new_from_stock (GTK_STOCK_CLEAR);
+	clear_messages_button = gtk_button_new_from_stock ("gtk-clear");
 	gtk_box_pack_start (GTK_BOX (vbox11), clear_messages_button, FALSE, FALSE, 0);
 
 	Message_label = gtk_label_new (_("Messages"));
@@ -975,11 +767,11 @@ interface_create_gui (int req_width, int req_height)
 	gtk_widget_set_size_request (statusbar_label_left, 130, -1);
 	gtk_label_set_justify ((GtkLabel *) statusbar_label_left, GTK_JUSTIFY_RIGHT);
 	
-	statusUnitComboBox = gtk_combo_box_new_text ();
-	gtk_box_pack_start (GTK_BOX (hbox5), statusUnitComboBox, FALSE, FALSE, 0);
-	gtk_combo_box_append_text (GTK_COMBO_BOX (statusUnitComboBox), _("mil"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (statusUnitComboBox), _("mm"));
-	gtk_combo_box_append_text (GTK_COMBO_BOX (statusUnitComboBox), _("in"));
+	combobox2 = gtk_combo_box_new_text ();
+	gtk_box_pack_start (GTK_BOX (hbox5), combobox2, FALSE, FALSE, 0);
+	gtk_combo_box_append_text (GTK_COMBO_BOX (combobox2), _("mil"));
+	gtk_combo_box_append_text (GTK_COMBO_BOX (combobox2), _("mm"));
+	gtk_combo_box_append_text (GTK_COMBO_BOX (combobox2), _("in"));
 
 	statusbar_label_right = gtk_label_new (_(""));
 	gtk_box_pack_start (GTK_BOX (hbox5), statusbar_label_right, TRUE, TRUE, 0);
@@ -1055,49 +847,6 @@ interface_create_gui (int req_width, int req_height)
 	                  NULL);
 
 	/* --- View menu --- */
-	g_signal_connect ((gpointer) view_fullscreen, "activate",
-	                  G_CALLBACK (callbacks_fullscreen_toggled),
-	                  GINT_TO_POINTER(0));
-	g_signal_connect ((gpointer) show_toolbar, "toggled",
-	                  G_CALLBACK (callbacks_show_toolbar_toggled),
-	                  toolbar_hbox);
-	g_signal_connect ((gpointer) show_sidepane, "toggled",
-	                  G_CALLBACK (callbacks_show_sidepane_toggled),
-	                  sidepane_vbox);
-	g_signal_connect ((gpointer) layer_up, "activate",
-	                  G_CALLBACK (callbacks_move_layer_up_menu_activate), NULL);
-	g_signal_connect ((gpointer) layer_down, "activate",
-	                  G_CALLBACK (callbacks_move_layer_down_menu_activate), NULL);
-	g_signal_connect ((gpointer) toggle_layer_visibility_item1, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(0));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item2, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(1));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item3, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(2));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item4, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(3));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item5, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(4));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item6, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(5));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item7, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(6));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item8, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(7));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item9, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(8));
-	g_signal_connect ((gpointer) toggle_layer_visibility_item10, "activate",
-	                  G_CALLBACK (callbacks_toggle_layer_visibility_activate),
-	                  GINT_TO_POINTER(9));
 	g_signal_connect ((gpointer) zoom_in, "activate",
 	                  G_CALLBACK (callbacks_zoom_in_activate),
 	                  NULL);
@@ -1110,15 +859,6 @@ interface_create_gui (int req_width, int req_height)
 	g_signal_connect ((gpointer) backgroundColor, "activate",
 	                  G_CALLBACK (callbacks_change_background_color_clicked),
 	                  NULL);
-	g_signal_connect ((gpointer) unit_mil, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_units_changed),
-	                  GINT_TO_POINTER(GERBV_MILS));
-	g_signal_connect ((gpointer) unit_mm, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_units_changed),
-	                  GINT_TO_POINTER(GERBV_MMS));
-	g_signal_connect ((gpointer) unit_in, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_units_changed),
-	                  GINT_TO_POINTER(GERBV_INS));
 
 	/* --- Analyze menu --- */
 	g_signal_connect ((gpointer) analyze_active_gerbers, "activate",
@@ -1204,7 +944,7 @@ interface_create_gui (int req_width, int req_height)
 	g_signal_connect ((gpointer) toggletoolbutton_measure, "clicked",
 	                  G_CALLBACK (callbacks_change_tool), (gpointer) 3);
 
-	g_signal_connect ((gpointer) statusUnitComboBox, "changed",
+	g_signal_connect ((gpointer) combobox2, "changed",
 	                  G_CALLBACK (callbacks_statusbar_unit_combo_box_changed),
 	                  NULL);
 	                  
@@ -1215,7 +955,7 @@ interface_create_gui (int req_width, int req_height)
 	g_signal_connect ((gpointer) button5, "clicked",
 	                  G_CALLBACK (callbacks_move_layer_down_button_clicked), NULL);
 	g_signal_connect ((gpointer) button6, "clicked",
-	                  G_CALLBACK (callbacks_move_layer_up_button_clicked), NULL);
+	                  G_CALLBACK (callbacks_move_layer_up_clicked), NULL);
 
 	g_signal_connect ((gpointer) hAdjustment, "value-changed",
 	                  G_CALLBACK (callbacks_hadjustment_value_changed), NULL);
@@ -1232,11 +972,11 @@ interface_create_gui (int req_width, int req_height)
 	
 
 	if (screen.unit == GERBV_MILS)
-		gtk_combo_box_set_active (GTK_COMBO_BOX (statusUnitComboBox), 0);
+		gtk_combo_box_set_active (GTK_COMBO_BOX (combobox2), 0);
 	else if (screen.unit == GERBV_MMS)
-		gtk_combo_box_set_active (GTK_COMBO_BOX (statusUnitComboBox), 1);
+		gtk_combo_box_set_active (GTK_COMBO_BOX (combobox2), 1);
 	else
-		gtk_combo_box_set_active (GTK_COMBO_BOX (statusUnitComboBox), 2);
+		gtk_combo_box_set_active (GTK_COMBO_BOX (combobox2), 2);
 	   
 	gint width, height;
               
@@ -1261,6 +1001,7 @@ interface_create_gui (int req_width, int req_height)
 	gtk_tree_view_column_set_min_width  ((GtkTreeViewColumn *)column,25);
 	gtk_signal_connect(GTK_OBJECT(renderer), "toggled",
 		       GTK_SIGNAL_FUNC(callbacks_layer_tree_visibility_button_toggled), NULL);
+		       
 	gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
 
 	renderer = gtk_cell_renderer_pixbuf_new ();
@@ -1287,8 +1028,6 @@ interface_create_gui (int req_width, int req_height)
 	gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
 
 	gtk_tree_view_set_headers_visible   ((GtkTreeView *)tree, FALSE);
-	gtk_signal_connect(GTK_OBJECT(tree), "key-press-event",
-		GTK_SIGNAL_FUNC(callbacks_layer_tree_key_press), NULL);
 	gtk_signal_connect(GTK_OBJECT(tree), "button-press-event",
 		GTK_SIGNAL_FUNC(callbacks_layer_tree_button_press), NULL);
 	gtk_container_add (GTK_CONTAINER (scrolledwindow1), tree);
@@ -1302,7 +1041,7 @@ interface_create_gui (int req_width, int req_height)
 	g_signal_connect (G_OBJECT(list_store), "row-inserted",
 			  G_CALLBACK (callbacks_layer_tree_row_inserted), NULL);
 	/* steal the focus to the tree to make sure none of the buttons are focused */
-	gtk_widget_grab_focus (tree);
+	gtk_widget_grab_focus (tree);	  		
 	/*
 	* Connect all events on drawing area 
 	*/    
@@ -1362,7 +1101,6 @@ interface_create_gui (int req_width, int req_height)
 	screen.win.hRuler = hRuler;
 	screen.win.vRuler = vRuler;	
 	screen.win.sidepane_notebook = sidepane_notebook;
-	screen.win.sidepaneRenderComboBox = GTK_COMBO_BOX(render_combobox);
 	screen.win.toolButtonPointer = toggletoolbutton_pointer;
 	screen.win.toolButtonPan = toggletoolbutton_pan;
 	screen.win.toolButtonZoom = toggletoolbutton_zoom;
@@ -1370,9 +1108,6 @@ interface_create_gui (int req_width, int req_height)
 	
 	/* Create right click popup menu for layer tree */
 	screen.win.layerTreePopupMenu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(screen.win.layerTreePopupMenu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(screen.win.layerTreePopupMenu), ACCEL_TREEPOPUP);
-
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Invert layer color");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Invert the display polarity of the layer", NULL);
@@ -1380,12 +1115,11 @@ interface_create_gui (int req_width, int req_height)
 	                  G_CALLBACK (callbacks_invert_layer_clicked), NULL);
 	                  
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Change color");
-	SET_ACCELS (ACCEL_TREEPOPUP_COLOR);
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Change the display color of the layer", NULL);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_change_layer_color_clicked), NULL);
-
+	                  
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Reload layer");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Reload the layer from disk", 
@@ -1410,50 +1144,47 @@ interface_create_gui (int req_width, int req_height)
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Add layer");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Open a new layer and insert it here", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (tempMenuItem), tempImage);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_add_layer_button_clicked), NULL);
-
+	                  
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Move layer down");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Move the layer down one in the layer list", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-go-down", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (tempMenuItem), tempImage);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_move_layer_down_button_clicked), NULL);
-
+	                  	
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Move layer up");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Move the layer up one in the layer list", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-go-up", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (tempMenuItem), tempImage);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
-	                  G_CALLBACK (callbacks_move_layer_up_button_clicked), NULL);
-
+	                  G_CALLBACK (callbacks_move_layer_up_clicked), NULL);
+	                  	
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Delete layer");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.layerTreePopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Remove this layer", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (tempMenuItem), tempImage);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_remove_layer_button_clicked), NULL);
-
+	                  
 	gtk_widget_show_all (screen.win.layerTreePopupMenu);
 	
 	/* Create right click popup menu for draw window */
 	screen.win.drawWindowPopupMenu = gtk_menu_new ();
-	gtk_menu_set_accel_group (GTK_MENU(screen.win.drawWindowPopupMenu), accel_group);
-	gtk_menu_set_accel_path (GTK_MENU(screen.win.drawWindowPopupMenu), ACCEL_WINPOPUP);
-
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Display object properties");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.drawWindowPopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Examine the properties of the selected object", NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_PROPERTIES, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-info", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (tempMenuItem), tempImage);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_display_object_properties_clicked), NULL);
-
+	                  
 	/*   Include these after they are coded.
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Edit object properties");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.drawWindowPopupMenu, tempMenuItem);
@@ -1466,18 +1197,18 @@ interface_create_gui (int req_width, int req_height)
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Move the selected object(s)",NULL);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_move_objects_clicked), NULL);
-
-	tempMenuItem = gtk_image_menu_item_new_with_label ("Reduce area");
+      
+        tempMenuItem = gtk_image_menu_item_new_with_label ("Reduce area");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.drawWindowPopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Reduce the area of the object (e.g. to prevent component floating)",NULL);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_reduce_object_area_clicked), NULL);
 	*/
-
+                        
 	tempMenuItem = gtk_image_menu_item_new_with_label ("Delete selected objects");
 	gtk_menu_shell_append ((GtkMenuShell *)screen.win.drawWindowPopupMenu, tempMenuItem);
 	gtk_tooltips_set_tip (tooltips, tempMenuItem, "Delete the selected object(s)",NULL);
-	tempImage = gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU);
+	tempImage = gtk_image_new_from_stock ("gtk-remove", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (tempMenuItem), tempImage);
 	g_signal_connect ((gpointer) tempMenuItem, "activate",
 	                  G_CALLBACK (callbacks_delete_objects_clicked), NULL);
@@ -1506,15 +1237,12 @@ interface_create_gui (int req_width, int req_height)
 
 	gtk_window_set_default_size((GtkWindow *)mainWindow, width, height);
 	
-	GtkSettings* gtksettings = gtk_settings_get_default ();
-	g_object_set (G_OBJECT(gtksettings), "gtk-can-change-accels", TRUE, NULL);
-	interface_load_accels ();
 	gtk_widget_show_all (mainWindow);
 	screen.win.topLevelWindow = mainWindow;
 	screen.win.messageTextView = message_textview;
 	screen.win.statusMessageLeft = statusbar_label_left;
 	screen.win.statusMessageRight = statusbar_label_right;
-	screen.win.statusUnitComboBox = statusUnitComboBox;
+	screen.win.statusUnitComboBox = combobox2;
 	screen.win.layerTree = tree;
 	screen.win.treeIsUpdating = FALSE;
 
@@ -1526,44 +1254,28 @@ interface_create_gui (int req_width, int req_height)
 	set_window_icon (mainWindow);
 	callbacks_update_layer_tree ();
 
-	/* connect this signals as late as possible to avoid triggering them before
+	/* connect this signal as late as possible to avoid triggering it before
 	   the gui is drawn */
-	g_signal_connect ((gpointer) render_fast, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_rendertype_changed),
-	                  GINT_TO_POINTER(GERBV_RENDER_TYPE_GDK));
-	g_signal_connect ((gpointer) render_fast_xor, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_rendertype_changed),
-	                  GINT_TO_POINTER(GERBV_RENDER_TYPE_GDK_XOR));
-	g_signal_connect ((gpointer) render_normal, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_rendertype_changed),
-	                  GINT_TO_POINTER(GERBV_RENDER_TYPE_CAIRO_NORMAL));
-	g_signal_connect ((gpointer) render_hq, "activate",
-	                  G_CALLBACK (callbacks_viewmenu_rendertype_changed),
-	                  GINT_TO_POINTER(GERBV_RENDER_TYPE_CAIRO_HIGH_QUALITY));
 	g_signal_connect ((gpointer) render_combobox, "changed",
 	                  G_CALLBACK (callbacks_sidepane_render_type_combo_box_changed),
 	                  NULL);
 	gtk_main();
-	interface_save_accels ();
 }
 
 /* ----------------------------------------------------  */
 void 
 interface_set_render_type (int t)
 {
-	if (t >= GERBV_RENDER_TYPE_MAX)
-		return;
-
-	screenRenderInfo.renderType = t;
-
-	/* make sure the interface is already up before calling
-	 * gtk_combo_box_set_active()
-	 */
-	if (!screen.win.sidepaneRenderComboBox)
-		return;
+    if (t >= 4)
+	return;
+    
+    screenRenderInfo.renderType = t;
 
-	gtk_combo_box_set_active (GTK_COMBO_BOX (screen.win.sidepaneRenderComboBox), t);
-	gtk_check_menu_item_set_active (screen.win.menu_view_render_group[t], TRUE);
+    /* make sure the interface is already up before calling
+     * gtk_combo_box_set_active()
+     */
+    if (render_combobox)
+	gtk_combo_box_set_active (GTK_COMBO_BOX (render_combobox), t);
 }
 
 /* ----------------------------------------------------  */
@@ -1606,7 +1318,7 @@ interface_get_alert_dialog_response (gchar *primaryText, gchar *secondaryText,
   gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (hbox1), 6);
 
-  image1 = gtk_image_new_from_icon_name (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+  image1 = gtk_image_new_from_icon_name ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
   gtk_box_pack_start (GTK_BOX (hbox1), image1, TRUE, TRUE, 0);
   gtk_misc_set_alignment (GTK_MISC (image1), 0.5, 0);
 
@@ -1636,13 +1348,13 @@ interface_get_alert_dialog_response (gchar *primaryText, gchar *secondaryText,
   dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
   gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
 
-  cancelbutton1 = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+  cancelbutton1 = gtk_button_new_from_stock ("gtk-cancel");
   gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), cancelbutton1, GTK_RESPONSE_CANCEL);
   GTK_WIDGET_SET_FLAGS (cancelbutton1, GTK_CAN_DEFAULT);
   gtk_widget_grab_default (cancelbutton1);
   gtk_widget_grab_focus (cancelbutton1);
 
-  okbutton1 = gtk_button_new_from_stock (GTK_STOCK_OK);
+  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
   gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
   GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
 
@@ -1700,7 +1412,7 @@ interface_show_alert_dialog (gchar *primaryText, gchar *secondaryText,
   gtk_box_pack_start (GTK_BOX (dialog_vbox1), hbox1, TRUE, TRUE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (hbox1), 6);
 
-  image1 = gtk_image_new_from_icon_name (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
+  image1 = gtk_image_new_from_icon_name ("gtk-dialog-warning", GTK_ICON_SIZE_DIALOG);
   gtk_box_pack_start (GTK_BOX (hbox1), image1, TRUE, TRUE, 0);
   gtk_misc_set_alignment (GTK_MISC (image1), 0.5, 0);
 
@@ -1729,7 +1441,7 @@ interface_show_alert_dialog (gchar *primaryText, gchar *secondaryText,
   dialog_action_area1 = GTK_DIALOG (dialog1)->action_area;
   gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1), GTK_BUTTONBOX_END);
 
-  okbutton1 = gtk_button_new_from_stock (GTK_STOCK_OK);
+  okbutton1 = gtk_button_new_from_stock ("gtk-ok");
   gtk_dialog_add_action_widget (GTK_DIALOG (dialog1), okbutton1, GTK_RESPONSE_OK);
   GTK_WIDGET_SET_FLAGS (okbutton1, GTK_CAN_DEFAULT);
 
diff --git a/src/interface.h b/src/interface.h
index fff9933..607a68d 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -26,142 +26,6 @@
     \ingroup gerbv
 */
 
-/** Sets the key acceleration of a menu item.
-First tries to lookup the given STOCK_ID with gtk_stock_lookup.
-If this succeeds and the retrieved GtkStockItem has an accelerator defined this accelerator is used.
-Otherwise the defaults given below are used.
-
-\warning There has to be a GtkStockItem variable 'stock' in scope where this macro is used.
-*/
-#define SET_ACCELS_FROM_STOCK(STOCK_ID, GERBV_ACCEL_ID)\
-if(gtk_stock_lookup (STOCK_ID, &stock) && stock.keyval != GDK_VoidSymbol && stock.keyval != 0)\
-	gtk_accel_map_add_entry (GERBV_ACCEL_ID ## _PATH, stock.keyval, stock.modifier);\
-else\
-	gtk_accel_map_add_entry (GERBV_ACCEL_ID ## _PATH, GERBV_ACCEL_ID ## _KEY, GERBV_ACCEL_ID ## _MOD)
-
-#define SET_ACCELS(GERBV_ACCEL_ID)\
-	gtk_accel_map_add_entry (GERBV_ACCEL_ID ## _PATH, GERBV_ACCEL_ID ## _KEY, GERBV_ACCEL_ID ## _MOD)
-
-/* If stock items/IDs are used the ACCEL_*_PATH macros have to match the labels of the stock items.
-Otherwise the (persistent) accelerators are broken. One workaround would be to look the labels up. */
-#define GERBV_ACCELS_RELPATH ".gnome2/accels/gerbv"
-#define ACCEL_ROOT						"<main>/"
-#define ACCEL_FILE						ACCEL_ROOT "file"
-#define ACCEL_FILE_NEW_PATH				ACCEL_FILE "/New"
-#define ACCEL_FILE_NEW_KEY				GDK_n
-#define ACCEL_FILE_NEW_MOD				(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_FILE_REVERT_PATH			ACCEL_FILE "/Revert"
-#define ACCEL_FILE_REVERT_KEY			GDK_F5
-#define ACCEL_FILE_REVERT_MOD			(GdkModifierType) 0
-#define ACCEL_FILE_OPEN_LAYER_PATH		ACCEL_FILE "/Open layer(s)..."
-#define ACCEL_FILE_OPEN_LAYER_KEY		GDK_O
-#define ACCEL_FILE_OPEN_LAYER_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_FILE_SAVE_LAYER_PATH		ACCEL_FILE "/Save active layer"
-#define ACCEL_FILE_SAVE_LAYER_KEY		GDK_S
-#define ACCEL_FILE_SAVE_LAYER_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_FILE_SAVE_LAYER_AS_PATH	ACCEL_FILE "/Save active layer as..."
-#define ACCEL_FILE_SAVE_LAYER_AS_KEY	GDK_S
-#define ACCEL_FILE_SAVE_LAYER_AS_MOD	(GdkModifierType) GDK_CONTROL_MASK | GDK_SHIFT_MASK
-#define ACCEL_FILE_EXPORT				ACCEL_FILE "/Export"
-#define ACCEL_FILE_PRINT_PATH			ACCEL_FILE "/Print..."
-#define ACCEL_FILE_PRINT_KEY			GDK_P
-#define ACCEL_FILE_PRINT_MOD			(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_FILE_QUIT_PATH			ACCEL_FILE "/Quit"
-#define ACCEL_FILE_QUIT_KEY				GDK_Q
-#define ACCEL_FILE_QUIT_MOD				(GdkModifierType) GDK_CONTROL_MASK
-
-#define ACCEL_EDIT						ACCEL_ROOT "edit"
-#define ACCEL_EDIT_DELETE_PATH			ACCEL_EDIT "/Delete selected object(s)"
-#define ACCEL_EDIT_DELETE_KEY			GDK_Delete
-#define ACCEL_EDIT_DELETE_MOD			(GdkModifierType) 0
-
-#define ACCEL_VIEW						ACCEL_ROOT "view"
-#define ACCEL_VIEW_FULLSCREEN_PATH		ACCEL_VIEW "/Fullscreen"
-#define ACCEL_VIEW_FULLSCREEN_KEY		GDK_F11
-#define ACCEL_VIEW_FULLSCREEN_MOD		(GdkModifierType) 0
-#define ACCEL_VIEW_TOOLBAR_PATH			ACCEL_VIEW "/Show Toolbar"
-#define ACCEL_VIEW_TOOLBAR_KEY			GDK_F7
-#define ACCEL_VIEW_TOOLBAR_MOD			(GdkModifierType) 0
-#define ACCEL_VIEW_SIDEPANE_PATH		ACCEL_VIEW "/Show Sidepane"
-#define ACCEL_VIEW_SIDEPANE_KEY			GDK_F9
-#define ACCEL_VIEW_SIDEPANE_MOD			(GdkModifierType) 0
-#define ACCEL_VIEW_LAYER_UP_PATH		ACCEL_VIEW "/Move current layer up"
-#define ACCEL_VIEW_LAYER_UP_KEY			GDK_Up
-#define ACCEL_VIEW_LAYER_UP_MOD			(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_LAYER_DOWN_PATH		ACCEL_VIEW "/Move current layer down"
-#define ACCEL_VIEW_LAYER_DOWN_KEY		GDK_Down
-#define ACCEL_VIEW_LAYER_DOWN_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS					ACCEL_VIEW "/Toggle layer visibilty"
-#define ACCEL_VIEW_VIS_LAYER1_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 1"
-#define ACCEL_VIEW_VIS_LAYER1_KEY		GDK_1
-#define ACCEL_VIEW_VIS_LAYER1_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER2_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 2"
-#define ACCEL_VIEW_VIS_LAYER2_KEY		GDK_2
-#define ACCEL_VIEW_VIS_LAYER2_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER3_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 3"
-#define ACCEL_VIEW_VIS_LAYER3_KEY		GDK_3
-#define ACCEL_VIEW_VIS_LAYER3_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER4_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 4"
-#define ACCEL_VIEW_VIS_LAYER4_KEY		GDK_4
-#define ACCEL_VIEW_VIS_LAYER4_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER5_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 5"
-#define ACCEL_VIEW_VIS_LAYER5_KEY		GDK_5
-#define ACCEL_VIEW_VIS_LAYER5_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER6_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 6"
-#define ACCEL_VIEW_VIS_LAYER6_KEY		GDK_6
-#define ACCEL_VIEW_VIS_LAYER6_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER7_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 7"
-#define ACCEL_VIEW_VIS_LAYER7_KEY		GDK_7
-#define ACCEL_VIEW_VIS_LAYER7_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER8_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 8"
-#define ACCEL_VIEW_VIS_LAYER8_KEY		GDK_8
-#define ACCEL_VIEW_VIS_LAYER8_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER9_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 9"
-#define ACCEL_VIEW_VIS_LAYER9_KEY		GDK_9
-#define ACCEL_VIEW_VIS_LAYER9_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_VIS_LAYER10_PATH		ACCEL_VIEW_VIS "/Toggle visibility of layer 10"
-#define ACCEL_VIEW_VIS_LAYER10_KEY		GDK_0
-#define ACCEL_VIEW_VIS_LAYER10_MOD		(GdkModifierType) GDK_CONTROL_MASK
-#define ACCEL_VIEW_ZOOM_IN_PATH			ACCEL_VIEW "/Zoom In"
-#define ACCEL_VIEW_ZOOM_IN_KEY			GDK_z
-#define ACCEL_VIEW_ZOOM_IN_MOD			(GdkModifierType) 0
-#define ACCEL_VIEW_ZOOM_OUT_PATH		ACCEL_VIEW "/Zoom Out"
-#define ACCEL_VIEW_ZOOM_OUT_KEY			GDK_z
-#define ACCEL_VIEW_ZOOM_OUT_MOD			(GdkModifierType) GDK_SHIFT_MASK
-#define ACCEL_VIEW_ZOOM_FIT_PATH		ACCEL_VIEW "/Best Fit"
-#define ACCEL_VIEW_ZOOM_FIT_KEY			GDK_f
-#define ACCEL_VIEW_ZOOM_FIT_MOD			(GdkModifierType) 0
-#define ACCEL_VIEW_RENDER				ACCEL_VIEW "/Rendering"
-#define ACCEL_VIEW_UNITS				ACCEL_VIEW "/Units"
-
-#define ACCEL_ANAL						ACCEL_ROOT "analyze"
-#define ACCEL_ANAL_PROPERTIES_PATH		ACCEL_ANAL "/Display object properties"
-#define ACCEL_ANAL_PROPERTIES_KEY		GDK_Return
-#define ACCEL_ANAL_PROPERTIES_MOD		(GdkModifierType) GDK_MOD1_MASK
-
-#define ACCEL_TOOLS						ACCEL_ROOT "tools"
-#define ACCEL_TOOLS_POINTER_PATH		ACCEL_TOOLS "/Pointer Tool"
-#define ACCEL_TOOLS_POINTER_KEY			GDK_1
-#define ACCEL_TOOLS_POINTER_MOD			(GdkModifierType) 0
-#define ACCEL_TOOLS_PAN_PATH			ACCEL_TOOLS "/Pan Tool"
-#define ACCEL_TOOLS_PAN_KEY				GDK_2
-#define ACCEL_TOOLS_PAN_MOD				(GdkModifierType) 0
-#define ACCEL_TOOLS_ZOOM_PATH			ACCEL_TOOLS "/Zoom Tool"
-#define ACCEL_TOOLS_ZOOM_KEY			GDK_3
-#define ACCEL_TOOLS_ZOOM_MOD			(GdkModifierType) 0
-#define ACCEL_TOOLS_MEASURE_PATH		ACCEL_TOOLS "/Measure Tool"
-#define ACCEL_TOOLS_MEASURE_KEY			GDK_4
-#define ACCEL_TOOLS_MEASURE_MOD			(GdkModifierType) 0
-
-#define ACCEL_HELP						ACCEL_ROOT "help"
-
-
-#define ACCEL_WINPOPUP					ACCEL_ROOT "WindowPopupMenu"
-
-#define ACCEL_TREEPOPUP					ACCEL_ROOT "TreePopupMenu"
-#define ACCEL_TREEPOPUP_COLOR_PATH		ACCEL_TREEPOPUP "/Change color"
-#define ACCEL_TREEPOPUP_COLOR_KEY		GDK_F6
-#define ACCEL_TREEPOPUP_COLOR_MOD		(GdkModifierType) 0
 
 void
 interface_create_gui (int req_width, int req_height);
diff --git a/src/main.c b/src/main.c
index d9aa138..936f1c8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -348,9 +348,9 @@ main(int argc, char *argv[])
     /* set default rendering mode */
 #ifdef WIN32
     /* Cairo seems to render faster on Windows, so use it for default */
-    screenRenderInfo.renderType = GERBV_RENDER_TYPE_CAIRO_NORMAL;
+    screenRenderInfo.renderType = 2;
 #else
-    screenRenderInfo.renderType = GERBV_RENDER_TYPE_GDK;
+    screenRenderInfo.renderType = 0;
 #endif
 
     logToFileOption = FALSE;
diff --git a/src/main.h b/src/main.h
index c35bbfa..b986b63 100644
--- a/src/main.h
+++ b/src/main.h
@@ -53,7 +53,6 @@ typedef struct {
 	GtkWidget *statusMessageLeft;
 	GtkWidget *statusMessageRight;
 	GtkWidget *statusUnitComboBox;
-	GtkCheckMenuItem **menu_view_unit_group;
 	GtkWidget *layerTree;
 	gboolean treeIsUpdating;
 	GtkWidget *colorSelectionDialog;
@@ -63,8 +62,6 @@ typedef struct {
 	GtkWidget *hRuler;
 	GtkWidget *vRuler;
 	GtkWidget *sidepane_notebook;
-	GtkComboBox *sidepaneRenderComboBox;
-	GtkCheckMenuItem **menu_view_render_group;
 	GtkWidget *project;
 	GtkWidget *gerber;
 	GtkWidget *about_dialog;
diff --git a/src/pick-and-place.c b/src/pick-and-place.c
index 7374cbe..205cad1 100644
--- a/src/pick-and-place.c
+++ b/src/pick-and-place.c
@@ -840,13 +840,11 @@ void
 pick_and_place_parse_file_to_images(gerb_file_t *fd, gerbv_image_t **topImage,
 			gerbv_image_t **bottomImage) 
 { 
-	GArray *parsedPickAndPlaceData = pick_and_place_parse_file (fd);
+    GArray *parsedPickAndPlaceData = pick_and_place_parse_file (fd);
 
-	if (parsedPickAndPlaceData != NULL) {
-		*bottomImage = pick_and_place_convert_pnp_data_to_image(parsedPickAndPlaceData, 0);
-		*topImage = pick_and_place_convert_pnp_data_to_image(parsedPickAndPlaceData, 1);
+    *bottomImage = pick_and_place_convert_pnp_data_to_image(parsedPickAndPlaceData, 0);
+    *topImage = pick_and_place_convert_pnp_data_to_image(parsedPickAndPlaceData, 1);
 
-		g_array_free (parsedPickAndPlaceData, TRUE);
-	}
+    g_array_free (parsedPickAndPlaceData, TRUE);
 } /* pick_and_place_parse_file_to_image */
 
diff --git a/src/project.c b/src/project.c
index 6cd8390..92118c4 100644
--- a/src/project.c
+++ b/src/project.c
@@ -766,7 +766,7 @@ gerbv_file_version(scheme *sc, pointer args)
     current_file_version = r;
 
     return sc->NIL;
-} /* gerbv_file_version */
+} /* set_render_type */
 
 
 /** Reads the content of a project file.
diff --git a/src/render.c b/src/render.c
index 961b904..2d0ba1d 100644
--- a/src/render.c
+++ b/src/render.c
@@ -81,9 +81,9 @@ render_layer_to_cairo_target_without_transforming(cairo_t *cr, gerbv_fileinfo_t
 
 gboolean
 render_check_scale_factor_limits (void) {
-	if ((screenRenderInfo.scaleFactorX > 20000)||(screenRenderInfo.scaleFactorY > 20000)) {
-		screenRenderInfo.scaleFactorX = 20000;
-		screenRenderInfo.scaleFactorY = 20000;
+	if ((screenRenderInfo.scaleFactorX > 5000)||(screenRenderInfo.scaleFactorY > 5000)) {
+		screenRenderInfo.scaleFactorX = 5000;
+		screenRenderInfo.scaleFactorY = 5000;
 		return FALSE;
 	}
 	return TRUE;
@@ -444,7 +444,7 @@ void render_refresh_rendered_image_on_screen (void) {
 	gdk_window_set_cursor(GDK_WINDOW(screen.drawing_area->window), cursor);
 	gdk_cursor_destroy(cursor);
 
-	if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR){
+	if (screenRenderInfo.renderType < 2){
 	    if (screen.pixmap) 
 		gdk_pixmap_unref(screen.pixmap);
 	    screen.pixmap = gdk_pixmap_new(screen.drawing_area->window, screenRenderInfo.displayWidth,
@@ -556,7 +556,7 @@ render_find_selected_objects_and_refresh_display (gint activeFileIndex, gboolean
 	if (!screen.selectionInfo.selectedNodeArray->len)
 		screen.selectionInfo.type = GERBV_SELECTION_EMPTY;
 	/* re-render the selection buffer layer */
-	if (screenRenderInfo.renderType <= GERBV_RENDER_TYPE_GDK_XOR){
+	if (screenRenderInfo.renderType < 2){
 		render_refresh_rendered_image_on_screen ();
 	}
 	else {
@@ -611,7 +611,7 @@ void render_recreate_composite_surface () {
 			cairo_set_source_surface (cr, (cairo_surface_t *) mainProject->file[i]->privateRenderData,
 			                              0, 0);
 			/* ignore alpha if we are in high-speed render mode */
-			if (((double) mainProject->file[i]->alpha < 65535)&&(screenRenderInfo.renderType != GERBV_RENDER_TYPE_GDK_XOR)) {
+			if (((double) mainProject->file[i]->alpha < 65535)&&(screenRenderInfo.renderType != 1)) {
 				cairo_paint_with_alpha(cr,(double) mainProject->file[i]->alpha/G_MAXUINT16);
 			}
 			else {
diff --git a/win32/build_gerbv b/win32/build_gerbv
index 44c0358..c9443b5 100755
--- a/win32/build_gerbv
+++ b/win32/build_gerbv
@@ -1,5 +1,6 @@
 #!/bin/sh
 #
+# $Id$
 #
 
 # error out on failed commands whose return code wasn't explicitly
@@ -11,7 +12,7 @@ cat << EOF
 
 $0 [options]
 
-Builds a non-cygwin version of gerbv or pcb and create a standalone
+Builds a non-cygwin version of gerbv and create a standalone
 windows installer.
 
 Supported options:
@@ -27,7 +28,7 @@ Supported options:
                     down to the configure script which enables 
                     a good bit of debug output.
 
-  -h|--help       - Show this message and exit.
+  --help          - Show this message and exit.
 
   --force-autogen - Force running ./autogen.sh.  Normally this is
                     only done if the configure script is not present.
@@ -51,17 +52,6 @@ locations.  Edit $0 to change these.  While you are at it, feel
 free to provide a patch to improve the documentation about 
 those libraries.
 
-On older installs of cygwin, the available gcc will accept -mno-cygwin
-to build an executible that does not link to the cygwin dll.  On newer
-gcc's this option has been removed and you must use either a
-cross compiler that targets mingw or use the native MinGW compiler.
-If you use the native MinGW compiler approach, then 
-the MinGW compilers to be installed in
-c:\MinGW and also in your cygwin environment there needs to be
-a symbolic link:
-
-/mingw -> /cygdrive/c/MinGW
-
 EOF
 }
 
@@ -91,7 +81,7 @@ while test $# -ne 0 ; do
 			shift
 			;;
 
-		-h|--help)
+		--help)
 			usage
 			exit 0
 			;;
@@ -146,68 +136,25 @@ while test $# -ne 0 ; do
 	esac
 done
 
-do_fake_crossbuild=no
-if test -f /mingw/bin/mingw32-gcc.exe ; then
-	do_fake_crossbuild=yes
-fi
-
-echo "do_fake_crossbuild = ${do_fake_crossbuild}"
-
-enable_doc=
-prog_name=unknown
-if test ! -d win32 ; then
-	echo "$0:  ERROR.  This script must be run from the top level of the source tree"
-	exit 1
-fi
-
-if test -f src/gerbv.c ; then
-	prog_name=gerbv
-fi
-
-if test -f src/pcb-menu.res ; then
-	prog_name=pcb
-	config_args="${config_args} --disable-dbus --disable-m4lib-png "
-	if test -f .gitignore -o -f CVS/Root ; then
-		echo "Building from git or CVS so the documentation"
-		echo "build will be disabled (since we are cross building"
-		config_args="${config_args} --disable-doc" 
-		enable_doc=";"
-	fi
-fi
-
-if test -f libwcalc/microstrip.c ; then
-	prog_name=wcalc
-	config_args="${config_args} --disable-htdocs --disable-cgi --disable-stdio"
-fi
-
-if test ${prog_name} = unknown ; then
-	cat << EOF
-$0:  ERROR.  Unable to figure out what you are building.
-This may happen if you are trying to execute $0 from a directory
-other than the top of the source tree.
-EOF
+if test ! -f win32/build_gerbv ; then
+	echo "$0:  ERROR.  This script must be run from the top level of the gerbv source tree."
 	exit 1
 fi
 
-echo "Building program:  ${prog_name}"
-
-# Run this under cygwin to build gerbv or pcb and create a windows installer for
+# Run this under cygwin to build gerbv and create a windows installer for
 # it.  Thanks to Bob Paddock for pointing me to NSIS and answering some 
 # beginner windows questions.
 
 # where gtk_win32 is installed
 gtk_win32=c:\\cygwin\\home\\${USER}\\gtk_win32
-gd_win32=c:\\cygwin\\home\\${USER}\\gd_win32
-gd_win32_f=c:/cygwin/home/${USER}/gd_win32
 
 # where only the runtime components are installed
 gtk_win32_runtime=c:\\\\cygwin\\\\home\\\\${USER}\\\\gtk_win32_runtime
-gd_win32_runtime=c:\\\\cygwin\\\\home\\\\${USER}\\\\gd_win32_runtime
 
-# program version
+# gerbv version
 
-prog_version=`awk '/AC_INIT/ {gsub(/.*,[ \t]*\[/, ""); gsub(/\]\).*/, ""); print}' configure.ac`
-echo "prog_version=${prog_version}"
+gerbv_version=`awk '/AC_INIT/ {gsub(/.*,[ \t]*\[/, ""); gsub(/\]\).*/, ""); print}' configure.ac`
+echo "gerbv_version=${gerbv_version}"
 
 # location of the NSIS makensis executible (see http://nsis.sourceforge.net)
 makensis="/cygdrive/c/Program Files/NSIS/makensis.exe"
@@ -220,12 +167,6 @@ makensis="/cygdrive/c/Program Files/NSIS/makensis.exe"
 # ########################################################################
 
 
-######################################################################
-#
-# AUTOGEN
-#
-######################################################################
-
 if test ! -f configure -o $do_autogen = yes ; then
 	echo "Bootstrapping autotools"
 	ACLOCAL_FLAGS="-I ${gtk_win32}\\share\\aclocal" ./autogen.sh
@@ -239,11 +180,11 @@ src_dir=c:\\\\cygwin`echo ${srcdir} | sed 's;/;\\\\\\\\;g'`
 top_src_dir=c:\\\\cygwin`echo ${top_srcdir} | sed 's;/;\\\\\\\\;g'`
 
 
-# where to install the program
-prog_inst=`pwd`/${prog_name}_inst
+# where to install gerbv
+gerbv_inst=`pwd`/gerbv_inst
 
 # DOS version
-prog_inst_dir=c:\\\\cygwin`echo ${prog_inst} | sed 's;/;\\\\\\\\;g'`
+gerbv_inst_dir=c:\\\\cygwin`echo ${gerbv_inst} | sed 's;/;\\\\\\\\;g'`
 
 PKG_CONFIG_PATH=${gtk_win32}\\lib\\pkgconfig
 export PKG_CONFIG_PATH
@@ -256,31 +197,11 @@ pkg-config --list-all
 
 
 # do not try to use libpng-config, it seems broken on win32
-if test $prog_name = pcb ; then
-	LIBPNG_CFLAGS="-I${gtk_win32}\\include"
-	LIBPNG_CPPFLAGS="-I${gtk_win32}\\include"
-	LIBPNG_LDFLAGS="-L${gtk_win32}\\lib"
-	LIBPNG_LIBS="-lpng14"
-	LIBGD_CFLAGS="-I${gd_win32}\\include -I${gd_win32_f}/include"
-	LIBGD_CPPFLAGS="-I${gd_win32}\\include"
-	LIBGD_LDFLAGS="-L${gd_win32}\\lib -L${gd_win32_f}/lib"
-	LIBGD_LIBS="-lbgd"
-	# this ugly hack is here because the AC_CHECK_FUNC autoconf
-	# test doesn't include gd.h.  Inside of gd.h, gdImageGif and
-	# friends are declared with
-	#  __declspec(dllimport) void _stdcall
-	# which causes a change in how the function is named in the DLL
-	# which in turn causes the autoconf test to fail.  ugh!  FIXME! 
-	export ac_cv_func_gdImageGif=yes
-	export ac_cv_func_gdImageJpeg=yes
-	export ac_cv_func_gdImagePng=yes
-else
-	LIBPNG_CFLAGS=""
-	LIBPNG_LDFLAGS=""
-	LIBPNG_LIBS=""
-fi
 LIBPNG_CONFIG=/usr/bin/true
 export LIBPNG_CONFIG
+LIBPNG_CFLAGS="-I${HOME}/gtk_win32/include"
+LIBPNG_LDFLAGS="-L${HOME}/gtk_win32/lib"
+LIBPNG_LIBS="-lpng12"
 
 # add the gcc options to produce a native windows binary that
 # does not need cygwin to run
@@ -294,40 +215,6 @@ export CYGWIN_CFLAGS
 CYGWIN_CPPFLAGS="-mms-bitfields -mno-cygwin ${EXTRA_FLAGS}"
 export CYGWIN_CPPFLAGS
 
-
-# older releases of cygwin had a gcc that accepted -mno-cygwin.
-# in more recent releases this flag (which builds and links without
-# the cygwin dll) has been removed.  We either need a normal
-# cross compiler or we can fake it by using the native mingw
-# compiler.  
-# see http://www.gnu.org/software/libtool/manual/html_node/Cygwin-to-MinGW-Cross.html
-# in particular, the lt_cv_to_tool_file_cmd bit is needed because
-# libtool will call the mingw ranlib which will not understand
-# any cygwin absolute paths.  
-if test ${do_fake_crossbuild} = yes ; then
-	config_args="${config_args} --build=i686-pc-cygwin --host=mingw32"
-	NM=/cygdrive/c/MinGW/bin/nm.exe
-	export NM
-
-	# the ranlib bit here is because putting the mingw tools first
-	# in PATH causes the mingw ranlib to be called.  The problem
-	# with that is tht libtool is passing an absolute cygwin
-	# path at install time to ranlib which can't deal.  The
-	# func_convert... stuff is supposed to help but it didn't.
-	# The libtool folks have a patch for this so at some point
-	# this can go away.
-	RANLIB=/usr/bin/ranlib
-	export RANLIB
-	PATH=/cygdrive/c/MinGW/bin:${PATH}
-	export lt_cv_to_tool_file_cmd=func_convert_file_cygwin_to_w32
-fi
-
-######################################################################
-#
-# CONFIGURE
-#
-######################################################################
-
 # setting WIN32=yes will make sure that the desktop icon
 # gets compiled in
 if test "$do_config" = "yes" ; then
@@ -335,17 +222,16 @@ rm -fr src/.deps
 echo "Configuring for cygwin"
 ( ( ( env WIN32=yes \
 	./configure \
-	--prefix=${prog_inst} \
+	--prefix=${gerbv_inst} \
 	--disable-dependency-tracking \
 	--disable-maintainer-mode \
 	--disable-nls \
 	--disable-update-desktop-database \
 	--disable-update-mime-database \
 	${config_args} \
-	CFLAGS="${LIBPNG_CFLAGS} ${LIBGD_CFLAGS}" \
-	CPPFLAGS="${LIBPNG_CPPFLAGS} ${LIBGD_CPPFLAGS}" \
-	LDFLAGS="${LIBPNG_LDFLAGS} ${LIBGD_LDFLAGS}" \
-	LIBS="${LIBPNG_LIBS} ${LIBGD_LIBS}" \
+	CFLAGS="${LIBPNG_CFLAGS}" \
+	LDFLAGS="${LIBPNG_LDFLAGS}" \
+	LIBS="${LIBPNG_LIBS}" \
 	WIN32=yes \
 	2>&1 ; echo $? >&4 ) | tee c.log 1>&3) 4>&1 | (read a ; exit $a)) 3>&1
 
@@ -368,19 +254,11 @@ for f in `find . -name Makefile -print` ; do
 	remove_rc "$f"
 done
 
-if test -f libtool ; then
-	echo "Removing spurious carriage returns in libtool..."
-	remove_rc libtool
-fi
+echo "Removing spurious carriage returns in libtool..."
+remove_rc libtool
 
 fi # do_config
 
-######################################################################
-#
-# CLEAN
-#
-######################################################################
-
 if test "$do_clean" = "yes" ; then
 echo "Cleaning"
 ( ( ( make clean 2>&1 ; echo $? >&4) | tee clean.log 1>&3) 4>&1 | (read a ; exit $a) ) 3>&1
@@ -390,12 +268,6 @@ if test $? -ne 0 ; then
 fi
 fi
 
-######################################################################
-#
-# BUILD
-#
-######################################################################
-
 if test "$do_build" = "yes" ; then
 echo "Building for cygwin"
 ( ( ( make 2>&1 ; echo $? >&4) | tee m.log 1>&3) 4>&1 | (read a ; exit $a) ) 3>&1
@@ -405,18 +277,12 @@ if test $? -ne 0 ; then
 fi
 fi
 
-######################################################################
-#
-# INSTALL
-#
-######################################################################
-
 if test "$do_install" = "yes" ; then
 echo "Installing for cygwin"
 # first clean out the installation directory to make sure
 # we don't have old junk lying around.
-if test -d ${prog_inst} ; then
-	rm -fr ${prog_inst}
+if test -d ${gerbv_inst} ; then
+	rm -fr ${gerbv_inst}
 fi
 ( ( ( make install 2>&1 ; echo $? >&4) | tee -a m.log 1>&3) 4>&1 | (read a ; exit $a) ) 3>&1
 if test $? -ne 0 ; then
@@ -425,12 +291,6 @@ if test $? -ne 0 ; then
 fi
 fi
 
-######################################################################
-#
-# NSIS INSTALLER CREATION
-#
-######################################################################
-
 if test "$do_nsis" = "yes" ; then
 echo "Creating NSIS script"
 echo "srcdir = ${srcdir}"
@@ -439,16 +299,14 @@ echo "top_srcdir = ${top_srcdir}"
 echo "top_src_dir = ${top_src_dir}"
 
 sed \
-	-e "s|@enable_doc@|${enable_doc}|g" \
-	-e "s;@prog_version@;${prog_version};g" \
-	-e "s;@prog_prefix@;${prog_inst_dir};g" \
-	-e "s;@prog_srcdir@;${top_src_dir};g" \
-	-e "s;@gd_win32_runtime@;${gd_win32_runtime};g" \
+	-e "s;@gerbv_version@;${gerbv_version};g" \
+	-e "s;@gerbv_prefix@;${gerbv_inst_dir};g" \
+	-e "s;@gerbv_srcdir@;${top_src_dir};g" \
 	-e "s;@gtk_win32_runtime@;${gtk_win32_runtime};g" \
-	${srcdir}/${prog_name}.nsi.in > ${srcdir}/${prog_name}.nsi
+	${srcdir}/gerbv.nsi.in > ${srcdir}/gerbv.nsi
 
 echo "Creating windows installer"
-"${makensis}" ${src_dir}/${prog_name}.nsi
+"${makensis}" ${src_dir}/gerbv.nsi
 
 
 echo "Windows installer left in ${srcdir}:"
@@ -471,7 +329,7 @@ EOF
 
 cat > ${bat} << EOF
 
-.\win32\\${prog_name}inst-${prog_version}.exe
+.\win32\gerbvinst-${gerbv_version}.exe
 
 EOF
 chmod 755 ${bat}
diff --git a/win32/extract_gtk_win32 b/win32/extract_gtk_win32
index 69eec19..14f831f 100755
--- a/win32/extract_gtk_win32
+++ b/win32/extract_gtk_win32
@@ -1,5 +1,6 @@
 #!/bin/sh
 #
+# $Id$
 #
 # This script is probably not useful to most people.  It is used
 # to extract a set of downloaded files for gtk for windows and 
@@ -8,22 +9,12 @@
 # It is used when initially setting up a cygwin environment for 
 # building gerbv or pcb with a non-cygwin version for windows
 # as the goal.
-#
-# Among the several limitations of this script are:
-#
-# - most (all?) directory locations are hard coded.
-#
-# - it is really only "correct" for a particular set of downloaded
-#   files.  If you get a different version of anything, then you
-#   really need to spend time and verify that the licenses are all
-#   still correct.
-#
 
 # directory where all the files have been downloaded
 gtk_win32_downloads=${HOME}/gtk_win32_downloads
 
 # directory to extract everything (including headers) to.
-# This must match ./build_gerbv, or ./build_pcb.
+# This must match ./build_pcb.
 gtk_win32=${HOME}/gtk_win32
 gd_win32=${HOME}/gd_win32
 
@@ -32,31 +23,7 @@ gd_win32=${HOME}/gd_win32
 gtk_win32_runtime=${HOME}/gtk_win32_runtime
 gd_win32_runtime=${HOME}/gd_win32_runtime
 
-cat << EOF
-
-Configured directories:
-
---------------------------------------------------
-GTK+ and friends developer and runtime directories
---------------------------------------------------
-gtk_win32           ${gtk_win32}
-gtk_win32_runtime   ${gtk_win32_runtime}
-
---------------------------------------
-GD developer and run time directories:
---------------------------------------
-gd_win32            ${gd_win32}
-gd_win32_runtime    ${gd_win32_runtime}
-
---------------------------------------------
-Directory where the downloaded files reside:
---------------------------------------------
-gtk_win32_downloads ${gtk_win32_downloads}
-
-EOF
-
 # clean out old directories
-echo "Cleaning out old developer and runtime directories"
 test ! -d ${gtk_win32} || rm -fr ${gtk_win32}
 test ! -d ${gtk_win32_runtime} || rm -fr ${gtk_win32_runtime}
 
@@ -64,7 +31,6 @@ test ! -d ${gd_win32} || rm -fr ${gd_win32}
 test ! -d ${gd_win32_runtime} || rm -fr ${gd_win32_runtime}
 
 # make the new ones
-echo "Creating new old developer and runtime directories"
 mkdir -p ${gtk_win32}
 mkdir -p ${gtk_win32_runtime}
 
@@ -72,7 +38,6 @@ mkdir -p ${gd_win32}
 mkdir -p ${gd_win32_runtime}/bin
 
 # extract the runtime files
-echo "Extracting runtime files"
 cd ${gtk_win32_runtime}
 for f in ${gtk_win32_downloads}/*.zip ; do
 	fb=`basename "${f}"`
@@ -94,7 +59,6 @@ for f in ${gtk_win32_downloads}/*.zip ; do
 done
 
 # extract the runtime+developer files
-echo "Extracting developer files (to be used at compile time)"
 cd ${gtk_win32}
 for f in ${gtk_win32_downloads}/*.zip ; do
 	fb=`basename "${f}"`
@@ -112,21 +76,15 @@ for f in ${gtk_win32_downloads}/*.zip ; do
 	esac
 done
 
-# this was needed for older zlibs
-#mv ${gtk_win32_runtime}/zlib*.dll ${gtk_win32_runtime}/bin
-
-mv ${gtk_win32}/lib/libpng.def ${gtk_win32}/lib/png14.def
-mv ${gtk_win32}/lib/libpng.lib ${gtk_win32}/lib/png14.lib
-
 chmod 755 ${gtk_win32}/bin/*
+mv ${gtk_win32_runtime}/zlib*.dll ${gtk_win32_runtime}/bin
 chmod 755 ${gtk_win32_runtime}/bin/*
 
 cd ${HOME}
 
-echo "Extracting license files"
 
 cd ${gd_win32}
-unzip -q ${gtk_win32_downloads}/gd-*-win32.zip
+unzip ${gtk_win32_downloads}/gd-*-win32.zip
 cp */*.dll ${gd_win32_runtime}/bin
 cat > ${gd_win32_runtime}/gd-license.txt << EOF
 The GD library which provides png/gif/jpeg exporting
@@ -148,11 +106,12 @@ mkdir ${tmpd}
 cd ${tmpd}
 
 
-cat > ${gtk_win32_runtime}/LICENSE-lgpl2 << EOF
+cat > ${gtk_win32_runtime}/LICENSE-lgpl << EOF
 The following packages are covered by the 
-GNU Library General Public License (LGPL) version 2
+GNU Library General Public License (LGPL)
 
 atk
+cairo
 glib
 gtk+
 libiconv
@@ -163,16 +122,6 @@ proxy-libintl
 
 EOF
 
-cat > ${gtk_win32_runtime}/LICENSE-lgpl2-1 << EOF
-The following packages are covered by the 
-GNU Library General Public License (LGPL) version 2.1
-
-cairo
-
-----------------------------------------
-
-EOF
-
 cat > ${gtk_win32_runtime}/LICENSE-gpl2 << EOF
 The following packages are covered by the GNU General Public License (GPL) v2.
 
@@ -195,101 +144,97 @@ EOF
 
 # LGPL
 #
-# atk-1.32.0.tar.bz2
-# atk_1.32.0-1_win32.zip
-# atk-dev_1.32.0-1_win32.zip
+# atk-1.22.0.tar.bz2
+# atk-1.22.0.zip
+# atk-dev-1.22.0.zip
 
 bzcat ${gtk_win32_downloads}/atk-*.tar.bz2 | tar -xf -
-cat atk-*/COPYING >> ${gtk_win32_runtime}/LICENSE-lgpl2
+cat atk-*/COPYING >> ${gtk_win32_runtime}/LICENSE-lgpl
 rm -fr atk-*
 
-# dual LGPL-2.1 and MPL-1.1 (Mozilla public license)
+# dual LGPL and MPL (Mozilla public license)
 #
-#cairo-1.10.0.tar.gz
-#cairo-1.10.0-1_win32.zip
-#cairo-dev_1.10.0-1_win32.zip
-tar -zxf ${gtk_win32_downloads}/cairo-*.tar.gz
-cat cairo-*/COPYING-LGPL-2.1 >> ${gtk_win32_runtime}/LICENSE-lgpl2-1
-rm -fr cairo-*
+#cairo-1.6.4.tar.gz
+#cairo-1.6.4.zip
+#cairo-dev-1.6.4.zip
 
 # no copyright assigned and placed in public domain
 #
 # dirent.zip
 
 # sort of BSD with advertising like
-# download the license from:
-# http://expat.cvs.sourceforge.net/viewvc/expat/expat/COPYING?view=log
-# expat-2.0.1-1_win32.zip
+#expat-2.0.0.zip
 echo "expat is covered by the following copyright and license" > ${gtk_win32_runtime}/LICENSE-expat
 cat ${gtk_win32_downloads}/COPYING-expat >> ${gtk_win32_runtime}/LICENSE-expat
 
 
-# fontconfig-2.8.0.tar.gz
-# fontconfig-dev_2.8.0-2_win32.zip
-# fontconfig_2.8.0-2_win32.zip
-tar -zxf ${gtk_win32_downloads}/fontconfig-*.tar.gz 
+#fontconfig-2.4.2-tml-20071015.diff
+#fontconfig-2.4.2-tml-20071015.zip
+#fontconfig-2.4.2.tar.gz
+#fontconfig-dev-2.4.2-tml-20071015.zip
+tar -zxvf ${gtk_win32_downloads}/fontconfig-*.tar.gz 
 echo "fontconfig is covered by the following license" > ${gtk_win32_runtime}/LICENSE-fontconfig
 cat fontconfig*/COPYING >> ${gtk_win32_runtime}/LICENSE-fontconfig
 rm -fr fontconfig-*
 
 #
 # Dual, "you choose" license.  We pick GPL v2.
-# freetype-2.4.2.tar.bz2
-# freetype-dev_2.4.2-1_win32.zip
-# freetype_2.4.2-1_win32.zip
-#bzcat  ${gtk_win32_downloads}/freetype-2.3.4.tar.bz2  | tar -xf - mv freetype-*/*/LICENSE.TXT ${gtk_win32_runtime}/LICENSE-freetype
+#freetype-2.3.4.tar.bz2
+#freetype-2.3.4.zip
+#freetype-dev-2.3.4.zip
+#bzcat  ${gtk_win32_downloads}/freetype-2.3.4.tar.bz2  | tar -xvf - mv freetype-*/*/LICENSE.TXT ${gtk_win32_runtime}/LICENSE-freetype
 #rm -fr freetype-*
 
 
 # GPL v3
 #
-# gettext-0.18.1.1.tar.gz
-# gettext-runtime-dev_0.18.1.1-2_win32.zip
-# gettext-runtime_0.18.1.1-2_win32.zip
-# gettext-tools-dev_0.18.1.1-2_win32.zip
-
-tar -zxf ${gtk_win32_downloads}/gettext-*.tar.gz
+#gettext-0.17.tar.gz
+#gettext-runtime-0.17.zip
+#gettext-runtime-dev-0.17.zip
+#gettext-tools-0.17.zip
+tar -zxvf ${gtk_win32_downloads}/gettext-*.tar.gz
 cat gettext-*/COPYING >> ${gtk_win32_runtime}/LICENSE-gpl3
 rm -fr gettext-*
 
 
 # LGPL
-# glib-2.26.1.tar.bz2
-# glib-dev_2.26.1-1_win32.zip
-# glib_2.26.1-1_win32.zip
+#glib-2.16.5.tar.bz2
+#glib-2.16.5.zip
+#glib-dev-2.16.5.zip
 
 # LGPL
 #
-# gtk+-2.22.1.tar.bz2
-# gtk+-dev_2.22.1-1_win32.zip
-# gtk+_2.22.1-1_win32.zip
+#gtk+-2.12.11.tar.bz2
+#gtk+-2.12.11.zip
+#gtk+-dev-2.12.11.zip
+
 
 # jpeg license
 #
-# jpeg-6b-4-bin.zip
-# jpeg-6b-4-dep.zip
-# jpeg-6b-4-lib.zip
-# jpegsrc.v6b.tar.gz
-
-# FIXME -- missing jpeg.  Do I care?
-#unzip -q ${gtk_win32_downloads}/jpeg-*-src.zip
-#tar -zxf ${gtk_win32_downloads}/jpegsrc.v6b.tar.gz
-#echo "libjpeg is covered by the following license:" > ${gtk_win32_runtime}/LICENSE-jpeg
-#cat jpeg-6b/README >> ${gtk_win32_runtime}/LICENSE-jpeg
-#rm -fr jpeg-6b
+#jpeg-6b-4-bin.zip
+#jpeg-6b-4-dep.zip
+#jpeg-6b-4-lib.zip
+#jpegsrc.v6b.tar.gz
+
+#unzip ${gtk_win32_downloads}/jpeg-*-src.zip
+tar -zxvf ${gtk_win32_downloads}/jpegsrc.v6b.tar.gz
+echo "libjpeg is covered by the following license:" > ${gtk_win32_runtime}/LICENSE-jpeg
+cat jpeg-6b/README >> ${gtk_win32_runtime}/LICENSE-jpeg
+rm -fr jpeg-6b
 
 # LGPL
-# not used anymore
+#
 #libiconv-1.9.1.bin.woe32.zip
 #libiconv-1.9.1.tar.gz
 
-# 
-# libpng-1.4.3.tar.gz
-# libpng-dev_1.4.3-1_win32.zip
-# libpng_1.4.3-1_win32.zip
+#libpng-1.2.9.tar.gz
+#libpng-dev-1.2.9.zip
+#libpng-1.2.9.zip
 mkdir tmppng
 cd tmppng
-unzip -q ${gtk_win32_downloads}/libpng-dev*.zip
+unzip ${gtk_win32_downloads}/libpng-dev-*.zip
+ls 
+ls include
 
 echo "libpng is covered by the following copyright and license" > ${gtk_win32_runtime}/LICENSE-png
 awk '/COPYRIGHT/,/^[ \t]*$/ {print}' include/png.h >> ${gtk_win32_runtime}/LICENSE-png
@@ -298,50 +243,44 @@ rm -fr tmppng
 
 # LGPL
 #
-# pango-1.28.3.tar.bz2
-# pango-dev_1.28.3-1_win32.zip
-# pango_1.28.3-1_win32.zip
+#pango-1.20.5.tar.bz2
+#pango-1.20.5.zip
+#pango-dev-1.20.5.zip
+
 
 # GPL
 #
-# pkg-config-0.23.tar.gz
-# pkg-config-dev_0.23-3_win32.zip
-# pkg-config_0.23-3_win32.zip
-tar -zxf ${gtk_win32_downloads}/pkg-config-*.tar.gz
+#pkg-config-0.23.tar.gz
+#pkg-config-0.23-2.zip
+tar -zxvf ${gtk_win32_downloads}/pkg-config-*.tar.gz
 cat pkg-config-*/COPYING >> ${gtk_win32_runtime}/LICENSE-gpl2
 rm -fr pkg-config-*
 
 # LGPL
-# no longer used
+#
 # proxy-libintl-20080728.zip
 
 # BSD-like with advertising clause
 #
-# FIXME - do I need this one?  I don't have the files
-# tiff-3.8.2.tar.gz
-# libtiff-3.8.2.zip
-# libtiff-dev-3.8.2.zip
-# tar -zxf ${gtk_win32_downloads}/tiff-*.tar.gz
-# echo "libtiff is covered by the following license:" > ${gtk_win32_runtime}/LICENSE-tiff
-# cat tiff-*/COPYRIGHT >> ${gtk_win32_runtime}/LICENSE-tiff
-# rm -fr tiff-*
+#tiff-3.8.2.tar.gz
+#libtiff-3.8.2.zip
+#libtiff-dev-3.8.2.zip
+tar -zxvf ${gtk_win32_downloads}/tiff-*.tar.gz
+echo "libtiff is covered by the following license:" > ${gtk_win32_runtime}/LICENSE-tiff
+cat tiff-*/COPYRIGHT >> ${gtk_win32_runtime}/LICENSE-tiff
+rm -fr tiff-*
 
 # Not needed anymore
 #xpm-nox-4.0.3-20020617.zip
 #xpm-nox-dev-4.0.3-20020112.zip
-#tar -zxf ${gtk_win32_downloads}/xpm-*.tar.gz
+#tar -zxvf ${gtk_win32_downloads}/xpm-*.tar.gz
 #echo "The xpm library is covered by the following license and copyright:" > ${gtk_win32_runtime}/LICENSE-xpm
 #cat xpm-*/COPYRIGHT >> ${gtk_win32_runtime}/LICENSE-xpm
 #rm -fr xpm-*
 
-# zlib-dev_1.2.5-2_win32.zip
-# zlib125.zip
-# zlib_1.2.5-2_win32.zip
-unzip -q ${gtk_win32_downloads}/zlib125.zip
+#zlib123-dll.zip
+# the license had to be found on the zlib web site
 echo "zlib is covered by the following license and copyright" > ${gtk_win32_runtime}/LICENSE-zlib
-#cat ${gtk_win32_downloads}/zlib_license.txt >> ${gtk_win32_runtime}/LICENSE-zlib
-awk '/Copyright/ {p=1} p==1{print}' zlib-1.2.5/README >> ${gtk_win32_runtime}/LICENSE-zlib
-rm -fr zlib-1.2.5
+cat ${gtk_win32_downloads}/zlib_license.txt >> ${gtk_win32_runtime}/LICENSE-zlib
 
-echo "All done!"
 
diff --git a/win32/gerbv.nsi.in b/win32/gerbv.nsi.in
index 29e2048..30a4017 100644
--- a/win32/gerbv.nsi.in
+++ b/win32/gerbv.nsi.in
@@ -29,18 +29,18 @@
 ;General
 
   ;Name and file
-  Name "gerbv- at prog_version@"
-  OutFile "gerbvinst- at prog_version@.exe"
+  Name "gerbv- at gerbv_version@"
+  OutFile "gerbvinst- at gerbv_version@.exe"
 
   ;See http://nsis.sourceforge.net/Shortcuts_removal_fails_on_Windows_Vista
   ;for more details.
   RequestExecutionLevel admin
 
   ;Default installation folder
-  InstallDir "$PROGRAMFILES\gerbv- at prog_version@"
+  InstallDir "$PROGRAMFILES\gerbv- at gerbv_version@"
   
   ;Get installation folder from registry if available
-  InstallDirRegKey HKCU "Software\gerbv- at prog_version@" ""
+  InstallDirRegKey HKCU "Software\gerbv- at gerbv_version@" ""
 
 ;--------------------------------
 ;Variables
@@ -56,16 +56,15 @@
 ;--------------------------------
 ;Pages
 
-  !insertmacro MUI_PAGE_LICENSE "@prog_srcdir@\COPYING"
+  !insertmacro MUI_PAGE_LICENSE "@gerbv_srcdir@\COPYING"
   !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-gpl2"
   !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-gpl3"
-  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-lgpl2"
-  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-lgpl2-1"
+  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-lgpl"
   !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-expat"
   !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-fontconfig"
-;  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-jpeg"
+  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-jpeg"
   !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-png"
-;  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-tiff"
+  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-tiff"
 ;  !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-xpm"
   !insertmacro MUI_PAGE_LICENSE "@gtk_win32_runtime@\LICENSE-zlib"
 ;  !insertmacro MUI_PAGE_COMPONENTS
@@ -73,7 +72,7 @@
   
   ;Start Menu Folder Page Configuration
   !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
-  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\gerbv- at prog_version@" 
+  !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\gerbv- at gerbv_version@" 
   !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
   
   !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
@@ -98,7 +97,7 @@ Section "Dummy Section" SecDummy
   
   ;ADD YOUR OWN FILES HERE...
   File /a /r "@gtk_win32_runtime@\*.*"
-  File /a /r "@prog_prefix@\*.*"
+  File /a /r "@gerbv_prefix@\*.*"
 
   ;Associate file types and icons
   ${registerExtension} "$INSTDIR\bin\gerbv.exe" "" ".gbr" "RS274-X File"
@@ -109,7 +108,7 @@ Section "Dummy Section" SecDummy
   ${registerExtension} "$INSTDIR\bin\gerbv.exe" "-p" ".gvp" "Gerbv Project File"
  
   ;Store installation folder
-  WriteRegStr HKCU "Software\gerbv- at prog_version@" "" $INSTDIR
+  WriteRegStr HKCU "Software\gerbv- at gerbv_version@" "" $INSTDIR
   
   ;Create uninstaller
   WriteUninstaller "$INSTDIR\Uninstall.exe"
@@ -187,6 +186,6 @@ Section "Uninstall"
     StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
   startMenuDeleteLoopDone:
 
-  DeleteRegKey /ifempty HKCU "Software\gerbv- at prog_version@"
+  DeleteRegKey /ifempty HKCU "Software\gerbv- at gerbv_version@"
 
 SectionEnd

-- 
Packaging for Gerbv



More information about the Pkg-electronics-commits mailing list