pthread-spin: Use GCC built-ins also on clang.
[gnulib.git] / build-aux / csharpexec.sh.in
blob3b1ede28e041b2085384afd977ff3cf4fa2165e8
1 #!/bin/sh
2 # Execute a C# program.
4 # Copyright (C) 2003-2020 Free Software Foundation, Inc.
5 # Written by Bruno Haible <bruno@clisp.org>, 2003.
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 3 of the License, or
10 # (at your option) any later version.
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.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20 # This uses the same choices as csharpexec.c, but instead of relying on the
21 # environment settings at run time, it uses the environment variables
22 # present at configuration time.
24 # This is a separate shell script, because the various C# interpreters have
25 # different command line options.
27 # Usage: /bin/sh csharpexec.sh [OPTION] program.exe [ARGUMENTS]
28 # Options:
29 # -L DIRECTORY search for C# libraries also in DIRECTORY
31 sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% \\]\)/\\\1/g'
32 libdirs_mono=
33 prog=
34 while test $# != 0; do
35 case "$1" in
36 -L)
37 libdirs_mono="${libdirs_mono:+$libdirs_mono@MONO_PATH_SEPARATOR@}$2"
38 shift
40 -*)
41 echo "csharpexec: unknown option '$1'" 1>&2
42 exit 1
45 prog="$1"
46 break
48 esac
49 shift
50 done
51 if test -z "$prog"; then
52 echo "csharpexec: no program specified" 1>&2
53 exit 1
55 case "$prog" in
56 *.exe) ;;
58 echo "csharpexec: program is not a .exe" 1>&2
59 exit 1
61 esac
63 if test -n "@HAVE_MONO@"; then
64 CONF_MONO_PATH='@MONO_PATH@'
65 if test -n "$libdirs_mono"; then
66 MONO_PATH="$libdirs_mono${CONF_MONO_PATH:+@MONO_PATH_SEPARATOR@$CONF_MONO_PATH}"
67 else
68 MONO_PATH="$CONF_MONO_PATH"
70 export MONO_PATH
71 test -z "$CSHARP_VERBOSE" || echo mono "$@"
72 exec mono "$@"
73 else
74 if test -n "@HAVE_CLIX@"; then
75 CONF_CLIX_PATH='@CLIX_PATH@'
76 if test -n "$libdirs_mono"; then
77 @CLIX_PATH_VAR@="$libdirs_mono${CONF_CLIX_PATH:+@MONO_PATH_SEPARATOR@$CONF_CLIX_PATH}"
78 else
79 @CLIX_PATH_VAR@="$CONF_CLIX_PATH"
81 export @CLIX_PATH_VAR@
82 test -z "$CSHARP_VERBOSE" || echo clix "$@"
83 exec clix "$@"
84 else
85 echo 'C# virtual machine not found, try installing mono, then reconfigure' 1>&2
86 exit 1