maint: update copyright
[gnulib.git] / m4 / csharpcomp.m4
1 # csharpcomp.m4 serial 8
2 dnl Copyright (C) 2003-2005, 2007, 2009-2014 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.
6
7 # Prerequisites of csharpcomp.sh.
8 # Checks for a C# compiler.
9 # Sets at most one of HAVE_CSCC, HAVE_MCS, HAVE_CSC.
10 # Sets HAVE_CSHARPCOMP to nonempty if csharpcomp.sh will work.
11 # Also sets CSHARPCOMPFLAGS.
12 AC_DEFUN([gt_CSHARPCOMP],
13 [
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_CSCC_IN_PATH], [cscc], [yes])
21   AC_CHECK_PROG([HAVE_MCS_IN_PATH], [mcs], [yes])
22   AC_CHECK_PROG([HAVE_CSC_IN_PATH], [csc], [yes])
23   popdef([AC_MSG_RESULT])dnl
24   popdef([AC_CHECKING])dnl
25   popdef([AC_MSG_CHECKING])dnl
26   for impl in "$CSHARP_CHOICE" pnet mono sscli no; do
27     case "$impl" in
28       pnet)
29         if test -n "$HAVE_CSCC_IN_PATH" \
30            && cscc --version >/dev/null 2>/dev/null \
31            && (
32              # See if pnetlib is well installed.
33              echo 'class ConfTest { static void Main() { } }' > conftest.cs
34              cscc -o conftest.exe conftest.cs 2>/dev/null
35              error=$?
36              rm -f conftest.cs conftest.exe
37              exit $error
38             ); then
39           HAVE_CSCC=1
40           ac_result="cscc"
41           break
42         fi
43         ;;
44       mono)
45         if test -n "$HAVE_MCS_IN_PATH" \
46            && mcs --version >/dev/null 2>/dev/null \
47            && mcs --version 2>/dev/null | grep Mono >/dev/null; then
48           HAVE_MCS=1
49           ac_result="mcs"
50           break
51         fi
52         ;;
53       sscli)
54         if test -n "$HAVE_CSC_IN_PATH" \
55            && csc -help >/dev/null 2>/dev/null \
56            && { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then
57           HAVE_CSC=1
58           ac_result="csc"
59           break
60         fi
61         ;;
62       no)
63         HAVE_CSHARPCOMP=
64         ac_result="no"
65         break
66         ;;
67     esac
68   done
69   AC_MSG_RESULT([$ac_result])
70   AC_SUBST([HAVE_CSCC])
71   AC_SUBST([HAVE_MCS])
72   AC_SUBST([HAVE_CSC])
73   dnl Provide a default for CSHARPCOMPFLAGS.
74   if test -z "${CSHARPCOMPFLAGS+set}"; then
75     CSHARPCOMPFLAGS="-O -g"
76   fi
77   AC_SUBST([CSHARPCOMPFLAGS])
78 ])