#-------------------------------------------------------------------------------
# Macros which are set by configure.
#-------------------------------------------------------------------------------
# Install locations for this component's products.
HD_PREFIX="@prefix@"
HD_EXEC_PFX="@exec_prefix@"
HD_SRC="@HD_SRC@"

# Install locations for top (HEADAS-wide) products.
HD_TOP_PFX="@HD_TOP_PFX@"
HD_TOP_EXEC_PFX="@HD_TOP_EXEC_PFX@"

# Locations for heacore products
HC_EXEC_PFX="@HC_EXEC_PFX@"
HC_BLD_EXEC_PFX="@HC_BLD_EXEC_PFX@"

# Locations for heatools products
HT_EXEC_PFX="@HT_EXEC_PFX@"
HT_BLD_EXEC_PFX="@HT_BLD_EXEC_PFX@"

# Locations for heagen products
HG_EXEC_PFX="@HG_EXEC_PFX@"
HG_BLD_EXEC_PFX="@HG_BLD_EXEC_PFX@"

# Locations for attitude products
ATT_EXEC_PFX="@ATT_EXEC_PFX@"
ATT_BLD_EXEC_PFX="@ATT_BLD_EXEC_PFX@"

# Locations for tcltk products
TCLTK_EXEC_PFX="@TCLTK_EXEC_PFX@"
TCLTK_BLD_EXEC_PFX="@TCLTK_BLD_EXEC_PFX@"

# Identify OS/architecture
HD_HOST="@host@"

# Identifiers for library version numbers.
AHLOG="@AHLOG@"
AST_LIBS="@AST_LIBS@"
CFITSIO="@CFITSIO@"
CFITSIO_DIR="@CFITSIO_DIR@"
HEAAPP="@HEAAPP@"
HEAINIT="@HEAINIT@"
HEAIO="@HEAIO@"
HEAUTILS="@HEAUTILS@"
HISTORY="@HISTORY@"
PIL="@PIL@"
READLINE="@READLINE@"
WCSLIB="@WCSLIB@"
ATFUNCTIONS="@ATFUNCTIONS@"
FT_VERS="_6.19"
CALLIB="caltools${FT_VERS}"
CFTOOLSLIB="cftools${FT_VERS}"
FTOOLSLIB="ftools${FT_VERS}"
XANLIB="xanlib${FT_VERS}"

TCL="@TCL@"
TCL_DIR="@TCL_DIR@"
TK="@TK@"
TK_DIR="@TK_DIR@"
ITCL="@ITCL@"
ITCL_DIR="@ITCL_DIR@"
ITK="@ITK@"
IWIDGETS="@IWIDGETS@"
TIX="@TIX@"
TIX_DIR="@TIX_DIR@"
TCLREADLINE="@TCLREADLINE@"
TCLREADLINE_DIR="@TCLREADLINE_DIR@"
XPA="@XPA@"
XPA_DIR="@XPA_DIR@"
TCLXPA="@TCLXPA@"
PGPLOT="@PGPLOT@"

LINK_PGPLOT="@LINK_PGPLOT@ @PGPLOT_PNG_LIBS@"
LINK_PGPLOT_TCL="@LINK_PGPLOT_TCL@ @PGPLOT_PNG_LIBS@"

#-------------------------------------------------------------------------------
# Build-related macros.
#-------------------------------------------------------------------------------
HD_LIB_STYLE="@HD_LIB_STYLE@"
HD_LIB_STYLE_F77="@HD_LIB_STYLE_F77@"
AR="@AR@"
ARCHIVE="@ARCHIVE@"
ARCHIVE_CXX="@ARCHIVE_CXX@"
BSUF="@BSUF@"
CC="@CC@"
CFLAGS="@CFLAGS@"
COPT="@COPT@"
COPT_SYS="@COPT_SYS@"
CXX="@CXX@"
CXXFLAGS="@CXXFLAGS@"
CXXOPT="@CXXOPT@"
DEFS="@DEFS@"
EXT="@EXT@"
F77LIBS4C="@F77LIBS4C@"
FC="@FC@"
FC_BASENAME="@FC_BASENAME@"
FFLAGS="@FFLAGS@"
FOPT="@FOPT@"
FOPT_SYS="@FOPT_SYS@"
G77="@G77@"
GCC="@GCC@"
GXX="@GXX@"
HD_LN_SYM="@HD_LN_SYM@"
MAKE="@MAKE@"
OSUF="@OSUF@"
PERL="@PERL@"
RANLIB="@RANLIB@"
SIZEOF_LONG="@SIZEOF_LONG@"
STRIP="@STRIP@"
SYSLIBS="@LIBS@"
SHLIB_LD="@SHLIB_LD@"
SHLIB_LD_CXX="@SHLIB_LD_CXX@"
SHLIB_SUFFIX="@SHLIB_SUFFIX@"
LDFLAGS_C="@LDFLAGS_C@"
LDFLAGS_C_BIN="@LDFLAGS_C_BIN@"
LDFLAGS_CXX="@LDFLAGS_CXX@"
LDFLAGS_CXX_BIN="@LDFLAGS_CXX_BIN@"
LDFLAGS_F="@LDFLAGS_F@"
LDFLAGS_F_BIN="@LDFLAGS_F_BIN@"
XINCLUDES="@XINCLUDES@"
XLIBS="@XLIBS@"
TCL_DEFS="@TCL_DEFS@"
FV_BUILD="@fv_build@"
FV_CFLAGS="@FV_CFLAGS@"
FV_LDFLAGS="@FV_LDFLAGS@"
FV_LIBS="@FV_LIBS@"

# local models for xspec
if [ "x$LMODDIR" = x ]; then
    LMODDIR="$HD_SRC/spectral/xspec/src/local_mod"
fi
export LMODDIR

#-------------------------------------------------------------------------------
# Macros which are hard-wired.
#-------------------------------------------------------------------------------
HD_COMPONENT_NAME="@h_comp@"
HD_COMPONENT_VERS="@h_vers@"
HMAKE="yes"

#-------------------------------------------------------------------------------
# Macros which are derived.
#-------------------------------------------------------------------------------
HD_BLD_PFX="$HD_SRC/BLD"
HD_BLD_EXEC_PFX="$HD_BLD_PFX/$HD_HOST"
HD_BUILD_DIR="$HD_SRC/BUILD_DIR"

HD_MAKE="$MAKE"
HD_STD_MAKEFILE="$HMAKE_CONF_DIR/Makefile-std"

# construct HD_PATH, adding component PATHs if applicable:
HD_PATH_INSTALLED="$HD_EXEC_PFX:$HC_EXEC_PFX"
HD_PATH_LOCAL="$HD_BLD_EXEC_PFX:$HC_BLD_EXEC_PFX"

for exec_prefix in "$ATT_EXEC_PFX" "$HG_EXEC_PFX" "$TCLTK_EXEC_PFX"; do
    if [ "x$exec_prefix" != x ]; then
       HD_PATH_INSTALLED="$HD_PATH_INSTALLED:$exec_prefix"
    fi
done
for bld_prefix in "$ATT_BLD_EXEC_PFX" "$HG_BLD_EXEC_PFX" "$TCLTK_BLD_EXEC_PFX"; do
    if [ "x$bld_prefix" != x ]; then
       HD_PATH_LOCAL="$HD_PATH_LOCAL:$bld_prefix"
    fi
done

HD_PATH="$HD_PATH_LOCAL:$HD_PATH_INSTALLED"

HD_INC_PATH=`echo "$HD_PATH/include" | sed 's%:%/include:%g'`
HD_LIB_PATH=`echo "$HD_PATH/lib" | sed 's%:%/lib:%g'`
HD_INC_PATH_LOCAL=`echo "$HD_PATH_LOCAL/include" | sed 's%:%/include:%g'`
HD_LIB_PATH_LOCAL=`echo "$HD_PATH_LOCAL/lib" | sed 's%:%/lib:%g'`

HD_IFLAGS=`echo "-I./ -I$HD_INC_PATH" | sed 's%:% -I%g'`
HD_LFLAGS=`echo "-L./ -L$HD_LIB_PATH" | sed 's%:% -L%g'`
HD_IFLAGS_LOCAL=`echo "-I./ -I$HD_INC_PATH_LOCAL" | sed 's%:% -I%g'`
HD_LFLAGS_LOCAL=`echo "-L./ -L$HD_LIB_PATH_LOCAL" | sed 's%:% -L%g'`

HD_STD_LIBS="-l${CALLIB} -l${CFTOOLSLIB} -l${FTOOLSLIB} -l${XANLIB} -l${PIL} -l${CFITSIO} -l${READLINE}"

HD_STD_CFLAGS="$COPT $CFLAGS $HD_IFLAGS $DEFS"
HD_STD_CLIBS="$HD_LFLAGS $HD_STD_LIBS $SYSLIBS"
HD_STD_CFLAGS_LOCAL="$COPT $CFLAGS $HD_IFLAGS_LOCAL $DEFS"
HD_STD_CLIBS_LOCAL="$HD_LFLAGS_LOCAL $HD_STD_LIBS $SYSLIBS"

HD_STD_FFLAGS="$FOPT $FFLAGS $HD_IFLAGS"

HD_STD_CXXFLAGS="$CXXOPT $CXXFLAGS $HD_IFLAGS $DEFS"
HD_STD_CXXLIBS="$HD_STD_CLIBS"
HD_STD_CXXFLAGS_LOCAL="$CXXOPT $CXXFLAGS $HD_IFLAGS_LOCAL $DEFS"
HD_STD_CXXLIBS_LOCAL="$HD_STD_CLIBS_LOCAL"

VPATH="$HD_INC_PATH:$HD_LIB_PATH"
VPATH_LOCAL="$HD_INC_PATH_LOCAL:$HD_LIB_PATH_LOCAL"

IMAGE="$HD_TOP_PFX/image"
SPECTRAL="$HD_TOP_PFX/spectral"

#-------------------------------------------------------------------------------
# Export all necessary variables.
#-------------------------------------------------------------------------------
export HD_PREFIX
export HD_EXEC_PFX
export HD_SRC

export HD_TOP_PFX
export HD_TOP_EXEC_PFX

export HC_EXEC_PFX
export HC_BLD_EXEC_PFX

export TCLTK_BLD_EXEC_PFX

export HD_HOST

export AHLOG
export AST_LIBS
export CFITSIO
export CFITSIO_DIR
export HEAAPP
export HEAINIT
export HEAIO
export HEAUTILS
export HISTORY
export PIL
export READLINE
export WCSLIB
export ATFUNCTIONS
export FT_VERS
export CALLIB
export CFTOOLSLIB
export FTOOLSLIB
export XANLIB

export TCL
export TCL_DIR
export TK
export TK_DIR
export ITCL
export ITCL_DIR
export ITK
export IWIDGETS
export TIX
export TIX_DIR
export TCLREADLINE
export TCLREADLINE_DIR
export XPA
export XPA_DIR
export TCLXPA
export PGPLOT

export LINK_PGPLOT
export LINK_PGPLOT_TCL

export HD_LIB_STYLE
export HD_LIB_STYLE_F77
export AR
export ARCHIVE
export ARCHIVE_CXX
export BSUF
export CC
export CFLAGS
export COPT
export COPT_SYS
export CXX
export CXXFLAGS
export CXXOPT
export DEFS
export EXT
export F77LIBS4C
export FC
export FC_BASENAME
export FFLAGS
export FOPT
export FOPT_SYS
export G77
export GCC
export GXX
export HD_LN_SYM
export MAKE
export OSUF
export PERL
export RANLIB
export SIZEOF_LONG
export STRIP
export SYSLIBS
export SHLIB_LD
export SHLIB_LD_CXX
export SHLIB_SUFFIX
export LDFLAGS_C
export LDFLAGS_C_BIN
export LDFLAGS_CXX
export LDFLAGS_CXX_BIN
export LDFLAGS_F
export LDFLAGS_F_BIN
export XINCLUDES
export XLIBS
export TCL_DEFS
export FV_BUILD
export FV_CFLAGS
export FV_LDFLAGS
export FV_LIBS

# Note: do NOT export the following:
#export HD_COMPONENT_NAME
#export HD_COMPONENT_VERS
export HMAKE

export HD_MAKE
export HD_STD_MAKEFILE

export HD_BLD_PFX
export HD_BLD_EXEC_PFX
export HD_BUILD_DIR

# No need to export the following; they are used just to compute other macros:
#export HD_PATH
#export HD_INC_PATH
#export HD_LIB_PATH

export HD_IFLAGS
export HD_LFLAGS
export HD_IFLAGS_LOCAL
export HD_LFLAGS_LOCAL

export HD_STD_LIBS

export HD_STD_CFLAGS
export HD_STD_CLIBS
export HD_STD_FFLAGS
export HD_STD_CXXFLAGS
export HD_STD_CXXLIBS

export HD_STD_CFLAGS_LOCAL
export HD_STD_CLIBS_LOCAL
export HD_STD_CXXFLAGS_LOCAL
export HD_STD_CXXLIBS_LOCAL

export VPATH
export VPATH_LOCAL

export IMAGE
export SPECTRAL
