#!/usr/bin/env bash
#set -x
set -o posix
#set -u
#set -e
#+
#
# ==================
# Fcheck_archfile.sh
# ==================
#
# --------------------------
# Check the compilation file
# --------------------------
#
# SYNOPSIS
# ========
#
# ::
#
#  $ Fcheck_archfile.sh
#
#
# DESCRIPTION
# ===========
#
#
# Check the choice of the compiler.
# Three cases :  
#
# - There was a previous choice
# - A new one has be specified, we use this one
# - No information, exit
#
# We use TOOLS/COMPILE/arch.fcm to see if something was chosen. 
#
# EXAMPLES
# ========
#
# ::
#
#  $ ./Fcheck_archfile.sh ARCHFILE COMPILER
#
#
# TODO
# ====
#
# option debug
#
#
# EVOLUTIONS
# ==========
#
# $Id: Fcheck_archfile.sh 2520 2010-12-27 14:43:36Z rblod $
#
#
#
#   * creation
#
#-

if [ ${#2} -eq 0 ]; then
   if [ ! -f ${COMPIL_DIR}/$1 ]; then
   echo "Warning !!!"
   echo "NO compiler chosen"
   echo "Try makenemo -h for help"
   echo "EXITING..."
   exit 1 
   fi
else
   ln -sf ${MAIN_DIR}/ARCH/arch-${2}.fcm ${COMPIL_DIR}/$1
fi
