03961db5b73c47918f8bc939bedafc3777b64c4c
[vpp.git] / vpp-api / java / m4 / ax_prog_java.m4
1 # ===========================================================================
2 #       http://www.gnu.org/software/autoconf-archive/ax_prog_java.html
3 # ===========================================================================
4 #
5 # SYNOPSIS
6 #
7 #   AX_PROG_JAVA
8 #
9 # DESCRIPTION
10 #
11 #   Here is a summary of the main macros:
12 #
13 #   AX_PROG_JAVAC: finds a Java compiler.
14 #
15 #   AX_PROG_JAVA: finds a Java virtual machine.
16 #
17 #   AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!).
18 #
19 #   AX_CHECK_RQRD_CLASS: finds if we have the given class and stops
20 #   otherwise.
21 #
22 #   AX_TRY_COMPILE_JAVA: attempt to compile user given source.
23 #
24 #   AX_TRY_RUN_JAVA: attempt to compile and run user given source.
25 #
26 #   AX_JAVA_OPTIONS: adds Java configure options.
27 #
28 #   AX_PROG_JAVA tests an existing Java virtual machine. It uses the
29 #   environment variable JAVA then tests in sequence various common Java
30 #   virtual machines. For political reasons, it starts with the free ones.
31 #   You *must* call [AX_PROG_JAVAC] before.
32 #
33 #   If you want to force a specific VM:
34 #
35 #   - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA
36 #
37 #     (but after AC_INIT)
38 #
39 #   - at the configure level, setenv JAVA
40 #
41 #   You can use the JAVA variable in your Makefile.in, with @JAVA@.
42 #
43 #   *Warning*: its success or failure can depend on a proper setting of the
44 #   CLASSPATH env. variable.
45 #
46 #   TODO: allow to exclude virtual machines (rationale: most Java programs
47 #   cannot run with some VM like kaffe).
48 #
49 #   Note: This is part of the set of autoconf M4 macros for Java programs.
50 #   It is VERY IMPORTANT that you download the whole set, some macros depend
51 #   on other. Unfortunately, the autoconf archive does not support the
52 #   concept of set of macros, so I had to break it for submission.
53 #
54 #   A Web page, with a link to the latest CVS snapshot is at
55 #   <http://www.internatif.org/bortzmeyer/autoconf-Java/>.
56 #
57 #   This is a sample configure.in Process this file with autoconf to produce
58 #   a configure script.
59 #
60 #     AC_INIT(UnTag.java)
61 #
62 #     dnl Checks for programs.
63 #     AC_CHECK_CLASSPATH
64 #     AX_PROG_JAVAC
65 #     AX_PROG_JAVA
66 #
67 #     dnl Checks for classes
68 #     AX_CHECK_RQRD_CLASS(org.xml.sax.Parser)
69 #     AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver)
70 #
71 #     AC_OUTPUT(Makefile)
72 #
73 # LICENSE
74 #
75 #   Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
76 #
77 #   This program is free software; you can redistribute it and/or modify it
78 #   under the terms of the GNU General Public License as published by the
79 #   Free Software Foundation; either version 2 of the License, or (at your
80 #   option) any later version.
81 #
82 #   This program is distributed in the hope that it will be useful, but
83 #   WITHOUT ANY WARRANTY; without even the implied warranty of
84 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
85 #   Public License for more details.
86 #
87 #   You should have received a copy of the GNU General Public License along
88 #   with this program. If not, see <http://www.gnu.org/licenses/>.
89 #
90 #   As a special exception, the respective Autoconf Macro's copyright owner
91 #   gives unlimited permission to copy, distribute and modify the configure
92 #   scripts that are the output of Autoconf when processing the Macro. You
93 #   need not follow the terms of the GNU General Public License when using
94 #   or distributing such scripts, even though portions of the text of the
95 #   Macro appear in them. The GNU General Public License (GPL) does govern
96 #   all other use of the material that constitutes the Autoconf Macro.
97 #
98 #   This special exception to the GPL applies to versions of the Autoconf
99 #   Macro released by the Autoconf Archive. When you make and distribute a
100 #   modified version of the Autoconf Macro, you may extend this special
101 #   exception to the GPL to apply to your modified version as well.
102
103 #serial 9
104
105 AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA])
106 AC_DEFUN([AX_PROG_JAVA],[
107 m4_define([m4_ax_prog_java_list], [kaffe java])dnl
108 AS_IF([test "x$JAVAPREFIX" = x],
109       [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])],
110       [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])])
111 test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH])
112 m4_undefine([m4_ax_prog_java_list])dnl
113 AX_PROG_JAVA_WORKS
114 AC_PROVIDE([$0])dnl
115 ])