-
Notifications
You must be signed in to change notification settings - Fork 32
/
configure.in
3318 lines (3089 loc) · 93 KB
/
configure.in
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
dnl // Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
AC_INIT(bochs.h)
AC_REVISION([[$Id: configure.in 14330 2021-08-01 08:07:38Z vruppert $]])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_HEADER(ltdlconf.h)
dnl // Put Bochs version information right here so that it gets substituted
dnl // into all the right places.
VERSION="2.7"
VER_MAJOR=2
VER_MINOR=7
dnl // this should be > 90 for pre-release of next version otherwise revision level
VER_REVISION=0
dnl // this should be 0 for release and 1 for svn version
VER_SVN=0
REL_STRING="Built from SVN snapshot on August 1, 2021"
REL_TIMESTAMP=`grep "Updated:" $srcdir/README | sed 's/Updated: //'`
changequote(<<, >>)
changequote([, ])
dnl Detect host and target
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_MSG_CHECKING(if you are configuring for another platform)
if test "$cross_compiling" = yes -o "$target_os" = "windows"; then
AC_MSG_RESULT(yes)
cross_configure=1
else
AC_MSG_RESULT(no)
cross_configure=0
fi
# this case statement defines the compile flags which are needed to
# compile bochs on a platform. Don't put things like optimization settings
# into the configure.in file, since people will want to be able to change
# those settings by defining CFLAGS and CXXFLAGS before running configure.
NO_LT=0
MSVC_TARGET=0
need_dlcompat_for_plugins=0
case "$target" in
*-pc-windows* | *-pc-winnt*)
DEFAULT_GUI=win32 # default to win32 gui
NO_LT=1 # do not use libtool at all
case "$target" in
x86_64*)
MSVC_TARGET=64
AC_DEFINE(MSVC_TARGET, 64)
;;
*)
MSVC_TARGET=32
AC_DEFINE(MSVC_TARGET, 32)
;;
esac
;;
*-cygwin* | *-mingw32* | *-msys)
NO_LT=1 # do not use libtool at all
if test "$with_term" = yes; then
# ncurses won't compile with -DWIN32
# also, I can't get it to link without this -DBROKEN_LINKER=1 hack.
# see /usr/include/curses.h for details.
ADD_FLAGS="-DBROKEN_LINKER=1"
else
# default case
ADD_FLAGS="-DWIN32" # required for cygwin/mingw/msys compile+win32 gui
DEFAULT_GUI=win32 # default to win32 gui
fi
;;
*-macosx* | *-darwin*)
ADD_FLAGS="-fpascal-strings -fno-common -Wno-four-char-constants -Wno-unknown-pragmas -Dmacintosh" # required for macosx compile
DEFAULT_GUI=carbon # default to carbon
need_dlcompat_for_plugins=1
;;
*-macos*)
DEFAULT_GUI=macos # macos defaults to macos
;;
*-amigaos* | *-morphos*)
DEFAULT_GUI=amigaos # amigaos or morphos defaults to amigaos gui
;;
*-solaris*)
ADD_FLAGS="-D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__" # required for correct function prototypes
LIBS="$LIBS -lsocket -lnsl"
DEFAULT_GUI=x11
;;
*)
DEFAULT_GUI=x11
;;
esac
if test "${ADD_FLAGS:+set}" = set; then
CFLAGS="$CFLAGS $ADD_FLAGS"
CXXFLAGS="$CXXFLAGS $ADD_FLAGS"
CPPFLAGS="$CPPFLAGS $ADD_FLAGS"
fi
case "$target" in
x86_64*)
BOCHS_BITS=64
;;
*)
BOCHS_BITS=32
;;
esac
AC_MSG_CHECKING(for standard CFLAGS on this platform)
AC_MSG_RESULT($ADD_FLAGS)
dnl // make sure the default gui is enabled if no other chosen
if (test "$with_sdl" != yes) && \
(test "$with_sdl2" != yes) && \
(test "$with_x11" != yes) && \
(test "$with_win32" != yes) && \
(test "$with_nogui" != yes) && \
(test "$with_term" != yes) && \
(test "$with_rfb" != yes) && \
(test "$with_vncsrv" != yes) && \
(test "$with_amigaos" != yes) && \
(test "$with_carbon" != yes) && \
(test "$with_wx" != yes) && \
(test "$with_macos" != yes); then
# use DEFAULT_GUI. Set the appropriate variable.
# DEFAULT_GUI must be set to one of the names above. Otherwise, no
# valid $with_* variable will be set and who knows what will happen?
eval "with_${DEFAULT_GUI}=yes"
fi
AC_PROG_CC
AC_PROG_CXX
AC_PROG_MAKE_SET
if test "$NO_LT" != 1; then
dnl------------ libtool configuration
dnl Configure libtool, and default to shared libraries. Libtool will only be
dnl used for compiling and linking plugins.
AC_DISABLE_STATIC
dnl Check for dlopen support
AC_LIBTOOL_DLOPEN
dnl Configure libtool
AC_PROG_LIBTOOL
dnl Configure the ltdl library. This must go after AC_PROG_LIBTOOL or
dnl else it disables shared libraries somehow.
AC_LIB_LTDL
else
RANLIB="echo"
fi
AC_PATH_PROG(PKGCONFIG, pkg-config, not_found)
if test "$PKGCONFIG" = not_found; then
AC_PATH_XTRA
fi
AC_C_BIGENDIAN
AC_CHECK_SIZEOF(unsigned char)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
if test "$MSVC_TARGET" = 0; then
AC_CHECK_SIZEOF(int *)
fi
AC_CHECK_FUNCS(getenv, AC_DEFINE(BX_HAVE_GETENV))
AC_CHECK_FUNCS(setenv, AC_DEFINE(BX_HAVE_SETENV))
AC_CHECK_FUNCS(snprintf, AC_DEFINE(BX_HAVE_SNPRINTF))
AC_CHECK_FUNCS(vsnprintf, AC_DEFINE(BX_HAVE_VSNPRINTF))
if test "$MSVC_TARGET" = 0; then
AC_CHECK_FUNCS(select, AC_DEFINE(BX_HAVE_SELECT))
AC_CHECK_TYPE(socklen_t, AC_DEFINE(BX_HAVE_SOCKLEN_T), , [#include <sys/types.h>
#include <sys/socket.h>])
AC_CHECK_FUNCS(strtoull, AC_DEFINE(BX_HAVE_STRTOULL))
AC_CHECK_FUNCS(strtouq, AC_DEFINE(BX_HAVE_STRTOUQ))
AC_CHECK_FUNCS(strdup, AC_DEFINE(BX_HAVE_STRDUP))
AC_CHECK_FUNCS(strrev, AC_DEFINE(BX_HAVE_STRREV))
AC_CHECK_FUNCS(stricmp, AC_DEFINE(BX_HAVE_STRICMP))
AC_CHECK_FUNCS(strcasecmp, AC_DEFINE(BX_HAVE_STRCASECMP))
AC_CHECK_FUNCS(mkstemp, AC_DEFINE(BX_HAVE_MKSTEMP))
AC_CHECK_HEADER(sys/mman.h, AC_DEFINE(BX_HAVE_SYS_MMAN_H))
AC_CHECK_FUNCS(gettimeofday, AC_DEFINE(BX_HAVE_GETTIMEOFDAY))
AC_CHECK_FUNCS(usleep, AC_DEFINE(BX_HAVE_USLEEP))
AC_MSG_CHECKING(for __builtin_bswap32)
AC_TRY_LINK([],[
__builtin_bswap32(0x12345678);
],[
AC_DEFINE(BX_HAVE___BUILTIN_BSWAP32, 1, [Define to 1 if you have the '__builtin_bswap32' function.])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for __builtin_bswap64)
AC_TRY_LINK([],[
__builtin_bswap64(0x12345678);
],[
AC_DEFINE(BX_HAVE___BUILTIN_BSWAP64, 1, [Define to 1 if you have the '__builtin_bswap64' function.])
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
])
AC_CHECK_FUNCS(tmpfile64, AC_DEFINE(BX_HAVE_TMPFILE64))
AC_CHECK_FUNCS(fseek64, AC_DEFINE(BX_HAVE_FSEEK64))
AC_CHECK_FUNCS(fseeko64, AC_DEFINE(BX_HAVE_FSEEKO64))
AC_CHECK_TYPE(ssize_t, AC_DEFINE(BX_HAVE_SSIZE_T), , [#include <sys/types.h>])
else
AC_DEFINE(BX_HAVE_SELECT, 1)
AC_DEFINE(BX_HAVE_SOCKLEN_T, 0)
AC_DEFINE(BX_HAVE_STRTOULL, 1)
AC_DEFINE(BX_HAVE_STRTOUQ, 0)
AC_DEFINE(BX_HAVE_STRDUP, 1)
AC_DEFINE(BX_HAVE_STRREV, 1)
AC_DEFINE(BX_HAVE_STRICMP, 1)
AC_DEFINE(BX_HAVE_STRCASECMP, 0)
AC_DEFINE(BX_HAVE_MKSTEMP, 0)
AC_DEFINE(BX_HAVE_SYS_MMAN_H, 0)
AC_DEFINE(BX_HAVE_GETTIMEOFDAY, 0)
AC_DEFINE(BX_HAVE_USLEEP, 0)
AC_DEFINE(BX_HAVE___BUILTIN_BSWAP32, 0)
AC_DEFINE(BX_HAVE___BUILTIN_BSWAP64, 0)
AC_DEFINE(BX_HAVE_TMPFILE64, 0)
AC_DEFINE(BX_HAVE_FSEEK64, 0)
AC_DEFINE(BX_HAVE_FSEEKO64, 0)
AC_DEFINE(BX_HAVE_SSIZE_T, 0)
AC_DEFINE(BX_HAVE_SETENV, 0)
if test "$MSVC_TARGET" = 64; then
AC_DEFINE(SIZEOF_INT_P, 8)
else
AC_DEFINE(SIZEOF_INT_P, 4)
fi
fi
AC_CHECK_FUNCS(sleep, AC_DEFINE(BX_HAVE_SLEEP))
AC_CHECK_FUNCS(nanosleep, AC_DEFINE(BX_HAVE_NANOSLEEP))
AC_CHECK_FUNCS(abort, AC_DEFINE(BX_HAVE_ABORT))
AC_CHECK_MEMBER(struct sockaddr_in.sin_len, AC_DEFINE(BX_HAVE_SOCKADDR_IN_SIN_LEN), , [#include <sys/socket.h>
#include <netinet/in.h> ])
AC_CHECK_FUNCS(timelocal, AC_DEFINE(BX_HAVE_TIMELOCAL))
AC_CHECK_FUNCS(gmtime, AC_DEFINE(BX_HAVE_GMTIME))
AC_CHECK_FUNCS(mktime, AC_DEFINE(BX_HAVE_MKTIME))
dnl As of autoconf 2.53, the standard largefile test fails for Linux/gcc.
dnl It does not put the largefiles arguments into CFLAGS, even though Linux/gcc
dnl does need them. So we do it ourselves.
AC_SYS_LARGEFILE
dnl we need to define _FILE_OFFSET_BITS or _LARGE_FILES on the compiler command
dnl line because otherwise the system headers risk being included before
dnl config.h which defines these constants leading to inconsistent
dnl sizeof(off_t) in different source files of the same program and linking
dnl problems
case "x$ac_cv_sys_file_offset_bits" in #(
xno | xunknown) ;;
*)
if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
BX_LARGEFILE_FLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
else
BX_LARGEFILE_FLAGS="-D_LARGE_FILES"
fi
CPPFLAGS="$CPPFLAGS $BX_LARGEFILE_FLAGS"
CFLAGS="$CFLAGS $BX_LARGEFILE_FLAGS"
CXXFLAGS="$CXXFLAGS $BX_LARGEFILE_FLAGS"
;;
esac
dnl ---end of largefile tests
AC_MSG_CHECKING(if compiler allows __attribute__)
AC_TRY_COMPILE([], [typedef struct { } __attribute__ ((packed)) junk;],
AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_NO_ATTRIBUTES)
])
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING(for set)
AC_TRY_COMPILE([#include <set>], [],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_HAVE_SET)
], AC_MSG_RESULT(no))
AC_MSG_CHECKING(for set.h)
AC_TRY_COMPILE([#include <set.h>], [],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_HAVE_SET_H)
], AC_MSG_RESULT(no))
AC_MSG_CHECKING(for map)
AC_TRY_COMPILE([#include <map>], [],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_HAVE_MAP)
], AC_MSG_RESULT(no))
AC_MSG_CHECKING(for map.h)
AC_TRY_COMPILE([#include <map.h>], [],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_HAVE_MAP_H)
], AC_MSG_RESULT(no))
AC_LANG_RESTORE
dnl Implement a check for each gui library to see if has a chance of compiling.
if test "$with_all_libs" = yes; then
if test "$cross_configure" = 1; then
AC_MSG_WARN([[Using --with-all-libs while cross configuring is very unlikely to be what you want. You should specify the --with-* args yourself.]])
fi
if test "$with_amigaos" != yes; then
can_compile_amigaos=1
AC_CHECK_HEADER([proto/intuition.h], [], [ can_compile_amigaos=0 ])
AC_CHECK_HEADER([intuition/intuitionbase.h], [], [ can_compile_amigaos=0 ])
AC_CHECK_HEADER([cybergraphx/cybergraphics.h], [], [ can_compile_amigaos=0 ])
AC_CHECK_HEADER([devices/trackdisk.h], [], [ can_compile_amigaos=0 ])
if test $can_compile_amigaos = 1; then
with_amigaos=yes
fi
fi
if test "$with_carbon" != yes; then
can_compile_carbon=1
AC_CHECK_HEADER([Carbon.h], [], [ can_compile_carbon=0 ])
AC_CHECK_HEADER([ApplicationServices/ApplicationServices.h], [], [ can_compile_carbon=0 ])
if test $can_compile_carbon = 1; then
with_carbon=yes
fi
fi
if test "$with_win32" != yes; then
can_compile_win32=1
AC_CHECK_HEADER([windows.h], [], [ can_compile_win32=0 ])
AC_CHECK_HEADER([commctrl.h], [], [ can_compile_win32=0 ])
if test $can_compile_win32 = 1; then
with_win32=yes
fi
fi
if test "$with_sdl" != yes -a "$with_sdl2" != yes; then
can_compile_sdl=2
AC_CHECK_HEADER([SDL2/SDL.h], [], [ can_compile_sdl=0 ])
AC_CHECK_HEADER([SDL2/SDL_main.h], [], [ can_compile_sdl=0 ])
if test $can_compile_sdl != 2; then
can_compile_sdl=1
AC_CHECK_HEADER([SDL/SDL.h], [], [ can_compile_sdl=0 ])
AC_CHECK_HEADER([SDL/SDL_main.h], [], [ can_compile_sdl=0 ])
if test $can_compile_sdl = 1; then
with_sdl=yes
fi
else
with_sdl2=yes
fi
fi
if test "$with_x11" != yes; then
can_compile_x11=1
AC_CHECK_HEADER([X11/Xlib.h], [], [ can_compile_x11=0 ])
AC_CHECK_HEADER([X11/Xutil.h], [], [ can_compile_x11=0 ])
if test $can_compile_x11 = 1; then
with_x11=yes
fi
fi
if test "$with_rfb" != yes; then
can_compile_rfb=1
case $target in
*-pc-windows* | *-pc-winnt* | *-cygwin* | *-mingw32* | *-msys)
AC_CHECK_HEADER([winsock2.h], [], [ can_compile_rfb=0 ])
AC_CHECK_HEADER([process.h], [], [ can_compile_rfb=0 ])
;;
*)
AC_CHECK_HEADER([sys/socket.h], [], [ can_compile_rfb=0 ])
AC_CHECK_HEADER([netinet/tcp.h], [], [ can_compile_rfb=0 ])
AC_CHECK_HEADER([pthread.h], [], [ can_compile_rfb=0 ])
;;
esac
if test $can_compile_rfb = 1; then
with_rfb=yes
fi
fi
if test "$with_vncsrv" != yes; then
can_compile_vncsrv=1
case $target in
*-pc-windows* | *-pc-winnt*)
can_compile_vncsrv=0
;;
*-cygwin* | *-mingw32* | *-msys)
AC_CHECK_HEADER([rfb/rfb.h], [], [ can_compile_vncsrv=0 ])
;;
*)
AC_CHECK_HEADER([rfb/rfb.h], [], [ can_compile_vncsrv=0 ])
AC_CHECK_HEADER([pthread.h], [], [ can_compile_vncsrv=0 ])
;;
esac
if test $can_compile_vncsrv = 1; then
with_vncsrv=yes
fi
fi
if test "$with_term" != yes; then
can_compile_term=1
AC_CHECK_HEADER([curses.h], [], [ can_compile_term=0 ])
AC_CHECK_HEADER([signal.h], [], [ can_compile_term=0 ])
if test $can_compile_term = 1; then
with_term=yes
fi
fi
if test "$with_nogui" != yes; then
with_nogui=yes
fi
fi # end of if $with_all_libs = yes
if test "$with_sdl" = yes -a "$with_sdl2" = yes; then
AC_MSG_ERROR([[--with-sdl and --with-sdl2 are mutually exclusive]])
fi
AC_MSG_CHECKING(for idle hack)
AC_ARG_ENABLE(idle-hack,
AS_HELP_STRING([--enable-idle-hack], [use Roland Mainz's idle hack (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_USE_IDLE_HACK, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_USE_IDLE_HACK, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_USE_IDLE_HACK, 0)
]
)
AC_SUBST(BX_USE_IDLE_HACK)
AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(BX_HAVE_DLFCN_H, 1))
AC_CHECK_HEADER(assert.h, AC_DEFINE(HAVE_ASSERT_H, 1))
AC_MSG_CHECKING(for plugins support)
AC_ARG_ENABLE(plugins,
AS_HELP_STRING([--enable-plugins], [enable plugin support (no)]),
[if test "$enableval" = yes; then
bx_plugins=1
else
bx_plugins=0
fi],
[
bx_plugins=0
]
)
USER_PLUGINS_MAKEFILE=''
if test "$bx_plugins" = 1; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_PLUGINS, 1)
GUI_NON_PLUGIN_OBJS='$(OBJS_THAT_CANNOT_BE_PLUGINS)'
GUI_PLUGIN_OBJS='$(OBJS_THAT_CAN_BE_PLUGINS)'
DEFINE_PLUGIN_PATH='-DBX_PLUGIN_PATH="\"${plugdir}\""'
# and the $(OBJS_THAT_SUPPORT_OTHER_PLUGINS) will be built and linked
if test "$NO_LT" != 1; then
# by special link rules for the plugins that they support.
LIBS="$LIBS $LIBADD_DL"
have_ltdl=0
AC_CHECK_HEADER(ltdl.h, [AC_CHECK_LIB(ltdl, lt_dlinit, [have_ltdl=1]]))
if test "$have_ltdl" = 1; then
PLUGIN_LIB="-lltdl"
AC_DEFINE(BX_HAVE_LTDL,1)
else
PLUGIN_VAR="ltdl.o"
PLUGIN_LIB="ltdl.o"
fi
fi
PLUGIN_TARGET=bochs_plugins
PLUGIN_TARGET_2=plugins_gcc
INSTALL_PLUGINS_VAR=install_libtool_plugins
NONPLUGIN_GUI_LINK_OPTS=''
if test -d user_plugins; then
USER_PLUGINS_MAKEFILE='user_plugins/Makefile'
fi
else
AC_MSG_RESULT(no)
bx_plugins=0
AC_DEFINE(BX_PLUGINS, 0)
GUI_NON_PLUGIN_OBJS='$(OBJS_THAT_CANNOT_BE_PLUGINS) $(OBJS_THAT_CAN_BE_PLUGINS) $(OBJS_THAT_SUPPORT_OTHER_PLUGINS)'
GUI_PLUGIN_OBJS=''
NONPLUGIN_GUI_LINK_OPTS='$(GUI_LINK_OPTS)'
fi
AC_SUBST(DEFINE_PLUGIN_PATH)
# copy gui variables into iodev variables. Later, we will add to the gui
# objs list, according to which display libraries are enabled.
IODEV_NON_PLUGIN_OBJS=$GUI_NON_PLUGIN_OBJS
IODEV_PLUGIN_OBJS=$GUI_PLUGIN_OBJS
IODEV_EXT_NON_PLUGIN_OBJS=$GUI_NON_PLUGIN_OBJS
IODEV_EXT_PLUGIN_OBJS=$GUI_PLUGIN_OBJS
# on MacOSX if they enabled plugins, make sure that dlopen() was found.
# It is provided by a library called dlcompat.
if test "$bx_plugins" = 1 -a "$need_dlcompat_for_plugins" = 1; then
have_dlopen=0
AC_CHECK_LIB(dl, dlopen, [have_dlopen=1])
AC_MSG_CHECKING(if you have dlcompat, required for MacOSX plugins)
if test "$have_dlopen" = 0; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([To use plugins on MacOSX you must use a library called dlcompat. The configure script was not able to find dlcompat. If it is already installed then you must set up your environment variables to point to it, as is done in .conf.macosx. If you cannot resolve this, you should turn off plugins.])
else
AC_MSG_RESULT(yes)
fi
fi
AC_MSG_CHECKING(if compiler allows LL for 64-bit constants)
AC_TRY_COMPILE([], [ { 42LL; } ],
AC_MSG_RESULT(yes),
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_64BIT_CONSTANTS_USE_LL, 0)
])
AC_MSG_CHECKING(for A20 support)
AC_ARG_ENABLE(a20-pin,
AS_HELP_STRING([--enable-a20-pin], [compile in support for A20 pin (yes)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_A20, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_A20, 0)
fi
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_A20, 1)
]
)
use_x86_64=0
AC_MSG_CHECKING(for x86-64 support)
AC_ARG_ENABLE(x86-64,
AS_HELP_STRING([--enable-x86-64], [compile in support for x86-64 instructions (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
OBJS64='$(OBJS64)'
AC_DEFINE(BX_SUPPORT_X86_64, 1)
use_x86_64=1
else
AC_MSG_RESULT(no)
OBJS64=''
AC_DEFINE(BX_SUPPORT_X86_64, 0)
fi
],
[
AC_MSG_RESULT(no)
OBJS64=''
AC_DEFINE(BX_SUPPORT_X86_64, 0)
]
)
AC_SUBST(OBJS64)
use_smp=0
AC_MSG_CHECKING(for SMP support)
AC_ARG_ENABLE(smp,
AS_HELP_STRING([--enable-smp], [compile in support for SMP configurations (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_SMP, 1)
AC_DEFINE(BX_USE_CPU_SMF, 0)
use_smp=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_SMP, 0)
fi
],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_SMP, 0)
]
)
AC_MSG_CHECKING(for cpu level)
AC_ARG_ENABLE(cpu-level,
AS_HELP_STRING([--enable-cpu-level], [select cpu level (3,4,5,6 - default is 6)]),
[case "$enableval" in
3)
AC_MSG_RESULT(3)
AC_DEFINE(BX_CPU_LEVEL, 3)
;;
4)
AC_MSG_RESULT(4)
AC_DEFINE(BX_CPU_LEVEL, 4)
;;
5)
AC_MSG_RESULT(5)
AC_DEFINE(BX_CPU_LEVEL, 5)
;;
6)
AC_MSG_RESULT(6)
AC_DEFINE(BX_CPU_LEVEL, 6)
;;
*)
echo " "
echo "ERROR: you must supply a valid CPU level to --enable-cpu-level"
exit 1
;;
esac
bx_cpu_level=$enableval
if test "$use_smp" = 1 -a "$enableval" -lt 5; then
echo "ERROR: with >1 processor, use --enable-cpu-level=5 or more"
exit 1
fi
if test "$use_x86_64" = 1 -a "$enableval" -lt 6; then
echo "ERROR: --enable-cpu-level=6 required for x86-64 emulation"
exit 1
fi
],
[
AC_MSG_RESULT(6)
AC_DEFINE(BX_CPU_LEVEL, 6)
bx_cpu_level=6
]
)
AC_MSG_CHECKING(for larger than 32 bit physical address emulation)
AC_ARG_ENABLE(long-phy-address,
AS_HELP_STRING([--enable-long-phy-address], [compile in support for physical address larger than 32 bit (yes, if cpu level >= 5)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_PHY_ADDRESS_LONG, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_PHY_ADDRESS_LONG, 0)
fi
],
[
if test "$bx_cpu_level" -ge 5; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_PHY_ADDRESS_LONG, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_PHY_ADDRESS_LONG, 0)
fi
]
)
AC_MSG_CHECKING(for large ramfile support)
AC_ARG_ENABLE(large-ramfile,
AS_HELP_STRING([--enable-large-ramfile], [enable large ramfile support (yes)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_LARGE_RAMFILE, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_LARGE_RAMFILE, 0)
fi],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_LARGE_RAMFILE, 1)
]
)
AC_SUBST(BX_LARGE_RAMFILE)
AC_MSG_CHECKING(for repeated IO and mem copy speedups)
AC_ARG_ENABLE(repeat-speedups,
AS_HELP_STRING([--enable-repeat-speedups], [support repeated IO and mem copy speedups (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
speedup_repeat=1
else
AC_MSG_RESULT(no)
speedup_repeat=0
fi],
[
AC_MSG_RESULT(no)
speedup_repeat=0
]
)
AC_MSG_CHECKING(for gcc / MSVC nmake fast function calls optimization)
AC_ARG_ENABLE(fast-function-calls,
AS_HELP_STRING([--enable-fast-function-calls], [support for fast function calls (no - gcc on x86 and MSVC nmake only)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
speedup_fastcall=1
else
AC_MSG_RESULT(no)
speedup_fastcall=0
fi],
[
AC_MSG_RESULT(no)
speedup_fastcall=0
]
)
AC_MSG_CHECKING(for handlers chaining speedups)
AC_ARG_ENABLE(handlers-chaining,
AS_HELP_STRING([--enable-handlers-chaining], [support handlers-chaining emulation speedups (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
speedup_handlers_chaining=1
else
AC_MSG_RESULT(no)
speedup_handlers_chaining=0
fi],
[
AC_MSG_RESULT(no)
speedup_handlers_chaining=0
]
)
AC_MSG_CHECKING(for trace linking speedups support)
AC_ARG_ENABLE(trace-linking,
AS_HELP_STRING([--enable-trace-linking], [enable trace linking speedups support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
enable_trace_linking=1
else
AC_MSG_RESULT(no)
enable_trace_linking=0
fi],
[
AC_MSG_RESULT(no)
enable_trace_linking=0
]
)
AC_MSG_CHECKING(support for configurable MSR registers)
AC_ARG_ENABLE(configurable-msrs,
AS_HELP_STRING([--enable-configurable-msrs], [support for configurable MSR registers (yes if cpu level >= 5)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_CONFIGURE_MSRS, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_CONFIGURE_MSRS, 0)
fi],
[
if test "$bx_cpu_level" -ge 5; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_CONFIGURE_MSRS, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_CONFIGURE_MSRS, 0)
fi
]
)
AC_MSG_CHECKING(show IPS)
AC_ARG_ENABLE(show-ips,
AS_HELP_STRING([--enable-show-ips], [show IPS in Bochs status bar / log file (yes)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SHOW_IPS, 1)
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SHOW_IPS, 0)
fi],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SHOW_IPS, 1)
]
)
AC_MSG_CHECKING(for use of .cpp as suffix)
AC_ARG_ENABLE(cpp,
AS_HELP_STRING([--enable-cpp], [use .cpp as C++ suffix (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
SUFFIX_LINE='.SUFFIXES: .cpp'
CPP_SUFFIX='cpp'
else
AC_MSG_RESULT(no)
SUFFIX_LINE='.SUFFIXES: .cc'
CPP_SUFFIX='cc'
fi],
[
AC_MSG_RESULT(no)
SUFFIX_LINE='.SUFFIXES: .cc'
CPP_SUFFIX='cc'
]
)
AC_SUBST(SUFFIX_LINE)
AC_SUBST(CPP_SUFFIX)
if test "$enable_cpp" = yes; then
echo "moving .cc source files to .cpp"
sourcefiles=`find . -name "*.cc" -print`
if test "$sourcefiles" != ""; then
for ccname in $sourcefiles
do
cppname=`echo $ccname | sed -e "s/\.cc$/.cpp/"`
echo "mv $ccname $cppname"
mv $ccname $cppname
done
else
echo "no more .cc source files to rename"
fi
fi
AC_MSG_CHECKING(for Bochs internal debugger support)
AC_ARG_ENABLE(debugger,
AS_HELP_STRING([--enable-debugger], [compile in support for Bochs internal debugger (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_DEBUGGER, 1)
DEBUGGER_VAR='$(DEBUGGER_LIB)'
NO_FLEX_YACC=''
AC_PATH_PROG(FLEX, flex, not_found)
AC_PATH_PROG(YACC, yacc, not_found)
AC_MSG_CHECKING(whether to generate parser / lexer files)
if test "$FLEX" = not_found -o "$YACC" = not_found -o "$MSVC_TARGET" != 0; then
NO_FLEX_YACC='#'
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
fi
AC_SUBST(NO_FLEX_YACC)
bx_debugger=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_DEBUGGER, 0)
DEBUGGER_VAR=''
bx_debugger=0
fi
],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_DEBUGGER, 0)
DEBUGGER_VAR=''
bx_debugger=0
]
)
AC_SUBST(DEBUGGER_VAR)
AC_MSG_CHECKING(enable Bochs internal debugger GUI)
AC_ARG_ENABLE(debugger-gui,
AS_HELP_STRING([--enable-debugger-gui], [compile in support for Bochs internal debugger GUI (yes, if debugger is on)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
gui_debugger=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_DEBUGGER_GUI, 0)
gui_debugger=0
fi],
[
if test "$bx_debugger" = 1; then
AC_MSG_RESULT(yes)
gui_debugger=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_DEBUGGER_GUI, 0)
gui_debugger=0
fi
]
)
bx_gdb_stub=0
AC_MSG_CHECKING(for gdb stub enable)
AC_ARG_ENABLE(gdb-stub,
AS_HELP_STRING([--enable-gdb-stub], [enable gdb stub support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_GDBSTUB, 1)
GDBSTUB_VAR='$(GDBSTUB_OBJS)'
bx_gdb_stub=1
if test "$bx_debugger" = 1; then
AC_MSG_ERROR([[--enable-debugger and --enable-gdb-stub are mutually exclusive]])
fi
AC_MSG_WARN([This Bochs feature is not maintained yet and may fail])
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_GDBSTUB, 0)
GDBSTUB_VAR=''
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_GDBSTUB, 0)
GDBSTUB_VAR=''
]
)
AC_SUBST(GDBSTUB_VAR)
AC_MSG_CHECKING(for I/O Interface to the debugger)
IODEBUG_OBJS=''
AC_ARG_ENABLE(iodebug,
AS_HELP_STRING([--enable-iodebug], [enable I/O interface to debugger (yes, if debugger is on)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_IODEBUG, 1)
IODEBUG_OBJS='iodebug.o'
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_IODEBUG, 0)
fi
],
[
if test "$bx_debugger" = 1; then
# enable by default if debugger is on
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_IODEBUG, 1)
IODEBUG_OBJS='iodebug.o'
else
AC_MSG_RESULT(no)
fi
]
)
AC_SUBST(IODEBUG_OBJS)
AC_MSG_CHECKING(for ALL optimizations enabled)
AC_ARG_ENABLE(all-optimizations,
AS_HELP_STRING([--enable-all-optimizations], [compile in all possible optimizations (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
speedups_all=1
else
AC_MSG_RESULT(no)
speedups_all=0
fi
],
[
AC_MSG_RESULT(no)
speedups_all=0
]
)
#
# Optimizations section. Decide what the status of various optimizations
# should be based on configure choices and other factors.
#
if test "$speedups_all" = 1; then
# Configure requested to force all options enabled.
speedup_repeat=1
speedup_fastcall=1
speedup_handlers_chaining=1
enable_trace_linking=1
fi
if test "$speedup_repeat" = 1; then
AC_DEFINE(BX_SUPPORT_REPEAT_SPEEDUPS, 1)
else
AC_DEFINE(BX_SUPPORT_REPEAT_SPEEDUPS, 0)
fi
if test "$speedup_fastcall" = 1; then
AC_DEFINE(BX_FAST_FUNC_CALL, 1)
else
AC_DEFINE(BX_FAST_FUNC_CALL, 0)
fi
if test "$bx_debugger" = 1 -a "$speedup_handlers_chaining" = 1; then
speedup_handlers_chaining=0
echo "ERROR: handlers-chaining speedups are not supported with internal debugger or gdbstub yet"
fi
if test "$bx_gdb_stub" = 1 -a "$speedup_handlers_chaining" = 1; then
speedup_handlers_chaining=0
echo "ERROR: handlers-chaining speedups are not supported with internal debugger or gdbstub yet"
fi
if test "$speedup_handlers_chaining" = 1; then
AC_DEFINE(BX_SUPPORT_HANDLERS_CHAINING_SPEEDUPS, 1)
else
AC_DEFINE(BX_SUPPORT_HANDLERS_CHAINING_SPEEDUPS, 0)
fi
if test "$enable_trace_linking" = 1; then
AC_DEFINE(BX_ENABLE_TRACE_LINKING, 1)
else
AC_DEFINE(BX_ENABLE_TRACE_LINKING, 0)
fi
READLINE_LIB=""
rl_without_curses_ok=no
rl_with_curses_ok=no
AC_MSG_CHECKING(whether user wants readline)
AC_ARG_ENABLE(readline,
AS_HELP_STRING([--enable-readline], [use readline library, if available (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
want_readline=yes
else
AC_MSG_RESULT(no)
want_readline=no
fi],
[
AC_MSG_RESULT(yes)
want_readline=yes
]
)
use_readline=0
AC_MSG_CHECKING(whether to use readline)
if test "$want_readline" = yes; then
if test "$bx_debugger" = 1; then
AC_MSG_CHECKING(if readline works without -lcurses)
OLD_LIBS=$LIBS
LIBS="$LIBS -lreadline"