Commit | Line | Data |
---|---|---|
504d4ace DG |
1 | # =========================================================================== |
2 | # http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html | |
3 | # =========================================================================== | |
4 | # | |
5 | # SYNOPSIS | |
6 | # | |
7 | # AX_PROG_JAVA_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 9 | |
51 | ||
52 | AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) | |
53 | AC_DEFUN([AX_PROG_JAVA_WORKS], [ | |
54 | AC_PATH_PROG(UUDECODE, uudecode, [no]) | |
55 | if test x$UUDECODE != xno; then | |
56 | AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ | |
57 | dnl /** | |
58 | dnl * Test.java: used to test if java compiler works. | |
59 | dnl */ | |
60 | dnl public class Test | |
61 | dnl { | |
62 | dnl | |
63 | dnl public static void | |
64 | dnl main( String[] argv ) | |
65 | dnl { | |
66 | dnl System.exit (0); | |
67 | dnl } | |
68 | dnl | |
69 | dnl } | |
70 | cat << \EOF > Test.uue | |
71 | begin-base64 644 Test.class | |
72 | yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE | |
73 | bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 | |
74 | bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s | |
75 | YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG | |
76 | aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB | |
77 | AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB | |
78 | AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= | |
79 | ==== | |
80 | EOF | |
81 | if $UUDECODE Test.uue; then | |
82 | ac_cv_prog_uudecode_base64=yes | |
83 | else | |
84 | echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD | |
85 | echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD | |
86 | cat Test.uue >&AS_MESSAGE_LOG_FD | |
87 | ac_cv_prog_uudecode_base64=no | |
88 | fi | |
89 | rm -f Test.uue]) | |
90 | fi | |
91 | if test x$ac_cv_prog_uudecode_base64 != xyes; then | |
92 | rm -f Test.class | |
93 | AC_MSG_WARN([I have to compile Test.class from scratch]) | |
94 | if test x$ac_cv_prog_javac_works = xno; then | |
95 | AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) | |
96 | fi | |
97 | if test x$ac_cv_prog_javac_works = x; then | |
98 | AX_PROG_JAVAC | |
99 | fi | |
100 | fi | |
101 | AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ | |
102 | JAVA_TEST=Test.java | |
103 | CLASS_TEST=Test.class | |
104 | TEST=Test | |
105 | changequote(, )dnl | |
106 | cat << \EOF > $JAVA_TEST | |
107 | /* [#]line __oline__ "configure" */ | |
108 | public class Test { | |
109 | public static void main (String args[]) { | |
110 | System.exit (0); | |
111 | } } | |
112 | EOF | |
113 | changequote([, ])dnl | |
114 | if test x$ac_cv_prog_uudecode_base64 != xyes; then | |
115 | if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then | |
116 | : | |
117 | else | |
118 | echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD | |
119 | cat $JAVA_TEST >&AS_MESSAGE_LOG_FD | |
120 | AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) | |
121 | fi | |
122 | fi | |
123 | if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then | |
124 | ac_cv_prog_java_works=yes | |
125 | else | |
126 | echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD | |
127 | cat $JAVA_TEST >&AS_MESSAGE_LOG_FD | |
128 | AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) | |
129 | fi | |
130 | rm -fr $JAVA_TEST $CLASS_TEST Test.uue | |
131 | ]) | |
132 | AC_PROVIDE([$0])dnl | |
133 | ] | |
134 | ) |