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.

65 lines
2.2KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_JAVAH
  8. #
  9. # DESCRIPTION
  10. #
  11. # AX_PROG_JAVAH tests the availability of the javah header generator and
  12. # looks for the jni.h header file. If available, JAVAH is set to the full
  13. # path of javah and CPPFLAGS is updated accordingly.
  14. #
  15. # LICENSE
  16. #
  17. # Copyright (c) 2008 Luc Maisonobe <luc@spaceroots.org>
  18. #
  19. # Copying and distribution of this file, with or without modification, are
  20. # permitted in any medium without royalty provided the copyright notice
  21. # and this notice are preserved. This file is offered as-is, without any
  22. # warranty.
  23. #serial 10
  24. AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH])
  25. AC_DEFUN([AX_PROG_JAVAH],[
  26. AC_REQUIRE([AC_CANONICAL_BUILD])dnl
  27. AC_REQUIRE([AC_PROG_CPP])dnl
  28. AC_PATH_PROG(JAVAH,javah)
  29. AS_IF([test -n "$ac_cv_path_JAVAH"],
  30. [
  31. AC_TRY_CPP([#include <jni.h>],,[
  32. ac_save_CPPFLAGS="$CPPFLAGS"
  33. _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH")
  34. ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])`
  35. ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include"
  36. AS_CASE([$build_os],
  37. [cygwin*|mingw*],
  38. [ac_machdep=win32],
  39. [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`])
  40. CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep"
  41. AC_TRY_CPP([#include <jni.h>],
  42. ac_save_CPPFLAGS="$CPPFLAGS",
  43. AC_MSG_WARN([unable to include <jni.h>]))
  44. CPPFLAGS="$ac_save_CPPFLAGS"])
  45. ])
  46. ])
  47. AC_DEFUN([_ACJAVAH_FOLLOW_SYMLINKS],[
  48. # find the include directory relative to the javac executable
  49. _cur="$1"
  50. while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do
  51. AC_MSG_CHECKING([symlink for $_cur])
  52. _slink=`ls -ld "$_cur" | sed 's/.* -> //'`
  53. case "$_slink" in
  54. /*) _cur="$_slink";;
  55. # 'X' avoids triggering unwanted echo options.
  56. *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";;
  57. esac
  58. AC_MSG_RESULT([$_cur])
  59. done
  60. _ACJAVAH_FOLLOWED="$_cur"
  61. ])