[surf-alggeo] 02/02: Import (zeroth) Debian patch 1.0.6+ds-1

Jerome Benoit calculus-guest at moszumanska.debian.org
Fri Apr 10 18:07:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

calculus-guest pushed a commit to branch master
in repository surf-alggeo.

commit 51f176444018c372bb85a30e872fa5afdedbc006
Author: Jerome Benoit <calculus at rezozer.net>
Date:   Fri Apr 10 19:44:36 2015 +0200

    Import (zeroth) Debian patch 1.0.6+ds-1
---
 debian/changelog                                   |   34 +
 debian/clean                                       |    3 +
 debian/compat                                      |    1 +
 debian/control                                     |   89 +
 debian/copyright                                   |   35 +
 debian/patches/debianization-documentation.patch   |   23 +
 debian/patches/debianization-help2man.patch        |   38 +
 debian/patches/debianization.patch                 |   20 +
 debian/patches/series                              |   12 +
 debian/patches/upstream-CC2help2man.patch          |   80 +
 debian/patches/upstream-automatic_extension.patch  |  167 ++
 .../upstream-autotoolization-help2man.patch        |  248 +++
 .../patches/upstream-autotoolization-update.patch  | 1839 ++++++++++++++++++++
 debian/patches/upstream-clip_to_rectangle.patch    |  132 ++
 debian/patches/upstream-flex-update.patch          |   16 +
 .../upstream-help2man-automatic_extension.patch    |   30 +
 debian/patches/upstream-nox-options.patch          |  205 +++
 debian/patches/upstream-option-quiet.patch         |  120 ++
 debian/repack                                      |  114 ++
 debian/rules                                       |   49 +
 debian/source/format                               |    1 +
 debian/source/lintian-overrides                    |    1 +
 debian/source/options                              |    2 +
 debian/surf-alggeo-doc.doc-base                    |   26 +
 debian/surf-alggeo-doc.docs                        |    6 +
 debian/surf-alggeo-doc.examples                    |    2 +
 debian/surf-alggeo-nox.docs                        |    4 +
 debian/surf-alggeo-nox.install                     |    1 +
 debian/surf-alggeo-nox.manpages                    |    1 +
 debian/surf-alggeo-nox.postinst                    |    7 +
 debian/surf-alggeo-nox.prerm                       |    9 +
 debian/watch                                       |    4 +
 32 files changed, 3319 insertions(+)

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..8c84fd8
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,34 @@
+surf-alggeo (1.0.6+ds-1) unstable; urgency=medium
+
+  * Initial release (Closes: #777132).
+  * Debianization:
+    - debian/copyright in DEP-5 format;
+    - debian/control:
+      - debhelper build-dep to >= 9;
+      - Standards Version 3.9.6;
+      - Vcs-* headers.
+    - debian/source, format 3.0 (quilt);
+    - debian/patches/:
+      - patches in DEP-3 format;
+      - autotool chain, update and harden;
+      - (f)lex dependent code, correct;
+      - Surfer material for quiet execution, apply and improve;
+      - Surfer material for external tiling parallelization, apply and adapt;
+      - automatic-extension machinery, extend and make disableable (disabled
+        by default for backward compatibility);
+      - manual page, generate via help2man;
+    - debian/watch file;
+    - debian/repack, repack script to clean up and gain weight;
+    - debian/rules:
+      - autoreconf-iguration;
+      - full and minal dh integration;
+      - get-orig-source uscan based target which downloads the currently
+        packaged upstream tarball and repacks it;
+      - default target which basically queries package status with uscan
+        -- output in DEHS format;
+    - gpg-signature check support, neutralize;
+    - GUI version, discard as it depends on GTK1 which is no more supported
+      by Debian.
+   * Enhancement patches submitted to the upstream maintainer team.
+
+ -- Jerome Benoit <calculus at rezozer.net>  Fri, 10 Apr 2015 18:06:33 +0000
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..9467783
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1,3 @@
+docs/surf-alggeo.sgml
+docs/surf-alggeo.html
+docs/surf-alggeo.pdf
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..c0a0925
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,89 @@
+Source: surf-alggeo
+Section: math
+Priority: optional
+Maintainer: Debian Science Maintainers <debian-science-maintainers at lists.alioth.debian.org>
+Uploaders: Jerome Benoit <calculus at rezozer.net>
+Build-Depends:
+ debhelper (>= 9),
+ autotools-dev, autoconf-archive, dh-autoreconf, pkg-config, help2man,
+ bison, flex,
+ libgmp-dev, libx11-dev, libjpeg-dev, libtiff5-dev, zlib1g-dev,
+ netpbm
+Build-Depends-Indep:
+ linuxdoc-tools,
+ texlive-base-bin, texlive-latex-base,
+ texlive-latex-recommended, texlive-fonts-recommended
+Standards-Version: 3.9.6
+Homepage: http://surf.sourceforge.net/
+Vcs-Git: git://anonscm.debian.org/debian-science/packages/surf-alggeo.git
+Vcs-Browser: http://anonscm.debian.org/gitweb/?p=debian-science/packages/surf-alggeo.git
+
+Package: surf-alggeo
+Architecture: all
+Depends: surf-alggeo-nox, ${misc:Depends}
+Multi-Arch: foreign
+Description: visualization of real algebraic geometry
+ Surf is a script driven tool to visualize some real algebraic geometry:
+ plane algebraic curves, algebraic surfaces and hyperplane sections of
+ surfaces.
+ .
+ The algorithms should be stable enough not to be confused by curve/surface
+ singularities in codimension greater than one and the degree of the surface
+ or curve. This has been achieved quite a bit. Curves of degree up to 30 and
+ surfaces of degree up to 20 have been drawn successfully. However, there are
+ examples of curves/surfaces of lower degree where surf fails to produce
+ perfect images. This happens especially if the equation of the curve/surface
+ is not reduced. Best results are achieved using reduced equations. On the other
+ hand, surf displays the Fermat-curves accurately for degree up to 98.
+ .
+ Surf is free software distributed under the GNU General Public License (GPL).
+ .
+ This dummy package is meant to allow multi-variant support for surf.
+
+Package: surf-alggeo-nox
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Recommends: netpbm
+Suggests: surf-alggeo-doc, graphicsmagick-imagemagick-compat
+Description: visualization of real algebraic geometry -- no X support
+ Surf is a script driven tool to visualize some real algebraic geometry:
+ plane algebraic curves, algebraic surfaces and hyperplane sections of
+ surfaces.
+ .
+ The algorithms should be stable enough not to be confused by curve/surface
+ singularities in codimension greater than one and the degree of the surface
+ or curve. This has been achieved quite a bit. Curves of degree up to 30 and
+ surfaces of degree up to 20 have been drawn successfully. However, there are
+ examples of curves/surfaces of lower degree where surf fails to produce
+ perfect images. This happens especially if the equation of the curve/surface
+ is not reduced. Best results are achieved using reduced equations. On the other
+ hand, surf displays the Fermat-curves accurately for degree up to 98.
+ .
+ Surf is free software distributed under the GNU General Public License (GPL).
+ .
+ This package provides the script driven tool surf without X support.
+
+Package: surf-alggeo-doc
+Section: doc
+Architecture: all
+Depends: ${misc:Depends}
+Suggests: surf-alggeo (=${binary:Version}), pdf-viewer
+Multi-Arch: foreign
+Description: visualization of real algebraic geometry -- manual
+ Surf is a script driven tool to visualize some real algebraic geometry:
+ plane algebraic curves, algebraic surfaces and hyperplane sections of
+ surfaces.
+ .
+ The algorithms should be stable enough not to be confused by curve/surface
+ singularities in codimension greater than one and the degree of the surface
+ or curve. This has been achieved quite a bit. Curves of degree up to 30 and
+ surfaces of degree up to 20 have been drawn successfully. However, there are
+ examples of curves/surfaces of lower degree where surf fails to produce
+ perfect images. This happens especially if the equation of the curve/surface
+ is not reduced. Best results are achieved using reduced equations. On the other
+ hand, surf displays the Fermat-curves accurately for degree up to 98.
+ .
+ Surf is free software distributed under the GNU General Public License (GPL).
+ .
+ This package provides the manual for the script driven tool surf; it also
+ contains some script samples.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..daa4a3e
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,35 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0
+Upstream-Name: surf
+Upstream-Contact: Stephan Endrass <endrass at mathematik.uni-mainz.de>
+Source: http://surf.sourceforge.net
+Comment:
+ The upstream source tarball is repacked to gain substantial weight mainly by
+ wiping out SVN repositories and also dropping off the regenerated material.
+
+Files: *
+Copyright:
+ 1997-2015 Johannes Gutenberg-Universitaet Mainz
+ 1996-1997 Friedrich-Alexander-Universitaet Erlangen-Nuernberg
+License: GPL-2+
+
+Files: debian/*
+Copyright:
+ 2015 Jerome Benoit <calculus at rezozer.net>
+License: GPL-2+
+
+License: GPL-2+
+ This package 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 package 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 package. If not, see <http://www.gnu.org/licenses/>.
+ .
+ On Debian systems, the complete text of the GNU General
+ Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
diff --git a/debian/patches/debianization-documentation.patch b/debian/patches/debianization-documentation.patch
new file mode 100644
index 0000000..4c1bb8e
--- /dev/null
+++ b/debian/patches/debianization-documentation.patch
@@ -0,0 +1,23 @@
+Description: debianization -- documentation
+ Address Debian Policy requirements for documentation.
+ This is a Debian centric patch.
+Origin: debian
+Forwarded: not-needed
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-03-14
+
+--- /dev/null
++++ b/docs/Makefile
+@@ -0,0 +1,12 @@
++LINUXDOC = /usr/bin/linuxdoc
++
++all: surf-alggeo.html surf-alggeo.pdf
++
++surf-alggeo.sgml: manual.sgml
++	ln -sf $< $@
++
++%.html : %.sgml
++	$(LINUXDOC) --backend=html --split=0 --toc=2 $<
++
++%.pdf : %.sgml
++	$(LINUXDOC) --backend=latex --papersize=a4 --output=pdf $<
diff --git a/debian/patches/debianization-help2man.patch b/debian/patches/debianization-help2man.patch
new file mode 100644
index 0000000..8804821
--- /dev/null
+++ b/debian/patches/debianization-help2man.patch
@@ -0,0 +1,38 @@
+Description: debianization -- help2man
+ Slighly modify the help2man material for Debian given
+ that the upstream source seems to be abandonned: the
+ communicated version is the Debian package version;
+ comments on the graphical user interface (GUI) for surf
+ is discarded as this GUI is built upon GTK1 (i) which is
+ no more distributed by Debian and (ii) while it is very
+ unlikely that the upstream team upgrade it.
+ This is a Debian centric patch.
+Origin: debian
+Forwarded: not-needed
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/man/surf.h2m
++++ b/man/surf.h2m
+@@ -2,9 +2,7 @@
+ 
+ [DESCRIPTION]
+ .B surf
+-is a tool to render algebraic curves and surfaces. It is script driven
+-and has (optionally) a nifty graphical user interface using the Gtk
+-widget set.
++is a script driven tool to render algebraic curves and surfaces.
+ 
+ The only input needed is the equation of an algebraic curve/surface in
+ everyday mathematical notation. The output is a (series of) color or
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -96,7 +96,7 @@
+ 
+ AM_H2MFLAGS = \
+ 	--manual="Surf Tool" \
+-	--source="surf $(PACKAGE_VERSION)" \
++	--source="surf (Debian $(DEB_PKG_VERSION))" \
+ 	--no-info
+ 
+ %.1: %
diff --git a/debian/patches/debianization.patch b/debian/patches/debianization.patch
new file mode 100644
index 0000000..84ef600
--- /dev/null
+++ b/debian/patches/debianization.patch
@@ -0,0 +1,20 @@
+Description: debianization
+ Meant to maintain a minimal debian/rules, to fix warnings,
+ to address Debian specific stuff in general.
+ This is a Debian centric patch.
+Origin: debian
+Forwarded: not-needed
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/gtkgui/showAbout.cc
++++ b/gtkgui/showAbout.cc
+@@ -77,7 +77,7 @@
+ //  					       &style->fg[GTK_STATE_NORMAL],
+ //  					       (gchar **)xpm_surf_icon );
+ 
+-	pixmap = gdk_pixmap_create_from_xpm (window->window, &mask, &style->bg[GTK_STATE_NORMAL], DATADIR "/surf/surf.xpm");
++	pixmap = gdk_pixmap_create_from_xpm (window->window, &mask, &style->bg[GTK_STATE_NORMAL], DATADIR "/surf-alggeo/surf.xpm");
+ 	if (pixmap) {
+ //  		cerr << "showAbout: got a pixmap...." << endl;
+ 		int i;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3efc0dd
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,12 @@
+upstream-autotoolization-update.patch
+upstream-flex-update.patch
+upstream-nox-options.patch
+upstream-option-quiet.patch
+upstream-automatic_extension.patch
+upstream-clip_to_rectangle.patch
+upstream-CC2help2man.patch
+upstream-autotoolization-help2man.patch
+upstream-help2man-automatic_extension.patch
+debianization.patch
+debianization-documentation.patch
+debianization-help2man.patch
diff --git a/debian/patches/upstream-CC2help2man.patch b/debian/patches/upstream-CC2help2man.patch
new file mode 100644
index 0000000..5d7a7b5
--- /dev/null
+++ b/debian/patches/upstream-CC2help2man.patch
@@ -0,0 +1,80 @@
+Description: format usages and helps
+ Attempt to format and harmonize the help message of surf program wrt
+ UN*X customs in view to employ help2man to generate its manpage.
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/src/Options.cc
++++ b/src/Options.cc
+@@ -48,7 +48,7 @@
+ #endif
+ 		;
+ 
+-	std::cerr
++	std::cout
+ 		<< "Usage: " << surf_name
+ #ifndef NO_GUI
+ 		<< " [-n|--no-gui] [FILE]..." << std::endl
+@@ -56,31 +56,32 @@
+ 		<< " [GTK-OPTIONS] [-x|--exec] [--progress-dialog] [--auto-resize]"
+ #endif
+ 		<< " [FILE]..." << std::endl
++		<< "Options:" << std::endl
+ #ifndef NO_GUI
+ 		<< std::endl
+-		<< "-n, --no-gui           disable GUI, execute all scripts passed as FILEs" << std::endl
+-		<< "-x, --exec             when running with GUI, execute first script immediately" << std::endl
+-		<< "    --progress-dialog  pop up a dialog instead of using a status bar" << std::endl
+-		<< "    --auto-resize      resize image windows automatically to image size" << std::endl
++		<< "  -n, --no-gui           disable GUI, execute all scripts passed as FILEs" << std::endl
++		<< "  -x, --exec             when running with GUI, execute first script immediately" << std::endl
++		<< "      --progress-dialog  pop up a dialog instead of using a status bar" << std::endl
++		<< "      --auto-resize      resize image windows automatically to image size" << std::endl
+ #endif
+ 		<< std::endl
+-		<< "    --disable-auto-extension" << std::endl
+-		<< "                       disable automatic extension for graphic files (default)" << std::endl
+-		<< "    --enable-auto-extension" << std::endl
+-		<< "                       enable automatic extension for graphic files" << std::endl
++		<< "      --disable-auto-extension" << std::endl
++		<< "                         disable automatic extension for graphic files (default)" << std::endl
++		<< "      --enable-auto-extension" << std::endl
++		<< "                         enable automatic extension for graphic files" << std::endl
+ #ifdef NO_GUI
+ 		<< std::endl
+-		<< "    --clip-to-rectangle x_min y_min x_max y_max" << std::endl
+-		<< "                       clip images to the specified rectangle" << std::endl
++		<< "      --clip-to-rectangle x_min y_min x_max y_max" << std::endl
++		<< "                         clip images to the specified rectangle" << std::endl
+ #endif
+ 		<< std::endl
+-		<< "-v, --verbose          verbose operation, print the executed commands (default)" << std::endl
+-		<< "-q, --quiet, --silent  quiet operation, do not print the executed commands" << std::endl
++		<< "  -v, --verbose          verbose operation, print the executed commands (default)" << std::endl
++		<< "  -q, --quiet, --silent  quiet operation, do not print the executed commands" << std::endl
+ 		<< std::endl
+-		<< "-h, --help             display this help and exit" << std::endl
+-		<< "-V, --version          display version tuple and exit\n" << std::endl
++		<< "  -h, --help             display this help and exit" << std::endl
++		<< "  -V, --version          display version tuple and exit\n" << std::endl
+ #if 0
+-		<< "    --copyright        display copyright and exit" << std::endl
++		<< "      --copyright        display copyright and exit" << std::endl
+ #endif
+ 		;
+ }
+@@ -116,10 +117,10 @@
+ 				execute = true;
+ #endif
+ 			} else if(strcmp(argv[i], "--copyright") == 0) {
+-				std::cerr << welcomeMessage;
++				std::cout << welcomeMessage;
+ 				exit(0);
+ 			} else if(strcmp(argv[i], "-V") == 0 || strcmp(argv[i], "--version") == 0) {
+-				std::cerr << VERSION << std::endl;
++				std::cout << VERSION << std::endl;
+ 				exit(0);
+ 			} else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
+ 				options_print_usage(argv[0]);
diff --git a/debian/patches/upstream-automatic_extension.patch b/debian/patches/upstream-automatic_extension.patch
new file mode 100644
index 0000000..6195dfe
--- /dev/null
+++ b/debian/patches/upstream-automatic_extension.patch
@@ -0,0 +1,167 @@
+Description: upstream: automatic extension machinery enhancement
+ Attempt to improve the automatic extension machinery as implemented
+ in version 1.0.6 by introducing (i) long options to either disable
+ or enable this feature, (ii) dummy extensions that are meant to be
+ overwritten on the fly with respect the image format, (iii) a check
+ of the current extension if any against the expected image format
+ extension. By default the automatic extension is disabled for implicit
+ backward compatibility reasons. The implemented dummy extension are:
+ `.xxx', `.XXX', `.auto-extension', `automatic-extension'. If the current
+ extension is compatible with the current image format, then no extension
+ is added. This machinery is meant to not counteract already existing
+ software programs that call `surf' (e.g., `surfer', `singular').
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -75,6 +75,8 @@
+ #include "SymbolTable.h"
+ #include "symtab.h"
+ 
++#include "Options.h"
++
+ // #define DEBUG
+ #include "debug.h"
+ 
+@@ -432,6 +434,8 @@
+ 
+ void Script::saveColorImage ()
+ {
++	bool auto_extension = false;
++
+ 	if (Thread::shouldStop())
+ 		return;
+ 
+@@ -444,7 +448,52 @@
+ 		Misc::alert ("no filename given.");
+ 	}
+ 
+-// 	const char *name = surface_filename_data;
++	char * surface_filename_data_extension=strrchr(surface_filename_data,'.');
++
++	if ((surface_filename_data_extension != NULL) &&
++			(  (strcmp(surface_filename_data_extension, ".xxx") == 0)
++			|| (strcmp(surface_filename_data_extension, ".XXX") == 0)
++			|| (strcmp(surface_filename_data_extension, ".auto-extension") == 0)
++			|| (strcmp(surface_filename_data_extension, ".automatic-extension") == 0)
++			)
++		) {
++		*surface_filename_data_extension = '\0';
++		auto_extension = true;
++	}
++	else if(options->get_auto_extension()) {
++		if ((surface_filename_data_extension == NULL) ||
++				(!(((color_output_data == color_output_xwd_data) && (strcmp(surface_filename_data_extension, ".xwd") == 0))
++				|| ((color_output_data == color_output_sun_data) && (strcmp(surface_filename_data_extension, ".ras") == 0))
++				|| ((color_output_data == color_output_ppm_data) && (strcmp(surface_filename_data_extension, ".ppm") == 0))
++				|| ((color_output_data == color_output_jpeg_data) && (
++					(strcmp(surface_filename_data_extension, ".jpg") == 0) || (strcmp(surface_filename_data_extension, ".jpeg") == 0)
++					))
++				|| ((color_output_data == color_output_postscript_data) && (strcmp(surface_filename_data_extension, ".ps") == 0))
++				|| ((color_output_data == color_output_encapsulatedpostscript_data) && (strcmp(surface_filename_data_extension, ".eps") == 0))
++				|| ((color_output_data == color_output_pdf_data) && (strcmp(surface_filename_data_extension, ".pdf") == 0))
++				))
++			) {
++			auto_extension = true;
++		}
++	}
++
++	if(auto_extension) {
++		if (color_output_data == color_output_xwd_data) {
++			strcat(surface_filename_data, ".xwd");
++		} else if (color_output_data == color_output_sun_data) {
++			strcat(surface_filename_data, ".ras");
++		} else if (color_output_data == color_output_ppm_data) {
++			strcat(surface_filename_data, ".ppm");
++		} else if (color_output_data == color_output_jpeg_data) {
++			strcat(surface_filename_data, ".jpg");
++		} else if (color_output_data == color_output_postscript_data) {
++			strcat(surface_filename_data, ".ps");
++		} else if (color_output_data == color_output_encapsulatedpostscript_data) {
++			strcat(surface_filename_data, ".eps");
++		} else if (color_output_data == color_output_pdf_data) {
++			strcat(surface_filename_data, ".pdf");
++		}
++	}
+ 
+ 	/* Fuck, fuck, fuck...why cant I just have working exceptions with
+ 	 * every every version of gcc I can think of  (especially 2.7.x)...
+@@ -452,22 +501,6 @@
+ 	 * I could have just thrown an exception in FileWriter if the file couldnt
+ 	 * be opened. But now Ive got to open the file too early...
+ 	 */
+-	
+-	if (color_output_data == color_output_xwd_data) {
+-		strcat(surface_filename_data, ".xwd");
+-	} else if (color_output_data == color_output_sun_data) {
+-		strcat(surface_filename_data, ".ras");
+-	} else if (color_output_data == color_output_ppm_data) {
+-		strcat(surface_filename_data, ".ppm");
+-	} else if (color_output_data == color_output_jpeg_data) {
+-		strcat(surface_filename_data, ".jpg");
+-	} else if (color_output_data == color_output_postscript_data) {
+-		strcat(surface_filename_data, ".ps");
+-	} else if (color_output_data == color_output_encapsulatedpostscript_data) {
+-		strcat(surface_filename_data, ".eps");
+-	} else if (color_output_data == color_output_pdf_data) {
+-		strcat(surface_filename_data, ".pdf");
+-	} 
+ 
+ 	FileWriter fw (surface_filename_data);
+ 	FILE *f = fw.openFile();
+--- a/src/Options.h
++++ b/src/Options.h
+@@ -15,6 +15,7 @@
+ 	bool get_auto_resize() const { return auto_resize; }
+ 	bool get_verbose() const {  return !quiet; }
+ 	bool get_quiet() const {  return quiet; }
++	bool get_auto_extension() const { return auto_extension; }
+ 
+ private:
+ 	int argc;
+@@ -25,6 +26,7 @@
+ 	bool progress_dialog;
+ 	bool auto_resize;
+ 	bool quiet;
++	bool auto_extension;
+ };
+ 
+ extern Options* options;
+--- a/src/Options.cc
++++ b/src/Options.cc
+@@ -64,6 +64,11 @@
+ 		<< "    --auto-resize      resize image windows automatically to image size" << std::endl
+ #endif
+ 		<< std::endl
++		<< "    --disable-auto-extension" << std::endl
++		<< "                       disable automatic extension for graphic files (default)" << std::endl
++		<< "    --enable-auto-extension" << std::endl
++		<< "                       enable automatic extension for graphic files" << std::endl
++		<< std::endl
+ 		<< "-v, --verbose          verbose operation, print the executed commands (default)" << std::endl
+ 		<< "-q, --quiet, --silent  quiet operation, do not print the executed commands" << std::endl
+ 		<< std::endl
+@@ -88,7 +93,8 @@
+ 		execute(false),
+ 	  progress_dialog(false),
+ 		auto_resize(false),
+-		quiet(false)
++		quiet(false),
++		auto_extension(false)
+ {
+ 		int i;
+ 		for(i = 1; i < argc; ++i) {
+@@ -114,6 +120,10 @@
+ 				quiet = false;
+ 			} else if(strcmp(argv[i], "-q") == 0 || strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "--silent") == 0) {
+ 				quiet = true;
++			} else if(strcmp(argv[i], "--enable-auto-extension") == 0) {
++				auto_extension = true;
++			} else if(strcmp(argv[i], "--disable-auto-extension") == 0) {
++				auto_extension = false;
+ 			} else if(strcmp(argv[i], "--progress-dialog") == 0) {
+ #ifdef NO_GUI
+ #else
diff --git a/debian/patches/upstream-autotoolization-help2man.patch b/debian/patches/upstream-autotoolization-help2man.patch
new file mode 100644
index 0000000..ab5aca3
--- /dev/null
+++ b/debian/patches/upstream-autotoolization-help2man.patch
@@ -0,0 +1,248 @@
+Description: autotools: help2man
+ Implement the generation of the manpages for the front-end
+ program surf with help2man(1); the upstream manpage material
+ has been revisited and it is reused as help2man include file.
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -32,6 +32,7 @@
+ dnl some standard checks:
+ dnl ---------------------
+ 
++AC_PATH_PROG([HELP2MAN],[help2man])
+ AC_PROG_CC
+ AC_PROG_CXX
+ AC_PROG_LEX
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,6 +1,10 @@
+ 
+ bin_PROGRAMS = surf
+ 
++man_MANS = surf.1
++
++surf_DESCRIPTION = "visualization of algebraic curves and surfaces"
++
+ surf_SOURCES = \
+ 	compfn.cc \
+ 	cube.cc \
+@@ -90,3 +94,18 @@
+ 	$(ZLIB_LIBS) \
+ 	-lfl
+ 
++AM_H2MFLAGS = \
++	--manual="Surf Tool" \
++	--source="surf $(PACKAGE_VERSION)" \
++	--no-info
++
++%.1: %
++	$(HELP2MAN) \
++			-s 1 \
++			$(AM_H2MFLAGS) \
++			-I $(top_srcdir)/man/$*.h2m \
++			-n $(if $($*_DESCRIPTION), $($*_DESCRIPTION), "manual page for $*") \
++			-o $@ \
++		./$<
++
++CLEANFILES = $(man_MANS)
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -14,8 +14,6 @@
+ 
+ pkgdata_DATA = surf.xpm
+ 
+-man_MANS = surf.1
+-
+ if MAINTAINER_MODE
+ surf.xpm: $(top_builddir)/src/surf $(top_srcdir)/background.pic
+ 	$(top_builddir)/src/surf --no-gui $(top_srcdir)/background.pic
+@@ -23,8 +21,9 @@
+ 
+ dist-hook:
+ 	cp -prd $(top_srcdir)/examples $(top_distdir)
++	cp -prd $(top_srcdir)/man $(top_distdir)
+ 
+-EXTRA_DIST = background.pic $(man_MANS) $(pkgdata_DATA)
++EXTRA_DIST = background.pic $(pkgdata_DATA)
+ 
+ MAINTAINERCLEANFILES = $(pkgdata_DATA)
+ 
+--- /dev/null
++++ b/man/surf.h2m
+@@ -0,0 +1,49 @@
++help2man include file for surf man page
++
++[DESCRIPTION]
++.B surf
++is a tool to render algebraic curves and surfaces. It is script driven
++and has (optionally) a nifty graphical user interface using the Gtk
++widget set.
++
++The only input needed is the equation of an algebraic curve/surface in
++everyday mathematical notation. The output is a (series of) color or
++black and white image(s) in one of several file formats.
++
++.B surf
++also provides a C-style command language which helps working out more
++complicated equations.
++
++The resolution of an image is only bounded by the available
++memory. Since the image is stored as an array of floats and because some
++image processing algorithms need a copy of the image, you need at least
++width*height*12 bytes of virtual memory.
++
++.B surf
++can handle curves/surfaces up to degree 30. The main features include
++.B algebraic
++.BR curves ,
++.B algebraic
++.BR surfaces ,
++.B hyper plane
++.BR sections ,
++.B lines on
++.BR surfaces ,
++.B multiple
++.BR curves/surfaces ,
++.B adaptive anti aliasing
++and
++.BR dithering .
++
++[COPYRIGHT]
++Copyright (C) 1997\-2015 Johannes Gutenberg-Universitaet Mainz
++.br
++Copyright (C) 1996\-1997 Friedrich Alexander Universitaet Erlangen-Nuernberg
++
++[AUTHORS]
++Stephan Endrass,
++Hans Huelf,
++Ruediger Oertel,
++Kai Schneider,
++Ralf Schmitt,
++Johannes Beigel
+--- a/src/Options.cc
++++ b/src/Options.cc
+@@ -60,9 +60,9 @@
+ #ifndef NO_GUI
+ 		<< std::endl
+ 		<< "  -n, --no-gui           disable GUI, execute all scripts passed as FILEs" << std::endl
+-		<< "  -x, --exec             when running with GUI, execute first script immediately" << std::endl
+-		<< "      --progress-dialog  pop up a dialog instead of using a status bar" << std::endl
+-		<< "      --auto-resize      resize image windows automatically to image size" << std::endl
++		<< "  -x, --exec             execute scripts passed as FILEs immediately instead of just loaded them" << std::endl
++		<< "      --progress-dialog  pop up a progress dialog instead of using a status bar display during calculations" << std::endl
++		<< "      --auto-resize      resize image windows automatically to image size (without actual screensize check)" << std::endl
+ #endif
+ 		<< std::endl
+ 		<< "      --disable-auto-extension" << std::endl
+--- a/surf.1
++++ /dev/null
+@@ -1,105 +0,0 @@
+-.TH surf 1 "Mar 31 2000"
+-
+-.SH NAME
+-surf \- visualization of algebraic curves and surfaces
+-
+-.SH SYNOPSIS
+-.B surf
+-.B \|\-n\||\|\-\-no-gui
+-.IR file \ .\|.\|.
+-.br
+-.B surf
+-.RI [\| Gtk
+-.IR options \|]
+-.RB [\| \-x \||\| \-\-exec \|]
+-.RB [\| \-\-progress-dialog \|]
+-.RB [\| \-\-auto-resize \|]
+-.IR file \ .\|.\|.
+-.br
+-.B surf
+-.B \|\-\-help
+-
+-.SH DESCRIPTION
+-.B surf
+-is a tool to render algebraic curves and surfaces. It is script driven
+-and has (optionally) a nifty graphical user interface using the Gtk
+-widget set.
+-
+-The only input needed is the equation of an algebraic curve/surface in
+-everyday mathematical notation. The output is a (series of) color or
+-black and white image(s) in one of several file formats.
+-
+-.B surf
+-also provides a C-style command language which helps working out more
+-complicated equations.
+-
+-The resolution of an image is only bounded by the available
+-memory. Since the image is stored as an array of floats and because some
+-image processing algorithms need a copy of the image, you need at least
+-width*height*12 bytes of virtual memory.
+-
+-.B surf
+-can handle curves/surfaces up to degree 30. The main features include
+-.B algebraic
+-.BR curves ,
+-.B algebraic
+-.BR surfaces ,
+-.B hyper plane
+-.BR sections ,
+-.B lines on
+-.BR surfaces ,
+-.B multiple
+-.BR curves/surfaces ,
+-.B adaptive anti aliasing
+-and
+-.BR dithering .
+-
+-.SH OPTIONS
+-If you run
+-.B surf
+-with GUI support (i.\|e. without the
+-.B \-n\||\|\-\-no-gui
+-option) the standard
+-.I Gtk options
+-are recognized.
+-.TP
+-.B \-n, \-\-no-gui
+-Run without a graphical user interface, just execute the scripts
+-given as
+-.IR file s
+-and exit thereafter.
+-
+-In case
+-.B surf
+-has been compiled without GUI support this option does nothing and
+-scripts are always executed non-interactively.
+-
+-.TP
+-.B \-x, \-\-exec
+-Execute scripts passed as
+-.IR file s
+-immediately. Otherwise the scripts are just loaded, not executed.
+-
+-.TP
+-.B \-\-progress-dialog
+-Pop up a progress dialog instead of the status bar display during
+-calculations.
+-
+-.TP
+-.B \-\-auto-reszie
+-Automatically resize the image windows to the size of the image.
+-Be aware that there's no check whether the image size is bigger than
+-your actual screen size.
+-
+-.TP
+-.B \-\-help
+-Display usage information.
+-
+-.SH COPYRIGHT
+-Copyright (C)
+-1996\-1997 Friedrich Alexander Universitaet Erlangen-Nuernberg,
+-1997\-2000 Johannes Gutenberg-Universitaet Mainz
+-
+-.SH AUTHORS
+-Stephan Endrass, Hans Huelf, Ruediger Oertel, Kai Schneider,
+-Ralf Schmitt, Johannes Beigel
diff --git a/debian/patches/upstream-autotoolization-update.patch b/debian/patches/upstream-autotoolization-update.patch
new file mode 100644
index 0000000..2c6d68a
--- /dev/null
+++ b/debian/patches/upstream-autotoolization-update.patch
@@ -0,0 +1,1839 @@
+Description: upstream autotool machinery: update
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-03-14
+
+--- a/configure.in
++++ /dev/null
+@@ -1,216 +0,0 @@
+-dnl ---------------------
+-dnl configure.in for surf
+-dnl ---------------------
+-
+-AC_PREREQ(2.13)
+-AC_INIT(yaccsrc/degree.h)
+-AM_INIT_AUTOMAKE(surf, 1.0.6)
+-CF_VERBOSE
+-
+-
+-dnl check options:
+-dnl --------------
+-
+-AC_ARG_ENABLE(gui,
+-[  --disable-gui           disable graphical user interface],
+-	gui="$enableval", gui="yes")
+-
+-AC_ARG_ENABLE(cups,
+-[  --disable-cups          disable cups printing support],
+-	cups="$enableval", cups="yes")
+-
+-AC_ARG_ENABLE(pthread-test, 
+-[  --disable-pthread-test  do not determine how to compile multithreaded 
+-			  programs (You'll have to specify the necessary 
+-			  flags)],
+-	pthread_test="$enableval", pthread_test="yes")
+-
+-AC_ARG_WITH(gmp-prefix,[  --with-gmp-prefix=PFX   Prefix where GMP is installed (optional)],
+-            gmp_prefix="$withval", gmp_prefix="")
+-
+-
+-dnl some standard checks:
+-dnl ---------------------
+-
+-AC_PROG_CC
+-AC_PROG_CXX
+-AC_AIX
+-AC_ISC_POSIX
+-AC_MINIX
+-AC_HEADER_STDC
+-AM_PROG_LEX
+-AC_PROG_YACC
+-AC_PROG_RANLIB
+-
+-
+-dnl check if C++ compiler really works:
+-dnl -----------------------------------
+-
+-LF_CHECK_CC_FLAG(-Wall -W -Wwrite-strings -Wpointer-arith -Wconversion -Wno-unused -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs)
+-
+-RS_CHECK_HAVE_BOOL
+-if test "$rs_cv_have_bool" = "no"
+-then
+-	AC_DEFINE(bool, int)
+-	AC_DEFINE(true, 1)
+-	AC_DEFINE(false,0)
+-fi
+-
+-LF_CHECK_CXX_FLAG(-fno-rtti -fno-exceptions)
+-LF_CHECK_CXX_FLAG(-Wall -W -Wwrite-strings -Wpointer-arith -Wconversion -Wno-unused  -Wstrict-prototypes -Wmissing-prototypes -Woverloaded-virtual -Wno-deprecated)
+-
+-ICE_CXX_EXPLICIT_TEMPLATE_INSTANTIATION
+-AC_CXX_FUNCTION_NONTYPE_PARAMETERS
+-if test "$ac_cv_cxx_function_nontype_parameters" = "no"; then
+-	AC_MSG_ERROR(["Sorry, your compiler is not smart enough to build surf"])
+-fi
+-
+-if test "$GCC" = "no" ; then
+-	case `uname` in
+-	IRIX*)
+-		CXXFLAGS="-LANG:std $CXXFLAGS"
+-		;;
+-	esac
+-fi
+-
+-
+-dnl pthread stuff:
+-dnl --------------
+-
+-if test "$pthread_test" = "yes"
+-then
+-	AC_CANONICAL_HOST
+-	case "$host_os" in
+-		*irix* | *linux* |*solaris*) try_threads="linux";;
+-		*freebsd*)	try_threads="freebsd";;
+-		*)		try_threads="other"; AC_MSG_WARN([Unknown os $host_os. Maybe it's better to configure with --disable-pthread-test]);;
+-	esac
+-fi
+-
+-if test "$try_threads" = "linux"
+-then
+-	RS_CHECK_LIB(pthread)
+-	AC_DEFINE(_REENTRANT)
+-fi
+-
+-if test "$try_threads" = "freebsd"
+-then
+-	CPPFLAGS="$CPPFLAGS -pthread"
+-	LDFLAGS="$LDFLAGS -pthread"
+-fi
+-
+-RS_CHECK_HEADER(pthread.h)
+-
+-RS_CHECK_PTHREADS
+-
+-
+-dnl check for gethostname prototype in unistd.h:
+-dnl --------------------------------------------
+-
+-AC_CACHE_CHECK(whether there is a prototype for gethostname in unistd.h,
+-ac_cv_gethostname_has_prototype,
+-AC_EGREP_HEADER(gethostname, unistd.h,
+-		ac_cv_gethostname_has_prototype=yes,
+-		ac_cv_gethostname_has_prototype=no
+-	        AC_DEFINE(NO_GETHOSTNAME_PROTO)))
+-
+-
+-
+-dnl check for libraries:
+-dnl --------------------
+-
+-dnl when compiling with CUPS support check for CUPS
+-
+-if test "$cups" = "yes"
+-then
+-	AC_PATH_PROG(CUPSCONFIG,cups-config)
+-	AC_DEFINE(HAVE_LIBCUPS)
+-	CFLAGS="`$CUPSCONFIG --cflags` $CFLAGS"
+-	CXXFLAGS="`$CUPSCONFIG --cflags` $CXXFLAGS"
+-	LIBS="`$CUPSCONFIG --libs` $LIBS"
+-	AM_CONDITIONAL(CUPS, test "x$cups" = "xyes")
+-fi
+-
+-dnl when compiling with GUI support check for GTK >= 1.2.0 and X:
+-
+-if test "$gui" = "yes"
+-then
+-	AM_PATH_GTK(1.2.0)
+-	CFLAGS="$CFLAGS $GTK_CFLAGS"
+-	CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
+-else
+-	AC_DEFINE(NO_GUI)
+-fi
+-
+-AC_PATH_X
+-AC_PATH_XTRA
+-CFLAGS="$CFLAGS $X_CFLAGS"
+-CXXFLAGS="$CXXFLAGS $X_CFLAGS"
+-
+-AM_CONDITIONAL(GUI, test "x$gui" = "xyes")
+-
+-
+-dnl math lib, power function and (g)zlib:
+-
+-RS_CHECK_LIB(m, main)
+-RS_CHECK_POW()
+-AC_CHECK_LIB(z,  main,,
+-	     AC_CHECK_LIB(gz, main,,
+-                          AC_MSG_ERROR([Sorry: can't find libz/libgz.])))
+-
+-dnl jpeg library and jpeglib.h:
+-
+-RS_CHECK_LIB(jpeg, main)
+-RS_CHECK_HEADER(jpeglib.h)
+-
+-dnl check for tiff library and header file (FreeBSD 3.0 has tiff34.so
+-dnl instead of tiff.so and the header files are in /usr/local/lib/tiff34):
+-
+-AC_CHECK_LIB(tiff, main,,
+-             AC_CHECK_LIB(tiff34, main,,
+-                          AC_MSG_ERROR([Sorry: can't find libtiff])))
+-
+-AC_CHECK_HEADER(tiffio.h,,
+-                [AC_CHECK_HEADER(tiff34/tiffio.h,AC_DEFINE(TIFF_HEADER_34))],
+-		[AC_MSG_ERROR(["Sorry: cannot find header file tiffio.h"])] )
+-
+-dnl gmp library and header file:
+-
+-if test x"$gmp_prefix" != x ; then
+-	LDFLAGS="-L$gmp_prefix/lib $LDFLAGS"
+-	CPPFLAGS="-I$gmp_prefix/include $CPPFLAGS"
+-fi
+-
+-AC_CHECK_HEADER(gmp.h,,
+-		[AC_CHECK_HEADER(gmp2/gmp.h,
+-				AC_DEFINE(GMP2_PREFIX),
+-				AC_MSG_ERROR([Sorry: can't find header file gmp.h]))])
+-AC_CHECK_LIB(gmp, main,,
+-             AC_CHECK_LIB(gmp2, main,,
+-			  AC_MSG_ERROR([Sorry: can't find gmp])))
+-
+-
+-dnl set DATADIR variable:
+-dnl ---------------------
+-dnl (Is there a another way to quote this...sometimes
+-dnl "/bin/sh ./config.status --recheck" complains about a non working 
+-dnl C compiler)
+-
+-CPPFLAGS="$CPPFLAGS -DDATADIR=\\\"$datadir\\\""
+-
+-
+-
+-
+-AC_OUTPUT(	Makefile
+-		src/Makefile
+-		image-formats/Makefile
+-		drawfunc/Makefile
+-		yaccsrc/Makefile
+-		curve/Makefile
+-		mt/Makefile
+-		draw/Makefile
+-		misc/Makefile
+-		debug/Makefile
+-		gtkgui/Makefile
+-		dither/Makefile
+-	 )
+--- a/draw/Makefile.am
++++ b/draw/Makefile.am
+@@ -1,8 +1,8 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
++noinst_LIBRARIES = libsurf_draw.a
+ 
+-libdummy_a_SOURCES = SurfaceCalc.cc SurfaceCalc.h \
++libsurf_draw_a_SOURCES = \
++	SurfaceCalc.cc           SurfaceCalc.h \
+ 	NewClip.cc               NewClip.h \
+ 	NewSimpleClip.cc         NewSimpleClip.h \
+ 	NewClipSphere.cc         NewClipSphere.h \
+@@ -17,7 +17,13 @@
+ 	NewClipAlgebraicCyl.cc   NewClipAlgebraicCyl.h \
+ 	NewClipAlgebraicUser.cc  NewClipAlgebraicUser.h \
+ 	                         NewClipNone.h \
+-	Preview.h
+-
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++	                         Preview.h
+ 
++libsurf_draw_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/drawfunc \
++	-I$(top_srcdir)/yaccsrc \
++	-I$(top_builddir)/yaccsrc \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug
+--- a/drawfunc/Makefile.am
++++ b/drawfunc/Makefile.am
+@@ -1,22 +1,32 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES =	Bezier.cc Bezier.h				\
+-			Clip.cc Clip.h					\
+-			DrawFunc.cc DrawFunc.h				\
+-			DrawfuncData.cc DrawfuncData.h			\
+-			Horner.cc Horner.h				\
+-			Hornergroup.cc Hornergroup.h			\
+-			MappingMatrix.cc MappingMatrix.h		\
+-			MultiVariatePolynom.cc MultiVariatePolynom.h	\
+-			Position.cc Position.h				\
+-			Sturmchain.cc Sturmchain.h			\
+-			UniVariatePolynom.cc UniVariatePolynom.h	\
+-			Vector.cc Vector.h				\
+-			HornergroupXY.cc HornergroupXY.h		\
+-			HornergroupXYZ.cc HornergroupXYZ.h		\
+-			RationalHornerXY.cc RationalHornerXY.h		\
+-			MultiIndex.h					\
+-			Monomial.h
++noinst_LIBRARIES = libsurf_drawfunc.a
++
++libsurf_drawfunc_a_SOURCES =	\
++	Bezier.cc Bezier.h \
++	Clip.cc Clip.h \
++	DrawFunc.cc DrawFunc.h \
++	DrawfuncData.cc DrawfuncData.h \
++	Horner.cc Horner.h \
++	Hornergroup.cc Hornergroup.h \
++	MappingMatrix.cc MappingMatrix.h \
++	MultiVariatePolynom.cc MultiVariatePolynom.h \
++	Position.cc Position.h \
++	Sturmchain.cc Sturmchain.h \
++	UniVariatePolynom.cc UniVariatePolynom.h \
++	Vector.cc Vector.h \
++	HornergroupXY.cc HornergroupXY.h \
++	HornergroupXYZ.cc HornergroupXYZ.h \
++	RationalHornerXY.cc RationalHornerXY.h \
++	MultiIndex.h \
++	Monomial.h
++
++libsurf_drawfunc_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/curve \
++	-I$(top_srcdir)/draw \
++	-I$(top_srcdir)/yaccsrc \
++	-I$(top_builddir)/yaccsrc \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
+--- a/image-formats/Makefile.am
++++ b/image-formats/Makefile.am
+@@ -1,13 +1,22 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES =  eps.cc ps.cc       tiffprint.cc     xbitmap.cc\
+-	sun.cc    xwd.cc \
+-	sun.h      xbitmap.h \
+-	eps.h      ps.h       tiffprint.h     xwd.h \
+-	jpeg.h jpeg.cc
++noinst_LIBRARIES = libsurf_image_formats.a
+ 
++libsurf_image_formats_a_SOURCES = \
++	eps.cc eps.h \
++	ps.cc ps.h \
++	tiffprint.cc tiffprint.h \
++	xbitmap.cc xbitmap.h \
++	sun.cc sun.h \
++	xwd.cc xwd.h \
++	jpeg.cc jpeg.h
+ 
++libsurf_image_formats_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug \
++	$(LIBJPEG_CFLAGS) \
++	$(LIBTIFF_CFLAGS) \
++	$(X_CFLAGS) \
++	$(ZLIB_CFLAGS)
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
+ 
+--- a/misc/Makefile.am
++++ b/misc/Makefile.am
+@@ -1,10 +1,16 @@
+-include $(top_srcdir)/Makefile.global
+-CPPFLAGS = @CPPFLAGS@ @GTK_CFLAGS@
+-noinst_LIBRARIES = libdummy.a
+ 
+-libdummy_a_SOURCES = welcomeMessage.cc welcomeMessage.h	\
++noinst_LIBRARIES = libsurf_misc.a
++
++libsurf_misc_a_SOURCES = \
++	welcomeMessage.cc welcomeMessage.h \
+ 	Misc.cc Misc.h \
+ 	mystrdup.cc mystrdup.h \
+ 	FileWriter.h
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++libsurf_misc_a_CPPFLAGS =
++
++if GUI
++libsurf_misc_a_CPPFLAGS += \
++	-I$(top_srcdir)/gtkgui \
++	$(GTK_CFLAGS)
++endif
+--- a/mt/Makefile.am
++++ b/mt/Makefile.am
+@@ -1,9 +1,23 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES =	Thread.cc Thread.h			\
+-			GuiThread.cc GuiThread.h		\
+-			TSDrawingArea.cc TSDrawingArea.h	\
+-			cthread.cc cthread.h
++noinst_LIBRARIES = libsurf_mt.a
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++libsurf_mt_a_SOURCES = \
++	Thread.cc Thread.h \
++	GuiThread.cc GuiThread.h \
++	TSDrawingArea.cc TSDrawingArea.h \
++	cthread.cc cthread.h
++
++libsurf_mt_a_CPPFLAGS = \
++	-I$(top_srcdir)/src
++
++if GUI
++libsurf_mt_a_CPPFLAGS += \
++	-I$(top_srcdir)/gtkgui
++endif
++
++libsurf_mt_a_CPPFLAGS += \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug
++
++libsurf_mt_a_CXXFLAGS = \
++	$(PTHREAD_CFLAGS)
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -1,24 +1,25 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = compfn.cc \
+-        cube.cc \
+-        float_buffer.cc \
+-        gui_config.cc \
+-        init_parser.cc \
+-        main.cc \
+-        oct_quan.cc \
+-        roots.cc \
+-        color.h \
+-        compfn.h \
+-        cube.h \
+-        def.h \
+-        gui_config.h \
+-        gui_enum.h \
+-        init_parser.h \
+-        oct_quan.h \
+-        roots.h \
+-        stop.cc stop.h \
++bin_PROGRAMS = surf
++
++surf_SOURCES = \
++	compfn.cc \
++	cube.cc \
++	float_buffer.cc \
++	gui_config.cc \
++	init_parser.cc \
++	main.cc \
++	oct_quan.cc \
++	roots.cc \
++	color.h \
++	compfn.h \
++	cube.h \
++	def.h \
++	gui_config.h \
++	gui_enum.h \
++	init_parser.h \
++	oct_quan.h \
++	roots.h \
++	stop.cc stop.h \
+ 	float_buffer.h\
+ 	bit_buffer.cc bit_buffer.h			\
+ 	SurfaceDataStruct.cc SurfaceDataStruct.h	\
+@@ -31,6 +32,61 @@
+ 	mytypes.h \
+ 	Options.h Options.cc
+ 
++surf_CPPFLAGS = \
++	-I$(top_srcdir)/drawfunc \
++	-I$(top_srcdir)/yaccsrc \
++	-I$(top_builddir)/yaccsrc \
++	-I$(top_srcdir)/image-formats \
++	-I$(top_srcdir)/curve \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/draw \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug \
++	-I$(top_srcdir)/xpm \
++	-I$(top_srcdir)/dither
++
++if GUI
++surf_CPPFLAGS += \
++	-I$(top_srcdir)/gtkgui \
++	$(GTK_CFLAGS)
++endif
++
++surf_CPPFLAGS += \
++	$(X_CFLAGS)
++
++surf_LDFLAGS = \
++	$(PTHREAD_CFLAGS) \
++	$(GMP_LDFLAGS)
++
++surf_LDADD = \
++	$(top_builddir)/yaccsrc/libsurf_parser.a \
++	$(top_builddir)/curve/libsurf_curve.a \
++	$(top_builddir)/draw/libsurf_draw.a \
++	$(top_builddir)/drawfunc/libsurf_drawfunc.a \
++	$(top_builddir)/debug/libsurf_debug.a \
++	$(top_builddir)/dither/libsurf_dither.a \
++	$(top_builddir)/image-formats/libsurf_image_formats.a \
++	$(top_builddir)/misc/libsurf_misc.a \
++	$(top_builddir)/mt/libsurf_mt.a
++
++if GUI
++surf_LDADD += \
++	$(top_builddir)/gtkgui/libsurf_gtkgui.a
++endif
++
++surf_LDADD += \
++	$(PTHREAD_LIBS) \
++	$(GMP_LIBS) \
++	$(LIBJPEG_LIBS) \
++	$(LIBTIFF_LIBS)
++
++if GUI
++surf_LDADD += \
++	$(GTK_LIBS) \
++	$(X_LIBS)
++endif
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++surf_LDADD += \
++	$(ZLIB_LIBS) \
++	-lfl
+ 
+--- a/curve/Makefile.am
++++ b/curve/Makefile.am
+@@ -1,21 +1,31 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = RBTree.cc RBTree.h		\
+-        Array.h				\
+-        defs.h				\
+-        Matrix.h			\
+-        Monom.h				\
+-        RefCounter.h			\
+-        TreePolynom.h			\
+-	doubleMath.h			\
+-	resultant.cc resultant.h	\
+-	RootFinder2d.cc RootFinder2d.h	\
+-	RootFinder3d.cc RootFinder3d.h  \
+-	DrawCurve.cc DrawCurve.h	\
+-	mygmp.cc mygmp.h		\
+-	BigInteger.cc BigInteger.h	\
++noinst_LIBRARIES = libsurf_curve.a
++
++libsurf_curve_a_SOURCES = \
++	RBTree.cc RBTree.h \
++	Array.h \
++	defs.h \
++	Matrix.h \
++	Monom.h \
++	RefCounter.h \
++	TreePolynom.h \
++	doubleMath.h \
++	resultant.cc resultant.h \
++	RootFinder2d.cc RootFinder2d.h \
++	RootFinder3d.cc RootFinder3d.h \
++	DrawCurve.cc DrawCurve.h \
++	mygmp.cc mygmp.h \
++	BigInteger.cc BigInteger.h \
+ 	Bezout.h
+ 
++libsurf_curve_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/drawfunc \
++	-I$(top_srcdir)/draw \
++	-I$(top_srcdir)/yaccsrc \
++	-I$(top_builddir)/yaccsrc \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug
++
+ EXTRA_DIST = examples.txt
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
+--- a/debug/Makefile.am
++++ b/debug/Makefile.am
+@@ -1,8 +1,7 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = debug.cc debug.h \
+-	Timer.h
++noinst_LIBRARIES = libsurf_debug.a
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++libsurf_debug_a_SOURCES = \
++	debug.cc debug.h \
++	Timer.h
+ 
+--- a/dither/Makefile.am
++++ b/dither/Makefile.am
+@@ -1,20 +1,22 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES = dither_brute.cc dither_brute.h			\
+-	dither_clustered.cc dither_clustered.h				\
+-	dither_dispersed.cc dither_dispersed.h				\
+-	dither_floyd_steinberg.cc dither_floyd_steinberg.h		\
+-	dither_jarvis_judis_ninke.cc dither_jarvis_judis_ninke.h	\
+-	dither_stucki.cc dither_stucki.h				\
+-	dither_dot_diffusion.cc dither_dot_diffusion.h			\
+-	dither_smooth_dot_diffusion.cc dither_smooth_dot_diffusion.h	\
+-	copy_rgb_to_float.cc copy_rgb_to_float.h			\
+-	copy_rgb_to_float_curve.cc copy_rgb_to_float_curve.h		\
+-	dither_pixel_radius_adjust.cc dither_pixel_radius_adjust.h	\
+-	dither.h
++noinst_LIBRARIES = libsurf_dither.a
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++libsurf_dither_a_SOURCES = \
++	dither_brute.cc dither_brute.h \
++	dither_clustered.cc dither_clustered.h \
++	dither_dispersed.cc dither_dispersed.h \
++	dither_floyd_steinberg.cc dither_floyd_steinberg.h \
++	dither_jarvis_judis_ninke.cc dither_jarvis_judis_ninke.h \
++	dither_stucki.cc dither_stucki.h \
++	dither_dot_diffusion.cc dither_dot_diffusion.h \
++	dither_smooth_dot_diffusion.cc dither_smooth_dot_diffusion.h \
++	copy_rgb_to_float.cc copy_rgb_to_float.h \
++	copy_rgb_to_float_curve.cc copy_rgb_to_float_curve.h \
++	dither_pixel_radius_adjust.cc dither_pixel_radius_adjust.h \
++	dither.h
+ 
+-echo_obj::
+-	@echo $(libdummy_a_OBJECTS)
++libsurf_dither_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug
+--- a/yaccsrc/Makefile.am
++++ b/yaccsrc/Makefile.am
+@@ -1,26 +1,34 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-EXTRA_DIST = polyyacc.h
+-YACC = @YACC@ -d
++noinst_LIBRARIES = libsurf_parser.a
+ 
+-polylex.c: polyyacc.c
+-lexfunc.cc: polyyacc.c
++libsurf_parser_a_SOURCES =	\
++	bezierarith.cc bezierarith.h \
++	hornerarith.cc hornerarith.h \
++	monomarith.cc monomarith.h \
++	mymemory.cc mymemory.h \
++	polyarith.cc polyarith.h \
++	polyroot.cc polyroot.h \
++	polyx.cc polyx.h \
++	simple.cc simple.h \
++	polyyacc.y polylex.l polylexyacc.h degree.h \
++	lexfunc.cc \
++	SymbolTable.cc SymbolTable.h \
++	Script.cc Script.h \
++	ExecuteScriptStruct.cc ExecuteScriptStruct.h \
++	addDefaultSymbols.cc addDefaultSymbols.h
+ 
+-noinst_LIBRARIES = libdummy.a
+-libdummy_a_SOURCES =	bezierarith.cc bezierarith.h	\
+-			hornerarith.cc hornerarith.h	\
+-			monomarith.cc monomarith.h	\
+-			mymemory.cc mymemory.h		\
+-			polyarith.cc polyarith.h	\
+-			polyroot.cc polyroot.h		\
+-			polyx.cc polyx.h		\
+-			simple.cc simple.h		\
+-			polyyacc.y polylex.l polylexyacc.h degree.h \
+-			lexfunc.cc			\
+-			SymbolTable.cc SymbolTable.h	\
+-			Script.cc Script.h		\
+-			ExecuteScriptStruct.cc ExecuteScriptStruct.h \
+-			addDefaultSymbols.cc addDefaultSymbols.h
++AM_YFLAGS = --defines
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++libsurf_parser_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/curve \
++	-I$(top_srcdir)/drawfunc \
++	-I$(top_srcdir)/draw \
++	-I$(top_srcdir)/dither \
++	-I$(top_srcdir)/image-formats \
++	-I$(top_srcdir)/yaccsrc \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug
+ 
++EXTRA_DIST = polyyacc.h
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -1,70 +1,30 @@
+-AUTOMAKE_OPTIONS = foreign 1.4
++ACLOCAL_AMFLAGS = -I m4
+ 
+-DITHER_OBJ = dither/dither_brute.o dither/dither_clustered.o dither/dither_dispersed.o dither/dither_floyd_steinberg.o dither/dither_jarvis_judis_ninke.o dither/dither_stucki.o dither/dither_dot_diffusion.o dither/dither_smooth_dot_diffusion.o dither/copy_rgb_to_float.o dither/copy_rgb_to_float_curve.o dither/dither_pixel_radius_adjust.o
++AUTOMAKE_OPTIONS = gnu dist-bzip2 dist-xz
+ 
+-DEBUG_OBJ = debug/debug.o
++AM_DISTCHECK_CONFIGURE_FLAGS ?= --disable-maintainer-mode
+ 
+-MISC_OBJ = misc/welcomeMessage.o misc/Misc.o misc/mystrdup.o
++SUBDIRS = yaccsrc image-formats drawfunc curve mt draw misc debug dither
+ 
+-DRAW_OBJ = draw/NewClip.o draw/NewClipSphere.o draw/NewClipSphereCentral.o draw/NewClipSphereParallel.o draw/NewClipAlgebraic.o draw/NewClipAlgebraicCube.o draw/NewClipAlgebraicTetra.o draw/NewClipAlgebraicOcta.o draw/NewClipAlgebraicDode.o draw/NewClipAlgebraicIco.o draw/NewClipAlgebraicCyl.o draw/NewClipAlgebraicUser.o draw/NewSimpleClip.o draw/SurfaceCalc.o
+-
+-MT_OBJ = mt/GuiThread.o mt/Thread.o mt/TSDrawingArea.o mt/cthread.o
+-
+-if CUPS
+-GTKGUI_OBJ = gtkgui/start.o gtkgui/MainWindowController.o gtkgui/mycolor.o gtkgui/TextWidget.o gtkgui/showAbout.o gtkgui/ProgressDialog.o gtkgui/ColorWindow.o gtkgui/DrawingArea.o gtkgui/PositionWindow.o gtkgui/ConfigurationWindow.o gtkgui/NumericWindow.o gtkgui/ColorSelectionButton.o gtkgui/IlluminationWindow.o gtkgui/Requester.o gtkgui/DisplayWindow.o gtkgui/WidgetReadWriter.o gtkgui/DitherWindow.o gtkgui/ClipWindow.o gtkgui/Document.o gtkgui/RGBToStandard.o gtkgui/mygtk.o gtkgui/Save [...]
+-else
+-GTKGUI_OBJ = gtkgui/start.o gtkgui/MainWindowController.o gtkgui/mycolor.o gtkgui/TextWidget.o gtkgui/showAbout.o gtkgui/ProgressDialog.o gtkgui/ColorWindow.o gtkgui/DrawingArea.o gtkgui/PositionWindow.o gtkgui/ConfigurationWindow.o gtkgui/NumericWindow.o gtkgui/ColorSelectionButton.o gtkgui/IlluminationWindow.o gtkgui/Requester.o gtkgui/DisplayWindow.o gtkgui/WidgetReadWriter.o gtkgui/DitherWindow.o gtkgui/ClipWindow.o gtkgui/Document.o gtkgui/RGBToStandard.o gtkgui/mygtk.o gtkgui/Save [...]
++if GUI
++SUBDIRS += gtkgui
+ endif
+ 
+-CURVE_OBJ = curve/RBTree.o curve/resultant.o curve/RootFinder2d.o curve/RootFinder3d.o curve/DrawCurve.o curve/BigInteger.o
+-
+-DRAWFUNC_OBJ =  drawfunc/Bezier.o drawfunc/Clip.o drawfunc/DrawfuncData.o drawfunc/DrawFunc.o drawfunc/Hornergroup.o drawfunc/Horner.o drawfunc/MappingMatrix.o drawfunc/MultiVariatePolynom.o drawfunc/Position.o drawfunc/Sturmchain.o drawfunc/UniVariatePolynom.o drawfunc/Vector.o drawfunc/HornergroupXY.o drawfunc/HornergroupXYZ.o drawfunc/RationalHornerXY.o
+-
+-IMAGE_OBJ =  image-formats/eps.o image-formats/ps.o image-formats/sun.o image-formats/tiffprint.o image-formats/xbitmap.o image-formats/xwd.o image-formats/jpeg.o
+-
+-SRC_OBJ = src/RGBToNetscape.o src/compfn.o src/cube.o src/float_buffer.o src/gui_config.o src/init_parser.o src/main.o src/oct_quan.o src/RgbBuffer.o src/roots.o src/bit_buffer.o src/SurfaceDataStruct.o src/CanvasDataStruct.o src/symtab.o src/WindowGeometry.o src/antialiasing_factor.o src/stop.o src/Options.o
+-
+-YACCSRC_OBJ = yaccsrc/bezierarith.o yaccsrc/hornerarith.o yaccsrc/monomarith.o yaccsrc/mymemory.o yaccsrc/polyarith.o yaccsrc/polylex.o yaccsrc/polyroot.o yaccsrc/polyyacc.o yaccsrc/simple.o yaccsrc/polyx.o yaccsrc/lexfunc.o yaccsrc/SymbolTable.o yaccsrc/addDefaultSymbols.o yaccsrc/Script.o yaccsrc/ExecuteScriptStruct.o
+-
++SUBDIRS += src docs
+ 
+-LOCAL_OBJECTS = $(CURVE_OBJ) $(BALLS_OBJ) $(MISC_OBJ) $(DRAWFUNC_OBJ) $(IMAGE_OBJ) $(SRC_OBJ) $(YACCSRC_OBJ) $(MT_OBJ) $(DRAW_OBJ) $(DEBUG_OBJ) $(DITHER_OBJ)
++pkgdata_DATA = surf.xpm
+ 
++man_MANS = surf.1
+ 
+-if GUI
+-SUBDIRS = yaccsrc src image-formats drawfunc curve mt draw misc debug dither gtkgui
+-else
+-SUBDIRS = yaccsrc src image-formats drawfunc curve mt draw misc debug dither
++if MAINTAINER_MODE
++surf.xpm: $(top_builddir)/src/surf $(top_srcdir)/background.pic
++	$(top_builddir)/src/surf --no-gui $(top_srcdir)/background.pic
+ endif
+ 
+-bin_PROGRAMS = surf
+-surf_SOURCES = 
+-EXTRA_DIST = background.pic Makefile.global aclocal.m4 surf.1 surf.xpm
+-man_MANS = surf.1
+-pkgdata_DATA = surf.xpm
++dist-hook:
++	cp -prd $(top_srcdir)/examples $(top_distdir)
+ 
+-if CUPS
+-surf: $(LOCAL_OBJECTS) $(GTKGUI_OBJ)
+-	$(CXX) $(LOCAL_OBJECTS) $(GTKGUI_OBJ) -o surf $(LDFLAGS) -lXmu -lXext -lXt @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ $(LIBS) -lfl @GTK_LIBS@ -lcups
+-else
+-if GUI
+-surf: $(LOCAL_OBJECTS) $(GTKGUI_OBJ)
+-	$(CXX) $(LOCAL_OBJECTS) $(GTKGUI_OBJ) -o surf $(LDFLAGS) -lXmu -lXext -lXt @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ $(LIBS) -lfl @GTK_LIBS@
+-else
+-surf: $(LOCAL_OBJECTS)
+-	$(CXX) $(LOCAL_OBJECTS) -o surf $(LDFLAGS) $(LIBS) -lfl 
+-endif
+-endif
++EXTRA_DIST = background.pic $(man_MANS) $(pkgdata_DATA)
+ 
+-clean-local::
+-	rm -f *~
++MAINTAINERCLEANFILES = $(pkgdata_DATA)
+ 
+-dist-hook::
+-	absdistdir=`cd $(distdir) && pwd` && \
+-	(cd $(top_srcdir) && find examples docs | grep -v CVS | cpio -pad $$absdistdir)
+-
+-#install-data-local:: surf.xpm
+-#	$(mkinstalldirs) $(pkgdatadir)
+-#	@(test -s surf.xpm && $(INSTALL) -m 644 surf.xpm $(pkgdatadir)) || echo "WARNING: background picture not installed"
+-#
+-#surf.xpm: surf $(srcdir)/background.pic
+-#	./surf --no-gui $(srcdir)/background.pic
+--- /dev/null
++++ b/configure.ac
+@@ -0,0 +1,166 @@
++dnl ---------------------
++dnl configure.in for surf
++dnl ---------------------
++
++AC_PREREQ(2.65)
++AC_INIT([surf],[1.0.6],[endrass at mathematik.uni-mainz.de])
++AC_CONFIG_MACRO_DIR([m4])
++AC_CONFIG_AUX_DIR([build-aux])
++AC_CONFIG_SRCDIR([yaccsrc/degree.h])
++AC_USE_SYSTEM_EXTENSIONS
++AM_INIT_AUTOMAKE
++AM_SILENT_RULES([no])
++AM_MAINTAINER_MODE([enable])
++
++
++dnl Check for which system:
++dnl -----------------------
++AC_CANONICAL_HOST
++
++dnl check options:
++dnl --------------
++
++AC_ARG_ENABLE(gui,
++	[  --enable-gui            enable graphical user interface],
++	[gui="$enableval"], [gui="no"])
++
++AC_ARG_ENABLE(cups,
++	[  --enable-cups           enable cups printing support],
++	[cups="$enableval"], [cups="no"])
++
++
++dnl some standard checks:
++dnl ---------------------
++
++AC_PROG_CC
++AC_PROG_CXX
++AC_PROG_LEX
++AC_PROG_YACC
++AC_PROG_INSTALL
++AC_PROG_LN_S
++
++dnl libtool:
++dnl --------
++LT_INIT
++
++AC_HEADER_STDC
++
++dnl check if C++ compiler really works:
++dnl -----------------------------------
++
++AX_APPEND_COMPILE_FLAGS(-Wall,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-W,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wwrite-strings,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wpointer-arith,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wconversion,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wno-unused,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wstrict-prototypes,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wmissing-prototypes,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wmissing-declarations,[CFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wnested-externs,[CFLAGS])
++
++AC_LANG_SAVE
++AC_LANG_CPLUSPLUS
++AC_TRY_COMPILE(,[bool a=false; bool b=true; return 0;],[],[
++	AC_DEFINE(bool, int)
++	AC_DEFINE(true, 1)
++	AC_DEFINE(false,0)
++	])
++AC_LANG_RESTORE
++
++AC_LANG_SAVE
++AC_LANG_CPLUSPLUS
++AX_APPEND_COMPILE_FLAGS(-fno-rtti,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-fno-exceptions,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wall,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-W,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wwrite-strings,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wpointer-arith,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wconversion,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wno-unused,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Woverloaded-virtual,[CXXFLAGS])
++AX_APPEND_COMPILE_FLAGS(-Wno-deprecated,[CXXFLAGS])
++AC_LANG_RESTORE
++
++
++AX_CXX_EXPLICIT_INSTANTIATIONS
++
++AX_CXX_FUNCTION_NONTYPE_PARAMETERS
++if test "$ax_cv_cxx_function_nontype_parameters" = "no"; then
++	AC_MSG_ERROR(["Sorry, your compiler is not smart enough to build surf"])
++fi
++
++dnl pthread stuff:
++dnl --------------
++
++ACX_PTHREAD([AC_DEFINE([_REENTRANT])],[])
++
++
++dnl check for gethostname prototype in unistd.h:
++dnl --------------------------------------------
++
++AC_CACHE_CHECK(whether there is a prototype for gethostname in unistd.h,
++ac_cv_gethostname_has_prototype,
++AC_EGREP_HEADER(gethostname, unistd.h,
++		ac_cv_gethostname_has_prototype=yes,
++		ac_cv_gethostname_has_prototype=no
++	        AC_DEFINE(NO_GETHOSTNAME_PROTO)))
++
++
++
++dnl check for libraries:
++dnl --------------------
++
++dnl when compiling with CUPS support check for CUPS
++
++if test "$cups" = "yes"
++then
++	AC_PATH_PROG(CUPSCONFIG,cups-config)
++	AC_DEFINE(HAVE_LIBCUPS)
++	CFLAGS="`$CUPSCONFIG --cflags` $CFLAGS"
++	CXXFLAGS="`$CUPSCONFIG --cflags` $CXXFLAGS"
++	LIBS="`$CUPSCONFIG --libs` $LIBS"
++fi
++AM_CONDITIONAL(CUPS, test "x$cups" = "xyes")
++
++dnl when compiling with GUI support check for GTK >= 1.2.0 and X:
++if test "$gui" = "yes"; then
++	AC_PATH_X
++	AC_PATH_XTRA
++	AM_PATH_GTK([1.2.0])
++else
++	AC_PATH_XTRA
++	AC_DEFINE(NO_GUI)
++fi
++AM_CONDITIONAL(GUI, test "x$gui" = "xyes")
++
++
++dnl Checks for libraries.
++## math library
++LT_LIB_M
++AC_CHECK_FUNCS([pow])
++## GMP library
++AM_PATH_GMP([5])
++## zlib library
++PKG_CHECK_MODULES([ZLIB],[zlib],[],[AC_MSG_ERROR([unable to find zlib])])
++## JPEG library
++PKG_CHECK_MODULES([LIBJPEG],[libjpeg],[],[AC_MSG_ERROR([unable to find libjpeg])])
++## TIFF library
++PKG_CHECK_MODULES([LIBTIFF],[libtiff-4],[],[AC_MSG_ERROR([unable to find libtiff])])
++
++AC_CONFIG_FILES([
++	Makefile
++	src/Makefile
++	image-formats/Makefile
++	drawfunc/Makefile
++	yaccsrc/Makefile
++	curve/Makefile
++	mt/Makefile
++	draw/Makefile
++	misc/Makefile
++	debug/Makefile
++	gtkgui/Makefile
++	dither/Makefile
++	docs/Makefile
++	])
++AC_OUTPUT
+--- a/drawfunc/MultiVariatePolynom.cc
++++ b/drawfunc/MultiVariatePolynom.cc
+@@ -696,12 +696,12 @@
+ // ------------ declare templates -- at end for gcc 2.6.3 ---------------------
+ // ----------------------------------------------------------------------------
+ 
+-#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
++#ifdef HAVE_INSTANTIATIONS
+ template class MultiPoly<MonomXY>;
+ template class MultiPoly<MonomXYZ>;
+ template class Monom<2>;
+ template class Monom<3>;
+-#endif
++#endif // HAVE_INSTANTIATIONS
+ 
+ // ----------------------------------------------------------------------------
+ // ------------- end of file MultiVariatePolynom.cc ---------------------------
+--- a/acinclude.m4
++++ /dev/null
+@@ -1,219 +0,0 @@
+-dnl Some of this code is:
+-dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf at amath.washington.edu>
+-dnl it is taken from the autotools distribution...
+-
+-# --------------------------------------------------------------------------
+-# Check whether the C++ compiler accepts a certain flag
+-# If it does it adds the flag to CXXFLAGS
+-# If it does not then it returns an error to lf_ok
+-# Usage:
+-#   LF_CHECK_CXX_FLAG(-flag1 -flag2 -flag3 ...)
+-# -------------------------------------------------------------------------
+-
+-AC_DEFUN(LF_CHECK_CXX_FLAG,[
+-  echo 'void f(){}' > conftest.cc
+-  for i in $1
+-  do
+-    AC_MSG_CHECKING([whether $CXX accepts $i])
+-    if test -z "`${CXX} $i -c conftest.cc 2>&1`"
+-    then
+-      CXXFLAGS="${CXXFLAGS} $i"
+-      AC_MSG_RESULT(yes)
+-    else
+-      AC_MSG_RESULT(no)
+-    fi
+-  done
+-  rm -f conftest.cc conftest.o
+-])
+-
+-# --------------------------------------------------------------------------
+-# Check whether the C compiler accepts a certain flag
+-# If it does it adds the flag to CFLAGS
+-# If it does not then it returns an error to lf_ok
+-# Usage:
+-#  LF_CHECK_CC_FLAG(-flag1 -flag2 -flag3 ...)
+-# -------------------------------------------------------------------------
+-
+-AC_DEFUN(LF_CHECK_CC_FLAG,[
+-  echo 'void f(){}' > conftest.c
+-  for i in $1
+-  do
+-    AC_MSG_CHECKING([whether $CC accepts $i])
+-    if test -z "`${CC} $i -c conftest.c 2>&1`"
+-    then
+-      CFLAGS="${CFLAGS} $i"
+-      AC_MSG_RESULT(yes)
+-    else
+-      AC_MSG_RESULT(no)
+-    fi
+-  done
+-  rm -f conftest.c conftest.o
+-])
+-
+-
+-AC_DEFUN(RS_CHECK_HAVE_BOOL,[
+-	AC_CACHE_CHECK(whether $CXX supports bool, rs_cv_have_bool, [
+-		AC_LANG_SAVE
+-		AC_LANG_CPLUSPLUS
+-		AC_TRY_COMPILE(,[bool a=false; bool b=true; return 0;],
+-		rs_cv_have_bool="yes",	
+-		rs_cv_have_bool="no")
+-		
+-		AC_LANG_RESTORE
+-	])
+-])
+-
+-AC_DEFUN([RS_CHECK_PTHREADS],
+-[
+-AC_CACHE_CHECK(if compilation of multithreaded programs works, rs_cv_have_pthread, 
+-[
+-	AC_TRY_LINK(,pthread_create();, rs_cv_have_pthread="yes", rs_cv_have_pthread="no")
+-])
+-
+-if test "$rs_cv_have_pthread" = "no"
+-then
+-	AC_MSG_ERROR("You need an implementation of posix threads \(did you give me the necessary flags to compile multithreaded programs ?\)")
+-fi
+-])
+-
+-
+-
+-AC_DEFUN([RS_CHECK_POW],
+-[
+-	AC_MSG_CHECKING(if pow(0,0)!=1)
+-	AC_TRY_RUN(
+-		[#include <math.h>
+-		int main() { if (pow(0.0,0.0)==1.0) return 0; else return 10;}],
+-                POW_IS_BROKEN=no, POW_IS_BROKEN=yes, POW_IS_BROKEN=yes)
+-	AC_MSG_RESULT([$POW_IS_BROKEN])
+-	test "$POW_IS_BROKEN" = "yes" &&
+-		AC_DEFINE(POW_IS_BROKEN)
+-])
+-
+-AC_DEFUN([RS_CHECK_LIB], 
+-[
+-	AC_CHECK_LIB($1, main,, AC_MSG_ERROR([Sorry: can't link with library lib$1.\(a\|so\).]))
+-])
+-
+-AC_DEFUN([RS_CHECK_HEADER],
+-[
+-	AC_CHECK_HEADER($1,, AC_MSG_ERROR([Sorry: can't find header file $1]))
+-])
+-
+-
+-dnl Use AC_VERBOSE w/o the warnings
+-dnl
+-AC_DEFUN([CF_VERBOSE],
+-[test -n "$verbose" && echo "   $1" 1>&AC_FD_MSG
+-])dnl
+-
+-
+-
+-
+-dnl Autoconf support for C++
+-dnl Copyright (C) 1988 Eleftherios Gkioulekas <lf at amath.washington.edu>
+-dnl  
+-dnl This program is free software; you can redistribute it and/or modify
+-dnl it under the terms of the GNU General Public License as published by
+-dnl the Free Software Foundation; either version 2 of the License, or
+-dnl (at your option) any later version.
+-dnl 
+-dnl This program is distributed in the hope that it will be useful,
+-dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-dnl GNU General Public License for more details.
+-dnl 
+-dnl You should have received a copy of the GNU General Public License
+-dnl along with this program; if not, write to the Free Software 
+-dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+-dnl 
+-dnl As a special exception to the GNU General Public License, if you 
+-dnl distribute this file as part of a program that contains a configuration 
+-dnl script generated by Autoconf, you may include it under the same 
+-dnl distribution terms that you use for the rest of that program.
+-
+-# -----------------------------------------------------------------------
+-# This macro determines hardware-vendor-os information and 
+-# sets the variable ``canonical_host_type'' to that information
+-# ------------------------------------------------------------------------
+-
+-dnl ACCONFIG TEMPLATE
+-dnl #undef YOUR_OS
+-dnl END ACCONFIG
+-
+-AC_DEFUN(LF_HOST_TYPE, [
+-  AC_CANONICAL_HOST
+-  if test -z "$host"
+-  then
+-    host=unknown
+-  fi
+-  canonical_host_type=$host
+-  if test "$host" = unknown
+-  then
+-    AC_MSG_WARN(configuring for unknown system type)
+-  fi
+-  AC_SUBST(canonical_host_type)
+-  AC_DEFINE_UNQUOTED(YOUR_OS,"$canonical_host_type")
+-])
+-
+-
+-dnl this is from:
+-dnl To: autoconf-collection at peti.gmd.de 
+-dnl Subject: ice_cxx_explicit_template_instantiation.m4 
+-dnl From: Andreas Zeller <zeller at ips.cs.tu-bs.de> 
+-dnl Date: Sat, 29 Nov 1997 17:13:23 +0100 (MET) 
+-dnl Sender: autoconf-collection-owner at peti.gmd.de 
+-
+-dnl ICE_CXX_EXPLICIT_TEMPLATE_INSTANTIATION
+-dnl ---------------------------------------
+-dnl
+-dnl If the C++ compiler supports explicit template instantiation,
+-dnl define `HAVE_EXPLICIT_TEMPLATE_INSTANTIATION'.
+-dnl
+-AC_DEFUN(ICE_CXX_EXPLICIT_TEMPLATE_INSTANTIATION,
+-[
+-AC_REQUIRE([AC_PROG_CXX])
+-AC_MSG_CHECKING(whether ${CXX} supports explicit template instantiation)
+-AC_CACHE_VAL(ice_cv_have_explicit_template_instantiation,
+-[
+-AC_LANG_SAVE
+-AC_LANG_CPLUSPLUS
+-AC_TRY_COMPILE([
+-template <class T> class Pointer { public: T *value; };
+-template class Pointer<char>;
+-], [/* empty */],
+-ice_cv_have_explicit_template_instantiation=yes,
+-ice_cv_have_explicit_template_instantiation=no)
+-AC_LANG_RESTORE
+-])
+-AC_MSG_RESULT($ice_cv_have_explicit_template_instantiation)
+-if test "$ice_cv_have_explicit_template_instantiation" = yes; then
+-AC_DEFINE(HAVE_EXPLICIT_TEMPLATE_INSTANTIATION)
+-fi
+-])dnl
+-
+-dnl @synopsis AC_CXX_FUNCTION_NONTYPE_PARAMETERS
+-dnl
+-dnl If the compiler supports function templates with non-type parameters,
+-dnl define HAVE_FUNCTION_NONTYPE_PARAMETERS.
+-dnl
+-dnl @version $Id: /surf-1/acinclude.m4 22703 2006-03-04T21:20:19.270670Z ralf  $
+-dnl @author Luc Maisonobe
+-dnl
+-AC_DEFUN(AC_CXX_FUNCTION_NONTYPE_PARAMETERS,
+-[AC_CACHE_CHECK(whether the compiler supports function templates with non-type parameters,
+-ac_cv_cxx_function_nontype_parameters,
+-[AC_LANG_SAVE
+- AC_LANG_CPLUSPLUS
+- AC_TRY_COMPILE([
+-template<class T, int N> class A {};
+-template<class T, int N> int f(const A<T,N>& x) { return 0; }
+-],[A<double, 17> z; return f(z);],
+- ac_cv_cxx_function_nontype_parameters=yes, ac_cv_cxx_function_nontype_parameters=no)
+- AC_LANG_RESTORE
+-])
+-dnl if test "$ac_cv_cxx_function_nontype_parameters" = yes; then
+-dnl  AC_DEFINE(HAVE_FUNCTION_NONTYPE_PARAMETERS,,
+-dnl             [define if the compiler supports function templates with non-type parameters])
+-dnl fi
+-])
+--- /dev/null
++++ b/m4/adhoc_gmp.m4
+@@ -0,0 +1,333 @@
++# adhoc_gmp.m4 serial 1
++dnl m4/adhoc_gmp.m4 -- M4 macro processor include script
++dnl
++dnl Copyright (C) 2015 Jerome Benoit <jgmbenoit at rezozer.net>
++dnl
++dnl Based on macros by Owen Taylor, modified by:
++dnl Hans Petter Jansson, 2001-04-09;
++dnl Allin Cottrell, April 2003;
++dnl and certainly others.
++dnl
++dnl Copying and distribution of this file, with or without modification, are
++dnl permitted in any medium without royalty provided the copyright notice and
++dnl this notice are preserved. This file is offered as-is, without any warranty.
++dnl
++dnl
++dnl NOTE:
++dnl  m4/adhoc_gmp.m4 is a digest version of m4/mpria_ax_prog_path_gmp_cc.m4
++dnl  written and copyrighted by the same author Jerome Benoit for the
++dnl  GNU MPRIA project <http://www.gnu.org/software/mpria/>.
++dnl
++
++dnl _adhoc_AC_PROG_PATH_GMP_CC_ARG_WITH
++AC_DEFUN_ONCE([_adhoc_AC_PROG_PATH_GMP_CC_ARG_WITH],[dnl
++AC_ARG_WITH([gmp-prefix],
++	[AS_HELP_STRING([--with-gmp-prefix=PREFIX],
++		[specify prefix for the installed GMP [standard search prefixes]])],
++	[gmp_config_prefix="$withval"],[gmp_config_prefix=""])
++AC_ARG_WITH([gmp-include],
++	[AS_HELP_STRING([--with-gmp-include=PATH],
++		[specify directory for the installed GMP header file [standard search paths]])],
++	[gmp_config_include_prefix="$withval"],[gmp_config_include_prefix=""])
++AC_ARG_WITH([gmp-lib],
++	[AS_HELP_STRING([--with-gmp-lib=PATH],
++		[specify directory for the installed GMP library [standard search paths]])],
++	[gmp_config_lib_prefix="$withval"],[gmp_config_lib_prefix=""])
++
++	if test "x$gmp_config_include_prefix" = "x" ; then
++		if test "x$gmp_config_prefix" != "x" ; then
++			gmp_config_include_prefix="$gmp_config_prefix/include"
++		fi
++	fi
++	if test "x$gmp_config_lib_prefix" = "x" ; then
++		if test "x$gmp_config_prefix" != "x" ; then
++			gmp_config_lib_prefix="$gmp_config_prefix/lib"
++		fi
++	fi
++
++	GMP_CPPFLAGS=
++	if test "x$gmp_config_include_prefix" != "x" ; then
++		GMP_CPPFLAGS="-I$gmp_config_include_prefix"
++	fi
++
++	GMP_LDFLAGS=
++	if test "x$gmp_config_lib_prefix" != "x" ; then
++		GMP_LDFLAGS="-L$gmp_config_lib_prefix"
++	fi
++
++AC_SUBST(GMP_CPPFLAGS)
++AC_SUBST(GMP_LDFLAGS)
++])
++
++dnl adhoc_AM_PATH_GMP([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
++AC_DEFUN([adhoc_AM_PATH_GMP],[dnl
++AC_REQUIRE([AC_PROG_SED])dnl
++AC_REQUIRE([_adhoc_AC_PROG_PATH_GMP_CC_ARG_WITH])dnl
++
++	min_gmp_version=m4_default([$1],[4.1.0])
++	min_gmp_version_0_0_0="$min_gmp_version.0.0.0"
++
++	min_gmp_version_major=`echo $min_gmp_version_0_0_0 | \
++		$SED 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\1/'`
++	min_gmp_version_minor=`echo $min_gmp_version_0_0_0 | \
++		$SED 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'`
++	min_gmp_version_micro=`echo $min_gmp_version_0_0_0 | \
++		$SED 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\3/'`
++
++	min_gmp_dotted_version="$min_gmp_version_major.$min_gmp_version_minor.$min_gmp_version_micro"
++
++	GMP_LIBS="-lgmp"
++
++	AC_MSG_CHECKING([for GMP - version >= $min_gmp_version ])
++
++	ac_save_CPPFLAGS="$CPPFLAGS"
++	ac_save_CFLAGS="$CFLAGS"
++	ac_save_LDFLAGS="$LDFLAGS"
++	ac_save_LIBS="$LIBS"
++
++	CPPFLAGS="$CPPFLAGS $GMP_CPPFLAGS"
++	CFLAGS="$CFLAGS $GMP_CFLAGS"
++	LDFLAGS="$LDFLAGS $GMP_LDFLAGS"
++	LIBS="$LIBS $GMP_LIBS"
++
++	if test "x$gmp_hdr_version_major" != "x" ; then
++		gmp_comment_flag=1
++	else
++		gmp_comment_flag=0
++	fi
++	rm -f conf.gmptest
++	AC_RUN_IFELSE([AC_LANG_SOURCE(
++[[
++#include <gmp.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++#define PRINTF_MSG_ERROR_MISMATCH_HEADER \
++	printf("*** This likely indicates either a bad configuration or some other\n"); \
++	printf("*** inconsistency in the development environment. If the GNU MP header\n"); \
++	printf("*** is searched in different include paths, it may be sufficient either\n"); \
++	printf("*** to set a proper include path through the --with-gmp-include configure\n"); \
++	printf("*** option, or to specify a pertinent C preprocessor via the GMP_GPP or\n"); \
++	printf("*** CPP influential environment variables.\n"); \
++	printf("***\n"); \
++	printf("*** If an old version is installed, it may be best to remove it and to\n"); \
++	printf("*** reinstall a more recent one; although removing and then reinstalling\n"); \
++	printf("*** from scratch the GNU MP library may also get things to work. The latest\n"); \
++	printf("*** version of GNU MP is always available from http://gmplib.org/.\n"); \
++	printf("***\n");
++
++#define PRINTF_MSG_ERROR_MISMATCH_HEADER_LIBRARY \
++	printf("*** This likely indicates either a bad configuration or some\n"); \
++	printf("*** other inconsistency in the development environment. If the\n"); \
++	printf("*** expected GNU MP library cannot be found, it may be sufficient\n"); \
++	printf("*** either to set properly the LD_LIBRARY_PATH environment variable\n"); \
++	printf("*** or to configure ldconfig(8) to consider the installed location.\n"); \
++	printf("*** Otherwise a bad configuration or an inconsistency in the\n"); \
++	printf("*** include/library search paths may be investigated; adjustments\n"); \
++	printf("*** through the use of --with-gmp-(include|lib) configure option\n"); \
++	printf("*** may help.\n"); \
++	printf("***\n"); \
++	printf("*** If an old version is installed, it may be best to remove it and to\n"); \
++	printf("*** reinstall a more recent one; although modifying LD_LIBRARY_PATH\n"); \
++	printf("*** may also get things to work. The latest version of GNU MP is always\n"); \
++	printf("*** available from http://gmplib.org/.\n"); \
++	printf("***\n");
++
++int main ()
++{
++	int gmp_hdr_version_major = 0;
++	int gmp_hdr_version_minor = 0;
++	int gmp_hdr_version_micro = 0;
++	int gmp_lib_version_major = 0;
++	int gmp_lib_version_minor = 0;
++	int gmp_lib_version_micro = 0;
++	char *tmp_version_0;
++	char *tmp_version_1;
++	mpz_t a;
++	mpz_t b;
++	mpz_t c;
++
++	mpz_init (a);
++	mpz_init (b);
++	mpz_init (c);
++	mpz_mul (c, a, b);
++
++	fclose (fopen ("conf.gmptest", "w"));
++
++#ifdef __GMP_CC
++#define GMPM4_CC __GMP_CC
++#else
++#define GMPM4_CC ""
++#endif
++
++#ifdef __GMP_CFLAGS
++#define GMPM4_CFLAGS __GMP_CFLAGS
++#else
++#define GMPM4_CFLAGS ""
++#endif
++
++#ifdef __GNU_MP_VERSION
++	gmp_hdr_version_major = __GNU_MP_VERSION;
++#endif
++
++#ifdef __GNU_MP_VERSION_MINOR
++	gmp_hdr_version_minor = __GNU_MP_VERSION_MINOR;
++#endif
++
++#ifdef __GNU_MP_VERSION_PATCHLEVEL
++	gmp_hdr_version_micro = __GNU_MP_VERSION_PATCHLEVEL;
++#endif
++
++	/* HP/UX 9 (%@#!) writes to sscanf strings */
++	tmp_version_0 = strdup(gmp_version);
++	tmp_version_1 = strdup(gmp_version);
++	if (sscanf(tmp_version_0, "%d.%d.%d",
++			&gmp_lib_version_major, &gmp_lib_version_minor, &gmp_lib_version_micro) != 3) {
++		gmp_lib_version_micro = 0;
++		if (sscanf(tmp_version_1, "%d.%d",
++				&gmp_lib_version_major, &gmp_lib_version_minor) != 2) {
++			printf("\n***\n");
++			printf("*** unexpected GMP library version string\n");
++			printf("***\n");
++			exit(1);
++			}
++	}
++
++#if $gmp_comment_flag
++	if (
++			($gmp_hdr_version_major != gmp_hdr_version_major) ||
++			($gmp_hdr_version_minor != gmp_hdr_version_minor) ||
++			($gmp_hdr_version_micro != gmp_hdr_version_micro)
++		) {
++		printf("\n***\n");
++		printf("*** The preprocessed GNU MP header version numbers ($gmp_hdr_dotted_version) and\n");
++		printf("*** the compiled GNU MP header version numbers (%d.%d.%d)\n",
++			gmp_hdr_version_major, gmp_hdr_version_minor, gmp_hdr_version_micro);
++		printf("*** do not match.\n");
++		printf("***\n");
++		PRINTF_MSG_ERROR_MISMATCH_HEADER
++		}
++	else if (strcmp("$GMP_CC",GMPM4_CC)) {
++		printf("\n***\n");
++		printf("*** The preprocessed GNU MP header __GMP_CC macro value (\"$GMP_CC\") and\n");
++		printf("*** the compiled GNU MP header __GMP_CC macro value (\"" GMPM4_CC "\")\n");
++		printf("*** do not match.\n");
++		printf("***\n");
++		PRINTF_MSG_ERROR_MISMATCH_HEADER
++		}
++	else if (strcmp("$GMP_CFLAGS",GMPM4_CFLAGS)) {
++		printf("\n***\n");
++		printf("*** The preprocessed GNU MP header __GMP_CFLAGS macro value (\"$GMP_CFLAGS\") and\n");
++		printf("*** the compiled GNU MP header __GMP_CFLAGS macro value (\"" GMPM4_CFLAGS "\")\n");
++		printf("*** do not match.\n");
++		printf("***\n");
++		PRINTF_MSG_ERROR_MISMATCH_HEADER
++		}
++	else
++#endif
++	if (
++			(gmp_lib_version_major != gmp_hdr_version_major) ||
++			(gmp_lib_version_minor != gmp_hdr_version_minor) ||
++			(gmp_lib_version_micro != gmp_hdr_version_micro)
++		) {
++		printf("\n***\n");
++		printf("*** GNU MP header version numbers (%d.%d.%d) and\n",
++			gmp_hdr_version_major, gmp_hdr_version_minor, gmp_hdr_version_micro);
++		printf("*** GNU MP library version numbers (%d.%d.%d)\n",
++			gmp_lib_version_major, gmp_lib_version_minor, gmp_lib_version_micro);
++		printf("*** do not match.\n");
++		printf("***\n");
++		PRINTF_MSG_ERROR_MISMATCH_HEADER_LIBRARY
++		}
++	else if (
++			($min_gmp_version_major < gmp_hdr_version_major) ||
++			(
++				($min_gmp_version_major == gmp_hdr_version_major) &&
++				($min_gmp_version_minor < gmp_hdr_version_minor)
++				) ||
++			(
++				($min_gmp_version_major == gmp_hdr_version_major) &&
++				($min_gmp_version_minor == gmp_hdr_version_minor) &&
++				($min_gmp_version_micro <= gmp_hdr_version_micro)
++				)
++		) {
++		return (0);
++		}
++	else {
++		printf("\n***\n");
++		printf("*** GNU MP version $min_gmp_dotted_version or higher is required:\n");
++		printf("*** an older version of GNU MP (%d.%d.%d) was found.\n",
++			gmp_hdr_version_major, gmp_hdr_version_minor, gmp_hdr_version_micro);
++		printf("*** The latest version of GNU MP is always available from http://gmplib.org/.\n");
++		printf("***\n");
++		}
++
++	return (1);
++}
++]]
++)],[],[no_gmp=yes],[AC_MSG_WARN([$ac_n "cross compiling; assumed OK... $ac_c])])
++
++	CPPFLAGS="$ac_save_CPPFLAGS"
++	CFLAGS="$ac_save_CFLAGS"
++	LDFLAGS="$ac_save_LDFLAGS"
++	LIBS="$ac_save_LIBS"
++
++	if test "x$no_gmp" = "x" ; then
++		AC_MSG_RESULT([yes])
++		$2
++	else
++		AC_MSG_RESULT([no])
++		if test -f conf.gmptest ; then
++			:
++		else
++			echo "***"
++			echo "*** Could not run GNU MP test program, checking why..."
++			CPPFLAGS="$CPPFLAGS $GMP_CPPFLAGS"
++			CFLAGS="$CFLAGS $GMP_CFLAGS"
++			LDFLAGS="$CFLAGS $GMP_LDFLAGS"
++			LIBS="$LIBS $GMP_LIBS"
++			AC_LINK_IFELSE([AC_LANG_PROGRAM(
++[[
++#include <gmp.h>
++#include <stdio.h>
++]],
++[[ return (1); ]]
++)],
++[
++echo "***"
++echo "*** The test program compiled, but did not run. This usually means"
++echo "*** that the run-time linker is not finding GNU MP or finding the wrong"
++echo "*** version of GNU MP. If it is not finding GNU MP, you'll need to set your"
++echo "*** LD_LIBRARY_PATH environment variable, or configure ldconfig(8) to consider"
++echo "*** the installed location."
++echo "***"
++echo "*** If you have an old version installed, it is best to remove it; although"
++echo "*** modifying LD_LIBRARY_PATH may also get things to work. The latest version"
++echo "*** of GNU MP is always available from http://gmplib.org/."
++echo "***"
++],
++[
++echo "***"
++echo "*** The test program failed to compile or link. See the file config.log for the"
++echo "*** exact error that occured. This usually means GNU MP was incorrectly installed"
++echo "*** or that you have moved GNU MP since it was installed."
++echo "***"
++])
++			CPPFLAGS="$ac_save_CPPFLAGS"
++			CFLAGS="$ac_save_CFLAGS"
++			LDFLAGS="$ac_save_LDFLAGS"
++			LIBS="$ac_save_LIBS"
++		fi
++		rm -f conf.gmptest
++		m4_default([$3],[AC_MSG_ERROR([no suitable GNU MP library found])])
++	fi
++	rm -f conf.gmptest
++
++AC_SUBST(GMP_LIBS)
++])
++
++dnl alias
++AU_ALIAS([AM_PATH_GMP],[adhoc_AM_PATH_GMP])
++
++dnl eof
+--- a/gtkgui/Makefile.am
++++ b/gtkgui/Makefile.am
+@@ -1,61 +1,45 @@
+-include $(top_srcdir)/Makefile.global
+ 
+-CPPFLAGS = @CPPFLAGS@ @GTK_CFLAGS@
+-noinst_LIBRARIES = libdummy.a
++noinst_LIBRARIES = libsurf_gtkgui.a
+ 
+-if CUPS
+-libdummy_a_SOURCES = mycolor.cc mycolor.h			\
+-	MainWindowController.cc MainWindowController.h		\
+-	TextWidget.cc TextWidget.h				\
+-	start.cc						\
+-	mygtk.cc mygtk.h					\
+-	showAbout.cc showAbout.h				\
+-	ProgressDialog.cc ProgressDialog.h			\
+-	ColorWindow.cc ColorWindow.h				\
+-	DrawingArea.cc DrawingArea.h				\
+-	PositionWindow.cc PositionWindow.h			\
+-	ConfigurationWindow.cc ConfigurationWindow.h		\
+-	NumericWindow.cc NumericWindow.h			\
+-	ParameterWindow.h					\
+-	ColorSelectionButton.cc ColorSelectionButton.h		\
+-	IlluminationWindow.cc IlluminationWindow.h		\
+-	Requester.cc Requester.h				\
+-	DisplayWindow.cc DisplayWindow.h			\
+-	WidgetReadWriter.cc WidgetReadWriter.h			\
+-	DitherWindow.cc DitherWindow.h				\
+-	ClipWindow.cc ClipWindow.h				\
+-	Document.cc Document.h					\
+-	TableBuilder.h RadioButtonBuilder.h			\
+-	RGBToStandard.cc RGBToStandard.h			\
+-	SaveImageDialog.cc SaveImageDialog.h			\
+-	PrintImageDialog.cc PrintImageDialog.h			\
+-	OptionMenuBuilder.h
+-else
+-libdummy_a_SOURCES = mycolor.cc mycolor.h			\
+-	MainWindowController.cc MainWindowController.h		\
+-	TextWidget.cc TextWidget.h				\
+-	start.cc						\
+-	mygtk.cc mygtk.h					\
+-	showAbout.cc showAbout.h				\
+-	ProgressDialog.cc ProgressDialog.h			\
+-	ColorWindow.cc ColorWindow.h				\
+-	DrawingArea.cc DrawingArea.h				\
+-	PositionWindow.cc PositionWindow.h			\
+-	ConfigurationWindow.cc ConfigurationWindow.h		\
+-	NumericWindow.cc NumericWindow.h			\
+-	ParameterWindow.h					\
+-	ColorSelectionButton.cc ColorSelectionButton.h		\
+-	IlluminationWindow.cc IlluminationWindow.h		\
+-	Requester.cc Requester.h				\
+-	DisplayWindow.cc DisplayWindow.h			\
+-	WidgetReadWriter.cc WidgetReadWriter.h			\
+-	DitherWindow.cc DitherWindow.h				\
+-	ClipWindow.cc ClipWindow.h				\
+-	Document.cc Document.h					\
+-	TableBuilder.h RadioButtonBuilder.h			\
+-	RGBToStandard.cc RGBToStandard.h			\
+-	SaveImageDialog.cc SaveImageDialog.h			\
++libsurf_gtkgui_a_SOURCES = \
++	mycolor.cc mycolor.h \
++	MainWindowController.cc MainWindowController.h \
++	TextWidget.cc TextWidget.h \
++	start.cc \
++	mygtk.cc mygtk.h \
++	showAbout.cc showAbout.h \
++	ProgressDialog.cc ProgressDialog.h \
++	ColorWindow.cc ColorWindow.h \
++	DrawingArea.cc DrawingArea.h \
++	PositionWindow.cc PositionWindow.h \
++	ConfigurationWindow.cc ConfigurationWindow.h \
++	NumericWindow.cc NumericWindow.h \
++	ParameterWindow.h \
++	ColorSelectionButton.cc ColorSelectionButton.h \
++	IlluminationWindow.cc IlluminationWindow.h \
++	Requester.cc Requester.h \
++	DisplayWindow.cc DisplayWindow.h \
++	WidgetReadWriter.cc WidgetReadWriter.h \
++	DitherWindow.cc DitherWindow.h \
++	ClipWindow.cc ClipWindow.h \
++	Document.cc Document.h \
++	TableBuilder.h RadioButtonBuilder.h \
++	RGBToStandard.cc RGBToStandard.h \
++	SaveImageDialog.cc SaveImageDialog.h \
+ 	OptionMenuBuilder.h
++
++if CUPS
++libsurf_gtkgui_a_SOURCES += \
++	PrintImageDialog.cc PrintImageDialog.h
+ endif
+ 
+-libdummy.a:: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES)
++libsurf_gtkgui_a_CPPFLAGS = \
++	-I$(top_srcdir)/src \
++	-I$(top_srcdir)/curve \
++	-I$(top_srcdir)/yaccsrc \
++	-I$(top_builddir)/yaccsrc \
++	-I$(top_srcdir)/mt \
++	-I$(top_srcdir)/misc \
++	-I$(top_srcdir)/debug \
++	$(GTK_CFLAGS) \
++	-DDATADIR=\\\"$(datadir)\\\"
+--- a/Makefile.global
++++ /dev/null
+@@ -1,5 +0,0 @@
+-if GUI
+-INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/drawfunc -I$(top_srcdir)/yaccsrc -I$(top_srcdir)/image-formats -I$(top_srcdir)/curve -I$(top_srcdir)/gtkgui -I$(top_srcdir)/mt -I$(top_srcdir)/draw -I$(top_srcdir)/misc -I$(top_srcdir)/debug -I$(top_srcdir)/xpm -I$(top_srcdir)/dither
+-else
+-INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/drawfunc -I$(top_srcdir)/yaccsrc -I$(top_srcdir)/image-formats -I$(top_srcdir)/curve -I$(top_srcdir)/mt -I$(top_srcdir)/draw -I$(top_srcdir)/misc -I$(top_srcdir)/debug -I$(top_srcdir)/xpm -I$(top_srcdir)/dither
+-endif
+--- a/gtkgui/showAbout.cc
++++ b/gtkgui/showAbout.cc
+@@ -30,6 +30,11 @@
+ 
+ #include "showAbout.h"
+ #include "welcomeMessage.h"
++
++#ifndef DATADIR
++#define DATADIR "/usr/share"
++#endif
++
+ using namespace std;
+ 
+ static GtkWidget *about=0;
+--- /dev/null
++++ b/m4/gtk.m4
+@@ -0,0 +1,194 @@
++# Configure paths for GTK+
++# Owen Taylor     97-11-3
++
++dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
++dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
++dnl
++AC_DEFUN([AM_PATH_GTK],
++[dnl
++dnl Get the cflags and libraries from the gtk-config script
++dnl
++AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
++            gtk_config_prefix="$withval", gtk_config_prefix="")
++AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
++            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
++AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
++		    , enable_gtktest=yes)
++
++  for module in . $4
++  do
++      case "$module" in
++         gthread)
++             gtk_config_args="$gtk_config_args gthread"
++         ;;
++      esac
++  done
++
++  if test x$gtk_config_exec_prefix != x ; then
++     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
++     if test x${GTK_CONFIG+set} != xset ; then
++        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
++     fi
++  fi
++  if test x$gtk_config_prefix != x ; then
++     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
++     if test x${GTK_CONFIG+set} != xset ; then
++        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
++     fi
++  fi
++
++  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
++  min_gtk_version=ifelse([$1], ,0.99.7,$1)
++  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
++  no_gtk=""
++  if test "$GTK_CONFIG" = "no" ; then
++    no_gtk=yes
++  else
++    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
++    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
++    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
++           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
++    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
++           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
++    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
++           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
++    if test "x$enable_gtktest" = "xyes" ; then
++      ac_save_CFLAGS="$CFLAGS"
++      ac_save_LIBS="$LIBS"
++      CFLAGS="$CFLAGS $GTK_CFLAGS"
++      LIBS="$GTK_LIBS $LIBS"
++dnl
++dnl Now check if the installed GTK is sufficiently new. (Also sanity
++dnl checks the results of gtk-config to some extent
++dnl
++      rm -f conf.gtktest
++      AC_TRY_RUN([
++#include <gtk/gtk.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++int
++main ()
++{
++  int major, minor, micro;
++  char *tmp_version;
++
++  system ("touch conf.gtktest");
++
++  /* HP/UX 9 (%@#!) writes to sscanf strings */
++  tmp_version = g_strdup("$min_gtk_version");
++  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
++     printf("%s, bad version string\n", "$min_gtk_version");
++     exit(1);
++   }
++
++  if ((gtk_major_version != $gtk_config_major_version) ||
++      (gtk_minor_version != $gtk_config_minor_version) ||
++      (gtk_micro_version != $gtk_config_micro_version))
++    {
++      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",
++             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
++             gtk_major_version, gtk_minor_version, gtk_micro_version);
++      printf ("*** was found! If gtk-config was correct, then it is best\n");
++      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
++      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
++      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
++      printf("*** required on your system.\n");
++      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
++      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
++      printf("*** before re-running configure\n");
++    }
++#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
++  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
++	   (gtk_minor_version != GTK_MINOR_VERSION) ||
++           (gtk_micro_version != GTK_MICRO_VERSION))
++    {
++      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
++	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
++      printf("*** library (version %d.%d.%d)\n",
++	     gtk_major_version, gtk_minor_version, gtk_micro_version);
++    }
++#endif /* defined (GTK_MAJOR_VERSION) ... */
++  else
++    {
++      if ((gtk_major_version > major) ||
++        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
++        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
++      {
++        return 0;
++       }
++     else
++      {
++        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
++               gtk_major_version, gtk_minor_version, gtk_micro_version);
++        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
++	       major, minor, micro);
++        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
++        printf("***\n");
++        printf("*** If you have already installed a sufficiently new version, this error\n");
++        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
++        printf("*** being found. The easiest way to fix this is to remove the old version\n");
++        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
++        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
++        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
++        printf("*** so that the correct libraries are found at run-time))\n");
++      }
++    }
++  return 1;
++}
++],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
++       CFLAGS="$ac_save_CFLAGS"
++       LIBS="$ac_save_LIBS"
++     fi
++  fi
++  if test "x$no_gtk" = x ; then
++     AC_MSG_RESULT(yes)
++     ifelse([$2], , :, [$2])
++  else
++     AC_MSG_RESULT(no)
++     if test "$GTK_CONFIG" = "no" ; then
++       echo "*** The gtk-config script installed by GTK could not be found"
++       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
++       echo "*** your path, or set the GTK_CONFIG environment variable to the"
++       echo "*** full path to gtk-config."
++     else
++       if test -f conf.gtktest ; then
++        :
++       else
++          echo "*** Could not run GTK test program, checking why..."
++          CFLAGS="$CFLAGS $GTK_CFLAGS"
++          LIBS="$LIBS $GTK_LIBS"
++          AC_TRY_LINK([
++#include <gtk/gtk.h>
++#include <stdio.h>
++],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
++        [ echo "*** The test program compiled, but did not run. This usually means"
++          echo "*** that the run-time linker is not finding GTK or finding the wrong"
++          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
++          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
++          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
++          echo "*** is required on your system"
++	  echo "***"
++          echo "*** If you have an old version installed, it is best to remove it, although"
++          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
++          echo "***"
++          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
++          echo "*** came with the system with the command"
++          echo "***"
++          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
++        [ echo "*** The test program failed to compile or link. See the file config.log for the"
++          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
++          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
++          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
++          CFLAGS="$ac_save_CFLAGS"
++          LIBS="$ac_save_LIBS"
++       fi
++     fi
++     GTK_CFLAGS=""
++     GTK_LIBS=""
++     ifelse([$3], , :, [$3])
++  fi
++  AC_SUBST(GTK_CFLAGS)
++  AC_SUBST(GTK_LIBS)
++  rm -f conf.gtktest
++])
+--- /dev/null
++++ b/docs/Makefile.am
+@@ -0,0 +1,2 @@
++
++EXTRA_DIST = manual.sgml
diff --git a/debian/patches/upstream-clip_to_rectangle.patch b/debian/patches/upstream-clip_to_rectangle.patch
new file mode 100644
index 0000000..af625fb
--- /dev/null
+++ b/debian/patches/upstream-clip_to_rectangle.patch
@@ -0,0 +1,132 @@
+Description: upstream: add clip-to-rectangle option
+ Quickly implement a clip (to rectangle) machinery for allowing third party
+ tiling parallelization. This feature was initially encoded in a modified
+ version of surf for surfer (<http://imaginary.org>) by Henning Meyer
+ <hmeyer at mathematik.uni-kl.de>, it was revisited on behalf of the Debian
+ Science Team and of imaginary.org by Jerome Benoit <calculus at rezozer.net>.
+Origin:
+ imaginary.org
+ debian
+Forwarded: submitted
+Author:
+ Jerome Benoit <calculus at rezozer.net>
+ Henning Meyer <hmeyer at mathematik.uni-kl.de>
+Last-Update: 2015-04-10
+
+--- a/src/Options.h
++++ b/src/Options.h
+@@ -16,6 +16,10 @@
+ 	bool get_verbose() const {  return !quiet; }
+ 	bool get_quiet() const {  return quiet; }
+ 	bool get_auto_extension() const { return auto_extension; }
++	int get_clip_xmin() const { return clip_xmin; }
++	int get_clip_ymin() const { return clip_ymin; }
++	int get_clip_xmax() const { return clip_xmax; }
++	int get_clip_ymax() const { return clip_ymax; }
+ 
+ private:
+ 	int argc;
+@@ -27,6 +31,8 @@
+ 	bool auto_resize;
+ 	bool quiet;
+ 	bool auto_extension;
++	int clip_xmin, clip_ymin;
++	int clip_xmax, clip_ymax;
+ };
+ 
+ extern Options* options;
+--- a/src/Options.cc
++++ b/src/Options.cc
+@@ -68,6 +68,11 @@
+ 		<< "                       disable automatic extension for graphic files (default)" << std::endl
+ 		<< "    --enable-auto-extension" << std::endl
+ 		<< "                       enable automatic extension for graphic files" << std::endl
++#ifdef NO_GUI
++		<< std::endl
++		<< "    --clip-to-rectangle x_min y_min x_max y_max" << std::endl
++		<< "                       clip images to the specified rectangle" << std::endl
++#endif
+ 		<< std::endl
+ 		<< "-v, --verbose          verbose operation, print the executed commands (default)" << std::endl
+ 		<< "-q, --quiet, --silent  quiet operation, do not print the executed commands" << std::endl
+@@ -94,9 +99,12 @@
+ 	  progress_dialog(false),
+ 		auto_resize(false),
+ 		quiet(false),
+-		auto_extension(false)
++		auto_extension(false),
++		clip_xmin(INT_MIN),clip_ymin(INT_MIN),
++		clip_xmax(INT_MIN),clip_ymax(INT_MIN)
+ {
+ 		int i;
++		int dum;
+ 		for(i = 1; i < argc; ++i) {
+ 			if(argv[i][0] != '-') {
+ 				break;
+@@ -124,6 +132,13 @@
+ 				auto_extension = true;
+ 			} else if(strcmp(argv[i], "--disable-auto-extension") == 0) {
+ 				auto_extension = false;
++			} else if(strcmp(argv[i], "--clip-to-rectangle") == 0) {
++				clip_xmin = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
++				clip_ymin = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
++				clip_xmax = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
++				clip_ymax = (int)(strtol(argv[++i],NULL,10)); ++fileopts;
++				if(clip_xmax < clip_xmin) { dum=clip_xmin; clip_xmin=clip_xmax; clip_xmax=dum; }
++				if(clip_ymax < clip_ymin) { dum=clip_ymin; clip_ymin=clip_ymax; clip_ymax=dum; }
+ 			} else if(strcmp(argv[i], "--progress-dialog") == 0) {
+ #ifdef NO_GUI
+ #else
+--- a/yaccsrc/Script.cc
++++ b/yaccsrc/Script.cc
+@@ -375,6 +375,8 @@
+ 
+ void Script::drawSurface()
+ {
++	int xmin, ymin;
++	int xmax, ymax;
+ 	checkVariables();
+ 	setSize();
+ 	BEGIN("Script::drawSurface");
+@@ -386,6 +388,23 @@
+ 		getDisplay()->setSize (main_width_data, main_height_data);
+ 	}
+ 
++	if(options->get_no_gui()) {
++		int clip_xmin = options->get_clip_xmin();
++		int clip_ymin = options->get_clip_ymin();
++		int clip_xmax = options->get_clip_xmax();
++		int clip_ymax = options->get_clip_ymax();
++		xmin = ((clip_xmin<0)? 0 : min(clip_xmin, main_width_data));
++		ymin = ((clip_ymin<0)? 0 : min(clip_ymin, main_height_data));
++		xmax = ((clip_xmax<0)? 0 : min(clip_xmax, main_width_data));
++		ymax = ((clip_ymax<0)? 0 : min(clip_ymax, main_height_data));
++	}
++	else {
++		xmin = 0;
++		ymin = 0;
++		xmax = main_width_data;
++		ymax = main_height_data;
++	}
++
+ 	Y_AXIS_LR_ROTATE = 0.0;
+ 	SurfaceCalc sc;
+ 	sc.setDisplay (getDisplay());
+@@ -394,7 +413,7 @@
+ 	getBuffer()->clearTags();
+ 
+ 	*getZBuffer() = -10.0;
+-	sc.surface_calculate(0, 0, main_width_data, main_height_data, *getBuffer());
++	sc.surface_calculate(xmin, ymin, xmax, ymax, *getBuffer());
+ 
+ 
+ 	if( display_numeric.stereo_eye ) {
+@@ -421,7 +440,7 @@
+ 		SurfaceCalc sc;
+ 		sc.setDisplay (getDisplay());
+ 		sc.setPreview (getPreview());
+-		sc.surface_calculate(0, 0, main_width_data, main_height_data,*getBuffer());
++		sc.surface_calculate(xmin, ymin, xmax, ymax,*getBuffer());
+ 
+ 		intensity->StereoRight( display_numeric.stereo_red,display_numeric.stereo_green,
+                                         display_numeric.stereo_blue,dist,back );
diff --git a/debian/patches/upstream-flex-update.patch b/debian/patches/upstream-flex-update.patch
new file mode 100644
index 0000000..cc68e8e
--- /dev/null
+++ b/debian/patches/upstream-flex-update.patch
@@ -0,0 +1,16 @@
+Description: upstream flex machinery: update
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/yaccsrc/polylexyacc.h
++++ b/yaccsrc/polylexyacc.h
+@@ -104,7 +104,6 @@
+ /*  Global data                                                              */
+ /* ------------------------------------------------------------------------- */
+ 
+-extern  int     yyleng;
+ extern int error_begin_char;
+ extern  long    int     char_number;
+ extern  long    int     line_number;
diff --git a/debian/patches/upstream-help2man-automatic_extension.patch b/debian/patches/upstream-help2man-automatic_extension.patch
new file mode 100644
index 0000000..f545ca1
--- /dev/null
+++ b/debian/patches/upstream-help2man-automatic_extension.patch
@@ -0,0 +1,30 @@
+Description: upstream: automatic extension machinery description
+ Add a subsection within the Description section for the automatic
+ extension machinery; this patch is the [help2]man(1) complementary
+ part of the previous patch that attents to improve the automatic
+ extension machinery.
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/man/surf.h2m
++++ b/man/surf.h2m
+@@ -19,6 +19,17 @@
+ image processing algorithms need a copy of the image, you need at least
+ width*height*12 bytes of virtual memory.
+ 
++A relevant extension to the image output filename can be automatically provided by
++either enabling the auto-extension machinery
++or giving a dummy extension.
++The auto-extension machinery is disabled by default for backward compatibility,
++while the implemented dummy extensions are:
++\fI.xxx\fR,
++\fI.XXX\fR,
++\fI.auto-extension\fR,
++and
++\fI.automatic-extension\fR.
++
+ .B surf
+ can handle curves/surfaces up to degree 30. The main features include
+ .B algebraic
diff --git a/debian/patches/upstream-nox-options.patch b/debian/patches/upstream-nox-options.patch
new file mode 100644
index 0000000..7272784
--- /dev/null
+++ b/debian/patches/upstream-nox-options.patch
@@ -0,0 +1,205 @@
+Description: upstream: no X (no GUI) option machinery simplification
+ Attempt to simply the uptream option selection machinery in view to
+ add new options: the --no-gui trigger is replaced by a silencer: GUI
+ options are now silentely ignored in CLI mode.
+Origin: debian
+Forwarded: submitted
+Author: Jerome Benoit <calculus at rezozer.net>
+Last-Update: 2015-04-10
+
+--- a/src/Options.cc
++++ b/src/Options.cc
+@@ -26,73 +26,109 @@
+ #include <iostream>
+ #include <string.h>
+ #include <stdlib.h>
++#include <argp.h>
+ 
+ #ifndef NO_GUI
+-
+ #include <gtk/gtk.h>
++#endif
++
++#include "welcomeMessage.h"
++
+ using namespace std;
+ 
+-namespace {
+-char usage_text[] = "Usage: surf -n | --no-gui FILE...\n"
+-                    "       surf [GTK-OPTIONS] [-x | --exec] [--progress-dialog]\n"
+-                    "            [--auto-resize] [FILE]...\n"
+-                    "       surf --help\n"
+-                    "\n"
+-		    "-n, --no-gui           disable GUI, execute all scripts passed as FILEs\n"
+-		    "-x, --exec             when running with GUI, execute first script immediately\n"
+-                    "    --progress-dialog  pop up a dialog instead of using a status bar\n"
+-                    "    --auto-resize      resize image windows automatically to image size\n"
+-                    "    --help             display this help and exit\n\n";
+-};
++static void options_print_usage(const char* argv0)
++{
++	const char *surf_name=
++#ifdef HAVE_PROGRAM_INVOCATION_SHORT_NAME
++		program_invocation_short_name
++#else
++		"surf"
++#endif
++		;
+ 
++	std::cerr
++		<< "Usage: " << surf_name
++#ifndef NO_GUI
++		<< " [-n|--no-gui] [FILE]..." << std::endl
++		<< "       " << surf_name
++		<< " [GTK-OPTIONS] [-x|--exec] [--progress-dialog] [--auto-resize]"
++#endif
++		<< " [FILE]..." << std::endl
++#ifndef NO_GUI
++		<< std::endl
++		<< "-n, --no-gui           disable GUI, execute all scripts passed as FILEs" << std::endl
++		<< "-x, --exec             when running with GUI, execute first script immediately" << std::endl
++		<< "    --progress-dialog  pop up a dialog instead of using a status bar" << std::endl
++		<< "    --auto-resize      resize image windows automatically to image size" << std::endl
++#endif
++		<< std::endl
++		<< "-h, --help             display this help and exit" << std::endl
++		<< "-V, --version          display version tuple and exit\n" << std::endl
++#if 0
++		<< "    --copyright        display copyright and exit" << std::endl
+ #endif
++		;
++}
++
+ 
+-Options::Options(int _argc, char* _argv[])
+-	: argc(_argc), argv(_argv),
+-	  fileopts(1), no_gui(false), execute(false),
+-	  progress_dialog(false), auto_resize(false)
++Options::Options(int _argc, char* _argv[]) :
++		argc(_argc),
++		argv(_argv),
++	  fileopts(1),
++#ifdef NO_GUI
++		no_gui(true),
++#else
++		no_gui(false),
++#endif
++		execute(false),
++	  progress_dialog(false),
++		auto_resize(false)
+ {
+-	if(argc > 1 &&
+-	   (strcmp(argv[1], "-n") == 0 || strcmp(argv[1], "--no-gui") == 0)) {
+-		no_gui = true;
+-		fileopts = 2;
+-	}
+-#ifndef NO_GUI
+-          else {
+-		gtk_init(&argc, &argv);
+-		
+ 		int i;
+ 		for(i = 1; i < argc; ++i) {
+ 			if(argv[i][0] != '-') {
+ 				break;
+ 			}
+-			
+ 			++fileopts;
+-			
+-			if(strcmp(argv[i], "-x") == 0 ||
+-			    strcmp(argv[i], "--exec") == 0) {
++			if(strcmp(argv[i], "-x") == 0 || strcmp(argv[i], "--exec") == 0) {
++#ifdef NO_GUI
++#else
+ 				execute = true;
+-			} else if(strcmp(argv[i], "--help") == 0) {
+-				std::cerr << usage_text;
++#endif
++			} else if(strcmp(argv[i], "--copyright") == 0) {
++				std::cerr << welcomeMessage;
++				exit(0);
++			} else if(strcmp(argv[i], "-V") == 0 || strcmp(argv[i], "--version") == 0) {
++				std::cerr << VERSION << std::endl;
++				exit(0);
++			} else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
++				options_print_usage(argv[0]);
+ 				exit(0);
+ 			} else if(strcmp(argv[i], "--progress-dialog") == 0) {
++#ifdef NO_GUI
++#else
+ 				progress_dialog = true;
++#endif
+ 			} else if(strcmp(argv[i], "--auto-resize") == 0) {
++#ifdef NO_GUI
++#else
+ 				auto_resize = true;
+-			} else if(strcmp(argv[i], "-n") == 0 ||
+-				  strcmp(argv[i], "--no-gui") == 0) {
+-				std::cerr << "Error: \'" << argv[i] << "\' must be the only option\n\n"
+-					  << usage_text;
+-				exit(1);
++#endif
++			} else if(strcmp(argv[i], "-n") == 0 || strcmp(argv[i], "--no-gui") == 0) {
++#ifdef NO_GUI
++#else
++				no_gui = true;
++#endif
+ 			} else {
+-				std::cerr << "Error: unknown option \'" << argv[i] << "\'\n\n"
+-					  << usage_text;
++				std::cerr << "Error: unknown option \'" << argv[i] << "\'\n\n";
++				options_print_usage(argv[0]);
+ 				exit(1);
+ 			}
+ 		}
+ 		fileopts = i;
+-	}
++
++#ifdef NO_GUI
+ #else
+-        no_gui = true;
++		if(!no_gui) gtk_init(&argc, &argv);
+ #endif
+ }
+--- a/src/main.cc
++++ b/src/main.cc
+@@ -27,7 +27,6 @@
+ #include <stdlib.h>
+ #include <signal.h>
+ #include "Script.h"
+-#include "welcomeMessage.h"
+ #include "compfn.h"
+ #include "Options.h"
+ using namespace std;
+@@ -56,8 +55,6 @@
+ 	yydebug = 1;
+ #endif
+ 
+-	cout << welcomeMessage;
+-
+ 	options = new Options(argc, argv);
+ 
+ 	init_all();
+--- a/configure.ac
++++ b/configure.ac
+@@ -148,6 +148,21 @@
+ ## TIFF library
+ PKG_CHECK_MODULES([LIBTIFF],[libtiff-4],[],[AC_MSG_ERROR([unable to find libtiff])])
+ 
++## grabbed from gnulib
++AC_MSG_CHECKING([whether program_invocation_short_name is defined])
++AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
++	#include <argp.h>
++]], [[
++	program_invocation_short_name = "test";
++]])], [
++	AC_MSG_RESULT([yes])
++	AC_DEFINE([HAVE_PROGRAM_INVOCATION_SHORT_NAME], [1],
++		[Define if program_invocation_short_name is defined])
++], [
++	AC_MSG_RESULT([no])
++])
++
++
+ AC_CONFIG_FILES([
+ 	Makefile
+ 	src/Makefile
diff --git a/debian/patches/upstream-option-quiet.patch b/debian/patches/upstream-option-quiet.patch
new file mode 100644
index 0000000..721e380
--- /dev/null
+++ b/debian/patches/upstream-option-quiet.patch
@@ -0,0 +1,120 @@
+Description: upstream: add quiet/verbose options
+ Attempt to implement quiet options by shortcutting info messages:
+ the long options --quiet and --silent along the short option -q
+ are introduced to silent surf; the long option --verbose along
+ the short option -v as counterpart. The short option -q was encoded
+ in a modified version of surf for surfer (<http://imaginary.org>)
+ by Henning Meyer <hmeyer at mathematik.uni-kl.de>, it was revisited
+ and extented on behalf of the Debian Science Team and of imaginary.org
+ by Jerome Benoit <calculus at rezozer.net>.
+Origin:
+ imaginary.org
+ debian
+Forwarded: submitted
+Author:
+ Jerome Benoit <calculus at rezozer.net>
+ Henning Meyer <hmeyer at mathematik.uni-kl.de>
+Last-Update: 2015-04-10
+
+--- a/src/Options.cc
++++ b/src/Options.cc
+@@ -24,6 +24,8 @@
+ 
+ #include "Options.h"
+ #include <iostream>
++#include <cstdio>
++#include <strstream>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <argp.h>
+@@ -62,6 +64,9 @@
+ 		<< "    --auto-resize      resize image windows automatically to image size" << std::endl
+ #endif
+ 		<< std::endl
++		<< "-v, --verbose          verbose operation, print the executed commands (default)" << std::endl
++		<< "-q, --quiet, --silent  quiet operation, do not print the executed commands" << std::endl
++		<< std::endl
+ 		<< "-h, --help             display this help and exit" << std::endl
+ 		<< "-V, --version          display version tuple and exit\n" << std::endl
+ #if 0
+@@ -82,7 +87,8 @@
+ #endif
+ 		execute(false),
+ 	  progress_dialog(false),
+-		auto_resize(false)
++		auto_resize(false),
++		quiet(false)
+ {
+ 		int i;
+ 		for(i = 1; i < argc; ++i) {
+@@ -104,6 +110,10 @@
+ 			} else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
+ 				options_print_usage(argv[0]);
+ 				exit(0);
++			} else if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) {
++				quiet = false;
++			} else if(strcmp(argv[i], "-q") == 0 || strcmp(argv[i], "--quiet") == 0 || strcmp(argv[i], "--silent") == 0) {
++				quiet = true;
+ 			} else if(strcmp(argv[i], "--progress-dialog") == 0) {
+ #ifdef NO_GUI
+ #else
+--- a/src/Options.h
++++ b/src/Options.h
+@@ -13,6 +13,8 @@
+ 	bool get_exec() const { return execute; }
+ 	bool get_progress_dialog() const { return progress_dialog; }
+ 	bool get_auto_resize() const { return auto_resize; }
++	bool get_verbose() const {  return !quiet; }
++	bool get_quiet() const {  return quiet; }
+ 
+ private:
+ 	int argc;
+@@ -22,6 +24,7 @@
+ 	bool execute;
+ 	bool progress_dialog;
+ 	bool auto_resize;
++	bool quiet;
+ };
+ 
+ extern Options* options;
+--- a/src/main.cc
++++ b/src/main.cc
+@@ -61,7 +61,9 @@
+ 
+ 	if(options->get_no_gui()) {
+ 		for(int i = options->getFirstFileIdx(); i < argc; ++i) {
+-			cerr << "************** executing " << argv[i] << endl;
++			if(options->get_verbose()) {
++				cerr << "************** executing " << argv[i] << endl;
++				}
+ 			Script::executeScriptFromFile(argv[i]);
+ 		}
+ 	} else {
+--- a/mt/Thread.cc
++++ b/mt/Thread.cc
+@@ -28,6 +28,8 @@
+ 
+ #include "Thread.h"
+ 
++#include "Options.h"
++
+ // #define DEBUG
+ #include "debug.h"
+ 
+@@ -116,8 +118,15 @@
+ 
+ void Thread::setDoing (const char *str, double val)
+ {
++	if(options->get_quiet()) return;
++
+ 	if (!is_multithreaded) {
+-		cout << str << endl;
++		if(options->get_no_gui()) {
++			cerr << "***** " << str << endl;
++			}
++		else {
++			cerr << str << endl;
++			}
+ 		return;
+ 	}
+ 
diff --git a/debian/repack b/debian/repack
new file mode 100755
index 0000000..ef33542
--- /dev/null
+++ b/debian/repack
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+PACKAGE_NAME=surf-alggeo
+
+set -e
+set -u
+
+usage() {
+	echo "Usage: repack --upstream-version <ver> <downloaded file>"
+	exit 1
+	}
+
+if [ "$#" != "3" ]; then
+	usage
+fi
+if [ "$1" != "--upstream-version" ]; then
+	usage
+fi
+if [ ! -f "$3" ]; then
+	if [ -n "$3" ]; then
+		echo "$3 doesn't exist"
+	fi
+	usage
+fi
+UPSTREAM_VERSION="$2"
+UPSTREAM_TARBALLZZ="$3"
+
+DEBIAN_SUFFIX="+ds"
+####DEBIAN_ENCAPSULATEDFOLDERNAME="${PACKAGE_NAME}-usrc"
+
+DEBIAN_UVERSION=${UPSTREAM_VERSION}${DEBIAN_SUFFIX}
+DEBIAN_ROOTFOLDERNAME="${PACKAGE_NAME}-${DEBIAN_UVERSION}.orig"
+DEBIAN_TARBALLXZ="$(dirname $UPSTREAM_TARBALLZZ)/${PACKAGE_NAME}_${DEBIAN_UVERSION}.orig.tar.xz"
+
+REPACK_TMPDIR=`mktemp -d ./repackXXXXXX`
+REPACK_TMPDIR=$(readlink -f "$REPACK_TMPDIR")
+trap "/bin/rm -rf \"$REPACK_TMPDIR\"" QUIT INT EXIT
+
+message() {
+	echo
+	echo "-- -- $1"
+	echo
+	}
+
+message "Repackaging $UPSTREAM_TARBALLZZ"
+
+UPSTREAM_ROOTFOLDER="${REPACK_TMPDIR}/unpacked"
+mkdir "${UPSTREAM_ROOTFOLDER}"
+tar -C "${UPSTREAM_ROOTFOLDER}" -xf "${UPSTREAM_TARBALLZZ}" || unzip -d "${UPSTREAM_ROOTFOLDER}" "${UPSTREAM_TARBALLZZ}"
+if [ `ls -1 "${UPSTREAM_ROOTFOLDER}" | wc -l` -eq 1 ]; then
+	UPSTREAM_ROOTFOLDER="${UPSTREAM_ROOTFOLDER}/`ls -1 "${UPSTREAM_ROOTFOLDER}"`"
+fi
+
+DEBIAN_ROOTFOLDER="${REPACK_TMPDIR}/${DEBIAN_ROOTFOLDERNAME}"
+## repack
+####set -f
+REPACK_WORKING_FOLDER=$(pwd)
+cd "${UPSTREAM_ROOTFOLDER}"
+
+####. "${REPACK_WORKING_FOLDER}/debian/repack.local"
+## wipe out SVN material
+find . -type d -a -name '.svn' | xargs rm --verbose --recursive --force
+## wipe out material generated at build time
+rm --verbose --force -- yaccsrc/polyyacc.c
+rm --verbose --force -- yaccsrc/polyyacc.h
+rm --verbose --force -- yaccsrc/polylex.c
+## wipe out material provided or generated by autotools
+find . -type f -a -name 'Makefile.in' | xargs rm --verbose --force
+##rm --verbose --force -- config.h.in
+##rm --verbose --force -- Makefile.in
+rm --verbose --force -- aclocal.m4
+rm --verbose --force -- install-sh
+rm --verbose --force -- missing
+rm --verbose --force -- mkinstalldirs
+rm --verbose --force -- config.guess
+rm --verbose --force -- config.sub
+rm --verbose --force -- configure
+rm --verbose --force -- INSTALL
+## remove executable bit for source files
+chmod --changes a-x gtkgui/PrintImageDialog.cc
+chmod --changes a-x gtkgui/PrintImageDialog.h
+#:
+
+cd ${REPACK_WORKING_FOLDER}
+set +f
+## end
+####if [ -n "${DEBIAN_ENCAPSULATEDFOLDERNAME}" ]; then
+####	mkdir "${DEBIAN_ROOTFOLDER}"
+####	mv "${UPSTREAM_ROOTFOLDER}" "${DEBIAN_ROOTFOLDER}/${DEBIAN_ENCAPSULATEDFOLDERNAME}"
+####else
+	mv "${UPSTREAM_ROOTFOLDER}" "${DEBIAN_ROOTFOLDER}"
+####fi
+
+REPACK_TARBALL="${REPACK_TMPDIR}/repacked.tar"
+REPACK_TARBALLXZ="${REPACK_TARBALL}.xz"
+( cd "${REPACK_TMPDIR}" && \
+	find -L "${DEBIAN_ROOTFOLDERNAME}" -xdev -type f -print | sort | \
+	tar -T-  --owner=root --group=root --mode=a+rX --create --file "${REPACK_TARBALL}" \
+	)
+xz -9e < "${REPACK_TARBALL}" > "${REPACK_TARBALLXZ}"
+mv "${REPACK_TARBALLXZ}" "${DEBIAN_TARBALLXZ}"
+
+message "Testing ${DEBIAN_TARBALLXZ}"
+
+xz --verbose --test "${DEBIAN_TARBALLXZ}"
+
+message "Printing information about ${DEBIAN_TARBALLXZ}"
+
+xz --verbose --list "${DEBIAN_TARBALLXZ}"
+
+message "Quitting"
+
+##
+## eos
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..74a9c73
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,49 @@
+#!/usr/bin/make -f
+
+export DEB_PKG_VERSION = $(shell dpkg-parsechangelog | sed -n -e '/^Version:/s/Version: //p')
+
+DEB_VIRT_SURFALGGEO_LISTOF_VARIANT = nox ##gtk
+
+CONFIGURE_OPTS_nox = --disable-gui --disable-cups
+##CONFIGURE_OPTS_gtk = --enable-gui --enable-cups
+
+## inspired from gsl material
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else ifeq ($(DEB_HOST_ARCH), m68k)
+	CFLAGS += -O2
+else ifeq ($(DEB_HOST_ARCH), alpha)
+	CFLAGS += -O2 -mieee
+else
+	CFLAGS += -O3
+endif
+
+default:
+	@uscan --no-conf --dehs --report || true
+
+%:
+	dh $@ --with autoreconf
+
+override_dh_auto_configure:
+	$(foreach vt, $(DEB_VIRT_SURFALGGEO_LISTOF_VARIANT), \
+		dh_auto_configure -B _build/$(vt) -- --srcdir=../.. --program-suffix=-alggeo-$(vt) $(CONFIGURE_OPTS_$(subst -,_,$(vt))) ;\
+		)
+
+override_dh_auto_build-arch:
+	$(foreach vt, $(DEB_VIRT_SURFALGGEO_LISTOF_VARIANT), dh_auto_build -a -B _build/$(vt) ;)
+
+override_dh_auto_build-indep:
+	$(MAKE) -C docs all
+
+override_dh_auto_install-arch:
+	$(foreach vt, $(DEB_VIRT_SURFALGGEO_LISTOF_VARIANT), dh_auto_install -a -B _build/$(vt) ;)
+
+override_dh_compress-indep:
+	dh_compress -X.pdf -Xexamples
+
+override_dh_auto_clean-arch:
+	dh_auto_clean -a
+	rm -rf _build
+
+get-orig-source:
+	uscan --no-conf --download-current-version --verbose
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides
new file mode 100644
index 0000000..8b06cb1
--- /dev/null
+++ b/debian/source/lintian-overrides
@@ -0,0 +1 @@
+debian-watch-may-check-gpg-signature
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 0000000..22a4de9
--- /dev/null
+++ b/debian/source/options
@@ -0,0 +1,2 @@
+compression = xz
+compression-level = 9
diff --git a/debian/surf-alggeo-doc.doc-base b/debian/surf-alggeo-doc.doc-base
new file mode 100644
index 0000000..d239d0f
--- /dev/null
+++ b/debian/surf-alggeo-doc.doc-base
@@ -0,0 +1,26 @@
+Document: surf-alggeo
+Title: surf version 1.0.1
+Author: Stephan Endrass <endrass at mathematik.uni-mainz.de>
+Abstract:
+ The aim was to have a tool to visualize some real algebraic geometry:
+ plane algebraic curves given as zero locus of a polynomial in two variables,
+ algebraic surfaces given as zero locus of a polynomial in three variables,
+ hyperplane sections of surfaces: algebraic space curves given as zero locus of
+ two polynomials in three variables: a polynomial of arbitrary degree
+ (the surface) and a linear polynomial (the hyperplane), and lines on surfaces
+ given by two points on a surface. The algorithms should be stable enough not to
+ be confused by curve/surface singularities in codimension greater than one and
+ the degree of the surface or curve. This has been achieved quite a bit. We have
+ drawn curves of degree up to 30 and surfaces of degree up to 20 successfully.
+ However, there are examples of curves/surfaces of lower degree where surf fails
+ to produce perfect images. This happens especially if the equation of the
+ curve/surface is not reduced. Best results are achieved using reduced equations.
+ On the other hand, surf displays the Fermat-curves accurately for degree up to 98.
+Section: Science/Mathematics
+
+Format: HTML
+Index: /usr/share/doc/surf-alggeo-doc/surf-alggeo.html
+Files: /usr/share/doc/surf-alggeo-doc/surf-alggeo.html
+
+Format: PDF
+Files: /usr/share/doc/surf-alggeo-doc/surf-alggeo.pdf
diff --git a/debian/surf-alggeo-doc.docs b/debian/surf-alggeo-doc.docs
new file mode 100644
index 0000000..6430168
--- /dev/null
+++ b/debian/surf-alggeo-doc.docs
@@ -0,0 +1,6 @@
+README
+NEWS
+TODO
+AUTHORS
+docs/surf-alggeo.html
+docs/surf-alggeo.pdf
diff --git a/debian/surf-alggeo-doc.examples b/debian/surf-alggeo-doc.examples
new file mode 100644
index 0000000..3918a9d
--- /dev/null
+++ b/debian/surf-alggeo-doc.examples
@@ -0,0 +1,2 @@
+background.pic
+examples/*
diff --git a/debian/surf-alggeo-nox.docs b/debian/surf-alggeo-nox.docs
new file mode 100644
index 0000000..b0f9c78
--- /dev/null
+++ b/debian/surf-alggeo-nox.docs
@@ -0,0 +1,4 @@
+README
+NEWS
+TODO
+AUTHORS
diff --git a/debian/surf-alggeo-nox.install b/debian/surf-alggeo-nox.install
new file mode 100644
index 0000000..d5c9433
--- /dev/null
+++ b/debian/surf-alggeo-nox.install
@@ -0,0 +1 @@
+usr/bin/surf-alggeo-nox
diff --git a/debian/surf-alggeo-nox.manpages b/debian/surf-alggeo-nox.manpages
new file mode 100644
index 0000000..702a9ae
--- /dev/null
+++ b/debian/surf-alggeo-nox.manpages
@@ -0,0 +1 @@
+debian/tmp/usr/share/man/man1/surf-alggeo-nox.1
diff --git a/debian/surf-alggeo-nox.postinst b/debian/surf-alggeo-nox.postinst
new file mode 100644
index 0000000..c9b0394
--- /dev/null
+++ b/debian/surf-alggeo-nox.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+update-alternatives \
+	--install /usr/bin/surf-alggeo surf-alggeo /usr/bin/surf-alggeo-nox 10 \
+	--slave /usr/share/man/man1/surf-alggeo.1.gz surf-alggeo.1.gz /usr/share/man/man1/surf-alggeo-nox.1.gz
+#DEBHELPER#
+exit 0
diff --git a/debian/surf-alggeo-nox.prerm b/debian/surf-alggeo-nox.prerm
new file mode 100644
index 0000000..8b7d101
--- /dev/null
+++ b/debian/surf-alggeo-nox.prerm
@@ -0,0 +1,9 @@
+#!/bin/sh
+set -e
+case $1 in
+	remove|deconfigure) update-alternatives --remove surf-alggeo /usr/bin/surf-alggeo-nox ;;
+	upgrade|failed-upgrade) ;;
+	*) echo "prerm called with unknown argument \`$1'" >&2 ; exit 0 ;;
+esac
+#DEBHELPER#
+exit 0
diff --git a/debian/watch b/debian/watch
new file mode 100644
index 0000000..1cfcc09
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+version=3
+opts=dversionmangle=s/\+ds// \
+http://sf.net/surf/surf-(.+)\.tar\.gz \
+debian sh debian/repack

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/surf-alggeo.git



More information about the debian-science-commits mailing list