Build system: implement REUSE with SPDX identifiers
[lttng-ust.git] / m4 / ax_prog_javah.m4
CommitLineData
e03d7c66
MJ
1# SPDX-License-Identifier: FSFAP
2#
5c5aae82 3# ===========================================================================
e465639e 4# https://www.gnu.org/software/autoconf-archive/ax_prog_javah.html
5c5aae82
CB
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
e465639e 26#serial 11
5c5aae82
CB
27
28AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH])
29AC_DEFUN([AX_PROG_JAVAH],[
30AC_REQUIRE([AC_CANONICAL_BUILD])dnl
31AC_REQUIRE([AC_PROG_CPP])dnl
32AC_PATH_PROG(JAVAH,javah)
33AS_IF([test -n "$ac_cv_path_JAVAH"],
34 [
e465639e 35 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],[],[
5c5aae82 36 ac_save_CPPFLAGS="$CPPFLAGS"
e465639e
MJ
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"
5c5aae82 40 AS_CASE([$build_os],
e465639e 41 [cygwin*|mingw*],
5c5aae82
CB
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"
e465639e
MJ
45 AC_PREPROC_IFELSE([AC_LANG_SOURCE([[#include <jni.h>]])],
46 [ac_save_CPPFLAGS="$CPPFLAGS"],
47 [AC_MSG_WARN([unable to include <jni.h>])])
5c5aae82
CB
48 CPPFLAGS="$ac_save_CPPFLAGS"])
49 ])
50])
e465639e
MJ
51
52AC_DEFUN([_ACJAVAH_FOLLOW_SYMLINKS],[
53# find the include directory relative to the javac executable
54_cur="$1"
55while 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])
64done
65_ACJAVAH_FOLLOWED="$_cur"
66])
This page took 0.031639 seconds and 4 git commands to generate.