comparison GEMBASSY-1.0.3/m4/java.m4 @ 2:8947fca5f715 draft default tip

Uploaded
author ktnyt
date Fri, 26 Jun 2015 05:21:44 -0400
parents 84a17b3fad1f
children
comparison
equal deleted inserted replaced
1:84a17b3fad1f 2:8947fca5f715
1 dnl -*- Autoconf -*-
2 dnl @synopsis CHECK_JAVA()
3 dnl
4 dnl Need to specify --with-java and --with-javaos
5 dnl @author Alan Bleasby
6 dnl
7 dnl This macro calls:
8 dnl
9 dnl AC_SUBST([JAVA_CFLAGS])
10 dnl AC_SUBST([JAVA_CPPFLAGS])
11 dnl AC_SUBST([JAVA_LDFLAGS])
12 dnl
13 dnl AM_CONDITIONAL([JAVA_BUILD], ...)
14 dnl
15 dnl And sets:
16 dnl
17 dnl AC_DEFINE([HAVE_JAVA], ...)
18 dnl
19 dnl AC_PATH_PROG([ANT], ...)
20 dnl AC_PATH_PROG([JAR], ...)
21 dnl AC_PATH_PROG([JAVA], ...)
22 dnl AC_PATH_PROG([JAVAC], ...)
23
24 AC_DEFUN([CHECK_JAVA],
25 [
26 JAVA_CFLAGS=""
27 JAVA_CPPFLAGS=""
28 JAVA_LDFLAGS=""
29
30 have_java="yes"
31 auth_java=""
32
33 AC_MSG_CHECKING([for Java JNI])
34
35 AC_ARG_WITH([java],
36 [AS_HELP_STRING([--with-java@<:@=ARG@:>@],
37 [root directory path of Java installation])],
38 [
39 AC_MSG_RESULT([${withval}])
40 AS_IF([test "x${withval}" = "xno"], [have_java="no"])
41 ],
42 [
43 AC_MSG_RESULT([no])
44 have_java="no"
45 ])
46
47 AS_IF([test "x${have_java}" = "xyes"],
48 [
49 # If specified, the Java JNI include directory has to exist.
50 AS_IF([test -d ${with_java}],
51 [AS_VAR_SET([JAVA_CPPFLAGS], ["-I${withval}"])],
52 [
53 have_java="no"
54 AC_MSG_ERROR([Java include directory ${withval} does not exist])
55 ])
56 ])
57
58 AC_MSG_CHECKING([for Java JNI OS])
59
60 AC_ARG_WITH([javaos],
61 [AS_HELP_STRING([--with-javaos@<:@=ARG@:>@],
62 [root directory path of Java OS include])],
63 [
64 AC_MSG_RESULT([${withval}])
65
66 AS_IF([test "x${withval}" != "xno"],
67 [
68 # If specified, the Java JNI OS include directory has to exist.
69 AS_IF([test "x${have_java}" = "xyes" && test -d ${withval}],
70 [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -I${withval}"])],
71 [
72 have_java="no"
73 AC_MSG_ERROR([Java OS include directory ${withval} does not exist])
74 ])
75 ])
76 ],
77 [
78 AC_MSG_RESULT([no])
79 ])
80
81 # Authorisation type
82
83 AC_MSG_CHECKING([for authorisation type])
84
85 AC_ARG_WITH([auth],
86 [AS_HELP_STRING([--with-auth@<:@=ARG@:>@],
87 [authorisation mechanism for Jemboss server @<:@default=PAM@:>@])],
88 [
89 AS_IF([test "x${withval}" != "xno"],
90 [
91 AC_MSG_RESULT([yes])
92
93 AS_CASE([${withval}],
94 [yes],
95 [
96 auth_java="PAM"
97 AC_CHECK_LIB([pam], [main],
98 [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpam"])])
99 ],
100 [pam],
101 [
102 auth_java="PAM"
103 AC_CHECK_LIB([pam], [main],
104 [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpam"])])
105 ],
106 [shadow],
107 [
108 auth_java="N_SHADOW"
109 AC_CHECK_LIB([crypy], [main],
110 [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lcrypt"])])
111 ],
112 [rshadow],
113 [
114 auth_java="R_SHADOW"
115 AC_CHECK_LIB([crypy], [main],
116 [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lcrypt"])])
117 ],
118 [noshadow],
119 [auth_java="NO_SHADOW"],
120 [rnoshadow],
121 [auth_java="RNO_SHADOW"],
122 [aixshadow],
123 [auth_java="AIX_SHADOW"],
124 [hpuxshadow],
125 [auth_java="HPUX_SHADOW"])
126 ],
127 [AC_MSG_RESULT([no])])
128 ],
129 [AC_MSG_RESULT([no])])
130
131 AS_IF([test -n "${auth_java}"],
132 [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D${auth_java}"])],
133 [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -DNO_AUTH"])])
134
135 # Threading type
136
137 AC_MSG_CHECKING([for threading type])
138
139 AC_ARG_WITH([thread],
140 [AS_HELP_STRING([--with-thread@<:@=ARG@:>@],
141 [thread type @<:@default=linux@:>@])],
142 [
143 AS_IF([test "x${withval}" != "xno"],
144 [
145 AC_MSG_RESULT([yes])
146
147 AS_CASE([${withval}],
148 [yes],
149 [
150 AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT"])
151 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
152 # AS_VAR_APPEND([LIBS], [" -lpthread"])
153 ],
154 [freebsd],
155 [
156 AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_THREAD_SAFE"])
157 AS_VAR_APPEND([JAVA_LDFLAGS], [" -pthread"])
158 # AS_VAR_APPEND([LIBS], [" -lc_r"])
159 ],
160 [linux],
161 [
162 AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT"])
163 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
164 # AS_VAR_APPEND([LIBS], [" -lpthread"])
165 ],
166 [solaris],
167 [
168 AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_POSIX_C_SOURCE=199506L"])
169 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
170 # AS_VAR_APPEND([LIBS], [" -lpthread"])
171 ],
172 [macos],
173 [
174 # AS_VAR_APPEND([JAVA_CPPFLAGS], [""])
175 # AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
176 # AS_VAR_APPEND([LIBS], [" -lpthread"])
177 ],
178 [hpux],
179 [
180 AS_VAR_APPEND([JAVA_CFLAGS], [" -Ae +z"])
181 AS_VAR_APPEND([JAVA CPPFLAGS], [" -DNATIVE -D_POSIX_C_SOURCE=199506L"])
182 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
183 # AS_VAR_APPEND([LIBS], [" -lpthread"])
184 ],
185 [irix],
186 [
187 # AS_VAR_APPEND([JAVA_CFLAGS], [""])
188 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
189 AS_VAR_APPEND([LIBS], [" -lpthread"])
190 ],
191 [aix],
192 [
193 AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT"])
194 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
195 AS_VAR_APPEND([LIBS], [" -lpthread"])
196 ],
197 [osf],
198 [
199 AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT -D_OSF_SOURCE"])
200 AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
201 AS_VAR_APPEND([LIBS], [" -lpthread"])
202 ])
203 ],
204 [AC_MSG_RESULT([no])])
205 ],
206 [AC_MSG_RESULT([no])])
207
208 # Test for programs ant, jar, java and javac.
209
210 AS_IF([test "x${have_java}" = "xyes"],
211 [
212 AC_PATH_PROG([ANT], [ant], [no])
213 AS_IF([test "x${ANT}" = "xno"], [have_java="no"])
214
215 AC_PATH_PROG([JAR], [jar], [no])
216 AS_IF([test "x${JAR}" = "xno"], [have_java="no"])
217
218 AC_PATH_PROG([JAVA], [java], [no])
219 AS_IF([test "x${JAVA}" = "xno"], [have_java="no"])
220
221 AC_PATH_PROG([JAVAC], [javac], [no])
222 AS_IF([test "x${JAVAC}" = "xno"], [have_java="no"])
223 ])
224
225 AS_IF([test "x${have_java}" = "xyes"],
226 [
227 AC_DEFINE([HAVE_JAVA], [1],
228 [Define to 1 if the Java Native Interface (JNI) is available.])
229
230 ### FIXME: Append -DDEBIAN for the moment.
231 # Debian uses PAM service "ssh" instead of "login", see ajjava.c
232 # This could use AC_DEFINE() if no better option was avialable.
233 # Ultimately, this should be configurable via server configuration
234 # files.
235 AS_IF([test -f "/etc/debian_release" || test -f /etc/debian_version],
236 [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -DDEBIAN"])])
237 ])
238
239 AC_ARG_VAR([ANT], [Path to the Apache Ant make tool])
240 AC_ARG_VAR([JAR], [Path to the Java archive tool])
241 AC_ARG_VAR([JAVA], [Path to the Java application launcher])
242 AC_ARG_VAR([JAVAC], [Path to the Java compiler])
243
244 AC_SUBST([JAVA_CFLAGS])
245 AC_SUBST([JAVA_CPPFLAGS])
246 AC_SUBST([JAVA_LDFLAGS])
247
248 AM_CONDITIONAL([JAVA_BUILD], [test "x${have_java}" = "xyes"])
249 ])