Skip to content

Commit

Permalink
Include and link to a local copy of CFITSIO.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/hstcal/trunk@8959 fe389314-cf27-0410-b35b-8c050e845b92
  • Loading branch information
astropy-buildbot committed Mar 23, 2010
1 parent 1236165 commit baa2601
Show file tree
Hide file tree
Showing 156 changed files with 204,597 additions and 51 deletions.
14 changes: 0 additions & 14 deletions INSTALL
Expand Up @@ -19,20 +19,6 @@ For more information, run:

> ./waf --help

Configuration options
=====================

The location of CFITSIO may be specified using commandline arguments
to the configure command.

--cfitsio-inc specifies the directory containing the CFITSIO header files

--cfitsio-lib specifies the CFITSIO static library file (usually libcfitsio.a)

For example:

> ./waf configure --cfitsio-inc=/path/to/cfitsio --cfitsio-lib=/path/to/cfitsio/libcfitsio.a

build.cfg file
==============

Expand Down
4 changes: 2 additions & 2 deletions build.cfg.example
@@ -1,2 +1,2 @@
--cfitsio-inc=/home/mdroe/builds/cfitsio
--cfitsio-lib=/home/mdroe/builds/cfitsio/libcfitsio.a
--prefix=/home/me/install_root

53 changes: 53 additions & 0 deletions cfitsio/License.txt
@@ -0,0 +1,53 @@
Copyright (Unpublished--all rights reserved under the copyright laws of
the United States), U.S. Government as represented by the Administrator
of the National Aeronautics and Space Administration. No copyright is
claimed in the United States under Title 17, U.S. Code.

Permission to freely use, copy, modify, and distribute this software
and its documentation without fee is hereby granted, provided that this
copyright notice and disclaimer of warranty appears in all copies.
(However, see the restriction on the use of the gzip compression code,
below).

DISCLAIMER:

THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND,
EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY
IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE
DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE
SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY
DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR
CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY
CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY,
CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY
PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED
FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR
SERVICES PROVIDED HEREUNDER.

The file compress.c contains (slightly modified) source code that
originally came from gzip-1.2.4, copyright (C) 1992-1993 by Jean-loup
Gailly. This gzip code is distributed under the GNU General Public
License and thus requires that any software that uses the CFITSIO
library (which in turn uses the gzip code) must conform to the
provisions in the GNU General Public License. A copy of the GNU
license is included at the beginning of compress.c file.

Similarly, the file wcsutil.c contains 2 slightly modified routines
from the Classic AIPS package that are also distributed under the GNU
General Public License.

Alternate versions of the compress.c and wcsutil.c files (called
compress_alternate.c and wcsutil_alternate.c) are provided for users
who want to use the CFITSIO library but are unwilling or unable to
publicly release their software under the terms of the GNU General
Public License. These alternate versions contains non-functional
stubs for the file compression and uncompression routines and the
world coordinate transformation routines used by CFITSIO. Replace the
file `compress.c' with `compress_alternate.c' and 'wcsutil.c' with
'wcsutil_alternate.c before compiling the CFITSIO library. This will
produce a version of CFITSIO which does not support reading or writing
compressed FITS files, or doing image coordinate transformations, but
is otherwise identical to the standard version.

161 changes: 161 additions & 0 deletions cfitsio/Makefile.in
@@ -0,0 +1,161 @@
#
# Makefile for cfitsio library:
# libcfits.a
#
# Oct-96 : original version by
#
# JDD/WDP
# NASA GSFC
# Oct 1996
#
# 25-Jan-01 : removed conditional drvrsmem.c compilation because this
# is now handled within the source file itself.
# 09-Mar-98 : modified to conditionally compile drvrsmem.c. Also
# changes to target all (deleted clean), added DEFS, LIBS, added
# DEFS to .c.o, added SOURCES_SHMEM and MY_SHMEM, expanded getcol*
# and putcol* in SOURCES, modified OBJECTS, mv changed to /bin/mv
# (to bypass aliasing), cp changed to /bin/cp, add smem and
# testprog targets. See also changes and comments in configure.in
#

prefix = @prefix@
exec_prefix = @exec_prefix@
DESTDIR =
CFITSIO_PREFIX = $(prefix)
CFITSIO_LIB = $(DESTDIR)$(exec_prefix)/lib
CFITSIO_INCLUDE = $(DESTDIR)$(prefix)/include
INSTALL_DIRS = $(DESTDIR)@INSTALL_ROOT@ ${CFITSIO_LIB} ${CFITSIO_LIB}/pkgconfig ${CFITSIO_INCLUDE}


SHELL = /bin/sh
RANLIB = @RANLIB@
CC = @CC@
CFLAGS = @CFLAGS@
FC = @FC@
LDFLAGS = $(CFLAGS)
DEFS = @DEFS@
LIBS = @LIBS@
FLEX = flex
BISON = bison

SHLIB_LD = @SHLIB_LD@
SHLIB_SUFFIX = @SHLIB_SUFFIX@

.c.o:
$(CC) -c $(CFLAGS) $(DEFS) $<


CORE_SOURCES = buffers.c cfileio.c checksum.c compress.c drvrfile.c drvrmem.c \
drvrnet.c drvrsmem.c drvrgsiftp.c editcol.c edithdu.c eval_l.c \
eval_y.c eval_f.c fitscore.c getcol.c getcolb.c getcold.c getcole.c \
getcoli.c getcolj.c getcolk.c getcoll.c getcols.c getcolsb.c \
getcoluk.c getcolui.c getcoluj.c getkey.c group.c grparser.c \
histo.c iraffits.c \
modkey.c putcol.c putcolb.c putcold.c putcole.c putcoli.c \
putcolj.c putcolk.c putcoluk.c putcoll.c putcols.c putcolsb.c \
putcolu.c putcolui.c putcoluj.c putkey.c region.c scalnull.c \
swapproc.c wcssub.c wcsutil.c imcompress.c quantize.c ricecomp.c \
pliocomp.c fits_hcompress.c fits_hdecompress.c

SOURCES = ${CORE_SOURCES} @F77_WRAPPERS@

OBJECTS = ${SOURCES:.c=.o}

CORE_OBJECTS = ${CORE_SOURCES:.c=.o}


FITSIO_SRC = f77_wrap1.c f77_wrap2.c f77_wrap3.c f77_wrap4.c

# ============ description of all targets =============
# - <<-- ignore error code

all:
@if [ "x${FC}" = x ]; then \
${MAKE} all-nofitsio; \
else \
${MAKE} stand_alone; \
fi

all-nofitsio:
${MAKE} stand_alone "FITSIO_SRC="

stand_alone: libcfitsio.a

libcfitsio.a: ${OBJECTS}
ar rv libcfitsio.a ${OBJECTS}; \
${RANLIB} libcfitsio.a;

shared: libcfitsio${SHLIB_SUFFIX}

libcfitsio${SHLIB_SUFFIX}: ${OBJECTS}
${SHLIB_LD} ${LDFLAGS} -o $@ ${OBJECTS}

install: libcfitsio.a $(INSTALL_DIRS)
@if [ -f libcfitsio.a ]; then \
/bin/mv libcfitsio.a ${CFITSIO_LIB}; \
fi; \
if [ -f libcfitsio${SHLIB_SUFFIX} ]; then \
/bin/mv libcfitsio${SHLIB_SUFFIX} ${CFITSIO_LIB}; \
fi; \
/bin/cp fitsio.h fitsio2.h longnam.h drvrsmem.h ${CFITSIO_INCLUDE}/; \
/bin/cp cfitsio.pc ${CFITSIO_LIB}/pkgconfig

smem: smem.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o smem smem.o -L. -lcfitsio -lm

testprog: testprog.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o testprog testprog.o -L. -lcfitsio -lm ${LIBS}

fpack: fpack.o fpackutil.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o fpack fpack.o fpackutil.o -L. -lcfitsio -lm ${LIBS}

funpack: funpack.o fpackutil.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o funpack funpack.o fpackutil.o -L. -lcfitsio -lm ${LIBS}

fitscopy: fitscopy.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o fitscopy fitscopy.o -L. -lcfitsio -lm ${LIBS}

speed: speed.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o speed speed.o -L. -lcfitsio -lm ${LIBS}

imcopy: imcopy.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o imcopy imcopy.o -L. -lcfitsio -lm ${LIBS}

listhead: listhead.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o listhead listhead.o -L. -lcfitsio -lm ${LIBS}

cookbook: cookbook.o libcfitsio.a ${OBJECTS}
${CC} $(CFLAGS) $(DEFS) -o cookbook cookbook.o -L. -lcfitsio -lm ${LIBS}

eval: # Rebuild eval_* files from flex/bison source
$(FLEX) -t eval.l > eval_l.c1
/bin/sed -e 's/yy/ff/g' -e 's/YY/FF/g' eval_l.c1 > eval_l.c
/bin/rm -f eval_l.c1
$(BISON) -d -v -y eval.y
/bin/sed -e 's/yy/ff/g' -e 's/YY/FF/g' y.tab.c > eval_y.c
/bin/sed -e 's/yy/ff/g' -e 's/YY/FF/g' y.tab.h > eval_tab.h
/bin/rm -f y.tab.c y.tab.h

clean:
- /bin/rm -f *.o libcfitsio.a libcfitsio${SHLIB_SUFFIX} \
smem testprog y.output

distclean: clean
- /bin/rm -f Makefile cfitsio.pc config.* configure.lineno

# Make target which outputs the list of the .o contained in the cfitsio lib
# usefull to build a single big shared library containing Tcl/Tk and other
# extensions. used for the Tcl Plugin.

cfitsioLibObjs:
@echo ${CORE_OBJECTS}

cfitsioLibSrcs:
@echo ${SOURCES}

# This target actually builds the objects needed for the lib in the above
# case
objs: ${CORE_OBJECTS}

$(INSTALL_DIRS):
@if [ ! -d $@ ]; then mkdir -p $@; fi
151 changes: 151 additions & 0 deletions cfitsio/README
@@ -0,0 +1,151 @@
CFITSIO Interface Library

CFITSIO is a library of ANSI C routines for reading and writing FITS
format data files. A set of Fortran-callable wrapper routines are also
included for the convenience of Fortran programmers. This README file
gives a brief summary of how to build and test CFITSIO, but the CFITSIO
User's Guide, found in the files cfitsio.doc (plain text), cfitsio.tex
(LaTeX source file), or cfitsio.ps (postscript format), should be
referenced for the latest and most complete information.

BUILDING CFITSIO
----------------

The CFITSIO code is contained in about 40 *.c source files and several *.h
header files. The CFITSIO library is built on Unix systems by typing:

> ./configure [--prefix=/target/installation/path]
> make (or 'make shared')
> make install (this step is optional)

at the operating system prompt. The configure command customizes the
Makefile for the particular system, then the `make' command compiles the
source files and builds the library. Type `./configure' and not simply
`configure' to ensure that the configure script in the current directory
is run and not some other system-wide configure script. The optional
'prefix' argument to configure gives the path to the directory where
the CFITSIO library and include files should be installed via the later
'make install' command. For example,

> ./configure --prefix=/usr1/local

will cause the 'make install' command to copy the CFITSIO libcfitsio file
to /usr1/local/lib and the necessary include files to /usr1/local/include
(assuming of course that the process has permission to write to these
directories).

On VAX/VMS and ALPHA/VMS systems the make.com command file may be used
to build the cfitsio.olb object library using the default G-floating
point option for double variables. The make\_dfloat.com and make\_ieee.com
files may be used instead to build the library with the other floating
point options.

A precompiled DLL version of CFITSIO is available for IBM-PC users of
the Borland or Microsoft Visual C++ compilers in the files
cfitsiodll_2xxx_borland.zip and cfitsiodll_2xxx_vcc.zip, where '2xxx'
represents the current release number. These zip archives also
contains other files and instructions on how to use the CFITSIO DLL
library. The CFITSIO library may also be built from the source code
using the makefile.bc or makefile.vcc files. Finally, the makepc.bat
file gives an example of building CFITSIO with the Borland C++ v4.5
compiler using simpler DOS commands.

On OS/2 systems, CFITSIO can be built using the supplied makefile by
typing 'make -f makefile.os2'. This makefile requires the GCC compiler
and EMX library, which are available from many Internet sites
containing OS/2 software, such as
ftp-os2.nmsu.edu/pub/os2/dev/emx/v0.9c and
ftp.leo.org/pub/comp/os/os2/leo/devtools/emx+gcc.

When building on Mac OS-X, users should follow the Unix instructions,
above. Previous MacOS versions of the cfitsio library can be built by
(1) un binhex and unstuff cfitsio_mac.sit.hqx, (2) put CFitsioPPC.mcp
in the cfitsio directory, and (3) load CFitsioPPC.mcp into CodeWarrior
Pro 5 and make. This builds the cfitsio library for PPC. There are
also targets for both the test program and the speed test program.

To use the MacOS port you can add Cfitsio PPC.lib to your Codewarrior
Pro 5 project. Note that this only has been tested for the PPC and
probably won't work
on 68k macs.

TESTING CFITSIO
---------------

The CFITSIO library should be tested by building and running
the testprog.c program that is included with the release.
On Unix systems, type:
-
% make testprog
% testprog > testprog.lis
% diff testprog.lis testprog.out
% cmp testprog.fit testprog.std
-
On VMS systems,
(assuming cc is the name of the C compiler command), type:
-
$ cc testprog.c
$ link testprog, cfitsio/lib
$ run testprog
-
The testprog program should produce a FITS file called `testprog.fit'
that is identical to the testprog.std FITS file included in this
release. The diagnostic messages (which were piped to the file
testprog.lis in the Unix example) should be identical to the listing
contained in the file testprog.out. The 'diff' and 'cmp' commands
shown above should not report any differences in the files.

USING CFITSIO
-------------

The CFITSIO User's Guide, contained in the files cfitsio.doc (plain
text file) and cfitsio.ps (postscript file), provides detailed
documentation about how to build and use the CFITSIO library.
It contains a description of every user-callable routine in the
CFITSIO interface.

The cookbook.c file provides some sample routines for performing common
operations on various types of FITS files. Programmers are urged to
examine these routines for recommended programming practices when using
CFITSIO. Users are free to copy or modify these routines for their own
purposes.

SUPPORTED PLATFORMS
-------------------

CFITSIO has currently been tested on the following platforms:

Operating System Compiler
---------------- --------
OPERATING SYSTEM COMPILER
Sun OS gcc and cc (3.0.1)
Sun Solaris gcc and cc
Silicon Graphics IRIX gcc and cc
Silicon Graphics IRIX64 MIPS
Dec Alpha OSF/1 gcc and cc
DECstation Ultrix gcc
Dec Alpha OpenVMS cc
DEC VAX/VMS gcc and cc
HP-UX gcc
IBM AIX gcc
Linux gcc
MkLinux DR3
Windows 95/98/NT Borland C++ V4.5
Windows 95/98/NT/ME/XP Microsoft/Compaq Visual C++ v5.0, v6.0
Windows 95/98/NT Cygwin gcc
OS/2 gcc + EMX
Mac OS 7.1 or greater Metrowerks 10.+
Mac OS-X 10.1 or greater cc (gcc)

CFITSIO will probably run on most other Unix platforms without
modification. Cray supercomputers and IBM mainframe computers are
currently not supported.

Reports of any success or failure to run CFITSIO on other platforms
would be appreciated. Any problem reports or suggestions for
improvements are also welcome and should be sent to the primary author.

-------------------------------------------------------------------------
William D. Pence
HEASARC, NASA/GSFC
email: William.D.Pence@nasa.gov

0 comments on commit baa2601

Please sign in to comment.