.
[gnulib.git] / m4 / csharpcomp.m4
1 # csharpcomp.m4 serial 5 (gettext-0.15)
2 dnl Copyright (C) 2003-2005 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 # Sets HAVE_CSHARPCOMP to nonempty if csharpcomp.sh will work.
9
10 AC_DEFUN([gt_CSHARPCOMP],
11 [
12   AC_REQUIRE([gt_CSHARP_CHOICE])
13   AC_MSG_CHECKING([for C[#] compiler])
14   HAVE_CSHARPCOMP=1
15   pushdef([AC_MSG_CHECKING],[:])dnl
16   pushdef([AC_CHECKING],[:])dnl
17   pushdef([AC_MSG_RESULT],[:])dnl
18   AC_CHECK_PROG(HAVE_CSCC_IN_PATH, cscc, yes)
19   AC_CHECK_PROG(HAVE_MCS_IN_PATH, mcs, yes)
20   AC_CHECK_PROG(HAVE_CSC_IN_PATH, csc, yes)
21   popdef([AC_MSG_RESULT])dnl
22   popdef([AC_CHECKING])dnl
23   popdef([AC_MSG_CHECKING])dnl
24   for impl in "$CSHARP_CHOICE" pnet mono sscli no; do
25     case "$impl" in
26       pnet)
27         if test -n "$HAVE_CSCC_IN_PATH" \
28            && cscc --version >/dev/null 2>/dev/null \
29            && (
30              # See if pnetlib is well installed.
31              echo 'class ConfTest { static void Main() { } }' > conftest.cs
32              cscc -o conftest.exe conftest.cs 2>/dev/null
33              error=$?
34              rm -f conftest.cs conftest.exe
35              exit $error
36             ); then
37           HAVE_CSCC=1
38           ac_result="cscc"
39           break
40         fi
41         ;;
42       mono)
43         if test -n "$HAVE_MCS_IN_PATH" \
44            && mcs --version >/dev/null 2>/dev/null; then
45           HAVE_MCS=1
46           ac_result="mcs"
47           break
48         fi
49         ;;
50       sscli)
51         if test -n "$HAVE_CSC_IN_PATH" \
52            && csc -help >/dev/null 2>/dev/null \
53            && { if csc -help 2>/dev/null | grep -i chicken > /dev/null; then false; else true; fi; }; then
54           HAVE_CSC=1
55           ac_result="csc"
56           break
57         fi
58         ;;
59       no)
60         HAVE_CSHARPCOMP=
61         ac_result="no"
62         break
63         ;;
64     esac
65   done
66   AC_MSG_RESULT([$ac_result])
67   AC_SUBST(HAVE_CSCC)
68   AC_SUBST(HAVE_MCS)
69   AC_SUBST(HAVE_CSC)
70 ])