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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
|
dnl Used by aclocal to generate configure
dnl JAPHAR_GREP_CFLAGS(flag, cmd_if_missing, cmd_if_present)
AC_DEFUN([JAPHAR_GREP_CFLAGS],
[case "$CFLAGS" in
"$1" | "$1 "* | *" $1" | *" $1 "* )
ifelse($#, 3, [$3], [:])
;;
*)
$2
;;
esac
])
dnl CLASSPATH_CHECK_JAPHAR
AC_DEFUN([CLASSPATH_CHECK_JAPHAR],
[
if test "x$1" = x; then
AC_PATH_PROG(JAPHAR_CONFIG, japhar-config, "", $PATH:/usr/local/japhar/bin:/usr/japhar/bin)
else
AC_PATH_PROG(JAPHAR_CONFIG, japhar-config, "", $1/bin:$PATH)
fi
if test "x${JAPHAR_CONFIG}" = x; then
echo "configure: cannot find japhar-config: is Japhar installed?" 1>&2
exit 1
fi
AC_MSG_CHECKING(for Japhar)
JAPHAR_PREFIX="`$JAPHAR_CONFIG --prefix`"
JAPHAR_CFLAGS="`$JAPHAR_CONFIG compile`"
JAPHAR_LIBS="`$JAPHAR_CONFIG link`"
JVM="yes"
JVM_REFERENCE="reference"
AC_SUBST(JAPHAR_PREFIX)
AC_SUBST(JAPHAR_CFLAGS)
AC_SUBST(JAPHAR_LIBS)
AC_SUBST(JVM)
AC_SUBST(JVM_REFERENCE)
conditional_with_japhar=true
AC_MSG_RESULT(yes)
dnl define WITH_JAPHAR for native compilation
AC_DEFINE(WITH_JAPHAR)
dnl Reset prefix so that we install into Japhar directory
prefix=$JAPHAR_PREFIX
AC_SUBST(prefix)
dnl programs we probably need somewhere
_t_bindir=`$JAPHAR_CONFIG info bindir`
_t_datadir=`$JAPHAR_CONFIG info datadir`
AC_PATH_PROG(JAPHAR_JABBA, japhar, "", $_t_bindir:$PATH)
AC_PATH_PROG(JAPHAR_JAVAC, javac, "", $_t_bindir:$PATH)
AC_PATH_PROG(JAPHAR_JAVAH, javah, "", $_t_bindir:$PATH)
AC_MSG_CHECKING(for Japhar classes)
if test -e $_t_datadir/classes.zip; then
JAPHAR_CLASSLIB=$_t_datadir/classes.zip
elif test -e $_t_datadir/classes.jar; then
JAPHAR_CLASSLIB=$_t_datadir/classes.jar
elif test -e $_t_datadir/rt.jar; then
JAPHAR_CLASSLIB=$_t_datadir/rt.jar
elif test -e $_t_datadir/rt.zip; then
JAPHAR_CLASSLIB=$_t_datadir/rt.zip
fi
if test $JAPHAR_CLASSLIB ; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(JAPHAR_CLASSLIB)
])
dnl CLASSPATH_CHECK_KAFFE
AC_DEFUN([CLASSPATH_CHECK_KAFFE],
[
AC_PATH_PROG(KAFFE_CONFIG, kaffe-config, "", $PATH:/usr/local/kaffe/bin:/usr/kaffe/bin)
if test "x${KAFFE_CONFIG}" = x; then
echo "configure: cannot find kaffe-config: is Kaffe installed?" 1>&2
exit 1
fi
AC_MSG_CHECKING(for Kaffe)
KAFFE_PREFIX="`$KAFFE_CONFIG --prefix`"
KAFFE_CFLAGS="`$KAFFE_CONFIG compile`"
KAFFE_LIBS="`$KAFFE_CONFIG link`"
JVM="yes"
JVM_REFERENCE="kaffe"
AC_SUBST(KAFFE_PREFIX)
AC_SUBST(KAFFE_CFLAGS)
AC_SUBST(KAFFE_LIBS)
AC_SUBST(JVM)
AC_SUBST(JVM_REFERENCE)
conditional_with_kaffe=true
AC_MSG_RESULT(yes)
dnl define WITH_KAFFE for native compilation
AC_DEFINE(WITH_KAFFE)
dnl Reset prefix so that we install into the Kaffe directory
prefix=$KAFFE_PREFIX
AC_SUBST(prefix)
dnl programs we probably need somewhere
_t_bindir=`$KAFFE_CONFIG info bindir`
_t_datadir=`$KAFFE_CONFIG info datadir`
AC_PATH_PROG(KAFFE_JABBA, kaffe, "", $_t_bindir:$PATH)
AC_MSG_CHECKING(for kjc)
if test -e $_t_datadir/kaffe/kjc.jar; then
KJC_CLASSPATH=$_t_datadir/kaffe/kjc.jar
AC_SUBST(KJC_CLASSPATH)
conditional_with_kjc=true
AC_MSG_RESULT(${withval})
elif test -e $_t_datadir/kjc.jar; then
KJC_CLASSPATH=$_t_datadir/kjc.jar
AC_SUBST(KJC_CLASSPATH)
conditional_with_kjc=true
AC_MSG_RESULT(${withval})
else
conditional_with_kjc=false
AC_MSG_RESULT(no)
fi
AC_PATH_PROG(KAFFE_JAVAH, kaffeh, "", $_t_bindir:$PATH)
AC_MSG_CHECKING(for Kaffe classes)
KAFFE_CLASSLIB=""
if test -e $_t_datadir/glibj.jar; then
KAFFE_CLASSLIB=$_t_datadir/glibj.jar
elif test -e $_t_datadir/kaffe/glibj.jar; then
KAFFE_CLASSLIB=$_t_datadir/kaffe/glibj.jar
elif test -e $_t_datadir/Klasses.jar; then
KAFFE_CLASSLIB=$_t_datadir/Klasses.jar
elif test -e $_t_datadir/kaffe/Klasses.jar; then
KAFFE_CLASSLIB=$_t_datadir/kaffe/Klasses.jar
else
AC_MSG_RESULT(no)
fi
AC_MSG_RESULT(yes)
if test -e $_t_datadir/rmi.jar; then
KAFFE_CLASSLIB=$KAFFE_CLASSLIB:$_t_datadir/rmi.jar
fi
if test -e $_t_datadir/kaffe/rmi.jar; then
KAFFE_CLASSLIB=$KAFFE_CLASSLIB:$_t_datadir/kaffe/rmi.jar
fi
if test -e $_t_datadir/tools.jar; then
KAFFE_CLASSLIB=$KAFFE_CLASSLIB:$_t_datadir/tools.jar
fi
if test -e $_t_datadir/kaffe/tools.jar; then
KAFFE_CLASSLIB=$KAFFE_CLASSLIB:$_t_datadir/kaffe/tools.jar
fi
AC_SUBST(KAFFE_CLASSLIB)
])
dnl CLASSPATH_WITH_JAPHAR - checks for japhar
AC_DEFUN([CLASSPATH_WITH_JAPHAR],
[
AC_ARG_WITH(japhar,
[ --with-japhar configure GNU Classpath for Japhar [default=yes]],
[
if test "x${withval}" = xyes || test "x${withval}" = x; then
CLASSPATH_CHECK_JAPHAR
elif test "x${withval}" != xno || test "x${withval}" != xfalse; then
CLASSPATH_CHECK_JAPHAR(${withval})
fi
],
[
conditional_with_japhar=false
JAPHAR_CFLAGS=""
AC_SUBST(JAPHAR_CFLAGS)
])
])
dnl CLASSPATH_WITH_KAFFE - checks for which java virtual machine to use
AC_DEFUN([CLASSPATH_WITH_KAFFE],
[
AC_ARG_WITH(kaffe,
[ --with-kaffe configure GNU Classpath for Kaffe [default=no]],
[
if test "x${withval}" = xyes || test "x${withval}" = x; then
CLASSPATH_CHECK_KAFFE
fi
],
[ conditional_with_kaffe=false
KAFFE_CFLAGS=""
AC_SUBST(KAFFE_CFLAGS)
])
])
dnl threads packages (mostly stolen from Japhar)
dnl given that japhar-config gives -lpthread, may not need this (cbj)
AC_DEFUN([CLASSPATH_CHECK_THREADS],
[
threads=no
if test "x${threads}" = xno; then
AC_CHECK_LIB(threads, cthread_fork)
if test "x${ac_cv_lib_threads_cthread_fork}" = xyes; then
AC_DEFINE(USE_CTHREADS, )
threads=yes
fi
fi
if test "x${threads}" = xno; then
AC_CHECK_FUNCS(_beginthreadex)
if test "x${ac_cv_CreateThread}" = xyes; then
AC_DEFINE(USE_WIN32_THREADS, )
AC_CHECK_FUNCS(CloseHandle SetThreadPriority ExitThread Sleep \
GetCurrentThreadId TlsAlloc TlsSetValue TlsGetValue)
threads=yes
fi
fi
if test "x${threads}" = xno; then
AC_CHECK_LIB(pthread, pthread_create)
if test "x${ac_cv_lib_pthread_pthread_create}" = xyes; then
threads=yes
fi
if test "x${threads}" = xno; then
AC_CHECK_LIB(c_r, pthread_create)
if test "x${ac_cv_lib_c_r_pthread_create}" = xyes; then
threads=yes
fi
fi
if test "x${threads}" = xno; then
# HP/UX 10.20 uses -lcma
AC_CHECK_LIB(cma, pthread_create)
if test "x${ac_cv_lib_cma_pthread_create}" = xyes; then
threads=yes
fi
fi
if test "x${threads}" = xno; then
AC_CHECK_LIB(c, pthread_create)
if test "x${ac_cv_lib_c_pthread_create}" = xyes; then
threads=yes
fi
fi
if test "x${threads}" = xyes; then
AC_DEFINE(USE_PTHREADS, )
fi
fi
])
AC_DEFUN([CLASSPATH_FIND_JAVAC],
[
user_specified_javac=
CLASSPATH_WITH_GCJ
CLASSPATH_WITH_JIKES
CLASSPATH_WITH_KJC
if test "x${user_specified_javac}" = x; then
AM_CONDITIONAL(FOUND_GCJ, test "x${GCJ}" != x)
AM_CONDITIONAL(FOUND_JIKES, test "x${JIKES}" != x)
else
AM_CONDITIONAL(FOUND_GCJ, test "x${user_specified_javac}" = xgcj)
AM_CONDITIONAL(FOUND_JIKES, test "x${user_specified_javac}" = xjikes)
fi
AM_CONDITIONAL(FOUND_KJC, test "x${user_specified_javac}" = xkjc)
if test "x${GCJ}" = x && test "x${JIKES}" = x && test "x${user_specified_javac}" != xkjc; then
echo "configure: cannot find javac, try --with-gcj, --with-jikes, or --with-kjc" 1>&2
exit 1
fi
])
AC_DEFUN([CLASSPATH_WITH_GCJ],
[
AC_ARG_WITH(gcj,
[ --with-gcj bytecode compilation with gcj ],
[
if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
CLASSPATH_CHECK_GCJ(${withval})
else
if test "x${withval}" != xno; then
CLASSPATH_CHECK_GCJ
fi
fi
user_specified_javac=gcj
],
[
CLASSPATH_CHECK_GCJ
])
AM_CONDITIONAL(USER_SPECIFIED_GCJ, test "x${GCJ}" != x)
AC_SUBST(GCJ)
])
AC_DEFUN([CLASSPATH_CHECK_GCJ],
[
if test "x$1" != x; then
if test -f "$1"; then
GCJ="$1"
else
AC_PATH_PROG(GCJ, "$1")
fi
else
AC_PATH_PROG(GCJ, "gcj")
fi
if test "x$GCJ" != x; then
AC_MSG_CHECKING(gcj version)
GCJ_VERSION=`$GCJ --version`
GCJ_VERSION_MAJOR=`echo "$GCJ_VERSION" | cut -d '.' -f 1`
GCJ_VERSION_MINOR=`echo "$GCJ_VERSION" | cut -d '.' -f 2`
if expr "$GCJ_VERSION_MAJOR" \< 3 > /dev/null; then
GCJ=""
fi
if expr "$GCJ_VERSION_MAJOR" = 3 > /dev/null; then
if expr "$GCJ_VERSION_MINOR" \< 1; then
GCJ=""
fi
fi
if test "x$GCJ" != x; then
AC_MSG_RESULT($GCJ_VERSION)
else
AC_MSG_WARN($GCJ_VERSION: gcj 3.1 or higher required)
fi
fi
])
AC_DEFUN([CLASSPATH_WITH_JIKES],
[
AC_ARG_WITH(jikes,
[ --with-jikes bytecode compilation with jikes ],
[
if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
CLASSPATH_CHECK_JIKES(${withval})
else
if test "x${withval}" != xno; then
CLASSPATH_CHECK_JIKES
fi
fi
user_specified_javac=jikes
],
[
CLASSPATH_CHECK_JIKES
])
AM_CONDITIONAL(USER_SPECIFIED_JIKES, test "x${JIKES}" != x)
AC_SUBST(JIKES)
])
AC_DEFUN([CLASSPATH_CHECK_JIKES],
[
if test "x$1" != x; then
if test -f "$1"; then
JIKES="$1"
else
AC_PATH_PROG(JIKES, "$1")
fi
else
AC_PATH_PROG(JIKES, "jikes")
fi
])
AC_DEFUN([CLASSPATH_WITH_KJC],
[
AC_ARG_WITH(kjc,
[ --with-kjc=<ksusu.jar> bytecode compilation with kjc [default=no]],
[
if test "x${withval}" != xno; then
AC_MSG_CHECKING(for kjc)
if test "x${withval}" = x || test "x${withval}" = xyes; then
AC_MSG_ERROR(specify the location of ksusu.jar or kjc CLASSPATH)
fi
KJC_CLASSPATH=${withval}
AC_SUBST(KJC_CLASSPATH)
conditional_with_kjc=true
AC_MSG_RESULT(${withval})
fi
user_specified_javac=kjc
],
[
conditional_with_kjc=false
])
AM_CONDITIONAL(USER_SPECIFIED_KJC, test "x${conditional_with_kjc}" = xtrue)
if test "x${conditional_with_kjc}" = xtrue && test "x${USER_JABBA}" = x; then
if test "x${USER_JABBA}" = x; then
echo "configure: cannot find java, try --with-java" 1>&2
exit 1
fi
fi
])
AC_DEFUN([CLASSPATH_WITH_JAVA],
[
AC_ARG_WITH(java,
[ --with-java specify path or name of a java-like program ],
[
if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
CLASSPATH_CHECK_JAVA(${withval})
else
if test "x${withval}" != xno; then
CLASSPATH_CHECK_JAVA
fi
fi
],
[
CLASSPATH_CHECK_JAVA
])
AM_CONDITIONAL(USER_SPECIFIED_JABBA, test "x${USER_JABBA}" != x)
AC_SUBST(USER_JABBA)
])
AC_DEFUN([CLASSPATH_CHECK_JAVA],
[
if test "x$1" != x; then
if test -f "$1"; then
USER_JABBA="$1"
else
AC_PATH_PROG(USER_JABBA, "$1")
fi
else
AC_PATH_PROG(USER_JABBA, "java")
fi
])
AC_DEFUN([CLASSPATH_FIND_JAVA],
[
dnl Place additional bytecode interpreter checks here
CLASSPATH_WITH_JAVA
])
AC_DEFUN([CLASSPATH_WITH_JAVAH],
[
AC_ARG_WITH(javah,
[ --with-javah specify path or name of a javah-like program ],
[
if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
CLASSPATH_CHECK_JAVAH(${withval})
else
CLASSPATH_CHECK_JAVAH
fi
],
[
CLASSPATH_CHECK_JAVAH
])
AM_CONDITIONAL(USER_SPECIFIED_JAVAH, test "x${USER_JAVAH}" != x)
AC_SUBST(USER_JAVAH)
])
dnl Checking for a javah like program
AC_DEFUN([CLASSPATH_CHECK_JAVAH],
[
if test "x$1" != x; then
if test -f "$1"; then
USER_JAVAH="$1"
else
AC_PATH_PROG(USER_JAVAH, "$1")
fi
else
for javah_name in gcjh javah; do
AC_PATH_PROG(USER_JAVAH, "$javah_name")
if test "x${USER_JAVAH}" != x; then
break
fi
done
fi
# if test "x${USER_JAVAH}" = x; then
# echo "configure: cannot find javah" 1>&2
# exit 1
# fi
])
dnl CLASSPATH_WITH_CLASSLIB - checks for user specified classpath additions
AC_DEFUN([CLASSPATH_WITH_CLASSLIB],
[
AC_ARG_WITH(classpath,
[ --with-classpath specify path to a classes.zip like file ],
[
if test "x${withval}" = xyes; then
# set user classpath to CLASSPATH from env
AC_MSG_CHECKING(for classlib)
USER_CLASSLIB=${CLASSPATH}
AC_SUBST(USER_CLASSLIB)
AC_MSG_RESULT(${USER_CLASSLIB})
conditional_with_classlib=true
elif test "x${withval}" != x && test "x${withval}" != xno; then
# set user classpath to specified value
AC_MSG_CHECKING(for classlib)
USER_CLASSLIB=${withval}
AC_SUBST(USER_CLASSLIB)
AC_MSG_RESULT(${withval})
conditional_with_classlib=true
fi
],
[ conditional_with_classlib=false ])
AM_CONDITIONAL(USER_SPECIFIED_CLASSLIB, test "x${conditional_with_classlib}" = xtrue)
])
dnl CLASSPATH_WITH_INCLUDEDIR - checks for user specified extra include directories
AC_DEFUN([CLASSPATH_WITH_INCLUDEDIR],
[
AC_ARG_WITH(includedir,
[ --with-includedir=DIR specify path to an extra include dir ],
[
AC_MSG_CHECKING(for includedir)
if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
if test -r ${withval}; then
if test "x${EXTRA_INCLUDES}" = x; then
EXTRA_INCLUDES="-I${withval}"
else
EXTRA_INCLUDES="${EXTRA_INCLUDES} -I${withval}"
fi
AC_SUBST(EXTRA_INCLUDES)
AC_MSG_RESULT("added ${withval}")
else
AC_MSG_RESULT("${withval} does not exist")
fi
fi
],
[
if test -z "$EXTRA_INCLUDES"; then
EXTRA_INCLUDES=""
AC_SUBST(EXTRA_INCLUDES)
fi
])
])
dnl CLASSPATH_WITH_ZIP - allow user to specify without zip
AC_DEFUN([CLASSPATH_WITH_ZIP],
[
AC_ARG_WITH(zip,
[ --with-zip create glibj.zip [default=yes]],
[
if test "x${withval}" = xyes || test "x${withval}" = x; then
AC_PATH_PROG(ZIP, zip)
elif test "x${withval}" = xno || test "x${withval}" = xfalse; then
ZIP=
else
ZIP="${withval}"
fi
],
[
AC_PATH_PROG(ZIP, zip)
])
AC_SUBST(ZIP)
AM_CONDITIONAL(HAVE_ZIP, test "x${ZIP}" != x)
])
dnl -----------------------------------------------------------
dnl Enable generation of API documentation, assumes gjdoc
dnl has been compiled to an executable or a suitable script
dnl is in your PATH
dnl -----------------------------------------------------------
AC_DEFUN([CLASSPATH_ENABLE_GJDOC],
[
AC_ARG_ENABLE([gjdoc],
[AS_HELP_STRING([--enable-gjdoc],[enable API doc. generation [default=no]])],
[
case "${enableval}" in
yes) ENABLE_GJDOC=yes ;;
no) ENABLE_GJDOC=no ;;
*) ENABLE_GJDOC=yes ;;
esac
if test "x${ENABLE_GJDOC}" = xyes; then
AC_PATH_PROG(GJDOC, gjdoc)
AC_PATH_PROG(XMLCATALOG, xmlcatalog)
AC_PATH_PROG(XSLTPROC, xsltproc)
fi
],
[ENABLE_GJDOC=no])
AM_CONDITIONAL(CREATE_API_DOCS, test "x${ENABLE_GJDOC}" = xyes)
])
|