ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.13
Committed: 2002-11-05T11:58:40Z (21 years, 8 months ago) by gbeauche
Branch: MAIN
Changes since 1.12: +9 -0 lines
Log Message:
Add configury for x86-64

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 HAVE_X86_64=no
73 case "$target_cpu" in
74 i386* | i486* | i586* | i686* | i786* ) HAVE_I386=yes;;
75 m68k* ) HAVE_M68K=yes;;
76 sparc* ) HAVE_SPARC=yes;;
77 powerpc* ) HAVE_POWERPC=yes;;
78 x86_64* ) HAVE_X86_64=yes;;
79 esac
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" ]]; 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 JITSRCS="cpuemu1_nf.cpp cpuemu2_nf.cpp cpuemu3_nf.cpp cpuemu4_nf.cpp cpuemu5_nf.cpp cpuemu6_nf.cpp cpuemu7_nf.cpp cpuemu8_nf.cpp $JITSRCS"
830 CAN_JIT=yes
831 fi
832 elif [[ "x$HAVE_GCC30" = "xyes" -a "x$HAVE_X86_64" = "xyes" ]]; then
833 dnl x86-64 CPU
834 DEFINES="$DEFINES -DUNALIGNED_PROFITABLE"
835 if [[ "x$HAVE_GAS" = "xyes" ]]; then
836 ASM_OPTIMIZATIONS="x86-64"
837 DEFINES="$DEFINES -DX86_64_ASSEMBLY -DOPTIMIZED_FLAGS"
838 fi
839 elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
840 dnl SPARC CPU
841 case "$target_os" in
842 solaris*)
843 AC_MSG_CHECKING(SPARC CPU architecture)
844 SPARC_TYPE=`Solaris/which_sparc`
845 AC_MSG_RESULT($SPARC_TYPE)
846 case "$SPARC_TYPE" in
847 SPARC_V8)
848 ASM_OPTIMIZATIONS="SPARC V8 architecture"
849 DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
850 CFLAGS="$CFLAGS -Wa,-Av8"
851 CXXFLAGS="$CXXFLAGS -Wa,-Av8"
852 ;;
853 SPARC_V9)
854 ASM_OPTIMIZATIONS="SPARC V9 architecture"
855 DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
856 CFLAGS="$CFLAGS -Wa,-Av9"
857 CXXFLAGS="$CXXFLAGS -Wa,-Av9"
858 ;;
859 esac
860 ;;
861 esac
862 elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
863 dnl Native m68k, no emulation
864 CPUINCLUDES="-I../native_cpu"
865 CPUSRCS="asm_support.s"
866 fi
867
868 dnl Enable JIT compiler, if possible.
869 if [[ "x$WANT_JIT" = "xyes" -a "x$CAN_JIT" ]]; then
870 JITSRCS="$JITSRCS ../uae_cpu/compiler/compemu_support.cpp ../uae_cpu/compiler/compemu_fpp.cpp compstbl.o cpustbl_nf.o"
871 DEFINES="$DEFINES -DUSE_JIT -DUSE_JIT_FPU"
872
873 if [[ "x$WANT_JIT_DEBUG" = "xyes" ]]; then
874 if [[ "x$WANT_MON" = "xyes" ]]; then
875 DEFINES="$DEFINES -DJIT_DEBUG=1"
876 else
877 AC_MSG_WARN([cxmon not found, ignoring --enable-jit-debug])
878 WANT_JIT_DEBUG=no
879 fi
880 fi
881
882 dnl IEEE core is the only FPU emulator to use with the JIT compiler
883 case $FPE_CORE_TEST_ORDER in
884 ieee*) ;;
885 *) AC_MSG_WARN([Forcing use of the IEEE FPU core, as the JIT compiler supports only this one.]) ;;
886 esac
887 FPE_CORE_TEST_ORDER="ieee"
888 else
889 WANT_JIT=no
890 WANT_JIT_DEBUG=no
891 JITSRCS=""
892 fi
893
894 dnl Utility macro used by next two tests.
895 dnl AC_EXAMINE_OBJECT(C source code,
896 dnl commands examining object file,
897 dnl [commands to run if compile failed]):
898 dnl
899 dnl Compile the source code to an object file; then convert it into a
900 dnl printable representation. All unprintable characters and
901 dnl asterisks (*) are replaced by dots (.). All white space is
902 dnl deleted. Newlines (ASCII 0x10) in the input are preserved in the
903 dnl output, but runs of newlines are compressed to a single newline.
904 dnl Finally, line breaks are forcibly inserted so that no line is
905 dnl longer than 80 columns and the file ends with a newline. The
906 dnl result of all this processing is in the file conftest.dmp, which
907 dnl may be examined by the commands in the second argument.
908 dnl
909 AC_DEFUN([gcc_AC_EXAMINE_OBJECT],
910 [AC_LANG_SAVE
911 AC_LANG_C
912 dnl Next bit cribbed from AC_TRY_COMPILE.
913 cat > conftest.$ac_ext <<EOF
914 [#line __oline__ "configure"
915 #include "confdefs.h"
916 $1
917 ]EOF
918 if AC_TRY_EVAL(ac_compile); then
919 od -c conftest.o |
920 sed ['s/^[0-7]*[ ]*/ /
921 s/\*/./g
922 s/ \\n/*/g
923 s/ [0-9][0-9][0-9]/./g
924 s/ \\[^ ]/./g'] |
925 tr -d '
926 ' | tr -s '*' '
927 ' | fold | sed '$a\
928 ' > conftest.dmp
929 $2
930 ifelse($3, , , else
931 $3
932 )dnl
933 fi
934 rm -rf conftest*
935 AC_LANG_RESTORE])
936
937 dnl Floating point format probe.
938 dnl The basic concept is the same as the above: grep the object
939 dnl file for an interesting string. We have to watch out for
940 dnl rounding changing the values in the object, however; this is
941 dnl handled by ignoring the least significant byte of the float.
942 dnl
943 dnl Does not know about VAX G-float or C4x idiosyncratic format.
944 dnl It does know about PDP-10 idiosyncratic format, but this is
945 dnl not presently supported by GCC. S/390 "binary floating point"
946 dnl is in fact IEEE (but maybe we should have that in EBCDIC as well
947 dnl as ASCII?)
948 dnl
949 AC_DEFUN([gcc_AC_C_FLOAT_FORMAT],
950 [AC_CACHE_CHECK(floating point format, ac_cv_c_float_format,
951 [gcc_AC_EXAMINE_OBJECT(
952 [/* This will not work unless sizeof(double) == 8. */
953 extern char sizeof_double_must_be_8 [sizeof(double) == 8 ? 1 : -1];
954
955 /* This structure must have no internal padding. */
956 struct possibility {
957 char prefix[8];
958 double candidate;
959 char postfix[8];
960 };
961
962 #define C(cand) { "\nformat:", cand, ":tamrof\n" }
963 struct possibility table [] =
964 {
965 C( 3.25724264705901305206e+01), /* @@IEEEFP - IEEE 754 */
966 C( 3.53802595280598432000e+18), /* D__float - VAX */
967 C( 5.32201830133125317057e-19), /* D.PDP-10 - PDP-10 - the dot is 0x13a */
968 C( 1.77977764695171661377e+10), /* IBMHEXFP - s/390 format, ascii */
969 C(-5.22995989424860458374e+10) /* IBMHEXFP - s/390 format, EBCDIC */
970 };],
971 [if grep 'format:.@IEEEF.:tamrof' conftest.dmp >/dev/null 2>&1; then
972 ac_cv_c_float_format='IEEE (big-endian)'
973 elif grep 'format:.I@@PFE.:tamrof' conftest.dmp >/dev/null 2>&1; then
974 ac_cv_c_float_format='IEEE (big-endian)'
975 elif grep 'format:.FEEEI@.:tamrof' conftest.dmp >/dev/null 2>&1; then
976 ac_cv_c_float_format='IEEE (little-endian)'
977 elif grep 'format:.EFP@@I.:tamrof' conftest.dmp >/dev/null 2>&1; then
978 ac_cv_c_float_format='IEEE (little-endian)'
979 elif grep 'format:.__floa.:tamrof' conftest.dmp >/dev/null 2>&1; then
980 ac_cv_c_float_format='VAX D-float'
981 elif grep 'format:..PDP-1.:tamrof' conftest.dmp >/dev/null 2>&1; then
982 ac_cv_c_float_format='PDP-10'
983 elif grep 'format:.BMHEXF.:tamrof' conftest.dmp >/dev/null 2>&1; then
984 ac_cv_c_float_format='IBM 370 hex'
985 else
986 AC_MSG_ERROR(Unknown floating point format)
987 fi],
988 [AC_MSG_ERROR(compile failed)])
989 ])
990 # IEEE is the default format. If the float endianness isn't the same
991 # as the integer endianness, we have to set FLOAT_WORDS_BIG_ENDIAN
992 # (which is a tristate: yes, no, default). This is only an issue with
993 # IEEE; the other formats are only supported by a few machines each,
994 # all with the same endianness.
995 format=IEEE_FLOAT_FORMAT
996 fbigend=
997 case $ac_cv_c_float_format in
998 'IEEE (big-endian)' )
999 if test $ac_cv_c_bigendian = no; then
1000 fbigend=1
1001 fi
1002 ;;
1003 'IEEE (little-endian)' )
1004 if test $ac_cv_c_bigendian = yes; then
1005 fbigend=0
1006 fi
1007 ;;
1008 'VAX D-float' )
1009 format=VAX_FLOAT_FORMAT
1010 ;;
1011 'PDP-10' )
1012 format=PDP10_FLOAT_FORMAT
1013 ;;
1014 'IBM 370 hex' )
1015 format=IBM_FLOAT_FORMAT
1016 ;;
1017 esac
1018 AC_DEFINE_UNQUOTED(HOST_FLOAT_FORMAT, $format,
1019 [Define to the floating point format of the host machine.])
1020 if test -n "$fbigend"; then
1021 AC_DEFINE_UNQUOTED(HOST_FLOAT_WORDS_BIG_ENDIAN, $fbigend,
1022 [Define to 1 if the host machine stores floating point numbers in
1023 memory with the word containing the sign bit at the lowest address,
1024 or to 0 if it does it the other way around.
1025
1026 This macro should not be defined if the ordering is the same as for
1027 multi-word integers.])
1028 fi
1029 ])
1030
1031 dnl Select appropriate FPU source.
1032 gcc_AC_C_FLOAT_FORMAT
1033 AC_CHECK_HEADERS(ieee754.h ieeefp.h floatingpoint.h nan.h)
1034
1035 for fpe in $FPE_CORE_TEST_ORDER; do
1036 case $fpe in
1037 ieee)
1038 case $ac_cv_c_float_format in
1039 IEEE*)
1040 FPE_CORE="IEEE fpu core"
1041 DEFINES="$DEFINES -DFPU_IEEE"
1042 FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
1043 dnl Math functions not mandated by C99 standard
1044 AC_CHECK_FUNCS(isnanl isinfl)
1045 dnl Math functions required by C99 standard, but probably not
1046 dnl implemented everywhere. In that case, we fall back to the
1047 dnl regular variant for doubles.
1048 AC_CHECK_FUNCS(logl log10l expl powl fabsl sqrtl)
1049 AC_CHECK_FUNCS(sinl cosl tanl sinhl coshl tanhl)
1050 AC_CHECK_FUNCS(asinl acosl atanl asinhl acoshl atanhl)
1051 AC_CHECK_FUNCS(floorl ceill)
1052 break
1053 ;;
1054 esac
1055 ;;
1056 x86)
1057 if [[ ":$HAVE_GCC27:$HAVE_I386:$HAVE_GAS:" = ":yes:yes:yes:" ]]; then
1058 FPE_CORE="i387 fpu core"
1059 DEFINES="$DEFINES -DFPU_X86"
1060 FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
1061 break
1062 fi
1063 ;;
1064 uae)
1065 FPE_CORE="uae fpu core"
1066 DEFINES="$DEFINES -DFPU_UAE"
1067 FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
1068 break
1069 ;;
1070 *)
1071 AC_MSG_ERROR([Internal configure.in script error for $fpe fpu core])
1072 ;;
1073 esac
1074 done
1075 if [[ "x$FPE_CORE" = "x" ]]; then
1076 AC_MSG_ERROR([Sorry, no suitable FPU core found in $FPE_CORE_TEST_ORDER])
1077 fi
1078
1079 dnl Check for certain math functions
1080 AC_CHECK_FUNCS(atanh)
1081 AC_CHECK_FUNCS(isnan isinf finite isnormal signbit)
1082
1083 dnl UAE CPU sources for all non-m68k-native architectures.
1084 if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
1085 CPUINCLUDES="-I../uae_cpu"
1086 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"
1087 fi
1088
1089 dnl Remove the "-g" option if set for GCC.
1090 if [[ "x$HAVE_GCC27" = "xyes" ]]; then
1091 CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
1092 CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
1093 fi
1094
1095 dnl Or if we have -Ofast
1096 if [[ "x$HAVE_OFAST" = "xyes" ]]; then
1097 CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
1098 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
1099 CXXFLAGS="-LANG:std $CXXFLAGS"
1100 LDFLAGS="$LDFLAGS -ipa"
1101 fi
1102
1103 dnl Generate Makefile.
1104 AC_SUBST(DEFINES)
1105 AC_SUBST(SYSSRCS)
1106 AC_SUBST(CPUINCLUDES)
1107 AC_SUBST(CPUSRCS)
1108 AC_OUTPUT(Makefile)
1109
1110 dnl Print summary.
1111 echo
1112 echo Basilisk II configuration summary:
1113 echo
1114 echo XFree86 DGA support .................... : $WANT_XF86_DGA
1115 echo XFree86 VidMode support ................ : $WANT_XF86_VIDMODE
1116 echo fbdev DGA support ...................... : $WANT_FBDEV_DGA
1117 echo Enable video on SEGV signals ........... : $WANT_VOSF
1118 echo ESD sound support ...................... : $WANT_ESD
1119 echo GTK user interface ..................... : $WANT_GTK
1120 echo mon debugger support ................... : $WANT_MON
1121 echo Running m68k code natively ............. : $WANT_NATIVE_M68K
1122 echo Use JIT compiler ....................... : $WANT_JIT
1123 echo JIT debug mode ......................... : $WANT_JIT_DEBUG
1124 echo Floating-Point emulation core .......... : $FPE_CORE
1125 echo Assembly optimizations ................. : $ASM_OPTIMIZATIONS
1126 echo Addressing mode ........................ : $ADDRESSING_MODE
1127 echo
1128 echo "Configuration done. Now type \"make\" (or \"gmake\")."