view build-aux/csharpexec.sh.in @ 17366:9855b352e525

regex: port to mingw's recent addition of undeclared alarm On mingw (at least, when cross-compiling with Fedora 18's mingw32-headers-2.0.999-0.15.trunk.20121110.fc18.noarch build), compilation of test-regex fails: test-regex.c: In function 'main': test-regex.c:42:11: error: 'SIGALRM' undeclared (first use in this function) test-regex.c:42:11: note: each undeclared identifier is reported only once for each function it appears in test-regex.c:43:3: warning: implicit declaration of function 'alarm' It turns out that recent mingw64 added an export of alarm() and SIGALRM, but guarded their declarations behind __USE_MINGW_ALARM (default off, and with alarm() only in the non-standard <io.h>); so the m4 tests were setting HAVE_ALARM to 1 based on link success but then failing to compile. * doc/posix-functions/alarm.texi (alarm): Document that alarm exists but still doesn't work in newer mingw. * m4/frexp.m4 (gl_FUNC_FREXP_WORKS): Check for alarm declaration, not existence. Ensure SIGALRM is not trapped. * m4/mktime.m4 (gl_FUNC_MKTIME): Likewise. * m4/regex.m4 (gl_REGEX): Likewise. * m4/remainderf.m4 (gl_FUNC_REMAINDERF_WORKS): Likewise. * tests/test-regex.c (main): Use correct probe for alarm. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Mon, 11 Mar 2013 14:51:33 -0600
parents e542fd46ad6f
children
line wrap: on
line source

#!/bin/sh
# Execute a C# program.

# Copyright (C) 2003-2013 Free Software Foundation, Inc.
# Written by Bruno Haible <bruno@clisp.org>, 2003.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This uses the same choices as csharpexec.c, but instead of relying on the
# environment settings at run time, it uses the environment variables
# present at configuration time.
#
# This is a separate shell script, because the various C# interpreters have
# different command line options.
#
# Usage: /bin/sh csharpexec.sh [OPTION] program.exe [ARGUMENTS]
# Options:
#   -L DIRECTORY      search for C# libraries also in DIRECTORY

sed_quote_subst='s/\([|&;<>()$`"'"'"'*?[#~=% 	\\]\)/\\\1/g'
options_ilrun=
libdirs_mono=
prog=
while test $# != 0; do
  case "$1" in
    -L)
      options_ilrun="$options_ilrun -L "`echo "$2" | sed -e "$sed_quote_subst"`
      libdirs_mono="${libdirs_mono:+$libdirs_mono@MONO_PATH_SEPARATOR@}$2"
      shift
      ;;
    -*)
      echo "csharpexec: unknown option '$1'" 1>&2
      exit 1
      ;;
    *)
      prog="$1"
      break
      ;;
  esac
  shift
done
if test -z "$prog"; then
  echo "csharpexec: no program specified" 1>&2
  exit 1
fi
case "$prog" in
  *.exe) ;;
  *)
    echo "csharpexec: program is not a .exe" 1>&2
    exit 1
    ;;
esac

if test -n "@HAVE_ILRUN@"; then
  test -z "$CSHARP_VERBOSE" || echo ilrun $options_ilrun "$@"
  exec ilrun $options_ilrun "$@"
else
  if test -n "@HAVE_MONO@"; then
    CONF_MONO_PATH='@MONO_PATH@'
    if test -n "$libdirs_mono"; then
      MONO_PATH="$libdirs_mono${CONF_MONO_PATH:+@MONO_PATH_SEPARATOR@$CONF_MONO_PATH}"
    else
      MONO_PATH="$CONF_MONO_PATH"
    fi
    export MONO_PATH
    test -z "$CSHARP_VERBOSE" || echo mono "$@"
    exec mono "$@"
  else
    if test -n "@HAVE_CLIX@"; then
      CONF_CLIX_PATH='@CLIX_PATH@'
      if test -n "$libdirs_mono"; then
        @CLIX_PATH_VAR@="$libdirs_mono${CONF_CLIX_PATH:+@MONO_PATH_SEPARATOR@$CONF_CLIX_PATH}"
      else
        @CLIX_PATH_VAR@="$CONF_CLIX_PATH"
      fi
      export @CLIX_PATH_VAR@
      test -z "$CSHARP_VERBOSE" || echo clix "$@"
      exec clix "$@"
    else
      echo 'C# virtual machine not found, try installing pnet, then reconfigure' 1>&2
      exit 1
    fi
  fi
fi