ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.8
Committed: 2002-09-18T13:06:49Z (22 years, 2 months ago) by gbeauche
Branch: MAIN
Changes since 1.7: +7 -0 lines
Log Message:
Ensure the IEEE fpu core is used when building the JIT compiler

File Contents

# Content
1 dnl Process this file with autoconf to produce a configure script.
2 dnl Written in 2002 by Christian Bauer et al.
3
4 AC_INIT(main_unix.cpp)
5 AC_PREREQ(2.52)
6 AC_CONFIG_HEADER(config.h)
7
8 dnl Video options.
9 AC_ARG_ENABLE(xf86-dga, [ --enable-xf86-dga use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
10 AC_ARG_ENABLE(xf86-vidmode, [ --enable-xf86-vidmode use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
11 AC_ARG_ENABLE(fbdev-dga, [ --enable-fbdev-dga use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
12 AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes])
13
14 dnl JIT compiler options.
15 AC_ARG_ENABLE(jit-compiler, [ --enable-jit-compiler enable JIT compiler [default=no]], [WANT_JIT=$enableval], [WANT_JIT=no])
16 AC_ARG_ENABLE(jit-debug, [ --enable-jit-debug activate native code disassemblers [default=no]], [WANT_JIT_DEBUG=$enableval], [WANT_JIT_DEBUG=no])
17
18 dnl FPU emulation core.
19 AC_ARG_ENABLE(fpe,
20 [ --enable-fpe=FPE specify which fpu emulator to use [default=auto]],
21 [ case "$enableval" in
22 dnl default is always ieee, if architecture has this fp format
23 auto) FPE_CORE_TEST_ORDER="ieee uae";;
24 ieee) FPE_CORE_TEST_ORDER="ieee";;
25 uae) FPE_CORE_TEST_ORDER="uae";;
26 x86) FPE_CORE_TEST_ORDER="x86";;
27 *) AC_MSG_ERROR([--enable-fpe takes only one of the following values: auto, x86, ieee, uae]);;
28 esac
29 ],
30 [ FPE_CORE_TEST_ORDER="ieee uae"
31 ])
32
33 dnl Addressing modes.
34 AC_ARG_ENABLE(addressing,
35 [ --enable-addressing=AM specify the addressing mode to use [default=fastest]],
36 [ case "$enableval" in
37 real) ADDRESSING_TEST_ORDER="real";;
38 direct) ADDRESSING_TEST_ORDER="direct";;
39 banks) ADDRESSING_TEST_ORDER="banks";;
40 fastest)ADDRESSING_TEST_ORDER="direct banks";;
41 *) AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
42 esac
43 ],
44 [ ADDRESSING_TEST_ORDER="direct banks"
45 ])
46
47 dnl External packages.
48 AC_ARG_WITH(esd, [ --with-esd support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
49 AC_ARG_WITH(gtk, [ --with-gtk use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
50 AC_ARG_WITH(mon, [ --with-mon use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
51
52 dnl Canonical system information.
53 AC_CANONICAL_HOST
54 AC_CANONICAL_TARGET
55
56 dnl Target OS type (target is host if not cross-compiling).
57 case "$target_os" in
58 linux*) OS_TYPE=linux;;
59 netbsd*) OS_TYPE=netbsd;;
60 freebsd*) OS_TYPE=freebsd;;
61 solaris*) OS_TYPE=solaris;;
62 darwin*) OS_TYPE=darwin;;
63 *) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;;
64 esac
65 DEFINES="$DEFINES -DOS_$OS_TYPE"
66
67 dnl Target CPU type.
68 HAVE_I386=no
69 HAVE_M68K=no
70 HAVE_SPARC=no
71 HAVE_POWERPC=no
72 case "$target_cpu" in
73 i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
74 m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
75 sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
76 powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
77 *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
78 esac
79 DEFINES="$DEFINES -DCPU_$CPU_TYPE"
80
81 dnl Checks for programs.
82 AC_PROG_CC
83 AC_PROG_CC_C_O
84 AC_PROG_CPP
85 AC_PROG_CXX
86 AC_PROG_MAKE_SET
87 AC_PROG_INSTALL
88
89 dnl We use mon if possible.
90 MONSRCS=
91 if [[ "x$WANT_MON" = "xyes" ]]; then
92 AC_MSG_CHECKING(for mon)
93 mon_srcdir=../../../mon/src
94 if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
95 AC_MSG_RESULT(yes)
96 AC_DEFINE(ENABLE_MON, 1, [Define if using "mon".])
97 MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_z80.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/mon_lowmem.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
98 CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
99 AC_CHECK_LIB(ncurses, tgetent, ,
100 AC_CHECK_LIB(termcap, tgetent, ,
101 AC_CHECK_LIB(termlib, tgetent, ,
102 AC_CHECK_LIB(terminfo, tgetent, ,
103 AC_CHECK_LIB(Hcurses, tgetent, ,
104 AC_CHECK_LIB(curses, tgetent))))))
105 AC_CHECK_LIB(readline, readline)
106 AC_CHECK_HEADERS(readline.h history.h readline/readline.h readline/history.h)
107 else
108 AC_MSG_RESULT(no)
109 AC_MSG_WARN([Could not find mon, ignoring --with-mon.])
110 WANT_MON=no
111 fi
112 fi
113
114 dnl Checks for libraries.
115 AC_CHECK_LIB(posix4, sem_init)
116 AC_CHECK_LIB(rt, timer_create)
117
118 dnl We need X11.
119 AC_PATH_XTRA
120 if [[ "x$no_x" = "xyes" ]]; then
121 AC_MSG_ERROR([You need X11 to run Basilisk II.])
122 fi
123 CFLAGS="$CFLAGS $X_CFLAGS"
124 CXXFLAGS="$CXXFLAGS $X_CFLAGS"
125 LIBS="$LIBS $X_PRE_LIBS $X_LIBS -lX11 -lXext $X_EXTRA_LIBS"
126
127 dnl We want pthreads. Try libpthread first, then libc_r (FreeBSD), then PTL.
128 HAVE_PTHREADS=yes
129 AC_CHECK_LIB(pthread, pthread_create, , [
130 AC_CHECK_LIB(c_r, pthread_create, , [
131 AC_CHECK_LIB(PTL, pthread_create, , [
132 HAVE_PTHREADS=no
133 ])
134 ])
135 ])
136 if [[ "x$HAVE_PTHREADS" = "xyes" ]]; then
137 AC_DEFINE(HAVE_PTHREADS, 1, [Define if pthreads are available.])
138 fi
139 AC_CHECK_FUNCS(pthread_cancel)
140 AC_CHECK_FUNCS(pthread_mutexattr_setprotocol)
141 AC_CHECK_FUNCS(pthread_mutexattr_settype)
142 AC_CHECK_FUNCS(pthread_mutexattr_setpshared)
143
144 dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
145 SEMSRC=
146 AC_CHECK_FUNCS(sem_init, , [
147 if test "x$HAVE_PTHREADS" = "xyes"; then
148 SEMSRC=posix_sem.cpp
149 fi
150 ])
151
152 dnl We use DGA (XFree86 or fbdev) if possible.
153 if [[ "x$WANT_XF86_DGA" = "xyes" ]]; then
154 AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension, [
155 AC_DEFINE(ENABLE_XF86_DGA, 1, [Define if using XFree86 DGA extension.])
156 LIBS="$LIBS -lXxf86dga"
157 if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
158 AC_MSG_WARN([Cannot have both --enable-xf86-dga and --enable-fbdev-dga, ignoring --enable-fbdev-dga.])
159 WANT_FBDEV_DGA=no
160 fi
161 ], [
162 AC_MSG_WARN([Could not find XFree86 DGA extension, ignoring --enable-xf86-dga.])
163 WANT_XF86_DGA=no
164 ])
165 fi
166 if [[ "x$WANT_FBDEV_DGA" = "xyes" ]]; then
167 AC_DEFINE(ENABLE_FBDEV_DGA, 1, [Define if using DGA with framebuffer device.])
168 fi
169
170 dnl We use XFree86 VidMode if possible.
171 if [[ "x$WANT_XF86_VIDMODE" = "xyes" ]]; then
172 AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryExtension, [
173 AC_DEFINE(ENABLE_XF86_VIDMODE, 1, [Define if using XFree86 DGA extension.])
174 LIBS="$LIBS -lXxf86vm"
175 ], [
176 AC_MSG_WARN([Could not find XFree86 VidMode extension, ignoring --enable-xf86-vidmode.])
177 WANT_XF86_VIDMODE=no
178 ])
179 fi
180
181 dnl We use GTK+ if possible.
182 UISRCS=../dummy/prefs_editor_dummy.cpp
183 if [[ "x$WANT_GTK" = "xyes" ]]; then
184 AM_PATH_GTK(1.2.0, [
185 AC_DEFINE(ENABLE_GTK, 1, [Define if using GTK.])
186 CXXFLAGS="$CXXFLAGS $GTK_CFLAGS"
187 LIBS="$LIBS $GTK_LIBS"
188 UISRCS=prefs_editor_gtk.cpp
189 B2_PATH_GNOMEUI([
190 AC_DEFINE(HAVE_GNOMEUI, 1, [Define if libgnomeui is available.])
191 CXXFLAGS="$CXXFLAGS $GNOMEUI_CFLAGS"
192 LIBS="$LIBS $GNOMEUI_LIBS"
193 ], [])
194 ], [
195 AC_MSG_WARN([Could not find GTK+, disabling user interface.])
196 WANT_GTK=no
197 ])
198 fi
199
200 dnl We use ESD if possible.
201 if [[ "x$WANT_ESD" = "xyes" ]]; then
202 AM_PATH_ESD(0.2.8, [
203 AC_DEFINE(ENABLE_ESD, 1, [Define is using ESD.])
204 CFLAGS="$CFLAGS $ESD_CFLAGS"
205 CXXFLAGS="$CXXFLAGS $ESD_CFLAGS"
206 LIBS="$LIBS $ESD_LIBS"
207 ], [
208 AC_MSG_WARN([Could not find ESD, disabling ESD support.])
209 WANT_ESD=no
210 ])
211 fi
212
213 dnl We use 64-bit file size support if possible.
214 AC_SYS_LARGEFILE
215
216 dnl Checks for header files.
217 AC_HEADER_STDC
218 AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h)
219
220 dnl Checks for typedefs, structures, and compiler characteristics.
221 AC_C_BIGENDIAN
222 AC_C_CONST
223 AC_C_INLINE
224 AC_CHECK_SIZEOF(short, 2)
225 AC_CHECK_SIZEOF(int, 4)
226 AC_CHECK_SIZEOF(long, 4)
227 AC_CHECK_SIZEOF(long long, 8)
228 AC_CHECK_SIZEOF(float, 4)
229 AC_CHECK_SIZEOF(double, 8)
230 AC_CHECK_SIZEOF(long double, 12)
231 AC_CHECK_SIZEOF(void *, 4)
232 AC_TYPE_OFF_T
233 AC_CHECK_TYPE(loff_t, off_t)
234 AC_CHECK_TYPE(caddr_t, [char *])
235 AC_TYPE_SIZE_T
236 AC_TYPE_SIGNAL
237 AC_HEADER_TIME
238 AC_STRUCT_TM
239
240 dnl Check whether sys/socket.h defines type socklen_t.
241 dnl (extracted from ac-archive/Miscellaneous)
242 AC_CACHE_CHECK([for socklen_t],
243 ac_cv_type_socklen_t, [
244 AC_TRY_COMPILE([
245 #include <sys/types.h>
246 #include <sys/socket.h>
247 ], [socklen_t len = 42; return 0;],
248 ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no,
249 dnl When cross-compiling, do not assume anything.
250 ac_cv_type_socklen_t="guessing no"
251 )
252 ])
253 if [[ "x$ac_cv_type_socklen_t" != "xyes" ]]; then
254 AC_DEFINE(socklen_t, int, [Define to 'int' if <sys/types.h> doesn't define.])
255 fi
256
257 dnl Checks for library functions.
258 AC_CHECK_FUNCS(strdup cfmakeraw)
259 AC_CHECK_FUNCS(clock_gettime timer_create)
260 AC_CHECK_FUNCS(sigaction signal)
261 AC_CHECK_FUNCS(mmap mprotect munmap)
262 AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect)
263
264 dnl Darwin seems to define mach_task_self() instead of task_self().
265 AC_CHECK_FUNCS(mach_task_self task_self)
266
267 dnl Check for headers and functions related to pty support (sshpty.c)
268 dnl From openssh-3.2.2p1 configure.ac
269
270 AC_CHECK_HEADERS(strings.h login.h sys/bsdtty.h sys/stat.h util.h pty.h)
271 AC_CHECK_FUNCS(_getpty vhangup strlcpy)
272
273 case "$host" in
274 *-*-hpux10.26)
275 disable_ptmx_check=yes
276 ;;
277 *-*-linux*)
278 no_dev_ptmx=1
279 ;;
280 mips-sony-bsd|mips-sony-newsos4)
281 AC_DEFINE(HAVE_NEWS4, 1, [Define if you are on NEWS-OS (additions from openssh-3.2.2p1, for sshpty.c).])
282 ;;
283 *-*-sco3.2v4*)
284 no_dev_ptmx=1
285 ;;
286 *-*-sco3.2v5*)
287 no_dev_ptmx=1
288 ;;
289 esac
290
291 if test -z "$no_dev_ptmx" ; then
292 if test "x$disable_ptmx_check" != "xyes" ; then
293 AC_CHECK_FILE([/dev/ptmx],
294 [
295 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1, [Define if you have /dev/ptmx.])
296 have_dev_ptmx=1
297 ]
298 )
299 fi
300 fi
301 AC_CHECK_FILE([/dev/ptc],
302 [
303 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1, [Define if you have /dev/ptc.])
304 have_dev_ptc=1
305 ]
306 )
307
308 dnl (end of code from openssh-3.2.2p1 configure.ac)
309
310
311 dnl Select system-dependant source files.
312 SERIALSRC=serial_unix.cpp
313 ETHERSRC=../dummy/ether_dummy.cpp
314 SCSISRC=../dummy/scsi_dummy.cpp
315 AUDIOSRC=../dummy/audio_dummy.cpp
316 EXTRASYSSRCS=
317 CAN_NATIVE_M68K=no
318 case "$target_os" in
319 linux*)
320 ETHERSRC=ether_unix.cpp
321 AUDIOSRC=audio_oss_esd.cpp
322 SCSISRC=Linux/scsi_linux.cpp
323 ;;
324 freebsd*)
325 ETHERSRC=ether_unix.cpp
326 AUDIOSRC=audio_oss_esd.cpp
327 DEFINES="$DEFINES -DBSD_COMP"
328 CXXFLAGS="$CXXFLAGS -fpermissive"
329 dnl Check for the CAM library
330 AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no)
331 if [[ "x$HAVE_LIBCAM" = "xno" ]]; then
332 AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.])
333 else
334 dnl Check for the sys kernel includes
335 AC_CHECK_HEADER(camlib.h)
336 if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then
337 dnl In this case I should fix this thing including a "patch"
338 dnl to access directly to the functions in the kernel :) --Orlando
339 AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.])
340 else
341 SCSISRC=FreeBSD/scsi_freebsd.cpp
342 LIBS="$LIBS -lcam"
343 DEFINES="$DEFINES -DCAM"
344 fi
345 fi
346 ;;
347 netbsd*)
348 CAN_NATIVE_M68K=yes
349 ;;
350 solaris*)
351 AUDIOSRC=Solaris/audio_solaris.cpp
352 DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
353 ;;
354 irix*)
355 ETHERSRC=ether_unix.cpp
356 AUDIOSRC=Irix/audio_irix.cpp
357 EXTRASYSSRCS=Irix/unaligned.c
358 dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS"
359 DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS"
360 LIBS="$LIBS -laudio"
361 WANT_ESD=no
362
363 dnl Check if our compiler supports -Ofast (MIPSPro)
364 HAVE_OFAST=no
365 ocflags="$CFLAGS"
366 CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'`
367 AC_MSG_CHECKING(if "-Ofast" works)
368 dnl Do a test compile of an empty function
369 AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no))
370 CFLAGS="$ocflags"
371
372 ;;
373 esac
374
375 dnl Use 68k CPU natively?
376 WANT_NATIVE_M68K=no
377 if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
378 AC_DEFINE(ENABLE_NATIVE_M68K, 1, [Define if using native 68k mode.])
379 WANT_NATIVE_M68K=yes
380 fi
381
382 if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
383 dnl Serial, ethernet and audio support needs pthreads
384 AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
385 SERIALSRC=../dummy/serial_dummy.cpp
386 ETHERSRC=../dummy/ether_dummy.cpp
387 AUDIOSRC=../dummy/audio_dummy.cpp
388 fi
389 SYSSRCS="$SERIALSRC $ETHERSRC $SCSISRC $AUDIOSRC $SEMSRC $UISRCS $MONSRCS $EXTRASYSSRCS"
390
391 dnl Define a macro that translates a yesno-variable into a C macro definition
392 dnl to be put into the config.h file
393 dnl $1 -- the macro to define
394 dnl $2 -- the value to translate
395 dnl $3 -- template name
396 AC_DEFUN(AC_TRANSLATE_DEFINE, [
397 if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then
398 AC_DEFINE($1, 1, $3)
399 fi
400 ])
401
402 dnl Various checks if the system supports vm_allocate() and the like functions.
403 have_mach_vm=no
404 if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \
405 "x$ac_cv_func_vm_protect" = "xyes" ]]; then
406 have_mach_vm=yes
407 fi
408 AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
409 [Define if your system has a working vm_allocate()-based memory allocator.])
410
411 dnl Check that vm_allocate(), vm_protect() work
412 if [[ "x$have_mach_vm" = "xyes" ]]; then
413
414 AC_CACHE_CHECK([whether vm_protect works],
415 ac_cv_vm_protect_works, [
416 AC_LANG_SAVE
417 AC_LANG_CPLUSPLUS
418 ac_cv_vm_protect_works=yes
419 dnl First the tests that should segfault
420 for test_def in NONE_READ NONE_WRITE READ_WRITE; do
421 AC_TRY_RUN([
422 #define CONFIGURE_TEST_VM_MAP
423 #define TEST_VM_PROT_$test_def
424 #include "vm_alloc.cpp"
425 ], ac_cv_vm_protect_works=no, rm -f core,
426 dnl When cross-compiling, do not assume anything
427 ac_cv_vm_protect_works="guessing no"
428 )
429 done
430 AC_TRY_RUN([
431 #define CONFIGURE_TEST_VM_MAP
432 #define TEST_VM_PROT_RDWR_WRITE
433 #include "vm_alloc.cpp"
434 ], , ac_cv_vm_protect_works=no,
435 dnl When cross-compiling, do not assume anything
436 ac_cv_vm_protect_works="guessing no"
437 )
438 AC_LANG_RESTORE
439 ]
440 )
441
442 dnl Remove support for vm_allocate() if vm_protect() does not work
443 if [[ "x$have_mach_vm" = "xyes" ]]; then
444 case $ac_cv_vm_protect_works in
445 *yes) have_mach_vm=yes;;
446 *no) have_mach_vm=no;;
447 esac
448 fi
449 AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm",
450 [Define if your system has a working vm_allocate()-based memory allocator.])
451
452 fi dnl HAVE_MACH_VM
453
454 dnl Various checks if the system supports mmap() and the like functions.
455 dnl ... and Mach memory allocators are not supported
456 have_mmap_vm=no
457 if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \
458 "x$ac_cv_func_mprotect" = "xyes" ]]; then
459 if [[ "x$have_mach_vm" = "xno" ]]; then
460 have_mmap_vm=yes
461 fi
462 fi
463 AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm",
464 [Define if your system has a working mmap()-based memory allocator.])
465
466 dnl Check that mmap() and associated functions work.
467 if [[ "x$have_mmap_vm" = "xyes" ]]; then
468
469 dnl Check if we have a working anonymous mmap()
470 AC_CACHE_CHECK([whether mmap supports MAP_ANON],
471 ac_cv_mmap_anon, [
472 AC_LANG_SAVE
473 AC_LANG_CPLUSPLUS
474 AC_TRY_RUN([
475 #define HAVE_MMAP_ANON
476 #define CONFIGURE_TEST_VM_MAP
477 #define TEST_VM_MMAP_ANON
478 #include "vm_alloc.cpp"
479 ], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no,
480 dnl When cross-compiling, do not assume anything.
481 ac_cv_mmap_anon="guessing no"
482 )
483 AC_LANG_RESTORE
484 ]
485 )
486 AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon",
487 [Define if <sys/mman.h> defines MAP_ANON and mmap()'ing with MAP_ANON works.])
488
489 AC_CACHE_CHECK([whether mmap supports MAP_ANONYMOUS],
490 ac_cv_mmap_anonymous, [
491 AC_LANG_SAVE
492 AC_LANG_CPLUSPLUS
493 AC_TRY_RUN([
494 #define HAVE_MMAP_ANONYMOUS
495 #define CONFIGURE_TEST_VM_MAP
496 #define TEST_VM_MMAP_ANON
497 #include "vm_alloc.cpp"
498 ], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no,
499 dnl When cross-compiling, do not assume anything.
500 ac_cv_mmap_anonymous="guessing no"
501 )
502 AC_LANG_RESTORE
503 ]
504 )
505 AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous",
506 [Define if <sys/mman.h> defines MAP_ANONYMOUS and mmap()'ing with MAP_ANONYMOUS works.])
507
508 AC_CACHE_CHECK([whether mprotect works],
509 ac_cv_mprotect_works, [
510 AC_LANG_SAVE
511 AC_LANG_CPLUSPLUS
512 ac_cv_mprotect_works=yes
513 dnl First the tests that should segfault
514 for test_def in NONE_READ NONE_WRITE READ_WRITE; do
515 AC_TRY_RUN([
516 #define CONFIGURE_TEST_VM_MAP
517 #define TEST_VM_PROT_$test_def
518 #include "vm_alloc.cpp"
519 ], ac_cv_mprotect_works=no, rm -f core,
520 dnl When cross-compiling, do not assume anything
521 ac_cv_mprotect_works="guessing no"
522 )
523 done
524 AC_TRY_RUN([
525 #define CONFIGURE_TEST_VM_MAP
526 #define TEST_VM_PROT_RDWR_WRITE
527 #include "vm_alloc.cpp"
528 ], , ac_cv_mprotect_works=no,
529 dnl When cross-compiling, do not assume anything
530 ac_cv_mprotect_works="guessing no"
531 )
532 AC_LANG_RESTORE
533 ]
534 )
535
536 dnl Remove support for mmap() if mprotect() does not work
537 if [[ "x$have_mmap_vm" = "xyes" ]]; then
538 case $ac_cv_mprotect_works in
539 *yes) have_mmap_vm=yes;;
540 *no) have_mmap_vm=no;;
541 esac
542 fi
543 AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm,
544 [Define if your system has a working mmap()-based memory allocator.])
545
546 fi dnl HAVE_MMAP_VM
547
548 dnl Check if we can mmap 0x2000 bytes from 0x0000
549 AC_CACHE_CHECK([whether we can map Low Memory area 0x0000-0x2000],
550 ac_cv_can_map_lm, [
551 AC_LANG_SAVE
552 AC_LANG_CPLUSPLUS
553 AC_TRY_RUN([
554 #include "vm_alloc.cpp"
555 int main(void) { /* returns 0 if we could map the lowmem globals */
556 volatile char * lm;
557 if (vm_init() < 0) exit(1);
558 if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1);
559 lm[0] = 'z';
560 if (vm_release((char *)lm, 0x2000) < 0) exit(1);
561 vm_exit(); exit(0);
562 }
563 ], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no,
564 dnl When cross-compiling, do not assume anything.
565 ac_cv_can_map_lm="guessing no"
566 )
567 AC_LANG_RESTORE
568 ]
569 )
570
571 dnl Check signal handlers need to be reinstalled
572 AC_CACHE_CHECK([whether signal handlers need to be reinstalled],
573 ac_cv_signal_need_reinstall, [
574 AC_LANG_SAVE
575 AC_LANG_CPLUSPLUS
576 AC_TRY_RUN([
577 #include <stdlib.h>
578 #ifdef HAVE_UNISTD_H
579 #include <unistd.h>
580 #endif
581 #include <signal.h>
582 static int handled_signal = 0;
583 RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
584 int main(void) { /* returns 0 if signals need not to be reinstalled */
585 signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
586 exit(handled_signal == 2);
587 }
588 ], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no,
589 dnl When cross-compiling, do not assume anything.
590 ac_cv_signal_need_reinstall="guessing yes"
591 )
592 AC_LANG_RESTORE
593 ]
594 )
595 AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall",
596 [Define if your system requires signals to be reinstalled.])
597
598 dnl Check if sigaction handlers need to be reinstalled
599 AC_CACHE_CHECK([whether sigaction handlers need to be reinstalled],
600 ac_cv_sigaction_need_reinstall, [
601 AC_LANG_SAVE
602 AC_LANG_CPLUSPLUS
603 AC_TRY_RUN([
604 #include <stdlib.h>
605 #ifdef HAVE_UNISTD_H
606 #include <unistd.h>
607 #endif
608 #include <signal.h>
609 static int handled_signal = 0;
610 RETSIGTYPE sigusr1_handler(int) { handled_signal++; }
611 typedef RETSIGTYPE (*signal_handler)(int);
612 static signal_handler mysignal(int sig, signal_handler handler) {
613 struct sigaction old_sa;
614 struct sigaction new_sa;
615 new_sa.sa_handler = handler;
616 return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler);
617 }
618 int main(void) { /* returns 0 if signals need not to be reinstalled */
619 mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1);
620 exit(handled_signal == 2);
621 }
622 ], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no,
623 dnl When cross-compiling, do not assume anything.
624 ac_cv_sigaction_need_reinstall="guessing yes"
625 )
626 AC_LANG_RESTORE
627 ]
628 )
629 AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall",
630 [Define if your system requires sigactions to be reinstalled.])
631
632 dnl Check if extended signals are supported.
633 AC_CACHE_CHECK([whether your system supports extended signal handlers],
634 ac_cv_have_extended_signals, [
635 AC_LANG_SAVE
636 AC_LANG_CPLUSPLUS
637 AC_TRY_RUN([
638 #define HAVE_SIGINFO_T 1
639 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
640 #include "vm_alloc.cpp"
641 #include "sigsegv.cpp"
642 ], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no,
643 dnl When cross-compiling, do not assume anything.
644 ac_cv_have_extended_signals=no
645 )
646 AC_LANG_RESTORE
647 ]
648 )
649 AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac_cv_have_extended_signals",
650 [Define if your system support extended signals.])
651
652 dnl Otherwise, check for subterfuges.
653 if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then
654 AC_CACHE_CHECK([whether we then have a subterfuge for your system],
655 ac_cv_have_sigcontext_hack, [
656 AC_LANG_SAVE
657 AC_LANG_CPLUSPLUS
658 AC_TRY_RUN([
659 #define HAVE_SIGCONTEXT_SUBTERFUGE 1
660 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
661 #include "vm_alloc.cpp"
662 #include "sigsegv.cpp"
663 ], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no,
664 dnl When cross-compiling, do not assume anything.
665 ac_cv_have_sigcontext_hack=no
666 )
667 AC_LANG_RESTORE
668 ])
669 AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack",
670 [Define if we know a hack to replace siginfo_t->si_addr member.])
671 fi
672
673 dnl Check if we can ignore the fault (instruction skipping in SIGSEGV handler)
674 AC_CACHE_CHECK([whether we can skip instruction in SIGSEGV handler],
675 ac_cv_have_skip_instruction, [
676 AC_LANG_SAVE
677 AC_LANG_CPLUSPLUS
678 AC_TRY_RUN([
679 #define HAVE_SIGSEGV_SKIP_INSTRUCTION 1
680 #define CONFIGURE_TEST_SIGSEGV_RECOVERY
681 #include "vm_alloc.cpp"
682 #include "sigsegv.cpp"
683 ], ac_cv_have_skip_instruction=yes, ac_cv_have_skip_instruction=no,
684 dnl When cross-compiling, do not assume anything.
685 ac_cv_have_skip_instruction=no
686 )
687 AC_LANG_RESTORE
688 ]
689 )
690 AC_TRANSLATE_DEFINE(HAVE_SIGSEGV_SKIP_INSTRUCTION, "$ac_cv_have_skip_instruction",
691 [Define if we can ignore the fault (instruction skipping in SIGSEGV handler).])
692
693 dnl Can we do Video on SEGV Signals ?
694 CAN_VOSF=no
695 if [[ "$ac_cv_have_extended_signals" = "yes" -o "$ac_cv_have_sigcontext_hack" = "yes" ]]; then
696 CAN_VOSF=yes
697 fi
698
699 dnl Determine the addressing mode to use
700 if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
701 ADDRESSING_MODE="real"
702 else
703 ADDRESSING_MODE=""
704 AC_MSG_CHECKING([for the addressing mode to use])
705 for am in $ADDRESSING_TEST_ORDER; do
706 case $am in
707 real)
708 dnl Requires ability to mmap() Low Memory globals
709 if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
710 continue
711 fi
712 dnl Requires VOSF screen updates
713 if [[ "x$CAN_VOSF" = "xno" ]]; then
714 continue
715 fi
716 dnl Real addressing will probably work.
717 ADDRESSING_MODE="real"
718 WANT_VOSF=yes dnl we can use VOSF and we need it actually
719 DEFINES="$DEFINES -DREAL_ADDRESSING"
720 break
721 ;;
722 direct)
723 dnl Requires VOSF screen updates
724 if [[ "x$CAN_VOSF" = "xyes" ]]; then
725 ADDRESSING_MODE="direct"
726 WANT_VOSF=yes dnl we can use VOSF and we need it actually
727 DEFINES="$DEFINES -DDIRECT_ADDRESSING"
728 break
729 fi
730 ;;
731 banks)
732 dnl Default addressing mode
733 ADDRESSING_MODE="memory banks"
734 break
735 ;;
736 *)
737 AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
738 esac
739 done
740 AC_MSG_RESULT($ADDRESSING_MODE)
741 if [[ "x$ADDRESSING_MODE" = "x" ]]; then
742 AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
743 ADDRESSING_MODE="memory banks"
744 fi
745 fi
746
747 dnl Banked Memory Addressing mode is not supported by the JIT compiler
748 if [[ "x$WANT_JIT" = "xyes" -a "x$ADDRESSING_MODE" = "xmemory banks" ]]; then
749 AC_MSG_ERROR([Sorry, the JIT Compiler requires Direct Addressing, at least])
750 fi
751
752 dnl Enable VOSF screen updates with this feature is requested and feasible
753 if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
754 AC_DEFINE(ENABLE_VOSF, 1, [Define if using video enabled on SEGV signals.])
755 else
756 WANT_VOSF=no
757 fi
758
759 dnl Check for GAS.
760 HAVE_GAS=no
761 AC_MSG_CHECKING(for GAS .p2align feature)
762 cat >conftest.S << EOF
763 .text
764 .p2align 5
765 EOF
766 if $CC conftest.S -c -o conftest.o >/dev/null 2>&1 ; then HAVE_GAS=yes; fi
767 AC_MSG_RESULT($HAVE_GAS)
768
769 dnl Check for GCC 2.7 or higher.
770 HAVE_GCC27=no
771 AC_MSG_CHECKING(for GCC 2.7 or higher)
772 AC_EGREP_CPP(yes,
773 [#if __GNUC__ - 1 > 1 || __GNUC_MINOR__ - 1 > 5
774 yes
775 #endif
776 ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
777
778 dnl Check for GCC 3.0 or higher.
779 HAVE_GCC30=no
780 AC_MSG_CHECKING(for GCC 3.0 or higher)
781 AC_EGREP_CPP(yes,
782 [#if __GNUC__ >= 3
783 yes
784 #endif
785 ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
786
787 dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
788 dnl Also set "-fno-exceptions" for C++ because exception handling requires
789 dnl the frame pointer.
790 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
791 CFLAGS="$CFLAGS -fomit-frame-pointer"
792 CXXFLAGS="$CXXFLAGS -fomit-frame-pointer -fno-exceptions"
793 fi
794
795 dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
796 dnl As of 2001/08/02, this affects the following compilers:
797 dnl Official: probably gcc-3.1 (mainline CVS)
798 dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
799 dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
800 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
801 SAVED_CXXFLAGS="$CXXFLAGS"
802 CXXFLAGS="$CXXFLAGS -fno-merge-constants"
803 AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
804 AC_LANG_SAVE
805 AC_LANG_CPLUSPLUS
806 AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
807 AC_LANG_RESTORE
808 ])
809 if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
810 CXXFLAGS="$SAVED_CXXFLAGS"
811 fi
812 fi
813
814 dnl Select appropriate CPU source and REGPARAM define.
815 ASM_OPTIMIZATIONS=none
816 CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
817
818 dnl (gb) JITSRCS will be emptied later if the JIT is not available
819 dnl Other platforms should define their own set of noflags file variants
820 CAN_JIT=no
821 JITSRCS="compemu1.cpp compemu2.cpp compemu3.cpp compemu4.cpp compemu5.cpp compemu6.cpp compemu7.cpp compemu8.cpp"
822
823 if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
824 dnl i386 CPU
825 DEFINES="$DEFINES -DUNALIGNED_PROFITABLE -DREGPARAM=\"__attribute__((regparm(3)))\""
826 if [[ "x$HAVE_GAS" = "xyes" ]]; then
827 ASM_OPTIMIZATIONS=i386
828 DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTIMIZED_FLAGS -DSAHF_SETO_PROFITABLE"
829 CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
830 JITSRCS="cpufast1_nf.s cpufast2_nf.s cpufast3_nf.s cpufast4_nf.s cpufast5_nf.s cpufast6_nf.s cpufast7_nf.s cpufast8_nf.s $JITSRCS"
831 fi
832 CAN_JIT=yes
833 elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
834 dnl SPARC CPU
835 case "$target_os" in
836 solaris*)
837 AC_MSG_CHECKING(SPARC CPU architecture)
838 SPARC_TYPE=`Solaris/which_sparc`
839 AC_MSG_RESULT($SPARC_TYPE)
840 case "$SPARC_TYPE" in
841 SPARC_V8)
842 ASM_OPTIMIZATIONS="SPARC V8 architecture"
843 DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
844 CFLAGS="$CFLAGS -Wa,-Av8"
845 CXXFLAGS="$CXXFLAGS -Wa,-Av8"
846 ;;
847 SPARC_V9)
848 ASM_OPTIMIZATIONS="SPARC V9 architecture"
849 DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
850 CFLAGS="$CFLAGS -Wa,-Av9"
851 CXXFLAGS="$CXXFLAGS -Wa,-Av9"
852 ;;
853 esac
854 ;;
855 esac
856 elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
857 dnl Native m68k, no emulation
858 CPUINCLUDES="-I../native_cpu"
859 CPUSRCS="asm_support.s"
860 fi
861
862 dnl Enable JIT compiler, if possible.
863 if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
864 JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
865 DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
866
867 if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
868 if [[ "x$WANT_MON" = "xyes" ]]; then
869 DEFINES="$DEFINES -DJIT_DEBUG=1"
870 else
871 AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
872 WANT_JIT_DEBUG=no
873 fi
874 fi
875
876 dnl IEEE core is the only FPU emulator to use with the JIT compiler
877 case $FPE_CORE_TEST_ORDER in
878 ieee*) ;;
879 *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
880 esac
881 FPE_CORE_TEST_ORDER="ieee"
882 else
883 WANT_JIT=no
884 WANT_JIT_DEBUG=no
885 JITSRCS=""
886 fi
887
888 dnl Utility macro used by next two tests.
889 dnl AC_EXAMINE_OBJECT(C source code,
890 dnl commands examining object file,
891 dnl [commands to run if compile failed]):
892 dnl
893 dnl Compile the source code to an object file; then convert it into a
894 dnl printable representation. All unprintable characters and
895 dnl asterisks (*) are replaced by dots (.). All white space is
896 dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
897 dnl output, but runs of newlines are compressed to a single newline.
898 dnl Finally, line breaks are forcibly inserted so that no line is
899 dnl longer than 80 columns and the file ends with a newline. The
900 dnl result of all this processing is in the file conftest.dmp, which
901 dnl may be examined by the commands in the second argument.
902 dnl
903 AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
904 [AC_LANG_SAVE
905 AC_LANG_C
906 dnl Next bit cribbed from AC_TRY_COMPILE.
907 cat > conftest.$ac_ext <<EOF
908 [#line __oline__ "configure"
909 #include "confdefs.h"
910 $1
911 ]EOF
912 if AC_TRY_EVAL(ac_compile); then
913 od -c conftest.o |
914 sed ['s/^[0-7]*[ ]*/ /
915 s/\*/./g
916 s/ \\n/*/g
917 s/ [0-9][0-9][0-9]/./g
918 s/ \\[^ ]/./g'] |
919 tr -d '
920 ' | tr -s '*' '
921 ' | fold | sed '$a\
922 ' > conftest.dmp
923 $2
924 ifelse($3, , , else
925 $3
926 )dnl
927 fi
928 rm -rf conftest*
929 AC_LANG_RESTORE])
930
931 dnl Floating point format probe.
932 dnl The basic concept is the same as the above: grep the object
933 dnl file for an interesting string. We have to watch out for
934 dnl rounding changing the values in the object, however; this is
935 dnl handled by ignoring the least significant byte of the float.
936 dnl
937 dnl Does not know about VAX G-float or C4x idiosyncratic format.
938 dnl It does know about PDP-10 idiosyncratic format, but this is
939 dnl not presently supported by GCC. S/390 "binary floating point"
940 dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
941 dnl as ASCII?)
942 dnl
943 AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
944 [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
945 [gcc_AC_EXAMINE_OBJECT(
946 [/* This will not work unless sizeof(double) == 8. */
947 extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
948
949 /* This structure must have no internal padding. */
950 struct possibility {
951 char prefix[8];
952 double candidate;
953 char postfix[8];
954 };
955
956 #define C(cand) { "\nformat:", cand, ":tamrof\n" }
957 struct possibility table [] =
958 {
959 C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
960 C( 3.53802595280598432000e+18), /* D__float - VAX */
961 C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
962 C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
963 C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
964 };],
965 [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
966 ac_cv_c_float_format='IEEE (big-endian)'
967 elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
968 ac_cv_c_float_format='IEEE (big-endian)'
969 elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
970 ac_cv_c_float_format='IEEE (little-endian)'
971 elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
972 ac_cv_c_float_format='IEEE (little-endian)'
973 elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
974 ac_cv_c_float_format='VAX D-float'
975 elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
976 ac_cv_c_float_format='PDP-10'
977 elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
978 ac_cv_c_float_format='IBM 370 hex'
979 else
980 AC_MSG_ERROR(Unknown floating point format)
981 fi],
982 [AC_MSG_ERROR(compile failed)])
983 ])
984 # IEEE is the default format. If the float endianness isn't the same
985 # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
986 # (which is a tristate: yes, no, default). This is only an issue with
987 # IEEE; the other formats are only supported by a few machines each,
988 # all with the same endianness.
989 format=IEEE_FLOAT_FORMAT
990 fbigend=
991 case $ac_cv_c_float_format in
992 'IEEE (big-endian)' )
993 if test $ac_cv_c_bigendian = no; then
994 fbigend=1
995 fi
996 ;;
997 'IEEE (little-endian)' )
998 if test $ac_cv_c_bigendian = yes; then
999 fbigend=0
1000 fi
1001 ;;
1002 'VAX D-float' )
1003 format=VAX_FLOAT_FORMAT
1004 ;;
1005 'PDP-10' )
1006 format=PDP10_FLOAT_FORMAT
1007 ;;
1008 'IBM 370 hex' )
1009 format=IBM_FLOAT_FORMAT
1010 ;;
1011 esac
1012 AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1013 [Define to the floating point format of the host machine.])
1014 if test -n "$fbigend"; then
1015 AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1016 [Define to 1 if the host machine stores floating point numbers in
1017 memory with the word containing the sign bit at the lowest address,
1018 or to 0 if it does it the other way around.
1019
1020 This macro should not be defined if the ordering is the same as for
1021 multi-word integers.])
1022 fi
1023 ])
1024
1025 dnl Select appropriate FPU source.
1026 gcc_AC_C_FLOAT_FORMAT
1027 AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
1028
1029 for fpe in $FPE_CORE_TEST_ORDER; do
1030 case $fpe in
1031 ieee)
1032 case $ac_cv_c_float_format in
1033 IEEE*)
1034 FPE_CORE="IEEE fpu core"
1035 DEFINES="$DEFINES -DFPU_IEEE"
1036 FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
1037 dnl Math functions not mandated by C99 standard
1038 AC_CHECK_FUNCS(isnanl isinfl)
1039 dnl Math functions required by C99 standard, but probably not
1040 dnl implemented everywhere. In that case, we fall back to the
1041 dnl regular variant for doubles.
1042 AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
1043 AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
1044 AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
1045 AC_CHECK_FUNCS(floorl ceill)
1046 break
1047 ;;
1048 esac
1049 ;;
1050 x86)
1051 if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
1052 FPE_CORE="i387 fpu core"
1053 DEFINES="$DEFINES -DFPU_X86"
1054 FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
1055 break
1056 fi
1057 ;;
1058 uae)
1059 FPE_CORE="uae fpu core"
1060 DEFINES="$DEFINES -DFPU_UAE"
1061 FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
1062 break
1063 ;;
1064 *)
1065 AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
1066 ;;
1067 esac
1068 done
1069 if [[ "x$FPE_CORE" = "x" ]]; then
1070 AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
1071 fi
1072
1073 dnl Check for certain math functions
1074 AC_CHECK_FUNCS(atanh)
1075 AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
1076
1077 dnl UAE CPU sources for all non-m68k-native architectures.
1078 if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
1079 CPUINCLUDES="-I../uae_cpu"
1080 CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS $JITSRCS"
1081 fi
1082
1083 dnl Remove the "-g" option if set for GCC.
1084 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1085 CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1086 CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1087 fi
1088
1089 dnl Or if we have -Ofast
1090 if [[ "x$HAVE_OFAST" = "xyes" ]]; then
1091 CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
1092 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
1093 CXXFLAGS="-LANG:std $CXXFLAGS"
1094 LDFLAGS="$LDFLAGS -ipa"
1095 fi
1096
1097 dnl Generate Makefile.
1098 AC_SUBST(DEFINES)
1099 AC_SUBST(SYSSRCS)
1100 AC_SUBST(CPUINCLUDES)
1101 AC_SUBST(CPUSRCS)
1102 AC_OUTPUT(Makefile)
1103
1104 dnl Print summary.
1105 echo
1106 echo Basilisk II configuration summary:
1107 echo
1108 echo XFree86 DGA support .................... : $WANT_XF86_DGA
1109 echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1110 echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
1111 echo Enable video on SEGV signals ........... : $WANT_VOSF
1112 echo ESD sound support ...................... : $WANT_ESD
1113 echo GTK user interface ..................... : $WANT_GTK
1114 echo mon debugger support ................... : $WANT_MON
1115 echo Running m68k code natively ............. : $WANT_NATIVE_M68K
1116 echo Use JIT compiler ....................... : $WANT_JIT
1117 echo JIT debug mode ......................... : $WANT_JIT_DEBUG
1118 echo Floating-Point emulation core .......... : $FPE_CORE
1119 echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1120 echo Addressing mode ........................ : $ADDRESSING_MODE
1121 echo
1122 echo "Configuration done. Now type \"make\" (or \"gmake\")."