| 1 | # SPDX-License-Identifier: GPL-2.0-or-later WITH LicenseRef-Autoconf-exception-macro |
| 2 | # |
| 3 | # =========================================================================== |
| 4 | # https://www.gnu.org/software/autoconf-archive/ax_check_class.html |
| 5 | # =========================================================================== |
| 6 | # |
| 7 | # SYNOPSIS |
| 8 | # |
| 9 | # AX_CHECK_CLASS |
| 10 | # |
| 11 | # DESCRIPTION |
| 12 | # |
| 13 | # AX_CHECK_CLASS tests the existence of a given Java class, either in a |
| 14 | # jar or in a '.class' file. |
| 15 | # |
| 16 | # *Warning*: its success or failure can depend on a proper setting of the |
| 17 | # CLASSPATH env. variable. |
| 18 | # |
| 19 | # Note: This is part of the set of autoconf M4 macros for Java programs. |
| 20 | # It is VERY IMPORTANT that you download the whole set, some macros depend |
| 21 | # on other. Unfortunately, the autoconf archive does not support the |
| 22 | # concept of set of macros, so I had to break it for submission. The |
| 23 | # general documentation, as well as the sample configure.in, is included |
| 24 | # in the AX_PROG_JAVA macro. |
| 25 | # |
| 26 | # LICENSE |
| 27 | # |
| 28 | # Copyright (c) 2008 Stephane Bortzmeyer <bortzmeyer@pasteur.fr> |
| 29 | # |
| 30 | # This program is free software; you can redistribute it and/or modify it |
| 31 | # under the terms of the GNU General Public License as published by the |
| 32 | # Free Software Foundation; either version 2 of the License, or (at your |
| 33 | # option) any later version. |
| 34 | # |
| 35 | # This program is distributed in the hope that it will be useful, but |
| 36 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 37 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
| 38 | # Public License for more details. |
| 39 | # |
| 40 | # You should have received a copy of the GNU General Public License along |
| 41 | # with this program. If not, see <https://www.gnu.org/licenses/>. |
| 42 | # |
| 43 | # As a special exception, the respective Autoconf Macro's copyright owner |
| 44 | # gives unlimited permission to copy, distribute and modify the configure |
| 45 | # scripts that are the output of Autoconf when processing the Macro. You |
| 46 | # need not follow the terms of the GNU General Public License when using |
| 47 | # or distributing such scripts, even though portions of the text of the |
| 48 | # Macro appear in them. The GNU General Public License (GPL) does govern |
| 49 | # all other use of the material that constitutes the Autoconf Macro. |
| 50 | # |
| 51 | # This special exception to the GPL applies to versions of the Autoconf |
| 52 | # Macro released by the Autoconf Archive. When you make and distribute a |
| 53 | # modified version of the Autoconf Macro, you may extend this special |
| 54 | # exception to the GPL to apply to your modified version as well. |
| 55 | |
| 56 | #serial 12 |
| 57 | |
| 58 | AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) |
| 59 | AC_DEFUN([AX_CHECK_CLASS],[ |
| 60 | AC_REQUIRE([AX_PROG_JAVA]) |
| 61 | ac_var_name=`echo $1 | sed 's/\./_/g'` |
| 62 | dnl Normally I'd use a AC_CACHE_CHECK here but since the variable name is |
| 63 | dnl dynamic I need an extra level of extraction |
| 64 | AC_MSG_CHECKING([for $1 class]) |
| 65 | AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ |
| 66 | AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], |
| 67 | [eval "ac_cv_class_$ac_var_name=no"]) |
| 68 | eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" |
| 69 | eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" |
| 70 | HAVE_LAST_CLASS=$ac_var_val |
| 71 | if test x$ac_var_val = xyes; then |
| 72 | ifelse([$2], , :, [$2]) |
| 73 | else |
| 74 | ifelse([$3], , :, [$3]) |
| 75 | fi |
| 76 | ]) |
| 77 | dnl for some reason the above statement didn't fall though here? |
| 78 | dnl do scripts have variable scoping? |
| 79 | eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" |
| 80 | AC_MSG_RESULT($ac_var_val) |
| 81 | ]) |