1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
"http://www.w3.org/TR/html4/strict.dtd">
6
<title>Autoconf Macro: ac_check_class</title>
7
<link rel="stylesheet" type="text/css" href="ac-archive.css">
11
<table summary="web navigation" style="width:100%;">
14
<td style="width:50%;" align="center">[<a href="index.html">Macro Index
17
<td style="width:50%;" align="center">[<a href=
18
"../m4source/ac_check_class.m4">Download M4 Source</a>]</td>
24
<h1>ac_check_class</h1>
29
<p style="text-align:left; white-space:nowrap;">
30
<code>AC_CHECK_CLASS</code></p>
36
<p>AC_CHECK_CLASS tests the existence of a given Java class, either in a
37
jar or in a '.class' file.</p>
39
<p>*Warning*: its success or failure can depend on a proper setting of the
40
CLASSPATH env. variable.</p>
42
<p>Note: This is part of the set of autoconf M4 macros for Java programs.
43
It is VERY IMPORTANT that you download the whole set, some macros depend on
44
other. Unfortunately, the autoconf archive does not support the concept of
45
set of macros, so I had to break it for submission. The general
46
documentation, as well as the sample configure.in, is included in the
47
AC_PROG_JAVA macro.</p>
53
<p>1.2 (last modified: 2000-07-19)</p>
59
<p>Stephane Bortzmeyer <bortzmeyer@pasteur.fr></p>
62
<h2>M4 Source Code</h2>
65
<pre class="m4source">
66
AC_DEFUN([AC_CHECK_CLASS],[
67
AC_REQUIRE([AC_PROG_JAVA])
68
ac_var_name=`echo $1 | sed 's/\./_/g'`
69
dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is
70
dnl dynamic I need an extra level of extraction
71
AC_MSG_CHECKING([for $1 class])
72
AC_CACHE_VAL(ac_cv_class_$ac_var_name, [
73
if test x$ac_cv_prog_uudecode_base64 = xyes; then
75
dnl * Test.java: used to test dynamicaly if a class exists.
80
dnl public static void
81
dnl main( String[] argv )
84
dnl if (argv.length < 1)
86
dnl System.err.println ("Missing argument");
91
dnl lib = Class.forName (argv[0]);
93
dnl catch (ClassNotFoundException e)
102
cat << \EOF > Test.uue
103
begin-base64 644 Test.class
104
yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
105
bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
106
bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
107
AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
108
ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
109
ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
110
VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
111
amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
112
AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
113
AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
114
AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
115
uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
116
AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
117
JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
121
if uudecode$EXEEXT Test.uue; then
124
echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AC_FD_CC
125
echo "configure: failed file was:" >&AC_FD_CC
126
cat Test.uue >&AC_FD_CC
127
ac_cv_prog_uudecode_base64=no
130
if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then
131
eval "ac_cv_class_$ac_var_name=yes"
133
eval "ac_cv_class_$ac_var_name=no"
137
AC_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"],
138
[eval "ac_cv_class_$ac_var_name=no"])
140
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
141
eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
142
HAVE_LAST_CLASS=$ac_var_val
143
if test x$ac_var_val = xyes; then
144
ifelse([$2], , :, [$2])
146
ifelse([$3], , :, [$3])
149
dnl for some reason the above statment didn't fall though here?
150
dnl do scripts have variable scoping?
151
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
152
AC_MSG_RESULT($ac_var_val)
160
<a href="COPYING.html">GNU General Public License</a> with this special
161
<a href="COPYING-Exception.html">exception</a>.