#!/bin/sh # $Id: vbnc-version.in 5550 2009-02-19 18:14:43Z cher $ # Copyright (c) 2005-2008 Alexander Chernov LANG_CONFIG_DIR="/home/judges/compile/conf/lang.d" common_config() { echo 'long_name="Mono Visual Basic .NET"' echo 'src_sfx=".vb"' echo 'exe_sfx=".exe"' echo 'arch="msil"' echo 'insecure=1' } failure() { rm -f conftest* echo 'version=' echo 'arg="'"${arg}"'"' common_config echo 'MONORUN=false' echo 'MONODIR=' echo 'MONOVER=' echo 'VBNCRUN=false' echo 'VBNCDIR=' [ "${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 ] && VBNCRUN="$2" [ "${VBNCRUN}" = "" ] && VBNCRUN="vbnc" [ "${verbose}" = 1 ] && echo -n "checking whether Mono Visual Basic is available..." >&2 VBNCDIR=`dirname "${VBNCRUN}"` || failure if [ "${VBNCDIR}" = . ] then MONORUN=mono MONODIR= VBNCDIR= else VBNCRUN="${MCSDIR}/mono" VBNCDIR="${MCSDIR}" fi "${MONORUN}" --version >/dev/null 2>&1 || failure MONOVER=`"${MONORUN}" --version 2>&1 | grep "version" | awk '{gsub(",","",$5); print $5;}'` || failure [ "${MONOVER}" != "" ] || failure "${VBNCRUN}" /help >/dev/null 2>&1 || failure version=`"${VBNCRUN}" /help 2>&1 | head -1 | awk '{print $5;}'` || failure [ "${version}" != "" ] || failure cat > conftest.vb </dev/null 2>&1 || failure [ -f conftest.exe ] || failure "${MONORUN}" conftest.exe >/dev/null 2>&1 || failure rm -f ./conftest* echo 'version="'"${version}"'"' echo 'arg="'"${arg}"'"' common_config echo 'MONORUN="'"${MONORUN}"'"' echo 'MONODIR="'"${MONODIR}"'"' echo 'MONOVER="'"${MONOVER}"'"' echo 'VBNCRUN="'"${VBNCRUN}"'"' echo 'VBNCDIR="'"${VBNCDIR}"'"' [ "${verbose}" = 1 ] && echo "yes, ${VBNCRUN}, ${version}" >&2 exit 0 fi if [ x"$1" = x-l ] then echo "Mono Visual Basic .NET compiler [http://www.mono-project.com]" exit 0 fi [ "${EJUDGE_LANG_CONFIG}" = "" ] && EJUDGE_LANG_CONFIG="${LANG_CONFIG_DIR}/vbnc.cfg" if [ -f "${EJUDGE_LANG_CONFIG}" ] then . "${EJUDGE_LANG_CONFIG}" else VBNCRUN="vbnc" VBNCDIR="" fi if [ x"${VBNCRUN}" = x -o x"${VBNCRUN}" = xfalse ] then echo "This language is not supported." >&2 exit 1 fi if [ x"${VBNCDIR}" != x ] then PATH="${VBNCDIR}/bin:${PATH}" fi if [ x"$1" = x-p ] then echo "${VBNCRUN}" exit 0 fi "${VBNCRUN}" /help 2>/dev/null >/dev/null || exit 1 [ x"$1" = x-f ] && echo -n "Mono Visual Basic .NET " "${VBNCRUN}" /help 2>&1 | head -1 | awk '{print $5;}'