Collection of DPF-based plugins for packaging
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.

86 lines
3.4KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_java_check_class.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_JAVA_CHECK_CLASS(<class>,<action-if-found>,<action-if-not-found>)
  8. #
  9. # DESCRIPTION
  10. #
  11. # Test if a Java class is available. Based on AX_PROG_JAVAC_WORKS. This
  12. # version uses a cache variable which is both compiler, options and
  13. # classpath dependent (so if you switch from javac to gcj it correctly
  14. # notices and redoes the test).
  15. #
  16. # The macro tries to compile a minimal program importing <class>. Some
  17. # newer compilers moan about the failure to use this but fail or produce a
  18. # class file anyway. All moaning is sunk to /dev/null since I only wanted
  19. # to know if the class could be imported. This is a recommended followup
  20. # to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted.
  21. #
  22. # LICENSE
  23. #
  24. # Copyright (c) 2008 Duncan Simpson <dps@simpson.demon.co.uk>
  25. #
  26. # This program is free software; you can redistribute it and/or modify it
  27. # under the terms of the GNU General Public License as published by the
  28. # Free Software Foundation; either version 2 of the License, or (at your
  29. # option) any later version.
  30. #
  31. # This program is distributed in the hope that it will be useful, but
  32. # WITHOUT ANY WARRANTY; without even the implied warranty of
  33. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  34. # Public License for more details.
  35. #
  36. # You should have received a copy of the GNU General Public License along
  37. # with this program. If not, see <https://www.gnu.org/licenses/>.
  38. #
  39. # As a special exception, the respective Autoconf Macro's copyright owner
  40. # gives unlimited permission to copy, distribute and modify the configure
  41. # scripts that are the output of Autoconf when processing the Macro. You
  42. # need not follow the terms of the GNU General Public License when using
  43. # or distributing such scripts, even though portions of the text of the
  44. # Macro appear in them. The GNU General Public License (GPL) does govern
  45. # all other use of the material that constitutes the Autoconf Macro.
  46. #
  47. # This special exception to the GPL applies to versions of the Autoconf
  48. # Macro released by the Autoconf Archive. When you make and distribute a
  49. # modified version of the Autoconf Macro, you may extend this special
  50. # exception to the GPL to apply to your modified version as well.
  51. #serial 12
  52. AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS])
  53. AC_DEFUN([AX_JAVA_CHECK_CLASS],[
  54. m4_define([cache_val],[m4_translit(ax_cv_have_java_class_$1, " ." ,"__")])
  55. if test "x$CLASSPATH" != "x"; then
  56. xtra=" with classpath ${CLASSPATH}"
  57. xopts=`echo ${CLASSPATH} | ${SED} 's/^ *://'`
  58. xopts="-classpath $xopts"
  59. else xtra=""; xopts=""; fi
  60. cache_var="cache_val"AS_TR_SH([_Jc_${JAVAC}_Cp_${CLASSPATH}])
  61. AC_CACHE_CHECK([if the $1 class is available$xtra], [$cache_var], [
  62. JAVA_TEST=Test.java
  63. CLASS_TEST=Test.class
  64. cat << \EOF > $JAVA_TEST
  65. /* [#]xline __oline__ "configure" */
  66. import $1;
  67. public class Test {
  68. }
  69. EOF
  70. if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $xopts $JAVA_TEST) >/dev/null 2>&1; then
  71. eval "${cache_var}=yes"
  72. else
  73. eval "${cache_var}=no"
  74. echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
  75. cat $JAVA_TEST >&AS_MESSAGE_LOG_FD
  76. fi
  77. rm -f $JAVA_TEST $CLASS_TEST
  78. ])
  79. if eval 'test "x$'${cache_var}'" = "xyes"'; then
  80. $2
  81. true; else
  82. $3
  83. false; fi])