Fix: perform the initialization memory barrier out of loop body
[lttng-tools.git] / m4 / ax_check_class.m4
CommitLineData
504d4ace
DG
1# ===========================================================================
2# http://www.gnu.org/software/autoconf-archive/ax_check_class.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7# AX_CHECK_CLASS
8#
9# DESCRIPTION
10#
11# AX_CHECK_CLASS tests the existence of a given Java class, either in a
12# jar or in a '.class' file.
13#
14# *Warning*: its success or failure can depend on a proper setting of the
15# CLASSPATH env. variable.
16#
17# Note: This is part of the set of autoconf M4 macros for Java programs.
18# It is VERY IMPORTANT that you download the whole set, some macros depend
19# on other. Unfortunately, the autoconf archive does not support the
20# concept of set of macros, so I had to break it for submission. The
21# general documentation, as well as the sample configure.in, is included
22# in the AX_PROG_JAVA macro.
23#
24# LICENSE
25#
26# Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
27#
28# This program is free software; you can redistribute it and/or modify it
29# under the terms of the GNU General Public License as published by the
30# Free Software Foundation; either version 2 of the License, or (at your
31# option) any later version.
32#
33# This program is distributed in the hope that it will be useful, but
34# WITHOUT ANY WARRANTY; without even the implied warranty of
35# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
36# Public License for more details.
37#
38# You should have received a copy of the GNU General Public License along
39# with this program. If not, see <http://www.gnu.org/licenses/>.
40#
41# As a special exception, the respective Autoconf Macro's copyright owner
42# gives unlimited permission to copy, distribute and modify the configure
43# scripts that are the output of Autoconf when processing the Macro. You
44# need not follow the terms of the GNU General Public License when using
45# or distributing such scripts, even though portions of the text of the
46# Macro appear in them. The GNU General Public License (GPL) does govern
47# all other use of the material that constitutes the Autoconf Macro.
48#
49# This special exception to the GPL applies to versions of the Autoconf
50# Macro released by the Autoconf Archive. When you make and distribute a
51# modified version of the Autoconf Macro, you may extend this special
52# exception to the GPL to apply to your modified version as well.
53
54#serial 7
55
56AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS])
57AC_DEFUN([AX_CHECK_CLASS],[
58AC_REQUIRE([AX_PROG_JAVA])
59ac_var_name=`echo $1 | sed 's/\./_/g'`
60dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is
61dnl dynamic I need an extra level of extraction
62AC_MSG_CHECKING([for $1 class])
63AC_CACHE_VAL(ax_cv_class_$ac_var_name, [
64if test x$ac_cv_prog_uudecode_base64 = xyes; then
65dnl /**
66dnl * Test.java: used to test dynamicaly if a class exists.
67dnl */
68dnl public class Test
69dnl {
70dnl
71dnl public static void
72dnl main( String[] argv )
73dnl {
74dnl Class lib;
75dnl if (argv.length < 1)
76dnl {
77dnl System.err.println ("Missing argument");
78dnl System.exit (77);
79dnl }
80dnl try
81dnl {
82dnl lib = Class.forName (argv[0]);
83dnl }
84dnl catch (ClassNotFoundException e)
85dnl {
86dnl System.exit (1);
87dnl }
88dnl lib = null;
89dnl System.exit (0);
90dnl }
91dnl
92dnl }
93cat << \EOF > Test.uue
94begin-base64 644 Test.class
95yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
96bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
97bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
98AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
99ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
100ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
101VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
102amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
103AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
104AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
105AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
106uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
107AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
108JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
109JwAAAAIAKA==
110====
111EOF
112 if $UUDECODE Test.uue; then
113 :
114 else
115 echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD
116 echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD
117 cat Test.uue >&AS_MESSAGE_LOG_FD
118 ac_cv_prog_uudecode_base64=no
119 fi
120 rm -f Test.uue
0b7af945 121 if AC_TRY_COMMAND($JAVA -classpath ".:$CLASSPATH" $JAVAFLAGS Test $1) >/dev/null 2>&1; then
504d4ace
DG
122 eval "ac_cv_class_$ac_var_name=yes"
123 else
124 eval "ac_cv_class_$ac_var_name=no"
125 fi
126 rm -f Test.class
127else
128 AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"],
129 [eval "ac_cv_class_$ac_var_name=no"])
130fi
131eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
132eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
133HAVE_LAST_CLASS=$ac_var_val
134if test x$ac_var_val = xyes; then
135 ifelse([$2], , :, [$2])
136else
137 ifelse([$3], , :, [$3])
138fi
139])
140dnl for some reason the above statment didn't fall though here?
141dnl do scripts have variable scoping?
142eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
143AC_MSG_RESULT($ac_var_val)
144])
This page took 0.032905 seconds and 4 git commands to generate.