1 dnl // Process this file with autoconf to produce a configure script.
5 AC_REVISION([[$Id: configure.in,v 1.353 2007/12/01 16:45:15 sshwarts Exp $]])
6 AC_CONFIG_HEADER(config.h)
7 AC_CONFIG_HEADER(ltdlconf.h)
9 dnl // Put Bochs version information right here so that it gets substituted
10 dnl // into all the right places.
12 VER_STRING="2.3.5.cvs"
13 REL_STRING="Build from CVS snapshot, after release 2.3.5"
18 dnl Detect host and target
22 AC_MSG_CHECKING(if you are configuring for another platform)
23 if test "$cross_compiling" = yes -o "$target_os" = "windows"; then
31 # this case statement defines the compile flags which are needed to
32 # compile bochs on a platform. Don't put things like optimization settings
33 # into the configure.in file, since people will want to be able to change
34 # those settings by defining CFLAGS and CXXFLAGS before running configure.
36 need_dlcompat_for_plugins=0
38 *-pc-windows* | *-pc-winnt*)
39 DEFAULT_GUI=win32 # default to win32 gui
41 *-pc-cygwin* | *-pc-mingw32*)
42 NO_LT=1 # do not use libtool at all on cygwin
43 if test "$with_term" = yes; then
44 # ncurses won't compile with -mno-cygwin or -DWIN32
45 # also, I can't get it to link without this -DBROKEN_LINKER=1 hack.
46 # see /usr/include/curses.h for details.
47 ADD_FLAGS="-DBROKEN_LINKER=1"
50 ADD_FLAGS="-mno-cygwin -DWIN32" # required for cygwin compile+win32 gui
51 DEFAULT_GUI=win32 # default to win32 gui
54 *-macosx* | *-darwin*)
55 ADD_FLAGS="-fpascal-strings -fno-common -Wno-four-char-constants -Wno-unknown-pragmas -Dmacintosh" # required for macosx compile
56 DEFAULT_GUI=carbon # default to carbon
57 need_dlcompat_for_plugins=1
60 DEFAULT_GUI=macos # macos defaults to macos
63 ADD_FLAGS="-Wno-multichar"
64 DEFAULT_GUI=beos # beos defaults to beos
66 *-amigaos* | *-morphos*)
67 DEFAULT_GUI=amigaos # amigaos or morphos defaults to amigaos gui
70 ADD_FLAGS="-D_XOPEN_SOURCE_EXTENDED=1 -D__EXTENSIONS__" # required for correct function prototypes
71 LIBS="$LIBS -lsocket -lnsl"
78 if test "${ADD_FLAGS:+set}" = set; then
79 CFLAGS="$CFLAGS $ADD_FLAGS"
80 CXXFLAGS="$CXXFLAGS $ADD_FLAGS"
81 CPPFLAGS="$CPPFLAGS $ADD_FLAGS"
84 AC_MSG_CHECKING(for standard CFLAGS on this platform)
85 AC_MSG_RESULT($ADD_FLAGS)
87 dnl // make sure X Windows is default if no other chosen
88 if (test "$with_sdl" != yes) && \
89 (test "$with_svga" != yes) && \
90 (test "$with_x11" != yes) && \
91 (test "$with_beos" != yes) && \
92 (test "$with_win32" != yes) && \
93 (test "$with_nogui" != yes) && \
94 (test "$with_term" != yes) && \
95 (test "$with_rfb" != yes) && \
96 (test "$with_amigaos" != yes) && \
97 (test "$with_carbon" != yes) && \
98 (test "$with_wx" != yes) && \
99 (test "$with_macos" != yes); then
100 # use DEFAULT_GUI. Set the appropriate variable.
101 # DEFAULT_GUI must be set to one of the names above. Otherwise, no
102 # valid $with_* variable will be set and who knows what will happen?
103 eval "with_${DEFAULT_GUI}=yes"
110 dnl------------ libtool configuration
111 dnl Configure libtool, and default to shared libraries. Libtool will only be
112 dnl used for compiling and linking plugins.
114 dnl Check for dlopen support
116 dnl Configure libtool
118 dnl Configure the ltdl library. This must go after AC_PROG_LIBTOOL or
119 dnl else it disables shared libraries somehow. The values from this macro
120 dnl are written to ltdlconf.h.
127 AC_CHECK_SIZEOF(unsigned char)
128 AC_CHECK_SIZEOF(unsigned short)
129 AC_CHECK_SIZEOF(unsigned int)
130 AC_CHECK_SIZEOF(unsigned long)
131 AC_CHECK_SIZEOF(unsigned long long)
132 AC_CHECK_SIZEOF(int *)
133 AC_CHECK_FUNCS(getenv, AC_DEFINE(BX_HAVE_GETENV))
134 AC_CHECK_FUNCS(setenv, AC_DEFINE(BX_HAVE_SETENV))
135 AC_CHECK_FUNCS(select, AC_DEFINE(BX_HAVE_SELECT))
136 AC_CHECK_FUNCS(snprintf, AC_DEFINE(BX_HAVE_SNPRINTF))
137 AC_CHECK_FUNCS(vsnprintf, AC_DEFINE(BX_HAVE_VSNPRINTF))
138 AC_CHECK_FUNCS(strtoull, AC_DEFINE(BX_HAVE_STRTOULL))
139 AC_CHECK_FUNCS(strtouq, AC_DEFINE(BX_HAVE_STRTOUQ))
140 AC_CHECK_FUNCS(strdup, AC_DEFINE(BX_HAVE_STRDUP))
141 AC_CHECK_FUNCS(strrev, AC_DEFINE(BX_HAVE_STRREV))
142 AC_CHECK_FUNCS(sleep, AC_DEFINE(BX_HAVE_SLEEP))
143 AC_CHECK_FUNCS(usleep, AC_DEFINE(BX_HAVE_USLEEP))
144 AC_CHECK_FUNCS(nanosleep, AC_DEFINE(BX_HAVE_NANOSLEEP))
145 AC_CHECK_FUNCS(abort, AC_DEFINE(BX_HAVE_ABORT))
146 AC_CHECK_FUNCS(gettimeofday, AC_DEFINE(BX_HAVE_GETTIMEOFDAY))
147 AC_CHECK_TYPE(socklen_t, AC_DEFINE(BX_HAVE_SOCKLEN_T), , [#include <sys/types.h>
148 #include <sys/socket.h>])
149 AC_CHECK_MEMBER(struct sockaddr_in.sin_len, AC_DEFINE(BX_HAVE_SOCKADDR_IN_SIN_LEN), , [#include <sys/socket.h>
150 #include <netinet/in.h> ])
151 AC_CHECK_FUNCS(mkstemp, AC_DEFINE(BX_HAVE_MKSTEMP))
152 AC_CHECK_HEADER(sys/mman.h, AC_DEFINE(BX_HAVE_SYS_MMAN_H))
153 AC_CHECK_FUNCS(timelocal, AC_DEFINE(BX_HAVE_TIMELOCAL))
154 AC_CHECK_FUNCS(gmtime, AC_DEFINE(BX_HAVE_GMTIME))
155 AC_CHECK_FUNCS(mktime, AC_DEFINE(BX_HAVE_MKTIME))
157 dnl As of autoconf 2.53, the standard largefile test fails for Linux/gcc.
158 dnl It does not put the largefiles arguments into CFLAGS, even though Linux/gcc
159 dnl does need them. Since wxWidgets had already solved this exact problem,
160 dnl Bryce asked Vadim Zeitlin of the wxWidgets project if Bochs could grab
161 dnl their largefile test, and he said it was fine. The re-implemented
162 dnl AC_SYS_LARGEFILE test can be found in aclocal.m4.
165 dnl This logic came from wxWidgets as well. Bryce added the CFLAGS and
166 dnl CXXFLAGS lines, since Bochs makefiles don't use CPPFLAGS at all.
168 dnl we need to define _FILE_OFFSET_BITS or _LARGE_FILES on the compiler command
169 dnl line because otherwise the system headers risk being included before
170 dnl config.h which defines these constants leading to inconsistent
171 dnl sizeof(off_t) in different source files of the same program and linking
173 if test "x$wx_largefile" = "xyes"; then
174 if test "x$ac_cv_sys_file_offset_bits" = "x64"; then
175 BX_LARGEFILE_FLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES"
177 BX_LARGEFILE_FLAGS="-D_LARGE_FILES"
179 CPPFLAGS="$CPPFLAGS $BX_LARGEFILE_FLAGS"
180 CFLAGS="$CFLAGS $BX_LARGEFILE_FLAGS"
181 CXXFLAGS="$CXXFLAGS $BX_LARGEFILE_FLAGS"
183 dnl ---end of largefile tests
185 dnl Add the -lm library if math functions cannot be used without it.
186 dnl This check is important on cygwin because of the bizarre way that they
187 dnl have organized functions into libraries. On cygwin, both libc.a and
188 dnl libm.a are symbolic links to a single lib libcygwin.a. This means that
189 dnl 1) linking with -lm is not necessary, and
190 dnl 2) linking with -lm is dangerous if the order of libraries is wrong
191 dnl In particular, if you compile any program with -mno-cygwin and link with
192 dnl -lm, it will crash instantly when it is run. This happens because the
193 dnl linker incorrectly links the Cygwin libm.a (==libcygwin.a), which replaces
194 dnl the ___main function instead of allowing it to be defined by
195 dnl /usr/lib/mingw/libmingw32.a as it should be.
197 dnl On MacOS X, this test will find that -lm is unnecessary and leave it out.
199 dnl Just check a few math functions. If they are all found without
200 dnl -lm, then we must not need -lm.
203 AC_CHECK_FUNCS(cos, have_cos=1)
204 AC_CHECK_FUNCS(floor, have_floor=1)
205 AC_MSG_CHECKING(if math functions link without -lm)
206 if test "$have_cos" = 1 -a "$have_floor" = 1; then
211 # use different functions to bypass configure caching
214 AC_CHECK_FUNCS(sin, have_sin=1)
215 AC_CHECK_FUNCS(ceil, have_ceil=1)
216 AC_MSG_CHECKING(if math functions link with -lm)
217 if test "$have_sin" = 1 -a "$have_ceil" = 1; then
221 # not sure we should warn the user, crash, etc.
222 # expect link failure
226 AC_MSG_CHECKING(for struct timeval)
227 AC_TRY_COMPILE([#include <sys/time.h>],
231 AC_DEFINE(BX_HAVE_STRUCT_TIMEVAL, 1)
235 AC_MSG_CHECKING(if compiler allows empty structs)
236 AC_TRY_COMPILE([], [typedef struct { } junk;],
239 AC_DEFINE(BX_NO_EMPTY_STRUCTS)
243 AC_MSG_CHECKING(if compiler allows __attribute__)
244 AC_TRY_COMPILE([], [typedef struct { } __attribute__ ((packed)) junk;],
248 AC_DEFINE(BX_NO_ATTRIBUTES)
253 AC_MSG_CHECKING(for hash_map)
254 AC_TRY_COMPILE([#include <hash_map>], [],
257 AC_DEFINE(BX_HAVE_HASH_MAP)
258 ], AC_MSG_RESULT(no))
259 AC_MSG_CHECKING(for hash_map.h)
260 AC_TRY_COMPILE([#include <hash_map.h>], [],
263 AC_DEFINE(BX_HAVE_HASH_MAP_H)
264 ], AC_MSG_RESULT(no))
265 AC_MSG_CHECKING(for set)
266 AC_TRY_COMPILE([#include <set>], [],
269 AC_DEFINE(BX_HAVE_SET)
270 ], AC_MSG_RESULT(no))
271 AC_MSG_CHECKING(for set.h)
272 AC_TRY_COMPILE([#include <set.h>], [],
275 AC_DEFINE(BX_HAVE_SET_H)
276 ], AC_MSG_RESULT(no))
279 dnl Implement a check for each gui library to see if has a chance of compiling.
280 if test "$with_all_libs" = yes; then
281 if test "$cross_configure" = 1; then
282 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.]])
284 if test "$with_beos" != yes; then
286 AC_CHECK_HEADER([app/Application.h], [], [ can_compile_beos=0 ])
287 AC_CHECK_HEADER([interface/Window.h], [], [ can_compile_beos=0 ])
288 AC_CHECK_HEADER([interface/View.h], [], [ can_compile_beos=0 ])
289 if test $can_compile_beos = 1; then
294 if test "$with_amigaos" != yes; then
295 can_compile_amigaos=1
296 AC_CHECK_HEADER([proto/intuition.h], [], [ can_compile_amigaos=0 ])
297 AC_CHECK_HEADER([intuition/intuitionbase.h], [], [ can_compile_amigaos=0 ])
298 AC_CHECK_HEADER([cybergraphx/cybergraphics.h], [], [ can_compile_amigaos=0 ])
299 AC_CHECK_HEADER([devices/trackdisk.h], [], [ can_compile_amigaos=0 ])
300 if test $can_compile_amigaos = 1; then
305 if test "$with_macos" != yes; then
307 AC_CHECK_HEADER([Quickdraw.h], [], [ can_compile_macos=0 ])
308 AC_CHECK_HEADER([Dialogs.h], [], [ can_compile_macos=0 ])
309 if test $can_compile_macos = 1; then
314 if test "$with_carbon" != yes; then
316 AC_CHECK_HEADER([Carbon.h], [], [ can_compile_carbon=0 ])
317 AC_CHECK_HEADER([ApplicationServices/ApplicationServices.h], [], [ can_compile_carbon=0 ])
318 if test $can_compile_carbon = 1; then
323 if test "$with_win32" != yes; then
325 AC_CHECK_HEADER([windows.h], [], [ can_compile_win32=0 ])
326 AC_CHECK_HEADER([commctrl.h], [], [ can_compile_win32=0 ])
327 if test $can_compile_win32 = 1; then
332 if test "$with_sdl" != yes; then
334 AC_CHECK_HEADER([SDL/SDL.h], [], [ can_compile_sdl=0 ])
335 AC_CHECK_HEADER([SDL/SDL_main.h], [], [ can_compile_sdl=0 ])
336 if test $can_compile_sdl = 1; then
341 if test "$with_svga" != yes; then
343 AC_CHECK_HEADER([vga.h], [], [ can_compile_svga=0 ])
344 AC_CHECK_HEADER([vgagl.h], [], [ can_compile_svga=0 ])
345 if test $can_compile_svga = 1; then
350 if test "$with_x11" != yes; then
352 AC_CHECK_HEADER([X11/Xlib.h], [], [ can_compile_x11=0 ])
353 AC_CHECK_HEADER([X11/Xutil.h], [], [ can_compile_x11=0 ])
354 if test $can_compile_x11 = 1; then
359 if test "$with_rfb" != yes; then
362 *-pc-windows* | *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
363 AC_CHECK_HEADER([winsock.h], [], [ can_compile_rfb=0 ])
364 AC_CHECK_HEADER([process.h], [], [ can_compile_rfb=0 ])
367 AC_CHECK_HEADER([sys/socket.h], [], [ can_compile_rfb=0 ])
368 AC_CHECK_HEADER([netinet/tcp.h], [], [ can_compile_rfb=0 ])
369 AC_CHECK_HEADER([pthread.h], [], [ can_compile_rfb=0 ])
372 if test $can_compile_rfb = 1; then
377 if test "$with_term" != yes; then
379 AC_CHECK_HEADER([curses.h], [], [ can_compile_term=0 ])
380 AC_CHECK_HEADER([signal.h], [], [ can_compile_term=0 ])
381 if test $can_compile_term = 1; then
386 if test "$with_nogui" != yes; then
389 fi # end of if $with_all_libs = yes
391 AC_MSG_CHECKING(for idle hack)
392 AC_ARG_ENABLE(idle-hack,
393 [ --enable-idle-hack use Roland Mainz's idle hack],
394 [if test "$enableval" = yes; then
396 AC_DEFINE(BX_USE_IDLE_HACK, 1)
399 AC_DEFINE(BX_USE_IDLE_HACK, 0)
403 AC_DEFINE(BX_USE_IDLE_HACK, 0)
406 AC_SUBST(BX_USE_IDLE_HACK)
408 AC_CHECK_HEADER(dlfcn.h, AC_DEFINE(BX_HAVE_DLFCN_H, 1))
409 AC_CHECK_HEADER(assert.h, AC_DEFINE(HAVE_ASSERT_H, 1))
411 AC_MSG_CHECKING(for plugins support)
412 AC_ARG_ENABLE(plugins,
413 [ --enable-plugins enable plugins],
414 [if test "$enableval" = yes; then
424 if test "$bx_plugins" = 1; then
426 AC_DEFINE(BX_PLUGINS, 1)
427 GUI_NON_PLUGIN_OBJS='$(OBJS_THAT_CANNOT_BE_PLUGINS)'
428 GUI_PLUGIN_OBJS='$(OBJS_THAT_CAN_BE_PLUGINS)'
429 DEFINE_PLUGIN_PATH='-DBX_PLUGIN_PATH="\"${plugdir}\""'
430 # and the $(OBJS_THAT_SUPPORT_OTHER_PLUGINS) will be built and linked
431 # by special link rules for the plugins that they support.
432 LIBS="$LIBS $LIBADD_DL"
434 PLUGIN_TARGET=bochs_plugins
435 INSTALL_PLUGINS_VAR=install_libtool_plugins
436 NONPLUGIN_GUI_LINK_OPTS=''
440 AC_DEFINE(BX_PLUGINS, 0)
441 GUI_NON_PLUGIN_OBJS='$(OBJS_THAT_CANNOT_BE_PLUGINS) $(OBJS_THAT_CAN_BE_PLUGINS) $(OBJS_THAT_SUPPORT_OTHER_PLUGINS)'
443 NONPLUGIN_GUI_LINK_OPTS='$(GUI_LINK_OPTS)'
445 AC_SUBST(DEFINE_PLUGIN_PATH)
446 AC_SUBST(NONPLUGIN_GUI_LINK_OPTS)
448 # copy gui variables into iodev variables. Later, we will add to the gui
449 # objs list, according to which display libraries are enabled.
450 IODEV_NON_PLUGIN_OBJS=$GUI_NON_PLUGIN_OBJS
451 IODEV_PLUGIN_OBJS=$GUI_PLUGIN_OBJS
453 # on MacOSX if they enabled plugins, make sure that dlopen() was found.
454 # It is provided by a library called dlcompat.
455 if test "$bx_plugins" = 1 -a "$need_dlcompat_for_plugins" = 1; then
457 AC_CHECK_LIB(dl, dlopen, [have_dlopen=1])
458 AC_MSG_CHECKING(if you have dlcompat, required for MacOSX plugins)
459 if test "$have_dlopen" = 0; then
461 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.])
467 AC_MSG_CHECKING(if compiler allows blank labels)
468 AC_TRY_COMPILE([], [ { label1: } ],
472 AC_DEFINE(BX_NO_BLANK_LABELS)
475 AC_MSG_CHECKING(if compiler allows LL for 64-bit constants)
476 AC_TRY_COMPILE([], [ { 42LL; } ],
480 AC_DEFINE(BX_64BIT_CONSTANTS_USE_LL, 0)
484 AC_MSG_CHECKING(for x86-64 support)
485 AC_ARG_ENABLE(x86-64,
486 [ --enable-x86-64 compile in support for x86-64 instructions],
487 [if test "$enableval" = yes; then
490 AC_DEFINE(BX_SUPPORT_X86_64, 1)
495 AC_DEFINE(BX_SUPPORT_X86_64, 0)
501 AC_DEFINE(BX_SUPPORT_X86_64, 0)
507 AC_MSG_CHECKING(for SMP support)
509 [ --enable-smp compile in support for SMP configurations],
510 [if test "$enableval" = yes; then
512 AC_DEFINE(BX_SUPPORT_SMP, 1)
513 AC_DEFINE(BX_USE_CPU_SMF, 0)
517 AC_DEFINE(BX_SUPPORT_SMP, 0)
522 AC_DEFINE(BX_SUPPORT_SMP, 0)
526 AC_MSG_CHECKING(for cpu level)
527 AC_ARG_ENABLE(cpu-level,
528 [ --enable-cpu-level select cpu level (3,4,5,6)],
529 [case "$enableval" in
532 AC_DEFINE(BX_CPU_LEVEL, 3)
533 AC_DEFINE(BX_CPU_LEVEL_HACKED, 3)
537 AC_DEFINE(BX_CPU_LEVEL, 4)
538 AC_DEFINE(BX_CPU_LEVEL_HACKED, 4)
542 AC_DEFINE(BX_CPU_LEVEL, 5)
543 AC_DEFINE(BX_CPU_LEVEL_HACKED, 5)
547 AC_DEFINE(BX_CPU_LEVEL, 6)
548 AC_DEFINE(BX_CPU_LEVEL_HACKED, 6)
552 echo "ERROR: you must supply a valid CPU level to --enable-cpu-level"
556 bx_cpu_level=$enableval
557 if test "$use_smp" = 1 -a "$enableval" -lt 6; then
558 echo "ERROR: with >1 processor, use --enable-cpu-level=6"
563 # for multiprocessors or x86-64, cpu level must be 6
564 if test "$use_smp" = 1 -o "$use_x86_64" = 1; then
566 AC_DEFINE(BX_CPU_LEVEL, 6)
567 AC_DEFINE(BX_CPU_LEVEL_HACKED, 6)
571 AC_DEFINE(BX_CPU_LEVEL, 5)
572 AC_DEFINE(BX_CPU_LEVEL_HACKED, 5)
579 AC_MSG_CHECKING(for APIC support)
581 [ --enable-apic enable APIC support],
582 [if test "$enableval" = yes; then
584 AC_DEFINE(BX_SUPPORT_APIC, 1)
585 IOAPIC_OBJS='ioapic.o'
588 if test "$use_smp" = 1; then
589 echo "ERROR: With SMP configuration you must use --enable-apic"
592 AC_DEFINE(BX_SUPPORT_APIC, 0)
597 if test "$use_smp" = 1 -o "$bx_cpu_level" -gt 5; then
598 # enable APIC by default, if SMP configuration or if cpulevel>5
600 AC_DEFINE(BX_SUPPORT_APIC, 1)
601 IOAPIC_OBJS='ioapic.o'
604 AC_DEFINE(BX_SUPPORT_APIC, 0)
609 AC_SUBST(IOAPIC_OBJS)
611 AC_CHECK_HEADER(zlib.h, [AC_CHECK_LIB(z, gzopen, AC_DEFINE(BX_HAVE_ZLIB,1))] )
613 AC_MSG_CHECKING(for compressed hard disk image support)
614 AC_ARG_ENABLE(compressed-hd,
615 [ --enable-compressed-hd allows compressed (zlib) hard disk image (not implemented yet)],
616 [if test "$enableval" = yes; then
618 AC_DEFINE(BX_COMPRESSED_HD_SUPPORT, 1)
622 AC_DEFINE(BX_COMPRESSED_HD_SUPPORT, 0)
626 AC_DEFINE(BX_COMPRESSED_HD_SUPPORT, 0)
629 AC_SUBST(BX_COMPRESSED_HD_SUPPORT)
631 AC_MSG_CHECKING(for NE2000 support)
632 AC_ARG_ENABLE(ne2000,
633 [ --enable-ne2000 enable limited ne2000 support],
634 [if test "$enableval" = yes; then
636 AC_DEFINE(BX_SUPPORT_NE2K, 1)
641 AC_DEFINE(BX_SUPPORT_NE2K, 0)
647 AC_DEFINE(BX_SUPPORT_NE2K, 0)
654 AC_MSG_CHECKING(for ACPI support)
656 [ --enable-acpi enable ACPI support],
657 [if test "$enableval" = yes; then
659 AC_DEFINE(BX_SUPPORT_ACPI, 1)
662 AC_DEFINE(BX_SUPPORT_ACPI, 0)
666 AC_DEFINE(BX_SUPPORT_ACPI, 0)
669 AC_SUBST(BX_SUPPORT_ACPI)
671 AC_MSG_CHECKING(for i440FX PCI support)
673 [ --enable-pci enable limited i440FX PCI support],
674 [if test "$enableval" = yes; then
676 AC_DEFINE(BX_SUPPORT_PCI, 1)
678 PCI_OBJ='pci.o pci2isa.o pci_ide.o pcivga.o acpi.o'
681 AC_DEFINE(BX_SUPPORT_PCI, 0)
687 AC_DEFINE(BX_SUPPORT_PCI, 0)
695 # PCI host device support
697 AC_MSG_CHECKING(for PCI host device mapping support)
698 AC_ARG_ENABLE(pcidev,
699 [ --enable-pcidev enable PCI host device mapping support (linux host only)],
701 if test "$enableval" = "yes"; then
703 if test "$pci" != "1"; then
704 AC_MSG_ERROR([PCI host device mapping requires PCI support])
708 AC_MSG_NOTICE([Linux detected as host for PCI host device mapping])
709 linux_version=`uname -r`
710 case "$linux_version" in
712 PCIDEV_MODULE_MAKE_ALL="all-kernel24"
713 KERNEL_MODULE_SUFFIX="o"
716 PCIDEV_MODULE_MAKE_ALL="all-kernel26"
717 KERNEL_MODULE_SUFFIX="ko"
720 AC_MSG_ERROR([Linux kernel 2.4 or 2.6 is required])
723 KERNELDIR="/lib/modules/$linux_version/build"
733 AC_SUBST(PCIDEV_MODULE_MAKE_ALL)
734 AC_SUBST(KERNEL_MODULE_SUFFIX)
737 AC_MSG_ERROR([PCI host device mapping requires Linux as host])
740 AC_DEFINE(BX_SUPPORT_PCIDEV, 1)
741 PCI_OBJ="$PCI_OBJ pcidev.o"
744 AC_DEFINE(BX_SUPPORT_PCIDEV, 0)
749 AC_DEFINE(BX_SUPPORT_PCIDEV, 0)
755 AC_MSG_CHECKING(for limited USB support)
757 [ --enable-usb enable limited USB support],
758 [if test "$enableval" = yes; then
760 AC_DEFINE(BX_SUPPORT_PCIUSB, 1)
761 PCI_OBJ="$PCI_OBJ pciusb.o"
762 USBDEV_OBJS="usb_hid.o usb_msd.o"
763 SCSI_OBJS="scsi_device.o"
766 AC_DEFINE(BX_SUPPORT_PCIUSB, 0)
770 AC_DEFINE(BX_SUPPORT_PCIUSB, 0)
774 AC_SUBST(USBDEV_OBJS)
777 AC_MSG_CHECKING(for PCI pseudo NIC support)
779 [ --enable-pnic enable PCI pseudo NIC support],
780 [if test "$enableval" = yes; then
782 AC_DEFINE(BX_SUPPORT_PCIPNIC, 1)
783 PCI_OBJ="$PCI_OBJ pcipnic.o"
787 AC_DEFINE(BX_SUPPORT_PCIPNIC, 0)
791 AC_DEFINE(BX_SUPPORT_PCIPNIC, 0)
796 if test "$networking" = yes; then
797 NETLOW_OBJS='eth.o eth_null.o eth_vnet.o'
798 AC_CHECK_HEADER(net/bpf.h, NETLOW_OBJS="$NETLOW_OBJS eth_fbsd.o")
799 AC_CHECK_HEADER(netpacket/packet.h, NETLOW_OBJS="$NETLOW_OBJS eth_linux.o")
801 *-pc-windows* | *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
802 NETLOW_OBJS="$NETLOW_OBJS eth_win32.o"
804 *-macosx* | *-darwin*)
805 NETLOW_OBJS="$NETLOW_OBJS eth_tuntap.o"
806 AC_DEFINE(HAVE_TUNTAP, 1)
809 AC_CHECK_HEADER(net/if.h, [
811 AC_DEFINE(BX_HAVE_NET_IF_H, 1)
814 #include <sys/types.h>
815 #include <sys/socket.h>
817 AC_CHECK_HEADER(linux/netlink.h, [
821 #include <asm/types.h>
822 #include <sys/socket.h>
825 if test "$use_ethertap" = yes; then
826 NETLOW_OBJS="$NETLOW_OBJS eth_tap.o eth_vde.o"
827 AC_DEFINE(HAVE_ETHERTAP, 1)
828 AC_DEFINE(HAVE_VDE, 1)
831 AC_CHECK_HEADER(net/if_tun.h, [
835 #include <sys/types.h>
836 #include <sys/socket.h>
839 AC_CHECK_HEADER(linux/if_tun.h, [
843 #include <asm/types.h>
844 #include <sys/socket.h>
846 if test "$use_tuntap" = yes; then
847 NETLOW_OBJS="$NETLOW_OBJS eth_tuntap.o"
848 AC_DEFINE(HAVE_TUNTAP, 1)
853 AC_DEFINE(BX_NETWORKING, 1)
855 AC_DEFINE(BX_NETWORKING, 0)
858 AC_SUBST(NETLOW_OBJS)
861 AC_MSG_CHECKING(for large pages support)
862 AC_ARG_ENABLE(large-pages,
863 [ --enable-large-pages support for large pages (2M/4M pages)],
864 [if test "$enableval" = yes; then
866 AC_DEFINE(BX_SUPPORT_LARGE_PAGES, 1)
867 support_large_pages=1
870 AC_DEFINE(BX_SUPPORT_LARGE_PAGES, 0)
871 support_large_pages=0
874 if test "$bx_cpu_level" -gt 4; then
876 AC_DEFINE(BX_SUPPORT_LARGE_PAGES, 1)
877 support_large_pages=1
880 AC_DEFINE(BX_SUPPORT_LARGE_PAGES, 0)
881 support_large_pages=0
887 AC_MSG_CHECKING(for PAE support)
889 [ --enable-pae support Physical Address Extensions],
890 [if test "$enableval" = yes; then
892 AC_DEFINE(BX_SUPPORT_PAE, 1)
896 AC_DEFINE(BX_SUPPORT_PAE, 0)
900 if test "$bx_cpu_level" -gt 5; then
902 AC_DEFINE(BX_SUPPORT_PAE, 1)
906 AC_DEFINE(BX_SUPPORT_PAE, 0)
912 AC_MSG_CHECKING(for global pages support)
913 AC_ARG_ENABLE(global-pages,
914 [ --enable-global-pages support for global pages in PDE/PTE],
915 [if test "$enableval" = yes; then
917 AC_DEFINE(BX_SUPPORT_GLOBAL_PAGES, 1)
918 support_global_pages=1
921 AC_DEFINE(BX_SUPPORT_GLOBAL_PAGES, 0)
922 support_global_pages=0
925 if test "$bx_cpu_level" -gt 5; then
928 AC_DEFINE(BX_SUPPORT_GLOBAL_PAGES, 1)
929 support_global_pages=1
932 AC_DEFINE(BX_SUPPORT_GLOBAL_PAGES, 0)
933 support_global_pages=0
938 if test "$bx_cpu_level" -lt 4 -a "$support_large_pages" = 1; then
939 AC_MSG_ERROR([for large paging support the CPU level must be >= 4])
942 if test "$bx_cpu_level" -lt 5 -a "$support_pae" = 1; then
943 AC_MSG_ERROR([for PAE support the CPU level must be >= 5])
946 if test "$bx_cpu_level" -lt 5 -a "$support_global_pages" = 1; then
947 AC_MSG_ERROR([for Global Pages support the CPU level must be >= 5])
950 AC_MSG_CHECKING(for MTRRs support)
952 [ --enable-mtrr support for MTRRs],
953 [if test "$enableval" = yes; then
955 AC_DEFINE(BX_SUPPORT_MTRR, 1)
958 AC_DEFINE(BX_SUPPORT_MTRR, 0)
961 if test "$bx_cpu_level" -gt 5; then
964 AC_DEFINE(BX_SUPPORT_MTRR, 1)
967 AC_DEFINE(BX_SUPPORT_MTRR, 0)
972 AC_MSG_CHECKING(for guest to host TLB support)
973 AC_ARG_ENABLE(guest2host-tlb,
974 [ --enable-guest2host-tlb support guest to host addr TLB for speed],
975 [if test "$enableval" = yes; then
977 speedup_guest2host_tlb=1
980 speedup_guest2host_tlb=0
984 speedup_guest2host_tlb=0
988 AC_MSG_CHECKING(for repeated IO and mem copy speedups)
989 AC_ARG_ENABLE(repeat-speedups,
990 [ --enable-repeat-speedups support repeated IO and mem copy speedups],
991 [if test "$enableval" = yes; then
1004 AC_MSG_CHECKING(for instruction cache support)
1005 AC_ARG_ENABLE(icache,
1006 [ --enable-icache support instruction cache],
1007 [if test "$enableval" = yes; then
1020 AC_MSG_CHECKING(for gcc fast function calls optimization)
1021 AC_ARG_ENABLE(fast-function-calls,
1022 [ --enable-fast-function-calls support for fast function calls (gcc on x86 only)],
1023 [if test "$enableval" = yes; then
1036 AC_MSG_CHECKING(for host specific inline assembly accelerations)
1037 AC_ARG_ENABLE(host-specific-asms,
1038 [ --enable-host-specific-asms support for host specific inline assembly],
1039 [if test "$enableval" = yes; then
1041 speedup_host_specific_asms=1
1044 speedup_host_specific_asms=0
1048 speedup_host_specific_asms=0
1052 AC_MSG_CHECKING(whether to ignore bad MSR references)
1053 AC_ARG_ENABLE(ignore-bad-msr,
1054 [ --enable-ignore-bad-msr ignore bad MSR references ],
1055 [if test "$enableval" = yes; then
1057 AC_DEFINE(BX_IGNORE_BAD_MSR, 1)
1060 AC_DEFINE(BX_IGNORE_BAD_MSR, 0)
1064 AC_DEFINE(BX_IGNORE_BAD_MSR, 1)
1068 AC_MSG_CHECKING(for port e9 hack)
1069 AC_ARG_ENABLE(port-e9-hack,
1070 [ --enable-port-e9-hack writes to port e9 go to console],
1071 [if test "$enableval" = yes; then
1073 AC_DEFINE(BX_PORT_E9_HACK, 1)
1076 AC_DEFINE(BX_PORT_E9_HACK, 0)
1080 AC_DEFINE(BX_PORT_E9_HACK, 1)
1084 AC_MSG_CHECKING(show IPS)
1085 AC_ARG_ENABLE(show-ips,
1086 [ --enable-show-ips show IPS in Bochs log file],
1087 [if test "$enableval" = yes; then
1089 AC_DEFINE(BX_SHOW_IPS, 1)
1092 AC_DEFINE(BX_SHOW_IPS, 0)
1096 AC_DEFINE(BX_SHOW_IPS, 0)
1100 AC_MSG_CHECKING(for use of .cpp as suffix)
1102 [ --enable-cpp use .cpp as C++ suffix],
1103 [if test "$enableval" = yes; then
1105 SUFFIX_LINE='.SUFFIXES: .cpp'
1109 SUFFIX_LINE='.SUFFIXES: .cc'
1114 SUFFIX_LINE='.SUFFIXES: .cc'
1118 AC_SUBST(SUFFIX_LINE)
1119 AC_SUBST(CPP_SUFFIX)
1121 if test "$enable_cpp" = yes; then
1122 echo "moving .cc source files to .cpp"
1123 sourcefiles=`find . -name "*.cc" -print`
1124 if test "$sourcefiles" != ""; then
1125 for ccname in $sourcefiles
1127 cppname=`echo $ccname | sed -e "s/\.cc$/.cpp/"`
1128 echo "mv $ccname $cppname"
1132 echo "no more .cc source files to rename"
1138 AC_MSG_CHECKING(for Bochs internal debugger support)
1139 AC_ARG_ENABLE(debugger,
1140 [ --enable-debugger compile in support for Bochs internal debugger],
1141 [if test "$enableval" = yes; then
1143 AC_DEFINE(BX_DEBUGGER, 1)
1144 DEBUGGER_VAR='$(DEBUGGER_LIB)'
1148 AC_DEFINE(BX_DEBUGGER, 0)
1155 AC_DEFINE(BX_DEBUGGER, 0)
1160 AC_SUBST(DEBUGGER_VAR)
1162 AC_MSG_CHECKING(for external debugger)
1164 AC_ARG_ENABLE(external-debugger,
1165 [ --enable-external-debugger enable external debugger support (win32 only)],
1166 [if test "$enableval" = yes; then
1168 *-pc-windows* | *-cygwin* | *-mingw32*)
1170 AC_DEFINE(BX_EXTERNAL_DEBUGGER, 1)
1171 EXT_DEBUG_OBJS=extdb.o
1174 echo "ERROR: external debugger is currently supported on win32 only"
1184 AC_SUBST(BX_EXTERNAL_DEBUGGER)
1186 AC_MSG_CHECKING(for magic breakpoints)
1187 AC_ARG_ENABLE(magic-breakpoints,
1188 [ --enable-magic-breakpoints enable magic debugger breakpoints],
1189 [if test "$enableval" = yes; then
1191 AC_DEFINE(BX_MAGIC_BREAKPOINT, 1)
1194 AC_DEFINE(BX_MAGIC_BREAKPOINT, 0)
1197 if test "$bx_debugger" = 1; then
1199 AC_DEFINE(BX_MAGIC_BREAKPOINT, 1)
1202 AC_DEFINE(BX_MAGIC_BREAKPOINT, 0)
1205 AC_SUBST(BX_MAGIC_BREAKPOINT)
1207 AC_MSG_CHECKING(for disassembler support)
1208 AC_ARG_ENABLE(disasm,
1209 [ --enable-disasm compile in support for disassembler],
1210 [if test "$enableval" = yes; then
1212 AC_DEFINE(BX_DISASM, 1)
1213 DISASM_VAR='$(DISASM_LIB)'
1216 if test "$bx_debugger" = 1; then
1217 echo "ERROR: debugger is enabled, so --enable-disasm is required"
1220 AC_DEFINE(BX_DISASM, 0)
1225 AC_DEFINE(BX_DISASM, 1)
1226 DISASM_VAR='$(DISASM_LIB)'
1228 AC_SUBST(DISASM_VAR)
1230 AC_MSG_CHECKING(for ALL optimizations enabled)
1231 AC_ARG_ENABLE(all-optimizations,
1232 [ --enable-all-optimizations compile in all possible optimizations],
1233 [if test "$enableval" = yes; then
1248 # Optimizations section. Decide what the status of various optimizations
1249 # should be based on configure choices and other factors.
1252 if test "$speedups_all" = 1; then
1253 # Configure requested to force all options enabled.
1254 speedup_guest2host_tlb=1
1260 if test "$speedup_guest2host_tlb" = 1; then
1261 AC_DEFINE(BX_SupportGuest2HostTLB, 1)
1263 AC_DEFINE(BX_SupportGuest2HostTLB, 0)
1266 if test "$speedup_repeat" = 1; then
1267 AC_DEFINE(BX_SupportRepeatSpeedups, 1)
1269 AC_DEFINE(BX_SupportRepeatSpeedups, 0)
1272 if test "$speedup_iCache" = 1; then
1273 AC_DEFINE(BX_SUPPORT_ICACHE, 1)
1275 AC_DEFINE(BX_SUPPORT_ICACHE, 0)
1278 if test "$speedup_host_specific_asms" = 1; then
1279 AC_DEFINE(BX_SupportHostAsms, 1)
1281 AC_DEFINE(BX_SupportHostAsms, 0)
1284 if test "$speedup_fastcall" = 1; then
1285 AC_DEFINE(BX_FAST_FUNC_CALL, 1)
1287 AC_DEFINE(BX_FAST_FUNC_CALL, 0)
1292 rl_without_curses_ok=no
1293 rl_with_curses_ok=no
1295 AC_MSG_CHECKING(whether user wants readline)
1296 AC_ARG_ENABLE(readline,
1297 [ --enable-readline use readline library, if available],
1298 [if test "$enableval" = yes; then
1312 AC_MSG_CHECKING(whether to use readline)
1313 if test "$want_readline" = yes; then
1314 if test "$bx_debugger" = 1; then
1316 AC_MSG_CHECKING(if readline works without -lcurses)
1318 LIBS="$LIBS -lreadline"
1321 #include <readline/readline.h>
1322 int main() { rl_initialize(); exit(0); }
1324 [ AC_MSG_RESULT(yes)
1325 rl_without_curses_ok=yes ],
1326 [ AC_MSG_RESULT(no) ]
1328 AC_MSG_CHECKING(if readline works with -lcurses)
1329 LIBS="$LIBS -lcurses"
1332 #include <readline/readline.h>
1333 int main() { rl_initialize(); exit(0); }
1336 rl_with_curses_ok=yes ],
1337 [ AC_MSG_RESULT(no) ]
1341 if test "$rl_without_curses_ok" = yes; then
1343 AC_DEFINE(HAVE_LIBREADLINE, 1)
1344 READLINE_LIB="-lreadline"
1346 elif test "$rl_with_curses_ok" = yes; then
1348 AC_DEFINE(HAVE_LIBREADLINE, 1)
1349 READLINE_LIB="-lreadline -lcurses"
1353 echo WARNING: The readline library was disabled because it was not found.
1361 AC_SUBST(READLINE_LIB)
1363 AC_CHECK_HEADER(readline/history.h,
1364 AC_DEFINE(HAVE_READLINE_HISTORY_H)
1367 INSTRUMENT_DIR='instrument/stubs'
1369 AC_MSG_CHECKING(for instrumentation support)
1370 AC_ARG_ENABLE(instrumentation,
1371 [ --enable-instrumentation compile in support for instrumentation],
1372 [if test "$enableval" = yes; then
1374 AC_DEFINE(BX_INSTRUMENTATION, 1)
1375 INSTRUMENT_VAR='$(INSTRUMENT_LIB)'
1376 elif test "$enableval" = no; then
1378 AC_DEFINE(BX_INSTRUMENTATION, 0)
1382 AC_DEFINE(BX_INSTRUMENTATION, 1)
1383 INSTRUMENT_DIR=$enableval
1384 INSTRUMENT_VAR='$(INSTRUMENT_LIB)'
1388 AC_DEFINE(BX_INSTRUMENTATION, 0)
1392 AC_SUBST(INSTRUMENT_DIR)
1393 AC_SUBST(INSTRUMENT_VAR)
1395 dnl // serial mode 'socket' needs wsock32.dll in non-plugin mode
1396 if test "$bx_plugins" = 0; then
1399 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS wsock32.lib"
1401 *-cygwin* | *-mingw32*)
1402 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwsock32"
1407 AC_MSG_CHECKING(enable logging)
1408 AC_ARG_ENABLE(logging,
1409 [ --enable-logging enable logging],
1410 [if test "$enableval" = yes; then
1412 AC_DEFINE(BX_NO_LOGGING, 0)
1415 AC_DEFINE(BX_NO_LOGGING, 1)
1419 AC_DEFINE(BX_NO_LOGGING, 0)
1423 AC_MSG_CHECKING(for raw serial support)
1424 AC_ARG_ENABLE(raw-serial,
1425 [ --enable-raw-serial use raw serial port access],
1426 [if test "$enableval" = yes; then
1428 AC_DEFINE(USE_RAW_SERIAL, 1)
1431 AC_DEFINE(USE_RAW_SERIAL, 0)
1435 AC_DEFINE(USE_RAW_SERIAL, 0)
1439 AC_MSG_CHECKING(for VESA BIOS extensions)
1441 [ --enable-vbe use VESA BIOS extensions],
1442 [if test "$enableval" = yes; then
1444 AC_DEFINE(BX_SUPPORT_VBE, 1)
1445 if test "$pci" = 1; then
1446 AC_DEFINE(BX_SUPPORT_PCIVGA, 1)
1450 AC_DEFINE(BX_SUPPORT_VBE, 0)
1454 AC_DEFINE(BX_SUPPORT_VBE, 1)
1455 if test "$pci" = 1; then
1456 AC_DEFINE(BX_SUPPORT_PCIVGA, 1)
1461 AC_MSG_CHECKING(for CLGD54XX emulation)
1462 AC_ARG_ENABLE(clgd54xx,
1463 [ --enable-clgd54xx enable CLGD54XX emulation],
1464 [if test "$enableval" = yes; then
1466 AC_DEFINE(BX_SUPPORT_CLGD54XX, 1)
1467 if test "$pci" = 1; then
1468 AC_DEFINE(BX_SUPPORT_CLGD54XX_PCI, 1)
1472 AC_DEFINE(BX_SUPPORT_CLGD54XX, 0)
1476 AC_DEFINE(BX_SUPPORT_CLGD54XX, 0)
1481 AC_MSG_CHECKING(for FPU emulation)
1484 [ --enable-fpu compile in FPU emulation],
1485 [if test "$enableval" = yes; then
1487 AC_DEFINE(BX_SUPPORT_FPU, 1)
1488 FPU_VAR='$(FPU_LIB)'
1489 elif test "$enableval" = no; then
1491 AC_DEFINE(BX_SUPPORT_FPU, 0)
1495 echo "ERROR: --enable-fpu does not accept a path"
1501 AC_DEFINE(BX_SUPPORT_FPU, 1)
1502 FPU_VAR='$(FPU_LIB)'
1507 AC_MSG_CHECKING(for VME support)
1509 [ --enable-vme virtual 8086 mode extensions],
1510 [if test "$enableval" = yes; then
1512 AC_DEFINE(BX_SUPPORT_VME, 1)
1513 elif test "$enableval" = no; then
1515 AC_DEFINE(BX_SUPPORT_VME, 0)
1519 if test "$bx_cpu_level" -ge 5; then
1521 AC_DEFINE(BX_SUPPORT_VME, 1)
1527 AC_MSG_CHECKING(for MMX support)
1529 [ --enable-mmx MMX support],
1530 [if test "$enableval" = yes; then
1532 AC_DEFINE(BX_SUPPORT_MMX, 1)
1533 elif test "$enableval" = no; then
1535 AC_DEFINE(BX_SUPPORT_MMX, 0)
1540 if test "$bx_cpu_level" -ge 5; then
1542 AC_DEFINE(BX_SUPPORT_MMX, 1)
1547 AC_MSG_CHECKING(for 3DNow! support)
1548 AC_ARG_ENABLE(3dnow,
1549 [ --enable-3dnow 3DNow! support],
1550 [if test "$enableval" = yes; then
1552 AC_DEFINE(BX_SUPPORT_3DNOW, 1)
1553 elif test "$enableval" = no; then
1555 AC_DEFINE(BX_SUPPORT_3DNOW, 0)
1560 AC_DEFINE(BX_SUPPORT_3DNOW, 0)
1565 AC_MSG_CHECKING(for SSE support)
1567 [ --enable-sse SSE support (--enable-sse=[no|1|2|3|4])],
1568 [case "$enableval" in
1590 echo "ERROR: --enable-sse=$enableval not understood. Use --enable-sse=[no|1|2|3|4]"
1596 if test "$use_x86_64" = 1; then
1605 if test "$support_sse" -gt 0 -a "$bx_cpu_level" -lt 6; then
1606 AC_MSG_ERROR([for SSE support the CPU level must be set to 6])
1609 if test "$support_sse" -lt 2 -a "$use_x86_64" = 1; then
1610 AC_MSG_ERROR([x86-64 needs SSE2 support])
1613 if test "$support_sse" = 4; then
1614 AC_DEFINE(BX_SUPPORT_SSE, 4)
1615 elif test "$support_sse" = 3; then
1616 AC_DEFINE(BX_SUPPORT_SSE, 3)
1617 elif test "$support_sse" = 2; then
1618 AC_DEFINE(BX_SUPPORT_SSE, 2)
1619 elif test "$support_sse" = 1; then
1620 AC_DEFINE(BX_SUPPORT_SSE, 1)
1622 AC_DEFINE(BX_SUPPORT_SSE, 0)
1625 AC_MSG_CHECKING(for SSE extensions support)
1626 AC_ARG_ENABLE(sse-extension,
1627 [ --enable-sse-extension support for SSE extensions],
1628 [if test "$enableval" = yes; then
1630 AC_DEFINE(BX_SUPPORT_SSE_EXTENSION, 1)
1631 elif test "$enableval" = no; then
1633 AC_DEFINE(BX_SUPPORT_SSE_EXTENSION, 0)
1638 AC_DEFINE(BX_SUPPORT_SSE_EXTENSION, 0)
1642 AC_MSG_CHECKING(for DAZ support)
1644 [ --enable-daz denormals-are-zeroes support],
1645 [if test "$enableval" = yes; then
1647 AC_DEFINE(BX_SUPPORT_DAZ, 1)
1648 elif test "$enableval" = no; then
1650 AC_DEFINE(BX_SUPPORT_DAZ, 0)
1654 if test "$support_sse" -ge 2; then
1656 AC_DEFINE(BX_SUPPORT_DAZ, 1)
1659 AC_DEFINE(BX_SUPPORT_DAZ, 0)
1664 AC_MSG_CHECKING(for alignment check support)
1665 AC_ARG_ENABLE(alignment-check,
1666 [ --enable-alignment-check alignment check (#AC) support],
1667 [if test "$enableval" = yes; then
1669 AC_DEFINE(BX_SUPPORT_ALIGNMENT_CHECK, 1)
1670 elif test "$enableval" = no; then
1672 AC_DEFINE(BX_SUPPORT_ALIGNMENT_CHECK, 0)
1676 if test "$bx_cpu_level" -gt 3; then
1678 AC_DEFINE(BX_SUPPORT_ALIGNMENT_CHECK, 1)
1681 AC_DEFINE(BX_SUPPORT_ALIGNMENT_CHECK, 0)
1686 AC_MSG_CHECKING(for misaligned SSE support)
1687 AC_ARG_ENABLE(misaligned-sse,
1688 [ --enable-misaligned-sse misaligned SSE support],
1689 [if test "$enableval" = yes; then
1691 AC_DEFINE(BX_SUPPORT_MISALIGNED_SSE, 1)
1692 elif test "$enableval" = no; then
1694 AC_DEFINE(BX_SUPPORT_MISALIGNED_SSE, 0)
1699 AC_DEFINE(BX_SUPPORT_MISALIGNED_SSE, 0)
1703 AC_MSG_CHECKING(for SEP support)
1705 [ --enable-sep SYSENTER/SYSEXIT support],
1706 [if test "$enableval" = yes; then
1708 AC_DEFINE(BX_SUPPORT_SEP, 1)
1709 elif test "$enableval" = no; then
1711 AC_DEFINE(BX_SUPPORT_SEP, 0)
1715 if test "$bx_cpu_level" -ge 6 -a "$support_mmx" = 1; then
1717 AC_DEFINE(BX_SUPPORT_SEP, 1)
1720 AC_DEFINE(BX_SUPPORT_SEP, 0)
1725 AC_MSG_CHECKING(for POPCNT instruction support)
1726 AC_ARG_ENABLE(popcnt,
1727 [ --enable-popcnt support for POPCNT instruction],
1728 [if test "$enableval" = yes; then
1730 AC_DEFINE(BX_SUPPORT_POPCNT, 1)
1731 elif test "$enableval" = no; then
1733 AC_DEFINE(BX_SUPPORT_POPCNT, 0)
1738 AC_DEFINE(BX_SUPPORT_POPCNT, 0)
1742 AC_MSG_CHECKING(for MONITOR/MWAIT instructions support (experimental))
1743 AC_ARG_ENABLE(monitor_mwait,
1744 [ --enable-monitor-mwait support for MONITOR/MWAIT instructions (experimental)],
1745 [if test "$enableval" = yes; then
1747 AC_DEFINE(BX_SUPPORT_MONITOR_MWAIT, 1)
1748 elif test "$enableval" = no; then
1750 AC_DEFINE(BX_SUPPORT_MONITOR_MWAIT, 0)
1755 AC_DEFINE(BX_SUPPORT_MONITOR_MWAIT, 0)
1759 AC_MSG_CHECKING(for x86 debugger support)
1760 AC_ARG_ENABLE(x86-debugger,
1761 [ --enable-x86-debugger x86 debugger support],
1762 [if test "$enableval" = yes; then
1764 AC_DEFINE(BX_X86_DEBUGGER, 1)
1765 elif test "$enableval" = no; then
1767 AC_DEFINE(BX_X86_DEBUGGER, 0)
1770 AC_DEFINE(BX_X86_DEBUGGER, 1)
1774 AC_DEFINE(BX_X86_DEBUGGER, 0)
1778 AC_CHECK_HEADER(IOKit/storage/IOCDMedia.h,
1779 can_use_osx_cdrom=yes
1782 AC_MSG_CHECKING(for CDROM support)
1783 AC_ARG_ENABLE(cdrom,
1784 [ --enable-cdrom CDROM support],
1785 [if test "$enableval" = no; then
1793 if test "$bx_cdrom" = 1; then
1795 CDROM_OBJS='cdrom.o'
1796 if test "$with_amigaos" = yes; then
1797 # use the amiga cdrom file instead.
1798 CDROM_OBJS="cdrom_amigaos.o"
1799 elif test "$can_use_osx_cdrom" = yes; then
1801 AC_MSG_RESULT(Using OSX IOKit CD Interface)
1802 CDROM_OBJS="cdrom.o"
1803 EXTRA_LINK_OPTS="${EXTRA_LINK_OPTS} -framework IOKit -framework CoreFoundation "'$(GUI_LINK_OPTS)'
1807 # use the beos cdrom file instead
1808 CDROM_OBJS="$CDROM_OBJS cdrom_beos.o"
1810 AC_DEFINE(BX_SUPPORT_CDROM, 1)
1814 AC_DEFINE(BX_SUPPORT_CDROM, 0)
1817 AC_SUBST(CDROM_OBJS)
1820 AC_MSG_CHECKING(for Sound Blaster 16 support)
1826 [ --enable-sb16=xxx Sound Blaster 16 Support (xxx=dummy|win|linux|freebsd|osx)],
1827 [if test "$enableval" = no; then
1829 AC_DEFINE(BX_SUPPORT_SB16, 0)
1831 case "$enableval" in
1834 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_output_c)
1835 AC_MSG_RESULT(dummy)
1838 SOUNDLOW_OBJS='soundlnx.o'
1839 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_linux_c)
1840 AC_MSG_RESULT(linux)
1843 SOUNDLOW_OBJS='soundwin.o'
1844 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_windows_c)
1848 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS winmm.lib"
1851 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwinmm"
1856 SOUNDLOW_OBJS='soundosx.o'
1857 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_osx_c)
1859 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -framework AudioUnit -framework AudioToolbox"
1863 *-linux* | *-freebsd*)
1864 SOUNDLOW_OBJS='soundlnx.o'
1865 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_linux_c)
1866 AC_MSG_RESULT(linux)
1869 SOUNDLOW_OBJS='soundwin.o'
1870 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_windows_c)
1872 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS winmm.lib"
1874 *-cygwin* | *-mingw32*)
1875 SOUNDLOW_OBJS='soundwin.o'
1876 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_windows_c)
1878 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwinmm"
1880 *-macosx* | *-macos*)
1881 SOUNDLOW_OBJS='soundosx.o'
1882 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_osx_c)
1884 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -framework AudioUnit -framework AudioToolbox"
1888 AC_DEFINE(BX_SOUND_OUTPUT_C, bx_sound_output_c)
1889 AC_MSG_RESULT(dummy)
1895 echo \!\!\!Error\!\!\!
1896 echo "You must pass one of dummy, linux, win, freebsd, osx to --enable-sb16"
1900 AC_DEFINE(BX_SUPPORT_SB16, 1)
1901 GAME_OBJS='gameport.o'
1907 AC_DEFINE(BX_SUPPORT_SB16, 0)
1911 AC_SUBST(SOUNDLOW_OBJS)
1914 AC_MSG_CHECKING(for standard PC gameport support)
1915 AC_ARG_ENABLE(gameport,
1916 [ --enable-gameport enable standard PC gameport support],
1917 [if test "$enableval" = yes; then
1919 AC_DEFINE(BX_SUPPORT_GAMEPORT, 1)
1920 if test "$gameport_present" = 0; then
1921 GAME_OBJS='gameport.o'
1923 *-cygwin* | *-mingw32*)
1924 DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwinmm"
1931 AC_DEFINE(BX_SUPPORT_GAMEPORT, 0)
1934 if test "$gameport_present" = 1; then
1935 AC_DEFINE(BX_SUPPORT_GAMEPORT, 1)
1938 AC_DEFINE(BX_SUPPORT_GAMEPORT, 0)
1945 AC_MSG_CHECKING(for gdb stub enable)
1946 AC_ARG_ENABLE(gdb-stub,
1947 [ --enable-gdb-stub enable gdb stub support],
1948 [if test "$enableval" = yes; then
1950 AC_DEFINE(BX_GDBSTUB, 1)
1951 GDBSTUB_VAR='$(GDBSTUB_OBJS)'
1952 if test "$bx_debugger" = 1; then
1953 AC_MSG_ERROR([[--enable-debugger and --enable-gdb-stub are mutually exclusive]])
1957 AC_DEFINE(BX_GDBSTUB, 0)
1962 AC_DEFINE(BX_GDBSTUB, 0)
1966 AC_SUBST(GDBSTUB_VAR)
1969 AC_MSG_CHECKING(for I/O Interface to the debugger)
1971 AC_ARG_ENABLE(iodebug,
1972 [ --enable-iodebug enable I/O interface to debugger],
1973 [if test "$enableval" = yes; then
1975 AC_DEFINE(BX_SUPPORT_IODEBUG, 1)
1976 IODEBUG_OBJS='iodebug.o'
1979 AC_DEFINE(BX_SUPPORT_IODEBUG, 0)
1983 if test "" = 1; then
1984 # enable by default if debugger is on
1986 AC_DEFINE(BX_SUPPORT_IODEBUG, 1)
1987 IODEBUG_OBJS='iodebug.o'
1993 AC_SUBST(IODEBUG_OBJS)
1996 AC_PATH_PROG(DOCBOOK2HTML, docbook2html, not_found)
1997 AC_MSG_CHECKING(whether to build docbook documentation)
1999 AC_ARG_ENABLE(docbook,
2000 [ --enable-docbook build the Docbook documentation],
2002 if test "$enableval" = yes; then build_docbook=1; fi
2005 dnl Not specified. If they have docbook2html, then yes.
2006 if test "$DOCBOOK2HTML" != not_found; then build_docbook=1; fi
2010 if test $build_docbook = 1; then
2012 BUILD_DOCBOOK_VAR=build_docbook
2013 INSTALL_DOCBOOK_VAR=install_docbook
2014 if test "$DOCBOOK2HTML" = not_found; then
2015 echo "ERROR: docbook2html must be installed to build the documentation"
2021 AC_SUBST(BUILD_DOCBOOK_VAR)
2022 AC_SUBST(INSTALL_DOCBOOK_VAR)
2023 AC_SUBST(DOCBOOK2HTML)
2025 PRIMARY_TARGET='bochs'
2026 PLUGIN_LIBNAME_TRANSFORMATION='%.o=libbx_%.la'
2028 AC_DEFINE(BX_PROVIDE_DEVICE_MODELS, 1)
2029 IODEV_LIB_VAR='iodev/libiodev.a'
2030 AC_DEFINE(BX_PROVIDE_CPU_MEMORY, 1)
2031 NONINLINE_VAR='$(NONINLINE_OBJS)'
2033 AC_SUBST(IODEV_LIB_VAR)
2034 AC_SUBST(EXTRA_BX_OBJS)
2035 AC_SUBST(NONINLINE_VAR)
2036 AC_SUBST(INLINE_VAR)
2037 AC_SUBST(EXTERNAL_DEPENDENCY)
2038 AC_SUBST(EXT_DEBUG_OBJS)
2043 [ --with-x11 use X11 GUI],
2047 [ --with-beos use BeOS GUI],
2051 [ --with-win32 use Win32 GUI],
2055 [ --with-macos use Macintosh/CodeWarrior environment],
2059 [ --with-carbon compile for MacOS X with Carbon GUI],
2063 [ --with-nogui no native GUI, just use blank stubs],
2067 [ --with-term textmode terminal environment],
2071 [ --with-rfb use RFB protocol, works with VNC viewer],
2074 AC_ARG_WITH(amigaos,
2075 [ --with-amigaos use AmigaOS (or MorphOS) GUI],
2079 [ --with-sdl use SDL libraries],
2083 [ --with-svga use SVGALib libraries],
2087 [ --with-wx use wxWidgets libraries],
2090 AC_ARG_WITH(all-libs,
2091 [ --with-all-libs compile all guis that Bochs supports],
2094 dnl // DASH is option prefix for your platform
2095 dnl // SLASH is directory for your platform
2096 dnl // CXXFP is C++ File Prefix; the flag that tells the compiler
2097 dnl // this is a C++ source file
2098 dnl // CFP is C File Prefix; the flag that tells the compiler
2099 dnl // this is a C source file
2100 dnl // OFP is Object File Prefix; the flag that tells the compiler
2101 dnl // generate an object file with this name
2109 # first define link variables without libtool
2110 LINK="\$(CXX) -o \$@ \$(CXXFLAGS) \$(LDFLAGS)"
2111 LINK_CONSOLE="\$(CXX) -o \$@ \$(CXXFLAGS_CONSOLE) \$(LDFLAGS)"
2112 # unless NO_LT is set, add libtool to the front of the link command
2113 if test "$NO_LT" != 1; then
2114 LINK="\$(LIBTOOL) --mode=link $LINK"
2115 LINK_CONSOLE="\$(LIBTOOL) --mode=link $LINK_CONSOLE"
2118 COMMAND_SEPARATOR="&& \\"
2119 CD_UP_ONE="echo done"
2120 CD_UP_TWO="echo done"
2121 CD_UP_THREE="echo done"
2123 INSTALL_TARGET=install_unix
2124 INSTALL_LIST_FOR_PLATFORM=
2126 # check for existence of and usable version of wxWidgets. This comes
2127 # early so that it could affect which one gets chosen.
2128 if test x$WX_CONFIG = x; then
2129 AC_CHECK_PROG(WX_CONFIG, [ wx-config --version ], wx-config, not_found)
2131 AC_MSG_CHECKING(for wxWidgets configuration script)
2132 AC_MSG_RESULT($WX_CONFIG)
2137 AC_MSG_CHECKING(for wxWidgets library version)
2138 if test x$WX_CONFIG != xnot_found; then
2139 WX_VERSION=`$WX_CONFIG --version`
2140 WX_BASENAME=`$WX_CONFIG --basename`
2142 # test that version >= 2.3.2. Anybody have a better way to do this? Yuck.
2143 case x$WX_VERSION in
2144 x2.[012]*) ;; # less than version 2.3.x
2145 x2.3.[01]) ;; # less than version 2.3.2
2146 x2.3.[2-4]*) ok_wx_version=1 ;; # 2.3.2 or greater
2147 x2.[4-5]*) ok_wx_version=1 ;; # version 2.4 / 2.5
2148 x2.[6-9]*) # version 2.6 or greater
2151 case x$WX_BASENAME in
2152 xwx_gtk2|xwx_gtk2u) wx_needs_gtk2=1 ;;
2156 x[3-9]*) ok_wx_version=1 ;; # version 3 or greater
2161 AC_MSG_RESULT($WX_VERSION)
2162 if test "$cross_configure" = 0; then
2163 if test "$ok_wx_version" = 1; then
2164 # detected a usable version
2165 if test "$with_all_libs" = yes; then
2169 if test "$with_wx" = yes; then
2170 AC_MSG_WARN([Bochs for wxWidgets cannot be compiled here, disabling it])
2176 AC_MSG_CHECKING(for default gui on this platform)
2177 AC_MSG_RESULT($DEFAULT_GUI)
2181 # the $with_* variable tells the gui library to use, but does NOT necessarily
2182 # indicate the platform. Settings that depend on the platform should be
2186 if test "$with_x11" = yes; then
2187 display_libs="$display_libs X11"
2188 if test "$no_x" = yes; then
2189 echo ERROR: X windows gui was selected, but X windows libraries were not found.
2192 AC_DEFINE(BX_WITH_X11, 1)
2193 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_X11)"
2194 GUI_CFLAGS="$GUI_CFLAGS \$(X_CFLAGS)"
2195 GUI_CXXFLAGS="$GUI_CXXFLAGS \$(X_CFLAGS)"
2196 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_X)"
2198 AC_MSG_CHECKING(whether user wants XPM support)
2200 [ --enable-xpm enable the check for XPM support],
2201 [if test "$enableval" = yes; then
2214 if test $check_xpm = 1; then
2215 AC_CHECK_HEADER(X11/xpm.h, [
2216 AC_DEFINE(BX_HAVE_XPM_H)
2223 if test "$with_beos" = yes; then
2224 display_libs="$display_libs beos"
2225 AC_DEFINE(BX_WITH_BEOS, 1)
2226 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_BEOS)"
2227 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_BEOS)"
2230 if test "$with_sdl" = yes; then
2231 display_libs="$display_libs sdl"
2232 AC_DEFINE(BX_WITH_SDL, 1)
2233 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_SDL)"
2234 # GUI_*FLAGS are added to the compilation of every bochs file, not just
2235 # the files in gui/*.cc.
2236 SDL_CFLAGS=`sdl-config --cflags`
2237 GUI_CFLAGS="$GUI_CFLAGS $SDL_CFLAGS"
2238 GUI_CXXFLAGS="$GUI_CXXFLAGS $SDL_CFLAGS"
2239 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_SDL)"
2240 if test "$with_win32" != yes -a "$with_wx" != yes; then
2244 EXTRA_BX_OBJS="$EXTRA_BX_OBJS win32res.o"
2246 *-cygwin* | *-mingw32*)
2247 RC_CMD="windres -o "
2248 EXTRA_BX_OBJS="$EXTRA_BX_OBJS win32res.o"
2254 if test "$with_svga" = yes; then
2255 display_libs="$display_libs svga"
2256 AC_DEFINE(BX_WITH_SVGA, 1)
2257 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_SVGA)"
2258 # GUI_*FLAGS are added to the compilation of every bochs file, not just
2259 # the files in gui/*.cc.
2260 GUI_CFLAGS="$GUI_CFLAGS"
2261 GUI_CXXFLAGS="$GUI_CXXFLAGS"
2262 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_SVGA)"
2265 if test "$with_rfb" = yes; then
2266 display_libs="$display_libs rfb"
2267 AC_DEFINE(BX_WITH_RFB, 1)
2268 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_RFB)"
2269 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_RFB)"
2272 if test "$with_amigaos" = yes; then
2273 display_libs="$display_libs amigaos"
2274 AC_DEFINE(BX_WITH_AMIGAOS, 1)
2275 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_AMIGAOS)"
2276 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_AMIGAOS)"
2279 if test "$with_win32" = yes; then
2280 display_libs="$display_libs win32"
2281 AC_DEFINE(BX_WITH_WIN32, 1)
2282 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_WIN32)"
2285 if test "$with_wx" != yes; then
2287 EXTRA_BX_OBJS="$EXTRA_BX_OBJS win32res.o"
2289 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_WIN32_VCPP)"
2291 *-cygwin* | *-mingw32*)
2292 if test "$with_wx" != yes; then
2293 RC_CMD="windres -o "
2294 EXTRA_BX_OBJS="$EXTRA_BX_OBJS win32res.o"
2296 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_WIN32)"
2298 *) echo Unsupported compile setup: GUI library is win32, but target is neither windows nor cygwin.
2303 if test "$with_macos" = yes; then
2304 display_libs="$display_libs macos"
2305 AC_DEFINE(BX_WITH_MACOS, 1)
2306 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_MACOS)"
2307 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_MACOS)"
2310 if test "$with_carbon" = yes; then
2311 display_libs="$display_libs carbon"
2312 AC_DEFINE(BX_WITH_CARBON, 1)
2313 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_CARBON)"
2314 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_CARBON)"
2315 if test "$bx_plugins" = 1; then
2316 PRIMARY_TARGET=bochs.app/.build_plugins # only for carbon application
2318 PRIMARY_TARGET=bochs.app/.build # only for carbon application
2320 INSTALL_TARGET='install_macosx'
2323 if test "$with_term" = yes; then
2324 display_libs="$display_libs term"
2325 AC_DEFINE(BX_WITH_TERM, 1)
2326 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_TERM)"
2327 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_TERM)"
2331 if test "$with_wx" = yes; then
2332 display_libs="$display_libs wxWidgets"
2333 if test "$cross_configure" = 1; then
2334 true # do not insist, if configuring for another machine
2336 if test x$ok_wx_version != x1; then
2337 echo ERROR: A usable version of wxWidgets was not found.
2338 echo Upgrade the library or choose another gui.
2342 AC_DEFINE(BX_WITH_WX, 1)
2343 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_WX)"
2344 SPECIFIC_GUI_SUPPORT_OBJS="$SPECIFIC_GUI_SUPPORT_OBJS \$(GUI_OBJS_WX_SUPPORT)"
2345 WX_CFLAGS="`$WX_CONFIG --cflags`"
2346 WX_CXXFLAGS="`$WX_CONFIG --cxxflags`"
2347 if test "$wx_multi_lib" = 1; then
2348 GUI_LINK_OPTS_WX="`$WX_CONFIG --libs core,base`"
2350 GUI_LINK_OPTS_WX="`$WX_CONFIG --libs`"
2352 if test "$wx_needs_gtk2" = 1; then
2353 PKG_CHECK_MODULES([GTK], [gtk+-2.0], [
2354 WX_CFLAGS="$WX_CFLAGS $GTK_CFLAGS"
2355 WX_CXXFLAGS="$WX_CXXFLAGS $GTK_CFLAGS"
2358 # if gtk-config exists, then add it to the cflags.
2359 gtkconf=`gtk-config --cflags`
2360 if test $? = 0; then
2361 # gtk-config was found and returned 0, so it must return valid output
2362 WX_CFLAGS="$WX_CFLAGS $gtkconf"
2363 WX_CXXFLAGS="$WX_CXXFLAGS $gtkconf"
2366 # GUI_C*FLAGS are added to the compilation of every bochs file, not just
2367 # the files in gui/*.cc. They are not used when building other things
2369 GUI_CFLAGS="$GUI_CFLAGS $WX_CFLAGS"
2370 GUI_CXXFLAGS="$GUI_CXXFLAGS $WX_CXXFLAGS"
2371 GUI_LINK_OPTS="$GUI_LINK_OPTS \$(GUI_LINK_OPTS_WX)"
2372 # using debugger with readline is failing due to thread/signal handler
2375 *-pc-windows* | *-cygwin* | *-mingw32*)
2376 EXTRA_BX_OBJS="$EXTRA_BX_OBJS wxbochs_resources.o"
2377 GUI_LINK_OPTS_WX="$GUI_LINK_OPTS_WX --subsystem,windows -mwindows"
2382 if test "$with_nogui" = yes; then
2383 display_libs="$display_libs nogui"
2384 AC_DEFINE(BX_WITH_NOGUI, 1)
2385 SPECIFIC_GUI_OBJS="$SPECIFIC_GUI_OBJS \$(GUI_OBJS_NOGUI)"
2388 AC_MSG_CHECKING(for display libraries)
2389 AC_MSG_RESULT($display_libs)
2391 if test "$display_libs" = ""; then
2392 echo "No display libraries were selected. Use --with-* options to enable"
2393 echo "individual display libraries, or --with-all-libs to detect the ones"
2394 echo "that Bochs supports."
2398 dnl To use wxWidgets you must select it as both the configuration interface
2399 dnl and the display library. In the simplest case where the user has
2400 dnl only configured with --with-wx, set both defaults to wxWidgets.
2401 dnl Without this setting, the config interface would default to the text
2402 dnl mode config interface, and then the wxWidgets display library would not
2404 if test "$display_libs" = " wxWidgets"; then
2405 AC_MSG_CHECKING(for default configuration interface)
2406 AC_MSG_RESULT(wxWidgets)
2407 AC_MSG_CHECKING(for default display library)
2408 AC_MSG_RESULT(wxWidgets)
2409 AC_DEFINE(BX_DEFAULT_CONFIG_INTERFACE, "wx")
2410 AC_DEFINE(BX_DEFAULT_DISPLAY_LIBRARY, "wx")
2411 AC_DEFINE(BX_USE_TEXTCONFIG, 0)
2413 AC_DEFINE(BX_USE_TEXTCONFIG, 1)
2416 if test "$bx_plugins" = 1; then
2417 # every item in this list will be compiled as a plugin. Do not include
2418 # support objs; they will be mentioned in plugin-specific makefile rules.
2419 GUI_PLUGIN_OBJS="$GUI_PLUGIN_OBJS $SPECIFIC_GUI_OBJS"
2421 # include support objs
2422 GUI_NON_PLUGIN_OBJS="$GUI_NON_PLUGIN_OBJS $SPECIFIC_GUI_OBJS $SPECIFIC_GUI_SUPPORT_OBJS"
2425 AC_SUBST(GUI_CFLAGS)
2426 AC_SUBST(GUI_CXXFLAGS)
2429 AC_SUBST(WX_CXXFLAGS)
2431 AC_CHECK_PROGS(WGET, wget curl fetch, not_found)
2432 if test "$WGET" = not_found; then
2433 AC_MSG_WARN([cannot find wget (or equivalent) command])
2435 # everybody has to re-invent the wheel. differently.
2436 test "${WGET}" = "curl" && WGET="curl -O"
2438 # modify settings based on target platform
2441 AC_DEFINE(BX_HAVE_STRDUP, 0)
2444 AC_DEFINE(BX_HAVE_STRDUP, 0)
2445 AC_DEFINE(BX_PLUGINS, 0)
2446 AC_DEFINE(BX_HAVE_DLFCN_H, 0)
2447 AC_DEFINE(BX_HAVE_SOCKLEN_T, 0)
2448 AC_DEFINE(BX_HAVE_SELECT, 0)
2449 AC_DEFINE(BX_HAVE_GETTIMEOFDAY, 0)
2450 AC_DEFINE(BX_NO_ATTRIBUTES, 1)
2451 AC_DEFINE(HAVE_TUNTAP, 0)
2452 AC_DEFINE(HAVE_ETHERTAP, 0)
2453 AC_DEFINE(BX_HAVE_HASH_MAP, 0)
2456 INSTALL_TARGET='install_win32'
2459 #C_OPT="/Zi" # for debugging
2460 C_OPT="/Ox" # optimize for speed
2461 CFLAGS="/nologo /G6 /MT /W3 /GX- /DNDEBUG /DWIN32 /D_WINDOWS $C_OPT"
2469 MAKELIB="lib /nologo /subsystem:console /machine:I386 /verbose /out:\$@"
2472 #L_OPT="/debug" # for debugging
2473 L_OPT="" # no debug info
2474 LINK="link $L_OPT /nologo /subsystem:console /incremental:no /machine:I386 /out:\$@ "
2477 PRIMARY_TARGET="bochs.exe"
2478 BXIMAGE_LINK_OPTS="user32.lib"
2479 # also compile niclist if networking is on
2480 if test "$networking" = yes; then
2481 PRIMARY_TARGET="$PRIMARY_TARGET niclist.exe"
2483 COMMAND_SEPARATOR=""
2485 CD_UP_TWO="cd ..\.."
2486 CD_UP_THREE="cd ..\..\.."
2487 have_gettimeofday=0 # even though it may exist in build environment
2488 AC_DEFINE(BX_64BIT_CONSTANTS_USE_LL, 0)
2489 AC_DEFINE(inline, __inline)
2490 AC_DEFINE(BX_NO_EMPTY_STRUCTS, 1)
2491 AC_DEFINE(BX_NO_ATTRIBUTES, 1)
2492 AC_DEFINE(BX_HAVE_HASH_MAP, 0)
2493 AC_DEFINE(BX_HAVE_HASH_MAP_H, 0)
2494 AC_DEFINE(BX_HAVE_STRTOULL, 0)
2495 AC_DEFINE(BX_HAVE_STRTOUQ, 0)
2496 AC_DEFINE(HAVE_LIBREADLINE, 0)
2497 AC_DEFINE(BX_HAVE_GETTIMEOFDAY, 0)
2498 AC_DEFINE(BX_HAVE_DLFCN_H, 0)
2499 AC_DEFINE(BX_HAVE_MKSTEMP, 0)
2500 AC_DEFINE(BX_HAVE_SYS_MMAN_H, 0)
2501 AC_DEFINE(BX_HAVE_USLEEP, 0)
2502 AC_DEFINE(HAVE_ETHERTAP, 0)
2503 AC_DEFINE(BX_HAVE_SELECT, 1)
2504 AC_DEFINE(BX_HAVE_SOCKLEN_T, 0)
2508 PRIMARY_TARGET="bochs.exe"
2509 BXIMAGE_LINK_OPTS="-luser32"
2510 if test "$networking" = yes; then
2511 PRIMARY_TARGET="$PRIMARY_TARGET niclist.exe"
2513 AC_DEFINE(BX_HAVE_SELECT, 1)
2516 BXIMAGE_LINK_OPTS="-luser32"
2517 if test "$networking" = yes; then
2518 PRIMARY_TARGET="$PRIMARY_TARGET niclist"
2520 AC_DEFINE(BX_HAVE_SELECT, 1)
2523 PRIMARY_TARGET=.bochs_beos_target
2528 EXPORT_DYNAMIC="-export-dynamic"
2530 *-pc-windows* | *-pc-winnt* | *-cygwin* | *-mingw*)
2531 if test "$bx_plugins" = 1; then
2532 AC_CHECK_LIB(mingwex, opendir, LIBS="$LIBS -lmingwex")
2533 # set variables for building DLL plugins
2534 PRIMARY_TARGET=".win32_dll_plugin_target"
2535 PLUGIN_LIBNAME_TRANSFORMATION='%.o=bx_%.dll'
2536 INSTALL_PLUGINS_VAR=install_dll_plugins
2538 if test "$with_win32" != yes; then
2539 LIBS="$LIBS -lcomctl32"
2542 DIALOG_OBJS="win32dialog.o"
2546 AC_SUBST(DIALOG_OBJS)
2547 AC_SUBST(EXPORT_DYNAMIC)
2549 if test "$use_curses" = yes -a "$cross_configure" = 0; then
2550 AC_CHECK_LIB(curses, mvaddch, GUI_LINK_OPTS_TERM='-lcurses')
2551 AC_CHECK_LIB(ncurses, mvaddch, GUI_LINK_OPTS_TERM='-lncurses')
2552 AC_CHECK_LIB(termlib, mvaddch, GUI_LINK_OPTS_TERM='-ltermlib')
2553 AC_CHECK_LIB(pdcurses, mvaddch, GUI_LINK_OPTS_TERM='-lpdcurses')
2554 if test "$GUI_LINK_OPTS_TERM" = ""; then
2555 echo Curses library not found: tried curses, ncurses, termlib and pdcurses.
2560 if test "$with_term" = yes; then
2562 LIBS="$LIBS $GUI_LINK_OPTS_TERM"
2563 AC_CHECK_FUNCS(color_set, AC_DEFINE(BX_HAVE_COLOR_SET, 1))
2564 AC_CHECK_FUNCS(mvhline, AC_DEFINE(BX_HAVE_MVHLINE, 1))
2565 AC_CHECK_FUNCS(mvvline, AC_DEFINE(BX_HAVE_MVVLINE, 1))
2569 if test "$with_rfb" = yes; then
2570 # we need the socket function
2573 # is this okay without a check ?
2574 RFB_LIBS="$RFB_LIBS wsock32.lib"
2577 *-pc-winnt* | *-pc-cygwin* | *-pc-mingw32*)
2578 # is this okay without a check ?
2579 RFB_LIBS="$RFB_LIBS -lwsock32"
2583 AC_CHECK_FUNCS(socket, have_socket=yes)
2584 if test "$have_socket" != yes; then
2585 AC_CHECK_LIB(socket, socket,
2587 RFB_LIBS="$RFB_LIBS -lsocket"
2593 if test "$have_socket" != yes; then
2594 echo 'ERROR: socket function required for RFB compile'
2599 # The ACX_PTHREAD function was written by
2600 # Steven G. Johnson <stevenj@alum.mit.edu> and
2601 # Alejandro Forero Cuervo <bachue@bachue.com>
2602 # I found it in the ac-archive project on Source Forge.
2604 AC_DEFUN([ACX_PTHREAD], [
2605 AC_REQUIRE([AC_CANONICAL_HOST])
2608 # First, check if the POSIX threads header, pthread.h, is available.
2609 # If it isn't, don't bother looking for the threads libraries.
2610 AC_CHECK_HEADER(pthread.h, , acx_pthread_ok=noheader)
2612 # We must check for the threads library under a number of different
2613 # names; the ordering is very important because some systems
2614 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
2615 # libraries is broken (non-POSIX).
2617 # First of all, check if the user has set any of the PTHREAD_LIBS,
2618 # etcetera environment variables, and if threads linking works using
2620 if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
2621 save_CFLAGS="$CFLAGS"
2622 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
2623 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
2625 LIBS="$PTHREAD_LIBS $LIBS"
2626 AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
2627 AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
2628 AC_MSG_RESULT($acx_pthread_ok)
2629 if test x"$acx_pthread_ok" = xno; then
2634 CFLAGS="$save_CFLAGS"
2637 # Create a list of thread flags to try. Items starting with a "-" are
2638 # C compiler flags, and other items are library names, except for "none"
2639 # which indicates that we try without any flags at all.
2641 acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
2643 # The ordering *is* (sometimes) important. Some notes on the
2644 # individual items follow:
2646 # pthreads: AIX (must check this before -lpthread)
2647 # none: in case threads are in libc; should be tried before -Kthread and
2648 # other compiler flags to prevent continual compiler warnings
2649 # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
2650 # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
2651 # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
2652 # -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
2653 # -pthreads: Solaris/gcc
2654 # -mthreads: Mingw32/gcc, Lynx/gcc
2655 # -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
2656 # doesn't hurt to check since this sometimes defines pthreads too;
2657 # also defines -D_REENTRANT)
2658 # pthread: Linux, etcetera
2659 # --thread-safe: KAI C++
2661 case "${host_cpu}-${host_os}" in
2664 # On Solaris (at least, for some versions), libc contains stubbed
2665 # (non-functional) versions of the pthreads routines, so link-based
2666 # tests will erroneously succeed. (We need to link with -pthread or
2667 # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
2668 # a function called by this macro, so we could check for that, but
2669 # who knows whether they'll stub that too in a future libc.) So,
2670 # we'll just look for -pthreads and -lpthread first:
2672 acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
2676 if test x"$acx_pthread_ok" = xno; then
2677 for flag in $acx_pthread_flags; do
2681 AC_MSG_CHECKING([whether pthreads work without any flags])
2685 AC_MSG_CHECKING([whether pthreads work with $flag])
2686 PTHREAD_CFLAGS="$flag"
2690 AC_MSG_CHECKING([for the pthreads library -l$flag])
2691 PTHREAD_LIBS="-l$flag"
2696 save_CFLAGS="$CFLAGS"
2697 LIBS="$PTHREAD_LIBS $LIBS"
2698 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
2700 # Check for various functions. We must include pthread.h,
2701 # since some functions may be macros. (On the Sequent, we
2702 # need a special flag -Kthread to make this header compile.)
2703 # We check for pthread_join because it is in -lpthread on IRIX
2704 # while pthread_create is in libc. We check for pthread_attr_init
2705 # due to DEC craziness with -lpthreads. We check for
2706 # pthread_cleanup_push because it is one of the few pthread
2707 # functions on Solaris that doesn't have a non-functional libc stub.
2708 # We try pthread_create on general principles.
2709 AC_TRY_LINK([#include <pthread.h>],
2710 [pthread_t th; pthread_join(th, 0);
2711 pthread_attr_init(0); pthread_cleanup_push(0, 0);
2712 pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
2713 [acx_pthread_ok=yes])
2716 CFLAGS="$save_CFLAGS"
2718 AC_MSG_RESULT($acx_pthread_ok)
2719 if test "x$acx_pthread_ok" = xyes; then
2728 # Various other checks:
2729 if test "x$acx_pthread_ok" = xyes; then
2731 LIBS="$PTHREAD_LIBS $LIBS"
2732 save_CFLAGS="$CFLAGS"
2733 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
2735 # Detect AIX lossage: threads are created detached by default
2736 # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
2737 AC_MSG_CHECKING([for joinable pthread attribute])
2738 AC_TRY_LINK([#include <pthread.h>],
2739 [int attr=PTHREAD_CREATE_JOINABLE;],
2740 ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
2741 if test x"$ok" = xunknown; then
2742 AC_TRY_LINK([#include <pthread.h>],
2743 [int attr=PTHREAD_CREATE_UNDETACHED;],
2744 ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
2746 if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
2747 AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
2748 [Define to the necessary symbol if this constant
2749 uses a non-standard name on your system.])
2751 AC_MSG_RESULT(${ok})
2752 if test x"$ok" = xunknown; then
2753 AC_MSG_WARN([we do not know how to create joinable pthreads])
2756 AC_MSG_CHECKING([if more special flags are required for pthreads])
2758 case "${host_cpu}-${host_os}" in
2759 *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
2760 *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
2762 AC_MSG_RESULT(${flag})
2763 if test "x$flag" != xno; then
2764 PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
2768 CFLAGS="$save_CFLAGS"
2770 # More AIX lossage: must compile with cc_r
2771 AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
2776 AC_SUBST(PTHREAD_LIBS)
2777 AC_SUBST(PTHREAD_CFLAGS)
2778 AC_SUBST(PTHREAD_CC)
2780 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
2781 if test x"$acx_pthread_ok" = xyes; then
2782 ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
2794 #echo Using PTHREAD_LIBS=$PTHREAD_LIBS
2795 #echo Using PTHREAD_CFLAGS=$PTHREAD_CFLAGS
2796 #echo Using PTHREAD_CC=$PTHREAD_CC
2800 # since RFB (usually) needs pthread library, check that it was found.
2801 # But on win32 platforms, the pthread library is not needed.
2802 if test "$with_rfb" = yes -a "$cross_configure" = 0; then
2803 if test "$pthread_ok" = yes; then
2804 RFB_LIBS="$RFB_LIBS $PTHREAD_LIBS"
2805 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
2806 CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
2810 *-pc-windows* | *-pc-winnt* | *-cygwin* | *-mingw*)
2811 # pthread not needed for win32 platform
2814 echo ERROR: --with-rfb requires the pthread library, which could not be found.; exit 1
2819 dnl // DEPRECATED configure options - force users to remove them
2821 AC_MSG_CHECKING(for save/restore (deprecated))
2822 AC_ARG_ENABLE(save-restore,
2823 [ --enable-save-restore enables save/restore (deprecated)],
2824 [AC_MSG_RESULT($enableval)
2825 AC_MSG_ERROR([DEPRECATED - save/restore feature is always enabled])
2831 AC_MSG_CHECKING(for number of processors (deprecated))
2832 AC_ARG_ENABLE(processors,
2833 [ --enable-processors select number of processors (deprecated)],
2834 [AC_MSG_RESULT($enableval)
2835 AC_MSG_ERROR([DEPRECATED - use option --enable-smp instead])
2841 AC_MSG_CHECKING(whether to reset on triple fault (deprecated))
2842 AC_ARG_ENABLE(reset-on-triple-fault,
2843 [ --enable-reset-on-triple-fault reset when cpu detects a triple fault (deprecated)],
2844 [AC_MSG_RESULT($enableval)
2845 AC_MSG_ERROR([DEPRECATED - could be configured directly from .bochsrc instead])
2851 AC_MSG_CHECKING(PNI support (deprecated))
2852 AC_ARG_ENABLE(--enable-pni,
2853 [ --enable-pni PNI support (deprecated)],
2854 [AC_MSG_RESULT($enableval)
2855 AC_MSG_ERROR([DEPRECATED - use --enable-sse=3 instead])
2861 AC_MSG_CHECKING(for new PIT model (deprecated))
2862 AC_ARG_ENABLE(new-pit,
2863 [ --enable-new-pit use Greg Alexander's new PIT model (deprecated)],
2864 [AC_MSG_RESULT($enableval)
2865 AC_MSG_ERROR([DEPRECATED - the new PIT model is always present and the old one has been removed])
2871 # Create some subdirectories for when you run configure from some other
2873 if test ! -d instrument; then mkdir instrument; fi
2874 if test ! -d build; then mkdir build; fi
2875 if test ! -d build/linux; then mkdir build/linux; fi
2876 if test ! -d build/win32; then mkdir build/win32; fi
2877 if test ! -d build/win32/nsis; then mkdir build/win32/nsis; fi
2879 AC_SUBST(INSTALL_TARGET)
2880 AC_SUBST(INSTALL_LIST_FOR_PLATFORM)
2883 AC_SUBST(DEVICE_LINK_OPTS)
2884 AC_SUBST(GUI_LINK_OPTS)
2885 AC_SUBST(GUI_LINK_OPTS_TERM)
2886 AC_SUBST(GUI_LINK_OPTS_WX)
2887 AC_SUBST(BXIMAGE_LINK_OPTS)
2896 AC_SUBST(LINK_CONSOLE)
2898 AC_SUBST(PRIMARY_TARGET)
2899 AC_SUBST(PLUGIN_LIBNAME_TRANSFORMATION)
2900 AC_SUBST(COMMAND_SEPARATOR)
2903 AC_SUBST(CD_UP_THREE)
2905 AC_SUBST(VER_STRING)
2906 AC_SUBST(REL_STRING)
2907 AC_SUBST(EXTRA_LINK_OPTS)
2908 AC_SUBST(GUI_NON_PLUGIN_OBJS)
2909 AC_SUBST(GUI_PLUGIN_OBJS)
2910 AC_SUBST(IODEV_NON_PLUGIN_OBJS)
2911 AC_SUBST(IODEV_PLUGIN_OBJS)
2912 AC_SUBST(PLUGIN_VAR)
2913 AC_SUBST(PLUGIN_TARGET)
2914 AC_SUBST(INSTALL_PLUGINS_VAR)
2916 AC_PATH_PROG(GZIP, gzip)
2917 AC_PATH_PROG(TAR, tar)
2919 AC_OUTPUT(Makefile iodev/Makefile bx_debug/Makefile bios/Makefile \
2920 cpu/Makefile memory/Makefile gui/Makefile \
2921 disasm/Makefile ${INSTRUMENT_DIR}/Makefile misc/Makefile \
2922 fpu/Makefile doc/docbook/Makefile \
2923 build/linux/bochs-dlx \
2924 bxversion.h build/macosx/Info.plist \
2925 build/win32/nsis/Makefile build/win32/nsis/bochs.nsi \
2926 host/linux/pcidev/Makefile)