ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/configure.in
(Generate patch)

Comparing BasiliskII/src/Unix/configure.in (file contents):
Revision 1.24 by cebix, 2000-09-25T17:54:01Z vs.
Revision 1.47 by gbeauche, 2001-08-19T16:18:30Z

# Line 9 | Line 9 | dnl Options.
9   AC_ARG_ENABLE(xf86-dga,      [  --enable-xf86-dga       use the XFree86 DGA extension [default=yes]], [WANT_XF86_DGA=$enableval], [WANT_XF86_DGA=yes])
10   AC_ARG_ENABLE(xf86-vidmode,  [  --enable-xf86-vidmode   use the XFree86 VidMode extension [default=yes]], [WANT_XF86_VIDMODE=$enableval], [WANT_XF86_VIDMODE=yes])
11   AC_ARG_ENABLE(fbdev-dga,     [  --enable-fbdev-dga      use direct frame buffer access via /dev/fb [default=yes]], [WANT_FBDEV_DGA=$enableval], [WANT_FBDEV_DGA=yes])
12 < AC_ARG_ENABLE(vosf,          [  --enable-vosf           enable video on SEGV signals [default=yes]], [WANT_VOSF=$enableval], [WANT_VOSF=no])
13 < AC_ARG_ENABLE(16bit-vidmode, [  --enable-16bit-vidmode  enable 16-bit video if possible [default=yes]], [WANT_16BIT_VIDMODE=$enableval], [WANT_16BIT_VIDMODE=yes])
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,
28 < [  --enable-addressing=mode specify the addressing mode to use [default=fastest]],
28 > [  --enable-addressing=AM  specify the addressing mode to use [default=fastest]],
29   [ case "$enableval" in
30      real)       ADDRESSING_TEST_ORDER="real";;
31      direct)     ADDRESSING_TEST_ORDER="direct";;
32      banks)      ADDRESSING_TEST_ORDER="banks";;
33 < dnl fastest)    ADDRESSING_TEST_ORDER="real direct banks";; gb-- will enable later...
34 <    fastest)    ADDRESSING_TEST_ORDER="direct banks";;
22 <    *)          AC_MSG_ERROR([--enable-mem-addressing takes only one of the following values: fastest, real, direct, banks]);;
33 >    fastest)ADDRESSING_TEST_ORDER="direct banks";;
34 >    *)          AC_MSG_ERROR([--enable-addressing takes only one of the following values: fastest, real, direct, banks]);;
35    esac
36   ],
25 dnl [ ADDRESSING_TEST_ORDER="real direct banks" gb-- will probably reactivate later
37   [ ADDRESSING_TEST_ORDER="direct banks"
38   ])
39 +
40 + dnl External packages.
41   AC_ARG_WITH(esd,             [  --with-esd              support ESD for sound under Linux/FreeBSD [default=yes]], [WANT_ESD=$withval], [WANT_ESD=yes])
42   AC_ARG_WITH(gtk,             [  --with-gtk              use GTK user interface [default=yes]], [WANT_GTK=$withval], [WANT_GTK=yes])
43   AC_ARG_WITH(mon,             [  --with-mon              use mon as debugger [default=yes]], [WANT_MON=$withval], [WANT_MON=yes])
# Line 39 | Line 52 | case "$target_os" in
52    netbsd*)      OS_TYPE=netbsd;;
53    freebsd*)     OS_TYPE=freebsd;;
54    solaris*)     OS_TYPE=solaris;;
55 <  *)            OS_TYPE=`echo $target_os | 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  
# Line 47 | Line 61 | dnl Target CPU type.
61   HAVE_I386=no
62   HAVE_M68K=no
63   HAVE_SPARC=no
64 + HAVE_POWERPC=no
65   case "$target_cpu" in
66    i386* | i486* | i586* | i686* | i786* ) CPU_TYPE=i386 HAVE_I386=yes;;
67    m68k* ) CPU_TYPE=m68k HAVE_M68K=yes;;
68    sparc* ) CPU_TYPE=sparc HAVE_SPARC=yes;;
69 <  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/'`;;
69 >  powerpc* ) CPU_TYPE=powerpc HAVE_POWERPC=yes;;
70 >  *) CPU_TYPE=`echo $target_cpu | sed -e 's/-/_/g'`;;
71   esac
72   DEFINES="$DEFINES -DCPU_$CPU_TYPE"
73  
# Line 71 | Line 87 | if [[ "x$WANT_MON" = "xyes" ]]; then
87    if grep mon_init $mon_srcdir/mon.h >/dev/null 2>/dev/null; then
88      AC_MSG_RESULT(yes)
89      AC_DEFINE(ENABLE_MON)
90 <    MONSRCS="$mon_srcdir/mon.cpp $mon_srcdir/mon_6502.cpp $mon_srcdir/mon_8080.cpp $mon_srcdir/mon_cmd.cpp $mon_srcdir/mon_disass.cpp $mon_srcdir/mon_ppc.cpp $mon_srcdir/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
90 >    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/disass/floatformat.c $mon_srcdir/disass/i386-dis.c $mon_srcdir/disass/m68k-dis.c $mon_srcdir/disass/m68k-opc.c"
91      CXXFLAGS="$CXXFLAGS -I$mon_srcdir -I$mon_srcdir/disass"
92      AC_CHECK_LIB(readline, readline)
93      AC_CHECK_LIB(termcap, tputs)
# Line 85 | Line 101 | fi
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
# Line 112 | Line 129 | AC_CHECK_FUNCS(pthread_cancel)
129   dnl If POSIX.4 semaphores are not available, we emulate them with pthread mutexes.
130   SEMSRC=
131   AC_CHECK_FUNCS(sem_init, , [
132 <  if [ "x$HAVE_PTHREADS" = "xyes" ]; then
132 >  if test "x$HAVE_PTHREADS" = "xyes"; then
133      SEMSRC=posix_sem.cpp
134    fi
135   ])
# Line 176 | Line 193 | fi
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
# Line 197 | Line 214 | AC_STRUCT_TM
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
# Line 204 | Line 227 | ETHERSRC=../dummy/ether_dummy.cpp
227   SCSISRC=../dummy/scsi_dummy.cpp
228   AUDIOSRC=../dummy/audio_dummy.cpp
229   EXTRASYSSRCS=
230 < SUPPORTS_NATIVE_M68K=no
230 > CAN_NATIVE_M68K=no
231   case "$target_os" in
232   linux*)
233 <  ETHERSRC=Linux/ether_linux.cpp
211 <  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
230      CXXFLAGS="$CXXFLAGS -I/sys"
231      CFLAGS="$CFLAGS -I/sys"
255        LIBS="$LIBS -lcam"
256        DEFINES="$DEFINES -DCAM"
257      fi
258    fi
259    ;;
237 freebsd*)
238  DEFINES="$DEFINES -DBSD_COMP"
239  dnl Check for the SCSI library
240  AC_CHECK_LIB(scsi, scsi_open, HAVE_LIBSCSI=yes, HAVE_LIBSCSI=no)
241  if [[ "x$HAVE_LIBSCSI" = "xno" ]]; then
242    AC_MSG_WARN([Cannot find libscsi for SCSI management, disabling SCSI support.])
243  else
244    dnl Check for the sys kernel includes
245    AC_CHECK_HEADER(scsi.h sys/scsiio.h)
246    if [[ "x$ac_cv_header_scsi_h" = "xno" ]]; then
247      AC_MSG_WARN([Cannot find includes for the SCSI library, disabling SCSI support.])
248    else
249      SCSISRC=FreeBSD/scsi_freebsd.cpp
250      LIBS="$LIBS -lscsi"
251    fi
252  fi
253  ;;
260   netbsd*)
261 <  SUPPORTS_NATIVE_M68K=yes
261 >  CAN_NATIVE_M68K=yes
262    ;;
263   solaris*)
264    AUDIOSRC=Solaris/audio_solaris.cpp
265    DEFINES="$DEFINES -DBSD_COMP -D_POSIX_PTHREAD_SEMANTICS"
266    ;;
267   irix*)
268 +  AUDIOSRC=Irix/audio_irix.cpp
269    EXTRASYSSRCS=Irix/unaligned.c
270 <  DEFINES="$DEFINES -DCRTSCTS=CNEW_RTSCTS -DB230400=B115200"
271 <  LIBS="$LIBS -lm"
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  
286 + dnl Use 68k CPU natively?
287 + WANT_NATIVE_M68K=no
288 + if [[ "x$HAVE_M68K" = "xyes" -a "x$CAN_NATIVE_M68K" = "xyes" ]]; then
289 +  AC_DEFINE(ENABLE_NATIVE_M68K)
290 +  WANT_NATIVE_M68K=yes
291 + fi
292 +
293   if [[ "x$HAVE_PTHREADS" = "xno" ]]; then
294    dnl Serial, ethernet and audio support needs pthreads
295    AC_MSG_WARN([You don't have pthreads, disabling serial, ethernet and audio support.])
# Line 279 | Line 304 | dnl to be put into the config.h file
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);
301 <      lm[0] = 0x12;
302 <          munmap(lm, 0x2000);
303 <      close(zero_fd);
304 <      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([
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 = 0;
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    ]
# Line 348 | Line 552 | AC_TRANSLATE_DEFINE(HAVE_SIGINFO_T, "$ac
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 <
367 <            static RETSIGTYPE segfault_handler(int, struct sigcontext scs)
368 <            { if ((caddr_t)(scs.cr2) != mem) exit(1);
369 <              munmap(mem, getpagesize()); close(zero_fd); exit(0); }
370 <
371 <            int main()
372 <            { if ((zero_fd = open("/dev/zero", O_RDWR)) < 0) exit(1);
373 <              if ((mem = (caddr_t)mmap(0, getpagesize(), PROT_READ, MAP_PRIVATE, zero_fd, 0)) == (caddr_t)MAP_FAILED) exit(1);
374 <              struct sigaction sa; sa.sa_flags = 0;
375 <                          sa.sa_handler = (RETSIGTYPE (*)(int))segfault_handler;
376 <              sigaction(SIGSEGV, &sa, 0);
377 <              mem[0] = 0;
378 <              exit(1); // should not be reached
379 <            }
380 <          ],
381 <          [ac_cv_have_sigcontext_hack=yes],
382 <          [ac_cv_have_sigcontext_hack=no]
383 <          )
384 <          AC_LANG_RESTORE
385 <        ])
386 <                AC_TRANSLATE_DEFINE(HAVE_SIGCONTEXT_SUBTERFUGE, $ac_cv_have_sigcontext_hack)
387 <      fi
388 <    ;;
389 <  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 ?
# Line 396 | Line 577 | if [[ "$ac_cv_have_extended_signals" = "
577   fi
578  
579   dnl Determine the addressing mode to use
580 < ADDRESSING_MODE=""
581 < AC_MSG_CHECKING([for the addressing mode to use])
582 < for am in $ADDRESSING_TEST_ORDER; do
583 <  case $am in
584 <  real)
585 <    dnl Requires ability to mmap Low Memory globals.
586 <    if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
587 <      continue
588 <    fi
589 <    if [[ "x$ac_cv_c_bigendian" = "xyes" ]]; then
590 <      dnl Requires only VOSF if 16-bit vidmode enable
410 <      if [[ "x$WANT_16BIT_VIDMODE" = "xyes" ]]; then
411 <        if [[ "x$CAN_VOSF" = "xno" ]]; then
412 <          continue
413 <        fi
414 <      else
415 <        DEFINES="$DEFINES -DDISABLE_16BIT_VIDMODE"
580 > if [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
581 >  ADDRESSING_MODE="real"
582 > else
583 >  ADDRESSING_MODE=""
584 >  AC_MSG_CHECKING([for the addressing mode to use])
585 >  for am in $ADDRESSING_TEST_ORDER; do
586 >    case $am in
587 >    real)
588 >      dnl Requires ability to mmap() Low Memory globals
589 >      if [[ "x$ac_cv_can_map_lm" = "xno" ]]; then
590 >        continue
591        fi
592 <    else
418 <      dnl Requires VOSF
592 >          dnl Requires VOSF screen updates
593        if [[ "x$CAN_VOSF" = "xno" ]]; then
594          continue
595        fi
596 <    fi
597 <    dnl Real addressing will probably work
424 <    ADDRESSING_MODE="real"
425 <    WANT_VOSF=yes dnl we can use VOSF and we need it actually
426 <    DEFINES="$DEFINES -DREAL_ADDRESSING"
427 <    break
428 <    ;;
429 <  direct)
430 <    dnl Requires VOSF
431 <    if [[ "x$CAN_VOSF" = "xyes" ]]; then
432 <      ADDRESSING_MODE="direct"
596 >      dnl Real addressing will probably work.
597 >      ADDRESSING_MODE="real"
598        WANT_VOSF=yes dnl we can use VOSF and we need it actually
599 <      DEFINES="$DEFINES -DDIRECT_ADDRESSING"
599 >      DEFINES="$DEFINES -DREAL_ADDRESSING"
600        break
601 <    fi
602 <    ;;
603 <  banks)
604 <    dnl Default addressing mode
601 >      ;;
602 >    direct)
603 >      dnl Requires VOSF screen updates
604 >      if [[ "x$CAN_VOSF" = "xyes" ]]; then
605 >        ADDRESSING_MODE="direct"
606 >        WANT_VOSF=yes dnl we can use VOSF and we need it actually
607 >        DEFINES="$DEFINES -DDIRECT_ADDRESSING"
608 >        break
609 >      fi
610 >      ;;
611 >    banks)
612 >      dnl Default addressing mode
613 >      ADDRESSING_MODE="memory banks"
614 >      break
615 >      ;;
616 >    *)
617 >      AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
618 >    esac
619 >  done
620 >  AC_MSG_RESULT($ADDRESSING_MODE)
621 >  if [[ "x$ADDRESSING_MODE" = "x" ]]; then
622 >    AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
623      ADDRESSING_MODE="memory banks"
624 <    break
442 <    ;;
443 <  *)
444 <    AC_MSG_ERROR([Internal configure.in script error for $am addressing mode])
445 <  esac
446 < done
447 < AC_MSG_RESULT($ADDRESSING_MODE)
448 < if [[ "x$ADDRESSING_MODE" = "x" ]]; then
449 <  AC_MSG_WARN([Sorry, no suitable addressing mode in $ADDRESSING_TEST_ORDER])
450 <  ADDRESSING_MODE="memory banks"
624 >  fi
625   fi
626  
627 < dnl Since real and direct addressing modes automatically activate VOSF,
628 < dnl I put this test here.
455 < if [[ "x$WANT_VOSF" = "xyes" ]]; then
456 <  if [[ "x$CAN_VOSF" = "xno" ]]; then
457 <    AC_MSG_WARN([Sorry, your system does not support Video on SEGV signals])
458 <    WANT_VOSF=no
459 <  else
627 > dnl Enable VOSF screen updates with this feature is requested and feasible
628 > if [[ "x$WANT_VOSF" = "xyes" -a "x$CAN_VOSF" = "xyes" ]]; then
629      AC_DEFINE(ENABLE_VOSF)
630 <  fi
630 > else
631 >    WANT_VOSF=no
632   fi
633  
634   dnl Check for GAS.
# Line 480 | Line 650 | AC_EGREP_CPP(yes,
650   #endif
651   ], [AC_MSG_RESULT(yes); HAVE_GCC27=yes], AC_MSG_RESULT(no))
652  
653 + dnl Check for GCC 3.0 or higher.
654 + HAVE_GCC30=no
655 + AC_MSG_CHECKING(for GCC 3.0 or higher)
656 + AC_EGREP_CPP(yes,
657 + [#if __GNUC__ >= 3
658 +  yes
659 + #endif
660 + ], [AC_MSG_RESULT(yes); HAVE_GCC30=yes], AC_MSG_RESULT(no))
661 +
662   dnl Set "-fomit-frame-pointer" on i386 GCC 2.7 or higher.
663   if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
664    CFLAGS="$CFLAGS -fomit-frame-pointer"
665    CXXFLAGS="$CXXFLAGS -fomit-frame-pointer"
666   fi
667  
668 + dnl (gb) Do not merge constants since it breaks fpu/fpu_x86.cpp.
669 + dnl As of 2001/08/02, this affects the following compilers:
670 + dnl Official: probably gcc-3.1 (mainline CVS)
671 + dnl Mandrake: gcc-2.96 >= 0.59mdk, gcc-3.0.1 >= 0.1mdk
672 + dnl Red Hat : gcc-2.96 >= 89, gcc-3.0 >= 1
673 + if [[ "x$HAVE_GCC27" = "xyes" ]]; then
674 +  SAVED_CXXFLAGS="$CXXFLAGS"
675 +  CXXFLAGS="$CXXFLAGS -fno-merge-constants"
676 +  AC_CACHE_CHECK([whether GCC supports constants merging], ac_cv_gcc_constants_merging, [
677 +    AC_LANG_SAVE
678 +    AC_LANG_CPLUSPLUS
679 +    AC_TRY_COMPILE([],[],[ac_cv_gcc_constants_merging=yes],[ac_cv_gcc_constants_merging=no])
680 +    AC_LANG_RESTORE
681 +  ])
682 +  if [[ "x$ac_cv_gcc_constants_merging" != "xyes" ]]; then
683 +    CXXFLAGS="$SAVED_CXXFLAGS"
684 +  fi
685 + fi
686 +
687   dnl Select appropriate CPU source and REGPARAM define.
688   ASM_OPTIMIZATIONS=none
491 WANT_NATIVE_M68K=no
689   CPUSRCS="cpuemu1.cpp cpuemu2.cpp cpuemu3.cpp cpuemu4.cpp cpuemu5.cpp cpuemu6.cpp cpuemu7.cpp cpuemu8.cpp"
690 < FPUSRCS="../uae_cpu/fpp.cpp"
691 < if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" ]]; then
690 > FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
691 > if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$OS_TYPE" != "xfreebsd" ]]; then
692    dnl i386 CPU
693    DEFINES="$DEFINES -DREGPARAM=\"__attribute__((regparm(3)))\""
694    if [[ "x$HAVE_GAS" = "xyes" ]]; then
695      ASM_OPTIMIZATIONS=i386
696 <    DEFINES="$DEFINES -DX86_ASSEMBLY -DOPTFLAGS"
697 <    CPUSRCS="../uae_cpu/compiler.cpp cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
696 >    DEFINES="$DEFINES -DX86_ASSEMBLY -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS"
697 >    CPUSRCS="cpufast1.s cpufast2.s cpufast3.s cpufast4.s cpufast5.s cpufast6.s cpufast7.s cpufast8.s"
698      FPUSRCS="../uae_cpu/fpu_x86.cpp"
699    fi
700   elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_SPARC" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
# Line 509 | Line 706 | elif [[ "x$HAVE_GCC27" = "xyes" -a "x$HA
706      AC_MSG_RESULT($SPARC_TYPE)
707      case "$SPARC_TYPE" in
708      SPARC_V8)
709 <          ASM_OPTIMIZATIONS="SPARC V8 architecture"
710 <      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTFLAGS"
709 >      ASM_OPTIMIZATIONS="SPARC V8 architecture"
710 >      DEFINES="$DEFINES -DSPARC_V8_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
711        CFLAGS="$CFLAGS -Wa,-Av8"
712        CXXFLAGS="$CXXFLAGS -Wa,-Av8"
713        ;;
714      SPARC_V9)
715 <          ASM_OPTIMIZATIONS="SPARC V9 architecture"
716 <      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTFLAGS"
715 >      ASM_OPTIMIZATIONS="SPARC V9 architecture"
716 >      DEFINES="$DEFINES -DSPARC_V9_ASSEMBLY" dnl -DOPTIMIZED_FLAGS"
717        CFLAGS="$CFLAGS -Wa,-Av9"
718        CXXFLAGS="$CXXFLAGS -Wa,-Av9"
719        ;;
720      esac
721      ;;
722    esac
723 < elif [[ "x$HAVE_M68K" = "xyes" -a "x$SUPPORTS_NATIVE_M68K" = "xyes" ]]; then
723 > elif [[ "x$WANT_NATIVE_M68K" = "xyes" ]]; then
724    dnl Native m68k, no emulation
725 <  CPUSRCS=""
726 <  AC_DEFINE(ENABLE_NATIVE_M68K)
530 <  WANT_NATIVE_M68K=yes
725 >  CPUINCLUDES="-I../native_cpu"
726 >  CPUSRCS="asm_support.s"
727   fi
728  
729 + dnl Select appropriate FPU source.
730 + dnl 1. Optimized X86 assembly core if target is i386 architecture
731 + SAVED_DEFINES=$DEFINES
732 + if [[ "x$FPE_CORE" = "xdefault" ]]; then
733 +  if [[ "x$HAVE_GCC27" = "xyes" -a "x$HAVE_I386" = "xyes" -a "x$HAVE_GAS" = "xyes" ]]; then
734 +    DEFINES="$DEFINES -DFPU_X86"
735 +    FPE_CORE_STR="i386 optimized core"
736 +    FPUSRCS="../uae_cpu/fpu/fpu_x86.cpp"
737 +    FPE_CORE="i386"
738 +  else
739 +    FPE_CORE="uae"
740 +  fi
741 + fi
742 +
743 + dnl 2. JIT-FPU only supports IEEE-based implementation.
744 + if [[ "x$WANT_JIT_FPU" = "xyes" -a "x$FPE_CORE" != "xieee" ]]; then
745 +  AC_MSG_WARN([Sorry, JIT-FPU supports only the "ieee" FPE implementation])
746 +  FPE_CORE="ieee"
747 +  dnl Restore previous variables. FPE_CORE_STR and FPUSRCS are overwritten
748 +  DEFINES=$SAVED_DEFINES
749 + fi
750 +
751 + dnl 3. Choose either IEEE-based implementation or the old UAE core
752 + if [[ "x$FPE_CORE" = "xieee" ]]; then
753 +  AC_CHECK_HEADERS(fenv.h)
754 +  AC_CHECK_FUNCS(feclearexcept fegetexceptflag feraiseexcept fesetexceptflag fetestexcept)
755 +  AC_CHECK_FUNCS(fegetround fesetround)
756 +  DEFINES="$DEFINES -DFPU_IEEE"
757 +  FPE_CORE_STR="ieee-based fpu core"
758 +  FPUSRCS="../uae_cpu/fpu/fpu_ieee.cpp"
759 + elif [[ "x$FPE_CORE" = "xuae" ]]; then
760 +  DEFINES="$DEFINES -DFPU_UAE"
761 +  FPE_CORE_STR="original uae core"
762 +  FPUSRCS="../uae_cpu/fpu/fpu_uae.cpp"
763 + fi
764 +
765 + dnl Check for certain math functions
766 + AC_CHECK_FUNCS(atanh)
767 + AC_CHECK_FUNCS(isnan isinf)             dnl C99
768 + AC_CHECK_FUNCS(isnanl isinfl)   dnl IEEE ?
769 +
770   dnl UAE CPU sources for all non-m68k-native architectures.
771   if [[ "x$WANT_NATIVE_M68K" = "xno" ]]; then
772    CPUINCLUDES="-I../uae_cpu"
773    CPUSRCS="../uae_cpu/basilisk_glue.cpp ../uae_cpu/memory.cpp ../uae_cpu/newcpu.cpp ../uae_cpu/readcpu.cpp $FPUSRCS cpustbl.cpp cpudefs.cpp $CPUSRCS"
537 else
538  CPUINCLUDES="-I../native_cpu"
539  CPUSRCS="asm_support.s"
774   fi
775  
776   dnl Remove the "-g" option if set for GCC.
777   if [[ "x$HAVE_GCC27" = "xyes" ]]; then
778 <        dnl gb-- Probably not the cleanest way to take
779 <        CFLAGS=`echo $CFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
780 <        CXXFLAGS=`echo $CXXFLAGS | sed -e 's/ -g / /;s/^-g / /;s/ -g$/ /;s/^-g$//'`
778 >  CFLAGS=`echo $CFLAGS | sed -e 's/-g//g'`
779 >  CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-g//g'`
780 > fi
781 >
782 > dnl Or if we have -Ofast
783 > if [[ "x$HAVE_OFAST" = "xyes" ]]; then
784 >  CFLAGS="`echo $CFLAGS | sed -e 's/-g//g'` -Ofast"
785 >  CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-g//g'` -Ofast"
786 >  CXXFLAGS="-LANG:std $CXXFLAGS"
787 >  LDFLAGS="$LDFLAGS -Ofast"
788   fi
789  
790   dnl Generate Makefile.
# Line 565 | Line 806 | echo ESD sound support ................
806   echo GTK user interface ............... : $WANT_GTK
807   echo mon debugger support ............. : $WANT_MON
808   echo Running m68k code natively ....... : $WANT_NATIVE_M68K
809 + echo Floating-Point emulation core .... : $FPE_CORE_STR
810   echo Assembly optimizations ........... : $ASM_OPTIMIZATIONS
811   echo Addressing mode .................. : $ADDRESSING_MODE
812   echo

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines