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