-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
2829 lines (2617 loc) · 78.6 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 11692 2013-05-26 07:17:33Z 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.6.2"
VER_STRING="2.6.2"
dnl // WIN_VER_STRING format is "a, b, c, d"
dnl // c should be > 90 for pre-release of next version otherwise patch level
dnl // d should be 0 for release and 1 for svn version
WIN_VER_STRING="2, 6, 2, 0"
REL_STRING="Built from SVN snapshot on May 26, 2013"
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
MSVC_TARGET=1
;;
*-pc-cygwin*)
NO_LT=1 # do not use libtool at all on cygwin
if test "$with_term" = yes; then
# ncurses won't compile with -mno-cygwin or -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"
fi
;;
*-mingw32*)
NO_LT=1 # do not use libtool at all on cygwin
if test "$with_term" = yes; then
# ncurses won't compile with -mno-cygwin or -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 mingw 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
AC_MSG_CHECKING(for standard CFLAGS on this platform)
AC_MSG_RESULT($ADD_FLAGS)
dnl // make sure X Windows is default if no other chosen
if (test "$with_sdl" != yes) && \
(test "$with_svga" != yes) && \
(test "$with_x11" != yes) && \
(test "$with_win32" != yes) && \
(test "$with_nogui" != yes) && \
(test "$with_term" != yes) && \
(test "$with_rfb" != 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 "$MSVC_TARGET" != 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
fi
AC_PATH_PROG(PKGCONFIG, pkg-config, not_found)
if test "$PKGCONFIG" = not_found; then
AC_PATH_XTRA
fi
AC_C_BIGENDIAN
AC_C_INLINE
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)
AC_CHECK_SIZEOF(int *)
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" != 1; 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))
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)
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
dnl Add the -lm library if math functions cannot be used without it.
dnl This check is important on cygwin because of the bizarre way that they
dnl have organized functions into libraries. On cygwin, both libc.a and
dnl libm.a are symbolic links to a single lib libcygwin.a. This means that
dnl 1) linking with -lm is not necessary, and
dnl 2) linking with -lm is dangerous if the order of libraries is wrong
dnl In particular, if you compile any program with -mno-cygwin and link with
dnl -lm, it will crash instantly when it is run. This happens because the
dnl linker incorrectly links the Cygwin libm.a (==libcygwin.a), which replaces
dnl the ___main function instead of allowing it to be defined by
dnl /usr/lib/mingw/libmingw32.a as it should be.
dnl
dnl On MacOS X, this test will find that -lm is unnecessary and leave it out.
dnl
dnl Just check a few math functions. If they are all found without
dnl -lm, then we must not need -lm.
have_cos=0
have_floor=0
AC_CHECK_FUNCS(cos, have_cos=1)
AC_CHECK_FUNCS(floor, have_floor=1)
AC_MSG_CHECKING(if math functions link without -lm)
if test "$have_cos" = 1 -a "$have_floor" = 1; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
LIBS="$LIBS -lm"
# use different functions to bypass configure caching
have_sin=0
have_ceil=0
AC_CHECK_FUNCS(sin, have_sin=1)
AC_CHECK_FUNCS(ceil, have_ceil=1)
AC_MSG_CHECKING(if math functions link with -lm)
if test "$have_sin" = 1 -a "$have_ceil" = 1; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
# not sure we should warn the user, crash, etc.
# expect link failure
fi
fi
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_macos" != yes; then
can_compile_macos=1
AC_CHECK_HEADER([Quickdraw.h], [], [ can_compile_macos=0 ])
AC_CHECK_HEADER([Dialogs.h], [], [ can_compile_macos=0 ])
if test $can_compile_macos = 1; then
with_macos=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; 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
fi
if test "$with_svga" != yes; then
can_compile_svga=1
AC_CHECK_HEADER([vga.h], [], [ can_compile_svga=0 ])
AC_CHECK_HEADER([vgagl.h], [], [ can_compile_svga=0 ])
if test $can_compile_svga = 1; then
with_svga=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* | *-pc-cygwin* | *-mingw32*)
AC_CHECK_HEADER([winsock.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_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
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
]
)
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
# 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_VAR="-lltdl"
AC_DEFINE(BX_HAVE_LTDL,1)
else
PLUGIN_VAR="ltdl.o"
fi
PLUGIN_TARGET=bochs_plugins
INSTALL_PLUGINS_VAR=install_libtool_plugins
NONPLUGIN_GUI_LINK_OPTS=''
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)
AC_SUBST(NONPLUGIN_GUI_LINK_OPTS)
# 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)
networking=no
NETDEV_OBJS=''
AC_MSG_CHECKING(for NE2000 support)
AC_ARG_ENABLE(ne2000,
AS_HELP_STRING([--enable-ne2000], [enable NE2000 support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_NE2K, 1)
NETDEV_OBJS='ne2k.o'
networking=yes
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_NE2K, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_NE2K, 0)
]
)
AC_MSG_CHECKING(for i440FX PCI support)
AC_ARG_ENABLE(pci,
AS_HELP_STRING([--enable-pci], [enable i440FX PCI support (yes)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_PCI, 1)
pci=1
PCI_OBJ='pci.o pci2isa.o pci_ide.o acpi.o'
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_PCI, 0)
pci=0
PCI_OBJ=''
fi],
[
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_PCI, 1)
pci=1
PCI_OBJ='pci.o pci2isa.o pci_ide.o acpi.o'
]
)
AC_SUBST(PCI_OBJ)
#
# PCI host device support
#
AC_MSG_CHECKING(for PCI host device mapping support)
AC_ARG_ENABLE(pcidev,
AS_HELP_STRING([--enable-pcidev], [enable PCI host device mapping support (no - linux host only)]),
[
if test "$enableval" = "yes"; then
AC_MSG_RESULT(yes)
if test "$pci" != "1"; then
AC_MSG_ERROR([PCI host device mapping requires PCI support])
fi
case "$target" in
*-linux*)
AC_MSG_NOTICE([Linux detected as host for PCI host device mapping])
linux_version=`uname -r`
case "$linux_version" in
2.4*)
PCIDEV_MODULE_MAKE_ALL="all-kernel24"
KERNEL_MODULE_SUFFIX="o"
;;
2.6*|3.*)
PCIDEV_MODULE_MAKE_ALL="all-kernel26"
KERNEL_MODULE_SUFFIX="ko"
;;
*)
AC_MSG_ERROR([Linux kernel 2.4, 2.6 or 3.x is required for PCI host device mapping])
;;
esac
KERNELDIR="/lib/modules/$linux_version/build"
LSMOD="lsmod"
INSMOD="insmod"
RMMOD="rmmod"
DEPMOD="depmod"
CLEAN_PCIDEV_VAR=clean_pcidev
AC_SUBST(KERNELDIR)
AC_SUBST(LSMOD)
AC_SUBST(INSMOD)
AC_SUBST(RMMOD)
AC_SUBST(DEPMOD)
AC_SUBST(PCIDEV_MODULE_MAKE_ALL)
AC_SUBST(KERNEL_MODULE_SUFFIX)
AC_SUBST(CLEAN_PCIDEV_VAR)
;;
*)
AC_MSG_ERROR([PCI host device mapping requires Linux as host])
;;
esac
AC_DEFINE(BX_SUPPORT_PCIDEV, 1)
PCI_OBJ="$PCI_OBJ pcidev.o"
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_PCIDEV, 0)
fi
],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_PCIDEV, 0)
]
)
use_usb=0
USBHC_OBJS=''
AC_MSG_CHECKING(for USB UHCI support)
AC_ARG_ENABLE(usb,
AS_HELP_STRING([--enable-usb], [enable USB UHCI support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_USB_UHCI, 1)
USBHC_OBJS="usb_uhci.o"
use_usb=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_USB_UHCI, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_USB_UHCI, 0)
]
)
AC_MSG_CHECKING(for USB OHCI support)
AC_ARG_ENABLE(usb-ohci,
AS_HELP_STRING([--enable-usb-ohci], [enable USB OHCI support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_USB_OHCI, 1)
USBHC_OBJS="$USBHC_OBJS usb_ohci.o"
use_usb=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_USB_OHCI, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_USB_OHCI, 0)
]
)
AC_MSG_CHECKING(for experimental USB xHCI support)
AC_ARG_ENABLE(usb-xhci,
AS_HELP_STRING([--enable-usb-xhci], [enable experimental USB xHCI support (no - incomplete)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_USB_XHCI, 1)
USBHC_OBJS="$USBHC_OBJS usb_xhci.o"
use_usb=1
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_USB_XHCI, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_USB_XHCI, 0)
]
)
if test "$use_usb" = 1; then
if test "$pci" != "1"; then
AC_MSG_ERROR([USB requires PCI support])
fi
USBCORE_OBJ="usb_common.o"
USBDEV_OBJS="usb_hid.o usb_hub.o usb_msd.o usb_printer.o"
SCSI_OBJS="scsi_device.o"
AC_SUBST(USBHC_OBJS)
AC_SUBST(USBCORE_OBJ)
AC_SUBST(USBDEV_OBJS)
AC_SUBST(SCSI_OBJS)
if test "$bx_plugins" = 0; then
USB_LIB_VAR='iodev/usb/libusb.a'
AC_SUBST(USB_LIB_VAR)
fi
fi
AC_MSG_CHECKING(for PCI pseudo NIC support)
AC_ARG_ENABLE(pnic,
AS_HELP_STRING([--enable-pnic], [enable PCI pseudo NIC support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(BX_SUPPORT_PCIPNIC, 1)
NETDEV_OBJS="$NETDEV_OBJS pcipnic.o"
networking=yes
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_PCIPNIC, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_PCIPNIC, 0)
]
)
AC_MSG_CHECKING(for Intel(R) Gigabit Ethernet support)
AC_ARG_ENABLE(e1000,
AS_HELP_STRING([--enable-e1000], [enable Intel(R) Gigabit Ethernet support (no)]),
[if test "$enableval" = yes; then
AC_MSG_RESULT(yes)
if test "$pci" != "1"; then
AC_MSG_ERROR([E1000 network adapter requires PCI support])
fi
AC_DEFINE(BX_SUPPORT_E1000, 1)
NETDEV_OBJS="$NETDEV_OBJS e1000.o"
networking=yes
else
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_E1000, 0)
fi],
[
AC_MSG_RESULT(no)
AC_DEFINE(BX_SUPPORT_E1000, 0)
]
)
NETLOW_OBJS=''
if test "$networking" = yes; then
NETLOW_OBJS='eth_null.o eth_vnet.o'
if test "$MSVC_TARGET" != 1; then
AC_CHECK_HEADER(net/bpf.h, [
NETLOW_OBJS="$NETLOW_OBJS eth_fbsd.o"
AC_DEFINE(BX_NETMOD_FBSD, 1)
])
AC_CHECK_HEADER(netpacket/packet.h, [
NETLOW_OBJS="$NETLOW_OBJS eth_linux.o"
AC_DEFINE(BX_NETMOD_LINUX, 1)
])
AC_CHECK_FUNCS(fork, have_fork=1)
AC_CHECK_FUNCS(execlp, have_execlp=1)
AC_CHECK_FUNCS(socketpair, have_socketpair=1)
if test x"$have_fork" = x1 -a x"$have_execlp" = x1 -a x"$have_socketpair" = x1; then
NETLOW_OBJS="$NETLOW_OBJS eth_slirp.o"
AC_DEFINE(BX_NETMOD_SLIRP, 1)
fi
fi
case "$target" in
*-pc-windows* | *-pc-winnt* | *-pc-cygwin* | *-mingw32*)
NETLOW_OBJS="$NETLOW_OBJS eth_win32.o"
AC_DEFINE(BX_NETMOD_WIN32, 1)
;;
*-macosx* | *-darwin*)
NETLOW_OBJS="$NETLOW_OBJS eth_tuntap.o"
AC_DEFINE(BX_NETMOD_TUNTAP, 1)
;;
*)
AC_CHECK_HEADER(net/if.h, [
use_ethertap=yes
AC_DEFINE(BX_HAVE_NET_IF_H, 1)
], [],
[
#include <sys/types.h>
#include <sys/socket.h>
])
AC_CHECK_HEADER(linux/netlink.h, [
use_ethertap=yes
], [],
[
#include <asm/types.h>
#include <sys/socket.h>
])
if test "$use_ethertap" = yes; then
NETLOW_OBJS="$NETLOW_OBJS eth_tap.o eth_vde.o"
AC_DEFINE(BX_NETMOD_TAP, 1)
AC_DEFINE(BX_NETMOD_VDE, 1)
fi
AC_CHECK_HEADER(net/if_tun.h, [
use_tuntap=yes
], [],
[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
])
AC_CHECK_HEADER(linux/if_tun.h, [
use_tuntap=yes
], [],
[
#include <asm/types.h>
#include <sys/socket.h>
])
if test "$use_tuntap" = yes; then
NETLOW_OBJS="$NETLOW_OBJS eth_tuntap.o"
AC_DEFINE(BX_NETMOD_TUNTAP, 1)
fi
;;
esac
if test "$bx_plugins" = 0; then
NETWORK_LIB_VAR='iodev/network/libnetwork.a'
AC_SUBST(NETWORK_LIB_VAR)
fi
AC_DEFINE(BX_NETWORKING, 1)
else
AC_DEFINE(BX_NETWORKING, 0)
fi
AC_SUBST(NETDEV_OBJS)
AC_SUBST(NETLOW_OBJS)
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 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 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],
[