This repository has been archived by the owner on Sep 15, 2021. It is now read-only.
/
configure.ac
1589 lines (1288 loc) · 50.4 KB
/
configure.ac
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
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AC_INIT([Kaffe Virtual Machine],[1.1.10-pre],[kaffe@kaffe.org],[kaffe])
AC_PREREQ(2.61)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([scripts])
AC_CONFIG_SRCDIR([kaffe])
# Copyright information. The nice sounding paragraphs about
# GPLed portions has been taken from the GPL-d configure.ac
# file of gimp-print project
AC_COPYRIGHT([Copyright 1996 - 2008 Kaffe.org project contributors. All rights reserved.
Portions Copyright 1996 - 2002 Transvirtual Technologies, Inc.
Portions Copyright by various third parties, see file THIRDPARTY for details.
This file is part of Kaffe Virtual Machine, a free software runtime
for java applications. See http://www.kaffe.org for details.
Parts of this configure script come from the `configure.ac' file, and
are not based on freely-redistributable m4 macros; you can redistribute
them and/or modify them under the terms of the GNU General Public
as published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
])
AM_INIT_AUTOMAKE([1.9 dist-bzip2 dist-zip tar-ustar])
AC_PREFIX_DEFAULT(/usr/local/kaffe)
AM_MAINTAINER_MODE
dnl needed for autoheader to find acconfig.h
AUTOHEADER="$AUTOHEADER --include=config"
dnl abssrcdir is the absolute path to the source base (regardless of where
dnl you are building it)
case x$srcdir in
x/*)
abssrcdir=$srcdir
;;
*)
abssrcdir=`pwd`/$srcdir
;;
esac
AC_SUBST(abssrcdir)
dnl =========================================================================
dnl Allow specification of header-file and library directories
dnl -------------------------------------------------------------------------
AC_ARG_WITH([includes],
AS_HELP_STRING([--with-includes=dirs],
[Search specified directories for header files]),
[ CPPFLAGS="$CPPFLAGS"`echo " $withval" |
sed -e 's/ / -I/g' -e 's/-I //g' -e 's/-I$//'` ],
[ CPPFLAGS="$CPPFLAGS" ])
AC_ARG_WITH([libraries],
AS_HELP_STRING([--with-libraries=dirs],
[Search for libraries in specified directories]),
[ CTLIBS="$CTLIBS"`echo " $withval" |
sed -e 's/ / -L/g' -e 's/-L //g' -e 's/-L$//'`
LTLIBS="$LTLIBS"`echo " $withval" |
sed -e 's/ / -R/g' -e 's/-R //g' -e 's/-R$//'`],
[ CTLIBS="$CTLIBS"
LTLIBS="$LTLIBS"])
LIBS="$CTLIBS $LIBS"
dnl Find the compiler early on in case we need to override.
AC_PROG_CC
AC_PROG_CC_C99
dnl If gcc is the compiler, compile with -Wall for lots of warnings
AX_CFLAGS_WARN_ALL
# the following are covered by -Wall, but we list them separately, so
# that it's easier to control.
# AX_CFLAGS_GCC_OPTION([-Wno-import])
# AX_CFLAGS_GCC_OPTION([-Wchar-subscripts])
# AX_CFLAGS_GCC_OPTION([-Wcomment])
# AX_CFLAGS_GCC_OPTION([-Wformat])
# AX_CFLAGS_GCC_OPTION([-Wformat-y2k])
# AX_CFLAGS_GCC_OPTION([-Wno-format-extra-args])
# AX_CFLAGS_GCC_OPTION([-Wno-format-zero-length])
# AX_CFLAGS_GCC_OPTION([-Wformat-nonliteral])
# AX_CFLAGS_GCC_OPTION([-Wformat-security])
# -Wformat=2 includes -Wformat, -Wformat-nonliteral -Wformat-security, -Wformat-y2k
# AX_CFLAGS_GCC_OPTION([-Wformat=2])
# -Wnonnull is included in -Wformat
# AX_CFLAGS_GCC_OPTION([-Wnonnull])
# -Winit-self requires(-Wunitialized)
# AX_CFLAGS_GCC_OPTION([-Winit-self])
# AX_CFLAGS_GCC_OPTION([-Wimplicit-function-declaration])
# AX_CFLAGS_GCC_OPTION([-Wimplicit-int])
# -Wimplicit includes -Wimplicit-int, -Wimplicit-function-declaration
# AX_CFLAGS_GCC_OPTION([-Wimplicit])
# AX_CFLAGS_GCC_OPTION([-Wmain])
# AX_CFLAGS_GCC_OPTION([-Wmissing-braces])
# AX_CFLAGS_GCC_OPTION([-Wparentheses])
# AX_CFLAGS_GCC_OPTION([-Wsequence-point])
# AX_CFLAGS_GCC_OPTION([-Wreturn-type])
# AX_CFLAGS_GCC_OPTION([-Wswitch])
# AX_CFLAGS_GCC_OPTION([-Wswitch-default])
# AX_CFLAGS_GCC_OPTION([-Wswitch-enum])
# AX_CFLAGS_GCC_OPTION([-Wtrigraphs])
# AX_CFLAGS_GCC_OPTION([-Wunused-function])
# AX_CFLAGS_GCC_OPTION([-Wunused-label])
# AX_CFLAGS_GCC_OPTION([-Wunused-parameter])
# AX_CFLAGS_GCC_OPTION([-Wunused-variable])
# AX_CFLAGS_GCC_OPTION([-Wunused-value])
# -Wunused includes -Wunused-function, -Wunused-label, -Wunused-parameter, -Wunused-variable, -Wunused-value
# AX_CFLAGS_GCC_OPTION([-Wunused])
## disable -Wuninitialized as it clashes with -O0
## leading to trouble for libtool, which
## misinterprets the compiler warnings for
## something more serious.
# AX_CFLAGS_GCC_OPTION([-Wuninitialized])
# AX_CFLAGS_GCC_OPTION([-Wunknown-pragmas])
# requires -fstrict-aliasing
# AX_CFLAGS_GCC_OPTION([-Wstrict-aliasing])
# includes all of the above
# AX_CFLAGS_GCC_OPTION([-Wall])
# turn on all other gcc warnings for more fixing fun
# AX_CFLAGS_GCC_OPTION([-pedantic])
# AX_CFLAGS_GCC_OPTION([-ansi])
AX_CFLAGS_GCC_OPTION([-W]) dnl new name is -Wextra
AX_CFLAGS_GCC_OPTION([-Wextra])
# AX_CFLAGS_GCC_OPTION([-Wfloat-equal])
# AX_CFLAGS_GCC_OPTION([-Wtraditional])
# AX_CFLAGS_GCC_OPTION([-Wdeclaration-after-statement])
# AX_CFLAGS_GCC_OPTION([-Wundef])
# AX_CFLAGS_GCC_OPTION([-Wendif-labels])
# AX_CFLAGS_GCC_OPTION([-Wshadow])
# AX_CFLAGS_GCC_OPTION([-Wpointer-arith])
# AX_CFLAGS_GCC_OPTION([-Wbad-function-cast])
# AX_CFLAGS_GCC_OPTION([-Wcast-qual])
# AX_CFLAGS_GCC_OPTION([-Wcast-align])
# AX_CFLAGS_GCC_OPTION([-Wwrite-strings])
# AX_CFLAGS_GCC_OPTION([-Wconversion])
# AX_CFLAGS_GCC_OPTION([-Wsign-compare])
# AX_CFLAGS_GCC_OPTION([-Waggregate-return])
# AX_CFLAGS_GCC_OPTION([-Wstrict-prototypes])
# AX_CFLAGS_GCC_OPTION([-Wold-style-definition])
# AX_CFLAGS_GCC_OPTION([-Wmissing-prototypes])
# AX_CFLAGS_GCC_OPTION([-Wmissing-declarations])
# AX_CFLAGS_GCC_OPTION([-Wmissing-noreturn])
# AX_CFLAGS_GCC_OPTION([-Wmissing-format-attribute])
# AX_CFLAGS_GCC_OPTION([-Wno-multichar])
# AX_CFLAGS_GCC_OPTION([-Wno-deprecated-declarations])
# AX_CFLAGS_GCC_OPTION([-Wpacked])
# AX_CFLAGS_GCC_OPTION([-Wpadded])
# AX_CFLAGS_GCC_OPTION([-Wredundant-decls])
# AX_CFLAGS_GCC_OPTION([-Wnested-externs])
# AX_CFLAGS_GCC_OPTION([-Wunreachable-code])
# AX_CFLAGS_GCC_OPTION([-Winvalid-pch])
# AX_CFLAGS_GCC_OPTION([-Winline])
# AX_CFLAGS_GCC_OPTION([-Wlong-long])
# AX_CFLAGS_GCC_OPTION([-Wdisabled-optimization])
## required for old darwin versions because Apples'
## gcc falls appart all over assembler statements
## and produces a ton of false warnings otherwise.
## AX_CFLAGS_GCC_OPTION([-no-cpp-precomp])
## required for powerpc assember register names
## in order to use a common notation on darwin
## and GNU/Linux.
AX_CFLAGS_GCC_OPTION([-mregnames],KAFFE_CCASFLAGS)
## Required for gcc 4.1.x as long as kaffe's
## not cleaned up to use unions in classMethod.h
## where necessary.
AX_CFLAGS_GCC_OPTION([-fno-strict-aliasing])
## Required for gcc 4.1.x and above, as it
## omits the frame pointer on -O1 and above on
## some architectures, notably i386, making
## it impossible to unwind exceptions.
AX_CFLAGS_GCC_OPTION([-fno-omit-frame-pointer])
GCC_ATTRIBUTE_ALWAYS_INLINE
GCC_ATTRIBUTE_CONST
GCC_ATTRIBUTE_FORMAT
GCC_ATTRIBUTE_NORETURN
GCC_ATTRIBUTE_PACKED
GCC_ATTRIBUTE_UNUSED
if test "$GCC" != "yes"; then
AC_MSG_WARN([Kaffe can only build with GCC])
fi
dnl Find the c++ compiler early on
AC_PROG_CXX
dnl find the assembler
AM_PROG_AS
dnl Find the machine type and setup the relevant links
AC_CANONICAL_HOST
AC_EXEEXT
AC_SYS_LARGEFILE
dnl =========================================================================
dnl By default we use dynamic libraries for everything
dnl -------------------------------------------------------------------------
dynamic_libraries=yes
vm_dynamic_library=yes
vm_dynamic_binary=yes
dnl -------------------------------------------------------------------------
dnl =========================================================================
dnl Force use of static libraries
dnl -------------------------------------------------------------------------
AC_ARG_WITH([staticlib],
AS_HELP_STRING([--with-staticlib],
[Force the use of static libraries rather than shared]))
if test x"$with_staticlib" = x"yes" ; then
dynamic_libraries=no
if test x"${with_staticvm+set}" != x"set"; then
with_staticvm=yes
fi
fi
AC_ARG_WITH([staticvm],
AS_HELP_STRING([--with-staticvm],
[Force the creation of a static virtual machine]))
if test x"$with_staticvm" = x"yes" ; then
vm_dynamic_library=no
fi
dnl If the vm is static or all libraries are static then make sure we set
dnl the no-share-vmlibrary flag.
if test x"$vm_dynamic_library" = x"no" || test x"$dynamic_libraries" = x"no"; then
AC_DEFINE(NO_SHARED_VMLIBRARY, 1, [If the vm is static or all libraries are static])
fi
dnl =========================================================================
dnl Look for the configuration information
dnl -------------------------------------------------------------------------
known=no
Khost_cpu=$host_cpu
AC_SUBST([Khost_cpu])
Khost_os=$host_os
AC_SUBST([Khost_os])
if test -f $srcdir/config/config.alias ; then
. $srcdir/config/config.alias
fi
if test -f $srcdir/config/$Khost_cpu/$Khost_os/config.frag ; then
known=yes
. $srcdir/config/$Khost_cpu/$Khost_os/config.frag
fi
if test x"$known" = x"no" ; then
AC_MSG_ERROR(Configuration $Khost_cpu-$Khost_os not supported)
fi
if test x"$needs_altstack_end_pointer" = x"yes"; then
AC_DEFINE(SIGALTSTACK_NEEDS_END, 1, [Defined if sigaltstack needs the stackbase+size pointer instead of stackbase])
fi
dnl =========================================================================
dnl =========================================================================
dnl Configure libtool
dnl -------------------------------------------------------------------------
case "$dynamic_libraries,$vm_dynamic_library" in
no,no) : ${enable_shared=no};;
yes,yes) : ${enable_static=no};;
# otherwise, we have to compile everything twice
esac
AC_LIBTOOL_DLOPEN
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
AC_CHECK_HEADER([ltdl.h],
[AC_SEARCH_LIBS([lt_dlinterface_register], [ltdl], [], [AC_MSG_ERROR([Can't find the libltdl library.])])],
[AC_MSG_ERROR([Can't find the ltdl.h header file from the libltdl library])])
## Let users override the linker used by libtool, but default to $CC.
CCLD=${CCLD:-'$(CC)'}
AC_SUBST(CCLD)
AC_LTDL_SHLIBEXT
# ===========================================================================
# Configure gettext (needed for libiconv scripts)
# ===========================================================================
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION(0.14.1)
KAFFE_LOCALEDIR="${datadir}/locale"
eval KAFFE_LOCALEPATH=$KAFFE_LOCALEDIR
AC_DEFINE_UNQUOTED(KAFFE_LOCALEDIR, "$KAFFE_LOCALEPATH", [Full path to the directory containing kaffe's locales])
AM_LC_MESSAGES
AM_CONDITIONAL(MAY_RUN_PO, test x"$MSGFMT" != x":" || test -f $ac_top_srcdir/po/fr.gmo)
dnl =========================================================================
dnl Do we need underscore?
dnl -------------------------------------------------------------------------
AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
AC_LTDL_SYMBOL_USCORE
if test x"$ac_cv_sys_symbol_underscore" = x"yes"; then
AC_DEFINE(HAVE_UNDERSCORED_C_NAMES, 1, [Define if C symbol names start with underscore])
fi
dnl =========================================================================
dnl Start of default configurations
dnl -------------------------------------------------------------------------
dnl What kind of system are we using?
NOSIGCONTEXT=false
case $Khost_os in
win32*)
SYSTEM=win32 ;;
cygwin*)
SYSTEM=unix;
NOSIGCONTEXT=true;;
*)
SYSTEM=unix ;;
esac
dnl -------------------------------------------------------------------------
dnl End of default configurations
dnl =========================================================================
dnl =========================================================================
dnl Set the base set of platform-dependent files
dnl -------------------------------------------------------------------------
CONFIG_MD_H="config/$Khost_cpu/$Khost_os/md.h"
CONFIG_CALLKAFFEEXCEPTION_H="config/$Khost_cpu/callKaffeException.h"
KAFFEVM_MD_C="config/$Khost_cpu/$Khost_os/md.c"
dnl =========================================================================
dnl =========================================================================
dnl Look for configuration specific Makefile fragement and include it
dnl -------------------------------------------------------------------------
if test -f $srcdir/config/$Khost_cpu/$Khost_os/Make.frag ; then
cpu_os_frag=$srcdir/config/$Khost_cpu/$Khost_os/Make.frag
else
cpu_os_frag=/dev/null
fi
if test -f $srcdir/config/$Khost_cpu/Make.frag ; then
cpu_frag=$srcdir/config/$Khost_cpu/Make.frag
else
cpu_frag=/dev/null
fi
AC_SUBST_FILE(cpu_os_frag)dnl
AC_SUBST_FILE(cpu_frag)dnl
dnl =========================================================================
dnl =========================================================================
dnl Allow selection of a specific execution engine
dnl -------------------------------------------------------------------------
AC_ARG_WITH([engine],
AS_HELP_STRING([--with-engine=ENGINE],
[Force use given execution engine (intrp, jit, or jit3)]))
dnl Translate 'interpreter' to 'intrp'
if test x"$with_engine" = x"interpreter" ; then
with_engine=intrp
fi
dnl Save the requested engine and set the default to 'jit'
want_engine="$with_engine"
if test x"${with_engine+set}" != x"set" ; then
with_engine="jit"
fi
dnl =========================================================================
dnl -------------------------------------------------------------------------
dnl Check for JIT support and add in the necessary configuration files
dnl -------------------------------------------------------------------------
dnl AC_KAFFE_IF_SUPPORTED_ENGINE(ENGINE, SUP_CMDS, UPDATE_CMDS, UNSUP_CMDS)
dnl If the engine is fully supported, run SUP_CMDS.
dnl If it needs updating, run UPDATE_CMDS.
dnl If it is not supported at all, run UNSUP_CMDS.
AC_DEFUN([AC_KAFFE_IF_SUPPORTED_ENGINE], [
if test x"$1" = x"intrp"; then
ifelse([$2],[],[:],[$2])
else
if test -f "$srcdir/config/$Khost_cpu/$1-$Khost_cpu.def" && test -f "$srcdir/config/$Khost_cpu/$Khost_os/$1-md.h"; then
if sed 1q < "$srcdir/config/$Khost_cpu/$Khost_os/$1-md.h" |
fgrep "Needs update, do not use" > /dev/null; then
ifelse([$3],[],[:],[$3])
else
ifelse([$2],[],[:],[$2])
fi
else
ifelse([$4],[],[:],[$4])
fi
fi
])
dnl If they request a specific engine, we must support it or else fail
dnl Otherwise, pick the most preferable supported engine. Note that
dnl the "intrp" engine is always supported, so we can't fail there.
if test x"${want_engine}" != x""; then
AC_KAFFE_IF_SUPPORTED_ENGINE([${want_engine}],,
[AC_MSG_WARN([The $want_engine engine was not updated for $Khost_cpu-$Khost_os])],
[AC_MSG_ERROR([Configuration $Khost_cpu-$Khost_os does not support the $want_engine engine])])
with_engine="${want_engine}"
else
for engine in jit3 jit intrp; do
AC_KAFFE_IF_SUPPORTED_ENGINE([${engine}], [
with_engine="${engine}"
break;
])
done
fi
if test x"$with_engine" != x"intrp" ; then
CONFIG_JIT_MD_H="config/$Khost_cpu/$Khost_os/$with_engine-md.h"
KAFFEVM_JIT_DEF="config/$Khost_cpu/$with_engine-$Khost_cpu.def"
KAFFEVM_ICODE_H="config/$Khost_cpu/$with_engine-icode.h"
fi
AC_MSG_CHECKING(execution engine)
AC_MSG_RESULT($with_engine)
AM_CONDITIONAL(USE_JIT, test x"$with_engine" != x"intrp")
ENGINE_NAME="$with_engine"
AC_SUBST(ENGINE_NAME)
AC_SUBST_FILE(engine_frag)
engine_frag=$srcdir/kaffe/kaffevm/$with_engine/Makefile.frag
dnl =========================================================================
dnl Allow selection of debugging mechanisms
dnl -------------------------------------------------------------------------
AC_ARG_ENABLE([vmdebug],
AS_HELP_STRING([--disable-vmdebug],
[Disable run-time debugging machinery. It is enabled by default.]),
[],
[enable_vmdebug="yes"])
case "$enable_vmdebug" in
no) CPPFLAGS="$CPPFLAGS -DNDEBUG";;
*) CPPFLAGS="$CPPFLAGS -DKAFFE_VMDEBUG";;
esac
AC_MSG_CHECKING([whether to enable run-time debugging machinery])
AC_MSG_RESULT($enable_vmdebug)
dnl =========================================================================
dnl Allow user to specify a bcel.jar file for class file testing.
dnl -------------------------------------------------------------------------
AC_ARG_WITH([bcel],
AS_HELP_STRING([--with-bcel=<jar>],
[Use the specified Bytecode Engineering Jar file. It is not used by default.]),
[ BCEL_JAR="$withval" ],
[
BCEL_JAR=""
with_bcel="no"
])
AC_MSG_CHECKING([whether to use BCEL for additional regression tests])
AC_SUBST(BCEL_JAR)
AM_CONDITIONAL(HAVE_BCEL, test x"$BCEL_JAR" != x"")
AC_MSG_RESULT($with_bcel)
dnl =========================================================================
dnl Allow activation of jvmpi
dnl -------------------------------------------------------------------------
AC_ARG_ENABLE([jvmpi],
AS_HELP_STRING([--enable-jvmpi],
[Enable JVMPI. It is disabled by default.]),
[
case "$enable_jvmpi" in
no) ;;
*) if test "x$NOSIGCONTEXT" = "xtrue"; then
echo "JVMPI does not support Cygwin"
else
AC_DEFINE(ENABLE_JVMPI, 1, [JVM Profiling Interface])
fi;;
esac
],
[enable_jvmpi="no"])
AC_MSG_CHECKING([whether to enable JVMPI support])
AM_CONDITIONAL(ENABLE_JVMPI, test x"$enable_jvmpi" != x"no")
AC_MSG_RESULT($enable_jvmpi)
dnl =========================================================================
dnl Allow support for profiling of C/jitted code
dnl -------------------------------------------------------------------------
need_libxprof=no
AC_ARG_ENABLE([xprofiling],
AS_HELP_STRING([--enable-xprofiling],
[Enable profiling for C and jitted code.
It is disabled by default.]),
[
if test "x$NOSIGCONTEXT" = "xtrue"; then
echo "XProfiling does not support Cygwin"
enable_xprofiling=no
fi
case "$enable_xprofiling" in
no) xprofiling=no ;;
*) xprofiling=yes; need_libxprof=yes; CPPFLAGS="$CPPFLAGS -DKAFFE_XPROFILER";;
esac
],
[
enable_xprofiling=no
xprofiling=no
])
AC_MSG_CHECKING([whether to enable profiling for C and jitted code])
dnl ENABLE_XPROF controls installation of xprof scripts in kaffe/scripts/Makefile.am
AM_CONDITIONAL(ENABLE_XPROF, test x"$xprofiling" = x"yes")
if test x"$xprofiling" = x"yes"; then
if test -f "$srcdir/config/$Khost_cpu/$Khost_os/xprofile-md.h"; then
CONFIG_XPROFILE_MD_H="config/$Khost_cpu/$Khost_os/xprofile-md.h"
else
AC_MSG_ERROR(Profiling not supported in $Khost_cpu-$Khost_os)
fi
fi
AC_MSG_RESULT($enable_xprofiling)
dnl =========================================================================
dnl Allow support for debugging of C/jitted code
dnl -------------------------------------------------------------------------
AC_ARG_ENABLE([xdebugging],
AS_HELP_STRING([--enable-xdebugging],
[Enable debugging symbol generation for jitted code.
It is disabled by default.]),
[
case "$enable_xdebugging" in
no) ;;
*) need_libxprof=yes;
JAVAC_FLAGS="-g $JAVAC_FLAGS";
AC_DEFINE(KAFFE_XDEBUGGING, 1, [Enable debugging symbol generation for jitted code]);;
esac
],
[
enable_xdebugging="no"
])
AC_MSG_CHECKING([whether to enable debugging symbol generation for jitted code])
AC_SUBST(JAVAC_FLAGS)
AC_MSG_RESULT($enable_xdebugging)
dnl =========================================================================
dnl Allow generation feedback data
dnl -------------------------------------------------------------------------
AC_ARG_ENABLE([feedback],
AS_HELP_STRING([--enable-feedback],
[Enable generation of feedback data]),
[
case "$enable_feedback" in
no) ;;
*) need_libxprof=yes; CPPFLAGS="$CPPFLAGS -DKAFFE_FEEDBACK";;
esac
],
[enable_feedback=no
])
AM_CONDITIONAL(NEED_LIBXPROF, test x"$need_libxprof" = x"yes")
dnl =========================================================================
dnl Allow enabling of profiling
dnl -------------------------------------------------------------------------
AC_ARG_WITH([profiling],
AS_HELP_STRING([--with-profiling],
[Compile with gprof(1) profiling support]))
AC_MSG_CHECKING(gprof(4) profiling support)
if test x"${with_profiling}" = x"yes" ; then
CFLAGS_PG="-pg"
CPPFLAGS="$CPPFLAGS -DKAFFE_CPROFILER"
else
with_profiling=no
fi
AC_MSG_RESULT($with_profiling)
AC_SUBST(CFLAGS_PG)
dnl =========================================================================
dnl Do we include our Sun compatibility scripts?
dnl -------------------------------------------------------------------------
AC_ARG_WITH([suncompat],
AS_HELP_STRING([--without-suncompat],
[Don't include Sun compatibility scripts]))
AC_MSG_CHECKING(sun compatibility mode)
if test x"${with_suncompat+set}" != x"set" ; then
with_suncompat=yes
fi
AM_CONDITIONAL(SUN_COMPAT, test x"$with_suncompat" = x"yes")
AC_MSG_RESULT($with_suncompat)
dnl =========================================================================
dnl Use the new internal threading system "jthreads"
dnl -------------------------------------------------------------------------
AC_ARG_WITH([threads],
AS_HELP_STRING([--with-threads=SYSTEM],
[Define which threading system to use @<:@default=unix-pthreads@:>@]))
AC_MSG_CHECKING(thread system)
if test x"$with_threads" = x"" ; then
with_threads=unix-pthreads
fi
if test ! -d $srcdir/kaffe/kaffevm/systems/${with_threads} ; then
AC_MSG_ERROR(Configuration $Khost_cpu-$Khost_os does not support $with_threads threads)
fi
THREAD_SYSTEM=$with_threads
AC_MSG_RESULT($THREAD_SYSTEM)
AC_SUBST_FILE(threads_frag)dnl
threads_frag=$srcdir/kaffe/kaffevm/systems/$with_threads/Makefile.frag
AC_SUBST(THREAD_DIR)
THREAD_DIR=systems/$with_threads
dnl Check for thread libraries
if test x$with_threads = xunix-pthreads ; then
ACX_PTHREAD([THREADLIBS="$PTHREAD_LIBS "
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC"])
OLD_LIBS="$LIBS"
LIBS="$LIBS $THREADLIBS"
OLD_CFLAGS="$CFLAGS"
AC_CHECK_FUNCS([pthread_getattr_np])
LIBS="$OLD_LIBS"
CFLAGS="$OLD_CFLAGS"
AC_CHECK_LIB(semaphore,sem_init,SEMAPHORE_LIB="-lsemaphore")
AC_SUBST(SEMAPHORE_LIB)
KAFFE_LIB_SOLARIS_PTHREAD
KAFFE_CHECK_SEMAPHORE
if test -z "$THREADLIBS"; then
AC_MSG_ERROR([Missing library libpthread, read FAQ/FAQ.pthreads])
fi
VMLIBS="$VM_LIBS $PTHREAD_LIBS"
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
if test "x$Khost_os" = "xnetbsd1"; then
AC_DEFINE(KAFFE_BUGGY_NETBSD_SIGWAIT, 1, [Defined on NetBSD because sigwait needs the handle not to be registered])
fi
else
CPPFLAGS="$CPPFLAGS -DBR_PTHREADS=0"
fi
if test x$with_threads = xunix-pthreads ; then
AC_DEFINE([KAFFE_SYSTEM_UNIX_PTHREADS], 1, [Defined if we are using the unix-pthreads threading system])
fi
AC_SUBST(VM_LIBS)
AC_CHECK_WITH_CLASSPATH_PREFIX
AC_CHECK_WITH_CLASSPATH_CLASSES
AC_CHECK_WITH_TARGET_CLASSPATH_CLASSES
AC_CHECK_WITH_CLASSPATH_LIBDIR
AC_CHECK_WITH_CLASSPATH_INCLUDEDIR
AC_MSG_CHECKING([if class library exists and is readable at ${CLASSPATH_CLASSES}])
if test -r ${CLASSPATH_CLASSES} ; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_MSG_ERROR([Couldn't find readable class library at ${CLASSPATH_CLASSES}])
fi
GLIBJ_ZIP=${CLASSPATH_CLASSES}
AC_SUBST(GLIBJ_ZIP)
JAVACFLAGS="-classpath ${CLASSPATH_CLASSES}"
AC_PROG_JAVAC
AC_PROG_JAVADOC
AC_PATH_PROGS([JAVAP],[javap-cp javap])
dnl =========================================================================
dnl Look for trampoline code if in JIT mode
dnl -------------------------------------------------------------------------
KAFFEVM_TRAMPOLINES_S=
if test x"$with_engine" != x"intrp" ; then
AC_MSG_CHECKING(for trampolines)
if test -f $srcdir/config/$Khost_cpu/trampolines.S ; then
KAFFEVM_TRAMPOLINES_S="config/$Khost_cpu/trampolines.S"
AC_MSG_RESULT(yes)
else
AC_MSG_ERROR(does not support trampolines - now mandatory)
fi
fi
dnl =========================================================================
dnl Set install root directory which prefixes all install target dirs
dnl -------------------------------------------------------------------------
if test x"$with_installroot" != x""; then
AC_MSG_ERROR([--with-installroot is deprecated, use `make install DESTDIR=...'])
fi
dnl =========================================================================
dnl =========================================================================
dnl Make the necessary substitutions
dnl -------------------------------------------------------------------------
AC_SUBST(JAVA_LIBS)
AC_SUBST(with_engine)
AC_SUBST(THREAD_SYSTEM)
if test x"$program_prefix" = x"NONE" ; then
KPREFIX=""
else
KPREFIX=$program_prefix
fi
AC_SUBST(KPREFIX)
KAFFE_ARCHOS="$Khost_cpu-$Khost_os"
AC_DEFINE_UNQUOTED(ARCHOS, "$KAFFE_ARCHOS", [Define the version we're compiling for])
AC_SUBST(KAFFE_ARCHOS)
dnl =========================================================================
dnl =========================================================================
dnl Checks for programs.
dnl -------------------------------------------------------------------------
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_SED
AC_CHECK_PROG(MKTEMP, mktemp, mktemp)
if test x"$MKTEMP" = x"" ; then
AC_MSG_WARN([mktemp not found. You need mktemp to be able to debug kaffe.])
fi
AC_CHECK_PROG(JASMIN, jasmin, jasmin)
AM_CONDITIONAL(HAVE_JAVAC, test x"$JAVAC" != x"")
AM_CONDITIONAL(HAVE_MKTEMP, test x"$MKTEMP" != x"")
AM_CONDITIONAL(HAVE_JASMIN, test x"$JASMIN" != x"")
dnl If symlink is overridden then don't bother with the test.
if test x"$LN_S" = x"" ; then
AC_PROG_LN_S
fi
dnl This shell macro caches uses of ln -s in the generated script and
dnl converts them to LN_S
ln() {
if test x"$1" = x"-s" ; then
$LN_S $2 $3
else
ln $1 $2
fi
}
dnl Check for AWK. Used by kaffexprof
AC_PROG_AWK
dnl =========================================================================
dnl Checks for types
dnl -------------------------------------------------------------------------
AC_CHECK_SIZEOF(short,0)
AC_CHECK_SIZEOF(int,0)
AC_CHECK_SIZEOF(long,0)
AC_CHECK_SIZEOF(long long,0)
AC_CHECK_SIZEOF(__int64,0)
AC_CHECK_SIZEOF(void *,0)
AC_TYPE_OFF_T
AC_TYPE_PID_T
dnl -------------------------------------------------------------------------
AC_TYPE_SIGNAL
AC_CACHE_CHECK([whether signal handlers are one-shot],
kaffe_cv_signal_one_shot, [ dnl
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <signal.h>
int counter = 0;
RETSIGTYPE hup_handler () { ++counter; }
int get_counter () { return counter; }
int main() {
signal(1, hup_handler);
kill(getpid(), 1);
if (get_counter() == 0)
exit(1); /* signal was not delivered, can't test reliably */
kill(getpid(), 1);
if (get_counter() != 2)
exit(1); /* signal was not delivered, seems to be one-shot */
exit(0);
}
]])],[kaffe_cv_signal_one_shot=no],[kaffe_cv_signal_one_shot=yes],[kaffe_cv_signal_one_shot=cross])
])
if test x"$kaffe_cv_signal_one_shot" != x"no"; then
AC_DEFINE(KAFFE_SIGNAL_ONE_SHOT, 1, [Define if signal handlers must be reset upon delivery])
fi
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
dnl -------------------------------------------------------------------------
AC_DEFUN([AC_CHECK_LIBRARY], [dnl
KSAVE_LIBS="$LIBS"
LIBS="$$3 $KSAVE_LIBS"
AC_CHECK_LIB($1,$2)
$3=`echo "$LIBS" | sed "s% $KSAVE_LIBS$%%"`
LIBS="$KSAVE_LIBS"
])
dnl =========================================================================
dnl Checks for libraries
dnl -------------------------------------------------------------------------
AC_PROG_GCC_TRADITIONAL
dnl Libraries for programs such as Kaffe and kaffeh
KAFFE_LIBS="$KAFFE_LIBS"
AC_SUBST(KAFFE_LIBS)
dnl Checks for general math libraries
AC_CHECK_LIBRARY(mw,_mwvalidcheckl,M_LIBS)
AC_CHECK_LIBRARY(m,sin,M_LIBS)
AC_SUBST(M_LIBS)
dnl If there is no native sysdepCallMethod, let's use libffi
AC_ARG_WITH([libffi],
AS_HELP_STRING([--with-libffi],
[Use libffi for sysdepCallMethod]))
if test x"$with_libffi" = x"yes" ; then
AC_CHECK_LIBRARY(ffi,ffi_call,VM_LIBS)
if test $ac_cv_lib_ffi_ffi_call = no; then
AC_MSG_ERROR([Missing library libffi, read FAQ/FAQ.libffi])
fi
fi
dnl Checks for libraries for vm library.
dnl Include work around FreeBSD modulo bug.
case "$Khost_os" in
freebsd2|oskit)
AC_CHECK_LIBRARY(gcc,__moddi3,VM_LIBS);;
esac
dnl -------------------------------------------------------------------------
dnl =========================================================================
dnl Checks for header files.
dnl -------------------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS_ONCE([stdarg.h \
alloca.h \
bsd/libc.h \
dlfcn.h \
fcntl.h \
features.h \
gmp.h \
gc/gc.h \
jpeglib.h \
kernel/OS.h \
limits.h \
mach/mach.h \
mach-o/rld.h \
malloc.h \
memory.h \
mips/cachectl.h \
png.h \
poll.h \
pthread.h \
pwd.h \
sgidefs.h \
sigcontext.h \
signal.h \
stdlib.h \
string.h \
sys/cachectl.h \
sys/filio.h \
sys/ioctl.h \
sys/mman.h \
sys/param.h \
sys/poll.h \
sys/select.h \
sys/signal.h \
sys/socket.h \
sys/stat.h \
sys/sysinfo.h \
sys/time.h \
sys/types.h \
sys/utsname.h \
sys/ucontext.h \
unistd.h \
wintypes.h])
# check sys/sysctl.h seperately, as it requires other headers on at least OpenBSD
AC_CHECK_HEADERS([sys/sysctl.h], [], [],
[[#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
]])
dnl GNU/Linux sigcontext headers
AC_CHECK_HEADERS_ONCE([asm/sigcontext.h])
AC_CHECK_HEADERS([asm/signal.h], [], [], [
#include <linux/types.h>
])
dnl needed for common ppc asm syntax on GNU/Linux
AC_CHECK_HEADERS_ONCE([asm/ppc_asm.h])
dnl needed for MIPS cache flushing on GNU/Linux
AC_CHECK_HEADERS_ONCE([asm/cachectl.h])
dnl needed for ia64
AC_CHECK_HEADERS_ONCE([ia64intrin.h])
AC_HEADER_SYS_WAIT
AC_HEADER_DIRENT
dnl We need both getrusage and the header containing its decls.
AC_CHECK_HEADERS_ONCE([sys/resource.h])
dnl Check whether there exists mprotect. If it exists and we are
dnl on HPUX, then prevent kaffe from using it when the pointer does not
dnl come from mmap.
AC_CHECK_FUNCS_ONCE(mprotect)
if test x"$ac_cv_func_mprotect" = x"yes"; then
case "$Khost_os" in
hpux*)
;;
*) AC_DEFINE(HAVE_COMPATIBLE_MPROTECT, 1, [Does mprotect support protecting region not covered by mmap ?])
;;
esac
fi
dnl needed for valgrind
AC_CHECK_HEADERS_ONCE([valgrind/memcheck.h])
gl_SIZE_MAX
dnl =========================================================================
dnl Select GC to use
dnl -------------------------------------------------------------------------
AC_ARG_WITH([gc],