Build system: implement REUSE with SPDX identifiers
[lttng-ust.git] / m4 / ax_prog_java_works.m4
CommitLineData
e03d7c66
MJ
1# SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro
2#
5c5aae82 3# ===========================================================================
e465639e 4# https://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html
5c5aae82
CB
5# ===========================================================================
6#
7# SYNOPSIS
8#
9# AX_PROG_JAVA_WORKS
10#
11# DESCRIPTION
12#
13# Internal use ONLY.
14#
15# Note: This is part of the set of autoconf M4 macros for Java programs.
16# It is VERY IMPORTANT that you download the whole set, some macros depend
17# on other. Unfortunately, the autoconf archive does not support the
18# concept of set of macros, so I had to break it for submission. The
19# general documentation, as well as the sample configure.in, is included
20# in the AX_PROG_JAVA macro.
21#
22# LICENSE
23#
24# Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
25#
26# This program is free software; you can redistribute it and/or modify it
27# under the terms of the GNU General Public License as published by the
28# Free Software Foundation; either version 2 of the License, or (at your
29# option) any later version.
30#
31# This program is distributed in the hope that it will be useful, but
32# WITHOUT ANY WARRANTY; without even the implied warranty of
33# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
34# Public License for more details.
35#
36# You should have received a copy of the GNU General Public License along
e465639e 37# with this program. If not, see <https://www.gnu.org/licenses/>.
5c5aae82
CB
38#
39# As a special exception, the respective Autoconf Macro's copyright owner
40# gives unlimited permission to copy, distribute and modify the configure
41# scripts that are the output of Autoconf when processing the Macro. You
42# need not follow the terms of the GNU General Public License when using
43# or distributing such scripts, even though portions of the text of the
44# Macro appear in them. The GNU General Public License (GPL) does govern
45# all other use of the material that constitutes the Autoconf Macro.
46#
47# This special exception to the GPL applies to versions of the Autoconf
48# Macro released by the Autoconf Archive. When you make and distribute a
49# modified version of the Autoconf Macro, you may extend this special
50# exception to the GPL to apply to your modified version as well.
51
e465639e 52#serial 11
5c5aae82
CB
53
54AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS])
55AC_DEFUN([AX_PROG_JAVA_WORKS], [
5c5aae82
CB
56 if test x$ac_cv_prog_javac_works = xno; then
57 AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly])
58 fi
59 if test x$ac_cv_prog_javac_works = x; then
60 AX_PROG_JAVAC
61 fi
5c5aae82
CB
62AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
63JAVA_TEST=Test.java
64CLASS_TEST=Test.class
65TEST=Test
66changequote(, )dnl
67cat << \EOF > $JAVA_TEST
68/* [#]line __oline__ "configure" */
69public class Test {
70public static void main (String args[]) {
71 System.exit (0);
72} }
73EOF
74changequote([, ])dnl
5c5aae82
CB
75 if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then
76 :
77 else
78 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
79 cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
80 AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?))
81 fi
5c5aae82
CB
82if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then
83 ac_cv_prog_java_works=yes
84else
85 echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
86 cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
87 AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?))
88fi
e465639e 89rm -f $JAVA_TEST $CLASS_TEST
5c5aae82
CB
90])
91AC_PROVIDE([$0])dnl
92]
93)
This page took 0.031991 seconds and 4 git commands to generate.