7dfa1e37d8992a914f3dfa1f5c592d0470ba1fc6
[vpp.git] / vpp-api / java / m4 / ax_prog_javac_works.m4
1 # ===========================================================================
2 #    http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 #   AX_PROG_JAVAC_WORKS
8 #
9 # DESCRIPTION
10 #
11 #   Internal use ONLY.
12 #
13 #   Note: This is part of the set of autoconf M4 macros for Java programs.
14 #   It is VERY IMPORTANT that you download the whole set, some macros depend
15 #   on other. Unfortunately, the autoconf archive does not support the
16 #   concept of set of macros, so I had to break it for submission. The
17 #   general documentation, as well as the sample configure.in, is included
18 #   in the AX_PROG_JAVA macro.
19 #
20 # LICENSE
21 #
22 #   Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
23 #
24 #   This program is free software; you can redistribute it and/or modify it
25 #   under the terms of the GNU General Public License as published by the
26 #   Free Software Foundation; either version 2 of the License, or (at your
27 #   option) any later version.
28 #
29 #   This program is distributed in the hope that it will be useful, but
30 #   WITHOUT ANY WARRANTY; without even the implied warranty of
31 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
32 #   Public License for more details.
33 #
34 #   You should have received a copy of the GNU General Public License along
35 #   with this program. If not, see <http://www.gnu.org/licenses/>.
36 #
37 #   As a special exception, the respective Autoconf Macro's copyright owner
38 #   gives unlimited permission to copy, distribute and modify the configure
39 #   scripts that are the output of Autoconf when processing the Macro. You
40 #   need not follow the terms of the GNU General Public License when using
41 #   or distributing such scripts, even though portions of the text of the
42 #   Macro appear in them. The GNU General Public License (GPL) does govern
43 #   all other use of the material that constitutes the Autoconf Macro.
44 #
45 #   This special exception to the GPL applies to versions of the Autoconf
46 #   Macro released by the Autoconf Archive. When you make and distribute a
47 #   modified version of the Autoconf Macro, you may extend this special
48 #   exception to the GPL to apply to your modified version as well.
49
50 #serial 6
51
52 AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS])
53 AC_DEFUN([AX_PROG_JAVAC_WORKS],[
54 AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
55 JAVA_TEST=Test.java
56 CLASS_TEST=Test.class
57 cat << \EOF > $JAVA_TEST
58 /* [#]line __oline__ "configure" */
59 public class Test {
60 }
61 EOF
62 if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then
63   ac_cv_prog_javac_works=yes
64 else
65   AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)])
66   echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
67   cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
68 fi
69 rm -f $JAVA_TEST $CLASS_TEST
70 ])
71 AC_PROVIDE([$0])dnl
72 ])