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