1#!/bin/sh 2# Execute a C# program. 3 4# Copyright (C) 2003, 2005 Free Software Foundation, Inc. 5# Written by Bruno Haible <bruno@clisp.org>, 2003. 6# 7# This program is free software; you can redistribute it and/or modify 8# it under the terms of the GNU General Public License as published by 9# the Free Software Foundation; either version 2, or (at your option) 10# any later version. 11# 12# This program is distributed in the hope that it will be useful, 13# but WITHOUT ANY WARRANTY; without even the implied warranty of 14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# GNU General Public License for more details. 16# 17# You should have received a copy of the GNU General Public License 18# along with this program; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 21# This uses the same choices as csharpexec.c, but instead of relying on the 22# environment settings at run time, it uses the environment variables 23# present at configuration time. 24# 25# This is a separate shell script, because the various C# interpreters have 26# different command line options. 27# 28# Usage: /bin/sh csharpexec.sh [OPTION] program.exe [ARGUMENTS] 29# Options: 30# -L DIRECTORY search for C# libraries also in DIRECTORY 31 32sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g' 33options_ilrun= 34libdirs_mono= 35prog= 36while test $# != 0; do 37 case "$1" in 38 -L) 39 options_ilrun="$options_ilrun -L "`echo "$2" | sed -e "$sed_quote_subst"` 40 libdirs_mono="${libdirs_mono:+$libdirs_mono@MONO_PATH_SEPARATOR@}$2" 41 shift 42 ;; 43 -*) 44 echo "csharpexec: unknown option '$1'" 1>&2 45 exit 1 46 ;; 47 *) 48 prog="$1" 49 break 50 ;; 51 esac 52 shift 53done 54if test -z "$prog"; then 55 echo "csharpexec: no program specified" 1>&2 56 exit 1 57fi 58case "$prog" in 59 *.exe) ;; 60 *) 61 echo "csharpexec: program is not a .exe" 1>&2 62 exit 1 63 ;; 64esac 65 66if test -n "@HAVE_ILRUN@"; then 67 test -z "$CSHARP_VERBOSE" || echo ilrun $options_ilrun "$@" 68 exec ilrun $options_ilrun "$@" 69else 70 if test -n "@HAVE_MONO@"; then 71 CONF_MONO_PATH='@MONO_PATH@' 72 if test -n "$libdirs_mono"; then 73 MONO_PATH="$libdirs_mono${CONF_MONO_PATH:+@MONO_PATH_SEPARATOR@$CONF_MONO_PATH}" 74 else 75 MONO_PATH="$CONF_MONO_PATH" 76 fi 77 export MONO_PATH 78 test -z "$CSHARP_VERBOSE" || echo mono "$@" 79 exec mono "$@" 80 else 81 if test -n "@HAVE_CLIX@"; then 82 CONF_CLIX_PATH='@CLIX_PATH@' 83 if test -n "$libdirs_mono"; then 84 @CLIX_PATH_VAR@="$libdirs_mono${CONF_CLIX_PATH:+@MONO_PATH_SEPARATOR@$CONF_CLIX_PATH}" 85 else 86 @CLIX_PATH_VAR@="$CONF_CLIX_PATH" 87 fi 88 export @CLIX_PATH_VAR@ 89 test -z "$CSHARP_VERBOSE" || echo clix "$@" 90 exec clix "$@" 91 else 92 echo 'C# virtual machine not found, try installing pnet, then reconfigure' 1>&2 93 exit 1 94 fi 95 fi 96fi 97