File: bindings.m4

package info (click to toggle)
brltty 5.6-10~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 25,116 kB
  • sloc: ansic: 117,871; sh: 6,590; java: 4,785; xml: 3,451; makefile: 1,973; tcl: 1,499; awk: 611; ml: 293; python: 250; lisp: 52
file content (127 lines) | stat: -rw-r--r-- 3,629 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
###############################################################################
# libbrlapi - A library providing access to braille terminals for applications.
#
# Copyright (C) 2006-2018 by
#   Samuel Thibault <Samuel.Thibault@ens-lyon.org>
#   S├ębastien Hinderer <Sebastien.Hinderer@ens-lyon.org>
#
# libbrlapi comes with ABSOLUTELY NO WARRANTY.
#
# This is free software, placed under the terms of the
# GNU Lesser General Public License, as published by the Free Software
# Foundation; either version 2.1 of the License, or (at your option) any
# later version. Please see the file LICENSE-LGPL for details.
#
# Web Page: http://brltty.com/
#
# This software is maintained by Dave Mielke <dave@mielke.cc>.
###############################################################################

AC_DEFUN([BRLTTY_JAVA_BINDINGS], [dnl
if test -n "${JAVA_HOME}"
then
   BRLTTY_JAVA_COMPILER([javac], ["${JAVA_HOME}/bin"])
else
   BRLTTY_JAVA_COMPILER([javac], [], [dnl
      BRLTTY_JAVA_COMPILER([javac], [/usr/java/bin /usr/java/jdk*/bin], [dnl
         BRLTTY_JAVA_COMPILER([gcj])
      ])
   ])
fi

JAVA_OK=false
if test -n "${JAVAC_PATH}"
then
   path=`realpath -e -- "${JAVAC_PATH}"` && JAVAC_PATH="${path}"
   AC_MSG_NOTICE([Java compiler is ${JAVAC_PATH}])
   JAVA_OK=true

   JAVA_ENCODING="UTF-8"
   JAVA_TARGET="-source 1.6 -target 1.6"
   case "${JAVAC_NAME}"
   in
      javac) JAVAC_OPTIONS="-encoding ${JAVA_ENCODING} ${JAVA_TARGET}";;
      gcj)   JAVAC_OPTIONS="-C --encoding=${JAVA_ENCODING}";;
      *)     JAVAC_OPTIONS="";;
   esac
   AC_SUBST([JAVAC], ["'${JAVAC_PATH}' ${JAVAC_OPTIONS}"])

   JAVA_BIN=`AS_DIRNAME("${JAVAC_PATH}")`
   JAVA_ROOT=`AS_DIRNAME("${JAVA_BIN}")`

   AC_CHECK_PROGS([JAVADOC_NAME], [javadoc gjdoc], [], ["${JAVA_BIN}"])
   if test -n "${JAVADOC_NAME}"
   then
      JAVADOC_PATH="${JAVA_BIN}/${JAVADOC_NAME}"
   else
      JAVADOC_PATH=":"
   fi
   AC_SUBST([JAVADOC], ["'${JAVADOC_PATH}' -encoding ${JAVA_ENCODING}"])

   AC_CHECK_PROGS([JAR_NAME], [jar gjar], [JAR_NOT_FOUND_BY_CONFIGURE], ["${JAVA_BIN}"])
   AC_SUBST([JAR], ["'${JAVA_BIN}/${JAR_NAME}'"])
   BRLTTY_JAVA_DIRECTORY([JAR], [/usr/share/java /mingw])

   JAVA_JNI_INC="${JAVA_ROOT}/include"
   JAVA_JNI_HDR="jni.h"
   JAVA_JNI_FLAGS=""
   AC_CHECK_HEADER([${JAVA_JNI_HDR}], [], [AC_CHECK_FILE(["${JAVA_JNI_INC}/${JAVA_JNI_HDR}"], [JAVA_JNI_FLAGS="-I${JAVA_JNI_INC}"], [JAVA_OK=false])])

   "${JAVA_OK}" && {
     set -- "${JAVA_JNI_INC}"/*/jni_md.h

     if test ${#} -eq 1
     then
        directory=`AS_DIRNAME("${1}")`
        JAVA_JNI_FLAGS="${JAVA_JNI_FLAGS} -I${directory}"
     elif test ${#} -gt 0
     then
        AC_MSG_WARN([more than one machine-dependent Java header found: ${*}])
        JAVA_OK=false
     fi
   }

   AC_SUBST([JAVA_JNI_HDR])
   AC_SUBST([JAVA_JNI_INC], ["'${JAVA_JNI_INC}'"])
   AC_SUBST([JAVA_JNI_FLAGS])
   BRLTTY_JAVA_DIRECTORY([JNI], [/usr/lib*/java /usr/lib*/jni /mingw])
else
   AC_MSG_WARN([Java compiler not found])
fi

AC_SUBST([JAVA_OK])
])

AC_DEFUN([BRLTTY_JAVA_COMPILER], [dnl
AC_PATH_PROG([JAVAC_PATH], [$1], [], [$2])
if test -n "${JAVAC_PATH}"
then
   JAVAC_NAME="$1"
ifelse(len([$3]), 0, [], [dnl
else
   $3
])dnl
fi])

AC_DEFUN([BRLTTY_JAVA_DIRECTORY], [dnl
JAVA_$1_DIR=""
for directory in $2
do
   test -d "${directory}" && {
      JAVA_$1_DIR="${directory}"
      break
   }
done

if test -n "${JAVA_$1_DIR}"
then
   JAVA_$1="yes"
   AC_MSG_NOTICE([Java] m4_tolower([$1]) [installation directory is ${JAVA_$1_DIR}])
else
   JAVA_$1="no"
   AC_MSG_WARN([no commonly used] m4_tolower([$1]) [installation directory])
fi

AC_SUBST([JAVA_$1])
AC_SUBST([JAVA_$1_DIR])
])