#!/bin/sh # $Id: g77-version.in 5608 2010-01-07 19:51:45Z cher $ # Copyright (c) 2005-2010 Alexander Chernov LANG_CONFIG_DIR="/home/judges/compile/conf/lang.d" common_config() { echo 'long_name="GNU Fortran 77"' echo 'src_sfx=".for"' } failure() { rm -f conftest* echo 'version=' echo 'arg="'"${arg}"'"' common_config echo 'G77RUN=false' echo 'G77DIR=' [ "${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 ] && G77RUN="$2" [ "${G77RUN}" = "" ] && G77RUN="g77" [ "${verbose}" = 1 ] && echo -n "checking whether GNU Fortran 77 is available..." >&2 "${G77RUN}" -v >/dev/null 2>/dev/null || failure version=`"${G77RUN}" --version | grep "GNU Fortran (GCC)" | gawk '{ print $4; }'` || failure [ "${version}" != x ] || failure echo " END" > conftest.for "${G77RUN}" -static conftest.for -o conftest 2>/dev/null >/dev/null || failure [ -x conftest ] || failure ./conftest > /dev/null 2>/dev/null || failure rm -f ./conftest* G77DIR=`dirname "${G77RUN}"` [ "${G77DIR}" = . ] && G77DIR="" echo 'version="'"${version}"'"' echo 'arg="'"${arg}"'"' common_config echo 'G77RUN="'"${G77RUN}"'"' echo 'G77DIR="'"${G77DIR}"'"' [ "${verbose}" = 1 ] && echo "yes, ${G77RUN}, ${version}" >&2 exit 0 fi if [ x"$1" = x-l ] then echo "GNU Fortran 77 compiler (obsoleted by gfortran) [http://gcc.gnu.org]" exit 0 fi if [ x"$1" = x-b ] then echo "GNU Fortran 77" exit 0 fi if [ x"$1" = x-c ] then cat <&2 exit 1 fi if [ x"${G77DIR}" != x ] then PATH="${G77DIR}:${PATH}" fi if [ x"$1" = x-p ] then echo "${G77RUN}" exit 0 fi "${G77RUN}" --version 2>/dev/null >/dev/null || exit 1 [ x"$1" = x-f ] && echo -n "GNU Fortran 77 " "${G77RUN}" --version | grep "GNU Fortran (GCC)" | gawk '{ print $4; }' [ $? != 0 -a $? != 1 ] && exit 1 exit 0