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, |
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 |
206 |
|
AC_CHECK_SIZEOF(void *, 4) |
207 |
|
AC_TYPE_OFF_T |
208 |
|
AC_CHECK_TYPE(loff_t, off_t) |
209 |
+ |
TYPE_SOCKLEN_T |
210 |
|
AC_TYPE_SIZE_T |
211 |
|
AC_TYPE_SIGNAL |
212 |
|
AC_HEADER_TIME |
215 |
|
dnl Checks for library functions. |
216 |
|
AC_CHECK_FUNCS(strdup cfmakeraw) |
217 |
|
AC_CHECK_FUNCS(clock_gettime timer_create) |
218 |
+ |
AC_CHECK_FUNCS(sigaction signal) |
219 |
+ |
AC_CHECK_FUNCS(mmap mprotect munmap) |
220 |
+ |
AC_CHECK_FUNCS(vm_allocate vm_deallocate vm_protect) |
221 |
+ |
|
222 |
+ |
dnl Darwin seems to define mach_task_self() instead of task_self(). |
223 |
+ |
AC_CHECK_FUNCS(mach_task_self task_self) |
224 |
|
|
225 |
|
dnl Select system-dependant source files. |
226 |
|
SERIALSRC=serial_unix.cpp |
231 |
|
CAN_NATIVE_M68K=no |
232 |
|
case "$target_os" in |
233 |
|
linux*) |
234 |
< |
ETHERSRC=Linux/ether_linux.cpp |
226 |
< |
SCSISRC=Linux/scsi_linux.cpp |
234 |
> |
ETHERSRC=ether_unix.cpp |
235 |
|
AUDIOSRC=audio_oss_esd.cpp |
236 |
+ |
SCSISRC=Linux/scsi_linux.cpp |
237 |
|
;; |
238 |
< |
freebsd*3.*) |
238 |
> |
freebsd*) |
239 |
> |
ETHERSRC=ether_unix.cpp |
240 |
|
AUDIOSRC=audio_oss_esd.cpp |
241 |
|
DEFINES="$DEFINES -DBSD_COMP" |
242 |
+ |
CXXFLAGS="$CXXFLAGS -fpermissive" |
243 |
|
dnl Check for the CAM library |
244 |
|
AC_CHECK_LIB(cam, cam_open_btl, HAVE_LIBCAM=yes, HAVE_LIBCAM=no) |
245 |
|
if [[ "x$HAVE_LIBCAM" = "xno" ]]; then |
246 |
|
AC_MSG_WARN([Cannot find libcam for SCSI management, disabling SCSI support.]) |
247 |
|
else |
248 |
|
dnl Check for the sys kernel includes |
249 |
< |
AC_CHECK_HEADER(/sys/cam/cam.h) |
250 |
< |
if [[ "x$ac_cv_header__sys_cam_cam_h" = "xno" ]]; then |
249 |
> |
AC_CHECK_HEADER(camlib.h) |
250 |
> |
if [[ "x$ac_cv_header_camlib_h" = "xno" ]]; then |
251 |
|
dnl In this case I should fix this thing including a "patch" |
252 |
|
dnl to access directly to the functions in the kernel :) --Orlando |
253 |
< |
AC_MSG_WARN([Cannot find kernel includes for CAM library, disabling SCSI support.]) |
253 |
> |
AC_MSG_WARN([Cannot find includes for CAM library, disabling SCSI support.]) |
254 |
|
else |
255 |
|
SCSISRC=FreeBSD/scsi_freebsd.cpp |
245 |
– |
CXXFLAGS="$CXXFLAGS -I/sys" |
246 |
– |
CFLAGS="$CFLAGS -I/sys" |
256 |
|
LIBS="$LIBS -lcam" |
257 |
|
DEFINES="$DEFINES -DCAM" |
258 |
|
fi |
259 |
|
fi |
260 |
|
;; |
252 |
– |
freebsd*) |
253 |
– |
DEFINES="$DEFINES -DBSD_COMP" |
254 |
– |
dnl Check for the SCSI library |
255 |
– |
AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no) |
256 |
– |
if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then |
257 |
– |
AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.]) |
258 |
– |
else |
259 |
– |
dnl Check for the sys kernel includes |
260 |
– |
AC_CHECK_HEADER(scsi.h sys/scsiio.h) |
261 |
– |
if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then |
262 |
– |
AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.]) |
263 |
– |
else |
264 |
– |
SCSISRC=FreeBSD/scsi_freebsd.cpp |
265 |
– |
LIBS="$LIBS -lscsi" |
266 |
– |
fi |
267 |
– |
fi |
268 |
– |
;; |
261 |
|
netbsd*) |
262 |
|
CAN_NATIVE_M68K=yes |
263 |
|
;; |
266 |
|
DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS" |
267 |
|
;; |
268 |
|
irix*) |
269 |
+ |
ETHERSRC=ether_unix.cpp |
270 |
|
AUDIOSRC=Irix/audio_irix.cpp |
271 |
|
EXTRASYSSRCS=Irix/unaligned.c |
272 |
|
dnl IRIX headers work fine, but somehow don't define or use "STDC_HEADERS" |
273 |
|
DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200 -DSTDC_HEADERS" |
274 |
|
LIBS="$LIBS -laudio" |
275 |
+ |
WANT_ESD=no |
276 |
+ |
|
277 |
+ |
dnl Check if our compiler supports -Ofast (MIPSPro) |
278 |
+ |
HAVE_OFAST=no |
279 |
+ |
ocflags="$CFLAGS" |
280 |
+ |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / -Ofast /;s/^-g /-Ofast /;s/-g$/ -Ofast/;s/^-g$/-Ofast/'` |
281 |
+ |
AC_MSG_CHECKING(if "-Ofast" works) |
282 |
+ |
dnl Do a test compile of an empty function |
283 |
+ |
AC_TRY_COMPILE(,, [AC_MSG_RESULT(yes); HAVE_OFAST=yes], AC_MSG_RESULT(no)) |
284 |
+ |
CFLAGS="$ocflags" |
285 |
+ |
|
286 |
|
;; |
287 |
|
esac |
288 |
|
|
307 |
|
dnl $1 -- the macro to define |
308 |
|
dnl $2 -- the value to translate |
309 |
|
AC_DEFUN(AC_TRANSLATE_DEFINE, [ |
310 |
< |
if [[ "x$2" = "xyes" ]]; then |
310 |
> |
if [[ "x$2" = "xyes" -o "x$2" = "xguessing yes" ]]; then |
311 |
|
AC_DEFINE($1) |
312 |
|
fi |
313 |
|
]) |
314 |
|
|
315 |
+ |
dnl Various checks if the system supports vm_allocate() and the like functions. |
316 |
+ |
have_mach_vm=no |
317 |
+ |
if [[ "x$ac_cv_func_vm_allocate" = "xyes" -a "x$ac_cv_func_vm_deallocate" = "xyes" -a \ |
318 |
+ |
"x$ac_cv_func_vm_protect" = "xyes" ]]; then |
319 |
+ |
have_mach_vm=yes |
320 |
+ |
fi |
321 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
322 |
+ |
|
323 |
+ |
dnl Check that vm_allocate(), vm_protect() work |
324 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
325 |
+ |
|
326 |
+ |
AC_CACHE_CHECK("whether vm_protect works", |
327 |
+ |
ac_cv_vm_protect_works, [ |
328 |
+ |
AC_LANG_SAVE |
329 |
+ |
AC_LANG_CPLUSPLUS |
330 |
+ |
ac_cv_vm_protect_works=yes |
331 |
+ |
dnl First the tests that should segfault |
332 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
333 |
+ |
AC_TRY_RUN([ |
334 |
+ |
#define CONFIGURE_TEST_VM_MAP |
335 |
+ |
#define TEST_VM_PROT_$test_def |
336 |
+ |
#include "vm_alloc.cpp" |
337 |
+ |
], ac_cv_vm_protect_works=no, rm -f core, |
338 |
+ |
dnl When cross-compiling, do not assume anything |
339 |
+ |
ac_cv_vm_protect_works="guessing no" |
340 |
+ |
) |
341 |
+ |
done |
342 |
+ |
AC_TRY_RUN([ |
343 |
+ |
#define CONFIGURE_TEST_VM_MAP |
344 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
345 |
+ |
#include "vm_alloc.cpp" |
346 |
+ |
], , ac_cv_vm_protect_works=no, |
347 |
+ |
dnl When cross-compiling, do not assume anything |
348 |
+ |
ac_cv_vm_protect_works="guessing no" |
349 |
+ |
) |
350 |
+ |
AC_LANG_RESTORE |
351 |
+ |
] |
352 |
+ |
) |
353 |
+ |
|
354 |
+ |
dnl Remove support for vm_allocate() if vm_protect() does not work |
355 |
+ |
if [[ "x$have_mach_vm" = "xyes" ]]; then |
356 |
+ |
case $ac_cv_vm_protect_works in |
357 |
+ |
*yes) have_mach_vm=yes;; |
358 |
+ |
*no) have_mach_vm=no;; |
359 |
+ |
esac |
360 |
+ |
fi |
361 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MACH_VM, "$have_mach_vm") |
362 |
+ |
|
363 |
+ |
fi dnl HAVE_MACH_VM |
364 |
+ |
|
365 |
+ |
dnl Various checks if the system supports mmap() and the like functions. |
366 |
+ |
dnl ... and Mach memory allocators are not supported |
367 |
+ |
have_mmap_vm=no |
368 |
+ |
if [[ "x$ac_cv_func_mmap" = "xyes" -a "x$ac_cv_func_munmap" = "xyes" -a \ |
369 |
+ |
"x$ac_cv_func_mprotect" = "xyes" ]]; then |
370 |
+ |
if [[ "x$have_mach_vm" = "xno" ]]; then |
371 |
+ |
have_mmap_vm=yes |
372 |
+ |
fi |
373 |
+ |
fi |
374 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, "$have_mmap_vm") |
375 |
+ |
|
376 |
+ |
dnl Check that mmap() and associated functions work. |
377 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
378 |
+ |
|
379 |
+ |
dnl Check if we have a working anonymous mmap() |
380 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANON", |
381 |
+ |
ac_cv_mmap_anon, [ |
382 |
+ |
AC_LANG_SAVE |
383 |
+ |
AC_LANG_CPLUSPLUS |
384 |
+ |
AC_TRY_RUN([ |
385 |
+ |
#define HAVE_MMAP_ANON |
386 |
+ |
#define CONFIGURE_TEST_VM_MAP |
387 |
+ |
#define TEST_VM_MMAP_ANON |
388 |
+ |
#include "vm_alloc.cpp" |
389 |
+ |
], ac_cv_mmap_anon=yes, ac_cv_mmap_anon=no, |
390 |
+ |
dnl When cross-compiling, do not assume anything. |
391 |
+ |
ac_cv_mmap_anon="guessing no" |
392 |
+ |
) |
393 |
+ |
AC_LANG_RESTORE |
394 |
+ |
] |
395 |
+ |
) |
396 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANON, "$ac_cv_mmap_anon") |
397 |
+ |
|
398 |
+ |
AC_CACHE_CHECK("whether mmap supports MAP_ANONYMOUS", |
399 |
+ |
ac_cv_mmap_anonymous, [ |
400 |
+ |
AC_LANG_SAVE |
401 |
+ |
AC_LANG_CPLUSPLUS |
402 |
+ |
AC_TRY_RUN([ |
403 |
+ |
#define HAVE_MMAP_ANONYMOUS |
404 |
+ |
#define CONFIGURE_TEST_VM_MAP |
405 |
+ |
#define TEST_VM_MMAP_ANON |
406 |
+ |
#include "vm_alloc.cpp" |
407 |
+ |
], ac_cv_mmap_anonymous=yes, ac_cv_mmap_anonymous=no, |
408 |
+ |
dnl When cross-compiling, do not assume anything. |
409 |
+ |
ac_cv_mmap_anonymous="guessing no" |
410 |
+ |
) |
411 |
+ |
AC_LANG_RESTORE |
412 |
+ |
] |
413 |
+ |
) |
414 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_ANONYMOUS, "$ac_cv_mmap_anonymous") |
415 |
+ |
|
416 |
+ |
AC_CACHE_CHECK("whether mprotect works", |
417 |
+ |
ac_cv_mprotect_works, [ |
418 |
+ |
AC_LANG_SAVE |
419 |
+ |
AC_LANG_CPLUSPLUS |
420 |
+ |
ac_cv_mprotect_works=yes |
421 |
+ |
dnl First the tests that should segfault |
422 |
+ |
for test_def in NONE_READ NONE_WRITE READ_WRITE; do |
423 |
+ |
AC_TRY_RUN([ |
424 |
+ |
#define CONFIGURE_TEST_VM_MAP |
425 |
+ |
#define TEST_VM_PROT_$test_def |
426 |
+ |
#include "vm_alloc.cpp" |
427 |
+ |
], ac_cv_mprotect_works=no, rm -f core, |
428 |
+ |
dnl When cross-compiling, do not assume anything |
429 |
+ |
ac_cv_mprotect_works="guessing no" |
430 |
+ |
) |
431 |
+ |
done |
432 |
+ |
AC_TRY_RUN([ |
433 |
+ |
#define CONFIGURE_TEST_VM_MAP |
434 |
+ |
#define TEST_VM_PROT_RDWR_WRITE |
435 |
+ |
#include "vm_alloc.cpp" |
436 |
+ |
], , ac_cv_mprotect_works=no, |
437 |
+ |
dnl When cross-compiling, do not assume anything |
438 |
+ |
ac_cv_mprotect_works="guessing no" |
439 |
+ |
) |
440 |
+ |
AC_LANG_RESTORE |
441 |
+ |
] |
442 |
+ |
) |
443 |
+ |
|
444 |
+ |
dnl Remove support for mmap() if mprotect() does not work |
445 |
+ |
if [[ "x$have_mmap_vm" = "xyes" ]]; then |
446 |
+ |
case $ac_cv_mprotect_works in |
447 |
+ |
*yes) have_mmap_vm=yes;; |
448 |
+ |
*no) have_mmap_vm=no;; |
449 |
+ |
esac |
450 |
+ |
fi |
451 |
+ |
AC_TRANSLATE_DEFINE(HAVE_MMAP_VM, $have_mmap_vm) |
452 |
+ |
|
453 |
+ |
fi dnl HAVE_MMAP_VM |
454 |
+ |
|
455 |
|
dnl Check if we can mmap 0x2000 bytes from 0x0000 |
456 |
|
AC_CACHE_CHECK("whether we can map Low Memory area 0x0000-0x2000", |
457 |
|
ac_cv_can_map_lm, [ |
458 |
|
AC_LANG_SAVE |
459 |
|
AC_LANG_CPLUSPLUS |
460 |
|
AC_TRY_RUN([ |
461 |
< |
#include <unistd.h> |
462 |
< |
#include <fcntl.h> |
463 |
< |
#include <sys/mman.h> |
464 |
< |
|
465 |
< |
int main() |
466 |
< |
{ int zero_fd; char * lm; |
467 |
< |
if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
468 |
< |
if ((lm = (char *)mmap((caddr_t)0x0000, 0x2000, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_PRIVATE, zero_fd, 0)) == MAP_FAILED) exit(1); |
325 |
< |
lm[0] = 0x12; |
326 |
< |
munmap(lm, 0x2000); |
327 |
< |
close(zero_fd); |
328 |
< |
exit(0); |
461 |
> |
#include "vm_alloc.cpp" |
462 |
> |
int main(void) { /* returns 0 if we could map the lowmem globals */ |
463 |
> |
volatile char * lm; |
464 |
> |
if (vm_init() < 0) exit(1); |
465 |
> |
if ((lm = (volatile char *)vm_acquire_fixed(0, 0x2000)) == VM_MAP_FAILED) exit(1); |
466 |
> |
lm[0] = 'z'; |
467 |
> |
if (vm_release((char *)lm, 0x2000) < 0) exit(1); |
468 |
> |
vm_exit(); exit(0); |
469 |
|
} |
470 |
< |
], |
471 |
< |
[ac_cv_can_map_lm=yes], |
472 |
< |
[ac_cv_can_map_lm=no] |
470 |
> |
], ac_cv_can_map_lm=yes, ac_cv_can_map_lm=no, |
471 |
> |
dnl When cross-compiling, do not assume anything. |
472 |
> |
ac_cv_can_map_lm="guessing no" |
473 |
|
) |
474 |
|
AC_LANG_RESTORE |
475 |
|
] |
476 |
|
) |
477 |
|
|
478 |
< |
dnl Check if extended signals are supported. |
479 |
< |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
480 |
< |
ac_cv_have_extended_signals, [ |
478 |
> |
dnl Check signal handlers need to be reinstalled |
479 |
> |
AC_CACHE_CHECK("whether signal handlers need to be reinstalled", |
480 |
> |
ac_cv_signal_need_reinstall, [ |
481 |
|
AC_LANG_SAVE |
482 |
|
AC_LANG_CPLUSPLUS |
483 |
|
AC_TRY_RUN([ |
344 |
– |
#include <unistd.h> |
484 |
|
#include <stdlib.h> |
485 |
+ |
#ifdef HAVE_UNISTD_H |
486 |
+ |
#include <unistd.h> |
487 |
+ |
#endif |
488 |
|
#include <signal.h> |
489 |
< |
#include <fcntl.h> |
490 |
< |
#include <sys/mman.h> |
491 |
< |
|
492 |
< |
static volatile caddr_t mem = 0; |
493 |
< |
static int zero_fd = -1; |
489 |
> |
static int handled_signal = 0; |
490 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
491 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
492 |
> |
signal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
493 |
> |
exit(handled_signal == 2); |
494 |
> |
} |
495 |
> |
], ac_cv_signal_need_reinstall=yes, ac_cv_signal_need_reinstall=no, |
496 |
> |
dnl When cross-compiling, do not assume anything. |
497 |
> |
ac_cv_signal_need_reinstall="guessing yes" |
498 |
> |
) |
499 |
> |
AC_LANG_RESTORE |
500 |
> |
] |
501 |
> |
) |
502 |
> |
AC_TRANSLATE_DEFINE(SIGNAL_NEED_REINSTALL, "$ac_cv_signal_need_reinstall") |
503 |
|
|
504 |
< |
static RETSIGTYPE segfault_handler(int, siginfo_t * sip, void *) |
505 |
< |
{ if ((caddr_t)(sip->si_addr) != mem) exit(1); |
506 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
507 |
< |
|
508 |
< |
int main() |
509 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
510 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
511 |
< |
struct sigaction sa; sa.sa_sigaction = segfault_handler; sa.sa_flags = SA_SIGINFO; |
512 |
< |
sigaction(SIGSEGV, &sa, 0); |
513 |
< |
mem[0] = 0; |
514 |
< |
exit(1); // should not be reached |
504 |
> |
dnl Check if sigaction handlers need to be reinstalled |
505 |
> |
AC_CACHE_CHECK("whether sigaction handlers need to be reinstalled", |
506 |
> |
ac_cv_sigaction_need_reinstall, [ |
507 |
> |
AC_LANG_SAVE |
508 |
> |
AC_LANG_CPLUSPLUS |
509 |
> |
AC_TRY_RUN([ |
510 |
> |
#include <stdlib.h> |
511 |
> |
#ifdef HAVE_UNISTD_H |
512 |
> |
#include <unistd.h> |
513 |
> |
#endif |
514 |
> |
#include <signal.h> |
515 |
> |
static int handled_signal = 0; |
516 |
> |
RETSIGTYPE sigusr1_handler(int) { handled_signal++; } |
517 |
> |
typedef RETSIGTYPE (*signal_handler)(int); |
518 |
> |
static signal_handler mysignal(int sig, signal_handler handler) { |
519 |
> |
struct sigaction old_sa; |
520 |
> |
struct sigaction new_sa; |
521 |
> |
new_sa.sa_handler = handler; |
522 |
> |
return ((sigaction(sig,&new_sa,&old_sa) < 0) ? SIG_IGN : old_sa.sa_handler); |
523 |
|
} |
524 |
< |
], |
525 |
< |
[ac_cv_have_extended_signals=yes], |
526 |
< |
[ac_cv_have_extended_signals=no] |
524 |
> |
int main(void) { /* returns 0 if signals need not to be reinstalled */ |
525 |
> |
mysignal(SIGUSR1, sigusr1_handler); raise(SIGUSR1); raise(SIGUSR1); |
526 |
> |
exit(handled_signal == 2); |
527 |
> |
} |
528 |
> |
], ac_cv_sigaction_need_reinstall=yes, ac_cv_sigaction_need_reinstall=no, |
529 |
> |
dnl When cross-compiling, do not assume anything. |
530 |
> |
ac_cv_sigaction_need_reinstall="guessing yes" |
531 |
> |
) |
532 |
> |
AC_LANG_RESTORE |
533 |
> |
] |
534 |
> |
) |
535 |
> |
AC_TRANSLATE_DEFINE(SIGACTION_NEED_REINSTALL, "$ac_cv_sigaction_need_reinstall") |
536 |
> |
|
537 |
> |
dnl Check if extended signals are supported. |
538 |
> |
AC_CACHE_CHECK("whether your system supports extended signal handlers", |
539 |
> |
ac_cv_have_extended_signals, [ |
540 |
> |
AC_LANG_SAVE |
541 |
> |
AC_LANG_CPLUSPLUS |
542 |
> |
AC_TRY_RUN([ |
543 |
> |
#define HAVE_SIGINFO_T 1 |
544 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
545 |
> |
#include "vm_alloc.cpp" |
546 |
> |
#include "sigsegv.cpp" |
547 |
> |
], ac_cv_have_extended_signals=yes, ac_cv_have_extended_signals=no, |
548 |
> |
dnl When cross-compiling, do not assume anything. |
549 |
> |
ac_cv_have_extended_signals=no |
550 |
|
) |
551 |
|
AC_LANG_RESTORE |
552 |
|
] |
555 |
|
|
556 |
|
dnl Otherwise, check for subterfuges. |
557 |
|
if [[ "x$ac_cv_have_extended_signals" = "xno" ]]; then |
558 |
< |
case "$target_os" in |
559 |
< |
linux*) |
560 |
< |
if [[ "x$HAVE_I386" = "xyes" ]]; then |
561 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
562 |
< |
ac_cv_have_sigcontext_hack, [ |
563 |
< |
AC_LANG_SAVE |
564 |
< |
AC_LANG_CPLUSPLUS |
565 |
< |
AC_TRY_RUN([ |
566 |
< |
#include <unistd.h> |
567 |
< |
#include <signal.h> |
568 |
< |
#include <fcntl.h> |
569 |
< |
#include <sys/mman.h> |
570 |
< |
|
571 |
< |
static volatile caddr_t mem = 0; |
572 |
< |
static int zero_fd = -1; |
573 |
< |
|
392 |
< |
static RETSIGTYPE segfault_handler(int, struct sigcontext scs) |
393 |
< |
{ if ((caddr_t)(scs.cr2) != mem) exit(1); |
394 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
395 |
< |
|
396 |
< |
int main() |
397 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
398 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
399 |
< |
struct sigaction sa; sa.sa_flags = 0; |
400 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
401 |
< |
sigaction(SIGSEGV, &sa, 0); |
402 |
< |
mem[0] = 0; |
403 |
< |
exit(1); // should not be reached |
404 |
< |
} |
405 |
< |
], |
406 |
< |
[ac_cv_have_sigcontext_hack=yes], |
407 |
< |
[ac_cv_have_sigcontext_hack=no] |
408 |
< |
) |
409 |
< |
AC_LANG_RESTORE |
410 |
< |
]) |
411 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
412 |
< |
elif [[ "x$HAVE_POWERPC" = "xyes" ]]; then |
413 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
414 |
< |
ac_cv_have_sigcontext_hack, [ |
415 |
< |
AC_LANG_SAVE |
416 |
< |
AC_LANG_CPLUSPLUS |
417 |
< |
AC_TRY_RUN([ |
418 |
< |
#include <unistd.h> |
419 |
< |
#include <signal.h> |
420 |
< |
#include <fcntl.h> |
421 |
< |
#include <sys/mman.h> |
422 |
< |
|
423 |
< |
static volatile caddr_t mem = 0; |
424 |
< |
static int zero_fd = -1; |
425 |
< |
|
426 |
< |
static RETSIGTYPE segfault_handler(int, struct sigcontext_struct *scs) |
427 |
< |
{ if ((caddr_t)(scs->regs->dar) != mem) exit(1); |
428 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
429 |
< |
|
430 |
< |
int main() |
431 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
432 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
433 |
< |
struct sigaction sa; sa.sa_flags = 0; |
434 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
435 |
< |
sigaction(SIGSEGV, &sa, 0); |
436 |
< |
mem[0] = 0; |
437 |
< |
exit(1); // should not be reached |
438 |
< |
} |
439 |
< |
], |
440 |
< |
[ac_cv_have_sigcontext_hack=yes], |
441 |
< |
[ac_cv_have_sigcontext_hack=no] |
442 |
< |
) |
443 |
< |
AC_LANG_RESTORE |
444 |
< |
]) |
445 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
446 |
< |
fi |
447 |
< |
;; |
448 |
< |
netbsd*) |
449 |
< |
if [[ "x$HAVE_M68K" = "xyes" ]]; then |
450 |
< |
AC_CACHE_CHECK("whether we then have a subterfuge for your system", |
451 |
< |
ac_cv_have_sigcontext_hack, [ |
452 |
< |
AC_LANG_SAVE |
453 |
< |
AC_LANG_CPLUSPLUS |
454 |
< |
AC_TRY_RUN([ |
455 |
< |
#include <unistd.h> |
456 |
< |
#include <signal.h> |
457 |
< |
#include <fcntl.h> |
458 |
< |
#include <sys/mman.h> |
459 |
< |
|
460 |
< |
static volatile caddr_t mem = 0; |
461 |
< |
static int zero_fd = -1; |
462 |
< |
|
463 |
< |
static RETSIGTYPE segfault_handler(int, int code) |
464 |
< |
{ if ((caddr_t)code != mem) exit(1); |
465 |
< |
munmap(mem, getpagesize()); close(zero_fd); exit(0); } |
466 |
< |
|
467 |
< |
int main() |
468 |
< |
{ if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1); |
469 |
< |
if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1); |
470 |
< |
struct sigaction sa; sa.sa_flags = 0; |
471 |
< |
sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler; |
472 |
< |
sigaction(SIGSEGV, &sa, 0); |
473 |
< |
mem[0] = 0; |
474 |
< |
exit(1); // should not be reached |
475 |
< |
} |
476 |
< |
], |
477 |
< |
[ac_cv_have_sigcontext_hack=yes], |
478 |
< |
[ac_cv_have_sigcontext_hack=no] |
479 |
< |
) |
480 |
< |
AC_LANG_RESTORE |
481 |
< |
]) |
482 |
< |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack) |
483 |
< |
fi |
484 |
< |
;; |
485 |
< |
esac |
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 |
> |
#define HAVE_SIGCONTEXT_SUBTERFUGE 1 |
564 |
> |
#define CONFIGURE_TEST_SIGSEGV_RECOVERY |
565 |
> |
#include "vm_alloc.cpp" |
566 |
> |
#include "sigsegv.cpp" |
567 |
> |
], ac_cv_have_sigcontext_hack=yes, ac_cv_have_sigcontext_hack=no, |
568 |
> |
dnl When cross-compiling, do not assume anything. |
569 |
> |
ac_cv_have_sigcontext_hack=no |
570 |
> |
) |
571 |
> |
AC_LANG_RESTORE |
572 |
> |
]) |
573 |
> |
AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, "$ac_cv_have_sigcontext_hack") |
574 |
|
fi |
575 |
|
|
576 |
|
dnl Can we do Video on SEGV Signals ? |
653 |
|
#endif |
654 |
|
], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no)) |
655 |
|
|
656 |
+ |
dnl Check for GCC 3.0 or higher. |
657 |
+ |
HAVE_GCC30=no |
658 |
+ |
AC_MSG_CHECKING(for GCC 3.0 or higher) |
659 |
+ |
AC_EGREP_CPP(yes, |
660 |
+ |
[#if __GNUC__ >= 3 |
661 |
+ |
yes |
662 |
+ |
#endif |
663 |
+ |
], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no)) |
664 |
+ |
|
665 |
|
dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher. |
666 |
|
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
667 |
|
CFLAGS="$CFLAGS -fomit-frame-pointer" |
668 |
|
CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" |
669 |
|
fi |
670 |
|
|
671 |
+ |
dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp. |
672 |
+ |
dnl As of 2001/08/02, this affects the following compilers: |
673 |
+ |
dnl Official: probably gcc-3.1 (mainline CVS) |
674 |
+ |
dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk |
675 |
+ |
dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1 |
676 |
+ |
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
677 |
+ |
SAVED_CXXFLAGS="$CXXFLAGS" |
678 |
+ |
CXXFLAGS="$CXXFLAGS -fno-merge-constants" |
679 |
+ |
AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [ |
680 |
+ |
AC_LANG_SAVE |
681 |
+ |
AC_LANG_CPLUSPLUS |
682 |
+ |
AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no]) |
683 |
+ |
AC_LANG_RESTORE |
684 |
+ |
]) |
685 |
+ |
if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then |
686 |
+ |
CXXFLAGS="$SAVED_CXXFLAGS" |
687 |
+ |
fi |
688 |
+ |
fi |
689 |
+ |
|
690 |
|
dnl Select appropriate CPU source and REGPARAM define. |
691 |
|
ASM_OPTIMIZATIONS=none |
692 |
|
CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp" |
693 |
< |
FPUSRCS="../uae_cpu/fpp.cpp" |
694 |
< |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then |
693 |
> |
FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp" |
694 |
> |
if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then |
695 |
|
dnl i386 CPU |
696 |
|
DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\"" |
697 |
|
if [[ "x$HAVE_GAS" = "xyes" ]]; then |
737 |
|
DEFINES="$DEFINES -DFPU_X86" |
738 |
|
FPE_CORE_STR="i386 optimized core" |
739 |
|
FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp" |
740 |
+ |
FPE_CORE="i386" |
741 |
|
else |
742 |
|
FPE_CORE="uae" |
743 |
|
fi |
778 |
|
|
779 |
|
dnl Remove the "-g" option if set for GCC. |
780 |
|
if [[ "x$HAVE_GCC27" = "xyes" ]]; then |
781 |
< |
dnl gb-- Probably not the cleanest way to take |
782 |
< |
CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
783 |
< |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'` |
781 |
> |
CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'` |
782 |
> |
CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'` |
783 |
> |
fi |
784 |
> |
|
785 |
> |
dnl Or if we have -Ofast |
786 |
> |
if [[ "x$HAVE_OFAST" = "xyes" ]]; then |
787 |
> |
CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast" |
788 |
> |
CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast" |
789 |
> |
CXXFLAGS="-LANG:std $CXXFLAGS" |
790 |
> |
LDFLAGS="$LDFLAGS -Ofast" |
791 |
|
fi |
792 |
|
|
793 |
|
dnl Generate Makefile. |