File: java.m4

package info (click to toggle)
emboss 6.6.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 571,536 kB
  • ctags: 40,250
  • sloc: ansic: 460,579; java: 29,439; perl: 13,573; sh: 12,754; makefile: 3,283; csh: 706; asm: 351; xml: 239; pascal: 237; modula3: 8
file content (249 lines) | stat: -rw-r--r-- 6,701 bytes parent folder | download | duplicates (24)
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
dnl                                            -*- Autoconf -*-
dnl @synopsis CHECK_JAVA()
dnl
dnl Need to specify --with-java and --with-javaos
dnl @author Alan Bleasby
dnl
dnl This macro calls:
dnl
dnl   AC_SUBST([JAVA_CFLAGS])
dnl   AC_SUBST([JAVA_CPPFLAGS])
dnl   AC_SUBST([JAVA_LDFLAGS])
dnl
dnl   AM_CONDITIONAL([JAVA_BUILD], ...)
dnl
dnl And sets:
dnl
dnl   AC_DEFINE([HAVE_JAVA], ...)
dnl
dnl   AC_PATH_PROG([ANT], ...)
dnl   AC_PATH_PROG([JAR], ...)
dnl   AC_PATH_PROG([JAVA], ...)
dnl   AC_PATH_PROG([JAVAC], ...)

AC_DEFUN([CHECK_JAVA],
[
  JAVA_CFLAGS=""
  JAVA_CPPFLAGS=""
  JAVA_LDFLAGS=""

  have_java="yes"
  auth_java=""

  AC_MSG_CHECKING([for Java JNI])

  AC_ARG_WITH([java],
  [AS_HELP_STRING([--with-java@<:@=ARG@:>@],
  [root directory path of Java installation])],
  [
    AC_MSG_RESULT([${withval}])
    AS_IF([test "x${withval}" = "xno"], [have_java="no"])
  ],
  [
    AC_MSG_RESULT([no])
    have_java="no"
  ])

  AS_IF([test "x${have_java}" = "xyes"],
  [
    # If specified, the Java JNI include directory has to exist.
    AS_IF([test -d ${with_java}],
    [AS_VAR_SET([JAVA_CPPFLAGS], ["-I${withval}"])],
    [
      have_java="no"
      AC_MSG_ERROR([Java include directory ${withval} does not exist])
    ])
  ])

  AC_MSG_CHECKING([for Java JNI OS])

  AC_ARG_WITH([javaos],
  [AS_HELP_STRING([--with-javaos@<:@=ARG@:>@],
  [root directory path of Java OS include])],
  [
    AC_MSG_RESULT([${withval}])

    AS_IF([test "x${withval}" != "xno"],
    [
      # If specified, the Java JNI OS include directory has to exist.
      AS_IF([test "x${have_java}" = "xyes" && test -d ${withval}],
      [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -I${withval}"])],
      [
        have_java="no"
        AC_MSG_ERROR([Java OS include directory ${withval} does not exist])
      ])
    ])
  ],
  [
    AC_MSG_RESULT([no])
  ])

  # Authorisation type

  AC_MSG_CHECKING([for authorisation type])

  AC_ARG_WITH([auth],
  [AS_HELP_STRING([--with-auth@<:@=ARG@:>@],
  [authorisation mechanism for Jemboss server @<:@default=PAM@:>@])],
  [
    AS_IF([test "x${withval}" != "xno"],
    [
      AC_MSG_RESULT([yes])

      AS_CASE([${withval}],
      [yes],
      [
        auth_java="PAM"
        AC_CHECK_LIB([pam], [main],
        [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpam"])])
      ],
      [pam],
      [
        auth_java="PAM"
        AC_CHECK_LIB([pam], [main],
        [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpam"])])
      ],
      [shadow],
      [
        auth_java="N_SHADOW"
        AC_CHECK_LIB([crypy], [main],
        [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lcrypt"])])
      ],
      [rshadow],
      [
        auth_java="R_SHADOW"
        AC_CHECK_LIB([crypy], [main],
        [AS_VAR_APPEND([JAVA_LDFLAGS], [" -lcrypt"])])
      ],
      [noshadow],
      [auth_java="NO_SHADOW"],
      [rnoshadow],
      [auth_java="RNO_SHADOW"],
      [aixshadow],
      [auth_java="AIX_SHADOW"],
      [hpuxshadow],
      [auth_java="HPUX_SHADOW"])
    ],
    [AC_MSG_RESULT([no])])
  ],
  [AC_MSG_RESULT([no])])

  AS_IF([test -n "${auth_java}"],
  [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D${auth_java}"])],
  [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -DNO_AUTH"])])

  # Threading type

  AC_MSG_CHECKING([for threading type])

  AC_ARG_WITH([thread],
  [AS_HELP_STRING([--with-thread@<:@=ARG@:>@],
  [thread type @<:@default=linux@:>@])],
  [
    AS_IF([test "x${withval}" != "xno"],
    [
      AC_MSG_RESULT([yes])

      AS_CASE([${withval}],
      [yes],
      [
        AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        # AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [freebsd],
      [
        AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_THREAD_SAFE"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -pthread"])
        # AS_VAR_APPEND([LIBS], [" -lc_r"])
      ],
      [linux],
      [
        AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        # AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [solaris],
      [
        AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_POSIX_C_SOURCE=199506L"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        # AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [macos],
      [
        # AS_VAR_APPEND([JAVA_CPPFLAGS], [""])
        # AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        # AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [hpux],
      [
        AS_VAR_APPEND([JAVA_CFLAGS], [" -Ae +z"])
        AS_VAR_APPEND([JAVA CPPFLAGS], [" -DNATIVE -D_POSIX_C_SOURCE=199506L"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        # AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [irix],
      [
        # AS_VAR_APPEND([JAVA_CFLAGS], [""])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [aix],
      [
        AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        AS_VAR_APPEND([LIBS], [" -lpthread"])
      ],
      [osf],
      [
        AS_VAR_APPEND([JAVA_CPPFLAGS], [" -D_REENTRANT -D_OSF_SOURCE"])
        AS_VAR_APPEND([JAVA_LDFLAGS], [" -lpthread"])
        AS_VAR_APPEND([LIBS], [" -lpthread"])
      ])
    ],
    [AC_MSG_RESULT([no])])
  ],
  [AC_MSG_RESULT([no])])

  # Test for programs ant, jar, java and javac.

  AS_IF([test "x${have_java}" = "xyes"],
  [
    AC_PATH_PROG([ANT], [ant], [no])
    AS_IF([test "x${ANT}" = "xno"], [have_java="no"])

    AC_PATH_PROG([JAR], [jar], [no])
    AS_IF([test "x${JAR}" = "xno"], [have_java="no"])

    AC_PATH_PROG([JAVA], [java], [no])
    AS_IF([test "x${JAVA}" = "xno"], [have_java="no"])

    AC_PATH_PROG([JAVAC], [javac], [no])
    AS_IF([test "x${JAVAC}" = "xno"], [have_java="no"])
  ])

  AS_IF([test "x${have_java}" = "xyes"],
  [
    AC_DEFINE([HAVE_JAVA], [1],
    [Define to 1 if the Java Native Interface (JNI) is available.])

    ### FIXME: Append -DDEBIAN for the moment.
    # Debian uses PAM service "ssh" instead of "login", see ajjava.c
    # This could use AC_DEFINE() if no better option was avialable.
    # Ultimately, this should be configurable via server configuration
    # files.
    AS_IF([test -f "/etc/debian_release" || test -f /etc/debian_version],
    [AS_VAR_APPEND([JAVA_CPPFLAGS], [" -DDEBIAN"])])
  ])

  AC_ARG_VAR([ANT], [Path to the Apache Ant make tool])
  AC_ARG_VAR([JAR], [Path to the Java archive tool])
  AC_ARG_VAR([JAVA], [Path to the Java application launcher])
  AC_ARG_VAR([JAVAC], [Path to the Java compiler])

  AC_SUBST([JAVA_CFLAGS])
  AC_SUBST([JAVA_CPPFLAGS])
  AC_SUBST([JAVA_LDFLAGS])

  AM_CONDITIONAL([JAVA_BUILD], [test "x${have_java}" = "xyes"])
])