m4: sync ax_pthread.m4 with autoconf archive
[lttng-tools.git] / m4 / ax_check_class.m4
CommitLineData
504d4ace 1# ===========================================================================
6333b87b 2# https://www.gnu.org/software/autoconf-archive/ax_check_class.html
504d4ace
DG
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
6333b87b 39# with this program. If not, see <https://www.gnu.org/licenses/>.
504d4ace
DG
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
6333b87b 54#serial 12
504d4ace
DG
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'`
6333b87b 60dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is
504d4ace
DG
61dnl dynamic I need an extra level of extraction
62AC_MSG_CHECKING([for $1 class])
63AC_CACHE_VAL(ax_cv_class_$ac_var_name, [
504d4ace
DG
64 AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"],
65 [eval "ac_cv_class_$ac_var_name=no"])
504d4ace
DG
66eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
67eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`"
68HAVE_LAST_CLASS=$ac_var_val
69if test x$ac_var_val = xyes; then
70 ifelse([$2], , :, [$2])
71else
72 ifelse([$3], , :, [$3])
73fi
74])
6333b87b 75dnl for some reason the above statement didn't fall though here?
504d4ace
DG
76dnl do scripts have variable scoping?
77eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`"
78AC_MSG_RESULT($ac_var_val)
79])
This page took 0.032242 seconds and 4 git commands to generate.