next up previous contents FITSIO Home
Next: 2.1.2 VMS Up: 2.1 Building the Library Previous: 2.1 Building the Library

2.1.1 Unix Systems

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).

The 'make shared' option builds a shared or dynamic version of the CFITSIO library. 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 of using a shared library 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 penalty, 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 Mac OS X platforms the 'make shared' command works like on other UNIX platforms, but a .dylib file will be created instead of .so. If installed in a nonstandard location, add its location to the DYLD_LIBRARY_PATH environment variable so that the library can be found at run time.

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.

Most 32-bit operating systems have only supported disk files up to 2.1GB (2**31 bytes) in size. Starting with version 2.1 of CFITSIO, FITS files larger than this limit (up to 6 terabytes) can be read and written on platforms which support large files (e.g., Solaris). To enable this feature, CFITSIO must be compiled with the `-D_FILE_OFFSET_BITS=64' compiler flag. All programs which link to the CFITSIO library must also be compiled with this flag or must include this preprocessor definition at the start of the source code file. See the `CFITSIO Size Limitations' section in Chapter 4 for further details.

It may not be possible to staticly link programs that use CFITSIO on some platforms (namely, on Solaris 2.6) due to the network drivers (which provide FTP and HTTP access to FITS files). It is possible to make both a dynamic and a static version of the CFITSIO library, but network file access will not be possible using the static version.

next up previous contents FITSIO Home
Next: 2.1.2 VMS Up: 2.1 Building the Library Previous: 2.1 Building the Library