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=no]], [WANT_VOSF=$enableval], [WANT_VOSF=no]) |
12 |
> |
AC_ARG_ENABLE(vosf, [ --enable-vosf enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=yes]) |
13 |
> |
|
14 |
> |
dnl FPU emulation core. |
15 |
> |
AC_ARG_ENABLE(fpe, |
16 |
> |
[ --enable-fpe=which specify which fpu emulator to use [default=opt]], |
17 |
> |
[ case "$enableval" in |
18 |
> |
default) FPE_CORE="default";; dnl fpu_x86.cpp if i386 architecture, fpu_uae.cpp otherwise |
19 |
> |
uae) FPE_CORE="uae";; |
20 |
> |
*) AC_MSG_ERROR([--enable-fpe takes only one of the following values: default, uae]);; |
21 |
> |
esac |
22 |
> |
], |
23 |
> |
[ FPE_CORE="default" |
24 |
> |
]) |
25 |
|
|
26 |
|
dnl Addressing modes. |
27 |
|
AC_ARG_ENABLE(addressing, |
52 |
|
netbsd*) OS_TYPE=netbsd;; |
53 |
|
freebsd*) OS_TYPE=freebsd;; |
54 |
|
solaris*) OS_TYPE=solaris;; |
55 |
< |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/' | sed -e 's/\./_/'`;; |
55 |
> |
darwin*) OS_TYPE=darwin;; |
56 |
> |
*) OS_TYPE=`echo $target_os | sed -e 's/-/_/g' | sed -e 's/\./_/g'`;; |
57 |
|
esac |
58 |
|
DEFINES="$DEFINES -DOS_$OS_TYPE" |
59 |
|
|
67 |
|
m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;; |
68 |
|
sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;; |
69 |
|
powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;; |
70 |
< |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;; |
70 |
> |
*) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;; |
71 |
|
esac |
72 |
|
DEFINES="$DEFINES -DCPU_$CPU_TYPE" |
73 |
|
|
101 |
|
|
102 |
|
dnl Checks for libraries. |
103 |
|
AC_CHECK_LIB(posix4, sem_init) |
104 |
+ |
AC_CHECK_LIB(rt, timer_create) |
105 |
|
|
106 |
|
dnl We need X11. |
107 |
|
AC_PATH_XTRA |
193 |
|
|
194 |
|
dnl Checks for header files. |
195 |
|
AC_HEADER_STDC |
196 |
< |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h) |
196 |
> |
AC_CHECK_HEADERS(unistd.h fcntl.h sys/time.h sys/mman.h) |
197 |
|
|
198 |
|
dnl Checks for typedefs, structures, and compiler characteristics. |
199 |
|
AC_C_BIGENDIAN |
214 |
|
dnl Checks for library functions. |
215 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
216 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
217 |
+ |
AC_CHECK_FUNCS(sigaction signal) |
218 |
+ |
AC_CHECK_FUNCS(mmap mprotect munmap) |
219 |
+ |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
220 |
+ |
|
221 |
+ |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
222 |
+ |
AC_CHECK_FUNCS(mach_task_self task_self) |
223 |
|
|
224 |
|
dnl Select system-dependant source files. |
225 |
|
SERIALSRC=serial_unix.cpp |
230 |
|
CAN_NATIVE_M68K=no |
231 |
|
case "$target_os" in |
232 |
|
linux*) |
233 |
< |
ETHERSRC=Linux/ether_linux.cpp |
214 |
< |
SCSISRC=Linux/scsi_linux.cpp |
233 |
> |
ETHERSRC=ether_unix.cpp |
234 |
|
AUDIOSRC=audio_oss_esd.cpp |
235 |
+ |
SCSISRC=Linux/scsi_linux.cpp |
236 |
|
;; |
237 |
< |
freebsd*3.*) |
237 |
> |
freebsd*) |
238 |
> |
ETHERSRC=ether_unix.cpp |
239 |
|
AUDIOSRC=audio_oss_esd.cpp |
240 |
|
DEFINES="$DEFINES -DBSD_COMP" |
241 |
+ |
CXXFLAGS="$CXXFLAGS -fpermissive" |
242 |
|
dnl Check for the CAM library |
243 |
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
244 |
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
245 |
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
246 |
|
else |
247 |
|
dnl Check for the sys kernel includes |
248 |
< |
AC_CHECK_HEADER(/sys/cam/cam.h) |
249 |
< |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
248 |
> |
AC_CHECK_HEADER(camlib.h) |
249 |
> |
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
250 |
|
dnl In this case I should fix this thing including a "patch" |
251 |
|
dnl to access directly to the functions in the kernel :) --Orlando |
252 |
< |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
252 |
> |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
253 |
|
else |
254 |
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
233 |
– |
CXXFLAGS="$CXXFLAGS -I/sys" |
234 |
– |
CFLAGS="$CFLAGS -I/sys" |
255 |
|
LIBS="$LIBS -lcam" |
256 |
|
DEFINES="$DEFINES -DCAM" |
257 |
|
fi |
258 |
|
fi |
259 |
|
;; |
240 |
– |
freebsd*) |
241 |
– |
DEFINES="$DEFINES -DBSD_COMP" |
242 |
– |
dnl Check for the SCSI library |
243 |
– |
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
244 |
– |
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
245 |
– |
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
246 |
– |
else |
247 |
– |
dnl Check for the sys kernel includes |
248 |
– |
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
249 |
– |
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
250 |
– |
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.]) |
251 |
– |
else |
252 |
– |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
253 |
– |
LIBS="$LIBS -lscsi" |
254 |
– |
fi |
255 |
– |
fi |
256 |
– |
;; |
260 |
|
netbsd*) |
261 |
|
CAN_NATIVE_M68K=yes |
262 |
|
;; |
270 |
|
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
271 |
|
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
272 |
|
LIBS="$LIBS -laudio" |
273 |
+ |
|
274 |
+ |
dnl Check if our compiler supports -Ofast (MIPSPro) |
275 |
+ |
HAVE_OFAST=no |
276 |
+ |
ocflags="$CFLAGS" |
277 |
+ |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
278 |
+ |
AC_MSG_CHECKING(if "-Ofast" works) |
279 |
+ |
dnl Do a test compile of an empty function |
280 |
+ |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
281 |
+ |
CFLAGS="$ocflags" |
282 |
+ |
|
283 |
|
;; |
284 |
|
esac |
285 |
|
|
304 |
|
dnl $1 -- the macro to define |
305 |
|
dnl $2 -- the value to translate |
306 |
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
307 |
< |
if [[ "x$2" = "xyes" ]]; then |
307 |
> |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
308 |
|
AC_DEFINE($1) |
309 |
|
fi |
310 |
|
]) |
311 |
|
|
312 |
+ |
dnl Various checks if the system supports vm_allocate() and the like functions. |
313 |
+ |
have_mach_vm=no |
314 |
+ |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
315 |
+ |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
316 |
+ |
have_mach_vm=yes |
317 |
+ |
fi |
318 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
319 |
+ |
|
320 |
+ |
dnl Check that vm_allocate(), vm_protect() work |
321 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
322 |
+ |
|
323 |
+ |
AC_CACHE_CHECK("whether vm_protect works", |
324 |
+ |
ac_cv_vm_protect_works, [ |
325 |
+ |
AC_LANG_SAVE |
326 |
+ |
AC_LANG_CPLUSPLUS |
327 |
+ |
ac_cv_vm_protect_works=yes |
328 |
+ |
dnl First the tests that should segfault |
329 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
330 |
+ |
AC_TRY_RUN([ |
331 |
+ |
#define CONFIGURE_TEST_VM_MAP |
332 |
+ |
#define TEST_VM_PROT_$test_def |
333 |
+ |
#include "vm_alloc.cpp" |
334 |
+ |
], ac_cv_vm_protect_works=no, rm -f core, |
335 |
+ |
dnl When cross-compiling, do not assume anything |
336 |
+ |
ac_cv_vm_protect_works="guessing no" |
337 |
+ |
) |
338 |
+ |
done |
339 |
+ |
AC_TRY_RUN([ |
340 |
+ |
#define CONFIGURE_TEST_VM_MAP |
341 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
342 |
+ |
#include "vm_alloc.cpp" |
343 |
+ |
], , ac_cv_vm_protect_works=no, |
344 |
+ |
dnl When cross-compiling, do not assume anything |
345 |
+ |
ac_cv_vm_protect_works="guessing no" |
346 |
+ |
) |
347 |
+ |
AC_LANG_RESTORE |
348 |
+ |
] |
349 |
+ |
) |
350 |
+ |
|
351 |
+ |
dnl Remove support for vm_allocate() if vm_protect() does not work |
352 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
353 |
+ |
case $ac_cv_vm_protect_works in |
354 |
+ |
*yes) have_mach_vm=yes;; |
355 |
+ |
*no) have_mach_vm=no;; |
356 |
+ |
esac |
357 |
+ |
fi |
358 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
359 |
+ |
|
360 |
+ |
fi dnl HAVE_MACH_VM |
361 |
+ |
|
362 |
+ |
dnl Various checks if the system supports mmap() and the like functions. |
363 |
+ |
dnl ... and Mach memory allocators are not supported |
364 |
+ |
have_mmap_vm=no |
365 |
+ |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
366 |
+ |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
367 |
+ |
if [[ "x$have_mach_vm" = "xno" ]]; then |
368 |
+ |
have_mmap_vm=yes |
369 |
+ |
fi |
370 |
+ |
fi |
371 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
372 |
+ |
|
373 |
+ |
dnl Check that mmap() and associated functions work. |
374 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
375 |
+ |
|
376 |
+ |
dnl Check if we have a working anonymous mmap() |
377 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
378 |
+ |
ac_cv_mmap_anon, [ |
379 |
+ |
AC_LANG_SAVE |
380 |
+ |
AC_LANG_CPLUSPLUS |
381 |
+ |
AC_TRY_RUN([ |
382 |
+ |
#define HAVE_MMAP_ANON |
383 |
+ |
#define CONFIGURE_TEST_VM_MAP |
384 |
+ |
#define TEST_VM_MMAP_ANON |
385 |
+ |
#include "vm_alloc.cpp" |
386 |
+ |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
387 |
+ |
dnl When cross-compiling, do not assume anything. |
388 |
+ |
ac_cv_mmap_anon="guessing no" |
389 |
+ |
) |
390 |
+ |
AC_LANG_RESTORE |
391 |
+ |
] |
392 |
+ |
) |
393 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
394 |
+ |
|
395 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
396 |
+ |
ac_cv_mmap_anonymous, [ |
397 |
+ |
AC_LANG_SAVE |
398 |
+ |
AC_LANG_CPLUSPLUS |
399 |
+ |
AC_TRY_RUN([ |
400 |
+ |
#define HAVE_MMAP_ANONYMOUS |
401 |
+ |
#define CONFIGURE_TEST_VM_MAP |
402 |
+ |
#define TEST_VM_MMAP_ANON |
403 |
+ |
#include "vm_alloc.cpp" |
404 |
+ |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
405 |
+ |
dnl When cross-compiling, do not assume anything. |
406 |
+ |
ac_cv_mmap_anonymous="guessing no" |
407 |
+ |
) |
408 |
+ |
AC_LANG_RESTORE |
409 |
+ |
] |
410 |
+ |
) |
411 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
412 |
+ |
|
413 |
+ |
AC_CACHE_CHECK("whether mprotect works", |
414 |
+ |
ac_cv_mprotect_works, [ |
415 |
+ |
AC_LANG_SAVE |
416 |
+ |
AC_LANG_CPLUSPLUS |
417 |
+ |
ac_cv_mprotect_works=yes |
418 |
+ |
dnl First the tests that should segfault |
419 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
420 |
+ |
AC_TRY_RUN([ |
421 |
+ |
#define CONFIGURE_TEST_VM_MAP |
422 |
+ |
#define TEST_VM_PROT_$test_def |
423 |
+ |
#include "vm_alloc.cpp" |
424 |
+ |
], ac_cv_mprotect_works=no, rm -f core, |
425 |
+ |
dnl When cross-compiling, do not assume anything |
426 |
+ |
ac_cv_mprotect_works="guessing no" |
427 |
+ |
) |
428 |
+ |
done |
429 |
+ |
AC_TRY_RUN([ |
430 |
+ |
#define CONFIGURE_TEST_VM_MAP |
431 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
432 |
+ |
#include "vm_alloc.cpp" |
433 |
+ |
], , ac_cv_mprotect_works=no, |
434 |
+ |
dnl When cross-compiling, do not assume anything |
435 |
+ |
ac_cv_mprotect_works="guessing no" |
436 |
+ |
) |
437 |
+ |
AC_LANG_RESTORE |
438 |
+ |
] |
439 |
+ |
) |
440 |
+ |
|
441 |
+ |
dnl Remove support for mmap() if mprotect() does not work |
442 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
443 |
+ |
case $ac_cv_mprotect_works in |
444 |
+ |
*yes) have_mmap_vm=yes;; |
445 |
+ |
*no) have_mmap_vm=no;; |
446 |
+ |
esac |
447 |
+ |
fi |
448 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
449 |
+ |
|
450 |
+ |
fi dnl HAVE_MMAP_VM |
451 |
+ |
|
452 |
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
453 |
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
454 |
|
ac_cv_can_map_lm, [ |
455 |
|
AC_LANG_SAVE |
456 |
|
AC_LANG_CPLUSPLUS |
457 |
|
AC_TRY_RUN([ |
458 |
< |
#include <unistd.h> |
459 |
< |
#include <fcntl.h> |
460 |
< |
#include <sys/mman.h> |
461 |
< |
|
462 |
< |
int main() |
463 |
< |
{ int zero_fd; char * lm; |
464 |
< |
if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
465 |
< |
if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1); |
313 |
< |
lm[0] = 0x12; |
314 |
< |
munmap(lm, 0x2000); |
315 |
< |
close(zero_fd); |
316 |
< |
exit(0); |
458 |
> |
#include "vm_alloc.cpp" |
459 |
> |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
460 |
> |
volatile char * lm; |
461 |
> |
if (vm_init() < 0) exit(1); |
462 |
> |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
463 |
> |
lm[0] = 'z'; |
464 |
> |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
465 |
> |
vm_exit(); exit(0); |
466 |
|
} |
467 |
< |
], |
468 |
< |
[ac_cv_can_map_lm=yes], |
469 |
< |
[ac_cv_can_map_lm=no] |
467 |
> |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
468 |
> |
dnl When cross-compiling, do not assume anything. |
469 |
> |
ac_cv_can_map_lm="guessing no" |
470 |
|
) |
471 |
|
AC_LANG_RESTORE |
472 |
|
] |
473 |
|
) |
474 |
|
|
475 |
< |
dnl Check if extended signals are supported. |
476 |
< |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
477 |
< |
ac_cv_have_extended_signals, [ |
475 |
> |
dnl Check signal handlers need to be reinstalled |
476 |
> |
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
477 |
> |
ac_cv_signal_need_reinstall, [ |
478 |
|
AC_LANG_SAVE |
479 |
|
AC_LANG_CPLUSPLUS |
480 |
|
AC_TRY_RUN([ |
332 |
– |
#include <unistd.h> |
481 |
|
#include <stdlib.h> |
482 |
+ |
#ifdef HAVE_UNISTD_H |
483 |
+ |
#include <unistd.h> |
484 |
+ |
#endif |
485 |
|
#include <signal.h> |
486 |
< |
#include <fcntl.h> |
487 |
< |
#include <sys/mman.h> |
488 |
< |
|
489 |
< |
static volatile caddr_t mem = 0; |
490 |
< |
static int zero_fd = -1; |
486 |
> |
static int handled_signal = 0; |
487 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
488 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
489 |
> |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
490 |
> |
exit(handled_signal == 2); |
491 |
> |
} |
492 |
> |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
493 |
> |
dnl When cross-compiling, do not assume anything. |
494 |
> |
ac_cv_signal_need_reinstall="guessing yes" |
495 |
> |
) |
496 |
> |
AC_LANG_RESTORE |
497 |
> |
] |
498 |
> |
) |
499 |
> |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
500 |
|
|
501 |
< |
static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *) |
502 |
< |
{ if ((caddr_t)(sip->si_addr) != mem) exit(1); |
503 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
504 |
< |
|
505 |
< |
int main() |
506 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
507 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
508 |
< |
struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO; |
509 |
< |
sigaction(SIGSEGV, &sa, 0); |
510 |
< |
mem[0] = 0; |
511 |
< |
exit(1); // should not be reached |
501 |
> |
dnl Check if sigaction handlers need to be reinstalled |
502 |
> |
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
503 |
> |
ac_cv_sigaction_need_reinstall, [ |
504 |
> |
AC_LANG_SAVE |
505 |
> |
AC_LANG_CPLUSPLUS |
506 |
> |
AC_TRY_RUN([ |
507 |
> |
#include <stdlib.h> |
508 |
> |
#ifdef HAVE_UNISTD_H |
509 |
> |
#include <unistd.h> |
510 |
> |
#endif |
511 |
> |
#include <signal.h> |
512 |
> |
static int handled_signal = 0; |
513 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
514 |
> |
typedef RETSIGTYPE (*signal_handler)(int); |
515 |
> |
static signal_handler mysignal(int sig, signal_handler handler) { |
516 |
> |
struct sigaction old_sa; |
517 |
> |
struct sigaction new_sa; |
518 |
> |
new_sa.sa_handler = handler; |
519 |
> |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
520 |
> |
} |
521 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
522 |
> |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
523 |
> |
exit(handled_signal == 2); |
524 |
|
} |
525 |
< |
], |
526 |
< |
[ac_cv_have_extended_signals=yes], |
527 |
< |
[ac_cv_have_extended_signals=no] |
525 |
> |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
526 |
> |
dnl When cross-compiling, do not assume anything. |
527 |
> |
ac_cv_sigaction_need_reinstall="guessing yes" |
528 |
> |
) |
529 |
> |
AC_LANG_RESTORE |
530 |
> |
] |
531 |
> |
) |
532 |
> |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
533 |
> |
|
534 |
> |
dnl Check if extended signals are supported. |
535 |
> |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
536 |
> |
ac_cv_have_extended_signals, [ |
537 |
> |
AC_LANG_SAVE |
538 |
> |
AC_LANG_CPLUSPLUS |
539 |
> |
AC_TRY_RUN([ |
540 |
> |
#define HAVE_SIGINFO_T 1 |
541 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
542 |
> |
#include "vm_alloc.cpp" |
543 |
> |
#include "sigsegv.cpp" |
544 |
> |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
545 |
> |
dnl When cross-compiling, do not assume anything. |
546 |
> |
ac_cv_have_extended_signals=no |
547 |
|
) |
548 |
|
AC_LANG_RESTORE |
549 |
|
] |
552 |
|
|
553 |
|
dnl Otherwise, check for subterfuges. |
554 |
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
555 |
< |
case "$target_os" in |
556 |
< |
linux*) |
557 |
< |
if [[ "x$HAVE_I386" = "xyes" ]]; then |
558 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
559 |
< |
ac_cv_have_sigcontext_hack, [ |
560 |
< |
AC_LANG_SAVE |
561 |
< |
AC_LANG_CPLUSPLUS |
562 |
< |
AC_TRY_RUN([ |
563 |
< |
#include <unistd.h> |
564 |
< |
#include <signal.h> |
565 |
< |
#include <fcntl.h> |
566 |
< |
#include <sys/mman.h> |
567 |
< |
|
568 |
< |
static volatile caddr_t mem = 0; |
569 |
< |
static int zero_fd = -1; |
570 |
< |
|
380 |
< |
static RETSIGTYPE segfault_handler(int, struct sigcontext scs) |
381 |
< |
{ if ((caddr_t)(scs.cr2) != mem) exit(1); |
382 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
383 |
< |
|
384 |
< |
int main() |
385 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
386 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
387 |
< |
struct sigaction sa; sa.sa_flags = 0; |
388 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
389 |
< |
sigaction(SIGSEGV, &sa, 0); |
390 |
< |
mem[0] = 0; |
391 |
< |
exit(1); // should not be reached |
392 |
< |
} |
393 |
< |
], |
394 |
< |
[ac_cv_have_sigcontext_hack=yes], |
395 |
< |
[ac_cv_have_sigcontext_hack=no] |
396 |
< |
) |
397 |
< |
AC_LANG_RESTORE |
398 |
< |
]) |
399 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
400 |
< |
elif [[ "x$HAVE_POWERPC" = "xyes" ]]; then |
401 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
402 |
< |
ac_cv_have_sigcontext_hack, [ |
403 |
< |
AC_LANG_SAVE |
404 |
< |
AC_LANG_CPLUSPLUS |
405 |
< |
AC_TRY_RUN([ |
406 |
< |
#include <unistd.h> |
407 |
< |
#include <signal.h> |
408 |
< |
#include <fcntl.h> |
409 |
< |
#include <sys/mman.h> |
410 |
< |
|
411 |
< |
static volatile caddr_t mem = 0; |
412 |
< |
static int zero_fd = -1; |
413 |
< |
|
414 |
< |
static RETSIGTYPE segfault_handler(int, struct sigcontext_struct *scs) |
415 |
< |
{ if ((caddr_t)(scs->regs->dar) != mem) exit(1); |
416 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
417 |
< |
|
418 |
< |
int main() |
419 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
420 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
421 |
< |
struct sigaction sa; sa.sa_flags = 0; |
422 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
423 |
< |
sigaction(SIGSEGV, &sa, 0); |
424 |
< |
mem[0] = 0; |
425 |
< |
exit(1); // should not be reached |
426 |
< |
} |
427 |
< |
], |
428 |
< |
[ac_cv_have_sigcontext_hack=yes], |
429 |
< |
[ac_cv_have_sigcontext_hack=no] |
430 |
< |
) |
431 |
< |
AC_LANG_RESTORE |
432 |
< |
]) |
433 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
434 |
< |
fi |
435 |
< |
;; |
436 |
< |
netbsd*) |
437 |
< |
if [[ "x$HAVE_M68K" = "xyes" ]]; then |
438 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
439 |
< |
ac_cv_have_sigcontext_hack, [ |
440 |
< |
AC_LANG_SAVE |
441 |
< |
AC_LANG_CPLUSPLUS |
442 |
< |
AC_TRY_RUN([ |
443 |
< |
#include <unistd.h> |
444 |
< |
#include <signal.h> |
445 |
< |
#include <fcntl.h> |
446 |
< |
#include <sys/mman.h> |
447 |
< |
|
448 |
< |
static volatile caddr_t mem = 0; |
449 |
< |
static int zero_fd = -1; |
450 |
< |
|
451 |
< |
static RETSIGTYPE segfault_handler(int, int code) |
452 |
< |
{ if ((caddr_t)code != mem) exit(1); |
453 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
454 |
< |
|
455 |
< |
int main() |
456 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
457 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
458 |
< |
struct sigaction sa; sa.sa_flags = 0; |
459 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
460 |
< |
sigaction(SIGSEGV, &sa, 0); |
461 |
< |
mem[0] = 0; |
462 |
< |
exit(1); // should not be reached |
463 |
< |
} |
464 |
< |
], |
465 |
< |
[ac_cv_have_sigcontext_hack=yes], |
466 |
< |
[ac_cv_have_sigcontext_hack=no] |
467 |
< |
) |
468 |
< |
AC_LANG_RESTORE |
469 |
< |
]) |
470 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
471 |
< |
fi |
472 |
< |
;; |
473 |
< |
esac |
555 |
> |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
556 |
> |
ac_cv_have_sigcontext_hack, [ |
557 |
> |
AC_LANG_SAVE |
558 |
> |
AC_LANG_CPLUSPLUS |
559 |
> |
AC_TRY_RUN([ |
560 |
> |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
561 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
562 |
> |
#include "vm_alloc.cpp" |
563 |
> |
#include "sigsegv.cpp" |
564 |
> |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
565 |
> |
dnl When cross-compiling, do not assume anything. |
566 |
> |
ac_cv_have_sigcontext_hack=no |
567 |
> |
) |
568 |
> |
AC_LANG_RESTORE |
569 |
> |
]) |
570 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
571 |
|
fi |
572 |
|
|
573 |
|
dnl Can we do Video on SEGV Signals ? |
659 |
|
dnl Select appropriate CPU source and REGPARAM define. |
660 |
|
ASM_OPTIMIZATIONS=none |
661 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
662 |
< |
FPUSRCS="../uae_cpu/fpp.cpp" |
663 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
662 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
663 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
664 |
|
dnl i386 CPU |
665 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
666 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
667 |
|
ASM_OPTIMIZATIONS=i386 |
668 |
|
DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS" |
669 |
< |
CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
669 |
> |
CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s" |
670 |
|
FPUSRCS="../uae_cpu/fpu_x86.cpp" |
671 |
|
fi |
672 |
|
elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
698 |
|
CPUSRCS="asm_support.s" |
699 |
|
fi |
700 |
|
|
701 |
+ |
dnl Select appropriate FPU source. |
702 |
+ |
dnl 1. Optimized X86 assembly core if target is i386 architecture |
703 |
+ |
SAVED_DEFINES=$DEFINES |
704 |
+ |
if [[ "x$FPE_CORE" = "xdefault" ]]; then |
705 |
+ |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then |
706 |
+ |
DEFINES="$DEFINES -DFPU_X86" |
707 |
+ |
FPE_CORE_STR="i386 optimized core" |
708 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
709 |
+ |
else |
710 |
+ |
FPE_CORE="uae" |
711 |
+ |
fi |
712 |
+ |
fi |
713 |
+ |
|
714 |
+ |
dnl 2. JIT-FPU only supports IEEE-based implementation. |
715 |
+ |
if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then |
716 |
+ |
AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation]) |
717 |
+ |
FPE_CORE="ieee" |
718 |
+ |
dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten |
719 |
+ |
DEFINES=$SAVED_DEFINES |
720 |
+ |
fi |
721 |
+ |
|
722 |
+ |
dnl 3. Choose either IEEE-based implementation or the old UAE core |
723 |
+ |
if [[ "x$FPE_CORE" = "xieee" ]]; then |
724 |
+ |
AC_CHECK_HEADERS(fenv.h) |
725 |
+ |
AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept) |
726 |
+ |
AC_CHECK_FUNCS(fegetround fesetround) |
727 |
+ |
DEFINES="$DEFINES -DFPU_IEEE" |
728 |
+ |
FPE_CORE_STR="ieee-based fpu core" |
729 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp" |
730 |
+ |
elif [[ "x$FPE_CORE" = "xuae" ]]; then |
731 |
+ |
DEFINES="$DEFINES -DFPU_UAE" |
732 |
+ |
FPE_CORE_STR="original uae core" |
733 |
+ |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
734 |
+ |
fi |
735 |
+ |
|
736 |
+ |
dnl Check for certain math functions |
737 |
+ |
AC_CHECK_FUNCS(atanh) |
738 |
+ |
AC_CHECK_FUNCS(isnan isinf) dnl C99 |
739 |
+ |
AC_CHECK_FUNCS(isnanl isinfl) dnl IEEE ? |
740 |
+ |
|
741 |
|
dnl UAE CPU sources for all non-m68k-native architectures. |
742 |
|
if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then |
743 |
|
CPUINCLUDES="-I../uae_cpu" |
746 |
|
|
747 |
|
dnl Remove the "-g" option if set for GCC. |
748 |
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
749 |
< |
dnl gb-- Probably not the cleanest way to take |
750 |
< |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
751 |
< |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
749 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
750 |
> |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
751 |
> |
fi |
752 |
> |
|
753 |
> |
dnl Or if we have -Ofast |
754 |
> |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
755 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
756 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
757 |
> |
CXXFLAGS="-LANG:std $CXXFLAGS" |
758 |
> |
LDFLAGS="$LDFLAGS -Ofast" |
759 |
|
fi |
760 |
|
|
761 |
|
dnl Generate Makefile. |
777 |
|
echo GTK user interface ............... : $WANT_GTK |
778 |
|
echo mon debugger support ............. : $WANT_MON |
779 |
|
echo Running m68k code natively ....... : $WANT_NATIVE_M68K |
780 |
+ |
echo Floating-Point emulation core .... : $FPE_CORE_STR |
781 |
|
echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS |
782 |
|
echo Addressing mode .................. : $ADDRESSING_MODE |
783 |
|
echo |