Executive summary:

	autoconf      (only needed if the file 'configure' is absent)
	configure     (you may need options here to direct it to find cdf and cfitsio libraries)
	make all      (this should not need any command line options)

INSTALLATION directions:
========================

Preconditions:

  - a C compiler, GNU make, autoconf  (most linux distributions will come with these)
	(autoconf is only needed for developers, not for client installation)

  - cfitsio library: 
    See also http://heasarc.gsfc.nasa.gov/docs/software/fitsio/fitsio.html

    The easiest is to install it inside the cdf2fits
    source tree, and type (the version number, 2460 here, may differ)

	cd
	wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio2460.tar.gz
	tar zxf cfitsio2460.tar.gz
	cd cfitsio
	./configure
	make                      		(takes about 70" on a P4/1600)
	setenv CFITSIO_DIR `pwd`/cfitsio

    However, if somebody has installed it for you in e.g. "/usr/local", that should work too.
    An enviroment variable $CFITSIO_DIR can also be used to keep track of the source
    code directory where cfitsio was compiled from. Both the library and include files
    live there.

    Notes: --includedir=DIR appears not to work (tested w/ version 2440)
	   --prefix=PREFIX  then dumps all the .h files in /usr/local/include
		(their bug: PREFIX must already exist, and the default is /usr/local)

   - cdf library:  
     See also http://nssdc.gsfc.nasa.gov/cdf/cdf_home.html

	You actually need access to the source code, not the installed base,
	and for this you need to have the environment variable $CDF_BASE set
	to the root directory of cdf, e.g.


        Example of installation:

	cd
	wget ftp://nssdcftp.gsfc.nasa.gov/standards/cdf/dist/cdf27/unix/cdf27-dist-all.tar.gz
	tar zxf cdf27-dist-all.tar.gz
	cd cdf27-dist
	make OS=linux ENV=gnu all (takes about 23" on a P4/1600)
	make test
	setenv CDF_BASE `pwd`/cdf27-dist

	Notes: the following OS/ENV combinations have been tried:

	OS	ENV
	------  -----
	linux	gnu	ok
	sunos	gnu	ok, but failed to compile CDF header
	sunos   SysV	failed


Installation steps:


1)  autoconf  (only needed if the file 'configure' is absent)

	This will convert the configure.in file into a configure script.
You need the GNU automake package installed for this. Normally an export 
release is made with the configure script, but the development (CVS based)
code is not.  If you run this and see some error messages like
	warning: AC_TRY_RUN called....
	AC_PROG_CPP was called before AC_PROG_CC
	..
you have an oldish version of autoconf (--version), but my experience is
that despite these warnings, configure will work.


2)  ./configure [options]

	Normally configure will try and find cdf and cfitsio in a number
of places. We also allow $CDF_BASE for 'cdf' and $CFITSIO_DIR for 'cfitsio'
to set defaults for those two libraries.

Examples of options:

	--enable-debug				       [optimized]
	--with-cdf-prefix=/home/cdf/cdf27-dist         [/usr/local/cdf]
	--with-cfitsio-prefix=/home/cfitsio            [/usr/local]

Note that it is important (because of shared library useage) that
the install path be  given in an absolute sense, not relative to
cdf2fits.

3)   make all

	This will build all executables, currently cdf-to-fits and the
companion fits-to-cdf program.


4)   make check test pjt

	Runs a few checks to see if the system processes data.



=====================

here are some helpful cut&paste lines for CVS users


1) setup for anonymous CVS (if you've done this earlier, no need to
   do it again)


        cvs -d :pserver:anonymous@cvs.astro.umd.edu:/home/cvsroot login

2) get the source code

        cvs -d :pserver:anonymous@cvs.astro.umd.edu:/home/cvsroot co cdf2fits
        cd cdf2fits


3) make sure CDF_BASE and CFITSIO_DIR are set to where CDF and CFITSIO
   compiled source code are present, e.g. for you 

        setenv CDF_BASE    /home/davidh/cdf27-dist
        setenv CFITSIO_DIR /home/davidh/fits/lib-and-tools/cfitsio

4) if the file configure does not exist, run autoconf to generate it.

	autoconf

   This step only applies to developers, and normally you don't need
   this if you are receiving a full version of cdf2fits

5) configure the code to locate and check libraries and features

        ./configure

   if it fails, you will need to read the INSTALL file and see what
   options are to be given, e.g. you could need

        ./configure --with-cdf-prefix=/home/cdf --with-cfitsio-prefix=/opt

   of course it probably means either the CDF_BASE or CFITSIO_DIR from
   step 3) was wrong to begin with...


6) compile the code (it actually compiles a few other things too)

        make all

7) see what the program says if no arguments are given (should give some usage/help screen)

        ./cdf-to-fits

8) convert the example CDF files to FITS files:

	make test



=======

other notes:

 - the U and V types in CFITSIO are much better to handle UINT2 and UINT4
   with.
 - the new version of CFITSIO is able to handle INT1's properly (i.e. wihtout
   resorting to INT2 and wasting space). For that a new 'S' was invented,
   and also makes my convert_ubytes() superfluous.
