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.

102 lines
3.9KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_check_java_plugin.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_CHECK_JAVA_PLUGIN(<shell-variable>)
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro sets <shell-variable> to empty on failure and to a compatible
  12. # version of plugin.jar otherwise. Directories searched are /usr/java/*
  13. # and /usr/local/java/*, which are assumed to be j{dk,re} installations.
  14. # Apply the shell variable as you see fit. If sun changes things so
  15. # <jre>/lib/plugin.jar is not the magic file it will stop working.
  16. #
  17. # This macro assumes that unzip, zipinfo or pkzipc is available (and can
  18. # list the contents of the jar archive). The first two are assumed to work
  19. # similarly enough to the infozip versions. The pkzipc version is assumed
  20. # to work if I understand the documentation on pkware's site but YMMV. I
  21. # do not have access to pwkware's version to test it.
  22. #
  23. # LICENSE
  24. #
  25. # Copyright (c) 2008 Duncan Simpson <dps@simpson.demon.co.uk>
  26. #
  27. # This program is free software; you can redistribute it and/or modify it
  28. # under the terms of the GNU General Public License as published by the
  29. # Free Software Foundation; either version 2 of the License, or (at your
  30. # option) any later version.
  31. #
  32. # This program is distributed in the hope that it will be useful, but
  33. # WITHOUT ANY WARRANTY; without even the implied warranty of
  34. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  35. # Public License for more details.
  36. #
  37. # You should have received a copy of the GNU General Public License along
  38. # with this program. If not, see <https://www.gnu.org/licenses/>.
  39. #
  40. # As a special exception, the respective Autoconf Macro's copyright owner
  41. # gives unlimited permission to copy, distribute and modify the configure
  42. # scripts that are the output of Autoconf when processing the Macro. You
  43. # need not follow the terms of the GNU General Public License when using
  44. # or distributing such scripts, even though portions of the text of the
  45. # Macro appear in them. The GNU General Public License (GPL) does govern
  46. # all other use of the material that constitutes the Autoconf Macro.
  47. #
  48. # This special exception to the GPL applies to versions of the Autoconf
  49. # Macro released by the Autoconf Archive. When you make and distribute a
  50. # modified version of the Autoconf Macro, you may extend this special
  51. # exception to the GPL to apply to your modified version as well.
  52. #serial 11
  53. AU_ALIAS([DPS_CHECK_PLUGIN], [AX_CHECK_JAVA_PLUGIN])
  54. AC_DEFUN([AX_CHECK_JAVA_PLUGIN],
  55. [AC_REQUIRE([AC_PROG_AWK])
  56. AC_REQUIRE([AC_PROG_FGREP])
  57. AC_CHECK_PROG(ZIPINFO,[zipinfo unzip pkzipc])
  58. AC_MSG_CHECKING([for the java plugin])
  59. case "x$ZIPINFO" in
  60. [*/zipinfo)]
  61. zipinf="zipinfo -1" ;;
  62. [*/unzip)]
  63. zipinf="unzip -l";;
  64. [*/pkzipc)]
  65. ziping="unzipc -view";;
  66. [x*)]
  67. AC_MSG_RESULT([skiped, none of zipinfo, unzip and pkzipc found])
  68. AC_SUBST($1,[])
  69. zipinf="";;
  70. esac
  71. if test "x$zipinf" != "x"; then
  72. jplugin=""
  73. for jhome in `ls -dr /usr/java/* /usr/local/java/* 2> /dev/null`; do
  74. for jfile in lib/plugin.jar jre/lib/plugin.jar; do
  75. if test "x$jplugin" = "x" && test -f "$jhome/$jfile"; then
  76. eval "$zipinf $jhome/$jfile | $AWK '{ print \$NF; }' | $FGREP netscape/javascript/JSObject" >/dev/null 2>/dev/null
  77. if test $? -eq 0; then
  78. dnl Some version of gcj (and javac) refuse to work with some files
  79. dnl that pass this test. To stop this problem make sure that the compiler
  80. dnl still works with this jar file in the classpath
  81. cat << \EOF > Test.java
  82. /* [#]line __oline__ "configure" */
  83. public class Test {
  84. }
  85. EOF
  86. if eval "$JAVAC -classpath $jhome/$jfile Test.java 2>/dev/null >/dev/null" && test -f Test.class; then
  87. jplugin="$jhome/$jfile"
  88. fi
  89. rm -f Test.java Test.class
  90. fi; fi; done; done
  91. if test "x$jplugin" != "x"; then
  92. AC_SUBST($1,$jplugin)
  93. AC_MSG_RESULT($jplugin)
  94. else
  95. AC_MSG_RESULT([java plugin not found])
  96. AC_SUBST($1,[])
  97. fi
  98. fi
  99. ])