See SBIG or APOGEE for instructions on building and installing the
software for your camera.

It helps to have a recent Linux operating system installed.  
This version of XmCCD has been developed for many years and older distributions
may require an older version of XmCCd.  This one was tested on 
64-bit OpenSUSE Leap 15.

The default installation of OpenSUSE will need additional software. 
At a minimum add the Motif development and fxload (for SBIG) packages. Warnings
of missing run-time libraries will tell you if there are others needed.  Also,
it may be necessary to rebuild the Apogee library.  See libapogee for more
information on how to do that. 


Build xpa
=========

If not already on your system, you must install xpaccd system-wide.  Software
and installation instructions are included in the xpa subdirectory.

Build cfitsio
=============

Also if not already on your system, you must install cfitsio system-wide.  
Software and installation instructions are included in the cfitsio subdirectory.


Select your camera
==================

The libraries and executable programs that you will install are specific to the
cameras you chose at build time.   If you want to use xmccd with more than one
camera type, build separate versions and rename them so that when run they will
be explicitly for the right camera.  For example, when you build xmccd1, name
its binary in /usr/local/bin/ xmccd1_sbig instead of xmccd1 if it is to run 
an sbig camera.


Install the appropriate camera libraries
========================================

In the camera libary subdirectory run the apppropriate installation program:


cd libapogee
./install_apogee

If you have to rebuild the library for Apogee cameras run

./build_apogee
./install_apogee


Build xmccd1
============

This is the simplest standalone version of xmccd.  It will run a single camera
without running the xpa server.  Select your camera from those that are
available with the appropriate setup command and then make and install the code.

./setup_apogee_alta
make clean
make
make install

An error here may indicate a problem with the camera library.  For example,
building the executable for the Apogee Alta series cameras on Leap 15 (or other
recent Linux distribution) may fail on missing librariers.

With the Alta series, the "F" electronics require different software from the
older "U" cameras.  If you are not aware of your camera type, check the label to
see if its name begins with an F.  Cameras repaired for electronics problems 
come back  with a F-series board replacing the original U-series.

If you are building for SBIG, you have to edit the header file to select the
filter wheel system choice, which is by default turned off. For other cameras,
the protocol.h file can set the number of filters that are available.


Build xpaccd
============

This is the server that runs the camera and talks to the user interface xpaccd
and to the display software ds9.  

cd xpaccd
make
make install



Edit protocol.h for the filter wheel and maximum filter count in your system. 

With recent versions of Linux, ds9, and xpa you must add this to the
local profile (e.g. in /etc/profile.local for global use):

export XPA_METHOD=local

Otherwise, you will see an error message when ds9 starts, and xmccd and ds9
cannot communicate.

It is also helpful to add these commands to startup scripts so that ds9 is
in the right state to handle the images pushed from xmccd:

# Set ds9 preferences

xpaset -p ds9 preserve scale yes
xpaset -p ds9 preserve pan yes
xpaset -p ds9 preserve regions yes
xpaset -p ds9 colorbar no
xpaset -p ds9 regions centroid radius 40

# Set ds9 for N up W right Cassegrain telescope pointing east

xpaset -p ds9 orient x
xpaset -p ds9 rotate 180

# Set ds9 for N up W right Cassegrain telescope pointing west

xpaset -p ds9 orient x
xpaset -p ds9 rotate 0


Examples of scripts that use xmccd and ds9 are in the scripts directory.
