#!/bin/sh # $Id: dcc-version.in 6904 2012-06-21 12:22:32Z cher $ # Copyright (c) 2005-2012 Alexander Chernov LANG_CONFIG_DIR="/home/judges/compile/conf/lang.d" common_config() { echo 'long_name="Borland Delphi 6 (Kylix)"' echo 'src_sfx=".pas"' echo 'arch="linux-shared-32"' } failure() { rm -f conftest* echo 'version=' echo 'arg="'"${arg}"'"' common_config echo 'DCCRUN=false' echo 'DCCDIR=' [ "${verbose}" = 1 ] && echo "no" >&2 exit 1 } unset LANG unset LC_ALL unset LC_MESSAGES unset LANGUAGE if [ x"$1" = x-v ] then verbose=1 shift fi # recheck the language if [ x"$1" = x-r ] then arg="$2" [ x"$2" != x ] && DCCRUN="$2" [ "${DCCRUN}" = "" ] && DCCRUN="dcc" [ "${verbose}" = 1 ] && echo -n "checking whether Borland Delphi is available..." >&2 "${DCCRUN}" -h 2>/dev/null >/dev/null || failure version=`"${DCCRUN}" -h 2>/dev/null | grep "Borland Delphi" | gawk '{ print $6; }'` || failure [ "${version}" != "" ] || failure cat > conftest.pas </dev/null >/dev/null || failure [ -x conftest ] || failure ./conftest 2>/dev/null >/dev/null || failure rm -f ./conftest* DCCDIR=`dirname "${DCCRUN}"` [ "${DCCDIR}" = . ] && DCCDIR="" echo 'version="'"${version}"'"' echo 'arg="'"${arg}"'"' common_config echo 'DCCRUN="'"${DCCRUN}"'"' echo 'DCCDIR="'"${DCCDIR}"'"' [ "${verbose}" = 1 ] && echo "yes, ${DCCRUN}, ${version}" >&2 exit 0 fi if [ x"$1" = x-l ] then echo "Borland Delphi 6 (Kylix) compiler (unsupported by Borland)" exit 0 fi [ "${EJUDGE_LANG_CONFIG}" = "" ] && EJUDGE_LANG_CONFIG="${LANG_CONFIG_DIR}/dcc.cfg" if [ -f "${EJUDGE_LANG_CONFIG}" ] then . "${EJUDGE_LANG_CONFIG}" else DCCRUN="dcc" DCCDIR= fi if [ x"${DCCRUN}" = x -o x"${DCCRUN}" = xfalse ] then echo "This language is not supported." >&2 exit 1 fi if [ x"${DCCDIR}" != x ] then PATH="${DCCDIR}:${PATH}" KYLIXDIR="${DCCDIR}" export KYLIXDIR fi if [ x"$1" = x-p ] then echo "${DCCRUN}" exit 0 fi "${DCCRUN}" -h 2>/dev/null >/dev/null || exit 1 [ x"$1" = x-f ] && echo -n "Borland Delphi 6 (Kylix) " "${DCCRUN}" -h 2>/dev/null | grep "Borland Delphi" | gawk '{ print $6; }'