HEASARC Menu Bar

next up previous contents FITSIO Home
Next: Testing the Library Up: Creating the CFITSIO Library Previous: Creating the CFITSIO Library

Building the Library

The CFITSIO code is contained in about 40 C source files (*.c) and header files (*.h). On VAX/VMS systems 2 assembly-code files (vmsieeed.mar and vmsieeer.mar) are also needed.

The CFITSIO library is built on Unix systems by typing:

   > ./configure
   > make
at the operating system prompt. 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 configure command customizes the Makefile for the particular system, then the `make' command compiles the source files and builds the library.

On HP/UX systems, the environment variable CFLAGS should be set to -Ae before running configure to enable "extended ANSI" features.

By default, a set of Fortran-callable wrapper routines are also built and included in the CFITSIO library. If these wrapper routines are not needed (i.e., the CFITSIO library will not be linked to any Fortran applications which call FITSIO subroutines) then they may be omitted from the build by typing 'make all-nofitsio' instead of simply typing 'make'. This will reduce the size of the CFITSIO library slightly.

Note that starting with V2.0 of CFITSIO, it may no longer be possible to build staticly linked executables on some system. On SUN Solaris, for example the required nsl library is apparently only available as a shared library.

An alternate makefile called Makefile.shared is included in the distribution that will build CFITSIO as a shared library. It has only been tested under Solaris 2.5 but will likely also work on other systems, at least with gcc or cc. When using the shared library the executable code is not copied into your program at link time and instead the program locates the necessary library code at run time, normally through LD_LIBRARY_PATH or some other method. The advantages are:

   1.  Less disk space if you build more than 1 program
   2.  Less memory if more than one copy of a program using the shared
       library is running at the same time since the system is smart
       enough to share copies of the shared library at run time.
   3.  Possibly easier maintenance since a new version of the shared
       library can be installed without relinking all the software
       that uses it (as long as the subroutine names and calling
       sequences remain unchanged).
   4.  No run-time penalty.
The disadvantages are:
   1. More hassle at runtime.  You have to either build the programs
      specially or have LD_LIBRARY_PATH set right.
   2. There may be a slight start up penality, depending on where you are
      reading the shared library and the program from and if your CPU is
      either really slow or really heavily loaded.

On VAX/VMS and ALPHA/VMS systems the make.com command file may be used to build the cfitsio.olb object library. Execute this command file by typing '@make' on the command line. CFITSIO can support both the native G-float format and the IEEE float format on ALPHA/VMS systems; the makeieee.com file can be used to build the CFITSIO library using IEEE float.

On DOS-based PC computers, the makepc.bat file gives an example of how to build the CFITSIO library. This file will probably need to be edited to include the appropriate command switches if a different C compiler or linker is used.

On OS/2 systems, CFITSIO can be built 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.

The MacOS version 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 2 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 2 project. Note that this only has been tested for the PPC and probably won't work on 68k Macs.

CFITSIO has currently been tested on the following platforms:

  OPERATING SYSTEM           COMPILER
   Sun OS                     gcc and cc (3.0.1)
   Sun Solaris                gcc and cc
   Silicon Graphics IRIX      gcc and cc
   DECstation  Ultrix         gcc
   Dec Alpha OSF/1            gcc
   Dec Alpha OpenVMS          cc with /float=gfloat or /float=ieee options
   DEC VAX/VMS                gcc and cc
   HP-UX                      gcc
   IBM AIX                    gcc
   Linux running on IBM PC    gcc
   IBM PC w/ Windows 95       Borland C++ V4.5
   IBM PC w/ OS/2             gcc + EMX
   MacOS 7.1 or greater       Metrowerks 10.+
CFITSIO will probably run on most other Unix platforms. Cray supercomputers and IBM mainframe computers are currently not supported.


next up previous contents FITSIO Home
Next: Testing the Library Up: Creating the CFITSIO Library Previous: Creating the CFITSIO Library