immutable: Add tests.
[gnulib.git] / m4 / csharpcomp.m4
blobe657b84a7fac1883f10cfc981d2b293cded865d6
1 # csharpcomp.m4 serial 9
2 dnl Copyright (C) 2003-2005, 2007, 2009-2021 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
7 # Prerequisites of csharpcomp.sh.
8 # Checks for a C# compiler.
9 # Sets at most one of HAVE_MCS, HAVE_CSC.
10 # Sets HAVE_CSHARPCOMP to nonempty if csharpcomp.sh will work.
11 # Also sets CSHARPCOMPFLAGS.
12 AC_DEFUN([gt_CSHARPCOMP],
14   AC_REQUIRE([gt_CSHARP_CHOICE])
15   AC_MSG_CHECKING([for C[#] compiler])
16   HAVE_CSHARPCOMP=1
17   pushdef([AC_MSG_CHECKING],[:])dnl
18   pushdef([AC_CHECKING],[:])dnl
19   pushdef([AC_MSG_RESULT],[:])dnl
20   AC_CHECK_PROG([HAVE_MCS_IN_PATH], [mcs], [yes])
21   AC_CHECK_PROG([HAVE_CSC_IN_PATH], [csc], [yes])
22   popdef([AC_MSG_RESULT])dnl
23   popdef([AC_CHECKING])dnl
24   popdef([AC_MSG_CHECKING])dnl
25   for impl in "$CSHARP_CHOICE" mono sscli no; do
26     case "$impl" in
27       mono)
28         if test -n "$HAVE_MCS_IN_PATH" \
29            && mcs --version >/dev/null 2>/dev/null \
30            && mcs --version 2>/dev/null | grep Mono >/dev/null; then
31           HAVE_MCS=1
32           ac_result="mcs"
33           break
34         fi
35         ;;
36       sscli)
37         if test -n "$HAVE_CSC_IN_PATH" \
38            && csc -help >/dev/null 2>/dev/null \
39            && { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then
40           HAVE_CSC=1
41           ac_result="csc"
42           break
43         fi
44         ;;
45       no)
46         HAVE_CSHARPCOMP=
47         ac_result="no"
48         break
49         ;;
50     esac
51   done
52   AC_MSG_RESULT([$ac_result])
53   AC_SUBST([HAVE_MCS])
54   AC_SUBST([HAVE_CSC])
55   dnl Provide a default for CSHARPCOMPFLAGS.
56   if test -z "${CSHARPCOMPFLAGS+set}"; then
57     CSHARPCOMPFLAGS="-O -g"
58   fi
59   AC_SUBST([CSHARPCOMPFLAGS])