| 1 | # =========================================================================== |
| 2 | # http://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 | |
| 24 | #serial 7 |
| 25 | |
| 26 | AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) |
| 27 | AC_DEFUN([AX_PROG_JAVAH],[ |
| 28 | AC_REQUIRE([AC_CANONICAL_BUILD])dnl |
| 29 | AC_REQUIRE([AC_PROG_CPP])dnl |
| 30 | AC_PATH_PROG(JAVAH,javah) |
| 31 | AS_IF([test -n "$ac_cv_path_JAVAH"], |
| 32 | [ |
| 33 | AC_TRY_CPP([#include <jni.h>],,[ |
| 34 | ac_save_CPPFLAGS="$CPPFLAGS" |
| 35 | ax_prog_javah_bin_dir=`AS_DIRNAME([$ac_cv_path_JAVAH])` |
| 36 | ac_dir="`AS_DIRNAME([$ax_prog_javah_bin])`/include" |
| 37 | AS_CASE([$build_os], |
| 38 | [cygwin*], |
| 39 | [ac_machdep=win32], |
| 40 | [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) |
| 41 | CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" |
| 42 | AC_TRY_CPP([#include <jni.h>], |
| 43 | ac_save_CPPFLAGS="$CPPFLAGS", |
| 44 | AC_MSG_WARN([unable to include <jni.h>])) |
| 45 | CPPFLAGS="$ac_save_CPPFLAGS"]) |
| 46 | ]) |
| 47 | ]) |