ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.ac
Revision: 1.18
Committed: 2003-08-17T10:16:23Z (21 years, 3 months ago) by gbeauche
Branch: MAIN
Changes since 1.17: +4 -0 lines
Log Message:
AM_GNU_GETTEXT for gnome stuff

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