[SCM] Control pipeline recipes from the European Southern Observatory branch, master, updated. upstream/0.3.5.1-6-g4ca9f20

Ole Streicher debian at liska.ath.cx
Tue Nov 29 08:48:31 UTC 2011


The following commit has been merged in the master branch:
commit 357873362ab31d43ecd1535a4cf816a28a20b801
Author: Ole Streicher <debian at liska.ath.cx>
Date:   Fri Nov 11 19:15:32 2011 +0100

    Added unit test from http://www.aip.de/~oles/python-cpl/python-cpl-tests-0.3.5.1.tar.gz

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..a110c8e
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+python-cpl (0.3.5.1-1) unstable; urgency=low
+
+  * New package. Closes: #641636
+
+ -- Ole Streicher <debian at liska.ath.cx>  Thu, 10 Nov 2011 17:52:00 +0100
diff --git a/debian/clean b/debian/clean
new file mode 100644
index 0000000..1b412db
--- /dev/null
+++ b/debian/clean
@@ -0,0 +1,19 @@
+setup.cfg
+cpl/version.py
+cpl/CPL_recipe.so
+test/iiinstrumentp/libtool
+test/iiinstrumentp/configure
+test/iiinstrumentp/config.status
+test/iiinstrumentp/libtool
+test/iiinstrumentp/Makefile
+test/iiinstrumentp/Makefile.in
+test/iiinstrumentp/aclocal.m4
+test/iiinstrumentp/config.*
+test/iiinstrumentp/stamp-h1
+test/iiinstrumentp/*/Makefile
+test/iiinstrumentp/*/Makefile.in
+test/iiinstrumentp/*/*.l[ao]
+test/iiinstrumentp/m4macros/l*.m4
+test/iiinstrumentp/admin/*
+test/iiinstrumentp/iiinstrument/.libs/*
+test/iiinstrumentp/recipes/.libs/*
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..93139bf
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,26 @@
+Source: python-cpl
+Section: python
+Priority: optional
+Maintainer: Ole Streicher <debian at liska.ath.cx>
+Build-Depends: python-all-dev (>= 2.6.6-3~), debhelper (>= 7.0.50~), 
+ dh-autoreconf, libcpl-dev (>= 5.1.0), python-numpy, python-pyfits
+Standards-Version: 3.9.2
+Homepage: http://www.aip.de/~oles/python-cpl/index.html
+
+Package: python-cpl
+Architecture: any
+Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}
+Suggests: gdb
+Description: Control pipeline recipes from the European Southern Observatory
+ This module can list, configure and execute CPL-based recipes from Python.
+ The input, calibration and output data can be specified as FITS files
+ or as pyfits objects in memory.
+ .
+ The Common Pipeline Library (CPL) comprises a set of ISO-C libraries that
+ provide a comprehensive, efficient and robust software toolkit. It forms a
+ basis for the creation of automated astronomical data-reduction tasks.
+ .
+ One of the features provided by the CPL is the ability to create
+ data-reduction algorithms that run as plugins (dynamic libraries). These are
+ called "recipes" and are one of the main aspects of the CPL data-reduction
+ development environment. 
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..91645f8
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,28 @@
+Format: http://anonscm.debian.org/viewvc/dep/web/deps/dep5.mdwn?revision=202
+Upstream-Name: cpl
+Upstream-Author:Ole Streicher <python-cpl at liska.ath.cx>
+Source: https://github.com/olebole/python-cpl/downloads
+
+Files: *
+Copyright: Copyright (C) 2010 Ole Streicher
+License: GPL-2
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ .
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 2 can be found in the file
+ `/usr/share/common-licenses/GPL-2'.
+
+Files: test/iiinstrumentp/*
+Copyright: Copyright (C) 2002,2003 European Southern Observatory
+License: GPL-2
+ On Debian systems, the full text of the GNU General Public
+ License version 2 can be found in the file
+ `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000..e845566
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1 @@
+README
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..53b8ccb
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+set-default-plugin-path.patch
diff --git a/debian/patches/set-default-plugin-path.patch b/debian/patches/set-default-plugin-path.patch
new file mode 100644
index 0000000..41f3f14
--- /dev/null
+++ b/debian/patches/set-default-plugin-path.patch
@@ -0,0 +1,14 @@
+Author: Ole Streicher <debian at liska.ath.cx>
+Description: Set the default plugin path to the one where recipes are
+ installed in Debian.
+--- a/cpl/recipes.py
++++ b/cpl/recipes.py
+@@ -37,7 +37,7 @@
+     version: (versionnumber, versionstring) pair
+     '''
+ 
+-    path = [ '.' ]
++    path = [ '/usr/local/lib/cpl/plugins', '/usr/lib/cpl/plugins']
+ 
+     def __init__(self, name, filename = None, version = None, threaded = False):
+         '''Try to load a recipe with the specified name in the directory
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..d4b3098
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,14 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@ --with python2 
+
+build_test_recipe:
+	(cd test/iiinstrumentp && ./bootstrap && ./configure && make)
+
+override_dh_auto_test: build_test_recipe
+	for PYTHON in $(shell pyversions -r); do \
+	    $$PYTHON setup.py build_ext -i && \
+	    MALLOC_CHECK_=0 PYTHONPATH=$$(pwd) $$PYTHON test/TestRecipe.py \
+	        || exit $$? ; \
+	done
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/watch b/debian/watch
new file mode 100644
index 0000000..1cebbeb
--- /dev/null
+++ b/debian/watch
@@ -0,0 +1,4 @@
+# format version number, currently 3; this line is compulsory!
+version=3
+http://www.aip.de/~oles/python-cpl/install.html python-cpl-([0-9].*)\.tar\.gz debian uupdate
+
diff --git a/test/TestRecipe.py b/test/TestRecipe.py
new file mode 100644
index 0000000..cc65ade
--- /dev/null
+++ b/test/TestRecipe.py
@@ -0,0 +1,707 @@
+import logging
+import os
+import shutil
+import tempfile
+import unittest
+
+import numpy
+import pyfits
+import cpl
+
+class CplTestCase(unittest.TestCase):
+    def setUp(self):
+        cpl.Recipe.path = os.path.dirname(os.path.abspath(__file__))
+
+class RecipeTestCase(CplTestCase):
+    def setUp(self):
+        CplTestCase.setUp(self)
+        self.temp_dir = tempfile.mkdtemp()
+        self.recipe = cpl.Recipe('rrrecipe')
+        self.recipe.temp_dir = self.temp_dir
+        self.recipe.tag = 'RRRECIPE_DOCATG_RAW'
+        self.image_size = (16, 16)
+        self.raw_frame = pyfits.HDUList([
+                pyfits.PrimaryHDU(numpy.random.random_integers(0, 65000,
+                                                               self.image_size))])
+        self.raw_frame[0].header.update('HIERARCH ESO DET DIT', 0.0)
+        self.raw_frame[0].header.update('HIERARCH ESO PRO CATG', 
+                                        'RRRECIPE_DOCATG_RAW')
+
+    def tearDown(self):
+        shutil.rmtree(self.temp_dir)
+
+class RecipeStatic(CplTestCase):
+    def test_list(self):
+        '''List available recipes'''
+        l = cpl.Recipe.list()
+        self.assertTrue(isinstance(l, list))
+        self.assertEqual(len(l), 1)
+        self.assertEqual(l[0], ('rrrecipe', ['0.0.1']))
+
+    def test_create_recipe(self):
+        '''Create a recipe specified by its name'''
+        recipe = cpl.Recipe('rrrecipe')
+        self.assertTrue(isinstance(recipe, cpl.Recipe))
+
+    def test_create_recipe_version(self):
+        '''Create a recipe specified by its name and version'''
+        recipe = cpl.Recipe('rrrecipe', version = '0.0.1')
+        self.assertTrue(isinstance(recipe, cpl.Recipe))        
+
+    def test_create_recipe_wrong_name(self):
+        '''Create a recipe specified by a wrong name'''
+        self.assertRaises(IOError, cpl.Recipe, 'wrongname')
+
+    def test_create_recipe_wrong_version(self):
+        '''Create a recipe specified by a wrong version'''
+        self.assertRaises(IOError, cpl.Recipe, 'rrrecipe', version='0.0.10')
+
+    def test_create_recipe_filename(self):
+        '''Create a recipe specified by a the name and the filename'''
+        recipe = cpl.Recipe('rrrecipe', filename = os.path.join(
+                os.path.dirname(os.path.abspath(__file__)),
+                'iiinstrumentp', 'recipes', '.libs', 'rrrecipe.so'))
+        self.assertTrue(isinstance(recipe, cpl.Recipe))
+
+    def test_create_recipe_wrong_filename(self):
+        '''Create a recipe specified by a wrong filename'''
+        self.assertRaises(IOError, cpl.Recipe, 'rrrecipe', 
+                          filename = os.path.join(
+                os.path.dirname(os.path.abspath(__file__)),
+                'iiinstrumentp', 'recipes', '.libs', 'rrrecipe.o'))
+
+class RecipeCommon(RecipeTestCase):
+    def test_name(self):
+        '''Recipe name'''
+        self.assertEqual(self.recipe.__name__, 'rrrecipe')
+
+    def test_author(self):
+        '''Author attribute'''
+        self.assertEqual(self.recipe.__author__, 'Firstname Lastname')
+
+    def test_email(self):
+        '''Author attribute'''
+        self.assertEqual(self.recipe.__email__, 'flastname at eso.org')
+
+    def test_description(self):
+        '''Synopsis and description'''
+        self.assertTrue(isinstance(self.recipe.description[0], str))
+        self.assertTrue(len(self.recipe.description[0]) > 0)
+        self.assertTrue(isinstance(self.recipe.description[1], str))
+        self.assertTrue(len(self.recipe.description[1]) > 0)
+
+    def test_copyright(self):
+        '''Copyright'''
+        self.assertTrue(isinstance(self.recipe.__copyright__, str))
+        self.assertTrue(len(self.recipe.__copyright__) > 0)
+
+class RecipeParams(RecipeTestCase):
+    def test_str(self):
+        '''String parameter'''
+        self.assertTrue(isinstance(self.recipe.param.stropt, cpl.Parameter))
+        self.assertEqual(self.recipe.param.stropt.name, 'stropt')
+        self.assertEqual(self.recipe.param.stropt.context, 
+                         'iiinstrument.rrrecipe')
+        self.assertEqual(self.recipe.param.stropt.default, None)
+        self.assertEqual(self.recipe.param.stropt.value, None)
+        self.assertEqual(self.recipe.param.stropt.range, None)
+        self.assertEqual(self.recipe.param.stropt.sequence, None)
+        self.recipe.param.stropt = 'more'
+        self.assertEqual(self.recipe.param.stropt.value, 'more')
+        del self.recipe.param.stropt 
+        self.assertEqual(self.recipe.param.stropt.value, None)
+
+    def test_bool(self):
+        '''Boolean parameter'''
+        self.assertTrue(isinstance(self.recipe.param.boolopt, cpl.Parameter))
+        self.assertEqual(self.recipe.param.boolopt.name, 'boolopt')
+        self.assertEqual(self.recipe.param.boolopt.default, True)
+        self.assertEqual(self.recipe.param.boolopt.value, None)
+        self.recipe.param.boolopt = False
+        self.assertEqual(self.recipe.param.boolopt.value, False)
+        del self.recipe.param.boolopt 
+        self.assertEqual(self.recipe.param.boolopt.value, None)
+        
+    def test_float(self):
+        '''Float parameter'''
+        self.assertTrue(isinstance(self.recipe.param.floatopt, cpl.Parameter))
+        self.assertEqual(self.recipe.param.floatopt.name, 'floatopt')
+        self.assertEqual(self.recipe.param.floatopt.default, 0.1)
+        self.assertEqual(self.recipe.param.floatopt.value, None)
+        self.recipe.param.floatopt = 1.1
+        self.assertEqual(self.recipe.param.floatopt.value, 1.1)
+        del self.recipe.param.floatopt 
+        self.assertEqual(self.recipe.param.floatopt.value, None)
+
+    def test_int(self):
+        '''Integer parameter'''
+        self.assertTrue(isinstance(self.recipe.param.intopt, cpl.Parameter))
+        self.assertEqual(self.recipe.param.intopt.name, 'intopt')
+        self.assertEqual(self.recipe.param.intopt.default, 2)
+        self.assertEqual(self.recipe.param.intopt.value, None)
+        self.recipe.param.intopt = -1
+        self.assertEqual(self.recipe.param.intopt.value, -1)
+        del self.recipe.param.intopt 
+        self.assertEqual(self.recipe.param.intopt.value, None)
+
+    def test_enum(self):
+        '''Enumeration (string) parameter'''
+        self.assertTrue(isinstance(self.recipe.param.enumopt, cpl.Parameter))
+        self.assertEqual(self.recipe.param.enumopt.name, 'enumopt')
+        self.assertEqual(self.recipe.param.enumopt.default, 'first')
+        self.assertEqual(self.recipe.param.enumopt.value, None)
+        self.recipe.param.enumopt = 'second'
+        self.assertEqual(self.recipe.param.enumopt.value, 'second')
+        del self.recipe.param.enumopt 
+        self.assertEqual(self.recipe.param.enumopt.value, None)
+        def setenumoptinvalid():
+            self.recipe.param.enumopt = 'invalid'
+        self.assertRaises(ValueError, setenumoptinvalid)
+
+    def test_range(self):
+        '''Range (float) parameter'''
+        self.assertTrue(isinstance(self.recipe.param.rangeopt, cpl.Parameter))
+        self.assertEqual(self.recipe.param.rangeopt.name, 'rangeopt')
+        self.assertEqual(self.recipe.param.rangeopt.default, 0.1)
+        self.assertEqual(self.recipe.param.rangeopt.value, None)
+        self.recipe.param.rangeopt = 0.4
+        self.assertEqual(self.recipe.param.rangeopt.value, 0.4)
+        del self.recipe.param.rangeopt 
+        self.assertEqual(self.recipe.param.rangeopt.value, None)
+        def setrangeoptinvalid():
+            self.recipe.param.rangeopt = 1.5
+        self.assertRaises(ValueError, setrangeoptinvalid)
+
+    def test_as_dict(self):
+        '''Use the parameter list as a dictionary'''
+        self.assertEqual(self.recipe.param.boolopt, 
+                         self.recipe.param['boolopt'])
+        self.assertEqual(self.recipe.param.boolopt, 
+                         self.recipe.param['iiinstrument.rrrecipe.bool_option'])
+
+    def test_dotted_par(self):
+        '''Use a parameter that has a dot in its alias'''
+        self.assertEqual(self.recipe.param.dot_opt, 
+                         self.recipe.param['dot.opt'])
+        self.assertEqual(self.recipe.param.dot_opt, 
+                         self.recipe.param['iiinstrument.rrrecipe.dotted.opt'])
+
+    def test_iterate(self):
+        '''Iteration over all parameters'''
+        for p in self.recipe.param:
+            self.assertTrue(isinstance(p, cpl.Parameter))
+        pars = [p.name for p in self.recipe.param]
+        self.assertEqual(len(pars), len(self.recipe.param))
+        self.assertTrue('stropt' in pars)
+        self.assertTrue('boolopt' in pars)
+
+    def test_set_dict(self):
+        '''Assign a dictionary to the parameter list'''
+        self.recipe.param = { 'stropt':'dmore', 'boolopt':True }
+        self.assertEqual(self.recipe.param.boolopt.value, True)
+        self.assertEqual(self.recipe.param.stropt.value, 'dmore')
+
+        # Check that we can assign a dictionary with the short names and string
+        self.recipe.param = { 'stropt':'dmore', 'boolopt':'False' }
+        self.assertEqual(self.recipe.param.boolopt.value, False)
+
+        # Check that we can assign a dictionary with the long names
+        self.recipe.param = { 'iiinstrument.rrrecipe.string_option':'dless', 
+                      'iiinstrument.rrrecipe.float_option':1.5, 
+                      'iiinstrument.rrrecipe.bool_option':True }
+        self.assertEqual(self.recipe.param.stropt.value, 'dless')
+        self.assertEqual(self.recipe.param.floatopt.value, 1.5)
+        self.assertEqual(self.recipe.param.boolopt.value, True)
+
+    def test_delete(self):
+        '''Delete all parameter values to reset to default'''
+        self.recipe.param.boolopt.value = True
+        self.recipe.param.stropt.value = 'something'
+        del self.recipe.param
+        self.assertEqual(self.recipe.param.stropt.value, None)
+        self.assertEqual(self.recipe.param.boolopt.value, None)
+
+    def test_dir(self):
+        '''[TAB] completition. 
+        This requires to have   the __dir__() method working.
+        '''
+        self.assertEqual(self.recipe.param.__dir__(), 
+                         [ p.name.replace('.','_') for p in self.recipe.param ])
+
+class RecipeCalib(RecipeTestCase):
+    def test_set(self):
+        '''Set a calibration frame'''
+        self.recipe.calib.FLAT = 'flat.fits'
+        self.assertEqual(self.recipe.calib.FLAT.frames, 'flat.fits')
+        
+    def test_set_dict(self):
+        '''Assign a dictionary to the calibration frame list'''
+        self.recipe.calib = { 'FLAT':'flat2.fits' }
+        self.assertEqual(self.recipe.calib.FLAT.frames, 'flat2.fits')
+
+    def test_del(self):
+        '''Delete a calibration frame set'''
+        self.recipe.calib.FLAT = 'flat.fits'
+        del self.recipe.calib.FLAT
+        f = self.recipe.calib.FLAT.frames
+        self.assertEqual(f, None)
+
+    def test_del_all(self):
+        '''Delete all calibration frame sets'''
+        self.recipe.calib.FLAT = 'flat.fits'
+        del self.recipe.calib
+        try:
+            f = self.recipe.calib.FLAT.frames
+        except:
+            f = None
+        self.assertEqual(f, None)
+
+    def test_dir(self):
+        '''[TAB] completition. 
+        This requires to have   the __dir__() method working.
+        '''
+        self.assertEqual(self.recipe.calib.__dir__(), 
+                         [ f.tag for f in self.recipe.calib ])
+
+class RecipeExec(RecipeTestCase):
+    def setUp(self):
+        RecipeTestCase.setUp(self)
+        self.flat_frame = pyfits.HDUList([
+                pyfits.PrimaryHDU(numpy.random.random_integers(0, 65000,
+                                                               self.image_size))])
+
+    def test_frames_keyword(self):
+        '''Raw and calibration frames specified as keywords'''
+        self.recipe.tag = None
+        res = self.recipe(raw_RRRECIPE_DOCATG_RAW = self.raw_frame, 
+                          calib_FLAT = self.flat_frame)
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+        self.assertTrue(abs(self.raw_frame[0].data 
+                            - res.THE_PRO_CATG_VALUE[0].data).max() == 0)
+
+    def test_frames_keyword_dict(self):
+        '''Raw and calibration frames specified as keyword dict'''
+        self.recipe.tag = None
+        res = self.recipe(raw_RRRECIPE_DOCATG_RAW = self.raw_frame, 
+                          calib = { 'FLAT':self.flat_frame })
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+        self.assertTrue(abs(self.raw_frame[0].data 
+                            - res.THE_PRO_CATG_VALUE[0].data).max() == 0)
+
+    def test_frames_keyword_calib(self):
+        '''Raw frame specified as keyword, calibration frame set in recipe'''
+        self.recipe.tag = None
+        self.recipe.calib.FLAT = self.flat_frame
+        res = self.recipe(raw_RRRECIPE_DOCATG_RAW = self.raw_frame)
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+
+    def test_frames_tag_keyword(self):
+        '''The 'tag' parameter'''
+        self.recipe.tag = None
+        self.recipe.calib.FLAT = self.flat_frame
+        res = self.recipe(self.raw_frame, tag = 'RRRECIPE_DOCATG_RAW')
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+
+    def test_frames_tag_attribute(self):
+        '''The 'tag' attribute'''
+        self.recipe.tag = 'RRRECIPE_DOCATG_RAW'
+        res = self.recipe(self.raw_frame)
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+
+    def test_frames_one_element_input_list(self):
+        '''Use 1-element list as input'''
+        # --> we want a list back'''
+        res = self.recipe([self.raw_frame])
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertFalse(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, list))
+
+    def test_frames_many_element_input_list(self):
+        '''Use multiple files as input'''
+        # --> since we only get back one image, it is
+        # assumed to be a 'master', and we get back a plain frame'''
+        res = self.recipe([self.raw_frame, self.raw_frame])
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+
+    def test_output_dir_attribute(self):
+        '''Write an output dir specified as attribute'''
+        output_dir = os.path.join(self.temp_dir, 'out')
+        self.recipe.output_dir = output_dir
+        res = self.recipe(self.raw_frame)
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, str))
+        self.assertEqual(os.path.basename(res.THE_PRO_CATG_VALUE), 
+                         'rrrecipe.fits')
+        self.assertTrue(os.path.isdir(output_dir))
+        self.assertTrue(os.path.isfile(res.THE_PRO_CATG_VALUE))
+        hdu = pyfits.open(res.THE_PRO_CATG_VALUE)
+        self.assertTrue(isinstance(hdu, pyfits.HDUList))
+
+    def test_output_dir_keyword(self):
+        '''Write an output dir specified as call keyword arg'''
+        output_dir = os.path.join(self.temp_dir, 'out')
+        res = self.recipe(self.raw_frame, output_dir = output_dir)
+        self.recipe.output_dir = output_dir
+        res = self.recipe(self.raw_frame)
+        self.assertTrue(os.path.isdir(output_dir))
+        self.assertTrue(isinstance(res, cpl.Result))
+        self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, str))
+        self.assertEqual(os.path.basename(res.THE_PRO_CATG_VALUE), 
+                         'rrrecipe.fits')
+        self.assertTrue(os.path.isfile(res.THE_PRO_CATG_VALUE))
+        hdu = pyfits.open(res.THE_PRO_CATG_VALUE)
+        self.assertTrue(isinstance(hdu, pyfits.HDUList))
+
+    def test_param_keyword(self):
+        '''Parameter handling via keyword arg'''
+        res = self.recipe(self.raw_frame, 
+                          param_stropt = 'more').THE_PRO_CATG_VALUE
+        self.assertEqual(res[0].header['HIERARCH ESO QC STROPT'], 'more')
+
+    def test_param_keyword_dict(self):
+        '''Parameter handling via keyword dict'''
+        res = self.recipe(self.raw_frame, 
+                          param = { 'stropt':'more' }).THE_PRO_CATG_VALUE
+        self.assertEqual(res[0].header['HIERARCH ESO QC STROPT'], 'more')
+
+    def test_param_setting(self):
+        '''Parameter handling via recipe setting'''
+        self.recipe.param.stropt = 'more'
+        res = self.recipe(self.raw_frame).THE_PRO_CATG_VALUE
+        self.assertEqual(res[0].header['HIERARCH ESO QC STROPT'], 'more')
+
+    def test_param_delete(self):
+        '''Delete a parameter in a second run after setting it'''
+        self.recipe.param.intopt = 123
+        res = self.recipe(self.raw_frame).THE_PRO_CATG_VALUE
+        del self.recipe.param.intopt
+        res = self.recipe(self.raw_frame).THE_PRO_CATG_VALUE
+        self.assertEqual(res[0].header['HIERARCH ESO QC INTOPT'], 2)
+
+    def test_param_overwrite(self):
+        '''Overwrite the recipe setting param via via keyword arg'''
+        self.recipe.param.stropt = 'more'
+        res = self.recipe(self.raw_frame, param_stropt = 'less').THE_PRO_CATG_VALUE
+        self.assertEqual(res[0].header['HIERARCH ESO QC STROPT'], 'less')
+
+    def test_param_types(self):
+        '''Parameter types'''
+        self.recipe.param.stropt = 'more'
+        self.recipe.param.boolopt = False
+        self.recipe.param.intopt = 123
+        self.recipe.param.floatopt = -0.25
+        self.recipe.param.enumopt = 'third'
+        self.recipe.param.rangeopt = 0.125
+        res = self.recipe(self.raw_frame).THE_PRO_CATG_VALUE
+        self.assertEqual(res[0].header['HIERARCH ESO QC STROPT'], 'more')
+        self.assertEqual(res[0].header['HIERARCH ESO QC BOOLOPT'], False)
+        self.assertEqual(res[0].header['HIERARCH ESO QC INTOPT'], 123)
+        self.assertEqual(res[0].header['HIERARCH ESO QC FLOATOPT'], -0.25)
+        self.assertEqual(res[0].header['HIERARCH ESO QC ENUMOPT'], 'third')
+        self.assertEqual(res[0].header['HIERARCH ESO QC RANGEOPT'], 0.125)
+        
+    def test_error(self):
+        '''Error handling'''
+        self.recipe.tag = 'some_unknown_tag'
+        self.assertRaises(cpl.CplError, self.recipe, self.raw_frame)
+
+    def test_crash(self):
+        '''Handling of recipe crashes'''
+        self.recipe.param.crashing = 'free'
+        self.assertRaises(cpl.RecipeCrash, self.recipe, self.raw_frame)
+        self.recipe.param.crashing = 'segfault'
+        self.assertRaises(cpl.RecipeCrash, self.recipe, self.raw_frame)
+
+    def test_parallel(self):
+        '''Parallel execution'''
+        results = list()
+        for i in range(20):
+            # mark each frame so that we can see their order
+            self.raw_frame[0].header.update('HIERARCH ESO RAW1 NR', i)
+            results.append(self.recipe(self.raw_frame, param_intopt = i,
+                                       threaded = True))
+        for i, res in enumerate(results):
+            # check if we got the correct type
+            self.assertTrue(isinstance(res.THE_PRO_CATG_VALUE, pyfits.HDUList))
+            # check if we have the correct parameter
+            self.assertEqual(res.THE_PRO_CATG_VALUE[0].header[
+                    'HIERARCH ESO QC INTOPT'], i)
+            # check if we have the correct input frame
+            self.assertEqual(res.THE_PRO_CATG_VALUE[0].header[
+                    'HIERARCH ESO RAW1 NR'], i)
+            # check that the data were moved correctly
+            self.assertTrue(abs(self.raw_frame[0].data 
+                                - res.THE_PRO_CATG_VALUE[0].data).max() < 1e-6)
+
+    def test_error_parallel(self):
+        '''Error handling in parallel execution'''
+        self.recipe.tag = 'some_unknown_tag'
+        res = self.recipe(self.raw_frame, threaded = True)
+        def get(x):
+            return x.THE_PRO_CATG_VALUE
+        self.assertRaises(cpl.CplError, get, res)
+
+    def test_md5sum_result(self):
+        '''MD5sum of the result file'''
+        self.recipe.tag = 'RRRECIPE_DOCATG_RAW'
+        res = self.recipe(self.raw_frame)
+        key = 'DATAMD5'
+        md5sum = res.THE_PRO_CATG_VALUE[0].header[key]
+        self.assertNotEqual(md5sum, 'Not computed')
+        self.assertEqual(len(md5sum), 
+                         len('9d123996fa9a7bda315d07e063043454'))
+
+    def test_md5sum_calib(self):
+        '''Created MD5sum for a HDUList calib file'''
+        self.recipe.tag = 'RRRECIPE_DOCATG_RAW'
+        self.recipe.calib.FLAT = self.flat_frame
+        res = self.recipe(self.raw_frame)
+        key = 'HIERARCH ESO PRO REC1 CAL1 DATAMD5'
+        md5sum = res.THE_PRO_CATG_VALUE[0].header[key]
+        self.assertNotEqual(md5sum, 'Not computed')
+        self.assertEqual(len(md5sum), 
+                         len('9d123996fa9a7bda315d07e063043454'))
+
+class RecipeRes(RecipeTestCase):
+    def setUp(self):
+        RecipeTestCase.setUp(self)
+        self.res = self.recipe(self.raw_frame)
+
+    def test_attribute(self):
+        '''The result as an attribute'''
+        self.assertTrue(isinstance(self.res.THE_PRO_CATG_VALUE, 
+                                   pyfits.HDUList))
+
+    def test_dict(self):
+        '''The result as an attribute'''
+        self.assertTrue(isinstance(self.res['THE_PRO_CATG_VALUE'], 
+                                   pyfits.HDUList))
+
+    def test_len(self):
+        '''Length of the result'''
+        self.assertEqual(len(self.res), 1)
+
+    def test_iter(self):
+        '''Iterate over the result'''
+        for tag, hdu in self.res:
+            self.assertEqual(tag, 'THE_PRO_CATG_VALUE')
+            self.assertTrue(isinstance(hdu, pyfits.HDUList))
+
+class RecipeEsorex(CplTestCase):
+    def tearDown(self):
+        CplTestCase.tearDown(self)
+        cpl.msg.level = cpl.msg.OFF
+
+    def test_read_sof(self):
+        '''Read a SOF file'''
+        soffile = 'geometry_table1.fits GEOMETRY_TABLE\n' \
+            'geometry_table2.fits GEOMETRY_TABLE\n' \
+            'MASTER_BIAS-01.fits MASTER_BIAS\n' \
+            'MASTER_FLAT-01.fits MASTER_FLAT\n' \
+            '#sky_fullmoon_1.fits          SKY\n' \
+            'sky_fullmoon_2.fits          SKY\n'
+        self.assertEqual(cpl.esorex.load_sof(soffile),
+                         { 'GEOMETRY_TABLE': ['geometry_table1.fits',
+                                              'geometry_table2.fits' ],
+                           'MASTER_BIAS': 'MASTER_BIAS-01.fits',
+                           'MASTER_FLAT': 'MASTER_FLAT-01.fits',
+                           'SKY': 'sky_fullmoon_2.fits' })
+                           
+    def test_read_rc(self):
+        '''Read an EsoRec .rc file'''
+        rcfile = '# environment variable lambda_low.\n' \
+        'muse.muse_sky.lambda_low=4.65e+03\n' \
+        'muse.muse_sky.lambda_high=9.3e+03\n'
+        self.assertEqual(cpl.esorex.load_rc(rcfile), 
+                         { 'muse.muse_sky.lambda_low': '4.65e+03',
+                           'muse.muse_sky.lambda_high': '9.3e+03'})
+        
+    def test_esorex_init(self):
+        '''Init CPL from an esorex.rc file'''
+        rcfile = 'esorex.caller.recipe-dir=/some/dir\n' \
+        'esorex.caller.msg-level=debug'
+        cpl.esorex.init(rcfile)
+        self.assertEqual(cpl.msg.level, cpl.msg.DEBUG)
+        self.assertEqual(cpl.Recipe.path, ['/some/dir'])
+
+class RecipeLog(RecipeTestCase):
+    def setUp(self):
+        RecipeTestCase.setUp(self)
+        self.handler = RecipeLog.THandler()
+        logging.getLogger('cpl.rrrecipe').addHandler(self.handler)
+        self.other_handler = RecipeLog.THandler()
+        logging.getLogger('othername').addHandler(self.other_handler)
+
+    def tearDown(self):
+        RecipeTestCase.tearDown(self)
+        logging.getLogger('cpl.rrrecipe').removeHandler(self.handler)
+        logging.getLogger('othername').removeHandler(self.other_handler)
+
+    class THandler(logging.Handler):
+        def __init__(self):
+            logging.Handler.__init__(self)
+            self.logs = list()
+
+        def emit(self, record):
+            self.logs.append(record)
+
+        def clear(self):
+            self.logs = list()
+
+    def test_logging_DEBUG(self):
+        '''Injection of CPL messages into the python logging system'''
+        logging.getLogger().setLevel(logging.DEBUG)
+        self.recipe(self.raw_frame)
+
+        # check that the logs are not empty
+        self.assertNotEqual(len(self.handler.logs), 0)
+        funcnames = set()
+        lognames = set()
+        for r in self.handler.logs:
+            # Check that we saved the right class
+            self.assertTrue(isinstance(r, logging.LogRecord))
+            # Check that a message was provided
+            self.assertNotEqual(r.msg, None)
+            # Check that a function name was provided
+            self.assertNotEqual(r.funcName, None)
+            funcnames.add(r.funcName)
+            lognames.add(r.name)
+        # Check that we had at least one expected entry
+        self.assertTrue('cpl_dfs_product_save' in funcnames)
+        self.assertTrue('cpl.rrrecipe.cpl_dfs_product_save' in lognames)
+        
+    def test_logging_INFO(self):
+        '''Filtering INFO messages'''
+        self.handler.clear()
+        logging.getLogger('cpl.rrrecipe').setLevel(logging.INFO)
+        self.recipe(self.raw_frame)
+        # check that the logs are not empty
+        self.assertNotEqual(len(self.handler.logs), 0)
+
+    def test_logging_WARN(self):
+        '''Filtering WARN messages'''
+        self.handler.clear()
+        logging.getLogger('cpl.rrrecipe').setLevel(logging.WARN)
+        self.recipe(self.raw_frame)
+        # check that the logs are not empty
+        self.assertNotEqual(len(self.handler.logs), 0)
+
+    def test_logging_ERROR(self):
+        '''Filtering of error messages'''
+        # There is no error msg written by the recipe, so it should be empty.
+        self.handler.clear()
+        logging.getLogger('cpl.rrrecipe').setLevel(logging.ERROR)
+        self.recipe(self.raw_frame)
+        self.assertEqual(len(self.handler.logs), 0)
+
+    def test_logging_common(self):
+        '''Log name specification on recipe call'''
+        self.handler.clear()
+        self.other_handler.clear()
+        self.recipe(self.raw_frame, logname = 'othername')
+        self.assertNotEqual(len(self.other_handler.logs), 0)
+
+    def test_result(self):
+        '''"log" attribute of the result object'''
+        res = self.recipe(self.raw_frame)
+        # Check that we get a not-empty list back
+        self.assertTrue(isinstance(res.log, list))
+        self.assertNotEqual(len(res.log), 0)
+        self.assertTrue(isinstance(res.log[0], logging.LogRecord))
+
+        # Check that we can read debug messages
+        self.assertNotEqual(len(res.log.debug), 0)
+        self.assertTrue(isinstance(res.log.debug[0], str))
+        # Check that we can read info messages
+        self.assertNotEqual(len(res.log.info), 0)
+        self.assertTrue(isinstance(res.log.info[0], str))
+        # Check that we can read warning messages
+        self.assertNotEqual(len(res.log.warning), 0)
+        self.assertTrue(isinstance(res.log.warning[0], str))
+        # Check that there were no error messages
+        self.assertEqual(len(res.log.error), 0)
+
+    def test_error(self):
+        '''"log" attribute of the CplError object'''
+        try:
+            self.recipe('test.fits')
+        except cpl.CplError as res:
+            pass
+        # Check that we get a not-empty list back
+        self.assertTrue(isinstance(res.log, list))
+        self.assertNotEqual(len(res.log), 0)
+        self.assertTrue(isinstance(res.log[0], logging.LogRecord))
+        # Check that we can read debug messages
+        self.assertNotEqual(len(res.log.debug), 0)
+        self.assertTrue(isinstance(res.log.debug[0], str))
+        # Check that we can read info messages
+        self.assertNotEqual(len(res.log.info), 0)
+        self.assertTrue(isinstance(res.log.info[0], str))
+        # Check that we can read warning messages
+        self.assertNotEqual(len(res.log.warning), 0)
+        self.assertTrue(isinstance(res.log.warning[0], str))
+        # Check that we can read error messages
+        self.assertNotEqual(len(res.log.error), 0)
+        self.assertTrue(isinstance(res.log.error[0], str))
+
+class ProcessingInfo(RecipeTestCase):
+    def setUp(self):
+        RecipeTestCase.setUp(self)
+        '''Parameter storage in the result'''
+        self.recipe.param.stropt = 'more'
+        self.recipe.param.boolopt = False
+        self.recipe.param.intopt = 123
+        self.recipe.param.floatopt = -0.25
+        self.recipe.param.enumopt = 'third'
+        self.recipe.param.rangeopt = 0.125
+        self.recipe.calib.FLAT = pyfits.HDUList([
+                pyfits.PrimaryHDU(numpy.random.random_integers(0, 65000,
+                                                          self.image_size))])
+        self.res = self.recipe(self.raw_frame).THE_PRO_CATG_VALUE
+        self.pinfo = cpl.dfs.ProcessingInfo(self.res)
+
+    def test_param(self):
+        '''Parameter information'''
+        self.assertEqual(len(self.pinfo.param), len(self.recipe.param))
+        for p in self.recipe.param:
+            self.assertEqual(self.pinfo.param[p.name], 
+                             p.value if p.value is not None else p.default)
+
+    def test_calib(self):
+        '''Calibration frame information'''
+        self.assertEqual(len(self.pinfo.calib), 1)
+        self.assertEqual(self.pinfo.calib['FLAT'][-5:], '.fits')
+
+    def test_tag(self):
+        '''Input tag information'''
+        self.assertEqual(self.pinfo.tag, self.recipe.tag)
+
+    def test_raw(self):
+        '''Raw file information'''
+        self.assertEqual(self.pinfo.raw[-5:], '.fits')
+
+    def test_name(self):
+        '''Recipe and pipeline name information'''
+        self.assertEqual(self.pinfo.name, self.recipe.__name__)
+        self.assertEqual(self.pinfo.pipeline, 'iiinstrument')
+
+    def test_version(self):
+        '''Version information'''
+        self.assertEqual(self.pinfo.version[0], self.recipe.version[0])
+        self.assertEqual(self.pinfo.cpl_version, 'cpl-%s' % cpl.lib_version)
+
+    def test_md5(self):
+        '''MD5 checksums'''
+        md5sum = self.res[0].header.get('DATAMD5')
+        self.assertEqual(md5sum, self.pinfo.md5sum)
+        md5sum = self.res[0].header.get('HIERARCH ESO PRO REC1 CAL1 DATAMD5')
+        self.assertEqual(md5sum, self.pinfo.md5sums[self.pinfo.calib['FLAT']])
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/test/iiinstrumentp/COPYING b/test/iiinstrumentp/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/test/iiinstrumentp/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/test/iiinstrumentp/Makefile.am b/test/iiinstrumentp/Makefile.am
new file mode 100644
index 0000000..0055bd9
--- /dev/null
+++ b/test/iiinstrumentp/Makefile.am
@@ -0,0 +1,32 @@
+## Process this file with automake to produce Makefile.in
+
+##   This file is part of the iiinstrument Pipeline
+##   Copyright (C) 2002,2003 European Southern Observatory
+
+##   This program is free software; you can redistribute it and/or modify
+##   it under the terms of the GNU General Public License as published by
+##   the Free Software Foundation; either version 2 of the License, or
+##   (at your option) any later version.
+
+##   This program is distributed in the hope that it will be useful,
+##   but WITHOUT ANY WARRANTY; without even the implied warranty of
+##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##   GNU General Public License for more details.
+
+##   You should have received a copy of the GNU General Public License
+##   along with this program; if not, write to the Free Software
+##   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+ACLOCAL_AMFLAGS = -I m4macros
+
+DISTCLEANFILES = *~
+
+SUBDIRS = iiinstrument recipes
+
+EXTRA_DIST = m4macros/eso.m4 m4macros/cpl.m4
+
+libtool: $(LIBTOOL_DEPS)
+	$(SHELL) ./config.status --recheck
+
diff --git a/test/iiinstrumentp/acinclude.m4 b/test/iiinstrumentp/acinclude.m4
new file mode 100644
index 0000000..7eca00c
--- /dev/null
+++ b/test/iiinstrumentp/acinclude.m4
@@ -0,0 +1,154 @@
+# IIINSTRUMENT_SET_PREFIX(PREFIX)
+#---------------------------
+AC_DEFUN([IIINSTRUMENT_SET_PREFIX],
+[
+    unset CDPATH
+    # make $PIPE_HOME the default for the installation
+    AC_PREFIX_DEFAULT($1)
+
+    if test "x$prefix" = "xNONE"; then
+        prefix=$ac_default_prefix
+        ac_configure_args="$ac_configure_args --prefix $prefix"
+    fi
+
+    if test "x$exec_prefix" = "xNONE"; then
+        exec_prefix=$prefix
+    fi
+
+])
+
+
+# IIINSTRUMENT_SET_VERSION_INFO(VERSION, [CURRENT], [REVISION], [AGE])
+#----------------------------------------------------------------
+# Setup various version information, especially the libtool versioning
+AC_DEFUN([IIINSTRUMENT_SET_VERSION_INFO],
+[
+    iiinstrument_version=`echo "$1" | sed -e 's/[[a-z,A-Z]].*$//'`
+
+    iiinstrument_major_version=`echo "$iiinstrument_version" | \
+        sed 's/\([[0-9]]*\).\(.*\)/\1/'`
+    iiinstrument_minor_version=`echo "$iiinstrument_version" | \
+        sed 's/\([[0-9]]*\).\([[0-9]]*\)\(.*\)/\2/'`
+    iiinstrument_micro_version=`echo "$iiinstrument_version" | \
+        sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+
+    if test -z "$iiinstrument_major_version"; then iiinstrument_major_version=0
+    fi
+
+    if test -z "$iiinstrument_minor_version"; then iiinstrument_minor_version=0
+    fi
+
+    if test -z "$iiinstrument_micro_version"; then iiinstrument_micro_version=0
+    fi
+
+    IIINSTRUMENT_VERSION="$iiinstrument_version"
+    IIINSTRUMENT_MAJOR_VERSION=$iiinstrument_major_version
+    IIINSTRUMENT_MINOR_VERSION=$iiinstrument_minor_version
+    IIINSTRUMENT_MICRO_VERSION=$iiinstrument_micro_version
+
+    if test -z "$4"; then IIINSTRUMENT_INTERFACE_AGE=0
+    else IIINSTRUMENT_INTERFACE_AGE="$4"
+    fi
+
+    IIINSTRUMENT_BINARY_AGE=`expr 100 '*' $IIINSTRUMENT_MINOR_VERSION + $IIINSTRUMENT_MICRO_VERSION`
+    IIINSTRUMENT_BINARY_VERSION=`expr 10000 '*' $IIINSTRUMENT_MAJOR_VERSION + \
+                          $IIINSTRUMENT_BINARY_AGE`
+
+    AC_SUBST(IIINSTRUMENT_VERSION)
+    AC_SUBST(IIINSTRUMENT_MAJOR_VERSION)
+    AC_SUBST(IIINSTRUMENT_MINOR_VERSION)
+    AC_SUBST(IIINSTRUMENT_MICRO_VERSION)
+    AC_SUBST(IIINSTRUMENT_INTERFACE_AGE)
+    AC_SUBST(IIINSTRUMENT_BINARY_VERSION)
+    AC_SUBST(IIINSTRUMENT_BINARY_AGE)
+
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_MAJOR_VERSION, $IIINSTRUMENT_MAJOR_VERSION,
+                       [IIINSTRUMENT major version number])
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_MINOR_VERSION, $IIINSTRUMENT_MINOR_VERSION,
+                       [IIINSTRUMENT minor version number])
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_MICRO_VERSION, $IIINSTRUMENT_MICRO_VERSION,
+                       [IIINSTRUMENT micro version number])
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_INTERFACE_AGE, $IIINSTRUMENT_INTERFACE_AGE,
+                       [IIINSTRUMENT interface age])
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_BINARY_VERSION, $IIINSTRUMENT_BINARY_VERSION,
+                       [IIINSTRUMENT binary version number])
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_BINARY_AGE, $IIINSTRUMENT_BINARY_AGE,
+                       [IIINSTRUMENT binary age])
+
+    ESO_SET_LIBRARY_VERSION([$2], [$3], [$4])
+])
+
+
+# IIINSTRUMENT_SET_PATHS
+#------------------
+# Define auxiliary directories of the installed directory tree.
+AC_DEFUN([IIINSTRUMENT_SET_PATHS],
+[
+
+    if test -z "$plugindir"; then
+        plugindir='${libdir}/${PACKAGE}/plugins/${PACKAGE}-${VERSION}'
+    fi
+
+    if test -z "$htmldir"; then
+        htmldir='${datadir}/doc/${PACKAGE}/html'
+    fi
+
+    if test -z "$configdir"; then
+       configdir='${datadir}/${PACKAGE}/config'
+    fi
+
+    AC_SUBST(plugindir)
+    AC_SUBST(htmldir)
+    AC_SUBST(configdir)
+
+
+    # Define a preprocesor symbol for the plugin search paths
+
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_PLUGIN_DIR, "${PACKAGE}/plugins",
+                       [Plugin directory tree prefix])
+
+    eval plugin_dir="$plugindir"
+    plugin_path=`eval echo $plugin_dir | \
+                sed -e "s/\/${PACKAGE}-${VERSION}.*$//"`
+
+    AC_DEFINE_UNQUOTED(IIINSTRUMENT_PLUGIN_PATH, "$plugin_path",
+                       [Absolute path to the plugin directory tree])
+
+])
+
+
+# IIINSTRUMENT_CREATE_SYMBOLS
+#-----------------------
+# Define include and library related makefile symbols
+AC_DEFUN([IIINSTRUMENT_CREATE_SYMBOLS],
+[
+
+    # Symbols for package include file and library search paths
+
+    IIINSTRUMENT_INCLUDES='-I$(top_srcdir)/iiinstrument'
+    IIINSTRUMENT_LDFLAGS='-L$(top_builddir)/iiinstrument'
+
+    all_includes='$(IIINSTRUMENT_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+    all_ldflags='$(IIINSTRUMENT_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
+
+    # Library aliases
+
+    LIBIIINSTRUMENT='$(top_builddir)/iiinstrument/libiiinstrument.la'
+
+    # Substitute the defined symbols
+
+    AC_SUBST(IIINSTRUMENT_INCLUDES)
+    AC_SUBST(IIINSTRUMENT_LDFLAGS)
+
+    AC_SUBST(LIBIIINSTRUMENT)
+
+    # Check for CPL and user defined libraries
+    AC_REQUIRE([CPL_CHECK_LIBS])
+    AC_REQUIRE([ESO_CHECK_EXTRA_LIBS])
+
+    all_includes='$(IIINSTRUMENT_INCLUDES) $(CPL_INCLUDES) $(EXTRA_INCLUDES)'
+    all_ldflags='$(IIINSTRUMENT_LDFLAGS) $(CPL_LDFLAGS) $(EXTRA_LDFLAGS)'
+
+    AC_SUBST(all_includes)
+    AC_SUBST(all_ldflags)
+])
diff --git a/test/iiinstrumentp/bootstrap b/test/iiinstrumentp/bootstrap
new file mode 100755
index 0000000..b54ae02
--- /dev/null
+++ b/test/iiinstrumentp/bootstrap
@@ -0,0 +1,546 @@
+#! /bin/bash
+#
+# This script is only for the CVS repository to bootstrap the checked
+# out module. It will be deleted before making the distribution.
+#
+
+#set -x
+
+# Helper functions
+
+bt_usage ()
+{
+
+    echo "Usage: $__bt_script $__bt_usage"
+
+}
+
+
+bt_message ()
+{
+
+    echo "$1"
+
+}
+
+
+bt_info ()
+{
+
+    if test $__bt_level -eq 0; then
+        echo "$__bt_script: $1"
+    else
+        echo "$__bt_script[$__bt_level]: $1"
+    fi
+
+}
+
+
+bt_warning ()
+{
+
+    if test $__bt_level -eq 0; then
+        echo "$__bt_script: Warning: $1"
+    else
+        echo "$__bt_script[$__bt_level]: Warning: $1"
+    fi
+
+}
+
+
+bt_error ()
+{
+
+    if test $__bt_level -eq 0; then
+        echo "$__bt_script: Error: $1"
+    else
+        echo "$__bt_script[$__bt_level]: Error: $1"
+    fi
+
+}
+
+
+bt_init ()
+{
+    __bt_script=`basename $0`
+    readonly __bt_script
+
+    __bt_usage="[-hlcCD] [-L level] [-d helpers-dir] [-s subdirs-file]"
+    bt_options="hlcCDL:d:s:"
+    readonly __bt_usage bt_options
+
+    # Recursion level
+    __bt_level=0
+
+    # Default helpers directory
+    bt_auxdir="admin"
+
+    # Default subdirs file
+    bt_subdirs_file="bootdirs"
+
+    # Disable check for maintainer tools
+    bt_check_tools=1
+
+    # Distribution mode (default is to run in maintainer mode)
+    bt_dist_mode=no
+
+    # Local flag (default is to work recursive)
+    bt_run_local=0
+
+    # Copy files flag
+    bt_copy_files="--copy"
+
+    # Process command line
+    set -- `getopt $bt_options $*`
+
+    if test $? != 0; then
+	bt_usage
+	exit 1
+    fi
+
+    for opt in $*; do
+	case $opt in
+	-h) bt_usage
+	    exit 0
+	    ;;
+
+	-l) bt_run_local=1
+	    shift
+	    ;;
+
+	-c) bt_copy_files=""
+	    shift
+	    ;;
+
+	-C) bt_check_tools=0
+	    shift
+	    ;;
+
+	-D) bt_dist_mode=yes
+	    shift
+	    ;;
+
+	-L) __bt_level=$2
+	    shift 2
+	    ;;
+
+	-d) bt_auxdir=$2
+	    shift 2
+	    ;;
+
+	-s) bt_subdirs_file=$2
+	    shift 2
+	    ;;
+
+	--) shift
+	    break
+	    ;;
+	esac
+    done
+
+
+    # Check existance of the helpers directory
+    if test ! -d $bt_auxdir; then
+	mkdir -p $bt_auxdir
+    fi
+
+
+    # Force local mode if subdirs file is missing
+    if test ! -r $bt_subdirs_file; then
+	bt_run_local=1
+    fi
+
+    return 0
+
+}
+
+
+bt_check_autoconf_template ()
+{
+    for f in configure.ac configure.in; do
+	if test -r $f; then
+	    bt_configure=$f
+	    break
+	fi
+    done
+
+    if test -z "$bt_configure"; then
+	bt_error "No GNU autoconf configure template found!"
+	return 1
+    fi
+
+    return 0
+}
+
+
+bt_needs_automake ()
+{
+    bt_use_am=no
+
+    if egrep "^AM_INIT_AUTOMAKE" $bt_configure >/dev/null 2>&1; then
+	if test ! -r Makefile.am; then
+	    bt_error "No GNU automake Makefile template found!"
+	    return 1
+	fi
+
+        bt_use_am=yes
+    fi
+
+    return 0
+}
+
+
+bt_needs_libtool ()
+{
+    bt_use_lt=no
+
+    if egrep "^AC_PROG_LIBTOOL" $bt_configure >/dev/null 2>&1; then
+        bt_use_lt=yes
+    fi
+
+    return 0
+}
+
+
+bt_check_build_tools ()
+{
+
+    bt_info "Checking for maintainer tools..."
+
+    # Temporarily remove the current working directory from PATH
+    save_PATH="$PATH"
+    PATH="`echo $PATH | sed -e 's/^\.://' -e 's/:\.:/:/g' -e 's/:\.$//'`"
+
+    # Autoconf 2.59 or newer
+    bt_autoconf=`which autoconf 2>/dev/null | grep '^/' | head -1`
+    bt_ac_version=`$bt_autoconf --version 2>/dev/null | head -1 \
+    	      | sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
+    
+    if test -z "$bt_ac_version"; then
+        bt_error "GNU autoconf not found in your PATH!"
+        bt_error "You need autoconf 2.59 or newer installed."
+    
+        return 1
+    else
+        save_IFS="$IFS"
+        IFS=.
+        set $bt_ac_version
+        IFS="$save_IFS"
+    
+        if test "$1" -lt 2 || test x"$1" = x2 && test "$2" -lt 59; then
+            bt_error "Installed GNU autoconf $bt_ac_version is too old!"
+            bt_error "You need autoconf 2.59 or newer installed."
+    
+            return 1
+        else
+            bt_info "GNU autoconf $bt_ac_version found."
+            bt_ac_path=`dirname $bt_autoconf`
+            bt_use_ac=yes
+        fi
+    fi
+
+
+    # Automake 1.8 or newer
+    if test x"$bt_use_am" = xyes; then
+
+	bt_automake=`which automake 2>/dev/null | grep '^/' | head -1`
+	bt_am_version=`$bt_automake --version 2>/dev/null | head -1 \
+		      | sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
+
+	if test -z "$bt_am_version"; then
+	    bt_error "GNU automake not found in your PATH!"
+	    bt_error "You need automake 1.8 or newer installed."
+
+	    return 1
+	else
+	    save_IFS="$IFS"
+	    IFS=.
+	    set $bt_am_version
+	    IFS="$save_IFS"
+
+	    if test "$1" -lt 1 || test x"$1" = x1 && test "$2" -lt 8; then
+		bt_error "Installed GNU automake $bt_am_version is too old!"
+		bt_error "You need automake 1.8 or newer installed."
+
+		return 1
+	    else
+		bt_info "GNU automake $bt_am_version found."
+		bt_am_path=`dirname $bt_automake`
+	    fi
+	fi
+    fi
+
+
+    # Libtool 1.5 or newer (optional)
+    if test x"$bt_use_lt" = xyes; then
+
+        for f in glibtool libtool; do
+            bt_libtool=`which $f 2>/dev/null | grep '^/' | head -1`
+            test -n "$bt_libtool" && break
+        done
+
+	bt_lt_version=`$bt_libtool --version 2>/dev/null | head -1 \
+		       | sed -e 's/^[^0-9]*//' -e 's/[- ].*//'`
+
+	if test -z "$bt_lt_version"; then
+	    bt_error "GNU libtool not found in your PATH!"
+	    bt_error "You need libtool 1.5 or newer installed."
+
+	    return 1
+	else
+	    save_IFS="$IFS"
+	    IFS=.
+	    set $bt_lt_version
+	    IFS="$save_IFS"
+
+	    if test "$1" -lt 1 || test x"$1" = x1 && test "$2" -lt 5; then
+		bt_error "Installed GNU libtool $bt_lt_version is too old!"
+		bt_error "You need libtool 1.5 or newer installed."
+
+		return 1
+	    else
+		bt_info "GNU libtool $bt_lt_version found."
+		bt_lt_path=`dirname $bt_libtool`
+	    fi
+	fi
+    fi
+
+    PATH="$save_PATH"
+
+    return 0
+
+}
+
+
+bt_setup_libtool ()
+{
+
+    for f in glibtoolize libtoolize; do
+        bt_libtoolize=`which $f 2>/dev/null | grep '^/' | head -1`
+        test -n "$bt_libtoolize" && break
+    done
+
+    if test x"$bt_libtoolize" = x; then
+	bt_error "GNU libtoolize not found in your PATH!"
+    	return 1
+    else
+	bt_lt_path=`dirname $bt_libtoolize`
+    fi
+
+
+    save_cwd=`pwd`
+    cd $bt_auxdir
+
+    bt_lt_files="config.guess config.sub ltmain.sh"
+
+    for f in $bt_lt_files; do
+	if test ! -f $f; then
+	    bt_run_libtoolize=yes
+	    break
+	fi
+    done
+
+    cd $save_cwd
+
+
+    bt_install_ltdl=" "
+
+    if egrep "^AC_LIBLTDL_CONVENIENCE" $bt_configure >/dev/null 2>&1; then
+	bt_install_ltdl="--ltdl"
+    fi
+
+    if test x"$bt_run_libtoolize" = xyes; then
+	bt_info "Copying libtool files."
+	bt_warning "Do not forget to put these files under version control!"
+
+	$bt_libtoolize --automake $bt_copy_files $bt_install_ltdl
+    fi
+
+    # Setup libltdl if the directory exists
+    if test -d libltdl; then
+	bt_info "Setting up libltdl convenience library ..."
+
+	(cd libltdl; $bt_libtoolize --automake $bt_copy_files; \
+         aclocal && autoheader \
+                 && automake --gnits --add-missing $bt_copy_files \
+                 && autoconf) || return 1
+    fi
+
+    return 0
+
+}
+
+
+bt_create_macro_file ()
+{
+
+    # Sanity check
+    if test x"$bt_check_tools" = x1 && test ! -x $bt_am_path/aclocal; then
+        bt_error "Cannot run aclocal. Check your automake installation!"
+        return 1
+    fi
+
+    # Remove aclocal.m4 if it exists
+    test -f ./aclocal.m4 && rm -f ./aclocal.m4
+
+
+    # Recreate aclocal.m4
+    if test -f ./acinclude.m4 || test x"$bt_use_lt" = xyes; then
+	bt_message "Creating aclocal.m4"
+        bt_aclocal_flags=`egrep "^\ *ACLOCAL_AMFLAGS" Makefile.am | \
+                          sed -e 's/^.*=[ ]*//'`
+        if test -n "bt_aclocal_flags"; then
+            aclocal $bt_aclocal_flags || return 1
+        else
+            aclocal || return 1
+        fi
+    fi
+
+    return 0
+
+}
+
+
+bt_create_configure ()
+{
+
+    # Save existing configure
+    test -f ./configure && cp ./configure ./configure.$$.tmp
+
+    # Create the configure script
+    bt_message "Creating configure"
+    autoconf || return 1
+
+    if test -f ./config.cache && test -f ./configure.$$.tmp; then
+	if cmp ./configure ./configure.$$.tmp; then
+	    bt_warning "configure has changed. Removing file config.cache."
+	    rm -f ./config.cache
+	fi
+    fi
+
+    test -f ./configure.$$.tmp && rm -f ./configure.$$.tmp
+
+    return 0
+
+}
+
+
+bt_create_config_header ()
+{
+
+    # Sanity check
+    if test x"$bt_check_tools" = x1 && test ! -x $bt_ac_path/autoheader; then 
+        bt_error "Cannot run autoheader. Check your autoconf installation!"
+        return 1
+    fi
+
+    if egrep "^AM_CONFIG_HEADER" $bt_configure >/dev/null 2>&1; then
+	bt_message "Creating config.h template"
+	autoheader || return 1
+    fi
+
+    return 0
+
+}
+
+
+bt_create_makefile_templates ()
+{
+
+    bt_message "Creating Makefile templates"
+
+    if test x"$1" != xyes; then
+	automake --foreign --add-missing $bt_copy_files
+    else
+	automake --foreign --include-deps
+    fi
+
+    return 0
+
+}
+
+
+bt_bootstrap_packages ()
+{
+
+    if test -r $bt_subdirs_file; then
+	for bt_dir in `cat $bt_subdirs_file`; do
+	    if test ! -d $bt_dir; then
+		bt_warning "Skipping $bt_dir. Directory does not exist!"
+	    else
+		if test ! -x $bt_dir/bootstrap; then
+		    bt_error "Cannot execute $bt_dir/bootstrap."
+		    return 1
+		else
+                    __bt_level=$(($__bt_level + 1))
+		    bt_info "Entering directory \`$PWD/$bt_dir'"
+		    (cd $bt_dir && ./bootstrap -C -L $__bt_level) || return 1
+		    bt_info "Leaving directory \`$PWD/$bt_dir'"
+                    __bt_level=$(($__bt_level - 1))
+		fi
+	    fi
+	done
+    fi
+		    
+    return 0
+
+}
+
+
+bt_main ()
+{
+
+    # Initialize some variables and process the command line
+    bt_init $* || return 1
+
+    # Sanity check
+    bt_check_autoconf_template || return 1
+
+
+    # Check whether optional tools should be used
+    bt_needs_automake
+    bt_needs_libtool
+
+    # Check maintainer tools
+    if test x$bt_check_tools = x1; then
+	bt_check_build_tools || return 1
+    fi
+
+
+    # Setup maintainer tools
+    if test x"$bt_use_lt" = xyes; then
+	bt_setup_libtool || return 1
+    fi
+
+
+    # Bootstrap local build environment
+    if test x"$__bt_level" = x0; then
+        bt_info "Bootstrapping build tree in \`$PWD' ..."
+    fi
+
+    bt_create_macro_file || return 1
+
+    bt_create_configure || return 1
+
+    bt_create_config_header || return 1
+
+    bt_create_makefile_templates $bt_dist_mode || return 1
+
+    
+    # Bootstrap 3rd party packages
+    bt_bootstrap_packages || return 1
+
+    if test $__bt_level -eq 0; then
+        bt_message ""
+        bt_message "Don't forget to run ./configure"
+        bt_message "If you haven't done so in a while, run ./configure --help"
+        bt_message ""
+    fi
+
+    return 0
+
+}
+
+
+# Call main here
+bt_main $* || exit 1
diff --git a/test/iiinstrumentp/configure.ac b/test/iiinstrumentp/configure.ac
new file mode 100644
index 0000000..3bedbde
--- /dev/null
+++ b/test/iiinstrumentp/configure.ac
@@ -0,0 +1,91 @@
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT([IIINSTRUMENT Instrument Pipeline], [0.0.1], [flastname at eso.org],
+[iiinstrument])
+AC_PREREQ([2.59])
+
+AC_CONFIG_MACRO_DIR([m4macros])
+AC_CONFIG_SRCDIR([Makefile.am])
+AC_CONFIG_AUX_DIR([admin])
+
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+AM_INIT_AUTOMAKE
+AM_CONFIG_HEADER([config.h])
+
+AM_MAINTAINER_MODE
+
+IIINSTRUMENT_SET_PREFIX(${PIPE_HOME:-/usr/local})
+
+# Immediately before every release do:
+#-------------------------------------
+#   if (the interface is totally unchanged from previous release)
+#       REVISION++;
+#   else {
+#       /* interfaces have been added, removed or changed */
+#       REVISION = 0;
+#       CURRENT++;
+#       if (any interfaces have been _added_ since last release)
+#           AGE++;
+#       if (any interfaces have been _removed_ or incompatibly changed)
+#           AGE = 0;
+#   }
+
+IIINSTRUMENT_SET_VERSION_INFO([$VERSION])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_CPP
+AM_PROG_CC_C_O
+AC_PROG_LN_S
+
+#
+# Check for purify
+#
+CHECK_PURIFY
+
+
+ESO_ENABLE_DEBUG(no)
+ESO_ENABLE_STRICT(no)
+ESO_PROG_CC_FLAG([fno-builtin], [CFLAGS="$CFLAGS -fno-builtin"])
+ESO_PROG_CC_FLAG([-std=c99], [CFLAGS="$CFLAGS --std=c99"])
+
+ESO_CHECK_DOCTOOLS
+
+AC_ENABLE_STATIC(no)
+AC_ENABLE_SHARED(yes)
+
+AC_PROG_LIBTOOL
+AC_SUBST(LIBTOOL_DEPS)
+
+# Checks for libraries.
+AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"])
+AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"])
+AC_CHECK_LIB(nsl, inet_ntoa, [LIBS="$LIBS -lnsl"])
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([string.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+
+# Checks for library functions.
+AC_CHECK_FUNCS([floor pow sqrt isinf isnan])
+ESO_FUNC_STRDUP
+
+# Check for CPL presence and usability
+CPL_CHECK_LIBS
+
+IIINSTRUMENT_SET_PATHS
+IIINSTRUMENT_CREATE_SYMBOLS
+
+AM_WITH_DMALLOC
+
+
+AC_CONFIG_FILES(Makefile
+                iiinstrument/Makefile
+                recipes/Makefile)
+AC_OUTPUT
diff --git a/test/iiinstrumentp/iiinstrument/Makefile.am b/test/iiinstrumentp/iiinstrument/Makefile.am
new file mode 100644
index 0000000..0a87ce7
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/Makefile.am
@@ -0,0 +1,42 @@
+## Process this file with automake to produce Makefile.in
+
+##   This file is part of the IIINSTRUMENT Pipeline
+##   Copyright (C) 2002,2003 European Southern Observatory
+
+##   This library is free software; you can redistribute it and/or modify
+##   it under the terms of the GNU General Public License as published by
+##   the Free Software Foundation; either version 2 of the License, or
+##   (at your option) any later version.
+
+##   This program is distributed in the hope that it will be useful,
+##   but WITHOUT ANY WARRANTY; without even the implied warranty of
+##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##   GNU General Public License for more details.
+
+##   You should have received a copy of the GNU General Public License
+##   along with this program; if not, write to the Free Software
+##   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+CPPFLAGS = -DCX_LOG_DOMAIN=\"IiinstrumentLib\"
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS =    iiinstrument_utils.h \
+                    iiinstrument_pfits.h \
+                    iiinstrument_dfs.h
+
+pkginclude_HEADERS =
+
+lib_LTLIBRARIES = libiiinstrument.la
+
+libiiinstrument_la_SOURCES =    iiinstrument_utils.c \
+                                iiinstrument_pfits.c \
+                                iiinstrument_dfs.c
+
+libiiinstrument_la_LDFLAGS = $(CPL_LDFLAGS) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+libiiinstrument_la_LIBADD = $(LIBCPLDFS) $(LIBCPLUI) $(LIBCPLDRS) $(LIBCPLCORE) 
+libiiinstrument_la_DEPENDENCIES =
diff --git a/test/iiinstrumentp/iiinstrument/iiinstrument_dfs.c b/test/iiinstrumentp/iiinstrument/iiinstrument_dfs.c
new file mode 100644
index 0000000..f1ba8b2
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/iiinstrument_dfs.c
@@ -0,0 +1,93 @@
+/* $Id: iiinstrument_dfs.c,v 1.6 2007/07/31 06:10:40 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/31 06:10:40 $
+ * $Revision: 1.6 $
+ * $Name:  $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+                                   Includes
+ -----------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <math.h>
+
+#include <cpl.h>
+
+#include "iiinstrument_dfs.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup iiinstrument_dfs  DFS related functions
+ *
+ * TBD
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Set the group as RAW or CALIB in a frameset
+  @param    set     the input frameset
+  @return   CPL_ERROR_NONE iff OK
+ */
+/*----------------------------------------------------------------------------*/
+cpl_error_code iiinstrument_dfs_set_groups(cpl_frameset * set)
+{
+    cpl_errorstate prestate = cpl_errorstate_get();
+    cpl_frame * frame = NULL;
+    int         i = 0;
+
+
+    /* Loop on frames */
+    for (frame = cpl_frameset_get_first(set); frame != NULL;
+         frame = cpl_frameset_get_next(set), i++) {
+
+        const char * tag = cpl_frame_get_tag(frame);
+
+        if (tag == NULL) {
+            cpl_msg_warning(cpl_func, "Frame %d has no tag", i);
+        } else if (!strcmp(tag, RRRECIPE_RAW)) {
+            /* RAW frames */
+            cpl_frame_set_group(frame, CPL_FRAME_GROUP_RAW);
+        } else if (!strcmp(tag, IIINSTRUMENT_CALIB_FLAT)) {
+            /* CALIB frames */
+            cpl_frame_set_group(frame, CPL_FRAME_GROUP_CALIB);
+        }
+    }
+
+    if (!cpl_errorstate_is_equal(prestate)) {
+        return cpl_error_set_message(cpl_func, cpl_error_get_code(),
+                                     "Could not identify RAW and CALIB "
+                                     "frames");
+    }
+
+    return CPL_ERROR_NONE;
+}
+
+/**@}*/
diff --git a/test/iiinstrumentp/iiinstrument/iiinstrument_dfs.h b/test/iiinstrumentp/iiinstrument/iiinstrument_dfs.h
new file mode 100644
index 0000000..fd0dd8e
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/iiinstrument_dfs.h
@@ -0,0 +1,48 @@
+/* $Id: iiinstrument_dfs.h,v 1.9 2007/07/31 06:10:40 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/31 06:10:40 $
+ * $Revision: 1.9 $
+ * $Name:  $
+ */
+
+#ifndef IIINSTRUMENT_DFS_H
+#define IIINSTRUMENT_DFS_H
+
+/*-----------------------------------------------------------------------------
+                                   Define
+ -----------------------------------------------------------------------------*/
+
+/* Define here the PRO.CATG keywords */
+#define RRRECIPE_XXX_PROCATG            "THE_PRO_CATG_VALUE"
+
+/* Define here the DO.CATG keywords */
+#define RRRECIPE_RAW                    "RRRECIPE_DOCATG_RAW"
+#define IIINSTRUMENT_CALIB_FLAT         "FLAT"
+
+/*-----------------------------------------------------------------------------
+                                Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+cpl_error_code iiinstrument_dfs_set_groups(cpl_frameset *);
+
+#endif
diff --git a/test/iiinstrumentp/iiinstrument/iiinstrument_pfits.c b/test/iiinstrumentp/iiinstrument/iiinstrument_pfits.c
new file mode 100644
index 0000000..cd23ab9
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/iiinstrument_pfits.c
@@ -0,0 +1,88 @@
+/* $Id: iiinstrument_pfits.c,v 1.12 2007/07/31 06:10:40 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/31 06:10:40 $
+ * $Revision: 1.12 $
+ * $Name:  $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+                                   Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+#include "iiinstrument_pfits.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup iiinstrument_pfits     FITS header protected access
+ *
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*-----------------------------------------------------------------------------
+                              Function codes
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    find out the arcfile   
+  @param    plist       property list to read from
+  @return   pointer to statically allocated character string
+ */
+/*----------------------------------------------------------------------------*/
+const char * iiinstrument_pfits_get_arcfile(const cpl_propertylist * plist)
+{
+    const char * value = cpl_propertylist_get_string(plist, "ARCFILE");
+
+    cpl_ensure(value != NULL, cpl_error_get_code(), NULL);
+
+    return value;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    find out the DIT value 
+  @param    plist       property list to read from
+  @return   the requested value
+ */
+/*----------------------------------------------------------------------------*/
+double iiinstrument_pfits_get_dit(const cpl_propertylist * plist)
+{
+    cpl_errorstate prestate = cpl_errorstate_get();
+    const double value = cpl_propertylist_get_double(plist, "ESO DET DIT");
+
+    /* Check for a change in the CPL error state */
+    /* - if it did change then propagate the error and return */
+    cpl_ensure(cpl_errorstate_is_equal(prestate), cpl_error_get_code(), 0.0);
+
+    return value;
+}
+
+/**@}*/
diff --git a/test/iiinstrumentp/iiinstrument/iiinstrument_pfits.h b/test/iiinstrumentp/iiinstrument/iiinstrument_pfits.h
new file mode 100644
index 0000000..0b02ab3
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/iiinstrument_pfits.h
@@ -0,0 +1,44 @@
+/* $Id: iiinstrument_pfits.h,v 1.8 2007/07/31 06:10:40 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/31 06:10:40 $
+ * $Revision: 1.8 $
+ * $Name:  $
+ */
+
+#ifndef IIINSTRUMENT_PFITS_H
+#define IIINSTRUMENT_PFITS_H
+
+/*-----------------------------------------------------------------------------
+                                   Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+                                   Functions prototypes
+ -----------------------------------------------------------------------------*/
+
+const char * iiinstrument_pfits_get_arcfile(const cpl_propertylist *) ;
+double iiinstrument_pfits_get_dit(const cpl_propertylist *) ;
+
+#endif
diff --git a/test/iiinstrumentp/iiinstrument/iiinstrument_utils.c b/test/iiinstrumentp/iiinstrument/iiinstrument_utils.c
new file mode 100644
index 0000000..837db31
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/iiinstrument_utils.c
@@ -0,0 +1,80 @@
+/* $Id: iiinstrument_utils.c,v 1.10 2007/07/31 06:10:40 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/31 06:10:40 $
+ * $Revision: 1.10 $
+ * $Name:  $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+                                   Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+#include "iiinstrument_utils.h"
+
+/*----------------------------------------------------------------------------*/
+/**
+ * @defgroup iiinstrument_utils     Miscellaneous Utilities
+ */
+/*----------------------------------------------------------------------------*/
+
+/**@{*/
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Get the pipeline copyright and license
+  @return   The copyright and license string
+
+  The function returns a pointer to the statically allocated license string.
+  This string should not be modified using the returned pointer.
+ */
+/*----------------------------------------------------------------------------*/
+const char * iiinstrument_get_license(void)
+{
+    const char  *   iiinstrument_license = 
+        "This file is part of the IIINSTRUMENT Instrument Pipeline\n"
+        "Copyright (C) 2002,2003 European Southern Observatory\n"
+        "\n"
+        "This program is free software; you can redistribute it and/or modify\n"
+        "it under the terms of the GNU General Public License as published by\n"
+        "the Free Software Foundation; either version 2 of the License, or\n"
+        "(at your option) any later version.\n"
+        "\n"
+        "This program is distributed in the hope that it will be useful,\n"
+        "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+        "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
+        "GNU General Public License for more details.\n"
+        "\n"
+        "You should have received a copy of the GNU General Public License\n"
+        "along with this program; if not, write to the Free Software\n"
+        "Foundation, Inc., 59 Temple Place, Suite 330, Boston, \n"
+        "MA  02111-1307  USA" ;
+    return iiinstrument_license ;
+}
+
+/**@}*/
diff --git a/test/iiinstrumentp/iiinstrument/iiinstrument_utils.h b/test/iiinstrumentp/iiinstrument/iiinstrument_utils.h
new file mode 100644
index 0000000..9464dd4
--- /dev/null
+++ b/test/iiinstrumentp/iiinstrument/iiinstrument_utils.h
@@ -0,0 +1,43 @@
+/* $Id: iiinstrument_utils.h,v 1.12 2007/07/31 06:10:40 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/31 06:10:40 $
+ * $Revision: 1.12 $
+ * $Name:  $
+ */
+
+#ifndef IIINSTRUMENT_UTILS_H
+#define IIINSTRUMENT_UTILS_H
+
+/*-----------------------------------------------------------------------------
+                                   Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+/*-----------------------------------------------------------------------------
+                                       Prototypes
+ -----------------------------------------------------------------------------*/
+
+const char * iiinstrument_get_license(void) ;
+
+#endif
diff --git a/test/iiinstrumentp/m4macros/cpl.m4 b/test/iiinstrumentp/m4macros/cpl.m4
new file mode 100644
index 0000000..00442b2
--- /dev/null
+++ b/test/iiinstrumentp/m4macros/cpl.m4
@@ -0,0 +1,363 @@
+# CPL_CHECK_CFITSIO
+#------------------
+# Checks for the cfitsio library and header files.
+AC_DEFUN([CPL_CHECK_CFITSIO],
+[
+    cpl_cfitsio_check_header="fitsio.h"
+    # FIXME: Check first for the dynamic library...
+    cpl_cfitsio_check_lib="libcfitsio.so"
+
+    cpl_cfitsio_dir=""
+    cpl_cfitsio_incdirs=""
+    cpl_cfitsio_libdirs=""
+    cpl_cfitsio_includes=""
+    cpl_cfitsio_libraries=""
+
+    # Get the CFITSIO directory from the --with-cfitsio CLI option, or
+    # else fall back on the environment variable $CFITSIODIR
+    AC_ARG_WITH(cfitsio,
+                AC_HELP_STRING([--with-cfitsio],
+                               [location where cfitsio is installed]),
+                [
+                    cpl_cfitsio_dir=$withval
+                ],
+                [
+                    cpl_cfitsio_dir=$CFITSIODIR
+                ])
+
+    # Check for the cfitsio includes, either in include/, include/cfitsio/
+    # or include/libcfitsio0/
+    if test -n "$cpl_cfitsio_dir" ; then
+      AC_MSG_CHECKING([for cfitsio in $cpl_cfitsio_dir])
+      cpl_cfitsio_incdirs="$cpl_cfitsio_dir/include"
+      ESO_FIND_FILE($cpl_cfitsio_check_header, $cpl_cfitsio_incdirs, cpl_cfitsio_includes)
+      if test x"$cpl_cfitsio_includes" = xno; then
+        # include/cfitsio/ is seen on a 64-bit Fedora 10
+        cpl_cfitsio_incdirs="$cpl_cfitsio_dir/include/cfitsio"
+        ESO_FIND_FILE($cpl_cfitsio_check_header, $cpl_cfitsio_incdirs, cpl_cfitsio_includes)
+        if test x"$cpl_cfitsio_includes" = xno; then
+          # include/libcfitsio0/ is seen on a 64-bit Suse
+          cpl_cfitsio_incdirs="$cpl_cfitsio_dir/include/libcfitsio0"
+          ESO_FIND_FILE($cpl_cfitsio_check_header, $cpl_cfitsio_incdirs, cpl_cfitsio_includes)
+        fi
+      fi
+
+      # Check for the cfitsio library, either in lib64/, lib32/ or lib/
+      cpl_cfitsio_libdirs="$cpl_cfitsio_dir/lib64"
+      ESO_FIND_FILE($cpl_cfitsio_check_lib, $cpl_cfitsio_libdirs, cpl_cfitsio_libraries)
+
+      if test x"$cpl_cfitsio_libraries" = xno; then
+        cpl_cfitsio_libdirs="$cpl_cfitsio_dir/lib32"
+        ESO_FIND_FILE($cpl_cfitsio_check_lib, $cpl_cfitsio_libdirs, cpl_cfitsio_libraries)
+        if test x"$cpl_cfitsio_libraries" = xno; then
+          cpl_cfitsio_libdirs="$cpl_cfitsio_dir/lib"
+          ESO_FIND_FILE($cpl_cfitsio_check_lib, $cpl_cfitsio_libdirs, cpl_cfitsio_libraries)
+        fi
+      fi
+
+      if test x"$cpl_cfitsio_includes" = xno || test x"$cpl_cfitsio_libraries" = xno; then
+          AC_MSG_ERROR([cfitsio was not found on your system. Please check!])
+      else
+          AC_MSG_RESULT([libraries $cpl_cfitsio_libraries, headers $cpl_cfitsio_includes])
+          # Attempt to check the version via CFITSIO_VERSION in the include file
+          cpl_cfitsio_check_vers=`perl -nle 's/^#\s*define\s+CFITSIO_VERSION\s+\b// and s/\s.*//, print' $cpl_cfitsio_inclu
+des/fitsio.h`
+         if test -z "$cpl_cfitsio_check_vers" ; then
+           # Attempt to check the version by checking the include files
+           cpl_cfitsio_check_vers=`grep "Version Info: This file is distributed with version 2.510 of CFITSIO" $cpl_cfitsio
+_includes/fitsio.h`
+           if test -z "$cpl_cfitsio_check_vers" ; then
+               AC_MSG_WARN([cfitsio version seems to be different from 2.510 and less than 3.X.])
+           else
+               AC_MSG_WARN([cfitsio version seems to be 2.510])
+           fi
+         else
+            CFLAGS="-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 $CFLAGS"
+         fi
+      fi
+
+      # Set up the symbols
+      CFITSIO_INCLUDES="-I$cpl_cfitsio_includes"
+      CFITSIO_LDFLAGS="-L$cpl_cfitsio_libraries"
+    else
+      AC_CHECK_HEADERS($cpl_cfitsio_check_header,,AC_MSG_ERROR([fitsio.h was not found on your system. Please check!]))
+      AC_SEARCH_LIBS([fits_get_cwd], [cfitsio],,AC_MSG_ERROR([libcfitsio was not found on your system. Please check!]),[-lpthread])
+      CFLAGS="-D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 $CFLAGS"
+    fi
+
+    LIBCFITSIO="-lcfitsio"
+    AC_SUBST(CFITSIO_INCLUDES)
+    AC_SUBST(CFITSIO_LDFLAGS)
+    AC_SUBST(LIBCFITSIO)
+])
+
+# CPL_CHECK_WCS
+#--------------
+# Checks for the wcs library and header files.
+AC_DEFUN([CPL_CHECK_WCS],
+[
+    AC_MSG_CHECKING([for wcs])
+
+    cpl_wcs_check_header="wcslib/wcslib.h"
+    cpl_wcs_check_lib="libwcs.a"
+
+    cpl_wcs_includes=""
+    cpl_wcs_libraries=""
+
+    AC_ARG_WITH(wcs,
+                AC_HELP_STRING([--with-wcs],
+                               [location where wcs is installed]),
+                [
+                    cpl_with_wcs_includes=$withval/include
+                    cpl_with_wcs_libs=$withval/lib
+                ])
+
+    if test -z "$cpl_with_wcs_includes"; then
+        test -n "$WCSDIR" && cpl_wcs_incdirs="$WCSDIR/include"
+    else
+        cpl_wcs_incdirs="$cpl_with_wcs_includes"
+    fi
+
+    if test -z "$cpl_with_wcs_libs"; then
+        test -n "$WCSDIR" && cpl_wcs_libdirs="$WCSDIR/lib"
+    else
+        cpl_wcs_libdirs="$cpl_with_wcs_libs"
+    fi
+
+    if test -n "$cpl_with_wcs_includes"; then
+      # Check for the wcs includes
+      ESO_FIND_FILE($cpl_wcs_check_header, $cpl_wcs_incdirs, cpl_wcs_includes)
+    else
+      AC_CHECK_HEADERS($cpl_wcs_check_header,,cpl_wcs_includes="no")
+    fi
+
+    # Check for the wcs library
+    if test -n "$cpl_with_wcs_libs"; then
+      ESO_FIND_FILE($cpl_wcs_check_lib, $cpl_wcs_libdirs, cpl_wcs_libraries)
+    else
+      AC_SEARCH_LIBS([wcsini], [wcs],,cpl_wcs_libraries="no",)
+    fi
+
+    if test x"$cpl_wcs_includes" = xno || test x"$cpl_wcs_libraries" = xno; then
+        AC_MSG_WARN([wcs was not found on your system.])
+    else
+        AC_MSG_RESULT([libraries $cpl_wcs_libraries, headers $cpl_wcs_includes])
+        if test -n "$cpl_wcs_includes" ; then
+          # Attempt to check the version by checking the include files
+          cpl_wcs_check_vers43=`grep "WCSLIB 4.3 - an implementation of the FITS WCS standard" $cpl_wcs_includes/wcslib/wcslib.h`
+          if test -z "$cpl_wcs_check_vers43" ; then
+              cpl_wcs_check_vers44=`grep "WCSLIB 4.4 - an implementation of the FITS WCS standard" $cpl_wcs_includes/wcslib/wcslib.h`
+              if test -z "$cpl_wcs_check_vers44" ; then
+                  AC_MSG_WARN([wcs version seems to be older than 4.3])
+              fi
+          fi
+        fi
+        AC_DEFINE_UNQUOTED(CPL_WCS_INSTALLED, 1, [Defined if WCS is available])
+        # Set up the symbols
+        if test -n "$cpl_wcs_includes" ; then
+          WCS_INCLUDES="-I$cpl_wcs_includes"
+        fi
+        if test -n "$cpl_wcs_libraries" ; then
+          WCS_LDFLAGS="-L$cpl_wcs_libraries"
+        fi
+        LIBWCS="-lwcs"
+
+        AC_SUBST(WCS_INCLUDES)
+        AC_SUBST(WCS_LDFLAGS)
+        AC_SUBST(LIBWCS)
+    fi
+])
+
+# CPL_CHECK_FFTW
+#--------------
+# Checks for the wcs library and header files.
+AC_DEFUN([CPL_CHECK_FFTW],
+[
+    AC_MSG_CHECKING([for fftw])
+
+    cpl_fftw_check_header="fftw3.h"
+    cpl_fftwf_check_header="fftw3.h"
+    cpl_fftw_check_lib="libfftw3.a"
+    cpl_fftwf_check_lib="libfftw3f.a"
+
+    cpl_fftw_includes=""
+    cpl_fftwf_includes=""
+    cpl_fftw_libraries=""
+    cpl_fftwf_libraries=""
+
+    AC_ARG_WITH(fftw,
+                AC_HELP_STRING([--with-fftw],
+                               [location where fftw is installed]),
+                [
+                    cpl_with_fftw_includes=$withval/include
+                    cpl_with_fftw_libs=$withval/lib
+                ])
+
+    if test -z "$cpl_with_fftw_includes"; then
+        test -n "$FFTWDIR" && cpl_fftw_incdirs="$FFTWDIR/include"
+    else
+        cpl_fftw_incdirs="$cpl_with_fftw_includes"
+    fi
+    if test -z "$cpl_with_fftw_libs"; then
+        test -n "$FFTWDIR" && cpl_fftw_libdirs="$FFTWDIR/lib"
+    else
+        cpl_fftw_libdirs="$cpl_with_fftw_libs"
+    fi
+
+    # Check for the fftw includes
+    if test -n "$cpl_fftw_incdirs"; then
+      ESO_FIND_FILE($cpl_fftw_check_header, $cpl_fftw_incdirs, cpl_fftw_includes)
+      ESO_FIND_FILE($cpl_fftwf_check_header, $cpl_fftw_incdirs, cpl_fftwf_includes)
+    else
+      AC_CHECK_HEADERS($cpl_fftw_check_header,,cpl_fftw_includes="no")
+      AC_CHECK_HEADERS($cpl_fftwf_check_header,,cpl_fftwf_includes="no")
+    fi
+
+    # Check for the fftw library
+    if test -n "$cpl_fftw_libdirs"; then
+      ESO_FIND_FILE($cpl_fftw_check_lib, $cpl_fftw_libdirs, cpl_fftw_libraries)
+      ESO_FIND_FILE($cpl_fftwf_check_lib, $cpl_fftw_libdirs, cpl_fftwf_libraries)
+    else
+      AC_SEARCH_LIBS([fftw_version], [fftw3],,cpl_fftw_libraries="no",)
+      AC_SEARCH_LIBS([fftwf_version], [fftw3f],,cpl_fftwf_libraries="no",)
+    fi
+
+    if test x"$cpl_fftw_includes" = xno || test x"$cpl_fftw_libraries" = xno; then
+        AC_MSG_WARN([fftw (normal-precision) was not found on your system.])
+    else
+        AC_MSG_RESULT([libraries $cpl_fftw_libraries, headers $cpl_fftw_includes])
+        # FIXME: Attempt to check the version
+
+        AC_DEFINE_UNQUOTED(CPL_FFTW_INSTALLED, 1, [Defined if FFTW (normal-precision) is available])
+        # Set up the symbols
+        if test -n "$cpl_fftw_includes"; then
+          FFTW_INCLUDES="-I$cpl_fftw_includes"
+        fi
+        if test -n "$cpl_fftw_libraries"; then
+          FFTW_LDFLAGS="-L$cpl_fftw_libraries"
+        fi
+        LIBFFTW="-lfftw3"
+
+        AC_SUBST(FFTW_INCLUDES)
+        AC_SUBST(FFTW_LDFLAGS)
+        AC_SUBST(LIBFFTW)
+    fi
+
+    if test x"$cpl_fftwf_includes" = xno || test x"$cpl_fftwf_libraries" = xno; then
+        AC_MSG_WARN([fftw (single-precision) was not found on your system.])
+    else
+        AC_MSG_RESULT([libraries $cpl_fftwf_libraries, headers $cpl_fftwf_includes])
+        # FIXME: Attempt to check the version
+
+        AC_DEFINE_UNQUOTED(CPL_FFTWF_INSTALLED, 1, [Defined if FFTW (single-precision) is available])
+        # Set up the symbols
+        if test -n "$cpl_fftwf_includes"; then
+          FFTWF_INCLUDES="-I$cpl_fftwf_includes"
+        fi
+        if test -n "$cpl_fftwf_libraries"; then
+          FFTWF_LDFLAGS="-L$cpl_fftwf_libraries"
+        fi
+        LIBFFTWF="-lfftw3f"
+
+        AC_SUBST(FFTWF_INCLUDES)
+        AC_SUBST(FFTWF_LDFLAGS)
+        AC_SUBST(LIBFFTWF)
+    fi
+
+])
+
+#
+# CPL_CREATE_SYMBOLS(build=[])
+#-----------------------------
+# Sets the Makefile symbols for the CPL libraries. If an argument is
+# provided the symbols are setup for building CPL, if no argument is
+# given (default) the symbols are set for using the libraries
+# for external package development.
+AC_DEFUN([CPL_CREATE_SYMBOLS],
+[
+
+    if test -z "$1"; then
+        LIBCPLCORE='-lcplcore'
+        LIBCPLDRS='-lcpldrs'
+        LIBCPLUI='-lcplui'
+        LIBCPLDFS='-lcpldfs'
+    else
+        LIBCPLCORE='$(top_builddir)/cplcore/libcplcore.la'
+        LIBCPLDRS='$(top_builddir)/cpldrs/libcpldrs.la'
+        LIBCPLUI='$(top_builddir)/cplui/libcplui.la'
+        LIBCPLDFS='$(top_builddir)/cpldfs/libcpldfs.la'
+    fi
+
+   AC_SUBST(LIBCPLCORE)
+   AC_SUBST(LIBCPLDRS)
+   AC_SUBST(LIBCPLUI)
+   AC_SUBST(LIBCPLDFS)
+
+])
+
+
+# CPL_CHECK_LIBS
+#---------------
+# Checks for the CPL libraries and header files.
+AC_DEFUN([CPL_CHECK_LIBS],
+[
+
+    AC_REQUIRE([CPL_CHECK_CFITSIO])
+    
+    cpl_check_cpl_header="cpl.h"
+    cpl_check_cpl_lib="libcplcore.so"
+
+    cpl_incdirs=""
+    cpl_libdirs=""
+    cpl_includes=""
+    cpl_libraries=""
+
+    AC_ARG_WITH(cpl,
+                AC_HELP_STRING([--with-cpl],
+                               [location where CPL is installed]),
+                [
+                    cpl_with_cpl=$withval
+                ])
+
+    if test -n "$cpl_with_cpl" ; then
+      AC_MSG_CHECKING([for CPL])
+      cpl_incdirs="$cpl_with_cpl/include"
+      ESO_FIND_FILE($cpl_check_cpl_header, $cpl_incdirs, cpl_includes)
+        
+      cpl_libdirs="$cpl_with_cpl/lib"
+      ESO_FIND_FILE($cpl_check_cpl_lib, $cpl_libdirs, cpl_libraries)
+
+      if test x"$cpl_includes" = xno || test x"$cpl_libraries" = xno; then
+          cpl_notfound=""
+          if test x"$cpl_includes" = xno; then
+              if test x"$cpl_libraries" = xno; then
+                  cpl_notfound="(headers and libraries)"
+              else
+                  cpl_notfound="(headers)"
+              fi
+          else
+              cpl_notfound="(libraries)"
+          fi
+
+          AC_MSG_ERROR([CPL $cpl_notfound was not found on your system. Please check!])
+      else
+          AC_MSG_RESULT([libraries $cpl_libraries, headers $cpl_includes])
+          # Set up the symbols
+
+          CPL_INCLUDES="-I$cpl_includes"
+          CPL_LDFLAGS="-L$cpl_libraries"
+      fi
+    else
+       AC_CHECK_HEADERS($cpl_check_cpl_header,,AC_MSG_ERROR([cpl.h was not found on your system. Please check!]))
+       AC_SEARCH_LIBS([cpl_init], [cplcore],,AC_MSG_ERROR([libcplcore was not found on your system. Please check!]),)
+    fi
+
+    CPL_CREATE_SYMBOLS
+     AC_SUBST(CPL_INCLUDES)
+    AC_SUBST(CPL_LDFLAGS)
+    AC_SUBST(LIBCPLCORE)
+    AC_SUBST(LIBCPLDRS)
+    AC_SUBST(LIBCPLUI)
+    AC_SUBST(LIBCPLDFS)
+
+])
diff --git a/test/iiinstrumentp/m4macros/eso.m4 b/test/iiinstrumentp/m4macros/eso.m4
new file mode 100644
index 0000000..53cf8d7
--- /dev/null
+++ b/test/iiinstrumentp/m4macros/eso.m4
@@ -0,0 +1,1019 @@
+# ESO_PROG_CC_FLAG(FLAG, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#-----------------------------------------------------------------
+AC_DEFUN([ESO_PROG_CC_FLAG],
+[
+    AC_REQUIRE([AC_PROG_CC])
+
+    flag=`echo $1 | sed 'y%.=/+-%___p_%'`
+    AC_CACHE_CHECK([whether $CC supports -$1],
+                   [eso_cv_prog_cc_$flag],
+                   [
+                       eval "eso_cv_prog_cc_$flag=no"
+                       AC_LANG_PUSH(C)
+
+                       echo 'int main() { return 0; }' >conftest.$ac_ext
+
+                       try_compile="`$CC -$1 -c conftest.$ac_ext 2>&1`"
+                       if test -z "$try_compile"; then
+                           try_link="`$CC -$1 -o conftest$ac_exeext \
+                                    conftest.$ac_ext 2>&1`"
+                           if test -z "$try_link"; then
+                               eval "eso_cv_prog_cc_$flag=yes"
+                           fi
+                       fi
+                       rm -f conftest*
+
+                       AC_LANG_POP(C)
+                   ])
+
+    if eval "test \"`echo '$eso_cv_prog_cc_'$flag`\" = yes"; then
+        :
+        $2
+    else
+        :
+        $3
+    fi
+])
+
+
+# ESO_ENABLE_DEBUG(debug=no)
+#---------------------------
+AC_DEFUN([ESO_ENABLE_DEBUG],
+[
+    AC_REQUIRE([AC_PROG_CC])
+
+    AC_ARG_ENABLE(debug,
+                  AC_HELP_STRING([--enable-debug],
+                                 [creates debugging code [[default=$1]]]),
+                  eso_enable_debug=$enableval, eso_enable_debug=$1)
+
+    AC_CACHE_CHECK([whether debugging code should be created],
+                   eso_cv_enable_debug,
+                   eso_cv_enable_debug=$eso_enable_debug)
+
+    if test x"$eso_cv_enable_debug" = xyes; then
+
+        eso_clean_CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]//g' \
+                                              -e 's/-g[[0-9]]//g' \
+                                              -e 's/-g[[a-z,A-Z]]* / /g' \
+                                              -e 's/-[[Og]]//g'`"
+
+        ESO_PROG_CC_FLAG([g3], [CFLAGS="$CFLAGS -g3"])
+
+        if test x"$eso_cv_prog_cc_g3" = xyes; then
+            CFLAGS="-g3"
+        else
+            if test x"$ac_cv_prog_cc_g" = xyes; then
+                CFLAGS="-g"
+            else
+                CFLAGS=""
+            fi
+        fi
+
+        ESO_PROG_CC_FLAG([ggdb], [CFLAGS="$CFLAGS -ggdb"])
+        ESO_PROG_CC_FLAG([O0], [CFLAGS="$CFLAGS -O0"])
+        ESO_PROG_CC_FLAG([rdynamic], [CFLAGS="$CFLAGS -rdynamic"])
+        ESO_PROG_CC_FLAG([Wall], [CFLAGS="$CFLAGS -Wall"])
+        ESO_PROG_CC_FLAG([W], [CFLAGS="$CFLAGS -W"])
+
+        CFLAGS="$CFLAGS $eso_clean_CFLAGS"
+        ESO_DEBUG_FLAGS="-DESO_ENABLE_DEBUG"
+    else
+        ESO_DEBUG_FLAGS="-DNDEBUG"
+    fi
+
+    AC_SUBST(ESO_DEBUG_FLAGS)
+])
+
+
+# ESO_ENABLE_STRICT(strict=no)
+#-----------------------------
+AC_DEFUN([ESO_ENABLE_STRICT],
+[
+    AC_REQUIRE([AC_PROG_CC])
+
+    AC_ARG_ENABLE(strict,
+                  AC_HELP_STRING([--enable-strict],
+                                 [compiles with strict compiler options (may not work!) [[default=$1]]]),
+                  eso_enable_strict=$enableval, eso_enable_strict=$1)
+
+    AC_CACHE_CHECK([whether strict compiler options should be used],
+                   eso_cv_enable_strict,
+                   eso_cv_enable_strict=$eso_enable_strict)
+
+
+    if test x"$eso_cv_enable_strict" = xyes; then
+        ESO_PROG_CC_FLAG([std=c99], [CFLAGS="$CFLAGS -std=c99"])
+        ESO_PROG_CC_FLAG([pedantic], [CFLAGS="$CFLAGS -pedantic"])
+    fi
+])
+
+
+# ESO_ENABLE_PROFILE(profile=no)
+#-----------------------------
+AC_DEFUN([ESO_ENABLE_PROFILE],
+[
+    AC_REQUIRE([AC_PROG_CC])
+
+    AC_ARG_ENABLE(profile,
+                  AC_HELP_STRING([--enable-profile],
+                                 [compiles with compiler options necessary for profiling (may not work!) [[default=$1]]]),
+                  eso_enable_profile=$enableval, eso_enable_profile=$1)
+
+    AC_CACHE_CHECK([whether profiling compiler options should be used],
+                   eso_cv_enable_profile,
+                   eso_cv_enable_profile=$eso_enable_profile)
+
+
+    if test x"$eso_cv_enable_profile" = xyes; then
+        ESO_PROG_CC_FLAG([pg], [CFLAGS="$CFLAGS -pg"])
+        ESO_PROG_CC_FLAG([g], [CFLAGS="$CFLAGS -g"])
+        ESO_PROG_CC_FLAG([static-libgcc], [CFLAGS="$CFLAGS -static-libgcc"])
+
+        AC_ENABLE_SHARED(no)
+        AC_ENABLE_STATIC(yes)
+    fi
+])
+
+
+# ESO_CHECK_DOCTOOLS
+#-------------------
+AC_DEFUN([ESO_CHECK_DOCTOOLS],
+[
+    AC_ARG_VAR([DOXYGEN], [doxygen command])
+    AC_PATH_PROG([DOXYGEN], [doxygen])
+
+    AC_ARG_VAR([LATEX], [latex command])
+    AC_PATH_PROG([LATEX], [latex])
+
+
+    if test -z "${DOXYGEN}"; then
+        DOXYGEN=":"
+    fi
+
+    if test -z "${LATEX}"; then
+        LATEX=":"
+    fi
+
+])
+
+
+# ESO_PROG_AR
+#------------
+# Checks if ar is in the path
+AC_DEFUN([ESO_PROG_AR],
+[
+    AC_CHECK_PROG(AR, ar, ar, NONE)
+
+    if test x"$AR" = xNONE; then
+        AC_MSG_ERROR([Cannot find \'ar\'])
+    fi
+
+])
+
+
+# ESO_CHECK_EXTRA_LIBS
+#---------------------
+# Check for non-standard headers and libraries
+AC_DEFUN([ESO_CHECK_EXTRA_LIBS],
+[
+
+    AC_ARG_WITH(extra-includes,
+                AC_HELP_STRING([--with-extra-includes=DIR],
+                               [adds non standard include paths]),
+                eso_with_extra_includes=$withval, eso_with_extra_includes=NONE)
+
+    AC_ARG_WITH(extra-libs,
+                AC_HELP_STRING([--with-extra-libs=DIR],
+                              [adds non standard library paths]),
+                eso_with_extra_libs=$withval, eso_with_extra_libs=NONE)
+
+    AC_MSG_CHECKING([for extra includes])
+    AC_CACHE_VAL([eso_cv_with_extra_includes],
+                 [
+                     eso_cv_with_extra_includes=$eso_with_extra_includes
+                 ])
+
+    if test x"$eso_cv_with_extra_includes" != xNONE; then
+        eso_save_IFS=$IFS
+        IFS=':'
+
+        for dir in $eso_cv_with_extra_includes; do
+            EXTRA_INCLUDES="$EXTRA_INCLUDES -I$dir"
+        done
+
+        IFS=$eso_save_IFS
+        AC_MSG_RESULT(added)
+    else
+        AC_MSG_RESULT(no)
+    fi
+
+
+    AC_MSG_CHECKING([for extra libs])
+    AC_CACHE_VAL([eso_cv_with_extra_libs],
+                 [
+                     eso_cv_with_extra_libs=$eso_with_extra_libs
+                 ])
+
+    if test x"$eso_cv_with_extra_libs" != xNONE; then
+        eso_save_IFS=$IFS
+        IFS=':'
+
+        for dir in $eso_cv_with_extra_libs; do
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$dir"
+        done
+
+        IFS=$eso_save_IFS
+        AC_MSG_RESULT(added)
+    else
+        AC_MSG_RESULT(no)
+    fi
+
+])
+
+
+# ESO_CHECK_THREADS_POSIX
+#------------------------
+# Check whether the POSIX threads are available. The cached result is
+# set to 'yes' if either the compiler supports the '-pthread' flag, or linking
+# with the POSIX thread library works, and the header file defining the POSIX
+# threads symbols is present. If POSIX threads are not supported, the
+# result is set to 'no'. Whether the compiler supports POSIX threads,
+# or whether the library, and the header are available is stored in cache
+# variables.  
+AC_DEFUN([ESO_CHECK_THREADS_POSIX],
+[
+    AC_REQUIRE([AC_PROG_CC])
+
+    ESO_PROG_CC_FLAG([pthread], [], [])
+    
+    AC_CHECK_LIB([pthread], [pthread_create],
+                 [eso_threads_have_libpthread=yes],
+                 [eso_threads_have_libpthread=no])
+
+    AC_CHECK_HEADER([pthread.h],
+                    [eso_threads_have_pthread_h=yes],
+                    [eso_threads_have_pthread_h=no])
+
+    if test x"$eso_threads_have_pthread_h" != xyes; then
+        eso_threads_posix=no
+    else
+        if test x"$eso_threads_have_libpthread" != xyes && \
+          test x"$eso_cv_prog_cc_pthread" != xyes; then
+            eso_threads_posix=no
+        else
+            eso_threads_posix=yes
+        fi
+    fi
+    
+    
+    # Setup the POSIX thread symbols
+
+    if test x"$eso_threads_have_pthread_h" = xyes; then
+        AC_DEFINE([HAVE_PTHREAD_H], [1],
+                  [Define to 1 if you have <pthread.h>.])
+    fi
+    
+    if test x"$eso_threads_posix" = xyes; then
+    
+        if test x"$eso_cv_prog_cc_pthread" = xyes; then
+            PTHREAD_CFLAGS="-pthread"
+        else
+            PTHREAD_CFLAGS=""
+        fi
+        
+        if test x"$eso_threads_have_libpthread" = xyes; then
+            LIBPTHREAD="-lpthread"
+        else
+            LIBPTHREAD=""
+        fi
+        
+    fi  
+
+    AC_CACHE_VAL(eso_cv_threads_posix_header,
+                 eso_cv_threads_posix_header=$eso_threads_have_pthread_h)          
+    AC_CACHE_VAL(eso_cv_threads_posix_lib,
+                 eso_cv_threads_posix_lib=$eso_threads_have_libpthread)          
+    AC_CACHE_VAL(eso_cv_threads_posix_flags,
+                 eso_cv_threads_posix_flags=$eso_cv_prog_cc_pthread)          
+    AC_CACHE_VAL(eso_cv_threads_posix,
+                 eso_cv_threads_posix=$eso_threads_posix)
+
+    AC_SUBST(PTHREAD_CFLAGS)
+    AC_SUBST(LIBPTHREAD)
+    
+])
+
+
+# ESO_CHECK_FUNC(FUNCTION, INCLUDES, SYMBOL)
+#-------------------------------------------
+# Checks whether a function is available and declared.
+AC_DEFUN([ESO_CHECK_FUNC],
+[
+
+    AC_LANG_PUSH(C)
+
+    AC_CHECK_DECL($1, [], [], [$2])
+
+    eso_save_CFLAGS="$CFLAGS"
+
+    if test x"$GCC" = xyes; then
+        CFLAGS="$CFLAGS -pedantic-errors"
+    fi
+
+    AC_CHECK_FUNC($1)
+
+    CFLAGS="$eso_save_CFLAGS"
+
+    AC_LANG_POP(C)
+
+    if test x"$ac_cv_have_decl_$1" = xyes &&
+       test x"$ac_cv_func_$1" = xyes; then
+        AC_DEFINE($3)
+    fi
+
+])
+
+
+# ESO_FUNC_VSNPRINTF_C99
+#-----------------------
+# Check whether vsnprintf() has C99 semantics.
+AC_DEFUN([ESO_FUNC_VSNPRINTF_C99],
+[
+
+    AH_TEMPLATE([HAVE_VSNPRINTF_C99],
+                [Define if you have the C99 `vsnprintf' function.])
+
+    AC_CACHE_CHECK([whether vsnprintf has C99 semantics],
+                   [eso_cv_func_vsnprintf_c99],
+                   [
+                       AC_LANG_PUSH(C)
+
+                       eso_cppflags_save="$CPPFLAGS"
+                       eso_cflags_save="$CFLAGS"
+                       eso_ldflags_save="$LDFLAGS"
+                       eso_libs_save="$LIBS"
+
+                      if test x$GCC = xyes; then
+                          CFLAGS="$CFLAGS -pedantic-errors"
+                          CPPFLAGS="$CPPFLAGS $CFLAGS"
+                      fi
+
+                       AC_RUN_IFELSE([[
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+int
+doit(char * s, ...)
+{
+    char buffer[32];
+    va_list args;
+    int q, r;
+
+    va_start(args, s);
+    q = vsnprintf(NULL, 0, s, args);
+    r = vsnprintf(buffer, 5, s, args);
+    va_end(args);
+
+    if (q != 7 || r != 7)
+      exit(1);
+
+    exit(0);
+}
+
+int
+main(void)
+{
+    doit((char*)"1234567");
+    exit(1);
+}
+                                     ]],
+                                     eso_cv_func_vsnprintf_c99=yes,
+                                     eso_cv_func_vsnprintf_c99=no,
+                                     eso_cv_func_vsnprintf_c99=no)
+
+                       CPPFLAGS="$eso_cppflags_save"
+                       CFLAGS="$eso_cflags_save"
+                       LDFLAGS="$eso_ldflags_save"
+                       LIBS="$eso_libs_save"
+
+                       AC_LANG_POP(C)
+                   ])
+
+# Note that the default is to be pessimistic in the case of cross compilation.
+# If you know that the target has a C99 vsnprintf(), you can get around this
+# by setting eso_func_vsnprintf_c99 to yes, as described in the Autoconf
+# manual.
+
+    if test x$eso_cv_func_vsnprintf_c99 = xyes; then
+        AC_DEFINE(HAVE_VSNPRINTF_C99)
+    fi
+
+])
+
+
+# ESO_CHECK_PRINTF_FORMATS
+#-------------------------
+# Checks for printf() format peculiarities.
+AC_DEFUN([ESO_CHECK_PRINTF_FORMATS],
+[
+
+    # Check if string format for NULL is `(null)'
+
+    AH_TEMPLATE([HAVE_PRINTF_STR_FMT_NULL],
+                [Define if printf outputs `(null)' when printing NULL using
+                 `%s'])
+
+    AC_RUN_IFELSE([[
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+    char s[128];
+
+    sprintf(s, "%s", NULL);
+    return strncmp(s, "(null)", 6) ? 1 : 0;
+}
+                  ]],
+                  eso_have_printf_str_format_null=yes,
+                  eso_have_printf_str_format_null=no,
+                  eso_have_printf_str_format_null=no
+                 )
+
+    if test x$eso_have_printf_str_format_null = xyes; then
+        AC_DEFINE(HAVE_PRINTF_STR_FMT_NULL)
+    fi
+
+
+    # Check if pointer format for NULL is `(nil)'
+
+    AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_NIL],
+                [Define if printf outputs `(nil)' when printing NULL using
+                 `%p'])
+
+    AC_RUN_IFELSE([[
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+    char s[128];
+
+    sprintf(s, "%p", NULL);
+    return strncmp(s, "(nil)", 5) ? 1 : 0;
+}
+                  ]],
+                  eso_have_printf_ptr_format_nil=yes,
+                  eso_have_printf_ptr_format_nil=no,
+                  eso_have_printf_ptr_format_nil=no
+                 )
+
+    if test x$eso_have_printf_ptr_format_nil = xyes; then
+        AC_DEFINE(HAVE_PRINTF_PTR_FMT_NIL)
+    fi
+
+
+    # Check if output for `%p' is the same as `%#x'
+
+    AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_ALTERNATE],
+                [Define if printf format `%p' produces the same output as
+                 `%#x' or `%#lx'])
+
+    AC_RUN_IFELSE([[
+#include <stdio.h>
+#include <string.h>
+
+int main()
+{
+    char s1[128], s2[128];
+
+    sprintf(s1, "%p", s1);
+    sprintf(s2, "%#x", s1);
+    return strncmp(s1, s2, 3) ? 1 : 0;
+}
+                  ]],
+                  eso_have_printf_ptr_format_alternate=yes,
+                  eso_have_printf_ptr_format_alternate=no,
+                  eso_have_printf_ptr_format_alternate=no
+                 )
+
+    if test x$eso_have_printf_ptr_format_alternate = xyes; then
+        AC_DEFINE(HAVE_PRINTF_PTR_FMT_ALTERNATE)
+    fi
+
+
+    # Check if pointers are treated as signed
+
+    AH_TEMPLATE([HAVE_PRINTF_PTR_FMT_SIGNED],
+                [Define if printf treats pointers as signed when using a sign
+                 flag])
+
+    AC_RUN_IFELSE([[
+#include <stdio.h>
+
+int main()
+{
+    char s[128];
+
+    sprintf(s, "%+p", s);
+    return s[0] == '+' ? 0 : 1;
+}
+                  ]],
+                  eso_have_printf_ptr_format_signed=yes,
+                  eso_have_printf_ptr_format_signed=no,
+                  eso_have_printf_ptr_format_signed=no
+                 )
+
+    if test x$eso_have_printf_ptr_format_signed = xyes; then
+        AC_DEFINE(HAVE_PRINTF_PTR_FMT_SIGNED)
+    fi
+
+
+    # Check if default precision for conversion specifier `g' is 1 (as
+    # required by ISO C) or 6.
+
+    AH_TEMPLATE([HAVE_PRINTF_FLT_FMT_G_STD],
+                [Define if printf default precision for format `g' is 1
+                 (ISO C standard) or 6])
+
+    AC_RUN_IFELSE([[
+#include <stdio.h>
+
+int main()
+{
+    char s1[128], s2[128];
+    int n1, n2;
+
+    sprintf(s1, "%g%n", 1.123456, &n1);
+    sprintf(s2, "%.1g%n", 1.123456, &n2);
+    return n1 > n2 ? 1 : 0;
+}
+                  ]],
+                  eso_have_printf_flt_format_g_std=yes,
+                  eso_have_printf_flt_format_g_std=no,
+                  eso_have_printf_flt_format_g_std=no
+                 )
+
+    if test x$eso_have_printf_flt_format_g_std = xyes; then
+        AC_DEFINE(HAVE_PRINTF_FLT_FMT_G_STD)
+    fi
+
+])
+
+
+# ESO_FUNC_VSNPRINTF
+#-------------------
+# Checks for vsnprintf and snprintf declaration and function.
+AC_DEFUN([ESO_FUNC_VSNPRINTF],
+[
+
+    eso_compile_snprintf=no
+
+    AH_TEMPLATE([HAVE_VSNPRINTF],
+                [Define if you have the `vsnprintf' function])
+    ESO_CHECK_FUNC(vsnprintf, [
+#include <stdio.h>
+#include <stdarg.h>
+                              ], HAVE_VSNPRINTF)
+
+    if test x$ac_cv_func_vsnprintf = xyes &&
+       test x$ac_cv_have_decl_vsnprintf = xyes; then
+
+        ESO_FUNC_VSNPRINTF_C99
+
+        if test x$eso_cv_func_vsnprintf_c99 != xyes; then
+            eso_compile_snprintf=yes
+        fi
+
+    else
+        eso_compile_snprintf=yes
+    fi
+
+    if test x$eso_compile_snprintf = xyes; then
+        if test -n "$LIBTOOL"; then
+            SNPRINTF=snprintf.lo
+        else
+            SNPRINTF=snprintf.$ac_objext
+        fi
+    fi
+
+    AC_SUBST(SNPRINTF)
+
+    # The symbols defined by the following macro are only needed to setup the
+    # vsnprintf() replacement. May be useless if the vsnprintf implementation
+    # changes.
+    ESO_CHECK_PRINTF_FORMATS
+
+    AH_TEMPLATE([HAVE_SNPRINTF],
+                [Define if you have the `snprintf' function])
+    ESO_CHECK_FUNC(snprintf, [#include <stdio.h>], HAVE_SNPRINTF)
+
+])
+
+
+# ESO_FUNC_VASPRINTF
+#-------------------
+# Checks for vasprintf declaration and function.
+AC_DEFUN([ESO_FUNC_VASPRINTF],
+[
+
+    AH_TEMPLATE([HAVE_VASPRINTF],
+                [Define if you have the `vasprintf' function])
+    ESO_CHECK_FUNC(vasprintf, [
+#include <stdio.h>
+#include <stdarg.h>
+                              ], HAVE_VASPRINTF)
+
+])
+
+
+# ESO_FUNC_FPATHCONF
+#-------------------
+# Checks for fpathconf declaration and function.
+AC_DEFUN([ESO_FUNC_FPATHCONF],
+[
+
+    AH_TEMPLATE([HAVE_FPATHCONF],
+                [Define if you have the `fpathconf' function])
+    ESO_CHECK_FUNC(fpathconf, [#include <unistd.h>], HAVE_FPATHCONF)
+
+    # If we have fpathconf we should also have pathconf, but who knows.
+    AH_TEMPLATE([HAVE_PATHCONF],
+                [Define if you have the `pathconf' function])
+    ESO_CHECK_FUNC(pathconf, [#include <unistd.h>], HAVE_PATHCONF)
+
+])
+
+
+# ESO_FUNC_SYSCONF
+#-----------------
+# Checks for sysconf declaration and function.
+AC_DEFUN([ESO_FUNC_SYSCONF],
+[
+
+    AH_TEMPLATE([HAVE_SYSCONF],
+                [Define if you have the `sysconf' function])
+    ESO_CHECK_FUNC(sysconf, [#include <unistd.h>], HAVE_SYSCONF)
+
+])
+
+
+# ESO_FUNC_GETOPT
+#----------------
+# Checks for GNU getopt_long declaration and function.
+AC_DEFUN([ESO_FUNC_GETOPT],
+[
+
+    AH_TEMPLATE([HAVE_GETOPT_LONG],
+                [Define if you have the `getopt_long' function])
+
+    ESO_CHECK_FUNC(getopt_long, [#include <getopt.h>], HAVE_GETOPT_LONG)
+
+    if test x"$ac_cv_func_getopt_long" = xno ||
+       test x"$eso_cv_have_decl_getopt_long" = xno; then
+        if test -n "$LIBTOOL"; then
+            GETOPT="getopt.lo getopt1.lo"
+        else
+            GETOPT="getopt.$ac_objext getopt1.$ac_objext"
+        fi
+    fi
+
+    AC_SUBST(GETOPT)
+
+
+])
+
+
+# ESO_FUNC_GETPWUID
+#------------------
+# Checks for getpwuid declaration and function.
+AC_DEFUN([ESO_FUNC_GETPWUID],
+[
+
+    AH_TEMPLATE([HAVE_GETPWUID],
+                [Define if you have the `getpwuid' function])
+
+    ESO_CHECK_FUNC(getpwuid, [#include <pwd.h>], HAVE_GETPWUID)
+
+])
+
+
+# ESO_FUNC_GETUID
+#----------------
+AC_DEFUN([ESO_FUNC_GETUID],
+[
+
+    AH_TEMPLATE([HAVE_GETUID],
+                [Define if you have the `getuid' function])
+
+    ESO_CHECK_FUNC(getuid, [#include <unistd.h>], HAVE_GETUID)
+
+])
+
+
+# ESO_FUNC_LSTAT
+#---------------
+AC_DEFUN([ESO_FUNC_LSTAT],
+[
+
+    AH_TEMPLATE([HAVE_LSTAT],
+                [Define if you have the `lstat' function])
+
+    ESO_CHECK_FUNC(lstat, [#include <sys/stat.h>], HAVE_LSTAT)
+
+])
+
+
+# ESO_FUNC_STRDUP
+#----------------
+AC_DEFUN([ESO_FUNC_STRDUP],
+[
+
+    AH_TEMPLATE([HAVE_STRDUP],
+                [Define if you have the `strdup' function])
+
+    ESO_CHECK_FUNC(strdup, [#include <string.h>], HAVE_STRDUP)
+
+    AH_BOTTOM([
+#ifndef HAVE_STRDUP
+#  define strdup  cx_strdup
+#endif
+              ])
+])
+
+
+# ESO_FUNC_STPCPY
+#----------------
+AC_DEFUN([ESO_FUNC_STPCPY],
+[
+
+    AH_TEMPLATE([HAVE_STPCPY],
+                [Define if you have the `stpcpy' function])
+
+    ESO_CHECK_FUNC(stpcpy, [#include <stpcpy.h>], HAVE_STPCPY)
+
+])
+
+
+# ESO_FUNC_SYMLINK
+#-----------------
+AC_DEFUN([ESO_FUNC_SYMLINK],
+[
+
+    AH_TEMPLATE([HAVE_SYMLINK],
+                [Define if you have the `symlink' function])
+
+    ESO_CHECK_FUNC(symlink, [#include <unistd.h>], HAVE_SYMLINK)
+
+])
+
+
+# ESO_FUNC_WORDEXP
+#-----------------
+AC_DEFUN([ESO_FUNC_WORDEXP],
+[
+
+    AH_TEMPLATE([HAVE_WORDEXP],
+                [Define if you have the `wordexp' function])
+
+    ESO_CHECK_FUNC(wordexp, [#include <wordexp.h>], HAVE_WORDEXP)
+
+])
+
+
+# ESO_FUNC_GETTIMEOFDAY
+#----------------------
+AC_DEFUN([ESO_FUNC_GETTIMEOFDAY],
+[
+
+    AH_TEMPLATE([HAVE_GETTIMEOFDAY],
+                [Define if you have the `gettimeofday' function])
+
+    ESO_CHECK_FUNC(gettimeofday,
+                   [
+                       #include <unistd.h>
+                       #include <sys/time.h>
+                   ],
+                   HAVE_GETTIMEOFDAY)
+])
+
+
+# ESO_FUNC_VA_COPY(symbol)
+#-------------------------
+# Check for an implementation of va_copy(). The argument which must be
+# given is the preprocessor symbol that is defined to be either va_copy
+# or __va_copy depending on the available function, provided that an
+# implementation of va_copy is available at all.
+AC_DEFUN([ESO_FUNC_VA_COPY],
+[
+
+    # Check for all three va_copy possibilities, so we get
+    # all results in config.log for bug reports.
+
+    # Check for availability of va_copy(). This is ISO C. Available with
+    # gcc since version 3.0.
+    AC_CACHE_CHECK([for an implementation of va_copy()], eso_cv_have_va_copy,
+                   [
+                       AC_RUN_IFELSE([
+#include <stdarg.h>
+
+void f(int i, ...)
+{
+    va_list args1, args2;
+    va_start (args1, i);
+    va_copy (args2, args1);
+
+    if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+        exit (1);
+
+    va_end (args1);
+    va_end (args2);
+}
+
+int main() {
+  f(0, 42);
+  return 0;
+}
+                                     ],
+                                     eso_cv_have_va_copy=yes,
+                                     eso_cv_have_va_copy=no,
+                                     eso_cv_have_va_copy=no)
+                   ])
+
+
+    # Check for availability of __va_copy(). Some compilers provide
+    # this. Available with gcc since version 2.8.1.
+    AC_CACHE_CHECK([for an implementation of __va_copy()],
+                   eso_cv_have__va_copy,
+                   [
+                       AC_RUN_IFELSE([
+#include <stdarg.h>
+
+void f(int i, ...)
+{
+    va_list args1, args2;
+
+    va_start (args1, i);
+    __va_copy (args2, args1);
+
+    if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+        exit (1);
+
+    va_end (args1);
+    va_end (args2);
+}
+
+int main()
+{
+    f(0, 42);
+    return 0;
+}
+                                     ],
+                                     eso_cv_have__va_copy=yes,
+                                     eso_cv_have__va_copy=no,
+                                     eso_cv_have__va_copy=no)
+
+                   ])
+
+    if test "x$eso_cv_have_va_copy" = "xyes"; then
+        eso_func_va_copy=va_copy
+    else
+        if test "x$eso_cv_have__va_copy" = "xyes"; then
+            eso_func_va_copy=__va_copy
+        fi
+    fi
+
+    AH_TEMPLATE([HAVE_VA_COPY],
+                [Define if you have an implementation of a `va_copy()' style
+                 function.])
+    AH_TEMPLATE([$1], [A `va_copy()' style function])
+
+    if test -n "$eso_func_va_copy"; then
+        AC_DEFINE_UNQUOTED([$1], $eso_func_va_copy)
+        AC_DEFINE(HAVE_VA_COPY)
+    fi
+
+    # Check whether va_lists can be copied by value
+    AC_CACHE_CHECK([whether va_lists can be copied by value],
+                   eso_cv_have_va_value_copy,
+                   [
+                       AC_RUN_IFELSE([
+#include <stdarg.h>
+
+void f(int i, ...)
+{
+    va_list args1, args2;
+    va_start (args1, i);
+    args2 = args1;
+
+    if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
+        exit (1);
+
+    va_end (args1);
+    va_end (args2);
+}
+
+int main()
+{
+  f(0, 42);
+  return 0;
+}
+                                     ],
+                                     eso_cv_have_va_value_copy=yes,
+                                     eso_cv_have_va_val_copy=no,
+                                     eso_cv_have_va_val_copy=no)
+                   ])
+
+    AH_TEMPLATE([HAVE_VA_LIST_COPY_BY_VALUE],
+                [Define if `va_lists' can be copied by value])
+    if test "x$eso_cv_have_va_value_copy" = "xyes"; then
+        AC_DEFINE(HAVE_VA_LIST_COPY_BY_VALUE)
+    fi
+
+])
+
+
+# ESO_FUNC_REALLOC_SANITY
+#-------------------------
+# Check whether realloc(NULL,) works.
+AC_DEFUN([ESO_FUNC_REALLOC_SANITY],
+[
+    AC_CACHE_CHECK([whether realloc(NULL,) works],
+                   eso_cv_have_sane_realloc,
+                   [
+                       AC_RUN_IFELSE([
+#include <stdlib.h>
+
+int main()
+{
+    return realloc (0, sizeof (int)) == 0;
+}
+                                     ],
+                                     eso_cv_have_sane_realloc=yes,
+                                     eso_cv_have_sane_realloc=no,
+                                     eso_cv_have_sane_realloc=no)
+                   ])
+
+    AH_TEMPLATE([HAVE_WORKING_REALLOC],
+                [Define if realloc(NULL,) works])
+
+    if test x$eso_cv_have_sane_realloc = xyes; then
+        AC_DEFINE(HAVE_WORKING_REALLOC)
+    fi
+
+])
+
+
+# ESO_FIND_FILE(file, directories, variable)
+#------------------------------------------
+# Search for file in directories. Set variable to the first location
+# where file was found, if file is not found at all variable is set to NO.
+AC_DEFUN([ESO_FIND_FILE],
+[
+    $3=no
+
+    for i in $2; do
+        for j in $1; do
+
+            echo "configure: __oline__: $i/$j" >&AC_FD_CC
+
+            if test -r "$i/$j"; then
+                echo "taking that" >&AC_FD_CC
+                $3=$i
+                break 2
+            fi
+        done
+    done
+])
+
+
+# ESO_SET_LIBRARY_VERSION([CURRENT], [REVISION], [AGE])
+#------------------------------------------------------
+# Sets the libtool versioning symbols LT_CURRENT, LT_REVISION, LT_AGE.
+AC_DEFUN([ESO_SET_LIBRARY_VERSION],
+[
+
+    if test -z "$1"; then
+        LT_CURRENT=0
+    else
+        LT_CURRENT="$1"
+    fi
+
+    if test -z "$2"; then
+        LT_REVISION=0
+    else
+        LT_REVISION="$2"
+    fi
+
+    if test -z "$3"; then
+        LT_AGE=0
+    else
+        LT_AGE="$3"
+    fi
+
+    AC_SUBST(LT_CURRENT)
+    AC_SUBST(LT_REVISION)
+    AC_SUBST(LT_AGE)
+])
diff --git a/test/iiinstrumentp/recipes/Makefile.am b/test/iiinstrumentp/recipes/Makefile.am
new file mode 100644
index 0000000..b240fe9
--- /dev/null
+++ b/test/iiinstrumentp/recipes/Makefile.am
@@ -0,0 +1,33 @@
+## Process this file with automake to produce Makefile.in
+
+##   This file is part of the IIINSTRUMENT Pipeline
+##   Copyright (C) 2002,2003 European Southern Observatory
+
+##   This library is free software; you can redistribute it and/or modify
+##   it under the terms of the GNU General Public License as published by
+##   the Free Software Foundation; either version 2 of the License, or
+##   (at your option) any later version.
+
+##   This program is distributed in the hope that it will be useful,
+##   but WITHOUT ANY WARRANTY; without even the implied warranty of
+##   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+##   GNU General Public License for more details.
+
+##   You should have received a copy of the GNU General Public License
+##   along with this program; if not, write to the Free Software
+##   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+AUTOMAKE_OPTIONS = 1.8 foreign
+
+DISTCLEANFILES = *~
+
+INCLUDES = $(all_includes)
+
+noinst_HEADERS = 
+
+plugin_LTLIBRARIES = rrrecipe.la 
+
+rrrecipe_la_SOURCES = rrrecipe.c 
+rrrecipe_la_LIBADD = $(LIBCPLDFS) $(LIBIIINSTRUMENT)
+rrrecipe_la_LDFLAGS = -module -avoid-version
+rrrecipe_la_DEPENDENCIES = $(LIBIIINSTRUMENT)
diff --git a/test/iiinstrumentp/recipes/rrrecipe.c b/test/iiinstrumentp/recipes/rrrecipe.c
new file mode 100644
index 0000000..e6c0147
--- /dev/null
+++ b/test/iiinstrumentp/recipes/rrrecipe.c
@@ -0,0 +1,477 @@
+/* $Id: rrrecipe.c,v 1.28 2007/07/30 07:08:59 llundin Exp $
+ *
+ * This file is part of the IIINSTRUMENT Pipeline
+ * Copyright (C) 2002,2003 European Southern Observatory
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/*
+ * $Author: llundin $
+ * $Date: 2007/07/30 07:08:59 $
+ * $Revision: 1.28 $
+ * $Name:  $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/*-----------------------------------------------------------------------------
+				Includes
+ -----------------------------------------------------------------------------*/
+
+#include <cpl.h>
+
+#include "iiinstrument_utils.h"
+#include "iiinstrument_pfits.h"
+#include "iiinstrument_dfs.h"
+
+/*-----------------------------------------------------------------------------
+			    Private function prototypes
+ -----------------------------------------------------------------------------*/
+
+static int rrrecipe_create(cpl_plugin *);
+static int rrrecipe_exec(cpl_plugin *);
+static int rrrecipe_destroy(cpl_plugin *);
+static int rrrecipe(cpl_frameset *, const cpl_parameterlist *);
+
+/*-----------------------------------------------------------------------------
+			    Static variables
+ -----------------------------------------------------------------------------*/
+
+static char rrrecipe_description[] =
+"This example text is used to describe the recipe.\n"
+"The description should include the required FITS-files and\n"
+"their associated tags, e.g.\n"
+"IIINSTRUMENT-RRRECIPE-raw-file.fits " RRRECIPE_RAW "\n"
+"and any optional files, e.g.\n"
+"IIINSTRUMENT-RRRECIPE-flat-file.fits " IIINSTRUMENT_CALIB_FLAT "\n"
+"\n"
+"Additionally, it should describe functionality of the expected output."
+"\n";
+
+/*-----------------------------------------------------------------------------
+				Function code
+ -----------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Build the list of available plugins, for this module.
+  @param    list    the plugin list
+  @return   0 if everything is ok, 1 otherwise
+  @note     Only this function is exported
+
+  Create the recipe instance and make it available to the application using the
+  interface.
+ */
+/*----------------------------------------------------------------------------*/
+int cpl_plugin_get_info(cpl_pluginlist * list)
+{
+    cpl_recipe  *   recipe = cpl_calloc(1, sizeof *recipe );
+    cpl_plugin  *   plugin = &recipe->interface;
+
+    if (cpl_plugin_init(plugin,
+		    CPL_PLUGIN_API,
+		    IIINSTRUMENT_BINARY_VERSION,
+		    CPL_PLUGIN_TYPE_RECIPE,
+		    "rrrecipe",
+		    "Short description of rrrecipe",
+		    rrrecipe_description,
+		    "Firstname Lastname",
+		    PACKAGE_BUGREPORT,
+		    iiinstrument_get_license(),
+		    rrrecipe_create,
+		    rrrecipe_exec,
+		    rrrecipe_destroy)) {
+	cpl_msg_error(cpl_func, "Plugin initialization failed");
+	(void)cpl_error_set_where(cpl_func);
+	return 1;
+    }
+
+    if (cpl_pluginlist_append(list, plugin)) {
+	cpl_msg_error(cpl_func, "Error adding plugin to list");
+	(void)cpl_error_set_where(cpl_func);
+	return 1;
+    }
+
+    return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Setup the recipe options
+  @param    plugin  the plugin
+  @return   0 if everything is ok
+
+  Defining the command-line/configuration parameters for the recipe.
+ */
+/*----------------------------------------------------------------------------*/
+static int rrrecipe_create(cpl_plugin * plugin)
+{
+    cpl_recipe    * recipe;
+    cpl_parameter * p;
+
+    /* Do not create the recipe if an error code is already set */
+    if (cpl_error_get_code() != CPL_ERROR_NONE) {
+	cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
+		      cpl_func, __LINE__, cpl_error_get_where());
+	return (int)cpl_error_get_code();
+    }
+
+    if (plugin == NULL) {
+	cpl_msg_error(cpl_func, "Null plugin");
+	cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
+    }
+
+    /* Verify plugin type */
+    if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
+	cpl_msg_error(cpl_func, "Plugin is not a recipe");
+	cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
+    }
+
+    /* Get the recipe */
+    recipe = (cpl_recipe *)plugin;
+
+    /* Create the parameters list in the cpl_recipe object */
+    recipe->parameters = cpl_parameterlist_new();
+    if (recipe->parameters == NULL) {
+	cpl_msg_error(cpl_func, "Parameter list allocation failed");
+	cpl_ensure_code(0, (int)CPL_ERROR_ILLEGAL_OUTPUT);
+    }
+
+    /* Fill the parameters list */
+    /* --stropt */
+    p = cpl_parameter_new_value("iiinstrument.rrrecipe.string_option",
+	    CPL_TYPE_STRING, "the string option", "iiinstrument.rrrecipe",NULL);
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "stropt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --boolopt */
+    p = cpl_parameter_new_value("iiinstrument.rrrecipe.bool_option",
+	    CPL_TYPE_BOOL, "a flag", "iiinstrument.rrrecipe", TRUE);
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "boolopt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --floatopt */
+    p = cpl_parameter_new_value("iiinstrument.rrrecipe.float_option",
+	    CPL_TYPE_DOUBLE, "a flag", "iiinstrument.rrrecipe", 0.1);
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "floatopt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --inttopt */
+    p = cpl_parameter_new_value("iiinstrument.rrrecipe.int_option",
+	    CPL_TYPE_INT, "a flag", "iiinstrument.rrrecipe", 2);
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "intopt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --enumopt */
+    p = cpl_parameter_new_enum("iiinstrument.rrrecipe.enum_option",
+	    CPL_TYPE_STRING, "the string option", "iiinstrument.rrrecipe",
+			       "first", 3, "first", "second", "third");
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "enumopt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --rangeopt */
+    p = cpl_parameter_new_range("iiinstrument.rrrecipe.range_option",
+	    CPL_TYPE_DOUBLE, "a flag", "iiinstrument.rrrecipe", 0.1, -0.5, 0.5);
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "rangeopt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --dot.opt */
+    p = cpl_parameter_new_value("iiinstrument.rrrecipe.dotted.opt",
+	    CPL_TYPE_INT, "a flag", "iiinstrument.rrrecipe", 0);
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "dot.opt");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    /* --crashing */
+    p = cpl_parameter_new_enum("iiinstrument.rrrecipe.crashing",
+	  CPL_TYPE_STRING, "Crash the recipe?", "iiinstrument.rrrecipe",
+			       "no", 3, "no", "free", "segfault");
+    cpl_parameter_set_alias(p, CPL_PARAMETER_MODE_CLI, "crashing");
+    cpl_parameter_disable(p, CPL_PARAMETER_MODE_ENV);
+    cpl_parameterlist_append(recipe->parameters, p);
+
+    return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Execute the plugin instance given by the interface
+  @param    plugin  the plugin
+  @return   0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int rrrecipe_exec(cpl_plugin * plugin)
+{
+
+    cpl_recipe * recipe;
+    int recipe_status;
+    cpl_errorstate initial_errorstate = cpl_errorstate_get();
+
+    /* Return immediately if an error code is already set */
+    if (cpl_error_get_code() != CPL_ERROR_NONE) {
+	cpl_msg_error(cpl_func, "%s():%d: An error is already set: %s",
+		      cpl_func, __LINE__, cpl_error_get_where());
+	return (int)cpl_error_get_code();
+    }
+
+    if (plugin == NULL) {
+	cpl_msg_error(cpl_func, "Null plugin");
+	cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
+    }
+
+    /* Verify plugin type */
+    if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
+	cpl_msg_error(cpl_func, "Plugin is not a recipe");
+	cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
+    }
+
+    /* Get the recipe */
+    recipe = (cpl_recipe *)plugin;
+
+    /* Verify parameter and frame lists */
+    if (recipe->parameters == NULL) {
+	cpl_msg_error(cpl_func, "Recipe invoked with NULL parameter list");
+	cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
+    }
+    if (recipe->frames == NULL) {
+	cpl_msg_error(cpl_func, "Recipe invoked with NULL frame set");
+	cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
+    }
+
+    /* Invoke the recipe */
+    recipe_status = rrrecipe(recipe->frames, recipe->parameters);
+
+    /* Ensure DFS-compliance of the products */
+    if (cpl_dfs_update_product_header(recipe->frames)) {
+	if (!recipe_status) recipe_status = (int)cpl_error_get_code();
+    }
+
+    if (!cpl_errorstate_is_equal(initial_errorstate)) {
+	/* Dump the error history since recipe execution start.
+	   At this point the recipe cannot recover from the error */
+	cpl_errorstate_dump(initial_errorstate, CPL_FALSE, NULL);
+    }
+
+    return recipe_status;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Destroy what has been created by the 'create' function
+  @param    plugin  the plugin
+  @return   0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int rrrecipe_destroy(cpl_plugin * plugin)
+{
+    cpl_recipe * recipe;
+
+    if (plugin == NULL) {
+	cpl_msg_error(cpl_func, "Null plugin");
+	cpl_ensure_code(0, (int)CPL_ERROR_NULL_INPUT);
+    }
+
+    /* Verify plugin type */
+    if (cpl_plugin_get_type(plugin) != CPL_PLUGIN_TYPE_RECIPE) {
+	cpl_msg_error(cpl_func, "Plugin is not a recipe");
+	cpl_ensure_code(0, (int)CPL_ERROR_TYPE_MISMATCH);
+    }
+
+    /* Get the recipe */
+    recipe = (cpl_recipe *)plugin;
+
+    cpl_parameterlist_delete(recipe->parameters);
+
+    return 0;
+}
+
+/*----------------------------------------------------------------------------*/
+/**
+  @brief    Interpret the command line options and execute the data processing
+  @param    frameset   the frames list
+  @param    parlist    the parameters list
+  @return   0 if everything is ok
+ */
+/*----------------------------------------------------------------------------*/
+static int rrrecipe(cpl_frameset            * frameset,
+		    const cpl_parameterlist * parlist)
+{
+    const cpl_parameter *   param;
+    const cpl_frame     *   rawframe;
+    const cpl_frame     *   flat;
+    double                  qc_param;
+    cpl_propertylist    *   plist;
+    cpl_propertylist    *   qclist;
+    cpl_image           *   image;
+
+    /* Use the errorstate to detect an error in a function that does not
+       return an error code. */
+    cpl_errorstate          prestate = cpl_errorstate_get();
+
+    /* HOW TO RETRIEVE INPUT PARAMETERS */
+    /* --stropt */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.string_option");
+    const char *str_option = cpl_parameter_get_string(param);
+    cpl_ensure_code(str_option != NULL, CPL_ERROR_NULL_INPUT);
+
+    /* --boolopt */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.bool_option");
+    int bool_option = cpl_parameter_get_bool(param);
+
+    /* --floatopt */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.float_option");
+    double float_option = cpl_parameter_get_double(param);
+
+    /* --intopt */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.int_option");
+    int int_option = cpl_parameter_get_int(param);
+
+    /* --enumopt */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.enum_option");
+    const char *enum_option = cpl_parameter_get_string(param);
+
+    /* --floatopt */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.range_option");
+    double range_option = cpl_parameter_get_double(param);
+
+    /* --crashing */
+    param = cpl_parameterlist_find_const(parlist,
+					 "iiinstrument.rrrecipe.crashing");
+    const char *crashing = cpl_parameter_get_string(param);
+
+    if (!cpl_errorstate_is_equal(prestate)) {
+	return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(),
+					  "Could not retrieve the input "
+					  "parameters");
+    }
+
+    /* Identify the RAW and CALIB frames in the input frameset */
+    cpl_ensure_code(iiinstrument_dfs_set_groups(frameset) == CPL_ERROR_NONE,
+		    cpl_error_get_code());
+
+    /* HOW TO ACCESS INPUT DATA */
+    /*  - A required file */
+    rawframe = cpl_frameset_find_const(frameset, RRRECIPE_RAW);
+    if (rawframe == NULL) {
+	/* cpl_frameset_find_const() does not set an error code, when a frame
+	   is not found, so we will set one here. */
+	return (int)cpl_error_set_message(cpl_func, CPL_ERROR_DATA_NOT_FOUND,
+					  "SOF does not have any file tagged "
+					  "with %s", RRRECIPE_RAW);
+    }
+    /* - A recommended file */
+    flat = cpl_frameset_find(frameset, IIINSTRUMENT_CALIB_FLAT);
+    if (flat == NULL) {
+	cpl_msg_warning(cpl_func, "SOF does not have any file tagged with %s",
+			IIINSTRUMENT_CALIB_FLAT);
+    }
+
+    /* HOW TO GET THE VALUE OF A FITS KEYWORD */
+    /*  - Load only DETector related keys */
+    plist = cpl_propertylist_load_regexp(cpl_frame_get_filename(rawframe),
+					 0, "ESO DET ", 0);
+    if (plist == NULL) {
+	/* In this case an error message is added to the error propagation */
+	return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(),
+					  "Could not read the FITS header");
+    }
+
+    qc_param = iiinstrument_pfits_get_dit(plist);
+    cpl_propertylist_delete(plist);
+
+    /* Check for a change in the CPL error state */
+    /* - if it did change then propagate the error and return */
+    cpl_ensure_code(cpl_errorstate_is_equal(prestate), cpl_error_get_code());
+
+    /* NOW PERFORMING THE DATA REDUCTION */
+    /* Let's just load an image for the example */
+    usleep(10000);
+    image = cpl_image_load(cpl_frame_get_filename(rawframe),
+			   CPL_TYPE_FLOAT, 0, 0);
+    if (image == NULL) {
+	return (int)cpl_error_set_message(cpl_func, cpl_error_get_code(),
+				     "Could not load the image");
+    }
+
+    /* Add QC parameters  */
+    qclist = cpl_propertylist_new();
+
+    cpl_propertylist_append_double(qclist, "ESO QC QCPARAM", qc_param);
+    cpl_propertylist_append_string(qclist, "ESO PRO CATG", RRRECIPE_XXX_PROCATG);
+    if (str_option != NULL) {
+	cpl_propertylist_append_string(qclist, "ESO QC STROPT", str_option);
+    } else {
+	cpl_propertylist_append_string(qclist, "ESO QC STROPT", "(null)");
+    }
+
+    cpl_propertylist_append_bool(qclist, "ESO QC BOOLOPT", bool_option);
+    cpl_propertylist_append_double(qclist, "ESO QC FLOATOPT", float_option);
+    cpl_propertylist_append_int(qclist, "ESO QC INTOPT", int_option);
+    if (enum_option != NULL) {
+	cpl_propertylist_append_string(qclist, "ESO QC ENUMOPT", enum_option);
+    } else {
+	cpl_propertylist_append_string(qclist, "ESO QC ENUMOPT", "(null)");
+    }
+    cpl_propertylist_append_double(qclist, "ESO QC RANGEOPT", range_option);
+
+    prestate = cpl_errorstate_get();
+
+    /* HOW TO SAVE A DFS-COMPLIANT PRODUCT TO DISK  */
+    if (cpl_dfs_save_image(frameset, NULL, parlist, frameset, NULL, image,
+			   CPL_BPP_IEEE_FLOAT,
+			   "rrrecipe", qclist, NULL,
+			   PACKAGE "/" PACKAGE_VERSION,
+			   "rrrecipe.fits")) {
+	/* Propagate the error */
+	(void)cpl_error_set_where(cpl_func);
+    }
+
+    if (!cpl_errorstate_is_equal(prestate)) {
+	cpl_msg_error(__func__, "in cpl_dfs_save_image()");
+    }
+
+    cpl_image_delete(image);
+    cpl_propertylist_delete(qclist);
+
+    /* Let's see if we can crash the machine by some random code */
+    if (strcmp(crashing, "free") == 0) {
+	cpl_image_delete(image);
+	cpl_propertylist_delete(qclist);
+    }
+    if (strcmp(crashing, "segfault") == 0) {
+	double *crashvar = NULL;
+	*crashvar = 1.99;
+    }
+
+    return (int)cpl_error_get_code();
+}

-- 
Control pipeline recipes from the European Southern Observatory



More information about the debian-science-commits mailing list