You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
145 lines
5.4 KiB
145 lines
5.4 KiB
8 years ago
|
# ===========================================================================
|
||
|
# http://www.gnu.org/software/autoconf-archive/ax_check_class.html
|
||
|
# ===========================================================================
|
||
|
#
|
||
|
# SYNOPSIS
|
||
|
#
|
||
|
# AX_CHECK_CLASS
|
||
|
#
|
||
|
# DESCRIPTION
|
||
|
#
|
||
|
# AX_CHECK_CLASS tests the existence of a given Java class, either in a
|
||
|
# jar or in a '.class' file.
|
||
|
#
|
||
|
# *Warning*: its success or failure can depend on a proper setting of the
|
||
|
# CLASSPATH env. variable.
|
||
|
#
|
||
|
# Note: This is part of the set of autoconf M4 macros for Java programs.
|
||
|
# It is VERY IMPORTANT that you download the whole set, some macros depend
|
||
|
# on other. Unfortunately, the autoconf archive does not support the
|
||
|
# concept of set of macros, so I had to break it for submission. The
|
||
|
# general documentation, as well as the sample configure.in, is included
|
||
|
# in the AX_PROG_JAVA macro.
|
||
|
#
|
||
|
# LICENSE
|
||
|
#
|
||
|
# Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr>
|
||
|
#
|
||
|
# This program is free software; you can redistribute it and/or modify it
|
||
|
# under the terms of the GNU General Public License as published by the
|
||
|
# Free Software Foundation; either version 2 of the License, or (at your
|
||
|
# option) any later version.
|
||
|
#
|
||
|
# This program is distributed in the hope that it will be useful, but
|
||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||
|
# Public License for more details.
|
||
|
#
|
||
|
# You should have received a copy of the GNU General Public License along
|
||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
#
|
||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||
|
# need not follow the terms of the GNU General Public License when using
|
||
|
# or distributing such scripts, even though portions of the text of the
|
||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||
|
#
|
||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||
|
# modified version of the Autoconf Macro, you may extend this special
|
||
|
# exception to the GPL to apply to your modified version as well.
|
||
|
|
||
|
#serial 7
|
||
|
|
||
|
AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS])
|
||
|
AC_DEFUN([AX_CHECK_CLASS],[
|
||
|
AC_REQUIRE([AX_PROG_JAVA])
|
||
|
ac_var_name=`echo $1 | sed 's/\./_/g'`
|
||
|
dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is
|
||
|
dnl dynamic I need an extra level of extraction
|
||
|
AC_MSG_CHECKING([for $1 class])
|
||
|
AC_CACHE_VAL(ax_cv_class_$ac_var_name, [
|
||
|
if test x$ac_cv_prog_uudecode_base64 = xyes; then
|
||
|
dnl /**
|
||
|
dnl * Test.java: used to test dynamicaly if a class exists.
|
||
|
dnl */
|
||
|
dnl public class Test
|
||
|
dnl {
|
||
|
dnl
|
||
|
dnl public static void
|
||
|
dnl main( String[] argv )
|
||
|
dnl {
|
||
|
dnl Class lib;
|
||
|
dnl if (argv.length < 1)
|
||
|
dnl {
|
||
|
dnl System.err.println ("Missing argument");
|
||
|
dnl System.exit (77);
|
||
|
dnl }
|
||
|
dnl try
|
||
|
dnl {
|
||
|
dnl lib = Class.forName (argv[0]);
|
||
|
dnl }
|
||
|
dnl catch (ClassNotFoundException e)
|
||
|
dnl {
|
||
|
dnl System.exit (1);
|
||
|
dnl }
|
||
|
dnl lib = null;
|
||
|
dnl System.exit (0);
|
||
|
dnl }
|
||
|
dnl
|
||
|
dnl }
|
||
|
cat << \EOF > Test.uue
|
||
|
begin-base64 644 Test.class
|
||
|
yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE
|
||
|
bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51
|
||
|
bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ
|
||
|
AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt
|
||
|
ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV
|
||
|
ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp
|
||
|
VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM
|
||
|
amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi
|
||
|
AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B
|
||
|
AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA
|
||
|
AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN
|
||
|
uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK
|
||
|
AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA
|
||
|
JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA
|
||
|
JwAAAAIAKA==
|
||
|
====
|
||
|
EOF
|
||
|
if $UUDECODE Test.uue; then
|
||
|
:
|
||
|
else
|
||
|
echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD
|
||
|
echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD
|
||
|
cat Test.uue >&AS_MESSAGE_LOG_FD
|
||
|
ac_cv_prog_uudecode_base64=no
|
||
|
fi
|
||
|
rm -f Test.uue
|
||
|
if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then
|
||
|
eval "ac_cv_class_$ac_var_name=yes"
|
||
|
else
|
||
|
eval "ac_cv_class_$ac_var_name=no"
|
||
|
fi
|
||
|
rm -f Test.class
|
||
|
else
|
||
|
AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"],
|
||
|
[eval "ac_cv_class_$ac_var_name=no"])
|
||
|
fi
|
||
|
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
|
||
|
eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
|
||
|
HAVE_LAST_CLASS=$ac_var_val
|
||
|
if test x$ac_var_val = xyes; then
|
||
|
ifelse([$2], , :, [$2])
|
||
|
else
|
||
|
ifelse([$3], , :, [$3])
|
||
|
fi
|
||
|
])
|
||
|
dnl for some reason the above statment didn't fall though here?
|
||
|
dnl do scripts have variable scoping?
|
||
|
eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
|
||
|
AC_MSG_RESULT($ac_var_val)
|
||
|
])
|